You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

3 lines
1.4 MiB

This file contains invisible Unicode characters!

This file contains invisible Unicode characters that may be processed differently from what appears below. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to reveal hidden characters.

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

/*! For license information please see vendors~element-web-app.js.LICENSE.txt */
(window.webpackJsonp=window.webpackJsonp||[]).push([[29],{1451:function(e,t,a){"use strict";(function(e){var t=a(136);if(e.__js_sdk_entrypoint)throw new Error("Multiple matrix-js-sdk entrypoints detected!");let n;e.__js_sdk_entrypoint=!0;try{n=e.indexedDB}catch(e){}n&&t.setCryptoStoreFactory((()=>new t.IndexedDBCryptoStore(n,"matrix-js-sdk:crypto")));e.matrixcs=t}).call(this,a(14))},1452:function(e,t,a){"use strict";var n=a(13),i=a.n(n),s=a(1),r=a(122),o=a(124),l=a(329);var c;!function(e){e.Online="online",e.Offline="offline",e.Unavailable="unavailable"}(c||(c={}));t.a=new class{constructor(){i()(this,"unavailableTimer",null),i()(this,"dispatcherRef",null),i()(this,"state",null),i()(this,"onAction",(e=>{var t;"user_activity"===e.action&&(this.setState(c.Online),null===(t=this.unavailableTimer)||void 0===t||t.restart())}))}async start(){for(this.unavailableTimer=new l.a(18e4),this.dispatcherRef=o.a.register(this.onAction);this.unavailableTimer;)try{await this.unavailableTimer.finished(),this.setState(c.Unavailable)}catch(e){}}stop(){this.dispatcherRef&&(o.a.unregister(this.dispatcherRef),this.dispatcherRef=null),this.unavailableTimer&&(this.unavailableTimer.abort(),this.unavailableTimer=null)}getState(){return this.state}async setState(e){if(e===this.state)return;const t=this.state;if(this.state=e,!r.a.get().isGuest())try{await r.a.get().setPresence({presence:this.state}),s.a.info("Presence:",e)}catch(e){s.a.error("Failed to set presence:",e),this.state=t}}}},1453:function(e,t){e.exports="fonts/Twemoji_Mozilla/TwemojiMozilla-colr.4d2d834.woff2"},1454:function(e,t){e.exports="fonts/Twemoji_Mozilla/TwemojiMozilla-sbix.b1b6461.woff2"},1455:function(e,t,a){"use strict";a.r(t),a.d(t,"Icon",(function(){return r}));var n,i=a(120);function s(){return s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},s.apply(this,arguments)}function r(e){return i.createElement("svg",s({fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 18 18",role:"presentation","aria-hidden":!0},e),n||(n=i.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 3.05v6.22C2 15.63 9 17 9 17s7-1.37 7-7.73V3.05L9 1 2 3.05zm9.94 2.47c.19-.18.49-.17.67.02.16.18.16.45.02.63l-4.22 5.11-.03.04c-.28.34-.79.39-1.13.11a.29.29 0 01-.077-.067.912.912 0 00-.023-.023L5.34 9.26c-.2-.24-.18-.6.06-.8.2-.18.49-.18.7-.04l1.57 1.1 4.27-4z",fill:"#010101"})))}t.default="img/e2e/verified-deprecated.85c94e6.svg"},1456:function(e,t,a){"use strict";t.a={}},1457:function(e,t,a){"use strict";var n=a(120),i=a.n(n),s=a(154),r=a(121),o=a(131);t.a=e=>{const t=o.b.get().brand,a=Object(r.a)("%(brand)s now uses 3-5x less memory, by only loading information about other users when needed. Please wait whilst we resynchronise with the server!",{brand:t});return i.a.createElement(s.a,{hasCancelButton:!1,title:Object(r.a)("Updating %(brand)s",{brand:t}),description:i.a.createElement("div",null,a),button:Object(r.a)("OK"),onFinished:e.onFinished})}},1458:function(e,t,a){"use strict";var n=a(120),i=a.n(n),s=a(154),r=a(121),o=a(131);t.a=e=>{const t=o.b.get().brand,a=Object(r.a)("You've previously used %(brand)s on %(host)s with lazy loading of members enabled. In this version lazy loading is disabled. As the local cache is not compatible between these two settings, %(brand)s needs to resync your account.",{brand:t,host:e.host}),n=Object(r.a)("If the other version of %(brand)s is still open in another tab, please close it as using %(brand)s on the same host with both lazy loading enabled and disabled simultaneously will cause issues.",{brand:t});return i.a.createElement(s.a,{hasCancelButton:!1,title:Object(r.a)("Incompatible local cache"),description:i.a.createElement("div",null,i.a.createElement("p",null,a),i.a.createElement("p",null,n)),button:Object(r.a)("Clear cache and resync"),onFinished:e.onFinished})}},1459:function(e,t,a){"use strict";a.d(t,"a",(function(){return p}));var n=a(13),i=a.n(n),s=a(120),r=a.n(s),o=a(131),l=a(127),c=a(121),d=a(154),m=a(277),u=a(135),h=a(145);class p extends r.a.Component{constructor(){super(...arguments),i()(this,"sendBugReport",(()=>{l.b.createDialog(m.a,{error:this.props.error})})),i()(this,"onClearStorageClick",(()=>{l.b.createDialog(d.a,{title:Object(c.a)("Sign out"),description:r.a.createElement("div",null,Object(c.a)("Sign out and remove encryption keys?")),button:Object(c.a)("Sign out"),danger:!0,onFinished:this.props.onFinished})})),i()(this,"onRefreshClick",(()=>{window.location.reload()}))}render(){const e=o.b.get().brand,t=r.a.createElement("button",{onClick:this.onClearStorageClick,className:"danger"},Object(c.a)("Clear Storage and Sign Out"));let a;return a=o.b.get().bug_report_endpoint_url?r.a.createElement(h.a,{primaryButton:Object(c.a)("Send Logs"),onPrimaryButtonClick:this.sendBugReport,focus:!0,hasCancel:!1},t):r.a.createElement(h.a,{primaryButton:Object(c.a)("Refresh"),onPrimaryButtonClick:this.onRefreshClick,focus:!0,hasCancel:!1},t),r.a.createElement(u.a,{className:"mx_ErrorDialog",onFinished:this.props.onFinished,title:Object(c.a)("Unable to restore session"),contentId:"mx_Dialog_content",hasCancel:!1},r.a.createElement("div",{className:"mx_Dialog_content",id:"mx_Dialog_content"},r.a.createElement("p",null,Object(c.a)("We encountered an error trying to restore your previous session.")),r.a.createElement("p",null,Object(c.a)("If you have previously used a more recent version of %(brand)s, your session may be incompatible with this version. Close this window and return to the more recent version.",{brand:e})),r.a.createElement("p",null,Object(c.a)("Clearing your browser's storage may fix the problem, but will sign you out and cause any encrypted chat history to become unreadable."))),a)}}},1460:function(e,t,a){"use strict";a.d(t,"a",(function(){return p}));var n=a(13),i=a.n(n),s=a(120),r=a.n(s),o=a(131),l=a(127),c=a(121),d=a(135),m=a(145),u=a(277),h=a(123);class p extends r.a.Component{constructor(){super(...arguments),i()(this,"sendBugReport",(e=>{e.preventDefault(),l.b.createDialog(u.a,{})})),i()(this,"onSignOutClick",(()=>{this.props.onFinished(!0)}))}render(){let e;return o.b.get().bug_report_endpoint_url&&(e=Object(c.a)("To help us prevent this in future, please <a>send us logs</a>.",{},{a:e=>r.a.createElement(h.a,{kind:"link_inline",onClick:this.sendBugReport},e)})),r.a.createElement(d.a,{className:"mx_ErrorDialog",onFinished:this.props.onFinished,title:Object(c.a)("Missing session data"),contentId:"mx_Dialog_content",hasCancel:!1},r.a.createElement("div",{className:"mx_Dialog_content",id:"mx_Dialog_content"},r.a.createElement("p",null,Object(c.a)("Some session data, including encrypted message keys, is missing. Sign out and sign in to fix this, restoring keys from backup.")),r.a.createElement("p",null,Object(c.a)("Your browser likely removed this data when running low on disk space.")," ",e)),r.a.createElement(m.a,{primaryButton:Object(c.a)("Sign out"),onPrimaryButtonClick:this.onSignOutClick,focus:!0,hasCancel:!1}))}}},1461:function(e,t,a){"use strict";a.r(t),a.d(t,"Icon",(function(){return r}));var n,i=a(120);function s(){return s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},s.apply(this,arguments)}function r(e){return i.createElement("svg",s({viewBox:"-1 -1 13 13",xmlns:"http://www.w3.org/2000/svg",role:"presentation","aria-hidden":!0},e),n||(n=i.createElement("g",{stroke:"#4A4A4A",strokeWidth:2.82,strokeLinecap:"square",fill:"none",fillRule:"evenodd"},i.createElement("path",{d:"M6 2.229V9.77M2.229 6H9.77"}))))}t.default="img/plus.e8a5e12.svg"},1462:function(e,t,a){"use strict";(function(e){a.d(t,"a",(function(){return $e}));var n=a(130),i=a.n(n),s=a(13),r=a.n(s),o=a(120),l=a.n(o),c=a(136),d=a(214),m=a(289),u=a(16),h=a(1),p=a(148),g=a(175),v=(a(1463),a(1464),a(159)),b=a(884),f=a(122),y=a(157),E=a(131),_=a(124),S=a(274),w=a(127),O=a(231),C=a(284),x=a(467),k=(a(1465),a(1478),a(423)),j=a(218),R=a(121),I=a(125),T=a(625),N=a(891),D=a(382),P=a(1479),M=a(345),A=a(165),L=a(466),U=a(457),F=a(385),B=a(198),V=a(429),W=a(1570),H=a(128),z=a(910),G=a(623),K=a(144),q=a(219),$=a(137),Y=a(879),J=a(156),Q=a(1543),X=a(1544),Z=a(473),ee=a(224),te=a(190),ae=a(294),ne=a(134),ie=a(154),se=a(1571),re=a(594),oe=a(1548),le=a(1578),ce=a(1549),de=a(1581),me=a(1572),ue=a(1582),he=a(1583),pe=a(1584),ge=a(475),ve=a(1558),be=a(1585),fe=a(195),ye=a(1586),Ee=a(167),_e=a(226),Se=a(189),we=a(575),Oe=a(184),Ce=a(250),xe=a(123),ke=a(359),je=a(26),Re=a(493),Ie=a(308),Te=a(181),Ne=a(174),De=a(138),Pe=a(1579),Me=a(217),Ae=a(153),Le=a(1559),Ue=a(192),Fe=a(235),Be=a(892),Ve=a(307),We=a(196),He=a(197);function ze(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function Ge(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?ze(Object(a),!0).forEach((function(t){r()(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):ze(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}const Ke=["register","login","forgot_password","start_sso","start_cas","welcome"],qe=[H.a.ViewUserSettings,"view_create_chat","view_create_room"];class $e extends l.a.PureComponent{constructor(t){if(super(t),r()(this,"firstSyncComplete",!1),r()(this,"firstSyncPromise",void 0),r()(this,"screenAfterLogin",void 0),r()(this,"tokenLogin",void 0),r()(this,"accountPassword",void 0),r()(this,"accountPasswordTimer",void 0),r()(this,"focusComposer",void 0),r()(this,"subTitleStatus",void 0),r()(this,"prevWindowWidth",void 0),r()(this,"voiceBroadcastResumer",void 0),r()(this,"loggedInView",void 0),r()(this,"dispatcherRef",void 0),r()(this,"themeWatcher",void 0),r()(this,"fontWatcher",void 0),r()(this,"stores",void 0),r()(this,"onWindowResized",(()=>{this.warnInConsole()})),r()(this,"warnInConsole",Object(p.throttle)((()=>{const t=Object(R.a)("Wait!"),a=Object(R.a)("If someone told you to copy/paste something here, there is a high likelihood you're being scammed!"),n=Object(R.a)("If you know what you're doing, Element is open-source, be sure to check out our GitHub (https://github.com/vector-im/element-web/) and contribute!");e.mx_rage_logger.bypassRageshake("log",`%c${t}\n%c${a}\n%c${n}`,"font-size:50px; color:blue;","font-size:15px; color:red;","font-size:15px;")}),1e3)),r()(this,"onAction",(e=>{var t;if(null!==(t=f.a.get())&&void 0!==t&&t.isGuest()&&qe.includes(e.action))return _.a.dispatch({action:H.a.DoAfterSyncPrepared,deferred_action:e}),void _.a.dispatch({action:"require_registration"});switch(e.action){case"MatrixActions.accountData":if("m.identity_server"===e.event_type){const t=e.event_content?e.event_content.base_url:null;t?(f.a.get().setIdentityServerUrl(t),localStorage.removeItem("mx_is_access_token"),localStorage.setItem("mx_is_url",t)):(f.a.get().setIdentityServerUrl(null),localStorage.removeItem("mx_is_access_token"),localStorage.removeItem("mx_is_url")),_.a.dispatch({action:"id_server_changed"})}break;case"logout":Oe.b.instance.hangupAllCalls(),Promise.all([...[...Ie.a.instance.activeCalls].map((e=>e.disconnect())),Object(Ue.D)(this.stores)]).finally((()=>x.i()));break;case"require_registration":Object(N.b)(e);break;case"start_registration":if(x.g()){this.onSoftLogout();break}e.screenAfterLogin&&(this.screenAfterLogin=e.screenAfterLogin),this.startRegistration(e.params||{});break;case"start_login":if(x.g()){this.onSoftLogout();break}e.screenAfterLogin&&(this.screenAfterLogin=e.screenAfterLogin),this.viewLogin();break;case"start_password_recovery":this.setStateForNewView({view:ke.a.FORGOT_PASSWORD}),this.notifyNewScreen("forgot_password");break;case"start_chat":Object(j.b)({dmUserId:e.user_id});break;case"leave_room":this.leaveRoom(e.room_id);break;case"forget_room":this.forgetRoom(e.room_id);break;case"copy_room":this.copyRoom(e.room_id);break;case"reject_invite":w.b.createDialog(ie.a,{title:Object(R.a)("Reject invitation"),description:Object(R.a)("Are you sure you want to reject the invitation?"),onFinished:t=>{if(t){const t=w.b.createDialog(ne.a,void 0,"mx_Dialog_spinner");f.a.get().leave(e.room_id).then((()=>{t.close(),this.state.currentRoomId===e.room_id&&_.a.dispatch({action:H.a.ViewHomePage})}),(e=>{t.close(),w.b.createDialog(K.a,{title:Object(R.a)("Failed to reject invitation"),description:e.toString()})}))}}});break;case"view_user_info":this.viewUser(e.userId,e.subAction);break;case"MatrixActions.RoomState.events":{const t=e.event;t.getType()===c.EventType.RoomCanonicalAlias&&t.getRoomId()===this.state.currentRoomId&&this.viewRoom({action:H.a.ViewRoom,room_id:this.state.currentRoomId,metricsTrigger:void 0});break}case H.a.ViewRoom:{const t=this.viewRoom(e);e.deferred_action&&t.then((()=>{_.a.dispatch(e.deferred_action)}));break}case H.a.ViewUserDeviceSettings:Object(Le.a)(I.b.getValue("feature_new_device_manager"));break;case H.a.ViewUserSettings:{const t=e;w.b.createDialog(se.a,{initialTabId:t.initialTabId},null,!1,!0),this.viewSomethingBehindModal();break}case"view_create_room":this.createRoom(e.public,e.defaultName,e.type),this.viewSomethingBehindModal();break;case H.a.ViewRoomDirectory:w.b.createDialog(Be.b,{initialText:e.initialText,initialFilter:Be.a.PublicRooms},"mx_SpotlightDialog_wrapper",!1,!0),this.viewSomethingBehindModal();break;case"view_welcome_page":this.viewWelcome();break;case H.a.ViewHomePage:this.viewHome(e.justRegistered);break;case H.a.ViewStartChatOrReuse:this.chatCreateOrReuse(e.user_id);break;case"view_create_chat":Object(O.f)(e.initialText||""),this.viewSomethingBehindModal();break;case"view_invite":{const t=f.a.get().getRoom(e.roomId);null!=t&&t.isSpaceRoom()?Object(Ce.i)(t):Object(O.e)(e.roomId);break}case"view_last_screen":this.showScreenAfterLogin();break;case"hide_left_panel":this.setState({collapseLhs:!0},(()=>{this.state.resizeNotifier.notifyLeftHandleResized()}));break;case"show_left_panel":this.setState({collapseLhs:!1},(()=>{this.state.resizeNotifier.notifyLeftHandleResized()}));break;case H.a.OpenDialPad:w.b.createDialog(Q.a,{},"mx_Dialog_dialPadWrapper");break;case H.a.OnLoggedIn:this.stores.client=f.a.get(),this.tokenLogin||x.g()||this.state.view===ke.a.LOGIN||this.state.view===ke.a.REGISTER||this.state.view===ke.a.COMPLETE_SECURITY||this.state.view===ke.a.E2E_SETUP||this.state.view===ke.a.USE_CASE_SELECTION||this.onLoggedIn();break;case"on_client_not_viable":this.onSoftLogout();break;case H.a.OnLoggedOut:this.onLoggedOut();break;case"will_start_client":this.setState({ready:!1},(()=>{this.onWillStartClient()}));break;case"client_started":this.onClientStarted();break;case"send_event":this.onSendEvent(e.room_id,e.event);break;case"aria_hide_main_app":this.setState({hideToSRUsers:!0});break;case"aria_unhide_main_app":this.setState({hideToSRUsers:!1});break;case H.a.PseudonymousAnalyticsAccept:Object(z.b)(),I.b.setValue("pseudonymousAnalyticsOptIn",null,$.a.ACCOUNT,!0);break;case H.a.PseudonymousAnalyticsReject:Object(z.b)(),I.b.setValue("pseudonymousAnalyticsOptIn",null,$.a.ACCOUNT,!1);break;case H.a.ShowThread:{const{rootEvent:t,initialEvent:a,highlighted:n,scrollIntoView:i,push:s}=e,r={phase:Te.a.ThreadView,state:{threadHeadEvent:t,initialEvent:a,isInitialEventHighlighted:n,initialEventScrollIntoView:i}};null!=s&&s?Ne.a.instance.pushCard(r):Ne.a.instance.setCards([{phase:Te.a.ThreadPanel},r]),_.a.dispatch({action:H.a.FocusSendMessageComposer,context:De.a.Thread});break}}})),r()(this,"handleResize",(()=>{const e=1e3,t=fe.b.instance.windowWidth;this.prevWindowWidth<e&&t>=e&&_.a.dispatch({action:"show_left_panel"}),this.prevWindowWidth>=e&&t<e&&_.a.dispatch({action:"hide_left_panel"}),this.prevWindowWidth=t,this.state.resizeNotifier.notifyWindowResized()})),r()(this,"onRegisterClick",(()=>{this.showScreen("register")})),r()(this,"onLoginClick",(()=>{this.showScreen("login")})),r()(this,"onForgotPasswordClick",(()=>{this.showScreen("forgot_password")})),r()(this,"onRegisterFlowComplete",((e,t)=>this.onUserCompletedLoginFlow(e,t))),r()(this,"onUpdateStatusIndicator",((e,t)=>{const a=e.numUnreadStates;y.a.get()&&(y.a.get().setErrorStatus(t===d.b.Error),y.a.get().setNotificationCount(a)),this.subTitleStatus="",t===d.b.Error&&(this.subTitleStatus+=`[${Object(R.a)("Offline")}] `),a>0?this.subTitleStatus+=`[${a}]`:e.color>=He.a.Bold&&(this.subTitleStatus+="*"),this.setPageSubtitle()})),r()(this,"onServerConfigChange",(e=>{this.setState({serverConfig:e})})),r()(this,"makeRegistrationUrl",(e=>(this.props.startingFragmentQueryParams.referrer&&(e.referrer=this.props.startingFragmentQueryParams.referrer),this.props.makeRegistrationUrl(e)))),r()(this,"onUserCompletedLoginFlow",(async(e,t)=>{this.accountPassword=t,null!==this.accountPasswordTimer&&clearTimeout(this.accountPasswordTimer),this.accountPasswordTimer=window.setTimeout((()=>{this.accountPassword=null,this.accountPasswordTimer=null}),3e5),await x.k(e),await this.postLoginSetup(),be.b.instance.stop(be.a.LOGIN),be.b.instance.stop(be.a.REGISTER)})),r()(this,"onCompleteSecurityE2eSetupFinished",(()=>{this.onLoggedIn()})),this.stores=Ae.b.instance,this.stores.constructEagerStores(),this.state={view:ke.a.LOADING,collapseLhs:!1,hideToSRUsers:!1,syncError:null,resizeNotifier:new P.a,ready:!1},this.loggedInView=Object(o.createRef)(),E.b.put(this.props.config),this.firstSyncComplete=!1,this.firstSyncPromise=Object(u.l)(),this.props.config.sync_timeline_limit&&(f.a.opts.initialSyncLimit=this.props.config.sync_timeline_limit),this.screenAfterLogin=this.props.initialScreenAfterLogin,this.screenAfterLogin){const e=this.screenAfterLogin.params||{};if(this.screenAfterLogin.screen.startsWith("room/")&&e.signurl&&e.email){const t=this.screenAfterLogin.screen.substring("room/".length);Y.a.instance.storeInvite(t,e)}}this.prevWindowWidth=fe.b.instance.windowWidth||1e3,fe.b.instance.on(fe.a.Resize,this.handleResize),this.state.resizeNotifier.on("middlePanelResized",this.dispatchTimelineResize),q.a.instance.on(q.b,this.onUpdateStatusIndicator),x.g()&&x.h(),this.accountPassword=null,this.accountPasswordTimer=null,this.dispatcherRef=_.a.register(this.onAction),this.themeWatcher=new L.a,this.fontWatcher=new U.a,this.themeWatcher.start(),this.fontWatcher.start(),this.focusComposer=!1,this.subTitleStatus="",x.g()||x.a(this.props.realQueryParams,this.props.defaultDeviceDisplayName,this.getFragmentAfterLogin()).then((async e=>{var t;if(null!==(t=this.props.realQueryParams)&&void 0!==t&&t.loginToken&&this.props.onTokenLoginCompleted(),e)return this.tokenLogin=!0,await x.j({ignoreGuest:!0}),this.postLoginSetup();const a=this.screenAfterLogin?this.screenAfterLogin.screen:null;return!!await this.loadSession()||("login"!==a&&"register"!==a&&"forgot_password"!==a||this.showScreenAfterLogin(),!1)})),Object(we.a)(E.b.get("sentry"))}async postLoginSetup(){const e=f.a.get(),t=e.isCryptoEnabled();t||this.onLoggedIn();const a=[this.firstSyncPromise.promise];let n=!1;t&&a.push((async()=>{n=await e.userHasCrossSigningKeys()})()),this.setState({pendingInitialSync:!0}),await Promise.all(a),t?(n?!1===ae.a.SHOW_ENCRYPTION_SETUP_UI?this.onLoggedIn():this.setStateForNewView({view:ke.a.COMPLETE_SECURITY}):await e.doesServerSupportUnstableFeature("org.matrix.e2e_cross_signing")?this.setStateForNewView({view:ke.a.E2E_SETUP}):this.onLoggedIn(),this.setState({pendingInitialSync:!1})):this.setState({pendingInitialSync:!1})}setState(e,t){this.shouldTrackPageChange(this.state,Ge(Ge({},this.state),e))&&this.startPageChangeTimer(),super.setState(e,t)}componentDidMount(){window.addEventListener("resize",this.onWindowResized)}componentDidUpdate(e,t){if(this.shouldTrackPageChange(t,this.state)){const e=this.stopPageChangeTimer();v.b.instance.trackPageChange(this.state.view,this.state.page_type,e)}this.focusComposer&&(_.a.fire(H.a.FocusSendMessageComposer),this.focusComposer=!1)}componentWillUnmount(){x.m(),_.a.unregister(this.dispatcherRef),this.themeWatcher.stop(),this.fontWatcher.stop(),fe.b.destroy(),this.state.resizeNotifier.removeListener("middlePanelResized",this.dispatchTimelineResize),window.removeEventListener("resize",this.onWindowResized),null!==this.accountPasswordTimer&&clearTimeout(this.accountPasswordTimer),this.voiceBroadcastResumer&&this.voiceBroadcastResumer.destroy()}getFallbackHsUrl(){var e;return null!==(e=this.props.serverConfig)&&void 0!==e&&e.isDefault?this.props.config.fallback_hs_url:null}getServerProperties(){let e=this.state.serverConfig;return e||(e=this.props.serverConfig),e||(e=E.b.get("validated_server_config")),{serverConfig:e}}loadSession(){return Promise.resolve().then((()=>x.h({fragmentQueryParams:this.props.startingFragmentQueryParams,enableGuest:this.props.enableGuest,guestHsUrl:this.getServerProperties().serverConfig.hsUrl,guestIsUrl:this.getServerProperties().serverConfig.isUrl,defaultDeviceDisplayName:this.props.defaultDeviceDisplayName}))).then((e=>(e||(Y.a.instance.pickBestInvite()?_.a.dispatch({action:"start_registration"}):_.a.dispatch({action:"view_welcome_page"})),e)))}startPageChangeTimer(){be.b.instance.start(be.a.PAGE_CHANGE)}stopPageChangeTimer(){const e=be.b.instance;e.stop(be.a.PAGE_CHANGE);const t=e.getEntries({name:be.a.PAGE_CHANGE}).pop();return t?t.duration:null}shouldTrackPageChange(e,t){return e.currentRoomId!==t.currentRoomId||e.view!==t.view||e.page_type!==t.page_type}setStateForNewView(e){if(void 0===e.view)throw new Error("setStateForNewView with no view!");this.setState(Ge({currentUserId:void 0,justRegistered:!1},e))}setPage(e){this.setState({page_type:e})}async startRegistration(e){const t={view:ke.a.REGISTER};if(e.client_secret&&e.session_id&&e.hs_url&&e.is_url&&e.sid){t.serverConfig=await M.a.validateServerConfigWithStaticUrls(e.hs_url,e.is_url);const a=E.b.get("validated_server_config");a&&a.hsUrl===t.serverConfig.hsUrl&&(t.serverConfig.hsName=a.hsName,t.serverConfig.hsNameIsDifferent=a.hsNameIsDifferent,t.serverConfig.isDefault=a.isDefault,t.serverConfig.isNameResolvable=a.isNameResolvable),t.register_client_secret=e.client_secret,t.register_session_id=e.session_id,t.register_id_sid=e.sid}this.setStateForNewView(t),T.a.isLogin=!0,this.themeWatcher.recheck(),this.notifyNewScreen("register")}async viewRoom(e){if(this.focusComposer=!0,e.room_alias?h.a.log(`Switching to room alias ${e.room_alias} at event ${e.event_id}`):h.a.log(`Switching to room id ${e.room_id} at event ${e.event_id}`),!this.firstSyncComplete){if(!this.firstSyncPromise)return void h.a.warn("Cannot view a room before first sync. room_id:",e.room_id);await this.firstSyncPromise.promise}let t=e.room_alias||e.room_id;const a=f.a.get().getRoom(e.room_id);if(a){var n;a.decryptAllEvents();const e=C.b(a);e&&(t=e,Object(F.b)(e,a.roomId)),null===(n=localStorage)||void 0===n||n.setItem("mx_last_room_id",a.roomId)}let i="#"===t[0]&&e.room_id===this.state.currentRoomId;var s,r,o,l;(Object(Me.a)(this.state.currentRoomId)&&(i=!0),e.room_id===this.state.currentRoomId)&&(e.threepid_invite=null!==(s=e.threepid_invite)&&void 0!==s?s:this.state.threepidInvite,e.oob_data=null!==(r=e.oob_data)&&void 0!==r?r:this.state.roomOobData,e.forceTimeline=null!==(o=e.forceTimeline)&&void 0!==o?o:this.state.forceTimeline,e.justCreatedOpts=null!==(l=e.justCreatedOpts)&&void 0!==l?l:this.state.roomJustCreatedOpts);e.event_id&&e.highlighted&&(t+="/"+e.event_id),this.setState({view:ke.a.LOGGED_IN,currentRoomId:e.room_id||null,page_type:k.a.RoomView,threepidInvite:e.threepid_invite,roomOobData:e.oob_data,forceTimeline:e.forceTimeline,ready:!0,roomJustCreatedOpts:e.justCreatedOpts},(()=>{T.a.isLogin=!1,this.themeWatcher.recheck(),this.notifyNewScreen("room/"+t,i)}))}viewSomethingBehindModal(){this.state.view===ke.a.LOGGED_IN?this.state.currentRoomId||this.state.currentUserId||this.viewHome():this.viewWelcome()}viewWelcome(){if(Object(Z.b)(E.b.get()))return this.viewLogin();this.setStateForNewView({view:ke.a.WELCOME}),this.notifyNewScreen("welcome"),T.a.isLogin=!0,this.themeWatcher.recheck()}viewLogin(e){this.setStateForNewView(Ge({view:ke.a.LOGIN},e)),this.notifyNewScreen("login"),T.a.isLogin=!0,this.themeWatcher.recheck()}viewHome(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.setStateForNewView({view:ke.a.LOGGED_IN,justRegistered:e,currentRoomId:null}),this.setPage(k.a.HomePage),this.notifyNewScreen("home"),T.a.isLogin=!1,this.themeWatcher.recheck()}viewUser(e,t){(this.firstSyncPromise?this.firstSyncPromise.promise:Promise.resolve()).then((()=>{"chat"!==t?(this.notifyNewScreen("user/"+e),this.setState({currentUserId:e}),this.setPage(k.a.UserView)):this.chatCreateOrReuse(e)}))}async createRoom(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1?arguments[1]:void 0,a=arguments.length>2?arguments[2]:void 0;const n=w.b.createDialog(re.a,{type:a,defaultPublic:e,defaultName:t}),[i,s]=await n.finished;i&&Object(j.b)(s)}chatCreateOrReuse(e){const t=new je.a(this.props.config);if(f.a.get().isGuest())return e!==t.get("welcome_user_id")&&_.a.dispatch({action:H.a.DoAfterSyncPrepared,deferred_action:{action:H.a.ViewStartChatOrReuse,user_id:e}}),void _.a.dispatch({action:"require_registration",go_welcome_on_cancel:!0,screen_after:{screen:`user/${t.get("welcome_user_id")}`,params:{action:"chat"}}});const a=f.a.get(),n=Object(Ve.a)(a,e);n?_.a.dispatch({action:H.a.ViewRoom,room_id:n.roomId,metricsTrigger:"MessageUser"}):_.a.dispatch({action:"start_chat",user_id:e})}leaveRoomWarnings(e){const t=f.a.get().getRoom(e),a=null==t?void 0:t.isSpaceRoom(),n=[];if(1===t.currentState.getJoinedMemberCount())return n.push(l.a.createElement("span",{className:"warning",key:"only_member_warning"}," ",Object(R.a)("You are the only person here. If you leave, no one will be able to join in the future, including you."))),n;const i=t.currentState.getStateEvents("m.room.join_rules","");if(i){"public"!==i.getContent().join_rule&&n.push(l.a.createElement("span",{className:"warning",key:"non_public_warning"}," ",a?Object(R.a)("This space is not public. You will not be able to rejoin without an invite."):Object(R.a)("This room is not public. You will not be able to rejoin without an invite.")))}return n}leaveRoom(e){const t=f.a.get().getRoom(e),a=this.leaveRoomWarnings(e),n=null==t?void 0:t.isSpaceRoom();w.b.createDialog(ie.a,{title:n?Object(R.a)("Leave space"):Object(R.a)("Leave room"),description:l.a.createElement("span",null,n?Object(R.a)("Are you sure you want to leave the space '%(spaceName)s'?",{spaceName:t.name}):Object(R.a)("Are you sure you want to leave the room '%(roomName)s'?",{roomName:t.name}),a),button:Object(R.a)("Leave"),onFinished:t=>{t&&(Object(Re.a)(e),_.a.dispatch({action:H.a.AfterLeaveRoom,room_id:e}))}})}forgetRoom(e){const t=f.a.get().getRoom(e);f.a.get().forget(e).then((()=>{this.state.currentRoomId===e&&_.a.dispatch({action:H.a.ViewHomePage}),ee.c.instance.manualRoomUpdate(t,te.c.RoomRemoved)})).catch((e=>{const t=e.errcode||Object(R.c)("unknown error code");w.b.createDialog(K.a,{title:Object(R.a)("Failed to forget room %(errCode)s",{errCode:t}),description:e&&e.message?e.message:Object(R.a)("Operation failed")})}))}async copyRoom(e){const t=Object(Ee.h)(e);await Object(_e.b)(t)||w.b.createDialog(K.a,{title:Object(R.a)("Unable to copy room link"),description:Object(R.a)("Unable to copy a link to the room to the clipboard.")})}async startWelcomeUserChat(){let e;e=this.firstSyncComplete?Promise.resolve():this.firstSyncPromise.promise,await e;const t=new je.a(this.props.config);if(0===A.a.shared().getDMRoomsForUserId(t.get("welcome_user_id")).length){const e=await Object(j.b)({dmUserId:t.get("welcome_user_id"),andView:!this.state.currentRoomId,spinner:!1}),a=e=>{e.getType()===c.EventType.Direct&&e.getContent()[t.get("welcome_user_id")]&&(f.a.get().store.save(!0),f.a.get().removeListener(c.ClientEvent.AccountData,a))};return f.a.get().on(c.ClientEvent.AccountData,a),e}return null}async onLoggedIn(){if(T.a.isLogin=!1,this.themeWatcher.recheck(),V.f(),!f.a.currentUserIsJustRegistered()||null!==I.b.getValue("FTUE.useCaseSelection"))return this.onShowPostLoginScreen();this.setStateForNewView({view:ke.a.USE_CASE_SELECTION}),I.b.watchSetting("FTUE.useCaseSelection",null,((e,t,a,n,i)=>{null!==i&&this.state.view===ke.a.USE_CASE_SELECTION&&this.onShowPostLoginScreen()}))}async onShowPostLoginScreen(e){if(e&&(Se.a.instance.setProperty("ftueUseCaseSelection",e),I.b.setValue("FTUE.useCaseSelection",null,$.a.ACCOUNT,e)),this.setStateForNewView({view:ke.a.LOGGED_IN}),this.screenAfterLogin&&this.screenAfterLogin.screen)this.showScreen(this.screenAfterLogin.screen,this.screenAfterLogin.params),this.screenAfterLogin=null;else if(f.a.currentUserIsJustRegistered()){f.a.setJustRegisteredUserId(null);if(new je.a(this.props.config).get("welcome_user_id")&&Object(R.e)().startsWith("en")){null===await this.startWelcomeUserChat()&&_.a.dispatch({action:H.a.ViewHomePage,justRegistered:!0})}else if(Y.a.instance.pickBestInvite()){const e=Y.a.instance.pickBestInvite(),t=Y.a.instance.translateToWireFormat(e);this.showScreen(`room/${e.roomId}`,t)}else _.a.dispatch({action:H.a.ViewHomePage,justRegistered:!0})}else this.showScreenAfterLogin();E.b.get("mobile_guide_toast")&&Object(X.a)();const t=E.b.get("user_notice");if(t){const e="user_notice_"+t.title;t.show_once&&localStorage.getItem(e)||B.a.sharedInstance().addOrReplaceToast({key:e,title:t.title,props:{description:l.a.createElement(We.a,null,t.description),acceptLabel:Object(R.a)("OK"),onAccept:()=>{B.a.sharedInstance().dismissToast(e),localStorage.setItem(e,"1")}},component:Fe.a,className:"mx_AnalyticsToast",priority:100})}}initPosthogAnalyticsToast(){null===I.b.getValue("pseudonymousAnalyticsOptIn")&&Object(z.c)(),I.b.watchSetting("pseudonymousAnalyticsOptIn",null,((e,t,a,n,i)=>{null===i?Object(z.c)():Object(z.b)()}))}showScreenAfterLogin(){this.screenAfterLogin&&this.screenAfterLogin.screen?(this.showScreen(this.screenAfterLogin.screen,this.screenAfterLogin.params),this.screenAfterLogin=null):localStorage&&localStorage.getItem("mx_last_room_id")?this.viewLastRoom():f.a.get().isGuest()?_.a.dispatch({action:"view_welcome_page"}):_.a.dispatch({action:H.a.ViewHomePage})}viewLastRoom(){_.a.dispatch({action:H.a.ViewRoom,room_id:localStorage.getItem("mx_last_room_id"),metricsTrigger:void 0})}onLoggedOut(){this.viewLogin({ready:!1,collapseLhs:!1,currentRoomId:null}),this.subTitleStatus="",this.setPageSubtitle()}onSoftLogout(){this.notifyNewScreen("soft_logout"),this.setStateForNewView({view:ke.a.SOFT_LOGOUT,ready:!1,collapseLhs:!1,currentRoomId:null}),this.subTitleStatus="",this.setPageSubtitle()}onWillStartClient(){this.firstSyncComplete=!1,this.firstSyncPromise=Object(u.l)();const e=f.a.get();e.setCanResetTimelineCallback((e=>(h.a.log("Request to reset timeline in room ",e," viewing:",this.state.currentRoomId),e!==this.state.currentRoomId||(!this.loggedInView.current||this.loggedInView.current.canResetTimelineInRoom(e))))),e.on(c.ClientEvent.Sync,((e,t,a)=>{e===d.b.Error||e===d.b.Reconnecting?(a.error instanceof m.c&&x.d(a.error),this.setState({syncError:a.error})):this.state.syncError&&this.setState({syncError:null}),e===d.b.Syncing&&t===d.b.Syncing||(h.a.info("MatrixClient sync state => %s",e),e===d.b.Prepared&&(this.firstSyncComplete=!0,this.firstSyncPromise.resolve(),S.default.shouldShowPrompt()&&!f.a.userRegisteredWithinLastHours(24)&&Object(G.b)(!1),_.a.fire(H.a.FocusSendMessageComposer),this.setState({ready:!0})))})),e.on(c.HttpApiEvent.SessionLoggedOut,(function(e){if(!x.f()){if(w.b.closeCurrentModal("Session.logged_out"),401===e.httpStatus&&e.data&&e.data.soft_logout)return h.a.warn("Soft logout issued by server - avoiding data deletion"),void x.l();w.b.createDialog(K.a,{title:Object(R.a)("Signed Out"),description:Object(R.a)("For security, this session has been signed out. Please sign in again.")}),_.a.dispatch({action:"logout"})}})),e.on(c.HttpApiEvent.NoConsent,(function(t,a){w.b.createDialog(ie.a,{title:Object(R.a)("Terms and Conditions"),description:l.a.createElement("div",null,l.a.createElement("p",null," ",Object(R.a)("To continue using the %(homeserverDomain)s homeserver you must review and agree to our terms and conditions.",{homeserverDomain:e.getDomain()}))),button:Object(R.a)("Review terms and conditions"),cancelButton:Object(R.a)("Dismiss"),onFinished:e=>{if(e){window.open(a,"_blank").opener=null}}},null,!0)}));const t=b.a.instance;t.start(),e.on(c.HttpApiEvent.SessionLoggedOut,(()=>t.stop())),e.on(c.MatrixEventEvent.Decrypted,((e,a)=>t.eventDecrypted(e,a))),e.on(c.ClientEvent.Room,(e=>{if(f.a.get().isCryptoEnabled()){const t=I.b.getValueAt($.a.ROOM_DEVICE,"blacklistUnverifiedDevices",e.roomId,!0);e.setBlacklistUnverifiedDevices(t)}})),e.on(g.b.Warning,(e=>{if("CRYPTO_WARNING_OLD_VERSION_DETECTED"===e)w.b.createDialog(K.a,{title:Object(R.a)("Old cryptography data detected"),description:Object(R.a)("Data from an older version of %(brand)s has been detected. This will have caused end-to-end cryptography to malfunction in the older version. End-to-end encrypted messages exchanged recently whilst using the older version may not be decryptable in this version. This may also cause messages exchanged with this version to fail. If you experience problems, log out and back in again. To retain message history, export and re-import your keys.",{brand:E.b.get().brand})})})),e.on(g.b.KeyBackupFailed,(async e=>{let t,n;if(f.a.get().getKeyBackupEnabled())t=!0;else try{n=await f.a.get().getKeyBackupVersion(),null!==n&&(t=!0)}catch(e){return void h.a.error("Saw key backup error but failed to check backup version!",e)}t?w.b.createDialogAsync(a.e(39).then(a.bind(null,1560)),{newVersionInfo:n}):w.b.createDialogAsync(a.e(40).then(a.bind(null,1561)))})),e.on(g.b.KeySignatureUploadFailure,((e,t,a)=>{w.b.createDialog(oe.a,{failures:e,source:t,continuation:a})})),e.on(g.b.VerificationRequest,(e=>{e.verifier?w.b.createDialog(le.a,{verifier:e.verifier},null,!1,!0):e.pending&&B.a.sharedInstance().addOrReplaceToast({key:"verifreq_"+e.channel.transactionId,title:Object(R.a)("Verification requested"),icon:"verification",props:{request:e},component:ve.a,priority:90})})),this.voiceBroadcastResumer=new Ue.z(e)}onClientStarted(){const e=f.a.get();if(e.isCryptoEnabled()){const t=I.b.getValueAt($.a.DEVICE,"blacklistUnverifiedDevices");e.setGlobalBlacklistUnverifiedDevices(t),e.setGlobalErrorOnUnknownDevices(!1)}Se.a.instance.isEnabled()&&I.b.isLevelSupported($.a.ACCOUNT)&&this.initPosthogAnalyticsToast()}showScreen(e,t){const a=f.a.get();if(!a||a.isGuest()||!Ke.includes(e))if("register"===e)_.a.dispatch({action:"start_registration",params:t}),be.b.instance.start(be.a.REGISTER);else if("login"===e)_.a.dispatch({action:"start_login",params:t}),be.b.instance.start(be.a.LOGIN);else if("forgot_password"===e)_.a.dispatch({action:"start_password_recovery",params:t});else if("soft_logout"===e)a.getUserId()&&!x.g()?this.viewLastRoom():_.a.dispatch({action:"start_login",params:t});else if("new"===e)_.a.dispatch({action:"view_create_room"});else if("dm"===e)_.a.dispatch({action:"view_create_chat"});else if("settings"===e)_.a.fire(H.a.ViewUserSettings);else if("welcome"===e)_.a.dispatch({action:"view_welcome_page"});else if("home"===e)_.a.dispatch({action:H.a.ViewHomePage});else if("start"===e)this.showScreen("home"),_.a.dispatch({action:"require_registration"});else if("directory"===e)_.a.fire(H.a.ViewRoomDirectory);else if("start_sso"===e||"start_cas"===e){let t=f.a.get();if(!t){const{hsUrl:e,isUrl:a}=this.props.serverConfig;t=Object(c.createClient)({baseUrl:e,idBaseUrl:a})}const a="start_sso"===e?"sso":"cas";y.a.get().startSingleSignOn(t,a,this.getFragmentAfterLogin())}else if(0===e.indexOf("room/")){var n,i,s;const a=e.substring(5),r=a.indexOf(":")+1;let o=a.length;a.substring(r).indexOf("/")>-1&&(o=r+a.substring(r).indexOf("/"));const l=a.substring(0,o);let c,d=a.substring(o+1);if(d||(d=void 0),t.signurl&&t.email&&(c=Y.a.instance.storeInvite(l,t)),!c){c=Y.a.instance.getInvites().find((e=>e.roomId===l))}let m=[];t.via&&(m="string"==typeof t.via?[t.via]:t.via);const u={action:H.a.ViewRoom,event_id:d,via_servers:m,highlighted:Boolean(d),threepid_invite:c,oob_data:{name:null===(n=c)||void 0===n?void 0:n.roomName,avatarUrl:null===(i=c)||void 0===i?void 0:i.roomAvatarUrl,inviterName:null===(s=c)||void 0===s?void 0:s.inviterName},room_alias:void 0,room_id:void 0,metricsTrigger:void 0};"#"===l[0]?u.room_alias=l:u.room_id=l,_.a.dispatch(u)}else if(0===e.indexOf("user/")){const a=e.substring(5);_.a.dispatch({action:"view_user_info",userId:a,subAction:t.action})}else h.a.info("Ignoring showScreen for '%s'",e);else _.a.dispatch({action:H.a.ViewHomePage})}notifyNewScreen(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.props.onNewScreen&&this.props.onNewScreen(e,t),this.setPageSubtitle()}onLogoutClick(e){_.a.dispatch({action:"logout"}),e.stopPropagation(),e.preventDefault()}dispatchTimelineResize(){_.a.dispatch({action:"timeline_resize"})}onRegistered(e){return x.k(e)}onSendEvent(e,t){const a=f.a.get();a&&a.sendEvent(e,t.getType(),t.getContent()).then((()=>{_.a.dispatch({action:"message_sent"})}))}setPageSubtitle(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";if(this.state.currentRoomId){const t=f.a.get(),a=t&&t.getRoom(this.state.currentRoomId);a&&(e=`${this.subTitleStatus} | ${a.name} ${e}`)}else e=`${this.subTitleStatus} ${e}`;const t=`${E.b.get().brand} ${e}`;document.title!==t&&(document.title=t)}getFragmentAfterLogin(){let e="";const t=this.props.initialScreenAfterLogin;return t&&!["welcome","login","register","start_sso","start_cas"].includes(t.screen)&&(e=`/${t.screen}`),e}render(){const e=this.getFragmentAfterLogin();let t=null;if(this.state.view===ke.a.LOADING)t=l.a.createElement("div",{className:"mx_MatrixChat_splash"},l.a.createElement(ne.a,null));else if(this.state.view===ke.a.COMPLETE_SECURITY)t=l.a.createElement(ce.a,{onFinished:this.onCompleteSecurityE2eSetupFinished});else if(this.state.view===ke.a.E2E_SETUP)t=l.a.createElement(ue.a,{onFinished:this.onCompleteSecurityE2eSetupFinished,accountPassword:this.accountPassword,tokenLogin:!!this.tokenLogin});else if(this.state.view===ke.a.LOGGED_IN){const e=this.state.syncError&&this.state.syncError instanceof m.c;if(this.state.ready&&this.state.page_type&&!e)t=l.a.createElement(W.a,i()({},this.props,this.state,{ref:this.loggedInView,matrixClient:f.a.get(),onRegistered:this.onRegistered,currentRoomId:this.state.currentRoomId}));else{let a;this.state.syncError&&!e&&(a=l.a.createElement("div",{className:"mx_MatrixChat_syncError"},Object(D.b)(this.state.syncError))),t=l.a.createElement("div",{className:"mx_MatrixChat_splash"},a,l.a.createElement(ne.a,null),l.a.createElement("div",{className:"mx_MatrixChat_splashButtons"},l.a.createElement(xe.a,{kind:"link_inline",onClick:this.onLogoutClick},Object(R.a)("Logout"))))}}else if(this.state.view===ke.a.WELCOME)t=l.a.createElement(de.a,null);else if(this.state.view===ke.a.REGISTER&&I.b.getValue(J.b.Registration)){var a;const n=null===(a=Y.a.instance.pickBestInvite())||void 0===a?void 0:a.toEmail;t=l.a.createElement(he.a,i()({clientSecret:this.state.register_client_secret,sessionId:this.state.register_session_id,idSid:this.state.register_id_sid,email:n,brand:this.props.config.brand,makeRegistrationUrl:this.makeRegistrationUrl,onLoggedIn:this.onRegisterFlowComplete,onLoginClick:this.onLoginClick,onServerConfigChange:this.onServerConfigChange,defaultDeviceDisplayName:this.props.defaultDeviceDisplayName,fragmentAfterLogin:e},this.getServerProperties()))}else if(this.state.view===ke.a.FORGOT_PASSWORD&&I.b.getValue(J.b.PasswordReset))t=l.a.createElement(me.a,i()({onComplete:this.onLoginClick,onLoginClick:this.onLoginClick},this.getServerProperties()));else if(this.state.view===ke.a.LOGIN){const a=I.b.getValue(J.b.PasswordReset);t=l.a.createElement(pe.a,i()({isSyncing:this.state.pendingInitialSync,onLoggedIn:this.onUserCompletedLoginFlow,onRegisterClick:this.onRegisterClick,fallbackHsUrl:this.getFallbackHsUrl(),defaultDeviceDisplayName:this.props.defaultDeviceDisplayName,onForgotPasswordClick:a?this.onForgotPasswordClick:void 0,onServerConfigChange:this.onServerConfigChange,fragmentAfterLogin:e,defaultUsername:this.props.startingFragmentQueryParams.defaultUsername},this.getServerProperties()))}else this.state.view===ke.a.SOFT_LOGOUT?t=l.a.createElement(ye.a,{realQueryParams:this.props.realQueryParams,onTokenLoginCompleted:this.props.onTokenLoginCompleted,fragmentAfterLogin:e}):this.state.view===ke.a.USE_CASE_SELECTION?t=l.a.createElement(Pe.a,{onFinished:e=>this.onShowPostLoginScreen(e)}):h.a.error(`Unknown view ${this.state.view}`);return l.a.createElement(ge.a,null,l.a.createElement(Ae.a.Provider,{value:this.stores},t))}}r()($e,"displayName","MatrixChat"),r()($e,"defaultProps",{realQueryParams:{},startingFragmentQueryParams:{},config:{},onTokenLoginCompleted:()=>{}})}).call(this,a(14))},1463:function(e,t,a){!function(){"use strict";function e(e){var t=!0,a=!1,n=null,i={text:!0,search:!0,url:!0,tel:!0,email:!0,password:!0,number:!0,date:!0,month:!0,week:!0,time:!0,datetime:!0,"datetime-local":!0};function s(e){return!!(e&&e!==document&&"HTML"!==e.nodeName&&"BODY"!==e.nodeName&&"classList"in e&&"contains"in e.classList)}function r(e){var t=e.type,a=e.tagName;return!("INPUT"!==a||!i[t]||e.readOnly)||"TEXTAREA"===a&&!e.readOnly||!!e.isContentEditable}function o(e){e.classList.contains("focus-visible")||(e.classList.add("focus-visible"),e.setAttribute("data-focus-visible-added",""))}function l(e){e.hasAttribute("data-focus-visible-added")&&(e.classList.remove("focus-visible"),e.removeAttribute("data-focus-visible-added"))}function c(a){a.metaKey||a.altKey||a.ctrlKey||(s(e.activeElement)&&o(e.activeElement),t=!0)}function d(e){t=!1}function m(e){s(e.target)&&(t||r(e.target))&&o(e.target)}function u(e){s(e.target)&&(e.target.classList.contains("focus-visible")||e.target.hasAttribute("data-focus-visible-added"))&&(a=!0,window.clearTimeout(n),n=window.setTimeout((function(){a=!1}),100),l(e.target))}function h(e){"hidden"===document.visibilityState&&(a&&(t=!0),p())}function p(){document.addEventListener("mousemove",v),document.addEventListener("mousedown",v),document.addEventListener("mouseup",v),document.addEventListener("pointermove",v),document.addEventListener("pointerdown",v),document.addEventListener("pointerup",v),document.addEventListener("touchmove",v),document.addEventListener("touchstart",v),document.addEventListener("touchend",v)}function g(){document.removeEventListener("mousemove",v),document.removeEventListener("mousedown",v),document.removeEventListener("mouseup",v),document.removeEventListener("pointermove",v),document.removeEventListener("pointerdown",v),document.removeEventListener("pointerup",v),document.removeEventListener("touchmove",v),document.removeEventListener("touchstart",v),document.removeEventListener("touchend",v)}function v(e){e.target.nodeName&&"html"===e.target.nodeName.toLowerCase()||(t=!1,g())}document.addEventListener("keydown",c,!0),document.addEventListener("mousedown",d,!0),document.addEventListener("pointerdown",d,!0),document.addEventListener("touchstart",d,!0),document.addEventListener("visibilitychange",h,!0),p(),e.addEventListener("focus",m,!0),e.addEventListener("blur",u,!0),e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&e.host?e.host.setAttribute("data-js-focus-visible",""):e.nodeType===Node.DOCUMENT_NODE&&(document.documentElement.classList.add("js-focus-visible"),document.documentElement.setAttribute("data-js-focus-visible",""))}if("undefined"!=typeof window&&"undefined"!=typeof document){var t;window.applyFocusVisiblePolyfill=e;try{t=new CustomEvent("focus-visible-polyfill-ready")}catch(e){(t=document.createEvent("CustomEvent")).initCustomEvent("focus-visible-polyfill-ready",!1,!1,{})}window.dispatchEvent(t)}"undefined"!=typeof document&&e(document)}()},1464:function(e,t,a){var n;n=function(){return function(e){var t={};function a(n){if(t[n])return t[n].exports;var i=t[n]={exports:{},id:n,loaded:!1};return e[n].call(i.exports,i,i.exports,a),i.loaded=!0,i.exports}return a.m=e,a.c=t,a.p="",a(0)}([function(e,t){"use strict";e.exports=function(){if("undefined"==typeof document||"undefined"==typeof window)return{ask:function(){return"initial"},element:function(){return null},ignoreKeys:function(){},specificKeys:function(){},registerOnChange:function(){},unRegisterOnChange:function(){}};var e=document.documentElement,t=null,a="initial",n=a,i=Date.now(),s=!1,r=["button","input","select","textarea"],o=[],l=[16,17,18,91,93],c=[],d={keydown:"keyboard",keyup:"keyboard",mousedown:"mouse",mousemove:"mouse",MSPointerDown:"pointer",MSPointerMove:"pointer",pointerdown:"pointer",pointermove:"pointer",touchstart:"touch",touchend:"touch"},m=!1,u={x:null,y:null},h={2:"touch",3:"touch",4:"mouse"},p=!1;try{var g=Object.defineProperty({},"passive",{get:function(){p=!0}});window.addEventListener("test",null,g)}catch(e){}var v=function(){var e=!p||{passive:!0,capture:!0};document.addEventListener("DOMContentLoaded",b,!0),window.PointerEvent?(window.addEventListener("pointerdown",f,!0),window.addEventListener("pointermove",E,!0)):window.MSPointerEvent?(window.addEventListener("MSPointerDown",f,!0),window.addEventListener("MSPointerMove",E,!0)):(window.addEventListener("mousedown",f,!0),window.addEventListener("mousemove",E,!0),"ontouchstart"in window&&(window.addEventListener("touchstart",f,e),window.addEventListener("touchend",f,!0))),window.addEventListener(x(),E,e),window.addEventListener("keydown",f,!0),window.addEventListener("keyup",f,!0),window.addEventListener("focusin",_,!0),window.addEventListener("focusout",S,!0)},b=function(){if(s=!("false"===e.getAttribute("data-whatpersist")||"false"===document.body.getAttribute("data-whatpersist")))try{window.sessionStorage.getItem("what-input")&&(a=window.sessionStorage.getItem("what-input")),window.sessionStorage.getItem("what-intent")&&(n=window.sessionStorage.getItem("what-intent"))}catch(e){}y("input"),y("intent")},f=function(e){var t=e.which,i=d[e.type];"pointer"===i&&(i=O(e));var s=!c.length&&-1===l.indexOf(t),o=c.length&&-1!==c.indexOf(t),m="keyboard"===i&&t&&(s||o)||"mouse"===i||"touch"===i;if(C(i)&&(m=!1),m&&a!==i&&(w("input",a=i),y("input")),m&&n!==i){var u=document.activeElement;u&&u.nodeName&&(-1===r.indexOf(u.nodeName.toLowerCase())||"button"===u.nodeName.toLowerCase()&&!R(u,"form"))&&(w("intent",n=i),y("intent"))}},y=function(t){e.setAttribute("data-what"+t,"input"===t?a:n),k(t)},E=function(e){var t=d[e.type];"pointer"===t&&(t=O(e)),j(e),(!m&&!C(t)||m&&"wheel"===e.type||"mousewheel"===e.type||"DOMMouseScroll"===e.type)&&n!==t&&(w("intent",n=t),y("intent"))},_=function(a){a.target.nodeName?(t=a.target.nodeName.toLowerCase(),e.setAttribute("data-whatelement",t),a.target.classList&&a.target.classList.length&&e.setAttribute("data-whatclasses",a.target.classList.toString().replace(" ",","))):S()},S=function(){t=null,e.removeAttribute("data-whatelement"),e.removeAttribute("data-whatclasses")},w=function(e,t){if(s)try{window.sessionStorage.setItem("what-"+e,t)}catch(e){}},O=function(e){return"number"==typeof e.pointerType?h[e.pointerType]:"pen"===e.pointerType?"touch":e.pointerType},C=function(e){var t=Date.now(),n="mouse"===e&&"touch"===a&&t-i<200;return i=t,n},x=function(){return"onwheel"in document.createElement("div")?"wheel":void 0!==document.onmousewheel?"mousewheel":"DOMMouseScroll"},k=function(e){for(var t=0,i=o.length;t<i;t++)o[t].type===e&&o[t].fn.call(void 0,"input"===e?a:n)},j=function(e){u.x!==e.screenX||u.y!==e.screenY?(m=!1,u.x=e.screenX,u.y=e.screenY):m=!0},R=function(e,t){var a=window.Element.prototype;if(a.matches||(a.matches=a.msMatchesSelector||a.webkitMatchesSelector),a.closest)return e.closest(t);do{if(e.matches(t))return e;e=e.parentElement||e.parentNode}while(null!==e&&1===e.nodeType);return null};return"addEventListener"in window&&Array.prototype.indexOf&&(d[x()]="mouse",v()),{ask:function(e){return"intent"===e?n:a},element:function(){return t},ignoreKeys:function(e){l=e},specificKeys:function(e){c=e},registerOnChange:function(e,t){o.push({fn:e,type:t||"input"})},unRegisterOnChange:function(e){var t=function(e){for(var t=0,a=o.length;t<a;t++)if(o[t].fn===e)return t}(e);(t||0===t)&&o.splice(t,1)},clearStorage:function(){window.sessionStorage.clear()}}}()}])},e.exports=n()},1465:function(e,t,a){"use strict";var n=a(13),i=a.n(n),s=a(1466),r=a(128),o=a(124);const l={deferredAction:null};class c extends s.Store{constructor(){super(o.a),i()(this,"state",l)}setState(e){this.state=Object.assign(this.state,e),this.__emitChange()}__onDispatch(e){switch(e.action){case r.a.DoAfterSyncPrepared:this.setState({deferredAction:e.deferred_action});break;case"cancel_after_sync_prepared":this.setState({deferredAction:null});break;case"MatrixActions.sync":{if("PREPARED"!==e.state)break;if(!this.state.deferredAction)break;const t=Object.assign({},this.state.deferredAction);this.setState({deferredAction:null}),o.a.dispatch(t);break}case"on_client_not_viable":case r.a.OnLoggedOut:this.reset()}}reset(){this.state=Object.assign({},l)}}let d=null;d||(d=new c)},1466:function(e,t,a){e.exports.Container=a(1467),e.exports.Mixin=a(1470),e.exports.ReduceStore=a(1471),e.exports.Store=a(889)},1467:function(e,t,a){"use strict";function n(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function i(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,s(e,t)}function s(e,t){return s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},s(e,t)}function r(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function o(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?r(Object(a),!0).forEach((function(t){l(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):r(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}function l(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}var c=a(1468),d=a(120),m=a(254),u=a(1469),h=d.Component,p={pure:!0,withProps:!1,withContext:!1};function g(e,t){var a;(a=e).getStores||m(!1),!a.calculateState&&m(!1);var s,r=o(o({},p),t||{}),d=function(t,a,n){var i=r.withProps?a:void 0,s=r.withContext?n:void 0;return e.calculateState(t,i,s)},h=function(t,a){var n=r.withProps?t:void 0,i=r.withContext?a:void 0;return e.getStores(n,i)},g=function(e){function t(t,a){var i;l(n(i=e.call(this,t,a)||this),"_fluxContainerSubscriptions",void 0),i._fluxContainerSubscriptions=new c,i._fluxContainerSubscriptions.setStores(h(t,a)),i._fluxContainerSubscriptions.addListener((function(){i.setState((function(e,t){return d(e,t,a)}))}));var s=d(void 0,t,a);return i.state=o(o({},i.state||{}),s),i}i(t,e);var a=t.prototype;return a.UNSAFE_componentWillReceiveProps=function(t,a){e.prototype.UNSAFE_componentWillReceiveProps&&e.prototype.UNSAFE_componentWillReceiveProps.call(this,t,a),e.prototype.componentWillReceiveProps&&e.prototype.componentWillReceiveProps.call(this,t,a),(r.withProps||r.withContext)&&(this._fluxContainerSubscriptions.setStores(h(t,a)),this.setState((function(e){return d(e,t,a)})))},a.componentWillUnmount=function(){e.prototype.componentWillUnmount&&e.prototype.componentWillUnmount.call(this),this._fluxContainerSubscriptions.reset()},t}(e),v=r.pure?(s=function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t.prototype.shouldComponentUpdate=function(e,t){return!u(this.props,e)||!u(this.state,t)},t}(g),s):g,b=e.displayName||e.name;return v.displayName="FluxContainer("+b+")",v}e.exports={create:g,createFunctional:function(e,t,a,s){var r=function(s){function r(){for(var e,t=arguments.length,a=new Array(t),i=0;i<t;i++)a[i]=arguments[i];return l(n(e=s.call.apply(s,[this].concat(a))||this),"state",void 0),e}return i(r,s),r.getStores=function(e,a){return t(e,a)},r.calculateState=function(e,t,n){return a(e,t,n)},r.prototype.render=function(){return e(this.state)},r}(h),o=e.displayName||e.name||"FunctionalContainer";return r.displayName=o,g(r,s)}}},1468:function(e,t,a){"use strict";function n(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}var i=a(888);var s=function(){function e(){n(this,"_callbacks",void 0),n(this,"_storeGroup",void 0),n(this,"_stores",void 0),n(this,"_tokens",void 0),this._callbacks=[]}var t=e.prototype;return t.setStores=function(e){var t=this;if(!this._stores||!function(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(var a=0;a<e.length;a++)if(e[a]!==t[a])return!1;return!0}(this._stores,e)){this._stores=e,this._resetTokens(),this._resetStoreGroup();var a=!1,n=function(){a=!0};this._tokens=e.map((function(e){return e.addListener(n)}));this._storeGroup=new i(e,(function(){a&&(t._callbacks.forEach((function(e){return e()})),a=!1)}))}},t.addListener=function(e){this._callbacks.push(e)},t.reset=function(){this._resetTokens(),this._resetStoreGroup(),this._resetCallbacks(),this._resetStores()},t._resetTokens=function(){this._tokens&&(this._tokens.forEach((function(e){return e.remove()})),this._tokens=null)},t._resetStoreGroup=function(){this._storeGroup&&(this._storeGroup.release(),this._storeGroup=null)},t._resetStores=function(){this._stores=null},t._resetCallbacks=function(){this._callbacks=[]},e}();e.exports=s},1469:function(e,t,a){"use strict";var n=Object.prototype.hasOwnProperty;function i(e,t){return e===t?0!==e||0!==t||1/e==1/t:e!=e&&t!=t}e.exports=function(e,t){if(i(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;var a=Object.keys(e),s=Object.keys(t);if(a.length!==s.length)return!1;for(var r=0;r<a.length;r++)if(!n.call(t,a[r])||!i(e[a[r]],t[a[r]]))return!1;return!0}},1470:function(e,t,a){"use strict";function n(e,t){var a="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!a){if(Array.isArray(e)||(a=function(e,t){if(!e)return;if("string"==typeof e)return i(e,t);var a=Object.prototype.toString.call(e).slice(8,-1);"Object"===a&&e.constructor&&(a=e.constructor.name);if("Map"===a||"Set"===a)return Array.from(e);if("Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a))return i(e,t)}(e))||t&&e&&"number"==typeof e.length){a&&(e=a);var n=0,s=function(){};return{s:s,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:s}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r,o=!0,l=!1;return{s:function(){a=a.call(e)},n:function(){var e=a.next();return o=e.done,e},e:function(e){l=!0,r=e},f:function(){try{o||null==a.return||a.return()}finally{if(l)throw r}}}}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var a=0,n=new Array(t);a<t;a++)n[a]=e[a];return n}var s=a(888),r=a(254);function o(e){e.constructor.calculateState||r(!1)}e.exports=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{withProps:!1};return e=e.filter((function(e){return!!e})),{getInitialState:function(){return o(this),t.withProps?this.constructor.calculateState(null,this.props):this.constructor.calculateState(null,void 0)},componentWillMount:function(){var a=this,n=!1,i=function(){n=!0};this._fluxMixinSubscriptions=e.map((function(e){return e.addListener(i)}));this._fluxMixinStoreGroup=new s(e,(function(){n&&a.setState((function(e){return t.withProps?a.constructor.calculateState(e,a.props):a.constructor.calculateState(e,void 0)})),n=!1}))},componentWillUnmount:function(){this._fluxMixinStoreGroup.release();var e,t=n(this._fluxMixinSubscriptions);try{for(t.s();!(e=t.n()).done;){e.value.remove()}}catch(e){t.e(e)}finally{t.f()}this._fluxMixinSubscriptions=[]}}}},1471:function(e,t,a){"use strict";function n(e,t){return n=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},n(e,t)}var i=a(889),s=a(1477),r=a(254),o=function(e){var t,a;function i(t){var a,n,i,s;return a=e.call(this,t)||this,n=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(a),s=void 0,(i="_state")in n?Object.defineProperty(n,i,{value:s,enumerable:!0,configurable:!0,writable:!0}):n[i]=s,a._state=a.getInitialState(),a}a=e,(t=i).prototype=Object.create(a.prototype),t.prototype.constructor=t,n(t,a);var o=i.prototype;return o.getState=function(){return this._state},o.getInitialState=function(){return s("FluxReduceStore","getInitialState")},o.reduce=function(e,t){return s("FluxReduceStore","reduce")},o.areEqual=function(e,t){return e===t},o.__invokeOnDispatch=function(e){this.__changed=!1;var t=this._state,a=this.reduce(t,e);void 0===a&&r(!1),this.areEqual(t,a)||(this._state=a,this.__emitChange()),this.__changed&&this.__emitter.emit(this.__changeEvent)},i}(i);e.exports=o},1472:function(e,t,a){var n={EventEmitter:a(1473),EmitterSubscription:a(890)};e.exports=n},1473:function(e,t,a){"use strict";var n=a(890),i=a(1475),s=a(254),r=a(1476),o=function(){function e(){this._subscriber=new i,this._currentSubscription=null}var t=e.prototype;return t.addListener=function(e,t,a){return this._subscriber.addSubscription(e,new n(this._subscriber,t,a))},t.once=function(e,t,a){var n=this;return this.addListener(e,(function(){n.removeCurrentListener(),t.apply(a,arguments)}))},t.removeAllListeners=function(e){this._subscriber.removeAllSubscriptions(e)},t.removeCurrentListener=function(){this._currentSubscription||s(!1),this._subscriber.removeSubscription(this._currentSubscription)},t.listeners=function(e){var t=this._subscriber.getSubscriptionsForType(e);return t?t.filter(r.thatReturnsTrue).map((function(e){return e.listener})):[]},t.emit=function(e){var t=this._subscriber.getSubscriptionsForType(e);if(t){for(var a=Object.keys(t),n=0;n<a.length;n++){var i=a[n],s=t[i];s&&(this._currentSubscription=s,this.__emitToSubscription.apply(this,[s].concat(Array.prototype.slice.call(arguments))))}this._currentSubscription=null}},t.__emitToSubscription=function(e,t){var a=Array.prototype.slice.call(arguments,2);e.listener.apply(e.context,a)},e}();e.exports=o},1474:function(e,t,a){"use strict";var n=function(){function e(e){this.subscriber=e}return e.prototype.remove=function(){this.subscriber&&(this.subscriber.removeSubscription(this),this.subscriber=null)},e}();e.exports=n},1475:function(e,t,a){"use strict";var n=a(254),i=function(){function e(){this._subscriptionsForType={},this._currentSubscription=null}var t=e.prototype;return t.addSubscription=function(e,t){t.subscriber!==this&&n(!1),this._subscriptionsForType[e]||(this._subscriptionsForType[e]=[]);var a=this._subscriptionsForType[e].length;return this._subscriptionsForType[e].push(t),t.eventType=e,t.key=a,t},t.removeAllSubscriptions=function(e){void 0===e?this._subscriptionsForType={}:delete this._subscriptionsForType[e]},t.removeSubscription=function(e){var t=e.eventType,a=e.key,n=this._subscriptionsForType[t];n&&delete n[a]},t.getSubscriptionsForType=function(e){return this._subscriptionsForType[e]},e}();e.exports=i},1476:function(e,t,a){"use strict";function n(e){return function(){return e}}var i=function(){};i.thatReturns=n,i.thatReturnsFalse=n(!1),i.thatReturnsTrue=n(!0),i.thatReturnsNull=n(null),i.thatReturnsThis=function(){return this},i.thatReturnsArgument=function(e){return e},e.exports=i},1477:function(e,t,a){"use strict";var n=a(254);e.exports=function(e,t){n(!1)}},1478:function(e,t,a){"use strict";var n=a(13),i=a.n(n),s=a(136),r=a(16),o=a(131),l=a(379),c=a(124),d=a(201),m=a(125),u=a(128);function h(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function p(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?h(Object(a),!0).forEach((function(t){i()(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):h(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}const g="im.vector.auto_rs_request";class v extends d.a{constructor(){super(c.a,{reportedSessionIds:new Set,lastRageshakeTime:0,initialSyncCompleted:!1}),this.onDecryptionAttempt=this.onDecryptionAttempt.bind(this),this.onDeviceMessage=this.onDeviceMessage.bind(this),this.onSyncStateChange=this.onSyncStateChange.bind(this)}static get instance(){return v.internalInstance}async onAction(e){if(e.action===u.a.ReportKeyBackupNotEnabled)this.onReportKeyBackupNotEnabled()}async onReady(){m.b.getValue("automaticDecryptionErrorReporting")&&this.matrixClient&&(this.matrixClient.on(s.MatrixEventEvent.Decrypted,this.onDecryptionAttempt),this.matrixClient.on(s.ClientEvent.ToDeviceEvent,this.onDeviceMessage),this.matrixClient.on(s.ClientEvent.Sync,this.onSyncStateChange))}async onNotReady(){this.matrixClient&&(this.matrixClient.removeListener(s.ClientEvent.ToDeviceEvent,this.onDeviceMessage),this.matrixClient.removeListener(s.MatrixEventEvent.Decrypted,this.onDecryptionAttempt),this.matrixClient.removeListener(s.ClientEvent.Sync,this.onSyncStateChange))}async onDecryptionAttempt(e){if(!this.state.initialSyncCompleted)return;const t=e.getWireContent(),a=t.session_id;if(e.isDecryptionFailure()&&!this.state.reportedSessionIds.has(a)){if(await Object(r.J)(5e3),!e.isDecryptionFailure())return;const n=new Set(this.state.reportedSessionIds);await this.updateState({reportedSessionIds:n.add(a)});const i=(new Date).getTime();if(i-this.state.lastRageshakeTime<6e4)return;await this.updateState({lastRageshakeTime:i});const s={event_id:e.getId(),room_id:e.getRoomId(),session_id:a,device_id:t.device_id,user_id:e.getSender(),sender_key:t.sender_key},c=await Object(l.a)(o.b.get().bug_report_endpoint_url,{userText:"Auto-reporting decryption error (recipient)",sendLogs:!0,labels:["Z-UISI","web","uisi-recipient"],customApp:o.b.get().uisi_autorageshake_app,customFields:{auto_uisi:JSON.stringify(s)}}),d=p(p({},s),{},{recipient_rageshake:c});this.matrixClient.sendToDevice(g,{[d.user_id]:{[d.device_id]:d}})}}async onSyncStateChange(e,t,a){this.state.initialSyncCompleted||await this.updateState({initialSyncCompleted:!!a.nextSyncToken})}async onDeviceMessage(e){if(e.getType()!==g)return;const t=e.getContent(),a=t.recipient_rageshake||"",n=(new Date).getTime();n-this.state.lastRageshakeTime>6e4&&(await this.updateState({lastRageshakeTime:n}),await Object(l.a)(o.b.get().bug_report_endpoint_url,{userText:`Auto-reporting decryption error (sender)\nRecipient rageshake: ${a}`,sendLogs:!0,labels:["Z-UISI","web","uisi-sender"],customApp:o.b.get().uisi_autorageshake_app,customFields:{recipient_rageshake:a,auto_uisi:JSON.stringify(t)}}))}async onReportKeyBackupNotEnabled(){m.b.getValue("automaticKeyBackNotEnabledReporting")&&await Object(l.a)(o.b.get().bug_report_endpoint_url,{userText:"Auto-reporting key backup not enabled",sendLogs:!0,labels:["web",u.a.ReportKeyBackupNotEnabled]})}}i()(v,"internalInstance",(()=>{const e=new v;return e.start(),e})()),window.mxAutoRageshakeStore=v.instance},1479:function(e,t,a){"use strict";a.d(t,"a",(function(){return o}));var n=a(13),i=a.n(n),s=a(17),r=a(148);class o extends s.EventEmitter{constructor(){super(...arguments),i()(this,"_isResizing",!1),i()(this,"throttledMiddlePanel",Object(r.throttle)((()=>this.emit("middlePanelResized")),200))}get isResizing(){return this._isResizing}startResizing(){this._isResizing=!0,this.emit("isResizing",!0)}stopResizing(){this._isResizing=!1,this.emit("isResizing",!1)}noisyMiddlePanel(){this.emit("middlePanelResizedNoisy")}updateMiddlePanel(){this.throttledMiddlePanel(),this.noisyMiddlePanel()}notifyLeftHandleResized(){this.updateMiddlePanel()}notifyRightHandleResized(){this.updateMiddlePanel()}notifyTimelineHeightChanged(){this.updateMiddlePanel()}notifyWindowResized(){this.updateMiddlePanel()}}},1480:function(e,t,a){"use strict";a.d(t,"a",(function(){return i}));var n=a(120);function i(e,t,a){Object(n.useEffect)((()=>{let n=null;const i=()=>{n=null,t(...a)};if(!1!==e)return n=window.setTimeout(i,100),()=>{n&&clearTimeout(n)}}),[e,t,a])}},1481:function(e,t,a){"use strict";a.d(t,"a",(function(){return o}));var n=a(120),i=a(122),s=a(137),r=a(125);const o=()=>{const[e,t]=Object(n.useState)((()=>{const e=i.a.get();return r.b.getValue("SpotlightSearch.recentSearches",null).map((t=>e.getRoom(t))).filter(Boolean)}));return[e,()=>{r.b.setValue("SpotlightSearch.recentSearches",null,s.a.ACCOUNT,[]),t([])}]}},1482:function(e,t,a){"use strict";a.d(t,"a",(function(){return r}));var n=a(120),i=a(122),s=a(632);const r=()=>{const[e,t]=Object(n.useState)(null),[a,r]=Object(n.useState)(!1),[o,l]=Object(s.a)(t);return{ready:!0,loading:a,profile:e,search:Object(n.useCallback)((async e=>{let{query:a}=e;if(o(a),null==a||!a.length||!a.startsWith("@")||!a.includes(":"))return t(null),!0;r(!0);try{const e=await i.a.get().getProfileInfo(a);return l(a,{user_id:a,avatar_url:e.avatar_url,display_name:e.displayname}),!0}catch(e){return console.error("Could not fetch profile info for params",{term:a},e),l(a,null),!1}finally{r(!1)}}),[o,l])}}},1483:function(e,t,a){"use strict";a.d(t,"a",(function(){return g}));var n=a(120),i=a(122),s=a(131),r=a(125),o=a(632),l=a(166);const c="ALL_ROOMS",d="mx_last_room_directory_server",m="mx_last_room_directory_instance";let u;const h="nsfw",p=e=>{var t,a;return!(null!==(t=e.name)&&void 0!==t&&t.toLocaleLowerCase().includes(h)||null!==(a=e.topic)&&void 0!==a&&a.toLocaleLowerCase().includes(h))},g=()=>{const[e,t]=Object(n.useState)([]),[a,h]=Object(n.useState)(void 0),[g,v]=Object(n.useState)(null),[b,f]=Object(n.useState)(!1),[y,E]=Object(n.useState)(!1),[_,S]=Object(o.a)(t),w=Object(l.b)("SpotlightSearch.showNsfwPublicRooms");const O=Object(n.useCallback)((async e=>{let{limit:t=20,query:n,roomTypes:s}=e;const r={limit:t};(null==a?void 0:a.roomServer)!=i.a.getHomeserverName()&&(r.server=null==a?void 0:a.roomServer),(null==a?void 0:a.instanceId)===c?r.include_all_networks=!0:null!=a&&a.instanceId&&(r.third_party_instance_id=a.instanceId),(n||s)&&(r.filter={generic_search_term:n,room_types:await i.a.get().doesServerSupportUnstableFeature("org.matrix.msc3827.stable")?Array.from(s):null}),_(r);try{E(!0);const{chunk:e}=await i.a.get().publicRooms(r);return S(r,w?e:e.filter(p)),!0}catch(e){return console.error("Could not fetch public rooms for params",r,e),S(r,[]),!1}finally{E(!1)}}),[a,_,S,w]);return Object(n.useEffect)((()=>{!async function(){if(i.a.get())if(u)v(u);else{const e=await i.a.get().getThirdpartyProtocols();u=e,v(e)}else f(!0)}()}),[]),Object(n.useEffect)((()=>{var e,t,a,n;if(null===g)return;const o=i.a.getHomeserverName(),l=localStorage.getItem(d),u=null!==(e=localStorage.getItem(m))&&void 0!==e?e:void 0;let p,v=o;(null!==(t=s.b.getObject("room_directory"))&&void 0!==t&&null!==(a=t.get("servers"))&&void 0!==a&&a.includes(l)||null!==(n=r.b.getValue("room_directory_servers"))&&void 0!==n&&n.includes(l))&&(v=l),v!==o||u!==c&&!Object.values(g).some((e=>{e.instances.some((e=>e.instance_id===u))}))||(p=u),f(!0),h({roomServer:v,instanceId:p})}),[g]),Object(n.useEffect)((()=>{localStorage.setItem(d,null==a?void 0:a.roomServer),null!=a&&a.instanceId?localStorage.setItem(m,null==a?void 0:a.instanceId):localStorage.removeItem(m)}),[a]),{ready:b,loading:y,publicRooms:e,protocols:g,config:a,search:O,setConfig:function(e){if(!b)throw new Error("public room configuration not initialised yet");h(e)}}}},1484:function(e,t,a){"use strict";a.d(t,"a",(function(){return l}));var n=a(120),i=a(136),s=a(893),r=a(16),o=a(122);const l=(e,t)=>{var a;const[l,c]=Object(n.useState)([]),[d,m]=Object(n.useState)(),u=Object(n.useCallback)((()=>{m(e?new s.a(e,50):null)}),[e]);Object(n.useEffect)(u,[u]),Object(n.useEffect)((()=>{if(!e||!d)return;let t=!1;return(async()=>{for(;null!=d&&d.canLoadMore&&!t&&e===d.root;)await d.load(),d.canLoadMore&&d.load(),c(d.rooms)})(),()=>{t=!0}}),[e,d]);return[Object(n.useMemo)((()=>{const e=t.trim(),a=e.toLowerCase(),n=Object(r.z)(e),s=o.a.get();return null==l?void 0:l.filter((e=>{var t;return e.room_type!==i.RoomType.Space&&"join"!==(null===(t=s.getRoom(e.room_id))||void 0===t?void 0:t.getMyMembership())&&(Object(r.z)(e.name||"").includes(n)||(e.canonical_alias||"").includes(a))}))}),[l,t]),null!==(a=null==d?void 0:d.loading)&&void 0!==a&&a]}},1485:function(e,t,a){"use strict";a.d(t,"a",(function(){return o}));var n=a(120),i=a(122),s=a(402),r=a(632);const o=()=>{const[e,t]=Object(n.useState)([]),[a,o]=Object(n.useState)(!1),[l,c]=Object(r.a)(t);return{ready:!0,loading:a,users:e,search:Object(n.useCallback)((async e=>{let{limit:a=20,query:n}=e;const r={limit:a,term:n};if(l(r),null==n||!n.length)return t([]),!0;try{o(!0);const{results:e}=await i.a.get().searchUserDirectory(r);return c(r,e.map((e=>new s.a(e)))),!0}catch(e){return console.error("Could not fetch user in user directory for params",{limit:a,term:n},e),c(r,[]),!1}finally{o(!1)}}),[l,c])}}},1486:function(e,t,a){"use strict";a.d(t,"a",(function(){return p}));var n=a(130),i=a.n(n),s=a(132),r=a.n(s),o=a(126),l=a.n(o),c=a(120),d=a.n(c),m=a(169),u=a(123);const h=["inputRef","children","endAdornment","className"],p=e=>{let{inputRef:t,children:a,endAdornment:n,className:s}=e,o=r()(e,h);const[c,p,g]=Object(m.i)(t);return d.a.createElement(u.a,i()({},o,{className:l()(s,"mx_SpotlightDialog_option"),onFocus:c,inputRef:g,tabIndex:-1,"aria-selected":p,role:"option"}),a,d.a.createElement("div",{className:"mx_SpotlightDialog_option--endAdornment"},d.a.createElement("kbd",{className:"mx_SpotlightDialog_enterPrompt","aria-hidden":!0},"↵"),n))}},1487:function(e,t,a){"use strict";a.d(t,"a",(function(){return l}));var n=a(120),i=a.n(n),s=a(196),r=a(121),o=a(284);function l(e){var t,a,n;let{room:l,labelId:c,descriptionId:d,detailsId:m}=e,u=l.name||Object(o.a)(null!==(t=l.canonical_alias)&&void 0!==t?t:"",null!==(a=l.aliases)&&void 0!==a?a:[])||Object(r.a)("Unnamed room");u.length>80&&(u=`${u.substring(0,80)}...`);let h=l.topic||"";return h.length>800&&(h=`${h.substring(0,800)}...`),i.a.createElement("div",{className:"mx_SpotlightDialog_result_publicRoomDetails"},i.a.createElement("div",{className:"mx_SpotlightDialog_result_publicRoomHeader"},i.a.createElement("span",{id:c,className:"mx_SpotlightDialog_result_publicRoomName"},u),i.a.createElement("span",{id:d,className:"mx_SpotlightDialog_result_publicRoomAlias"},null!==(n=l.canonical_alias)&&void 0!==n?n:l.room_id)),i.a.createElement("div",{id:m,className:"mx_SpotlightDialog_result_publicRoomDescription"},i.a.createElement("span",{className:"mx_SpotlightDialog_result_publicRoomMemberCount"},Object(r.a)("%(count)s Members",{count:l.num_joined_members})),h&&i.a.createElement(i.a.Fragment,null," · ",i.a.createElement("span",{className:"mx_SpotlightDialog_result_publicRoomTopic",dangerouslySetInnerHTML:{__html:Object(s.g)(h)}}))))}},1488:function(e,t,a){"use strict";a.d(t,"a",(function(){return b}));var n=a(130),i=a.n(n),s=a(126),r=a.n(s),o=a(120),l=a.n(o),c=a(328),d=a(597),m=a(121),u=a(266),h=a(831),p=a(830),g=a(634),v=a(448);function b(e){let{room:t}=e;const[a]=Object(d.a)(t),[n,s]=Object(o.useState)(null),[b,f]=Object(o.useState)(null);let y,E;null!==n&&(y=t.isSpaceRoom()?l.a.createElement(g.a,i()({},Object(v.a)(n),{space:t,onFinished:()=>s(null)})):l.a.createElement(h.a,i()({},Object(v.a)(n),{room:t,onFinished:()=>s(null)}))),null!==b&&(E=l.a.createElement(p.a,i()({},Object(v.a)(b),{room:t,onFinished:()=>f(null)})));const _=r()("mx_SpotlightDialog_option--notifications",{mx_RoomNotificationContextMenu_iconBell:a===u.a.AllMessages,mx_RoomNotificationContextMenu_iconBellDot:a===u.a.AllMessagesLoud,mx_RoomNotificationContextMenu_iconBellMentions:a===u.a.MentionsOnly,mx_RoomNotificationContextMenu_iconBellCrossed:a===u.a.Mute});return l.a.createElement(o.Fragment,null,l.a.createElement(c.a,{className:"mx_SpotlightDialog_option--menu",onClick:e=>{e.preventDefault(),e.stopPropagation();const t=e.target;s(t.getBoundingClientRect())},title:t.isSpaceRoom()?Object(m.a)("Space options"):Object(m.a)("Room options"),isExpanded:null!==n}),!t.isSpaceRoom()&&l.a.createElement(c.a,{className:_,onClick:e=>{e.preventDefault(),e.stopPropagation();const t=e.target;f(t.getBoundingClientRect())},title:Object(m.a)("Notification options"),isExpanded:null!==b}),y,E)}},1489:function(e,t,a){"use strict";a.d(t,"a",(function(){return p}));var n=a(130),i=a.n(n),s=a(132),r=a.n(s),o=a(126),l=a.n(o),c=a(120),d=a.n(c),m=a(169),u=a(147);const h=["inputRef","className"],p=e=>{let{inputRef:t,className:a}=e,n=r()(e,h);const[s,o,c]=Object(m.i)(t);return d.a.createElement(u.a,i()({},n,{className:l()(a,"mx_SpotlightDialog_option"),onFocus:s,inputRef:c,tabIndex:-1,"aria-selected":o,role:"option"}))}},1490:function(e,t,a){"use strict";a.r(t),a.d(t,"Icon",(function(){return r}));var n,i=a(120);function s(){return s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},s.apply(this,arguments)}function r(e){return i.createElement("svg",s({fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 18 18",role:"presentation","aria-hidden":!0},e),n||(n=i.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M15 9a6 6 0 01-6 6v-2a4 4 0 000-8V3a6 6 0 016 6zM9 5a4 4 0 100 8V5zm8 4A8 8 0 111 9a8 8 0 0116 0z",fill:"#000"})))}t.default="img/element-icons/roomlist/dark-light-mode.87d7411.svg"},1491:function(e,t,a){"use strict";function n(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(t,"__esModule",{value:!0});var i=a(120),s=n(i),r=n(a(687)),o=n(a(130)),l=a(1492),c=a(1494),d=a(1513),m=a(1514),u=n(a(1516)),h=n(a(1517)),p=n(a(185));function g(e,t){}g.bind(null,"warn"),g.bind(null,"error");function v(){}function b(e,t,a){var n=t.map((function(t){var n=function(e,t){return o({},e,{},t)}(a,t.options);return e.addEventListener(t.eventName,t.fn,n),function(){e.removeEventListener(t.eventName,t.fn,n)}}));return function(){n.forEach((function(e){e()}))}}var f="Invariant failed";function y(e){this.message=e}function E(e,t){if(!e)throw new y(f)}y.prototype.toString=function(){return this.message};var _=function(e){function t(){for(var t,a=arguments.length,n=new Array(a),i=0;i<a;i++)n[i]=arguments[i];return(t=e.call.apply(e,[this].concat(n))||this).callbacks=null,t.unbind=v,t.onWindowError=function(e){var a=t.getCallbacks();a.isDragging()&&a.tryAbort(),e.error instanceof y&&e.preventDefault()},t.getCallbacks=function(){if(!t.callbacks)throw new Error("Unable to find AppCallbacks in <ErrorBoundary/>");return t.callbacks},t.setCallbacks=function(e){t.callbacks=e},t}r(t,e);var a=t.prototype;return a.componentDidMount=function(){this.unbind=b(window,[{eventName:"error",fn:this.onWindowError}])},a.componentDidCatch=function(e){if(!(e instanceof y))throw e;this.setState({})},a.componentWillUnmount=function(){this.unbind()},a.render=function(){return this.props.children(this.setCallbacks)},t}(s.Component),S=function(e){return e+1},w=function(e,t){var a=e.droppableId===t.droppableId,n=S(e.index),i=S(t.index);return a?"\n You have moved the item from position "+n+"\n to position "+i+"\n ":"\n You have moved the item from position "+n+"\n in list "+e.droppableId+"\n to list "+t.droppableId+"\n in position "+i+"\n "},O=function(e,t,a){return t.droppableId===a.droppableId?"\n The item "+e+"\n has been combined with "+a.draggableId:"\n The item "+e+"\n in list "+t.droppableId+"\n has been combined with "+a.draggableId+"\n in list "+a.droppableId+"\n "},C=function(e){return"\n The item has returned to its starting position\n of "+S(e.index)+"\n"},x="\n Press space bar to start a drag.\n When dragging you can use the arrow keys to move the item around and escape to cancel.\n Some screen readers may require you to be in focus mode or to use your pass through key\n",k=function(e){return"\n You have lifted an item in position "+S(e.source.index)+"\n"},j=function(e){var t=e.destination;if(t)return w(e.source,t);var a=e.combine;return a?O(e.draggableId,e.source,a):"You are over an area that cannot be dropped on"},R=function(e){if("CANCEL"===e.reason)return"\n Movement cancelled.\n "+C(e.source)+"\n ";var t=e.destination,a=e.combine;return t?"\n You have dropped the item.\n "+w(e.source,t)+"\n ":a?"\n You have dropped the item.\n "+O(e.draggableId,e.source,a)+"\n ":"\n The item has been dropped while not over a drop area.\n "+C(e.source)+"\n "},I={x:0,y:0},T=function(e,t){return{x:e.x+t.x,y:e.y+t.y}},N=function(e,t){return{x:e.x-t.x,y:e.y-t.y}},D=function(e,t){return e.x===t.x&&e.y===t.y},P=function(e){return{x:0!==e.x?-e.x:0,y:0!==e.y?-e.y:0}},M=function(e,t,a){var n;return void 0===a&&(a=0),(n={})[e]=t,n["x"===e?"y":"x"]=a,n},A=function(e,t){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))},L=function(e,t){return Math.min.apply(Math,t.map((function(t){return A(e,t)})))},U=function(e){return function(t){return{x:e(t.x),y:e(t.y)}}},F=function(e,t){return{top:e.top+t.y,left:e.left+t.x,bottom:e.bottom+t.y,right:e.right+t.x}},B=function(e){return[{x:e.left,y:e.top},{x:e.right,y:e.top},{x:e.left,y:e.bottom},{x:e.right,y:e.bottom}]},V=function(e,t){return t&&t.shouldClipSubject?function(e,t){var a=m.getRect({top:Math.max(t.top,e.top),right:Math.min(t.right,e.right),bottom:Math.min(t.bottom,e.bottom),left:Math.max(t.left,e.left)});return a.width<=0||a.height<=0?null:a}(t.pageMarginBox,e):m.getRect(e)},W=function(e){var t=e.page,a=e.withPlaceholder,n=e.axis,i=e.frame,s=function(e,t){return t?F(e,t.scroll.diff.displacement):e}(t.marginBox,i),r=function(e,t,a){var n;return a&&a.increasedBy?o({},e,((n={})[t.end]=e[t.end]+a.increasedBy[t.line],n)):e}(s,n,a);return{page:t,withPlaceholder:a,active:V(r,i)}},H=function(e,t){e.frame||E(!1);var a=e.frame,n=N(t,a.scroll.initial),i=P(n),s=o({},a,{scroll:{initial:a.scroll.initial,current:t,diff:{value:n,displacement:i},max:a.scroll.max}}),r=W({page:e.subject.page,withPlaceholder:e.subject.withPlaceholder,axis:e.axis,frame:s});return o({},e,{frame:s,subject:r})};function z(e){return Object.values?Object.values(e):Object.keys(e).map((function(t){return e[t]}))}function G(e,t){if(e.findIndex)return e.findIndex(t);for(var a=0;a<e.length;a++)if(t(e[a]))return a;return-1}function K(e,t){if(e.find)return e.find(t);var a=G(e,t);return-1!==a?e[a]:void 0}function q(e){return Array.prototype.slice.call(e)}var $=u((function(e){return e.reduce((function(e,t){return e[t.descriptor.id]=t,e}),{})})),Y=u((function(e){return e.reduce((function(e,t){return e[t.descriptor.id]=t,e}),{})})),J=u((function(e){return z(e)})),Q=u((function(e){return z(e)})),X=u((function(e,t){var a=Q(t).filter((function(t){return e===t.descriptor.droppableId})).sort((function(e,t){return e.descriptor.index-t.descriptor.index}));return a}));function Z(e){return e.at&&"REORDER"===e.at.type?e.at.destination:null}function ee(e){return e.at&&"COMBINE"===e.at.type?e.at.combine:null}var te=u((function(e,t){return t.filter((function(t){return t.descriptor.id!==e.descriptor.id}))})),ae=function(e,t){return e.descriptor.droppableId===t.descriptor.id},ne={point:I,value:0},ie={invisible:{},visible:{},all:[]},se={displaced:ie,displacedBy:ne,at:null},re=function(e,t){return function(a){return e<=a&&a<=t}},oe=function(e){var t=re(e.top,e.bottom),a=re(e.left,e.right);return function(n){if(t(n.top)&&t(n.bottom)&&a(n.left)&&a(n.right))return!0;var i=t(n.top)||t(n.bottom),s=a(n.left)||a(n.right);if(i&&s)return!0;var r=n.top<e.top&&n.bottom>e.bottom,o=n.left<e.left&&n.right>e.right;return!(!r||!o)||(r&&s||o&&i)}},le=function(e){var t=re(e.top,e.bottom),a=re(e.left,e.right);return function(e){return t(e.top)&&t(e.bottom)&&a(e.left)&&a(e.right)}},ce={direction:"vertical",line:"y",crossAxisLine:"x",start:"top",end:"bottom",size:"height",crossAxisStart:"left",crossAxisEnd:"right",crossAxisSize:"width"},de={direction:"horizontal",line:"x",crossAxisLine:"y",start:"left",end:"right",size:"width",crossAxisStart:"top",crossAxisEnd:"bottom",crossAxisSize:"height"},me=function(e){var t=e.target,a=e.destination,n=e.viewport,i=e.withDroppableDisplacement,s=e.isVisibleThroughFrameFn,r=i?function(e,t){var a=t.frame?t.frame.scroll.diff.displacement:I;return F(e,a)}(t,a):t;return function(e,t,a){return!!t.subject.active&&a(t.subject.active)(e)}(r,a,s)&&function(e,t,a){return a(t)(e)}(r,n,s)},ue=function(e){return me(o({},e,{isVisibleThroughFrameFn:oe}))},he=function(e){return me(o({},e,{isVisibleThroughFrameFn:le}))};function pe(e){var t=e.afterDragging,a=e.destination,n=e.displacedBy,i=e.viewport,s=e.forceShouldAnimate,r=e.last;return t.reduce((function(e,t){var o=function(e,t){var a=e.page.marginBox,n={top:t.point.y,right:0,bottom:0,left:t.point.x};return m.getRect(m.expand(a,n))}(t,n),l=t.descriptor.id;if(e.all.push(l),!ue({target:o,destination:a,viewport:i,withDroppableDisplacement:!0}))return e.invisible[t.descriptor.id]=!0,e;var c=function(e,t,a){if("boolean"==typeof a)return a;if(!t)return!0;var n=t.invisible,i=t.visible;if(n[e])return!1;var s=i[e];return!s||s.shouldAnimate}(l,r,s),d={draggableId:l,shouldAnimate:c};return e.visible[l]=d,e}),{all:[],visible:{},invisible:{}})}function ge(e){var t=e.insideDestination,a=e.inHomeList,n=e.displacedBy,i=e.destination,s=function(e,t){if(!e.length)return 0;var a=e[e.length-1].descriptor.index;return t.inHomeList?a:a+1}(t,{inHomeList:a});return{displaced:ie,displacedBy:n,at:{type:"REORDER",destination:{droppableId:i.descriptor.id,index:s}}}}function ve(e){var t=e.draggable,a=e.insideDestination,n=e.destination,i=e.viewport,s=e.displacedBy,r=e.last,o=e.index,l=e.forceShouldAnimate,c=ae(t,n);if(null==o)return ge({insideDestination:a,inHomeList:c,displacedBy:s,destination:n});var d=K(a,(function(e){return e.descriptor.index===o}));if(!d)return ge({insideDestination:a,inHomeList:c,displacedBy:s,destination:n});var m=te(t,a),u=a.indexOf(d);return{displaced:pe({afterDragging:m.slice(u),destination:n,displacedBy:s,last:r,viewport:i.frame,forceShouldAnimate:l}),displacedBy:s,at:{type:"REORDER",destination:{droppableId:n.descriptor.id,index:o}}}}function be(e,t){return Boolean(t.effected[e])}var fe=function(e){var t=e.isMovingForward,a=e.isInHomeList,n=e.draggable,i=e.draggables,s=e.destination,r=e.insideDestination,o=e.previousImpact,l=e.viewport,c=e.afterCritical,d=o.at;if(d||E(!1),"REORDER"===d.type){var m=function(e){var t=e.isMovingForward,a=e.isInHomeList,n=e.insideDestination,i=e.location;if(!n.length)return null;var s=i.index,r=t?s+1:s-1,o=n[0].descriptor.index,l=n[n.length-1].descriptor.index;return r<o||r>(a?l:l+1)?null:r}({isMovingForward:t,isInHomeList:a,location:d.destination,insideDestination:r});return null==m?null:ve({draggable:n,insideDestination:r,destination:s,viewport:l,last:o.displaced,displacedBy:o.displacedBy,index:m})}var u=function(e){var t=e.isMovingForward,a=e.destination,n=e.draggables,i=e.combine,s=e.afterCritical;if(!a.isCombineEnabled)return null;var r=i.draggableId,o=n[r].descriptor.index;return be(r,s)?t?o:o-1:t?o+1:o}({isMovingForward:t,destination:s,displaced:o.displaced,draggables:i,combine:d.combine,afterCritical:c});return null==u?null:ve({draggable:n,insideDestination:r,destination:s,viewport:l,last:o.displaced,displacedBy:o.displacedBy,index:u})},ye=function(e){var t=e.afterCritical,a=e.impact,n=e.draggables,i=ee(a);i||E(!1);var s=i.draggableId,r=n[s].page.borderBox.center,o=function(e){var t=e.displaced,a=e.afterCritical,n=e.combineWith,i=e.displacedBy,s=Boolean(t.visible[n]||t.invisible[n]);return be(n,a)?s?I:P(i.point):s?i.point:I}({displaced:a.displaced,afterCritical:t,combineWith:s,displacedBy:a.displacedBy});return T(r,o)},Ee=function(e,t){return t.margin[e.start]+t.borderBox[e.size]/2},_e=function(e,t,a){return t[e.crossAxisStart]+a.margin[e.crossAxisStart]+a.borderBox[e.crossAxisSize]/2},Se=function(e){var t=e.axis,a=e.moveRelativeTo,n=e.isMoving;return M(t.line,a.marginBox[t.end]+Ee(t,n),_e(t,a.marginBox,n))},we=function(e){var t=e.axis,a=e.moveRelativeTo,n=e.isMoving;return M(t.line,a.marginBox[t.start]-function(e,t){return t.margin[e.end]+t.borderBox[e.size]/2}(t,n),_e(t,a.marginBox,n))},Oe=function(e){var t=e.impact,a=e.draggable,n=e.draggables,i=e.droppable,s=e.afterCritical,r=X(i.descriptor.id,n),o=a.page,l=i.axis;if(!r.length)return function(e){var t=e.axis,a=e.moveInto,n=e.isMoving;return M(t.line,a.contentBox[t.start]+Ee(t,n),_e(t,a.contentBox,n))}({axis:l,moveInto:i.page,isMoving:o});var c=t.displaced,d=t.displacedBy,u=c.all[0];if(u){var h=n[u];if(be(u,s))return we({axis:l,moveRelativeTo:h.page,isMoving:o});var p=m.offset(h.page,d.point);return we({axis:l,moveRelativeTo:p,isMoving:o})}var g=r[r.length-1];if(g.descriptor.id===a.descriptor.id)return o.borderBox.center;if(be(g.descriptor.id,s)){var v=m.offset(g.page,P(s.displacedBy.point));return Se({axis:l,moveRelativeTo:v,isMoving:o})}return Se({axis:l,moveRelativeTo:g.page,isMoving:o})},Ce=function(e,t){var a=e.frame;return a?T(t,a.scroll.diff.displacement):t},xe=function(e){var t=function(e){var t=e.impact,a=e.draggable,n=e.droppable,i=e.draggables,s=e.afterCritical,r=a.page.borderBox.center,o=t.at;return n&&o?"REORDER"===o.type?Oe({impact:t,draggable:a,draggables:i,droppable:n,afterCritical:s}):ye({impact:t,draggables:i,afterCritical:s}):r}(e),a=e.droppable;return a?Ce(a,t):t},ke=function(e,t){var a=N(t,e.scroll.initial),n=P(a);return{frame:m.getRect({top:t.y,bottom:t.y+e.frame.height,left:t.x,right:t.x+e.frame.width}),scroll:{initial:e.scroll.initial,max:e.scroll.max,current:t,diff:{value:a,displacement:n}}}};function je(e,t){return e.map((function(e){return t[e]}))}var Re=function(e){var t=e.pageBorderBoxCenter,a=e.draggable,n=function(e,t){return T(e.scroll.diff.displacement,t)}(e.viewport,t),i=N(n,a.page.borderBox.center);return T(a.client.borderBox.center,i)},Ie=function(e){var t=e.draggable,a=e.destination,n=e.newPageBorderBoxCenter,i=e.viewport,s=e.withDroppableDisplacement,r=e.onlyOnMainAxis,l=void 0!==r&&r,c=N(n,t.page.borderBox.center),d={target:F(t.page.borderBox,c),destination:a,withDroppableDisplacement:s,viewport:i};return l?function(e){return me(o({},e,{isVisibleThroughFrameFn:(t=e.destination.axis,function(e){var a=re(e.top,e.bottom),n=re(e.left,e.right);return function(e){return t===ce?a(e.top)&&a(e.bottom):n(e.left)&&n(e.right)}})}));var t}(d):he(d)},Te=function(e){var t=e.isMovingForward,a=e.draggable,n=e.destination,i=e.draggables,s=e.previousImpact,r=e.viewport,l=e.previousPageBorderBoxCenter,c=e.previousClientSelection,d=e.afterCritical;if(!n.isEnabled)return null;var m=X(n.descriptor.id,i),u=ae(a,n),h=function(e){var t=e.isMovingForward,a=e.draggable,n=e.destination,i=e.insideDestination,s=e.previousImpact;if(!n.isCombineEnabled)return null;if(!Z(s))return null;function r(e){var t={type:"COMBINE",combine:{draggableId:e,droppableId:n.descriptor.id}};return o({},s,{at:t})}var l=s.displaced.all,c=l.length?l[0]:null;if(t)return c?r(c):null;var d=te(a,i);if(!c)return d.length?r(d[d.length-1].descriptor.id):null;var m=G(d,(function(e){return e.descriptor.id===c}));-1===m&&E(!1);var u=m-1;return u<0?null:r(d[u].descriptor.id)}({isMovingForward:t,draggable:a,destination:n,insideDestination:m,previousImpact:s})||fe({isMovingForward:t,isInHomeList:u,draggable:a,draggables:i,destination:n,insideDestination:m,previousImpact:s,viewport:r,afterCritical:d});if(!h)return null;var p=xe({impact:h,draggable:a,droppable:n,draggables:i,afterCritical:d});if(Ie({draggable:a,destination:n,newPageBorderBoxCenter:p,viewport:r.frame,withDroppableDisplacement:!1,onlyOnMainAxis:!0}))return{clientSelection:Re({pageBorderBoxCenter:p,draggable:a,viewport:r}),impact:h,scrollJumpRequest:null};var g=N(p,l),v=function(e){var t=e.impact,a=e.viewport,n=e.destination,i=e.draggables,s=e.maxScrollChange,r=ke(a,T(a.scroll.current,s)),l=n.frame?H(n,T(n.frame.scroll.current,s)):n,c=t.displaced,d=pe({afterDragging:je(c.all,i),destination:n,displacedBy:t.displacedBy,viewport:r.frame,last:c,forceShouldAnimate:!1}),m=pe({afterDragging:je(c.all,i),destination:l,displacedBy:t.displacedBy,viewport:a.frame,last:c,forceShouldAnimate:!1}),u={},h={},p=[c,d,m];return c.all.forEach((function(e){var t=function(e,t){for(var a=0;a<t.length;a++){var n=t[a].visible[e];if(n)return n}return null}(e,p);t?h[e]=t:u[e]=!0})),o({},t,{displaced:{all:c.all,invisible:u,visible:h}})}({impact:h,viewport:r,destination:n,draggables:i,maxScrollChange:g});return{clientSelection:c,impact:v,scrollJumpRequest:g}},Ne=function(e){var t=e.subject.active;return t||E(!1),t},De=function(e,t){var a=e.page.borderBox.center;return be(e.descriptor.id,t)?N(a,t.displacedBy.point):a},Pe=function(e,t){var a=e.page.borderBox;return be(e.descriptor.id,t)?F(a,P(t.displacedBy.point)):a},Me=u((function(e,t){var a=t[e.line];return{value:a,point:M(e.line,a)}})),Ae=function(e,t){return o({},e,{scroll:o({},e.scroll,{max:t})})},Le=function(e,t,a){var n=e.frame;ae(t,e)&&E(!1),e.subject.withPlaceholder&&E(!1);var i=Me(e.axis,t.displaceBy).point,s=function(e,t,a){var n=e.axis;if("virtual"===e.descriptor.mode)return M(n.line,t[n.line]);var i=e.subject.page.contentBox[n.size],s=X(e.descriptor.id,a).reduce((function(e,t){return e+t.client.marginBox[n.size]}),0)+t[n.line]-i;return s<=0?null:M(n.line,s)}(e,i,a),r={placeholderSize:i,increasedBy:s,oldFrameMaxScroll:e.frame?e.frame.scroll.max:null};if(!n){var l=W({page:e.subject.page,withPlaceholder:r,axis:e.axis,frame:e.frame});return o({},e,{subject:l})}var c=s?T(n.scroll.max,s):n.scroll.max,d=Ae(n,c),m=W({page:e.subject.page,withPlaceholder:r,axis:e.axis,frame:d});return o({},e,{subject:m,frame:d})},Ue=function(e){var t=e.isMovingForward,a=e.previousPageBorderBoxCenter,n=e.draggable,i=e.isOver,s=e.draggables,r=e.droppables,o=e.viewport,l=e.afterCritical,c=function(e){var t=e.isMovingForward,a=e.pageBorderBoxCenter,n=e.source,i=e.droppables,s=e.viewport,r=n.subject.active;if(!r)return null;var o=n.axis,l=re(r[o.start],r[o.end]),c=J(i).filter((function(e){return e!==n})).filter((function(e){return e.isEnabled})).filter((function(e){return Boolean(e.subject.active)})).filter((function(e){return oe(s.frame)(Ne(e))})).filter((function(e){var a=Ne(e);return t?r[o.crossAxisEnd]<a[o.crossAxisEnd]:a[o.crossAxisStart]<r[o.crossAxisStart]})).filter((function(e){var t=Ne(e),a=re(t[o.start],t[o.end]);return l(t[o.start])||l(t[o.end])||a(r[o.start])||a(r[o.end])})).sort((function(e,a){var n=Ne(e)[o.crossAxisStart],i=Ne(a)[o.crossAxisStart];return t?n-i:i-n})).filter((function(e,t,a){return Ne(e)[o.crossAxisStart]===Ne(a[0])[o.crossAxisStart]}));if(!c.length)return null;if(1===c.length)return c[0];var d=c.filter((function(e){return re(Ne(e)[o.start],Ne(e)[o.end])(a[o.line])}));return 1===d.length?d[0]:d.length>1?d.sort((function(e,t){return Ne(e)[o.start]-Ne(t)[o.start]}))[0]:c.sort((function(e,t){var n=L(a,B(Ne(e))),i=L(a,B(Ne(t)));return n!==i?n-i:Ne(e)[o.start]-Ne(t)[o.start]}))[0]}({isMovingForward:t,pageBorderBoxCenter:a,source:i,droppables:r,viewport:o});if(!c)return null;var d=X(c.descriptor.id,s),m=function(e){var t=e.pageBorderBoxCenter,a=e.viewport,n=e.destination,i=e.insideDestination,s=e.afterCritical,r=i.filter((function(e){return he({target:Pe(e,s),destination:n,viewport:a.frame,withDroppableDisplacement:!0})})).sort((function(e,a){var i=A(t,Ce(n,De(e,s))),r=A(t,Ce(n,De(a,s)));return i<r?-1:r<i?1:e.descriptor.index-a.descriptor.index}));return r[0]||null}({pageBorderBoxCenter:a,viewport:o,destination:c,insideDestination:d,afterCritical:l}),u=function(e){var t=e.previousPageBorderBoxCenter,a=e.moveRelativeTo,n=e.insideDestination,i=e.draggable,s=e.draggables,r=e.destination,o=e.viewport,l=e.afterCritical;if(!a){if(n.length)return null;var c={displaced:ie,displacedBy:ne,at:{type:"REORDER",destination:{droppableId:r.descriptor.id,index:0}}},d=xe({impact:c,draggable:i,droppable:r,draggables:s,afterCritical:l}),m=ae(i,r)?r:Le(r,i,s);return Ie({draggable:i,destination:m,newPageBorderBoxCenter:d,viewport:o.frame,withDroppableDisplacement:!1,onlyOnMainAxis:!0})?c:null}var u,h=Boolean(t[r.axis.line]<=a.page.borderBox.center[r.axis.line]),p=(u=a.descriptor.index,a.descriptor.id===i.descriptor.id||h?u:u+1),g=Me(r.axis,i.displaceBy);return ve({draggable:i,insideDestination:n,destination:r,viewport:o,displacedBy:g,last:ie,index:p})}({previousPageBorderBoxCenter:a,destination:c,draggable:n,draggables:s,moveRelativeTo:m,insideDestination:d,viewport:o,afterCritical:l});if(!u)return null;var h=xe({impact:u,draggable:n,droppable:c,draggables:s,afterCritical:l});return{clientSelection:Re({pageBorderBoxCenter:h,draggable:n,viewport:o}),impact:u,scrollJumpRequest:null}},Fe=function(e){var t=e.at;return t?"REORDER"===t.type?t.destination.droppableId:t.combine.droppableId:null},Be=function(e){var t=e.state,a=e.type,n=function(e,t){var a=Fe(e);return a?t[a]:null}(t.impact,t.dimensions.droppables),i=Boolean(n),s=t.dimensions.droppables[t.critical.droppable.id],r=n||s,o=r.axis.direction,l="vertical"===o&&("MOVE_UP"===a||"MOVE_DOWN"===a)||"horizontal"===o&&("MOVE_LEFT"===a||"MOVE_RIGHT"===a);if(l&&!i)return null;var c="MOVE_DOWN"===a||"MOVE_RIGHT"===a,d=t.dimensions.draggables[t.critical.draggable.id],m=t.current.page.borderBoxCenter,u=t.dimensions,h=u.draggables,p=u.droppables;return l?Te({isMovingForward:c,previousPageBorderBoxCenter:m,draggable:d,destination:r,draggables:h,viewport:t.viewport,previousClientSelection:t.current.client.selection,previousImpact:t.impact,afterCritical:t.afterCritical}):Ue({isMovingForward:c,previousPageBorderBoxCenter:m,draggable:d,isOver:r,draggables:h,droppables:p,viewport:t.viewport,afterCritical:t.afterCritical})};function Ve(e){return"DRAGGING"===e.phase||"COLLECTING"===e.phase}function We(e){var t=re(e.top,e.bottom),a=re(e.left,e.right);return function(e){return t(e.y)&&a(e.x)}}function He(e){var t=e.pageBorderBox,a=e.draggable,n=e.droppables,i=J(n).filter((function(e){if(!e.isEnabled)return!1;var a,n,i=e.subject.active;if(!i)return!1;if(n=i,!((a=t).left<n.right&&a.right>n.left&&a.top<n.bottom&&a.bottom>n.top))return!1;if(We(i)(t.center))return!0;var s=e.axis,r=i.center[s.crossAxisLine],o=t[s.crossAxisStart],l=t[s.crossAxisEnd],c=re(i[s.crossAxisStart],i[s.crossAxisEnd]),d=c(o),m=c(l);return!d&&!m||(d?o<r:l>r)}));return i.length?1===i.length?i[0].descriptor.id:function(e){var t=e.pageBorderBox,a=e.draggable,n=e.candidates,i=a.page.borderBox.center,s=n.map((function(e){var a=e.axis,n=M(e.axis.line,t.center[a.line],e.page.borderBox.center[a.crossAxisLine]);return{id:e.descriptor.id,distance:A(i,n)}})).sort((function(e,t){return t.distance-e.distance}));return s[0]?s[0].id:null}({pageBorderBox:t,draggable:a,candidates:i}):null}var ze=function(e,t){return m.getRect(F(e,t))};function Ge(e){var t=e.displaced,a=e.id;return Boolean(t.visible[a]||t.invisible[a])}var Ke=function(e){var t=e.pageOffset,a=e.draggable,n=e.draggables,i=e.droppables,s=e.previousImpact,r=e.viewport,o=e.afterCritical,l=ze(a.page.borderBox,t),c=He({pageBorderBox:l,draggable:a,droppables:i});if(!c)return se;var d=i[c],m=X(d.descriptor.id,n),u=function(e,t){var a=e.frame;return a?ze(t,a.scroll.diff.value):t}(d,l);return function(e){var t=e.draggable,a=e.pageBorderBoxWithDroppableScroll,n=e.previousImpact,i=e.destination,s=e.insideDestination,r=e.afterCritical;if(!i.isCombineEnabled)return null;var o=i.axis,l=Me(i.axis,t.displaceBy),c=l.value,d=a[o.start],m=a[o.end],u=K(te(t,s),(function(e){var t=e.descriptor.id,a=e.page.borderBox,i=a[o.size]/4,s=be(t,r),l=Ge({displaced:n.displaced,id:t});return s?l?m>a[o.start]+i&&m<a[o.end]-i:d>a[o.start]-c+i&&d<a[o.end]-c-i:l?m>a[o.start]+c+i&&m<a[o.end]+c-i:d>a[o.start]+i&&d<a[o.end]-i}));return u?{displacedBy:l,displaced:n.displaced,at:{type:"COMBINE",combine:{draggableId:u.descriptor.id,droppableId:i.descriptor.id}}}:null}({pageBorderBoxWithDroppableScroll:u,draggable:a,previousImpact:s,destination:d,insideDestination:m,afterCritical:o})||function(e){var t=e.pageBorderBoxWithDroppableScroll,a=e.draggable,n=e.destination,i=e.insideDestination,s=e.last,r=e.viewport,o=e.afterCritical,l=n.axis,c=Me(n.axis,a.displaceBy),d=c.value,m=t[l.start],u=t[l.end],h=function(e){var t=e.draggable,a=e.closest,n=e.inHomeList;return a?n&&a.descriptor.index>t.descriptor.index?a.descriptor.index-1:a.descriptor.index:null}({draggable:a,closest:K(te(a,i),(function(e){var t=e.descriptor.id,a=e.page.borderBox.center[l.line],n=be(t,o),i=Ge({displaced:s,id:t});return n?i?u<=a:m<a-d:i?u<=a+d:m<a})),inHomeList:ae(a,n)});return ve({draggable:a,insideDestination:i,destination:n,viewport:r,last:s,displacedBy:c,index:h})}({pageBorderBoxWithDroppableScroll:u,draggable:a,destination:d,insideDestination:m,last:s.displaced,viewport:r,afterCritical:o})},qe=function(e,t){var a;return o({},e,((a={})[t.descriptor.id]=t,a))},$e=function(e){var t=e.previousImpact,a=e.impact,n=e.droppables,i=Fe(t),s=Fe(a);if(!i)return n;if(i===s)return n;var r=n[i];if(!r.subject.withPlaceholder)return n;var l=function(e){var t=e.subject.withPlaceholder;t||E(!1);var a=e.frame;if(!a){var n=W({page:e.subject.page,axis:e.axis,frame:null,withPlaceholder:null});return o({},e,{subject:n})}var i=t.oldFrameMaxScroll;i||E(!1);var s=Ae(a,i),r=W({page:e.subject.page,axis:e.axis,frame:s,withPlaceholder:null});return o({},e,{subject:r,frame:s})}(r);return qe(n,l)},Ye=function(e){var t=e.state,a=e.clientSelection,n=e.dimensions,i=e.viewport,s=e.impact,r=e.scrollJumpRequest,l=i||t.viewport,c=n||t.dimensions,d=a||t.current.client.selection,m=N(d,t.initial.client.selection),u={offset:m,selection:d,borderBoxCenter:T(t.initial.client.borderBoxCenter,m)},h={selection:T(u.selection,l.scroll.current),borderBoxCenter:T(u.borderBoxCenter,l.scroll.current),offset:T(u.offset,l.scroll.diff.value)},p={client:u,page:h};if("COLLECTING"===t.phase)return o({phase:"COLLECTING"},t,{dimensions:c,viewport:l,current:p});var g=c.draggables[t.critical.draggable.id],v=s||Ke({pageOffset:h.offset,draggable:g,draggables:c.draggables,droppables:c.droppables,previousImpact:t.impact,viewport:l,afterCritical:t.afterCritical}),b=function(e){var t=e.draggable,a=e.draggables,n=e.droppables,i=e.previousImpact,s=e.impact,r=$e({previousImpact:i,impact:s,droppables:n}),o=Fe(s);if(!o)return r;var l=n[o];if(ae(t,l))return r;if(l.subject.withPlaceholder)return r;var c=Le(l,t,a);return qe(r,c)}({draggable:g,impact:v,previousImpact:t.impact,draggables:c.draggables,droppables:c.droppables});return o({},t,{current:p,dimensions:{draggables:c.draggables,droppables:b},impact:v,viewport:l,scrollJumpRequest:r||null,forceShouldAnimate:!r&&null})};var Je=function(e){var t=e.impact,a=e.viewport,n=e.draggables,i=e.destination,s=e.forceShouldAnimate,r=t.displaced,l=function(e,t){return e.map((function(e){return t[e]}))}(r.all,n),c=pe({afterDragging:l,destination:i,displacedBy:t.displacedBy,viewport:a.frame,forceShouldAnimate:s,last:r});return o({},t,{displaced:c})},Qe=function(e){var t=e.impact,a=e.draggable,n=e.droppable,i=e.draggables,s=e.viewport,r=e.afterCritical,o=xe({impact:t,draggable:a,draggables:i,droppable:n,afterCritical:r});return Re({pageBorderBoxCenter:o,draggable:a,viewport:s})},Xe=function(e){var t=e.state,a=e.dimensions,n=e.viewport;"SNAP"!==t.movementMode&&E(!1);var i=t.impact,s=n||t.viewport,r=a||t.dimensions,o=r.draggables,l=r.droppables,c=o[t.critical.draggable.id],d=Fe(i);d||E(!1);var m=l[d],u=Je({impact:i,viewport:s,destination:m,draggables:o}),h=Qe({impact:u,draggable:c,droppable:m,draggables:o,viewport:s,afterCritical:t.afterCritical});return Ye({impact:u,clientSelection:h,state:t,dimensions:r,viewport:s})},Ze=function(e){var t=e.draggable,a=e.home,n=e.draggables,i=e.viewport,s=Me(a.axis,t.displaceBy),r=X(a.descriptor.id,n),o=r.indexOf(t);-1===o&&E(!1);var l,c=r.slice(o+1),d=c.reduce((function(e,t){return e[t.descriptor.id]=!0,e}),{}),m={inVirtualList:"virtual"===a.descriptor.mode,displacedBy:s,effected:d};return{impact:{displaced:pe({afterDragging:c,destination:a,displacedBy:s,last:null,viewport:i.frame,forceShouldAnimate:!1}),displacedBy:s,at:{type:"REORDER",destination:(l=t.descriptor,{index:l.index,droppableId:l.droppableId})}},afterCritical:m}},et=function(e){0},tt=function(e){0},at=function(e){var t=e.additions,a=e.updatedDroppables,n=e.viewport,i=n.scroll.diff.value;return t.map((function(e){var t=e.descriptor.droppableId,s=function(e){var t=e.frame;return t||E(!1),t}(a[t]),r=s.scroll.diff.value,l=function(e){var t=e.draggable,a=e.offset,n=e.initialWindowScroll,i=m.offset(t.client,a),s=m.withScroll(i,n);return o({},t,{placeholder:o({},t.placeholder,{client:i}),client:i,page:s})}({draggable:e,offset:T(i,r),initialWindowScroll:n.scroll.initial});return l}))},nt=function(e){return"SNAP"===e.movementMode},it=function(e,t,a){var n=function(e,t){return{draggables:e.draggables,droppables:qe(e.droppables,t)}}(e.dimensions,t);return!nt(e)||a?Ye({state:e,dimensions:n}):Xe({state:e,dimensions:n})};function st(e){return e.isDragging&&"SNAP"===e.movementMode?o({phase:"DRAGGING"},e,{scrollJumpRequest:null}):e}var rt={phase:"IDLE",completed:null,shouldFlush:!1},ot=function(e,t){if(void 0===e&&(e=rt),"FLUSH"===t.type)return o({},rt,{shouldFlush:!0});if("INITIAL_PUBLISH"===t.type){"IDLE"!==e.phase&&E(!1);var a=t.payload,n=a.critical,i=a.clientSelection,s=a.viewport,r=a.dimensions,l=a.movementMode,c=r.draggables[n.draggable.id],d=r.droppables[n.droppable.id],m={selection:i,borderBoxCenter:c.client.borderBox.center,offset:I},u={client:m,page:{selection:T(m.selection,s.scroll.initial),borderBoxCenter:T(m.selection,s.scroll.initial),offset:T(m.selection,s.scroll.diff.value)}},h=J(r.droppables).every((function(e){return!e.isFixedOnPage})),p=Ze({draggable:c,home:d,draggables:r.draggables,viewport:s}),g=p.impact;return{phase:"DRAGGING",isDragging:!0,critical:n,movementMode:l,dimensions:r,initial:u,current:u,isWindowScrollAllowed:h,impact:g,afterCritical:p.afterCritical,onLiftImpact:g,viewport:s,scrollJumpRequest:null,forceShouldAnimate:null}}if("COLLECTION_STARTING"===t.type)return"COLLECTING"===e.phase||"DROP_PENDING"===e.phase?e:("DRAGGING"!==e.phase&&E(!1),o({phase:"COLLECTING"},e,{phase:"COLLECTING"}));if("PUBLISH_WHILE_DRAGGING"===t.type)return"COLLECTING"!==e.phase&&"DROP_PENDING"!==e.phase&&E(!1),function(e){var t=e.state,a=e.published;et();var n=a.modified.map((function(e){var a=t.dimensions.droppables[e.droppableId];return H(a,e.scroll)})),i=o({},t.dimensions.droppables,{},$(n)),s=Y(at({additions:a.additions,updatedDroppables:i,viewport:t.viewport})),r=o({},t.dimensions.draggables,{},s);a.removals.forEach((function(e){delete r[e]}));var l={droppables:i,draggables:r},c=Fe(t.impact),d=c?l.droppables[c]:null,m=l.draggables[t.critical.draggable.id],u=l.droppables[t.critical.droppable.id],h=Ze({draggable:m,home:u,draggables:r,viewport:t.viewport}),p=h.impact,g=h.afterCritical,v=d&&d.isCombineEnabled?t.impact:p,b=Ke({pageOffset:t.current.page.offset,draggable:l.draggables[t.critical.draggable.id],draggables:l.draggables,droppables:l.droppables,previousImpact:v,viewport:t.viewport,afterCritical:g});tt();var f=o({phase:"DRAGGING"},t,{phase:"DRAGGING",impact:b,onLiftImpact:p,dimensions:l,afterCritical:g,forceShouldAnimate:!1});return"COLLECTING"===t.phase?f:o({phase:"DROP_PENDING"},f,{phase:"DROP_PENDING",reason:t.reason,isWaiting:!1})}({state:e,published:t.payload});if("MOVE"===t.type){if("DROP_PENDING"===e.phase)return e;Ve(e)||E(!1);var v=t.payload.client;return D(v,e.current.client.selection)?e:Ye({state:e,clientSelection:v,impact:nt(e)?e.impact:null})}if("UPDATE_DROPPABLE_SCROLL"===t.type){if("DROP_PENDING"===e.phase)return st(e);if("COLLECTING"===e.phase)return st(e);Ve(e)||E(!1);var b=t.payload,f=b.id,y=b.newScroll,_=e.dimensions.droppables[f];if(!_)return e;var S=H(_,y);return it(e,S,!1)}if("UPDATE_DROPPABLE_IS_ENABLED"===t.type){if("DROP_PENDING"===e.phase)return e;Ve(e)||E(!1);var w=t.payload,O=w.id,C=w.isEnabled,x=e.dimensions.droppables[O];x||E(!1),x.isEnabled===C&&E(!1);var k=o({},x,{isEnabled:C});return it(e,k,!0)}if("UPDATE_DROPPABLE_IS_COMBINE_ENABLED"===t.type){if("DROP_PENDING"===e.phase)return e;Ve(e)||E(!1);var j=t.payload,R=j.id,N=j.isCombineEnabled,P=e.dimensions.droppables[R];P||E(!1),P.isCombineEnabled===N&&E(!1);var M=o({},P,{isCombineEnabled:N});return it(e,M,!0)}if("MOVE_BY_WINDOW_SCROLL"===t.type){if("DROP_PENDING"===e.phase||"DROP_ANIMATING"===e.phase)return e;Ve(e)||E(!1),e.isWindowScrollAllowed||E(!1);var A=t.payload.newScroll;if(D(e.viewport.scroll.current,A))return st(e);var L=ke(e.viewport,A);return nt(e)?Xe({state:e,viewport:L}):Ye({state:e,viewport:L})}if("UPDATE_VIEWPORT_MAX_SCROLL"===t.type){if(!Ve(e))return e;var U=t.payload.maxScroll;if(D(U,e.viewport.scroll.max))return e;var F=o({},e.viewport,{scroll:o({},e.viewport.scroll,{max:U})});return o({phase:"DRAGGING"},e,{viewport:F})}if("MOVE_UP"===t.type||"MOVE_DOWN"===t.type||"MOVE_LEFT"===t.type||"MOVE_RIGHT"===t.type){if("COLLECTING"===e.phase||"DROP_PENDING"===e.phase)return e;"DRAGGING"!==e.phase&&E(!1);var B=Be({state:e,type:t.type});return B?Ye({state:e,impact:B.impact,clientSelection:B.clientSelection,scrollJumpRequest:B.scrollJumpRequest}):e}if("DROP_PENDING"===t.type){var V=t.payload.reason;return"COLLECTING"!==e.phase&&E(!1),o({phase:"DROP_PENDING"},e,{phase:"DROP_PENDING",isWaiting:!0,reason:V})}if("DROP_ANIMATE"===t.type){var W=t.payload,z=W.completed,G=W.dropDuration,K=W.newHomeClientOffset;return"DRAGGING"!==e.phase&&"DROP_PENDING"!==e.phase&&E(!1),{phase:"DROP_ANIMATING",completed:z,dropDuration:G,newHomeClientOffset:K,dimensions:e.dimensions}}return"DROP_COMPLETE"===t.type?{phase:"IDLE",completed:t.payload.completed,shouldFlush:!1}:e},lt=function(e){return{type:"PUBLISH_WHILE_DRAGGING",payload:e}},ct=function(){return{type:"COLLECTION_STARTING",payload:null}},dt=function(e){return{type:"UPDATE_DROPPABLE_SCROLL",payload:e}},mt=function(e){return{type:"UPDATE_DROPPABLE_IS_ENABLED",payload:e}},ut=function(e){return{type:"UPDATE_DROPPABLE_IS_COMBINE_ENABLED",payload:e}},ht=function(e){return{type:"MOVE",payload:e}},pt=function(){return{type:"MOVE_UP",payload:null}},gt=function(){return{type:"MOVE_DOWN",payload:null}},vt=function(){return{type:"MOVE_RIGHT",payload:null}},bt=function(){return{type:"MOVE_LEFT",payload:null}},ft=function(e){return{type:"DROP_COMPLETE",payload:e}},yt=function(e){return{type:"DROP",payload:e}},Et=function(){return{type:"DROP_ANIMATION_FINISHED",payload:null}};var _t="cubic-bezier(.2,1,.1,1)",St={drop:0,combining:.7},wt={drop:.75},Ot=.2+"s "+"cubic-bezier(0.2, 0, 0, 1)",Ct={fluid:"opacity "+Ot,snap:"transform "+Ot+", opacity "+Ot,drop:function(e){var t=e+"s "+_t;return"transform "+t+", opacity "+t},outOfTheWay:"transform "+Ot,placeholder:"height "+Ot+", width "+Ot+", margin "+Ot},xt=function(e){return D(e,I)?null:"translate("+e.x+"px, "+e.y+"px)"},kt=xt,jt=function(e,t){var a=xt(e);return a?t?a+" scale("+wt.drop+")":a:null},Rt=.33,It=.55,Tt=It-Rt,Nt=function(e){var t=e.getState,a=e.dispatch;return function(e){return function(n){if("DROP"===n.type){var i=t(),s=n.payload.reason;if("COLLECTING"!==i.phase){if("IDLE"!==i.phase){"DROP_PENDING"===i.phase&&i.isWaiting&&E(!1),"DRAGGING"!==i.phase&&"DROP_PENDING"!==i.phase&&E(!1);var r=i.critical,l=i.dimensions,c=l.draggables[i.critical.draggable.id],d=function(e){var t=e.draggables,a=e.reason,n=e.lastImpact,i=e.home,s=e.viewport,r=e.onLiftImpact;return n.at&&"DROP"===a?"REORDER"===n.at.type?{impact:n,didDropInsideDroppable:!0}:{impact:o({},n,{displaced:ie}),didDropInsideDroppable:!0}:{impact:Je({draggables:t,impact:r,destination:i,viewport:s,forceShouldAnimate:!0}),didDropInsideDroppable:!1}}({reason:s,lastImpact:i.impact,afterCritical:i.afterCritical,onLiftImpact:i.onLiftImpact,home:i.dimensions.droppables[i.critical.droppable.id],viewport:i.viewport,draggables:i.dimensions.draggables}),m=d.impact,u=d.didDropInsideDroppable,h=u?Z(m):null,p=u?ee(m):null,g={index:r.draggable.index,droppableId:r.droppable.id},v={draggableId:c.descriptor.id,type:c.descriptor.type,source:g,reason:s,mode:i.movementMode,destination:h,combine:p},b=function(e){var t=e.impact,a=e.draggable,n=e.dimensions,i=e.viewport,s=e.afterCritical,r=n.draggables,o=n.droppables,l=Fe(t),c=l?o[l]:null,d=o[a.descriptor.droppableId],m=Qe({impact:t,draggable:a,draggables:r,afterCritical:s,droppable:c||d,viewport:i});return N(m,a.client.borderBox.center)}({impact:m,draggable:c,dimensions:l,viewport:i.viewport,afterCritical:i.afterCritical}),f={critical:i.critical,afterCritical:i.afterCritical,result:v,impact:m};if(!D(i.current.client.offset,b)||Boolean(v.combine)){var y=function(e){var t=e.current,a=e.destination,n=e.reason,i=A(t,a);if(i<=0)return Rt;if(i>=1500)return It;var s=Rt+Tt*(i/1500);return Number(("CANCEL"===n?.6*s:s).toFixed(2))}({current:i.current.client.offset,destination:b,reason:s});a(function(e){return{type:"DROP_ANIMATE",payload:e}}({newHomeClientOffset:b,dropDuration:y,completed:f}))}else a(ft({completed:f}))}}else a(function(e){return{type:"DROP_PENDING",payload:e}}({reason:s}))}else e(n)}}},Dt=function(){return{x:window.pageXOffset,y:window.pageYOffset}};function Pt(e){var t=e.onWindowScroll;var a=h((function(){t(Dt())})),n=function(e){return{eventName:"scroll",options:{passive:!0,capture:!1},fn:function(t){t.target!==window&&t.target!==window.document||e()}}}(a),i=v;function s(){return i!==v}return{start:function(){s()&&E(!1),i=b(window,[n])},stop:function(){s()||E(!1),a.cancel(),i(),i=v},isActive:s}}var Mt=function(e){var t=Pt({onWindowScroll:function(t){e.dispatch({type:"MOVE_BY_WINDOW_SCROLL",payload:{newScroll:t}})}});return function(e){return function(a){t.isActive()||"INITIAL_PUBLISH"!==a.type||t.start(),t.isActive()&&function(e){return"DROP_COMPLETE"===e.type||"DROP_ANIMATE"===e.type||"FLUSH"===e.type}(a)&&t.stop(),e(a)}}},At=function(){var e=[];return{add:function(t){var a=setTimeout((function(){return function(t){var a=G(e,(function(e){return e.timerId===t}));-1===a&&E(!1),e.splice(a,1)[0].callback()}(a)})),n={timerId:a,callback:t};e.push(n)},flush:function(){if(e.length){var t=[].concat(e);e.length=0,t.forEach((function(e){clearTimeout(e.timerId),e.callback()}))}}}},Lt=function(e,t){et(),t(),tt()},Ut=function(e,t){return{draggableId:e.draggable.id,type:e.droppable.type,source:{droppableId:e.droppable.id,index:e.draggable.index},mode:t}},Ft=function(e,t,a,n){if(e){var i=function(e){var t=!1,a=!1,n=setTimeout((function(){a=!0})),i=function(i){t||a||(t=!0,e(i),clearTimeout(n))};return i.wasCalled=function(){return t},i}(a);e(t,{announce:i}),i.wasCalled()||a(n(t))}else a(n(t))},Bt=function(e,t){var a=function(e,t){var a=At(),n=null,i=function(a){n||E(!1),n=null,Lt(0,(function(){return Ft(e().onDragEnd,a,t,R)}))};return{beforeCapture:function(t,a){n&&E(!1),Lt(0,(function(){var n=e().onBeforeCapture;n&&n({draggableId:t,mode:a})}))},beforeStart:function(t,a){n&&E(!1),Lt(0,(function(){var n=e().onBeforeDragStart;n&&n(Ut(t,a))}))},start:function(i,s){n&&E(!1);var r=Ut(i,s);n={mode:s,lastCritical:i,lastLocation:r.source,lastCombine:null},a.add((function(){Lt(0,(function(){return Ft(e().onDragStart,r,t,k)}))}))},update:function(i,s){var r=Z(s),l=ee(s);n||E(!1);var c=!function(e,t){if(e===t)return!0;var a=e.draggable.id===t.draggable.id&&e.draggable.droppableId===t.draggable.droppableId&&e.draggable.type===t.draggable.type&&e.draggable.index===t.draggable.index,n=e.droppable.id===t.droppable.id&&e.droppable.type===t.droppable.type;return a&&n}(i,n.lastCritical);c&&(n.lastCritical=i);var d,m,u=(m=r,!(null==(d=n.lastLocation)&&null==m||null!=d&&null!=m&&d.droppableId===m.droppableId&&d.index===m.index));u&&(n.lastLocation=r);var h=!function(e,t){return null==e&&null==t||null!=e&&null!=t&&e.draggableId===t.draggableId&&e.droppableId===t.droppableId}(n.lastCombine,l);if(h&&(n.lastCombine=l),c||u||h){var p=o({},Ut(i,n.mode),{combine:l,destination:r});a.add((function(){Lt(0,(function(){return Ft(e().onDragUpdate,p,t,j)}))}))}},flush:function(){n||E(!1),a.flush()},drop:i,abort:function(){if(n){var e=o({},Ut(n.lastCritical,n.mode),{combine:null,destination:null,reason:"CANCEL"});i(e)}}}}(e,t);return function(e){return function(t){return function(n){if("BEFORE_INITIAL_CAPTURE"!==n.type){if("INITIAL_PUBLISH"===n.type){var i=n.payload.critical;return a.beforeStart(i,n.payload.movementMode),t(n),void a.start(i,n.payload.movementMode)}if("DROP_COMPLETE"===n.type){var s=n.payload.completed.result;return a.flush(),t(n),void a.drop(s)}if(t(n),"FLUSH"!==n.type){var r=e.getState();"DRAGGING"===r.phase&&a.update(r.critical,r.impact)}else a.abort()}else a.beforeCapture(n.payload.draggableId,n.payload.movementMode)}}}},Vt=function(e){return function(t){return function(a){if("DROP_ANIMATION_FINISHED"===a.type){var n=e.getState();"DROP_ANIMATING"!==n.phase&&E(!1),e.dispatch(ft({completed:n.completed}))}else t(a)}}},Wt=function(e){var t=null,a=null;return function(n){return function(i){if("FLUSH"!==i.type&&"DROP_COMPLETE"!==i.type&&"DROP_ANIMATION_FINISHED"!==i.type||(a&&(cancelAnimationFrame(a),a=null),t&&(t(),t=null)),n(i),"DROP_ANIMATE"===i.type){var s={eventName:"scroll",options:{capture:!0,passive:!1,once:!0},fn:function(){"DROP_ANIMATING"===e.getState().phase&&e.dispatch({type:"DROP_ANIMATION_FINISHED",payload:null})}};a=requestAnimationFrame((function(){a=null,t=b(window,[s])}))}}}},Ht=function(e){return function(t){return function(a){if(t(a),"PUBLISH_WHILE_DRAGGING"===a.type){var n=e.getState();"DROP_PENDING"===n.phase&&(n.isWaiting||e.dispatch(yt({reason:n.reason})))}}}},zt=l.compose,Gt=function(e){var t,a=e.dimensionMarshal,n=e.focusMarshal,i=e.styleMarshal,s=e.getResponders,r=e.announce,o=e.autoScroller;return l.createStore(ot,zt(l.applyMiddleware((t=i,function(){return function(e){return function(a){"INITIAL_PUBLISH"===a.type&&t.dragging(),"DROP_ANIMATE"===a.type&&t.dropping(a.payload.completed.result.reason),"FLUSH"!==a.type&&"DROP_COMPLETE"!==a.type||t.resting(),e(a)}}}),function(e){return function(){return function(t){return function(a){"DROP_COMPLETE"!==a.type&&"FLUSH"!==a.type&&"DROP_ANIMATE"!==a.type||e.stopPublishing(),t(a)}}}}(a),function(e){return function(t){var a=t.getState,n=t.dispatch;return function(t){return function(i){if("LIFT"===i.type){var s=i.payload,r=s.id,o=s.clientSelection,l=s.movementMode,c=a();"DROP_ANIMATING"===c.phase&&n(ft({completed:c.completed})),"IDLE"!==a().phase&&E(!1),n({type:"FLUSH",payload:null}),n({type:"BEFORE_INITIAL_CAPTURE",payload:{draggableId:r,movementMode:l}});var d={draggableId:r,scrollOptions:{shouldPublishImmediately:"SNAP"===l}},m=e.startPublishing(d),u=m.critical,h=m.dimensions,p=m.viewport;n({type:"INITIAL_PUBLISH",payload:{critical:u,dimensions:h,clientSelection:o,movementMode:l,viewport:p}})}else t(i)}}}}(a),Nt,Vt,Wt,Ht,function(e){return function(t){return function(a){return function(n){if(function(e){return"DROP_COMPLETE"===e.type||"DROP_ANIMATE"===e.type||"FLUSH"===e.type}(n))return e.stop(),void a(n);if("INITIAL_PUBLISH"===n.type){a(n);var i=t.getState();return"DRAGGING"!==i.phase&&E(!1),void e.start(i)}a(n),e.scroll(t.getState())}}}}(o),Mt,function(e){var t=!1;return function(){return function(a){return function(n){if("INITIAL_PUBLISH"===n.type)return t=!0,e.tryRecordFocus(n.payload.critical.draggable.id),a(n),void e.tryRestoreFocusRecorded();if(a(n),t){if("FLUSH"===n.type)return t=!1,void e.tryRestoreFocusRecorded();if("DROP_COMPLETE"===n.type){t=!1;var i=n.payload.completed.result;i.combine&&e.tryShiftRecord(i.draggableId,i.combine.draggableId),e.tryRestoreFocusRecorded()}}}}}}(n),Bt(s,r))))};var Kt=function(e){var t=e.scrollHeight,a=e.scrollWidth,n=e.height,i=e.width,s=N({x:a,y:t},{x:i,y:n});return{x:Math.max(0,s.x),y:Math.max(0,s.y)}},qt=function(){var e=document.documentElement;return e||E(!1),e},$t=function(){var e=qt();return Kt({scrollHeight:e.scrollHeight,scrollWidth:e.scrollWidth,width:e.clientWidth,height:e.clientHeight})},Yt=function(e){var t=e.critical,a=e.scrollOptions,n=e.registry;et();var i=function(){var e=Dt(),t=$t(),a=e.y,n=e.x,i=qt(),s=n+i.clientWidth,r=a+i.clientHeight;return{frame:m.getRect({top:a,left:n,right:s,bottom:r}),scroll:{initial:e,current:e,max:t,diff:{value:I,displacement:I}}}}(),s=i.scroll.current,r=t.droppable,o=n.droppable.getAllByType(r.type).map((function(e){return e.callbacks.getDimensionAndWatchScroll(s,a)})),l=n.draggable.getAllByType(t.draggable.type).map((function(e){return e.getDimension(s)})),c={draggables:Y(l),droppables:$(o)};return tt(),{dimensions:c,critical:t,viewport:i}};function Jt(e,t,a){return a.descriptor.id!==t.id&&(a.descriptor.type===t.type&&"virtual"===e.droppable.getById(a.descriptor.droppableId).descriptor.mode)}var Qt,Xt,Zt=function(e,t){var a=null,n=function(e){var t=e.registry,a=e.callbacks,n={additions:{},removals:{},modified:{}},i=null,s=function(){i||(a.collectionStarting(),i=requestAnimationFrame((function(){i=null,et();var e=n,s=e.additions,r=e.removals,o=e.modified,l=Object.keys(s).map((function(e){return t.draggable.getById(e).getDimension(I)})).sort((function(e,t){return e.descriptor.index-t.descriptor.index})),c=Object.keys(o).map((function(e){return{droppableId:e,scroll:t.droppable.getById(e).callbacks.getScrollWhileDragging()}})),d={additions:l,removals:Object.keys(r),modified:c};n={additions:{},removals:{},modified:{}},tt(),a.publish(d)})))};return{add:function(e){var t=e.descriptor.id;n.additions[t]=e,n.modified[e.descriptor.droppableId]=!0,n.removals[t]&&delete n.removals[t],s()},remove:function(e){var t=e.descriptor;n.removals[t.id]=!0,n.modified[t.droppableId]=!0,n.additions[t.id]&&delete n.additions[t.id],s()},stop:function(){i&&(cancelAnimationFrame(i),i=null,n={additions:{},removals:{},modified:{}})}}}({callbacks:{publish:t.publishWhileDragging,collectionStarting:t.collectionStarting},registry:e}),i=function(t){a||E(!1);var i=a.critical.draggable;"ADDITION"===t.type&&Jt(e,i,t.value)&&n.add(t.value),"REMOVAL"===t.type&&Jt(e,i,t.value)&&n.remove(t.value)},s={updateDroppableIsEnabled:function(n,i){e.droppable.exists(n)||E(!1),a&&t.updateDroppableIsEnabled({id:n,isEnabled:i})},updateDroppableIsCombineEnabled:function(n,i){a&&(e.droppable.exists(n)||E(!1),t.updateDroppableIsCombineEnabled({id:n,isCombineEnabled:i}))},scrollDroppable:function(t,n){a&&e.droppable.getById(t).callbacks.scroll(n)},updateDroppableScroll:function(n,i){a&&(e.droppable.exists(n)||E(!1),t.updateDroppableScroll({id:n,newScroll:i}))},startPublishing:function(t){a&&E(!1);var n=e.draggable.getById(t.draggableId),s=e.droppable.getById(n.descriptor.droppableId),r={draggable:n.descriptor,droppable:s.descriptor},o=e.subscribe(i);return a={critical:r,unsubscribe:o},Yt({critical:r,registry:e,scrollOptions:t.scrollOptions})},stopPublishing:function(){if(a){n.stop();var t=a.critical.droppable;e.droppable.getAllByType(t.type).forEach((function(e){return e.callbacks.dragStopped()})),a.unsubscribe(),a=null}}};return s},ea=function(e,t){return"IDLE"===e.phase||"DROP_ANIMATING"===e.phase&&(e.completed.result.draggableId!==t&&"DROP"===e.completed.result.reason)},ta=function(e){window.scrollBy(e.x,e.y)},aa=u((function(e){return J(e).filter((function(e){return!!e.isEnabled&&!!e.frame}))})),na=function(e){var t=e.center,a=e.destination,n=e.droppables;if(a){var i=n[a];return i.frame?i:null}var s=function(e,t){var a=K(aa(t),(function(t){return t.frame||E(!1),We(t.frame.pageMarginBox)(e)}));return a}(t,n);return s},ia=.25,sa=.05,ra=28,oa=function(e){return Math.pow(e,2)},la={stopDampeningAt:1200,accelerateAt:360},ca=function(e){var t=e.startOfRange,a=e.endOfRange,n=e.current,i=a-t;return 0===i?0:(n-t)/i},da=la.accelerateAt,ma=la.stopDampeningAt,ua=function(e){var t=e.distanceToEdge,a=e.thresholds,n=e.dragStartTime,i=e.shouldUseTimeDampening,s=function(e,t){if(e>t.startScrollingFrom)return 0;if(e<=t.maxScrollValueAt)return ra;if(e===t.startScrollingFrom)return 1;var a=ca({startOfRange:t.maxScrollValueAt,endOfRange:t.startScrollingFrom,current:e}),n=ra*oa(1-a);return Math.ceil(n)}(t,a);return 0===s?0:i?Math.max(function(e,t){var a=t,n=ma,i=Date.now()-a;if(i>=ma)return e;if(i<da)return 1;var s=ca({startOfRange:da,endOfRange:n,current:i}),r=e*oa(s);return Math.ceil(r)}(s,n),1):s},ha=function(e){var t=e.container,a=e.distanceToEdges,n=e.dragStartTime,i=e.axis,s=e.shouldUseTimeDampening,r=function(e,t){return{startScrollingFrom:e[t.size]*ia,maxScrollValueAt:e[t.size]*sa}}(t,i);return a[i.end]<a[i.start]?ua({distanceToEdge:a[i.end],thresholds:r,dragStartTime:n,shouldUseTimeDampening:s}):-1*ua({distanceToEdge:a[i.start],thresholds:r,dragStartTime:n,shouldUseTimeDampening:s})},pa=U((function(e){return 0===e?0:e})),ga=function(e){var t=e.dragStartTime,a=e.container,n=e.subject,i=e.center,s=e.shouldUseTimeDampening,r={top:i.y-a.top,right:a.right-i.x,bottom:a.bottom-i.y,left:i.x-a.left},o=ha({container:a,distanceToEdges:r,dragStartTime:t,axis:ce,shouldUseTimeDampening:s}),l=ha({container:a,distanceToEdges:r,dragStartTime:t,axis:de,shouldUseTimeDampening:s}),c=pa({x:l,y:o});if(D(c,I))return null;var d=function(e){var t=e.container,a=e.subject,n=e.proposedScroll,i=a.height>t.height,s=a.width>t.width;return s||i?s&&i?null:{x:s?0:n.x,y:i?0:n.y}:n}({container:a,subject:n,proposedScroll:c});return d?D(d,I)?null:d:null},va=U((function(e){return 0===e?0:e>0?1:-1})),ba=(Qt=function(e,t){return e<0?e:e>t?e-t:0},function(e){var t=e.current,a=e.max,n=e.change,i=T(t,n),s={x:Qt(i.x,a.x),y:Qt(i.y,a.y)};return D(s,I)?null:s}),fa=function(e){var t=e.max,a=e.current,n=e.change,i={x:Math.max(a.x,t.x),y:Math.max(a.y,t.y)},s=va(n),r=ba({max:i,current:a,change:s});return!r||(0!==s.x&&0===r.x||0!==s.y&&0===r.y)},ya=function(e,t){return fa({current:e.scroll.current,max:e.scroll.max,change:t})},Ea=function(e,t){var a=e.frame;return!!a&&fa({current:a.scroll.current,max:a.scroll.max,change:t})},_a=function(e){var t=e.state,a=e.dragStartTime,n=e.shouldUseTimeDampening,i=e.scrollWindow,s=e.scrollDroppable,r=t.current.page.borderBoxCenter,o=t.dimensions.draggables[t.critical.draggable.id].page.marginBox;if(t.isWindowScrollAllowed){var l=function(e){var t=e.viewport,a=e.subject,n=e.center,i=e.dragStartTime,s=e.shouldUseTimeDampening,r=ga({dragStartTime:i,container:t.frame,subject:a,center:n,shouldUseTimeDampening:s});return r&&ya(t,r)?r:null}({dragStartTime:a,viewport:t.viewport,subject:o,center:r,shouldUseTimeDampening:n});if(l)return void i(l)}var c=na({center:r,destination:Fe(t.impact),droppables:t.dimensions.droppables});if(c){var d=function(e){var t=e.droppable,a=e.subject,n=e.center,i=e.dragStartTime,s=e.shouldUseTimeDampening,r=t.frame;if(!r)return null;var o=ga({dragStartTime:i,container:r.pageMarginBox,subject:a,center:n,shouldUseTimeDampening:s});return o&&Ea(t,o)?o:null}({dragStartTime:a,droppable:c,subject:o,center:r,shouldUseTimeDampening:n});d&&s(c.descriptor.id,d)}},Sa=function(e){var t=e.move,a=e.scrollDroppable,n=e.scrollWindow,i=function(e,t){if(!Ea(e,t))return t;var n=function(e,t){var a=e.frame;return a&&Ea(e,t)?ba({current:a.scroll.current,max:a.scroll.max,change:t}):null}(e,t);if(!n)return a(e.descriptor.id,t),null;var i=N(t,n);return a(e.descriptor.id,i),N(t,i)},s=function(e,t,a){if(!e)return a;if(!ya(t,a))return a;var i=function(e,t){if(!ya(e,t))return null;var a=e.scroll.max,n=e.scroll.current;return ba({current:n,max:a,change:t})}(t,a);if(!i)return n(a),null;var s=N(a,i);return n(s),N(a,s)};return function(e){var a=e.scrollJumpRequest;if(a){var n=Fe(e.impact);n||E(!1);var r=i(e.dimensions.droppables[n],a);if(r){var o=e.viewport,l=s(e.isWindowScrollAllowed,o,r);l&&function(e,a){var n=T(e.current.client.selection,a);t({client:n})}(e,l)}}}},wa=function(e){var t=e.scrollDroppable,a=e.scrollWindow,n=e.move,i=function(e){var t=e.scrollWindow,a=e.scrollDroppable,n=h(t),i=h(a),s=null,r=function(e){s||E(!1);var t=s,a=t.shouldUseTimeDampening,r=t.dragStartTime;_a({state:e,scrollWindow:n,scrollDroppable:i,dragStartTime:r,shouldUseTimeDampening:a})};return{start:function(e){et(),s&&E(!1);var t=Date.now(),a=!1,n=function(){a=!0};_a({state:e,dragStartTime:0,shouldUseTimeDampening:!1,scrollWindow:n,scrollDroppable:n}),s={dragStartTime:t,shouldUseTimeDampening:a},tt(),a&&r(e)},stop:function(){s&&(n.cancel(),i.cancel(),s=null)},scroll:r}}({scrollWindow:a,scrollDroppable:t}),s=Sa({move:n,scrollWindow:a,scrollDroppable:t});return{scroll:function(e){"DRAGGING"===e.phase&&("FLUID"!==e.movementMode?e.scrollJumpRequest&&s(e):i.scroll(e))},start:i.start,stop:i.stop}},Oa={base:Xt="data-rbd-drag-handle",draggableId:Xt+"-draggable-id",contextId:Xt+"-context-id"},Ca=function(){var e="data-rbd-draggable";return{base:e,contextId:e+"-context-id",id:e+"-id"}}(),xa=function(){var e="data-rbd-droppable";return{base:e,contextId:e+"-context-id",id:e+"-id"}}(),ka={contextId:"data-rbd-scroll-container-context-id"},ja=function(e,t){return e.map((function(e){var a=e.styles[t];return a?e.selector+" { "+a+" }":""})).join(" ")},Ra="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement?i.useLayoutEffect:i.useEffect,Ia=function(){var e=document.querySelector("head");return e||E(!1),e},Ta=function(e){var t=document.createElement("style");return e&&t.setAttribute("nonce",e),t.type="text/css",t};function Na(e,t){var a=d.useMemo((function(){return function(e){var t,a,n,i=(t=e,function(e){return"["+e+'="'+t+'"]'}),s=(a="\n cursor: -webkit-grab;\n cursor: grab;\n ",{selector:i(Oa.contextId),styles:{always:"\n -webkit-touch-callout: none;\n -webkit-tap-highlight-color: rgba(0,0,0,0);\n touch-action: manipulation;\n ",resting:a,dragging:"pointer-events: none;",dropAnimating:a}}),r=[(n="\n transition: "+Ct.outOfTheWay+";\n ",{selector:i(Ca.contextId),styles:{dragging:n,dropAnimating:n,userCancel:n}}),s,{selector:i(xa.contextId),styles:{always:"overflow-anchor: none;"}},{selector:"body",styles:{dragging:"\n cursor: grabbing;\n cursor: -webkit-grabbing;\n user-select: none;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n overflow-anchor: none;\n "}}];return{always:ja(r,"always"),resting:ja(r,"resting"),dragging:ja(r,"dragging"),dropAnimating:ja(r,"dropAnimating"),userCancel:ja(r,"userCancel")}}(e)}),[e]),n=i.useRef(null),s=i.useRef(null),r=d.useCallback(u((function(e){var t=s.current;t||E(!1),t.textContent=e})),[]),o=d.useCallback((function(e){var t=n.current;t||E(!1),t.textContent=e}),[]);Ra((function(){(n.current||s.current)&&E(!1);var i=Ta(t),l=Ta(t);return n.current=i,s.current=l,i.setAttribute("data-rbd-always",e),l.setAttribute("data-rbd-dynamic",e),Ia().appendChild(i),Ia().appendChild(l),o(a.always),r(a.resting),function(){var e=function(e){var t=e.current;t||E(!1),Ia().removeChild(t),e.current=null};e(n),e(s)}}),[t,o,r,a.always,a.resting,e]);var l=d.useCallback((function(){return r(a.dragging)}),[r,a.dragging]),c=d.useCallback((function(e){r("DROP"!==e?a.userCancel:a.dropAnimating)}),[r,a.dropAnimating,a.userCancel]),m=d.useCallback((function(){s.current&&r(a.resting)}),[r,a.resting]);return d.useMemo((function(){return{dragging:l,dropping:c,resting:m}}),[l,c,m])}var Da=function(e){return e&&e.ownerDocument?e.ownerDocument.defaultView:window};function Pa(e){return e instanceof Da(e).HTMLElement}function Ma(e,t){var a="["+Oa.contextId+'="'+e+'"]',n=q(document.querySelectorAll(a));if(!n.length)return null;var i=K(n,(function(e){return e.getAttribute(Oa.draggableId)===t}));return i&&Pa(i)?i:null}function Aa(){var e={draggables:{},droppables:{}},t=[];function a(e){t.length&&t.forEach((function(t){return t(e)}))}function n(t){return e.draggables[t]||null}function i(t){return e.droppables[t]||null}return{draggable:{register:function(t){e.draggables[t.descriptor.id]=t,a({type:"ADDITION",value:t})},update:function(t,a){var n=e.draggables[a.descriptor.id];n&&n.uniqueId===t.uniqueId&&(delete e.draggables[a.descriptor.id],e.draggables[t.descriptor.id]=t)},unregister:function(t){var i=t.descriptor.id,s=n(i);s&&t.uniqueId===s.uniqueId&&(delete e.draggables[i],a({type:"REMOVAL",value:t}))},getById:function(e){var t=n(e);return t||E(!1),t},findById:n,exists:function(e){return Boolean(n(e))},getAllByType:function(t){return z(e.draggables).filter((function(e){return e.descriptor.type===t}))}},droppable:{register:function(t){e.droppables[t.descriptor.id]=t},unregister:function(t){var a=i(t.descriptor.id);a&&t.uniqueId===a.uniqueId&&delete e.droppables[t.descriptor.id]},getById:function(e){var t=i(e);return t||E(!1),t},findById:i,exists:function(e){return Boolean(i(e))},getAllByType:function(t){return z(e.droppables).filter((function(e){return e.descriptor.type===t}))}},subscribe:function(e){return t.push(e),function(){var a=t.indexOf(e);-1!==a&&t.splice(a,1)}},clean:function(){e.draggables={},e.droppables={},t.length=0}}}var La=s.createContext(null),Ua=function(){var e=document.body;return e||E(!1),e},Fa={position:"absolute",width:"1px",height:"1px",margin:"-1px",border:"0",padding:"0",overflow:"hidden",clip:"rect(0 0 0 0)","clip-path":"inset(100%)"};var Ba=0,Va={separator:"::"};function Wa(e,t){return void 0===t&&(t=Va),d.useMemo((function(){return""+e+t.separator+Ba++}),[t.separator,e])}var Ha=s.createContext(null);function za(e){0}function Ga(e,t){za()}function Ka(){Ga()}function qa(e){var t=i.useRef(e);return i.useEffect((function(){t.current=e})),t}var $a,Ya=(($a={})[13]=!0,$a[9]=!0,$a),Ja=function(e){Ya[e.keyCode]&&e.preventDefault()},Qa=function(){var e="visibilitychange";return"undefined"==typeof document?e:K([e,"ms"+e,"webkit"+e,"moz"+e,"o"+e],(function(e){return"on"+e in document}))||e}();var Xa,Za={type:"IDLE"};function en(e){var t=e.cancel,a=e.completed,n=e.getPhase,i=e.setPhase;return[{eventName:"mousemove",fn:function(e){var t=e.button,a=e.clientX,s=e.clientY;if(0===t){var r={x:a,y:s},o=n();if("DRAGGING"===o.type)return e.preventDefault(),void o.actions.move(r);"PENDING"!==o.type&&E(!1);var l=o.point;if(c=l,d=r,Math.abs(d.x-c.x)>=5||Math.abs(d.y-c.y)>=5){var c,d;e.preventDefault();var m=o.actions.fluidLift(r);i({type:"DRAGGING",actions:m})}}}},{eventName:"mouseup",fn:function(e){var i=n();"DRAGGING"===i.type?(e.preventDefault(),i.actions.drop({shouldBlockNextClick:!0}),a()):t()}},{eventName:"mousedown",fn:function(e){"DRAGGING"===n().type&&e.preventDefault(),t()}},{eventName:"keydown",fn:function(e){if("PENDING"!==n().type)return 27===e.keyCode?(e.preventDefault(),void t()):void Ja(e);t()}},{eventName:"resize",fn:t},{eventName:"scroll",options:{passive:!0,capture:!1},fn:function(){"PENDING"===n().type&&t()}},{eventName:"webkitmouseforcedown",fn:function(e){var a=n();"IDLE"===a.type&&E(!1),a.actions.shouldRespectForcePress()?t():e.preventDefault()}},{eventName:Qa,fn:t}]}function tn(e){var t=i.useRef(Za),a=i.useRef(v),n=d.useMemo((function(){return{eventName:"mousedown",fn:function(t){if(!t.defaultPrevented&&0===t.button&&!(t.ctrlKey||t.metaKey||t.shiftKey||t.altKey)){var n=e.findClosestDraggableId(t);if(n){var i=e.tryGetLock(n,o,{sourceEvent:t});if(i){t.preventDefault();var s={x:t.clientX,y:t.clientY};a.current(),m(i,s)}}}}}}),[e]),s=d.useMemo((function(){return{eventName:"webkitmouseforcewillbegin",fn:function(t){if(!t.defaultPrevented){var a=e.findClosestDraggableId(t);if(a){var n=e.findOptionsForDraggable(a);n&&(n.shouldRespectForcePress||e.canGetLock(a)&&t.preventDefault())}}}}}),[e]),r=d.useCallback((function(){a.current=b(window,[s,n],{passive:!1,capture:!0})}),[s,n]),o=d.useCallback((function(){"IDLE"!==t.current.type&&(t.current=Za,a.current(),r())}),[r]),l=d.useCallback((function(){var e=t.current;o(),"DRAGGING"===e.type&&e.actions.cancel({shouldBlockNextClick:!0}),"PENDING"===e.type&&e.actions.abort()}),[o]),c=d.useCallback((function(){var e=en({cancel:l,completed:o,getPhase:function(){return t.current},setPhase:function(e){t.current=e}});a.current=b(window,e,{capture:!0,passive:!1})}),[l,o]),m=d.useCallback((function(e,a){"IDLE"!==t.current.type&&E(!1),t.current={type:"PENDING",point:a,actions:e},c()}),[c]);Ra((function(){return r(),function(){a.current()}}),[r])}function an(){}var nn=((Xa={})[34]=!0,Xa[33]=!0,Xa[36]=!0,Xa[35]=!0,Xa);function sn(e,t){function a(){t(),e.cancel()}return[{eventName:"keydown",fn:function(n){return 27===n.keyCode?(n.preventDefault(),void a()):32===n.keyCode?(n.preventDefault(),t(),void e.drop()):40===n.keyCode?(n.preventDefault(),void e.moveDown()):38===n.keyCode?(n.preventDefault(),void e.moveUp()):39===n.keyCode?(n.preventDefault(),void e.moveRight()):37===n.keyCode?(n.preventDefault(),void e.moveLeft()):void(nn[n.keyCode]?n.preventDefault():Ja(n))}},{eventName:"mousedown",fn:a},{eventName:"mouseup",fn:a},{eventName:"click",fn:a},{eventName:"touchstart",fn:a},{eventName:"resize",fn:a},{eventName:"wheel",fn:a,options:{passive:!0}},{eventName:Qa,fn:a}]}function rn(e){var t=i.useRef(an),a=d.useMemo((function(){return{eventName:"keydown",fn:function(a){if(!a.defaultPrevented&&32===a.keyCode){var i=e.findClosestDraggableId(a);if(i){var s=e.tryGetLock(i,l,{sourceEvent:a});if(s){a.preventDefault();var r=!0,o=s.snapLift();t.current(),t.current=b(window,sn(o,l),{capture:!0,passive:!1})}}}function l(){r||E(!1),r=!1,t.current(),n()}}}}),[e]),n=d.useCallback((function(){t.current=b(window,[a],{passive:!1,capture:!0})}),[a]);Ra((function(){return n(),function(){t.current()}}),[n])}var on={type:"IDLE"};function ln(e){var t=i.useRef(on),a=i.useRef(v),n=d.useCallback((function(){return t.current}),[]),s=d.useCallback((function(e){t.current=e}),[]),r=d.useMemo((function(){return{eventName:"touchstart",fn:function(t){if(!t.defaultPrevented){var n=e.findClosestDraggableId(t);if(n){var i=e.tryGetLock(n,l,{sourceEvent:t});if(i){var s=t.touches[0],r={x:s.clientX,y:s.clientY};a.current(),h(i,r)}}}}}}),[e]),o=d.useCallback((function(){a.current=b(window,[r],{capture:!0,passive:!1})}),[r]),l=d.useCallback((function(){var e=t.current;"IDLE"!==e.type&&("PENDING"===e.type&&clearTimeout(e.longPressTimerId),s(on),a.current(),o())}),[o,s]),c=d.useCallback((function(){var e=t.current;l(),"DRAGGING"===e.type&&e.actions.cancel({shouldBlockNextClick:!0}),"PENDING"===e.type&&e.actions.abort()}),[l]),m=d.useCallback((function(){var e={capture:!0,passive:!1},t={cancel:c,completed:l,getPhase:n},i=b(window,function(e){var t=e.cancel,a=e.completed,n=e.getPhase;return[{eventName:"touchmove",options:{capture:!1},fn:function(e){var a=n();if("DRAGGING"===a.type){a.hasMoved=!0;var i=e.touches[0],s={x:i.clientX,y:i.clientY};e.preventDefault(),a.actions.move(s)}else t()}},{eventName:"touchend",fn:function(e){var i=n();"DRAGGING"===i.type?(e.preventDefault(),i.actions.drop({shouldBlockNextClick:!0}),a()):t()}},{eventName:"touchcancel",fn:function(e){"DRAGGING"===n().type?(e.preventDefault(),t()):t()}},{eventName:"touchforcechange",fn:function(e){var a=n();"IDLE"===a.type&&E(!1);var i=e.touches[0];if(i&&i.force>=.15){var s=a.actions.shouldRespectForcePress();if("PENDING"!==a.type)return s?a.hasMoved?void e.preventDefault():void t():void e.preventDefault();s&&t()}}},{eventName:Qa,fn:t}]}(t),e),s=b(window,function(e){var t=e.cancel,a=e.getPhase;return[{eventName:"orientationchange",fn:t},{eventName:"resize",fn:t},{eventName:"contextmenu",fn:function(e){e.preventDefault()}},{eventName:"keydown",fn:function(e){"DRAGGING"===a().type?(27===e.keyCode&&e.preventDefault(),t()):t()}},{eventName:Qa,fn:t}]}(t),e);a.current=function(){i(),s()}}),[c,n,l]),u=d.useCallback((function(){var e=n();"PENDING"!==e.type&&E(!1);var t=e.actions.fluidLift(e.point);s({type:"DRAGGING",actions:t,hasMoved:!1})}),[n,s]),h=d.useCallback((function(e,t){"IDLE"!==n().type&&E(!1);var a=setTimeout(u,120);s({type:"PENDING",point:t,actions:e,longPressTimerId:a}),m()}),[m,n,s,u]);Ra((function(){return o(),function(){a.current();var e=n();"PENDING"===e.type&&(clearTimeout(e.longPressTimerId),s(on))}}),[n,o,s]),Ra((function(){return b(window,[{eventName:"touchmove",fn:function(){},options:{capture:!1,passive:!1}}])}),[])}var cn={input:!0,button:!0,textarea:!0,select:!0,option:!0,optgroup:!0,video:!0,audio:!0};function dn(e,t){if(null==t)return!1;if(Boolean(cn[t.tagName.toLowerCase()]))return!0;var a=t.getAttribute("contenteditable");return"true"===a||""===a||t!==e&&dn(e,t.parentElement)}function mn(e,t){var a=t.target;return!!Pa(a)&&dn(e,a)}var un=function(e){return m.getRect(e.getBoundingClientRect()).center};var hn=function(){var e="matches";return"undefined"==typeof document?e:K([e,"msMatchesSelector","webkitMatchesSelector"],(function(e){return e in Element.prototype}))||e}();function pn(e,t){return null==e?null:e[hn](t)?e:pn(e.parentElement,t)}function gn(e,t){return e.closest?e.closest(t):pn(e,t)}function vn(e,t){var a,n=t.target;if(!((a=n)instanceof Da(a).Element))return null;var i=function(e){return"["+Oa.contextId+'="'+e+'"]'}(e),s=gn(n,i);return s&&Pa(s)?s:null}function bn(e){e.preventDefault()}function fn(e){var t=e.expected,a=e.phase,n=e.isLockActive;e.shouldWarn;return!!n()&&t===a}function yn(e){var t=e.lockAPI,a=e.store,n=e.registry,i=e.draggableId;if(t.isClaimed())return!1;var s=n.draggable.findById(i);return!!s&&(!!s.options.isEnabled&&!!ea(a.getState(),i))}function En(e){var t=e.lockAPI,a=e.contextId,n=e.store,i=e.registry,s=e.draggableId,r=e.forceSensorStop,l=e.sourceEvent;if(!yn({lockAPI:t,store:n,registry:i,draggableId:s}))return null;var c=i.draggable.getById(s),d=function(e,t){var a="["+Ca.contextId+'="'+e+'"]',n=K(q(document.querySelectorAll(a)),(function(e){return e.getAttribute(Ca.id)===t}));return n&&Pa(n)?n:null}(a,c.descriptor.id);if(!d)return null;if(l&&!c.options.canDragInteractiveElements&&mn(d,l))return null;var m=t.claim(r||v),u="PRE_DRAG";function p(){return c.options.shouldRespectForcePress}function g(){return t.isActive(m)}var f=function(e,t){fn({expected:e,phase:u,isLockActive:g,shouldWarn:!0})&&n.dispatch(t())}.bind(null,"DRAGGING");function y(e){function a(){t.release(),u="COMPLETED"}function i(t,i){if(void 0===i&&(i={shouldBlockNextClick:!1}),e.cleanup(),i.shouldBlockNextClick){var s=b(window,[{eventName:"click",fn:bn,options:{once:!0,passive:!1,capture:!0}}]);setTimeout(s)}a(),n.dispatch(yt({reason:t}))}return"PRE_DRAG"!==u&&(a(),"PRE_DRAG"!==u&&E(!1)),n.dispatch(function(e){return{type:"LIFT",payload:e}}(e.liftActionArgs)),u="DRAGGING",o({isActive:function(){return fn({expected:"DRAGGING",phase:u,isLockActive:g,shouldWarn:!1})},shouldRespectForcePress:p,drop:function(e){return i("DROP",e)},cancel:function(e){return i("CANCEL",e)}},e.actions)}return{isActive:function(){return fn({expected:"PRE_DRAG",phase:u,isLockActive:g,shouldWarn:!1})},shouldRespectForcePress:p,fluidLift:function(e){var t=h((function(e){f((function(){return ht({client:e})}))})),a=y({liftActionArgs:{id:s,clientSelection:e,movementMode:"FLUID"},cleanup:function(){return t.cancel()},actions:{move:t}});return o({},a,{move:t})},snapLift:function(){var e={moveUp:function(){return f(pt)},moveRight:function(){return f(vt)},moveDown:function(){return f(gt)},moveLeft:function(){return f(bt)}};return y({liftActionArgs:{id:s,clientSelection:un(d),movementMode:"SNAP"},cleanup:v,actions:e})},abort:function(){fn({expected:"PRE_DRAG",phase:u,isLockActive:g,shouldWarn:!0})&&t.release()}}}var _n=[tn,rn,ln];function Sn(e){var t=e.contextId,a=e.store,n=e.registry,s=e.customSensors,r=e.enableDefaultSensors,o=[].concat(r?_n:[],s||[]),l=i.useState((function(){return function(){var e=null;function t(){e||E(!1),e=null}return{isClaimed:function(){return Boolean(e)},isActive:function(t){return t===e},claim:function(t){e&&E(!1);var a={abandon:t};return e=a,a},release:t,tryAbandon:function(){e&&(e.abandon(),t())}}}()}))[0],c=d.useCallback((function(e,t){e.isDragging&&!t.isDragging&&l.tryAbandon()}),[l]);Ra((function(){var e=a.getState();return a.subscribe((function(){var t=a.getState();c(e,t),e=t}))}),[l,a,c]),Ra((function(){return l.tryAbandon}),[l.tryAbandon]);var m=d.useCallback((function(e){return yn({lockAPI:l,registry:n,store:a,draggableId:e})}),[l,n,a]),u=d.useCallback((function(e,i,s){return En({lockAPI:l,registry:n,contextId:t,store:a,draggableId:e,forceSensorStop:i,sourceEvent:s&&s.sourceEvent?s.sourceEvent:null})}),[t,l,n,a]),h=d.useCallback((function(e){return function(e,t){var a=vn(e,t);return a?a.getAttribute(Oa.draggableId):null}(t,e)}),[t]),p=d.useCallback((function(e){var t=n.draggable.findById(e);return t?t.options:null}),[n.draggable]),g=d.useCallback((function(){l.isClaimed()&&(l.tryAbandon(),"IDLE"!==a.getState().phase&&a.dispatch({type:"FLUSH",payload:null}))}),[l,a]),v=d.useCallback(l.isClaimed,[l]),b=d.useMemo((function(){return{canGetLock:m,tryGetLock:u,findClosestDraggableId:h,findOptionsForDraggable:p,tryReleaseLock:g,isLockClaimed:v}}),[m,u,h,p,g,v]);za();for(var f=0;f<o.length;f++)o[f](b)}function wn(e){return e.current||E(!1),e.current}function On(e){var t=e.contextId,a=e.setCallbacks,n=e.sensors,r=e.nonce,m=e.dragHandleUsageInstructions,u=i.useRef(null);Ka();var h=qa(e),p=d.useCallback((function(){return function(e){return{onBeforeCapture:e.onBeforeCapture,onBeforeDragStart:e.onBeforeDragStart,onDragStart:e.onDragStart,onDragEnd:e.onDragEnd,onDragUpdate:e.onDragUpdate}}(h.current)}),[h]),g=function(e){var t=d.useMemo((function(){return function(e){return"rbd-announcement-"+e}(e)}),[e]),a=i.useRef(null);return i.useEffect((function(){var e=document.createElement("div");return a.current=e,e.id=t,e.setAttribute("aria-live","assertive"),e.setAttribute("aria-atomic","true"),o(e.style,Fa),Ua().appendChild(e),function(){setTimeout((function(){var t=Ua();t.contains(e)&&t.removeChild(e),e===a.current&&(a.current=null)}))}}),[t]),d.useCallback((function(e){var t=a.current;t&&(t.textContent=e)}),[])}(t),v=function(e){var t=e.contextId,a=e.text,n=Wa("hidden-text",{separator:"-"}),s=d.useMemo((function(){return"rbd-hidden-text-"+(e={contextId:t,uniqueId:n}).contextId+"-"+e.uniqueId;var e}),[n,t]);return i.useEffect((function(){var e=document.createElement("div");return e.id=s,e.textContent=a,e.style.display="none",Ua().appendChild(e),function(){var t=Ua();t.contains(e)&&t.removeChild(e)}}),[s,a]),s}({contextId:t,text:m}),b=Na(t,r),f=d.useCallback((function(e){wn(u).dispatch(e)}),[]),y=d.useMemo((function(){return l.bindActionCreators({publishWhileDragging:lt,updateDroppableScroll:dt,updateDroppableIsEnabled:mt,updateDroppableIsCombineEnabled:ut,collectionStarting:ct},f)}),[f]),E=function(){var e=d.useMemo(Aa,[]);return i.useEffect((function(){return function(){requestAnimationFrame(e.clean)}}),[e]),e}(),_=d.useMemo((function(){return Zt(E,y)}),[E,y]),S=d.useMemo((function(){return wa(o({scrollWindow:ta,scrollDroppable:_.scrollDroppable},l.bindActionCreators({move:ht},f)))}),[_.scrollDroppable,f]),w=function(e){var t=i.useRef({}),a=i.useRef(null),n=i.useRef(null),s=i.useRef(!1),r=d.useCallback((function(e,a){var n={id:e,focus:a};return t.current[e]=n,function(){var a=t.current;a[e]!==n&&delete a[e]}}),[]),o=d.useCallback((function(t){var a=Ma(e,t);a&&a!==document.activeElement&&a.focus()}),[e]),l=d.useCallback((function(e,t){a.current===e&&(a.current=t)}),[]),c=d.useCallback((function(){n.current||s.current&&(n.current=requestAnimationFrame((function(){n.current=null;var e=a.current;e&&o(e)})))}),[o]),m=d.useCallback((function(e){a.current=null;var t=document.activeElement;t&&t.getAttribute(Oa.draggableId)===e&&(a.current=e)}),[]);return Ra((function(){return s.current=!0,function(){s.current=!1;var e=n.current;e&&cancelAnimationFrame(e)}}),[]),d.useMemo((function(){return{register:r,tryRecordFocus:m,tryRestoreFocusRecorded:c,tryShiftRecord:l}}),[r,m,c,l])}(t),O=d.useMemo((function(){return Gt({announce:g,autoScroller:S,dimensionMarshal:_,focusMarshal:w,getResponders:p,styleMarshal:b})}),[g,S,_,w,p,b]);u.current=O;var C=d.useCallback((function(){var e=wn(u);"IDLE"!==e.getState().phase&&e.dispatch({type:"FLUSH",payload:null})}),[]),x=d.useCallback((function(){var e=wn(u).getState();return e.isDragging||"DROP_ANIMATING"===e.phase}),[]);a(d.useMemo((function(){return{isDragging:x,tryAbort:C}}),[x,C]));var k=d.useCallback((function(e){return ea(wn(u).getState(),e)}),[]),j=d.useCallback((function(){return Ve(wn(u).getState())}),[]),R=d.useMemo((function(){return{marshal:_,focus:w,contextId:t,canLift:k,isMovementAllowed:j,dragHandleUsageInstructionsId:v,registry:E}}),[t,_,v,w,k,j,E]);return Sn({contextId:t,store:O,registry:E,customSensors:n,enableDefaultSensors:!1!==e.enableDefaultSensors}),i.useEffect((function(){return C}),[C]),s.createElement(Ha.Provider,{value:R},s.createElement(c.Provider,{context:La,store:O},e.children))}var Cn=0;var xn=function(e){return function(t){return e===t}},kn=xn("scroll"),jn=xn("auto"),Rn=(xn("visible"),function(e,t){return t(e.overflowX)||t(e.overflowY)}),In=function(e){var t=window.getComputedStyle(e),a={overflowX:t.overflowX,overflowY:t.overflowY};return Rn(a,kn)||Rn(a,jn)},Tn=function e(t){return null==t||t===document.body||t===document.documentElement?null:In(t)?t:e(t.parentElement)},Nn=function(e){return{x:e.scrollLeft,y:e.scrollTop}},Dn=function e(t){return!!t&&("fixed"===window.getComputedStyle(t).position||e(t.parentElement))},Pn=function(e){return{closestScrollable:Tn(e),isFixedOnPage:Dn(e)}},Mn=function(e){var t=e.ref,a=e.descriptor,n=e.env,i=e.windowScroll,s=e.direction,r=e.isDropDisabled,o=e.isCombineEnabled,l=e.shouldClipSubject,c=n.closestScrollable,d=function(e,t){var a=m.getBox(e);if(!t)return a;if(e!==t)return a;var n=a.paddingBox.top-t.scrollTop,i=a.paddingBox.left-t.scrollLeft,s=n+t.scrollHeight,r={top:n,right:i+t.scrollWidth,bottom:s,left:i},o=m.expand(r,a.border);return m.createBox({borderBox:o,margin:a.margin,border:a.border,padding:a.padding})}(t,c),u=m.withScroll(d,i),h=function(){if(!c)return null;var e=m.getBox(c),t={scrollHeight:c.scrollHeight,scrollWidth:c.scrollWidth};return{client:e,page:m.withScroll(e,i),scroll:Nn(c),scrollSize:t,shouldClipSubject:l}}(),p=function(e){var t=e.descriptor,a=e.isEnabled,n=e.isCombineEnabled,i=e.isFixedOnPage,s=e.direction,r=e.client,o=e.page,l=e.closest,c=function(){if(!l)return null;var e=l.scrollSize,t=l.client,a=Kt({scrollHeight:e.scrollHeight,scrollWidth:e.scrollWidth,height:t.paddingBox.height,width:t.paddingBox.width});return{pageMarginBox:l.page.marginBox,frameClient:t,scrollSize:e,shouldClipSubject:l.shouldClipSubject,scroll:{initial:l.scroll,current:l.scroll,max:a,diff:{value:I,displacement:I}}}}(),d="vertical"===s?ce:de;return{descriptor:t,isCombineEnabled:n,isFixedOnPage:i,axis:d,isEnabled:a,client:r,page:o,frame:c,subject:W({page:o,withPlaceholder:null,axis:d,frame:c})}}({descriptor:a,isEnabled:!r,isCombineEnabled:o,isFixedOnPage:n.isFixedOnPage,direction:s,client:d,page:u,closest:h});return p},An={passive:!1},Ln={passive:!0},Un=function(e){return e.shouldPublishImmediately?An:Ln};function Fn(e){var t=i.useContext(e);return t||E(!1),t}var Bn=function(e){return e&&e.env.closestScrollable||null};function Vn(){}var Wn={width:0,height:0,margin:{top:0,right:0,bottom:0,left:0}},Hn=function(e){var t=e.isAnimatingOpenOnMount,a=e.placeholder,n=e.animate,i=function(e){var t=e.isAnimatingOpenOnMount,a=e.placeholder,n=e.animate;return t||"close"===n?Wn:{height:a.client.borderBox.height,width:a.client.borderBox.width,margin:a.client.margin}}({isAnimatingOpenOnMount:t,placeholder:a,animate:n});return{display:a.display,boxSizing:"border-box",width:i.width,height:i.height,marginTop:i.margin.top,marginRight:i.margin.right,marginBottom:i.margin.bottom,marginLeft:i.margin.left,flexShrink:"0",flexGrow:"0",pointerEvents:"none",transition:"none"!==n?Ct.placeholder:null}};var zn=s.memo((function(e){var t=i.useRef(null),a=d.useCallback((function(){t.current&&(clearTimeout(t.current),t.current=null)}),[]),n=e.animate,r=e.onTransitionEnd,o=e.onClose,l=e.contextId,c=i.useState("open"===e.animate),m=c[0],u=c[1];i.useEffect((function(){return m?"open"!==n?(a(),u(!1),Vn):t.current?Vn:(t.current=setTimeout((function(){t.current=null,u(!1)})),a):Vn}),[n,m,a]);var h=d.useCallback((function(e){"height"===e.propertyName&&(r(),"close"===n&&o())}),[n,o,r]),p=Hn({isAnimatingOpenOnMount:m,animate:e.animate,placeholder:e.placeholder});return s.createElement(e.placeholder.tagName,{style:p,"data-rbd-placeholder-context-id":l,onTransitionEnd:h,ref:e.innerRef})})),Gn=s.createContext(null);var Kn=function(e){function t(){for(var t,a=arguments.length,n=new Array(a),i=0;i<a;i++)n[i]=arguments[i];return(t=e.call.apply(e,[this].concat(n))||this).state={isVisible:Boolean(t.props.on),data:t.props.on,animate:t.props.shouldAnimate&&t.props.on?"open":"none"},t.onClose=function(){"close"===t.state.animate&&t.setState({isVisible:!1})},t}return r(t,e),t.getDerivedStateFromProps=function(e,t){return e.shouldAnimate?e.on?{isVisible:!0,data:e.on,animate:"open"}:t.isVisible?{isVisible:!0,data:t.data,animate:"close"}:{isVisible:!1,animate:"close",data:null}:{isVisible:Boolean(e.on),data:e.on,animate:"none"}},t.prototype.render=function(){if(!this.state.isVisible)return null;var e={onClose:this.onClose,data:this.state.data,animate:this.state.animate};return this.props.children(e)},t}(s.PureComponent),qn=5e3,$n=4500,Yn=function(e,t){return t?Ct.drop(t.duration):e?Ct.snap:Ct.fluid},Jn=function(e,t){return e?t?St.drop:St.combining:null};function Qn(e){return"DRAGGING"===e.type?(n=(a=e).dimension.client,i=a.offset,s=a.combineWith,r=a.dropping,o=Boolean(s),l=function(e){return null!=e.forceShouldAnimate?e.forceShouldAnimate:"SNAP"===e.mode}(a),c=Boolean(r),d=c?jt(i,o):kt(i),{position:"fixed",top:n.marginBox.top,left:n.marginBox.left,boxSizing:"border-box",width:n.borderBox.width,height:n.borderBox.height,transition:Yn(l,r),transform:d,opacity:Jn(o,c),zIndex:c?$n:qn,pointerEvents:"none"}):{transform:kt((t=e).offset),transition:t.shouldAnimateDisplacement?null:"none"};var t,a,n,i,s,r,o,l,c,d}function Xn(e){var t=Wa("draggable"),a=e.descriptor,n=e.registry,s=e.getDraggableRef,r=e.canDragInteractiveElements,o=e.shouldRespectForcePress,l=e.isEnabled,c=d.useMemo((function(){return{canDragInteractiveElements:r,shouldRespectForcePress:o,isEnabled:l}}),[r,l,o]),u=d.useCallback((function(e){var t=s();return t||E(!1),function(e,t,a){void 0===a&&(a=I);var n=window.getComputedStyle(t),i=t.getBoundingClientRect(),s=m.calculateBox(i,n),r=m.withScroll(s,a);return{descriptor:e,placeholder:{client:s,tagName:t.tagName.toLowerCase(),display:n.display},displaceBy:{x:s.marginBox.width,y:s.marginBox.height},client:s,page:r}}(a,t,e)}),[a,s]),h=d.useMemo((function(){return{uniqueId:t,descriptor:a,options:c,getDimension:u}}),[a,u,c,t]),p=i.useRef(h),g=i.useRef(!0);Ra((function(){return n.draggable.register(p.current),function(){return n.draggable.unregister(p.current)}}),[n.draggable]),Ra((function(){if(g.current)g.current=!1;else{var e=p.current;p.current=h,n.draggable.update(h,e)}}),[h,n.draggable])}function Zn(e,t,a){Ga()}function ei(e){e.preventDefault()}var ti=function(e,t){return e===t},ai=function(e){var t=e.combine,a=e.destination;return a?a.droppableId:t?t.droppableId:null};function ni(e){return{isDragging:!1,isDropAnimating:!1,isClone:!1,dropAnimation:null,mode:null,draggingOver:null,combineTargetFor:e,combineWith:null}}var ii={mapped:{type:"SECONDARY",offset:I,combineTargetFor:null,shouldAnimateDisplacement:!0,snapshot:ni(null)}};var si={dropAnimationFinished:Et},ri=c.connect((function(){var e,t,a,n=(e=u((function(e,t){return{x:e,y:t}})),t=u((function(e,t,a,n,i){return{isDragging:!0,isClone:t,isDropAnimating:Boolean(i),dropAnimation:i,mode:e,draggingOver:a,combineWith:n,combineTargetFor:null}})),a=u((function(e,a,n,i,s,r,o){return{mapped:{type:"DRAGGING",dropping:null,draggingOver:s,combineWith:r,mode:a,offset:e,dimension:n,forceShouldAnimate:o,snapshot:t(a,i,s,r,null)}}})),function(n,i){if(n.isDragging){if(n.critical.draggable.id!==i.draggableId)return null;var s=n.current.client.offset,r=n.dimensions.draggables[i.draggableId],o=Fe(n.impact),l=(d=n.impact).at&&"COMBINE"===d.at.type?d.at.combine.draggableId:null,c=n.forceShouldAnimate;return a(e(s.x,s.y),n.movementMode,r,i.isClone,o,l,c)}var d;if("DROP_ANIMATING"===n.phase){var m=n.completed;if(m.result.draggableId!==i.draggableId)return null;var u=i.isClone,h=n.dimensions.draggables[i.draggableId],p=m.result,g=p.mode,v=ai(p),b=function(e){return e.combine?e.combine.draggableId:null}(p),f={duration:n.dropDuration,curve:_t,moveTo:n.newHomeClientOffset,opacity:b?St.drop:null,scale:b?wt.drop:null};return{mapped:{type:"DRAGGING",offset:n.newHomeClientOffset,dimension:h,dropping:f,draggingOver:v,combineWith:b,mode:g,forceShouldAnimate:null,snapshot:t(g,u,v,b,f)}}}return null}),i=function(){var e=u((function(e,t){return{x:e,y:t}})),t=u(ni),a=u((function(e,a,n){return void 0===a&&(a=null),{mapped:{type:"SECONDARY",offset:e,combineTargetFor:a,shouldAnimateDisplacement:n,snapshot:t(a)}}})),n=function(e){return e?a(I,e,!0):null},i=function(t,i,s,r){var o=s.displaced.visible[t],l=Boolean(r.inVirtualList&&r.effected[t]),c=ee(s),d=c&&c.draggableId===t?i:null;if(!o){if(!l)return n(d);if(s.displaced.invisible[t])return null;var m=P(r.displacedBy.point),u=e(m.x,m.y);return a(u,d,!0)}if(l)return n(d);var h=s.displacedBy.point,p=e(h.x,h.y);return a(p,d,o.shouldAnimate)};return function(e,t){if(e.isDragging)return e.critical.draggable.id===t.draggableId?null:i(t.draggableId,e.critical.draggable.id,e.impact,e.afterCritical);if("DROP_ANIMATING"===e.phase){var a=e.completed;return a.result.draggableId===t.draggableId?null:i(t.draggableId,a.result.draggableId,a.impact,a.afterCritical)}return null}}();return function(e,t){return n(e,t)||i(e,t)||ii}}),si,null,{context:La,pure:!0,areStatePropsEqual:ti})((function(e){var t=i.useRef(null),a=d.useCallback((function(e){t.current=e}),[]),n=d.useCallback((function(){return t.current}),[]),s=Fn(Ha),r=s.contextId,o=s.dragHandleUsageInstructionsId,l=s.registry,c=Fn(Gn),m=c.type,u=c.droppableId,h=d.useMemo((function(){return{id:e.draggableId,index:e.index,type:m,droppableId:u}}),[e.draggableId,e.index,m,u]),p=e.children,g=e.draggableId,v=e.isEnabled,b=e.shouldRespectForcePress,f=e.canDragInteractiveElements,y=e.isClone,E=e.mapped,_=e.dropAnimationFinished;Zn(),za(),y||Xn(d.useMemo((function(){return{descriptor:h,registry:l,getDraggableRef:n,canDragInteractiveElements:f,shouldRespectForcePress:b,isEnabled:v}}),[h,l,n,f,b,v]));var S=d.useMemo((function(){return v?{tabIndex:0,role:"button","aria-describedby":o,"data-rbd-drag-handle-draggable-id":g,"data-rbd-drag-handle-context-id":r,draggable:!1,onDragStart:ei}:null}),[r,o,g,v]),w=d.useCallback((function(e){"DRAGGING"===E.type&&E.dropping&&"transform"===e.propertyName&&_()}),[_,E]),O=d.useMemo((function(){var e=Qn(E),t="DRAGGING"===E.type&&E.dropping?w:null;return{innerRef:a,draggableProps:{"data-rbd-draggable-context-id":r,"data-rbd-draggable-id":g,style:e,onTransitionEnd:t},dragHandleProps:S}}),[r,S,g,E,w,a]),C=d.useMemo((function(){return{draggableId:h.id,type:h.type,source:{index:h.index,droppableId:h.droppableId}}}),[h.droppableId,h.id,h.index,h.type]);return p(O,E.snapshot,C)}));function oi(e){return Fn(Gn).isUsingCloneFor!==e.draggableId||e.isClone?s.createElement(ri,e):null}var li=function(e,t){return e===t.droppable.type},ci=function(e,t){return t.draggables[e.draggable.id]},di={updateViewportMaxScroll:function(e){return{type:"UPDATE_VIEWPORT_MAX_SCROLL",payload:e}}};var mi={mode:"standard",type:"DEFAULT",direction:"vertical",isDropDisabled:!1,isCombineEnabled:!1,ignoreContainerClipping:!1,renderClone:null,getContainerForClone:function(){return document.body||E(!1),document.body}},ui=c.connect((function(){var e={placeholder:null,shouldAnimatePlaceholder:!0,snapshot:{isDraggingOver:!1,draggingOverWith:null,draggingFromThisWith:null,isUsingPlaceholder:!1},useClone:null},t=o({},e,{shouldAnimatePlaceholder:!1}),a=u((function(e){return{draggableId:e.id,type:e.type,source:{index:e.index,droppableId:e.droppableId}}})),n=u((function(n,i,s,r,o,l){var c=o.descriptor.id;if(o.descriptor.droppableId===n){var d=l?{render:l,dragging:a(o.descriptor)}:null,m={isDraggingOver:s,draggingOverWith:s?c:null,draggingFromThisWith:c,isUsingPlaceholder:!0};return{placeholder:o.placeholder,shouldAnimatePlaceholder:!1,snapshot:m,useClone:d}}if(!i)return t;if(!r)return e;var u={isDraggingOver:s,draggingOverWith:c,draggingFromThisWith:null,isUsingPlaceholder:!0};return{placeholder:o.placeholder,shouldAnimatePlaceholder:!0,snapshot:u,useClone:null}}));return function(a,i){var s=i.droppableId,r=i.type,o=!i.isDropDisabled,l=i.renderClone;if(a.isDragging){var c=a.critical;if(!li(r,c))return t;var d=ci(c,a.dimensions),m=Fe(a.impact)===s;return n(s,o,m,m,d,l)}if("DROP_ANIMATING"===a.phase){var u=a.completed;if(!li(r,u.critical))return t;var h=ci(u.critical,a.dimensions);return n(s,o,ai(u.result)===s,Fe(u.impact)===s,h,l)}if("IDLE"===a.phase&&a.completed&&!a.shouldFlush){var p=a.completed;if(!li(r,p.critical))return t;var g=Fe(p.impact)===s,v=Boolean(p.impact.at&&"COMBINE"===p.impact.at.type),b=p.critical.droppable.id===s;return g?v?e:t:b?e:t}return t}}),di,null,{context:La,pure:!0,areStatePropsEqual:ti})((function(e){var t=i.useContext(Ha);t||E(!1);var a=t.contextId,n=t.isMovementAllowed,r=i.useRef(null),o=i.useRef(null),l=e.children,c=e.droppableId,m=e.type,g=e.mode,v=e.direction,b=e.ignoreContainerClipping,f=e.isDropDisabled,y=e.isCombineEnabled,_=e.snapshot,S=e.useClone,w=e.updateViewportMaxScroll,O=e.getContainerForClone,C=d.useCallback((function(){return r.current}),[]),x=d.useCallback((function(e){r.current=e}),[]),k=(d.useCallback((function(){return o.current}),[]),d.useCallback((function(e){o.current=e}),[]));Ga();var j=d.useCallback((function(){n()&&w({maxScroll:$t()})}),[n,w]);!function(e){var t=i.useRef(null),a=Fn(Ha),n=Wa("droppable"),s=a.registry,r=a.marshal,o=qa(e),l=d.useMemo((function(){return{id:e.droppableId,type:e.type,mode:e.mode}}),[e.droppableId,e.mode,e.type]),c=i.useRef(l),m=d.useMemo((function(){return u((function(e,a){t.current||E(!1);var n={x:e,y:a};r.updateDroppableScroll(l.id,n)}))}),[l.id,r]),p=d.useCallback((function(){var e=t.current;return e&&e.env.closestScrollable?Nn(e.env.closestScrollable):I}),[]),g=d.useCallback((function(){var e=p();m(e.x,e.y)}),[p,m]),v=d.useMemo((function(){return h(g)}),[g]),b=d.useCallback((function(){var e=t.current,a=Bn(e);e&&a||E(!1),e.scrollOptions.shouldPublishImmediately?g():v()}),[v,g]),f=d.useCallback((function(e,n){t.current&&E(!1);var i=o.current,s=i.getDroppableRef();s||E(!1);var r=Pn(s),c={ref:s,descriptor:l,env:r,scrollOptions:n};t.current=c;var d=Mn({ref:s,descriptor:l,env:r,windowScroll:e,direction:i.direction,isDropDisabled:i.isDropDisabled,isCombineEnabled:i.isCombineEnabled,shouldClipSubject:!i.ignoreContainerClipping}),m=r.closestScrollable;return m&&(m.setAttribute(ka.contextId,a.contextId),m.addEventListener("scroll",b,Un(c.scrollOptions))),d}),[a.contextId,l,b,o]),y=d.useCallback((function(){var e=t.current,a=Bn(e);return e&&a||E(!1),Nn(a)}),[]),_=d.useCallback((function(){var e=t.current;e||E(!1);var a=Bn(e);t.current=null,a&&(v.cancel(),a.removeAttribute(ka.contextId),a.removeEventListener("scroll",b,Un(e.scrollOptions)))}),[b,v]),S=d.useCallback((function(e){var a=t.current;a||E(!1);var n=Bn(a);n||E(!1),n.scrollTop+=e.y,n.scrollLeft+=e.x}),[]),w=d.useMemo((function(){return{getDimensionAndWatchScroll:f,getScrollWhileDragging:y,dragStopped:_,scroll:S}}),[_,f,y,S]),O=d.useMemo((function(){return{uniqueId:n,descriptor:l,callbacks:w}}),[w,l,n]);Ra((function(){return c.current=O.descriptor,s.droppable.register(O),function(){t.current&&_(),s.droppable.unregister(O)}}),[w,l,_,O,r,s.droppable]),Ra((function(){t.current&&r.updateDroppableIsEnabled(c.current.id,!e.isDropDisabled)}),[e.isDropDisabled,r]),Ra((function(){t.current&&r.updateDroppableIsCombineEnabled(c.current.id,e.isCombineEnabled)}),[e.isCombineEnabled,r])}({droppableId:c,type:m,mode:g,direction:v,isDropDisabled:f,isCombineEnabled:y,ignoreContainerClipping:b,getDroppableRef:C});var R=s.createElement(Kn,{on:e.placeholder,shouldAnimate:e.shouldAnimatePlaceholder},(function(e){var t=e.onClose,n=e.data,i=e.animate;return s.createElement(zn,{placeholder:n,onClose:t,innerRef:k,animate:i,contextId:a,onTransitionEnd:j})})),T=d.useMemo((function(){return{innerRef:x,placeholder:R,droppableProps:{"data-rbd-droppable-id":c,"data-rbd-droppable-context-id":a}}}),[a,c,R,x]),N=S?S.dragging.draggableId:null,D=d.useMemo((function(){return{droppableId:c,type:m,isUsingCloneFor:N}}),[c,N,m]);return s.createElement(Gn.Provider,{value:D},l(T,_),function(){if(!S)return null;var e=S.dragging,t=S.render,a=s.createElement(oi,{draggableId:e.draggableId,index:e.source.index,isClone:!0,isEnabled:!0,shouldRespectForcePress:!1,canDragInteractiveElements:!0},(function(a,n){return t(a,n,e)}));return p.createPortal(a,O())}())}));ui.defaultProps=mi,t.DragDropContext=function(e){var t=d.useMemo((function(){return""+Cn++}),[]),a=e.dragHandleUsageInstructions||x;return s.createElement(_,null,(function(n){return s.createElement(On,{nonce:e.nonce,contextId:t,setCallbacks:n,dragHandleUsageInstructions:a,enableDefaultSensors:e.enableDefaultSensors,sensors:e.sensors,onBeforeCapture:e.onBeforeCapture,onBeforeDragStart:e.onBeforeDragStart,onDragStart:e.onDragStart,onDragUpdate:e.onDragUpdate,onDragEnd:e.onDragEnd},e.children)}))},t.Draggable=function(e){var t="boolean"!=typeof e.isDragDisabled||!e.isDragDisabled,a=Boolean(e.disableInteractiveElementBlocking),n=Boolean(e.shouldRespectForcePress);return s.createElement(oi,o({},e,{isClone:!1,isEnabled:t,canDragInteractiveElements:a,shouldRespectForcePress:n}))},t.Droppable=ui,t.resetServerContext=function(){Cn=0,Ba=0},t.useKeyboardSensor=rn,t.useMouseSensor=tn,t.useTouchSensor=ln},1492:function(e,t,a){"use strict";function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(a(1493));function s(e){return"Minified Redux error #"+e+"; visit https://redux.js.org/Errors?code="+e+" for the full message or use the non-minified dev environment for full errors. "}var r="function"==typeof Symbol&&Symbol.observable||"@@observable",o=function(){return Math.random().toString(36).substring(7).split("").join(".")},l={INIT:"@@redux/INIT"+o(),REPLACE:"@@redux/REPLACE"+o(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+o()}};function c(e){if("object"!=typeof e||null===e)return!1;for(var t=e;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function d(e,t,a){var n;if("function"==typeof t&&"function"==typeof a||"function"==typeof a&&"function"==typeof arguments[3])throw new Error(s(0));if("function"==typeof t&&void 0===a&&(a=t,t=void 0),void 0!==a){if("function"!=typeof a)throw new Error(s(1));return a(d)(e,t)}if("function"!=typeof e)throw new Error(s(2));var i=e,o=t,m=[],u=m,h=!1;function p(){u===m&&(u=m.slice())}function g(){if(h)throw new Error(s(3));return o}function v(e){if("function"!=typeof e)throw new Error(s(4));if(h)throw new Error(s(5));var t=!0;return p(),u.push(e),function(){if(t){if(h)throw new Error(s(6));t=!1,p();var a=u.indexOf(e);u.splice(a,1),m=null}}}function b(e){if(!c(e))throw new Error(s(7));if(void 0===e.type)throw new Error(s(8));if(h)throw new Error(s(9));try{h=!0,o=i(o,e)}finally{h=!1}for(var t=m=u,a=0;a<t.length;a++){(0,t[a])()}return e}function f(e){if("function"!=typeof e)throw new Error(s(10));i=e,b({type:l.REPLACE})}function y(){var e,t=v;return(e={subscribe:function(e){if("object"!=typeof e||null===e)throw new Error(s(11));function a(){e.next&&e.next(g())}return a(),{unsubscribe:t(a)}}})[r]=function(){return this},e}return b({type:l.INIT}),(n={dispatch:b,subscribe:v,getState:g,replaceReducer:f})[r]=y,n}var m=d;function u(e,t){return function(){return t(e.apply(this,arguments))}}function h(){for(var e=arguments.length,t=new Array(e),a=0;a<e;a++)t[a]=arguments[a];return 0===t.length?function(e){return e}:1===t.length?t[0]:t.reduce((function(e,t){return function(){return e(t.apply(void 0,arguments))}}))}t.__DO_NOT_USE__ActionTypes=l,t.applyMiddleware=function(){for(var e=arguments.length,t=new Array(e),a=0;a<e;a++)t[a]=arguments[a];return function(e){return function(){var a=e.apply(void 0,arguments),n=function(){throw new Error(s(15))},r={getState:a.getState,dispatch:function(){return n.apply(void 0,arguments)}},o=t.map((function(e){return e(r)}));return n=h.apply(void 0,o)(a.dispatch),i.default(i.default({},a),{},{dispatch:n})}}},t.bindActionCreators=function(e,t){if("function"==typeof e)return u(e,t);if("object"!=typeof e||null===e)throw new Error(s(16));var a={};for(var n in e){var i=e[n];"function"==typeof i&&(a[n]=u(i,t))}return a},t.combineReducers=function(e){for(var t=Object.keys(e),a={},n=0;n<t.length;n++){var i=t[n];0,"function"==typeof e[i]&&(a[i]=e[i])}var r,o=Object.keys(a);try{!function(e){Object.keys(e).forEach((function(t){var a=e[t];if(void 0===a(void 0,{type:l.INIT}))throw new Error(s(12));if(void 0===a(void 0,{type:l.PROBE_UNKNOWN_ACTION()}))throw new Error(s(13))}))}(a)}catch(e){r=e}return function(e,t){if(void 0===e&&(e={}),r)throw r;for(var n=!1,i={},l=0;l<o.length;l++){var c=o[l],d=a[c],m=e[c],u=d(m,t);if(void 0===u){t&&t.type;throw new Error(s(14))}i[c]=u,n=n||u!==m}return(n=n||o.length!==Object.keys(e).length)?i:e}},t.compose=h,t.createStore=d,t.legacy_createStore=m},1493:function(e,t,a){var n=a(13);function i(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}e.exports=function(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?i(Object(a),!0).forEach((function(t){n(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):i(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e},e.exports.__esModule=!0,e.exports.default=e.exports},1494:function(e,t,a){"use strict";t.__esModule=!0;var n={batch:!0},i=a(1495);Object.keys(i).forEach((function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(n,e)||e in t&&t[e]===i[e]||(t[e]=i[e]))}));var s=a(1512);t.batch=s.unstable_batchedUpdates,(0,a(896).setBatch)(s.unstable_batchedUpdates)},1495:function(e,t,a){"use strict";var n=a(172).default;t.__esModule=!0;var i=n(a(1496));t.Provider=i.default;var s=n(a(897));t.connectAdvanced=s.default;var r=a(313);t.ReactReduxContext=r.ReactReduxContext;var o=n(a(1502));t.connect=o.default;var l=a(1510);t.useDispatch=l.useDispatch,t.createDispatchHook=l.createDispatchHook;var c=a(1511);t.useSelector=c.useSelector,t.createSelectorHook=c.createSelectorHook;var d=a(902);t.useStore=d.useStore,t.createStoreHook=d.createStoreHook;var m=n(a(898));t.shallowEqual=m.default},1496:function(e,t,a){"use strict";var n=a(172).default,i=a(240).default;t.__esModule=!0,t.default=void 0;var s=i(a(120)),r=(n(a(215)),a(313)),o=a(636),l=a(637);var c=function(e){var t=e.store,a=e.context,n=e.children,i=(0,s.useMemo)((function(){var e=(0,o.createSubscription)(t);return{store:t,subscription:e}}),[t]),c=(0,s.useMemo)((function(){return t.getState()}),[t]);(0,l.useIsomorphicLayoutEffect)((function(){var e=i.subscription;return e.onStateChange=e.notifyNestedSubs,e.trySubscribe(),c!==t.getState()&&e.notifyNestedSubs(),function(){e.tryUnsubscribe(),e.onStateChange=null}}),[i,c]);var d=a||r.ReactReduxContext;return s.default.createElement(d.Provider,{value:i},n)};t.default=c},1497:function(e,t,a){"use strict";var n=a(1498),i={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},s={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},r={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},o={};function l(e){return n.isMemo(e)?r:o[e.$$typeof]||i}o[n.ForwardRef]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},o[n.Memo]=r;var c=Object.defineProperty,d=Object.getOwnPropertyNames,m=Object.getOwnPropertySymbols,u=Object.getOwnPropertyDescriptor,h=Object.getPrototypeOf,p=Object.prototype;e.exports=function e(t,a,n){if("string"!=typeof a){if(p){var i=h(a);i&&i!==p&&e(t,i,n)}var r=d(a);m&&(r=r.concat(m(a)));for(var o=l(t),g=l(a),v=0;v<r.length;++v){var b=r[v];if(!(s[b]||n&&n[b]||g&&g[b]||o&&o[b])){var f=u(a,b);try{c(t,b,f)}catch(e){}}}}return t}},1498:function(e,t,a){"use strict";e.exports=a(1499)},1499:function(e,t,a){"use strict";var n="function"==typeof Symbol&&Symbol.for,i=n?Symbol.for("react.element"):60103,s=n?Symbol.for("react.portal"):60106,r=n?Symbol.for("react.fragment"):60107,o=n?Symbol.for("react.strict_mode"):60108,l=n?Symbol.for("react.profiler"):60114,c=n?Symbol.for("react.provider"):60109,d=n?Symbol.for("react.context"):60110,m=n?Symbol.for("react.async_mode"):60111,u=n?Symbol.for("react.concurrent_mode"):60111,h=n?Symbol.for("react.forward_ref"):60112,p=n?Symbol.for("react.suspense"):60113,g=n?Symbol.for("react.suspense_list"):60120,v=n?Symbol.for("react.memo"):60115,b=n?Symbol.for("react.lazy"):60116,f=n?Symbol.for("react.block"):60121,y=n?Symbol.for("react.fundamental"):60117,E=n?Symbol.for("react.responder"):60118,_=n?Symbol.for("react.scope"):60119;function S(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case i:switch(e=e.type){case m:case u:case r:case l:case o:case p:return e;default:switch(e=e&&e.$$typeof){case d:case h:case b:case v:case c:return e;default:return t}}case s:return t}}}function w(e){return S(e)===u}t.AsyncMode=m,t.ConcurrentMode=u,t.ContextConsumer=d,t.ContextProvider=c,t.Element=i,t.ForwardRef=h,t.Fragment=r,t.Lazy=b,t.Memo=v,t.Portal=s,t.Profiler=l,t.StrictMode=o,t.Suspense=p,t.isAsyncMode=function(e){return w(e)||S(e)===m},t.isConcurrentMode=w,t.isContextConsumer=function(e){return S(e)===d},t.isContextProvider=function(e){return S(e)===c},t.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===i},t.isForwardRef=function(e){return S(e)===h},t.isFragment=function(e){return S(e)===r},t.isLazy=function(e){return S(e)===b},t.isMemo=function(e){return S(e)===v},t.isPortal=function(e){return S(e)===s},t.isProfiler=function(e){return S(e)===l},t.isStrictMode=function(e){return S(e)===o},t.isSuspense=function(e){return S(e)===p},t.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===r||e===u||e===l||e===o||e===p||e===g||"object"==typeof e&&null!==e&&(e.$$typeof===b||e.$$typeof===v||e.$$typeof===c||e.$$typeof===d||e.$$typeof===h||e.$$typeof===y||e.$$typeof===E||e.$$typeof===_||e.$$typeof===f)},t.typeOf=S},1500:function(e,t,a){"use strict";e.exports=a(1501)},1501:function(e,t,a){"use strict";var n=60103,i=60106,s=60107,r=60108,o=60114,l=60109,c=60110,d=60112,m=60113,u=60120,h=60115,p=60116,g=60121,v=60122,b=60117,f=60129,y=60131;if("function"==typeof Symbol&&Symbol.for){var E=Symbol.for;n=E("react.element"),i=E("react.portal"),s=E("react.fragment"),r=E("react.strict_mode"),o=E("react.profiler"),l=E("react.provider"),c=E("react.context"),d=E("react.forward_ref"),m=E("react.suspense"),u=E("react.suspense_list"),h=E("react.memo"),p=E("react.lazy"),g=E("react.block"),v=E("react.server.block"),b=E("react.fundamental"),f=E("react.debug_trace_mode"),y=E("react.legacy_hidden")}function _(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case n:switch(e=e.type){case s:case o:case r:case m:case u:return e;default:switch(e=e&&e.$$typeof){case c:case d:case p:case h:case l:return e;default:return t}}case i:return t}}}var S=l,w=n,O=d,C=s,x=p,k=h,j=i,R=o,I=r,T=m;t.ContextConsumer=c,t.ContextProvider=S,t.Element=w,t.ForwardRef=O,t.Fragment=C,t.Lazy=x,t.Memo=k,t.Portal=j,t.Profiler=R,t.StrictMode=I,t.Suspense=T,t.isAsyncMode=function(){return!1},t.isConcurrentMode=function(){return!1},t.isContextConsumer=function(e){return _(e)===c},t.isContextProvider=function(e){return _(e)===l},t.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===n},t.isForwardRef=function(e){return _(e)===d},t.isFragment=function(e){return _(e)===s},t.isLazy=function(e){return _(e)===p},t.isMemo=function(e){return _(e)===h},t.isPortal=function(e){return _(e)===i},t.isProfiler=function(e){return _(e)===o},t.isStrictMode=function(e){return _(e)===r},t.isSuspense=function(e){return _(e)===m},t.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===s||e===o||e===f||e===r||e===m||e===u||e===y||"object"==typeof e&&null!==e&&(e.$$typeof===p||e.$$typeof===h||e.$$typeof===l||e.$$typeof===c||e.$$typeof===d||e.$$typeof===b||e.$$typeof===g||e[0]===v)},t.typeOf=_},1502:function(e,t,a){"use strict";var n=a(172).default;t.__esModule=!0,t.createConnect=g,t.default=void 0;var i=n(a(130)),s=n(a(405)),r=n(a(897)),o=n(a(898)),l=n(a(1503)),c=n(a(1506)),d=n(a(1507)),m=n(a(1508)),u=["pure","areStatesEqual","areOwnPropsEqual","areStatePropsEqual","areMergedPropsEqual"];function h(e,t,a){for(var n=t.length-1;n>=0;n--){var i=t[n](e);if(i)return i}return function(t,n){throw new Error("Invalid value of type "+typeof e+" for "+a+" argument when connecting component "+n.wrappedComponentName+".")}}function p(e,t){return e===t}function g(e){var t=void 0===e?{}:e,a=t.connectHOC,n=void 0===a?r.default:a,g=t.mapStateToPropsFactories,v=void 0===g?c.default:g,b=t.mapDispatchToPropsFactories,f=void 0===b?l.default:b,y=t.mergePropsFactories,E=void 0===y?d.default:y,_=t.selectorFactory,S=void 0===_?m.default:_;return function(e,t,a,r){void 0===r&&(r={});var l=r,c=l.pure,d=void 0===c||c,m=l.areStatesEqual,g=void 0===m?p:m,b=l.areOwnPropsEqual,y=void 0===b?o.default:b,_=l.areStatePropsEqual,w=void 0===_?o.default:_,O=l.areMergedPropsEqual,C=void 0===O?o.default:O,x=(0,s.default)(l,u),k=h(e,v,"mapStateToProps"),j=h(t,f,"mapDispatchToProps"),R=h(a,E,"mergeProps");return n(S,(0,i.default)({methodName:"connect",getDisplayName:function(e){return"Connect("+e+")"},shouldHandleStateChanges:Boolean(e),initMapStateToProps:k,initMapDispatchToProps:j,initMergeProps:R,pure:d,areStatesEqual:g,areOwnPropsEqual:y,areStatePropsEqual:w,areMergedPropsEqual:C},x))}}var v=g();t.default=v},1503:function(e,t,a){"use strict";var n=a(172).default;t.__esModule=!0,t.default=void 0,t.whenMapDispatchToPropsIsFunction=r,t.whenMapDispatchToPropsIsMissing=o,t.whenMapDispatchToPropsIsObject=l;var i=n(a(1504)),s=a(899);function r(e){return"function"==typeof e?(0,s.wrapMapToPropsFunc)(e,"mapDispatchToProps"):void 0}function o(e){return e?void 0:(0,s.wrapMapToPropsConstant)((function(e){return{dispatch:e}}))}function l(e){return e&&"object"==typeof e?(0,s.wrapMapToPropsConstant)((function(t){return(0,i.default)(e,t)})):void 0}var c=[r,o,l];t.default=c},1504:function(e,t,a){"use strict";t.__esModule=!0,t.default=function(e,t){var a={},n=function(n){var i=e[n];"function"==typeof i&&(a[n]=function(){return t(i.apply(void 0,arguments))})};for(var i in e)n(i);return a}},1505:function(e,t,a){"use strict";t.__esModule=!0,t.default=function(e){if("object"!=typeof e||null===e)return!1;var t=Object.getPrototypeOf(e);if(null===t)return!0;var a=t;for(;null!==Object.getPrototypeOf(a);)a=Object.getPrototypeOf(a);return t===a}},1506:function(e,t,a){"use strict";t.__esModule=!0,t.default=void 0,t.whenMapStateToPropsIsFunction=i,t.whenMapStateToPropsIsMissing=s;var n=a(899);function i(e){return"function"==typeof e?(0,n.wrapMapToPropsFunc)(e,"mapStateToProps"):void 0}function s(e){return e?void 0:(0,n.wrapMapToPropsConstant)((function(){return{}}))}var r=[i,s];t.default=r},1507:function(e,t,a){"use strict";var n=a(172).default;t.__esModule=!0,t.default=void 0,t.defaultMergeProps=s,t.whenMergePropsIsFunction=o,t.whenMergePropsIsOmitted=l,t.wrapMergePropsFunc=r;var i=n(a(130));n(a(900));function s(e,t,a){return(0,i.default)({},a,e,t)}function r(e){return function(t,a){a.displayName;var n,i=a.pure,s=a.areMergedPropsEqual,r=!1;return function(t,a,o){var l=e(t,a,o);return r?i&&s(l,n)||(n=l):(r=!0,n=l),n}}}function o(e){return"function"==typeof e?r(e):void 0}function l(e){return e?void 0:function(){return s}}var c=[o,l];t.default=c},1508:function(e,t,a){"use strict";var n=a(172).default;t.__esModule=!0,t.default=function(e,t){var a=t.initMapStateToProps,n=t.initMapDispatchToProps,l=t.initMergeProps,c=(0,i.default)(t,s),d=a(e,c),m=n(e,c),u=l(e,c);0;return(c.pure?o:r)(d,m,u,e,c)},t.impureFinalPropsSelectorFactory=r,t.pureFinalPropsSelectorFactory=o;var i=n(a(405)),s=(n(a(1509)),["initMapStateToProps","initMapDispatchToProps","initMergeProps"]);function r(e,t,a,n){return function(i,s){return a(e(i,s),t(n,s),s)}}function o(e,t,a,n,i){var s,r,o,l,c,d=i.areStatesEqual,m=i.areOwnPropsEqual,u=i.areStatePropsEqual,h=!1;function p(i,h){var p,g,v=!m(h,r),b=!d(i,s,h,r);return s=i,r=h,v&&b?(o=e(s,r),t.dependsOnOwnProps&&(l=t(n,r)),c=a(o,l,r)):v?(e.dependsOnOwnProps&&(o=e(s,r)),t.dependsOnOwnProps&&(l=t(n,r)),c=a(o,l,r)):b?(p=e(s,r),g=!u(p,o),o=p,g&&(c=a(o,l,r)),c):c}return function(i,d){return h?p(i,d):(o=e(s=i,r=d),l=t(n,r),c=a(o,l,r),h=!0,c)}}},1509:function(e,t,a){"use strict";var n=a(172).default;t.__esModule=!0,t.default=function(e,t,a,n){s(e,"mapStateToProps",n),s(t,"mapDispatchToProps",n),s(a,"mergeProps",n)};var i=n(a(901));function s(e,t,a){if(!e)throw new Error("Unexpected value for "+t+" in "+a+".");"mapStateToProps"!==t&&"mapDispatchToProps"!==t||Object.prototype.hasOwnProperty.call(e,"dependsOnOwnProps")||(0,i.default)("The selector for "+t+" of "+a+" did not specify a value for dependsOnOwnProps.")}},1510:function(e,t,a){"use strict";t.__esModule=!0,t.createDispatchHook=s,t.useDispatch=void 0;var n=a(313),i=a(902);function s(e){void 0===e&&(e=n.ReactReduxContext);var t=e===n.ReactReduxContext?i.useStore:(0,i.createStoreHook)(e);return function(){return t().dispatch}}var r=s();t.useDispatch=r},1511:function(e,t,a){"use strict";t.__esModule=!0,t.createSelectorHook=c,t.useSelector=void 0;var n=a(120),i=a(903),s=a(636),r=a(637),o=a(313),l=function(e,t){return e===t};function c(e){void 0===e&&(e=o.ReactReduxContext);var t=e===o.ReactReduxContext?i.useReduxContext:function(){return(0,n.useContext)(e)};return function(e,a){void 0===a&&(a=l);var i=t(),o=function(e,t,a,i){var o,l=(0,n.useReducer)((function(e){return e+1}),0)[1],c=(0,n.useMemo)((function(){return(0,s.createSubscription)(a,i)}),[a,i]),d=(0,n.useRef)(),m=(0,n.useRef)(),u=(0,n.useRef)(),h=(0,n.useRef)(),p=a.getState();try{if(e!==m.current||p!==u.current||d.current){var g=e(p);o=void 0!==h.current&&t(g,h.current)?h.current:g}else o=h.current}catch(e){throw d.current&&(e.message+="\nThe error may be correlated with this previous error:\n"+d.current.stack+"\n\n"),e}return(0,r.useIsomorphicLayoutEffect)((function(){m.current=e,u.current=p,h.current=o,d.current=void 0})),(0,r.useIsomorphicLayoutEffect)((function(){function e(){try{var e=a.getState();if(e===u.current)return;var n=m.current(e);if(t(n,h.current))return;h.current=n,u.current=e}catch(e){d.current=e}l()}return c.onStateChange=e,c.trySubscribe(),e(),function(){return c.tryUnsubscribe()}}),[a,c]),o}(e,a,i.store,i.subscription);return(0,n.useDebugValue)(o),o}}var d=c();t.useSelector=d},1512:function(e,t,a){"use strict";t.__esModule=!0,t.unstable_batchedUpdates=void 0;var n=a(185);t.unstable_batchedUpdates=n.unstable_batchedUpdates},1513:function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=a(120);function i(e,t){var a=n.useState((function(){return{inputs:t,result:e()}}))[0],i=n.useRef(!0),s=n.useRef(a),r=i.current||Boolean(t&&s.current.inputs&&function(e,t){if(e.length!==t.length)return!1;for(var a=0;a<e.length;a++)if(e[a]!==t[a])return!1;return!0}(t,s.current.inputs))?s.current:{inputs:t,result:e()};return n.useEffect((function(){i.current=!1,s.current=r}),[r]),r.result}function s(e,t){return i((function(){return e}),t)}var r=i,o=s;t.useCallback=o,t.useCallbackOne=s,t.useMemo=r,t.useMemoOne=i},1514:function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n,i=(n=a(1515))&&"object"==typeof n&&"default"in n?n.default:n,s=function(e){var t=e.top,a=e.right,n=e.bottom,i=e.left;return{top:t,right:a,bottom:n,left:i,width:a-i,height:n-t,x:i,y:t,center:{x:(a+i)/2,y:(n+t)/2}}},r=function(e,t){return{top:e.top-t.top,left:e.left-t.left,bottom:e.bottom+t.bottom,right:e.right+t.right}},o=function(e,t){return{top:e.top+t.top,left:e.left+t.left,bottom:e.bottom-t.bottom,right:e.right-t.right}},l={top:0,right:0,bottom:0,left:0},c=function(e){var t=e.borderBox,a=e.margin,n=void 0===a?l:a,i=e.border,c=void 0===i?l:i,d=e.padding,m=void 0===d?l:d,u=s(r(t,n)),h=s(o(t,c)),p=s(o(h,m));return{marginBox:u,borderBox:s(t),paddingBox:h,contentBox:p,margin:n,border:c,padding:m}},d=function(e){var t=e.slice(0,-2);if("px"!==e.slice(-2))return 0;var a=Number(t);return isNaN(a)&&i(!1),a},m=function(e,t){var a,n,i=e.borderBox,s=e.border,r=e.margin,o=e.padding,l=(n=t,{top:(a=i).top+n.y,left:a.left+n.x,bottom:a.bottom+n.y,right:a.right+n.x});return c({borderBox:l,border:s,margin:r,padding:o})},u=function(e,t){var a={top:d(t.marginTop),right:d(t.marginRight),bottom:d(t.marginBottom),left:d(t.marginLeft)},n={top:d(t.paddingTop),right:d(t.paddingRight),bottom:d(t.paddingBottom),left:d(t.paddingLeft)},i={top:d(t.borderTopWidth),right:d(t.borderRightWidth),bottom:d(t.borderBottomWidth),left:d(t.borderLeftWidth)};return c({borderBox:e,margin:a,padding:n,border:i})};t.calculateBox=u,t.createBox=c,t.expand=r,t.getBox=function(e){var t=e.getBoundingClientRect(),a=window.getComputedStyle(e);return u(t,a)},t.getRect=s,t.offset=m,t.shrink=o,t.withScroll=function(e,t){return void 0===t&&(t={x:window.pageXOffset,y:window.pageYOffset}),m(e,t)}},1515:function(e,t,a){"use strict";var n="Invariant failed";e.exports=function(e,t){if(!e)throw new Error(n)}},1516:function(e,t,a){"use strict";var n=Number.isNaN||function(e){return"number"==typeof e&&e!=e};function i(e,t){if(e.length!==t.length)return!1;for(var a=0;a<e.length;a++)if(i=e[a],s=t[a],!(i===s||n(i)&&n(s)))return!1;var i,s;return!0}e.exports=function(e,t){var a;void 0===t&&(t=i);var n,s=[],r=!1;return function(){for(var i=[],o=0;o<arguments.length;o++)i[o]=arguments[o];return r&&a===this&&t(i,s)||(n=e.apply(this,i),r=!0,a=this,s=i),n}}},1517:function(e,t,a){"use strict";e.exports=function(e){var t=[],a=null,n=function(){for(var n=arguments.length,i=new Array(n),s=0;s<n;s++)i[s]=arguments[s];t=i,a||(a=requestAnimationFrame((function(){a=null,e.apply(void 0,t)})))};return n.cancel=function(){a&&(cancelAnimationFrame(a),a=null)},n}},1518:function(e,t){e.exports="img/user-onboarding/WorkMessaging.f3c8ccf.png"},1519:function(e,t){e.exports="img/user-onboarding/CommunityMessaging.85955ea.png"},1520:function(e,t,a){"use strict";a.r(t),a.d(t,"Icon",(function(){return l}));var n,i,s,r=a(120);function o(){return o=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},o.apply(this,arguments)}function l(e){return r.createElement("svg",o({fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",role:"presentation","aria-hidden":!0},e),r.createElement("g",{clipPath:"url(#default_app_svg__clip0)"},n||(n=r.createElement("rect",{width:20,height:20,rx:4,fill:"url(#default_app_svg__paint0_linear)"})),r.createElement("path",{d:"M2.496 0v20M20 2.5H0M20 10H0M20 17.5H0M10 0v20M17.496 0v20",stroke:"#fff",strokeOpacity:.5,style:{mixBlendMode:"lighten"}}),i||(i=r.createElement("circle",{opacity:.8,cx:10,cy:10,r:7.5,stroke:"#fff"}))),s||(s=r.createElement("defs",null,r.createElement("linearGradient",{id:"default_app_svg__paint0_linear",x1:10,y1:0,x2:10,y2:20,gradientUnits:"userSpaceOnUse"},r.createElement("stop",{stopColor:"#60A6FF"}),r.createElement("stop",{offset:1,stopColor:"#418DED"})),r.createElement("clipPath",{id:"default_app_svg__clip0"},r.createElement("rect",{width:20,height:20,rx:4,fill:"#fff"})))))}t.default="img/element-icons/room/default_app.63bac9a.svg"},1521:function(e,t,a){"use strict";a.r(t),a.d(t,"Icon",(function(){return o}));var n,i,s=a(120);function r(){return r=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},r.apply(this,arguments)}function o(e){return s.createElement("svg",r({fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",role:"presentation","aria-hidden":!0},e),n||(n=s.createElement("rect",{width:20,height:20,rx:4,fill:"#5ABFF2"})),i||(i=s.createElement("path",{d:"M3 7.875C3 6.839 3.84 6 4.875 6h6.313c1.035 0 1.874.84 1.874 1.875v5c0 1.036-.839 1.875-1.874 1.875H4.875A1.875 1.875 0 013 12.875v-5zM14.375 8.446l1.746-1.336a.547.547 0 01.879.435v5.495c0 .48-.575.727-.923.396l-1.702-1.615V8.446z",fill:"#fff"})))}t.default="img/element-icons/room/default_video.6afce87.svg"},1522:function(e,t,a){"use strict";a.r(t),a.d(t,"Icon",(function(){return c}));var n,i,s,r,o=a(120);function l(){return l=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},l.apply(this,arguments)}function c(e){return o.createElement("svg",l({fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",role:"presentation","aria-hidden":!0},e),n||(n=o.createElement("rect",{width:20,height:20,rx:4,fill:"#FF5B55"})),i||(i=o.createElement("path",{d:"M2 7h16v9a2 2 0 01-2 2H4a2 2 0 01-2-2V7z",fill:"#fff"})),s||(s=o.createElement("rect",{x:3.968,y:9,width:2.997,height:3,rx:.25,fill:"#FF5B55"})),r||(r=o.createElement("rect",{x:10.961,y:13,width:2.997,height:3,rx:.25,fill:"#FF5B55"})))}t.default="img/element-icons/room/default_cal.68352c5.svg"},1523:function(e,t,a){"use strict";a.r(t),a.d(t,"Icon",(function(){return o}));var n,i,s=a(120);function r(){return r=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},r.apply(this,arguments)}function o(e){return s.createElement("svg",r({fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",role:"presentation","aria-hidden":!0},e),n||(n=s.createElement("rect",{width:20,height:20,rx:4,fill:"#FCC639"})),i||(i=s.createElement("path",{d:"M2 7h16v9a2 2 0 01-2 2H4a2 2 0 01-2-2V7z",fill:"#fff"})))}t.default="img/element-icons/room/default_doc.6a6092c.svg"},1524:function(e,t,a){"use strict";a.r(t),a.d(t,"Icon",(function(){return l}));var n,i,s,r=a(120);function o(){return o=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},o.apply(this,arguments)}function l(e){return r.createElement("svg",o({fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",role:"presentation","aria-hidden":!0},e),n||(n=r.createElement("rect",{x:1,y:1,width:18,height:18,rx:3,fill:"#17191C",stroke:"#17191C",strokeWidth:2})),i||(i=r.createElement("path",{d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0z",fill:"#fff"})),s||(s=r.createElement("path",{d:"M10 6v3.813l2.5 1.687",stroke:"#000",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})))}t.default="img/element-icons/room/default_clock.312a340.svg"},1525:function(e,t,a){"use strict";(function(e){a.d(t,"a",(function(){return R}));var n=a(13),i=a.n(n),s=a(120),r=a.n(s),o=a(185),l=a.n(o),c=a(143),d=a(1526),m=a(129),u=a(1),h=a(639),p=a(163),g=a(194),v=a(652),b=a(161),f=a(167),y=a(121),E=a(260),_=a(400),S=a(498),w=a(191),O=a(133),C=a(1532),x=a(295),k=a(237),j=a(1534);class R extends h.a{constructor(e,t,a,n){super(e,t,a,n),i()(this,"avatars",void 0),i()(this,"permalinkCreator",void 0),i()(this,"totalSize",void 0),i()(this,"mediaOmitText",void 0),this.avatars=new Map,this.permalinkCreator=new f.a(this.room),this.totalSize=0,this.mediaOmitText=this.exportOptions.attachmentsIncluded?Object(y.a)("Media omitted - file size limit exceeded"):Object(y.a)("Media omitted")}async getRoomAvatar(){let e;const t=E.b(this.room,32,32,"crop"),a="room.png";if(t)try{const n=await fetch(t);e=await n.blob(),this.totalSize+=e.size,this.addFile(a,e)}catch(e){u.a.log("Failed to fetch room's avatar"+e)}const n=r.a.createElement(w.a,{width:32,height:32,name:this.room.name,title:this.room.name,url:e?a:"",resizeMethod:"crop"});return Object(d.renderToStaticMarkup)(n)}async wrapHTML(e,t,a){var n,i,s,o,l;const c=await this.getRoomAvatar(),u=Object(b.f)(new Date),h=null===(n=this.room.currentState.getStateEvents(m.b.RoomCreate,""))||void 0===n?void 0:n.getSender(),p=(h?null===(i=this.room.getMember(h))||void 0===i?void 0:i.rawDisplayName:h)||h,g=this.client.getUserId(),v=null===(s=this.room.getMember(g))||void 0===s?void 0:s.rawDisplayName,f=(null===(o=this.room.currentState.getStateEvents(m.b.RoomTopic,""))||void 0===o||null===(l=o.getContent())||void 0===l?void 0:l.topic)||"",E=Object(y.a)("%(creatorName)s created this room.",{creatorName:p}),_=Object(d.renderToStaticMarkup)(r.a.createElement("p",null,Object(y.a)("This is the start of export of <roomName/>. Exported by <exporterDetails/> at %(exportDate)s.",{exportDate:u},{roomName:()=>r.a.createElement("b",null,this.room.name),exporterDetails:()=>r.a.createElement("a",{href:`https://matrix.to/#/${g}`,target:"_blank",rel:"noopener noreferrer"},v?r.a.createElement(r.a.Fragment,null,r.a.createElement("b",null,v)," ("+g+")"):r.a.createElement("b",null,g))}))),S=f?Object(y.a)("Topic: %(topic)s",{topic:f}):"",w=Object(d.renderToStaticMarkup)(0!==t?r.a.createElement("div",{style:{textAlign:"center"}},r.a.createElement("a",{href:`./messages${1===t?"":t}.html`,style:{fontWeight:"bold"}},"Previous group of messages")):r.a.createElement(r.a.Fragment,null)),O=Object(d.renderToStaticMarkup)(t<a-1?r.a.createElement("div",{style:{textAlign:"center",margin:"10px"}},r.a.createElement("a",{href:"./messages"+(t+2)+".html",style:{fontWeight:"bold"}},"Next group of messages")):r.a.createElement(r.a.Fragment,null));return`\n <!DOCTYPE html>\n <html lang="en">\n <head>\n <meta charset="UTF-8" />\n <meta http-equiv="X-UA-Compatible" content="IE=edge" />\n <meta name="viewport" content="width=device-width, initial-scale=1.0" />\n <link href="css/style.css" rel="stylesheet" />\n <script src="js/script.js"><\/script>\n <title>Exported Data</title>\n </head>\n <body style="height: 100vh;">\n <section\n id="matrixchat"\n style="height: 100%; overflow: auto"\n class="notranslate"\n >\n <div class="mx_MatrixChat_wrapper" aria-hidden="false">\n <div class="mx_MatrixChat">\n <main class="mx_RoomView">\n <div class="mx_RoomHeader light-panel">\n <div class="mx_RoomHeader_wrapper" aria-owns="mx_RightPanel">\n <div class="mx_RoomHeader_avatar">\n <div class="mx_DecoratedRoomAvatar">\n ${c}\n </div>\n </div>\n <div class="mx_RoomHeader_name">\n <div\n dir="auto"\n class="mx_RoomHeader_nametext"\n title="${this.room.name}"\n >\n ${this.room.name}\n </div>\n </div>\n <div class="mx_RoomHeader_topic" dir="auto"> ${f} </div>\n </div>\n </div>\n ${w}\n <div class="mx_MainSplit">\n <div class="mx_RoomView_body">\n <div\n class="mx_RoomView_timeline mx_RoomView_timeline_rr_enabled"\n >\n <div\n class="\n mx_AutoHideScrollbar\n mx_ScrollPanel\n mx_RoomView_messagePanel\n "\n >\n <div class="mx_RoomView_messageListWrapper">\n <ol\n class="mx_RoomView_MessageList"\n aria-live="polite"\n role="list"\n >\n ${0==t?`<div class="mx_NewRoomIntro">\n ${c}\n <h2> ${this.room.name} </h2>\n <p> ${E} <br/><br/> ${_} </p>\n <br/>\n <p> ${S} </p>\n </div>`:""}\n ${e}\n </ol>\n </div>\n </div>\n </div>\n <div class="mx_RoomView_statusArea">\n <div class="mx_RoomView_statusAreaBox">\n <div class="mx_RoomView_statusAreaBox_line"></div>\n </div>\n </div>\n </div>\n </div>\n ${O}\n </main>\n </div>\n </div>\n </section>\n <div id="snackbar"/>\n </body>\n </html>`}getAvatarURL(e){const t=e.sender,a=null==t?void 0:t.getMxcAvatarUrl();return a?Object(p.b)(a).getThumbnailOfSourceHttp(30,30,"crop"):null}async saveAvatarIfNeeded(e){const t=e.sender;if(!this.avatars.has(t.userId))try{const a=this.getAvatarURL(e);this.avatars.set(t.userId,!0);const n=await fetch(a),i=await n.blob();this.addFile(`users/${t.userId.replace(/:/g,"-")}.png`,i)}catch(e){u.a.log("Failed to fetch user's avatar"+e)}}getDateSeparator(e){const t=e.getTs(),a=r.a.createElement("li",{key:t},r.a.createElement(S.a,{forExport:!0,key:t,roomId:e.getRoomId(),ts:t}));return Object(d.renderToStaticMarkup)(a)}needsDateSeparator(e,t){return!t||Object(b.o)(t.getDate()||void 0,e.getDate()||void 0)}getEventTile(e,t){return r.a.createElement("div",{className:"mx_Export_EventWrapper",id:e.getId()},r.a.createElement(O.a.Provider,{value:this.client},r.a.createElement(_.a,{mxEvent:e,continuation:t,isRedacted:e.isRedacted(),replacingEventId:e.replacingEventId(),forExport:!0,alwaysShowTimestamps:!0,showUrlPreview:!1,checkUnmounting:()=>!1,isTwelveHour:!1,last:!1,lastInSection:!1,permalinkCreator:this.permalinkCreator,lastSuccessful:!1,isSelectedEvent:!1,showReactions:!1,layout:g.a.Group,showReadReceipts:!1})))}async getEventTileMarkup(e,t,a){const n=this.getAvatarURL(e),i=!!n;i&&await this.saveAvatarIfNeeded(e);const s=this.getEventTile(e,t);let r;if(e.getContent().msgtype==m.e.Emote||e.getContent().msgtype==m.e.Notice||e.getContent().msgtype===m.e.Text){const e=document.createElement("div");l.a.render(s,e),r=e.innerHTML}else r=Object(d.renderToStaticMarkup)(s);if(a){var o,c;const t=null!==(o=e.getContent().url)&&void 0!==o?o:null===(c=e.getContent().file)||void 0===c?void 0:c.url;r=r.split(t).join(a)}return r=r.replace(/<span class="mx_MFileBody_info_icon".*?>.*?<\/span>/,""),i&&(r=r.replace(encodeURI(n).replace(/&/g,"&amp;"),`users/${e.sender.userId.replace(/:/g,"-")}.png`)),r}createModifiedEvent(e,t){const a={msgtype:"m.text",body:`${e}`,format:"org.matrix.custom.html",formatted_body:`${e}`};(!(arguments.length>2&&void 0!==arguments[2])||arguments[2])&&(a.formatted_body="<em>"+a.formatted_body+"</em>",a.body="*"+a.body+"*");const n=new c.b;return n.event=t.event,n.sender=t.sender,n.event.type="m.room.message",n.event.content=a,n}async createMessageBody(e){let t,a=arguments.length>1&&void 0!==arguments[1]&&arguments[1];try{if(this.isAttachment(e))if(this.exportOptions.attachmentsIncluded)try{const n=await this.getMediaBlob(e);if(this.totalSize+n.size>this.exportOptions.maxSize)t=await this.getEventTileMarkup(this.createModifiedEvent(this.mediaOmitText,e),a);else{this.totalSize+=n.size;const i=this.getFilePath(e);t=await this.getEventTileMarkup(e,a,i),this.totalSize==this.exportOptions.maxSize&&(this.exportOptions.attachmentsIncluded=!1),this.addFile(i,n)}}catch(n){u.a.log("Error while fetching file"+n),t=await this.getEventTileMarkup(this.createModifiedEvent(Object(y.a)("Error fetching file"),e),a)}else t=await this.getEventTileMarkup(this.createModifiedEvent(this.mediaOmitText,e),a);else t=await this.getEventTileMarkup(e,a)}catch(n){u.a.error(n),t=await this.getEventTileMarkup(this.createModifiedEvent(Object(x.b)(e),e,!1),a)}return t}async createHTML(t,a,n,i){let s="",r=null;for(let n=a;n<Math.min(a+1e3,t.length);n++){const a=t[n];if(this.updateProgress(Object(y.a)("Processing event %(number)s out of %(total)s",{number:n+1,total:t.length}),!1,!0),this.cancelled)return this.cleanUp();if(!Object(k.c)(a,!1))continue;s+=this.needsDateSeparator(a,r)?this.getDateSeparator(a):"";const i=!this.needsDateSeparator(a,r)&&Object(v.b)(r,a,!1),o=await this.createMessageBody(a,i);this.totalSize+=e.byteLength(o),s+=o,r=a}return this.wrapHTML(s,n,i)}async export(){this.updateProgress(Object(y.a)("Starting export…"));const e=performance.now(),t=await this.getRequiredEvents(),a=performance.now();this.updateProgress(Object(y.a)("Fetched %(count)s events in %(seconds)ss",{count:t.length,seconds:(a-e)/1e3}),!0,!1),this.updateProgress(Object(y.a)("Creating HTML…"));const n=new Set;for(let e=0;e<t.length/1e3;e++){const a=await this.createHTML(t,1e3*e,e,t.length/1e3);(new DOMParser).parseFromString(a,"text/html").querySelectorAll("*").forEach((e=>{e.classList.forEach((e=>n.add(e)))})),this.addFile(`messages${e?e+1:""}.html`,new Blob([a]))}const i=await Object(C.a)(n);this.addFile("css/style.css",new Blob([i])),this.addFile("js/script.js",new Blob([j.a])),await this.downloadZIP();const s=performance.now();this.cancelled?u.a.info("Export cancelled successfully"):(this.updateProgress(Object(y.a)("Export successful!")),this.updateProgress(Object(y.a)("Exported %(count)s events in %(seconds)s seconds",{count:t.length,seconds:(s-e)/1e3}))),this.cleanUp()}}}).call(this,a(53).Buffer)},1526:function(e,t,a){"use strict";e.exports=a(1527)},1527:function(e,t,a){"use strict";var n=a(499),i=a(120);function s(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,a=1;a<arguments.length;a++)t+="&args[]="+encodeURIComponent(arguments[a]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var r=60106,o=60107,l=60108,c=60114,d=60109,m=60110,u=60112,h=60113,p=60120,g=60115,v=60116,b=60121,f=60117,y=60119,E=60129,_=60131;if("function"==typeof Symbol&&Symbol.for){var S=Symbol.for;r=S("react.portal"),o=S("react.fragment"),l=S("react.strict_mode"),c=S("react.profiler"),d=S("react.provider"),m=S("react.context"),u=S("react.forward_ref"),h=S("react.suspense"),p=S("react.suspense_list"),g=S("react.memo"),v=S("react.lazy"),b=S("react.block"),f=S("react.fundamental"),y=S("react.scope"),E=S("react.debug_trace_mode"),_=S("react.legacy_hidden")}function w(e){if(null==e)return null;if("function"==typeof e)return e.displayName||e.name||null;if("string"==typeof e)return e;switch(e){case o:return"Fragment";case r:return"Portal";case c:return"Profiler";case l:return"StrictMode";case h:return"Suspense";case p:return"SuspenseList"}if("object"==typeof e)switch(e.$$typeof){case m:return(e.displayName||"Context")+".Consumer";case d:return(e._context.displayName||"Context")+".Provider";case u:var t=e.render;return t=t.displayName||t.name||"",e.displayName||(""!==t?"ForwardRef("+t+")":"ForwardRef");case g:return w(e.type);case b:return w(e._render);case v:t=e._payload,e=e._init;try{return w(e(t))}catch(e){}}return null}var O=i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,C={};function x(e,t){for(var a=0|e._threadCount;a<=t;a++)e[a]=e._currentValue2,e._threadCount=a+1}for(var k=new Uint16Array(16),j=0;15>j;j++)k[j]=j+1;k[15]=0;var R=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,I=Object.prototype.hasOwnProperty,T={},N={};function D(e){return!!I.call(N,e)||!I.call(T,e)&&(R.test(e)?N[e]=!0:(T[e]=!0,!1))}function P(e,t,a,n,i,s,r){this.acceptsBooleans=2===t||3===t||4===t,this.attributeName=n,this.attributeNamespace=i,this.mustUseProperty=a,this.propertyName=e,this.type=t,this.sanitizeURL=s,this.removeEmptyString=r}var M={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach((function(e){M[e]=new P(e,0,!1,e,null,!1,!1)})),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach((function(e){var t=e[0];M[t]=new P(t,1,!1,e[1],null,!1,!1)})),["contentEditable","draggable","spellCheck","value"].forEach((function(e){M[e]=new P(e,2,!1,e.toLowerCase(),null,!1,!1)})),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach((function(e){M[e]=new P(e,2,!1,e,null,!1,!1)})),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach((function(e){M[e]=new P(e,3,!1,e.toLowerCase(),null,!1,!1)})),["checked","multiple","muted","selected"].forEach((function(e){M[e]=new P(e,3,!0,e,null,!1,!1)})),["capture","download"].forEach((function(e){M[e]=new P(e,4,!1,e,null,!1,!1)})),["cols","rows","size","span"].forEach((function(e){M[e]=new P(e,6,!1,e,null,!1,!1)})),["rowSpan","start"].forEach((function(e){M[e]=new P(e,5,!1,e.toLowerCase(),null,!1,!1)}));var A=/[\-:]([a-z])/g;function L(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach((function(e){var t=e.replace(A,L);M[t]=new P(t,1,!1,e,null,!1,!1)})),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach((function(e){var t=e.replace(A,L);M[t]=new P(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)})),["xml:base","xml:lang","xml:space"].forEach((function(e){var t=e.replace(A,L);M[t]=new P(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)})),["tabIndex","crossOrigin"].forEach((function(e){M[e]=new P(e,1,!1,e.toLowerCase(),null,!1,!1)})),M.xlinkHref=new P("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach((function(e){M[e]=new P(e,1,!1,e.toLowerCase(),null,!0,!0)}));var U=/["'&<>]/;function F(e){if("boolean"==typeof e||"number"==typeof e)return""+e;e=""+e;var t=U.exec(e);if(t){var a,n="",i=0;for(a=t.index;a<e.length;a++){switch(e.charCodeAt(a)){case 34:t="&quot;";break;case 38:t="&amp;";break;case 39:t="&#x27;";break;case 60:t="&lt;";break;case 62:t="&gt;";break;default:continue}i!==a&&(n+=e.substring(i,a)),i=a+1,n+=t}e=i!==a?n+e.substring(i,a):n}return e}function B(e,t){var a,n=M.hasOwnProperty(e)?M[e]:null;return(a="style"!==e)&&(a=null!==n?0===n.type:2<e.length&&("o"===e[0]||"O"===e[0])&&("n"===e[1]||"N"===e[1])),a||function(e,t,a,n){if(null==t||function(e,t,a,n){if(null!==a&&0===a.type)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return!n&&(null!==a?!a.acceptsBooleans:"data-"!==(e=e.toLowerCase().slice(0,5))&&"aria-"!==e);default:return!1}}(e,t,a,n))return!0;if(n)return!1;if(null!==a)switch(a.type){case 3:return!t;case 4:return!1===t;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}(e,t,n,!1)?"":null!==n?(e=n.attributeName,3===(a=n.type)||4===a&&!0===t?e+'=""':(n.sanitizeURL&&(t=""+t),e+'="'+F(t)+'"')):D(e)?e+'="'+F(t)+'"':""}var V="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},W=null,H=null,z=null,G=!1,K=!1,q=null,$=0;function Y(){if(null===W)throw Error(s(321));return W}function J(){if(0<$)throw Error(s(312));return{memoizedState:null,queue:null,next:null}}function Q(){return null===z?null===H?(G=!1,H=z=J()):(G=!0,z=H):null===z.next?(G=!1,z=z.next=J()):(G=!0,z=z.next),z}function X(e,t,a,n){for(;K;)K=!1,$+=1,z=null,a=e(t,n);return Z(),a}function Z(){W=null,K=!1,H=null,$=0,z=q=null}function ee(e,t){return"function"==typeof t?t(e):t}function te(e,t,a){if(W=Y(),z=Q(),G){var n=z.queue;if(t=n.dispatch,null!==q&&void 0!==(a=q.get(n))){q.delete(n),n=z.memoizedState;do{n=e(n,a.action),a=a.next}while(null!==a);return z.memoizedState=n,[n,t]}return[z.memoizedState,t]}return e=e===ee?"function"==typeof t?t():t:void 0!==a?a(t):t,z.memoizedState=e,e=(e=z.queue={last:null,dispatch:null}).dispatch=ne.bind(null,W,e),[z.memoizedState,e]}function ae(e,t){if(W=Y(),t=void 0===t?null:t,null!==(z=Q())){var a=z.memoizedState;if(null!==a&&null!==t){var n=a[1];e:if(null===n)n=!1;else{for(var i=0;i<n.length&&i<t.length;i++)if(!V(t[i],n[i])){n=!1;break e}n=!0}if(n)return a[0]}}return e=e(),z.memoizedState=[e,t],e}function ne(e,t,a){if(!(25>$))throw Error(s(301));if(e===W)if(K=!0,e={action:a,next:null},null===q&&(q=new Map),void 0===(a=q.get(t)))q.set(t,e);else{for(t=a;null!==t.next;)t=t.next;t.next=e}}function ie(){}var se=null,re={readContext:function(e){var t=se.threadID;return x(e,t),e[t]},useContext:function(e){Y();var t=se.threadID;return x(e,t),e[t]},useMemo:ae,useReducer:te,useRef:function(e){W=Y();var t=(z=Q()).memoizedState;return null===t?(e={current:e},z.memoizedState=e):t},useState:function(e){return te(ee,e)},useLayoutEffect:function(){},useCallback:function(e,t){return ae((function(){return e}),t)},useImperativeHandle:ie,useEffect:ie,useDebugValue:ie,useDeferredValue:function(e){return Y(),e},useTransition:function(){return Y(),[function(e){e()},!1]},useOpaqueIdentifier:function(){return(se.identifierPrefix||"")+"R:"+(se.uniqueID++).toString(36)},useMutableSource:function(e,t){return Y(),t(e._source)}},oe="http://www.w3.org/1999/xhtml";function le(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}var ce={area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0},de=n({menuitem:!0},ce),me={animationIterationCount:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},ue=["Webkit","ms","Moz","O"];Object.keys(me).forEach((function(e){ue.forEach((function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),me[t]=me[e]}))}));var he=/([A-Z])/g,pe=/^ms-/,ge=i.Children.toArray,ve=O.ReactCurrentDispatcher,be={listing:!0,pre:!0,textarea:!0},fe=/^[a-zA-Z][a-zA-Z:_\.\-\d]*$/,ye={},Ee={};var _e=Object.prototype.hasOwnProperty,Se={children:null,dangerouslySetInnerHTML:null,suppressContentEditableWarning:null,suppressHydrationWarning:null};function we(e,t){if(void 0===e)throw Error(s(152,w(t)||"Component"))}function Oe(e,t,a){function r(i,r){var o=r.prototype&&r.prototype.isReactComponent,l=function(e,t,a,n){if(n&&"object"==typeof(n=e.contextType)&&null!==n)return x(n,a),n[a];if(e=e.contextTypes){for(var i in a={},e)a[i]=t[i];t=a}else t=C;return t}(r,t,a,o),c=[],d=!1,m={isMounted:function(){return!1},enqueueForceUpdate:function(){if(null===c)return null},enqueueReplaceState:function(e,t){d=!0,c=[t]},enqueueSetState:function(e,t){if(null===c)return null;c.push(t)}};if(o){if(o=new r(i.props,l,m),"function"==typeof r.getDerivedStateFromProps){var u=r.getDerivedStateFromProps.call(null,i.props,o.state);null!=u&&(o.state=n({},o.state,u))}}else if(W={},o=r(i.props,l,m),null==(o=X(r,i.props,o,l))||null==o.render)return void we(e=o,r);if(o.props=i.props,o.context=l,o.updater=m,void 0===(m=o.state)&&(o.state=m=null),"function"==typeof o.UNSAFE_componentWillMount||"function"==typeof o.componentWillMount)if("function"==typeof o.componentWillMount&&"function"!=typeof r.getDerivedStateFromProps&&o.componentWillMount(),"function"==typeof o.UNSAFE_componentWillMount&&"function"!=typeof r.getDerivedStateFromProps&&o.UNSAFE_componentWillMount(),c.length){m=c;var h=d;if(c=null,d=!1,h&&1===m.length)o.state=m[0];else{u=h?m[0]:o.state;var p=!0;for(h=h?1:0;h<m.length;h++){var g=m[h];null!=(g="function"==typeof g?g.call(o,u,i.props,l):g)&&(p?(p=!1,u=n({},u,g)):n(u,g))}o.state=u}}else c=null;if(we(e=o.render(),r),"function"==typeof o.getChildContext&&"object"==typeof(i=r.childContextTypes)){var v=o.getChildContext();for(var b in v)if(!(b in i))throw Error(s(108,w(r)||"Unknown",b))}v&&(t=n({},t,v))}for(;i.isValidElement(e);){var o=e,l=o.type;if("function"!=typeof l)break;r(o,l)}return{child:e,context:t}}var Ce=function(){function e(e,t,a){i.isValidElement(e)?e.type!==o?e=[e]:(e=e.props.children,e=i.isValidElement(e)?[e]:ge(e)):e=ge(e),e={type:null,domNamespace:oe,children:e,childIndex:0,context:C,footer:""};var n=k[0];if(0===n){var r=k,l=2*(n=r.length);if(!(65536>=l))throw Error(s(304));var c=new Uint16Array(l);for(c.set(r),(k=c)[0]=n+1,r=n;r<l-1;r++)k[r]=r+1;k[l-1]=0}else k[0]=k[n];this.threadID=n,this.stack=[e],this.exhausted=!1,this.currentSelectValue=null,this.previousWasTextNode=!1,this.makeStaticMarkup=t,this.suspenseDepth=0,this.contextIndex=-1,this.contextStack=[],this.contextValueStack=[],this.uniqueID=0,this.identifierPrefix=a&&a.identifierPrefix||""}var t=e.prototype;return t.destroy=function(){if(!this.exhausted){this.exhausted=!0,this.clearProviders();var e=this.threadID;k[e]=k[0],k[0]=e}},t.pushProvider=function(e){var t=++this.contextIndex,a=e.type._context,n=this.threadID;x(a,n);var i=a[n];this.contextStack[t]=a,this.contextValueStack[t]=i,a[n]=e.props.value},t.popProvider=function(){var e=this.contextIndex,t=this.contextStack[e],a=this.contextValueStack[e];this.contextStack[e]=null,this.contextValueStack[e]=null,this.contextIndex--,t[this.threadID]=a},t.clearProviders=function(){for(var e=this.contextIndex;0<=e;e--)this.contextStack[e][this.threadID]=this.contextValueStack[e]},t.read=function(e){if(this.exhausted)return null;var t=se;se=this;var a=ve.current;ve.current=re;try{for(var n=[""],i=!1;n[0].length<e;){if(0===this.stack.length){this.exhausted=!0;var r=this.threadID;k[r]=k[0],k[0]=r;break}var o=this.stack[this.stack.length-1];if(i||o.childIndex>=o.children.length){var l=o.footer;if(""!==l&&(this.previousWasTextNode=!1),this.stack.pop(),"select"===o.type)this.currentSelectValue=null;else if(null!=o.type&&null!=o.type.type&&o.type.type.$$typeof===d)this.popProvider(o.type);else if(o.type===h){this.suspenseDepth--;var c=n.pop();if(i){i=!1;var m=o.fallbackFrame;if(!m)throw Error(s(303));this.stack.push(m),n[this.suspenseDepth]+="\x3c!--$!--\x3e";continue}n[this.suspenseDepth]+=c}n[this.suspenseDepth]+=l}else{var u=o.children[o.childIndex++],p="";try{p+=this.render(u,o.context,o.domNamespace)}catch(e){if(null!=e&&"function"==typeof e.then)throw Error(s(294));throw e}n.length<=this.suspenseDepth&&n.push(""),n[this.suspenseDepth]+=p}}return n[0]}finally{ve.current=a,se=t,Z()}},t.render=function(e,t,a){if("string"==typeof e||"number"==typeof e)return""===(a=""+e)?"":this.makeStaticMarkup?F(a):this.previousWasTextNode?"\x3c!-- --\x3e"+F(a):(this.previousWasTextNode=!0,F(a));if(e=(t=Oe(e,t,this.threadID)).child,t=t.context,null===e||!1===e)return"";if(!i.isValidElement(e)){if(null!=e&&null!=e.$$typeof){if((a=e.$$typeof)===r)throw Error(s(257));throw Error(s(258,a.toString()))}return e=ge(e),this.stack.push({type:null,domNamespace:a,children:e,childIndex:0,context:t,footer:""}),""}var b=e.type;if("string"==typeof b)return this.renderDOM(e,t,a);switch(b){case _:case E:case l:case c:case p:case o:return e=ge(e.props.children),this.stack.push({type:null,domNamespace:a,children:e,childIndex:0,context:t,footer:""}),"";case h:throw Error(s(294));case y:throw Error(s(343))}if("object"==typeof b&&null!==b)switch(b.$$typeof){case u:W={};var S=b.render(e.props,e.ref);return S=X(b.render,e.props,S,e.ref),S=ge(S),this.stack.push({type:null,domNamespace:a,children:S,childIndex:0,context:t,footer:""}),"";case g:return e=[i.createElement(b.type,n({ref:e.ref},e.props))],this.stack.push({type:null,domNamespace:a,children:e,childIndex:0,context:t,footer:""}),"";case d:return a={type:e,domNamespace:a,children:b=ge(e.props.children),childIndex:0,context:t,footer:""},this.pushProvider(e),this.stack.push(a),"";case m:b=e.type,S=e.props;var w=this.threadID;return x(b,w),b=ge(S.children(b[w])),this.stack.push({type:e,domNamespace:a,children:b,childIndex:0,context:t,footer:""}),"";case f:throw Error(s(338));case v:return b=(S=(b=e.type)._init)(b._payload),e=[i.createElement(b,n({ref:e.ref},e.props))],this.stack.push({type:null,domNamespace:a,children:e,childIndex:0,context:t,footer:""}),""}throw Error(s(130,null==b?b:typeof b,""))},t.renderDOM=function(e,t,a){var r=e.type.toLowerCase();if(a===oe&&le(r),!ye.hasOwnProperty(r)){if(!fe.test(r))throw Error(s(65,r));ye[r]=!0}var o=e.props;if("input"===r)o=n({type:void 0},o,{defaultChecked:void 0,defaultValue:void 0,value:null!=o.value?o.value:o.defaultValue,checked:null!=o.checked?o.checked:o.defaultChecked});else if("textarea"===r){var l=o.value;if(null==l){l=o.defaultValue;var c=o.children;if(null!=c){if(null!=l)throw Error(s(92));if(Array.isArray(c)){if(!(1>=c.length))throw Error(s(93));c=c[0]}l=""+c}null==l&&(l="")}o=n({},o,{value:void 0,children:""+l})}else if("select"===r)this.currentSelectValue=null!=o.value?o.value:o.defaultValue,o=n({},o,{value:void 0});else if("option"===r){c=this.currentSelectValue;var d=function(e){if(null==e)return e;var t="";return i.Children.forEach(e,(function(e){null!=e&&(t+=e)})),t}(o.children);if(null!=c){var m=null!=o.value?o.value+"":d;if(l=!1,Array.isArray(c)){for(var u=0;u<c.length;u++)if(""+c[u]===m){l=!0;break}}else l=""+c===m;o=n({selected:void 0,children:void 0},o,{selected:l,children:d})}}if(l=o){if(de[r]&&(null!=l.children||null!=l.dangerouslySetInnerHTML))throw Error(s(137,r));if(null!=l.dangerouslySetInnerHTML){if(null!=l.children)throw Error(s(60));if("object"!=typeof l.dangerouslySetInnerHTML||!("__html"in l.dangerouslySetInnerHTML))throw Error(s(61))}if(null!=l.style&&"object"!=typeof l.style)throw Error(s(62))}l=o,c=this.makeStaticMarkup,d=1===this.stack.length,m="<"+e.type;e:if(-1===r.indexOf("-"))u="string"==typeof l.is;else switch(r){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":u=!1;break e;default:u=!0}for(_ in l)if(_e.call(l,_)){var h=l[_];if(null!=h){if("style"===_){var p=void 0,g="",v="";for(p in h)if(h.hasOwnProperty(p)){var b=0===p.indexOf("--"),f=h[p];if(null!=f){if(b)var y=p;else if(y=p,Ee.hasOwnProperty(y))y=Ee[y];else{var E=y.replace(he,"-$1").toLowerCase().replace(pe,"-ms-");y=Ee[y]=E}g+=v+y+":",v=p,g+=b=null==f||"boolean"==typeof f||""===f?"":b||"number"!=typeof f||0===f||me.hasOwnProperty(v)&&me[v]?(""+f).trim():f+"px",v=";"}}h=g||null}p=null,u?Se.hasOwnProperty(_)||(p=D(p=_)&&null!=h?p+'="'+F(h)+'"':""):p=B(_,h),p&&(m+=" "+p)}}c||d&&(m+=' data-reactroot=""');var _=m;l="",ce.hasOwnProperty(r)?_+="/>":(_+=">",l="</"+e.type+">");e:{if(null!=(c=o.dangerouslySetInnerHTML)){if(null!=c.__html){c=c.__html;break e}}else if("string"==typeof(c=o.children)||"number"==typeof c){c=F(c);break e}c=null}return null!=c?(o=[],be.hasOwnProperty(r)&&"\n"===c.charAt(0)&&(_+="\n"),_+=c):o=ge(o.children),e=e.type,a=null==a||"http://www.w3.org/1999/xhtml"===a?le(e):"http://www.w3.org/2000/svg"===a&&"foreignObject"===e?"http://www.w3.org/1999/xhtml":a,this.stack.push({domNamespace:a,type:r,children:o,childIndex:0,context:t,footer:l}),this.previousWasTextNode=!1,_},e}();t.renderToNodeStream=function(){throw Error(s(207))},t.renderToStaticMarkup=function(e,t){e=new Ce(e,!0,t);try{return e.read(1/0)}finally{e.destroy()}},t.renderToStaticNodeStream=function(){throw Error(s(208))},t.renderToString=function(e,t){e=new Ce(e,!1,t);try{return e.read(1/0)}finally{e.destroy()}},t.version="17.0.2"},1528:function(e,t,a){"use strict";var n=a(1529),i=/[\/\?<>\\:\*\|"]/g,s=/[\x00-\x1f\x80-\x9f]/g,r=/^\.+$/,o=/^(con|prn|aux|nul|com[0-9]|lpt[0-9])(\..*)?$/i,l=/[\. ]+$/;function c(e,t){if("string"!=typeof e)throw new Error("Input must be string");var a=e.replace(i,t).replace(s,t).replace(r,t).replace(o,t).replace(l,t);return n(a,255)}e.exports=function(e,t){var a=t&&t.replacement||"",n=c(e,a);return""===a?n:c(n,"")}},1529:function(e,t,a){"use strict";var n=a(1530),i=a(1531);e.exports=n.bind(null,i)},1530:function(e,t,a){"use strict";function n(e){return e>=55296&&e<=56319}function i(e){return e>=56320&&e<=57343}e.exports=function(e,t,a){if("string"!=typeof t)throw new Error("Input must be string");for(var s,r,o=t.length,l=0,c=0;c<o;c+=1){if(s=t.charCodeAt(c),r=t[c],n(s)&&i(t.charCodeAt(c+1))&&(r+=t[c+=1]),(l+=e(r))===a)return t.slice(0,c+1);if(l>a)return t.slice(0,c-r.length+1)}return t}},1531:function(e,t,a){"use strict";function n(e){return e>=55296&&e<=56319}function i(e){return e>=56320&&e<=57343}e.exports=function(e){if("string"!=typeof e)throw new Error("Input must be string");for(var t=e.length,a=0,s=null,r=null,o=0;o<t;o++)i(s=e.charCodeAt(o))?null!=r&&n(r)?a+=1:a+=3:s<=127?a+=1:s>=128&&s<=2047?a+=2:s>=2048&&s<=65535&&(a+=3),r=s;return a}},1532:function(e,t,a){"use strict";var n=a(1533);const i=/\.[\w-]+/g;function s(e){return e.replace(/font-family: ?(Inter|'Inter'|"Inter")/g,"font-family: -apple-system, BlinkMacSystemFont, avenir next,\n avenir, segoe ui, helvetica neue, helvetica, Ubuntu, roboto, noto, arial, sans-serif").replace(/font-family: ?Inconsolata/g,"font-family: Menlo, Consolas, Monaco, Liberation Mono, Lucida Console, monospace")}function r(e){var t;return"light"===(null===(t=e.ownerNode.dataset.mxTheme)||void 0===t?void 0:t.toLowerCase())}t.a=async e=>{const t=Array.from(document.styleSheets).filter((e=>{var t;return(null===(t=e.href)||void 0===t?void 0:t.endsWith("bundle.css"))||r(e)}));if(!t.some(r)){var a;const e=null===(a=document.querySelector('link[rel="stylesheet"][href$="theme-light.css"]'))||void 0===a?void 0:a.href;e&&t.push(await async function(e){const t=document.implementation.createHTMLDocument(""),a=document.createElement("style"),n=await fetch(e);return a.textContent=await n.text(),t.body.appendChild(a),a.sheet}(e))}let o="";for(const a of t)for(const t of a.cssRules){if(t instanceof CSSFontFaceRule)continue;const a=t.selectorText;null!=a&&a.split(",").every((t=>{const a=t.match(i);if(a&&!a.every((t=>e.has(t.substring(1)))))return!0}))||(o+=s(t.cssText)+"\n")}return o+n.a}},1534:function(e,t,a){"use strict";t.a='/*\nCopyright 2021 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the "License");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\nhttp://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an "AS IS" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\n// This file is raw-imported (imported as plain text) for the export bundle, which is why this is in JS\nfunction showToastIfNeeded(replyId) {\n const el = document.getElementById(replyId);\n if (!el) {\n showToast("The message you\'re looking for wasn\'t exported");\n return;\n }\n}\n\nfunction showToast(text) {\n const el = document.getElementById("snackbar");\n el.innerHTML = text;\n el.className = "mx_show";\n window.setTimeout(() => {\n el.className = el.className.replace("mx_show", "");\n }, 2000);\n}\n\nwindow.onload = () => {\n document.querySelectorAll(".mx_reply_anchor").forEach((element) => {\n element.addEventListener("click", (event) => {\n showToastIfNeeded(event.target.dataset.scrollTo);\n });\n });\n};\n'},1535:function(e,t,a){"use strict";(function(e){var n=a(120),i=a.n(n),s=a(1),r=a(179),o=a(129),l=a(121),c=a(124),d=a(128),m=a(135),u=a(212),h=a(145),p=a(177);t.a=t=>{const{matrixClient:a,room:g,member:v,onFinished:b}=t,[f,y]=Object(n.useState)(!0);let E=g.getLiveTimeline(),_=[];for(;E;)_=[..._,...E.getEvents().filter((e=>e.getSender()===v.userId&&!e.isRedacted()&&!e.isRedaction()&&e.getType()!==o.b.RoomCreate&&e.getType()!==o.b.RoomServerAcl&&e.getType()!==o.b.RoomEncryption))],E=E.getNeighbouringTimeline(r.b.BACKWARDS);if(0===_.length)return i.a.createElement(u.a,{onFinished:b,title:Object(l.a)("No recent messages by %(user)s found",{user:v.name}),description:i.a.createElement("div",null,i.a.createElement("p",null,Object(l.a)("Try scrolling up in the timeline to see if there are any earlier ones.")))});{_=_.filter((e=>!(f&&e.isState())));const t=_.length,n=v.name,r=async()=>{s.a.info(`Started redacting recent ${t} messages for ${v.userId} in ${g.roomId}`),c.a.dispatch({action:d.a.BulkRedactStart,room_id:g.roomId}),await Promise.resolve(),await Promise.all(_.reverse().map((async e=>{try{await a.redactEvent(g.roomId,e.getId())}catch(t){s.a.error("Could not redact",e.getId()),s.a.error(t)}}))),s.a.info(`Finished redacting recent ${t} messages for ${v.userId} in ${g.roomId}`),c.a.dispatch({action:d.a.BulkRedactEnd,room_id:g.roomId})};return i.a.createElement(m.a,{className:"mx_BulkRedactDialog",onFinished:b,title:Object(l.a)("Remove recent messages by %(user)s",{user:n}),contentId:"mx_Dialog_content"},i.a.createElement("div",{className:"mx_Dialog_content",id:"mx_Dialog_content"},i.a.createElement("p",null,Object(l.a)("You are about to remove %(count)s messages by %(user)s. This will remove them permanently for everyone in the conversation. Do you wish to continue?",{count:t,user:n})),i.a.createElement("p",null,Object(l.a)("For a large amount of messages, this might take some time. Please don't refresh your client in the meantime.")),i.a.createElement(p.b,{checked:f,onChange:e=>y(e.target.checked)},Object(l.a)("Preserve system messages")),i.a.createElement("div",{className:"mx_BulkRedactDialog_checkboxMicrocopy"},Object(l.a)("Uncheck if you also want to remove system messages on this user (e.g. membership change, profile change…)"))),i.a.createElement(h.a,{primaryButton:Object(l.a)("Remove %(count)s messages",{count:t}),primaryButtonClass:"danger",primaryDisabled:0===t,onPrimaryButtonClick:()=>{e(r),b(!0)},onCancel:()=>b(!1)}))}}}).call(this,a(54).setImmediate)},1536:function(e,t){e.exports="img/stickerpack-placeholder.c50e1de.png"},1537:function(e,t,a){"use strict";a.r(t),a.d(t,"Icon",(function(){return p}));var n,i,s,r,o,l,c,d,m,u=a(120);function h(){return h=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},h.apply(this,arguments)}function p(e){return u.createElement("svg",h({fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 31 31",role:"presentation","aria-hidden":!0},e),n||(n=u.createElement("path",{fill:"none",d:"M0 0h31v31H0z"})),i||(i=u.createElement("circle",{cx:15.5,cy:15.5,r:15.5,fill:"#A2A2A2"})),s||(s=u.createElement("path",{d:"M22.855 15.5a7.355 7.355 0 11-14.71 0 7.355 7.355 0 0114.71 0zM15.5 24.25a8.75 8.75 0 100-17.5 8.75 8.75 0 000 17.5z",fill:"#fff",stroke:"#fff",strokeWidth:.5})),r||(r=u.createElement("path",{fill:"#A2A2A2",d:"M16.266 30.503h-1.5L14.76 1.1h1.5z"})),o||(o=u.createElement("path",{fill:"#A2A2A2",d:"M8.894 28.844l-1.294-.76L22.605 2.503l1.294.759z"})),l||(l=u.createElement("path",{fill:"#A2A2A2",d:"M2.88 24.495l-.786-1.278L27.71 7.46l.786 1.277z"})),c||(c=u.createElement("path",{fill:"#A2A2A2",d:"M2.163 23.341L1.49 22l26.51-13.264.671 1.341z"})),d||(d=u.createElement("path",{fill:"#A2A2A2",d:"M1.551 22.134L1 20.74 28.433 9.887l.552 1.394z"})),m||(m=u.createElement("path",{d:"M9.5 17l-2 3-2-3h4zM21.5 15l2-3 2 3h-4z",fill:"#fff",stroke:"#fff"})))}t.default="img/room_replaced.97416ee.svg"},1538:function(e,t,a){"use strict";a.r(t),a.d(t,"Icon",(function(){return r}));var n,i=a(120);function s(){return s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},s.apply(this,arguments)}function r(e){return i.createElement("svg",s({fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",role:"presentation","aria-hidden":!0},e),n||(n=i.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M16 0C7.163 0 0 7.163 0 16s7.163 16 16 16 16-7.163 16-16S24.837 0 16 0zm1.251 6.974a1.496 1.496 0 00-2.051-.129 1.495 1.495 0 00-.13.12l-6.274 6.589a1.5 1.5 0 102.173 2.069l3.688-3.873V23.06a1.5 1.5 0 103 0V11.75l3.688 3.873a1.5 1.5 0 102.173-2.07L17.25 6.975z",fill:"#0DBD8B"})))}t.default="img/upload-big.dcf3fb1.svg"},1539:function(e,t,a){"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.RoomViewLifecycle=void 0,t.RoomViewLifecycle=n,function(e){e.PreviewRoomNotLoggedIn="preview_not_logged_in",e.JoinFromRoomPreview="try_join_not_logged_in"}(n||(t.RoomViewLifecycle=n={}))},1541:function(e,t,a){"use strict";(function(e){a.d(t,"a",(function(){return v}));var n=a(13),i=a.n(n),s=a(120),r=a.n(s),o=a(195),l=a(1542),c=a(393);const d=336,m=232,u=58,h=58,p=76,g=8;class v extends r.a.Component{constructor(){var t;super(...arguments),t=this,i()(this,"callViewWrapper",Object(s.createRef)()),i()(this,"initX",0),i()(this,"initY",0),i()(this,"desiredTranslationX",o.b.instance.windowWidth-g-d),i()(this,"desiredTranslationY",o.b.instance.windowHeight-h-m),i()(this,"translationX",this.desiredTranslationX),i()(this,"translationY",this.desiredTranslationY),i()(this,"mouseHeld",!1),i()(this,"scheduledUpdate",new c.a((()=>this.animationCallback()),(()=>requestAnimationFrame((()=>this.scheduledUpdate.trigger()))))),i()(this,"startingPositionX",0),i()(this,"startingPositionY",0),i()(this,"_moving",!1),i()(this,"animationCallback",(()=>{var e,t;if(!this.moving&&Math.abs(this.translationX-this.desiredTranslationX)<=1&&Math.abs(this.translationY-this.desiredTranslationY)<=1)this.translationX=this.desiredTranslationX,this.translationY=this.desiredTranslationY,this.setStyle();else{const e=this.moving?.2:.1;this.translationX=Object(l.a)(this.translationX,this.desiredTranslationX,e),this.translationY=Object(l.a)(this.translationY,this.desiredTranslationY,e),this.setStyle(),this.scheduledUpdate.mark()}null===(e=(t=this.props).onMove)||void 0===e||e.call(t)})),i()(this,"setStyle",(()=>{this.callViewWrapper.current&&(this.callViewWrapper.current.style.transform=`translateX(${this.translationX}px) translateY(${this.translationY}px)`)})),i()(this,"onResize",(()=>{this.snap(!1)})),i()(this,"snap",(function(){var e,a;let n=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const i=t.desiredTranslationX,s=t.desiredTranslationY,r=o.b.instance.windowWidth-((null===(e=t.callViewWrapper.current)||void 0===e?void 0:e.clientWidth)||d),l=o.b.instance.windowHeight-((null===(a=t.callViewWrapper.current)||void 0===a?void 0:a.clientHeight)||m);i>=r/2&&s>=l/2?(t.desiredTranslationX=r-g,t.desiredTranslationY=l-h):i>=r/2&&s<=l/2?(t.desiredTranslationX=r-g,t.desiredTranslationY=u):i<=r/2&&s>=l/2?(t.desiredTranslationX=p,t.desiredTranslationY=l-h):(t.desiredTranslationX=p,t.desiredTranslationY=u),n||(t.translationX=t.desiredTranslationX,t.translationY=t.desiredTranslationY),t.scheduledUpdate.mark()})),i()(this,"onStartMoving",(e=>{e.preventDefault(),e.stopPropagation(),this.mouseHeld=!0,this.startingPositionX=e.clientX,this.startingPositionY=e.clientY})),i()(this,"onMoving",(e=>{this.mouseHeld&&(Math.abs(this.startingPositionX-e.clientX)<5&&Math.abs(this.startingPositionY-e.clientY)<5||(e.preventDefault(),e.stopPropagation(),this.moving||(this.moving=!0,this.initX=e.pageX-this.desiredTranslationX,this.initY=e.pageY-this.desiredTranslationY,this.scheduledUpdate.mark()),this.setTranslation(e.pageX-this.initX,e.pageY-this.initY)))})),i()(this,"onEndMoving",(t=>{this.mouseHeld&&(t.preventDefault(),t.stopPropagation(),this.mouseHeld=!1,e((()=>this.moving=!1)),this.snap(!0))})),i()(this,"onClickCapture",(e=>{this.moving&&(e.preventDefault(),e.stopPropagation())}))}get moving(){return this._moving}set moving(e){this._moving=e}componentDidMount(){document.addEventListener("mousemove",this.onMoving),document.addEventListener("mouseup",this.onEndMoving),o.b.instance.on(o.a.Resize,this.onResize),this.snap()}componentWillUnmount(){document.removeEventListener("mousemove",this.onMoving),document.removeEventListener("mouseup",this.onEndMoving),o.b.instance.off(o.a.Resize,this.onResize)}componentDidUpdate(e){e.children!==this.props.children&&this.snap(!0)}setTranslation(e,t){var a,n;const i=(null===(a=this.callViewWrapper.current)||void 0===a?void 0:a.clientWidth)||d,s=(null===(n=this.callViewWrapper.current)||void 0===n?void 0:n.clientHeight)||m;e+i>=o.b.instance.windowWidth?this.desiredTranslationX=o.b.instance.windowWidth-i:this.desiredTranslationX=e<=0?0:e,t+s>=o.b.instance.windowHeight?this.desiredTranslationY=o.b.instance.windowHeight-s:this.desiredTranslationY=t<=0?0:t}render(){const e={transform:`translateX(${this.translationX}px) translateY(${this.translationY}px)`},t=this.props.children.map((e=>e({onStartMoving:this.onStartMoving,onResize:this.onResize})));return r.a.createElement("aside",{className:this.props.className,style:e,ref:this.callViewWrapper,onClickCapture:this.onClickCapture,onDoubleClick:this.props.onDoubleClick},t)}}}).call(this,a(54).setImmediate)},1542:function(e,t,a){"use strict";a.d(t,"a",(function(){return i}));var n=a(148);function i(e,t,a){return(1-(a=Object(n.clamp)(a,0,1)))*e+a*t}},1543:function(e,t,a){"use strict";a.d(t,"a",(function(){return u}));var n=a(13),i=a.n(n),s=a(120),r=a.n(s),o=a(123),l=a(139),c=a(620),d=a(858),m=a(184);class u extends r.a.PureComponent{constructor(e){super(e),i()(this,"numberEntryFieldRef",Object(s.createRef)()),i()(this,"onCancelClick",(()=>{this.props.onFinished(!1)})),i()(this,"onChange",(e=>{this.setState({value:e.target.value})})),i()(this,"onFormSubmit",(e=>{e.preventDefault(),this.onDialPress()})),i()(this,"onDigitPress",((e,t)=>{var a;(this.setState({value:this.state.value+e}),"click"===t.type)&&(null===(a=this.numberEntryFieldRef.current)||void 0===a||a.focus())})),i()(this,"onDeletePress",(e=>{var t;0!==this.state.value.length&&(this.setState({value:this.state.value.slice(0,-1)}),"click"===e.type&&(null===(t=this.numberEntryFieldRef.current)||void 0===t||t.focus()))})),i()(this,"onDialPress",(async()=>{m.b.instance.dialNumber(this.state.value),this.props.onFinished(!0)})),this.state={value:""}}render(){const e=r.a.createElement(d.a,{onBackspacePress:this.onDeletePress});let t;return t=0!==this.state.value.length?r.a.createElement(l.a,{ref:this.numberEntryFieldRef,className:"mx_DialPadModal_field",id:"dialpad_number",value:this.state.value,autoFocus:!0,onChange:this.onChange,postfixComponent:e}):r.a.createElement(l.a,{ref:this.numberEntryFieldRef,className:"mx_DialPadModal_field",id:"dialpad_number",value:this.state.value,autoFocus:!0,onChange:this.onChange}),r.a.createElement("div",{className:"mx_DialPadModal"},r.a.createElement("div",null,r.a.createElement(o.a,{className:"mx_DialPadModal_cancel",onClick:this.onCancelClick})),r.a.createElement("div",{className:"mx_DialPadModal_header"},r.a.createElement("form",{onSubmit:this.onFormSubmit},t)),r.a.createElement("div",{className:"mx_DialPadModal_dialPad"},r.a.createElement(c.a,{hasDial:!0,onDigitPress:this.onDigitPress,onDeletePress:this.onDeletePress,onDialPress:this.onDialPress})))}}},1544:function(e,t,a){"use strict";a.d(t,"a",(function(){return d}));var n=a(121),i=a(235),s=a(198),r=a(131);const o=()=>{window.location.href="mobile_guide/"},l=()=>{document.cookie="element_mobile_redirect_to_guide=false;path=/;max-age=14400",m()},c="mobileguide",d=()=>{const e=/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,t=/Android/.test(navigator.userAgent),a=r.b.get().brand;(e||t)&&(document.cookie.includes("element_mobile_redirect_to_guide=false")||s.a.sharedInstance().addOrReplaceToast({key:c,title:Object(n.a)("Use app for a better experience"),props:{description:Object(n.a)("%(brand)s is experimental on a mobile web browser. For a better experience and the latest features, use our free native app.",{brand:a}),acceptLabel:Object(n.a)("Use app"),onAccept:o,rejectLabel:Object(n.a)("Dismiss"),onReject:l},component:i.a,priority:99}))},m=()=>{s.a.sharedInstance().dismissToast(c)}},1545:function(e,t,a){"use strict";(function(e){a.d(t,"a",(function(){return b}));var n=a(13),i=a.n(n),s=a(120),r=a.n(s),o=a(487),l=a(121),c=a(123),d=a(446),m=a(134),u=a(909),h=a(1546),p=a(391),g=a(1547),v=a(655);class b extends r.a.Component{constructor(e){super(e),i()(this,"handleClick",(e=>async t=>{t.preventDefault(),await this.props.onClick(e)})),i()(this,"cancelButton",(()=>r.a.createElement(c.a,{"data-testid":"cancel-button",kind:"primary_outline",onClick:this.handleClick(v.a.Cancel)},Object(l.a)("Cancel")))),i()(this,"simpleSpinner",(e=>r.a.createElement("div",{className:"mx_LoginWithQR_spinner"},r.a.createElement("div",null,r.a.createElement(m.a,null),e&&r.a.createElement("p",null,e)))))}render(){let t,a,n,i,s="",m=!0,b=!1;switch(this.props.phase){case v.c.Error:switch(this.props.failureReason){case o.c.Expired:i=Object(l.a)("The linking wasn't completed in the required time.");break;case o.c.InvalidCode:i=Object(l.a)("The scanned code is invalid.");break;case o.c.UnsupportedAlgorithm:i=Object(l.a)("Linking with this device is not supported.");break;case o.c.UserDeclined:i=Object(l.a)("The request was declined on the other device.");break;case o.c.OtherDeviceAlreadySignedIn:i=Object(l.a)("The other device is already signed in.");break;case o.c.OtherDeviceNotSignedIn:i=Object(l.a)("The other device isn't signed in.");break;case o.c.UserCancelled:i=Object(l.a)("The request was cancelled.");break;case o.c.Unknown:i=Object(l.a)("An unexpected error occurred.");break;case o.c.HomeserverLacksSupport:i=Object(l.a)("The homeserver doesn't support signing in another device.");break;default:i=Object(l.a)("The request was cancelled.")}s=Object(l.a)("Connection failed"),b=!0,t=r.a.createElement(p.Icon,{className:"error"}),m=!1,a=r.a.createElement("p",{"data-testid":"cancellation-message"},i),n=r.a.createElement(r.a.Fragment,null,r.a.createElement(c.a,{"data-testid":"try-again-button",kind:"primary",onClick:this.handleClick(v.a.TryAgain)},Object(l.a)("Try again")),this.cancelButton());break;case v.c.Connected:s=Object(l.a)("Devices connected"),t=r.a.createElement(h.a,{className:"normal"}),m=!1,a=r.a.createElement(r.a.Fragment,null,r.a.createElement("p",null,Object(l.a)("Check that the code below matches with your other device:")),r.a.createElement("div",{className:"mx_LoginWithQR_confirmationDigits"},this.props.confirmationDigits),r.a.createElement("div",{className:"mx_LoginWithQR_confirmationAlert"},r.a.createElement("div",null,r.a.createElement(g.a,null)),r.a.createElement("div",null,Object(l.a)("By approving access for this device, it will have full access to your account.")))),n=r.a.createElement(r.a.Fragment,null,r.a.createElement(c.a,{"data-testid":"decline-login-button",kind:"primary_outline",onClick:this.handleClick(v.a.Decline)},Object(l.a)("Cancel")),r.a.createElement(c.a,{"data-testid":"approve-login-button",kind:"primary",onClick:this.handleClick(v.a.Approve)},Object(l.a)("Approve")));break;case v.c.ShowingQR:if(s=Object(l.a)("Sign in with QR code"),this.props.code){var f;const t=r.a.createElement("div",{className:"mx_LoginWithQR_qrWrapper"},r.a.createElement(d.a,{data:[{data:e.from(null!==(f=this.props.code)&&void 0!==f?f:""),mode:"byte"}],className:"mx_QRCode"}));a=r.a.createElement(r.a.Fragment,null,r.a.createElement("p",null,Object(l.a)("Scan the QR code below with your device that's signed out.")),r.a.createElement("ol",null,r.a.createElement("li",null,Object(l.a)("Start at the sign in screen")),r.a.createElement("li",null,Object(l.a)("Select '%(scanQRCode)s'",{scanQRCode:Object(l.a)("Scan QR code")})),r.a.createElement("li",null,Object(l.a)("Review and approve the sign in"))),t)}else a=this.simpleSpinner(),n=this.cancelButton();break;case v.c.Loading:a=this.simpleSpinner();break;case v.c.Connecting:a=this.simpleSpinner(Object(l.a)("Connecting…")),n=this.cancelButton();break;case v.c.WaitingForDevice:a=this.simpleSpinner(Object(l.a)("Waiting for device to sign in")),n=this.cancelButton();break;case v.c.Verifying:s=Object(l.a)("Success"),b=!0,a=this.simpleSpinner(Object(l.a)("Completing set up of your new device"))}return r.a.createElement("div",{"data-testid":"login-with-qr",className:"mx_LoginWithQR"},r.a.createElement("div",{className:b?"mx_LoginWithQR_centreTitle":""},m?r.a.createElement(c.a,{"data-testid":"back-button",className:"mx_LoginWithQR_BackButton",onClick:this.handleClick(v.a.Back),title:"Back"},r.a.createElement(u.a,null)):null,r.a.createElement("h1",null,t,s)),r.a.createElement("div",{className:"mx_LoginWithQR_main"},a),r.a.createElement("div",{className:"mx_LoginWithQR_buttons"},n))}}}).call(this,a(53).Buffer)},1546:function(e,t,a){"use strict";a.d(t,"a",(function(){return o}));var n,i,s=a(120);function r(){return r=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},r.apply(this,arguments)}function o(e){return s.createElement("svg",r({fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",role:"presentation","aria-hidden":!0},e),n||(n=s.createElement("g",{clipPath:"url(#devices_svg__clip0_721_35674)"},s.createElement("path",{d:"M5.333 9.333C5.333 8.6 5.933 8 6.667 8H28c.733 0 1.333-.6 1.333-1.334 0-.733-.6-1.333-1.333-1.333H5.333A2.675 2.675 0 002.667 8v14.666H2c-1.107 0-2 .894-2 2 0 1.107.893 2 2 2h16.667v-4H5.333V9.333zm25.334 1.333h-8c-.734 0-1.334.6-1.334 1.334v13.333c0 .734.6 1.334 1.334 1.334h8c.733 0 1.333-.6 1.333-1.334V12c0-.733-.6-1.334-1.333-1.334zm-1.334 12H24v-9.333h5.333v9.333z",fill:"currentColor"}))),i||(i=s.createElement("defs",null,s.createElement("clipPath",{id:"devices_svg__clip0_721_35674"},s.createElement("path",{fill:"#fff",d:"M0 0h32v32H0z"})))))}},1547:function(e,t,a){"use strict";a.d(t,"a",(function(){return r}));var n,i=a(120);function s(){return s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},s.apply(this,arguments)}function r(e){return i.createElement("svg",s({fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",role:"presentation","aria-hidden":!0},e),n||(n=i.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12 10a1.5 1.5 0 100-3 1.5 1.5 0 000 3zm-1 3a1 1 0 110-2h1a1 1 0 011 1v3.5h.5a1 1 0 110 2H12a1 1 0 01-1-1V13z",fill:"#000"})))}},1548:function(e,t,a){"use strict";var n=a(120),i=a.n(n),s=a(121),r=a(131),o=a(135),l=a(145),c=a(134);t.a=e=>{let{failures:t,source:a,continuation:d,onFinished:m}=e;const[u,h]=Object(n.useState)(2),[p,g]=Object(n.useState)(!1),[v,b]=Object(n.useState)(!1),[f,y]=Object(n.useState)(!1),E=Object(n.useRef)(m),_=new Map([["_afterCrossSigningLocalKeyChange",Object(s.a)("a new master key signature")],["checkOwnCrossSigningTrust",Object(s.a)("a new cross-signing key signature")],["setDeviceVerification",Object(s.a)("a device cross-signing signature")]]),S=Object(s.a)("a key signature"),w=Object(n.useCallback)((async()=>{try{b(!0);const e=new Promise(((e,t)=>{E.current=t})).finally((()=>{g(!0)}));await Promise.race([d(),e]),y(!0)}catch(e){h((e=>e-1))}finally{E.current=m,b(!1)}}),[d,m]);let O;if(!f&&!p&&d&&u>0){const e=_.get(a)||S,n=r.b.get().brand;O=i.a.createElement("div",null,i.a.createElement("p",null,Object(s.a)("%(brand)s encountered an error during upload of:",{brand:n})),i.a.createElement("p",null,e),v&&i.a.createElement(c.a,null),i.a.createElement("pre",null,JSON.stringify(t,null,2)),i.a.createElement(l.a,{primaryButton:"Retry",hasCancel:!0,onPrimaryButtonClick:w,onCancel:E.current,primaryDisabled:v}))}else{let e=Object(s.a)("Upload completed");f||(e=p?Object(s.a)("Cancelled signature upload"):Object(s.a)("Unable to upload")),O=i.a.createElement("div",null,i.a.createElement("span",null,e),i.a.createElement(l.a,{primaryButton:Object(s.a)("OK"),hasCancel:!1,onPrimaryButtonClick:m}))}return i.a.createElement(o.a,{title:f?Object(s.a)("Signature upload success"):Object(s.a)("Signature upload failed"),fixedWidth:!1,onFinished:()=>{}},O)}},1549:function(e,t,a){"use strict";a.d(t,"a",(function(){return h}));var n=a(13),i=a.n(n),s=a(120),r=a.n(s),o=a(121),l=a(470),c=a(873),d=a(123),m=a(917),u=a(319);class h extends r.a.Component{constructor(e){super(e),i()(this,"onStoreUpdate",(()=>{const e=l.b.sharedInstance();this.setState({phase:e.phase,lostKeys:e.lostKeys()})})),i()(this,"onSkipClick",(()=>{l.b.sharedInstance().skip()}));const t=l.b.sharedInstance();t.on("update",this.onStoreUpdate),t.start(),this.state={phase:t.phase,lostKeys:t.lostKeys()}}componentWillUnmount(){const e=l.b.sharedInstance();e.off("update",this.onStoreUpdate),e.stop()}render(){const{phase:e,lostKeys:t}=this.state;let a,n,i;if(e===l.a.Loading)return null;if(e===l.a.Intro)t?(a=r.a.createElement("span",{className:"mx_CompleteSecurity_headerIcon mx_E2EIcon_warning"}),n=Object(o.a)("Unable to verify this device")):(a=r.a.createElement("span",{className:"mx_CompleteSecurity_headerIcon mx_E2EIcon_warning"}),n=Object(o.a)("Verify this device"));else if(e===l.a.Done)a=r.a.createElement("span",{className:"mx_CompleteSecurity_headerIcon mx_E2EIcon_verified"}),n=Object(o.a)("Device verified");else if(e===l.a.ConfirmSkip)a=r.a.createElement("span",{className:"mx_CompleteSecurity_headerIcon mx_E2EIcon_warning"}),n=Object(o.a)("Are you sure?");else if(e===l.a.Busy)a=r.a.createElement("span",{className:"mx_CompleteSecurity_headerIcon mx_E2EIcon_warning"}),n=Object(o.a)("Verify this device");else if(e===l.a.ConfirmReset)a=r.a.createElement("span",{className:"mx_CompleteSecurity_headerIcon mx_E2EIcon_warning"}),n=Object(o.a)("Really reset verification keys?");else if(e!==l.a.Finished)throw new Error(`Unknown phase ${e}`);return e!==l.a.Intro&&e!==l.a.ConfirmReset||(i=r.a.createElement(d.a,{onClick:this.onSkipClick,className:"mx_CompleteSecurity_skip","aria-label":Object(o.a)("Skip verification for now")})),r.a.createElement(u.a,null,r.a.createElement(m.a,null,r.a.createElement("h1",{className:"mx_CompleteSecurity_header"},a,n,i),r.a.createElement("div",{className:"mx_CompleteSecurity_body"},r.a.createElement(c.a,{onFinished:this.props.onFinished}))))}}},1550:function(e,t,a){"use strict";a.r(t),a.d(t,"Icon",(function(){return g}));var n,i,s,r,o,l,c,d,m,u,h=a(120);function p(){return p=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},p.apply(this,arguments)}function g(e){return h.createElement("svg",p({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 793.322 340.809",role:"presentation","aria-hidden":!0},e),n||(n=h.createElement("path",{opacity:.5,fill:"#FFF",d:"M34.004 340.809H2a2 2 0 01-2-2V2a2 2 0 012-2h32.004a2 2 0 012 2v7.71a2 2 0 01-2 2h-21.13v317.386h21.13a2 2 0 012 2.001v7.712a2 2 0 01-2 2z"})),i||(i=h.createElement("path",{opacity:.5,fill:"#FFF",d:"M10.875 9.711v321.386h23.13v7.711H1.999V2.001h32.006v7.71h-23.13zM252.402 233.711h-32.993a2 2 0 01-2-2v-68.073c0-3.949-.154-7.722-.457-11.213-.289-3.282-1.074-6.153-2.332-8.53-1.204-2.276-3.017-4.119-5.384-5.476-2.393-1.362-5.775-2.056-10.042-2.056-4.238 0-7.674.798-10.213 2.371-2.565 1.596-4.604 3.701-6.053 6.258-1.498 2.643-2.51 5.694-3.013 9.067a72.757 72.757 0 00-.793 10.741v66.91a2 2 0 01-2 2h-32.991a2 2 0 01-2-2v-67.373c0-3.435-.078-6.964-.228-10.485-.148-3.251-.767-6.278-1.841-8.995-1.018-2.571-2.667-4.584-5.047-6.153-2.372-1.552-6.029-2.341-10.865-2.341-1.372 0-3.265.328-5.629.976-2.28.624-4.536 1.826-6.705 3.577-2.152 1.732-4.036 4.306-5.605 7.655-1.569 3.356-2.367 7.877-2.367 13.438v69.701a2 2 0 01-2 2H68.857a2 2 0 01-2-2V111.594a2 2 0 012-1.999h31.13a2 2 0 012 1.999v11.007c3.834-4.499 8.248-8.152 13.173-10.896 6.396-3.559 13.799-5.362 22.002-5.362 7.846 0 15.127 1.548 21.642 4.604 5.794 2.722 10.424 7.26 13.791 13.52 3.449-4.362 7.833-8.306 13.071-11.752 6.422-4.228 14.102-6.371 22.824-6.371 6.499 0 12.625.807 18.209 2.399 5.686 1.628 10.635 4.271 14.712 7.857 4.088 3.605 7.318 8.357 9.601 14.123 2.25 5.719 3.391 12.649 3.391 20.604v80.384a2.002 2.002 0 01-2.001 2z"})),s||(s=h.createElement("path",{opacity:.5,fill:"#FFF",d:"M99.988 111.595v16.264h.463c4.338-6.191 9.563-10.998 15.684-14.406 6.117-3.402 13.129-5.11 21.027-5.11 7.588 0 14.521 1.475 20.793 4.415 6.274 2.945 11.038 8.131 14.291 15.567 3.56-5.265 8.4-9.913 14.521-13.94 6.117-4.025 13.358-6.042 21.724-6.042 6.351 0 12.234.776 17.66 2.325 5.418 1.549 10.065 4.027 13.938 7.434 3.869 3.41 6.889 7.863 9.062 13.357 2.167 5.504 3.253 12.122 3.253 19.869v80.385H219.41v-68.074c0-4.025-.154-7.82-.465-11.385-.313-3.56-1.161-6.656-2.555-9.293-1.395-2.631-3.45-4.724-6.157-6.274-2.711-1.543-6.391-2.322-11.037-2.322s-8.403.896-11.269 2.671c-2.868 1.784-5.112 4.109-6.737 6.971-1.626 2.869-2.711 6.12-3.252 9.762a74.395 74.395 0 00-.814 11.035v66.91h-32.991v-67.375c0-3.562-.081-7.087-.23-10.57-.158-3.487-.814-6.7-1.978-9.645-1.162-2.94-3.099-5.304-5.809-7.088-2.711-1.775-6.699-2.671-11.965-2.671-1.551 0-3.603.349-6.156 1.048-2.556.697-5.036 2.016-7.435 3.949-2.404 1.938-4.454 4.726-6.158 8.363-1.705 3.642-2.556 8.402-2.556 14.287v69.701h-32.99V111.595h31.132zM304.909 236.733c-5.883 0-11.46-.729-16.574-2.163-5.192-1.464-9.806-3.774-13.713-6.871-3.944-3.117-7.068-7.111-9.282-11.871-2.205-4.733-3.324-10.412-3.324-16.876 0-7.13 1.293-13.117 3.846-17.797 2.542-4.674 5.877-8.464 9.912-11.263 3.97-2.752 8.556-4.842 13.63-6.209a142.954 142.954 0 0114.961-3.184 261.677 261.677 0 0114.754-1.872c4.679-.452 8.88-1.139 12.489-2.039 3.412-.854 6.118-2.09 8.042-3.672 1.666-1.37 2.416-3.384 2.292-6.151-.002-3.289-.502-5.816-1.492-7.595-.998-1.798-2.283-3.15-3.927-4.138-1.703-1.02-3.725-1.713-6.012-2.062-2.47-.37-5.146-.557-7.947-.557-6.034 0-10.789 1.271-14.135 3.783-3.233 2.424-5.155 6.64-5.714 12.527a2.003 2.003 0 01-1.992 1.812h-32.992a2.006 2.006 0 01-1.457-.629 2.013 2.013 0 01-.54-1.491c.485-8.073 2.55-14.894 6.142-20.272a41.725 41.725 0 0113.661-12.931c5.424-3.191 11.612-5.498 18.392-6.857a103.675 103.675 0 0120.26-2.013c6.096 0 12.365.437 18.626 1.296 6.377.88 12.285 2.622 17.562 5.177 5.376 2.604 9.845 6.29 13.282 10.951 3.498 4.744 5.271 11.048 5.271 18.731v62.494c0 5.307.306 10.462.915 15.319.576 4.64 1.572 8.116 2.963 10.338.385.616.407 1.395.055 2.031a2.002 2.002 0 01-1.75 1.03h-33.457c-.861 0-1.624-.55-1.898-1.367a49.145 49.145 0 01-1.572-5.936 49.182 49.182 0 01-.38-2.12 44.922 44.922 0 01-16.474 9.105 77.066 77.066 0 01-22.423 3.342zm37.032-60.072c-.809.409-1.676.768-2.596 1.074-2.161.72-4.511 1.326-6.988 1.807-2.442.475-5.033.872-7.699 1.186-2.631.311-5.251.697-7.784 1.146a56.995 56.995 0 00-7.051 1.792c-2.194.711-4.114 1.667-5.699 2.842-1.531 1.128-2.785 2.587-3.731 4.335-.917 1.709-1.385 3.97-1.385 6.719 0 2.598.465 4.778 1.385 6.481.928 1.722 2.142 3.035 3.716 4.018 1.644 1.026 3.601 1.757 5.816 2.17 2.344.439 4.799.663 7.297.663 6.105 0 10.836-.996 14.063-2.961 3.244-1.973 5.666-4.349 7.199-7.062 1.568-2.78 2.542-5.62 2.892-8.436.376-3.019.565-5.436.565-7.187v-8.587z"})),r||(r=h.createElement("path",{opacity:.5,fill:"#FFF",d:"M273.544 129.255c3.405-5.113 7.744-9.215 13.012-12.316 5.264-3.097 11.186-5.303 17.771-6.621a101.17 101.17 0 0119.865-1.976c6.042 0 12.158.428 18.354 1.277 6.195.855 11.85 2.522 16.962 4.997 5.111 2.477 9.292 5.926 12.546 10.338 3.253 4.414 4.879 10.262 4.879 17.543v62.494c0 5.428.31 10.611.931 15.567.615 4.959 1.701 8.676 3.251 11.153H347.66a46.656 46.656 0 01-1.511-5.693 48.292 48.292 0 01-.813-5.923c-5.267 5.422-11.465 9.217-18.585 11.386a74.81 74.81 0 01-21.842 3.251c-5.733 0-11.077-.698-16.033-2.09-4.958-1.395-9.293-3.562-13.01-6.51-3.718-2.938-6.622-6.656-8.713-11.147s-3.138-9.84-3.138-16.033c0-6.813 1.199-12.43 3.604-16.84 2.399-4.417 5.495-7.939 9.295-10.575 3.793-2.632 8.129-4.607 13.01-5.923a140.326 140.326 0 0114.752-3.137 253.631 253.631 0 0114.638-1.857c4.801-.466 9.062-1.164 12.779-2.093 3.718-.929 6.658-2.282 8.829-4.065 2.165-1.781 3.172-4.375 3.02-7.785 0-3.56-.58-6.389-1.742-8.479-1.161-2.09-2.711-3.719-4.646-4.88-1.937-1.161-4.183-1.936-6.737-2.325-2.557-.382-5.309-.58-8.248-.58-6.506 0-11.617 1.395-15.335 4.183-3.716 2.788-5.889 7.437-6.506 13.94h-32.991c.462-7.742 2.395-14.173 5.807-19.281zm65.169 46.583a53.802 53.802 0 01-6.736 1.741c-2.402.465-4.918.853-7.551 1.161-2.635.313-5.268.698-7.899 1.163a59.302 59.302 0 00-7.317 1.857c-2.404.779-4.495 1.822-6.274 3.138-1.784 1.317-3.216 2.985-4.3 4.994-1.085 2.014-1.626 4.571-1.626 7.668 0 2.94.541 5.422 1.626 7.431 1.084 2.017 2.558 3.604 4.416 4.765s4.025 1.976 6.507 2.438c2.475.466 5.031.698 7.665.698 6.505 0 11.537-1.082 15.103-3.253 3.561-2.166 6.192-4.762 7.899-7.785 1.702-3.019 2.749-6.072 3.137-9.174.384-3.097.58-5.576.58-7.434V172.93c-1.396 1.243-3.138 2.21-5.23 2.908zM444.542 234.874c-5.187 0-10.173-.361-14.823-1.069-4.802-.732-9.104-2.183-12.779-4.313-3.789-2.185-6.821-5.341-9.006-9.375-2.163-3.986-3.26-9.232-3.26-15.59v-68.859h-17.981a2 2 0 01-2-1.999v-22.073a2 2 0 012-1.999h17.981V75.582a2 2 0 012-2h32.992a2 2 0 012 2v34.014h22.162a2 2 0 012 1.999v22.073a2 2 0 01-2 1.999h-22.162v57.479c0 6.229 1.198 8.731 2.202 9.733 1.004 1.007 3.506 2.205 9.738 2.205 1.804 0 3.542-.076 5.161-.225a44.198 44.198 0 004.669-.665 1.994 1.994 0 011.661.415c.463.379.73.946.73 1.546v25.555a2 2 0 01-1.672 1.974c-2.834.472-6.041.794-9.527.957-3.613.157-6.91.233-10.086.233z"})),o||(o=h.createElement("path",{opacity:.5,fill:"#FFF",d:"M463.825 111.595v22.072h-24.161v59.479c0 5.573.928 9.292 2.788 11.149 1.856 1.859 5.576 2.788 11.152 2.788 1.859 0 3.638-.076 5.343-.232a45.912 45.912 0 004.878-.696v25.557c-2.788.465-5.887.773-9.293.931-3.407.149-6.737.23-9.99.23-5.111 0-9.953-.35-14.521-1.048-4.571-.695-8.597-2.047-12.081-4.063-3.486-2.011-6.236-4.88-8.248-8.597-2.016-3.714-3.021-8.595-3.021-14.639v-70.859h-19.98v-22.072h19.98V75.583h32.992v36.012h24.162zM512.613 233.711h-32.991a2 2 0 01-2-2V111.594a2 2 0 012-1.999h31.366a2 2 0 012 1.999v15.069a43.465 43.465 0 013.199-4.382 43.541 43.541 0 019.496-8.522 46.77 46.77 0 0111.415-5.462c4.056-1.298 8.327-1.954 12.691-1.954 2.341 0 4.953.418 7.766 1.243a2 2 0 011.437 1.92v30.67a2 2 0 01-2.395 1.96c-1.484-.3-3.299-.565-5.392-.787a57.416 57.416 0 00-6.062-.339c-5.706 0-10.572.95-14.467 2.823-3.862 1.86-7.012 4.428-9.361 7.629-2.389 3.263-4.115 7.12-5.127 11.47-1.043 4.479-1.574 9.409-1.574 14.647v54.132a2.002 2.002 0 01-2.001 2z"})),l||(l=h.createElement("path",{opacity:.5,fill:"#FFF",d:"M510.988 111.595V133.9h.465c1.546-3.72 3.636-7.163 6.272-10.341a41.182 41.182 0 019.06-8.131 44.466 44.466 0 0110.923-5.228c3.868-1.237 7.898-1.859 12.081-1.859 2.168 0 4.566.39 7.202 1.163v30.67c-1.551-.312-3.41-.584-5.576-.814a58.79 58.79 0 00-6.274-.35c-6.041 0-11.152 1.01-15.332 3.021-4.182 2.014-7.55 4.761-10.107 8.247-2.555 3.487-4.379 7.55-5.462 12.198-1.083 4.645-1.625 9.682-1.625 15.102v54.133h-32.991V111.595h31.364zM603.923 233.711H570.93a2 2 0 01-2-2V111.594a2 2 0 012-1.999h32.994a2 2 0 012 1.999v120.117a2.002 2.002 0 01-2.001 2zm0-138.705H570.93a2 2 0 01-2-1.999V65.825a2 2 0 012-2h32.994a2 2 0 012 2v27.182a2.002 2.002 0 01-2.001 1.999z"})),c||(c=h.createElement("path",{opacity:.5,fill:"#FFF",d:"M570.93 93.007V65.824h32.994v27.183H570.93zm32.994 18.588v120.117H570.93V111.595h32.994zM742.163 233.711h-37.64a1.995 1.995 0 01-1.667-.896l-23.426-35.352-23.426 35.352a1.992 1.992 0 01-1.667.896h-36.938a2.003 2.003 0 01-1.77-1.067 2.002 2.002 0 01.118-2.061l42.435-62.055-38.71-55.793a2.001 2.001 0 011.643-3.14h37.636c.665 0 1.287.33 1.658.882l19.477 28.893 19.255-28.884a2.004 2.004 0 011.665-.891h36.475c.746 0 1.43.415 1.776 1.078.343.66.289 1.46-.139 2.071l-38.69 55.082 43.578 62.744c.424.61.474 1.408.128 2.066a1.992 1.992 0 01-1.771 1.075z"})),d||(d=h.createElement("path",{opacity:.5,fill:"#FFF",d:"M621.115 111.595h37.637l21.144 31.365 20.911-31.365h36.476l-39.496 56.226 44.377 63.892h-37.64l-25.093-37.87-25.094 37.87h-36.938l43.213-63.193-39.497-56.925zM791.322 340.809h-32.008a2 2 0 01-2-2v-7.712a2 2 0 012-2.001h21.13V11.71h-21.13a2 2 0 01-2-2V2a2 2 0 012-2h32.008a2 2 0 012 2v336.809a2 2 0 01-2 2z"})),m||(m=h.createElement("path",{opacity:.5,fill:"#FFF",d:"M782.443 331.097V9.711h-23.13v-7.71h32.008v336.807h-32.008v-7.711h23.13z"})),u||(u=h.createElement("path",{d:"M10.875 9.711v321.386h23.13v7.711H1.999V2.001h32.006v7.71h-23.13zM99.988 111.595v16.264h.463c4.338-6.191 9.563-10.998 15.684-14.406 6.117-3.402 13.129-5.11 21.027-5.11 7.588 0 14.521 1.475 20.793 4.415 6.274 2.945 11.038 8.131 14.291 15.567 3.56-5.265 8.4-9.913 14.521-13.94 6.117-4.025 13.358-6.042 21.724-6.042 6.351 0 12.234.776 17.66 2.325 5.418 1.549 10.065 4.027 13.938 7.434 3.869 3.41 6.889 7.863 9.062 13.357 2.167 5.504 3.253 12.122 3.253 19.869v80.385H219.41v-68.074c0-4.025-.154-7.82-.465-11.385-.313-3.56-1.161-6.656-2.555-9.293-1.395-2.631-3.45-4.724-6.157-6.274-2.711-1.543-6.391-2.322-11.037-2.322s-8.403.896-11.269 2.671c-2.868 1.784-5.112 4.109-6.737 6.971-1.626 2.869-2.711 6.12-3.252 9.762a74.395 74.395 0 00-.814 11.035v66.91h-32.991v-67.375c0-3.562-.081-7.087-.23-10.57-.158-3.487-.814-6.7-1.978-9.645-1.162-2.94-3.099-5.304-5.809-7.088-2.711-1.775-6.699-2.671-11.965-2.671-1.551 0-3.603.349-6.156 1.048-2.556.697-5.036 2.016-7.435 3.949-2.404 1.938-4.454 4.726-6.158 8.363-1.705 3.642-2.556 8.402-2.556 14.287v69.701h-32.99V111.595h31.132zM273.544 129.255c3.405-5.113 7.744-9.215 13.012-12.316 5.264-3.097 11.186-5.303 17.771-6.621a101.17 101.17 0 0119.865-1.976c6.042 0 12.158.428 18.354 1.277 6.195.855 11.85 2.522 16.962 4.997 5.111 2.477 9.292 5.926 12.546 10.338 3.253 4.414 4.879 10.262 4.879 17.543v62.494c0 5.428.31 10.611.931 15.567.615 4.959 1.701 8.676 3.251 11.153H347.66a46.656 46.656 0 01-1.511-5.693 48.292 48.292 0 01-.813-5.923c-5.267 5.422-11.465 9.217-18.585 11.386a74.81 74.81 0 01-21.842 3.251c-5.733 0-11.077-.698-16.033-2.09-4.958-1.395-9.293-3.562-13.01-6.51-3.718-2.938-6.622-6.656-8.713-11.147s-3.138-9.84-3.138-16.033c0-6.813 1.199-12.43 3.604-16.84 2.399-4.417 5.495-7.939 9.295-10.575 3.793-2.632 8.129-4.607 13.01-5.923a140.326 140.326 0 0114.752-3.137 253.631 253.631 0 0114.638-1.857c4.801-.466 9.062-1.164 12.779-2.093 3.718-.929 6.658-2.282 8.829-4.065 2.165-1.781 3.172-4.375 3.02-7.785 0-3.56-.58-6.389-1.742-8.479-1.161-2.09-2.711-3.719-4.646-4.88-1.937-1.161-4.183-1.936-6.737-2.325-2.557-.382-5.309-.58-8.248-.58-6.506 0-11.617 1.395-15.335 4.183-3.716 2.788-5.889 7.437-6.506 13.94h-32.991c.462-7.742 2.395-14.173 5.807-19.281zm65.169 46.583a53.802 53.802 0 01-6.736 1.741c-2.402.465-4.918.853-7.551 1.161-2.635.313-5.268.698-7.899 1.163a59.302 59.302 0 00-7.317 1.857c-2.404.779-4.495 1.822-6.274 3.138-1.784 1.317-3.216 2.985-4.3 4.994-1.085 2.014-1.626 4.571-1.626 7.668 0 2.94.541 5.422 1.626 7.431 1.084 2.017 2.558 3.604 4.416 4.765s4.025 1.976 6.507 2.438c2.475.466 5.031.698 7.665.698 6.505 0 11.537-1.082 15.103-3.253 3.561-2.166 6.192-4.762 7.899-7.785 1.702-3.019 2.749-6.072 3.137-9.174.384-3.097.58-5.576.58-7.434V172.93c-1.396 1.243-3.138 2.21-5.23 2.908zM463.825 111.595v22.072h-24.161v59.479c0 5.573.928 9.292 2.788 11.149 1.856 1.859 5.576 2.788 11.152 2.788 1.859 0 3.638-.076 5.343-.232a45.912 45.912 0 004.878-.696v25.557c-2.788.465-5.887.773-9.293.931-3.407.149-6.737.23-9.99.23-5.111 0-9.953-.35-14.521-1.048-4.571-.695-8.597-2.047-12.081-4.063-3.486-2.011-6.236-4.88-8.248-8.597-2.016-3.714-3.021-8.595-3.021-14.639v-70.859h-19.98v-22.072h19.98V75.583h32.992v36.012h24.162zM510.988 111.595V133.9h.465c1.546-3.72 3.636-7.163 6.272-10.341a41.182 41.182 0 019.06-8.131 44.466 44.466 0 0110.923-5.228c3.868-1.237 7.898-1.859 12.081-1.859 2.168 0 4.566.39 7.202 1.163v30.67c-1.551-.312-3.41-.584-5.576-.814a58.79 58.79 0 00-6.274-.35c-6.041 0-11.152 1.01-15.332 3.021-4.182 2.014-7.55 4.761-10.107 8.247-2.555 3.487-4.379 7.55-5.462 12.198-1.083 4.645-1.625 9.682-1.625 15.102v54.133h-32.991V111.595h31.364zM570.93 93.007V65.824h32.994v27.183H570.93zm32.994 18.588v120.117H570.93V111.595h32.994zM621.115 111.595h37.637l21.144 31.365 20.911-31.365h36.476l-39.496 56.226 44.377 63.892h-37.64l-25.093-37.87-25.094 37.87h-36.938l43.213-63.193-39.497-56.925zM782.443 331.097V9.711h-23.13v-7.71h32.008v336.807h-32.008v-7.711h23.13z"})))}t.default="img/matrix.d1fcad6.svg"},1552:function(e,t,a){"use strict";a.r(t),a.d(t,"Icon",(function(){return r}));var n,i=a(120);function s(){return s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},s.apply(this,arguments)}function r(e){return i.createElement("svg",s({fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 24",role:"presentation","aria-hidden":!0},e),n||(n=i.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M16.98 1.28a4.872 4.872 0 01-1.114 3.49 4.099 4.099 0 01-3.237 1.53 4.636 4.636 0 011.144-3.36 4.957 4.957 0 013.207-1.66zm3.974 7.428a4.949 4.949 0 00-2.357 4.152 4.782 4.782 0 002.92 4.4 10.963 10.963 0 01-1.519 3.092c-.894 1.338-1.832 2.645-3.32 2.669-.708.016-1.186-.187-1.684-.4-.52-.22-1.06-.451-1.907-.451-.899 0-1.464.238-2.01.467-.47.198-.927.39-1.57.417-1.417.053-2.5-1.428-3.427-2.753-1.853-2.707-3.296-7.628-1.362-10.976a5.315 5.315 0 014.473-2.728c.804-.017 1.576.293 2.252.565.517.208.979.393 1.357.393.332 0 .78-.178 1.304-.386.824-.326 1.832-.727 2.859-.619 1.596.05 3.075.85 3.99 2.158z",fill:"#17191C"})))}t.default="img/element-icons/brands/apple.3f29900.svg"},1553:function(e,t,a){"use strict";a.r(t),a.d(t,"Icon",(function(){return l}));var n,i,s,r=a(120);function o(){return o=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},o.apply(this,arguments)}function l(e){return r.createElement("svg",o({fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 24",role:"presentation","aria-hidden":!0},e),n||(n=r.createElement("mask",{id:"facebook_svg__a",maskUnits:"userSpaceOnUse",x:2,y:1,width:22,height:22},r.createElement("path",{d:"M2.102 1.5H23.1v20.872H2.102V1.5z",fill:"#fff"}))),i||(i=r.createElement("g",{mask:"url(#facebook_svg__a)"},r.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M23.1 11.999c0-5.799-4.701-10.5-10.5-10.5S2.1 6.2 2.1 11.999c0 5.24 3.84 9.585 8.86 10.373v-7.338H8.292V12h2.666V9.686c0-2.632 1.568-4.085 3.966-4.085 1.15 0 2.35.205 2.35.205V8.39h-1.323c-1.305 0-1.711.809-1.711 1.64v1.969h2.912l-.466 3.035h-2.446v7.338c5.02-.788 8.859-5.132 8.859-10.373z",fill:"#1877F2"}))),s||(s=r.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M16.687 15.034L17.153 12H14.24v-1.97c0-.83.406-1.64 1.71-1.64h1.325V5.807s-1.202-.205-2.35-.205c-2.4 0-3.967 1.453-3.967 4.085v2.313H8.293v3.035h2.666v7.338a10.588 10.588 0 003.282 0v-7.338h2.446z",fill:"#fff"})))}t.default="img/element-icons/brands/facebook.d149f4a.svg"},1554:function(e,t,a){"use strict";a.r(t),a.d(t,"Icon",(function(){return r}));var n,i=a(120);function s(){return s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},s.apply(this,arguments)}function r(e){return i.createElement("svg",s({fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 24",role:"presentation","aria-hidden":!0},e),n||(n=i.createElement("path",{d:"M20.842 7.106a9.707 9.707 0 00-3.548-3.548C15.8 2.686 14.169 2.25 12.4 2.25c-1.769 0-3.4.436-4.894 1.308a9.707 9.707 0 00-3.548 3.548C3.086 8.6 2.65 10.23 2.65 12c0 2.124.62 4.035 1.86 5.732 1.24 1.696 2.841 2.87 4.805 3.522.228.043.398.013.508-.088a.497.497 0 00.165-.381l-.007-.686c-.004-.431-.006-.808-.006-1.13l-.292.051a3.725 3.725 0 01-.705.045 5.354 5.354 0 01-.882-.09 1.97 1.97 0 01-.85-.38 1.611 1.611 0 01-.56-.78l-.126-.293a3.174 3.174 0 00-.4-.647c-.182-.237-.366-.398-.552-.482l-.089-.064a.928.928 0 01-.165-.152.696.696 0 01-.114-.178c-.026-.06-.005-.108.063-.146.068-.039.19-.057.368-.057l.254.038c.17.034.379.135.629.304.25.17.454.39.615.66.195.348.43.612.705.794.275.182.552.273.831.273.28 0 .52-.021.724-.063.203-.043.393-.107.571-.191.076-.567.284-1.003.622-1.308a8.696 8.696 0 01-1.301-.228 5.18 5.18 0 01-1.193-.496 3.419 3.419 0 01-1.022-.85c-.271-.339-.493-.783-.667-1.333-.173-.55-.26-1.185-.26-1.904 0-1.025.335-1.896 1.003-2.616-.313-.77-.284-1.633.089-2.59.245-.076.61-.018 1.092.172.482.19.835.354 1.06.489.224.135.404.25.54.343.787-.22 1.599-.33 2.437-.33.838 0 1.65.11 2.438.33l.482-.305c.33-.203.72-.39 1.168-.559.448-.169.791-.215 1.028-.14.381.957.415 1.82.102 2.59.668.72 1.003 1.592 1.003 2.616 0 .72-.087 1.356-.26 1.91-.174.555-.398.999-.673 1.333a3.55 3.55 0 01-1.028.845c-.411.228-.809.393-1.194.495a8.69 8.69 0 01-1.301.229c.44.38.66.981.66 1.802v2.678c0 .153.053.28.159.381.105.102.273.131.501.089 1.964-.652 3.566-1.826 4.805-3.523 1.24-1.697 1.86-3.607 1.86-5.732 0-1.768-.436-3.4-1.308-4.893z",fill:"#000"})))}t.default="img/element-icons/brands/github.de3b60e.svg"},1555:function(e,t,a){"use strict";a.r(t),a.d(t,"Icon",(function(){return m}));var n,i,s,r,o,l,c=a(120);function d(){return d=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},d.apply(this,arguments)}function m(e){return c.createElement("svg",d({fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",role:"presentation","aria-hidden":!0},e),n||(n=c.createElement("path",{d:"M12 20.33l3.317-10.2H8.689l3.312 10.2z",fill:"#E24329"})),i||(i=c.createElement("path",{d:"M4.043 10.13l-1.01 3.098a.687.687 0 00.25.768L12 20.33l-7.957-10.2z",fill:"#FCA326"})),s||(s=c.createElement("path",{d:"M4.042 10.129h4.645L6.688 3.986c-.102-.315-.548-.315-.654 0l-1.992 6.143z",fill:"#E24329"})),r||(r=c.createElement("path",{d:"M19.96 10.13l1.006 3.098a.687.687 0 01-.248.768l-8.719 6.334 7.961-10.2z",fill:"#FCA326"})),o||(o=c.createElement("path",{d:"M19.962 10.129h-4.645l1.995-6.143c.102-.315.548-.315.654 0l1.996 6.143z",fill:"#E24329"})),l||(l=c.createElement("path",{d:"M12 20.33l3.315-10.2h4.645L12 20.33zM11.998 20.33l-7.956-10.2h4.645L12 20.33z",fill:"#FC6D26"})))}t.default="img/element-icons/brands/gitlab.e075acd.svg"},1556:function(e,t,a){"use strict";a.r(t),a.d(t,"Icon",(function(){return c}));var n,i,s,r,o=a(120);function l(){return l=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},l.apply(this,arguments)}function c(e){return o.createElement("svg",l({fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",role:"presentation","aria-hidden":!0},e),n||(n=o.createElement("path",{d:"M22.501 12.233c0-.863-.071-1.493-.226-2.146h-10.06v3.896h5.905c-.119.969-.762 2.427-2.19 3.407l-.02.13 3.18 2.415.22.022c2.024-1.832 3.191-4.527 3.191-7.724z",fill:"#4285F4"})),i||(i=o.createElement("path",{d:"M12.215 22.5c2.893 0 5.321-.933 7.095-2.543l-3.381-2.567c-.905.618-2.12 1.05-3.714 1.05a6.438 6.438 0 01-6.096-4.363l-.125.01-3.307 2.509-.044.117c1.762 3.43 5.381 5.787 9.572 5.787z",fill:"#34A853"})),s||(s=o.createElement("path",{d:"M6.12 14.077A6.347 6.347 0 015.763 12c0-.723.131-1.423.345-2.077l-.006-.139-3.348-2.548-.11.05A10.339 10.339 0 001.501 12c0 1.692.417 3.29 1.143 4.713l3.476-2.636z",fill:"#FBBC05"})),r||(r=o.createElement("path",{d:"M12.215 5.56c2.012 0 3.369.852 4.143 1.563L19.38 4.23c-1.857-1.692-4.273-2.73-7.166-2.73-4.19 0-7.81 2.357-9.572 5.787l3.465 2.636a6.465 6.465 0 016.107-4.363z",fill:"#EB4335"})))}t.default="img/element-icons/brands/google.44aaf41.svg"},1557:function(e,t,a){"use strict";a.r(t),a.d(t,"Icon",(function(){return r}));var n,i=a(120);function s(){return s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},s.apply(this,arguments)}function r(e){return i.createElement("svg",s({fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 24",role:"presentation","aria-hidden":!0},e),n||(n=i.createElement("path",{d:"M9.042 21c-2.427 0-4.688-.706-6.592-1.923 1.616.104 4.469-.146 6.243-1.838-2.67-.123-3.873-2.17-4.03-3.045.227.088 1.308.193 1.919-.052-3.07-.77-3.541-3.464-3.436-4.286.575.402 1.552.542 1.936.507-2.86-2.047-1.832-5.126-1.326-5.79 2.053 2.843 5.13 4.44 8.936 4.53a4.398 4.398 0 01-.11-.98 4.367 4.367 0 014.361-4.373c1.259 0 2.393.535 3.189 1.39.84-.197 2.106-.659 2.725-1.058-.312 1.12-1.283 2.054-1.87 2.4.005.012-.005-.012 0 0 .516-.078 1.912-.346 2.463-.72-.273.629-1.302 1.675-2.147 2.26C21.46 14.953 16.157 21 9.042 21z",fill:"#1D9BF0"})))}t.default="img/element-icons/brands/twitter.43b393b.svg"},1558:function(e,t,a){"use strict";a.d(t,"a",(function(){return E}));var n=a(13),i=a.n(n),s=a(120),r=a.n(s),o=a(239),l=a(1),c=a(121),d=a(122),m=a(181),u=a(617),h=a(124),p=a(198),g=a(127),v=a(235),b=a(128),f=a(469),y=a(174);class E extends r.a.PureComponent{constructor(e){super(e),i()(this,"intervalHandle",void 0),i()(this,"checkRequestIsPending",(()=>{const{request:e}=this.props;e.canAccept||p.a.sharedInstance().dismissToast(this.props.toastKey)})),i()(this,"cancel",(()=>{p.a.sharedInstance().dismissToast(this.props.toastKey);try{this.props.request.cancel()}catch(e){l.a.error("Error while cancelling verification request",e)}})),i()(this,"accept",(async()=>{p.a.sharedInstance().dismissToast(this.props.toastKey);const{request:e}=this.props,t=d.a.get();try{if(e.channel.roomId){h.a.dispatch({action:b.a.ViewRoom,room_id:e.channel.roomId,should_peek:!1,metricsTrigger:"VerificationRequest"});const a=t.getUser(e.otherUserId);y.a.instance.setCards([{phase:m.a.RoomSummary},{phase:m.a.RoomMemberInfo,state:{member:a}},{phase:m.a.EncryptionPanel,state:{verificationRequest:e,member:a}}],void 0,e.channel.roomId)}else g.b.createDialog(f.a,{verificationRequest:e,onFinished:()=>{e.cancel()}},void 0,!1,!0);await e.accept()}catch(e){l.a.error(e.message)}})),this.state={counter:Math.ceil(e.request.timeout/1e3)}}async componentDidMount(){const{request:e}=this.props;if(e.timeout&&e.timeout>0&&(this.intervalHandle=window.setInterval((()=>{let{counter:e}=this.state;e=Math.max(0,e-1),this.setState({counter:e})}),1e3)),e.on(o.l.Change,this.checkRequestIsPending),this.checkRequestIsPending(),e.isSelfVerification){const t=d.a.get(),a=(await t.getDevice(e.channel.deviceId)).last_seen_ip;this.setState({device:t.getStoredDevice(t.getUserId(),e.channel.deviceId),ip:a})}}componentWillUnmount(){clearInterval(this.intervalHandle);const{request:e}=this.props;e.off(o.l.Change,this.checkRequestIsPending)}render(){const{request:e}=this.props;let t,a;if(e.isSelfVerification)this.state.device&&(t=this.state.device.getDisplayName(),a=Object(c.a)("%(deviceId)s from %(ip)s",{deviceId:this.state.device.deviceId,ip:this.state.ip}));else{const a=e.otherUserId,n=e.channel.roomId;if(t=n?Object(u.b)(a,n):a,t===a){const e=d.a.get().getUser(a);e&&e.displayName&&(t=Object(c.a)("%(name)s (%(userId)s)",{name:e.displayName,userId:a}))}}const n=0===this.state.counter?Object(c.a)("Decline"):Object(c.a)("Decline (%(counter)s)",{counter:this.state.counter});return r.a.createElement(v.a,{description:t,detail:a,acceptLabel:Object(c.a)("Accept"),onAccept:this.accept,rejectLabel:n,onReject:this.cancel})}}},1559:function(e,t,a){"use strict";a.d(t,"a",(function(){return r}));var n=a(213),i=a(128),s=a(124);const r=e=>{s.a.dispatch({action:i.a.ViewUserSettings,initialTabId:e?n.a.SessionManager:n.a.Security})}},1570:function(e,t,a){"use strict";var n=a(13),i=a.n(n),s=a(120),r=a.n(s),o=a(146),l=a(126),c=a.n(l),d=a(214),m=a(150),u=a(204),h=a(423),p=a(245),g=a(876),v=a(124),b=a(125),f=a(137);var y=e=>{let{vertical:t,reverse:a,id:n,passRef:i}=e;const s=["mx_ResizeHandle"];return t?s.push("mx_ResizeHandle_vertical"):s.push("mx_ResizeHandle_horizontal"),a&&s.push("mx_ResizeHandle_reverse"),r.a.createElement("div",{ref:i,className:s.join(" "),"data-id":n},r.a.createElement("div",null))};class E{constructor(e,t,a,n){this.resizer=t,this.sizer=a,this.container=n,i()(this,"domNode",void 0),i()(this,"id",void 0),i()(this,"reverse",void 0),this.reverse=t.isReverseResizeHandle(e),this.domNode=n||(this.reverse?e.nextElementSibling:e.previousElementSibling),this.id=e.getAttribute("data-id")}copyWith(e,t,a,n){return new(0,this.constructor)(e,t,a,n)}advance(e){let t=this.reverse?this.domNode.previousElementSibling:this.domNode.nextElementSibling;const a=e!==this.reverse;do{t=a?t.nextElementSibling:t.previousElementSibling}while(t&&!this.resizer.isResizeHandle(t));if(t){const e=this.copyWith(t,this.resizer,this.sizer);return e.reverse=this.reverse,e}}next(){return this.advance(!0)}previous(){return this.advance(!1)}size(){return this.sizer.getItemSize(this.domNode)}offset(){return this.sizer.getItemOffset(this.domNode)}start(){this.sizer.start(this.domNode)}finish(){this.sizer.finish(this.domNode)}getSize(){return this.sizer.getDesiredItemSize(this.domNode)}setRawSize(e){this.sizer.setItemSize(this.domNode,e)}setSize(e){var t,a;this.setRawSize(`${Math.round(e)}px`),null===(t=this.resizer.config)||void 0===t||null===(a=t.onResized)||void 0===a||a.call(t,e,this.id,this.domNode)}clearSize(){var e,t;this.sizer.clearItemSize(this.domNode),null===(e=this.resizer.config)||void 0===e||null===(t=e.onResized)||void 0===t||t.call(e,null,this.id,this.domNode)}first(){const e=Array.from(this.domNode.parentElement.children).find((e=>this.resizer.isResizeHandle(e)));if(e)return this.copyWith(e,this.resizer,this.sizer)}last(){const e=Array.from(this.domNode.parentElement.children).reverse().find((e=>this.resizer.isResizeHandle(e)));if(e)return this.copyWith(e,this.resizer,this.sizer)}}class _{constructor(e,t,a){this.container=e,this.vertical=t,this.reverse=a}getItemOffset(e){const t=(this.vertical?e.offsetTop:e.offsetLeft)-this.getOffset();return this.reverse?this.getTotalSize()-(t+this.getItemSize(e)):t}getItemSize(e){return this.vertical?e.offsetHeight:e.offsetWidth}getTotalSize(){return this.vertical?this.container.offsetHeight:this.container.offsetWidth}getOffset(){return this.vertical?this.container.offsetTop:this.container.offsetLeft}getPageOffset(){let e=this.container,t=0;for(;e;){t+=this.vertical?e.offsetTop:e.offsetLeft,e=e.offsetParent}return t}getDesiredItemSize(e){return this.vertical?e.style.height:e.style.width}setItemSize(e,t){this.vertical?e.style.height=t:e.style.width=t}clearItemSize(e){this.vertical?e.style.height=null:e.style.width=null}start(e){}finish(e){}offsetFromEvent(e){const t=this.vertical?e.pageY:e.pageX;return this.reverse?this.getPageOffset()+this.getTotalSize()-t:t-this.getPageOffset()}}class S{static createItem(e,t,a){return new E(e,t,a)}static createSizer(e,t,a){return new _(e,t,a)}constructor(e){this.item=e,i()(this,"beforeOffset",void 0),this.beforeOffset=e.offset()}get size(){return this.item.getSize()}set size(e){this.item.setRawSize(e)}resize(e){this.item.setSize(e)}resizeFromContainerOffset(e){this.resize(e-this.beforeOffset)}start(){this.item.start()}finish(){this.item.finish()}}class w extends _{start(e){this.vertical?e.style.minHeight=null:e.style.minWidth=null}finish(e){const t=e.offsetParent;if(t)if(this.vertical){const a=(e.offsetHeight/t.offsetHeight*100).toFixed(2)+"%";e.style.minHeight=a,e.style.height=a}else{const a=(e.offsetWidth/t.offsetWidth*100).toFixed(2)+"%";e.style.minWidth=a,e.style.width=a}}}class O extends S{static createSizer(e,t,a){return new w(e,t,a)}}class C extends E{notifyCollapsed(e){var t,a;null===(t=this.resizer.config)||void 0===t||null===(a=t.onCollapsed)||void 0===a||a.call(t,e,this.id,this.domNode)}get isCollapsed(){var e,t,a;return null!==(e=null===(t=this.resizer.config)||void 0===t||null===(a=t.isItemCollapsed)||void 0===a?void 0:a.call(t,this.domNode))&&void 0!==e&&e}}class x extends S{static createItem(e,t,a,n){return new C(e,t,a,n)}constructor(e){var t,a;super(e),i()(this,"toggleSize",void 0),i()(this,"isCollapsed",void 0),this.toggleSize=null===(t=e.resizer)||void 0===t||null===(a=t.config)||void 0===a?void 0:a.toggleSize,this.isCollapsed=e.isCollapsed}resize(e){const t=e<this.toggleSize;t!==this.isCollapsed&&(this.isCollapsed=t,this.item.notifyCollapsed(t)),t||super.resize(e)}}var k=a(148);class j{constructor(e,t,a){this.container=e,this.distributorCtor=t,this.config=a,i()(this,"classNames",void 0),i()(this,"onMouseDown",(e=>{var t,a,n;const i=e.target&&e.target.closest(`.${this.classNames.handle}`),s=null==this||null===(t=this.config)||void 0===t?void 0:t.handler;if(!i||!s&&i.parentElement!==this.container||s&&i!==s)return;var r,o;(e.preventDefault(),this.classNames.resizing)&&(null===(r=this.container)||void 0===r||null===(o=r.classList)||void 0===o||o.add(this.classNames.resizing));null===(a=this.config)||void 0===a||null===(n=a.onResizeStart)||void 0===n||n.call(a);const{sizer:l,distributor:c}=this.createSizerAndDistributor(i);c.start();const d=e=>{const t=l.offsetFromEvent(e);c.resizeFromContainerOffset(t)},m=document.body,u=()=>{var e,t,a,n;this.classNames.resizing&&(null===(a=this.container)||void 0===a||null===(n=a.classList)||void 0===n||n.remove(this.classNames.resizing));c.finish(),null===(e=this.config)||void 0===e||null===(t=e.onResizeStop)||void 0===t||t.call(e),m.removeEventListener("mouseup",u,!1),document.removeEventListener("mouseleave",u,!1),m.removeEventListener("mousemove",d,!1)};m.addEventListener("mouseup",u,!1),document.addEventListener("mouseleave",u,!1),m.addEventListener("mousemove",d,!1)})),i()(this,"onResize",Object(k.throttle)((()=>{const e=this.getDistributors();e.forEach((e=>e.start())),e.forEach((e=>e.finish()))}),100,{trailing:!0,leading:!0})),i()(this,"getDistributors",(()=>this.getResizeHandles().map((e=>{const{distributor:t}=this.createSizerAndDistributor(e);return t})))),this.classNames={handle:"resizer-handle",reverse:"resizer-reverse",vertical:"resizer-vertical",resizing:"resizer-resizing"}}setClassNames(e){this.classNames=e}attach(){var e,t,a;(null!==(e=null==this||null===(t=this.config)||void 0===t||null===(a=t.handler)||void 0===a?void 0:a.parentElement)&&void 0!==e?e:this.container).addEventListener("mousedown",this.onMouseDown,!1),window.addEventListener("resize",this.onResize)}detach(){var e,t,a;(null!==(e=null==this||null===(t=this.config)||void 0===t||null===(a=t.handler)||void 0===a?void 0:a.parentElement)&&void 0!==e?e:this.container).removeEventListener("mousedown",this.onMouseDown,!1),window.removeEventListener("resize",this.onResize)}forHandleAt(e){const t=this.getResizeHandles()[e];if(t){const{distributor:e}=this.createSizerAndDistributor(t);return e}}forHandleWithId(e){const t=this.getResizeHandles().find((t=>t.getAttribute("data-id")===e));if(t){const{distributor:e}=this.createSizerAndDistributor(t);return e}}isReverseResizeHandle(e){return e.classList.contains(this.classNames.reverse)}isResizeHandle(e){return e.classList.contains(this.classNames.handle)}createSizerAndDistributor(e){var t;const a=e.classList.contains(this.classNames.vertical),n=this.isReverseResizeHandle(e),i=this.distributorCtor,s=null!==(t=this.config)&&void 0!==t&&t.handler?this.container:void 0,r=i.createSizer(this.container,a,n),o=i.createItem(e,this,r,s);return{sizer:r,distributor:new i(o)}}getResizeHandles(){var e,t;return null!=this&&null!==(e=this.config)&&void 0!==e&&e.handler?[this.config.handler]:null!==(t=this.container)&&void 0!==t&&t.children?Array.from(this.container.querySelectorAll(`.${this.classNames.handle}`)):[]}}var R=a(133),I=a(157),T=a(190),N=a(121),D=a(235),P=a(198),M=a(382);const A="serverlimit",L=()=>{P.a.sharedInstance().dismissToast(A)};var U=a(128),F=a(943),B=a(184),V=a(818),W=a(142),H=a(127),z=a(892),G=a(123);class K extends s.PureComponent{constructor(e){super(e),i()(this,"dispatcherRef",void 0),i()(this,"onAction",(e=>{"focus_room_filter"===e.action&&this.openSpotlight()})),this.dispatcherRef=v.a.register(this.onAction)}componentWillUnmount(){v.a.unregister(this.dispatcherRef)}openSpotlight(){H.b.createDialog(z.b,{},"mx_SpotlightDialog_wrapper",!1,!0)}render(){const e=c()({mx_RoomSearch:!0,mx_RoomSearch_minimized:this.props.isMinimized},"mx_RoomSearch_spotlightTrigger"),t=s.createElement("div",{className:"mx_RoomSearch_icon"}),a=s.createElement("kbd",{className:"mx_RoomSearch_shortcutPrompt"},u.a?"⌘ K":Object(N.a)(W.a[u.b.CONTROL])+" K");return s.createElement(G.a,{onClick:this.openSpotlight,className:e},t,!this.props.isMinimized&&s.createElement("div",{className:"mx_RoomSearch_spotlightTriggerText"},Object(N.a)("Search")),a)}}var q=a(147),$=a(178),Y=a(208),J=a(151),Q=a(195),X=a(130),Z=a.n(X),ee=a(129),te=a(141),ae=a(220),ne=a(236),ie=a(140),se=a(166),re=a(159),oe=a(156),le=a(250),ce=a(149),de=a(285),me=a(173),ue=a(634),he=a(206),pe=a(286),ge=a(132),ve=a.n(ge),be=a(1491),fe=a(596),ye=a(162);const Ee=(e,t)=>{let a="";if(t)for(const e of t.entries())a+=e+"/";return`mx_space_collapsed_${a+e}`};class _e{static get instance(){return _e.internalInstance||(_e.internalInstance=new _e),_e.internalInstance}setSpaceCollapsedState(e,t,a){localStorage.setItem(Ee(e,t),a.toString())}getSpaceCollapsedState(e,t,a){const n=localStorage.getItem(Ee(e,t));return n?"true"===n:a}}i()(_e,"internalInstance",void 0);var Se=a(246),we=a(328),Oe=a(330),Ce=a(197),xe=a(169);const ke=["space","spaceKey","className","selected","label","contextMenuTooltip","notificationState","avatarSize","isNarrow","children","ContextMenuComponent"],je=["space","activeSpaces","isNested","isPanelCollapsed","onExpand","parents","innerRef","dragHandleProps"],Re=["tabIndex"],Ie=Object(s.forwardRef)(((e,t)=>{var a;let{space:n,spaceKey:i,className:s,selected:o,label:l,contextMenuTooltip:d,notificationState:m,avatarSize:u,isNarrow:h,children:p,ContextMenuComponent:g}=e,b=ve()(e,ke);const[f,y,E,_]=Object(ce.q)(t),[S,w]=Object(xe.i)(y),O=w?0:-1;let C,x,k=r.a.createElement("div",{className:"mx_SpaceButton_avatarPlaceholder"},r.a.createElement("div",{className:"mx_SpaceButton_icon"}));if(n&&(k=r.a.createElement(ye.a,{width:u,height:u,room:n})),m){let e=Object(N.a)("Jump to first unread room.");"invite"===(null==n?void 0:n.getMyMembership())&&(e=Object(N.a)("Jump to first invite."));const t=e=>{e.stopPropagation(),e.preventDefault(),$.a.instance.setActiveRoomInSpace(null!=i?i:n.roomId)};C=r.a.createElement("div",{className:"mx_SpacePanel_badgeContainer"},r.a.createElement(Se.a,{onClick:t,forceCount:!1,notification:m,"aria-label":e,tabIndex:O,showUnsentTooltip:!0}))}f&&y.current&&g&&(x=r.a.createElement(g,Z()({},Object(ce.p)(y.current.getBoundingClientRect(),0),{space:n,onFinished:_})));const j=null!==(a=b.onClick)&&void 0!==a?a:o&&n?()=>v.a.dispatch({action:U.a.ViewRoom,room_id:n.roomId}):()=>$.a.instance.setActiveSpace(null!=i?i:n.roomId);return r.a.createElement(q.a,Z()({},b,{className:c()("mx_SpaceButton",s,{mx_SpaceButton_active:o,mx_SpaceButton_hasMenuOpen:f,mx_SpaceButton_narrow:h}),title:l,onClick:j,onContextMenu:E,forceHide:!h||f,inputRef:y,tabIndex:O,onFocus:S}),p,r.a.createElement("div",{className:"mx_SpaceButton_selectionWrapper"},r.a.createElement("div",{className:"mx_SpaceButton_avatarWrapper"},k,C),!h&&r.a.createElement("span",{className:"mx_SpaceButton_name"},l),g&&r.a.createElement(we.a,{className:"mx_SpaceButton_menuButton",onClick:E,title:d,isExpanded:f}),x))}));class Te extends r.a.PureComponent{constructor(e){super(e),i()(this,"buttonRef",Object(s.createRef)()),i()(this,"onSpaceUpdate",(()=>{this.setState({childSpaces:this.childSpaces})})),i()(this,"onRoomNameChange",(()=>{this.setState({name:this.props.space.name})})),i()(this,"toggleCollapse",(e=>{this.props.onExpand&&this.isCollapsed&&this.props.onExpand();const t=!this.isCollapsed;_e.instance.setSpaceCollapsedState(this.props.space.roomId,this.props.parents,t),this.setState({collapsed:t}),e.stopPropagation()})),i()(this,"onKeyDown",(e=>{var t;let a=!0;const n=Object(J.a)().getRoomListAction(e),i=null===(t=this.state.childSpaces)||void 0===t?void 0:t.length;switch(n){case W.h.CollapseRoomListSection:if(i&&!this.isCollapsed)this.toggleCollapse(e);else{var s,r,o;const e=null===(s=this.buttonRef)||void 0===s||null===(r=s.current)||void 0===r||null===(o=r.parentElement)||void 0===o?void 0:o.parentElement,t=null==e?void 0:e.previousElementSibling;null==t||t.focus()}break;case W.h.ExpandRoomListSection:if(i)if(this.isCollapsed)this.toggleCollapse(e);else{var l,c,d;const e=null===(l=this.buttonRef)||void 0===l||null===(c=l.current)||void 0===c?void 0:c.nextElementSibling,t=null==e?void 0:e.querySelector(".mx_SpaceItem");null==t||null===(d=t.querySelector(".mx_SpaceButton"))||void 0===d||d.focus()}break;default:a=!1}a&&(e.stopPropagation(),e.preventDefault())}));const t=_e.instance.getSpaceCollapsedState(e.space.roomId,this.props.parents,!e.isNested);this.state={name:this.props.space.name,collapsed:t,childSpaces:this.childSpaces},$.a.instance.on(this.props.space.roomId,this.onSpaceUpdate),this.props.space.on(te.d.Name,this.onRoomNameChange)}componentWillUnmount(){$.a.instance.off(this.props.space.roomId,this.onSpaceUpdate),this.props.space.off(te.d.Name,this.onRoomNameChange)}get childSpaces(){return $.a.instance.getChildSpaces(this.props.space.roomId).filter((e=>{var t;return!(null!==(t=this.props.parents)&&void 0!==t&&t.has(e.roomId))}))}get isCollapsed(){return this.state.collapsed||!!this.props.isPanelCollapsed}render(){var e,t;const a=this.props,{space:n,activeSpaces:i,isNested:s,isPanelCollapsed:o,onExpand:l,parents:d,innerRef:m,dragHandleProps:u}=a,h=ve()(a,je),p=this.isCollapsed,g=c()(this.props.className,{mx_SpaceItem:!0,mx_SpaceItem_narrow:o,collapsed:p,hasSubSpaces:null===(e=this.state.childSpaces)||void 0===e?void 0:e.length}),v="invite"===n.getMyMembership(),b=v?Oe.a.forSymbol("!",Ce.a.Red):$.a.instance.getNotificationState(n.roomId),f=null===(t=this.state.childSpaces)||void 0===t?void 0:t.length;let y;f&&!p&&(y=r.a.createElement(Ne,{spaces:this.state.childSpaces,activeSpaces:i,isNested:!0,parents:new Set(d).add(n.roomId)}));const E=f?r.a.createElement(G.a,{className:"mx_SpaceButton_toggleCollapse",onClick:this.toggleCollapse,tabIndex:-1,"aria-label":p?Object(N.a)("Expand"):Object(N.a)("Collapse")}):null,_=u||{},{tabIndex:S}=_,w=ve()(_,Re),O=i.includes(n.roomId);return r.a.createElement("li",Z()({},h,{className:g,ref:m,"aria-expanded":f?!p:void 0,"aria-selected":O,role:"treeitem"}),r.a.createElement(Ie,Z()({},w,{space:n,className:v?"mx_SpaceButton_invite":void 0,selected:O,label:this.state.name,contextMenuTooltip:Object(N.a)("Space options"),notificationState:b,isNarrow:o,avatarSize:s?24:32,onKeyDown:this.onKeyDown,ContextMenuComponent:"join"===this.props.space.getMyMembership()?ue.a:void 0}),E),y)}}i()(Te,"contextType",R.a);const Ne=e=>{let{spaces:t,activeSpaces:a,isNested:n,parents:i}=e;return r.a.createElement("ul",{className:"mx_SpaceTreeLevel",role:"group"},t.map((e=>r.a.createElement(Te,{key:e.roomId,activeSpaces:a,space:e,isNested:n,parents:i}))))};var De=a(219),Pe=a(177),Me=a(894),Ae=a(213),Le=a(312),Ue=a(279),Fe=a(895);const Be="MATCH_SYSTEM_THEME_ID";var Ve,We,He=e=>{let{requestClose:t}=e;const a=Object(s.useMemo)(Le.f,[]),n=Fe.a.calculateThemeState(),i=Object(Le.d)(n.theme),o=i||n.theme,{useSystemTheme:l}=n,c=[{id:Be,name:Object(N.a)("Match system")},...a],d=l?Be:o;return r.a.createElement("div",{className:"mx_QuickThemeSwitcher"},r.a.createElement("h4",{className:"mx_QuickThemeSwitcher_heading"},Object(N.a)("Theme")),r.a.createElement(Ue.a,{id:"mx_QuickSettingsButton_themePickerDropdown",onOptionChange:async e=>{re.b.trackInteraction("WebQuickSettingsThemeDropdown");try{e===Be?await b.b.setValue("use_system_theme",null,f.a.DEVICE,!0):(v.a.dispatch({action:U.a.RecheckTheme,forceTheme:e}),await Promise.all([b.b.setValue("theme",null,f.a.DEVICE,e),b.b.setValue("use_system_theme",null,f.a.DEVICE,!1)]))}catch(e){v.a.dispatch({action:U.a.RecheckTheme})}t()},value:d,label:Object(N.a)("Space selection")},c.map((e=>r.a.createElement("div",{key:e.id},e.name)))))};function ze(){return ze=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},ze.apply(this,arguments)}function Ge(e){return s.createElement("svg",ze({fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",role:"presentation","aria-hidden":!0},e),Ve||(Ve=s.createElement("path",{d:"M11 18.598V15h2v3.598C13 20.5 12.238 22 12 22s-1-1.5-1-3.402zM9.5 6c-.325-.167-1.714-.8-2.883-2s-.495-2 .513-2H12v4H9.5zM14.5 6c.325-.167 1.714-.8 2.883-2s.495-2-.513-2H12v4h2.5zM9.429 6h5.142L15 10H9l.429-4z",fill:"#000"})),We||(We=s.createElement("path",{d:"M12 9c-3.069 0-5.676 1.693-6.621 4.048C4.967 14.073 5.895 15 7 15h10c1.105 0 2.032-.927 1.621-1.952C17.677 10.693 15.07 9 12 9z",fill:"#000"})))}var Ke,qe,$e;function Ye(){return Ye=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},Ye.apply(this,arguments)}function Je(e){return s.createElement("svg",Ye({fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",role:"presentation","aria-hidden":!0},e),Ke||(Ke=s.createElement("circle",{cx:15.5,cy:10,r:1.5,transform:"rotate(180 15.5 10)",fill:"#15191E"})),qe||(qe=s.createElement("circle",{cx:10,cy:10,r:1.5,transform:"rotate(180 10 10)",fill:"#15191E"})),$e||($e=s.createElement("circle",{cx:4.5,cy:10,r:1.5,transform:"rotate(180 4.5 10)",fill:"#15191E"})))}var Qe,Xe,Ze;function et(){return et=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},et.apply(this,arguments)}function tt(e){return s.createElement("svg",et({fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",role:"presentation","aria-hidden":!0},e),Qe||(Qe=s.createElement("mask",{id:"members_svg__a",fill:"#fff"},s.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M17.591 20.292A9.954 9.954 0 0112 22a9.956 9.956 0 01-6-2 9.985 9.985 0 01-4-8C2 6.477 6.477 2 12 2s10 4.477 10 10a9.99 9.99 0 01-4.409 8.292zM12 12.5c1.657 0 3-1.455 3-3.25S13.657 6 12 6 9 7.455 9 9.25s1.343 3.25 3 3.25zm0 7.5a7.974 7.974 0 005.563-2.251 6.002 6.002 0 00-11.126 0A7.973 7.973 0 0012 20z"}))),Xe||(Xe=s.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M17.591 20.292A9.954 9.954 0 0112 22a9.956 9.956 0 01-6-2 9.985 9.985 0 01-4-8C2 6.477 6.477 2 12 2s10 4.477 10 10a9.99 9.99 0 01-4.409 8.292zM12 12.5c1.657 0 3-1.455 3-3.25S13.657 6 12 6 9 7.455 9 9.25s1.343 3.25 3 3.25zm0 7.5a7.974 7.974 0 005.563-2.251 6.002 6.002 0 00-11.126 0A7.973 7.973 0 0012 20z",fill:"#000"})),Ze||(Ze=s.createElement("path",{d:"M17.591 20.292l-1.12-1.657 1.12 1.657zM6 20.001L4.799 21.6 6 20zm11.563-2.252l1.391 1.437.97-.938-.507-1.25-1.854.75zm-11.126 0l-1.854-.751-.506 1.25.969.938 1.39-1.437zM12 24c2.482 0 4.794-.756 6.71-2.05l-2.239-3.315A7.954 7.954 0 0112 20v4zm-7.201-2.4A11.956 11.956 0 0012 24v-4a7.955 7.955 0 01-4.799-1.598L4.8 21.6zM0 12c0 3.927 1.889 7.414 4.799 9.6L7.2 18.402A7.985 7.985 0 014 12H0zM12 0C5.373 0 0 5.373 0 12h4a8 8 0 018-8V0zm12 12c0-6.627-5.373-12-12-12v4a8 8 0 018 8h4zm-5.29 9.95A11.99 11.99 0 0024 12h-4a7.99 7.99 0 01-3.529 6.635l2.24 3.314zM13 9.25c0 .844-.595 1.25-1 1.25v4c2.91 0 5-2.504 5-5.25h-4zM12 8c.405 0 1 .406 1 1.25h4C17 6.504 14.91 4 12 4v4zm-1 1.25c0-.844.595-1.25 1-1.25V4C9.09 4 7 6.504 7 9.25h4zm1 1.25c-.405 0-1-.406-1-1.25H7c0 2.746 2.09 5.25 5 5.25v-4zm4.172 5.812A5.974 5.974 0 0112 18v4a9.973 9.973 0 006.954-2.814l-2.782-2.874zM12 16a4.002 4.002 0 013.71 2.5l3.707-1.502A8.002 8.002 0 0012 12v4zm-3.71 2.5A4.002 4.002 0 0112 16v-4a8.002 8.002 0 00-7.417 4.998L8.29 18.5zM12 18a5.974 5.974 0 01-4.172-1.688l-2.782 2.874A9.973 9.973 0 0012 22v-4z",fill:"#000",mask:"url(#members_svg__a)"})))}var at;function nt(){return nt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},nt.apply(this,arguments)}function it(e){return s.createElement("svg",nt({fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 18 18",role:"presentation","aria-hidden":!0},e),at||(at=s.createElement("path",{d:"M8.414 1.432c.178-.576.994-.576 1.172 0l1.585 5.131h5.215c.586 0 .838.745.372 1.1l-4.244 3.243 1.604 5.194c.177.57-.483 1.03-.958.668L9 13.59l-4.16 3.178c-.475.363-1.135-.098-.959-.668l1.606-5.194-4.245-3.242c-.466-.356-.214-1.1.372-1.1H6.83l1.585-5.132z",fill:"#000"})))}var st=a(651),rt=a(153);var ot=e=>{let{isPanelCollapsed:t=!1}=e;const[a,n,i,s]=Object(ce.q)(),{[Y.a.Favourites]:o,[Y.a.People]:l}=Object(se.b)("Spaces.enabledMetaSpaces");let d;return a&&n.current&&(d=r.a.createElement(ce.n,Z()({},Object(ce.k)(n.current.getBoundingClientRect(),ce.a.None,16),{wrapperClassName:"mx_QuickSettingsButton_ContextMenuWrapper",onFinished:s,managed:!1,focusLock:!0}),r.a.createElement("h2",null,Object(N.a)("Quick settings")),r.a.createElement(G.a,{onClick:()=>{s(),v.a.dispatch({action:U.a.ViewUserSettings})},kind:"primary_outline"},Object(N.a)("All settings")),b.b.getValue("developerMode")&&r.a.createElement(G.a,{onClick:()=>{s(),H.b.createDialog(st.a,{roomId:rt.b.instance.roomViewStore.getRoomId()},"mx_DevtoolsDialog_wrapper")},kind:"danger_outline"},Object(N.a)("Developer tools")),r.a.createElement("h4",{className:"mx_QuickSettingsButton_pinToSidebarHeading"},r.a.createElement(Ge,{className:"mx_QuickSettingsButton_icon"}),Object(N.a)("Pin to sidebar")),r.a.createElement(Pe.b,{className:"mx_QuickSettingsButton_favouritesCheckbox",checked:!!o,onChange:Object(Me.b)(Y.a.Favourites,"WebQuickSettingsPinToSidebarCheckbox")},r.a.createElement(it,{className:"mx_QuickSettingsButton_icon"}),Object(N.a)("Favourites")),r.a.createElement(Pe.b,{className:"mx_QuickSettingsButton_peopleCheckbox",checked:!!l,onChange:Object(Me.b)(Y.a.People,"WebQuickSettingsPinToSidebarCheckbox")},r.a.createElement(tt,{className:"mx_QuickSettingsButton_icon"}),Object(N.a)("People")),r.a.createElement(G.a,{className:"mx_QuickSettingsButton_moreOptionsButton",onClick:()=>{s(),v.a.dispatch({action:U.a.ViewUserSettings,initialTabId:Ae.a.Sidebar})}},r.a.createElement(Je,{className:"mx_QuickSettingsButton_icon"}),Object(N.a)("More options")),r.a.createElement(He,{requestClose:s}))),r.a.createElement(r.a.Fragment,null,r.a.createElement(q.a,{className:c()("mx_QuickSettingsButton",{expanded:!t}),onClick:i,title:Object(N.a)("Quick settings"),inputRef:n,forceHide:!t},t?null:Object(N.a)("Settings")),d)},lt=a(122),ct=a(633),dt=a(635),mt=a(131),ut=a(473),ht=a(249),pt=a(152),gt=a(191);class vt extends pt.a{constructor(){super(v.a,{hostSignupActive:!1})}static get instance(){return vt.internalInstance}get isHostSignupActive(){return this.state.hostSignupActive}async setHostSignupActive(e){return this.updateState({hostSignupActive:e})}onDispatch(e){}}i()(vt,"internalInstance",new vt);class bt extends r.a.PureComponent{constructor(){super(...arguments),i()(this,"openDialog",(async()=>{var e,t;null===(e=(t=this.props).onClick)||void 0===e||e.call(t),await vt.instance.setHostSignupActive(!0)}))}render(){const e=mt.b.getObject("host_signup");return null!=e&&e.get("brand")?r.a.createElement(me.c,null,r.a.createElement(me.b,{iconClassName:"mx_UserMenu_iconHosting",label:Object(N.a)("Upgrade to %(hostSignupBrand)s",{hostSignupBrand:e.get("brand")}),onClick:this.openDialog})):null}}var ft=a(261),yt=a(392),Et=a(192);class _t extends r.a.Component{constructor(e,t){super(e,t),i()(this,"context",void 0),i()(this,"dispatcherRef",void 0),i()(this,"themeWatcherRef",void 0),i()(this,"dndWatcherRef",void 0),i()(this,"buttonRef",Object(s.createRef)()),i()(this,"onCurrentVoiceBroadcastRecordingChanged",(e=>{this.setState({showLiveAvatarAddon:null!==e})})),i()(this,"onProfileUpdate",(async()=>{this.forceUpdate()})),i()(this,"onSelectedSpaceUpdate",(async()=>{this.setState({selectedSpace:$.a.instance.activeSpaceRoom})})),i()(this,"onThemeChanged",(()=>{this.setState({isDarkTheme:this.isUserOnDarkTheme(),isHighContrast:this.isUserOnHighContrastTheme()})})),i()(this,"onAction",(e=>{if(e.action===U.a.ToggleUserMenu)this.state.contextMenuPosition?this.setState({contextMenuPosition:null}):this.buttonRef.current&&this.buttonRef.current.click()})),i()(this,"onOpenMenuClick",(e=>{e.preventDefault(),e.stopPropagation(),this.setState({contextMenuPosition:e.currentTarget.getBoundingClientRect()})})),i()(this,"onContextMenu",(e=>{e.preventDefault(),e.stopPropagation(),this.setState({contextMenuPosition:{left:e.clientX,top:e.clientY,width:20,height:0}})})),i()(this,"onCloseMenu",(()=>{this.setState({contextMenuPosition:null})})),i()(this,"onSwitchThemeClick",(e=>{e.preventDefault(),e.stopPropagation(),re.b.trackInteraction("WebUserMenuThemeToggleButton",e),b.b.setValue("use_system_theme",null,f.a.DEVICE,!1);let t=this.state.isDarkTheme?"light":"dark";if(this.state.isHighContrast){const e=Object(Le.c)(t);e&&(t=e)}b.b.setValue("theme",null,f.a.DEVICE,t)})),i()(this,"onSettingsOpen",((e,t)=>{e.preventDefault(),e.stopPropagation();const a={action:U.a.ViewUserSettings,initialTabId:t};v.a.dispatch(a),this.setState({contextMenuPosition:null})})),i()(this,"onProvideFeedback",(e=>{e.preventDefault(),e.stopPropagation(),H.b.createDialog(ct.a),this.setState({contextMenuPosition:null})})),i()(this,"onSignOutClick",(async e=>{var t;e.preventDefault(),e.stopPropagation();const a=lt.a.get();a&&a.isCryptoEnabled()&&null!==(t=await a.exportRoomKeys())&&void 0!==t&&t.length?H.b.createDialog(dt.a):v.a.dispatch({action:"logout"}),this.setState({contextMenuPosition:null})})),i()(this,"onSignInClick",(()=>{v.a.dispatch({action:"start_login"}),this.setState({contextMenuPosition:null})})),i()(this,"onRegisterClick",(()=>{v.a.dispatch({action:"start_registration"}),this.setState({contextMenuPosition:null})})),i()(this,"onHomeClick",(e=>{e.preventDefault(),e.stopPropagation(),v.a.dispatch({action:U.a.ViewHomePage}),this.setState({contextMenuPosition:null})})),i()(this,"renderContextMenu",(()=>{if(!this.state.contextMenuPosition)return null;let e;const t=mt.b.getObject("host_signup");if(lt.a.get().isGuest())e=r.a.createElement("div",{className:"mx_UserMenu_contextMenu_header mx_UserMenu_contextMenu_guestPrompts"},Object(N.a)("Got an account? <a>Sign in</a>",{},{a:e=>r.a.createElement(G.a,{kind:"link_inline",onClick:this.onSignInClick},e)}),Object(N.a)("New here? <a>Create an account</a>",{},{a:e=>r.a.createElement(G.a,{kind:"link_inline",onClick:this.onRegisterClick},e)}));else if(null!=t&&t.get("url")){const a=t.get("domains")||[],n=lt.a.get().getDomain(),i=a.filter((e=>e===n||n.endsWith(`.${e}`)));(!t.get("domains")||i.length>0)&&(e=r.a.createElement(bt,{onClick:this.onCloseMenu}))}let n,i=null;this.hasHomePage&&(i=r.a.createElement(me.b,{iconClassName:"mx_UserMenu_iconHome",label:Object(N.a)("Home"),onClick:this.onHomeClick})),b.b.getValue(oe.b.Feedback)&&(n=r.a.createElement(me.b,{iconClassName:"mx_UserMenu_iconMessage",label:Object(N.a)("Feedback"),onClick:this.onProvideFeedback}));let s=r.a.createElement(me.c,null,i,r.a.createElement(me.b,{iconClassName:"mx_UserMenu_iconBell",label:Object(N.a)("Notifications"),onClick:e=>this.onSettingsOpen(e,Ae.a.Notifications)}),r.a.createElement(me.b,{iconClassName:"mx_UserMenu_iconLock",label:Object(N.a)("Security & Privacy"),onClick:e=>this.onSettingsOpen(e,Ae.a.Security)}),r.a.createElement(me.b,{iconClassName:"mx_UserMenu_iconSettings",label:Object(N.a)("All settings"),onClick:e=>this.onSettingsOpen(e,null)}),n,r.a.createElement(me.b,{className:"mx_IconizedContextMenu_option_red",iconClassName:"mx_UserMenu_iconSignOut",label:Object(N.a)("Sign out"),onClick:this.onSignOutClick}));lt.a.get().isGuest()&&(s=r.a.createElement(me.c,null,i,r.a.createElement(me.b,{iconClassName:"mx_UserMenu_iconSettings",label:Object(N.a)("Settings"),onClick:e=>this.onSettingsOpen(e,null)}),n));const o=this.props.isPanelCollapsed?{left:(l=this.state.contextMenuPosition).width+l.left+8,top:l.top,chevronFace:ce.a.None}:(e=>({left:e.left,top:e.top+e.height,chevronFace:ce.a.None}))(this.state.contextMenuPosition);var l;return r.a.createElement(me.e,Z()({},o,{onFinished:this.onCloseMenu,className:"mx_UserMenu_contextMenu"}),r.a.createElement("div",{className:"mx_UserMenu_contextMenu_header"},r.a.createElement("div",{className:"mx_UserMenu_contextMenu_name"},r.a.createElement("span",{className:"mx_UserMenu_contextMenu_displayName"},ht.a.instance.displayName),r.a.createElement("span",{className:"mx_UserMenu_contextMenu_userId"},ft.a.getDisplayUserIdentifier(lt.a.get().getUserId(),{withDisplayName:!0}))),r.a.createElement(xe.b,{className:"mx_UserMenu_contextMenu_themeButton",onClick:this.onSwitchThemeClick,title:this.state.isDarkTheme?Object(N.a)("Switch to light mode"):Object(N.a)("Switch to dark mode")},r.a.createElement("img",{src:a(1490).default,alt:Object(N.a)("Switch theme"),width:16}))),e,s)})),this.context=t,this.state={contextMenuPosition:null,isDarkTheme:this.isUserOnDarkTheme(),isHighContrast:this.isUserOnHighContrastTheme(),selectedSpace:$.a.instance.activeSpaceRoom,showLiveAvatarAddon:this.context.voiceBroadcastRecordingsStore.hasCurrent()},ht.a.instance.on(pt.b,this.onProfileUpdate),$.a.instance.on(Y.d,this.onSelectedSpaceUpdate)}get hasHomePage(){return!!Object(ut.a)(mt.b.get())}componentDidMount(){this.context.voiceBroadcastRecordingsStore.on(Et.y.CurrentChanged,this.onCurrentVoiceBroadcastRecordingChanged),this.dispatcherRef=v.a.register(this.onAction),this.themeWatcherRef=b.b.watchSetting("theme",null,this.onThemeChanged)}componentWillUnmount(){this.themeWatcherRef&&b.b.unwatchSetting(this.themeWatcherRef),this.dndWatcherRef&&b.b.unwatchSetting(this.dndWatcherRef),this.dispatcherRef&&v.a.unregister(this.dispatcherRef),ht.a.instance.off(pt.b,this.onProfileUpdate),$.a.instance.off(Y.d,this.onSelectedSpaceUpdate),this.context.voiceBroadcastRecordingsStore.off(Et.y.CurrentChanged,this.onCurrentVoiceBroadcastRecordingChanged)}isUserOnDarkTheme(){if(b.b.getValue("use_system_theme"))return window.matchMedia("(prefers-color-scheme: dark)").matches;{const e=b.b.getValue("theme");return e.startsWith("custom-")?Object(Le.e)(e.substring("custom-".length)).is_dark:"dark"===e}}isUserOnHighContrastTheme(){if(b.b.getValue("use_system_theme"))return window.matchMedia("(prefers-contrast: more)").matches;{const e=b.b.getValue("theme");return!e.startsWith("custom-")&&Object(Le.g)(e)}}render(){const e=lt.a.get().getUserId(),t=ht.a.instance.displayName||e,a=ht.a.instance.getHttpAvatarUrl(32);let n;this.props.isPanelCollapsed||(n=r.a.createElement("div",{className:"mx_UserMenu_name"},t));const i=this.state.showLiveAvatarAddon?r.a.createElement("div",{className:"mx_UserMenu_userAvatarLive","data-testid":"user-menu-live-vb"},r.a.createElement(yt.a,{className:"mx_Icon_8"})):null;return r.a.createElement("div",{className:"mx_UserMenu"},r.a.createElement(ce.b,{onClick:this.onOpenMenuClick,inputRef:this.buttonRef,label:Object(N.a)("User menu"),isExpanded:!!this.state.contextMenuPosition,onContextMenu:this.onContextMenu},r.a.createElement("div",{className:"mx_UserMenu_userAvatar"},r.a.createElement(gt.a,{idName:e,name:t,url:a,width:32,height:32,resizeMethod:"crop",className:"mx_UserMenu_userAvatar_BaseAvatar"}),i),n,this.renderContextMenu()),this.props.children)}}i()(_t,"contextType",rt.a);var St=a(211);const wt=["children","trackHorizontalOverflow","verticalScrollsHorizontally"];class Ot extends r.a.Component{constructor(e){super(e),i()(this,"autoHideScrollbar",Object(s.createRef)()),i()(this,"scrollElement",void 0),i()(this,"likelyTrackpadUser",null),i()(this,"checkAgainForTrackpad",0),i()(this,"collectScroller",(e=>{var t,a;null===(t=(a=this.props).wrappedRef)||void 0===t||t.call(a,e),e&&!this.scrollElement&&(this.scrollElement=e,this.scrollElement.addEventListener("scroll",this.checkOverflow,{passive:!0}),this.checkOverflow())})),i()(this,"checkOverflow",(()=>{const e=this.scrollElement.scrollTop>0,t=this.scrollElement.scrollHeight>this.scrollElement.scrollTop+this.scrollElement.clientHeight,a=this.scrollElement.scrollLeft>0,n=this.scrollElement.scrollWidth>this.scrollElement.scrollLeft+this.scrollElement.clientWidth;e?this.scrollElement.classList.add("mx_IndicatorScrollbar_topOverflow"):this.scrollElement.classList.remove("mx_IndicatorScrollbar_topOverflow"),t?this.scrollElement.classList.add("mx_IndicatorScrollbar_bottomOverflow"):this.scrollElement.classList.remove("mx_IndicatorScrollbar_bottomOverflow"),a?this.scrollElement.classList.add("mx_IndicatorScrollbar_leftOverflow"):this.scrollElement.classList.remove("mx_IndicatorScrollbar_leftOverflow"),n?this.scrollElement.classList.add("mx_IndicatorScrollbar_rightOverflow"):this.scrollElement.classList.remove("mx_IndicatorScrollbar_rightOverflow"),this.props.trackHorizontalOverflow&&this.setState({leftIndicatorOffset:a?`${this.scrollElement.scrollLeft}px`:"0",rightIndicatorOffset:n?`-${this.scrollElement.scrollLeft}px`:"0"})})),i()(this,"onMouseWheel",(e=>{if(this.props.verticalScrollsHorizontally&&this.scrollElement){const t=0,a=1,n=(new Date).getTime();if(Math.abs(e.deltaX)>0?(this.likelyTrackpadUser=!0,this.checkAgainForTrackpad=n+6e4):this.likelyTrackpadUser&&n>=this.checkAgainForTrackpad&&(this.likelyTrackpadUser=!1),this.likelyTrackpadUser)return;if(Math.abs(e.deltaX)<=t){const t=e.deltaY<0?-50:50,n=Math.abs(e.deltaY)<25?e.deltaY+t:e.deltaY;this.scrollElement.scrollLeft+=n*a}}})),this.state={leftIndicatorOffset:"0",rightIndicatorOffset:"0"}}componentDidUpdate(e){r.a.Children.count(e.children)!==r.a.Children.count(this.props.children)&&this.checkOverflow()}componentDidMount(){this.checkOverflow(),Q.b.instance.on(Q.a.Resize,this.checkOverflow)}componentWillUnmount(){var e;null===(e=this.scrollElement)||void 0===e||e.removeEventListener("scroll",this.checkOverflow),Q.b.instance.off(Q.a.Resize,this.checkOverflow)}render(){const e=this.props,{children:t,trackHorizontalOverflow:a,verticalScrollsHorizontally:n}=e,i=ve()(e,wt),s={left:this.state.leftIndicatorOffset},o={right:this.state.rightIndicatorOffset},l=a?r.a.createElement("div",{className:"mx_IndicatorScrollbar_leftOverflowIndicator",style:s}):null,c=a?r.a.createElement("div",{className:"mx_IndicatorScrollbar_rightOverflowIndicator",style:o}):null;return r.a.createElement(St.a,Z()({},i,{ref:this.autoHideScrollbar,wrappedRef:this.collectScroller,onWheel:this.onMouseWheel}),l,t,c)}}const Ct=["onFinished","hideHeader"],xt=["selected","isPanelCollapsed"],kt=["children","isPanelCollapsed","setPanelCollapsed","isDraggingOver","innerRef"],jt=e=>{let{onFinished:t,hideHeader:a}=e,n=ve()(e,Ct);const i=Object(se.b)("Spaces.allRoomsInHome");return r.a.createElement(me.e,Z()({},n,{onFinished:t,className:"mx_SpacePanel_contextMenu",compact:!0}),!a&&r.a.createElement("div",{className:"mx_SpacePanel_contextMenu_header"},Object(N.a)("Home")),r.a.createElement(me.c,{first:!0},r.a.createElement(me.a,{iconClassName:"mx_SpacePanel_noIcon",label:Object(N.a)("Show all rooms"),active:i,onClick:()=>{b.b.setValue("Spaces.allRoomsInHome",null,f.a.ACCOUNT,!i)}})))},Rt=e=>{let{selected:t,isPanelCollapsed:a}=e,n=ve()(e,xt);return r.a.createElement("li",{className:c()("mx_SpaceItem",{collapsed:a}),role:"treeitem","aria-selected":t},r.a.createElement(Ie,Z()({},n,{selected:t,isNarrow:a})))},It=()=>$.a.instance.allRoomsInHome?De.a.instance.globalState:$.a.instance.getNotificationState(Y.a.Home),Tt=e=>{let{isPanelCollapsed:t,setPanelCollapsed:a}=e;const[n,i,o,l]=Object(ce.q)();let d;Object(s.useEffect)((()=>{!t&&n&&l()}),[t]),n&&(d=r.a.createElement(fe.d,{onFinished:l}));const m=n?l:()=>{t||a(!0),o()};return r.a.createElement("li",{className:c()("mx_SpaceItem mx_SpaceItem_new",{collapsed:t}),role:"treeitem"},r.a.createElement(Ie,{"data-testid":"create-space-button",className:c()("mx_SpaceButton_new",{mx_SpaceButton_newCancel:n}),label:n?Object(N.a)("Cancel"):Object(N.a)("Create a space"),onClick:m,isNarrow:t,ref:i}),d)},Nt={[Y.a.Home]:e=>{let{selected:t,isPanelCollapsed:a}=e;const n=Object(ie.b)($.a.instance,Y.b,(()=>$.a.instance.allRoomsInHome)),[i,o]=Object(s.useState)(It()),l=Object(s.useCallback)((()=>{o(It())}),[]);return Object(s.useEffect)(l,[l,n]),Object(ie.a)(De.a.instance,De.b,l),r.a.createElement(Rt,{spaceKey:Y.a.Home,className:"mx_SpaceButton_home",selected:t,isPanelCollapsed:a,label:Object(Y.g)(Y.a.Home,n),notificationState:i,ContextMenuComponent:jt,contextMenuTooltip:Object(N.a)("Options")})},[Y.a.Favourites]:e=>{let{selected:t,isPanelCollapsed:a}=e;return r.a.createElement(Rt,{spaceKey:Y.a.Favourites,className:"mx_SpaceButton_favourites",selected:t,isPanelCollapsed:a,label:Object(Y.g)(Y.a.Favourites),notificationState:$.a.instance.getNotificationState(Y.a.Favourites)})},[Y.a.People]:e=>{let{selected:t,isPanelCollapsed:a}=e;return r.a.createElement(Rt,{spaceKey:Y.a.People,className:"mx_SpaceButton_people",selected:t,isPanelCollapsed:a,label:Object(Y.g)(Y.a.People),notificationState:$.a.instance.getNotificationState(Y.a.People)})},[Y.a.Orphans]:e=>{let{selected:t,isPanelCollapsed:a}=e;return r.a.createElement(Rt,{spaceKey:Y.a.Orphans,className:"mx_SpaceButton_orphans",selected:t,isPanelCollapsed:a,label:Object(Y.g)(Y.a.Orphans),notificationState:$.a.instance.getNotificationState(Y.a.Orphans)})}},Dt=r.a.memo((e=>{let{children:t,isPanelCollapsed:a,setPanelCollapsed:n,isDraggingOver:i,innerRef:s}=e,o=ve()(e,kt);const[l,c,d,m]=(()=>{const e=Object(ie.b)($.a.instance,Y.c,(()=>$.a.instance.invitedSpaces)),[t,a]=Object(ie.b)($.a.instance,Y.f,(()=>[$.a.instance.enabledMetaSpaces,$.a.instance.spacePanelSpaces]));return[e,t,a,Object(ie.b)($.a.instance,Y.d,(()=>$.a.instance.activeSpace))]})(),u=m?[m]:[],h=c.map((e=>{const t=Nt[e];return r.a.createElement(t,{key:e,selected:m===e,isPanelCollapsed:a})}));return r.a.createElement(Ot,Z()({},o,{wrappedRef:s,className:"mx_SpaceTreeLevel",style:i?{pointerEvents:"none"}:void 0,element:"ul",role:"tree","aria-label":Object(N.a)("Spaces")}),h,l.map((e=>r.a.createElement(Te,{key:e.roomId,space:e,activeSpaces:u,isPanelCollapsed:a,onExpand:()=>n(!1)}))),d.map(((e,t)=>r.a.createElement(be.Draggable,{key:e.roomId,draggableId:e.roomId,index:t},((t,i)=>r.a.createElement(Te,Z()({},t.draggableProps,{dragHandleProps:t.dragHandleProps,key:e.roomId,innerRef:t.innerRef,className:i.isDragging?"mx_SpaceItem_dragging":void 0,space:e,activeSpaces:u,isPanelCollapsed:a,onExpand:()=>n(!1)})))))),t,Object(ae.a)(oe.a.CreateSpaces)&&r.a.createElement(Tt,{isPanelCollapsed:a,setPanelCollapsed:n}))}));var Pt=()=>{const[e,t]=Object(s.useState)(!0),a=Object(s.useRef)();return Object(s.useLayoutEffect)((()=>(Q.b.instance.trackElementDimensions("SpacePanel",a.current),()=>Q.b.instance.stopTrackingElementDimensions("SpacePanel"))),[]),Object(ne.a)(v.a,(a=>{a.action===U.a.ToggleSpacePanel&&t(!e)})),r.a.createElement(be.DragDropContext,{onDragEnd:e=>{e.destination&&$.a.instance.moveRootSpace(e.source.index,e.destination.index)}},r.a.createElement(xe.d,{handleHomeEnd:!0,handleUpDown:!0},(n=>{let{onKeyDownHandler:i}=n;return r.a.createElement("div",{className:c()("mx_SpacePanel",{collapsed:e}),onKeyDown:i,ref:a},r.a.createElement(_t,{isPanelCollapsed:e},r.a.createElement(q.a,{className:c()("mx_SpacePanel_toggleCollapse",{expanded:!e}),onClick:()=>t(!e),title:e?Object(N.a)("Expand"):Object(N.a)("Collapse"),tooltip:r.a.createElement("div",null,r.a.createElement("div",{className:"mx_Tooltip_title"},e?Object(N.a)("Expand"):Object(N.a)("Collapse")),r.a.createElement("div",{className:"mx_Tooltip_sub"},u.a?"⌘ + ⇧ + D":Object(N.a)(W.a[u.b.CONTROL])+" + "+Object(N.a)(W.a[u.b.SHIFT])+" + D"))})),r.a.createElement(be.Droppable,{droppableId:"top-level-spaces"},((a,n)=>r.a.createElement(Dt,Z()({},a.droppableProps,{isPanelCollapsed:e,setPanelCollapsed:t,isDraggingOver:n.isDraggingOver,innerRef:a.innerRef}),a.placeholder))),r.a.createElement(ot,{isPanelCollapsed:e}))})))};const Mt=e=>({left:e.left+window.scrollX,top:e.bottom+window.scrollY+12,chevronFace:ce.a.None});var At;!function(e){e[e.JoinRoom=0]="JoinRoom",e[e.BulkRedact=1]="BulkRedact"}(At||(At={}));var Lt=e=>{var t;let{onVisibilityChange:a}=e;const n=Object(s.useContext)(R.a),[i,l,c,d]=Object(ce.q)(),[m,u,h,p]=Object(ce.q)(),[g,b]=Object(ie.b)($.a.instance,Y.d,(()=>[$.a.instance.activeSpace,$.a.instance.activeSpaceRoom])),f=Object(ie.b)($.a.instance,Y.b,(()=>$.a.instance.allRoomsInHome)),y=Object(se.a)("feature_video_rooms"),E=Object(se.a)("feature_element_call_video_rooms"),_=(()=>{const e=Object(s.useContext)(R.a),[t,a]=Object(s.useState)(new Map),n=(e,n)=>{const i=new Set(t.get(e));i.add(n),a(new Map(t).set(e,i))},i=(e,n)=>{const i=new Set(t.get(e));i.delete(n)&&a(new Map(t).set(e,i))};return Object(ne.a)(v.a,(e=>{switch(e.action){case U.a.JoinRoom:n(At.JoinRoom,e.roomId);break;case U.a.JoinRoomReady:case U.a.JoinRoomError:i(At.JoinRoom,e.roomId);break;case U.a.BulkRedactStart:n(At.BulkRedact,e.roomId);break;case U.a.BulkRedactEnd:i(At.BulkRedact,e.roomId)}})),Object(ie.c)(e,o.b.Room,(e=>i(At.JoinRoom,e.roomId))),t})(),S=b||g===Y.a.Home;Object(s.useEffect)((()=>{i&&!S&&d()}),[d,S,i]);const w=Object(ie.d)(b,te.d.Name,(()=>null==b?void 0:b.name));Object(s.useEffect)((()=>{a&&a()}),[a]);const O=Object(ae.a)(oe.a.ExploreRooms),C=Object(ae.a)(oe.a.CreateRooms),x=Object(ae.a)(oe.a.CreateSpaces),k=null==b||null===(t=b.currentState)||void 0===t?void 0:t.maySendStateEvent(ee.b.SpaceChild,n.getUserId()),j=k&&C,I=k&&x,T=C||O||x||b;let D,P;if(i&&l.current){let e;e=b?ue.a:jt,D=r.a.createElement(e,Z()({},Mt(l.current.getBoundingClientRect()),{space:b,onFinished:d,hideHeader:!0}))}else if(m&&b){let e,t;Object(le.c)(b)&&(e=r.a.createElement(me.b,{label:Object(N.a)("Invite"),iconClassName:"mx_RoomListHeader_iconInvite",onClick:e=>{e.preventDefault(),e.stopPropagation(),Object(le.i)(b),p()}})),null!=b&&b.currentState.maySendStateEvent(ee.b.RoomAvatar,n.getUserId())&&(t=r.a.createElement(r.a.Fragment,null,r.a.createElement(me.b,{iconClassName:"mx_RoomListHeader_iconNewRoom",label:Object(N.a)("New room"),onClick:e=>{e.preventDefault(),e.stopPropagation(),Object(le.g)(b),re.b.trackInteraction("WebRoomListHeaderPlusMenuCreateRoomItem",e),p()}}),y&&r.a.createElement(me.b,{iconClassName:"mx_RoomListHeader_iconNewVideoRoom",label:Object(N.a)("New video room"),onClick:e=>{e.preventDefault(),e.stopPropagation(),Object(le.g)(b,E?ee.j.UnstableCall:ee.j.ElementVideo),p()}},r.a.createElement(de.a,null)))),D=r.a.createElement(me.e,Z()({},Mt(u.current.getBoundingClientRect()),{onFinished:p,compact:!0}),r.a.createElement(me.c,{first:!0},e,t,r.a.createElement(me.b,{label:Object(N.a)("Explore rooms"),iconClassName:"mx_RoomListHeader_iconExplore",onClick:e=>{e.preventDefault(),e.stopPropagation(),v.a.dispatch({action:U.a.ViewRoom,room_id:b.roomId,metricsTrigger:void 0}),p(),re.b.trackInteraction("WebRoomListHeaderPlusMenuExploreRoomsItem",e)}}),r.a.createElement(me.b,{label:Object(N.a)("Add existing room"),iconClassName:"mx_RoomListHeader_iconPlus",onClick:e=>{e.preventDefault(),e.stopPropagation(),Object(le.e)(b),p()},disabled:!j,tooltip:!j&&Object(N.a)("You do not have permissions to add rooms to this space")}),x&&r.a.createElement(me.b,{label:Object(N.a)("Add space"),iconClassName:"mx_RoomListHeader_iconPlus",onClick:e=>{e.preventDefault(),e.stopPropagation(),Object(le.h)(b),p()},disabled:!I,tooltip:!I&&Object(N.a)("You do not have permissions to add spaces to this space")},r.a.createElement(de.a,null))))}else if(m){let e,t;C&&(e=r.a.createElement(r.a.Fragment,null,r.a.createElement(me.b,{label:Object(N.a)("Start new chat"),iconClassName:"mx_RoomListHeader_iconStartChat",onClick:e=>{e.preventDefault(),e.stopPropagation(),v.a.dispatch({action:"view_create_chat"}),re.b.trackInteraction("WebRoomListHeaderPlusMenuCreateChatItem",e),p()}}),r.a.createElement(me.b,{label:Object(N.a)("New room"),iconClassName:"mx_RoomListHeader_iconNewRoom",onClick:e=>{e.preventDefault(),e.stopPropagation(),v.a.dispatch({action:"view_create_room"}),re.b.trackInteraction("WebRoomListHeaderPlusMenuCreateRoomItem",e),p()}}),y&&r.a.createElement(me.b,{label:Object(N.a)("New video room"),iconClassName:"mx_RoomListHeader_iconNewVideoRoom",onClick:e=>{e.preventDefault(),e.stopPropagation(),v.a.dispatch({action:"view_create_room",type:E?ee.j.UnstableCall:ee.j.ElementVideo}),p()}},r.a.createElement(de.a,null)))),O&&(t=r.a.createElement(me.b,{label:Object(N.a)("Join public room"),iconClassName:"mx_RoomListHeader_iconExplore",onClick:e=>{e.preventDefault(),e.stopPropagation(),v.a.dispatch({action:U.a.ViewRoomDirectory}),re.b.trackInteraction("WebRoomListHeaderPlusMenuExploreRoomsItem",e),p()}})),D=r.a.createElement(me.e,Z()({},Mt(u.current.getBoundingClientRect()),{onFinished:p,compact:!0}),r.a.createElement(me.c,{first:!0},e,t))}P=b?w:Object(Y.g)(g,f);const M=[..._.entries()].filter((e=>{let[t,a]=e;return a.size>0})).map((e=>{let[t,a]=e;switch(t){case At.JoinRoom:return Object(N.a)("Currently joining %(count)s rooms",{count:a.size});case At.BulkRedact:return Object(N.a)("Currently removing messages in %(count)s rooms",{count:a.size})}})).join("\n");let A=r.a.createElement("div",{className:"mx_RoomListHeader_contextLessTitle"},P);return S&&(A=r.a.createElement(ce.c,{inputRef:l,onClick:c,isExpanded:i,className:"mx_RoomListHeader_contextMenuButton",title:b?Object(N.a)("%(spaceName)s menu",{spaceName:null!=w?w:b.name}):Object(N.a)("Home options")},P)),r.a.createElement("div",{className:"mx_RoomListHeader"},A,M?r.a.createElement(pe.a,{label:M},r.a.createElement(he.a,null)):null,T&&r.a.createElement(ce.c,{inputRef:u,onClick:h,isExpanded:m,className:"mx_RoomListHeader_plusButton",title:Object(N.a)("Add")}),D)},Ut=a(472),Ft=a(661),Bt=a(185),Vt=a.n(Bt);function Wt(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function Ht(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?Wt(Object(a),!0).forEach((function(t){i()(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):Wt(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}const zt="mx_InteractiveTooltip_Container";function Gt(){let e=document.getElementById(zt);return e||(e=document.createElement("div"),e.id=zt,document.body.appendChild(e)),e}function Kt(e,t,a){const{top:n,right:i,bottom:s,left:r}=a;return e>=r&&e<=i&&t>=n&&t<=s}function qt(e){const{top:t,right:a,bottom:n,left:i}=e;return(n-t)/(a-i)}function $t(e,t,a){const{bottom:n,left:i}=a,s=-1*qt(a);return Kt(e,t,a)&&t<=n+s*(e-i)}function Yt(e,t,a){const{bottom:n,left:i}=a,s=-1*qt(a);return Kt(e,t,a)&&t>=n+s*(e-i)}function Jt(e,t,a){const{top:n,left:i}=a,s=1*qt(a);return Kt(e,t,a)&&t<=n+s*(e-i)}function Qt(e,t,a){const{top:n,left:i}=a,s=1*qt(a);return Kt(e,t,a)&&t>=n+s*(e-i)}let Xt;!function(e){e[e.Top=0]="Top",e[e.Left=1]="Left",e[e.Bottom=2]="Bottom",e[e.Right=3]="Right"}(Xt||(Xt={}));class Zt extends r.a.Component{constructor(e){super(e),i()(this,"target",void 0),i()(this,"collectContentRect",(e=>{e&&this.setState({contentRect:e.getBoundingClientRect()})})),i()(this,"collectTarget",(e=>{this.target=e})),i()(this,"onMouseMove",(e=>{const{clientX:t,clientY:a}=e,{contentRect:n}=this.state,i=this.target.getBoundingClientRect();let s;s=this.isOnTheSide?this.onLeftOfTarget()?Xt.Left:Xt.Right:this.aboveTarget()?Xt.Top:Xt.Bottom,function(e,t,a,n,i){const s=50;if(Kt(e,t,n))return!0;switch(a){case Xt.Left:{const a={top:i.top-s,right:i.right,bottom:i.bottom+s,left:i.left-s},r={top:i.top-s,right:n.right,bottom:n.top,left:i.right},o={top:n.top,right:n.left,bottom:n.bottom,left:i.right},l={top:n.bottom,right:n.right,bottom:i.bottom+s,left:i.right};if(Kt(e,t,a)||Qt(e,t,r)||Kt(e,t,o)||$t(e,t,l))return!0;break}case Xt.Right:{const a={top:i.top-s,right:i.right+s,bottom:i.bottom+s,left:i.left},r={top:i.top-s,right:i.left,bottom:n.top,left:n.left},o={top:n.top,right:i.left,bottom:n.bottom,left:n.right},l={top:n.bottom,right:i.left,bottom:i.bottom+s,left:n.left};if(Kt(e,t,a)||Yt(e,t,r)||Kt(e,t,o)||Jt(e,t,l))return!0;break}case Xt.Top:{const a={top:i.top-s,right:i.right+s,bottom:i.bottom,left:i.left-s},r={top:i.bottom,right:n.left,bottom:n.bottom,left:i.left-s},o={top:i.bottom,right:n.right,bottom:n.top,left:n.left},l={top:i.bottom,right:i.right+s,bottom:n.bottom,left:n.right};if(Kt(e,t,a)||Jt(e,t,r)||Kt(e,t,o)||$t(e,t,l))return!0;break}case Xt.Bottom:{const a={top:i.top,right:i.right+s,bottom:i.bottom+s,left:i.left-s},r={top:n.top,right:n.left,bottom:i.top,left:i.left-s},o={top:n.bottom,right:n.right,bottom:i.top,left:n.left},l={top:n.top,right:i.right+s,bottom:i.top,left:n.right};if(Kt(e,t,a)||Yt(e,t,r)||Kt(e,t,o)||Qt(e,t,l))return!0;break}}return!1}(t,a,s,i,n)||this.hideTooltip()})),i()(this,"onTargetMouseOver",(()=>{this.showTooltip()})),this.state={contentRect:null,visible:!1}}componentDidUpdate(){this.renderTooltip()}componentWillUnmount(){document.removeEventListener("mousemove",this.onMouseMove)}onLeftOfTarget(){const{contentRect:e}=this.state,t=this.target.getBoundingClientRect();if(this.props.direction===Xt.Left){const a=t.left+window.scrollX;return!e||a-e.width>20}{const a=t.right+window.scrollX,n=Q.b.instance.windowWidth-a;return e&&n-e.width<20}}aboveTarget(){const{contentRect:e}=this.state,t=this.target.getBoundingClientRect();if(this.props.direction===Xt.Top){const a=t.top+window.scrollY;return!e||a-e.height>20}{const a=t.bottom+window.scrollY,n=Q.b.instance.windowHeight-a;return e&&n-e.height<20}}get isOnTheSide(){return this.props.direction===Xt.Left||this.props.direction===Xt.Right}showTooltip(){var e,t;this.target&&(this.setState({visible:!0}),null===(e=(t=this.props).onVisibilityChange)||void 0===e||e.call(t,!0),document.addEventListener("mousemove",this.onMouseMove))}hideTooltip(){var e,t;this.setState({visible:!1}),null===(e=(t=this.props).onVisibilityChange)||void 0===e||e.call(t,!1),document.removeEventListener("mousemove",this.onMouseMove)}renderTooltip(){const{contentRect:e,visible:t}=this.state;if(!t)return Vt.a.unmountComponentAtNode(Gt()),null;const a=this.target.getBoundingClientRect(),n=a.left+window.scrollX,i=a.right+window.scrollX,s=a.bottom+window.scrollY,o=a.top+window.scrollY,l={};let d=null;this.isOnTheSide?(this.onLeftOfTarget()?(l.left=n,d=ce.a.Right):(l.left=i,d=ce.a.Left),l.top=o):(this.aboveTarget()?(l.bottom=Q.b.instance.windowHeight-o,d=ce.a.Bottom):(l.top=s,d=ce.a.Top),l.left=n+a.width/2);const m=r.a.createElement("div",{className:"mx_InteractiveTooltip_chevron_"+d}),u=c()({mx_InteractiveTooltip:!0,mx_InteractiveTooltip_withChevron_top:d===ce.a.Top,mx_InteractiveTooltip_withChevron_left:d===ce.a.Left,mx_InteractiveTooltip_withChevron_right:d===ce.a.Right,mx_InteractiveTooltip_withChevron_bottom:d===ce.a.Bottom}),h={};e&&!this.isOnTheSide&&(h.left=`-${e.width/2}px`);const p=r.a.createElement("div",{className:"mx_InteractiveTooltip_wrapper",style:Ht({},l)},r.a.createElement("div",{className:u,style:h,ref:this.collectContentRect},m,this.props.content));Vt.a.render(p,Gt())}render(){return this.props.children({ref:this.collectTarget,onMouseOver:this.onTargetMouseOver})}}i()(Zt,"defaultProps",{side:Xt.Top});var ea=a(318);var ta=()=>{const e=Object(s.useRef)(),t=Object(ie.b)(Ut.a.instance,pt.b,(()=>Ut.a.instance.rooms)),a=r.a.createElement("div",{className:"mx_RecentlyViewedButton_ContextMenu"},r.a.createElement("h4",null,Object(N.a)("Recently viewed")),r.a.createElement("div",null,t.map((t=>r.a.createElement(ce.d,{key:t.roomId,onClick:a=>{var n;v.a.dispatch({action:U.a.ViewRoom,room_id:t.roomId,metricsTrigger:"WebVerticalBreadcrumbs",metricsViaKeyboard:"click"!==a.type}),null===(n=e.current)||void 0===n||n.hideTooltip()}},t.isSpaceRoom()?r.a.createElement(ye.a,{room:t,width:24,height:24}):r.a.createElement(ea.a,{room:t,avatarSize:24,tooltipProps:{tabIndex:-1}}),r.a.createElement("span",{className:"mx_RecentlyViewedButton_entry_label"},r.a.createElement("div",null,t.name),r.a.createElement(Ft.a,{className:"mx_RecentlyViewedButton_entry_spaces",room:t})))))));return r.a.createElement(Zt,{content:a,direction:Xt.Right,ref:e},(e=>{let{ref:t,onMouseOver:a}=e;return r.a.createElement("span",{className:"mx_LeftPanel_recentsButton",title:Object(N.a)("Recently viewed"),ref:t,onMouseOver:a})}))},aa=a(224),na=a(840),ia=a(471);const sa=e=>{let{room:t,onClick:a}=e;const[n,i,s]=Object(xe.i)();return r.a.createElement(q.a,{className:"mx_RoomBreadcrumbs_crumb",onClick:a,"aria-label":Object(N.a)("Room %(name)s",{name:t.name}),title:t.name,tooltipClassName:"mx_RoomBreadcrumbs_Tooltip",onFocus:n,inputRef:s,tabIndex:i?0:-1},r.a.createElement(ea.a,{room:t,avatarSize:32,displayBadge:!0,forceCount:!0,tooltipProps:{tabIndex:i?0:-1}}))};class ra extends r.a.PureComponent{constructor(e){super(e),i()(this,"isMounted",!0),i()(this,"onBreadcrumbsUpdate",(()=>{this.isMounted&&(this.setState({doAnimation:!1,skipFirst:!0}),window.setTimeout((()=>this.setState({doAnimation:!0,skipFirst:!1})),0))})),i()(this,"viewRoom",(function(e,t){let a=arguments.length>2&&void 0!==arguments[2]&&arguments[2];v.a.dispatch({action:U.a.ViewRoom,room_id:e.roomId,metricsTrigger:"WebHorizontalBreadcrumbs",metricsViaKeyboard:a})})),this.state={doAnimation:!0,skipFirst:!1},Ut.a.instance.on(pt.b,this.onBreadcrumbsUpdate)}componentWillUnmount(){this.isMounted=!1,Ut.a.instance.off(pt.b,this.onBreadcrumbsUpdate)}render(){const e=Ut.a.instance.rooms.map(((e,t)=>r.a.createElement(sa,{key:e.roomId,room:e,onClick:a=>this.viewRoom(e,t,"click"!==a.type)})));return e.length>0?r.a.createElement(na.CSSTransition,{appear:!0,in:this.state.doAnimation,timeout:640,classNames:"mx_RoomBreadcrumbs"},r.a.createElement(ia.a,{className:"mx_RoomBreadcrumbs","aria-label":Object(N.a)("Recently visited rooms")},e.slice(this.state.skipFirst?1:0))):r.a.createElement("div",{className:"mx_RoomBreadcrumbs"},r.a.createElement("div",{className:"mx_RoomBreadcrumbs_placeholder"},Object(N.a)("No recently visited rooms")))}}var oa,la=a(176),ca=a(486);function da(e){let{selected:t,minimized:a}=e;const n=Object(se.b)("FTUE.useCaseSelection");return Object(se.b)("FTUE.userOnboardingButton")&&!a&&Object(ca.b)(n)?r.a.createElement(ma,{selected:t,minimized:a}):r.a.createElement(r.a.Fragment,null)}function ma(e){let{selected:t,minimized:a}=e;const n=Object(s.useCallback)((e=>{e.preventDefault(),e.stopPropagation(),re.b.trackInteraction("WebRoomListUserOnboardingIgnoreButton",e),b.b.setValue("FTUE.userOnboardingButton",null,f.a.ACCOUNT,!1)}),[]),i=Object(s.useCallback)((e=>{e.preventDefault(),e.stopPropagation(),re.b.trackInteraction("WebRoomListUserOnboardingButton",e),v.a.fire(U.a.ViewHomePage)}),[]);return r.a.createElement(G.a,{className:c()("mx_UserOnboardingButton",{mx_UserOnboardingButton_selected:t,mx_UserOnboardingButton_minimized:a}),onClick:i},!a&&r.a.createElement(r.a.Fragment,null,r.a.createElement("div",{className:"mx_UserOnboardingButton_content"},r.a.createElement(la.a,{size:"h4",className:"mx_Heading_h4"},Object(N.a)("Welcome")),r.a.createElement(G.a,{className:"mx_UserOnboardingButton_close",onClick:n}))))}!function(e){e[e.Disabled=0]="Disabled",e[e.Legacy=1]="Legacy",e[e.Labs=2]="Labs"}(oa||(oa={}));class ua extends s.Component{constructor(e){super(e),i()(this,"listContainerRef",Object(s.createRef)()),i()(this,"roomListRef",Object(s.createRef)()),i()(this,"focusedElement",null),i()(this,"isDoingStickyHeaders",!1),i()(this,"updateActiveSpace",(e=>{this.setState({activeSpace:e})})),i()(this,"onDialPad",(()=>{v.a.fire(U.a.OpenDialPad)})),i()(this,"onExplore",(e=>{v.a.fire(U.a.ViewRoomDirectory),re.b.trackInteraction("WebLeftPanelExploreRoomsButton",e)})),i()(this,"refreshStickyHeaders",(()=>{this.listContainerRef.current&&this.handleStickyHeaders(this.listContainerRef.current)})),i()(this,"onBreadcrumbsUpdate",(()=>{const e=ua.breadcrumbsMode;if(e!==this.state.showBreadcrumbs){if(this.setState({showBreadcrumbs:e}),!this.listContainerRef.current)return;this.handleStickyHeaders(this.listContainerRef.current)}})),i()(this,"onScroll",(e=>{const t=e.target;this.handleStickyHeaders(t)})),i()(this,"onFocus",(e=>{this.focusedElement=e.target})),i()(this,"onBlur",(()=>{this.focusedElement=null})),i()(this,"onKeyDown",((e,t)=>{if(!this.focusedElement)return;var a;Object(J.a)().getRoomListAction(e)===W.h.NextRoom&&(t||(e.stopPropagation(),e.preventDefault(),null===(a=this.roomListRef.current)||void 0===a||a.focus()))})),this.state={activeSpace:$.a.instance.activeSpace,showBreadcrumbs:ua.breadcrumbsMode},Ut.a.instance.on(pt.b,this.onBreadcrumbsUpdate),aa.c.instance.on(aa.b,this.onBreadcrumbsUpdate),$.a.instance.on(Y.d,this.updateActiveSpace)}static get breadcrumbsMode(){return Ut.a.instance.visible?b.b.getValue("feature_breadcrumbs_v2")?oa.Labs:oa.Legacy:oa.Disabled}componentDidMount(){var e;Q.b.instance.trackElementDimensions("ListContainer",this.listContainerRef.current),Q.b.instance.on("ListContainer",this.refreshStickyHeaders),null===(e=this.listContainerRef.current)||void 0===e||e.addEventListener("scroll",this.onScroll,{passive:!0})}componentWillUnmount(){var e;Ut.a.instance.off(pt.b,this.onBreadcrumbsUpdate),aa.c.instance.off(aa.b,this.onBreadcrumbsUpdate),$.a.instance.off(Y.d,this.updateActiveSpace),Q.b.instance.stopTrackingElementDimensions("ListContainer"),Q.b.instance.removeListener("ListContainer",this.refreshStickyHeaders),null===(e=this.listContainerRef.current)||void 0===e||e.removeEventListener("scroll",this.onScroll)}componentDidUpdate(e,t){t.activeSpace!==this.state.activeSpace&&this.refreshStickyHeaders()}handleStickyHeaders(e){this.isDoingStickyHeaders||(this.isDoingStickyHeaders=!0,window.requestAnimationFrame((()=>{this.doStickyHeaders(e),this.isDoingStickyHeaders=!1})))}doStickyHeaders(e){const t=e.scrollTop,a=e.offsetHeight+e.scrollTop,n=e.querySelectorAll(".mx_RoomSublist:not(.mx_RoomSublist_hidden)"),i=new Map;let s,r;for(const e of n){const o=e.querySelector(".mx_RoomSublist_stickable");o.style.removeProperty("display");const l=.4,c=e.offsetTop+l*V.a<=t,d=e.offsetTop+l*V.a>=a;c||e===n[0]?(i.set(o,{stickyTop:!0}),s&&(s.style.display="none",i.set(s,{makeInvisible:!0})),s=o):d&&!r?(i.set(o,{stickyBottom:!0}),r=o):i.set(o,{})}for(const t of i.keys()){const a=i.get(t);if(a.makeInvisible)t.style.display="none";else{if(a.stickyTop){t.classList.contains("mx_RoomSublist_headerContainer_stickyTop")||t.classList.add("mx_RoomSublist_headerContainer_stickyTop");const a=`${e.parentElement.offsetTop}px`;t.style.top!==a&&(t.style.top=a)}else t.classList.contains("mx_RoomSublist_headerContainer_stickyTop")&&t.classList.remove("mx_RoomSublist_headerContainer_stickyTop"),t.style.top&&t.style.removeProperty("top");if(a.stickyBottom){t.classList.contains("mx_RoomSublist_headerContainer_stickyBottom")||t.classList.add("mx_RoomSublist_headerContainer_stickyBottom");const a=`${Q.b.instance.windowHeight-(e.parentElement.offsetTop+e.parentElement.offsetHeight)}px`;t.style.bottom!==a&&(t.style.bottom=a)}else t.classList.contains("mx_RoomSublist_headerContainer_stickyBottom")&&t.classList.remove("mx_RoomSublist_headerContainer_stickyBottom"),t.style.bottom&&t.style.removeProperty("bottom");if(a.stickyTop||a.stickyBottom){t.classList.contains("mx_RoomSublist_headerContainer_sticky")||t.classList.add("mx_RoomSublist_headerContainer_sticky");const e=Q.b.instance.getElementDimensions("ListContainer");if(e){const a=15,n=`${e.width-a}px`;t.style.width!==n&&(t.style.width=n)}}else a.stickyTop||a.stickyBottom||(t.classList.contains("mx_RoomSublist_headerContainer_sticky")&&t.classList.remove("mx_RoomSublist_headerContainer_sticky"),t.style.width&&t.style.removeProperty("width"))}}const o=e.parentElement;s?o.classList.add("mx_LeftPanel_roomListWrapper_stickyTop"):o.classList.remove("mx_LeftPanel_roomListWrapper_stickyTop"),r?o.classList.add("mx_LeftPanel_roomListWrapper_stickyBottom"):o.classList.remove("mx_LeftPanel_roomListWrapper_stickyBottom")}renderBreadcrumbs(){if(this.state.showBreadcrumbs===oa.Legacy&&!this.props.isMinimized)return s.createElement(Ot,{className:"mx_LeftPanel_breadcrumbsContainer mx_AutoHideScrollbar",verticalScrollsHorizontally:!0},s.createElement(ra,null))}renderSearchDialExplore(){let e,t=null;return B.b.instance.getSupportsPstnProtocol()&&(t=s.createElement(q.a,{className:c()("mx_LeftPanel_dialPadButton",{}),onClick:this.onDialPad,title:Object(N.a)("Open dial pad")})),this.state.showBreadcrumbs===oa.Labs?e=s.createElement(ta,null):this.state.activeSpace===Y.a.Home&&Object(ae.a)(oe.a.ExploreRooms)&&(e=s.createElement(q.a,{className:"mx_LeftPanel_exploreButton",onClick:this.onExplore,title:Object(N.a)("Explore rooms")})),s.createElement("div",{className:"mx_LeftPanel_filterContainer",onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:this.onKeyDown},s.createElement(K,{isMinimized:this.props.isMinimized}),t,e)}render(){const e=s.createElement(F.b,{onKeyDown:this.onKeyDown,resizeNotifier:this.props.resizeNotifier,onFocus:this.onFocus,onBlur:this.onBlur,isMinimized:this.props.isMinimized,activeSpace:this.state.activeSpace,onResize:this.refreshStickyHeaders,onListCollapse:this.refreshStickyHeaders,ref:this.roomListRef}),t=c()({mx_LeftPanel:!0,mx_LeftPanel_minimized:this.props.isMinimized}),a=c()("mx_LeftPanel_actualRoomListContainer","mx_AutoHideScrollbar");return s.createElement("div",{className:t},s.createElement("div",{className:"mx_LeftPanel_roomListContainer"},this.renderSearchDialExplore(),this.renderBreadcrumbs(),!this.props.isMinimized&&s.createElement(Lt,{onVisibilityChange:this.refreshStickyHeaders}),s.createElement(da,{selected:this.props.pageType===h.a.HomePage,minimized:this.props.isMinimized}),s.createElement("div",{className:"mx_LeftPanel_roomListWrapper"},s.createElement("div",{className:a,ref:this.listContainerRef,tabIndex:-1},e))))}}var ha=a(821);class pa extends s.PureComponent{constructor(e){super(e),i()(this,"onUpdateToasts",(()=>{this.setState({toasts:ha.a.instance.components})})),this.state={toasts:ha.a.instance.components},ha.a.instance.on(pt.b,this.onUpdateToasts)}componentWillUnmount(){ha.a.instance.off(pt.b,this.onUpdateToasts)}render(){const e=this.state.toasts.map(((e,t)=>s.createElement("div",{className:"mx_NonUrgentToastContainer_toast",key:`toast-${t}`},s.createElement(e,{}))));return s.createElement("div",{className:"mx_NonUrgentToastContainer",role:"alert"},e)}}var ga=a(1),va=a(154);let ba;!function(e){e.CloseDialog="close_dialog",e.HostSignupAccountDetails="host_signup_account_details",e.HostSignupAccountDetailsRequest="host_signup_account_details_request",e.Minimize="host_signup_minimize",e.Maximize="host_signup_maximize",e.SetupComplete="setup_complete"}(ba||(ba={}));class fa extends r.a.PureComponent{constructor(e){super(e),i()(this,"iframeRef",r.a.createRef()),i()(this,"config",void 0),i()(this,"messageHandler",(async e=>{if(this.config.get("url").startsWith(e.origin))switch(e.data.action){case ba.HostSignupAccountDetailsRequest:this.onAccountDetailsRequest();break;case ba.Maximize:this.setState({minimized:!1});break;case ba.Minimize:this.setState({minimized:!0});break;case ba.SetupComplete:this.setState({completed:!0});break;case ba.CloseDialog:return this.closeDialog()}})),i()(this,"maximizeDialog",(()=>{this.setState({minimized:!1}),this.sendMessage({action:ba.Maximize})})),i()(this,"minimizeDialog",(()=>{this.setState({minimized:!0}),this.sendMessage({action:ba.Minimize})})),i()(this,"closeDialog",(async()=>(window.removeEventListener("message",this.messageHandler),vt.instance.setHostSignupActive(!1)))),i()(this,"onCloseClick",(async()=>{if(this.state.completed)return this.closeDialog();H.b.createDialog(va.a,{title:Object(N.a)("Confirm abort of host creation"),description:Object(N.a)("Are you sure you wish to abort creation of the host? The process cannot be continued."),button:Object(N.a)("Abort"),onFinished:e=>{if(e)return this.closeDialog()}})})),i()(this,"sendMessage",(e=>{this.iframeRef.current.contentWindow.postMessage(e,this.config.get("url"))})),i()(this,"onAccountDetailsDialogFinished",(async e=>e?this.sendAccountDetails():this.closeDialog())),i()(this,"onAccountDetailsRequest",(()=>{const e=this.config.get("cookie_policy_url"),t=this.config.get("privacy_policy_url"),a=this.config.get("terms_of_service_url"),n=r.a.createElement(r.a.Fragment,null,r.a.createElement("p",null,Object(N.a)("Continuing temporarily allows the %(hostSignupBrand)s setup process to access your account to fetch verified email addresses. This data is not stored.",{hostSignupBrand:this.config.get("brand")})),r.a.createElement("p",null,Object(N.a)("Learn more in our <privacyPolicyLink />, <termsOfServiceLink /> and <cookiePolicyLink />.",{},{cookiePolicyLink:()=>r.a.createElement("a",{href:e,target:"_blank",rel:"noreferrer noopener"},Object(N.a)("Cookie Policy")),privacyPolicyLink:()=>r.a.createElement("a",{href:t,target:"_blank",rel:"noreferrer noopener"},Object(N.a)("Privacy Policy")),termsOfServiceLink:()=>r.a.createElement("a",{href:a,target:"_blank",rel:"noreferrer noopener"},Object(N.a)("Terms of Service"))})));H.b.createDialog(va.a,{title:Object(N.a)("You should know"),description:n,button:Object(N.a)("Continue"),onFinished:this.onAccountDetailsDialogFinished})})),this.state={completed:!1,error:null,minimized:!1},this.config=mt.b.getObject("host_signup")}async sendAccountDetails(){const e=await lt.a.get().getOpenIdToken();if(!e||!e.access_token)return ga.a.warn("Failed to connect to homeserver for OpenID token."),void this.setState({completed:!0,error:Object(N.a)("Failed to connect to your homeserver. Please close this dialog and try again.")});this.sendMessage({action:ba.HostSignupAccountDetails,account:{accessToken:await lt.a.get().getAccessToken(),name:ht.a.instance.displayName,openIdToken:e.access_token,serverName:await lt.a.get().getDomain(),userLocalpart:await lt.a.get().getUserIdLocalpart(),termsAccepted:!0}})}componentDidMount(){window.addEventListener("message",this.messageHandler)}componentWillUnmount(){vt.instance.isHostSignupActive&&this.closeDialog()}render(){return r.a.createElement("div",{className:c()({mx_Dialog_wrapper:!this.state.minimized})},r.a.createElement("div",{className:c()("mx_Dialog",{mx_HostSignupDialog_minimized:this.state.minimized,mx_HostSignupDialog:!this.state.minimized})},this.state.minimized&&r.a.createElement("div",{className:"mx_Dialog_header mx_Dialog_headerWithButton"},r.a.createElement("div",{className:"mx_Dialog_title"},Object(N.a)("%(hostSignupBrand)s Setup",{hostSignupBrand:this.config.get("brand")})),r.a.createElement(G.a,{className:"mx_HostSignup_maximize_button",onClick:this.maximizeDialog,"aria-label":Object(N.a)("Maximise dialog"),title:Object(N.a)("Maximise dialog")})),!this.state.minimized&&r.a.createElement("div",{className:"mx_Dialog_header mx_Dialog_headerWithCancel"},r.a.createElement(G.a,{onClick:this.minimizeDialog,className:"mx_HostSignup_minimize_button","aria-label":Object(N.a)("Minimise dialog"),title:Object(N.a)("Minimise dialog")}),r.a.createElement(G.a,{onClick:this.onCloseClick,className:"mx_Dialog_cancelButton","aria-label":Object(N.a)("Close dialog"),title:Object(N.a)("Close dialog")})),this.state.error&&r.a.createElement("div",null,this.state.error),!this.state.error&&r.a.createElement("iframe",{title:Object(N.a)("Upgrade to %(hostSignupBrand)s",{hostSignupBrand:this.config.get("brand")}),src:this.config.get("url"),ref:this.iframeRef,sandbox:"allow-forms allow-scripts allow-same-origin allow-popups"})))}}var ya=()=>{const[e,t]=Object(s.useState)(vt.instance.isHostSignupActive);return Object(ie.a)(vt.instance,pt.b,(()=>{t(vt.instance.isHostSignupActive)})),r.a.createElement("div",{className:"mx_HostSignupContainer"},e&&r.a.createElement(fa,null))},Ea=a(188),_a=a(494);class Sa extends r.a.Component{constructor(e){super(e),i()(this,"element",Object(s.createRef)()),i()(this,"onAudioOutputChanged",(e=>{const t=this.element.current;if(e)try{t.setSinkId(e)}catch(e){ga.a.error("Couldn't set requested audio output device: using default",e),ga.a.warn("Couldn't set requested audio output device: using default",e)}})),i()(this,"onNewStream",(()=>{this.setState({audioMuted:this.props.feed.isAudioMuted()}),this.playMedia()})),this.state={audioMuted:this.props.feed.isAudioMuted()}}componentDidMount(){p.c.instance.addListener(p.a.AudioOutputChanged,this.onAudioOutputChanged),this.props.feed.addListener(_a.b.NewStream,this.onNewStream),this.playMedia()}componentWillUnmount(){p.c.instance.removeListener(p.a.AudioOutputChanged,this.onAudioOutputChanged),this.props.feed.removeListener(_a.b.NewStream,this.onNewStream),this.stopMedia()}async playMedia(){const e=this.element.current;if(e){this.onAudioOutputChanged(p.c.getAudioOutput()),e.muted=!1,e.srcObject=this.props.feed.stream,e.autoplay=!0;try{await e.load()}catch(e){ga.a.info(`Failed to play media element with feed for userId ${this.props.feed.userId} with purpose ${this.props.feed.purpose}`,e)}}}stopMedia(){const e=this.element.current;e&&(e.pause(),e.src=null)}render(){return this.state.audioMuted?null:r.a.createElement("audio",{ref:this.element})}}class wa extends r.a.Component{constructor(e){super(e),i()(this,"onFeedsChanged",(()=>{this.setState({feeds:this.props.call.getRemoteFeeds()})})),this.state={feeds:this.props.call.getRemoteFeeds()}}componentDidMount(){this.props.call.addListener(Ea.d.FeedsChanged,this.onFeedsChanged)}componentWillUnmount(){this.props.call.removeListener(Ea.d.FeedsChanged,this.onFeedsChanged)}render(){return this.state.feeds.map(((e,t)=>r.a.createElement(Sa,{feed:e,key:t})))}}var Oa=a(143),Ca=a(175),xa=a(170),ka=a(160),ja=a(367),Ra=a(167),Ia=a(283),Ta=a(284),Na=a(460);class Da extends r.a.Component{constructor(){super(...arguments),i()(this,"onResizeStart",(()=>{this.props.resizeNotifier.startResizing()})),i()(this,"onResize",(()=>{this.props.resizeNotifier.notifyRightHandleResized()})),i()(this,"onResizeStop",((e,t,a,n)=>{this.props.resizeNotifier.stopResizing(),window.localStorage.setItem("mx_rhs_size",(this.loadSidePanelSize().width+n.width).toString())}))}loadSidePanelSize(){let e=parseInt(window.localStorage.getItem("mx_rhs_size"),10);return isNaN(e)&&(e=350),{height:"100%",width:e}}render(){const e=r.a.Children.only(this.props.children),t=this.props.panel;let a;return!this.props.collapsedRhs&&t&&(a=r.a.createElement(Na.Resizable,{defaultSize:this.loadSidePanelSize(),minWidth:264,maxWidth:"50%",enable:{top:!1,right:!1,bottom:!1,left:!0,topRight:!1,bottomRight:!1,bottomLeft:!1,topLeft:!1},onResizeStart:this.onResizeStart,onResize:this.onResize,onResizeStop:this.onResizeStop,className:"mx_RightPanel_ResizeWrapper",handleClasses:{left:"mx_ResizeHandle_horizontal"}},t)),r.a.createElement("div",{className:"mx_MainSplit"},e,a)}}var Pa=a(186),Ma=a(181),Aa=a(174);function La(e,t){const[a,n]=Object(s.useState)(t?e.isRoomEncrypted(t.roomId):void 0),i=Object(s.useCallback)((a=>{t&&a.getType()===ee.b.RoomEncryption&&n(e.isRoomEncrypted(t.roomId))}),[e,t]);return Object(ie.c)(null==t?void 0:t.currentState,m.b.Events,i),a}var Ua=a(371);const Fa=e=>{let{className:t,title:a,children:n}=e;return r.a.createElement("div",{className:c()("mx_BaseCard_Group",t)},r.a.createElement("h1",null,a),n)};var Ba=Object(s.forwardRef)(((e,t)=>{let a,{closeLabel:n,onClose:i,onBack:s,className:o,header:l,footer:d,withoutScrollContainer:m,children:u,onKeyDown:h}=e;const p=Aa.a.instance.roomPhaseHistory;if(p.length>1){var g;const e=p[p.length-2],t=e=>{null==s||s(e),Aa.a.instance.popCard()},n=null!==(g=Object(Ma.b)(e.phase))&&void 0!==g?g:Object(N.a)("Back");a=r.a.createElement(G.a,{className:"mx_BaseCard_back",onClick:t,title:n})}let v;return i&&(v=r.a.createElement(G.a,{"data-testid":"base-card-close-button",className:"mx_BaseCard_close",onClick:i,title:n||Object(N.a)("Close")})),m||(u=r.a.createElement(St.a,null,u)),r.a.createElement(Ua.a.Provider,{value:{isCard:!0}},r.a.createElement("div",{className:c()("mx_BaseCard",o),ref:t,onKeyDown:h},r.a.createElement("div",{className:"mx_BaseCard_header"},a,v,l),u,d&&r.a.createElement("div",{className:"mx_BaseCard_footer"},d)))})),Va=a(560),Wa=a(183),Ha=a(282),za=a(244),Ga=a(163);const Ka=["app","className","width","height"];var qa=e=>{let{app:t,className:n,width:i=20,height:s=20}=e,o=ve()(e,Ka),l=[a(1520).default];return t.type.includes("jitsi")?l=[a(1521).default]:t.type.includes("meeting")||t.type.includes("calendar")?l=[a(1522).default]:t.type.includes("pad")||t.type.includes("doc")||t.type.includes("calc")?l=[a(1523).default]:t.type.includes("clock")&&(l=[a(1524).default]),r.a.createElement(gt.a,Z()({},o,{name:t.id,className:c()("mx_WidgetAvatar",n),url:t.avatar_url?Object(Ga.b)(t.avatar_url).getSquareThumbnailHttp(20):void 0,urls:l,width:i,height:s}))},$a=a(233),Ya=a(165);let Ja;!function(e){e.Warning="warning",e.Verified="verified",e.Normal="normal"}(Ja||(Ja={}));var Qa=a(138),Xa=a(6),Za=a(267),en=a(144),tn=a(205),an=a(207),nn=a(2);function sn(){return mt.b.get("audio_stream_url")}async function rn(e,t){const a=await async function(e){const t=await lt.a.get().getOpenIdToken(),a=sn()+"/createStream",n=await window.fetch(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({room_id:e,openid_token:t})});return(await n.json()).stream_id}(t);await e.transport.send(nn.a.StartLiveStream,{rtmpStreamKey:"rtmp://audiostream.dummy/"+a})}const on=["onFinished","app","userWidget","onDeleteClick","onEditClick","showUnpin"];var ln=e=>{var t;let{onFinished:a,app:n,userWidget:i,onDeleteClick:o,onEditClick:l,showUnpin:c}=e,d=ve()(e,on);const m=Object(s.useContext)(R.a),{room:u,roomId:h}=Object(s.useContext)(Qa.b),p=Za.a.instance.getMessagingForUid(Wa.a.getWidgetUid(n)),g=i||Wa.a.canUserModifyWidgets(h);let f;if(sn()&&tn.a.JITSI.matches(n.type)){const e=async()=>{try{await rn(p,h)}catch(e){ga.a.error("Failed to start livestream",e);const t=e.message||Object(N.a)("Unable to start audio streaming.");H.b.createDialog(en.a,{title:Object(N.a)("Failed to start livestream"),description:t})}a()};f=r.a.createElement(me.b,{onClick:e,label:Object(N.a)("Start audio stream")})}const y=an.d.instance.getContainerWidgets(u,an.a.Top),E=y.findIndex((e=>e.id===n.id));let _,S;if(g&&Wa.a.isManagedByManager(n)){const e=()=>{l?l():Wa.a.editWidget(u,n),a()};_=r.a.createElement(me.b,{onClick:e,label:Object(N.a)("Edit")})}if(b.b.getValue("enableWidgetScreenshots")&&null!=p&&p.hasCapability(Xa.MatrixCapabilities.Screenshots)){const e=()=>{null==p||p.takeScreenshot().then((e=>{v.a.dispatch({action:"picture_snapshot",file:e.screenshot})})).catch((e=>{ga.a.error("Failed to take screenshot: ",e)})),a()};S=r.a.createElement(me.b,{onClick:e,label:Object(N.a)("Take a picture")})}let w;if(o||g){const e=()=>{o?o():H.b.createDialog(va.a,{title:Object(N.a)("Delete Widget"),description:Object(N.a)("Deleting a widget removes it for all users in this room. Are you sure you want to delete this widget?"),button:Object(N.a)("Delete widget"),onFinished:e=>{e&&Wa.a.setRoomWidget(h,n.id)}}),a()};w=r.a.createElement(me.b,{onClick:e,label:i?Object(N.a)("Remove"):Object(N.a)("Remove for everyone")})}const O=void 0!==n.eventId&&null!==(t=b.b.getValue("allowedWidgets",h)[n.eventId])&&void 0!==t&&t||n.creatorUserId===m.getUserId(),C=tn.a.JITSI.matches(n.type);let x,k,j;if(!i&&!C&&O){const e=()=>{ga.a.info("Revoking permission for widget to load: "+n.eventId);const e=b.b.getValue("allowedWidgets",h);void 0!==n.eventId&&(e[n.eventId]=!1);const t=b.b.firstSupportedLevel("allowedWidgets");b.b.setValue("allowedWidgets",h,t,e).catch((e=>{ga.a.error(e)})),a()};x=r.a.createElement(me.b,{onClick:e,label:Object(N.a)("Revoke permissions")})}if(c&&E>0){const e=()=>{an.d.instance.moveWithinContainer(u,an.a.Top,n,-1),a()};k=r.a.createElement(me.b,{onClick:e,label:Object(N.a)("Move left")})}if(c&&E<y.length-1){const e=()=>{an.d.instance.moveWithinContainer(u,an.a.Top,n,1),a()};j=r.a.createElement(me.b,{onClick:e,label:Object(N.a)("Move right")})}return r.a.createElement(me.e,Z()({},d,{chevronFace:ce.a.None,onFinished:a}),r.a.createElement(me.c,null,f,_,x,w,S,k,j))};const cn=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:250;const[a,n]=Object(s.useState)(e.getJoinedMemberCount());return Object(ie.c)(e.currentState,m.b.Update,Object(k.throttle)((()=>{n(e.getJoinedMemberCount())}),t,{leading:!0,trailing:!0})),a},dn=e=>{const[t,a]=Object(s.useState)(e.getMyMembership());return Object(ie.c)(e,te.d.MyMembership,(()=>{a(e.getMyMembership())})),t};var mn=a(628),un=a(882),hn=a(883),pn=a(134),gn=a(187);class vn{static isPinnable(e){return!!e&&(!!this.pinnableEventTypes.includes(e.getType())&&!e.isRedacted())}}i()(vn,"pinnableEventTypes",[ee.b.RoomMessage,gn.e.name,gn.e.altName]);var bn=a(248),fn=a(927),yn=a(171),En=a(161),_n=a(210);class Sn extends r.a.Component{constructor(){super(...arguments),i()(this,"context",void 0),i()(this,"onTileClicked",(()=>{v.a.dispatch({action:U.a.ViewRoom,event_id:this.props.event.getId(),highlighted:!0,room_id:this.props.event.getRoomId(),metricsTrigger:void 0})})),i()(this,"relations",new Map),i()(this,"getRelationsForEvent",((e,t,a)=>{var n;if(e===this.props.event.getId())return null===(n=this.relations.get(t))||void 0===n?void 0:n.get(a)}))}render(){var e;const t=this.props.event.getSender();let a=null;return this.props.onUnpinClicked&&(a=r.a.createElement(q.a,{onClick:this.props.onUnpinClicked,className:"mx_PinnedEventTile_unpinButton",title:Object(N.a)("Unpin")})),r.a.createElement("div",{className:"mx_PinnedEventTile"},r.a.createElement(yn.b,{className:"mx_PinnedEventTile_senderAvatar",member:this.props.event.sender,width:24,height:24,fallbackUserId:t}),r.a.createElement("span",{className:"mx_PinnedEventTile_sender "+Object(_n.f)(t)},(null===(e=this.props.event.sender)||void 0===e?void 0:e.name)||t),a,r.a.createElement("div",{className:"mx_PinnedEventTile_message"},r.a.createElement(fn.a,{mxEvent:this.props.event,getRelationsForEvent:this.getRelationsForEvent,className:"mx_PinnedEventTile_body",maxImageHeight:150,onHeightChanged:()=>{},permalinkCreator:this.props.permalinkCreator,replacingEventId:this.props.event.replacingEventId()})),r.a.createElement("div",{className:"mx_PinnedEventTile_footer"},r.a.createElement("span",{className:"mx_MessageTimestamp mx_PinnedEventTile_timestamp"},Object(En.a)(new Date(this.props.event.getTs()))),r.a.createElement(G.a,{onClick:this.onTileClicked,kind:"link"},Object(N.a)("View message"))))}}i()(Sn,"contextType",R.a);var wn=a(311),On=a(759);function Cn(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function xn(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?Cn(Object(a),!0).forEach((function(t){i()(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):Cn(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}const kn=e=>{const[t,a]=Object(s.useState)([]),n=Object(s.useCallback)((t=>{var n,i;e&&(t&&t.getType()!==ee.b.RoomPinnedEvents||a((null===(n=e.currentState.getStateEvents(ee.b.RoomPinnedEvents,""))||void 0===n||null===(i=n.getContent())||void 0===i?void 0:i.pinned)||[]))}),[e]);return Object(ie.c)(null==e?void 0:e.currentState,m.b.Events,n),Object(s.useEffect)((()=>(n(),()=>{a([])})),[n]),t},jn=e=>{const[t,a]=Object(s.useState)(new Set),n=Object(s.useCallback)((t=>{var n,i;if(!e)return;if(t&&t.getType()!==On.a)return;const s=null===(n=e.getAccountData(On.a))||void 0===n||null===(i=n.getContent())||void 0===i?void 0:i.event_ids;a(new Set(s||[]))}),[e]);return Object(ie.c)(e,te.d.AccountData,n),Object(s.useEffect)((()=>(n(),()=>{a(new Set)})),[n]),t};var Rn=e=>{let{room:t,onClose:a,permalinkCreator:n}=e;const i=Object(s.useContext)(R.a),o=Object(s.useContext)(Qa.b),l=Object(wn.a)(t,(e=>e.mayClientSendStateEvent(ee.b.RoomPinnedEvents,i))),c=kn(t),d=jn(t);Object(s.useEffect)((()=>{c.filter((e=>!d.has(e))).length>0&&i.setRoomAccountData(t.roomId,On.a,{event_ids:c})}),[i,t.roomId,c,d]);const m=Object(bn.a)((()=>{const e=c.map((async e=>{var a;const n=t.getUnfilteredTimelineSet(),s=null==n||null===(a=n.getTimelineForEvent(e))||void 0===a?void 0:a.getEvents().find((t=>t.getId()===e));if(s)return vn.isPinnable(s)?s:null;try{const[a,{events:[n]}]=await Promise.all([i.fetchRoomEvent(t.roomId,e),i.relations(t.roomId,e,ee.h.Replace,null,{limit:1})]),s=new Oa.b(a);if(s.isEncrypted()&&await i.decryptEventIfNeeded(s),await t.processPollEvents([s]),s&&vn.isPinnable(s))return s.sender=t.getMember(s.getSender()),n&&s.makeReplaced(n),s}catch(a){ga.a.error("Error looking up pinned event "+e+" in room "+t.roomId),ga.a.error(a)}return null}));return Promise.all(e)}),[i,t,c],null);let u;if(m)if(m.length>0){const e=async e=>{var a;const n=t.currentState.getStateEvents(ee.b.RoomPinnedEvents,"");if(null!=n&&null!==(a=n.getContent())&&void 0!==a&&a.pinned){const a=n.getContent().pinned,s=a.indexOf(e.getId());-1!==s&&(a.splice(s,1),await i.sendStateEvent(t.roomId,ee.b.RoomPinnedEvents,{pinned:a},""))}};u=m.filter(Boolean).reverse().map((t=>r.a.createElement(Sn,{key:t.getId(),event:t,onUnpinClicked:l?()=>e(t):void 0,permalinkCreator:n})))}else u=r.a.createElement("div",{className:"mx_PinnedMessagesCard_empty_wrapper"},r.a.createElement("div",{className:"mx_PinnedMessagesCard_empty"},r.a.createElement("div",{className:"mx_MessageActionBar mx_PinnedMessagesCard_MessageActionBar"},r.a.createElement("div",{className:"mx_MessageActionBar_iconButton"},r.a.createElement(un.a,null)),r.a.createElement("div",{className:"mx_MessageActionBar_iconButton"},r.a.createElement(hn.a,null)),r.a.createElement("div",{className:"mx_MessageActionBar_iconButton mx_MessageActionBar_optionsButton"},r.a.createElement(mn.a,null))),r.a.createElement(la.a,{size:"h4",className:"mx_PinnedMessagesCard_empty_header"},Object(N.a)("Nothing pinned, yet")),Object(N.a)("If you have permissions, open the menu on any message and select <b>Pin</b> to stick them here.",{},{b:e=>r.a.createElement("b",null,e)})));else u=r.a.createElement(pn.a,null);return r.a.createElement(Ba,{header:r.a.createElement("div",{className:"mx_BaseCard_header_title"},r.a.createElement(la.a,{size:"h4",className:"mx_BaseCard_header_title_heading"},Object(N.a)("Pinned messages"))),className:"mx_PinnedMessagesCard",onClose:a},r.a.createElement(Qa.b.Provider,{value:xn(xn({},o),{},{timelineRenderingType:Qa.a.Pinned})},u))},In=a(281),Tn=a(135),Nn=a(145),Dn=a(139),Pn=a(334),Mn=a(906),An=a(200),Ln=a(1525),Un=a(639),Fn=a(237);class Bn extends Un.a{constructor(e,t,a,n){super(e,t,a,n),i()(this,"totalSize",0),i()(this,"messages",[])}get destinationFileName(){return this.makeFileNameNoExtension()+".json"}createJSONString(){var e,t,a,n,i,s,r;const o=Object(En.f)(new Date),l=null===(e=this.room.currentState.getStateEvents(ee.b.RoomCreate,""))||void 0===e?void 0:e.getSender(),c=(null===(t=this.room)||void 0===t||null===(a=t.getMember(l))||void 0===a?void 0:a.rawDisplayName)||l,d=(null===(n=this.room.currentState.getStateEvents(ee.b.RoomTopic,""))||void 0===n||null===(i=n.getContent())||void 0===i?void 0:i.topic)||"",m=this.client.getUserId(),u=(null===(s=this.room)||void 0===s||null===(r=s.getMember(m))||void 0===r?void 0:r.rawDisplayName)||m,h={room_name:this.room.name,room_creator:c,topic:d,export_date:o,exported_by:u,messages:this.messages};return JSON.stringify(h,null,2)}async getJSONString(e){if(this.exportOptions.attachmentsIncluded&&this.isAttachment(e))try{const t=await this.getMediaBlob(e);if(this.totalSize+t.size<this.exportOptions.maxSize){this.totalSize+=t.size;const a=this.getFilePath(e);this.totalSize==this.exportOptions.maxSize&&(this.exportOptions.attachmentsIncluded=!1),this.addFile(a,t)}}catch(e){ga.a.log("Error fetching file: "+e)}const t=e.toJSON();return e.isEncrypted()?t.decrypted:t}async createOutput(e){for(let t=0;t<e.length;t++){const a=e[t];if(this.updateProgress(Object(N.a)("Processing event %(number)s out of %(total)s",{number:t+1,total:e.length}),!1,!0),this.cancelled)return this.cleanUp();Object(Fn.c)(a,!1)&&this.messages.push(await this.getJSONString(a))}return this.createJSONString()}async export(){ga.a.info("Starting export process..."),ga.a.info("Fetching events...");const e=performance.now(),t=await this.getRequiredEvents(),a=performance.now();ga.a.log(`Fetched ${t.length} events in ${(a-e)/1e3}s`),ga.a.info("Creating output...");const n=await this.createOutput(t);if(this.files.length)this.addFile("export.json",new Blob([n])),await this.downloadZIP();else{const e=this.destinationFileName;this.downloadPlainText(e,n)}const i=performance.now();this.cancelled?ga.a.info("Export cancelled successfully"):(ga.a.info("Export successful!"),ga.a.log(`Exported ${t.length} events in ${(i-e)/1e3} seconds`)),this.cleanUp()}}var Vn=a(295);class Wn extends Un.a{constructor(e,t,a,n){super(e,t,a,n),i()(this,"totalSize",void 0),i()(this,"mediaOmitText",void 0),i()(this,"textForReplyEvent",(e=>{const t=/> <(.*?)>(.*?)\n\n(.*)/s.exec(e.body);if(!t)return e.body;let a;const n=t[1],i=t[3];a=t[2].substring(1);const s=a.split("\n").filter((e=>!/^\s*$/.test(e)));return s.length>0?(a=s[0].substring(0,32),s[0].length>32&&(a+="..."),a=` "${a}"`):a="",`<${n}${a}> ${i}`})),i()(this,"plainTextForEvent",(async e=>{const t=e.sender&&e.sender.name?e.sender.name:e.getSender();let a="";if(this.isAttachment(e))if(this.exportOptions.attachmentsIncluded)try{const t=await this.getMediaBlob(e);if(this.totalSize+t.size>this.exportOptions.maxSize)a=` (${this.mediaOmitText})`;else{this.totalSize+=t.size;const n=this.getFilePath(e);a=" ("+Object(N.a)("File Attached")+")",this.addFile(n,t),this.totalSize==this.exportOptions.maxSize&&(this.exportOptions.attachmentsIncluded=!1)}}catch(e){a=" ("+Object(N.a)("Error fetching file")+")",ga.a.log("Error fetching file "+e)}else a=` (${this.mediaOmitText})`;return this.isReply(e)?t+": "+this.textForReplyEvent(e.getContent())+a:Object(Vn.b)(e)+a})),this.totalSize=0,this.mediaOmitText=this.exportOptions.attachmentsIncluded?Object(N.a)("Media omitted - file size limit exceeded"):Object(N.a)("Media omitted")}get destinationFileName(){return this.makeFileNameNoExtension()+".txt"}async createOutput(e){let t="";for(let a=0;a<e.length;a++){const n=e[a];if(this.updateProgress(Object(N.a)("Processing event %(number)s out of %(total)s",{number:a+1,total:e.length}),!1,!0),this.cancelled)return this.cleanUp();if(!Object(Fn.c)(n,!1))continue;const i=await this.plainTextForEvent(n);t+=i&&`${new Date(n.getTs()).toLocaleString()} - ${i}\n`}return t}async export(){this.updateProgress(Object(N.a)("Starting export process…")),this.updateProgress(Object(N.a)("Fetching events…"));const e=performance.now(),t=await this.getRequiredEvents(),a=performance.now();ga.a.log(`Fetched ${t.length} events in ${(a-e)/1e3}s`),this.updateProgress(Object(N.a)("Creating output…"));const n=await this.createOutput(t);if(this.files.length)this.addFile("export.txt",new Blob([n])),await this.downloadZIP();else{const e=this.destinationFileName;this.downloadPlainText(e,n)}const i=performance.now();this.cancelled?ga.a.info("Export cancelled successfully"):(ga.a.info("Export successful!"),ga.a.log(`Exported ${t.length} events in ${(i-e)/1e3} seconds`)),this.cleanUp()}}var Hn=a(212);var zn=()=>({});const Gn=(e,t)=>a=>"number"==typeof a&&!(isNaN(a)||e>a||a>t);var Kn=e=>{let{room:t,onFinished:a}=e;const{exportFormat:n,exportType:i,includeAttachments:o,numberOfMessages:l,sizeLimit:c,setExportFormat:d,setExportType:m,setNumberOfMessages:u,setSizeLimit:h,setAttachments:p}=(()=>{var e,t,a,n,i;const r=zn(),[o,l]=Object(s.useState)(null!==(e=r.format)&&void 0!==e?e:Mn.a.Html),[c,d]=Object(s.useState)(null!==(t=r.range)&&void 0!==t?t:Mn.b.Timeline),[m,u]=Object(s.useState)(null!==(a=r.includeAttachments)&&void 0!==a&&a),[h,p]=Object(s.useState)(null!==(n=r.numberOfMessages)&&void 0!==n?n:100),[g,v]=Object(s.useState)(null!==(i=r.sizeMb)&&void 0!==i?i:8);return{exportFormat:o,exportType:c,includeAttachments:m,numberOfMessages:h,sizeLimit:g,setExportFormat:r.format?void 0:l,setExportType:r.range?void 0:d,setNumberOfMessages:r.numberOfMessages?void 0:p,setSizeLimit:r.sizeMb?void 0:v,setAttachments:void 0===r.includeAttachments?u:void 0}})(),[g,v]=Object(s.useState)(!1),b=Object(s.useRef)(),f=Object(s.useRef)(),[y,E]=Object(s.useState)(Object(N.a)("Processing…")),[_,S]=Object(s.useState)(!1),[w,O]=Object(s.useState)(!1),[C,x]=Object(s.useState)(!1),[k,j]=((e,t)=>{const[a,n]=Object(s.useState)(e);return[a,e=>{n(e),t(e)}]})(null,(async e=>{await(null==e?void 0:e.export().then((()=>{w||x(!0)})))})),R=async()=>{if(!h||await b.current.validate({focused:!1})){if(i===Mn.b.LastNMessages){if(!await f.current.validate({focused:!1}))return void f.current.validate({focused:!0})}v(!0),await(async()=>{const e={numberOfMessages:l,attachmentsIncluded:o,maxSize:1024*c*1024};switch(n){case Mn.a.Html:j(new Ln.a(t,Mn.b[i],e,E));break;case Mn.a.Json:j(new Bn(t,Mn.b[i],e,E));break;case Mn.a.PlainText:j(new Wn(t,Mn.b[i],e,E));break;default:return void ga.a.error("Unknown export format")}})()}else b.current.validate({focused:!0})},I=Object(An.a)({rules:[{key:"required",test(e){let{value:t,allowEmpty:a}=e;return a||!!t},invalid:()=>Object(N.a)("Enter a number between %(min)s and %(max)s",{min:1,max:2e3})},{key:"number",test:e=>{let{value:t}=e;const a=parseInt(t,10);return Gn(1,2e3)(a)},invalid:()=>Object(N.a)("Size can only be a number between %(min)s MB and %(max)s MB",{min:1,max:2e3})}]}),T=async e=>await I(e),D=Object(An.a)({rules:[{key:"required",test(e){let{value:t,allowEmpty:a}=e;return a||!!t},invalid:()=>Object(N.a)("Enter a number between %(min)s and %(max)s",{min:1,max:10**8})},{key:"number",test:e=>{let{value:t}=e;const a=parseInt(t,10);return Gn(1,10**8)(a)},invalid:()=>Object(N.a)("Number of messages can only be a number between %(min)s and %(max)s",{min:1,max:10**8})}]}),P=async e=>await D(e),M=async()=>{g?S(!0):a(!1)},A=async()=>{await(null==k?void 0:k.cancelExport()),O(!0),v(!1),j(null)},L=Object.values(Mn.a).map((e=>({value:e,label:Object(Mn.c)(e)}))),U=Object.values(Mn.b).map((e=>r.a.createElement("option",{key:Mn.b[e],value:e},Object(Mn.d)(e))));let F=null;i===Mn.b.LastNMessages&&u&&(F=r.a.createElement(Dn.a,{id:"message-count",element:"input",type:"number",value:l.toString(),ref:f,onValidate:P,label:Object(N.a)("Number of messages"),onChange:e=>{u(parseInt(e.target.value))}}));const B=r.a.createElement("span",null,Object(N.a)("MB"));return w?r.a.createElement(Hn.a,{title:Object(N.a)("Export Cancelled"),description:Object(N.a)("The export was cancelled successfully"),hasCloseButton:!0,onFinished:a}):C?r.a.createElement(Hn.a,{title:Object(N.a)("Export Successful"),description:Object(N.a)("Your export was successful. Find it in your Downloads folder."),hasCloseButton:!0,onFinished:a}):_?r.a.createElement(Tn.a,{title:Object(N.a)("Warning"),className:"mx_ExportDialog",contentId:"mx_Dialog_content",onFinished:a,fixedWidth:!0},r.a.createElement("p",null,Object(N.a)("Are you sure you want to stop exporting your data? If you do, you'll need to start over.")),r.a.createElement(Nn.a,{primaryButton:Object(N.a)("Stop"),primaryButtonClass:"danger",hasCancel:!0,cancelButton:Object(N.a)("Continue"),onCancel:()=>S(!1),onPrimaryButtonClick:A})):r.a.createElement(Tn.a,{title:g?Object(N.a)("Exporting your data"):Object(N.a)("Export Chat"),className:`mx_ExportDialog ${g&&"mx_ExportDialog_Exporting"}`,contentId:"mx_Dialog_content",hasCancel:!0,onFinished:a,fixedWidth:!0},g?null:r.a.createElement("p",null,Object(N.a)("Select from the options below to export chats from your timeline")),r.a.createElement("div",{className:"mx_ExportDialog_options"},!!d&&r.a.createElement(r.a.Fragment,null,r.a.createElement("span",{className:"mx_ExportDialog_subheading"},Object(N.a)("Format")),r.a.createElement(Pn.a,{name:"exportFormat",value:n,onChange:e=>d(Mn.a[e]),definitions:L})),!!m&&r.a.createElement(r.a.Fragment,null,r.a.createElement("span",{className:"mx_ExportDialog_subheading"},Object(N.a)("Messages")),r.a.createElement(Dn.a,{id:"export-type",element:"select",value:i,onChange:e=>{m(Mn.b[e.target.value])}},U),F),h&&r.a.createElement(r.a.Fragment,null,r.a.createElement("span",{className:"mx_ExportDialog_subheading"},Object(N.a)("Size Limit")),r.a.createElement(Dn.a,{id:"size-limit",type:"number",autoComplete:"off",onValidate:T,element:"input",ref:b,value:c.toString(),postfixComponent:B,onChange:e=>h(parseInt(e.target.value))})),p&&r.a.createElement(r.a.Fragment,null,r.a.createElement(Pe.b,{className:"mx_ExportDialog_attachments-checkbox",id:"include-attachments",checked:o,onChange:e=>p(e.target.checked)},Object(N.a)("Include Attachments")))),g?r.a.createElement("div",{"data-test-id":"export-progress",className:"mx_ExportDialog_progress"},r.a.createElement(pn.a,{w:24,h:24}),r.a.createElement("p",null,y),r.a.createElement(Nn.a,{primaryButton:Object(N.a)("Cancel"),primaryButtonClass:"danger",hasCancel:!1,onPrimaryButtonClick:M})):r.a.createElement(Nn.a,{primaryButton:Object(N.a)("Export"),onPrimaryButtonClick:R,onCancel:()=>a(!1)}))};const qn=["name","value","tabs","onFilterChange"],$n=e=>{let{name:t,value:a,tabs:n,onFilterChange:i}=e,s=ve()(e,qn);return r.a.createElement("fieldset",Z()({},s,{className:"mx_FilterTabGroup"}),n.map((e=>{let{label:n,id:s}=e;return r.a.createElement("label",{"data-testid":`filter-tab-${t}-${s}`,key:s},r.a.createElement("input",{type:"radio",name:t,value:s,onChange:()=>i(s),checked:a===s}),r.a.createElement("span",null,n))})))};var Yn=a(611);const Jn=e=>{let{event:t}=e;const a=t.unstableExtensibleEvent;if(!a)return null;const n=Object(En.i)(t.getTs());return r.a.createElement("li",{"data-testid":`pollListItem-${t.getId()}`,className:"mx_PollListItem"},r.a.createElement("span",null,n),r.a.createElement(Yn.a,{className:"mx_PollListItem_icon"}),r.a.createElement("span",{className:"mx_PollListItem_question"},a.question.text))};var Qn=a(136),Xn=a(346),Zn=a(948),ei=a(458);const ti=(e,t)=>{const a=Object(Xn.b)(Object(Xn.a)(t)),n=Object(Xn.c)(a,e.pollEvent),i=[...n.values()].reduce(((e,t)=>e+t),0),s=Math.max(...n.values());return{totalVoteCount:i,winningAnswers:e.pollEvent.answers.filter((e=>n.get(e.id)===s)).map((e=>({answer:e,voteCount:n.get(e.id)||0})))}},ai=e=>{let{event:t,poll:a}=e;const n=a.pollEvent,{winningAnswers:i,totalVoteCount:o}=(e=>{const[t,a]=Object(s.useState)({totalVoteCount:0});return Object(s.useEffect)((()=>{const t=t=>a(ti(e,t));return e.on(Qn.PollEvent.Responses,t),(async()=>{const t=await e.getResponses();a(ti(e,t))})(),()=>{e.off(Qn.PollEvent.Responses,t)}}),[e]),t})(a);if(!n)return null;const l=Object(En.i)(t.getTs());return r.a.createElement("li",{"data-testid":`pollListItem-${t.getId()}`,className:"mx_PollListItemEnded"},r.a.createElement("div",{className:"mx_PollListItemEnded_title"},r.a.createElement(Yn.a,{className:"mx_PollListItemEnded_icon"}),r.a.createElement("span",{className:"mx_PollListItemEnded_question"},n.question.text),r.a.createElement(ei.a,null,l)),!(null==i||!i.length)&&r.a.createElement("div",{className:"mx_PollListItemEnded_answers"},null==i?void 0:i.map((e=>{let{answer:t,voteCount:n}=e;return r.a.createElement(Zn.a,{key:t.id,answer:t,voteCount:n,totalVoteCount:o,pollId:a.pollId,displayVoteCount:!0,isChecked:!0,isEnded:!0})}))),r.a.createElement("div",{className:"mx_PollListItemEnded_voteCount"},r.a.createElement(ei.a,null,Object(N.a)("Final result based on %(count)s votes",{count:o}))))},ni=e=>{let{noResultsYet:t}=e;return r.a.createElement("div",{className:c()("mx_PollHistoryList_loading",{mx_PollHistoryList_noResultsYet:t})},r.a.createElement(he.a,null),Object(N.a)("Loading polls"))},ii=e=>{let{pollStartEvents:t,polls:a,filter:n,isLoading:i,onFilterChange:s}=e;return r.a.createElement("div",{className:"mx_PollHistoryList"},r.a.createElement($n,{name:"PollHistoryDialog_filter",value:n,onFilterChange:s,tabs:[{id:"ACTIVE",label:"Active polls"},{id:"ENDED",label:"Past polls"}]}),!!t.length&&r.a.createElement("ol",{className:c()("mx_PollHistoryList_list",`mx_PollHistoryList_list_${n}`)},t.map((e=>"ACTIVE"===n?r.a.createElement(Jn,{key:e.getId(),event:e}):r.a.createElement(ai,{key:e.getId(),event:e,poll:a.get(e.getId())}))),i&&r.a.createElement(ni,null)),!t.length&&!i&&r.a.createElement("span",{className:"mx_PollHistoryList_noResults"},"ACTIVE"===n?Object(N.a)("There are no active polls in this room"):Object(N.a)("There are no past polls in this room")),!t.length&&i&&r.a.createElement(ni,{noResultsYet:!0}))},si=(e,t)=>{const{polls:a}=((e,t)=>{const a=t.getRoom(e);if(!a)throw new Error("Cannot find room");return{polls:Object(ie.b)(a,Qn.PollEvent.New,(()=>new Map(a.polls)))}})(e,t),[n,i]=Object(s.useState)(a);return Object(s.useEffect)((()=>{const e=async()=>{i(new Map(a))};if(a){for(const t of a.values())t.on(Qn.PollEvent.End,e),t.on(Qn.PollEvent.Responses,e),t.getResponses();i(a)}return()=>{if(a)for(const t of a.values())t.off(Qn.PollEvent.End,e),t.off(Qn.PollEvent.Responses,e)}}),[a,i]),{polls:n}};var ri=a(316);const oi=async(e,t,a)=>{var n;const i=e.getLiveTimeline(),s=(null===(n=i.getEvents()[0])||void 0===n?void 0:n.getTs())||Date.now();if(!!i.getPaginationToken(Qn.EventTimeline.BACKWARDS)&&!(s<=a))return await t.paginateEventTimeline(i,{backwards:!0}),oi(e,t,a)},li=(e,t,a)=>{const[n,i]=Object(s.useState)(!0);return Object(s.useEffect)((()=>{if(!e)return;const n=Date.now()-864e5*a;(async()=>{i(!0);try{await oi(e,t,n)}catch(e){ga.a.error("Failed to fetch room polls history",e)}finally{i(!1)}})()}),[e,a,t]),{isLoading:n}},ci={room:{timeline:{types:[gn.e.name,gn.e.altName]}}},di=(e,t)=>t.getTs()-e.getTs(),mi=e=>{let{roomId:t,matrixClient:a,onFinished:n}=e;const i=a.getRoom(t),{isLoading:o}=function(e,t){let a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:30;const[n,i]=Object(s.useState)(null);Object(s.useEffect)((()=>{const a=new ri.a(t.getSafeUserId());a.setDefinition(ci),(async()=>{const n=await t.getOrCreateFilter(`POLL_HISTORY_FILTER_${e.roomId}}`,a);a.filterId=n;const s=e.getOrCreateFilteredTimelineSet(a);i(s)})()}),[e,t]);const{isLoading:r}=li(n,t,a);return{isLoading:r}}(i,a),{polls:l}=si(t,a),[c,d]=Object(s.useState)("ACTIVE"),m=((e,t)=>[...e.values()].filter((e=>t=>!t.isFetchingResponses&&"ACTIVE"===e!==t.isEnded)(t)).map((e=>e.rootEvent)).sort(di))(l,c),u=[...l.values()].some((e=>e.isFetchingResponses));return r.a.createElement(Tn.a,{title:Object(N.a)("Polls history"),onFinished:n},r.a.createElement("div",{className:"mx_PollHistoryDialog_content"},r.a.createElement(ii,{pollStartEvents:m,isLoading:o||u,polls:l,filter:c,onFilterChange:d})))},ui=["children","className","onClick"],hi=e=>{let{children:t,className:a,onClick:n}=e,i=ve()(e,ui);return r.a.createElement(G.a,Z()({},i,{className:c()("mx_BaseCard_Button mx_RoomSummaryCard_Button",a),onClick:n}),t)},pi=e=>{const[t,a]=Object(s.useState)((()=>$a.a.instance.getApps(e.roomId))),n=Object(s.useCallback)((()=>{a([...$a.a.instance.getApps(e.roomId)])}),[e]);return Object(s.useEffect)(n,[e,n]),Object(ie.a)($a.a.instance,e.roomId,n),Object(ie.a)(an.d.instance,an.d.emissionForRoom(e),n),t},gi=e=>{let{app:t,room:a}=e;const n=Wa.a.getWidgetName(t),i=Wa.a.getWidgetDataTitle(t),o=i&&" - "+i,[l,d]=Object(s.useState)();Object(s.useEffect)((()=>{d(Wa.a.canUserModifyWidgets(a.roomId))}),[a.roomId]);const m=an.d.instance.isInContainer(a,t,an.a.Top),u=m?()=>{an.d.instance.moveToContainer(a,t,an.a.Right)}:()=>{an.d.instance.moveToContainer(a,t,an.a.Top)},[h,p,g,v]=Object(ce.q)();let b;if(h){const e=p.current.getBoundingClientRect();b=r.a.createElement(ln,{chevronFace:ce.a.None,right:Q.b.instance.windowWidth-e.right,bottom:Q.b.instance.windowHeight-e.top,onFinished:v,app:t})}const f=!m&&!an.d.instance.canAddToContainer(a,an.a.Top);let y;y=f?Object(N.a)("You can only pin up to %(count)s widgets",{count:an.b}):m?Object(N.a)("Unpin"):Object(N.a)("Pin");const E=an.d.instance.isInContainer(a,t,an.a.Center),_=E?()=>{an.d.instance.moveToContainer(a,t,an.a.Right)}:()=>{an.d.instance.moveToContainer(a,t,an.a.Center)},S=E?Object(N.a)("Close"):Object(N.a)("Maximise");let w="";m?w=Object(N.a)("Unpin this widget to view it in this panel"):E&&(w=Object(N.a)("Close this widget to view it in this panel"));const O=c()("mx_BaseCard_Button mx_RoomSummaryCard_Button",{mx_RoomSummaryCard_Button_pinned:m,mx_RoomSummaryCard_Button_maximised:E});return r.a.createElement("div",{className:O,ref:p},r.a.createElement(q.a,{className:"mx_RoomSummaryCard_icon_app",onClick:()=>{Aa.a.instance.pushCard({phase:Ma.a.Widget,state:{widgetId:t.id}})},title:w,forceHide:!(m||E),disabled:m||E},r.a.createElement(qa,{app:t}),r.a.createElement("span",null,n),o),l&&r.a.createElement(ce.c,{className:"mx_RoomSummaryCard_app_options",isExpanded:h,onClick:g,title:Object(N.a)("Options")}),r.a.createElement(q.a,{className:"mx_RoomSummaryCard_app_pinToggle",onClick:u,title:y,disabled:f}),r.a.createElement(q.a,{className:"mx_RoomSummaryCard_app_maximiseToggle",onClick:_,title:S}),b)},vi=e=>{let{room:t}=e;const a=pi(t),n=Object(s.useMemo)((()=>a.filter((e=>void 0!==e.eventId))),[a]);let i=null;return n.length>0&&an.d.instance.canCopyLayoutToRoom(t)&&(i=r.a.createElement(G.a,{kind:"link",onClick:()=>an.d.instance.copyLayoutToRoom(t)},Object(N.a)("Set my room layout for everyone"))),r.a.createElement(Fa,{className:"mx_RoomSummaryCard_appsGroup",title:Object(N.a)("Widgets")},n.map((e=>r.a.createElement(gi,{key:e.id,app:e,room:t}))),i,r.a.createElement(G.a,{kind:"link",onClick:()=>{const e=Ha.a.sharedInstance();e.hasManager()?e.getPrimaryManager().open(t):e.openNoManagerDialog()}},n.length>0?Object(N.a)("Edit widgets, bridges & bots"):Object(N.a)("Add widgets, bridges & bots")))},bi=e=>{Aa.a.instance.pushCard({phase:Ma.a.RoomMemberList},!0),re.b.trackInteraction("WebRightPanelRoomInfoPeopleButton",e)},fi=()=>{Aa.a.instance.pushCard({phase:Ma.a.FilePanel},!0)},yi=()=>{Aa.a.instance.pushCard({phase:Ma.a.PinnedMessages},!0)},Ei=e=>{v.a.dispatch({action:"open_room_settings"}),re.b.trackInteraction("WebRightPanelRoomInfoSettingsButton",e)};var _i=e=>{var t;let{room:a,onClose:n}=e;const i=Object(s.useContext)(R.a),o=La(i,a),l=Object(s.useContext)(Qa.b).e2eStatus,d=Object(se.a)("feature_video_rooms"),m=Object(se.a)("feature_element_call_video_rooms"),u=d&&(a.isElementVideoRoom()||m&&a.isCallRoom()),h=a.getCanonicalAlias()||a.getAltAliases()[0]||"",p=r.a.createElement(r.a.Fragment,null,r.a.createElement("div",{className:"mx_RoomSummaryCard_avatar",role:"presentation"},r.a.createElement(ye.a,{room:a,height:54,width:54,viewAvatarOnClick:!0}),r.a.createElement(za.a,{tooltip:o?Object(N.a)("Encrypted"):Object(N.a)("Not encrypted"),class:c()("mx_RoomSummaryCard_e2ee",{mx_RoomSummaryCard_e2ee_normal:o,mx_RoomSummaryCard_e2ee_warning:o&&l===Ja.Warning,mx_RoomSummaryCard_e2ee_verified:o&&l===Ja.Verified})})),r.a.createElement(In.a,{room:a},(e=>r.a.createElement("h2",{title:e},e))),r.a.createElement("div",{className:"mx_RoomSummaryCard_alias",title:h},h)),g=cn(a),v=Object(se.a)("feature_pinning"),f=null===(t=kn(v&&a))||void 0===t?void 0:t.length,y=Object(se.a)("feature_poll_history");return r.a.createElement(Ba,{header:p,className:"mx_RoomSummaryCard",onClose:n},r.a.createElement(Fa,{title:Object(N.a)("About"),className:"mx_RoomSummaryCard_aboutGroup"},r.a.createElement(hi,{className:"mx_RoomSummaryCard_icon_people",onClick:bi},Object(N.a)("People"),r.a.createElement("span",{className:"mx_BaseCard_Button_sublabel"},g)),!u&&r.a.createElement(hi,{className:"mx_RoomSummaryCard_icon_files",onClick:fi},Object(N.a)("Files")),!u&&y&&r.a.createElement(hi,{className:"mx_RoomSummaryCard_icon_poll",onClick:()=>{H.b.createDialog(mi,{roomId:a.roomId,matrixClient:i})}},Object(N.a)("Polls history")),v&&!u&&r.a.createElement(hi,{className:"mx_RoomSummaryCard_icon_pins",onClick:yi},Object(N.a)("Pinned"),f>0&&r.a.createElement("span",{className:"mx_BaseCard_Button_sublabel"},f)),!u&&r.a.createElement(hi,{className:"mx_RoomSummaryCard_icon_export",onClick:async()=>{H.b.createDialog(Kn,{room:a})}},Object(N.a)("Export chat")),r.a.createElement(hi,{"data-testid":"shareRoomButton",className:"mx_RoomSummaryCard_icon_share",onClick:()=>{H.b.createDialog(Va.a,{target:a})}},Object(N.a)("Share room")),r.a.createElement(hi,{className:"mx_RoomSummaryCard_icon_settings",onClick:Ei},Object(N.a)("Room settings"))),b.b.getValue(oe.b.Widgets)&&!u&&Object(ae.a)(oe.a.AddIntegrations)&&r.a.createElement(vi,{room:a}))},Si=a(256),wi=a.n(Si);function Oi(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}class Ci extends r.a.Component{constructor(e){super(e);const t=this.parseWidgetUrl(),a=lt.a.get().getRoom(this.props.roomId);let n;a&&(n=a.getMember(this.props.creatorUserId)),this.state=function(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?Oi(Object(a),!0).forEach((function(t){i()(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):Oi(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}({widgetDomain:null,isWrapped:null,roomMember:n},t)}parseWidgetUrl(){const e=wi.a.parse(this.props.url),t=new URLSearchParams(e.search);if(Wa.a.isScalarUrl(this.props.url)&&t&&t.get("url")){const e=wi.a.parse(t.get("url"));return{widgetDomain:e.host||e.hostname,isWrapped:!0}}return{widgetDomain:e.host||e.hostname,isWrapped:!1}}render(){const e=mt.b.get().brand,t=this.state.roomMember?this.state.roomMember.name:this.props.creatorUserId,a=t===this.props.creatorUserId?null:this.props.creatorUserId,n=this.state.roomMember?r.a.createElement(yn.b,{member:this.state.roomMember,width:38,height:38}):r.a.createElement(gt.a,{name:this.props.creatorUserId,width:38,height:38}),i=r.a.createElement("div",null,Object(N.a)("Any of the following data may be shared:"),r.a.createElement("ul",null,r.a.createElement("li",null,Object(N.a)("Your display name")),r.a.createElement("li",null,Object(N.a)("Your avatar URL")),r.a.createElement("li",null,Object(N.a)("Your user ID")),r.a.createElement("li",null,Object(N.a)("Your theme")),r.a.createElement("li",null,Object(N.a)("%(brand)s URL",{brand:e})),r.a.createElement("li",null,Object(N.a)("Room ID")),r.a.createElement("li",null,Object(N.a)("Widget ID")))),s=r.a.createElement(za.a,{tooltip:i,tooltipClass:"mx_AppPermissionWarning_tooltip mx_Tooltip_dark"},r.a.createElement("span",{className:"mx_AppPermissionWarning_helpIcon"})),o=this.state.isWrapped?Object(N.a)("Using this widget may share data <helpIcon /> with %(widgetDomain)s & your integration manager.",{widgetDomain:this.state.widgetDomain},{helpIcon:()=>s}):Object(N.a)("Using this widget may share data <helpIcon /> with %(widgetDomain)s.",{widgetDomain:this.state.widgetDomain},{helpIcon:()=>s}),l=this.props.isRoomEncrypted?Object(N.a)("Widgets do not use message encryption."):null;return r.a.createElement("div",{className:"mx_AppPermissionWarning"},r.a.createElement("div",{className:"mx_AppPermissionWarning_row mx_AppPermissionWarning_bolder mx_AppPermissionWarning_smallText"},Object(N.a)("Widget added by")),r.a.createElement("div",{className:"mx_AppPermissionWarning_row"},n,r.a.createElement("h4",{className:"mx_AppPermissionWarning_bolder"},t),r.a.createElement("div",{className:"mx_AppPermissionWarning_smallText"},a)),r.a.createElement("div",{className:"mx_AppPermissionWarning_row mx_AppPermissionWarning_smallText"},o),r.a.createElement("div",{className:"mx_AppPermissionWarning_row mx_AppPermissionWarning_smallText"},Object(N.a)("This widget may use cookies.")," ",l),r.a.createElement("div",{className:"mx_AppPermissionWarning_row"},r.a.createElement(G.a,{kind:"primary_sm",onClick:this.props.onPermissionGranted},Object(N.a)("Continue"))))}}i()(Ci,"defaultProps",{onPermissionGranted:()=>{}});var xi=e=>r.a.createElement("div",{className:"mx_AppPermissionWarning"},r.a.createElement("div",{className:"mx_AppPermissionWarningImage"},r.a.createElement("img",{src:a(608).default,alt:""})),r.a.createElement("div",{className:"mx_AppPermissionWarningText"},r.a.createElement("span",{className:"mx_AppPermissionWarningTextLabel"},e.errorMsg||"Error"))),ki=a(331),ji=a(16);function Ri(e){return document.getElementById(e)}class Ii extends r.a.Component{constructor(e){super(e),i()(this,"resizeObserver",void 0),i()(this,"dispatcherRef",void 0),i()(this,"childContainer",void 0),i()(this,"child",void 0),i()(this,"collectChildContainer",(e=>{this.childContainer&&this.resizeObserver.unobserve(this.childContainer),this.childContainer=e,e&&this.resizeObserver.observe(e)})),i()(this,"collectChild",(e=>{this.child=e,this.updateChild()})),i()(this,"onAction",(e=>{"timeline_resize"===e.action?this.repositionChild():"logout"===e.action&&Ii.destroyElement(this.props.persistKey)})),i()(this,"repositionChild",(()=>{this.updateChildPosition(this.child,this.childContainer)})),this.resizeObserver=new ResizeObserver(this.repositionChild),window.addEventListener("resize",this.repositionChild),this.dispatcherRef=v.a.register(this.onAction),this.props.moveRef&&(this.props.moveRef.current=this.repositionChild)}static destroyElement(e){const t=Ri("mx_persistedElement_"+e);t&&t.remove()}static isMounted(e){return Boolean(Ri("mx_persistedElement_"+e))}componentDidMount(){this.updateChild(),this.renderApp()}componentDidUpdate(){this.updateChild(),this.renderApp()}componentWillUnmount(){this.updateChildVisibility(this.child,!1),this.resizeObserver.disconnect(),window.removeEventListener("resize",this.repositionChild),v.a.unregister(this.dispatcherRef)}updateChild(){this.updateChildPosition(this.child,this.childContainer),this.updateChildVisibility(this.child,!0)}renderApp(){const e=r.a.createElement(R.a.Provider,{value:lt.a.get()},r.a.createElement("div",{ref:this.collectChild,style:this.props.style},this.props.children));Vt.a.render(e,function(e){let t=Ri(e);return t||(t=document.createElement("div"),t.id=e,document.body.appendChild(t)),t}("mx_persistedElement_"+this.props.persistKey))}updateChildVisibility(e,t){e&&(e.style.display=t?"block":"none")}updateChildPosition(e,t){if(!e||!t)return;const a=t.getBoundingClientRect();Object.assign(e.style,{zIndex:Object(ji.t)(this.props.zIndex)?9:this.props.zIndex,position:"absolute",top:"0",left:"0",transform:`translateX(${a.left}px) translateY(${a.top}px)`,width:a.width+"px",height:a.height+"px"})}render(){return r.a.createElement("div",{ref:this.collectChildContainer})}}var Ti=a(17),Ni=a(155);var Di=a(234),Pi=a(593);class Mi extends r.a.PureComponent{constructor(e){super(e),i()(this,"onAllow",(()=>{this.onPermissionSelection(!0)})),i()(this,"onDeny",(()=>{this.onPermissionSelection(!1)})),i()(this,"onRememberSelectionChange",(e=>{this.setState({rememberSelection:e})})),this.state={rememberSelection:!1}}onPermissionSelection(e){this.state.rememberSelection&&(ga.a.log(`Remembering ${this.props.widget.id} as allowed=${e} for OpenID`),rt.b.instance.widgetPermissionStore.setOIDCState(this.props.widget,this.props.widgetKind,this.props.inRoomId,e?Pi.a.Allowed:Pi.a.Denied)),this.props.onFinished(e)}render(){return r.a.createElement(Tn.a,{className:"mx_WidgetOpenIDPermissionsDialog",hasCancel:!0,onFinished:this.props.onFinished,title:Object(N.a)("Allow this widget to verify your identity")},r.a.createElement("div",{className:"mx_WidgetOpenIDPermissionsDialog_content"},r.a.createElement("p",null,Object(N.a)("The widget will verify your user ID, but won't be able to perform actions for you:")),r.a.createElement("p",{className:"text-muted"},this.props.widget.templateUrl.split("?")[0].split("#")[0])),r.a.createElement(Nn.a,{primaryButton:Object(N.a)("Continue"),onPrimaryButtonClick:this.onAllow,onCancel:this.onDeny,additive:r.a.createElement(Di.a,{value:this.state.rememberSelection,toggleInFront:!0,onChange:this.onRememberSelectionChange,label:Object(N.a)("Remember this")})}))}}var Ai=a(182),Li=a(32);const Ui="generic";class Fi{static bylineFor(e){return e.kind===Xa.EventKind.State?e.keyStr?Object(N.a)("with state key %(stateKey)s",{stateKey:e.keyStr}):Object(N.a)("with an empty state key"):null}static for(e,t){if(Fi.simpleCaps[e]){const a=Fi.simpleCaps[e];if(a[t])return{primary:Object(N.a)(a[t])};if(a.generic)return{primary:Object(N.a)(a.generic)}}if(Object(Xa.isTimelineCapability)(e)){if(Object(Xa.isTimelineCapabilityFor)(e,Xa.Symbols.AnyRoom))return{primary:Object(N.a)("The above, but in any room you are joined or invited to as well")};{const t=Object(Xa.getTimelineRoomIDFromCapability)(e),a=lt.a.get().getRoom(t);return{primary:Object(N.a)("The above, but in <Room /> as well",{},{Room:()=>{var e;return a?r.a.createElement(za.a,{tooltip:null!==(e=a.getCanonicalAlias())&&void 0!==e?e:t},r.a.createElement("b",null,a.name)):r.a.createElement("b",null,r.a.createElement("code",null,t))}})}}}const[a]=Xa.WidgetEventCapability.findEventCapabilities([e]);if(a){if(a.kind===Xa.EventKind.Event&&a.eventType===ee.b.RoomMessage)return Fi.forRoomMessageCap(a,t);const e=a.kind===Xa.EventKind.State?Fi.stateSendRecvCaps:Fi.nonStateSendRecvCaps;if(e[a.eventType]){const n=e[a.eventType],i=(null==n?void 0:n[t])||(null==n?void 0:n.generic);if(null!=i&&i[a.direction])return{primary:Object(N.a)(i[a.direction])}}return t===Xa.WidgetKind.Room?a.direction===Xa.EventDirection.Send?{primary:Object(N.a)("Send <b>%(eventType)s</b> events as you in this room",{eventType:a.eventType},{b:e=>r.a.createElement("b",null,e)}),byline:Fi.bylineFor(a)}:{primary:Object(N.a)("See <b>%(eventType)s</b> events posted to this room",{eventType:a.eventType},{b:e=>r.a.createElement("b",null,e)}),byline:Fi.bylineFor(a)}:a.direction===Xa.EventDirection.Send?{primary:Object(N.a)("Send <b>%(eventType)s</b> events as you in your active room",{eventType:a.eventType},{b:e=>r.a.createElement("b",null,e)}),byline:Fi.bylineFor(a)}:{primary:Object(N.a)("See <b>%(eventType)s</b> events posted to your active room",{eventType:a.eventType},{b:e=>r.a.createElement("b",null,e)}),byline:Fi.bylineFor(a)}}return{primary:Object(N.a)("The <b>%(capability)s</b> capability",{capability:e},{b:e=>r.a.createElement("b",null,e)})}}static forRoomMessageCap(e,t){if(!e.keyStr)return e.direction===Xa.EventDirection.Send?{primary:t===Xa.WidgetKind.Room?Object(N.a)("Send messages as you in this room"):Object(N.a)("Send messages as you in your active room")}:{primary:t===Xa.WidgetKind.Room?Object(N.a)("See messages posted to this room"):Object(N.a)("See messages posted to your active room")};switch(e.keyStr){case ee.e.Text:return e.direction===Xa.EventDirection.Send?{primary:t===Xa.WidgetKind.Room?Object(N.a)("Send text messages as you in this room"):Object(N.a)("Send text messages as you in your active room")}:{primary:t===Xa.WidgetKind.Room?Object(N.a)("See text messages posted to this room"):Object(N.a)("See text messages posted to your active room")};case ee.e.Emote:return e.direction===Xa.EventDirection.Send?{primary:t===Xa.WidgetKind.Room?Object(N.a)("Send emotes as you in this room"):Object(N.a)("Send emotes as you in your active room")}:{primary:t===Xa.WidgetKind.Room?Object(N.a)("See emotes posted to this room"):Object(N.a)("See emotes posted to your active room")};case ee.e.Image:return e.direction===Xa.EventDirection.Send?{primary:t===Xa.WidgetKind.Room?Object(N.a)("Send images as you in this room"):Object(N.a)("Send images as you in your active room")}:{primary:t===Xa.WidgetKind.Room?Object(N.a)("See images posted to this room"):Object(N.a)("See images posted to your active room")};case ee.e.Video:return e.direction===Xa.EventDirection.Send?{primary:t===Xa.WidgetKind.Room?Object(N.a)("Send videos as you in this room"):Object(N.a)("Send videos as you in your active room")}:{primary:t===Xa.WidgetKind.Room?Object(N.a)("See videos posted to this room"):Object(N.a)("See videos posted to your active room")};case ee.e.File:return e.direction===Xa.EventDirection.Send?{primary:t===Xa.WidgetKind.Room?Object(N.a)("Send general files as you in this room"):Object(N.a)("Send general files as you in your active room")}:{primary:t===Xa.WidgetKind.Room?Object(N.a)("See general files posted to this room"):Object(N.a)("See general files posted to your active room")};default:{let a;return a=e.direction===Xa.EventDirection.Send?t===Xa.WidgetKind.Room?Object(N.a)("Send <b>%(msgtype)s</b> messages as you in this room",{msgtype:e.keyStr},{b:e=>r.a.createElement("b",null,e)}):Object(N.a)("Send <b>%(msgtype)s</b> messages as you in your active room",{msgtype:e.keyStr},{b:e=>r.a.createElement("b",null,e)}):t===Xa.WidgetKind.Room?Object(N.a)("See <b>%(msgtype)s</b> messages posted to this room",{msgtype:e.keyStr},{b:e=>r.a.createElement("b",null,e)}):Object(N.a)("See <b>%(msgtype)s</b> messages posted to your active room",{msgtype:e.keyStr},{b:e=>r.a.createElement("b",null,e)}),{primary:a}}}}}i()(Fi,"simpleCaps",{[Xa.MatrixCapabilities.AlwaysOnScreen]:{[Xa.WidgetKind.Room]:Object(N.c)("Remain on your screen when viewing another room, when running"),[Ui]:Object(N.c)("Remain on your screen while running")},[Xa.MatrixCapabilities.StickerSending]:{[Xa.WidgetKind.Room]:Object(N.c)("Send stickers into this room"),[Ui]:Object(N.c)("Send stickers into your active room")},[Li.a.CanChangeViewedRoom]:{[Ui]:Object(N.c)("Change which room you're viewing")},[Xa.MatrixCapabilities.MSC2931Navigate]:{[Ui]:Object(N.c)("Change which room, message, or user you're viewing")}}),i()(Fi,"stateSendRecvCaps",{[ee.b.RoomTopic]:{[Xa.WidgetKind.Room]:{[Xa.EventDirection.Send]:Object(N.c)("Change the topic of this room"),[Xa.EventDirection.Receive]:Object(N.c)("See when the topic changes in this room")},[Ui]:{[Xa.EventDirection.Send]:Object(N.c)("Change the topic of your active room"),[Xa.EventDirection.Receive]:Object(N.c)("See when the topic changes in your active room")}},[ee.b.RoomName]:{[Xa.WidgetKind.Room]:{[Xa.EventDirection.Send]:Object(N.c)("Change the name of this room"),[Xa.EventDirection.Receive]:Object(N.c)("See when the name changes in this room")},[Ui]:{[Xa.EventDirection.Send]:Object(N.c)("Change the name of your active room"),[Xa.EventDirection.Receive]:Object(N.c)("See when the name changes in your active room")}},[ee.b.RoomAvatar]:{[Xa.WidgetKind.Room]:{[Xa.EventDirection.Send]:Object(N.c)("Change the avatar of this room"),[Xa.EventDirection.Receive]:Object(N.c)("See when the avatar changes in this room")},[Ui]:{[Xa.EventDirection.Send]:Object(N.c)("Change the avatar of your active room"),[Xa.EventDirection.Receive]:Object(N.c)("See when the avatar changes in your active room")}},[ee.b.RoomMember]:{[Xa.WidgetKind.Room]:{[Xa.EventDirection.Send]:Object(N.c)("Remove, ban, or invite people to this room, and make you leave"),[Xa.EventDirection.Receive]:Object(N.c)("See when people join, leave, or are invited to this room")},[Ui]:{[Xa.EventDirection.Send]:Object(N.c)("Remove, ban, or invite people to your active room, and make you leave"),[Xa.EventDirection.Receive]:Object(N.c)("See when people join, leave, or are invited to your active room")}}}),i()(Fi,"nonStateSendRecvCaps",{[ee.b.Sticker]:{[Xa.WidgetKind.Room]:{[Xa.EventDirection.Send]:Object(N.c)("Send stickers to this room as you"),[Xa.EventDirection.Receive]:Object(N.c)("See when a sticker is posted in this room")},[Ui]:{[Xa.EventDirection.Send]:Object(N.c)("Send stickers to your active room as you"),[Xa.EventDirection.Receive]:Object(N.c)("See when anyone posts a sticker to your active room")}}});class Bi extends r.a.PureComponent{constructor(e){super(e),i()(this,"eventPermissionsMap",new Map),i()(this,"onToggle",(e=>{const t=Object(Ai.e)(this.state.booleanStates);t[e]=!t[e],this.setState({booleanStates:t})})),i()(this,"onRememberSelectionChange",(e=>{this.setState({rememberSelection:e})})),i()(this,"onSubmit",(async()=>{this.closeAndTryRemember(Object.entries(this.state.booleanStates).filter((e=>{let[t,a]=e;return a})).map((e=>{let[t]=e;return t})))})),i()(this,"onReject",(async()=>{this.closeAndTryRemember([])}));Xa.WidgetEventCapability.findEventCapabilities(this.props.requestedCapabilities).forEach((e=>this.eventPermissionsMap.set(e.raw,e)));const t={};this.props.requestedCapabilities.forEach((e=>t[e]=!0)),this.state={booleanStates:t,rememberSelection:!0}}closeAndTryRemember(e){this.props.onFinished({approved:e,remember:this.state.rememberSelection})}render(){const e=Object.entries(this.state.booleanStates).sort(((e,t)=>{let[a]=e,[n]=t;const i=Object(Xa.isTimelineCapability)(a),s=Object(Xa.isTimelineCapability)(n);return i||s?i&&!s?1:!i&&s?-1:i&&s?Object(ji.w)(a,n):0:Object(ji.w)(a,n)})).map(((e,t)=>{let[a,n]=e;const i=Fi.for(a,this.props.widgetKind),s=i.byline?r.a.createElement("span",{className:"mx_WidgetCapabilitiesPromptDialog_byline"},i.byline):null;return r.a.createElement("div",{className:"mx_WidgetCapabilitiesPromptDialog_cap",key:a+t},r.a.createElement(Pe.b,{checked:n,onChange:()=>this.onToggle(a)},i.primary),s)}));return r.a.createElement(Tn.a,{className:"mx_WidgetCapabilitiesPromptDialog",onFinished:this.props.onFinished,title:Object(N.a)("Approve widget permissions")},r.a.createElement("form",{onSubmit:this.onSubmit},r.a.createElement("div",{className:"mx_Dialog_content"},r.a.createElement("div",{className:"text-muted"},Object(N.a)("This widget would like to:")),e,r.a.createElement(Nn.a,{primaryButton:Object(N.a)("Approve"),cancelButton:Object(N.a)("Decline All"),onPrimaryButtonClick:this.onSubmit,onCancel:this.onReject,additive:r.a.createElement(Di.a,{value:this.state.rememberSelection,toggleInFront:!0,onChange:this.onRememberSelectionChange,label:Object(N.a)("Remember my selection for this widget")})}))))}}const Vi={};var Wi=a(247),Hi=a(309),zi=a(866);const Gi=e=>{let{urls:t,username:a,credential:n}=e;return{uris:t,username:a,password:n}};class Ki extends Xa.WidgetDriver{constructor(e,t,a,n,s){var r;if(super(),this.forWidget=t,this.forWidgetKind=a,this.inRoomId=s,i()(this,"allowedCapabilities",void 0),this.allowedCapabilities=new Set([...e,Xa.MatrixCapabilities.Screenshots,Li.a.RequiresClient]),tn.a.JITSI.matches(this.forWidget.type)&&a===Xa.WidgetKind.Room)this.allowedCapabilities.add(Xa.MatrixCapabilities.AlwaysOnScreen);else if(tn.a.STICKERPICKER.matches(this.forWidget.type)&&a===Xa.WidgetKind.Account){const e=Xa.WidgetEventCapability.forRoomEvent(Xa.EventDirection.Send,ee.b.Sticker).raw;this.allowedCapabilities.add(Xa.MatrixCapabilities.StickerSending),this.allowedCapabilities.add(e),this.allowedCapabilities.add("visibility")}else if(n&&new URL(null!==(r=mt.b.get("element_call").url)&&void 0!==r?r:mt.a.element_call.url).origin===this.forWidget.origin){this.allowedCapabilities.add(Xa.MatrixCapabilities.AlwaysOnScreen),this.allowedCapabilities.add(Xa.MatrixCapabilities.MSC3846TurnServers),this.allowedCapabilities.add(`org.matrix.msc2762.timeline:${s}`),this.allowedCapabilities.add(Xa.WidgetEventCapability.forRoomEvent(Xa.EventDirection.Send,"org.matrix.rageshake_request").raw),this.allowedCapabilities.add(Xa.WidgetEventCapability.forRoomEvent(Xa.EventDirection.Receive,"org.matrix.rageshake_request").raw),this.allowedCapabilities.add(Xa.WidgetEventCapability.forStateEvent(Xa.EventDirection.Receive,ee.b.RoomMember).raw),this.allowedCapabilities.add(Xa.WidgetEventCapability.forStateEvent(Xa.EventDirection.Receive,"org.matrix.msc3401.call").raw),this.allowedCapabilities.add(Xa.WidgetEventCapability.forStateEvent(Xa.EventDirection.Send,"org.matrix.msc3401.call.member",lt.a.get().getUserId()).raw),this.allowedCapabilities.add(Xa.WidgetEventCapability.forStateEvent(Xa.EventDirection.Receive,"org.matrix.msc3401.call.member").raw);const e=[ee.b.CallInvite,ee.b.CallCandidates,ee.b.CallAnswer,ee.b.CallHangup,ee.b.CallReject,ee.b.CallSelectAnswer,ee.b.CallNegotiate,ee.b.CallSDPStreamMetadataChanged,ee.b.CallSDPStreamMetadataChangedPrefix,ee.b.CallReplaces];for(const t of e)this.allowedCapabilities.add(Xa.WidgetEventCapability.forToDeviceEvent(Xa.EventDirection.Send,t).raw),this.allowedCapabilities.add(Xa.WidgetEventCapability.forToDeviceEvent(Xa.EventDirection.Receive,t).raw)}}async validateCapabilities(e){const t=(a=e,n=this.allowedCapabilities,Object(Ni.a)(Array.from(a),Array.from(n)));var a,n;const i=new Set(t.removed),s=new Set(this.allowedCapabilities);var r;if((r=this.forWidget,JSON.parse(localStorage.getItem(`widget_${r.id}_approved_caps`)||"[]")).forEach((e=>{s.add(e),i.delete(e)})),Vi.preapproveCapabilities){const t=await Vi.preapproveCapabilities(this.forWidget,e);t&&t.forEach((e=>{s.add(e),i.delete(e)}))}let o=!1;if(i.size>0)try{const[e]=await H.b.createDialog(Bi,{requestedCapabilities:i,widget:this.forWidget,widgetKind:this.forWidgetKind}).finished;(e.approved||[]).forEach((e=>s.add(e))),o=e.remember}catch(e){ga.a.error("Non-fatal error getting capabilities: ",e)}const l=new Set(function(e,t){return Object(Ni.f)(Array.from(e),Array.from(t))}(s,e));return o&&function(e,t){localStorage.setItem(`widget_${e.id}_approved_caps`,JSON.stringify(t))}(this.forWidget,Array.from(l)),l}async sendEvent(e,t,a,n){const i=lt.a.get(),s=n||rt.b.instance.roomViewStore.getRoomId();if(!i||!s)throw new Error("Not in a room or not attached to a client");let r=null;return null!==a?r=await i.sendStateEvent(s,e,t,a):e===ee.b.RoomRedaction?r=await i.redactEvent(s,t.redacts):(r=await i.sendEvent(s,e,t),e===ee.b.RoomMessage&&Wi.CHAT_EFFECTS.forEach((e=>{if(Object(Hi.containsEmoji)(t,e.emojis)){var a;(null===(a=t["m.relates_to"])||void 0===a?void 0:a.rel_type)!==xa.d.name&&v.a.dispatch({action:`effects.${e.command}`})}}))),{roomId:s,eventId:r.event_id}}async sendToDevice(e,t,a){const n=lt.a.get();if(t){const e=await n.crypto.deviceList.downloadKeys(Object.keys(a),!1);await Promise.all(Object.entries(a).flatMap((t=>{let[a,i]=t;return Object.entries(i).map((async t=>{let[i,s]=t;"*"===i?await n.encryptAndSendToDevices(Object.values(e[a]).map((e=>({userId:a,deviceInfo:e}))),s):await n.encryptAndSendToDevices([{userId:a,deviceInfo:e[a][i]}],s)}))})))}else await n.queueToDevice({eventType:e,batch:Object.entries(a).flatMap((e=>{let[t,a]=e;return Object.entries(a).map((e=>{let[a,n]=e;return{userId:t,deviceId:a,payload:n}}))}))})}pickRooms(e){const t=lt.a.get();if(!t)throw new Error("Not attached to a client");return(e?e.includes(Xa.Symbols.AnyRoom)?t.getVisibleRooms():e.map((e=>t.getRoom(e))):[t.getRoom(rt.b.instance.roomViewStore.getRoomId())]).filter((e=>!!e))}async readRoomEvents(e,t,a,n){a=a>0?Math.min(a,Number.MAX_SAFE_INTEGER):Number.MAX_SAFE_INTEGER;const i=this.pickRooms(n),s=[];for(const n of i){const i=[],r=n.getLiveTimeline().getEvents();for(let n=r.length-1;n>0&&!(i.length>=a);n--){const a=r[n];a.getType()!==e||a.isState()||e===ee.b.RoomMessage&&t&&t!==a.getContent().msgtype||i.push(a)}i.forEach((e=>s.push(e.getEffectiveEvent())))}return s}async readStateEvents(e,t,a,n){a=a>0?Math.min(a,Number.MAX_SAFE_INTEGER):Number.MAX_SAFE_INTEGER;const i=this.pickRooms(n),s=[];for(const n of i){const i=[],r=n.currentState.events.get(e);if(r)if(""===t||t){const e=r.get(t);e&&i.push(e)}else i.push(...Array.from(r.values()));i.slice(0,a).forEach((e=>s.push(e.getEffectiveEvent())))}return s}async askOpenID(e){const t=rt.b.instance.widgetPermissionStore.getOIDCState(this.forWidget,this.forWidgetKind,this.inRoomId),a=()=>lt.a.get().getOpenIdToken();return t===Pi.a.Denied?e.update({state:Xa.OpenIDRequestState.Blocked}):t===Pi.a.Allowed?e.update({state:Xa.OpenIDRequestState.Allowed,token:await a()}):(e.update({state:Xa.OpenIDRequestState.PendingUserConfirmation}),void H.b.createDialog(Mi,{widget:this.forWidget,widgetKind:this.forWidgetKind,inRoomId:this.inRoomId,onFinished:async t=>t?e.update({state:Xa.OpenIDRequestState.Allowed,token:await a()}):e.update({state:Xa.OpenIDRequestState.Blocked})}))}async navigate(e){Object(zi.a)(e)}async*getTurnServers(){const e=lt.a.get();if(!e.pollingTurnServers||!e.getTurnServers().length)return;let t,a;const n=e=>{let[a]=e;return t(Gi(a))},i=(e,t)=>{t&&a(e)};e.on(o.b.TurnServers,n),e.on(o.b.TurnServersError,i);try{const s=e.getTurnServers()[0];for(yield Gi(s);;)yield await new Promise(((e,n)=>{t=e,a=n}))}finally{e.off(o.b.TurnServers,n),e.off(o.b.TurnServersError,i)}}async readEventRelations(e,t,a,n,i,s,r,o){var l,c;const d=lt.a.get(),m=o;if("string"!=typeof(t=null!==(l=null!==(c=t)&&void 0!==c?c:rt.b.instance.roomViewStore.getRoomId())&&void 0!==l?l:void 0))throw new Error("Error while reading the current room");const{events:u,nextBatch:h,prevBatch:p}=await d.relations(t,e,null!=a?a:null,null!=n?n:null,{from:i,to:s,limit:r,dir:m});return{chunk:u.map((e=>e.getEffectiveEvent())),nextBatch:null!=h?h:void 0,prevBatch:null!=p?p:void 0}}}var qi=a(201);const $i="io.element.web";function Yi(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function Ji(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?Yi(Object(a),!0).forEach((function(t){i()(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):Yi(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}class Qi extends s.PureComponent{constructor(e){super(e),i()(this,"widget",void 0),i()(this,"possibleButtons",void 0),i()(this,"appFrame",s.createRef()),i()(this,"state",{disabledButtonIds:(this.props.widgetDefinition.buttons||[]).filter((e=>e.disabled)).map((e=>e.id))}),i()(this,"onReady",(()=>{this.state.messaging.sendWidgetConfig(this.props.widgetDefinition)})),i()(this,"onLoad",(()=>{this.state.messaging.once("ready",this.onReady),this.state.messaging.on(`action:${Xa.WidgetApiFromWidgetAction.CloseModalWidget}`,this.onWidgetClose),this.state.messaging.on(`action:${Xa.WidgetApiFromWidgetAction.SetModalButtonEnabled}`,this.onButtonEnableToggle)})),i()(this,"onWidgetClose",(e=>{this.props.onFinished(!0,e.detail.data)})),i()(this,"onButtonEnableToggle",(e=>{e.preventDefault();if(e.detail.data.button===Xa.BuiltInModalButtonID.Close||!this.possibleButtons.includes(e.detail.data.button))return this.state.messaging.transport.reply(e.detail,{error:{message:"Invalid button"}});let t;if(e.detail.data.enabled)t=Object(Ni.b)(this.state.disabledButtonIds).filter((t=>t!==e.detail.data.button));else{const a=new Set(this.state.disabledButtonIds);a.add(e.detail.data.button),t=Array.from(a)}this.setState({disabledButtonIds:t}),this.state.messaging.transport.reply(e.detail,{})})),this.widget=new ss(Ji(Ji({},this.props.widgetDefinition),{},{creatorUserId:lt.a.get().getUserId(),id:`modal_${this.props.sourceWidgetId}`})),this.possibleButtons=(this.props.widgetDefinition.buttons||[]).map((e=>e.id))}componentDidMount(){const e=new Ki([],this.widget,Xa.WidgetKind.Modal,!1),t=new Xa.ClientWidgetApi(this.widget,this.appFrame.current,e);this.setState({messaging:t})}componentWillUnmount(){this.state.messaging.off("ready",this.onReady),this.state.messaging.off(`action:${Xa.WidgetApiFromWidgetAction.CloseModalWidget}`,this.onWidgetClose),this.state.messaging.stop()}render(){const e=this.widget.getCompleteUrl({widgetRoomId:this.props.widgetRoomId,currentUserId:lt.a.get().getUserId(),userDisplayName:ht.a.instance.displayName,userHttpAvatarUrl:ht.a.instance.getHttpAvatarUrl(),clientId:$i,clientTheme:b.b.getValue("theme"),clientLanguage:Object(N.h)()}),t=new URL(e);t.searchParams.set("widgetId",this.widget.id),t.searchParams.set("parentUrl",window.location.href.split("#",2)[0]);const n=t.toString().replace(/%24/g,"$");let i;return this.props.widgetDefinition.buttons&&(i=this.props.widgetDefinition.buttons.slice(0,3).reverse().map((e=>{let t="secondary";switch(e.kind){case Xa.ModalButtonKind.Primary:t="primary";break;case Xa.ModalButtonKind.Secondary:t="primary_outline";break;case Xa.ModalButtonKind.Danger:t="danger"}const a=this.state.disabledButtonIds.includes(e.id);return s.createElement(G.a,{key:e.id,kind:t,onClick:()=>{this.state.messaging.notifyModalWidgetButtonClicked(e.id)},disabled:a},e.label)}))),s.createElement(Tn.a,{title:this.props.widgetDefinition.name||Object(N.a)("Modal Widget"),className:"mx_ModalWidgetDialog",contentId:"mx_Dialog_content",onFinished:this.props.onFinished},s.createElement("div",{className:"mx_ModalWidgetDialog_warning"},s.createElement("img",{src:a(391).default,height:"16",width:"16",alt:""}),Object(N.a)("Data on this screen is shared with %(widgetDomain)s",{widgetDomain:t.hostname})),s.createElement("div",null,s.createElement("iframe",{title:this.widget.name,ref:this.appFrame,sandbox:"allow-forms allow-scripts allow-same-origin",src:n,onLoad:this.onLoad})),s.createElement("div",{className:"mx_ModalWidgetDialog_buttons"},i))}}function Xi(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function Zi(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?Xi(Object(a),!0).forEach((function(t){i()(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):Xi(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}class es extends qi.a{constructor(){super(v.a,{}),i()(this,"modalInstance",null),i()(this,"openSourceWidgetId",null),i()(this,"openSourceWidgetRoomId",null),i()(this,"canOpenModalWidget",(()=>!this.modalInstance)),i()(this,"openModalWidget",((e,t,a)=>{this.modalInstance||(this.openSourceWidgetId=t.id,this.openSourceWidgetRoomId=a,this.modalInstance=H.b.createDialog(Qi,{widgetDefinition:Zi({},e),widgetRoomId:a,sourceWidgetId:t.id,onFinished:(e,n)=>{e?this.closeModalWidget(t,a,n):this.closeModalWidget(t,a,{"m.exited":!0}),this.openSourceWidgetId=null,this.openSourceWidgetRoomId=null,this.modalInstance=null}},null,!1,!0))})),i()(this,"closeModalWidget",((e,t,a)=>{if(this.modalInstance&&this.openSourceWidgetId===e.id&&this.openSourceWidgetRoomId===t){this.openSourceWidgetId=null,this.openSourceWidgetRoomId=null,this.modalInstance.close(),this.modalInstance=null;const n=Za.a.instance.getMessaging(e,t);if(!n)return void ga.a.error("No source widget messaging for modal widget");n.notifyModalWidgetClose(a)}}))}static get instance(){return es.internalInstance}async onAction(e){}}i()(es,"internalInstance",(()=>{const e=new es;return e.start(),e})()),window.mxModalWidgetStore=es.instance;var ts=a(466);const as={};function ns(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function is(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?ns(Object(a),!0).forEach((function(t){i()(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):ns(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}class ss extends Xa.Widget{constructor(e){super(e),this.rawDefinition=e}get templateUrl(){var e;return tn.a.JITSI.matches(this.type)?Wa.a.getLocalJitsiWrapperUrl({forLocalRender:!0,auth:null===(e=super.rawData)||void 0===e?void 0:e.auth}):super.templateUrl}get popoutTemplateUrl(){var e;return tn.a.JITSI.matches(this.type)?Wa.a.getLocalJitsiWrapperUrl({forLocalRender:!1,auth:null===(e=super.rawData)||void 0===e?void 0:e.auth}):this.templateUrl}get rawData(){let e=super.rawData.conferenceId;if(void 0===e){e=new URL(super.templateUrl).searchParams.get("confId")}let t=super.rawData.domain;void 0===t&&(t="meet.element.io");let a=(new ts.a).getEffectiveTheme();if(a.startsWith("custom-")){const e=Object(Le.e)(a.slice(7));a=e.is_dark?"dark":"light"}return a=a.includes("light")?"light":"dark",is(is({},super.rawData),{},{theme:a,conferenceId:e,domain:t})}getCompleteUrl(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Object(Xa.runTemplate)(t?this.popoutTemplateUrl:this.templateUrl,is(is({},this.rawDefinition),{},{data:this.rawData}),e)}}class rs extends Ti.EventEmitter{constructor(e){var t;super(),this.appTileProps=e,i()(this,"client",void 0),i()(this,"messaging",void 0),i()(this,"mockWidget",void 0),i()(this,"scalarToken",void 0),i()(this,"roomId",void 0),i()(this,"kind",void 0),i()(this,"virtual",void 0),i()(this,"readUpToMap",{}),i()(this,"onOpenModal",(async e=>{var t,a;(e.preventDefault(),es.instance.canOpenModalWidget())?(es.instance.openModalWidget(e.detail.data,this.mockWidget,this.roomId),null===(t=this.messaging)||void 0===t||t.transport.reply(e.detail,{})):null===(a=this.messaging)||void 0===a||a.transport.reply(e.detail,{error:{message:"Unable to open modal at this time"}})})),i()(this,"onEvent",(e=>{this.client.decryptEventIfNeeded(e),e.isBeingDecrypted()||e.isDecryptionFailure()||this.feedEvent(e)})),i()(this,"onEventDecrypted",(e=>{e.isDecryptionFailure()||this.feedEvent(e)})),i()(this,"onToDeviceEvent",(async e=>{var t;await this.client.decryptEventIfNeeded(e),e.isDecryptionFailure()||await(null===(t=this.messaging)||void 0===t?void 0:t.feedToDevice(e.getEffectiveEvent(),e.isEncrypted()))})),this.client=lt.a.get();let a=e.app;a.creatorUserId||(a=Object(Ai.e)(a),a.creatorUserId=this.client.getUserId()),this.mockWidget=new ss(a),this.roomId=null===(t=e.room)||void 0===t?void 0:t.roomId,this.kind=e.userWidget?Xa.WidgetKind.Account:Xa.WidgetKind.Room,this.virtual=void 0===a.eventId}get eventListenerRoomId(){return this.roomId?this.roomId:rt.b.instance.roomViewStore.getRoomId()}get widgetApi(){return this.messaging}get embedUrl(){return this.runUrlTemplate({asPopout:!1})}get popoutUrl(){return this.runUrlTemplate({asPopout:!0})}runUrlTemplate(){var e,t,a,n;let i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{asPopout:!1};const s=null!==(e=null==as||null===(t=as.provideVariables)||void 0===t?void 0:t.call(as))&&void 0!==e?e:{},r={widgetRoomId:this.roomId,currentUserId:this.client.getUserId(),userDisplayName:null!==(a=ht.a.instance.displayName)&&void 0!==a?a:void 0,userHttpAvatarUrl:null!==(n=ht.a.instance.getHttpAvatarUrl())&&void 0!==n?n:void 0,clientId:$i,clientTheme:b.b.getValue("theme"),clientLanguage:Object(N.h)()},o=this.mockWidget.getCompleteUrl(Object.assign(r,s),null==i?void 0:i.asPopout),l=new URL(o);return null!=i&&i.asPopout||(l.searchParams.set("widgetId",this.mockWidget.id),l.searchParams.set("parentUrl",window.location.href.split("#",2)[0]),this.scalarToken&&l.searchParams.set("scalar_token",this.scalarToken)),l.toString().replace(/%24/g,"$")}get isManagedByManager(){return!!this.scalarToken}get started(){return!!this.messaging}startMessaging(e){if(this.started)return;const t=this.appTileProps.whitelistCapabilities||[],a=new Ki(t,this.mockWidget,this.kind,this.virtual,this.roomId);this.messaging=new Xa.ClientWidgetApi(this.mockWidget,e,a),this.messaging.on("preparing",(()=>this.emit("preparing"))),this.messaging.on("ready",(()=>{Za.a.instance.storeMessaging(this.mockWidget,this.roomId,this.messaging),this.emit("ready")})),this.messaging.on("capabilitiesNotified",(()=>this.emit("capabilitiesNotified"))),this.messaging.on(`action:${Xa.WidgetApiFromWidgetAction.OpenModalWidget}`,this.onOpenModal),this.messaging.on(`action:${nn.a.JoinCall}`,(()=>{var e;null===(e=rt.b.instance.voiceBroadcastRecordingsStore.getCurrent())||void 0===e||e.pause()})),this.messaging.on(`action:${nn.a.ViewRoom}`,(e=>{var t;e.preventDefault();const a=(e.detail.data||{}).room_id;var n,i;return a?null!==(t=this.messaging)&&void 0!==t&&t.hasCapability(Li.a.CanChangeViewedRoom)?(v.a.dispatch({action:U.a.ViewRoom,room_id:a,metricsTrigger:"Widget"}),void this.messaging.transport.reply(e.detail,{})):null===(i=this.messaging)||void 0===i?void 0:i.transport.reply(e.detail,{error:{message:"This widget does not have permission for this action (denied)."}}):null===(n=this.messaging)||void 0===n?void 0:n.transport.reply(e.detail,{error:{message:"Room ID not supplied."}})}));for(const e of this.client.getRooms()){var n;const t=(null===(n=e.getLiveTimeline())||void 0===n?void 0:n.getEvents())||[],a=t[t.length-1];a&&(this.readUpToMap[e.roomId]=a.getId())}this.client.on(o.b.Event,this.onEvent),this.client.on(Oa.c.Decrypted,this.onEventDecrypted),this.client.on(o.b.ToDeviceEvent,this.onToDeviceEvent),this.messaging.on(`action:${Xa.WidgetApiFromWidgetAction.UpdateAlwaysOnScreen}`,(e=>{var t;null!==(t=this.messaging)&&void 0!==t&&t.hasCapability(Xa.MatrixCapabilities.AlwaysOnScreen)&&(ki.b.instance.setWidgetPersistence(this.mockWidget.id,this.roomId,e.detail.data.value),e.preventDefault(),this.messaging.transport.reply(e.detail,{}))})),this.messaging.on(`action:${Xa.WidgetApiFromWidgetAction.SendSticker}`,(e=>{var t;null!==(t=this.messaging)&&void 0!==t&&t.hasCapability(Xa.MatrixCapabilities.StickerSending)&&(e.preventDefault(),this.messaging.transport.reply(e.detail,{}),v.a.dispatch({action:"m.sticker",data:e.detail.data,widgetId:this.mockWidget.id}))})),tn.a.STICKERPICKER.matches(this.mockWidget.type)&&this.messaging.on(`action:${nn.a.OpenIntegrationManager}`,(e=>{var t;e.preventDefault(),null===(t=this.messaging)||void 0===t||t.transport.reply(e.detail,{}),v.a.dispatch({action:"stickerpicker_close"});const a=e.detail.data,n=null==a?void 0:a.integType,i=null==a?void 0:a.integId;Ha.a.sharedInstance().getPrimaryManager().open(this.client.getRoom(rt.b.instance.roomViewStore.getRoomId()),`type_${n}`,i)})),tn.a.JITSI.matches(this.mockWidget.type)&&this.messaging.on(`action:${nn.a.HangupCall}`,(e=>{var t,a;e.preventDefault(),null!==(t=e.detail.data)&&void 0!==t&&t.errorMessage&&H.b.createDialog(en.a,{title:Object(N.a)("Connection lost"),description:Object(N.a)("You were disconnected from the call. (Error: %(message)s)",{message:e.detail.data.errorMessage})}),null===(a=this.messaging)||void 0===a||a.transport.reply(e.detail,{})}))}async prepare(){var e,t;if(await(null!==(e=null==as||null===(t=as.isReady)||void 0===t?void 0:t.call(as))&&void 0!==e?e:Promise.resolve()),this.scalarToken)return;const a=Za.a.instance.getMessaging(this.mockWidget,this.roomId);a&&(this.messaging=a);try{if(Wa.a.isScalarUrl(this.mockWidget.templateUrl)){const e=Ha.a.sharedInstance();if(e.hasManager()){const t=e.getPrimaryManager();if(Wa.a.isScalarUrl(t.apiUrl)){const e=t.getScalarClient();this.scalarToken=await e.getScalarToken()}}}}catch(e){ga.a.error("Error preparing widget communications: ",e)}}stopMessaging(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{forceDestroy:!1};null!=e&&e.forceDestroy||!ki.b.instance.getWidgetPersistence(this.mockWidget.id,this.roomId)?this.started&&(Za.a.instance.stopMessaging(this.mockWidget,this.roomId),this.messaging=null,this.client.off(o.b.Event,this.onEvent),this.client.off(Oa.c.Decrypted,this.onEventDecrypted),this.client.off(o.b.ToDeviceEvent,this.onToDeviceEvent)):ga.a.log("Skipping destroy - persistent widget")}feedEvent(e){if(!this.messaging)return;const t=this.readUpToMap[e.getRoomId()];if(t){if(t===e.getId())return;let a=!0;const n=this.client.getRoom(e.getRoomId()).getLiveTimeline(),i=Object(Ni.b)(n.getEvents()).reverse().slice(0,100);for(const n of i){if(n.getId()===t)break;if(n.getId()===e.getId()){a=!1;break}}if(a)return}const a=e.getRoomId(),n=e.getId();if(a&&n){const e=this.client.getRoom(a);e&&"join"===e.getMyMembership()&&(this.readUpToMap[a]=n)}const i=e.getEffectiveEvent();this.messaging.feedEvent(i,this.eventListenerRoomId).catch((e=>{ga.a.error("Error sending event to widget: ",e)}))}}function os(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function ls(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?os(Object(a),!0).forEach((function(t){i()(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):os(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}class cs extends r.a.Component{constructor(e){super(e),i()(this,"context",void 0),i()(this,"contextMenuButton",Object(s.createRef)()),i()(this,"iframe",void 0),i()(this,"allowedWidgetsWatchRef",void 0),i()(this,"persistKey",void 0),i()(this,"sgWidget",void 0),i()(this,"dispatcherRef",void 0),i()(this,"unmounted",void 0),i()(this,"watchUserReady",(()=>{ht.a.instance.isProfileInfoFetched||ht.a.instance.once(pt.b,this.onUserReady)})),i()(this,"onUserReady",(()=>{this.setState({isUserProfileReady:!0})})),i()(this,"hasPermissionToLoad",(e=>{var t;if(this.usingLocalWidget())return!0;if(!e.room)return!0;const a=b.b.getValue("allowedWidgets",e.room.roomId);return void 0!==e.app.eventId&&null!==(t=a[e.app.eventId])&&void 0!==t&&t||e.userId===e.creatorUserId})),i()(this,"onMyMembership",((e,t)=>{var a;"leave"!==t&&"ban"!==t||e.roomId!==(null===(a=this.props.room)||void 0===a?void 0:a.roomId)||this.onUserLeftRoom()})),i()(this,"onAllowedWidgetsChange",(()=>{const e=this.hasPermissionToLoad(this.props);var t;this.state.hasPermissionToLoad&&!e&&(ki.b.instance.destroyPersistentWidget(this.props.app.id,this.props.app.roomId),Ii.destroyElement(this.persistKey),null===(t=this.sgWidget)||void 0===t||t.stopMessaging());this.setState({hasPermissionToLoad:e})})),i()(this,"iframeRefChange",(e=>{this.iframe=e,this.unmounted||(e?this.startMessaging():this.resetWidget(this.props))})),i()(this,"onWidgetPreparing",(()=>{this.setState({loading:!1})})),i()(this,"onWidgetCapabilitiesNotified",(()=>{this.setState({requiresClient:this.sgWidget.widgetApi.hasCapability(Li.a.RequiresClient)})})),i()(this,"onAction",(e=>{var t;switch(e.action){case"m.sticker":e.widgetId===this.props.app.id&&this.sgWidget.widgetApi.hasCapability(Xa.MatrixCapabilities.StickerSending)?(v.a.dispatch({action:"post_sticker_message",data:ls(ls({},e.data),{},{threadId:this.props.threadId})}),v.a.dispatch({action:"stickerpicker_close"})):ga.a.warn("Ignoring sticker message. Invalid capability");break;case U.a.AfterLeaveRoom:e.room_id===(null===(t=this.props.room)||void 0===t?void 0:t.roomId)&&this.onUserLeftRoom()}})),i()(this,"grantWidgetPermission",(()=>{var e;const t=null===(e=this.props.room)||void 0===e?void 0:e.roomId;ga.a.info("Granting permission for widget to load: "+this.props.app.eventId);const a=b.b.getValue("allowedWidgets",t);void 0!==this.props.app.eventId&&(a[this.props.app.eventId]=!0);const n=b.b.firstSupportedLevel("allowedWidgets");b.b.setValue("allowedWidgets",t,n,a).then((()=>{this.setState({hasPermissionToLoad:!0}),this.startWidget()})).catch((e=>{ga.a.error(e)}))})),i()(this,"onPopoutWidgetClick",(()=>{tn.a.JITSI.matches(this.props.app.type)&&this.reload(),Object.assign(document.createElement("a"),{target:"_blank",href:this.sgWidget.popoutUrl,rel:"noreferrer noopener"}).click()})),i()(this,"onToggleMaximisedClick",(()=>{if(!this.props.room)return;const e=an.d.instance.isInContainer(this.props.room,this.props.app,an.a.Center)?an.a.Top:an.a.Center;an.d.instance.moveToContainer(this.props.room,this.props.app,e)})),i()(this,"onMinimiseClicked",(()=>{this.props.room&&an.d.instance.moveToContainer(this.props.room,this.props.app,an.a.Right)})),i()(this,"onContextMenuClick",(()=>{this.setState({menuDisplayed:!0})})),i()(this,"closeContextMenu",(()=>{this.setState({menuDisplayed:!1})})),this.props.miniMode||ki.b.instance.dockWidget(this.props.app.id,this.props.app.roomId),this.persistKey="widget_"+Wa.a.getWidgetUid(this.props.app);try{this.sgWidget=new rs(this.props),this.setupSgListeners()}catch(e){ga.a.log("Failed to construct widget",e),this.sgWidget=null}this.state=this.getNewState(e)}onUserLeftRoom(){ki.b.instance.getWidgetPersistence(this.props.app.id,this.props.app.roomId)&&(this.props.room&&rt.b.instance.roomViewStore.getRoomId()!==this.props.room.roomId?this.endWidgetActions():tn.a.JITSI.matches(this.props.app.type)?this.reload():ki.b.instance.destroyPersistentWidget(this.props.app.id,this.props.app.roomId))}determineInitialRequiresClientState(){try{const e=new ss(this.props.app),t=Za.a.instance.getMessaging(e,this.props.room.roomId);if(t)return t.hasCapability(Li.a.RequiresClient)}catch{}return!0}getNewState(e){return{initialising:!0,loading:this.props.waitForIframeLoad&&!Ii.isMounted(this.persistKey),hasPermissionToLoad:this.hasPermissionToLoad(e),isUserProfileReady:ht.a.instance.isProfileInfoFetched,error:null,menuDisplayed:!1,requiresClient:this.determineInitialRequiresClientState()}}isMixedContent(){const e=window.location.protocol,t=wi.a.parse(this.props.app.url).protocol;return"https:"===e&&"https:"!==t&&(ga.a.warn("Refusing to load mixed-content app:",e,t,window.location,this.props.app.url),!0)}componentDidMount(){this.sgWidget&&this.state.hasPermissionToLoad&&this.startWidget(),this.watchUserReady(),this.props.room&&this.context.on(te.d.MyMembership,this.onMyMembership),this.allowedWidgetsWatchRef=b.b.watchSetting("allowedWidgets",null,this.onAllowedWidgetsChange),this.dispatcherRef=v.a.register(this.onAction)}componentWillUnmount(){this.unmounted=!0,this.props.miniMode||ki.b.instance.undockWidget(this.props.app.id,this.props.app.roomId),ki.b.instance.isLive(this.props.app.id,this.props.app.roomId)||this.endWidgetActions(),this.dispatcherRef&&v.a.unregister(this.dispatcherRef),this.props.room&&this.context.off(te.d.MyMembership,this.onMyMembership),b.b.unwatchSetting(this.allowedWidgetsWatchRef),ht.a.instance.removeListener(pt.b,this.onUserReady)}setupSgListeners(){this.sgWidget.on("preparing",this.onWidgetPreparing),this.sgWidget.on("capabilitiesNotified",this.onWidgetCapabilitiesNotified)}stopSgListeners(){this.sgWidget&&(this.sgWidget.off("preparing",this.onWidgetPreparing),this.sgWidget.off("capabilitiesNotified",this.onWidgetCapabilitiesNotified))}resetWidget(e){var t;null===(t=this.sgWidget)||void 0===t||t.stopMessaging(),this.stopSgListeners();try{this.sgWidget=new rs(e),this.setupSgListeners(),this.startWidget()}catch(e){ga.a.error("Failed to construct widget",e),this.sgWidget=null}}startWidget(){this.sgWidget.prepare().then((()=>{this.unmounted||this.setState({initialising:!1})}))}startMessaging(){try{var e;null===(e=this.sgWidget)||void 0===e||e.startMessaging(this.iframe)}catch(e){ga.a.error("Failed to start widget",e)}}componentDidUpdate(e){e.app.url!==this.props.app.url&&(this.getNewState(this.props),this.state.hasPermissionToLoad&&this.resetWidget(this.props))}async endWidgetActions(){var e;this.iframe&&(this.iframe.src="about:blank"),tn.a.JITSI.matches(this.props.app.type)&&this.props.room&&B.b.instance.hangupCallApp(this.props.room.roomId),Ii.destroyElement(this.persistKey),ki.b.instance.destroyPersistentWidget(this.props.app.id,this.props.app.roomId),null===(e=this.sgWidget)||void 0===e||e.stopMessaging({forceDestroy:!0})}formatAppTileName(){let e="No name";return this.props.app.name&&this.props.app.name.trim()&&(e=this.props.app.name.trim()),e}usingLocalWidget(){return tn.a.JITSI.matches(this.props.app.type)}getTileTitle(){const e=this.formatAppTileName(),t=r.a.createElement("span",null," - ");let a="";return this.props.widgetPageTitle&&this.props.widgetPageTitle!==this.formatAppTileName()&&(a=this.props.widgetPageTitle),r.a.createElement("span",null,r.a.createElement(qa,{app:this.props.app}),r.a.createElement("b",null,e),r.a.createElement("span",null,a?t:"",a))}reload(){this.endWidgetActions().then((()=>{this.resetWidget(this.props),this.startMessaging(),this.iframe&&(this.iframe.src=this.sgWidget.embedUrl)}))}render(){let e;const t="mx_AppTileBody"+(this.props.miniMode?"_mini ":" "),a={};this.props.pointerEvents&&(a.pointerEvents=this.props.pointerEvents);const n=r.a.createElement("div",{className:"mx_AppLoading_spinner_fadeIn"},r.a.createElement(pn.a,{message:Object(N.a)("Loading…")})),i=Wa.a.getWidgetName(this.props.app);if(null===this.sgWidget)e=r.a.createElement("div",{className:t,style:a},r.a.createElement(xi,{errorMsg:Object(N.a)("Error loading Widget")}));else if(this.state.hasPermissionToLoad){if(this.state.initialising||!this.state.isUserProfileReady)e=r.a.createElement("div",{className:t+(this.state.loading?"mx_AppLoading":""),style:a},n);else if(this.isMixedContent())e=r.a.createElement("div",{className:t,style:a},r.a.createElement(xi,{errorMsg:Object(N.a)("Error - Mixed content")}));else if(e=r.a.createElement("div",{className:t+(this.state.loading?"mx_AppLoading":""),style:a},this.state.loading&&n,r.a.createElement("iframe",{title:i,allow:"microphone; camera; encrypted-media; autoplay; display-capture; clipboard-write; clipboard-read;",ref:this.iframeRefChange,src:this.sgWidget.embedUrl,allowFullScreen:!0,sandbox:"allow-forms allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-scripts allow-presentation allow-downloads"})),!this.props.userWidget){const t=101;e=r.a.createElement("div",{className:"mx_AppTile_persistedWrapper"},r.a.createElement(Ii,{zIndex:this.props.miniMode?t:9,persistKey:this.persistKey,moveRef:this.props.movePersistedElement},e))}}else{const n=this.context.isRoomEncrypted(this.props.room.roomId);e=r.a.createElement("div",{className:t,style:a},r.a.createElement(Ci,{roomId:this.props.room.roomId,creatorUserId:this.props.creatorUserId,url:this.sgWidget.embedUrl,isRoomEncrypted:n,onPermissionGranted:this.grantWidgetPermission}))}let s,o;s=this.props.miniMode?{mx_AppTile_mini:!0}:this.props.fullWidth?{mx_AppTileFullWidth:!0}:{mx_AppTile:!0},s=c()(s),this.state.menuDisplayed&&(o=r.a.createElement(ln,Z()({},Object(ce.i)(this.contextMenuButton.current.getBoundingClientRect(),null),{app:this.props.app,onFinished:this.closeContextMenu,showUnpin:!this.props.userWidget,userWidget:this.props.userWidget,onEditClick:this.props.onEditClick,onDeleteClick:this.props.onDeleteClick})));const l=[];if(this.props.showLayoutButtons){const e=an.d.instance.isInContainer(this.props.room,this.props.app,an.a.Center),t=c()({mx_AppTileMenuBar_iconButton:!0,mx_AppTileMenuBar_iconButton_collapse:e,mx_AppTileMenuBar_iconButton_maximise:!e});l.push(r.a.createElement(G.a,{key:"toggleMaximised",className:t,title:e?Object(N.a)("Un-maximise"):Object(N.a)("Maximise"),onClick:this.onToggleMaximisedClick})),l.push(r.a.createElement(G.a,{key:"minimise",className:"mx_AppTileMenuBar_iconButton mx_AppTileMenuBar_iconButton_minimise",title:Object(N.a)("Minimise"),onClick:this.onMinimiseClicked}))}return r.a.createElement(r.a.Fragment,null,r.a.createElement("div",{className:s,id:this.props.app.id},this.props.showMenubar&&r.a.createElement("div",{className:"mx_AppTileMenuBar"},r.a.createElement("span",{className:"mx_AppTileMenuBarTitle",style:{pointerEvents:this.props.handleMinimisePointerEvents?"all":"none"}},this.props.showTitle&&this.getTileTitle()),r.a.createElement("span",{className:"mx_AppTileMenuBarWidgets"},l,this.props.showPopout&&!this.state.requiresClient&&r.a.createElement(G.a,{className:"mx_AppTileMenuBar_iconButton mx_AppTileMenuBar_iconButton_popout",title:Object(N.a)("Popout widget"),onClick:this.onPopoutWidgetClick}),r.a.createElement(ce.b,{className:"mx_AppTileMenuBar_iconButton mx_AppTileMenuBar_iconButton_menu",label:Object(N.a)("Options"),isExpanded:this.state.menuDisplayed,inputRef:this.contextMenuButton,onClick:this.onContextMenuClick}))),e),o)}}i()(cs,"contextType",R.a),i()(cs,"defaultProps",{waitForIframeLoad:!0,showMenubar:!0,showTitle:!0,showPopout:!0,handleMinimisePointerEvents:!1,userWidget:!1,miniMode:!1,threadId:null,showLayoutButtons:!0});var ds=e=>{let{room:t,widgetId:a,onClose:n}=e;const i=Object(s.useContext)(R.a),o=pi(t).find((e=>e.id===a)),l=o&&an.d.instance.isInContainer(t,o,an.a.Right),[c,d,m,u]=Object(ce.q)();if(Object(s.useEffect)((()=>{o&&l||Aa.a.instance.popCard()}),[o,l]),!o||!l)return null;let h;if(c){const e=d.current.getBoundingClientRect();h=r.a.createElement(ln,{chevronFace:ce.a.None,right:Q.b.instance.windowWidth-e.right-12,top:e.bottom+12,onFinished:u,app:o})}const p=r.a.createElement("div",{className:"mx_BaseCard_header_title"},r.a.createElement(la.a,{size:"h4",className:"mx_BaseCard_header_title_heading"},Wa.a.getWidgetName(o)),r.a.createElement(ce.b,{className:"mx_BaseCard_header_title_button--option",inputRef:d,onClick:m,isExpanded:c,label:Object(N.a)("Options")}),h);return r.a.createElement(Ba,{header:p,className:"mx_WidgetCard",onClose:n,withoutScrollContainer:!0},r.a.createElement(cs,{app:o,fullWidth:!0,showMenubar:!1,room:t,userId:i.getUserId(),creatorUserId:o.creatorUserId,widgetPageTitle:Wa.a.getWidgetDataTitle(o),waitForIframeLoad:o.waitForIframeLoad}))},ms=a(230),us=a(231),hs=a(557),ps=a(333),gs=a(630),vs=a(881),bs=a(268);class fs extends r.a.Component{constructor(e){super(e),i()(this,"userLastModifiedTime",void 0),i()(this,"memberLastModifiedTime",void 0),i()(this,"onRoomStateEvents",(e=>{if(e.getType()!==ee.b.RoomEncryption)return;const{roomId:t}=this.props.member;if(e.getRoomId()!==t)return;lt.a.get().removeListener(m.b.Events,this.onRoomStateEvents),this.setState({isRoomEncrypted:!0}),this.updateE2EStatus()})),i()(this,"onUserTrustStatusChanged",((e,t)=>{e===this.props.member.userId&&this.updateE2EStatus()})),i()(this,"onDeviceVerificationChanged",((e,t,a)=>{e===this.props.member.userId&&this.updateE2EStatus()})),i()(this,"onClick",(()=>{v.a.dispatch({action:U.a.ViewUser,member:this.props.member,push:!0})})),this.state={isRoomEncrypted:!1,e2eStatus:null}}componentDidMount(){const e=lt.a.get(),{roomId:t}=this.props.member;if(t){const a=e.isRoomEncrypted(t);this.setState({isRoomEncrypted:a}),a?(e.on(Ca.b.UserTrustStatusChanged,this.onUserTrustStatusChanged),e.on(Ca.b.DeviceVerificationChanged,this.onDeviceVerificationChanged),this.updateE2EStatus()):e.on(m.b.Events,this.onRoomStateEvents)}}componentWillUnmount(){const e=lt.a.get();e&&(e.removeListener(m.b.Events,this.onRoomStateEvents),e.removeListener(Ca.b.UserTrustStatusChanged,this.onUserTrustStatusChanged),e.removeListener(Ca.b.DeviceVerificationChanged,this.onDeviceVerificationChanged))}async updateE2EStatus(){const e=lt.a.get(),{userId:t}=this.props.member,a=t===e.getUserId(),n=e.checkUserTrust(t);if(!n.isCrossSigningVerified())return void this.setState({e2eStatus:n.wasCrossSigningVerified()?bs.a.Warning:bs.a.Normal});const i=e.getStoredDevicesForUser(t).some((n=>{const{deviceId:i}=n,s=e.checkDeviceTrust(t,i);return a?!s.isCrossSigningVerified():!s.isVerified()}));this.setState({e2eStatus:i?bs.a.Warning:bs.a.Verified})}shouldComponentUpdate(e,t){return void 0===this.memberLastModifiedTime||this.memberLastModifiedTime<e.member.getLastModifiedTime()||(!(!e.member.user||!(void 0===this.userLastModifiedTime||this.userLastModifiedTime<e.member.user.getLastModifiedTime()))||(t.isRoomEncrypted!==this.state.isRoomEncrypted||t.e2eStatus!==this.state.e2eStatus))}getDisplayName(){return this.props.member.name}getPowerLabel(){return Object(N.a)("%(userName)s (power %(powerLevelNumber)s)",{userName:ft.a.getDisplayUserIdentifier(this.props.member.userId,{roomId:this.props.member.roomId}),powerLevelNumber:this.props.member.powerLevel}).trim()}render(){var e,t;const a=this.props.member,n=this.getDisplayName(),i=null!==(e=null===(t=a.user)||void 0===t?void 0:t.presence)&&void 0!==e?e:null,s=r.a.createElement(yn.b,{member:a,width:36,height:36,"aria-hidden":"true"});a.user&&(this.userLastModifiedTime=a.user.getLastModifiedTime()),this.memberLastModifiedTime=a.getLastModifiedTime();const o=new Map([[100,gs.a.Admin],[50,gs.a.Moderator]]);let l=this.props.member.powerLevel;for(const[e]of o)if(this.props.member.powerLevel>=e){l=e;break}const c=o.get(l);let d;this.state.isRoomEncrypted&&(d=this.state.e2eStatus);const m=r.a.createElement(vs.a,{member:a,fallbackName:n||""});return r.a.createElement(gs.b,Z()({},this.props,{presenceState:i,presenceLastActiveAgo:a.user?a.user.lastActiveAgo:0,presenceLastTs:a.user?a.user.lastPresenceTs:0,presenceCurrentlyActive:!!a.user&&a.user.currentlyActive,avatarJsx:s,title:this.getPowerLabel(),name:n,nameJSX:m,powerStatus:c,showPresence:this.props.showPresence,e2eStatus:d,onClick:this.onClick}))}}i()(fs,"defaultProps",{showPresence:!0});class ys extends r.a.Component{constructor(e,t){super(e),i()(this,"showPresence",!0),i()(this,"mounted",!1),i()(this,"context",void 0),i()(this,"onUserPresenceChange",((e,t)=>{this.refs[t.userId]&&this.updateList()})),i()(this,"onRoom",(e=>{e.roomId===this.props.roomId&&this.updateListNow(!0)})),i()(this,"onMyMembership",((e,t,a)=>{e.roomId===this.props.roomId&&"join"===t&&"join"!==a&&this.updateListNow(!0)})),i()(this,"onRoomStateUpdate",(e=>{e.roomId===this.props.roomId&&this.updateList()})),i()(this,"onRoomMemberName",((e,t)=>{t.roomId===this.props.roomId&&this.updateList()})),i()(this,"onRoomStateEvent",(e=>{e.getRoomId()===this.props.roomId&&e.getType()===ee.b.RoomThirdPartyInvite&&this.updateList(),this.canInvite!==this.state.canInvite&&this.setState({canInvite:this.canInvite})})),i()(this,"updateList",Object(k.throttle)((()=>{this.updateListNow(!1)}),500,{leading:!0,trailing:!0})),i()(this,"createOverflowTileJoined",((e,t)=>this.createOverflowTile(e,t,this.showMoreJoinedMemberList))),i()(this,"createOverflowTileInvited",((e,t)=>this.createOverflowTile(e,t,this.showMoreInvitedMemberList))),i()(this,"createOverflowTile",((e,t,n)=>{const i=Object(N.a)("and %(count)s others...",{count:e});return r.a.createElement(gs.b,{className:"mx_EntityTile_ellipsis",avatarJsx:r.a.createElement(gt.a,{url:a(886).default,name:"...",width:36,height:36}),name:i,presenceState:"online",suppressOnHover:!0,onClick:n})})),i()(this,"showMoreJoinedMemberList",(()=>{this.setState({truncateAtJoined:this.state.truncateAtJoined+100})})),i()(this,"showMoreInvitedMemberList",(()=>{this.setState({truncateAtInvited:this.state.truncateAtInvited+100})})),i()(this,"onSearchQueryChanged",(e=>{this.props.onSearchQueryChanged(e)})),i()(this,"onPending3pidInviteClick",(e=>{v.a.dispatch({action:"view_3pid_invite",event:e})})),i()(this,"getChildrenJoined",((e,t)=>this.makeMemberTiles(this.state.filteredJoinedMembers.slice(e,t)))),i()(this,"getChildCountJoined",(()=>this.state.filteredJoinedMembers.length)),i()(this,"getChildrenInvited",((e,t)=>{let a=this.state.filteredInvitedMembers;return t>this.state.filteredInvitedMembers.length&&(a=a.concat(this.getPending3PidInvites())),this.makeMemberTiles(a.slice(e,t))})),i()(this,"getChildCountInvited",(()=>this.state.filteredInvitedMembers.length+(this.getPending3PidInvites()||[]).length)),i()(this,"onInviteButtonClick",(e=>{re.b.trackInteraction("WebRightPanelMemberListInviteButton",e),lt.a.get().isGuest()?v.a.dispatch({action:"require_registration"}):v.a.dispatch({action:"view_invite",roomId:this.props.roomId})})),this.state=this.getMembersState([],[]),this.showPresence=t.memberListStore.isPresenceEnabled(),this.mounted=!0,this.listenForMembersChanges()}listenForMembersChanges(){const e=lt.a.get();e.on(m.b.Update,this.onRoomStateUpdate),e.on(Pa.b.Name,this.onRoomMemberName),e.on(m.b.Events,this.onRoomStateEvent),e.on(ms.b.LastPresenceTs,this.onUserPresenceChange),e.on(ms.b.Presence,this.onUserPresenceChange),e.on(ms.b.CurrentlyActive,this.onUserPresenceChange),e.on(o.b.Room,this.onRoom),e.on(te.d.MyMembership,this.onMyMembership)}componentDidMount(){this.updateListNow(!0)}componentWillUnmount(){this.mounted=!1;const e=lt.a.get();e&&(e.removeListener(m.b.Update,this.onRoomStateUpdate),e.removeListener(Pa.b.Name,this.onRoomMemberName),e.removeListener(te.d.MyMembership,this.onMyMembership),e.removeListener(m.b.Events,this.onRoomStateEvent),e.removeListener(o.b.Room,this.onRoom),e.removeListener(ms.b.LastPresenceTs,this.onUserPresenceChange),e.removeListener(ms.b.Presence,this.onUserPresenceChange),e.removeListener(ms.b.CurrentlyActive,this.onUserPresenceChange)),this.updateList.cancel()}get canInvite(){const e=lt.a.get(),t=e.getRoom(this.props.roomId);return(null==t?void 0:t.canInvite(e.getUserId()))||(null==t?void 0:t.isSpaceRoom())&&t.getJoinRule()===ka.c.Public}getMembersState(e,t){return{loading:!1,filteredJoinedMembers:t,filteredInvitedMembers:e,canInvite:this.canInvite,truncateAtJoined:30,truncateAtInvited:5}}async updateListNow(e){if(!this.mounted)return;e&&this.setState({loading:!0});const{joined:t,invited:a}=await this.context.memberListStore.loadMemberList(this.props.roomId,this.props.searchQuery);this.mounted&&this.setState({loading:!1,filteredJoinedMembers:t,filteredInvitedMembers:a})}memberString(e){if(e){const t=e.user;return"("+e.name+", "+e.powerLevel+", "+(t?t.lastActiveAgo:"<null>")+", "+(t?t.getLastActiveTs():"<null>")+", "+(t?t.currentlyActive:"<null>")+", "+(t?t.presence:"<null>")+")"}return"(null)"}componentDidUpdate(e,t,a){e.searchQuery!==this.props.searchQuery&&this.updateListNow(!1)}getPending3PidInvites(){const e=lt.a.get().getRoom(this.props.roomId);if(e)return e.currentState.getStateEvents("m.room.third_party_invite").filter((function(t){if(!Object(us.c)(t))return!1;return!e.currentState.getInviteForThreePidToken(t.getStateKey())}))}makeMemberTiles(e){return e.map((e=>e instanceof Pa.a?r.a.createElement(fs,{key:e.userId,member:e,ref:e.userId,showPresence:this.showPresence}):r.a.createElement(gs.b,{key:e.getStateKey(),name:e.getContent().display_name,suppressOnHover:!0,onClick:()=>this.onPending3pidInviteClick(e)})))}render(){if(this.state.loading)return r.a.createElement(Ba,{className:"mx_MemberList",onClose:this.props.onClose},r.a.createElement(pn.a,null));const e=lt.a.get().getRoom(this.props.roomId);let t,a,n;if("join"===(null==e?void 0:e.getMyMembership())&&Object(ae.a)(oe.a.InviteUsers)){let a=Object(N.a)("Invite to this room");e.isSpaceRoom()&&(a=Object(N.a)("Invite to this space")),t=r.a.createElement(G.a,{className:"mx_MemberList_invite",onClick:this.onInviteButtonClick,disabled:!this.state.canInvite},r.a.createElement("span",null,a))}this.getChildCountInvited()>0&&(a=r.a.createElement("h2",null,Object(N.a)("Invited")),n=r.a.createElement(hs.a,{className:"mx_MemberList_section mx_MemberList_invited",truncateAt:this.state.truncateAtInvited,createOverflowElement:this.createOverflowTileInvited,getChildren:this.getChildrenInvited,getChildCount:this.getChildCountInvited}));const i=r.a.createElement(ps.a,{className:"mx_MemberList_query mx_textinput_icon mx_textinput_search",placeholder:Object(N.a)("Filter room members"),onSearch:this.onSearchQueryChanged,initialValue:this.props.searchQuery});let s;return null!=e&&e.isSpaceRoom()&&(s=r.a.createElement("div",{className:"mx_RightPanel_scopeHeader"},r.a.createElement(ye.a,{room:e,height:32,width:32}),r.a.createElement(In.a,{room:e}))),r.a.createElement(Ba,{className:"mx_MemberList",header:r.a.createElement(r.a.Fragment,null,s,t),footer:i,onClose:this.props.onClose},r.a.createElement("div",{className:"mx_MemberList_wrapper"},r.a.createElement(hs.a,{className:"mx_MemberList_section mx_MemberList_joined",truncateAt:this.state.truncateAtJoined,createOverflowElement:this.createOverflowTileJoined,getChildren:this.getChildrenJoined,getChildCount:this.getChildCountJoined}),a,n))}}i()(ys,"contextType",rt.a);var Es=a(659),_s=a(522),Ss=a(656),ws=a(935),Os=a(403),Cs=a(621),xs=a(885),ks=a(1535);class js extends r.a.Component{constructor(e){super(e),i()(this,"onOk",(e=>{e.preventDefault(),this.props.onFinished(!0,this.state.reason)})),i()(this,"onCancel",(()=>{this.props.onFinished(!1)})),i()(this,"onReasonChange",(e=>{this.setState({reason:e.target.value})})),this.state={reason:""}}render(){const e=this.props.danger?"danger":"";let t;this.props.askReason&&(t=r.a.createElement("form",{onSubmit:this.onOk},r.a.createElement(Dn.a,{type:"text",onChange:this.onReasonChange,value:this.state.reason,className:"mx_ConfirmUserActionDialog_reasonField",label:Object(N.a)("Reason"),autoFocus:!0})));const a=r.a.createElement(yn.b,{member:this.props.member,width:48,height:48}),n=this.props.member.name,i=this.props.member.userId,s=ft.a.getDisplayUserIdentifier(i,{roomId:this.props.roomId,withDisplayName:!0});return r.a.createElement(Tn.a,{className:c()("mx_ConfirmUserActionDialog",this.props.className),onFinished:this.props.onFinished,title:this.props.title,contentId:"mx_Dialog_content"},r.a.createElement("div",{id:"mx_Dialog_content",className:"mx_Dialog_content"},r.a.createElement("div",{className:"mx_ConfirmUserActionDialog_user"},r.a.createElement("div",{className:"mx_ConfirmUserActionDialog_avatar"},a),r.a.createElement("div",{className:"mx_ConfirmUserActionDialog_name"},n),r.a.createElement("div",{className:"mx_ConfirmUserActionDialog_userId"},s)),t,this.props.children),r.a.createElement(Nn.a,{primaryButton:this.props.action,onPrimaryButtonClick:this.onOk,primaryButtonClass:e,focus:!this.props.askReason,onCancel:this.onCancel}))}}i()(js,"defaultProps",{danger:!1,askReason:!1});var Rs=a(823);const Is=["space","spaceChildFilter","allLabel","specificLabel","noneLabel","warningMessage","onFinished"];var Ts=e=>{let{space:t,spaceChildFilter:a,allLabel:n,specificLabel:i,noneLabel:o,warningMessage:l,onFinished:c}=e,d=ve()(e,Is);const m=Object(s.useMemo)((()=>{const e=$.a.instance.getChildren(t.roomId);return a?e.filter(a):e}),[t.roomId,a]),[u,h]=Object(s.useState)([]),p=Object(s.useMemo)((()=>new Set(u)),[u]);let g;return l&&(g=r.a.createElement("div",{className:"mx_ConfirmSpaceUserActionDialog_warning"},l)),r.a.createElement(js,Z()({},d,{onFinished:(e,t)=>{c(e,t,u)},className:"mx_ConfirmSpaceUserActionDialog",roomId:t.roomId}),g,r.a.createElement(Rs.a,{space:t,spaceChildren:m,selected:p,allLabel:n,specificLabel:i,noneLabel:o,onChange:h}))},Ns=a(402);const Ds=["user","room","onClose","phase"];function Ps(e){var t;let{userId:a,device:n}=e;const i=Object(s.useContext)(R.a),o=a===i.getUserId(),l=i.checkDeviceTrust(a,n.deviceId),d=i.checkUserTrust(a),m=o?l.isCrossSigningVerified():l.isVerified(),u=c()("mx_UserInfo_device",{mx_UserInfo_device_verified:m,mx_UserInfo_device_unverified:!m}),h=c()("mx_E2EIcon",{mx_E2EIcon_normal:!d.isVerified(),mx_E2EIcon_verified:m,mx_E2EIcon_warning:d.isVerified()&&!m}),p=()=>{const e=i.getUser(a);e&&Object(ws.c)(e,n)};let g;g=null!==(t=n.getDisplayName())&&void 0!==t&&t.trim()?n.ambiguous?n.getDisplayName()+" ("+n.deviceId+")":n.getDisplayName():n.deviceId;let v=null;return d.isVerified()&&(v=m?Object(N.a)("Trusted"):Object(N.a)("Not trusted")),m?r.a.createElement("div",{className:u,title:n.deviceId},r.a.createElement("div",{className:h}),r.a.createElement("div",{className:"mx_UserInfo_device_name"},g),r.a.createElement("div",{className:"mx_UserInfo_device_trusted"},v)):r.a.createElement(G.a,{className:u,title:n.deviceId,onClick:p},r.a.createElement("div",{className:h}),r.a.createElement("div",{className:"mx_UserInfo_device_name"},g),r.a.createElement("div",{className:"mx_UserInfo_device_trusted"},v))}function Ms(e){let{devices:t,userId:a,loading:n}=e;const i=Object(s.useContext)(R.a),o=i.checkUserTrust(a),[l,c]=Object(s.useState)(!1);if(n)return r.a.createElement(pn.a,null);if(null===t)return r.a.createElement("p",null,Object(N.a)("Unable to load session list"));const d=a===i.getUserId(),m=t.map((e=>i.checkDeviceTrust(a,e.deviceId)));let u=[];const h=[];let p,g,v,b="mx_E2EIcon";if(o.isVerified()){for(let e=0;e<t.length;++e){const a=t[e],n=m[e];(d?n.isCrossSigningVerified():n.isVerified())?u.push(a):h.push(a)}p=Object(N.a)("%(count)s verified sessions",{count:u.length}),g=Object(N.a)("Hide verified sessions"),b+=" mx_E2EIcon_verified"}else u=t,p=Object(N.a)("%(count)s sessions",{count:t.length}),g=Object(N.a)("Hide sessions"),b+=" mx_E2EIcon_normal";u.length&&(v=l?r.a.createElement(G.a,{kind:"link",className:"mx_UserInfo_expand",onClick:()=>c(!1)},r.a.createElement("div",null,g)):r.a.createElement(G.a,{kind:"link",className:"mx_UserInfo_expand",onClick:()=>c(!0)},r.a.createElement("div",{className:b}),r.a.createElement("div",null,p)));let f=h.map(((e,t)=>r.a.createElement(Ps,{key:t,userId:a,device:e})));if(l){const e=h.length;f=f.concat(u.map(((t,n)=>r.a.createElement(Ps,{key:n+e,userId:a,device:t}))))}return r.a.createElement("div",{className:"mx_UserInfo_devices"},r.a.createElement("div",null,f),r.a.createElement("div",null,v))}const As=e=>{let{member:t}=e;const a=Object(s.useContext)(R.a),[n,i]=Object(s.useState)(!1);return r.a.createElement(G.a,{kind:"link",onClick:async()=>{n||(i(!0),await async function(e,t){const a=new Ns.a({user_id:t.userId,display_name:t.rawDisplayName,avatar_url:t.getMxcAvatarUrl()});Object(Ns.e)(e,[a])}(a,t),i(!1))},className:"mx_UserInfo_field",disabled:n},Object(N.a)("Message"))},Ls=e=>{let{member:t,isIgnored:a,canInvite:n,isSpace:i}=e;const o=Object(s.useContext)(R.a);let l=null,d=null,m=null,u=null;const h=t.userId===o.getUserId(),p=Object(s.useCallback)((()=>{const e=o.getIgnoredUsers(),a=e.indexOf(t.userId);-1!==a&&e.splice(a,1),o.setIgnoredUsers(e)}),[o,t]),g=Object(s.useCallback)((async()=>{const{finished:e}=H.b.createDialog(va.a,{title:Object(N.a)("Ignore %(user)s",{user:t.name}),description:r.a.createElement("div",null,Object(N.a)("All messages and invites from this user will be hidden. Are you sure you want to ignore them?")),button:Object(N.a)("Ignore")}),[a]=await e;if(a){const e=o.getIgnoredUsers();e.push(t.userId),o.setIgnoredUsers(e)}}),[o,t]);if(!h){var b;if(l=r.a.createElement(G.a,{onClick:a?p:g,kind:"link",className:c()("mx_UserInfo_field",{mx_UserInfo_destructive:!a})},a?Object(N.a)("Unignore"):Object(N.a)("Ignore")),t.roomId&&!i){const e=function(){const e=o.getRoom(t.roomId);v.a.dispatch({action:U.a.ViewRoom,highlighted:!0,event_id:(null==e?void 0:e.getEventReadUpTo(t.userId))||void 0,room_id:t.roomId,metricsTrigger:void 0})},a=function(){v.a.dispatch({action:U.a.ComposerInsert,userId:t.userId,timelineRenderingType:Qa.a.Room})},n=o.getRoom(t.roomId);null!=n&&n.getEventReadUpTo(t.userId)&&(u=r.a.createElement(G.a,{kind:"link",onClick:e,className:"mx_UserInfo_field"},Object(N.a)("Jump to read receipt"))),d=r.a.createElement(G.a,{kind:"link",onClick:a,className:"mx_UserInfo_field"},Object(N.a)("Mention"))}if(n&&"leave"===(null!==(b=null==t?void 0:t.membership)&&void 0!==b?b:"leave")&&Object(ae.a)(oe.a.InviteUsers)){const e=t&&t.roomId?t.roomId:rt.b.instance.roomViewStore.getRoomId(),a=async a=>{try{const a=new Es.a(e||"");await a.invite([t.userId]).then((()=>{if("invited"!==a.getCompletionState(t.userId))throw new Error(a.getErrorText(t.userId))}))}catch(e){const t=e instanceof Error?e.message:Object(N.a)("Operation failed");H.b.createDialog(en.a,{title:Object(N.a)("Failed to invite"),description:t})}re.b.trackInteraction("WebRightPanelRoomUserInfoInviteButton",a)};m=r.a.createElement(G.a,{kind:"link",onClick:a,className:"mx_UserInfo_field"},Object(N.a)("Invite"))}}const f=r.a.createElement(G.a,{kind:"link",onClick:()=>{H.b.createDialog(Va.a,{target:t})},className:"mx_UserInfo_field"},Object(N.a)("Share Link to User")),y=h?null:r.a.createElement(As,{member:t});return r.a.createElement("div",{className:"mx_UserInfo_container"},r.a.createElement("h3",null,Object(N.a)("Options")),r.a.createElement("div",null,y,u,f,d,m,l))},Us=async e=>{const{finished:t}=H.b.createDialog(va.a,{title:Object(N.a)("Demote yourself?"),description:r.a.createElement("div",null,e?Object(N.a)("You will not be able to undo this change as you are demoting yourself, if you are the last privileged user in the space it will be impossible to regain privileges."):Object(N.a)("You will not be able to undo this change as you are demoting yourself, if you are the last privileged user in the room it will be impossible to regain privileges.")),button:Object(N.a)("Demote")}),[a]=await t;return a},Fs=e=>{let{children:t}=e;return r.a.createElement("div",{className:"mx_UserInfo_container"},r.a.createElement("h3",null,Object(N.a)("Admin Tools")),r.a.createElement("div",{className:"mx_UserInfo_buttons"},t))},Bs=e=>{var t,a;return(null==e||null===(t=e.currentState)||void 0===t||null===(a=t.getStateEvents(ee.b.RoomPowerLevels,""))||void 0===a?void 0:a.getContent())||{}},Vs=e=>{let{room:t,member:a,startUpdating:n,stopUpdating:i}=e;const o=Object(s.useContext)(R.a);if("invite"!==a.membership&&"join"!==a.membership)return null;const l=t.isSpaceRoom()?"invite"===a.membership?Object(N.a)("Disinvite from space"):Object(N.a)("Remove from space"):"invite"===a.membership?Object(N.a)("Disinvite from room"):Object(N.a)("Remove from room");return r.a.createElement(G.a,{kind:"link",className:"mx_UserInfo_field mx_UserInfo_destructive",onClick:async()=>{const{finished:e}=H.b.createDialog(t.isSpaceRoom()?Ts:js,{member:a,action:t.isSpaceRoom()?"invite"===a.membership?Object(N.a)("Disinvite from space"):Object(N.a)("Remove from space"):"invite"===a.membership?Object(N.a)("Disinvite from room"):Object(N.a)("Remove from room"),title:"invite"===a.membership?Object(N.a)("Disinvite from %(roomName)s",{roomName:t.name}):Object(N.a)("Remove from %(roomName)s",{roomName:t.name}),askReason:"join"===a.membership,danger:!0,space:t,spaceChildFilter:e=>{const t=e.getMember(o.credentials.userId||""),n=e.getMember(a.userId);return t&&n&&n.membership===a.membership&&t.powerLevel>n.powerLevel&&e.currentState.hasSufficientPowerLevelFor("kick",t.powerLevel)},allLabel:Object(N.a)("Remove them from everything I'm able to"),specificLabel:Object(N.a)("Remove them from specific things I'm able to"),warningMessage:Object(N.a)("They'll still be able to access whatever you're not an admin of.")},t.isSpaceRoom()?"mx_ConfirmSpaceUserActionDialog_wrapper":void 0),[s,r,l=[]]=await e;s&&(n(),Object(le.a)(t,l,(e=>o.kick(e.roomId,a.userId,r||void 0))).then((()=>{ga.a.log("Kick success")}),(function(e){ga.a.error("Kick error: "+e),H.b.createDialog(en.a,{title:Object(N.a)("Failed to remove user"),description:e&&e.message?e.message:"Operation failed"})})).finally((()=>{i()})))}},l)},Ws=e=>{let{member:t}=e;const a=Object(s.useContext)(R.a);return r.a.createElement(G.a,{kind:"link",className:"mx_UserInfo_field mx_UserInfo_destructive",onClick:()=>{const e=a.getRoom(t.roomId);e&&H.b.createDialog(ks.a,{matrixClient:a,room:e,member:t})}},Object(N.a)("Remove recent messages"))},Hs=e=>{let{room:t,member:a,startUpdating:n,stopUpdating:i}=e;const o=Object(s.useContext)(R.a),l="ban"===a.membership;let d=t.isSpaceRoom()?Object(N.a)("Ban from space"):Object(N.a)("Ban from room");l&&(d=t.isSpaceRoom()?Object(N.a)("Unban from space"):Object(N.a)("Unban from room"));const m=c()("mx_UserInfo_field",{mx_UserInfo_destructive:!l});return r.a.createElement(G.a,{kind:"link",className:m,onClick:async()=>{const{finished:e}=H.b.createDialog(t.isSpaceRoom()?Ts:js,{member:a,action:t.isSpaceRoom()?l?Object(N.a)("Unban from space"):Object(N.a)("Ban from space"):l?Object(N.a)("Unban from room"):Object(N.a)("Ban from room"),title:l?Object(N.a)("Unban from %(roomName)s",{roomName:t.name}):Object(N.a)("Ban from %(roomName)s",{roomName:t.name}),askReason:!l,danger:!l,space:t,spaceChildFilter:l?e=>{const t=e.getMember(o.credentials.userId||""),n=e.getMember(a.userId);return t&&n&&"ban"===n.membership&&t.powerLevel>n.powerLevel&&e.currentState.hasSufficientPowerLevelFor("ban",t.powerLevel)}:e=>{const t=e.getMember(o.credentials.userId||""),n=e.getMember(a.userId);return t&&n&&"ban"!==n.membership&&t.powerLevel>n.powerLevel&&e.currentState.hasSufficientPowerLevelFor("ban",t.powerLevel)},allLabel:l?Object(N.a)("Unban them from everything I'm able to"):Object(N.a)("Ban them from everything I'm able to"),specificLabel:l?Object(N.a)("Unban them from specific things I'm able to"):Object(N.a)("Ban them from specific things I'm able to"),warningMessage:l?Object(N.a)("They won't be able to access whatever you're not an admin of."):Object(N.a)("They'll still be able to access whatever you're not an admin of.")},t.isSpaceRoom()?"mx_ConfirmSpaceUserActionDialog_wrapper":void 0),[s,r,c=[]]=await e;if(!s)return;n();Object(le.a)(t,c,(e=>{return t=e.roomId,l?o.unban(t,a.userId):o.ban(t,a.userId,r||void 0);var t})).then((()=>{ga.a.log("Ban success")}),(function(e){ga.a.error("Ban error: "+e),H.b.createDialog(en.a,{title:Object(N.a)("Error"),description:Object(N.a)("Failed to ban user")})})).finally((()=>{i()}))}},d)},zs=e=>{let{member:t,room:a,powerLevels:n,startUpdating:i,stopUpdating:o}=e;const l=Object(s.useContext)(R.a);if("join"!==t.membership)return null;const d=((e,t)=>{if(!t||!e)return!1;const a=(t.events?t.events["m.room.message"]:null)||t.events_default;return void 0!==a&&e.powerLevel<a})(t,n),m=c()("mx_UserInfo_field",{mx_UserInfo_destructive:!d}),u=d?Object(N.a)("Unmute"):Object(N.a)("Mute");return r.a.createElement(G.a,{kind:"link",className:m,onClick:async()=>{const e=t.roomId,n=t.userId;if(n===l.getUserId())try{if(!await Us(null==a?void 0:a.isSpaceRoom()))return}catch(e){return void ga.a.error("Failed to warn about self demotion: ",e)}const s=a.currentState.getStateEvents("m.room.power_levels","");if(!s)return;const r=s.getContent(),c=(r.events?r.events["m.room.message"]:null)||r.events_default;let m;m=d?c:c-1,m=parseInt(m),isNaN(m)||(i(),l.setPowerLevel(e,n,m,s).then((()=>{ga.a.log("Mute toggle success")}),(function(e){ga.a.error("Mute error: "+e),H.b.createDialog(en.a,{title:Object(N.a)("Error"),description:Object(N.a)("Failed to mute user")})})).finally((()=>{o()})))}},u)},Gs=e=>{let{room:t,children:a,member:n,startUpdating:i,stopUpdating:o,powerLevels:l}=e;const c=Object(s.useContext)(R.a);let d,m,u,h;const p=(l.events?l.events["m.room.power_levels"]:null)||l.state_default,{ban:g=50,kick:v=50,redact:b=50}=l,f=t.getMember(c.getUserId()||"");if(!f)return r.a.createElement("div",null);const y=f.userId===n.userId,E=n.powerLevel<f.powerLevel||y;return!y&&E&&f.powerLevel>=v&&(d=r.a.createElement(Vs,{room:t,member:n,startUpdating:i,stopUpdating:o})),f.powerLevel>=b&&!t.isSpaceRoom()&&(h=r.a.createElement(Ws,{member:n,startUpdating:i,stopUpdating:o})),!y&&E&&f.powerLevel>=g&&(m=r.a.createElement(Hs,{room:t,member:n,startUpdating:i,stopUpdating:o})),!y&&E&&f.powerLevel>=Number(p)&&!t.isSpaceRoom()&&(u=r.a.createElement(zs,{member:n,room:t,powerLevels:l,startUpdating:i,stopUpdating:o})),d||m||u||h||a?r.a.createElement(Fs,null,u,d,m,h,a):r.a.createElement("div",null)};const Ks=e=>{let{user:t,room:a,roomPermissions:n,powerLevels:i}=e;if(n.canEdit)return r.a.createElement(qs,{user:t,room:a,roomPermissions:n});{const e=i.users_default||0,a=t.powerLevel,n=Object(_s.b)(a,e);return r.a.createElement("div",{className:"mx_UserInfo_profileField"},r.a.createElement("div",{className:"mx_UserInfo_roleDescription"},n))}},qs=e=>{let{user:t,room:a,roomPermissions:n}=e;const i=Object(s.useContext)(R.a),[o,l]=Object(s.useState)(t.powerLevel);Object(s.useEffect)((()=>{l(t.powerLevel)}),[t]);const c=Object(s.useCallback)((async e=>{l(e);const n=t.roomId,s=t.userId,o=a.currentState.getStateEvents("m.room.power_levels","");if(!o)return;const c=i.getUserId(),d=o.getContent().users[c||""];if(d&&parseInt(d)<=e&&c!==s){const{finished:e}=H.b.createDialog(va.a,{title:Object(N.a)("Warning!"),description:r.a.createElement("div",null,Object(N.a)("You will not be able to undo this change as you are promoting the user to have the same power level as yourself."),r.a.createElement("br",null),Object(N.a)("Are you sure?")),button:Object(N.a)("Continue")}),[t]=await e;if(!t)return}else if(c===s&&d&&parseInt(d)>e)try{if(!await Us(null==a?void 0:a.isSpaceRoom()))return}catch(e){ga.a.error("Failed to warn about self demotion: ",e)}await((e,t,a,n)=>i.setPowerLevel(e,t,a,n).then((function(){ga.a.log("Power change success")}),(function(e){ga.a.error("Failed to change power level "+e),H.b.createDialog(en.a,{title:Object(N.a)("Error"),description:Object(N.a)("Failed to change power level")})})))(n,s,e,o)}),[t.roomId,t.userId,i,a]),d=a.currentState.getStateEvents("m.room.power_levels",""),m=d?d.getContent().users_default:0;return r.a.createElement("div",{className:"mx_UserInfo_profileField"},r.a.createElement(Cs.a,{label:void 0,value:o,maxValue:n.modifyLevelMax,usersDefault:m,onChange:c}))},$s=e=>{const t=Object(s.useContext)(R.a),[a,n]=Object(s.useState)(void 0);return Object(s.useEffect)((()=>{n(void 0);let a=!1;return async function(){try{await t.downloadKeys([e],!0);const i=t.getStoredDevicesForUser(e);if(a)return;(e=>{const t=Object.create(null);for(let a=0;a<e.length;a++){const n=e[a].getDisplayName(),i=t[n]||[];i.push(a),t[n]=i}for(const a in t)t[a].length>1&&t[a].forEach((t=>{e[t].ambiguous=!0}))})(i),n(i)}catch(e){n(null)}}(),()=>{a=!0}}),[t,e]),Object(s.useEffect)((()=>{let a=!1;const i=async()=>{const i=t.getStoredDevicesForUser(e);a||n(i)},s=t=>{t.includes(e)&&i()},r=(t,a)=>{t===e&&i()},o=(t,a)=>{t===e&&i()};return t.on(Ca.b.DevicesUpdated,s),t.on(Ca.b.DeviceVerificationChanged,r),t.on(Ca.b.UserTrustStatusChanged,o),()=>{a=!0,t.removeListener(Ca.b.DevicesUpdated,s),t.removeListener(Ca.b.DeviceVerificationChanged,r),t.removeListener(Ca.b.UserTrustStatusChanged,o)}}),[t,e]),a},Ys=e=>{let{room:t,member:a,devices:n,isRoomEncrypted:i}=e;const l=Object(s.useContext)(R.a),c=((e,t)=>{const[a,n]=Object(s.useState)(Bs(t)),i=Object(s.useCallback)((e=>{t&&(e&&e.getType()!==ee.b.RoomPowerLevels||n(Bs(t)))}),[t]);return Object(ie.c)(e,m.b.Events,i),Object(s.useEffect)((()=>(i(),()=>{n({})})),[i]),a})(l,t),d=(e=>{const[t,a]=Object(s.useState)(!1);return Object(s.useEffect)((()=>{e.isSynapseAdministrator().then((e=>{a(e)}),(()=>{a(!1)}))}),[e]),t})(l),[u,h]=Object(s.useState)(l.isUserIgnored(a.userId));Object(s.useEffect)((()=>{h(l.isUserIgnored(a.userId))}),[l,a.userId]);const p=Object(s.useCallback)((e=>{"m.ignored_user_list"===e.getType()&&h(l.isUserIgnored(a.userId))}),[l,a.userId]);Object(ie.c)(l,o.b.AccountData,p);const[g,b]=Object(s.useState)(0),f=Object(s.useCallback)((()=>{b(g+1)}),[g]),y=Object(s.useCallback)((()=>{b(g-1)}),[g]),E=function(e,t,a){const[n,i]=Object(s.useState)({modifyLevelMax:-1,canEdit:!1,canInvite:!1}),r=Object(s.useCallback)((()=>{var n,s;const r=null==t||null===(n=t.currentState.getStateEvents(ee.b.RoomPowerLevels,""))||void 0===n?void 0:n.getContent();if(!r)return;const o=t.getMember(e.getUserId()||"");if(!o)return;const l=a,c=o.userId===l.userId;let d=-1;if(l.powerLevel<o.powerLevel||c){var m,u,h;const e=null!==(m=null!==(u=null===(h=r.events)||void 0===h?void 0:h[ee.b.RoomPowerLevels])&&void 0!==u?u:r.state_default)&&void 0!==m?m:50;o.powerLevel>=e&&(d=o.powerLevel)}i({canInvite:o.powerLevel>=(null!==(s=r.invite)&&void 0!==s?s:0),canEdit:d>=0,modifyLevelMax:d})}),[e,a,t]);return Object(ie.c)(e,m.b.Update,r),Object(s.useEffect)((()=>(r(),()=>{i({modifyLevelMax:-1,canEdit:!1,canInvite:!1})})),[r]),n}(l,t,a),_=Object(s.useCallback)((async()=>{const{finished:e}=H.b.createDialog(va.a,{title:Object(N.a)("Deactivate user?"),description:r.a.createElement("div",null,Object(N.a)("Deactivating this user will log them out and prevent them from logging back in. Additionally, they will leave all the rooms they are in. This action cannot be reversed. Are you sure you want to deactivate this user?")),button:Object(N.a)("Deactivate user"),danger:!0}),[t]=await e;if(t)try{await l.deactivateSynapseUser(a.userId)}catch(e){ga.a.error("Failed to deactivate user"),ga.a.error(e);const t=e instanceof Error?e.message:Object(N.a)("Operation failed");H.b.createDialog(en.a,{title:Object(N.a)("Failed to deactivate user"),description:t})}}),[l,a.userId]);let S,w,O,C;d&&a.userId.endsWith(`:${lt.a.getHomeserverName()}`)&&(S=r.a.createElement(G.a,{kind:"link",className:"mx_UserInfo_field mx_UserInfo_destructive",onClick:_},Object(N.a)("Deactivate user"))),t&&a.roomId?(Ya.a.shared().getUserIdForRoomId(a.roomId)||(O=r.a.createElement("div",{className:"mx_UserInfo_container"},r.a.createElement("h3",null,Object(N.a)("Role in <RoomName/>",{},{RoomName:()=>r.a.createElement("b",null,t.name)})),r.a.createElement(Ks,{powerLevels:c,user:a,room:t,roomPermissions:E}))),C=r.a.createElement(Gs,{powerLevels:c,member:a,room:t,startUpdating:f,stopUpdating:y},S)):S&&(C=r.a.createElement(Fs,null,S)),g>0&&(w=r.a.createElement(pn.a,null));const x=l.isCryptoEnabled();let k,j;i?t.isSpaceRoom()||(k=Object(N.a)("Messages in this room are end-to-end encrypted.")):x?t&&!t.isSpaceRoom()&&(k=Object(N.a)("Messages in this room are not end-to-end encrypted.")):k=Object(N.a)("This client does not support end-to-end encryption.");const I=(e=>Object(bn.a)((async()=>e.doesServerSupportUnstableFeature("org.matrix.e2e_cross_signing")),[e],!1))(l),T=x&&l.checkUserTrust(a.userId),D=x&&T&&T.isCrossSigningVerified(),P=a.userId===l.getUserId(),M=x&&I&&!D&&!P&&n&&n.length>0,A=function(e,t,a,n){return Object(bn.a)((async()=>{if(a){n(!0);try{await e.downloadKeys([t.userId]);const a=e.getStoredCrossSigningForUser(t.userId);return!(!a||!a.getId())}finally{n(!1)}}}),[e,t,a])}(l,a,M,(e=>{b((t=>t+(e?1:-1)))})),L=void 0===n;let F;M&&(void 0!==A?j=r.a.createElement("div",{className:"mx_UserInfo_container_verifyButton"},r.a.createElement(G.a,{kind:"link",className:"mx_UserInfo_field mx_UserInfo_verifyButton",onClick:()=>{A?Object(ws.d)(a):Object(ws.a)(a)}},Object(N.a)("Verify"))):L||(j=r.a.createElement(pn.a,null))),a.userId==l.getUserId()&&(F=r.a.createElement("div",null,r.a.createElement(G.a,{kind:"link",className:"mx_UserInfo_field",onClick:()=>{v.a.dispatch({action:U.a.ViewUserDeviceSettings})}},Object(N.a)("Edit devices"))));const B=r.a.createElement("div",{className:"mx_UserInfo_container"},r.a.createElement("h3",null,Object(N.a)("Security")),r.a.createElement("p",null,k),j,x&&r.a.createElement(Ms,{loading:L,devices:n,userId:a.userId}),F);return r.a.createElement(r.a.Fragment,null,O,B,r.a.createElement(Ls,{canInvite:E.canInvite,isIgnored:u,member:a,isSpace:null==t?void 0:t.isSpaceRoom()}),C,w)},Js=e=>{var t;let{member:a,e2eStatus:n,roomId:i}=e;const o=Object(s.useContext)(R.a),l=Object(s.useCallback)((()=>{const e=a.getMxcAvatarUrl?a.getMxcAvatarUrl():a.avatarUrl;if(!e)return;const t={src:Object(Ga.b)(e).srcHttp,name:a.name||a.displayName};H.b.createDialog(Os.a,t,"mx_Dialog_lightbox",void 0,!0)}),[a]),c=a.avatarUrl,d=r.a.createElement("div",{className:"mx_UserInfo_avatar"},r.a.createElement("div",{className:"mx_UserInfo_avatar_transition"},r.a.createElement("div",{className:"mx_UserInfo_avatar_transition_child"},r.a.createElement(yn.b,{key:a.userId,member:a,width:.6*Q.b.instance.windowHeight,height:.6*Q.b.instance.windowHeight,resizeMethod:"scale",fallbackUserId:a.userId,onClick:l,urls:c?[c]:void 0}))));let m,u,h;a instanceof Pa.a&&a.user&&(m=a.user.presence,u=a.user.lastActiveAgo,h=a.user.currentlyActive);const p=mt.b.get("enable_presence_by_hs_url");let g=!0;p&&void 0!==p[o.baseUrl]&&(g=p[o.baseUrl]);let v=null;g&&(v=r.a.createElement(xs.a,{activeAgo:u,currentlyActive:h,presenceState:m}));const b=n?r.a.createElement(bs.b,{size:18,status:n,isUser:!0}):null,f=a.rawDisplayName;return r.a.createElement(r.a.Fragment,null,d,r.a.createElement("div",{className:"mx_UserInfo_container mx_UserInfo_separator"},r.a.createElement("div",{className:"mx_UserInfo_profile"},r.a.createElement("div",null,r.a.createElement("h2",null,b,r.a.createElement("span",{title:f,"aria-label":f,dir:"auto"},f))),r.a.createElement("div",{className:"mx_UserInfo_profile_mxid"},null===(t=ft.a.getDisplayUserIdentifier)||void 0===t?void 0:t.call(ft.a,a.userId,{roomId:i,withDisplayName:!0})),r.a.createElement("div",{className:"mx_UserInfo_profileStatus"},v))))};var Qs=e=>{let{user:t,room:a,onClose:n,phase:i=Ma.a.RoomMemberInfo}=e,o=ve()(e,Ds);const l=Object(s.useContext)(R.a),c=Object(s.useMemo)((()=>a&&a.getMember(t.userId)||t),[a,t]),d=La(l,a),m=$s(t.userId);let u;d&&m&&(u=((e,t,a)=>{const n=t===e.getUserId(),i=e.checkUserTrust(t);return i.isCrossSigningVerified()?a.some((a=>{const{deviceId:i}=a,s=e.checkDeviceTrust(t,i);return n?!s.isCrossSigningVerified():!s.isVerified()}))?Ja.Warning:Ja.Verified:i.wasCrossSigningVerified()?Ja.Warning:Ja.Normal})(l,t.userId,m));const h=["mx_UserInfo"];let p={};a&&i===Ma.a.EncryptionPanel?p={member:c}:null!=a&&a.isSpaceRoom()&&(p={spaceId:a.roomId});const g=()=>{Aa.a.instance.popCard()};let v,b,f;switch(i){case Ma.a.RoomMemberInfo:case Ma.a.SpaceMemberInfo:v=r.a.createElement(Ys,{room:a,member:c,devices:m,isRoomEncrypted:Boolean(d)});break;case Ma.a.EncryptionPanel:h.push("mx_UserInfo_smallAvatar"),v=r.a.createElement(Ss.a,Z()({},o,{member:c,onClose:g,isRoomEncrypted:Boolean(d)}))}if(i===Ma.a.EncryptionPanel){const e=o.verificationRequest;e&&e.pending&&(b=Object(N.a)("Cancel"))}null!=a&&a.isSpaceRoom()&&(f=r.a.createElement("div",{"data-testid":"space-header",className:"mx_RightPanel_scopeHeader"},r.a.createElement(ye.a,{room:a,height:32,width:32}),r.a.createElement(In.a,{room:a})));const y=r.a.createElement(r.a.Fragment,null,f,r.a.createElement(Js,{member:c,e2eStatus:u,roomId:null==a?void 0:a.roomId}));return r.a.createElement(Ba,{className:h.join(" "),header:y,onClose:n,closeLabel:b,cardState:p,onBack:e=>{Aa.a.instance.previousCard.phase===Ma.a.RoomMemberList&&re.b.trackInteraction("WebRightPanelRoomUserInfoBackButton",e)}},v)};class Xs extends r.a.Component{constructor(e){super(e),i()(this,"room",void 0),i()(this,"onRoomStateEvents",(e=>{if(e.getType()===ee.b.RoomThirdPartyInvite&&e.getStateKey()===this.state.stateKey){const t=e.getContent().display_name,a={invited:Object(us.c)(e)};t&&(a.displayName=t),this.setState(a)}})),i()(this,"onCancel",(()=>{v.a.dispatch({action:"view_3pid_invite",event:null})})),i()(this,"onKickClick",(()=>{lt.a.get().sendStateEvent(this.state.roomId,"m.room.third_party_invite",{},this.state.stateKey).catch((e=>{ga.a.error(e),this.setState({invited:!0}),H.b.createDialog(en.a,{title:Object(N.a)("Failed to revoke invite"),description:Object(N.a)("Could not revoke the invite. The server may be experiencing a temporary problem or you do not have sufficient permissions to revoke the invite.")})})),this.setState({invited:!1})})),this.room=lt.a.get().getRoom(this.props.event.getRoomId());const t=this.room.getMember(lt.a.get().getUserId()),a=this.room.currentState.getStateEvents("m.room.power_levels","");let n=a?a.getContent().kick:50;"number"!=typeof n&&(n=50);const s=this.room.getMember(this.props.event.getSender());this.state={stateKey:this.props.event.getStateKey(),roomId:this.props.event.getRoomId(),displayName:this.props.event.getContent().display_name,invited:!0,canKick:!!t&&t.powerLevel>n,senderName:s?s.name:this.props.event.getSender()}}componentDidMount(){lt.a.get().on(m.b.Events,this.onRoomStateEvents)}componentWillUnmount(){const e=lt.a.get();e&&e.removeListener(m.b.Events,this.onRoomStateEvents)}render(){let e,t=null;return this.state.canKick&&this.state.invited&&(t=r.a.createElement("div",{className:"mx_MemberInfo_container"},r.a.createElement("h3",null,Object(N.a)("Admin Tools")),r.a.createElement("div",{className:"mx_MemberInfo_buttons"},r.a.createElement(G.a,{className:"mx_MemberInfo_field",onClick:this.onKickClick},Object(N.a)("Revoke invite"))))),this.room.isSpaceRoom()&&(e=r.a.createElement("div",{className:"mx_RightPanel_scopeHeader"},r.a.createElement(ye.a,{room:this.room,height:32,width:32}),r.a.createElement(In.a,{room:this.room}))),r.a.createElement("div",{className:"mx_MemberInfo",role:"tabpanel"},e,r.a.createElement("div",{className:"mx_MemberInfo_name"},r.a.createElement(G.a,{className:"mx_MemberInfo_cancel",onClick:this.onCancel,title:Object(N.a)("Close")}),r.a.createElement("h2",null,this.state.displayName)),r.a.createElement("div",{className:"mx_MemberInfo_container"},r.a.createElement("div",{className:"mx_MemberInfo_profile"},r.a.createElement("div",{className:"mx_MemberInfo_profileField"},Object(N.a)("Invited by %(sender)s",{sender:this.state.senderName})))),t)}}var Zs=a(317);let er;function tr(e){let{isRoomEncrypted:t,kind:a}=e;if(!t)return null;if(Zs.a.get())return null;if(Zs.a.error)return r.a.createElement("div",{className:"mx_SearchWarning"},Object(N.a)("Message search initialisation failed, check <a>your settings</a> for more information",{},{a:e=>r.a.createElement(G.a,{kind:"link_inline",onClick:e=>{e.preventDefault(),v.a.dispatch({action:U.a.ViewUserSettings,initialTabId:Ae.a.Security})}},e)}));const n=mt.b.get("brand"),i=mt.b.getObject("desktop_builds");let s=null,o=null;if(i.get("available")){o=r.a.createElement("img",{src:i.get("logo")});const e=i.get("url");switch(a){case er.Files:s=Object(N.a)("Use the <a>Desktop app</a> to see all encrypted files",{},{a:t=>r.a.createElement("a",{href:e,target:"_blank",rel:"noreferrer noopener"},t)});break;case er.Search:s=Object(N.a)("Use the <a>Desktop app</a> to search encrypted messages",{},{a:t=>r.a.createElement("a",{href:e,target:"_blank",rel:"noreferrer noopener"},t)})}}else switch(a){case er.Files:s=Object(N.a)("This version of %(brand)s does not support viewing some encrypted files",{brand:n});break;case er.Search:s=Object(N.a)("This version of %(brand)s does not support searching encrypted messages",{brand:n})}return s?r.a.createElement("div",{className:"mx_SearchWarning"},o,r.a.createElement("span",null,s)):(ga.a.warn("Unknown desktop builds warning kind: ",a),null)}!function(e){e[e.Files=0]="Files",e[e.Search=1]="Search"}(er||(er={}));var ar=a(179),nr=a(513),ir=a(18),sr=a(624),rr=a(329),or=a(652),lr=a(465);const cr=function(){if(b.b.getValue("debug_timeline_panel")){for(var e=arguments.length,t=new Array(e),a=0;a<e;a++)t[a]=arguments[a];ga.a.log.call(console,"TimelinePanel debuglog:",...t)}};class dr extends r.a.Component{constructor(e,t){var a;super(e,t),i()(this,"context",void 0),i()(this,"lastRRSentEventId",void 0),i()(this,"lastRMSentEventId",void 0),i()(this,"messagePanel",Object(s.createRef)()),i()(this,"dispatcherRef",void 0),i()(this,"timelineWindow",void 0),i()(this,"overlayTimelineWindow",void 0),i()(this,"unmounted",!1),i()(this,"readReceiptActivityTimer",null),i()(this,"readMarkerActivityTimer",null),i()(this,"callEventGroupers",new Map),i()(this,"onDumpDebugLogs",(()=>{var e,t,a,n,i;const s=null===(e=this.props.timelineSet)||void 0===e?void 0:e.room,r=null===(t=this.state)||void 0===t||null===(a=t.events)||void 0===a?void 0:a.map((e=>e.getId()));let o,l,c;try{const e=this.messagePanel.current;if(e){const t=Vt.a.findDOMNode(e);if(t){o=[...t.querySelectorAll("[data-event-id]")].map((e=>e.getAttribute("data-event-id")))}}}catch(e){ga.a.error("onDumpDebugLogs: Failed to get the actual event ID's in the DOM",e)}const d={};if(s){const e=s.getTimelineSets(),t=s.threadsTimelineSets;try{l=mr(e),c=mr(t)}catch(e){ga.a.error("onDumpDebugLogs: Failed to serialize event IDs from timelinesets",e)}try{s.getThreads().forEach((e=>{var t,a;d[e.id]={events:e.events.map((e=>e.getId())),numTimelines:e.timelineSet.getTimelines().length,liveTimeline:e.timelineSet.getLiveTimeline().getEvents().length,prevTimeline:null===(t=e.timelineSet.getLiveTimeline().getNeighbouringTimeline(ar.a.Backward))||void 0===t?void 0:t.getEvents().length,nextTimeline:null===(a=e.timelineSet.getLiveTimeline().getNeighbouringTimeline(ar.a.Forward))||void 0===a?void 0:a.getEvents().length}}))}catch(e){ga.a.error("onDumpDebugLogs: Failed to serialize event IDs from the threads",e)}}let m,u;try{m=this.timelineWindow.getEvents().map((e=>e.getId()))}catch(e){ga.a.error("onDumpDebugLogs: Failed to get event IDs from the timelineWindow",e)}try{u=this.props.timelineSet.getPendingEvents().map((e=>e.getId()))}catch(e){ga.a.error("onDumpDebugLogs: Failed to get pending event IDs",e)}ga.a.debug(`TimelinePanel(${this.context.timelineRenderingType}): Debugging info for ${null==s?void 0:s.roomId}\n\tevents(${r.length})=${JSON.stringify(r)}\n\trenderedEventIds(${null!==(n=null===(i=o)||void 0===i?void 0:i.length)&&void 0!==n?n:0})=${JSON.stringify(o)}\n\tserializedEventIdsFromTimelineSets=${JSON.stringify(l)}\n\tserializedEventIdsFromThreadsTimelineSets=${JSON.stringify(c)}\n\tserializedThreadsMap=${JSON.stringify(d)}\n\ttimelineWindowEventIds(${m.length})=${JSON.stringify(m)}\n\tpendingEventIds(${u.length})=${JSON.stringify(u)}`)})),i()(this,"onMessageListUnfillRequest",((e,t)=>{const a=e?ar.b.BACKWARDS:ar.b.FORWARDS;cr("unpaginating events in direction",a);const n=t,i=this.state.events.findIndex((e=>e.getId()===n)),s=e?i+1:this.state.events.length-i;if(s>0){cr("Unpaginating",s,"in direction",a),this.timelineWindow.unpaginate(s,e);const{events:t,liveEvents:n,firstVisibleEventIndex:i}=this.getEvents();this.buildLegacyCallEventGroupers(t);const r={events:t,liveEvents:n,firstVisibleEventIndex:i};e?r.canBackPaginate=!0:r.canForwardPaginate=!0,this.setState(r)}})),i()(this,"onPaginationRequest",((e,t,a)=>this.props.onPaginationRequest?this.props.onPaginationRequest(e,t,a):e.paginate(t,a))),i()(this,"onMessageListFillRequest",(e=>{if(!this.shouldPaginate())return Promise.resolve(!1);const t=e?ar.b.BACKWARDS:ar.b.FORWARDS,a=e?"canBackPaginate":"canForwardPaginate",n=e?"backPaginating":"forwardPaginating";return this.state[a]?this.timelineWindow.canPaginate(t)?e&&0!==this.state.firstVisibleEventIndex?(cr("won't",t,"paginate past first visible event"),Promise.resolve(!1)):(cr("Initiating paginate; backwards:"+e),this.setState({[n]:!0}),this.onPaginationRequest(this.timelineWindow,t,20).then((t=>{if(this.unmounted)return;cr("paginate complete backwards:"+e+"; success:"+t);const{events:i,liveEvents:s,firstVisibleEventIndex:r}=this.getEvents();this.buildLegacyCallEventGroupers(i);const o={[n]:!1,[a]:t,events:i,liveEvents:s,firstVisibleEventIndex:r},l=e?ar.b.FORWARDS:ar.b.BACKWARDS,c=e?"canForwardPaginate":"canBackPaginate";return!this.state[c]&&this.timelineWindow.canPaginate(l)&&(cr("can now",l,"paginate again"),o[c]=!0),new Promise((a=>{this.setState(o,(()=>{a(t&&(!e||0===r))}))}))}))):(cr("can't",t,"paginate any further"),this.setState({[a]:!1}),Promise.resolve(!1)):(cr("have given up",t,"paginating this timeline"),Promise.resolve(!1))})),i()(this,"onMessageListScroll",(e=>{var t,a;null===(t=(a=this.props).onScroll)||void 0===t||t.call(a,e),this.props.manageReadMarkers&&this.doManageReadMarkers()})),i()(this,"doManageReadMarkers",Object(k.debounce)((()=>{var e;const t=this.getReadMarkerPosition();t<0&&this.setState({readMarkerVisible:!0});const a=this.readMarkerTimeout(t);null===(e=this.readMarkerActivityTimer)||void 0===e||e.changeTimeout(a)}),100,{leading:!1,trailing:!0})),i()(this,"onAction",(e=>{switch(e.action){case"ignore_state_changed":this.forceUpdate();break;case U.a.DumpDebugLogs:this.onDumpDebugLogs()}})),i()(this,"onRoomTimeline",((e,t,a,n,i)=>{var s;i.timeline.getTimelineSet()!==this.props.timelineSet&&i.timeline.getTimelineSet()!==this.props.overlayTimelineSet||(xa.e.hasServerSideSupport||this.context.timelineRenderingType!==Qa.a.Thread||(a&&!this.state.canBackPaginate&&this.setState({canBackPaginate:!0}),a||this.state.canForwardPaginate||this.setState({canForwardPaginate:!0})),!a&&i&&i.liveEvent&&null!==(s=this.messagePanel.current)&&void 0!==s&&s.getScrollState()&&(this.messagePanel.current.getScrollState().stuckAtBottom?this.timelineWindow.paginate(ar.b.FORWARDS,1,!1).then((()=>{if(this.overlayTimelineWindow)return this.overlayTimelineWindow.paginate(ar.b.FORWARDS,1,!1)})).then((()=>{if(this.unmounted)return;const{events:t,liveEvents:a,firstVisibleEventIndex:n}=this.getEvents();this.buildLegacyCallEventGroupers(t);const i=a[a.length-1],s={events:t,liveEvents:a,firstVisibleEventIndex:n};let r=!1;if(this.props.manageReadMarkers){const t=lt.a.get().credentials.userId;if(r=!1,e.getSender()===t||sr.a.sharedInstance().userActiveRecently()){if(i&&0===this.getReadMarkerPosition()){var o;this.setReadMarker(null!==(o=i.getId())&&void 0!==o?o:null,i.getTs(),!0),s.readMarkerVisible=!1,s.readMarkerEventId=i.getId(),r=!0}}else s.readMarkerVisible=!0}this.setState(s,(()=>{var e,t,a;(null===(e=this.messagePanel.current)||void 0===e||e.updateTimelineMinHeight(),r)&&(null===(t=(a=this.props).onReadMarkerUpdated)||void 0===t||t.call(a))}))})):this.setState({canForwardPaginate:!0})))})),i()(this,"onRoomTimelineReset",((e,t)=>{t===this.props.timelineSet&&this.messagePanel.current&&this.messagePanel.current.isAtBottom()&&this.loadTimeline()})),i()(this,"canResetTimeline",(()=>{var e,t;return null===(e=this.messagePanel)||void 0===e||null===(t=e.current)||void 0===t?void 0:t.isAtBottom()})),i()(this,"onRoomRedaction",((e,t)=>{this.unmounted||t===this.props.timelineSet.room&&this.forceUpdate()})),i()(this,"onThreadUpdate",(e=>{var t,a;if(this.unmounted)return;if(e.roomId!==(null===(t=this.props.timelineSet.room)||void 0===t?void 0:t.roomId))return;const n=null===(a=this.messagePanel.current)||void 0===a?void 0:a.getTileForEventId(e.id);n&&n.forceUpdate()})),i()(this,"onEventVisibilityChange",(e=>{var t,a;if(this.unmounted)return;if(e.getRoomId()!==(null===(t=this.props.timelineSet.room)||void 0===t?void 0:t.roomId))return;const n=null===(a=this.messagePanel.current)||void 0===a?void 0:a.getTileForEventId(e.getId());n&&n.forceUpdate()})),i()(this,"onVisibilityPowerLevelChange",((e,t)=>{var a,n;if(!this.unmounted&&t.roomId===(null===(a=this.props.timelineSet.room)||void 0===a?void 0:a.roomId)&&t.userId==(null===(n=lt.a.get().credentials)||void 0===n?void 0:n.userId)){for(const e of this.state.events){var i;const t=null===(i=this.messagePanel.current)||void 0===i?void 0:i.getTileForEventId(e.getId());t&&t.forceUpdate()}this.forceUpdate()}})),i()(this,"onEventReplaced",(e=>{var t;this.unmounted||e.getRoomId()===(null===(t=this.props.timelineSet.room)||void 0===t?void 0:t.roomId)&&this.forceUpdate()})),i()(this,"onRoomReceipt",((e,t)=>{this.unmounted||t===this.props.timelineSet.room&&this.forceUpdate()})),i()(this,"onLocalEchoUpdated",((e,t,a)=>{this.unmounted||t===this.props.timelineSet.room&&this.reloadEvents()})),i()(this,"onAccountData",((e,t)=>{this.unmounted||t===this.props.timelineSet.room&&e.getType()===ee.b.FullyRead&&this.setState({readMarkerEventId:e.getContent().event_id},this.props.onReadMarkerUpdated)})),i()(this,"onEventDecrypted",(e=>{this.props.timelineSet.room&&e.getRoomId()===this.props.timelineSet.room.roomId&&this.state.events.includes(e)&&(this.recheckFirstVisibleEventIndex(),this.buildLegacyCallEventGroupers(this.state.events),this.forceUpdate())})),i()(this,"onSync",((e,t,a)=>{this.unmounted||this.setState({clientSyncState:e})})),i()(this,"recheckFirstVisibleEventIndex",Object(k.throttle)((()=>{const e=this.checkForPreJoinUISI(this.state.events);e!==this.state.firstVisibleEventIndex&&this.setState({firstVisibleEventIndex:e})}),500,{leading:!0,trailing:!0})),i()(this,"sendReadReceipt",(()=>{var e;if(b.b.getValue("lowBandwidth"))return;if(!this.messagePanel.current)return;if(!this.props.manageReadReceipts)return;const t=lt.a.get();if(!t||t.isGuest())return;let a=!0;const n=this.getCurrentReadReceipt(!0),i=this.indexForEventId(n);n&&null===i&&this.timelineWindow.canPaginate(ar.b.FORWARDS)&&(a=!1);const s=this.getLastDisplayedEventIndex({ignoreOwn:!0});null===s&&(a=!1);let r=this.state.events[null!=s?s:0];a=a&&s>i&&this.lastRRSentEventId!==(null===(e=r)||void 0===e?void 0:e.getId());const o=this.lastRMSentEventId!=this.state.readMarkerEventId;if(a||o){var l,c,d;if(a)this.lastRRSentEventId=null===(d=r)||void 0===d?void 0:d.getId();else r=null;this.lastRMSentEventId=this.state.readMarkerEventId;const e=this.props.timelineSet.room.roomId,n=b.b.getValue("sendReadReceipts",e);var m,u,h;if(cr(`Sending Read Markers for ${this.props.timelineSet.room.roomId}: `,`rm=${this.state.readMarkerEventId} `,`rr=${n?null===(l=r)||void 0===l?void 0:l.getId():null} `,`prr=${null===(c=r)||void 0===c?void 0:c.getId()}`),this.props.timelineSet.thread&&n&&r)t.sendReadReceipt(r,n?ir.b.Read:ir.b.ReadPrivate);else t.setRoomReadMarkers(e,null!==(m=this.state.readMarkerEventId)&&void 0!==m?m:"",n&&null!==(u=r)&&void 0!==u?u:void 0,null!==(h=r)&&void 0!==h?h:void 0).catch((async e=>{if("M_UNRECOGNIZED"===e.errcode&&r){if(!n&&!await t.doesServerSupportUnstableFeature("org.matrix.msc2285.stable")&&!await t.isVersionSupported("v1.4"))return;try{return void await t.sendReadReceipt(r,n?ir.b.Read:ir.b.ReadPrivate)}catch(t){ga.a.error(e),this.lastRRSentEventId=void 0}}else ga.a.error(e);this.lastRRSentEventId=void 0,this.lastRMSentEventId=void 0})),this.isAtEndOfLiveTimeline()&&(this.props.timelineSet.room.setUnreadNotificationCount(te.b.Total,0),this.props.timelineSet.room.setUnreadNotificationCount(te.b.Highlight,0),v.a.dispatch({action:"on_room_read",roomId:this.props.timelineSet.room.roomId}))}})),i()(this,"updateReadMarker",(()=>{if(!this.props.manageReadMarkers)return;if(1===this.getReadMarkerPosition())return;const e=this.getLastDisplayedEventIndex({allowPartial:!0});if(null===e)return;const t=this.state.events[e];this.setReadMarker(t.getId(),t.getTs()),this.state.readMarkerVisible&&this.setState({readMarkerVisible:!1}),this.sendReadReceipt()})),i()(this,"jumpToLiveTimeline",(()=>{var e;this.timelineWindow.canPaginate(ar.b.FORWARDS)?this.loadTimeline():null===(e=this.messagePanel.current)||void 0===e||e.scrollToBottom()})),i()(this,"scrollToEventIfNeeded",(e=>{var t;null===(t=this.messagePanel.current)||void 0===t||t.scrollToEventIfNeeded(e)})),i()(this,"jumpToReadMarker",(()=>{if(!this.props.manageReadMarkers)return;if(!this.messagePanel.current)return;if(!this.state.readMarkerEventId)return;null===this.messagePanel.current.getReadMarkerPosition()?this.loadTimeline(this.state.readMarkerEventId,0,1/3):this.messagePanel.current.scrollToEvent(this.state.readMarkerEventId,0,1/3)})),i()(this,"forgetReadMarker",(()=>{if(!this.props.manageReadMarkers)return;const e=this.getCurrentReadReceipt(),t=this.props.timelineSet.getTimelineForEvent(null!=e?e:"");let a;if(t){const n=t.getEvents().find((t=>t.getId()==e));n&&(a=n.getTs())}this.setReadMarker(e,a),this.sendReadReceipt()})),i()(this,"isAtEndOfLiveTimeline",(()=>{var e;return(null===(e=this.messagePanel.current)||void 0===e?void 0:e.isAtBottom())&&this.timelineWindow&&!this.timelineWindow.canPaginate(ar.b.FORWARDS)})),i()(this,"getScrollState",(()=>this.messagePanel.current?this.messagePanel.current.getScrollState():null)),i()(this,"getReadMarkerPosition",(()=>{if(!this.props.manageReadMarkers)return null;if(!this.messagePanel.current)return null;const e=this.messagePanel.current.getReadMarkerPosition();if(null!==e)return e;const t=dr.roomReadMarkerTsMap[this.props.timelineSet.room.roomId];return t&&this.state.events.length>0?t<this.state.events[0].getTs()?-1:1:null})),i()(this,"canJumpToReadMarker",(()=>{const e=this.getReadMarkerPosition();return null!==this.state.readMarkerEventId&&(e<0||null===e)})),i()(this,"handleScrollKey",(e=>{if(!this.messagePanel.current)return;Object(J.a)().getRoomAction(e)===W.h.JumpToLatestMessage?this.jumpToLiveTimeline():this.messagePanel.current.handleScrollKey(e)})),i()(this,"getRelationsForEvent",((e,t,a)=>{var n;return null===(n=this.props.timelineSet.relations)||void 0===n?void 0:n.getChildEventsForEvent(e,t,a)})),this.context=t,cr("mounting");let n=null;if(this.props.manageReadMarkers){const e=this.props.timelineSet.room.getAccountData("m.fully_read");n=e?e.getContent().event_id:this.getCurrentReadReceipt()}this.state={events:[],liveEvents:[],timelineLoading:!0,firstVisibleEventIndex:0,canBackPaginate:!1,canForwardPaginate:!1,readMarkerVisible:!0,readMarkerEventId:n,backPaginating:!1,forwardPaginating:!1,clientSyncState:lt.a.get().getSyncState(),isTwelveHour:b.b.getValue("showTwelveHourTimestamps"),alwaysShowTimestamps:b.b.getValue("alwaysShowTimestamps"),readMarkerInViewThresholdMs:b.b.getValue("readMarkerInViewThresholdMs"),readMarkerOutOfViewThresholdMs:b.b.getValue("readMarkerOutOfViewThresholdMs")},this.dispatcherRef=v.a.register(this.onAction);const r=lt.a.get();r.on(te.d.Timeline,this.onRoomTimeline),r.on(te.d.TimelineReset,this.onRoomTimelineReset),r.on(te.d.Redaction,this.onRoomRedaction),b.b.getValue("feature_msc3531_hide_messages_pending_moderation")&&(r.on(Oa.c.VisibilityChange,this.onEventVisibilityChange),r.on(Pa.b.PowerLevel,this.onVisibilityPowerLevelChange)),r.on(te.d.RedactionCancelled,this.onRoomRedaction),r.on(te.d.Receipt,this.onRoomReceipt),r.on(te.d.LocalEchoUpdated,this.onLocalEchoUpdated),r.on(te.d.AccountData,this.onAccountData),r.on(Oa.c.Decrypted,this.onEventDecrypted),r.on(Oa.c.Replaced,this.onEventReplaced),r.on(o.b.Sync,this.onSync),null===(a=this.props.timelineSet.room)||void 0===a||a.on(xa.f.Update,this.onThreadUpdate)}componentDidMount(){this.props.manageReadReceipts&&this.updateReadReceiptOnUserActivity(),this.props.manageReadMarkers&&this.updateReadMarkerOnUserActivity(),this.initTimeline(this.props)}componentDidUpdate(e){var t,a;e.timelineSet!==this.props.timelineSet&&ga.a.warn("Replacing timelineSet on a TimelinePanel - confusion may ensue"),null===(t=this.props.timelineSet.room)||void 0===t||t.off(xa.f.Update,this.onThreadUpdate),null===(a=this.props.timelineSet.room)||void 0===a||a.on(xa.f.Update,this.onThreadUpdate);const n=e.eventId!=this.props.eventId,i=e.highlightedEventId!=this.props.highlightedEventId,s=e.eventScrollIntoView&&!this.props.eventScrollIntoView,r=e.overlayTimelineSet!==this.props.overlayTimelineSet;n||i||s?(ga.a.log(`TimelinePanel switching to eventId ${this.props.eventId} (was ${e.eventId}), scrollIntoView: ${this.props.eventScrollIntoView} (was ${e.eventScrollIntoView})`),this.initTimeline(this.props)):r&&(ga.a.log("TimelinePanel updating overlay timeline."),this.initTimeline(this.props))}componentWillUnmount(){this.unmounted=!0,this.readReceiptActivityTimer&&(this.readReceiptActivityTimer.abort(),this.readReceiptActivityTimer=null),this.readMarkerActivityTimer&&(this.readMarkerActivityTimer.abort(),this.readMarkerActivityTimer=null),v.a.unregister(this.dispatcherRef);const e=lt.a.get();var t;e&&(e.removeListener(te.d.Timeline,this.onRoomTimeline),e.removeListener(te.d.TimelineReset,this.onRoomTimelineReset),e.removeListener(te.d.Redaction,this.onRoomRedaction),e.removeListener(te.d.RedactionCancelled,this.onRoomRedaction),e.removeListener(te.d.Receipt,this.onRoomReceipt),e.removeListener(te.d.LocalEchoUpdated,this.onLocalEchoUpdated),e.removeListener(te.d.AccountData,this.onAccountData),e.removeListener(Pa.b.PowerLevel,this.onVisibilityPowerLevelChange),e.removeListener(Oa.c.Decrypted,this.onEventDecrypted),e.removeListener(Oa.c.Replaced,this.onEventReplaced),e.removeListener(Oa.c.VisibilityChange,this.onEventVisibilityChange),e.removeListener(o.b.Sync,this.onSync),null===(t=this.props.timelineSet.room)||void 0===t||t.removeListener(xa.f.Update,this.onThreadUpdate))}readMarkerTimeout(e){var t,a,n,i;return 0===e?null!==(t=null===(a=this.context)||void 0===a?void 0:a.readMarkerInViewThresholdMs)&&void 0!==t?t:this.state.readMarkerInViewThresholdMs:null!==(n=null===(i=this.context)||void 0===i?void 0:i.readMarkerOutOfViewThresholdMs)&&void 0!==n?n:this.state.readMarkerOutOfViewThresholdMs}async updateReadMarkerOnUserActivity(){const e=this.readMarkerTimeout(this.getReadMarkerPosition());for(this.readMarkerActivityTimer=new rr.a(e);this.readMarkerActivityTimer;){sr.a.sharedInstance().timeWhileActiveRecently(this.readMarkerActivityTimer);try{await this.readMarkerActivityTimer.finished()}catch(e){continue}this.updateReadMarker()}}async updateReadReceiptOnUserActivity(){for(this.readReceiptActivityTimer=new rr.a(500);this.readReceiptActivityTimer;){sr.a.sharedInstance().timeWhileActiveNow(this.readReceiptActivityTimer);try{await this.readReceiptActivityTimer.finished()}catch(e){continue}this.sendReadReceipt()}}advanceReadMarkerPastMyEvents(){if(!this.props.manageReadMarkers)return;const e=this.timelineWindow.getEvents();let t;for(t=0;t<e.length&&e[t].getId()!=this.state.readMarkerEventId;t++);if(t>=e.length)return;const a=lt.a.get().credentials.userId;for(t++;t<e.length;t++){if(e[t].getSender()!==a)break}t--;const n=e[t];this.setReadMarker(n.getId(),n.getTs())}initTimeline(e){const t=e.eventId,a=e.eventPixelOffset;let n=1;return null==a&&(n=.5),this.loadTimeline(t,a,n,e.eventScrollIntoView)}scrollIntoView(e,t,a){var n,i;const s=()=>{this.messagePanel.current&&(e?(cr("TimelinePanel scrolling to eventId "+e+" at position "+100*a+"% + "+t),this.messagePanel.current.scrollToEvent(e,t,a)):(cr("TimelinePanel scrolling to bottom"),this.messagePanel.current.scrollToBottom()))};cr("TimelinePanel scheduling scroll to event"),null===(n=(i=this.props).onEventScrolledIntoView)||void 0===n||n.call(i,e),s(),window.requestAnimationFrame((()=>{s()}))}loadTimeline(e,t,a){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];const i=lt.a.get();this.timelineWindow=new nr.b(i,this.props.timelineSet,{windowLimit:this.props.timelineCap}),this.overlayTimelineWindow=this.props.overlayTimelineSet?new nr.b(i,this.props.overlayTimelineSet,{windowLimit:this.props.timelineCap}):void 0;const s=()=>{var i,s,r;this.unmounted||(null===(i=this.messagePanel.current)||void 0===i||i.onTimelineReset(),this.reloadEvents(),this.advanceReadMarkerPastMyEvents(),this.setState({canBackPaginate:!(null===(s=this.timelineWindow)||void 0===s||!s.canPaginate(ar.b.BACKWARDS)),canForwardPaginate:!(null===(r=this.timelineWindow)||void 0===r||!r.canPaginate(ar.b.FORWARDS)),timelineLoading:!1},(()=>{this.messagePanel.current?(n&&this.scrollIntoView(e,t,a),this.props.sendReadReceiptOnLoad&&this.sendReadReceipt()):ga.a.log("can't initialise scroll state because messagePanel didn't load")})))};var r;if(this.props.timelineSet.getTimelineForEvent(e))return this.timelineWindow.load(e,20),null===(r=this.overlayTimelineWindow)||void 0===r||r.load(void 0,20),void s();const o=this.timelineWindow.load(e,20).then((async()=>{this.overlayTimelineWindow&&await this.overlayTimelineWindow.load(void 0,20)}));this.buildLegacyCallEventGroupers(),this.setState({events:[],liveEvents:[],canBackPaginate:!1,canForwardPaginate:!1,timelineLoading:!0}),o.then(s,(t=>{var a;if(this.unmounted)return;let n,i;this.setState({timelineLoading:!1}),ga.a.error(`Error loading timeline panel at ${null===(a=this.props.timelineSet.room)||void 0===a?void 0:a.roomId}/${e}`,t),e&&(n=()=>{v.a.dispatch({action:U.a.ViewRoom,room_id:this.props.timelineSet.room.roomId,metricsTrigger:void 0})}),i="M_FORBIDDEN"==t.errcode?Object(N.a)("Tried to load a specific point in this room's timeline, but you do not have permission to view the message in question."):Object(N.a)("Tried to load a specific point in this room's timeline, but was unable to find it."),H.b.createDialog(en.a,{title:Object(N.a)("Failed to load timeline position"),description:i,onFinished:n})}))}reloadEvents(){if(this.unmounted)return;const e=this.getEvents();this.buildLegacyCallEventGroupers(e.events),this.setState(e)}refreshTimeline(e){this.loadTimeline(e,void 0,void 0,!1),this.reloadEvents()}getEvents(){var e,t,a;const n=(null===(e=this.timelineWindow)||void 0===e?void 0:e.getEvents())||[],i=this.props.overlayTimelineSetFilter||Boolean,s=((null===(t=this.overlayTimelineWindow)||void 0===t?void 0:t.getEvents().filter(i))||[]).reduce(((e,t)=>{const a=e.findIndex((e=>e.localTimestamp>t.localTimestamp));return a>-1?e.splice(a,0,t):e.push(t),e}),[...n]);Object(Ni.b)(s).reverse().forEach((e=>{lt.a.get().decryptEventIfNeeded(e)}));const r=this.checkForPreJoinUISI(n),o=[...s];if(null===(a=this.timelineWindow)||void 0===a||!a.canPaginate(ar.b.FORWARDS)){const e=this.props.timelineSet.getPendingEvents();s.push(...e.filter((t=>{const{shouldLiveInRoom:a,threadId:n}=this.props.timelineSet.room.eventShouldLiveIn(t,e);return this.context.timelineRenderingType===Qa.a.Thread?n===this.context.threadId:a})))}return{events:s,liveEvents:o,firstVisibleEventIndex:r}}checkForPreJoinUISI(e){const t=lt.a.get(),a=this.props.timelineSet.room,n=[Qa.a.Thread,Qa.a.ThreadsList].includes(this.context.timelineRenderingType);if(0===e.length||!a||!t.isRoomEncrypted(a.roomId)||n)return ga.a.info("checkForPreJoinUISI: showing all messages, skipping check"),0;const i=t.credentials.userId;let s=e.length-1,r="leave";for(;s>=0;s--){var o,l;const t=this.props.timelineSet.getTimelineForEvent(e[s].getId());if(!t){ga.a.warn(`Event ${e[s].getId()} in room ${a.roomId} is live, but it does not have a timeline`);continue}r=null!==(o=null===(l=t.getState(ar.b.FORWARDS).getMember(i))||void 0===l?void 0:l.membership)&&void 0!==o?o:"leave";const n=t.getEvents();for(let t=n.length-1;t>=0;t--){const a=n[t];if(a.getId()===e[s].getId())break;a.getStateKey()===i&&a.getType()===ee.b.RoomMember&&(r=a.getPrevContent().membership||"leave")}break}for(;s>=0;s--){const t=e[s];if(t.getStateKey()===i&&t.getType()===ee.b.RoomMember)r=t.getPrevContent().membership||"leave";else if("leave"===r&&(t.isDecryptionFailure()||t.isBeingDecrypted()))return ga.a.info("checkForPreJoinUISI: reached a pre-join UISI at index ",s),s+1}return ga.a.info("checkForPreJoinUISI: did not find pre-join UISI"),0}indexForEventId(e){if(null===e)return null;if(this.context.timelineRenderingType===Qa.a.Thread)return 0;const t=this.state.events.findIndex((t=>t.getId()===e));return t>-1?t:null}getVisibleDecryptionFailures(e){const t=this.messagePanel.current;if(!t)return null;const a=Vt.a.findDOMNode(t);if(!a)return null;const n=a.getBoundingClientRect(),i=e?100:0,s=n.top-i,r=n.bottom+i,o=[];for(const e of this.state.liveEvents){const a=e.getId();if(!a)continue;const n=t.getNodeForEventId(a);if(!n)continue;const i=n.getBoundingClientRect();if(i.top>r)break;i.bottom>=s&&e.isDecryptionFailure()&&o.push(e)}return o}getLastDisplayedEventIndex(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=e.ignoreOwn||!1,a=e.allowPartial||!1,n=this.messagePanel.current;if(!n)return null;const i=Vt.a.findDOMNode(n);if(!i)return null;const s=i.getBoundingClientRect(),r=lt.a.get().credentials.userId,o=e=>{if(e){const t=e.getBoundingClientRect();if(a&&t.top<=s.bottom||!a&&t.bottom<=s.bottom)return!0}return!1};let l=0;for(let e=this.state.liveEvents.length-1;e>=0;--e){var c;const a=this.state.liveEvents[e],i=n.getNodeForEventId(a.getId()),s=o(i);if(s&&0!==l)return e+l;i&&!s&&(l=0);const d=!!a.status||t&&a.getSender()===r;if(!(!Object(Fn.c)(a,null===(c=this.context)||void 0===c?void 0:c.showHiddenEvents)||Object(ja.a)(a,this.context))&&i){if(!d&&s)return e}else(!d||d&&0!==l)&&++l}return null}getCurrentReadReceipt(){var e;let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const a=lt.a.get();if(null==a)return null;const n=a.credentials.userId,i=null!==(e=this.props.timelineSet.thread)&&void 0!==e?e:this.props.timelineSet.room;return null==i?void 0:i.getEventReadUpTo(n,t)}setReadMarker(e,t){var a;let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const i=null===(a=this.props.timelineSet.room)||void 0===a?void 0:a.roomId;e!==this.state.readMarkerEventId&&null!==e&&(dr.roomReadMarkerTsMap[null!=i?i:""]=t,n||this.setState({readMarkerEventId:e},this.props.onReadMarkerUpdated))}shouldPaginate(){return!this.state.events.some((e=>e.isBeingDecrypted()))}buildLegacyCallEventGroupers(e){this.callEventGroupers=Object(lr.c)(this.callEventGroupers,e)}render(){var e,t,a,n,i;if(this.state.timelineLoading)return r.a.createElement("div",{className:"mx_RoomView_messagePanelSpinner"},r.a.createElement(pn.a,null));if(0==this.state.events.length&&!this.state.canBackPaginate&&this.props.empty)return r.a.createElement("div",{className:this.props.className+" mx_RoomView_messageListWrapper"},r.a.createElement("div",{className:"mx_RoomView_empty"},this.props.empty));const s=!this.timelineWindow.canPaginate(ar.b.FORWARDS),o=this.state.forwardPaginating||["PREPARED","CATCHUP"].includes(this.state.clientSyncState),l=this.state.firstVisibleEventIndex?this.state.events.slice(this.state.firstVisibleEventIndex):this.state.events;return r.a.createElement(or.a,{ref:this.messagePanel,room:this.props.timelineSet.room,permalinkCreator:this.props.permalinkCreator,hidden:this.props.hidden,backPaginating:this.state.backPaginating,forwardPaginating:o,events:l,highlightedEventId:this.props.highlightedEventId,readMarkerEventId:this.state.readMarkerEventId,readMarkerVisible:this.state.readMarkerVisible,canBackPaginate:this.state.canBackPaginate&&0===this.state.firstVisibleEventIndex,showUrlPreview:this.props.showUrlPreview,showReadReceipts:this.props.showReadReceipts,ourUserId:lt.a.get().credentials.userId,stickyBottom:s,onScroll:this.onMessageListScroll,onFillRequest:this.onMessageListFillRequest,onUnfillRequest:this.onMessageListUnfillRequest,isTwelveHour:null!==(e=null===(t=this.context)||void 0===t?void 0:t.showTwelveHourTimestamps)&&void 0!==e?e:this.state.isTwelveHour,alwaysShowTimestamps:null!==(a=null!==(n=this.props.alwaysShowTimestamps)&&void 0!==n?n:null===(i=this.context)||void 0===i?void 0:i.alwaysShowTimestamps)&&void 0!==a?a:this.state.alwaysShowTimestamps,className:this.props.className,resizeNotifier:this.props.resizeNotifier,getRelationsForEvent:this.getRelationsForEvent,editState:this.props.editState,showReactions:this.props.showReactions,layout:this.props.layout,hideThreadedMessages:this.props.hideThreadedMessages,disableGrouping:this.props.disableGrouping,callEventGroupers:this.callEventGroupers})}}function mr(e){return e.map((e=>{const t={},a=e.getTimelines(),n=e.getLiveTimeline();return a.forEach(((e,a)=>{t[e===n?"liveTimeline":`${a}`]=e.getEvents().map((e=>e.getId()))})),t}))}i()(dr,"contextType",Qa.b),i()(dr,"roomReadMarkerTsMap",{}),i()(dr,"defaultProps",{timelineCap:Number.MAX_VALUE,className:"mx_RoomView_messagePanel",sendReadReceiptOnLoad:!0,hideThreadedMessages:!0,disableGrouping:!1});var ur=dr,hr=a(194);class pr extends r.a.PureComponent{constructor(e){super(e),i()(this,"instanceId",void 0),i()(this,"onResize",((e,t)=>{e===Q.a.Resize&&this.props.onMeasurement(t.contentRect.width<=this.props.breakpoint)})),this.instanceId=pr.instanceCount++}componentDidMount(){Q.b.instance.on(`Measured${this.instanceId}`,this.onResize)}componentDidUpdate(e){const t=e.sensor,a=this.props.sensor;t!==a&&(t&&Q.b.instance.stopTrackingElementDimensions(`Measured${this.instanceId}`),a&&Q.b.instance.trackElementDimensions(`Measured${this.instanceId}`,this.props.sensor))}componentWillUnmount(){Q.b.instance.off(`Measured${this.instanceId}`,this.onResize),Q.b.instance.stopTrackingElementDimensions(`Measured${this.instanceId}`)}render(){return null}}function gr(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function vr(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?gr(Object(a),!0).forEach((function(t){i()(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):gr(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}i()(pr,"instanceCount",0),i()(pr,"defaultProps",{breakpoint:500});class br extends r.a.Component{constructor(){super(...arguments),i()(this,"decryptingEvents",new Set),i()(this,"noRoom",void 0),i()(this,"card",Object(s.createRef)()),i()(this,"state",{timelineSet:null,narrow:!1}),i()(this,"onRoomTimeline",((e,t,a,n,i)=>{var s;if((null==t?void 0:t.roomId)!==(null===(s=this.props)||void 0===s?void 0:s.roomId))return;if(a||!i||!i.liveEvent||e.isRedacted())return;lt.a.get().decryptEventIfNeeded(e),e.isBeingDecrypted()?this.decryptingEvents.add(e.getId()):this.addEncryptedLiveEvent(e)})),i()(this,"onEventDecrypted",((e,t)=>{if(e.getRoomId()!==this.props.roomId)return;const a=e.getId();this.decryptingEvents.delete(a)&&(t||this.addEncryptedLiveEvent(e))})),i()(this,"onPaginationRequest",((e,t,a)=>{const n=lt.a.get(),i=Zs.a.get(),s=this.props.roomId,r=n.getRoom(s);return n.isRoomEncrypted(s)&&null!==i?i.paginateTimelineWindow(r,e,t,a):e.paginate(t,a)})),i()(this,"onMeasurement",(e=>{this.setState({narrow:e})}))}addEncryptedLiveEvent(e){if(!this.state.timelineSet)return;const t=this.state.timelineSet.getLiveTimeline();"m.room.message"===e.getType()&&-1!=["m.file","m.image","m.video","m.audio"].indexOf(e.getContent().msgtype)&&(this.state.timelineSet.eventIdToTimeline(e.getId())||this.state.timelineSet.addEventToTimeline(e,t,!1))}async componentDidMount(){const e=lt.a.get();await this.updateTimelineSet(this.props.roomId),lt.a.get().isRoomEncrypted(this.props.roomId)&&null!==Zs.a.get()&&(e.on(te.d.Timeline,this.onRoomTimeline),e.on(Oa.c.Decrypted,this.onEventDecrypted))}componentWillUnmount(){const e=lt.a.get();null!==e&&lt.a.get().isRoomEncrypted(this.props.roomId)&&null!==Zs.a.get()&&(e.removeListener(te.d.Timeline,this.onRoomTimeline),e.removeListener(Oa.c.Decrypted,this.onEventDecrypted))}async fetchFileEventsServer(e){const t=lt.a.get(),a=new ri.a(t.credentials.userId);a.setDefinition({room:{timeline:{contains_url:!0,types:["m.room.message"]}}});const n=await t.getOrCreateFilter("FILTER_FILES_"+t.credentials.userId,a);a.filterId=n;return e.getOrCreateFilteredTimelineSet(a)}async updateTimelineSet(e){const t=lt.a.get(),a=t.getRoom(e),n=Zs.a.get();if(this.noRoom=!a,a){let i;try{if(i=await this.fetchFileEventsServer(a),t.isRoomEncrypted(e)&&null!==n){const e=i.getLiveTimeline();await n.populateFileTimeline(i,e,a,10)}this.setState({timelineSet:i})}catch(e){ga.a.error("Failed to get or create file panel filter",e)}}else ga.a.error("Failed to add filtered timelineSet for FilePanel as no room!")}render(){if(lt.a.get().isGuest())return r.a.createElement(Ba,{className:"mx_FilePanel mx_RoomView_messageListWrapper",onClose:this.props.onClose},r.a.createElement("div",{className:"mx_RoomView_empty"},Object(N.a)("You must <a>register</a> to use this functionality",{},{a:e=>r.a.createElement("a",{href:"#/register",key:"sub"},e)})));if(this.noRoom)return r.a.createElement(Ba,{className:"mx_FilePanel mx_RoomView_messageListWrapper",onClose:this.props.onClose},r.a.createElement("div",{className:"mx_RoomView_empty"},Object(N.a)("You must join the room to see its files")));const e=r.a.createElement("div",{className:"mx_RightPanel_empty mx_FilePanel_empty"},r.a.createElement("h2",null,Object(N.a)("No files visible in this room")),r.a.createElement("p",null,Object(N.a)("Attach files from chat or just drag and drop them anywhere in a room."))),t=!this.noRoom&&lt.a.get().isRoomEncrypted(this.props.roomId);return this.state.timelineSet?r.a.createElement(Qa.b.Provider,{value:vr(vr({},this.context),{},{timelineRenderingType:Qa.a.File,narrow:this.state.narrow})},r.a.createElement(Ba,{className:"mx_FilePanel",onClose:this.props.onClose,withoutScrollContainer:!0,ref:this.card},r.a.createElement(pr,{sensor:this.card.current,onMeasurement:this.onMeasurement}),r.a.createElement(tr,{isRoomEncrypted:t,kind:er.Files}),r.a.createElement(ur,{manageReadReceipts:!1,manageReadMarkers:!1,timelineSet:this.state.timelineSet,showUrlPreview:!1,onPaginationRequest:this.onPaginationRequest,resizeNotifier:this.props.resizeNotifier,empty:e,layout:hr.a.Group}))):r.a.createElement(Qa.b.Provider,{value:vr(vr({},this.context),{},{timelineRenderingType:Qa.a.File})},r.a.createElement(Ba,{className:"mx_FilePanel",onClose:this.props.onClose},r.a.createElement(pn.a,null)))}}i()(br,"contextType",Qa.b);var fr=br;class yr extends r.a.Component{constructor(e){super(e),i()(this,"resize",(()=>{this.props.onResize&&this.props.onResize()}))}componentDidMount(){window.addEventListener("resize",this.resize)}componentWillUnmount(){window.removeEventListener("resize",this.resize)}render(){return r.a.createElement("div",null,this.props.element)}}const Er="stickerPicker";class _r extends r.a.PureComponent{constructor(e){super(e),i()(this,"dispatcherRef",void 0),i()(this,"prevSentVisibility",void 0),i()(this,"popoverWidth",300),i()(this,"popoverHeight",300),i()(this,"scalarClient",null),i()(this,"removeStickerpickerWidgets",(async()=>{const e=await this.acquireScalarClient();ga.a.log("Removing Stickerpicker widgets"),this.state.widgetId?e?e.disableWidgetAssets(tn.a.STICKERPICKER,this.state.widgetId).then((()=>{ga.a.log("Assets disabled")})).catch((()=>{ga.a.error("Failed to disable assets")})):ga.a.error("Cannot disable assets: no scalar client"):ga.a.warn("No widget ID specified, not disabling assets"),this.props.setStickerPickerOpen(!1),Wa.a.removeStickerpickerWidgets().then((()=>{this.forceUpdate()})).catch((e=>{ga.a.error("Failed to remove sticker picker widget",e)}))})),i()(this,"updateWidget",(()=>{const e=Wa.a.getStickerpickerWidgets()[0];if(!e)return _r.currentWidget=null,void this.setState({stickerpickerWidget:null,widgetId:null});const t=_r.currentWidget;let a=null;t&&t.content&&t.content.url&&(a=t.content.url);let n=null;e&&e.content&&e.content.url&&(n=e.content.url),n!==a&&Ii.destroyElement(Er),_r.currentWidget=e,this.setState({stickerpickerWidget:e,widgetId:e?e.id:null})})),i()(this,"onAction",(e=>{switch(e.action){case"user_widget_updated":this.forceUpdate();break;case"stickerpicker_close":case"show_left_panel":case"hide_left_panel":this.props.setStickerPickerOpen(!1)}})),i()(this,"onRightPanelStoreUpdate",(()=>{this.props.setStickerPickerOpen(!1)})),i()(this,"onResize",(()=>{this.props.isStickerPickerOpen&&this.props.setStickerPickerOpen(!1)})),i()(this,"onFinished",(()=>{this.props.isStickerPickerOpen&&this.props.setStickerPickerOpen(!1)})),i()(this,"launchManageIntegrations",(()=>{Ha.a.sharedInstance().getPrimaryManager().open(this.props.room,`type_${tn.a.STICKERPICKER.preferred}`,this.state.widgetId)})),this.state={imError:null,stickerpickerWidget:null,widgetId:null}}acquireScalarClient(){return this.scalarClient?Promise.resolve(this.scalarClient):Ha.a.sharedInstance().hasManager()?(this.scalarClient=Ha.a.sharedInstance().getPrimaryManager().getScalarClient(),this.scalarClient.connect().then((()=>(this.forceUpdate(),this.scalarClient))).catch((e=>{this.imError(Object(N.c)("Failed to connect to integration manager"),e)}))):void Ha.a.sharedInstance().openNoManagerDialog()}componentDidMount(){window.addEventListener("resize",this.onResize),this.dispatcherRef=v.a.register(this.onAction),lt.a.get().on(te.d.AccountData,this.updateWidget),Aa.a.instance.on(pt.b,this.onRightPanelStoreUpdate),this.updateWidget()}componentWillUnmount(){const e=lt.a.get();e&&e.removeListener(te.d.AccountData,this.updateWidget),Aa.a.instance.off(pt.b,this.onRightPanelStoreUpdate),window.removeEventListener("resize",this.onResize),this.dispatcherRef&&v.a.unregister(this.dispatcherRef)}componentDidUpdate(){this.sendVisibilityToWidget(this.props.isStickerPickerOpen)}imError(e,t){ga.a.error(e,t),this.setState({imError:Object(N.a)(e)}),this.props.setStickerPickerOpen(!1)}defaultStickerpickerContent(){return r.a.createElement(G.a,{onClick:this.launchManageIntegrations,className:"mx_Stickers_contentPlaceholder"},r.a.createElement("p",null,Object(N.a)("You don't currently have any stickerpacks enabled")),r.a.createElement("p",{className:"mx_Stickers_addLink"},Object(N.a)("Add some now")),r.a.createElement("img",{src:a(1536),alt:""}))}errorStickerpickerContent(){return r.a.createElement("div",{style:{textAlign:"center"},className:"error"},r.a.createElement("p",null," ",this.state.imError," "))}sendVisibilityToWidget(e){if(!this.state.stickerpickerWidget)return;const t=Za.a.instance.getMessagingForUid(Wa.a.calcWidgetUid(this.state.stickerpickerWidget.id,null));t&&e!==this.prevSentVisibility&&(t.updateVisibility(e).catch((e=>{ga.a.error("Error updating widget visibility: ",e)})),this.prevSentVisibility=e)}getStickerpickerContent(){if(this.state.imError)return this.errorStickerpickerContent();const e=this.state.stickerpickerWidget;let t;if(e&&e.content&&e.content.url){e.content.name=e.content.name||Object(N.a)("Stickerpack");const a={id:e.id,url:e.content.url,name:e.content.name,type:e.content.type,data:e.content.data,roomId:e.content.roomId,eventId:e.content.eventId,avatar_url:e.content.avatar_url,creatorUserId:e.content.creatorUserId};t=r.a.createElement("div",{className:"mx_Stickers_content_container"},r.a.createElement("div",{id:"stickersContent",className:"mx_Stickers_content",style:{border:"none",height:this.popoverHeight,width:this.popoverWidth}},r.a.createElement(Ii,{persistKey:Er,zIndex:3500},r.a.createElement(cs,{app:a,room:this.props.room,threadId:this.props.threadId,fullWidth:!0,userId:lt.a.get().credentials.userId,creatorUserId:e.sender||lt.a.get().credentials.userId,waitForIframeLoad:!0,showMenubar:!0,onEditClick:this.launchManageIntegrations,onDeleteClick:this.removeStickerpickerWidgets,showTitle:!1,showPopout:!1,handleMinimisePointerEvents:!0,userWidget:!0,showLayoutButtons:!1}))))}else t=this.defaultStickerpickerContent();return t}render(){return this.props.isStickerPickerOpen?r.a.createElement(ce.n,Z()({chevronFace:ce.a.Bottom,menuWidth:this.popoverWidth,menuHeight:this.popoverHeight,onFinished:this.onFinished,menuPaddingTop:0,menuPaddingLeft:0,menuPaddingRight:0,zIndex:3500},this.props.menuPosition),r.a.createElement(yr,{element:this.getStickerpickerContent(),onResize:this.onFinished})):null}}i()(_r,"defaultProps",{threadId:null}),i()(_r,"currentWidget",void 0);var Sr=a(951);class wr extends r.a.Component{render(){return this.props.replyToEvent?r.a.createElement("div",{className:"mx_ReplyPreview"},r.a.createElement("div",{className:"mx_ReplyPreview_section"},r.a.createElement("div",{className:"mx_ReplyPreview_header"},r.a.createElement("span",null,Object(N.a)("Replying")),r.a.createElement(G.a,{className:"mx_ReplyPreview_header_cancel",onClick:()=>{return e=this.context.timelineRenderingType,void v.a.dispatch({action:"reply_to_event",event:null,context:e});var e}})),r.a.createElement(Sr.a,{mxEvent:this.props.replyToEvent,permalinkCreator:this.props.permalinkCreator}))):null}}i()(wr,"contextType",Qa.b);var Or=a(344),Cr=a(849),xr=a(393);class kr extends r.a.PureComponent{constructor(e){super(e),i()(this,"waveform",[]),i()(this,"scheduledUpdate",new xr.a((()=>this.updateWaveform()),(()=>requestAnimationFrame((()=>this.scheduledUpdate.trigger()))))),this.state={waveform:Object(Ni.h)(0,Or.a)}}componentDidMount(){this.props.recorder.liveData.onUpdate((e=>{this.waveform=Object(Ni.c)(Array.from(e.waveform),Or.a),this.scheduledUpdate.mark()}))}updateWaveform(){this.setState({waveform:this.waveform})}render(){return r.a.createElement(Cr.a,{relHeights:this.state.waveform})}}i()(kr,"defaultProps",{progress:1});var jr=a(336);class Rr extends r.a.PureComponent{constructor(e){super(e),i()(this,"seconds",0),i()(this,"scheduledUpdate",new xr.a((()=>this.updateClock()),(()=>requestAnimationFrame((()=>this.scheduledUpdate.trigger()))))),this.state={seconds:0}}componentDidMount(){this.props.recorder.liveData.onUpdate((e=>{this.seconds=e.timeSeconds,this.scheduledUpdate.mark()}))}updateClock(){this.setState({seconds:this.seconds})}render(){return r.a.createElement(jr.a,{seconds:this.state.seconds,"aria-live":"off"})}}var Ir=a(566),Tr=a(252);class Nr{constructor(e,t){this.matrixClient=e,this.voiceRecording=t,i()(this,"lastUpload",void 0),i()(this,"buffer",new Uint8Array(0)),i()(this,"playback",void 0),i()(this,"onDataAvailable",(e=>{const t=new Uint8Array(e);this.buffer=Object(Ni.m)(this.buffer,t)})),this.voiceRecording.onDataAvailable=this.onDataAvailable}async start(){if(this.lastUpload||this.hasRecording)throw new Error("Recording already prepared");return this.voiceRecording.start()}async stop(){return await this.voiceRecording.stop(),this.audioBuffer}on(e,t){return this.voiceRecording.on(e,t),this}off(e,t){return this.voiceRecording.off(e,t),this}emit(e){for(var t=arguments.length,a=new Array(t>1?t-1:0),n=1;n<t;n++)a[n-1]=arguments[n];return this.voiceRecording.emit(e,...a)}get hasRecording(){return this.buffer.length>0}get isRecording(){return this.voiceRecording.isRecording}getPlayback(){return this.playback=Ir.a.for(this,"playback").do((()=>new Tr.c(this.audioBuffer.buffer,this.voiceRecording.amplitudes))),this.playback}async upload(e){if(!this.hasRecording)throw new Error("No recording available to upload");if(this.lastUpload)return this.lastUpload;try{this.emit(Or.b.Uploading);const{url:t,file:a}=await Object(Ia.b)(this.matrixClient,e,new Blob([this.audioBuffer],{type:this.contentType}));this.lastUpload={mxc:t,encrypted:a},this.emit(Or.b.Uploaded)}catch(e){throw this.emit(Or.b.Ended),e}return this.lastUpload}get durationSeconds(){return this.voiceRecording.durationSeconds}get contentType(){return this.voiceRecording.contentType}get contentLength(){return this.buffer.length}get liveData(){return this.voiceRecording.liveData}get isSupported(){return this.voiceRecording.isSupported}destroy(){var e;null===(e=this.playback)||void 0===e||e.destroy(),this.voiceRecording.destroy()}get audioBuffer(){return this.buffer.slice(0)}}function Dr(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var a=e[Symbol.toPrimitive];if(void 0!==a){var n=a.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}function Pr(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function Mr(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?Pr(Object(a),!0).forEach((function(t){i()(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):Pr(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}class Ar extends qi.a{constructor(){super(v.a,{})}static get instance(){return this.internalInstance||(this.internalInstance=new Ar,this.internalInstance.start()),this.internalInstance}async onAction(e){}static getVoiceRecordingId(e,t){return"io.element.thread"===(null==t?void 0:t.rel_type)||(null==t?void 0:t.rel_type)===ee.h.Thread?e.roomId+"|"+t.event_id:e.roomId}getActiveRecording(e){return this.state[e]}startRecording(e){if(!this.matrixClient)throw new Error("Cannot start a recording without a MatrixClient");if(!e)throw new Error("Recording must be associated with a room");if(this.state[e])throw new Error("A recording is already in progress");const t=(a=this.matrixClient,new Nr(a,new Or.d));var a;return this.updateState(Mr(Mr({},this.state),{},{[e]:t})),t}disposeRecording(e){var t;null===(t=this.state[e])||void 0===t||t.destroy();const a=this.state,{[e]:n}=a,i=ve()(a,[e].map(Dr));return this.reset(i)}}i()(Ar,"internalInstance",void 0),window.mxVoiceRecordingStore=Ar.instance;var Lr=a(950),Ur=a(497),Fr=a(271),Br=a(567),Vr=a(225),Wr=a(828);class Hr extends r.a.PureComponent{constructor(e){super(e),i()(this,"context",void 0),i()(this,"voiceRecordingId",void 0),i()(this,"onCancel",(async()=>{await this.disposeRecording()})),i()(this,"onRecordStartEndClick",(async()=>{if(this.state.recorder)return void await this.state.recorder.stop();const e=()=>{H.b.createDialog(en.a,{title:Object(N.a)("Unable to access your microphone"),description:r.a.createElement(r.a.Fragment,null,r.a.createElement("p",null,Object(N.a)("We were unable to access your microphone. Please check your browser settings and try again.")))})};try{var t;const e=await p.c.getDevices();if(null==e||null===(t=e[p.b.AudioInput])||void 0===t||!t.length)return void H.b.createDialog(en.a,{title:Object(N.a)("No microphone found"),description:r.a.createElement(r.a.Fragment,null,r.a.createElement("p",null,Object(N.a)("We didn't find a microphone on your device. Please check your settings and try again.")))})}catch(t){return ga.a.error("Error getting devices: ",t),void e()}try{Ur.a.instance.pauseAllExcept(null);const e=Ar.instance.startRecording(this.voiceRecordingId);await e.start(),this.bindNewRecorder(e),this.setState({recorder:e,recordingPhase:Or.b.Started})}catch(t){ga.a.error("Error starting recording: ",t),e(),Ar.instance.disposeRecording(this.voiceRecordingId)}})),i()(this,"onRecordingUpdate",(e=>{e!==Or.b.EndingSoon&&this.setState({recordingPhase:e})})),this.state={recorder:null},this.voiceRecordingId=Ar.getVoiceRecordingId(this.props.room,this.props.relation)}componentDidMount(){const e=Ar.instance.getActiveRecording(this.voiceRecordingId);e&&(!e.isRecording&&e.hasRecording||ga.a.warn("Cached recording hasn't ended yet and might cause issues"),this.bindNewRecorder(e),this.setState({recorder:e,recordingPhase:Or.b.Ended}))}async componentWillUnmount(){const e=Ar.instance.getActiveRecording(this.voiceRecordingId);await(null==e?void 0:e.stop()),this.bindNewRecorder(null)}async send(){if(!this.state.recorder)throw new Error("No recording started - cannot send anything");const{replyToEvent:e,relation:t,permalinkCreator:a}=this.props;let n;await this.state.recorder.stop();try{n=await this.state.recorder.upload(this.voiceRecordingId)}catch(e){return ga.a.error("Error uploading voice message:",e),void this.setState({didUploadFail:!0})}try{const i=Object(Wr.a)(n.mxc,this.state.recorder.contentType,Math.round(1e3*this.state.recorder.durationSeconds),this.state.recorder.contentLength,n.encrypted,this.state.recorder.getPlayback().thumbnailWaveform.map((e=>Math.round(1024*e))));Object(Br.a)(i,t),e&&(Object(Vr.a)(i,e,{permalinkCreator:a,includeLegacyFallback:!0}),v.a.dispatch({action:"reply_to_event",event:null,context:this.context.timelineRenderingType})),Object(Fr.a)(this.props.room.roomId,(e=>lt.a.get().sendMessage(e,i)))}catch(e){ga.a.error("Error sending voice message:",e)}await this.disposeRecording()}async disposeRecording(){await Ar.instance.disposeRecording(this.voiceRecordingId),this.setState({recorder:null,recordingPhase:null,didUploadFail:!1})}bindNewRecorder(e){this.state.recorder&&this.state.recorder.off(pt.b,this.onRecordingUpdate),e&&e.on(pt.b,this.onRecordingUpdate)}renderWaveformArea(){return this.state.recorder?this.state.recordingPhase!==Or.b.Started?r.a.createElement(Lr.b,{playback:this.state.recorder.getPlayback(),layout:Lr.a.Composer}):r.a.createElement("div",{className:"mx_MediaBody mx_VoiceMessagePrimaryContainer mx_VoiceRecordComposerTile_recording"},r.a.createElement(Rr,{recorder:this.state.recorder}),r.a.createElement(kr,{recorder:this.state.recorder})):null}render(){if(!this.state.recordingPhase)return null;let e,t,a;if(this.state.recordingPhase===Or.b.Started){var n;let t=Object(N.a)("Send voice message");this.state.recorder&&(t=Object(N.a)("Stop recording")),e=r.a.createElement(q.a,{className:"mx_VoiceRecordComposerTile_stop",onClick:this.onRecordStartEndClick,title:t}),!this.state.recorder||null!==(n=this.state.recorder)&&void 0!==n&&n.isRecording||(e=null)}return this.state.recorder&&this.state.recordingPhase!==Or.b.Uploading&&(t=r.a.createElement(q.a,{className:"mx_VoiceRecordComposerTile_delete",title:Object(N.a)("Delete"),onClick:this.onCancel})),this.state.recordingPhase===Or.b.Uploading?a=r.a.createElement("span",{className:"mx_VoiceRecordComposerTile_uploadingState"},r.a.createElement(he.a,{w:16,h:16})):this.state.didUploadFail&&this.state.recordingPhase===Or.b.Ended&&(a=r.a.createElement("span",{className:"mx_VoiceRecordComposerTile_failedState"},r.a.createElement("span",{className:"mx_VoiceRecordComposerTile_uploadState_badge"},r.a.createElement(Se.a,{notification:Oe.a.forSymbol("!",Ce.a.Red)})),r.a.createElement("span",{className:"text-warning"},Object(N.a)("Failed to send")))),r.a.createElement(r.a.Fragment,null,a,t,e,this.renderWaveformArea())}}i()(Hr,"contextType",Qa.b);var zr=a(164),Gr=a(650),Kr=a(217),qr=a(315),$r=a(946);let Yr=0;function Jr(e){var t;return r.a.createElement(q.a,{className:"mx_MessageComposer_sendMessage",onClick:e.onClick,title:null!==(t=e.title)&&void 0!==t?t:Object(N.a)("Send message"),"data-testid":"sendmessagebtn"})}class Qr extends r.a.Component{constructor(e){super(e),i()(this,"dispatcherRef",void 0),i()(this,"messageComposerInput",Object(s.createRef)()),i()(this,"voiceRecordingButton",Object(s.createRef)()),i()(this,"ref",Object(s.createRef)()),i()(this,"instanceId",void 0),i()(this,"_voiceRecording",void 0),i()(this,"context",void 0),i()(this,"onResize",((e,t)=>{if(e===Q.a.Resize){const{narrow:e}=this.context;this.setState({isMenuOpen:!!e&&this.state.isMenuOpen,isStickerPickerOpen:!1})}})),i()(this,"onAction",(e=>{switch(e.action){case"reply_to_event":e.context===this.context.timelineRenderingType&&window.setTimeout((()=>{this.props.resizeNotifier.notifyTimelineHeightChanged()}),100);break;case U.a.SettingUpdated:{const t=e;switch(t.settingName){case"MessageComposerInput.showStickersButton":{const e=b.b.getValue("MessageComposerInput.showStickersButton");this.state.showStickersButton!==e&&this.setState({showStickersButton:e});break}case"MessageComposerInput.showPollsButton":{const e=b.b.getValue("MessageComposerInput.showPollsButton");this.state.showPollsButton!==e&&this.setState({showPollsButton:e});break}case qr.a.VoiceBroadcast:this.state.showVoiceBroadcastButton!==t.newValue&&this.setState({showVoiceBroadcastButton:!!t.newValue});break;case"feature_wysiwyg_composer":this.state.isWysiwygLabEnabled!==t.newValue&&this.setState({isWysiwygLabEnabled:Boolean(t.newValue)})}}}})),i()(this,"onTombstoneClick",(e=>{e.preventDefault();const t=this.context.tombstone.getContent().replacement_room,a=lt.a.get().getRoom(t);let n=null;if(a){const e=a.currentState.getStateEvents(ee.b.RoomCreate,"");e&&e.getId()&&(n=e.getId())}const i=[this.context.tombstone.getSender().split(":").slice(1).join(":")];v.a.dispatch({action:U.a.ViewRoom,highlighted:!0,event_id:n,room_id:t,auto_join:!0,via_servers:i,metricsTrigger:"Tombstone",metricsViaKeyboard:"click"!==e.type})})),i()(this,"renderPlaceholderText",(()=>{if(this.props.replyToEvent){var e;const t=(null===(e=this.props.relation)||void 0===e?void 0:e.rel_type)===xa.d.name;return t&&this.props.e2eStatus?Object(N.a)("Reply to encrypted thread…"):t?Object(N.a)("Reply to thread…"):this.props.e2eStatus?Object(N.a)("Send an encrypted reply…"):Object(N.a)("Send a reply…")}return this.props.e2eStatus?Object(N.a)("Send an encrypted message…"):Object(N.a)("Send a message…")})),i()(this,"addEmoji",(e=>(v.a.dispatch({action:U.a.ComposerInsert,text:e,timelineRenderingType:this.context.timelineRenderingType}),!0))),i()(this,"sendMessage",(async()=>{var e,t;if(this.state.haveRecording&&this.voiceRecordingButton.current)await(null===(t=this.voiceRecordingButton.current)||void 0===t?void 0:t.send());else if(null===(e=this.messageComposerInput.current)||void 0===e||e.sendMessage(),this.state.isWysiwygLabEnabled){const{permalinkCreator:e,relation:t,replyToEvent:a}=this.props,n=this.state.composerContent;this.setState({composerContent:"",initialComposerContent:""}),v.a.dispatch({action:U.a.ClearAndFocusSendMessageComposer,timelineRenderingType:this.context.timelineRenderingType}),await Object($r.d)(n,this.state.isRichTextEnabled,{mxClient:this.props.mxClient,roomContext:this.context,permalinkCreator:e,relation:t,replyToEvent:a})}})),i()(this,"onChange",(e=>{this.setState({isComposerEmpty:e.isEmpty})})),i()(this,"onWysiwygChange",(e=>{this.setState({composerContent:e,isComposerEmpty:0===(null==e?void 0:e.length)})})),i()(this,"onRichTextToggle",(async()=>{const{richToPlain:e,plainToRich:t}=await Object($r.c)(),{isRichTextEnabled:a,composerContent:n}=this.state,i=a?await e(n):await t(n);this.setState({isRichTextEnabled:!a,composerContent:i,initialComposerContent:i})})),i()(this,"onVoiceStoreUpdate",(()=>{this.updateRecordingState()})),i()(this,"onRecordingStarted",(()=>{const e=Ar.getVoiceRecordingId(this.props.room,this.props.relation);this.voiceRecording=Ar.instance.getActiveRecording(e),this.setState({haveRecording:!!this.voiceRecording})})),i()(this,"onRecordingEndingSoon",(e=>{let{secondsLeft:t}=e;this.setState({recordingTimeLeftSeconds:t}),window.setTimeout((()=>this.setState({recordingTimeLeftSeconds:null})),3e3)})),i()(this,"setStickerPickerOpen",(e=>{this.setState({isStickerPickerOpen:e,isMenuOpen:!1})})),i()(this,"toggleStickerPickerOpen",(()=>{this.setStickerPickerOpen(!this.state.isStickerPickerOpen)})),i()(this,"toggleButtonMenu",(()=>{this.setState({isMenuOpen:!this.state.isMenuOpen})})),i()(this,"onRecordStartEndClick",(()=>{const e=rt.b.instance.voiceBroadcastRecordingsStore.getCurrent();var t;e&&e.getState()!==Et.h.Stopped?H.b.createDialog(Hn.a,{title:Object(N.a)("Can't start voice message"),description:r.a.createElement("p",null,Object(N.a)("You can't start a voice message as you are currently recording a live broadcast. Please end your live broadcast in order to start recording a voice message.")),hasCloseButton:!0}):null===(t=this.voiceRecordingButton.current)||void 0===t||t.onRecordStartEndClick();this.context.narrow&&this.toggleButtonMenu()})),Ar.instance.on(pt.b,this.onVoiceStoreUpdate),this.state={isComposerEmpty:!0,composerContent:"",haveRecording:!1,recordingTimeLeftSeconds:void 0,isMenuOpen:!1,isStickerPickerOpen:!1,showStickersButton:b.b.getValue("MessageComposerInput.showStickersButton"),showPollsButton:b.b.getValue("MessageComposerInput.showPollsButton"),showVoiceBroadcastButton:b.b.getValue(qr.a.VoiceBroadcast),isWysiwygLabEnabled:b.b.getValue("feature_wysiwyg_composer"),isRichTextEnabled:!0,initialComposerContent:""},this.instanceId=Yr++,b.b.monitorSetting("MessageComposerInput.showStickersButton",null),b.b.monitorSetting("MessageComposerInput.showPollsButton",null),b.b.monitorSetting(qr.a.VoiceBroadcast,null),b.b.monitorSetting("feature_wysiwyg_composer",null)}get voiceRecording(){return this._voiceRecording}set voiceRecording(e){this._voiceRecording&&(this._voiceRecording.off(Or.b.Started,this.onRecordingStarted),this._voiceRecording.off(Or.b.EndingSoon,this.onRecordingEndingSoon)),this._voiceRecording=e,e&&(e.on(Or.b.Started,this.onRecordingStarted),e.on(Or.b.EndingSoon,this.onRecordingEndingSoon))}componentDidMount(){this.dispatcherRef=v.a.register(this.onAction),this.waitForOwnMember(),Q.b.instance.trackElementDimensions(`MessageComposer${this.instanceId}`,this.ref.current),Q.b.instance.on(`MessageComposer${this.instanceId}`,this.onResize),this.updateRecordingState()}waitForOwnMember(){const e=this.props.room.getMember(lt.a.get().getUserId());e?this.setState({me:e}):this.props.room.loadMembersIfNeeded().then((()=>{const e=this.props.room.getMember(lt.a.get().getUserId());this.setState({me:e})}))}componentWillUnmount(){Ar.instance.off(pt.b,this.onVoiceStoreUpdate),v.a.unregister(this.dispatcherRef),Q.b.instance.stopTrackingElementDimensions(`MessageComposer${this.instanceId}`),Q.b.instance.removeListener(`MessageComposer${this.instanceId}`,this.onResize),this.voiceRecording=null}updateRecordingState(){const e=Ar.getVoiceRecordingId(this.props.room,this.props.relation);this.voiceRecording=Ar.instance.getActiveRecording(e),this.voiceRecording?this.voiceRecording.hasRecording&&!this.voiceRecording.isRecording&&this.setState({haveRecording:!0}):this.setState({haveRecording:!1})}get showStickersButton(){return this.state.showStickersButton&&!Object(Kr.a)(this.props.room)}getMenuPosition(){if(this.ref.current){const e=this.state.isWysiwygLabEnabled&&this.state.isRichTextEnabled,t=this.ref.current.getBoundingClientRect(),a=e?36:0,n=new DOMRect(t.x,t.y+a,t.width,t.height-a);return Object(ce.i)(n)}}render(){var e;const t=Boolean(!this.state.isWysiwygLabEnabled&&this.props.e2eStatus),n=t&&r.a.createElement(bs.b,{key:"e2eIcon",status:this.props.e2eStatus,className:"mx_MessageComposer_e2eIcon"}),i=[],s=this.getMenuPosition(),o=this.context.canSendMessages&&!this.context.tombstone;let l,d;if(o)l=this.state.isWysiwygLabEnabled&&s?r.a.createElement($r.b,{key:"controls_input",disabled:this.state.haveRecording,onChange:this.onWysiwygChange,onSend:this.sendMessage,isRichTextEnabled:this.state.isRichTextEnabled,initialContent:this.state.initialComposerContent,e2eStatus:this.props.e2eStatus,menuPosition:s,placeholder:this.renderPlaceholderText(),eventRelation:this.props.relation}):r.a.createElement(Br.b,{ref:this.messageComposerInput,key:"controls_input",room:this.props.room,placeholder:this.renderPlaceholderText(),permalinkCreator:this.props.permalinkCreator,relation:this.props.relation,replyToEvent:this.props.replyToEvent,onChange:this.onChange,disabled:this.state.haveRecording,toggleStickerPickerOpen:this.toggleStickerPickerOpen}),i.push(r.a.createElement(Hr,{key:"controls_voice_record",ref:this.voiceRecordingButton,room:this.props.room,permalinkCreator:this.props.permalinkCreator,relation:this.props.relation,replyToEvent:this.props.replyToEvent}));else if(this.context.tombstone){const e=this.context.tombstone.getContent().replacement_room,t=e?r.a.createElement("a",{href:Object(Ra.h)(e),className:"mx_MessageComposer_roomReplaced_link",onClick:this.onTombstoneClick},Object(N.a)("The conversation continues here.")):"";i.push(r.a.createElement("div",{className:"mx_MessageComposer_replaced_wrapper",key:"room_replaced"},r.a.createElement("div",{className:"mx_MessageComposer_replaced_valign"},r.a.createElement("img",{className:"mx_MessageComposer_roomReplaced_icon",src:a(1537).default}),r.a.createElement("span",{className:"mx_MessageComposer_roomReplaced_header"},Object(N.a)("This room has been replaced and is no longer active.")),r.a.createElement("br",null),t)))}else i.push(r.a.createElement("div",{key:"controls_error",className:"mx_MessageComposer_noperm_error"},Object(N.a)("You do not have permission to post to this room")));if(this.state.recordingTimeLeftSeconds){const e=Math.round(this.state.recordingTimeLeftSeconds);d=r.a.createElement(zr.b,{label:Object(N.a)("%(seconds)ss left",{seconds:e}),alignment:zr.a.Top})}const m=(null===(e=this.props.relation)||void 0===e?void 0:e.rel_type)===xa.d.name?this.props.relation.event_id:null;i.push(r.a.createElement(_r,{room:this.props.room,threadId:m,isStickerPickerOpen:this.state.isStickerPickerOpen,setStickerPickerOpen:this.setStickerPickerOpen,menuPosition:s,key:"stickers"}));const u=!this.state.isComposerEmpty||this.state.haveRecording,h=c()({mx_MessageComposer:!0,"mx_MessageComposer--compact":this.props.compact,mx_MessageComposer_e2eStatus:t,mx_MessageComposer_wysiwyg:this.state.isWysiwygLabEnabled});return r.a.createElement("div",{className:h,ref:this.ref},d,r.a.createElement("div",{className:"mx_MessageComposer_wrapper"},r.a.createElement(wr,{replyToEvent:this.props.replyToEvent,permalinkCreator:this.props.permalinkCreator}),r.a.createElement("div",{className:"mx_MessageComposer_row"},n,l,r.a.createElement("div",{className:"mx_MessageComposer_actions"},i,o&&r.a.createElement(Gr.b,{addEmoji:this.addEmoji,haveRecording:this.state.haveRecording,isMenuOpen:this.state.isMenuOpen,isStickerPickerOpen:this.state.isStickerPickerOpen,menuPosition:s,relation:this.props.relation,onRecordStartEndClick:this.onRecordStartEndClick,setStickerPickerOpen:this.setStickerPickerOpen,showLocationButton:!window.electron,showPollsButton:this.state.showPollsButton,showStickersButton:this.showStickersButton,isRichTextEnabled:this.state.isRichTextEnabled,onComposerModeClick:this.onRichTextToggle,toggleButtonMenu:this.toggleButtonMenu,showVoiceBroadcastButton:this.state.showVoiceBroadcastButton,onStartVoiceBroadcastClick:()=>{(async(e,t,a,n,i)=>{var s;if(!await Object(Et.C)(e,t,n))return null;const r=t.getUserId();if(!r)return null;const o=e.getMember(r);if(!o)return null;null===(s=a.getCurrent())||void 0===s||s.pause(),a.clearCurrent();const l=new Et.o(e,o,t,a,n);i.setCurrent(l)})(this.props.room,lt.a.get(),rt.b.instance.voiceBroadcastPlaybacksStore,rt.b.instance.voiceBroadcastRecordingsStore,rt.b.instance.voiceBroadcastPreRecordingStore),this.toggleButtonMenu()}}),u&&r.a.createElement(Jr,{key:"controls_send",onClick:this.sendMessage,title:this.state.haveRecording?Object(N.a)("Send voice message"):void 0})))))}}i()(Qr,"contextType",Qa.b),i()(Qr,"defaultProps",{compact:!1,showVoiceBroadcastButton:!1,isRichTextEnabled:!0});var Xr=Object(R.c)(Qr);class Zr{constructor(e){this.event=e,i()(this,"serializedParts",null),i()(this,"caret",null)}setEditorState(e,t){this.caret=e,this.serializedParts=t}hasEditorState(){return!!this.serializedParts}getSerializedParts(){return this.serializedParts}getCaret(){return this.caret}getEvent(){return this.event}}var eo=a(374),to=a(491);class ao extends r.a.PureComponent{constructor(e){super(e),i()(this,"dispatcherRef",void 0),i()(this,"mounted",!1),i()(this,"onAction",(e=>{this.mounted&&function(e){return[U.a.UploadStarted,U.a.UploadProgress,U.a.UploadFailed,U.a.UploadFinished,U.a.UploadCanceled].includes(e.action)}(e)&&this.setState(this.calculateState())})),i()(this,"onCancelClick",(e=>{e.preventDefault(),Ia.a.sharedInstance().cancelUpload(this.state.currentUpload)})),this.state=this.calculateState()}componentDidMount(){this.dispatcherRef=v.a.register(this.onAction),this.mounted=!0}componentWillUnmount(){this.mounted=!1,v.a.unregister(this.dispatcherRef)}getUploadsInRoom(){return Ia.a.sharedInstance().getCurrentUploads(this.props.relation).filter((e=>e.roomId===this.props.room.roomId))}calculateState(){const[e,...t]=this.getUploadsInRoom();return{currentUpload:e,currentFile:null==e?void 0:e.fileName,currentLoaded:null==e?void 0:e.loaded,currentTotal:null==e?void 0:e.total,countFiles:t.length+1}}render(){if(!this.state.currentFile)return null;const e=Object(N.a)("Uploading %(filename)s and %(count)s others",{filename:this.state.currentFile,count:this.state.countFiles-1}),t=Object(eo.filesize)(this.state.currentTotal);return r.a.createElement("div",{className:"mx_UploadBar"},r.a.createElement("div",{className:"mx_UploadBar_filename"},e," (",t,")"),r.a.createElement(G.a,{onClick:this.onCancelClick,className:"mx_UploadBar_cancel"}),r.a.createElement(to.a,{value:this.state.currentLoaded,max:this.state.currentTotal}))}}var no=a(226);const io=["mxEvent","permalinkCreator","onMenuToggle"];var so=e=>{let{mxEvent:t,permalinkCreator:a,onMenuToggle:n}=e,i=ve()(e,io);const[o,l,c,d]=Object(ce.q)(),m=Object(s.useCallback)((e=>{e.preventDefault(),e.stopPropagation(),v.a.dispatch({action:U.a.ViewRoom,event_id:t.getId(),highlighted:!0,room_id:t.getRoomId(),metricsTrigger:void 0}),d()}),[t,d]),u=Object(s.useCallback)((async e=>{if(a){null==e||e.preventDefault(),null==e||e.stopPropagation();const n=a.forEvent(t.getId());await Object(no.b)(n),d()}}),[t,d,a]);Object(s.useEffect)((()=>{null==n||n(o)}),[o,n]);const h=!an.d.instance.hasMaximisedWidget(lt.a.get().getRoom(t.getRoomId()));return r.a.createElement(r.a.Fragment,null,r.a.createElement(ce.c,Z()({},i,{className:"mx_BaseCard_header_title_button--option",onClick:c,title:Object(N.a)("Thread options"),isExpanded:o,inputRef:l,"data-testid":"threadlist-dropdown-button"})),o&&r.a.createElement(me.e,Z()({onFinished:d,className:"mx_RoomTile_contextMenu",compact:!0,rightAligned:!0},{left:(p=l.current.getBoundingClientRect()).left+window.scrollX+p.width,top:p.bottom+window.scrollY,chevronFace:ce.a.None}),r.a.createElement(me.c,null,h&&r.a.createElement(me.b,{onClick:e=>m(e),label:Object(N.a)("View in room"),iconClassName:"mx_ThreadPanel_viewInRoom"}),a&&r.a.createElement(me.b,{"data-testid":"copy-thread-link",onClick:e=>u(e),label:Object(N.a)("Copy link to thread"),iconClassName:"mx_ThreadPanel_copyLinkToThread"}))));var p};var ro=e=>{let{parent:t,onFileDrop:n}=e;const[i,o]=Object(s.useState)({dragging:!1,counter:0});return Object(s.useEffect)((()=>{if(!t||t.ondrop)return;const e=e=>{e.stopPropagation(),e.preventDefault(),o((t=>({counter:t.counter+1,dragging:!(!e.dataTransfer.types.includes("Files")&&!e.dataTransfer.types.includes("application/x-moz-file"))||t.dragging})))},a=e=>{e.stopPropagation(),e.preventDefault(),o((e=>({counter:e.counter-1,dragging:!(e.counter<=1)&&e.dragging})))},i=e=>{e.stopPropagation(),e.preventDefault(),e.dataTransfer.dropEffect="none",(e.dataTransfer.types.includes("Files")||e.dataTransfer.types.includes("application/x-moz-file"))&&(e.dataTransfer.dropEffect="copy")},s=e=>{e.stopPropagation(),e.preventDefault(),n(e.dataTransfer),o((e=>({dragging:!1,counter:e.counter-1})))};return null==t||t.addEventListener("drop",s),null==t||t.addEventListener("dragover",i),null==t||t.addEventListener("dragenter",e),null==t||t.addEventListener("dragleave",a),()=>{null==t||t.removeEventListener("drop",s),null==t||t.removeEventListener("dragover",i),null==t||t.removeEventListener("dragenter",e),null==t||t.removeEventListener("dragleave",a)}}),[t,n]),i.dragging?r.a.createElement("div",{className:"mx_FileDropTarget"},r.a.createElement("img",{src:a(1538).default,className:"mx_FileDropTarget_image",alt:""}),Object(N.a)("Drop file here to upload")):null},oo=a(335);function lo(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function co(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?lo(Object(a),!0).forEach((function(t){i()(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):lo(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}class mo extends r.a.Component{constructor(e){var t;super(e),t=this,i()(this,"context",void 0),i()(this,"dispatcherRef",void 0),i()(this,"layoutWatcherRef",void 0),i()(this,"timelinePanel",Object(s.createRef)()),i()(this,"card",Object(s.createRef)()),i()(this,"onAction",(e=>{switch(e.phase==Ma.a.ThreadView&&e.event&&this.setupThread(e.event),e.action){case U.a.ComposerInsert:if(e.composerType)break;if(e.timelineRenderingType!==Qa.a.Thread)break;v.a.dispatch(co(co({},e),{},{composerType:this.state.editState?oo.a.Edit:oo.a.Send}));break;case U.a.EditEvent:if(e.timelineRenderingType!==Qa.a.Thread)return;if(e.event&&!e.event.getThread())return;this.setState({editState:e.event?new Zr(e.event):null},(()=>{var t;e.event&&(null===(t=this.timelinePanel.current)||void 0===t||t.scrollToEventIfNeeded(e.event.getId()))}));break;case"reply_to_event":e.context===Qa.a.Thread&&this.setState({replyToEvent:e.event})}})),i()(this,"setupThread",(e=>{let t=this.props.room.getThread(e.getId());t||(t=this.props.room.createThread(e.getId(),e,[e],!0)),this.updateThread(t)})),i()(this,"onNewThread",(e=>{e.id===this.props.mxEvent.getId()&&this.setupThread(this.props.mxEvent)})),i()(this,"updateThreadRelation",(()=>{this.setState({lastReply:this.threadLastReply})})),i()(this,"updateThread",(e=>{this.state.thread!==e&&(this.setupThreadListeners(e,this.state.thread),e&&this.setState({thread:e,lastReply:this.threadLastReply},(async()=>this.postThreadUpdate(e))))})),i()(this,"resetJumpToEvent",(e=>{var t,a;this.props.initialEvent&&this.props.initialEventScrollIntoView&&e===(null===(t=this.props.initialEvent)||void 0===t?void 0:t.getId())&&v.a.dispatch({action:U.a.ViewRoom,room_id:this.props.room.roomId,event_id:null===(a=this.props.initialEvent)||void 0===a?void 0:a.getId(),highlighted:this.props.isInitialEventHighlighted,scroll_into_view:!1,replyingToEvent:this.state.replyToEvent,metricsTrigger:void 0})})),i()(this,"onMeasurement",(e=>{this.setState({narrow:e})})),i()(this,"onKeyDown",(e=>{let t=!1;if(Object(J.a)().getRoomAction(e)===W.h.UploadFile)v.a.dispatch({action:"upload_file",context:Qa.a.Thread},!0),t=!0;t&&(e.stopPropagation(),e.preventDefault())})),i()(this,"onFileDrop",(e=>{const t=this.props.mxEvent.getRoomId();t?Ia.a.sharedInstance().sendContentListToRoom(Array.from(e.files),t,this.threadRelation,lt.a.get(),Qa.a.Thread):console.warn("Unknwon roomId for event",this.props.mxEvent)})),i()(this,"renderThreadViewHeader",(()=>r.a.createElement("div",{className:"mx_BaseCard_header_title"},r.a.createElement(la.a,{size:"h4",className:"mx_BaseCard_header_title_heading"},Object(N.a)("Thread")),r.a.createElement(so,{mxEvent:this.props.mxEvent,permalinkCreator:this.props.permalinkCreator}))));const a=this.props.room.getThread(this.props.mxEvent.getId());this.setupThreadListeners(a),this.state={layout:b.b.getValue("layout"),narrow:!1,thread:a,lastReply:null==a?void 0:a.lastReply((e=>e.isRelation(xa.d.name)&&!e.status))},this.layoutWatcherRef=b.b.watchSetting("layout",null,(function(){for(var e=arguments.length,a=new Array(e),n=0;n<e;n++)a[n]=arguments[n];let[,,,i]=a;return t.setState({layout:i})}))}componentDidMount(){this.state.thread&&this.postThreadUpdate(this.state.thread),this.setupThread(this.props.mxEvent),this.dispatcherRef=v.a.register(this.onAction);lt.a.get().getRoom(this.props.mxEvent.getRoomId()).on(xa.f.New,this.onNewThread)}componentWillUnmount(){this.dispatcherRef&&v.a.unregister(this.dispatcherRef);const e=this.props.mxEvent.getRoomId();lt.a.get().getRoom(e).removeListener(xa.f.New,this.onNewThread),b.b.unwatchSetting(this.layoutWatcherRef);const t=rt.b.instance.roomViewStore.getRoomId()!==e;this.props.initialEvent&&!t&&v.a.dispatch({action:U.a.ViewRoom,room_id:this.props.room.roomId,metricsTrigger:void 0}),v.a.dispatch({action:U.a.ViewThread,thread_id:null})}componentDidUpdate(e){e.mxEvent!==this.props.mxEvent&&this.setupThread(this.props.mxEvent),e.room!==this.props.room&&Aa.a.instance.setCard({phase:Ma.a.RoomSummary})}get threadLastReply(){var e;return null===(e=this.state.thread)||void 0===e?void 0:e.lastReply((e=>e.isRelation(xa.d.name)&&!e.status))}async postThreadUpdate(e){var t,a;v.a.dispatch({action:U.a.ViewThread,thread_id:e.id}),e.emit(xa.f.ViewThread),this.updateThreadRelation(),null===(t=this.timelinePanel.current)||void 0===t||t.refreshTimeline(null===(a=this.props.initialEvent)||void 0===a?void 0:a.getId())}setupThreadListeners(e,t){t&&(this.state.thread.off(xa.f.NewReply,this.updateThreadRelation),this.props.room.off(te.d.LocalEchoUpdated,this.updateThreadRelation)),e&&(e.on(xa.f.NewReply,this.updateThreadRelation),this.props.room.on(te.d.LocalEchoUpdated,this.updateThreadRelation))}get threadRelation(){var e,t,a,n;const i={rel_type:xa.d.name,event_id:null===(e=this.state.thread)||void 0===e?void 0:e.id,is_falling_back:!0},s=null!==(t=null===(a=this.state.lastReply)||void 0===a?void 0:a.getId())&&void 0!==t?t:null===(n=this.state.thread)||void 0===n?void 0:n.id;return s&&(i["m.in_reply_to"]={event_id:s}),i}render(){var e,t,a,n,i,s;const o=this.props.isInitialEventHighlighted?null===(e=this.props.initialEvent)||void 0===e?void 0:e.getId():null,l=this.threadRelation;let d;var m;this.state.thread?(this.props.initialEvent&&this.props.initialEvent.getRoomId()!==this.state.thread.roomId&&ga.a.warn("ThreadView attempting to render TimelinePanel with mismatched initialEvent",this.state.thread.roomId,this.props.initialEvent.getRoomId(),this.props.initialEvent.getId()),d=r.a.createElement(r.a.Fragment,null,r.a.createElement(ro,{parent:this.card.current,onFileDrop:this.onFileDrop}),r.a.createElement(ur,{key:this.state.thread.id,ref:this.timelinePanel,showReadReceipts:!0,manageReadReceipts:!0,manageReadMarkers:!0,sendReadReceiptOnLoad:!0,timelineSet:this.state.thread.timelineSet,showUrlPreview:this.context.showUrlPreview,layout:this.state.layout===hr.a.Bubble?hr.a.Bubble:hr.a.Group,hideThreadedMessages:!1,hidden:!1,showReactions:!0,className:"mx_RoomView_messagePanel",permalinkCreator:this.props.permalinkCreator,membersLoaded:!0,editState:this.state.editState,eventId:null===(m=this.props.initialEvent)||void 0===m?void 0:m.getId(),highlightedEventId:o,eventScrollIntoView:this.props.initialEventScrollIntoView,onEventScrolledIntoView:this.resetJumpToEvent}))):d=r.a.createElement("div",{className:"mx_RoomView_messagePanelSpinner"},r.a.createElement(pn.a,null));return r.a.createElement(Qa.b.Provider,{value:co(co({},this.context),{},{timelineRenderingType:Qa.a.Thread,threadId:null===(t=this.state.thread)||void 0===t?void 0:t.id,liveTimeline:null===(a=this.state)||void 0===a||null===(n=a.thread)||void 0===n||null===(i=n.timelineSet)||void 0===i?void 0:i.getLiveTimeline(),narrow:this.state.narrow})},r.a.createElement(Ba,{className:c()("mx_ThreadView mx_ThreadPanel",{mx_ThreadView_narrow:this.state.narrow}),onClose:this.props.onClose,withoutScrollContainer:!0,header:this.renderThreadViewHeader(),ref:this.card,onKeyDown:this.onKeyDown,onBack:e=>{re.b.trackInteraction("WebThreadViewBackButton",e)}},r.a.createElement(pr,{sensor:this.card.current,onMeasurement:this.onMeasurement}),r.a.createElement("div",{className:"mx_ThreadView_timelinePanelWrapper"},d),Ia.a.sharedInstance().getCurrentUploads(l).length>0&&r.a.createElement(ao,{room:this.props.room,relation:l}),(null===(s=this.state.thread)||void 0===s?void 0:s.timelineSet)&&r.a.createElement(Xr,{room:this.props.room,resizeNotifier:this.props.resizeNotifier,relation:l,replyToEvent:this.state.replyToEvent,permalinkCreator:this.props.permalinkCreator,e2eStatus:this.props.e2eStatus,compact:!0})))}}i()(mo,"contextType",Qa.b);var uo=a(549);function ho(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function po(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?ho(Object(a),!0).forEach((function(t){i()(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):ho(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}let go;!function(e){e[e.My=0]="My",e[e.All=1]="All"}(go||(go={}));const vo=e=>{let{label:t,description:a,onClick:n,isSelected:i}=e;return r.a.createElement(ce.f,{active:i,className:"mx_ThreadPanel_Header_FilterOptionItem",onClick:n},r.a.createElement("span",null,t),r.a.createElement("span",null,a))},bo=e=>{let{filterOption:t,setFilterOption:a,empty:n}=e;const[i,s,o,l]=Object(ce.q)(),c=[{label:Object(N.a)("All threads"),description:Object(N.a)("Shows all threads from current room"),key:go.All},{label:Object(N.a)("My threads"),description:Object(N.a)("Shows all threads you've participated in"),key:go.My}],d=c.find((e=>e.key===t)),m=c.map((e=>r.a.createElement(vo,{key:e.key,label:e.label,description:e.description,onClick:()=>{a(e.key),l()},isSelected:e===d}))),u=i?r.a.createElement(ce.n,{top:108,right:33,onFinished:l,chevronFace:ce.a.Top,wrapperClassName:"mx_BaseCard_header_title"},m):null;return r.a.createElement("div",{className:"mx_BaseCard_header_title"},r.a.createElement(la.a,{size:"h4",className:"mx_BaseCard_header_title_heading"},Object(N.a)("Threads")),!n&&r.a.createElement(r.a.Fragment,null,r.a.createElement(uo.a,{className:"mx_ThreadPanel_dropdown",inputRef:s,isExpanded:i,onClick:e=>{o(),re.b.trackInteraction("WebRightPanelThreadPanelFilterDropdown",e)}},`${Object(N.a)("Show:")} ${d.label}`),u))},fo=e=>{let t,{hasThreads:a,filterOption:n,showAllThreadsCallback:i}=e;return t=a?r.a.createElement(r.a.Fragment,null,r.a.createElement("p",null,Object(N.a)("Reply to an ongoing thread or use “%(replyInThread)s” when hovering over a message to start a new one.",{replyInThread:Object(N.a)("Reply in thread")})),r.a.createElement("p",null,n===go.My?r.a.createElement("button",{onClick:i},Object(N.a)("Show all threads")):r.a.createElement(r.a.Fragment,null," "))):r.a.createElement(r.a.Fragment,null,r.a.createElement("p",null,Object(N.a)("Threads help keep your conversations on-topic and easy to track.")),r.a.createElement("p",{className:"mx_ThreadPanel_empty_tip"},Object(N.a)("<b>Tip:</b> Use “%(replyInThread)s” when hovering over a message.",{replyInThread:Object(N.a)("Reply in thread")},{b:e=>r.a.createElement("b",null,e)}))),r.a.createElement("aside",{className:"mx_ThreadPanel_empty"},r.a.createElement("div",{className:"mx_ThreadPanel_largeIcon"}),r.a.createElement("h2",null,Object(N.a)("Keep discussions organised with threads")),t)};var yo=e=>{var t,a,n,i,o,l;let{roomId:c,onClose:d,permalinkCreator:m}=e;const u=Object(s.useContext)(R.a),h=Object(s.useContext)(Qa.b),p=Object(s.useRef)(),g=Object(s.useRef)(),[v,b]=Object(s.useState)(go.All),[f,y]=Object(s.useState)(null),[E,_]=Object(s.useState)(!1),S=v===go.My?null==f?void 0:f.threadsTimelineSets[1]:null==f?void 0:f.threadsTimelineSets[0],w=Boolean(null==f||null===(t=f.threadsTimelineSets)||void 0===t||null===(a=t[0])||void 0===a||null===(n=a.getLiveTimeline())||void 0===n||null===(i=n.getEvents())||void 0===i?void 0:i.length);return Object(s.useEffect)((()=>{const e=u.getRoom(c);null==e||e.createThreadsTimelineSets().then((()=>e.fetchRoomThreads())).then((()=>{b(go.All),y(e)}))}),[u,c]),Object(s.useEffect)((()=>{S&&!xa.e.hasServerSideSupport&&p.current.refreshTimeline()}),[S,p]),r.a.createElement(Qa.b.Provider,{value:po(po({},h),{},{timelineRenderingType:Qa.a.ThreadsList,showHiddenEvents:!0,narrow:E})},r.a.createElement(Ba,{header:r.a.createElement(bo,{filterOption:v,setFilterOption:b,empty:!w}),className:"mx_ThreadPanel",onClose:d,withoutScrollContainer:!0,ref:g},r.a.createElement(pr,{sensor:g.current,onMeasurement:_}),S?r.a.createElement(ur,{key:v+":"+(null!==(o=null===(l=S.getFilter())||void 0===l?void 0:l.filterId)&&void 0!==o?o:c),ref:p,showReadReceipts:!1,manageReadReceipts:!1,manageReadMarkers:!1,sendReadReceiptOnLoad:!1,timelineSet:S,showUrlPreview:!1,empty:r.a.createElement(fo,{hasThreads:w,filterOption:v,showAllThreadsCallback:()=>b(go.All)}),alwaysShowTimestamps:!0,layout:hr.a.Group,hideThreadedMessages:!1,hidden:!1,showReactions:!1,className:"mx_RoomView_messagePanel",membersLoaded:!0,permalinkCreator:m,disableGrouping:!0}):r.a.createElement("div",{className:"mx_AutoHideScrollbar"},r.a.createElement(pn.a,null))))};function Eo(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function _o(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?Eo(Object(a),!0).forEach((function(t){i()(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):Eo(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}class So extends r.a.PureComponent{constructor(e){super(e),i()(this,"card",r.a.createRef()),i()(this,"onMeasurement",(e=>{this.setState({narrow:e})})),this.state={narrow:!1}}render(){const e=r.a.createElement("div",{className:"mx_RightPanel_empty mx_NotificationPanel_empty"},r.a.createElement("h2",null,Object(N.a)("You're all caught up")),r.a.createElement("p",null,Object(N.a)("You have no visible notifications.")));let t;const a=lt.a.get().getNotifTimelineSet();return a?t=r.a.createElement(ur,{manageReadReceipts:!1,manageReadMarkers:!1,timelineSet:a,showUrlPreview:!1,empty:e,alwaysShowTimestamps:!0,layout:hr.a.Group}):(ga.a.error("No notifTimelineSet available!"),t=r.a.createElement(pn.a,null)),r.a.createElement(Qa.b.Provider,{value:_o(_o({},this.context),{},{timelineRenderingType:Qa.a.Notification,narrow:this.state.narrow})},r.a.createElement(Ba,{header:r.a.createElement(la.a,{size:"h4",className:"mx_BaseCard_header_title_heading"},Object(N.a)("Notifications")),className:"mx_ThreadPanel",onClose:this.props.onClose,withoutScrollContainer:!0},this.card.current&&r.a.createElement(pr,{sensor:this.card.current,onMeasurement:this.onMeasurement}),t))}}i()(So,"contextType",Qa.b);var wo=e=>{const t=c()({mx_JumpToBottomButton:!0,mx_JumpToBottomButton_highlight:e.highlight});let a;return e.numUnreadMessages&&(a=r.a.createElement("div",{className:"mx_JumpToBottomButton_badge"},e.numUnreadMessages)),r.a.createElement("div",{className:t},r.a.createElement(G.a,{className:"mx_JumpToBottomButton_scrollDown",title:Object(N.a)("Scroll to most recent messages"),onClick:e.onScrollToBottomClick}),a)};function Oo(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function Co(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?Oo(Object(a),!0).forEach((function(t){i()(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):Oo(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}class xo extends r.a.Component{constructor(e){super(e),i()(this,"dispatcherRef",void 0),i()(this,"layoutWatcherRef",void 0),i()(this,"timelinePanel",r.a.createRef()),i()(this,"card",r.a.createRef()),i()(this,"readReceiptsSettingWatcher",void 0),i()(this,"onRoomViewStoreUpdate",(async e=>{const t={initialEventId:rt.b.instance.roomViewStore.getInitialEventId(),isInitialEventHighlighted:rt.b.instance.roomViewStore.isInitialEventHighlighted(),replyToEvent:rt.b.instance.roomViewStore.getQuotingEvent()};this.setState(t)})),i()(this,"onAction",(e=>{if(e.action===U.a.EditEvent)this.setState({editState:e.event?new Zr(e.event):null},(()=>{var t;e.event&&(null===(t=this.timelinePanel.current)||void 0===t||t.scrollToEventIfNeeded(e.event.getId()))}))})),i()(this,"onScroll",(()=>{const e=this.timelinePanel.current;e&&(e.isAtEndOfLiveTimeline()?this.setState({atEndOfLiveTimeline:!0}):this.setState({atEndOfLiveTimeline:!1}),this.state.initialEventId&&this.state.isInitialEventHighlighted&&v.a.dispatch({action:U.a.ViewRoom,room_id:this.props.room.roomId,event_id:this.state.initialEventId,highlighted:!1,replyingToEvent:this.state.replyToEvent,metricsTrigger:void 0}))})),i()(this,"onMeasurement",(e=>{this.setState({narrow:e})})),i()(this,"jumpToLiveTimeline",(()=>{var e;this.state.initialEventId&&this.state.isInitialEventHighlighted?v.a.dispatch({action:U.a.ViewRoom,room_id:this.props.room.roomId}):(null===(e=this.timelinePanel.current)||void 0===e||e.jumpToLiveTimeline(),v.a.fire(U.a.FocusSendMessageComposer))})),i()(this,"renderTimelineCardHeader",(()=>r.a.createElement("div",{className:"mx_BaseCard_header_title"},r.a.createElement(la.a,{size:"h4",className:"mx_BaseCard_header_title_heading"},Object(N.a)("Chat"))))),this.state={showReadReceipts:b.b.getValue("showReadReceipts",e.room.roomId),layout:b.b.getValue("layout"),atEndOfLiveTimeline:!0,narrow:!1},this.readReceiptsSettingWatcher=null}componentDidMount(){var e=this;rt.b.instance.roomViewStore.addListener(pt.b,this.onRoomViewStoreUpdate),this.dispatcherRef=v.a.register(this.onAction),this.readReceiptsSettingWatcher=b.b.watchSetting("showReadReceipts",null,(function(){for(var t=arguments.length,a=new Array(t),n=0;n<t;n++)a[n]=arguments[n];let[,,,i]=a;return e.setState({showReadReceipts:i})})),this.layoutWatcherRef=b.b.watchSetting("layout",null,(function(){for(var t=arguments.length,a=new Array(t),n=0;n<t;n++)a[n]=arguments[n];let[,,,i]=a;return e.setState({layout:i})}))}componentWillUnmount(){rt.b.instance.roomViewStore.removeListener(pt.b,this.onRoomViewStoreUpdate),this.readReceiptsSettingWatcher&&b.b.unwatchSetting(this.readReceiptsSettingWatcher),this.layoutWatcherRef&&b.b.unwatchSetting(this.layoutWatcherRef),v.a.unregister(this.dispatcherRef)}render(){var e;const t=this.state.isInitialEventHighlighted?this.state.initialEventId:null;let a;this.state.atEndOfLiveTimeline||(a=r.a.createElement(wo,{highlight:this.props.room.getUnreadNotificationCount(te.b.Highlight)>0,onScrollToBottomClick:this.jumpToLiveTimeline}));const n=Ia.a.sharedInstance().getCurrentUploads(this.props.composerRelation).length>0,i="join"===this.props.room.getMyMembership();return r.a.createElement(Qa.b.Provider,{value:Co(Co({},this.context),{},{timelineRenderingType:null!==(e=this.props.timelineRenderingType)&&void 0!==e?e:this.context.timelineRenderingType,liveTimeline:this.props.timelineSet.getLiveTimeline(),narrow:this.state.narrow})},r.a.createElement(Ba,{className:this.props.classNames,onClose:this.props.onClose,withoutScrollContainer:!0,header:this.renderTimelineCardHeader(),ref:this.card},r.a.createElement(pr,{sensor:this.card.current,onMeasurement:this.onMeasurement}),r.a.createElement("div",{className:"mx_TimelineCard_timeline"},a,r.a.createElement(ur,{ref:this.timelinePanel,showReadReceipts:this.state.showReadReceipts,manageReadReceipts:!0,manageReadMarkers:!1,sendReadReceiptOnLoad:!0,timelineSet:this.props.timelineSet,showUrlPreview:this.context.showUrlPreview,layout:this.state.layout===hr.a.Bubble?hr.a.Bubble:hr.a.Group,hideThreadedMessages:!1,hidden:!1,showReactions:!0,className:"mx_RoomView_messagePanel",permalinkCreator:this.props.permalinkCreator,membersLoaded:!0,editState:this.state.editState,eventId:this.state.initialEventId,resizeNotifier:this.props.resizeNotifier,highlightedEventId:t,onScroll:this.onScroll})),n&&r.a.createElement(ao,{room:this.props.room,relation:this.props.composerRelation}),i&&r.a.createElement(Xr,{room:this.props.room,relation:this.props.composerRelation,resizeNotifier:this.props.resizeNotifier,replyToEvent:this.state.replyToEvent,permalinkCreator:this.props.permalinkCreator,e2eStatus:this.props.e2eStatus,compact:!0})))}}function ko(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}i()(xo,"contextType",Qa.b);class jo extends r.a.Component{constructor(e,t){super(e,t),i()(this,"context",void 0),i()(this,"delayedUpdate",Object(k.throttle)((()=>{this.forceUpdate()}),500,{leading:!0,trailing:!0})),i()(this,"onRoomStateMember",((e,t,a)=>{this.props.room&&a.roomId===this.props.room.roomId&&(this.state.phase===Ma.a.RoomMemberList||this.state.phase===Ma.a.RoomMemberInfo&&a.userId===this.state.cardState.member.userId)&&this.delayedUpdate()})),i()(this,"onRightPanelStoreUpdate",(()=>{this.setState(function(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?ko(Object(a),!0).forEach((function(t){i()(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):ko(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}({},jo.getDerivedStateFromProps(this.props)))})),i()(this,"onClose",(()=>{var e,t,a;if(null!==(e=this.props.overwriteCard)&&void 0!==e&&null!==(t=e.state)&&void 0!==t&&t.member)v.a.dispatch({action:U.a.ViewHomePage});else if(this.state.phase===Ma.a.EncryptionPanel&&null!==(a=this.state.cardState.verificationRequest)&&void 0!==a&&a.pending)this.state.cardState.verificationRequest.cancel();else{var n;Aa.a.instance.togglePanel(null===(n=this.props.room)||void 0===n?void 0:n.roomId)}})),i()(this,"onSearchQueryChanged",(e=>{this.setState({searchQuery:e})})),this.state={searchQuery:""}}componentDidMount(){this.context.on(m.b.Members,this.onRoomStateMember),Aa.a.instance.on(pt.b,this.onRightPanelStoreUpdate)}componentWillUnmount(){var e;null===(e=this.context)||void 0===e||e.removeListener(m.b.Members,this.onRoomStateMember),Aa.a.instance.off(pt.b,this.onRightPanelStoreUpdate)}static getDerivedStateFromProps(e){var t,a;let n;return e.room&&(n=Aa.a.instance.currentCardForRoom(e.room.roomId)),{cardState:null===(t=n)||void 0===t?void 0:t.state,phase:null===(a=n)||void 0===a?void 0:a.phase}}render(){var e,t,a,n,i;let s=r.a.createElement("div",null);const o=null===(e=this.props.room)||void 0===e?void 0:e.roomId,l=null!==(t=null===(a=this.props.overwriteCard)||void 0===a?void 0:a.phase)&&void 0!==t?t:this.state.phase,c=null!==(n=null===(i=this.props.overwriteCard)||void 0===i?void 0:i.state)&&void 0!==n?n:this.state.cardState;switch(l){case Ma.a.RoomMemberList:o&&(s=r.a.createElement(ys,{roomId:o,key:o,onClose:this.onClose,searchQuery:this.state.searchQuery,onSearchQueryChanged:this.onSearchQueryChanged}));break;case Ma.a.SpaceMemberList:s=r.a.createElement(ys,{roomId:c.spaceId?c.spaceId:o,key:c.spaceId?c.spaceId:o,onClose:this.onClose,searchQuery:this.state.searchQuery,onSearchQueryChanged:this.onSearchQueryChanged});break;case Ma.a.RoomMemberInfo:case Ma.a.SpaceMemberInfo:case Ma.a.EncryptionPanel:{var d;const e=c.member instanceof Pa.a?c.member:void 0;s=r.a.createElement(Qs,{user:c.member,room:null!==(d=this.context.getRoom(null==e?void 0:e.roomId))&&void 0!==d?d:this.props.room,key:o||c.member.userId,onClose:this.onClose,phase:l,verificationRequest:c.verificationRequest,verificationRequestPromise:c.verificationRequestPromise});break}case Ma.a.Room3pidMemberInfo:case Ma.a.Space3pidMemberInfo:s=r.a.createElement(Xs,{event:c.memberInfoEvent,key:o});break;case Ma.a.NotificationPanel:s=r.a.createElement(So,{onClose:this.onClose});break;case Ma.a.PinnedMessages:b.b.getValue("feature_pinning")&&(s=r.a.createElement(Rn,{room:this.props.room,onClose:this.onClose,permalinkCreator:this.props.permalinkCreator}));break;case Ma.a.Timeline:s=r.a.createElement(xo,{classNames:"mx_ThreadPanel mx_TimelineCard",room:this.props.room,timelineSet:this.props.room.getUnfilteredTimelineSet(),resizeNotifier:this.props.resizeNotifier,onClose:this.onClose,permalinkCreator:this.props.permalinkCreator,e2eStatus:this.props.e2eStatus});break;case Ma.a.FilePanel:s=r.a.createElement(fr,{roomId:o,resizeNotifier:this.props.resizeNotifier,onClose:this.onClose});break;case Ma.a.ThreadView:s=r.a.createElement(mo,{room:this.props.room,resizeNotifier:this.props.resizeNotifier,onClose:this.onClose,mxEvent:c.threadHeadEvent,initialEvent:c.initialEvent,isInitialEventHighlighted:c.isInitialEventHighlighted,initialEventScrollIntoView:c.initialEventScrollIntoView,permalinkCreator:this.props.permalinkCreator,e2eStatus:this.props.e2eStatus});break;case Ma.a.ThreadPanel:s=r.a.createElement(yo,{roomId:o,resizeNotifier:this.props.resizeNotifier,onClose:this.onClose,permalinkCreator:this.props.permalinkCreator});break;case Ma.a.RoomSummary:s=r.a.createElement(_i,{room:this.props.room,onClose:this.onClose});break;case Ma.a.Widget:s=r.a.createElement(ds,{room:this.props.room,widgetId:c.widgetId,onClose:this.onClose})}return r.a.createElement("aside",{className:"mx_RightPanel dark-panel",id:"mx_RightPanel"},s)}}i()(jo,"contextType",R.a);class Ro{constructor(){i()(this,"scrollStateMap",new Map)}getScrollState(e){return this.scrollStateMap.get(e)}setScrollState(e,t){this.scrollStateMap.set(e,t)}}void 0===window.mxRoomScrollStateStore&&(window.mxRoomScrollStateStore=new Ro);var Io=window.mxRoomScrollStateStore,To=a(375),No=a(447),Do=a(475),Po=a(1539),Mo=a(291),Ao=a(196);class Lo extends r.a.PureComponent{constructor(e){super(e),i()(this,"onViewClick",(()=>{this.setState({hidden:!1})})),this.state={hidden:!0}}render(){const e=c()({mx_InviteReason:!0,mx_InviteReason_hidden:this.state.hidden});return r.a.createElement("div",{className:e},r.a.createElement("div",{className:"mx_InviteReason_reason"},this.props.htmlReason?Object(Ao.i)(this.props.htmlReason):this.props.reason),r.a.createElement("div",{className:"mx_InviteReason_view",onClick:this.onViewClick},Object(N.a)("View message")))}}var Uo=a(654);var Fo;!function(e){e.NotLoggedIn="NotLoggedIn",e.Joining="Joining",e.Loading="Loading",e.Rejecting="Rejecting",e.Kicked="Kicked",e.Banned="Banned",e.OtherThreePIDError="OtherThreePIDError",e.InvitedEmailNotFoundInAccount="InvitedEmailNotFoundInAccount",e.InvitedEmailNoIdentityServer="InvitedEmailNoIdentityServer",e.InvitedEmailMismatch="InvitedEmailMismatch",e.Invite="Invite",e.ViewingRoom="ViewingRoom",e.RoomNotFound="RoomNotFound",e.OtherError="OtherError"}(Fo||(Fo={}));class Bo extends r.a.Component{constructor(e){super(e),i()(this,"onLoginClick",(()=>{v.a.dispatch({action:"start_login",screenAfterLogin:this.makeScreenAfterLogin()})})),i()(this,"onRegisterClick",(()=>{v.a.dispatch({action:"start_registration",screenAfterLogin:this.makeScreenAfterLogin()})})),this.state={busy:!1}}componentDidMount(){this.checkInvitedEmail()}componentDidUpdate(e,t){this.props.invitedEmail===e.invitedEmail&&this.props.inviterName===e.inviterName||this.checkInvitedEmail()}async checkInvitedEmail(){if(this.props.inviterName&&this.props.invitedEmail){this.setState({busy:!0});try{const e=await lt.a.get().getThreePids();if(this.setState({accountEmails:e.threepids.filter((e=>"email"===e.medium)).map((e=>e.address))}),!lt.a.get().getIdentityServerUrl())return void this.setState({busy:!1});const t=new Mo.a,a=await t.getAccessToken(),n=await lt.a.get().lookupThreePid("email",this.props.invitedEmail,a);this.setState({invitedEmailMxid:n.mxid})}catch(e){this.setState({threePidFetchError:e})}this.setState({busy:!1})}}getMessageCase(){if(lt.a.get().isGuest())return Fo.NotLoggedIn;const e=this.getMyMember();if(e){if(e.isKicked())return Fo.Kicked;if("ban"===e.membership)return Fo.Banned}if(this.props.joining)return Fo.Joining;if(this.props.rejecting)return Fo.Rejecting;if(this.props.loading||this.state.busy)return Fo.Loading;if(this.props.inviterName){if(this.props.invitedEmail){if(this.state.threePidFetchError)return Fo.OtherThreePIDError;if(this.state.accountEmails&&!this.state.accountEmails.includes(this.props.invitedEmail))return Fo.InvitedEmailNotFoundInAccount;if(!lt.a.get().getIdentityServerUrl())return Fo.InvitedEmailNoIdentityServer;if(this.state.invitedEmailMxid!=lt.a.get().getUserId())return Fo.InvitedEmailMismatch}return Fo.Invite}return this.props.error?"M_NOT_FOUND"==this.props.error.errcode?Fo.RoomNotFound:Fo.OtherError:Fo.ViewingRoom}getKickOrBanInfo(){const e=this.getMyMember();if(!e)return{};const t=this.props.room.currentState.getMember(e.events.member.getSender());return{memberName:t?t.name:e.events.member.getSender(),reason:e.events.member.getContent().reason}}joinRule(){var e,t;return null===(e=this.props.room)||void 0===e||null===(t=e.currentState.getStateEvents(ee.b.RoomJoinRules,""))||void 0===t?void 0:t.getContent().join_rule}getMyMember(){var e;return null===(e=this.props.room)||void 0===e?void 0:e.getMember(lt.a.get().getUserId())}getInviteMember(){const{room:e}=this.props;if(!e)return;const t=lt.a.get().getUserId(),a=e.currentState.getMember(t);if(!a)return;const n=a.events.member.getSender();return e.currentState.getMember(n)}isDMInvite(){const e=this.getMyMember();if(!e)return!1;const t=e.events.member.getContent();return"invite"===t.membership&&t.is_direct}makeScreenAfterLogin(){var e,t,a,n,i,s;return{screen:"room",params:{email:this.props.invitedEmail,signurl:this.props.signUrl,room_name:null!==(e=null===(t=this.props.oobData)||void 0===t?void 0:t.name)&&void 0!==e?e:null,room_avatar_url:null!==(a=null===(n=this.props.oobData)||void 0===n?void 0:n.avatarUrl)&&void 0!==a?a:null,inviter_name:null!==(i=null===(s=this.props.oobData)||void 0===s?void 0:s.inviterName)&&void 0!==i?i:null}}}render(){var e,t,a,n,i,s;const o=mt.b.get().brand,l=null!==(e=null!==(t=null===(a=this.props.room)||void 0===a?void 0:a.name)&&void 0!==t?t:this.props.roomAlias)&&void 0!==e?e:"",d=null!==(n=null===(i=this.props.room)||void 0===i?void 0:i.isSpaceRoom())&&void 0!==n?n:(null===(s=this.props.oobData)||void 0===s?void 0:s.roomType)===ee.j.Space;let m,u,h,p,g,v,f,y,E=!1;const _=[],S=this.getMessageCase();switch(S){case Fo.Joining:var w;m=null!==(w=this.props.oobData)&&void 0!==w&&w.roomType||d?d?Object(N.a)("Joining space…"):Object(N.a)("Joining room…"):Object(N.a)("Joining…"),E=!0;break;case Fo.Loading:m=Object(N.a)("Loading…"),E=!0;break;case Fo.Rejecting:m=Object(N.a)("Rejecting invite…"),E=!0;break;case Fo.NotLoggedIn:{var O;const e={canJoin:!1};null!==(O=this.props.room)&&void 0!==O&&O.roomId&&Uo.a.instance.invoke(Po.RoomViewLifecycle.PreviewRoomNotLoggedIn,e,this.props.room.roomId),e.canJoin?(m=Object(N.a)("Join the room to participate"),g=Object(N.a)("Join"),p=()=>{Uo.a.instance.invoke(Po.RoomViewLifecycle.JoinFromRoomPreview,this.props.room.roomId)}):(m=Object(N.a)("Join the conversation with an account"),b.b.getValue(oe.b.Registration)&&(g=Object(N.a)("Sign Up"),p=this.onRegisterClick),f=Object(N.a)("Sign In"),v=this.onLoginClick),this.props.previewLoading&&(y=r.a.createElement("div",null,r.a.createElement(pn.a,{w:20,h:20}),Object(N.a)("Loading preview")));break}case Fo.Kicked:{const{memberName:e,reason:t}=this.getKickOrBanInfo();m=l?Object(N.a)("You were removed from %(roomName)s by %(memberName)s",{memberName:e,roomName:l}):Object(N.a)("You were removed by %(memberName)s",{memberName:e}),u=t?Object(N.a)("Reason: %(reason)s",{reason:t}):null,g=d?Object(N.a)("Forget this space"):Object(N.a)("Forget this room"),p=this.props.onForgetClick,this.joinRule()!==ka.c.Invite&&(f=g,v=p,g=Object(N.a)("Re-join"),p=this.props.onJoinClick);break}case Fo.Banned:{const{memberName:e,reason:t}=this.getKickOrBanInfo();m=l?Object(N.a)("You were banned from %(roomName)s by %(memberName)s",{memberName:e,roomName:l}):Object(N.a)("You were banned by %(memberName)s",{memberName:e}),u=t?Object(N.a)("Reason: %(reason)s",{reason:t}):null,g=d?Object(N.a)("Forget this space"):Object(N.a)("Forget this room"),p=this.props.onForgetClick;break}case Fo.OtherThreePIDError:{m=l?Object(N.a)("Something went wrong with your invite to %(roomName)s",{roomName:l}):Object(N.a)("Something went wrong with your invite.");const e=this.joinRule(),t=Object(N.a)("An error (%(errcode)s) was returned while trying to validate your invite. You could try to pass this information on to the person who invited you.",{errcode:this.state.threePidFetchError.errcode||Object(N.a)("unknown error code")});switch(e){case"invite":u=[Object(N.a)("You can only join it with a working invite."),t],g=Object(N.a)("Try to join anyway"),p=this.props.onJoinClick;break;case"public":u=Object(N.a)("You can still join here."),g=Object(N.a)("Join the discussion"),p=this.props.onJoinClick;break;default:u=t,g=Object(N.a)("Try to join anyway"),p=this.props.onJoinClick}break}case Fo.InvitedEmailNotFoundInAccount:m=l?Object(N.a)("This invite to %(roomName)s was sent to %(email)s which is not associated with your account",{roomName:l,email:this.props.invitedEmail}):Object(N.a)("This invite was sent to %(email)s which is not associated with your account",{email:this.props.invitedEmail}),u=Object(N.a)("Link this email with your account in Settings to receive invites directly in %(brand)s.",{brand:o}),g=Object(N.a)("Join the discussion"),p=this.props.onJoinClick;break;case Fo.InvitedEmailNoIdentityServer:m=l?Object(N.a)("This invite to %(roomName)s was sent to %(email)s",{roomName:l,email:this.props.invitedEmail}):Object(N.a)("This invite was sent to %(email)s",{email:this.props.invitedEmail}),u=Object(N.a)("Use an identity server in Settings to receive invites directly in %(brand)s.",{brand:o}),g=Object(N.a)("Join the discussion"),p=this.props.onJoinClick;break;case Fo.InvitedEmailMismatch:m=l?Object(N.a)("This invite to %(roomName)s was sent to %(email)s",{roomName:l,email:this.props.invitedEmail}):Object(N.a)("This invite was sent to %(email)s",{email:this.props.invitedEmail}),u=Object(N.a)("Share this email in Settings to receive invites directly in %(brand)s.",{brand:o}),g=Object(N.a)("Join the discussion"),p=this.props.onJoinClick;break;case Fo.Invite:{var C,x;const e=r.a.createElement(ye.a,{room:this.props.room,oobData:this.props.oobData}),t=this.getInviteMember();let a;a=t?r.a.createElement("span",null,r.a.createElement("span",{className:"mx_RoomPreviewBar_inviter"},t.rawDisplayName)," (",t.userId,")"):r.a.createElement("span",{className:"mx_RoomPreviewBar_inviter"},this.props.inviterName);this.isDMInvite()?(m=Object(N.a)("Do you want to chat with %(user)s?",{user:t.name}),u=[e,Object(N.a)("<userName/> wants to chat",{},{userName:()=>a})],g=Object(N.a)("Start chatting")):(m=Object(N.a)("Do you want to join %(roomName)s?",{roomName:l}),u=[e,Object(N.a)("<userName/> invited you",{},{userName:()=>a})],g=Object(N.a)("Accept"));const n=lt.a.get().getUserId(),i=null===(C=this.props.room)||void 0===C?void 0:C.currentState.getMember(n),s=null==i||null===(x=i.events.member)||void 0===x?void 0:x.getContent();null!=s&&s.reason&&(h=r.a.createElement(Lo,{reason:s.reason,htmlReason:s["io.element.html_reason"]})),p=this.props.onJoinClick,f=Object(N.a)("Reject"),v=this.props.onRejectClick,this.props.onRejectAndIgnoreClick&&_.push(r.a.createElement(G.a,{kind:"secondary",onClick:this.props.onRejectAndIgnoreClick,key:"ignore"},Object(N.a)("Reject & Ignore user")));break}case Fo.ViewingRoom:m=this.props.canPreview?Object(N.a)("You're previewing %(roomName)s. Want to join it?",{roomName:l}):l?Object(N.a)("%(roomName)s can't be previewed. Do you want to join it?",{roomName:l}):Object(N.a)("There's no preview, would you like to join?"),g=Object(N.a)("Join the discussion"),p=this.props.onJoinClick;break;case Fo.RoomNotFound:m=l?Object(N.a)("%(roomName)s does not exist.",{roomName:l}):Object(N.a)("This room or space does not exist."),u=Object(N.a)("Are you sure you're at the right place?");break;case Fo.OtherError:m=l?Object(N.a)("%(roomName)s is not accessible at this time.",{roomName:l}):Object(N.a)("This room or space is not accessible at this time."),u=[Object(N.a)("Try again later, or ask a room or space admin to check if you have access."),Object(N.a)("%(errcode)s was returned while trying to access the room or space. If you think you're seeing this message in error, please <issueLink>submit a bug report</issueLink>.",{errcode:this.props.error.errcode},{issueLink:e=>r.a.createElement("a",{href:"https://github.com/vector-im/element-web/issues/new/choose",target:"_blank",rel:"noreferrer noopener"},e)})]}let k,j,R,I;u&&(Array.isArray(u)||(u=[u]),k=u.map(((e,t)=>r.a.createElement("p",{key:`subTitle${t}`},e)))),j=E?r.a.createElement("h3",{className:"mx_RoomPreviewBar_spinnerTitle"},r.a.createElement(pn.a,null),m):r.a.createElement("h3",null,m),p&&(R=r.a.createElement(G.a,{kind:"primary",onClick:p},g)),v&&(I=r.a.createElement(G.a,{kind:"secondary",onClick:v},f));const T=this.props.canPreview,D=c()("mx_RoomPreviewBar","dark-panel",`mx_RoomPreviewBar_${S}`,{mx_RoomPreviewBar_panel:T,mx_RoomPreviewBar_dialog:!T}),P=T?r.a.createElement(r.a.Fragment,null,I,_,R):r.a.createElement(r.a.Fragment,null,R,_,I);return r.a.createElement("div",{className:D},r.a.createElement("div",{className:"mx_RoomPreviewBar_message"},j,k),h,r.a.createElement("div",{className:"mx_RoomPreviewBar_actions"},P),r.a.createElement("div",{className:"mx_RoomPreviewBar_footer"},y))}}i()(Bo,"defaultProps",{onJoinClick(){}});var Vo=a(242),Wo=a(631);const Ho=["room"];function zo(e){let{room:t}=e,a=ve()(e,Ho);const n=Object(s.useContext)(R.a),i=Object(s.useRef)(),o=Object(Wo.b)(t),l=Object(Ao.j)(null==o?void 0:o.text,null==o?void 0:o.html,i),d=Object(s.useCallback)((e=>{var t;null===(t=a.onClick)||void 0===t||t.call(a,e);"A"!==e.target.tagName.toUpperCase()&&v.a.fire(U.a.ShowRoomTopic)}),[a]);Object(ne.a)(v.a,(e=>{if(e.action===U.a.ShowRoomTopic){const e=t.currentState.maySendStateEvent(ee.b.RoomTopic,n.getUserId()),a=Object(Ao.j)(null==o?void 0:o.text,null==o?void 0:o.html,i,!0),s=H.b.createDialog(Hn.a,{title:t.name,description:r.a.createElement("div",null,r.a.createElement(Ao.a,{options:{attributes:{onClick(){s.close()}}},as:"p"},a),e&&r.a.createElement(G.a,{kind:"primary_outline",onClick:()=>{s.close(),v.a.dispatch({action:"open_room_settings"})}},Object(N.a)("Edit topic"))),hasCloseButton:!0,button:!1})}}));const m=c()(a.className,"mx_RoomTopic");return r.a.createElement("div",Z()({},a,{ref:i,onClick:d,dir:"auto",className:m}),r.a.createElement(pe.a,{label:Object(N.a)("Click to read topic"),alignment:zr.a.Bottom,ignoreHover:e=>"A"===e.target.tagName.toUpperCase()},r.a.createElement(Ao.a,null,l)))}var Go=a(618);const Ko=["room","onlyKnownUsers","numShown"],qo=5,$o=e=>{var t;return!(null===(t=Ya.a.shared().getDMRoomsForUserId(e.userId))||void 0===t||!t.length)};var Yo=e=>{let{room:t,onlyKnownUsers:a=!0,numShown:n=qo}=e,i=ve()(e,Ko);const o=Object(s.useContext)(R.a),l="join"===t.getMyMembership();let c=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:250;const[a,n]=Object(s.useState)(e.getJoinedMembers());return Object(ie.c)(e.currentState,m.b.Update,Object(k.throttle)((()=>{n(e.getJoinedMembers())}),t,{leading:!0,trailing:!0})),a}(t);const d=c.length,u=[e=>e.getMxcAvatarUrl()?0:1];a?c=c.filter($o):u.unshift((e=>$o(e)?0:1));const h=Object(k.sortBy)(c.filter((e=>e.userId!==o.getUserId())),u).slice(0,n);if(h.length<1)return null;const p=h.map((e=>e.name)).reverse().join(", "),g=r.a.createElement("div",null,r.a.createElement("div",{className:"mx_Tooltip_title"},i.onClick?Object(N.a)("View all %(count)s members",{count:d}):Object(N.a)("%(count)s members",{count:d})),r.a.createElement("div",{className:"mx_Tooltip_sub"},l?Object(N.a)("Including you, %(commaSeparatedMembers)s",{commaSeparatedMembers:p}):Object(N.a)("Including %(commaSeparatedMembers)s",{commaSeparatedMembers:p})));return r.a.createElement(Go.a,Z()({members:h,faceSize:28,overflow:c.length>n,tooltip:g},i),a&&r.a.createElement("span",{className:"mx_FacePile_summary"},Object(N.a)("%(count)s people you know have already joined",{count:c.length})))};var Jo=e=>{let{room:t}=e;const a=Object(bn.a)((async()=>{if("invite"!==t.getMyMembership())return null;try{return await t.client.getRoomSummary(t.roomId)}catch(e){return null}}),[t]),n=Object(wn.a)(t,(e=>e.getJoinRule())),i=dn(t),s=cn(t),o=Object(se.a)("feature_element_call_video_rooms");let l,c,d;if(t.isElementVideoRoom()||o&&t.isCallRoom()?(l="mx_RoomInfoLine_video",c=Object(N.a)("Video room")):n===ka.c.Public?(l="mx_RoomInfoLine_public",c=t.isSpaceRoom()?Object(N.a)("Public space"):Object(N.a)("Public room")):(l="mx_RoomInfoLine_private",c=t.isSpaceRoom()?Object(N.a)("Private space"):Object(N.a)("Private room")),"invite"===i&&a)d=r.a.createElement("span",{className:"mx_RoomInfoLine_members"},Object(N.a)("%(count)s members",{count:a.num_joined_members}));else if(s&&void 0!==a){const e=()=>Aa.a.instance.setCard({phase:t.isSpaceRoom()?Ma.a.SpaceMemberList:Ma.a.RoomMemberList});d=r.a.createElement(G.a,{kind:"link",className:"mx_RoomInfoLine_members",onClick:e},Object(N.a)("%(count)s members",{count:s}))}return r.a.createElement("div",{className:`mx_RoomInfoLine ${l}`},c,d)};var Qo=e=>{let{room:t,onJoinButtonClicked:a,onRejectButtonClicked:n}=e;const i=Object(s.useContext)(R.a),o=Object(se.a)("feature_video_rooms"),l=Object(se.a)("feature_element_call_video_rooms"),c=t.isElementVideoRoom()||l&&t.isCallRoom(),d=dn(t);Object(ne.a)(v.a,(e=>{e.action===U.a.JoinRoomError&&e.roomId===t.roomId&&u(!1)}));const[m,u]=Object(s.useState)(!1),h=Object(wn.a)(t,(e=>e.getJoinRule())),p=Object(Vo.b)(d)===Vo.a.Leave&&h!==ka.c.Public,g=()=>v.a.dispatch({action:U.a.ViewUserSettings,initialTabId:Ae.a.Labs});let b,f,y=null;if("join"===d)b=r.a.createElement(G.a,{kind:"danger_outline",onClick:()=>{v.a.dispatch({action:"leave_room",room_id:t.roomId})}},Object(N.a)("Leave"));else if("invite"===d){var E,_;const e=null===(E=t.getMember(i.getUserId()))||void 0===E||null===(_=E.events.member)||void 0===_?void 0:_.getSender();if(e){const a=t.getMember(e);y=r.a.createElement("div",{className:"mx_RoomPreviewCard_inviter"},r.a.createElement(yn.b,{member:a,fallbackUserId:e,width:32,height:32}),r.a.createElement("div",null,r.a.createElement("div",{className:"mx_RoomPreviewCard_inviter_name"},Object(N.a)("<inviter/> invites you",{},{inviter:()=>r.a.createElement("b",null,(null==a?void 0:a.name)||e)})),a?r.a.createElement("div",{className:"mx_RoomPreviewCard_inviter_mxid"},e):null))}b=r.a.createElement(r.a.Fragment,null,r.a.createElement(G.a,{kind:"primary_outline",onClick:()=>{u(!0),n()}},Object(N.a)("Reject")),r.a.createElement(G.a,{kind:"primary",onClick:()=>{u(!0),a()}},Object(N.a)("Accept")))}else b=r.a.createElement(G.a,{kind:"primary",onClick:()=>{a(),i.isGuest()||u(!0)},disabled:p},Object(N.a)("Join"));m&&(b=r.a.createElement(he.a,null)),f=c?r.a.createElement(r.a.Fragment,null,r.a.createElement(ye.a,{room:t,height:50,width:50,viewAvatarOnClick:!0}),r.a.createElement("div",{className:"mx_RoomPreviewCard_video"}),r.a.createElement(de.a,{onClick:g,tooltipTitle:Object(N.a)("Video rooms are a beta feature")})):t.isSpaceRoom()?r.a.createElement(ye.a,{room:t,height:80,width:80,viewAvatarOnClick:!0}):r.a.createElement(ye.a,{room:t,height:50,width:50,viewAvatarOnClick:!0});let S=null;return p?S=Object(N.a)("To view %(roomName)s, you need an invite",{roomName:t.name}):c&&!o&&(S="join"===d?Object(N.a)("To view, please enable video rooms in Labs first"):Object(N.a)("To join, please enable video rooms in Labs first"),b=r.a.createElement(G.a,{kind:"primary",onClick:g},Object(N.a)("Show Labs settings"))),r.a.createElement("div",{className:"mx_RoomPreviewCard"},y,r.a.createElement("div",{className:"mx_RoomPreviewCard_avatar"},f),r.a.createElement("h1",{className:"mx_RoomPreviewCard_name"},r.a.createElement(In.a,{room:t})),r.a.createElement(Jo,{room:t}),r.a.createElement(zo,{room:t,className:"mx_RoomPreviewCard_topic"}),"public"===t.getJoinRule()&&r.a.createElement(Yo,{room:t}),S?r.a.createElement("div",{className:"mx_RoomPreviewCard_notice"},S):null,r.a.createElement("div",{className:"mx_RoomPreviewCard_joinButtons"},b))};let Xo;!function(e){e.Room="Room",e.All="All"}(Xo||(Xo={}));class Zo extends r.a.Component{constructor(e){super(e),i()(this,"searchTerm",Object(s.createRef)()),i()(this,"onThisRoomClick",(()=>{this.setState({scope:Xo.Room},(()=>this.searchIfQuery()))})),i()(this,"onAllRoomsClick",(()=>{this.setState({scope:Xo.All},(()=>this.searchIfQuery()))})),i()(this,"onSearchChange",(e=>{switch(Object(J.a)().getAccessibilityAction(e)){case W.h.Enter:this.onSearch();break;case W.h.Escape:this.props.onCancelClick()}})),i()(this,"onSearch",(()=>{this.searchTerm.current.value.trim()&&this.props.onSearch(this.searchTerm.current.value,this.state.scope)})),this.state={scope:Xo.Room}}searchIfQuery(){this.searchTerm.current.value&&this.onSearch()}render(){const e=c()("mx_SearchBar_searchButton",{mx_SearchBar_searching:this.props.searchInProgress}),t=c()("mx_SearchBar_button",{mx_SearchBar_unselected:this.state.scope!==Xo.Room}),a=c()("mx_SearchBar_button",{mx_SearchBar_unselected:this.state.scope!==Xo.All});return r.a.createElement(r.a.Fragment,null,r.a.createElement(re.a,{screenName:"RoomSearch"}),r.a.createElement("div",{className:"mx_SearchBar"},r.a.createElement("div",{className:"mx_SearchBar_buttons",role:"radiogroup"},r.a.createElement(G.a,{className:t,onClick:this.onThisRoomClick,"aria-checked":this.state.scope===Xo.Room,role:"radio"},Object(N.a)("This Room")),r.a.createElement(G.a,{className:a,onClick:this.onAllRoomsClick,"aria-checked":this.state.scope===Xo.All,role:"radio"},Object(N.a)("All Rooms"))),r.a.createElement("div",{className:"mx_SearchBar_input mx_textinput"},r.a.createElement("input",{ref:this.searchTerm,type:"text",autoFocus:!0,placeholder:Object(N.a)("Search…"),onKeyDown:this.onSearchChange}),r.a.createElement(G.a,{className:e,onClick:this.onSearch})),r.a.createElement(G.a,{className:"mx_SearchBar_cancel",onClick:this.props.onCancelClick})),r.a.createElement(tr,{isRoomEncrypted:this.props.isRoomEncrypted,kind:er.Search}))}}var el=a(861);class tl extends r.a.PureComponent{constructor(e,t){super(e,t),i()(this,"context",void 0),i()(this,"onStateEvents",(e=>{if(!this.props.room||e.getRoomId()!==this.props.room.roomId)return;if("m.room.tombstone"!==e.getType())return;const t=this.props.room.currentState.getStateEvents("m.room.tombstone","");this.setState({upgraded:t&&t.getContent().replacement_room})})),i()(this,"onUpgradeClick",(()=>{H.b.createDialog(el.a,{room:this.props.room})}));const a=this.props.room.currentState.getStateEvents("m.room.tombstone","");this.state={upgraded:null==a?void 0:a.getContent().replacement_room}}componentDidMount(){this.context.on(m.b.Events,this.onStateEvents)}componentWillUnmount(){this.context.removeListener(m.b.Events,this.onStateEvents)}render(){let e=r.a.createElement("div",null,r.a.createElement("div",{className:"mx_RoomUpgradeWarningBar_body"},r.a.createElement("p",null,Object(N.a)("Upgrading this room will shut down the current instance of the room and create an upgraded room with the same name.")),r.a.createElement("p",null,Object(N.a)("<b>Warning</b>: upgrading a room will <i>not automatically migrate room members to the new version of the room.</i> We'll post a link to the new room in the old version of the room - room members will have to click this link to join the new room.",{},{b:e=>r.a.createElement("b",null,e),i:e=>r.a.createElement("i",null,e)}))),r.a.createElement("p",{className:"mx_RoomUpgradeWarningBar_upgradelink"},r.a.createElement(G.a,{onClick:this.onUpgradeClick},Object(N.a)("Upgrade this room to the recommended room version"))));return this.state.upgraded&&(e=r.a.createElement("div",{className:"mx_RoomUpgradeWarningBar_body"},r.a.createElement("p",null,Object(N.a)("This room has already been upgraded.")))),r.a.createElement("div",{className:"mx_RoomUpgradeWarningBar"},r.a.createElement("div",{className:"mx_RoomUpgradeWarningBar_wrapped"},r.a.createElement("div",{className:"mx_RoomUpgradeWarningBar_header"},Object(N.a)("This room is running room version <roomVersion />, which this homeserver has marked as <i>unstable</i>.",{},{roomVersion:()=>r.a.createElement("code",null,this.props.room.getVersion()),i:e=>r.a.createElement("i",null,e)})),e,r.a.createElement("div",{className:"mx_RoomUpgradeWarningBar_small"},Object(N.a)("Only room administrators will see this warning"))))}}i()(tl,"contextType",R.a);var al=a(396),nl=a(470);const il=e=>{let{failures:t}=e;const a=Object(s.useContext)(R.a),[n,i]=Object(s.useState)(!0);Object(s.useEffect)((()=>{const e=setTimeout((()=>i(!1)),5e3);return()=>clearTimeout(e)}),[]);const[o,l]=Object(s.useState)(!1),[c,d]=Object(s.useState)(!1),[m,u]=Object(s.useState)(!1),[h,p]=Object(s.useState)(new Set),[g,b]=Object(s.useState)(!0);Object(s.useEffect)((()=>{b(t.some((e=>{const t=e.getWireContent().session_id;return t&&!h.has(t)})))}),[t,h,b]);const f=Object(s.useCallback)((()=>{const e=new Set(h);for(const n of t){const t=n.getWireContent().session_id;t&&!e.has(t)&&(e.add(t),a.cancelAndResendEventRoomKeyRequest(n))}p(e)}),[a,h,p,t]),y=Object(s.useCallback)((async()=>{const e=a.getDeviceId();let t=!0;try{t=a.checkIfOwnDeviceCrossSigned(e)}catch(e){console.error("Error getting device cross-signing info",e)}l(!t);let n=!1;try{n=a.getStoredDevicesForUser(a.getUserId()).some((t=>t.deviceId!==e&&a.checkIfOwnDeviceCrossSigned(t.deviceId)))}catch(e){console.error("Error getting info about other devices",e)}d(n);let i=!1;try{const e=await a.isSecretStored("m.cross_signing.master");i=null!==e&&Object.keys(e).length>0}catch(e){console.error("Error getting info about key backups",e)}u(i)}),[a]);Object(s.useEffect)((()=>(y().catch(console.error),a.on(Ca.b.DevicesUpdated,y),()=>{a.off(Ca.b.DevicesUpdated,y)})),[a,y]);const E=()=>{H.b.createDialog(al.a)},_=()=>{const e={action:U.a.ViewUserSettings,initialTabId:Ae.a.Security};v.a.dispatch(e)},S=()=>{nl.b.sharedInstance().resetConfirm()},w=n?r.a.createElement(pn.a,null):r.a.createElement("div",{className:"mx_DecryptionFailureBar_icon"});let O,C,x=r.a.createElement(r.a.Fragment,null);n?(O=r.a.createElement(r.a.Fragment,null,Object(N.a)("Decrypting messages…")),C=r.a.createElement(r.a.Fragment,null,Object(N.a)("Please wait as we try to decrypt your messages. This may take a few moments."))):o?c||m?(O=r.a.createElement(r.a.Fragment,null,Object(N.a)("Verify this device to access all messages")),C=r.a.createElement(r.a.Fragment,null,Object(N.a)("This device was unable to decrypt some messages because it has not been verified yet.")),x=r.a.createElement(G.a,{kind:"primary",onClick:E},Object(N.a)("Verify"))):(O=r.a.createElement(r.a.Fragment,null,Object(N.a)("Reset your keys to prevent future decryption errors")),C=r.a.createElement(r.a.Fragment,null,Object(N.a)("You will not be able to access old undecryptable messages, but resetting your keys will allow you to receive new messages.")),x=r.a.createElement(G.a,{kind:"primary",onClick:S},Object(N.a)("Reset"))):c?(O=r.a.createElement(r.a.Fragment,null,Object(N.a)("Open another device to load encrypted messages")),C=r.a.createElement(r.a.Fragment,null,Object(N.a)("This device is requesting decryption keys from your other devices. Opening one of your other devices may speed this up.")),x=r.a.createElement(G.a,{kind:"primary_outline",onClick:_},Object(N.a)("View your device list"))):(O=r.a.createElement(r.a.Fragment,null,Object(N.a)("Some messages could not be decrypted")),C=r.a.createElement(r.a.Fragment,null,Object(N.a)("Unfortunately, there are no other verified devices to request decryption keys from. Signing in and verifying other devices may help avoid this situation in the future.")));let k=r.a.createElement(r.a.Fragment,null);return!o&&c&&g&&(k=r.a.createElement("div",{className:"mx_DecryptionFailureBar_button"},r.a.createElement(G.a,{kind:"primary",onClick:f},Object(N.a)("Resend key requests")))),r.a.createElement("div",{className:"mx_DecryptionFailureBar"},w,r.a.createElement("div",{className:"mx_DecryptionFailureBar_message"},r.a.createElement("div",{className:"mx_DecryptionFailureBar_message_headline"},O),r.a.createElement("div",{className:"mx_DecryptionFailureBar_message_body"},C)),r.a.createElement("div",{className:"mx_DecryptionFailureBar_button"},x),k)};var sl;function rl(e,t){const a=Object(Ai.a)(e.data);a.response=t,e.source.postMessage(a,e.origin)}function ol(e,t,a){ga.a.error("Action:"+e.data.action+" failed with message: "+t);const n=Object(Ai.a)(e.data);n.response={error:{message:t}},a&&(n.response.error._error=a),e.source.postMessage(n,e.origin)}function ll(e,t){const a=e.data.widget_id;let n=e.data.type;const i=e.data.url,s=e.data.name,r=e.data.data,o=e.data.avatar_url,l=e.data.userWidget;if(a&&void 0!==i){if(null!==i){if(void 0!==s&&"string"!=typeof s)return void ol(e,Object(N.a)("Unable to create widget."),new Error("Optional field 'name' must be a string."));if(void 0!==r&&!(r instanceof Object))return void ol(e,Object(N.a)("Unable to create widget."),new Error("Optional field 'data' must be an Object."));if(void 0!==o&&"string"!=typeof o)return void ol(e,Object(N.a)("Unable to create widget."),new Error("Optional field 'avatar_url' must be a string."));if("string"!=typeof n)return void ol(e,Object(N.a)("Unable to create widget."),new Error("Field 'type' must be a string."));if("string"!=typeof i)return void ol(e,Object(N.a)("Unable to create widget."),new Error("Field 'url' must be a string or null."))}if(n=tn.a.fromString(n),l)Wa.a.setUserWidget(a,n,i,s,r).then((()=>{rl(e,{success:!0}),v.a.dispatch({action:"user_widget_updated"})})).catch((t=>{ol(e,Object(N.a)("Unable to create widget."),t)}));else{if(!t)return void ol(e,Object(N.a)("Missing roomId."));Wa.a.setRoomWidget(t,a,n,i,s,r,o).then((()=>{rl(e,{success:!0})}),(t=>{ol(e,Object(N.a)("Failed to send request."),t)}))}}else ol(e,Object(N.a)("Unable to create widget."),new Error("Missing required widget fields."))}function cl(e,t){const a=lt.a.get();if(!a)return void ol(e,Object(N.a)("You need to be logged in."));let n=[];if(t){const i=a.getRoom(t);if(!i)return void ol(e,Object(N.a)("This room is not recognised."));n=Wa.a.getRoomWidgets(i).map((e=>e.event))}const i=Wa.a.getUserWidgetsArray();n=n.concat(i),rl(e,n)}function dl(e,t,a,n){const i=lt.a.get();if(!i)return void ol(e,Object(N.a)("You need to be logged in."));const s=i.getRoom(t);if(!s)return void ol(e,Object(N.a)("This room is not recognised."));const r=s.currentState.getStateEvents(a,n);rl(e,r?r.getContent():null)}!function(e){e.CloseScalar="close_scalar",e.GetWidgets="get_widgets",e.SetWidget="set_widget",e.JoinRulesState="join_rules_state",e.SetPlumbingState="set_plumbing_state",e.GetMembershipCount="get_membership_count",e.GetRoomEncryptionState="get_room_enc_state",e.CanSendEvent="can_send_event",e.MembershipState="membership_state",e.invite="invite",e.Kick="kick",e.BotOptions="bot_options",e.SetBotOptions="set_bot_options",e.SetBotPower="set_bot_power",e.GetOpenIdToken="get_open_id_token",e.SendEvent="send_event",e.ReadEvents="read_events"}(sl||(sl={}));const ml=function(e){let t,a;e.origin||(e.origin=e.originalEvent.origin);try{hl||(hl=Ha.a.sharedInstance().getPrimaryManager().uiUrl),t=new URL(hl)}catch(e){return}try{a=new URL(e.origin)}catch(e){return}if(t.origin!==a.origin||!e.data.action||e.data.api)return;if(e.data.action===sl.CloseScalar)return v.a.dispatch({action:sl.CloseScalar}),void rl(e,null);const n=e.data.room_id,i=e.data.user_id;if(!n)return e.data.action===sl.GetWidgets?void cl(e,null):e.data.action===sl.SetWidget?void ll(e,null):e.data.action===sl.GetOpenIdToken?void async function(e){try{rl(e,await lt.a.get().getOpenIdToken())}catch(t){ga.a.warn("Unable to fetch openId token.",t),ol(e,"Unable to fetch openId token.")}}(e):void ol(e,Object(N.a)("Missing room_id in request"));if(n===rt.b.instance.roomViewStore.getRoomId())if(e.data.action!==sl.GetWidgets)if(e.data.action!==sl.SetWidget)if(e.data.action!==sl.JoinRulesState)if(e.data.action!==sl.SetPlumbingState)if(e.data.action!==sl.GetMembershipCount)if(e.data.action!==sl.GetRoomEncryptionState)if(e.data.action!==sl.CanSendEvent)if(e.data.action!==sl.SendEvent)if(e.data.action!==sl.ReadEvents)if(i)switch(e.data.action){case sl.MembershipState:!function(e,t,a){ga.a.log(`membership_state of ${a} in room ${t} requested.`),dl(e,t,"m.room.member",a)}(e,n,i);break;case sl.invite:!function(e,t,a){ga.a.log(`Received request to invite ${a} into room ${t}`);const n=lt.a.get();if(!n)return void ol(e,Object(N.a)("You need to be logged in."));const i=n.getRoom(t);if(i){const t=i.getMember(a);if(t&&["join","invite"].includes(t.membership))return void rl(e,{success:!0})}n.invite(t,a).then((function(){rl(e,{success:!0})}),(function(t){ol(e,Object(N.a)("You need to be able to invite users to do that."),t)}))}(e,n,i);break;case sl.Kick:!function(e,t,a){ga.a.log(`Received request to kick ${a} from room ${t}`);const n=lt.a.get();if(!n)return void ol(e,Object(N.a)("You need to be logged in."));const i=n.getRoom(t);if(i){const t=i.getMember(a);if(!t||Object(Vo.b)(t.membership)===Vo.a.Leave)return void rl(e,{success:!0})}const s=e.data.reason;n.kick(t,a,s).then((()=>{rl(e,{success:!0})})).catch((t=>{ol(e,Object(N.a)("You need to be able to kick users to do that."),t)}))}(e,n,i);break;case sl.BotOptions:!function(e,t,a){ga.a.log(`bot_options of ${a} in room ${t} requested.`),dl(e,t,"m.room.bot.options","_"+a)}(e,n,i);break;case sl.SetBotOptions:!function(e,t,a){ga.a.log(`Received request to set options for bot ${a} in room ${t}`);const n=lt.a.get();n?n.sendStateEvent(t,"m.room.bot.options",e.data.content,"_"+a).then((()=>{rl(e,{success:!0})}),(t=>{ol(e,t.message?t.message:Object(N.a)("Failed to send request."),t)})):ol(e,Object(N.a)("You need to be logged in."))}(e,n,i);break;case sl.SetBotPower:!async function(e,t,a,n,i){if(!(Number.isInteger(n)&&n>=0))return void ol(e,Object(N.a)("Power level must be positive integer."));ga.a.log(`Received request to set power level to ${n} for bot ${a} in room ${t}.`);const s=lt.a.get();if(s)try{const c=await s.getStateEvent(t,"m.room.power_levels","");var r,o,l;if(!0===i)if((null!==(r=null!==(o=null===(l=c.users)||void 0===l?void 0:l[a])&&void 0!==o?o:c.users_default)&&void 0!==r?r:0)>=n)return rl(e,{success:!0});await s.setPowerLevel(t,a,n,new Oa.b({type:"m.room.power_levels",content:c})),rl(e,{success:!0})}catch(t){ol(e,t.message?t.message:Object(N.a)("Failed to send request."),t)}else ol(e,Object(N.a)("You need to be logged in."))}(e,n,i,e.data.level,e.data.ignoreIfGreater);break;default:ga.a.warn("Unhandled postMessage event with action '"+e.data.action+"'")}else ol(e,Object(N.a)("Missing user_id in request"));else!async function(e,t){const a=e.data.type,n=e.data.state_key,i=e.data.limit;if("string"!=typeof a)return void ol(e,Object(N.a)("Failed to read events"),new Error("Invalid 'type' in request"));if(!["m.room.power_levels","m.room.encryption","m.room.member","m.room.name","m.widgets","im.vector.modular.widgets","io.element.integrations.installations"].includes(a))return void ol(e,Object(N.a)("Failed to read events"),new Error("Disallowed 'type' in request"));let s;if(void 0!==i){if("number"!=typeof i||i<0)return void ol(e,Object(N.a)("Failed to read events"),new Error("Invalid 'limit' in request"));s=Math.min(i,Number.MAX_SAFE_INTEGER)}else s=Number.MAX_SAFE_INTEGER;const r=lt.a.get();if(!r)return void ol(e,Object(N.a)("You need to be logged in."));const o=r.getRoom(t);if(o){if(void 0!==n){if("string"!=typeof n&&!0!==n)return void ol(e,Object(N.a)("Failed to read events"),new Error("Invalid 'state_key' in request"));const t=!0===n?void 0:n;let i=[];return i=i.concat(o.currentState.getStateEvents(a,t)||[]),i=i.slice(0,s),void rl(e,{events:i.map((e=>e.getEffectiveEvent()))})}ol(e,Object(N.a)("Failed to read events"),new Error("Reading message events is not implemented"))}else ol(e,Object(N.a)("This room is not recognised."))}(e,n);else!async function(e,t){const a=e.data.type,n=e.data.state_key,i=e.data.content;if("string"!=typeof a)return void ol(e,Object(N.a)("Failed to send event"),new Error("Invalid 'type' in request"));if(!["m.widgets","im.vector.modular.widgets","io.element.integrations.installations"].includes(a))return void ol(e,Object(N.a)("Failed to send event"),new Error("Disallowed 'type' in request"));if(!i||"object"!=typeof i)return void ol(e,Object(N.a)("Failed to send event"),new Error("Invalid 'content' in request"));const s=lt.a.get();if(!s)return void ol(e,Object(N.a)("You need to be logged in."));if(s.getRoom(t))if(void 0!==n)try{rl(e,{room_id:t,event_id:(await s.sendStateEvent(t,a,i,n)).event_id})}catch(t){return void ol(e,Object(N.a)("Failed to send event"),t)}else ol(e,Object(N.a)("Failed to send event"),new Error("Sending message events is not implemented"));else ol(e,Object(N.a)("This room is not recognised."))}(e,n);else!function(e,t){const a=""+e.data.event_type,n=Boolean(e.data.is_state),i=lt.a.get();if(!i)return void ol(e,Object(N.a)("You need to be logged in."));const s=i.getRoom(t);if(!s)return void ol(e,Object(N.a)("This room is not recognised."));if("join"!==s.getMyMembership())return void ol(e,Object(N.a)("You are not in this room."));const r=i.credentials.userId;let o=!1;o=n?s.currentState.maySendStateEvent(a,r):s.currentState.maySendEvent(a,r),o?rl(e,!0):ol(e,Object(N.a)("You do not have permission to do that in this room."))}(e,n);else!function(e,t){const a=lt.a.get();if(!a)return void ol(e,Object(N.a)("You need to be logged in."));if(!a.getRoom(t))return void ol(e,Object(N.a)("This room is not recognised."));rl(e,lt.a.get().isRoomEncrypted(t))}(e,n);else!function(e,t){const a=lt.a.get();if(!a)return void ol(e,Object(N.a)("You need to be logged in."));const n=a.getRoom(t);if(!n)return void ol(e,Object(N.a)("This room is not recognised."));rl(e,n.getJoinedMemberCount())}(e,n);else!function(e,t,a){if("string"!=typeof a)throw new Error("Plumbing state status should be a string");ga.a.log(`Received request to set plumbing state to status "${a}" in room ${t}`);const n=lt.a.get();n?n.sendStateEvent(t,"m.room.plumbing",{status:a}).then((()=>{rl(e,{success:!0})}),(t=>{ol(e,t.message?t.message:Object(N.a)("Failed to send request."),t)})):ol(e,Object(N.a)("You need to be logged in."))}(e,n,e.data.status);else!function(e,t){ga.a.log(`join_rules of ${t} requested.`),dl(e,t,"m.room.join_rules","")}(e,n);else ll(e,n);else cl(e,n);else ol(e,Object(N.a)("Room %(roomId)s not visible",{roomId:n}))};let ul=0,hl=null;var pl=a(292);class gl extends r.a.Component{constructor(e){super(e),i()(this,"unmounted",!1),i()(this,"resizeContainer",void 0),i()(this,"resizer",void 0),i()(this,"dispatcherRef",void 0),i()(this,"onIsResizing",(e=>{this.setState({resizingVertical:e}),e||this.relaxResizer()})),i()(this,"collectResizer",(e=>{this.resizeContainer&&this.resizer.detach(),e&&(this.resizer.container=e,this.resizer.attach()),this.resizeContainer=e,this.loadResizerPreferences()})),i()(this,"getAppsHash",(e=>e.map((e=>e.id)).join("~"))),i()(this,"relaxResizer",(()=>{const e=this.resizer.getDistributors();e.forEach((e=>e.start())),e.forEach((e=>e.finish()))})),i()(this,"loadResizerPreferences",(()=>{const e=an.d.instance.getResizerDistributions(this.props.room,an.a.Top);if(this.state.apps&&this.topApps().length-1===e.length)e.forEach(((e,t)=>{const a=this.resizer.forHandleAt(t);a&&(a.size=e,a.finish())}));else if(this.state.apps){const e=this.resizer.getDistributors();e.forEach((e=>e.item.clearSize())),e.forEach((e=>e.start())),e.forEach((e=>e.finish()))}})),i()(this,"onAction",(e=>{const t=this.props.room.roomId+"_hide_widget_drawer";if("appsDrawer"===e.action)e.show?localStorage.setItem(t,"false"):localStorage.setItem(t,"true")})),i()(this,"getApps",(()=>{const e={};return e[an.a.Top]=an.d.instance.getContainerWidgets(this.props.room,an.a.Top),e[an.a.Center]=an.d.instance.getContainerWidgets(this.props.room,an.a.Center),e})),i()(this,"topApps",(()=>this.state.apps[an.a.Top])),i()(this,"centerApps",(()=>this.state.apps[an.a.Center])),i()(this,"updateApps",(()=>{this.unmounted||this.setState({apps:this.getApps()})})),this.state={apps:this.getApps(),resizingVertical:!1,resizingHorizontal:!1,resizing:!1},this.resizer=this.createResizer(),this.props.resizeNotifier.on("isResizing",this.onIsResizing)}componentDidMount(){0===ul&&window.addEventListener("message",ml,!1),ul+=1,an.d.instance.on(an.d.emissionForRoom(this.props.room),this.updateApps),this.dispatcherRef=v.a.register(this.onAction)}componentWillUnmount(){this.unmounted=!0,function(){if(ul-=1,0===ul&&window.removeEventListener("message",ml),ul<0){const e=new Error("ScalarMessaging: mismatched startListening / stopListening detected. Negative count");ga.a.error(e)}}(),an.d.instance.off(an.d.emissionForRoom(this.props.room),this.updateApps),this.dispatcherRef&&v.a.unregister(this.dispatcherRef),this.resizeContainer&&this.resizer.detach(),this.props.resizeNotifier.off("isResizing",this.onIsResizing)}createResizer(){const e=new j(null,O,{onResizeStart:()=>{this.resizeContainer.classList.add("mx_AppsDrawer_resizing"),this.setState({resizingHorizontal:!0})},onResizeStop:()=>{this.resizeContainer.classList.remove("mx_AppsDrawer_resizing"),an.d.instance.setResizerDistributions(this.props.room,an.a.Top,this.topApps().slice(1).map(((e,t)=>this.resizer.forHandleAt(t).size))),this.setState({resizingHorizontal:!1})}});return e.setClassNames({handle:"mx_ResizeHandle",vertical:"mx_ResizeHandle_vertical",reverse:"mx_ResizeHandle_reverse"}),e}componentDidUpdate(e,t){e.userId!==this.props.userId||e.room!==this.props.room?this.updateApps():this.getAppsHash(this.topApps())!==this.getAppsHash(t.apps[an.a.Top])&&this.loadResizerPreferences()}isResizing(){return this.state.resizingVertical||this.state.resizingHorizontal}render(){if(!this.props.showApps)return r.a.createElement("div",null);const e=this.centerApps().length>0,t=(e?this.centerApps():this.topApps()).map(((e,t,a)=>r.a.createElement(cs,{key:e.id,app:e,fullWidth:a.length<2,room:this.props.room,userId:this.props.userId,creatorUserId:e.creatorUserId,widgetPageTitle:Wa.a.getWidgetDataTitle(e),waitForIframeLoad:e.waitForIframeLoad,pointerEvents:this.isResizing()?"none":void 0})));if(0===t.length)return r.a.createElement("div",null);let a;0===t.length&&To.a.roomHasPendingWidgets(this.props.room.roomId,Wa.a.getRoomWidgets(this.props.room))&&(a=r.a.createElement(pn.a,null));const n=c()({mx_AppsDrawer:!0,mx_AppsDrawer_maximise:e,mx_AppsDrawer_fullWidth:t.length<2,mx_AppsDrawer_resizing:this.state.resizing,mx_AppsDrawer_2apps:2===t.length,mx_AppsDrawer_3apps:3===t.length}),i=r.a.createElement("div",{className:"mx_AppsContainer",ref:this.collectResizer},t.map(((e,a)=>a<1?e:r.a.createElement(r.a.Fragment,{key:e.key},r.a.createElement(y,{reverse:a>t.length/2}),e))));let s;return s=e?i:r.a.createElement(vl,{room:this.props.room,minHeight:100,maxHeight:this.props.maxHeight-50,handleClass:"mx_AppsContainer_resizerHandle",handleWrapperClass:"mx_AppsContainer_resizerHandleContainer",className:"mx_AppsContainer_resizer",resizeNotifier:this.props.resizeNotifier},i),r.a.createElement("div",{className:n},s,a)}}i()(gl,"defaultProps",{showApps:!0});const vl=e=>{let{room:t,minHeight:a,maxHeight:n,className:i,handleWrapperClass:s,handleClass:o,resizeNotifier:l,children:c}=e,d=an.d.instance.getContainerHeight(t,an.a.Top);return a||(a=100),n||(n=Q.b.instance.windowHeight/4*3),d?(d=Object(pl.a)(d,0,100),d=Object(pl.d)(d/100,a,n)):d=280,r.a.createElement(Na.Resizable,{size:{height:Math.min(d,n),width:void 0},minHeight:a,maxHeight:n,onResizeStart:()=>{l.startResizing()},onResize:()=>{l.notifyTimelineHeightChanged()},onResizeStop:(e,i,s,r)=>{let o=d+r.height;o=100*Object(pl.c)(o,a,n),an.d.instance.setContainerHeight(t,an.a.Top,o),l.stopResizing()},handleWrapperClass:s,handleClasses:{bottom:o},className:i,enable:{bottom:!0}},c)};var bl=a(354);class fl extends r.a.PureComponent{constructor(e){super(e),i()(this,"element",void 0),i()(this,"setElementRef",(e=>{var t;e?(this.element=e,e.addEventListener("resize",this.onResize)):null===(t=this.element)||void 0===t||t.removeEventListener("resize",this.onResize)})),i()(this,"onNewStream",(()=>{this.setState({audioMuted:this.props.feed.isAudioMuted(),videoMuted:this.props.feed.isVideoMuted()}),this.playMedia()})),i()(this,"onMuteStateChanged",(()=>{this.setState({audioMuted:this.props.feed.isAudioMuted(),videoMuted:this.props.feed.isVideoMuted()})})),i()(this,"onResize",(e=>{this.props.onResize&&!this.props.feed.isLocal()&&this.props.onResize(e)})),this.state={audioMuted:this.props.feed.isAudioMuted(),videoMuted:this.props.feed.isVideoMuted()}}componentDidMount(){this.updateFeed(null,this.props.feed),this.playMedia()}componentWillUnmount(){this.updateFeed(this.props.feed,null)}componentDidUpdate(e,t){this.updateFeed(e.feed,this.props.feed),t.videoMuted===this.state.videoMuted&&e.feed.stream===this.props.feed.stream||this.playMedia()}static getDerivedStateFromProps(e){return{audioMuted:e.feed.isAudioMuted(),videoMuted:e.feed.isVideoMuted()}}updateFeed(e,t){e!==t&&(e&&(this.props.feed.removeListener(_a.b.NewStream,this.onNewStream),this.props.feed.removeListener(_a.b.MuteStateChanged,this.onMuteStateChanged),this.props.feed.purpose===bl.b.Usermedia&&this.props.feed.measureVolumeActivity(!1),this.stopMedia()),t&&(this.props.feed.addListener(_a.b.NewStream,this.onNewStream),this.props.feed.addListener(_a.b.MuteStateChanged,this.onMuteStateChanged),this.props.feed.purpose===bl.b.Usermedia&&this.props.feed.measureVolumeActivity(!0),this.playMedia()))}async playMedia(){const e=this.element;if(e){e.muted=!0,e.srcObject=this.props.feed.stream,e.autoplay=!0;try{await e.play()}catch(e){ga.a.info(`Failed to play media element with feed for userId ${this.props.feed.userId} with purpose ${this.props.feed.purpose}`,e)}}}stopMedia(){const e=this.element;e&&(e.pause(),e.src=null)}render(){const{pipMode:e,primary:t,secondary:a,feed:n}=this.props,i=c()("mx_VideoFeed",{mx_VideoFeed_primary:t,mx_VideoFeed_secondary:a,mx_VideoFeed_voice:this.state.videoMuted}),s=c()("mx_VideoFeed_mic",{mx_VideoFeed_mic_muted:this.state.audioMuted,mx_VideoFeed_mic_unmuted:!this.state.audioMuted});let o,l;if(n.purpose===bl.b.Screenshare||t||e||(o=r.a.createElement("div",{className:s})),this.state.videoMuted){const a=this.props.feed.getMember();let n;e&&t?n=76:e&&!t?n=16:!e&&t&&(n=160),l=r.a.createElement(yn.b,{member:a,height:n,width:n})}else{const e=c()("mx_VideoFeed_video",{mx_VideoFeed_video_mirror:this.props.feed.isLocal()&&this.props.feed.purpose===bl.b.Usermedia&&b.b.getValue("VideoView.flipVideoHorizontally")});l=r.a.createElement("video",{className:e,ref:this.setElementRef})}return r.a.createElement("div",{className:i},o,l)}}var yl=a(260),El=a(811);class _l extends r.a.Component{render(){const e=this.props.feeds.map((e=>r.a.createElement(fl,{key:e.stream.id,feed:e,call:this.props.call,primary:!1,pipMode:this.props.pipMode}))),t=c()("mx_LegacyCallViewSidebar",{mx_LegacyCallViewSidebar_pipMode:this.props.pipMode});return r.a.createElement("div",{className:t},e)}}const Sl=e=>{let{onExpand:t,onPin:a,onMaximize:n}=e;return r.a.createElement("div",{className:"mx_LegacyCallViewHeader_controls"},n&&r.a.createElement(q.a,{className:"mx_LegacyCallViewHeader_button mx_LegacyCallViewHeader_button_fullscreen",onClick:n,title:Object(N.a)("Fill screen")}),a&&r.a.createElement(q.a,{className:"mx_LegacyCallViewHeader_button mx_LegacyCallViewHeader_button_pin",onClick:a,title:Object(N.a)("Pin")}),t&&r.a.createElement(q.a,{className:"mx_LegacyCallViewHeader_button mx_LegacyCallViewHeader_button_expand",onClick:t,title:Object(N.a)("Return to call")}))},wl=e=>{let{callRoom:t}=e;return r.a.createElement("span",{className:"mx_LegacyCallViewHeader_secondaryCallInfo"},r.a.createElement(ye.a,{room:t,height:16,width:16}),r.a.createElement("span",{className:"mx_LegacyCallView_secondaryCall_roomName"},Object(N.a)("%(name)s on hold",{name:t.name})))};var Ol=e=>{let{pipMode:t=!1,callRooms:a,onPipMouseDown:n,onExpand:i,onPin:s,onMaximize:o}=e;const[l,c]=a,d=l.name;return t?r.a.createElement("div",{className:"mx_LegacyCallViewHeader mx_LegacyCallViewHeader_pip",onMouseDown:n},r.a.createElement(ye.a,{room:l,height:32,width:32}),r.a.createElement("div",{className:"mx_LegacyCallViewHeader_callInfo"},r.a.createElement("div",{className:"mx_LegacyCallViewHeader_roomName"},d),c&&r.a.createElement(wl,{callRoom:c})),r.a.createElement(Sl,{onExpand:i,onPin:s,onMaximize:o})):r.a.createElement("div",{className:"mx_LegacyCallViewHeader"},r.a.createElement("div",{className:"mx_LegacyCallViewHeader_icon"}),r.a.createElement("span",{className:"mx_LegacyCallViewHeader_text"},Object(N.a)("Call")),r.a.createElement(Sl,{onMaximize:o}))};class Cl extends r.a.Component{constructor(e){super(e),i()(this,"onHoldClick",(()=>{this.props.call.setRemoteOnHold(!0),this.props.onFinished()})),i()(this,"onUnholdClick",(()=>{B.b.instance.setActiveCallRoomId(this.props.call.roomId),this.props.onFinished()})),i()(this,"onTransferClick",(()=>{B.b.instance.showTransferDialog(this.props.call),this.props.onFinished()}))}render(){const e=this.props.call.isRemoteOnHold()?Object(N.a)("Resume"):Object(N.a)("Hold"),t=this.props.call.isRemoteOnHold()?this.onUnholdClick:this.onHoldClick;let a;return this.props.call.opponentCanBeTransferred()&&(a=r.a.createElement(ce.d,{className:"mx_LegacyCallContextMenu_item",onClick:this.onTransferClick},Object(N.a)("Transfer"))),r.a.createElement(ce.n,this.props,r.a.createElement(ce.d,{className:"mx_LegacyCallContextMenu_item",onClick:t},e),a)}}var xl=a(620);class kl extends s.Component{constructor(e){super(e),i()(this,"numberEntryFieldRef",Object(s.createRef)()),i()(this,"onDigitPress",((e,t)=>{var a;(this.props.call.sendDtmfDigit(e),this.setState({value:this.state.value+e}),"click"===t.type)&&(null===(a=this.numberEntryFieldRef.current)||void 0===a||a.focus())})),i()(this,"onCancelClick",(()=>{this.props.onFinished()})),i()(this,"onKeyDown",(e=>{"Backspace"!==e.code&&"Delete"!==e.code||e.preventDefault()})),i()(this,"onChange",(e=>{this.setState({value:e.target.value})})),this.state={value:""}}render(){return s.createElement(ce.n,this.props,s.createElement("div",{className:"mx_DialPadContextMenuWrapper"},s.createElement("div",null,s.createElement(G.a,{className:"mx_DialPadContextMenu_cancel",onClick:this.onCancelClick})),s.createElement("div",{className:"mx_DialPadContextMenu_header"},s.createElement(Dn.a,{ref:this.numberEntryFieldRef,className:"mx_DialPadContextMenu_dialled",value:this.state.value,autoFocus:!0,onKeyDown:this.onKeyDown,onChange:this.onChange})),s.createElement("div",{className:"mx_DialPadContextMenu_dialPad"},s.createElement(xl.a,{onDigitPress:this.onDigitPress,hasDial:!1}))))}}const jl=["deviceKinds"],Rl={[p.b.AudioInput]:Object(N.c)("Input devices"),[p.b.AudioOutput]:Object(N.c)("Output devices"),[p.b.VideoInput]:Object(N.c)("Cameras")},Il=e=>{let{label:t,selected:a,onClick:n}=e;return r.a.createElement(me.d,{iconClassName:"mx_DeviceContextMenu_device_icon",label:t,active:a,onClick:n})},Tl=e=>{let{deviceKind:t}=e;const[a,n]=Object(s.useState)([]),[i,o]=Object(s.useState)(p.c.getDevice(t));Object(s.useEffect)((()=>{(async()=>{n((await p.c.getDevices())[t])})()}),[t]);return r.a.createElement(me.c,{label:Object(N.a)(Rl[t])},a.map((e=>{let{label:a,deviceId:n}=e;return r.a.createElement(Il,{key:n,label:a,selected:i===n,onClick:()=>(e=>{p.c.instance.setDevice(e,t),o(e)})(n)})})))};var Nl=e=>{let{deviceKinds:t}=e,a=ve()(e,jl);return r.a.createElement(me.e,Z()({compact:!0,className:"mx_DeviceContextMenu"},a),t.map((e=>r.a.createElement(Tl,{key:e,deviceKind:e}))))};const Dl=["children","state","className","onLabel","offLabel"],Pl=["state","deviceKinds"],Ml=e=>{let{children:t,state:a,className:n,onLabel:i,offLabel:s}=e,o=ve()(e,Dl);const l=c()("mx_LegacyCallViewButtons_button",n,{mx_LegacyCallViewButtons_button_on:a,mx_LegacyCallViewButtons_button_off:!a});return r.a.createElement(q.a,Z()({className:l,title:a?i:s,alignment:zr.a.Top},o),t)},Al=e=>{let{state:t,deviceKinds:a}=e,n=ve()(e,Pl);const[i,o,l,d]=Object(ce.q)(),[m,u]=Object(s.useState)(!1),h=c()("mx_LegacyCallViewButtons_button","mx_LegacyCallViewButtons_dropdownButton",{mx_LegacyCallViewButtons_dropdownButton_collapsed:!i});return r.a.createElement(Ml,Z()({inputRef:o,forceHide:i||m,state:t},n),r.a.createElement(Ml,{className:h,onClick:e=>{e.stopPropagation(),l()},onHover:e=>u(e),state:t}),i&&o.current&&r.a.createElement(Nl,Z()({},Object(ce.k)(o.current.getBoundingClientRect()),{onFinished:d,deviceKinds:a})))};class Ll extends r.a.Component{constructor(e){super(e),i()(this,"dialpadButton",Object(s.createRef)()),i()(this,"contextMenuButton",Object(s.createRef)()),i()(this,"controlsHideTimer",null),i()(this,"onControlsHideTimer",(()=>{this.state.hoveringControls||this.state.showDialpad||this.state.showMoreMenu||(this.controlsHideTimer=null,this.setState({visible:!1}))})),i()(this,"onMouseEnter",(()=>{this.setState({hoveringControls:!0})})),i()(this,"onMouseLeave",(()=>{this.setState({hoveringControls:!1})})),i()(this,"onDialpadClick",(()=>{this.state.showDialpad?this.setState({showDialpad:!1}):(this.setState({showDialpad:!0}),this.showControls())})),i()(this,"onMoreClick",(()=>{this.setState({showMoreMenu:!0}),this.showControls()})),i()(this,"closeDialpad",(()=>{this.setState({showDialpad:!1})})),i()(this,"closeContextMenu",(()=>{this.setState({showMoreMenu:!1})})),this.state={showDialpad:!1,hoveringControls:!1,showMoreMenu:!1,visible:!0}}componentDidMount(){this.showControls()}showControls(){this.state.showMoreMenu||this.state.showDialpad||(this.state.visible||this.setState({visible:!0}),null!==this.controlsHideTimer&&clearTimeout(this.controlsHideTimer),this.controlsHideTimer=window.setTimeout(this.onControlsHideTimer,2e3))}render(){const e=c()("mx_LegacyCallViewButtons",{mx_LegacyCallViewButtons_hidden:!this.state.visible});let t,a;return this.state.showDialpad&&this.dialpadButton.current&&(t=r.a.createElement(kl,Z()({},Object(ce.l)(this.dialpadButton.current.getBoundingClientRect(),ce.a.None,8),{mountAsChild:!this.props.pipMode,onFinished:this.closeDialpad,call:this.props.call}))),this.state.showMoreMenu&&this.contextMenuButton.current&&(a=r.a.createElement(Cl,Z()({},Object(ce.l)(this.contextMenuButton.current.getBoundingClientRect(),ce.a.None,8),{mountAsChild:!this.props.pipMode,onFinished:this.closeContextMenu,call:this.props.call}))),r.a.createElement("div",{className:e,onMouseEnter:this.onMouseEnter,onMouseLeave:this.onMouseLeave},t,a,this.props.buttonsVisibility.dialpad&&r.a.createElement(ce.c,{className:"mx_LegacyCallViewButtons_button mx_LegacyCallViewButtons_dialpad",inputRef:this.dialpadButton,onClick:this.onDialpadClick,isExpanded:this.state.showDialpad,title:Object(N.a)("Dialpad"),alignment:zr.a.Top}),r.a.createElement(Al,{state:!this.props.buttonsState.micMuted,className:"mx_LegacyCallViewButtons_button_mic",onLabel:Object(N.a)("Mute the microphone"),offLabel:Object(N.a)("Unmute the microphone"),onClick:this.props.handlers.onMicMuteClick,deviceKinds:[p.b.AudioInput,p.b.AudioOutput]}),this.props.buttonsVisibility.vidMute&&r.a.createElement(Al,{state:!this.props.buttonsState.vidMuted,className:"mx_LegacyCallViewButtons_button_vid",onLabel:Object(N.a)("Stop the camera"),offLabel:Object(N.a)("Start the camera"),onClick:this.props.handlers.onVidMuteClick,deviceKinds:[p.b.VideoInput]}),this.props.buttonsVisibility.screensharing&&r.a.createElement(Ml,{state:this.props.buttonsState.screensharing,className:"mx_LegacyCallViewButtons_button_screensharing",onLabel:Object(N.a)("Stop sharing your screen"),offLabel:Object(N.a)("Start sharing your screen"),onClick:this.props.handlers.onScreenshareClick}),this.props.buttonsVisibility.sidebar&&r.a.createElement(Ml,{state:this.props.buttonsState.sidebarShown,className:"mx_LegacyCallViewButtons_button_sidebar",onLabel:Object(N.a)("Hide sidebar"),offLabel:Object(N.a)("Show sidebar"),onClick:this.props.handlers.onToggleSidebarClick}),this.props.buttonsVisibility.contextMenu&&r.a.createElement(ce.c,{className:"mx_LegacyCallViewButtons_button mx_LegacyCallViewButtons_button_more",onClick:this.onMoreClick,inputRef:this.contextMenuButton,isExpanded:this.state.showMoreMenu,title:Object(N.a)("More"),alignment:zr.a.Top}),r.a.createElement(q.a,{className:"mx_LegacyCallViewButtons_button mx_LegacyCallViewButtons_button_hangup",onClick:this.props.handlers.onHangupClick,title:Object(N.a)("Hangup"),alignment:zr.a.Top}))}}function Ul(){return document.fullscreenElement||document.webkitFullscreenElement||document.msFullscreenElement}function Fl(){const e=document.exitFullscreen||document.webkitExitFullscreen||document.msExitFullscreen;e&&e.call(document)}class Bl extends r.a.Component{constructor(e){super(e),i()(this,"dispatcherRef",void 0),i()(this,"contentWrapperRef",Object(s.createRef)()),i()(this,"buttonsRef",Object(s.createRef)()),i()(this,"onAction",(e=>{if("video_fullscreen"===e.action){if(!this.contentWrapperRef.current)return;e.fullscreen?function(e){const t=e.requestFullscreen||e.webkitRequestFullScreen||e.msRequestFullscreen;t&&t.call(e)}(this.contentWrapperRef.current):Ul()&&Fl()}})),i()(this,"onCallState",(e=>{this.setState({callState:e})})),i()(this,"onFeedsChanged",(e=>{const{primary:t,secondary:a,sidebar:n}=Bl.getOrderedFeeds(e);this.setState({primaryFeed:t,secondaryFeed:a,sidebarFeeds:n,micMuted:this.props.call.isMicrophoneMuted(),vidMuted:this.props.call.isLocalVideoMuted()})})),i()(this,"onCallLocalHoldUnhold",(()=>{this.setState({isLocalOnHold:this.props.call.isLocalOnHold()})})),i()(this,"onCallRemoteHoldUnhold",(()=>{this.setState({isRemoteOnHold:this.props.call.isRemoteOnHold(),isLocalOnHold:this.props.call.isLocalOnHold()})})),i()(this,"onMouseMove",(()=>{var e;null===(e=this.buttonsRef.current)||void 0===e||e.showControls()})),i()(this,"onMaximizeClick",(()=>{v.a.dispatch({action:"video_fullscreen",fullscreen:!0})})),i()(this,"onMicMuteClick",(async()=>{const e=!this.state.micMuted;this.setState({micMuted:await this.props.call.setMicrophoneMuted(e)})})),i()(this,"onVidMuteClick",(async()=>{const e=!this.state.vidMuted;this.setState({vidMuted:await this.props.call.setLocalVideoMuted(e)})})),i()(this,"onScreenshareClick",(async()=>{let e;var t;if(this.state.screensharing)e=await this.props.call.setScreensharingEnabled(!1);else if(null!==(t=I.a.get())&&void 0!==t&&t.supportsDesktopCapturer()){const{finished:t}=H.b.createDialog(El.a),[a]=await t;if(!a)return;e=await this.props.call.setScreensharingEnabled(!0,{desktopCapturerSourceId:a})}else e=await this.props.call.setScreensharingEnabled(!0);this.setState({sidebarShown:!0,screensharing:e})})),i()(this,"onNativeKeyDown",(e=>{var t,a;let n=!1;switch(Object(J.a)().getCallAction(e)){case W.h.ToggleMicInCall:this.onMicMuteClick(),null===(t=this.buttonsRef.current)||void 0===t||t.showControls(),n=!0;break;case W.h.ToggleWebcamInCall:this.onVidMuteClick(),null===(a=this.buttonsRef.current)||void 0===a||a.showControls(),n=!0}n&&(e.stopPropagation(),e.preventDefault())})),i()(this,"onCallResumeClick",(()=>{const e=B.b.instance.roomIdForCall(this.props.call);B.b.instance.setActiveCallRoomId(e)})),i()(this,"onTransferClick",(()=>{const e=B.b.instance.getTransfereeForCallId(this.props.call.callId);this.props.call.transferToCall(e)})),i()(this,"onHangupClick",(()=>{B.b.instance.hangupOrReject(B.b.instance.roomIdForCall(this.props.call))})),i()(this,"onToggleSidebar",(()=>{this.setState({sidebarShown:!this.state.sidebarShown})}));const{primary:t,secondary:a,sidebar:n}=Bl.getOrderedFeeds(this.props.call.getFeeds());this.state={isLocalOnHold:this.props.call.isLocalOnHold(),isRemoteOnHold:this.props.call.isRemoteOnHold(),micMuted:this.props.call.isMicrophoneMuted(),vidMuted:this.props.call.isLocalVideoMuted(),screensharing:this.props.call.isScreensharing(),callState:this.props.call.state,primaryFeed:t,secondaryFeed:a,sidebarFeeds:n,sidebarShown:!0},this.updateCallListeners(null,this.props.call)}componentDidMount(){this.dispatcherRef=v.a.register(this.onAction),document.addEventListener("keydown",this.onNativeKeyDown)}componentWillUnmount(){Ul()&&Fl(),document.removeEventListener("keydown",this.onNativeKeyDown),this.updateCallListeners(this.props.call,null),v.a.unregister(this.dispatcherRef)}static getDerivedStateFromProps(e){const{primary:t,secondary:a,sidebar:n}=Bl.getOrderedFeeds(e.call.getFeeds());return{primaryFeed:t,secondaryFeed:a,sidebarFeeds:n}}componentDidUpdate(e){this.props.call!==e.call&&(this.setState({isLocalOnHold:this.props.call.isLocalOnHold(),isRemoteOnHold:this.props.call.isRemoteOnHold(),micMuted:this.props.call.isMicrophoneMuted(),vidMuted:this.props.call.isLocalVideoMuted(),callState:this.props.call.state}),this.updateCallListeners(null,this.props.call))}updateCallListeners(e,t){e!==t&&(e&&(e.removeListener(Ea.d.State,this.onCallState),e.removeListener(Ea.d.LocalHoldUnhold,this.onCallLocalHoldUnhold),e.removeListener(Ea.d.RemoteHoldUnhold,this.onCallRemoteHoldUnhold),e.removeListener(Ea.d.FeedsChanged,this.onFeedsChanged)),t&&(t.on(Ea.d.State,this.onCallState),t.on(Ea.d.LocalHoldUnhold,this.onCallLocalHoldUnhold),t.on(Ea.d.RemoteHoldUnhold,this.onCallRemoteHoldUnhold),t.on(Ea.d.FeedsChanged,this.onFeedsChanged)))}static getOrderedFeeds(e){if(e.length<=2)return{primary:e.find((e=>!e.isLocal())),secondary:e.find((e=>e.isLocal())),sidebar:[]};let t;const a=e.filter((e=>e.purpose===bl.b.Screenshare));t=a.find((e=>!e.isLocal()))||a[0],t||(t=e.find((e=>!e.isLocal())));const n=[...e];return t&&n.splice(n.indexOf(t),1),n.sort(((e,t)=>e.isLocal()&&!t.isLocal()?-1:!e.isLocal()&&t.isLocal()?1:0)),{primary:t,sidebar:n}}renderCallControls(){const{call:e,pipMode:t}=this.props,{callState:a,micMuted:n,vidMuted:i,screensharing:s,sidebarShown:o,secondaryFeed:l,sidebarFeeds:c}=this.state,d=e.opponentSupportsSDPStreamMetadata()||e.hasLocalUserMediaVideoTrack,m=(e.opponentSupportsSDPStreamMetadata()||e.hasLocalUserMediaVideoTrack)&&e.state===Ea.f.Connected,u=l&&!l.isVideoMuted()||c.length>0,h=a===Ea.f.Connected,p=a===Ea.f.Connected&&e.opponentSupportsDTMF();return r.a.createElement(Ll,{ref:this.buttonsRef,call:e,pipMode:t,handlers:{onToggleSidebarClick:this.onToggleSidebar,onScreenshareClick:this.onScreenshareClick,onHangupClick:this.onHangupClick,onMicMuteClick:this.onMicMuteClick,onVidMuteClick:this.onVidMuteClick},buttonsState:{micMuted:n,vidMuted:i,sidebarShown:o,screensharing:s},buttonsVisibility:{vidMute:d,screensharing:m,sidebar:u,contextMenu:h,dialpad:p}})}renderToast(){var e;const{call:t}=this.props;if(!t.getFeeds().some((e=>e.purpose===bl.b.Screenshare)))return null;const a=t.isScreensharing(),{primaryFeed:n,sidebarShown:i}=this.state,s=null==n||null===(e=n.getMember())||void 0===e?void 0:e.name;if(!s)return null;let o=a?Object(N.a)("You are presenting"):Object(N.a)("%(sharerName)s is presenting",{sharerName:s});return i||(o+=" • "+(t.isLocalVideoMuted()?Object(N.a)("Your camera is turned off"):Object(N.a)("Your camera is still enabled"))),r.a.createElement("div",{className:"mx_LegacyCallView_toast"},o)}renderContent(){var e;const{pipMode:t,call:a,onResize:n}=this.props,{isLocalOnHold:i,isRemoteOnHold:s,sidebarShown:o,primaryFeed:l,secondaryFeed:d,sidebarFeeds:m}=this.state,u=null!==(e=lt.a.get().getRoom(a.roomId))&&void 0!==e?e:void 0,h=t?76:160,p=B.b.instance.getTransfereeForCallId(a.callId),g=i||s;let v;if(o&&d&&!d.isVideoMuted()&&(v=r.a.createElement(fl,{feed:d,call:a,pipMode:t,onResize:n,secondary:!0})),p||g){const e=c()("mx_LegacyCallView_content",{mx_LegacyCallView_content_hold:g}),t=Object(yl.a)(a.getOpponentMember(),1024,1024,"crop");let n;if(p){const e=lt.a.get().getRoom(B.b.instance.roomIdForCall(a)),t=e?e.name:Object(N.a)("unknown person"),i=lt.a.get().getRoom(B.b.instance.roomIdForCall(p)),s=i?i.name:Object(N.a)("unknown person");n=r.a.createElement("div",{className:"mx_LegacyCallView_status"},Object(N.a)("Consulting with %(transferTarget)s. <a>Transfer to %(transferee)s</a>",{transferTarget:t,transferee:s},{a:e=>r.a.createElement(G.a,{kind:"link_inline",onClick:this.onTransferClick},e)}))}else{let e;if(s)e=Object(N.a)(B.b.instance.hasAnyUnheldCall()?Object(N.c)("You held the call <a>Switch</a>"):Object(N.c)("You held the call <a>Resume</a>"),{},{a:e=>r.a.createElement(G.a,{kind:"link_inline",onClick:this.onCallResumeClick},e)});else if(i){var b;e=Object(N.a)("%(peerName)s held the call",{peerName:null===(b=a.getOpponentMember())||void 0===b?void 0:b.name})}n=r.a.createElement("div",{className:"mx_LegacyCallView_status"},e)}return r.a.createElement("div",{className:e,onMouseMove:this.onMouseMove},r.a.createElement("div",{className:"mx_LegacyCallView_holdBackground",style:{backgroundImage:"url("+t+")"}}),n)}return a.noIncomingFeeds()?r.a.createElement("div",{className:"mx_LegacyCallView_content",onMouseMove:this.onMouseMove},r.a.createElement("div",{className:"mx_LegacyCallView_avatarsContainer"},r.a.createElement("div",{className:"mx_LegacyCallView_avatarContainer",style:{width:h,height:h}},r.a.createElement(ye.a,{room:u,height:h,width:h}))),r.a.createElement("div",{className:"mx_LegacyCallView_status"},Object(N.a)("Connecting")),v):t?r.a.createElement("div",{className:"mx_LegacyCallView_content",onMouseMove:this.onMouseMove},r.a.createElement(fl,{feed:l,call:a,pipMode:t,onResize:n,primary:!0})):d?r.a.createElement("div",{className:"mx_LegacyCallView_content",onMouseMove:this.onMouseMove},r.a.createElement(fl,{feed:l,call:a,pipMode:t,onResize:n,primary:!0}),v):r.a.createElement("div",{className:"mx_LegacyCallView_content",onMouseMove:this.onMouseMove},r.a.createElement(fl,{feed:l,call:a,pipMode:t,onResize:n,primary:!0}),o&&r.a.createElement(_l,{feeds:m,call:a,pipMode:t}))}render(){const{call:e,secondaryCall:t,pipMode:a,showApps:n,onMouseDownOnHeader:i}=this.props,{sidebarShown:s,sidebarFeeds:o}=this.state,l=lt.a.get(),d=B.b.instance.roomIdForCall(e),m=B.b.instance.roomIdForCall(t),u=d?l.getRoom(d):null,h=m?l.getRoom(m):null,p=c()({mx_LegacyCallView:!0,mx_LegacyCallView_pip:a,mx_LegacyCallView_large:!a,mx_LegacyCallView_sidebar:s&&0!==o.length&&!a,mx_LegacyCallView_belowWidget:n});return r.a.createElement("div",{className:p},r.a.createElement(Ol,{onPipMouseDown:i,pipMode:a,callRooms:[u,h],onMaximize:this.onMaximizeClick}),r.a.createElement("div",{className:"mx_LegacyCallView_content_wrapper",ref:this.contentWrapperRef},this.renderToast(),this.renderContent(),this.renderCallControls()))}}class Vl extends r.a.Component{constructor(e){super(e),i()(this,"updateCall",(()=>{const e=this.getCall();e!==this.state.call&&this.setState({call:e})})),i()(this,"onResizeStart",(()=>{this.props.resizeNotifier.startResizing()})),i()(this,"onResize",(()=>{this.props.resizeNotifier.notifyTimelineHeightChanged()})),i()(this,"onResizeStop",(()=>{this.props.resizeNotifier.stopResizing()})),this.state={call:this.getCall()}}componentDidMount(){B.b.instance.addListener(B.a.CallState,this.updateCall),B.b.instance.addListener(B.a.CallChangeRoom,this.updateCall)}componentWillUnmount(){B.b.instance.removeListener(B.a.CallState,this.updateCall),B.b.instance.removeListener(B.a.CallChangeRoom,this.updateCall)}getCall(){const e=B.b.instance.getCallForRoom(this.props.roomId);return e&&[Ea.f.Ended,Ea.f.Ringing].includes(e.state)?null:e}render(){return this.state.call?r.a.createElement("div",{className:"mx_LegacyCallViewForRoom"},r.a.createElement(Na.Resizable,{minHeight:380,maxHeight:"80vh",enable:{top:!1,right:!1,bottom:!0,left:!1,topRight:!1,bottomRight:!1,bottomLeft:!1,topLeft:!1},onResizeStart:this.onResizeStart,onResize:this.onResize,onResizeStop:this.onResizeStop,className:"mx_LegacyCallViewForRoom_ResizeWrapper",handleClasses:{bottom:"mx_LegacyCallViewForRoom_ResizeHandle"}},r.a.createElement(Bl,{call:this.state.call,pipMode:!1,showApps:this.props.showApps}))):null}}class Wl extends r.a.Component{constructor(e){super(e),i()(this,"onRoomStateEvents",(e=>{"re.jki.counter"===e.getType()&&this.updateCounters()})),i()(this,"updateCounters",Object(k.throttle)((()=>{this.setState({counters:this.computeCounters()})}),500,{leading:!0,trailing:!0})),this.state={counters:this.computeCounters()}}componentDidMount(){const e=lt.a.get();b.b.getValue("feature_state_counters")&&e.on(m.b.Events,this.onRoomStateEvents)}componentWillUnmount(){var e;b.b.getValue("feature_state_counters")&&(null===(e=lt.a.get())||void 0===e||e.removeListener(m.b.Events,this.onRoomStateEvents))}shouldComponentUpdate(e,t){return Object(Ai.c)(this.props,e)||Object(Ai.c)(this.state,t)}computeCounters(){const e=[];if(this.props.room&&b.b.getValue("feature_state_counters")){const t=this.props.room.currentState.getStateEvents("re.jki.counter");t.sort(((e,t)=>Object(ji.w)(e.getStateKey(),t.getStateKey())));for(const a of t){const t=a.getContent().title,n=a.getContent().value,i=a.getContent().link,s=a.getContent().severity||"normal",r=a.getStateKey();t&&void 0!==n&&e.push({title:t,value:n,link:i,severity:s,stateKey:r})}}return e}render(){const e=r.a.createElement(Vl,{roomId:this.props.room.roomId,resizeNotifier:this.props.resizeNotifier,showApps:this.props.showApps});let t;b.b.getValue(oe.b.Widgets)&&(t=r.a.createElement(gl,{room:this.props.room,userId:this.props.userId,showApps:this.props.showApps,resizeNotifier:this.props.resizeNotifier}));let a=null;if(this.state.counters&&b.b.getValue("feature_state_counters")){const e=[];this.state.counters.forEach(((t,a)=>{const n=t.title,i=t.value,s=t.link,o=t.severity,l=t.stateKey;let c=r.a.createElement("span",null,n,": ",i);s&&(c=r.a.createElement("a",{href:s,target:"_blank",rel:"noreferrer noopener"},c)),c=r.a.createElement("span",{className:"m_RoomView_auxPanel_stateViews_span","data-severity":o,key:"x-"+l},c),e.push(c),e.push(r.a.createElement("span",{className:"m_RoomView_auxPanel_stateViews_delim",key:"delim"+a}," ","─"," "))})),e.length>0&&(e.pop(),a=r.a.createElement("div",{className:"m_RoomView_auxPanel_stateViews"},e))}return r.a.createElement(St.a,{className:"mx_RoomView_auxPanel"},a,this.props.children,t,e)}}i()(Wl,"defaultProps",{showApps:!0});const Hl=["isHighlighted","isUnread","onClick","name","title"];class zl extends r.a.Component{render(){const e=this.props,{isHighlighted:t,isUnread:a=!1,onClick:n,name:i,title:s}=e,o=ve()(e,Hl),l=c()({mx_RightPanel_headerButton:!0,mx_RightPanel_headerButton_highlight:t,mx_RightPanel_headerButton_unread:a,[`mx_RightPanel_${i}`]:!0});return r.a.createElement(q.a,Z()({},o,{"aria-selected":t,role:"tab",title:s,alignment:zr.a.Bottom,className:l,onClick:n}))}}let Gl;!function(e){e.Room="room"}(Gl||(Gl={}));class Kl extends r.a.Component{constructor(e,t){super(e),i()(this,"unmounted",!1),i()(this,"dispatcherRef",void 0),i()(this,"onRightPanelStoreUpdate",(()=>{this.unmounted||this.setState({phase:Aa.a.instance.currentCard.phase})}));const a=Aa.a.instance;this.state={headerKind:t,phase:a.currentCard.phase,threadNotificationColor:Ce.a.None,globalNotificationColor:Ce.a.None}}componentDidMount(){Aa.a.instance.on(pt.b,this.onRightPanelStoreUpdate),this.dispatcherRef=v.a.register(this.onAction.bind(this))}componentWillUnmount(){this.unmounted=!0,Aa.a.instance.off(pt.b,this.onRightPanelStoreUpdate),this.dispatcherRef&&v.a.unregister(this.dispatcherRef)}setPhase(e,t){const a=Aa.a.instance;a.currentCard.phase==e&&!t&&a.isOpen?a.togglePanel(null):(Aa.a.instance.setCard({phase:e,state:t}),a.isOpen||a.togglePanel(null))}isPhase(e){return!!Aa.a.instance.isOpen&&(Array.isArray(e)?e.includes(this.state.phase):e===this.state.phase)}render(){return r.a.createElement("div",{className:"mx_HeaderButtons",role:"tablist"},this.renderButtons())}}var ql=a(433);const $l=[Ma.a.RoomSummary,Ma.a.Widget,Ma.a.FilePanel,Ma.a.RoomMemberList,Ma.a.RoomMemberInfo,Ma.a.EncryptionPanel,Ma.a.Room3pidMemberInfo],Yl=e=>{let{color:t}=e;if(t===Ce.a.None)return null;const a=c()({mx_Indicator:!0,mx_RightPanel_headerButton_unreadIndicator:!0,mx_Indicator_bold:t===Ce.a.Bold,mx_Indicator_gray:t===Ce.a.Grey,mx_Indicator_red:t===Ce.a.Red});return r.a.createElement(r.a.Fragment,null,r.a.createElement("div",{className:"mx_RightPanel_headerButton_unreadIndicator_bg"}),r.a.createElement("div",{className:a}))},Jl=e=>{let{room:t,isHighlighted:a,onClick:n}=e;const i=kn(t),s=jn(t);if(null==i||!i.length)return null;let o;return i.some((e=>!s.has(e)))&&(o=r.a.createElement(Yl,null)),r.a.createElement(zl,{name:"pinnedMessagesButton",title:Object(N.a)("Pinned messages"),isHighlighted:a,isUnread:!!o,onClick:n},o)},Ql=e=>{let t,{room:a,isHighlighted:n,onClick:i}=e;const s=De.a.instance.getRoomState(a).color;switch(s){case Ce.a.Bold:case Ce.a.Grey:case Ce.a.Red:t=r.a.createElement(Yl,{color:s})}return r.a.createElement(zl,{name:"timelineCardButton",title:Object(N.a)("Chat"),isHighlighted:n,onClick:i},t)};class Xl extends Kl{constructor(e){super(e,Gl.Room),i()(this,"globalNotificationState",void 0),i()(this,"onNotificationUpdate",(()=>{this.setState({threadNotificationColor:this.notificationColor})})),i()(this,"onUpdateStatus",(e=>{this.globalNotificationState=e,this.setState({globalNotificationColor:e.color})})),i()(this,"onRoomSummaryClicked",(()=>{const e=Aa.a.instance.currentCard.phase;$l.includes(e)?this.state.phase===e?this.setPhase(e):this.setPhase(e,Aa.a.instance.currentCard.state):this.setPhase(Ma.a.RoomSummary)})),i()(this,"onNotificationsClicked",(()=>{this.setPhase(Ma.a.NotificationPanel)})),i()(this,"onPinnedMessagesClicked",(()=>{this.setPhase(Ma.a.PinnedMessages)})),i()(this,"onTimelineCardClicked",(()=>{this.setPhase(Ma.a.Timeline)})),i()(this,"onThreadsPanelClicked",(e=>{var t,a;Xl.THREAD_PHASES.includes(this.state.phase)?Aa.a.instance.togglePanel(null!==(t=null===(a=this.props.room)||void 0===a?void 0:a.roomId)&&void 0!==t?t:null):(Aa.a.instance.setCard({phase:Ma.a.ThreadPanel}),re.b.trackInteraction("WebRoomHeaderButtonsThreadsButton",e))})),this.globalNotificationState=De.a.instance.globalState}componentDidMount(){var e,t,a,n,i,s,r,o;super.componentDidMount(),null===(e=this.props.room)||void 0===e||e.on(te.d.UnreadNotifications,this.onNotificationUpdate),null===(t=this.props.room)||void 0===t||t.on(te.d.Receipt,this.onNotificationUpdate),null===(a=this.props.room)||void 0===a||a.on(te.d.Timeline,this.onNotificationUpdate),null===(n=this.props.room)||void 0===n||n.on(te.d.Redaction,this.onNotificationUpdate),null===(i=this.props.room)||void 0===i||i.on(te.d.LocalEchoUpdated,this.onNotificationUpdate),null===(s=this.props.room)||void 0===s||s.on(te.d.MyMembership,this.onNotificationUpdate),null===(r=this.props.room)||void 0===r||r.on(xa.f.New,this.onNotificationUpdate),null===(o=this.props.room)||void 0===o||o.on(xa.f.Update,this.onNotificationUpdate),this.onNotificationUpdate(),De.a.instance.on(De.b,this.onUpdateStatus)}componentWillUnmount(){var e,t,a,n,i,s,r,o;super.componentWillUnmount(),null===(e=this.props.room)||void 0===e||e.off(te.d.UnreadNotifications,this.onNotificationUpdate),null===(t=this.props.room)||void 0===t||t.off(te.d.Receipt,this.onNotificationUpdate),null===(a=this.props.room)||void 0===a||a.off(te.d.Timeline,this.onNotificationUpdate),null===(n=this.props.room)||void 0===n||n.off(te.d.Redaction,this.onNotificationUpdate),null===(i=this.props.room)||void 0===i||i.off(te.d.LocalEchoUpdated,this.onNotificationUpdate),null===(s=this.props.room)||void 0===s||s.off(te.d.MyMembership,this.onNotificationUpdate),null===(r=this.props.room)||void 0===r||r.off(xa.f.New,this.onNotificationUpdate),null===(o=this.props.room)||void 0===o||o.off(xa.f.Update,this.onNotificationUpdate),De.a.instance.off(De.b,this.onUpdateStatus)}get notificationColor(){var e;switch(null===(e=this.props.room)||void 0===e?void 0:e.threadsAggregateNotificationType){case te.b.Highlight:return Ce.a.Red;case te.b.Total:return Ce.a.Grey}for(const e of this.props.room.getThreads())if(Object(ql.b)(e))return Ce.a.Bold;return Ce.a.None}onAction(e){e.action===U.a.ViewUser?e.member?e.push?Aa.a.instance.pushCard({phase:Ma.a.RoomMemberInfo,state:{member:e.member}}):Aa.a.instance.setCards([{phase:Ma.a.RoomSummary},{phase:Ma.a.RoomMemberList},{phase:Ma.a.RoomMemberInfo,state:{member:e.member}}]):this.setPhase(Ma.a.RoomMemberList):"view_3pid_invite"===e.action&&(e.event?this.setPhase(Ma.a.Room3pidMemberInfo,{memberInfoEvent:e.event}):this.setPhase(Ma.a.RoomMemberList))}renderButtons(){if(!this.props.room)return r.a.createElement(r.a.Fragment,null);const e=new Map;return b.b.getValue("feature_pinning")&&e.set(Ma.a.PinnedMessages,r.a.createElement(Jl,{key:"pinnedMessagesButton",room:this.props.room,isHighlighted:this.isPhase(Ma.a.PinnedMessages),onClick:this.onPinnedMessagesClicked})),e.set(Ma.a.Timeline,r.a.createElement(Ql,{key:"timelineButton",room:this.props.room,isHighlighted:this.isPhase(Ma.a.Timeline),onClick:this.onTimelineCardClicked})),e.set(Ma.a.ThreadPanel,r.a.createElement(zl,{key:Ma.a.ThreadPanel,name:"threadsButton","data-testid":"threadsButton",title:Object(N.a)("Threads"),onClick:this.onThreadsPanelClicked,isHighlighted:this.isPhase(Xl.THREAD_PHASES),isUnread:this.state.threadNotificationColor>0},r.a.createElement(Yl,{color:this.state.threadNotificationColor}))),e.set(Ma.a.NotificationPanel,r.a.createElement(zl,{key:"notifsButton",name:"notifsButton",title:Object(N.a)("Notifications"),isHighlighted:this.isPhase(Ma.a.NotificationPanel),onClick:this.onNotificationsClicked,isUnread:this.globalNotificationState.color===Ce.a.Red},this.globalNotificationState.color===Ce.a.Red?r.a.createElement(Yl,{color:this.globalNotificationState.color}):null)),e.set(Ma.a.RoomSummary,r.a.createElement(zl,{key:"roomSummaryButton",name:"roomSummaryButton",title:Object(N.a)("Room info"),isHighlighted:this.isPhase($l),onClick:this.onRoomSummaryClicked})),r.a.createElement(r.a.Fragment,null,Array.from(e.keys()).map((t=>{var a;return null!==(a=this.props.excludedRightPanelPhaseButtons)&&void 0!==a&&a.includes(t)?null:e.get(t)})))}}i()(Xl,"THREAD_PHASES",[Ma.a.ThreadPanel,Ma.a.ThreadView]);var Zl=a(945),ec=a(488),tc=a(266),ac=a(401);const nc=["room","onFinished"];var ic=e=>{var t;let{room:a,onFinished:n}=e,i=ve()(e,nc);const o=Object(s.useContext)(R.a),l=Object(ie.b)(aa.c.instance,aa.b,(()=>aa.c.instance.getTagsForRoom(a)));let c;if(l.includes(T.a.Archived)){const e=e=>{e.preventDefault(),e.stopPropagation(),v.a.dispatch({action:"forget_room",room_id:a.roomId}),n()};c=r.a.createElement(me.b,{iconClassName:"mx_RoomTile_iconSignOut",label:Object(N.a)("Forget"),className:"mx_IconizedContextMenu_option_red",onClick:e})}else{const e=e=>{e.preventDefault(),e.stopPropagation(),v.a.dispatch({action:"leave_room",room_id:a.roomId}),n(),re.b.trackInteraction("WebRoomHeaderContextMenuLeaveItem",e)};c=r.a.createElement(me.b,{onClick:e,label:Object(N.a)("Leave"),className:"mx_IconizedContextMenu_option_red",iconClassName:"mx_RoomTile_iconSignOut"})}const d=Ya.a.shared().getUserIdForRoomId(a.roomId),m=Object(se.a)("feature_video_rooms"),u=Object(se.a)("feature_element_call_video_rooms"),h=m&&(a.isElementVideoRoom()||u&&a.isCallRoom());let p,g,f,y,E,_,S;if(a.canInvite(o.getUserId())&&!d){const e=e=>{e.preventDefault(),e.stopPropagation(),v.a.dispatch({action:"view_invite",roomId:a.roomId}),n(),re.b.trackInteraction("WebRoomHeaderContextMenuInviteItem",e)};p=r.a.createElement(me.b,{onClick:e,label:Object(N.a)("Invite"),iconClassName:"mx_RoomTile_iconInvite"})}if("join"===a.getMyMembership()){const e=l.includes(T.a.Favourite);g=r.a.createElement(me.a,{onClick:e=>{j(e,T.a.Favourite),re.b.trackInteraction("WebRoomHeaderContextMenuFavouriteToggle",e)},active:e,label:e?Object(N.a)("Favourited"):Object(N.a)("Favourite"),iconClassName:"mx_RoomTile_iconStar"});const t=l.includes(T.a.LowPriority);f=r.a.createElement(me.a,{onClick:e=>j(e,T.a.LowPriority),active:t,label:Object(N.a)("Low priority"),iconClassName:"mx_RoomTile_iconArrowDown"});let i,s;switch(ec.a.forRoom(a).notificationVolume){case tc.a.AllMessages:i=Object(N.a)("Default"),s="mx_RoomTile_iconNotificationsDefault";break;case tc.a.AllMessagesLoud:i=Object(N.a)("All messages"),s="mx_RoomTile_iconNotificationsAllMessages";break;case tc.a.MentionsOnly:i=Object(N.a)("Mentions only"),s="mx_RoomTile_iconNotificationsMentionsKeywords";break;case tc.a.Mute:i=Object(N.a)("Mute"),s="mx_RoomTile_iconNotificationsNone"}y=r.a.createElement(me.b,{onClick:e=>{e.preventDefault(),e.stopPropagation(),v.a.dispatch({action:"open_room_settings",room_id:a.roomId,initial_tab_id:ac.a}),n(),re.b.trackInteraction("WebRoomHeaderContextMenuNotificationsItem",e)},label:Object(N.a)("Notifications"),iconClassName:s},r.a.createElement("span",{className:"mx_IconizedContextMenu_sublabel"},i))}d||(E=r.a.createElement(me.b,{onClick:e=>{e.preventDefault(),e.stopPropagation(),I(e),Aa.a.instance.pushCard({phase:Ma.a.RoomMemberList},!1),n(),re.b.trackInteraction("WebRoomHeaderContextMenuPeopleItem",e)},label:Object(N.a)("People"),iconClassName:"mx_RoomTile_iconPeople"},r.a.createElement("span",{className:"mx_IconizedContextMenu_sublabel"},a.getJoinedMemberCount())),_=r.a.createElement(me.b,{onClick:e=>{e.preventDefault(),e.stopPropagation(),v.a.dispatch({action:"copy_room",room_id:a.roomId}),n()},label:Object(N.a)("Copy room link"),iconClassName:"mx_RoomTile_iconCopyLink"})),h||(S=r.a.createElement(me.b,{onClick:e=>{e.preventDefault(),e.stopPropagation(),I(e),Aa.a.instance.pushCard({phase:Ma.a.FilePanel},!1),n()},label:Object(N.a)("Files"),iconClassName:"mx_RoomTile_iconFiles"}));const w=Object(se.a)("feature_pinning"),O=null===(t=kn(w&&a))||void 0===t?void 0:t.length;let C,x,k;w&&!h&&(C=r.a.createElement(me.b,{onClick:e=>{e.preventDefault(),e.stopPropagation(),I(e),Aa.a.instance.pushCard({phase:Ma.a.PinnedMessages},!1),n()},label:Object(N.a)("Pinned"),iconClassName:"mx_RoomTile_iconPins"},O>0&&r.a.createElement("span",{className:"mx_IconizedContextMenu_sublabel"},O))),h||(x=r.a.createElement(me.b,{onClick:e=>{e.preventDefault(),e.stopPropagation(),I(e),Aa.a.instance.setCard({phase:Ma.a.RoomSummary},!1),n()},label:Object(N.a)("Widgets"),iconClassName:"mx_RoomTile_iconWidgets"})),h||(k=r.a.createElement(me.b,{onClick:e=>{e.preventDefault(),e.stopPropagation(),H.b.createDialog(Kn,{room:a}),n()},label:Object(N.a)("Export chat"),iconClassName:"mx_RoomTile_iconExport"}));const j=(e,t)=>{if(e.preventDefault(),e.stopPropagation(),t===T.a.Favourite||t===T.a.LowPriority){const e=t===T.a.Favourite?T.a.LowPriority:T.a.Favourite,n=aa.c.instance.getTagsForRoom(a).includes(t),i=n?t:e,s=n?null:t;v.a.dispatch(Zl.a.tagRoom(o,a,i,s,void 0,0))}else ga.a.warn(`Unexpected tag ${t} applied to ${a.roomId}`);if(Object(J.a)().getAccessibilityAction(e)===W.h.Enter)n()},I=e=>{rt.b.instance.roomViewStore.getRoomId()!==a.roomId&&v.a.dispatch({action:U.a.ViewRoom,room_id:a.roomId,metricsTrigger:"RoomList",metricsViaKeyboard:"click"!==e.type},!0)};return r.a.createElement(me.e,Z()({},i,{onFinished:n,className:"mx_RoomTile_contextMenu",compact:!0}),r.a.createElement(me.c,null,p,y,g,E,S,C,x,f,_,r.a.createElement(me.b,{onClick:e=>{e.preventDefault(),e.stopPropagation(),v.a.dispatch({action:"open_room_settings",room_id:a.roomId}),n(),re.b.trackInteraction("WebRoomHeaderContextMenuSettingsItem",e)},label:Object(N.a)("Settings"),iconClassName:"mx_RoomTile_iconSettings"}),k,b.b.getValue("developerMode")&&r.a.createElement(me.b,{onClick:e=>{e.preventDefault(),e.stopPropagation(),H.b.createDialog(st.a,{roomId:rt.b.instance.roomViewStore.getRoomId()},"mx_DevtoolsDialog_wrapper"),n()},label:Object(N.a)("Developer tools"),iconClassName:"mx_RoomTile_iconDeveloperTools"}),c))},sc=a(448),rc=a(278),oc=a(338),lc=a(269),cc=a(339),dc=a(852),mc=a(851);const uc=e=>{let{liveBeaconIds:t,roomId:a}=e;const{onStopSharing:n,onResetLocationPublishError:i,beacon:s,stoppingInProgress:o,hasStopSharingError:l,hasLocationPublishError:c}=Object(lc.k)(t);if(!s)return null;const d=l||c,m=e=>t=>{null==t||t.stopPropagation(),e()};return r.a.createElement("div",{className:"mx_RoomLiveShareWarning",onClick:()=>{v.a.dispatch({action:U.a.ViewRoom,room_id:s.roomId,metricsTrigger:void 0,event_id:s.beaconInfoId,scroll_into_view:!0,highlighted:!0})}},r.a.createElement(cc.a,{className:"mx_RoomLiveShareWarning_icon",withError:d}),r.a.createElement("span",{className:"mx_RoomLiveShareWarning_label"},((e,t)=>e?Object(N.a)("An error occurred whilst sharing your live location, please try again"):t?Object(N.a)("An error occurred while stopping your live location, please try again"):Object(N.a)("You are sharing your live location"))(c,l)),o&&r.a.createElement("span",{className:"mx_RoomLiveShareWarning_spinner"},r.a.createElement(pn.a,{h:16,w:16})),!o&&!d&&r.a.createElement(mc.a,{beacon:s}),r.a.createElement(G.a,{className:"mx_RoomLiveShareWarning_stopButton","data-testid":"room-live-share-primary-button",onClick:m((()=>{c?i():n()})),kind:"danger",element:"button",disabled:o},d?Object(N.a)("Retry"):Object(N.a)("Stop")),c&&r.a.createElement(G.a,{"data-testid":"room-live-share-wire-error-close-button",title:Object(N.a)("Stop and close"),element:"button",className:"mx_RoomLiveShareWarning_closeButton",onClick:m(n)},r.a.createElement(dc.a,{className:"mx_RoomLiveShareWarning_closeButtonIcon"})))};var hc=e=>{let{roomId:t}=e;const a=Object(ie.b)(oc.a.instance,oc.b.MonitoringLivePosition,(()=>oc.a.instance.isMonitoringLiveLocation)),n=Object(ie.b)(oc.a.instance,oc.b.LivenessChange,(()=>oc.a.instance.getLiveBeaconIds(t)));return a&&n.length?r.a.createElement(uc,{liveBeaconIds:n,roomId:t}):null};const pc=e=>e.isElementVideoRoom()||b.b.getValue("feature_element_call_video_rooms")&&e.isCallRoom();var gc=a(280),vc=a(810),bc=a(202),fc=a(619);const yc=e=>{let{roomId:t,call:a}=e;const n=Object(s.useCallback)((e=>{e.preventDefault(),v.b.dispatch({action:U.a.ViewRoom,room_id:t,view_call:!0,metricsTrigger:void 0})}),[t]),i=Object(s.useCallback)((()=>{const e=a.groupCall.room.currentState.getStateEvents(ee.b.GroupCallPrefix,a.groupCall.groupCallId);null!==e?v.a.dispatch({action:U.a.ViewRoom,room_id:t,metricsTrigger:void 0,event_id:e.getId(),scroll_into_view:!0,highlighted:!0}):ga.a.error("Couldn't find a group call event to jump to")}),[a,t]);return r.a.createElement("div",{className:"mx_RoomCallBanner",onClick:i},r.a.createElement("div",{className:"mx_RoomCallBanner_text"},r.a.createElement("span",{className:"mx_RoomCallBanner_label"},Object(N.a)("Video call")),r.a.createElement(fc.b,{groupCall:a.groupCall})),r.a.createElement(G.a,{onClick:n,kind:"primary",element:"button",disabled:!1},Object(N.a)("Join")))};var Ec=e=>{let{roomId:t}=e;const a=Object(gc.a)(t),n=Object(ie.b)(oc.a.instance,oc.b.MonitoringLivePosition,(()=>oc.a.instance.isMonitoringLiveLocation)),i=Object(ie.b)(oc.a.instance,oc.b.LivenessChange,(()=>oc.a.instance.getLiveBeaconIds(t)));return n&&i.length||rt.b.instance.roomViewStore.isViewingCall()?null:null!==a&&a.connectionState===bc.c.Disconnected?r.a.createElement(yc,{call:a,roomId:t}):null};class _c{constructor(e){this.reason=e}}const Sc=e=>{let{room:t,busy:a,setBusy:n,behavior:i}=e;const{onClick:o,tooltip:l,disabled:c}=Object(s.useMemo)((()=>i instanceof _c?{onClick:()=>{},tooltip:i.reason,disabled:!0}:{onClick:async e=>{e.preventDefault(),n(!0),await B.b.instance.placeCall(t.roomId,Ea.g.Voice),n(!1)},disabled:!1}),[i,t,n]);return r.a.createElement(q.a,{className:"mx_RoomHeader_button mx_RoomHeader_voiceCallButton",onClick:o,title:Object(N.a)("Voice call"),tooltip:null!=l?l:Object(N.a)("Voice call"),alignment:zr.a.Bottom,disabled:c||a})},wc=e=>{let{room:t,busy:a,setBusy:n,behavior:i}=e;const[o,l,c,d]=Object(ce.q)(),m=Object(s.useCallback)((async()=>{n(!0),await B.b.instance.placeCall(t.roomId,Ea.g.Video),n(!1)}),[n,t]),u=Object(s.useCallback)((()=>{n(!0),v.a.dispatch({action:U.a.ViewRoom,room_id:t.roomId,view_call:!0,metricsTrigger:void 0}),n(!1)}),[n,t]),{onClick:h,tooltip:p,disabled:g}=Object(s.useMemo)((()=>i instanceof _c?{onClick:()=>{},tooltip:i.reason,disabled:!0}:"legacy_or_jitsi"===i?{onClick:async e=>{e.preventDefault(),await m()},disabled:!1}:"element"===i?{onClick:async e=>{e.preventDefault(),u()},disabled:!1}:{onClick:async e=>{e.preventDefault(),c()},disabled:!1}),[i,m,u,c]),b=Object(s.useCallback)((async e=>{e.preventDefault(),d(),await m()}),[d,m]),f=Object(s.useCallback)((e=>{e.preventDefault(),d(),u()}),[d,u]);let y=null;if(o){var E;const e=l.current.getBoundingClientRect(),t=null!==(E=mt.b.get("element_call").brand)&&void 0!==E?E:mt.a.element_call.brand;y=r.a.createElement(me.e,Z()({},Object(ce.i)(e),{onFinished:d}),r.a.createElement(me.c,null,r.a.createElement(me.b,{label:Object(N.a)("Video call (Jitsi)"),onClick:b}),r.a.createElement(me.b,{label:Object(N.a)("Video call (%(brand)s)",{brand:t}),onClick:f})))}return r.a.createElement(r.a.Fragment,null,r.a.createElement(q.a,{inputRef:l,className:"mx_RoomHeader_button mx_RoomHeader_videoCallButton",onClick:h,title:Object(N.a)("Video call"),tooltip:null!=p?p:Object(N.a)("Video call"),alignment:zr.a.Bottom,disabled:g||a}),y)},Oc=e=>{let{room:t}=e;const[a,n]=Object(s.useState)(!1),i=Object(se.b)("showCallButtonsInComposer"),o=Object(se.a)("feature_group_calls"),l=Object(se.a)("feature_video_rooms"),c=Object(s.useMemo)((()=>l&&pc(t)),[l,t]),d=Object(s.useMemo)((()=>{var e;return null!==(e=mt.b.get("element_call").use_exclusively)&&void 0!==e?e:mt.a.element_call.use_exclusively}),[]),u=Object(ie.b)(B.b.instance,B.a.CallsChanged,Object(s.useCallback)((()=>null!==B.b.instance.getCallForRoom(t.roomId)),[t])),h=pi(t),p=Object(s.useMemo)((()=>h.some((e=>tn.a.JITSI.matches(e.type)))),[h]),g=null!==Object(gc.a)(t.roomId),[v,b,f]=Object(ie.d)(t,m.b.Update,Object(s.useCallback)((()=>[Object(vc.a)(t),t.currentState.mayClientSendStateEvent("im.vector.modular.widgets",t.client),t.currentState.mayClientSendStateEvent(bc.d.CALL_EVENT_TYPE.name,t.client)]),[t])),y=e=>r.a.createElement(Sc,{room:t,busy:a,setBusy:n,behavior:e}),E=e=>r.a.createElement(wc,{room:t,busy:a,setBusy:n,behavior:e});if(c||!i)return null;if(o){if(d)return E(g?new _c(Object(N.a)("Ongoing call")):f?"element":new _c(Object(N.a)("You do not have permission to start video calls")));if(u||p||g)return r.a.createElement(r.a.Fragment,null,y(new _c(Object(N.a)("Ongoing call"))),E(new _c(Object(N.a)("Ongoing call"))));if(v.length<=1)return r.a.createElement(r.a.Fragment,null,y(new _c(Object(N.a)("There's no one here to call"))),E(new _c(Object(N.a)("There's no one here to call"))));if(2===v.length)return r.a.createElement(r.a.Fragment,null,y("legacy_or_jitsi"),E("legacy_or_jitsi"));if(b)return r.a.createElement(r.a.Fragment,null,y("legacy_or_jitsi"),E(f?"jitsi_or_element":"legacy_or_jitsi"));{const e=f?"element":new _c(Object(N.a)("You do not have permission to start video calls"));return r.a.createElement(r.a.Fragment,null,y(new _c(Object(N.a)("You do not have permission to start voice calls"))),E(e))}}return u||p?r.a.createElement(r.a.Fragment,null,y(new _c(Object(N.a)("Ongoing call"))),E(new _c(Object(N.a)("Ongoing call")))):v.length<=1?r.a.createElement(r.a.Fragment,null,y(new _c(Object(N.a)("There's no one here to call"))),E(new _c(Object(N.a)("There's no one here to call")))):2===v.length||b?r.a.createElement(r.a.Fragment,null,y("legacy_or_jitsi"),E("legacy_or_jitsi")):r.a.createElement(r.a.Fragment,null,y(new _c(Object(N.a)("You do not have permission to start voice calls"))),E(new _c(Object(N.a)("You do not have permission to start video calls"))))},Cc=e=>{let{call:t}=e;const a=Object(gc.e)(t),[n,i,o,l]=Object(ce.q)(),d=Object(s.useCallback)((e=>{e.preventDefault(),o()}),[o]),m=Object(s.useCallback)((e=>{e.preventDefault(),l(),t.setLayout(bc.f.Tile)}),[l,t]),u=Object(s.useCallback)((e=>{e.preventDefault(),l(),t.setLayout(bc.f.Spotlight)}),[l,t]);let h=null;if(n){const e=i.current.getBoundingClientRect();h=r.a.createElement(me.e,Z()({className:"mx_RoomHeader_layoutMenu"},Object(ce.i)(e),{onFinished:l}),r.a.createElement(me.c,null,r.a.createElement(me.d,{iconClassName:"mx_RoomHeader_freedomIcon",label:Object(N.a)("Freedom"),active:a===bc.f.Tile,onClick:m}),r.a.createElement(me.d,{iconClassName:"mx_RoomHeader_spotlightIcon",label:Object(N.a)("Spotlight"),active:a===bc.f.Spotlight,onClick:u})))}return r.a.createElement(r.a.Fragment,null,r.a.createElement(q.a,{inputRef:i,className:c()("mx_RoomHeader_button",{"mx_RoomHeader_layoutButton--freedom":a===bc.f.Tile,"mx_RoomHeader_layoutButton--spotlight":a===bc.f.Spotlight}),onClick:d,title:Object(N.a)("Change layout"),alignment:zr.a.Bottom,key:"layout"}),h)};class xc extends r.a.Component{constructor(e,t){super(e,t),i()(this,"context",void 0),i()(this,"client",this.props.room.client),i()(this,"onRightPanelStoreUpdate",(()=>{this.setState({rightPanelOpen:Aa.a.instance.isOpen})})),i()(this,"onRoomStateEvents",(e=>{this.props.room&&e.getRoomId()===this.props.room.roomId&&this.rateLimitedUpdate()})),i()(this,"onNotificationUpdate",(()=>{this.forceUpdate()})),i()(this,"rateLimitedUpdate",Object(k.throttle)((()=>{this.forceUpdate()}),500,{leading:!0,trailing:!0})),i()(this,"onContextMenuOpenClick",(e=>{e.preventDefault(),e.stopPropagation();const t=e.target;this.setState({contextMenuPosition:t.getBoundingClientRect()})})),i()(this,"onContextMenuCloseClick",(()=>{this.setState({contextMenuPosition:void 0})})),i()(this,"onHideCallClick",(e=>{e.preventDefault(),v.a.dispatch({action:U.a.ViewRoom,room_id:this.props.room.roomId,view_call:!1,metricsTrigger:void 0})}));De.a.instance.getRoomState(e.room).on(rc.b.Update,this.onNotificationUpdate),this.state={rightPanelOpen:Aa.a.instance.isOpen}}componentDidMount(){this.client.on(m.b.Events,this.onRoomStateEvents),Aa.a.instance.on(pt.b,this.onRightPanelStoreUpdate)}componentWillUnmount(){this.client.removeListener(m.b.Events,this.onRoomStateEvents);De.a.instance.getRoomState(this.props.room).removeListener(rc.b.Update,this.onNotificationUpdate),Aa.a.instance.off(pt.b,this.onRightPanelStoreUpdate)}renderButtons(e){const t=[];this.props.viewingCall||!this.props.inRoom||this.context.tombstone||t.push(r.a.createElement(Oc,{key:"calls",room:this.props.room})),this.props.viewingCall&&this.props.activeCall instanceof bc.d&&t.push(r.a.createElement(Cc,{key:"layout",call:this.props.activeCall})),!this.props.viewingCall&&this.props.onForgetClick&&t.push(r.a.createElement(q.a,{className:"mx_RoomHeader_button mx_RoomHeader_forgetButton",onClick:this.props.onForgetClick,title:Object(N.a)("Forget room"),alignment:zr.a.Bottom,key:"forget"})),!this.props.viewingCall&&this.props.onAppsClick&&t.push(r.a.createElement(q.a,{className:c()("mx_RoomHeader_button mx_RoomHeader_appsButton",{mx_RoomHeader_appsButton_highlight:this.props.appsShown}),onClick:this.props.onAppsClick,title:this.props.appsShown?Object(N.a)("Hide Widgets"):Object(N.a)("Show Widgets"),alignment:zr.a.Bottom,key:"apps"})),!this.props.viewingCall&&this.props.onSearchClick&&this.props.inRoom&&t.push(r.a.createElement(q.a,{className:"mx_RoomHeader_button mx_RoomHeader_searchButton",onClick:this.props.onSearchClick,title:Object(N.a)("Search"),alignment:zr.a.Bottom,key:"search"})),this.props.onInviteClick&&(!this.props.viewingCall||e)&&this.props.inRoom&&t.push(r.a.createElement(q.a,{className:"mx_RoomHeader_button mx_RoomHeader_inviteButton",onClick:this.props.onInviteClick,title:Object(N.a)("Invite"),alignment:zr.a.Bottom,key:"invite"}));const a=[];return this.props.viewingCall&&!e&&(null===this.props.activeCall?a.push(r.a.createElement(G.a,{className:"mx_RoomHeader_button mx_RoomHeader_closeButton",onClick:this.onHideCallClick,title:Object(N.a)("Close call"),key:"close"})):a.push(r.a.createElement(q.a,{className:"mx_RoomHeader_button mx_RoomHeader_minimiseButton",onClick:this.onHideCallClick,title:Object(N.a)("View chat timeline"),alignment:zr.a.Bottom,key:"minimise"}))),r.a.createElement(r.a.Fragment,null,t,r.a.createElement(Xl,{room:this.props.room,excludedRightPanelPhaseButtons:this.props.excludedRightPanelPhaseButtons}),a)}renderName(e){let t=null;this.state.contextMenuPosition&&this.props.room&&(t=r.a.createElement(ic,Z()({},Object(sc.a)(this.state.contextMenuPosition),{room:this.props.room,onFinished:this.onContextMenuCloseClick})));let a=!1;const n=this.props.room?this.props.room.getJoinedMembers():void 0;if(n&&1===n.length&&n[0].userId===this.client.credentials.userId){const e=this.props.room.currentState.getStateEvents("m.room.name","");e&&e.getContent().name||(a=!0)}const i=c()("mx_RoomHeader_nametext",{mx_RoomHeader_settingsHint:a}),s=r.a.createElement(In.a,{room:this.props.room},(t=>{const a=t||e;return r.a.createElement("div",{dir:"auto",className:i,title:a,role:"heading","aria-level":1},a)}));return this.props.enableRoomOptionsMenu?r.a.createElement(ce.c,{className:"mx_RoomHeader_name",onClick:this.onContextMenuOpenClick,isExpanded:!!this.state.contextMenuPosition,title:Object(N.a)("Room options"),alignment:zr.a.Bottom},s,this.props.room&&r.a.createElement("div",{className:"mx_RoomHeader_chevron"}),t):r.a.createElement("div",{className:"mx_RoomHeader_name mx_RoomHeader_name--textonly"},s)}render(){var e;const t=b.b.getValue("feature_video_rooms")&&pc(this.props.room);let a=null;this.props.room&&(a=r.a.createElement(ea.a,{room:this.props.room,avatarSize:24,oobData:this.props.oobData,viewAvatarOnClick:!0}));const n=this.props.viewingCall?r.a.createElement("div",{className:"mx_RoomHeader_icon mx_RoomHeader_icon_video"}):this.props.e2eStatus?r.a.createElement(bs.b,{className:"mx_RoomHeader_icon",status:this.props.e2eStatus,tooltipAlignment:zr.a.Bottom}):this.client.isRoomEncrypted(this.props.room.roomId)&&this.client.isCryptoEnabled()?r.a.createElement("div",{className:"mx_RoomHeader_icon"}):null,i=this.props.showButtons?this.renderButtons(t):null;let s=Object(N.a)("Join Room");this.props.oobData&&this.props.oobData.name&&(s=this.props.oobData.name);const o=this.renderName(s);if(this.props.viewingCall&&!t)return r.a.createElement("header",{className:"mx_RoomHeader light-panel"},r.a.createElement("div",{className:"mx_RoomHeader_wrapper","aria-owns":this.state.rightPanelOpen?"mx_RightPanel":void 0},r.a.createElement("div",{className:"mx_RoomHeader_avatar"},a),n,o,this.props.activeCall instanceof bc.d&&r.a.createElement(fc.b,{groupCall:this.props.activeCall.groupCall}),r.a.createElement("div",{className:"mx_RoomHeader_topic"}),i));let l=null;"number"==typeof(null===(e=this.props.searchInfo)||void 0===e?void 0:e.count)&&(l=r.a.createElement("div",{className:"mx_RoomHeader_searchStatus"}," ",Object(N.a)("(~%(count)s results)",{count:this.props.searchInfo.count})));const c=r.a.createElement(zo,{room:this.props.room,className:"mx_RoomHeader_topic"}),d=t?r.a.createElement(de.a,{onClick:()=>v.a.dispatch({action:U.a.ViewUserSettings,initialTabId:Ae.a.Labs}),tooltipTitle:Object(N.a)("Video rooms are a beta feature")}):null;return r.a.createElement("header",{className:"mx_RoomHeader light-panel"},r.a.createElement("div",{className:"mx_RoomHeader_wrapper","aria-owns":this.state.rightPanelOpen?"mx_RightPanel":void 0},r.a.createElement("div",{className:"mx_RoomHeader_avatar"},a),n,o,l,c,d,i),!t&&r.a.createElement(Ec,{roomId:this.props.room.roomId}),r.a.createElement(hc,{roomId:this.props.room.roomId}))}}i()(xc,"defaultProps",{inRoom:!1,excludedRightPanelPhaseButtons:[],showButtons:!0,enableRoomOptionsMenu:!0}),i()(xc,"contextType",Qa.b);var kc=e=>{let{roomWidth:t}=e;const n=Object(s.useRef)(null),i=Object(s.useRef)(new Map);return Object(s.useEffect)((()=>{const e=()=>{var e;n.current&&(null===(e=n.current)||void 0===e?void 0:e.height)!==Q.b.instance.windowHeight&&(n.current.height=Q.b.instance.windowHeight)},t=v.a.register((e=>{const t="effects.";if(0===e.action.indexOf(t)){(async e=>{if(!e)return null;let t=i.current.get(e)||null;if(null===t){var n;const s=null===(n=Wi.CHAT_EFFECTS.find((t=>t.command===e)))||void 0===n?void 0:n.options;try{const{default:n}=await a(1540)(`./${e}`);t=new n(s),i.current.set(e,t)}catch(t){ga.a.warn(`Unable to load effect module at '../../../effects/${e}.`,t)}}return t})(e.action.slice(t.length)).then((e=>null==e?void 0:e.start(n.current)))}}));return n.current.height=Q.b.instance.windowHeight,Q.b.instance.on(Q.a.Resize,e),()=>{v.a.unregister(t),Q.b.instance.off(Q.a.Resize,e);const a=i.current;for(const e in a){const t=a.get(e);t&&t.isRunning&&t.stop()}}}),[]),r.a.createElement("canvas",{ref:n,width:t,style:{display:"block",zIndex:999999,pointerEvents:"none",position:"fixed",top:0,right:0}})},jc=a(308);const Rc=e=>{let{kind:t,devices:a,setDevice:n,deviceListLabel:i,muted:o,disabled:l,toggle:d,unmutedTitle:m,mutedTitle:u}=e;const[h,p,g,v]=Object(ce.q)(),b=Object(s.useCallback)((e=>{n(e),v()}),[n,v]);let f=null;if(h){const e=p.current.getBoundingClientRect();f=r.a.createElement(me.e,Z()({},Object(ce.j)(e,void 0,10),{onFinished:v}),r.a.createElement(me.c,null,a.map((e=>r.a.createElement(me.b,{key:e.deviceId,label:e.label,onClick:()=>b(e)})))))}return a.length?r.a.createElement("div",{className:c()("mx_CallView_deviceButtonWrapper",{mx_CallView_deviceButtonWrapper_muted:o})},r.a.createElement(q.a,{className:`mx_CallView_deviceButton mx_CallView_deviceButton_${t}`,inputRef:p,title:o?u:m,alignment:zr.a.Top,onClick:d,disabled:l}),a.length>1?r.a.createElement(ce.b,{className:"mx_CallView_deviceListButton",onClick:g,isExpanded:h,label:i,disabled:l}):null,f):null},Ic=e=>{let{room:t,joinCallButtonDisabledTooltip:a,connect:n,children:i}=e;const[o,l]=Object(s.useState)(!1),c=Object(s.useMemo)((()=>t.getMember(t.myUserId)),[t]),d=Object(s.useRef)(null),[m,u]=Object(s.useState)((()=>p.c.getVideoInput())),[h,g]=Object(s.useState)((()=>p.c.startWithAudioMuted)),[v,b]=Object(s.useState)((()=>p.c.startWithVideoMuted)),f=Object(s.useCallback)((()=>{p.c.startWithAudioMuted=!h,g(!h)}),[h,g]),y=Object(s.useCallback)((()=>{p.c.startWithVideoMuted=!v,b(!v)}),[v,b]),[E,_,S]=Object(bn.a)((async()=>{let e=await p.c.getDevices(),t=null;try{e.audioinput.length>0?t=await navigator.mediaDevices.getUserMedia({audio:!0,video:!v&&e.videoinput.length>0&&{deviceId:m}}):e.videoinput.length>0&&(t=await navigator.mediaDevices.getUserMedia({video:{deviceId:m}}))}catch(e){ga.a.error(`Failed to get stream for device ${m}`,e)}var a;(null!==t&&(e=await p.c.getDevices()),v)&&(null===(a=t)||void 0===a||a.getTracks().forEach((e=>e.stop())),t=null);return[t,e.audioinput,e.videoinput]}),[m,v],[null,[],[]]),w=Object(s.useCallback)((e=>{p.c.instance.setAudioInput(e.deviceId)}),[]),O=Object(s.useCallback)((e=>{p.c.instance.setVideoInput(e.deviceId),u(e.deviceId)}),[]);Object(s.useEffect)((()=>{if(E){const e=d.current;return e.srcObject=E,e.play(),()=>{E.getTracks().forEach((e=>e.stop())),e.srcObject=null}}}),[E]);const C=Object(s.useCallback)((async e=>{e.preventDefault(),l(!0);try{await n()}catch(e){ga.a.error(e),l(!1)}}),[n,l]);return r.a.createElement("div",{className:"mx_CallView_lobby"},i,r.a.createElement("div",{className:"mx_CallView_preview"},r.a.createElement(yn.b,{key:c.userId,member:c,width:200,height:200,resizeMethod:"scale"}),r.a.createElement("video",{ref:d,style:{visibility:v?"hidden":void 0},muted:!0,playsInline:!0,disablePictureInPicture:!0}),r.a.createElement("div",{className:"mx_CallView_controls"},r.a.createElement(Rc,{kind:"audio",devices:_,setDevice:w,deviceListLabel:Object(N.a)("Audio devices"),muted:h,disabled:o,toggle:f,unmutedTitle:Object(N.a)("Mute microphone"),mutedTitle:Object(N.a)("Unmute microphone")}),r.a.createElement(Rc,{kind:"video",devices:S,setDevice:O,deviceListLabel:Object(N.a)("Video devices"),muted:v,disabled:o,toggle:y,unmutedTitle:Object(N.a)("Turn off camera"),mutedTitle:Object(N.a)("Turn on camera")}))),r.a.createElement(q.a,{className:"mx_CallView_connectButton",kind:"primary",disabled:o||void 0!==a,onClick:C,label:Object(N.a)("Join"),tooltip:o?Object(N.a)("Connecting"):a,alignment:zr.a.Bottom}))},Tc=e=>{let{room:t,resizing:a,call:n,setStartingCall:i}=e;const o=Object(s.useContext)(R.a),l=Object(s.useRef)();void 0===l.current&&(l.current=Object(ji.l)());const c=l.current,[d,m]=Object(s.useState)((()=>null!==n&&Object(bc.g)(n.connectionState)));Object(s.useEffect)((()=>{if(null!==n){const e=e=>m(Object(bc.g)(e));return n.on(bc.b.ConnectionState,e),()=>{n.off(bc.b.ConnectionState,e)}}}),[n]);const u=Object(s.useCallback)((async()=>{i(!0),await bc.d.create(t),await c.promise}),[t,i,c]);return Object(s.useEffect)((()=>{(async()=>{if(null!==n)try{await Promise.all([...jc.a.instance.activeCalls].map((e=>e.disconnect()))),await n.connect(),c.resolve()}catch(e){c.reject(e)}})()}),[n,c]),r.a.createElement("div",{className:"mx_CallView"},d?null:r.a.createElement(Ic,{room:t,connect:u}),null!==n&&r.a.createElement(cs,{app:n.widget,room:t,userId:o.credentials.userId,creatorUserId:n.widget.creatorUserId,waitForIframeLoad:n.widget.waitForIframeLoad,showMenubar:!1,pointerEvents:a?"none":void 0}))},Nc=e=>{let{room:t,resizing:a,call:n}=e;const i=Object(s.useContext)(R.a),o=Object(bc.g)(Object(gc.c)(n)),l=Object(gc.g)(n),c=Object(gc.d)(n),d=Object(s.useCallback)((async()=>{await Promise.all([...jc.a.instance.activeCalls].map((e=>e.disconnect()))),await n.connect()}),[n]);Object(s.useEffect)((()=>{n.clean()}),[n]);let m=null;if(!o){let e=null;if(l.length){const t=l.slice(0,8),a=l.length>t.length;e=r.a.createElement("div",{className:"mx_CallView_participants"},Object(N.a)("%(count)s people joined",{count:l.length}),r.a.createElement(Go.a,{members:t,faceSize:24,overflow:a}))}m=r.a.createElement(Ic,{room:t,connect:d,joinCallButtonDisabledTooltip:null!=c?c:void 0},e)}return r.a.createElement("div",{className:"mx_CallView"},m,r.a.createElement(cs,{app:n.widget,room:t,userId:i.credentials.userId,creatorUserId:n.widget.creatorUserId,waitForIframeLoad:n.widget.waitForIframeLoad,showMenubar:!1,pointerEvents:a?"none":void 0}))},Dc=e=>{let{room:t,resizing:a,waitForCall:n}=e;const i=Object(gc.a)(t.roomId),[o,l]=Object(s.useState)(!1);return null===i||o?n?null:r.a.createElement(Tc,{room:t,resizing:a,call:i,setStartingCall:l}):r.a.createElement(Nc,{room:t,resizing:a,call:i})};var Pc=a(274),Mc=a(623),Ac=a(218),Lc=a(325);const Uc=(e,t)=>{const[a,n]=Object(s.useState)((()=>Array.isArray(t)?t:new Array(e).fill(t)));return[a,(e,t)=>n((a=>{const n=[...a];return n[e]=t,n}))]};var Fc=a(390),Bc=a(815),Vc=a(893),Wc=a(854),Hc=a(394),zc=a(387);function Gc(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function Kc(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?Gc(Object(a),!0).forEach((function(t){i()(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):Gc(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}const qc=e=>{var t;let{room:a,suggested:n,selected:i,hasPermissions:o,onToggleClick:l,onViewRoomClick:d,onJoinRoomClick:m,numChildRooms:u,children:h}=e;const p=Object(s.useContext)(R.a),[g,v]=Object(s.useState)((()=>{const e=p.getRoom(a.room_id);return"join"===(null==e?void 0:e.getMyMembership())?e:null})),b=Object(ie.d)(g,te.d.Name,(e=>null==e?void 0:e.name)),f=b||a.name||a.canonical_alias||(null===(t=a.aliases)||void 0===t?void 0:t[0])||(a.room_type===ee.j.Space?Object(N.a)("Unnamed Space"):Object(N.a)("Unnamed Room")),[y,E]=Object(Hc.a)(!0),[_,S,w]=Object(xe.i)(),[O,C]=Object(s.useState)(!1),x=e=>{e.preventDefault(),e.stopPropagation(),d()},k=async e=>{C(!0),e.preventDefault(),e.stopPropagation(),m().then((()=>Object(zc.a)(p,a.room_id))).then(v).finally((()=>{C(!1)}))};let j,I,T;j=O?r.a.createElement(q.a,{disabled:!0,onClick:k,kind:"primary_outline",onFocus:_,tabIndex:S?0:-1,title:Object(N.a)("Joining")},r.a.createElement(pn.a,{w:24,h:24})):g?r.a.createElement(G.a,{onClick:x,kind:"primary_outline",onFocus:_,tabIndex:S?0:-1},Object(N.a)("View")):r.a.createElement(G.a,{onClick:k,kind:"primary",onFocus:_,tabIndex:S?0:-1},Object(N.a)("Join")),l&&(I=o?r.a.createElement(Pe.b,{checked:!!i,onChange:l,tabIndex:S?0:-1}):r.a.createElement(za.a,{tooltip:Object(N.a)("You don't have permission"),onClick:e=>{e.stopPropagation()}},r.a.createElement(Pe.b,{disabled:!0,tabIndex:S?0:-1}))),T=g?r.a.createElement(ye.a,{room:g,width:20,height:20}):r.a.createElement(gt.a,{name:f,idName:a.room_id,url:a.avatar_url?Object(Ga.b)(a.avatar_url).getSquareThumbnailHttp(20):null,width:20,height:20});let D,P,M,A,L=Object(N.a)("%(count)s members",{count:a.num_joined_members});if(void 0!==u&&(L+=" · "+Object(N.a)("%(count)s rooms",{count:u})),g){const e=Object(Wo.a)(g);D=Object(Ao.j)(null==e?void 0:e.text,null==e?void 0:e.html)}else D=a.topic;D&&(P=r.a.createElement(Ao.a,{options:{attributes:{onClick(e){e.stopPropagation()}}}}," · ",D)),g&&(M=r.a.createElement("div",{className:"mx_SpaceHierarchy_roomTile_joined"},Object(N.a)("Joined"))),!n||g&&!o||(A=r.a.createElement(Wc.b,{tooltip:Object(N.a)("This room is suggested as a good one to join")},Object(N.a)("Suggested")));const U=r.a.createElement(r.a.Fragment,null,r.a.createElement("div",{className:"mx_SpaceHierarchy_roomTile_item"},r.a.createElement("div",{className:"mx_SpaceHierarchy_roomTile_avatar"},T),r.a.createElement("div",{className:"mx_SpaceHierarchy_roomTile_name"},f,M,A),r.a.createElement("div",{className:"mx_SpaceHierarchy_roomTile_info"},L,P)),r.a.createElement("div",{className:"mx_SpaceHierarchy_actions"},j,I));let F,B,V;if(h){if(F=r.a.createElement("div",{className:c()("mx_SpaceHierarchy_subspace_toggle",{mx_SpaceHierarchy_subspace_toggle_shown:y}),onClick:e=>{e.stopPropagation(),E()}}),y){const e=e=>{var t;if(Object(J.a)().getAccessibilityAction(e)===W.h.ArrowLeft)e.preventDefault(),e.stopPropagation(),null===(t=w.current)||void 0===t||t.focus()};B=r.a.createElement("div",{className:"mx_SpaceHierarchy_subspace_children",onKeyDown:e,role:"group"},h)}V=e=>{let t=!1;switch(Object(J.a)().getAccessibilityAction(e)){case W.h.ArrowLeft:y&&(t=!0,E());break;case W.h.ArrowRight:if(t=!0,y){var a,n;const e=null===(a=w.current)||void 0===a?void 0:a.nextElementSibling;null==e||null===(n=e.querySelector(".mx_SpaceHierarchy_roomTile"))||void 0===n||n.focus()}else E()}t&&(e.preventDefault(),e.stopPropagation())}}return r.a.createElement("li",{className:"mx_SpaceHierarchy_roomTileWrapper",role:"treeitem","aria-expanded":h?y:void 0},r.a.createElement(G.a,{className:c()("mx_SpaceHierarchy_roomTile",{mx_SpaceHierarchy_subspace:a.room_type===ee.j.Space,mx_SpaceHierarchy_joining:O}),onClick:o&&l?l:x,onKeyDown:V,inputRef:w,onFocus:_,tabIndex:S?0:-1},U,F),B)},$c=(e,t,a,n)=>{var i,s;const r=t.roomMap.get(a);if(e.isGuest()&&!r.world_readable&&!r.guest_can_join)return void v.a.dispatch({action:"require_registration"});const o=Object(Ta.a)(null!==(i=null==r?void 0:r.canonical_alias)&&void 0!==i?i:"",null!==(s=null==r?void 0:r.aliases)&&void 0!==s?s:[])||void 0;v.a.dispatch({action:U.a.ViewRoom,should_peek:!0,room_alias:o,room_id:r.room_id,via_servers:Array.from(t.viaMap.get(a)||[]),oob_data:{avatarUrl:r.avatar_url,name:r.name||o||Object(N.a)("Unnamed room"),roomType:n},metricsTrigger:"RoomDirectory"})},Yc=e=>{let{root:t,roomSet:a,hierarchy:n,parents:i,selectedMap:o,onViewRoomClick:l,onJoinRoomClick:c,onToggleClick:d}=e;const m=Object(s.useContext)(R.a),u=m.getRoom(t.room_id),h=null==u?void 0:u.currentState.maySendStateEvent(ee.b.SpaceChild,m.getUserId()),p=Object(k.sortBy)(t.children_state,(e=>Object($.b)(e.content.order,e.origin_server_ts,e.state_key))),[g,v]=p.reduce(((e,t)=>{const i=n.roomMap.get(t.state_key);return i&&a.has(i)&&e[i.room_type===ee.j.Space?0:1].push(((e,t,a)=>{const n=e.getRoomUpgradeHistory(t.room_id,!0);let i=null;for(let e=n.length-1;e>=0;--e)if(a.roomMap.get(n[e].roomId)){i=n[e];break}var s,r,o,l;return i?Kc(Kc({},t),{},{room_id:i.roomId,room_type:i.getType(),name:i.name,topic:null===(s=i.currentState.getStateEvents(ee.b.RoomTopic,""))||void 0===s?void 0:s.getContent().topic,avatar_url:i.getMxcAvatarUrl(),canonical_alias:null!==(r=i.getCanonicalAlias())&&void 0!==r?r:void 0,aliases:i.getAltAliases(),world_readable:(null===(o=i.currentState.getStateEvents(ee.b.RoomHistoryVisibility,""))||void 0===o?void 0:o.getContent().history_visibility)===ka.b.WorldReadable,guest_can_join:(null===(l=i.currentState.getStateEvents(ee.b.RoomGuestAccess,""))||void 0===l?void 0:l.getContent().guest_access)===ka.a.CanJoin,num_joined_members:i.getJoinedMemberCount()}):t})(m,i,n)),e}),[[],[]]),b=new Set(i).add(t.room_id);return r.a.createElement(r.a.Fragment,null,Object(k.uniqBy)(v,"room_id").map((e=>{var a;return r.a.createElement(qc,{key:e.room_id,room:e,suggested:n.isSuggested(t.room_id,e.room_id),selected:null==o||null===(a=o.get(t.room_id))||void 0===a?void 0:a.has(e.room_id),onViewRoomClick:()=>l(e.room_id,e.room_type),onJoinRoomClick:()=>c(e.room_id),hasPermissions:h,onToggleClick:d?()=>d(t.room_id,e.room_id):void 0})})),g.filter((e=>!b.has(e.room_id))).map((e=>{var i;return r.a.createElement(qc,{key:e.room_id,room:e,numChildRooms:e.children_state.filter((e=>{const t=n.roomMap.get(e.state_key);return t&&a.has(t)&&!t.room_type})).length,suggested:n.isSuggested(t.room_id,e.room_id),selected:null==o||null===(i=o.get(t.room_id))||void 0===i?void 0:i.has(e.room_id),onViewRoomClick:()=>l(e.room_id,ee.j.Space),onJoinRoomClick:()=>c(e.room_id),hasPermissions:h,onToggleClick:d?()=>d(t.room_id,e.room_id):void 0},r.a.createElement(Yc,{root:e,roomSet:a,hierarchy:n,parents:b,selectedMap:o,onViewRoomClick:l,onJoinRoomClick:c,onToggleClick:d}))})))},Jc=e=>{let{hierarchy:t,selected:a,setSelected:n,setError:i}=e;const o=Object(s.useContext)(R.a),[l,c]=Object(s.useState)(!1),[d,m]=Object(s.useState)(!1),u=Array.from(a.keys()).flatMap((e=>[...a.get(e).values()].map((t=>[e,t])))),h=u.every((e=>{let[a,n]=e;return t.isSuggested(a,n)})),p=!u.length||l||d;let g=G.a,v={};u.length||(g=q.a,v={tooltip:Object(N.a)("Select a room below first"),alignment:zr.a.Top});let b=Object(N.a)("Saving…");return d||(b=h?Object(N.a)("Mark as not suggested"):Object(N.a)("Mark as suggested")),r.a.createElement(r.a.Fragment,null,r.a.createElement(g,Z()({},v,{onClick:async()=>{c(!0);try{const e=o.getUserId();for(const[a,n]of u){await o.sendStateEvent(a,ee.b.SpaceChild,{},n);const i=o.getRoom(n),s=null==i?void 0:i.currentState.getStateEvents(ee.b.SpaceParent,a);null!=i&&i.currentState.maySendStateEvent(ee.b.SpaceParent,e)&&Array.isArray(null==s?void 0:s.getContent().via)&&await o.sendStateEvent(n,ee.b.SpaceParent,{},a),t.removeRelation(a,n)}}catch(e){i(Object(N.a)("Failed to remove some rooms. Try again later"))}c(!1),n(new Map)},kind:"danger_outline",disabled:p}),l?Object(N.a)("Removing…"):Object(N.a)("Remove")),r.a.createElement(g,Z()({},v,{onClick:async()=>{m(!0);try{for(const[a,n]of u){var e;const i=!h,s=null===(e=t.getRelation(a,n))||void 0===e?void 0:e.content;if(!s||s.suggested===i)continue;const r=Kc(Kc({},s),{},{suggested:!h});await o.sendStateEvent(a,ee.b.SpaceChild,r,n),s.suggested=r.suggested}}catch(e){i("Failed to update some suggestions. Try again later")}m(!1),n(new Map)},kind:"primary_outline",disabled:p}),b))};var Qc,Xc=e=>{let{space:t,initialText:a="",showRoom:n,additionalButtons:i}=e;const o=Object(s.useContext)(R.a),[l,c]=Object(s.useState)(a),[d,m]=Object(s.useState)(new Map),{loading:u,rooms:h,hierarchy:p,loadMore:g,error:b}=(e=>{const[t,a]=Object(s.useState)([]),[n,i]=Object(s.useState)(),[r,o]=Object(s.useState)(),l=Object(s.useCallback)((()=>{o(void 0);const t=new Vc.a(e,20);t.load().then((()=>{e===t.root&&a(t.rooms)}),o),i(t)}),[e]);Object(s.useEffect)(l,[l]),Object(ne.a)(v.a,(e=>{e.action===U.a.UpdateSpaceHierarchy&&(a([]),l())}));const c=Object(s.useCallback)((async e=>{n.loading||!n.canLoadMore||n.noSupport||r||(await n.load(e).catch(o),a(n.rooms))}),[r,n]);return(null==n?void 0:n.root)!==e?{loading:!0,loadMore:c}:{loading:n.loading,rooms:t,hierarchy:n,loadMore:c,error:r}})(t),f=Object(s.useMemo)((()=>{if(null==h||!h.length||!p)return new Set;const e=l.toLowerCase().trim();if(!e)return new Set(h);const t=h.filter((t=>{var a,n;return(null===(a=t.name)||void 0===a?void 0:a.toLowerCase().includes(e))||(null===(n=t.topic)||void 0===n?void 0:n.toLowerCase().includes(e))})),a=new Set,n=[...t.map((e=>e.room_id))];for(;n.length;){var i;const e=n.pop();a.add(e),null===(i=p.backRefs.get(e))||void 0===i||i.forEach((e=>{a.has(e)||n.push(e)}))}return new Set(h.filter((e=>a.has(e.room_id))))}),[h,p,l]),[y,E]=Object(s.useState)("");let _=y;!y&&b&&(_=Object(N.a)("Failed to load list of rooms."));const S=(e=>{const t=t=>{t[0].isIntersecting&&e()},a=Object(s.useRef)();return e=>{a.current?a.current.disconnect():e&&(a.current=new IntersectionObserver(t,{root:e.parentElement,rootMargin:"0px 0px 600px 0px"})),a.current&&e&&a.current.observe(e)}})(g);if(!u&&p.noSupport)return r.a.createElement("p",null,Object(N.a)("Your server does not support showing space hierarchies."));const w=(e,t)=>{if(E(""),!d.has(e))return void m(new Map(d.set(e,new Set([t]))));const a=d.get(e);a.has(t)?(a.delete(t),m(new Map(d.set(e,new Set(a))))):m(new Map(d.set(e,new Set([...a,t]))))};return r.a.createElement(xe.d,{onKeyDown:(e,t)=>{var a,n;Object(J.a)().getAccessibilityAction(e)===W.h.ArrowDown&&e.currentTarget.classList.contains("mx_SpaceHierarchy_search")&&(null===(a=t.refs[0])||void 0===a||null===(n=a.current)||void 0===n||n.focus())},handleHomeEnd:!0,handleUpDown:!0},(e=>{let s,{onKeyDownHandler:g}=e;if(p&&(!u||null!=h&&h.length)){const e="join"===(null==t?void 0:t.getMyMembership())&&t.currentState.maySendStateEvent(ee.b.SpaceChild,o.getUserId());let a,c;f.size?a=r.a.createElement(r.a.Fragment,null,r.a.createElement(Yc,{root:p.roomMap.get(t.roomId),roomSet:f,hierarchy:p,parents:new Set,selectedMap:d,onToggleClick:e?w:void 0,onViewRoomClick:(e,t)=>n(o,p,e,t),onJoinRoomClick:e=>((e,t,a)=>{if(e.isGuest())return void v.a.dispatch({action:"require_registration"});const n=e.joinRoom(a,{viaServers:Array.from(t.viaMap.get(a)||[])});return n.then((()=>{v.a.dispatch({action:U.a.JoinRoomReady,roomId:a,metricsTrigger:"SpaceHierarchy"})}),(e=>{rt.b.instance.roomViewStore.showJoinRoomError(e,a)})),n})(o,p,e)})):p.canLoadMore||(a=r.a.createElement("div",{className:"mx_SpaceHierarchy_noResults"},r.a.createElement("h3",null,Object(N.a)("No results found")),r.a.createElement("div",null,Object(N.a)("You may want to try a different search or check for typos.")))),p.canLoadMore&&(c=r.a.createElement("div",{ref:S},r.a.createElement(pn.a,null))),s=r.a.createElement(r.a.Fragment,null,r.a.createElement("div",{className:"mx_SpaceHierarchy_listHeader"},r.a.createElement("h4",{className:"mx_SpaceHierarchy_listHeader_header"},l.trim()?Object(N.a)("Results"):Object(N.a)("Rooms and spaces")),r.a.createElement("div",{className:"mx_SpaceHierarchy_listHeader_buttons"},i,e&&r.a.createElement(Jc,{hierarchy:p,selected:d,setSelected:m,setError:E}))),_&&r.a.createElement("div",{className:"mx_SpaceHierarchy_error"},_),r.a.createElement("ul",{className:"mx_SpaceHierarchy_list",onKeyDown:g,role:"tree","aria-label":Object(N.a)("Space")},a),c)}else s=r.a.createElement(pn.a,null);return r.a.createElement(r.a.Fragment,null,r.a.createElement(ps.a,{className:"mx_SpaceHierarchy_search mx_textinput_icon mx_textinput_search",placeholder:Object(N.a)("Search names and descriptions"),onSearch:c,autoFocus:!0,initialValue:a,onKeyDown:g}),s)}))};!function(e){e[e.Landing=0]="Landing",e[e.PublicCreateRooms=1]="PublicCreateRooms",e[e.PublicShare=2]="PublicShare",e[e.PrivateScope=3]="PrivateScope",e[e.PrivateInvite=4]="PrivateInvite",e[e.PrivateCreateRooms=5]="PrivateCreateRooms",e[e.PrivateExistingRooms=6]="PrivateExistingRooms"}(Qc||(Qc={}));const Zc=e=>{let{space:t}=e;const[a,n,i,s]=Object(ce.q)(),o=Object(ae.a)(oe.a.CreateRooms),l=Object(ae.a)(oe.a.CreateSpaces),c=Object(se.a)("feature_video_rooms"),d=Object(se.a)("feature_element_call_video_rooms");let m=null;if(a){const e=n.current.getBoundingClientRect();m=r.a.createElement(me.e,{left:e.left+window.scrollX+0,top:e.bottom+window.scrollY+8,chevronFace:ce.a.None,onFinished:s,className:"mx_RoomTile_contextMenu",compact:!0},r.a.createElement(me.c,{first:!0},o&&r.a.createElement(r.a.Fragment,null,r.a.createElement(me.b,{label:Object(N.a)("New room"),iconClassName:"mx_RoomList_iconNewRoom",onClick:async e=>{e.preventDefault(),e.stopPropagation(),s(),re.b.trackInteraction("WebSpaceHomeCreateRoomButton",e),await Object(le.g)(t)&&v.a.fire(U.a.UpdateSpaceHierarchy)}}),c&&r.a.createElement(me.b,{label:Object(N.a)("New video room"),iconClassName:"mx_RoomList_iconNewVideoRoom",onClick:async e=>{e.preventDefault(),e.stopPropagation(),s(),await Object(le.g)(t,d?ee.j.UnstableCall:ee.j.ElementVideo)&&v.a.fire(U.a.UpdateSpaceHierarchy)}},r.a.createElement(de.a,null))),r.a.createElement(me.b,{label:Object(N.a)("Add existing room"),iconClassName:"mx_RoomList_iconAddExistingRoom",onClick:e=>{e.preventDefault(),e.stopPropagation(),s(),Object(le.e)(t)}}),l&&r.a.createElement(me.b,{label:Object(N.a)("Add space"),iconClassName:"mx_RoomList_iconPlus",onClick:e=>{e.preventDefault(),e.stopPropagation(),s(),Object(le.h)(t)}},r.a.createElement(de.a,null))))}return r.a.createElement(r.a.Fragment,null,r.a.createElement(ce.b,{kind:"primary",inputRef:n,onClick:i,isExpanded:a,label:Object(N.a)("Add")},Object(N.a)("Add")),m)},ed=e=>{let{space:t}=e;const a=Object(s.useContext)(R.a),n=dn(t),i=a.getUserId(),o=Object(s.useCallback)((()=>{var e;return Aa.a.instance.isOpenForRoom(t.roomId)&&(null===(e=Aa.a.instance.currentCardForRoom(t.roomId))||void 0===e?void 0:e.phase)===Ma.a.SpaceMemberList}),[t.roomId]),l=Object(ie.b)(Aa.a.instance,pt.b,o);let c;Object(le.c)(t)&&Object(ae.a)(oe.a.InviteUsers)&&(c=r.a.createElement(G.a,{kind:"primary",className:"mx_SpaceRoomView_landing_inviteButton",onClick:()=>{Object(le.i)(t)}},Object(N.a)("Invite")));let d,m;"join"===n&&t.currentState.maySendStateEvent(ee.b.SpaceChild,i)&&(d=r.a.createElement(Zc,{space:t})),Object(le.d)(t)&&(m=r.a.createElement(q.a,{className:"mx_SpaceRoomView_landing_settingsButton",onClick:()=>{Object(le.k)(t)},title:Object(N.a)("Settings")}));return r.a.createElement("div",{className:"mx_SpaceRoomView_landing"},r.a.createElement("div",{className:"mx_SpaceRoomView_landing_header"},r.a.createElement(ye.a,{room:t,height:80,width:80,viewAvatarOnClick:!0}),r.a.createElement(fe.b,null)),r.a.createElement("div",{className:"mx_SpaceRoomView_landing_name"},r.a.createElement(In.a,{room:t},(e=>{const t={name:()=>r.a.createElement("h1",null,e)};return Object(N.a)("Welcome to <name/>",{},t)}))),r.a.createElement("div",{className:"mx_SpaceRoomView_landing_infoBar"},r.a.createElement(Jo,{room:t}),r.a.createElement("div",{className:"mx_SpaceRoomView_landing_infoBar_interactive"},r.a.createElement(Yo,{room:t,onlyKnownUsers:!1,numShown:7,onClick:l?void 0:()=>{Aa.a.instance.setCard({phase:Ma.a.SpaceMemberList})}}),c,m)),r.a.createElement(zo,{room:t,className:"mx_SpaceRoomView_landing_topic"}),r.a.createElement(Xc,{space:t,showRoom:$c,additionalButtons:d}))},td=e=>{let{space:t,title:a,description:n,onFinished:i}=e;const[o,l]=Object(s.useState)(!1),[c,d]=Object(s.useState)(""),m=[Object(N.a)("General"),Object(N.a)("Random"),Object(N.a)("Support")],[u,h]=Uc(3,[Object(N.a)("General"),Object(N.a)("Random"),""]),p=new Array(3).fill(0).map(((e,t)=>{const a="roomName"+t;return r.a.createElement(Dn.a,{key:a,name:a,type:"text",label:Object(N.a)("Room name"),placeholder:m[t],value:u[t],onChange:e=>h(t,e.target.value),autoFocus:2===t,disabled:o,autoComplete:"off"})})),g=async e=>{if(e.preventDefault(),!o){d(""),l(!0);try{const e=t.getJoinRule()===ka.c.Public,a=u.map((e=>e.trim())).filter(Boolean),n=await Promise.all(a.map((a=>Object(Ac.b)({createOpts:{preset:e?ka.d.PublicChat:ka.d.PrivateChat,name:a},spinner:!1,encryption:!1,andView:!1,inlineErrors:!0,parentSpace:t,joinRule:e?void 0:ka.c.Restricted,suggested:!0}))));i(n[0])}catch(e){ga.a.error("Failed to create initial space rooms",e),d(Object(N.a)("Failed to create initial space rooms"))}l(!1)}};let v=e=>{e.preventDefault(),i()},b=Object(N.a)("Skip for now");return u.some((e=>e.trim()))&&(v=g,b=o?Object(N.a)("Creating rooms…"):Object(N.a)("Continue")),r.a.createElement("div",null,r.a.createElement("h1",null,a),r.a.createElement("div",{className:"mx_SpaceRoomView_description"},n),c&&r.a.createElement("div",{className:"mx_SpaceRoomView_errorText"},c),r.a.createElement("form",{onSubmit:v,id:"mx_SpaceSetupFirstRooms"},p),r.a.createElement("div",{className:"mx_SpaceRoomView_buttons"},r.a.createElement(G.a,{kind:"primary",disabled:o,onClick:v,element:"input",type:"submit",form:"mx_SpaceSetupFirstRooms",value:b})))},ad=e=>{let{space:t,onFinished:a}=e;return r.a.createElement("div",null,r.a.createElement("h1",null,Object(N.a)("What do you want to organise?")),r.a.createElement("div",{className:"mx_SpaceRoomView_description"},Object(N.a)("Pick rooms or conversations to add. This is just a space for you, no one will be informed. You can add more later.")),r.a.createElement(Fc.a,{space:t,emptySelectionButton:r.a.createElement(G.a,{kind:"primary",onClick:a},Object(N.a)("Skip for now")),filterPlaceholder:Object(N.a)("Search for rooms or spaces"),onFinished:a,roomsRenderer:Fc.f,dmsRenderer:Fc.e}))},nd=e=>{var t;let{justCreatedOpts:a,space:n,onFinished:i,firstRoomId:s}=e;return r.a.createElement("div",{className:"mx_SpaceRoomView_publicShare"},r.a.createElement("h1",null,Object(N.a)("Share %(name)s",{name:(null==a||null===(t=a.createOpts)||void 0===t?void 0:t.name)||n.name})),r.a.createElement("div",{className:"mx_SpaceRoomView_description"},Object(N.a)("It's just you at the moment, it will be even better with others.")),r.a.createElement(Bc.a,{space:n}),r.a.createElement("div",{className:"mx_SpaceRoomView_buttons"},r.a.createElement(G.a,{kind:"primary",onClick:i},s?Object(N.a)("Go to my first room"):Object(N.a)("Go to my space"))))},id=e=>{var t;let{space:a,justCreatedOpts:n,onFinished:i}=e;return r.a.createElement("div",{className:"mx_SpaceRoomView_privateScope"},r.a.createElement("h1",null,Object(N.a)("Who are you working with?")),r.a.createElement("div",{className:"mx_SpaceRoomView_description"},Object(N.a)("Make sure the right people have access to %(name)s",{name:(null==n||null===(t=n.createOpts)||void 0===t?void 0:t.name)||a.name})),r.a.createElement(G.a,{className:"mx_SpaceRoomView_privateScope_justMeButton",onClick:()=>{i(!1)}},r.a.createElement("h3",null,Object(N.a)("Just me")),r.a.createElement("div",null,Object(N.a)("A private space to organise your rooms"))),r.a.createElement(G.a,{className:"mx_SpaceRoomView_privateScope_meAndMyTeammatesButton",onClick:()=>{i(!0)}},r.a.createElement("h3",null,Object(N.a)("Me and my teammates")),r.a.createElement("div",null,Object(N.a)("A private space for you and your teammates"))))},sd=Object(An.a)({rules:[{key:"email",test:e=>{let{value:t}=e;return!t||Lc.a(t)},invalid:()=>Object(N.a)("Doesn't look like a valid email address")}]}),rd=e=>{let{space:t,onFinished:a}=e;const[n,i]=Object(s.useState)(!1),[o,l]=Object(s.useState)(""),c=[Object(s.useRef)(),Object(s.useRef)(),Object(s.useRef)()],[d,m]=Uc(3,""),u=new Array(3).fill(0).map(((e,t)=>{const a="emailAddress"+t;return r.a.createElement(Dn.a,{key:a,name:a,type:"text",label:Object(N.a)("Email address"),placeholder:Object(N.a)("Email"),value:d[t],onChange:e=>m(t,e.target.value),ref:c[t],onValidate:sd,autoFocus:0===t,disabled:n})})),h=async e=>{if(e.preventDefault(),n)return;l("");for(const e of c){if(!1===await e.current.validate({allowEmpty:!0}))return e.current.focus(),void e.current.validate({allowEmpty:!0,focused:!0})}i(!0);const s=d.map((e=>e.trim())).filter(Boolean);try{const e=await Object(us.a)(t.roomId,s),n=Object.keys(e.states).filter((t=>"error"===e.states[t]));n.length>0?(ga.a.log("Failed to invite users to space: ",e),l(Object(N.a)("Failed to invite the following users to your space: %(csvUsers)s",{csvUsers:n.join(", ")}))):a()}catch(e){ga.a.error("Failed to invite users to space: ",e),l(Object(N.a)("We couldn't invite those users. Please check the users you want to invite and try again."))}i(!1)};let p=e=>{e.preventDefault(),a()},g=Object(N.a)("Skip for now");return d.some((e=>e.trim()))&&(p=h,g=n?Object(N.a)("Inviting…"):Object(N.a)("Continue")),r.a.createElement("div",{className:"mx_SpaceRoomView_inviteTeammates"},r.a.createElement("h1",null,Object(N.a)("Invite your teammates")),r.a.createElement("div",{className:"mx_SpaceRoomView_description"},Object(N.a)("Make sure the right people have access. You can invite more later.")),r.a.createElement("div",{className:"mx_SpaceRoomView_inviteTeammates_betaDisclaimer"},Object(N.a)("<b>This is an experimental feature.</b> For now, new users receiving an invite will have to open the invite on <link/> to actually join.",{},{b:e=>r.a.createElement("b",null,e),link:()=>r.a.createElement("a",{href:"https://app.element.io/",rel:"noreferrer noopener",target:"_blank"},"app.element.io")})),o&&r.a.createElement("div",{className:"mx_SpaceRoomView_errorText"},o),r.a.createElement("form",{onSubmit:p,id:"mx_SpaceSetupPrivateInvite"},u),r.a.createElement("div",{className:"mx_SpaceRoomView_inviteTeammates_buttons"},r.a.createElement(G.a,{className:"mx_SpaceRoomView_inviteTeammates_inviteDialogButton",onClick:()=>Object(us.e)(t.roomId)},Object(N.a)("Invite by username"))),r.a.createElement("div",{className:"mx_SpaceRoomView_buttons"},r.a.createElement(G.a,{kind:"primary",disabled:n,onClick:p,element:"input",type:"submit",form:"mx_SpaceSetupPrivateInvite",value:g})))};class od extends r.a.PureComponent{constructor(e,t){var a;super(e,t),i()(this,"context",void 0),i()(this,"creator",void 0),i()(this,"dispatcherRef",void 0),i()(this,"onMyMembership",((e,t)=>{e.roomId===this.props.space.roomId&&this.setState({myMembership:t})})),i()(this,"onRightPanelStoreUpdate",(()=>{this.setState({showRightPanel:Aa.a.instance.isOpenForRoom(this.props.space.roomId)})})),i()(this,"onAction",(e=>{if(e.action!==U.a.ViewRoom||e.room_id!==this.props.space.roomId){if(e.action===U.a.ViewUser||"view_3pid_invite"===e.action)if(e.action===U.a.ViewUser&&e.member){const t={phase:Ma.a.SpaceMemberInfo,state:{spaceId:this.props.space.roomId,member:e.member}};e.push?Aa.a.instance.pushCard(t):Aa.a.instance.setCards([{phase:Ma.a.SpaceMemberList,state:{spaceId:this.props.space.roomId}},t])}else"view_3pid_invite"===e.action&&e.event?Aa.a.instance.setCard({phase:Ma.a.Space3pidMemberInfo,state:{spaceId:this.props.space.roomId,memberInfoEvent:e.event}}):Aa.a.instance.setCard({phase:Ma.a.SpaceMemberList,state:{spaceId:this.props.space.roomId}})}else this.setState({phase:Qc.Landing})})),i()(this,"goToFirstRoom",(async()=>{this.state.firstRoomId?v.a.dispatch({action:U.a.ViewRoom,room_id:this.state.firstRoomId,metricsTrigger:void 0}):this.setState({phase:Qc.Landing})}));let n=Qc.Landing;this.creator=null===(a=this.props.space.currentState.getStateEvents(ee.b.RoomCreate,""))||void 0===a?void 0:a.getSender();this.props.justCreatedOpts&&t.getUserId()===this.creator&&(n=this.props.justCreatedOpts.createOpts.preset===ka.d.PublicChat?Qc.PublicCreateRooms:Qc.PrivateScope),this.state={phase:n,showRightPanel:Aa.a.instance.isOpenForRoom(this.props.space.roomId),myMembership:this.props.space.getMyMembership()},this.dispatcherRef=v.a.register(this.onAction),Aa.a.instance.on(pt.b,this.onRightPanelStoreUpdate)}componentDidMount(){this.context.on(te.d.MyMembership,this.onMyMembership)}componentWillUnmount(){v.a.unregister(this.dispatcherRef),Aa.a.instance.off(pt.b,this.onRightPanelStoreUpdate),this.context.off(te.d.MyMembership,this.onMyMembership)}renderBody(){var e,t;switch(this.state.phase){case Qc.Landing:return"join"===this.state.myMembership?r.a.createElement(ed,{space:this.props.space}):r.a.createElement(Qo,{room:this.props.space,onJoinButtonClicked:this.props.onJoinButtonClicked,onRejectButtonClicked:this.props.onRejectButtonClicked});case Qc.PublicCreateRooms:return r.a.createElement(td,{space:this.props.space,title:Object(N.a)("What are some things you want to discuss in %(spaceName)s?",{spaceName:(null===(e=this.props.justCreatedOpts)||void 0===e||null===(t=e.createOpts)||void 0===t?void 0:t.name)||this.props.space.name}),description:r.a.createElement(r.a.Fragment,null,Object(N.a)("Let's create a room for each of them."),r.a.createElement("br",null),Object(N.a)("You can add more later too, including already existing ones.")),onFinished:e=>this.setState({phase:Qc.PublicShare,firstRoomId:e})});case Qc.PublicShare:return r.a.createElement(nd,{justCreatedOpts:this.props.justCreatedOpts,space:this.props.space,onFinished:this.goToFirstRoom,firstRoomId:this.state.firstRoomId});case Qc.PrivateScope:return r.a.createElement(id,{space:this.props.space,justCreatedOpts:this.props.justCreatedOpts,onFinished:e=>{this.setState({phase:e?Qc.PrivateCreateRooms:Qc.PrivateExistingRooms})}});case Qc.PrivateInvite:return r.a.createElement(rd,{space:this.props.space,onFinished:()=>this.setState({phase:Qc.Landing})});case Qc.PrivateCreateRooms:return r.a.createElement(td,{space:this.props.space,title:Object(N.a)("What projects are your team working on?"),description:r.a.createElement(r.a.Fragment,null,Object(N.a)("We'll create rooms for each of them."),r.a.createElement("br",null),Object(N.a)("You can add more later too, including already existing ones.")),onFinished:e=>this.setState({phase:Qc.PrivateInvite,firstRoomId:e})});case Qc.PrivateExistingRooms:return r.a.createElement(ad,{space:this.props.space,onFinished:()=>this.setState({phase:Qc.Landing})})}}render(){const e=this.state.showRightPanel&&this.state.phase===Qc.Landing?r.a.createElement(jo,{room:this.props.space,resizeNotifier:this.props.resizeNotifier}):null;return r.a.createElement("main",{className:"mx_SpaceRoomView"},r.a.createElement(Do.a,null,r.a.createElement(Da,{panel:e,resizeNotifier:this.props.resizeNotifier},this.renderBody())))}}i()(od,"contextType",R.a);var ld=a(805);class cd extends r.a.PureComponent{render(){return r.a.createElement("div",{className:"mx_TopUnreadMessagesBar"},r.a.createElement(G.a,{className:"mx_TopUnreadMessagesBar_scrollUp",title:Object(N.a)("Jump to first unread message."),onClick:this.props.onScrollUpClick}),r.a.createElement(G.a,{className:"mx_TopUnreadMessagesBar_markAsRead",title:Object(N.a)("Mark all as read"),onClick:this.props.onCloseClick}))}}var dd=a(180),md=a(299),ud=a(907),hd=a(855),pd=a(806);const gd=e=>{let{text:t}=e;return r.a.createElement("div",{className:"mx_LargeLoader"},r.a.createElement(pn.a,{w:45,h:45}),r.a.createElement("div",{className:"mx_LargeLoader_text"},t))};var vd=a(498),bd=a(400);class fd extends r.a.Component{constructor(e,t){super(e,t),i()(this,"context",void 0),i()(this,"callEventGroupers",new Map),this.buildLegacyCallEventGroupers(this.props.timeline)}buildLegacyCallEventGroupers(e){this.callEventGroupers=Object(lr.c)(this.callEventGroupers,e)}render(){const e=this.props.timeline,t=e[this.props.ourEventsIndexes[0]],a=t.getId(),n=t.getTs(),i=[r.a.createElement(vd.a,{key:n+"-search",roomId:t.getRoomId(),ts:n})],s=b.b.getValue("layout"),o=b.b.getValue("showTwelveHourTimestamps"),l=b.b.getValue("alwaysShowTimestamps");for(let t=0;t<e.length;t++){var c;const n=e[t];let u;const h=!this.props.ourEventsIndexes.includes(t);if(h||(u=this.props.searchHighlights),Object(Fn.c)(n,null===(c=this.context)||void 0===c?void 0:c.showHiddenEvents)){var d;const c=e[t-1],p=c&&!Object(En.o)(c.getDate()||void 0,n.getDate()||void 0)&&Object(or.b)(c,n,null===(d=this.context)||void 0===d?void 0:d.showHiddenEvents,Qa.a.Search);let g=!0;const v=e[t+1];if(v){var m;g=Object(En.o)(n.getDate()||void 0,v.getDate()||void 0)||n.getSender()!==v.getSender()||!Object(or.b)(n,v,null===(m=this.context)||void 0===m?void 0:m.showHiddenEvents,Qa.a.Search)}i.push(r.a.createElement(bd.a,{key:`${a}+${t}`,mxEvent:n,layout:s,contextual:h,highlights:u,permalinkCreator:this.props.permalinkCreator,highlightLink:this.props.resultLink,onHeightChanged:this.props.onHeightChanged,isTwelveHour:o,alwaysShowTimestamps:l,lastInSection:g,continuation:p,callEventGrouper:this.callEventGroupers.get(n.getContent().call_id)}))}}return r.a.createElement("li",{"data-scroll-tokens":a},r.a.createElement("ol",null,i))}}i()(fd,"contextType",Qa.b);var yd=a(420);async function Ed(e,t,a){const n=lt.a.get(),i={limit:10};void 0!==t&&(i.rooms=[t]);const s={search_categories:{room_events:{search_term:e,filter:i,order_by:yd.a.Recent,event_context:{before_limit:1,after_limit:1,include_profile:!0}}}};return{response:await n.search({body:s},a),query:s}}async function _d(e,t,a){const n=lt.a.get(),i=await Ed(e,t,a),s={abortSignal:a,_query:i.query,results:[],highlights:[]};return n.processRoomEventsSearch(s,i.response)}function Sd(e,t){const a=e.result,n=t.result;return a.origin_server_ts>n.origin_server_ts?-1:a.origin_server_ts<n.origin_server_ts?1:0}async function wd(e,t){const a=Zs.a.get(),n={search_term:e,before_limit:1,after_limit:1,limit:10,order_by_recency:!0,room_id:void 0};void 0!==t&&(n.room_id=t);const i=await a.search(n);n.next_batch=i.next_batch;const s={response:i,query:n};return s}function Od(e,t){try{const a=e[e.length-1].result,n=t[t.length-1].result;return a.origin_server_ts<=n.origin_server_ts?-1:1}catch{return 0}}function Cd(e,t,a,n){const i=a.concat(n).sort(Sd);t.results=i.slice(0,10),e.cachedEvents=i.slice(10)}function xd(e,t,a){const n=function(e,t,a){const n={},i=e.cachedEvents;let s=e.oldestEventFrom;return n.highlights=e.highlights,t&&a&&a.results?(Od(t.results,a.results)<0&&(s="local"),Cd(e,n,t.results,a.results),n.highlights=t.highlights.concat(a.highlights)):t?(Od(t.results,i)<0&&(s="local"),Cd(e,n,t.results,i)):a&&a.results?(Od(a.results,i)<0&&(s="server"),Cd(e,n,a.results,i)):(n.results=i,e.cachedEvents=[]),e.oldestEventFrom=s,n}(e,t,a);return e.count?n.count=e.count:n.count=t.count+a.count,t&&(e.seshatQuery.next_batch=t.next_batch),a&&(e.serverSideNextBatch=a.next_batch),e.seshatQuery.next_batch?n.next_batch=e.seshatQuery.next_batch:e.serverSideNextBatch&&(n.next_batch=e.serverSideNextBatch),!n.next_batch&&e.cachedEvents.length>0&&(n.next_batch="cached"),n}function kd(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];for(const t of e){const e=t.context.getTimeline();for(const t of e){const e=t.event;e.curve25519Key&&(t.makeEncrypted(ee.b.RoomMessageEncrypted,{algorithm:e.algorithm},e.curve25519Key,e.ed25519Key),t.forwardingCurve25519KeyChain=e.forwardingCurve25519KeyChain,delete e.curve25519Key,delete e.ed25519Key,delete e.algorithm,delete e.forwardingCurve25519KeyChain)}}}function jd(e,t,a){let n;return n=void 0!==t?lt.a.get().isRoomEncrypted(t)?async function(e,t){const a={results:[],highlights:[]};if(""===e)return a;const n=await wd(e,t);a.seshatQuery=n.query;const i={search_categories:{room_events:n.response}},s=lt.a.get().processRoomEventsSearch(a,i);return kd(s.results),s}(e,t):_d(e,t,a):async function(e,t){const a=lt.a.get(),n=Ed(e,void 0,t),i=wd(e);await Promise.all([n,i]);const s=await i,r=await n,o=r.query,l=r.response,c=s.query,d=s.response,m={seshatQuery:c,_query:o,serverSideNextBatch:l.search_categories.room_events.next_batch,cachedEvents:[],oldestEventFrom:"server",results:[],highlights:[]},u={search_categories:{room_events:xd(m,d,l.search_categories.room_events)}},h=a.processRoomEventsSearch(m,u);return kd(h.results),h}(e,a),n}function Rd(e){const t=lt.a.get(),a=e.seshatQuery,n=e._query;if(a){if(n){const t=async function(e){const t=Zs.a.get(),a=lt.a.get(),n=e.seshatQuery,i=e.oldestEventFrom;let s,r,o;if(!n.next_batch||e.serverSideNextBatch&&"server"!==i||(s=await t.search(n)),e.serverSideNextBatch&&("local"===i||!n.next_batch)){const t={body:e._query,next_batch:e.serverSideNextBatch};r=await a.search(t)}r&&(o=r.search_categories.room_events);const l={search_categories:{room_events:xd(e,s,o)}},c=e.results?e.results.length:0,d=a.processRoomEventsSearch(e,l),m=d.results.length-c;return kd(d.results.slice(Math.max(d.results.length-m,0))),e.pendingRequest=null,d}(e);return e.pendingRequest=t,t}{const t=async function(e){const t=Zs.a.get(),a=e.seshatQuery,n=await t.search(a);e.seshatQuery.next_batch=n.next_batch;const i=n.results.length,s={search_categories:{room_events:n}},r=lt.a.get().processRoomEventsSearch(e,s);return kd(r.results.slice(Math.max(r.results.length-i,0))),e.pendingRequest=void 0,r}(e);return e.pendingRequest=t,t}}return t.backPaginateRoomEventsSearch(e)}function Id(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}let Td=function(e){};const Nd=Object(s.forwardRef)(((e,t)=>{let{term:a,scope:n,promise:o,abortController:l,resizeNotifier:c,permalinkCreator:d,className:m,onUpdate:u}=e;const h=Object(s.useContext)(R.a),p=Object(s.useContext)(Qa.b),[g,v]=Object(s.useState)(!0),[b,f]=Object(s.useState)(null),[y,E]=Object(s.useState)(null),_=Object(s.useRef)(!1),S=Object(s.useCallback)((e=>(v(!0),e.then((async e=>{if(Td("search complete"),_.current)return ga.a.error("Discarding stale search results"),!1;let t=e.highlights;t.includes(a)||(t=t.concat(a)),t=t.sort((function(e,t){return t.length-e.length}));for(const t of e.results)for(const e of t.context.getTimeline()){if(!e.getServerAggregatedRelation(xa.d.name)||e.getThread())continue;const t=h.getRoom(e.getRoomId()),a=null==t?void 0:t.findThreadForEvent(e);a?e.setThread(a):null==t||t.createThread(e.getId(),e,[],!0)}f(t),E(function(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?Id(Object(a),!0).forEach((function(t){i()(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):Id(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}({},e))}),(e=>{var t;return _.current?(ga.a.error("Discarding stale search results"),!1):(ga.a.error("Search failed",e),H.b.createDialog(en.a,{title:Object(N.a)("Search failed"),description:null!==(t=null==e?void 0:e.message)&&void 0!==t?t:Object(N.a)("Server may be unavailable, overloaded, or search timed out :(")}),!1)})).finally((()=>{v(!1)})))),[h,a]);if(Object(s.useEffect)((()=>(_.current=!1,S(o),()=>{_.current=!0,null==l||l.abort()})),[]),void 0===(null==y?void 0:y.count))return r.a.createElement("div",{className:"mx_RoomView_messagePanel mx_RoomView_messagePanelSearchSpinner","data-testid":"messagePanelSearchSpinner"});const w=[];var O;(g&&w.push(r.a.createElement("li",{key:"search-spinner"},r.a.createElement(pn.a,null))),y.next_batch)||(null!=y&&null!==(O=y.results)&&void 0!==O&&O.length?w.push(r.a.createElement("li",{key:"search-top-marker"},r.a.createElement("h2",{className:"mx_RoomView_topMarker"},Object(N.a)("No more results")))):w.push(r.a.createElement("li",{key:"search-top-marker"},r.a.createElement("h2",{className:"mx_RoomView_topMarker"},Object(N.a)("No results")))));const C=()=>{const e=t.current;null==e||e.checkScroll()};let x,k=[],j=[];for(let e=((null==y||null===(I=y.results)||void 0===I?void 0:I.length)||0)-1;e>=0;e--){var I;const t=y.results[e],a=t.context.getEvent(),i=a.getRoomId(),s=h.getRoom(i);if(!s){ga.a.log("Hiding search result from an unknown room",i);continue}if(!Object(Fn.c)(a,p.showHiddenEvents))continue;n===Xo.All&&i!==x&&(w.push(r.a.createElement("li",{key:a.getId()+"-room"},r.a.createElement("h2",null,Object(N.a)("Room"),": ",s.name))),x=i);const o="#/room/"+i+"/"+a.getId(),l=t.context.getTimeline(),c=e>0?y.results[e-1].context.getTimeline():[];if(e>0&&l[l.length-1].getId()==c[0].getId()){if(0==k.length){for(let e=0==k.length?0:1;e<t.context.getTimeline().length;e++)k.push(l[e]);j.push(t.context.getOurEventIndex())}for(let e=1;e<c.length;e++)k.push(c[e]);j.push(j[j.length-1]+y.results[e-1].context.getOurEventIndex()+1)}else 0==k.length&&(k=t.context.getTimeline(),j=[],j.push(t.context.getOurEventIndex())),w.push(r.a.createElement(fd,{key:a.getId(),timeline:k,ourEventsIndexes:j,searchHighlights:null!=b?b:[],resultLink:o,permalinkCreator:d,onHeightChanged:C})),j=[],k=[]}return r.a.createElement(No.a,{ref:t,className:"mx_RoomView_searchResultsPanel "+m,onFillRequest:async e=>{if(!e)return!1;if(!y.next_batch)return Td("no more search results"),!1;Td("requesting more search results");const t=function(e){const t=Zs.a.get(),a=lt.a.get();return e.pendingRequest?e.pendingRequest:null===t?a.backPaginateRoomEventsSearch(e):Rd(e)}(y);return S(t)},resizeNotifier:c},r.a.createElement("li",{className:"mx_RoomView_scrollheader"}),w)}));var Dd=a(383);const Pd=["upgradeRecommendation"],Md=["upgradeRecommendation"];function Ad(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function Ld(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?Ad(Object(a),!0).forEach((function(t){i()(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):Ad(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}let Ud=function(e){};const Fd="sandbox"in document.createElement("iframe");var Bd;function Vd(e){const t=Object(s.useContext)(Qa.b),a=t.room,n=t.room.currentState.getStateEvents(ee.b.RoomEncryption)[0];let i;n&&(i=r.a.createElement(hd.a,{mxEvent:n}));const o=()=>{a.state=md.c.NEW,v.b.dispatch({action:"local_room_event",roomId:a.roomId})};let l,c;if(a.isError){const e=r.a.createElement(G.a,{onClick:o,className:"mx_RoomStatusBar_unsentRetry"},Object(N.a)("Retry"));l=r.a.createElement(pd.a,{title:Object(N.a)("Some of your messages have not been sent"),notificationState:Oe.a.RED_EXCLAMATION,buttons:e})}else c=r.a.createElement(Xr,{room:t.room,resizeNotifier:e.resizeNotifier,permalinkCreator:e.permalinkCreator});return r.a.createElement("div",{className:"mx_RoomView mx_RoomView--local"},r.a.createElement(Do.a,null,r.a.createElement(xc,{room:t.room,searchInfo:null,inRoom:!0,onSearchClick:null,onInviteClick:null,onForgetClick:null,e2eStatus:Ja.Normal,onAppsClick:null,appsShown:!1,excludedRightPanelPhaseButtons:[],showButtons:!1,enableRoomOptionsMenu:!1,viewingCall:!1,activeCall:null}),r.a.createElement("main",{className:"mx_RoomView_body",ref:e.roomView},r.a.createElement(ro,{parent:e.roomView.current,onFileDrop:e.onFileDrop}),r.a.createElement("div",{className:"mx_RoomView_timeline"},r.a.createElement(No.a,{className:"mx_RoomView_messagePanel",resizeNotifier:e.resizeNotifier},i,r.a.createElement(ud.a,null))),l,c)))}function Wd(e){const t=Object(s.useContext)(Qa.b),a=Object(N.a)("We're creating a room with %(names)s",{names:e.names});return r.a.createElement("div",{className:"mx_RoomView mx_RoomView--local"},r.a.createElement(Do.a,null,r.a.createElement(xc,{room:t.room,searchInfo:null,inRoom:!0,onSearchClick:null,onInviteClick:null,onForgetClick:null,e2eStatus:Ja.Normal,onAppsClick:null,appsShown:!1,excludedRightPanelPhaseButtons:[],showButtons:!1,enableRoomOptionsMenu:!1,viewingCall:!1,activeCall:null}),r.a.createElement("div",{className:"mx_RoomView_body"},r.a.createElement(gd,{text:a}))))}(function(e){e[e.Timeline=0]="Timeline",e[e.MaximisedWidget=1]="MaximisedWidget",e[e.Call=2]="Call"})(Bd||(Bd={}));class Hd extends r.a.Component{constructor(e,t){var a,n;super(e,t),a=this,i()(this,"dispatcherRef",void 0),i()(this,"settingWatchers",void 0),i()(this,"unmounted",!1),i()(this,"permalinkCreators",{}),i()(this,"roomView",Object(s.createRef)()),i()(this,"searchResultsPanel",Object(s.createRef)()),i()(this,"messagePanel",void 0),i()(this,"roomViewBody",Object(s.createRef)()),i()(this,"context",void 0),i()(this,"onIsResizing",(e=>{this.setState({resizing:e})})),i()(this,"onWidgetStoreUpdate",(()=>{this.state.room&&this.checkWidgets(this.state.room)})),i()(this,"onWidgetEchoStoreUpdate",(()=>{this.state.room&&this.checkWidgets(this.state.room)})),i()(this,"onWidgetLayoutChange",(()=>{this.state.room&&(v.a.dispatch({action:"appsDrawer",show:!0}),this.context.widgetLayoutStore.hasMaximisedWidget(this.state.room)&&this.context.rightPanelStore.setCard({phase:Ma.a.Timeline}),this.checkWidgets(this.state.room))})),i()(this,"checkWidgets",(e=>{this.setState({hasPinnedWidgets:this.context.widgetLayoutStore.hasPinnedWidgets(e),mainSplitContentType:this.getMainSplitContentType(e),showApps:this.shouldShowApps(e)})})),i()(this,"getMainSplitContentType",(e=>b.b.getValue("feature_group_calls")&&this.context.roomViewStore.isViewingCall()||pc(e)?Bd.Call:this.context.widgetLayoutStore.hasMaximisedWidget(e)?Bd.MaximisedWidget:Bd.Timeline)),i()(this,"onRoomViewStoreUpdate",(async e=>{if(this.unmounted)return;if(!e&&this.state.roomId!==this.context.roomViewStore.getRoomId())return;const t=this.context.roomViewStore.getRoomId(),n=this.context.client.getRoom(t),i={roomId:t,roomAlias:this.context.roomViewStore.getRoomAlias(),roomLoading:this.context.roomViewStore.isRoomLoading(),roomLoadError:this.context.roomViewStore.getRoomLoadError(),joining:this.context.roomViewStore.isJoining(),replyToEvent:this.context.roomViewStore.getQuotingEvent(),shouldPeek:this.state.matrixClientIsReady&&this.context.roomViewStore.shouldPeek(),showReadReceipts:b.b.getValue("showReadReceipts",t),showRedactions:b.b.getValue("showRedactions",t),showJoinLeaves:b.b.getValue("showJoinLeaves",t),showAvatarChanges:b.b.getValue("showAvatarChanges",t),showDisplaynameChanges:b.b.getValue("showDisplaynameChanges",t),wasContextSwitch:this.context.roomViewStore.getWasContextSwitch(),mainSplitContentType:null===n?void 0:this.getMainSplitContentType(n),initialEventId:null,showRightPanel:this.context.rightPanelStore.isOpenForRoom(t),activeCall:jc.a.instance.getActiveCall(t)};var s;this.state.mainSplitContentType!==Bd.Timeline&&i.mainSplitContentType===Bd.Timeline&&this.context.rightPanelStore.isOpen&&this.context.rightPanelStore.currentCard.phase===Ma.a.Timeline&&this.context.rightPanelStore.roomPhaseHistory.some((e=>e.phase===Ma.a.Timeline))&&(this.context.rightPanelStore.setCard({phase:Ma.a.RoomSummary}),this.context.rightPanelStore.togglePanel(null!==(s=this.state.roomId)&&void 0!==s?s:null),i.showRightPanel=!1);const r=this.context.roomViewStore.getInitialEventId();if(r){var o,l;let e=null==n?void 0:n.findEventById(r);e||(e=await Object(dd.f)(this.context.client,t,r)),i.initialEventPixelOffset=null;const a=null===(o=e)||void 0===o?void 0:o.getThread();var c;if(!a||null!==(l=e)&&void 0!==l&&l.isThreadRoot)i.initialEventId=r,i.isInitialEventHighlighted=this.context.roomViewStore.isInitialEventHighlighted(),i.initialEventScrollIntoView=this.context.roomViewStore.initialEventScrollIntoView(),a&&null!==(c=e)&&void 0!==c&&c.isThreadRoot&&v.a.dispatch({action:U.a.ShowThread,rootEvent:a.rootEvent,initialEvent:e,highlighted:this.context.roomViewStore.isInitialEventHighlighted(),scroll_into_view:this.context.roomViewStore.initialEventScrollIntoView()});else v.a.dispatch({action:U.a.ShowThread,rootEvent:a.rootEvent,initialEvent:e,highlighted:this.context.roomViewStore.isInitialEventHighlighted(),scroll_into_view:this.context.roomViewStore.initialEventScrollIntoView()})}if(this.settingWatchers=this.settingWatchers.concat([b.b.watchSetting("showReadReceipts",t,(function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];let[,,,i]=t;return a.setState({showReadReceipts:i})})),b.b.watchSetting("showRedactions",t,(function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];let[,,,i]=t;return a.setState({showRedactions:i})})),b.b.watchSetting("showJoinLeaves",t,(function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];let[,,,i]=t;return a.setState({showJoinLeaves:i})})),b.b.watchSetting("showAvatarChanges",t,(function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];let[,,,i]=t;return a.setState({showAvatarChanges:i})})),b.b.watchSetting("showDisplaynameChanges",t,(function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];let[,,,i]=t;return a.setState({showDisplaynameChanges:i})}))]),e||!this.state.shouldPeek||i.shouldPeek||this.context.client.stopPeeking(),ga.a.log("RVS update:",i.roomId,i.roomAlias,"loading?",i.roomLoading,"joining?",i.joining,"initial?",e,"shouldPeek?",i.shouldPeek),e&&(i.room=this.context.client.getRoom(i.roomId)||void 0,i.room&&(i.showApps=this.shouldShowApps(i.room),this.onRoomLoaded(i.room))),null===this.state.roomId&&null!==i.roomId&&!i.initialEventId){const e=Io.getScrollState(i.roomId);e&&(i.initialEventId=e.focussedEvent,i.initialEventPixelOffset=e.pixelOffset)}var d,m;this.state.timelineRenderingType===Qa.a.Search&&this.state.initialEventId!==i.initialEventId&&(i.timelineRenderingType=Qa.a.Room,null===(d=this.state.search)||void 0===d||null===(m=d.abortController)||void 0===m||m.abort(),i.search=void 0);this.setState(i),e&&this.setupRoom(i.room,i.roomId,i.joining,i.shouldPeek)})),i()(this,"onActiveCalls",(()=>{if(void 0===this.state.roomId)return;const e=jc.a.instance.getActiveCall(this.state.roomId);null===e&&v.a.dispatch({action:U.a.ViewRoom,room_id:this.state.roomId,view_call:!1,metricsTrigger:void 0},!0),this.setState({activeCall:e})})),i()(this,"getRoomId",(()=>this.state.room?this.state.room.roomId:this.state.roomId)),i()(this,"onRightPanelStoreUpdate",(()=>{this.setState({showRightPanel:this.context.rightPanelStore.isOpenForRoom(this.state.roomId)})})),i()(this,"onPageUnload",(e=>Ia.a.sharedInstance().getCurrentUploads().length>0?e.returnValue=Object(N.a)("You seem to be uploading files, are you sure you want to quit?"):this.getCallForRoom()&&"ended"!==this.state.callState?e.returnValue=Object(N.a)("You seem to be in a call, are you sure you want to quit?"):void 0)),i()(this,"onReactKeyDown",(e=>{let t=!1;switch(Object(J.a)().getRoomAction(e)){case W.h.DismissReadMarker:this.messagePanel.forgetReadMarker(),this.jumpToLiveTimeline(),t=!0;break;case W.h.JumpToOldestUnread:this.jumpToReadMarker(),t=!0;break;case W.h.UploadFile:v.a.dispatch({action:"upload_file",context:Qa.a.Room},!0),t=!0}t&&(e.stopPropagation(),e.preventDefault())})),i()(this,"onCallState",(e=>{if(!e)return;const t=this.getCallForRoom();this.setState({callState:t?t.state:null})})),i()(this,"onAction",(async e=>{var t;switch(e.action){case"message_sent":this.checkDesktopNotifications();break;case"post_sticker_message":this.injectSticker(e.data.content.url,e.data.content.info,e.data.description||e.data.name,e.data.threadId);break;case"picture_snapshot":Ia.a.sharedInstance().sendContentListToRoom([e.file],this.state.room.roomId,null,this.context.client);break;case"notifier_enabled":case U.a.UploadStarted:case U.a.UploadFinished:case U.a.UploadCanceled:this.forceUpdate();break;case"appsDrawer":this.setState({showApps:e.show});break;case"reply_to_event":!this.unmounted&&this.state.search&&(null===(t=e.event)||void 0===t?void 0:t.getRoomId())===this.state.roomId&&e.context===Qa.a.Search&&this.onCancelSearchClick();break;case"MatrixActions.sync":var a;if(!this.state.matrixClientIsReady)this.setState({matrixClientIsReady:null===(a=this.context.client)||void 0===a?void 0:a.isInitialSyncComplete()},(()=>{this.onRoomViewStoreUpdate(!0)}));break;case"focus_search":this.onSearchClick();break;case"local_room_event":this.onLocalRoomEvent(e.roomId);break;case U.a.EditEvent:{if(e.timelineRenderingType!==this.state.timelineRenderingType)return;const t=e.event?new Zr(e.event):null;this.setState({editState:t},(()=>{var t;e.event&&(null===(t=this.messagePanel)||void 0===t||t.scrollToEventIfNeeded(e.event.getId()))}));break}case U.a.ComposerInsert:{if(e.composerType)break;let t=e.timelineRenderingType;if(t===Qa.a.Thread)break;this.state.timelineRenderingType===Qa.a.Search&&e.timelineRenderingType===Qa.a.Search&&(await this.onCancelSearchClick(),t=Qa.a.Room),v.a.dispatch(Ld(Ld({},e),{},{timelineRenderingType:t,composerType:this.state.editState?oo.a.Edit:oo.a.Send}));break}case U.a.FocusAComposer:v.a.dispatch(Ld(Ld({},e),{},{action:this.state.editState?U.a.FocusEditMessageComposer:U.a.FocusSendMessageComposer}));break;case"scroll_to_bottom":var n;if(e.timelineRenderingType===Qa.a.Room)null===(n=this.messagePanel)||void 0===n||n.jumpToLiveTimeline()}})),i()(this,"onRoomTimeline",((e,t,a,n,i)=>{var s;this.unmounted||t&&t.roomId===(null===(s=this.state.room)||void 0===s?void 0:s.roomId)&&i.timeline.getTimelineSet()===t.getUnfilteredTimelineSet()&&("org.matrix.room.preview_urls"===e.getType()&&this.updatePreviewUrlVisibility(t),"m.room.encryption"===e.getType()&&(this.updateE2EStatus(t),this.updatePreviewUrlVisibility(t)),!a&&null!=i&&i.liveEvent&&(this.state.joining||(e.isBeingDecrypted()||e.isDecryptionFailure()||this.handleEffects(e),e.getSender()!==this.context.client.credentials.userId&&(!this.state.search&&this.state.atEndOfLiveTimeline||Object(ja.a)(e,this.state)||this.setState((e=>({numUnreadMessages:e.numUnreadMessages+1})))))))})),i()(this,"onEventDecrypted",(e=>{this.state.room&&this.state.matrixClientIsReady&&e.getRoomId()===this.state.room.roomId&&(this.updateVisibleDecryptionFailures(),e.isDecryptionFailure()||this.handleEffects(e))})),i()(this,"handleEffects",(e=>{this.context.roomNotificationStateStore.getRoomState(this.state.room).isUnread&&Wi.CHAT_EFFECTS.forEach((t=>{(Object(Hi.containsEmoji)(e.getContent(),t.emojis)||e.getContent().msgtype===t.msgType)&&(e.isRelation(xa.d.name)||v.a.dispatch({action:`effects.${t.command}`}))}))})),i()(this,"onRoomName",(e=>{this.state.room&&e.roomId==this.state.room.roomId&&this.forceUpdate()})),i()(this,"onKeyBackupStatus",(()=>{this.forceUpdate()})),i()(this,"canResetTimeline",(()=>!this.messagePanel||this.messagePanel.canResetTimeline())),i()(this,"loadVirtualRoom",(async e=>{const t=(null==e?void 0:e.roomId)&&await Dd.a.sharedInstance().getVirtualRoomForRoom(null==e?void 0:e.roomId);this.setState({virtualRoom:t||void 0})})),i()(this,"onRoomLoaded",(e=>{this.unmounted||(this.context.widgetLayoutStore.on(an.d.emissionForRoom(e),this.onWidgetLayoutChange),this.calculatePeekRules(e),this.updatePreviewUrlVisibility(e),this.loadMembersIfJoined(e),this.calculateRecommendedVersion(e),this.updateE2EStatus(e),this.updatePermissions(e),this.checkWidgets(e),this.loadVirtualRoom(e),this.getMainSplitContentType(e)!==Bd.Timeline&&this.context.roomNotificationStateStore.getRoomState(e).isUnread&&this.context.rightPanelStore.setCard({phase:Ma.a.Timeline},!0,e.roomId),this.setState({tombstone:this.getRoomTombstone(e),liveTimeline:e.getLiveTimeline()}))})),i()(this,"onRoomTimelineReset",(e=>{var t;e&&e.roomId===(null===(t=this.state.room)||void 0===t?void 0:t.roomId)&&e.getLiveTimeline()!==this.state.liveTimeline&&(ga.a.log(`Live timeline of ${e.roomId} was reset`),this.setState({liveTimeline:e.getLiveTimeline()}))})),i()(this,"onRoom",(e=>{e&&e.roomId===this.state.roomId&&(this.state.room&&this.context.widgetLayoutStore.off(an.d.emissionForRoom(this.state.room),this.onWidgetLayoutChange),this.setState({room:e},(()=>{this.onRoomLoaded(e)})))})),i()(this,"onDeviceVerificationChanged",(e=>{const t=this.state.room;null!=t&&t.currentState.getMember(e)&&this.updateE2EStatus(t)})),i()(this,"onUserVerificationChanged",(e=>{const t=this.state.room;t&&t.currentState.getMember(e)&&this.updateE2EStatus(t)})),i()(this,"onCrossSigningKeysChanged",(()=>{const e=this.state.room;e&&this.updateE2EStatus(e)})),i()(this,"onUrlPreviewsEnabledChange",(()=>{this.state.room&&this.updatePreviewUrlVisibility(this.state.room)})),i()(this,"onRoomStateEvents",((e,t)=>{if(this.state.room&&this.state.room.roomId===t.roomId)if(e.getType()===ee.b.RoomTombstone)this.setState({tombstone:this.getRoomTombstone()});else this.updatePermissions(this.state.room)})),i()(this,"onRoomStateUpdate",(e=>{var t;e.roomId===(null===(t=this.state.room)||void 0===t?void 0:t.roomId)&&this.updateRoomMembers()})),i()(this,"onMyMembership",((e,t,a)=>{e.roomId===this.state.roomId&&(this.forceUpdate(),this.loadMembersIfJoined(e),this.updatePermissions(e))})),i()(this,"updateRoomMembers",Object(k.throttle)((()=>{this.updateDMState(),this.updateE2EStatus(this.state.room)}),500,{leading:!0,trailing:!0})),i()(this,"onInviteClick",(()=>{v.a.dispatch({action:"view_invite",roomId:this.state.room.roomId})})),i()(this,"onJoinButtonClicked",(()=>{var e;null!==(e=this.context.client)&&void 0!==e&&e.isGuest()?(v.a.dispatch({action:U.a.DoAfterSyncPrepared,deferred_action:{action:U.a.ViewRoom,room_id:this.getRoomId(),metricsTrigger:void 0}}),v.a.dispatch({action:"require_registration"})):Promise.resolve().then((()=>{var e,t;const a=null===(e=this.props.threepidInvite)||void 0===e?void 0:e.signUrl;return v.a.dispatch({action:U.a.JoinRoom,roomId:this.getRoomId(),opts:{inviteSignUrl:a},metricsTrigger:"invite"===(null===(t=this.state.room)||void 0===t?void 0:t.getMyMembership())?"Invite":"RoomPreview"}),Promise.resolve()}))})),i()(this,"updateVisibleDecryptionFailures",Object(k.throttle)((()=>this.setState((e=>{var t,a,n,i;return{visibleDecryptionFailures:null!==(t=null===(a=this.messagePanel)||void 0===a?void 0:a.getVisibleDecryptionFailures((null!==(n=null===(i=e.visibleDecryptionFailures)||void 0===i?void 0:i.length)&&void 0!==n?n:0)>0))&&void 0!==t?t:[]}}))),500,{leading:!1,trailing:!0})),i()(this,"onMessageListScroll",(()=>{this.messagePanel.isAtEndOfLiveTimeline()?this.setState({numUnreadMessages:0,atEndOfLiveTimeline:!0}):this.setState({atEndOfLiveTimeline:!1}),this.updateTopUnreadMessagesBar(),this.updateVisibleDecryptionFailures()})),i()(this,"resetJumpToEvent",(e=>{this.state.initialEventId&&this.state.initialEventScrollIntoView&&this.state.initialEventId===e&&(Ud("Removing scroll_into_view flag from initial event"),v.a.dispatch({action:U.a.ViewRoom,room_id:this.state.room.roomId,event_id:this.state.initialEventId,highlighted:this.state.isInitialEventHighlighted,scroll_into_view:!1,replyingToEvent:this.state.replyToEvent,metricsTrigger:void 0}))})),i()(this,"onSearch",((e,t)=>{const a=t===Xo.Room?this.state.room.roomId:void 0;Ud("sending search request");const n=new AbortController,i=function(e,t,a){return null===Zs.a.get()?_d(e,t,a):jd(e,t,a)}(e,a,n.signal);this.setState({search:{searchId:(new Date).getTime(),roomId:a,term:e,scope:t,promise:i,abortController:n}})})),i()(this,"onSearchUpdate",((e,t)=>{this.setState({search:Ld(Ld({},this.state.search),{},{count:null==t?void 0:t.count,inProgress:e})})})),i()(this,"onAppsClick",(()=>{v.a.dispatch({action:"appsDrawer",show:!this.state.showApps})})),i()(this,"onForgetClick",(()=>{v.a.dispatch({action:"forget_room",room_id:this.state.room.roomId})})),i()(this,"onRejectButtonClicked",(()=>{this.setState({rejecting:!0}),this.context.client.leave(this.state.roomId).then((()=>{v.a.dispatch({action:U.a.ViewHomePage}),this.setState({rejecting:!1})}),(e=>{ga.a.error("Failed to reject invite: %s",e);const t=e.message?e.message:JSON.stringify(e);H.b.createDialog(en.a,{title:Object(N.a)("Failed to reject invite"),description:t}),this.setState({rejecting:!1,rejectError:e})}))})),i()(this,"onRejectAndIgnoreClick",(async()=>{this.setState({rejecting:!0});try{const e=this.state.room.getMember(this.context.client.getUserId()).events.member,t=this.context.client.getIgnoredUsers();t.push(e.getSender()),await this.context.client.setIgnoredUsers(t),await this.context.client.leave(this.state.roomId),v.a.dispatch({action:U.a.ViewHomePage}),this.setState({rejecting:!1})}catch(e){ga.a.error("Failed to reject invite: %s",e);const t=e.message?e.message:JSON.stringify(e);H.b.createDialog(en.a,{title:Object(N.a)("Failed to reject invite"),description:t}),this.setState({rejecting:!1,rejectError:e})}})),i()(this,"onRejectThreepidInviteButtonClicked",(()=>{v.a.fire(U.a.ViewRoomDirectory)})),i()(this,"onSearchClick",(()=>{this.setState({timelineRenderingType:this.state.timelineRenderingType===Qa.a.Search?Qa.a.Room:Qa.a.Search})})),i()(this,"onCancelSearchClick",(()=>new Promise((e=>{this.setState({timelineRenderingType:Qa.a.Room,search:null},e)})))),i()(this,"jumpToLiveTimeline",(()=>{this.state.initialEventId&&this.state.isInitialEventHighlighted?v.a.dispatch({action:U.a.ViewRoom,room_id:this.state.room.roomId,metricsTrigger:void 0}):(this.messagePanel.jumpToLiveTimeline(),v.a.fire(U.a.FocusSendMessageComposer))})),i()(this,"jumpToReadMarker",(()=>{this.messagePanel.jumpToReadMarker()})),i()(this,"forgetReadMarker",(e=>{e.stopPropagation(),this.messagePanel.forgetReadMarker()})),i()(this,"updateTopUnreadMessagesBar",(()=>{if(!this.messagePanel)return;const e=this.messagePanel.canJumpToReadMarker();this.state.showTopUnreadMessagesBar!=e&&this.setState({showTopUnreadMessagesBar:e})})),i()(this,"onStatusBarVisible",(()=>{this.unmounted||this.state.statusBarVisible||this.setState({statusBarVisible:!0})})),i()(this,"onStatusBarHidden",(()=>{!this.unmounted&&this.state.statusBarVisible&&this.setState({statusBarVisible:!1})})),i()(this,"handleScrollKey",(e=>{var t;let a;this.searchResultsPanel.current?a=this.searchResultsPanel.current:this.messagePanel&&(a=this.messagePanel),null===(t=a)||void 0===t||t.handleScrollKey(e)})),i()(this,"gatherTimelinePanelRef",(e=>{this.messagePanel=e})),i()(this,"onHiddenHighlightsClick",(()=>{const e=this.getOldRoom();e&&v.a.dispatch({action:U.a.ViewRoom,room_id:e.roomId,metricsTrigger:"Predecessor"})})),i()(this,"onFileDrop",(e=>{var t,a;return Ia.a.sharedInstance().sendContentListToRoom(Array.from(e.files),null!==(t=null===(a=this.state.room)||void 0===a?void 0:a.roomId)&&void 0!==t?t:this.state.roomId,null,this.context.client,Qa.a.Room)})),i()(this,"onMeasurement",(e=>{this.setState({narrow:e})}));const r=t.client.hasLazyLoadMembersEnabled();this.state={roomId:null,roomLoading:!0,peekLoading:!1,shouldPeek:!0,membersLoaded:!r,numUnreadMessages:0,callState:null,activeCall:null,canPeek:!1,canSelfRedact:!1,showApps:!1,isPeeking:!1,showRightPanel:!1,joining:!1,showTopUnreadMessagesBar:!1,statusBarVisible:!1,canReact:!1,canSendMessages:!1,resizing:!1,layout:b.b.getValue("layout"),lowBandwidth:b.b.getValue("lowBandwidth"),alwaysShowTimestamps:b.b.getValue("alwaysShowTimestamps"),showTwelveHourTimestamps:b.b.getValue("showTwelveHourTimestamps"),readMarkerInViewThresholdMs:b.b.getValue("readMarkerInViewThresholdMs"),readMarkerOutOfViewThresholdMs:b.b.getValue("readMarkerOutOfViewThresholdMs"),showHiddenEvents:b.b.getValue("showHiddenEventsInTimeline"),showReadReceipts:!0,showRedactions:!0,showJoinLeaves:!0,showAvatarChanges:!0,showDisplaynameChanges:!0,matrixClientIsReady:null===(n=t.client)||void 0===n?void 0:n.isInitialSyncComplete(),mainSplitContentType:Bd.Timeline,timelineRenderingType:Qa.a.Room,liveTimeline:void 0,narrow:!1,visibleDecryptionFailures:[],msc3946ProcessDynamicPredecessor:b.b.getValue("feature_dynamic_room_predecessors")},this.dispatcherRef=v.a.register(this.onAction),t.client.on(o.b.Room,this.onRoom),t.client.on(te.d.Timeline,this.onRoomTimeline),t.client.on(te.d.TimelineReset,this.onRoomTimelineReset),t.client.on(te.d.Name,this.onRoomName),t.client.on(m.b.Events,this.onRoomStateEvents),t.client.on(m.b.Update,this.onRoomStateUpdate),t.client.on(te.d.MyMembership,this.onMyMembership),t.client.on(Ca.b.KeyBackupStatus,this.onKeyBackupStatus),t.client.on(Ca.b.DeviceVerificationChanged,this.onDeviceVerificationChanged),t.client.on(Ca.b.UserTrustStatusChanged,this.onUserVerificationChanged),t.client.on(Ca.b.KeysChanged,this.onCrossSigningKeysChanged),t.client.on(Oa.c.Decrypted,this.onEventDecrypted),t.roomViewStore.on(pt.b,this.onRoomViewStoreUpdate),t.rightPanelStore.on(pt.b,this.onRightPanelStoreUpdate),To.a.on(pt.b,this.onWidgetEchoStoreUpdate),t.widgetStore.on(pt.b,this.onWidgetStoreUpdate),jc.a.instance.on(jc.b.ActiveCalls,this.onActiveCalls),this.props.resizeNotifier.on("isResizing",this.onIsResizing),this.settingWatchers=[b.b.watchSetting("layout",null,(function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];let[,,,i]=t;return a.setState({layout:i})})),b.b.watchSetting("lowBandwidth",null,(function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];let[,,,i]=t;return a.setState({lowBandwidth:i})})),b.b.watchSetting("alwaysShowTimestamps",null,(function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];let[,,,i]=t;return a.setState({alwaysShowTimestamps:i})})),b.b.watchSetting("showTwelveHourTimestamps",null,(function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];let[,,,i]=t;return a.setState({showTwelveHourTimestamps:i})})),b.b.watchSetting("readMarkerInViewThresholdMs",null,(function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];let[,,,i]=t;return a.setState({readMarkerInViewThresholdMs:i})})),b.b.watchSetting("readMarkerOutOfViewThresholdMs",null,(function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];let[,,,i]=t;return a.setState({readMarkerOutOfViewThresholdMs:i})})),b.b.watchSetting("showHiddenEventsInTimeline",null,(function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];let[,,,i]=t;return a.setState({showHiddenEvents:i})})),b.b.watchSetting("urlPreviewsEnabled",null,this.onUrlPreviewsEnabledChange),b.b.watchSetting("urlPreviewsEnabled_e2ee",null,this.onUrlPreviewsEnabledChange),b.b.watchSetting("feature_dynamic_room_predecessors",null,(function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];let[,,,i]=t;return a.setState({msc3946ProcessDynamicPredecessor:i})}))]}getPermalinkCreatorForRoom(e){return this.permalinkCreators[e.roomId]||(this.permalinkCreators[e.roomId]=new Ra.a(e),this.state.room&&e.roomId===this.state.room.roomId?this.permalinkCreators[e.roomId].start():this.permalinkCreators[e.roomId].load()),this.permalinkCreators[e.roomId]}stopAllPermalinkCreators(){if(this.permalinkCreators)for(const e of Object.keys(this.permalinkCreators))this.permalinkCreators[e].stop()}setupRoom(e,t,a,n){!a&&t&&(!e&&n?(ga.a.info("Attempting to peek into room %s",t),this.setState({peekLoading:!0,isPeeking:!0}),this.context.client.peekInRoom(t).then((e=>{this.unmounted||(this.setState({room:e,peekLoading:!1}),this.onRoomLoaded(e))})).catch((e=>{if(!this.unmounted){if(this.setState({isPeeking:!1}),"M_GUEST_ACCESS_FORBIDDEN"!==e.errcode&&"M_FORBIDDEN"!==e.errcode)throw e;this.setState({peekLoading:!1})}}))):e&&(this.context.client.stopPeeking(),this.setState({isPeeking:!1})))}shouldShowApps(e){if(!Fd||!e)return!1;const t=e.roomId+"_hide_widget_drawer",a=localStorage.getItem(t),n=!a||"false"===a,i=this.context.widgetLayoutStore.getContainerWidgets(e,an.a.Top);return n&&i.length>0}componentDidMount(){this.onRoomViewStoreUpdate(!0);const e=this.getCallForRoom(),t=e?e.state:null;this.setState({callState:t}),this.context.legacyCallHandler.on(B.a.CallState,this.onCallState),window.addEventListener("beforeunload",this.onPageUnload)}shouldComponentUpdate(e,t){const a=Object(Ai.c)(this.props,e),n=this.state,{upgradeRecommendation:i}=n,s=ve()(n,Pd),{upgradeRecommendation:r}=t,o=ve()(t,Md),l=(null==r?void 0:r.needsUpgrade)!==(null==i?void 0:i.needsUpgrade)||Object(Ai.c)(s,o);return a||l}componentDidUpdate(){this.messagePanel&&void 0===this.state.atEndOfLiveTimeline&&this.setState({atEndOfLiveTimeline:this.messagePanel.isAtEndOfLiveTimeline()})}componentWillUnmount(){this.unmounted=!0,this.context.legacyCallHandler.removeListener(B.a.CallState,this.onCallState),this.state.roomId&&Io.setScrollState(this.state.roomId,this.getScrollState()),this.state.shouldPeek&&this.context.client.stopPeeking(),this.stopAllPermalinkCreators(),v.a.unregister(this.dispatcherRef),this.context.client&&(this.context.client.removeListener(o.b.Room,this.onRoom),this.context.client.removeListener(te.d.Timeline,this.onRoomTimeline),this.context.client.removeListener(te.d.TimelineReset,this.onRoomTimelineReset),this.context.client.removeListener(te.d.Name,this.onRoomName),this.context.client.removeListener(m.b.Events,this.onRoomStateEvents),this.context.client.removeListener(te.d.MyMembership,this.onMyMembership),this.context.client.removeListener(m.b.Update,this.onRoomStateUpdate),this.context.client.removeListener(Ca.b.KeyBackupStatus,this.onKeyBackupStatus),this.context.client.removeListener(Ca.b.DeviceVerificationChanged,this.onDeviceVerificationChanged),this.context.client.removeListener(Ca.b.UserTrustStatusChanged,this.onUserVerificationChanged),this.context.client.removeListener(Ca.b.KeysChanged,this.onCrossSigningKeysChanged),this.context.client.removeListener(Oa.c.Decrypted,this.onEventDecrypted)),window.removeEventListener("beforeunload",this.onPageUnload),this.context.roomViewStore.off(pt.b,this.onRoomViewStoreUpdate),this.context.rightPanelStore.off(pt.b,this.onRightPanelStoreUpdate),To.a.removeListener(pt.b,this.onWidgetEchoStoreUpdate),this.context.widgetStore.removeListener(pt.b,this.onWidgetStoreUpdate),this.props.resizeNotifier.off("isResizing",this.onIsResizing),this.state.room&&this.context.widgetLayoutStore.off(an.d.emissionForRoom(this.state.room),this.onWidgetLayoutChange),jc.a.instance.off(jc.b.ActiveCalls,this.onActiveCalls),this.context.legacyCallHandler.off(B.a.CallState,this.onCallState),this.updateRoomMembers.cancel();for(const e of this.settingWatchers)b.b.unwatchSetting(e);this.viewsLocalRoom&&this.context.client.store.removeRoom(this.state.room.roomId)}onLocalRoomEvent(e){e===this.state.room.roomId&&Object(Ns.c)(this.context.client,this.state.room)}getRoomTombstone(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.state.room;return null==e?void 0:e.currentState.getStateEvents(ee.b.RoomTombstone,"")}async calculateRecommendedVersion(e){const t=await e.getRecommendedVersion();this.unmounted||this.setState({upgradeRecommendation:t})}async loadMembersIfJoined(e){if(this.context.client.hasLazyLoadMembersEnabled()&&e&&"join"===e.getMyMembership())try{await e.loadMembersIfNeeded(),this.unmounted||this.setState({membersLoaded:!0})}catch(t){const a=`Fetching room members for ${e.roomId} failed. Room members will appear incomplete.`;ga.a.error(a),ga.a.error(t)}}calculatePeekRules(e){const t=e.currentState.getStateEvents(ee.b.RoomHistoryVisibility,"");this.setState({canPeek:(null==t?void 0:t.getContent().history_visibility)===ka.b.WorldReadable})}updatePreviewUrlVisibility(e){let{roomId:t}=e;const a=this.context.client.isRoomEncrypted(t)?"urlPreviewsEnabled_e2ee":"urlPreviewsEnabled";this.setState({showUrlPreview:b.b.getValue(a,t)})}async updateE2EStatus(e){if(!this.context.client.isRoomEncrypted(e.roomId))return;let t=Ja.Warning;this.context.client.isCryptoEnabled()&&(t=await async function(e,t){const a=(await t.getEncryptionTargetMembers()).map((e=>{let{userId:t}=e;return t})),n=!!Ya.a.shared().getUserIdForRoomId(t.roomId),i=[],s=[];a.filter((t=>t!==e.getUserId())).forEach((t=>{(e.checkUserTrust(t).isCrossSigningVerified()?i:s).push(t)}));for(const t of s)if(e.checkUserTrust(t).wasCrossSigningVerified())return Ja.Warning;const r=i.length>0&&!n&&2!==a.length||1===a.length?[...i,e.getUserId()]:i;for(const t of r)if(e.getStoredDevicesForUser(t).some((a=>{let{deviceId:n}=a;return!e.checkDeviceTrust(t,n).isVerified()})))return Ja.Warning;return 0===s.length?Ja.Verified:Ja.Normal}(this.context.client,e)),this.unmounted||this.setState({e2eStatus:t})}updatePermissions(e){if(e){const t=this.context.client.getUserId(),a="join"===e.getMyMembership()&&e.currentState.maySendEvent(ee.b.Reaction,t),n=e.maySendMessage(),i=e.currentState.maySendEvent(ee.b.RoomRedaction,t);this.setState({canReact:a,canSendMessages:n,canSelfRedact:i})}}checkDesktopNotifications(){this.state.room.getJoinedMemberCount()+this.state.room.getInvitedMemberCount()>1&&Pc.default.shouldShowPrompt()&&Object(Mc.b)(!0)}updateDMState(){const e=this.state.room;if("join"!=e.getMyMembership())return;const t=e.getDMInviter();t&&Ta.d(e.roomId,t)}injectSticker(e,t,a,n){this.context.client.isGuest()?v.a.dispatch({action:"require_registration"}):Ia.a.sharedInstance().sendStickerContentToRoom(e,this.state.room.roomId,n,t,a,this.context.client).then(void 0,(e=>{e.name}))}getScrollState(){const e=this.messagePanel;if(!e)return null;if(this.state.atEndOfLiveTimeline)return null;const t=e.getScrollState();return!t||t.stuckAtBottom?null:{focussedEvent:t.trackedScrollToken,pixelOffset:t.pixelOffset}}getCallForRoom(){return this.state.room?this.context.legacyCallHandler.getCallForRoom(this.state.room.roomId):null}getOldRoom(){var e,t;const{roomId:a}=(null===(e=this.state.room)||void 0===e?void 0:e.findPredecessor(this.state.msc3946ProcessDynamicPredecessor))||{};return(null===(t=this.context.client)||void 0===t?void 0:t.getRoom(a))||null}getHiddenHighlightCount(){const e=this.getOldRoom();return e?e.getUnreadNotificationCount(te.b.Highlight):0}get messagePanelClassNames(){return c()("mx_RoomView_messagePanel",{mx_IRCLayout:this.state.layout===hr.a.IRC})}get viewsLocalRoom(){return Object(Kr.a)(this.state.room)}get permalinkCreator(){return this.getPermalinkCreatorForRoom(this.state.room)}renderLocalRoomCreateLoader(){const e=this.state.room.getDefaultRoomName(this.context.client.getUserId());return r.a.createElement(Qa.b.Provider,{value:this.state},r.a.createElement(Wd,{names:e,resizeNotifier:this.props.resizeNotifier}))}renderLocalRoomView(){return r.a.createElement(Qa.b.Provider,{value:this.state},r.a.createElement(Vd,{resizeNotifier:this.props.resizeNotifier,permalinkCreator:this.permalinkCreator,roomView:this.roomView,onFileDrop:this.onFileDrop}))}render(){var e,t;if(this.state.room instanceof md.b)return this.state.room.state===md.c.CREATING?this.renderLocalRoomCreateLoader():this.renderLocalRoomView();if(!this.state.room){const e=!this.state.matrixClientIsReady||this.state.roomLoading||this.state.peekLoading;if(e){const t=!this.state.matrixClientIsReady||!this.state.roomId||this.state.peekLoading;return r.a.createElement("div",{className:"mx_RoomView"},r.a.createElement(Do.a,null,r.a.createElement(Bo,{canPreview:!1,previewLoading:t&&!this.state.roomLoadError,error:this.state.roomLoadError,loading:e,joining:this.state.joining,oobData:this.props.oobData})))}{var a,n;let e;this.props.oobData&&(e=this.props.oobData.inviterName);const t=null===(a=this.props.threepidInvite)||void 0===a?void 0:a.toEmail,i=this.state.roomAlias;return r.a.createElement("div",{className:"mx_RoomView"},r.a.createElement(Do.a,null,r.a.createElement(Bo,{onJoinClick:this.onJoinButtonClicked,onForgetClick:this.onForgetClick,onRejectClick:this.onRejectThreepidInviteButtonClicked,canPreview:!1,error:this.state.roomLoadError,roomAlias:i,joining:this.state.joining,inviterName:e,invitedEmail:t,oobData:this.props.oobData,signUrl:null===(n=this.props.threepidInvite)||void 0===n?void 0:n.signUrl,room:this.state.room})))}}const i=this.state.room.getMyMembership();if(pc(this.state.room)&&(!b.b.getValue("feature_video_rooms")||"join"!==i))return r.a.createElement(Do.a,null,r.a.createElement("div",{className:"mx_MainSplit"},r.a.createElement(Qo,{room:this.state.room,onJoinButtonClicked:this.onJoinButtonClicked,onRejectButtonClicked:this.onRejectButtonClicked})),";");if("invite"===i&&!this.state.room.isSpaceRoom()){if(this.state.joining||this.state.rejecting)return r.a.createElement(Do.a,null,r.a.createElement(Bo,{canPreview:!1,error:this.state.roomLoadError,joining:this.state.joining,rejecting:this.state.rejecting}));{const e=this.context.client.credentials.userId,t=this.state.room.getMember(e),a=t?t.events.member:null;let n=Object(N.a)("Unknown");return a&&(n=a.sender?a.sender.name:a.getSender()),r.a.createElement("div",{className:"mx_RoomView"},r.a.createElement(Do.a,null,r.a.createElement(Bo,{onJoinClick:this.onJoinButtonClicked,onForgetClick:this.onForgetClick,onRejectClick:this.onRejectButtonClicked,onRejectAndIgnoreClick:this.onRejectAndIgnoreClick,inviterName:n,canPreview:!1,joining:this.state.joining,room:this.state.room})))}}let s,o=null;{const e=this.getCallForRoom();e&&"ended"!==this.state.callState&&"ringing"!==this.state.callState&&(o=e)}let l=!0;Ia.a.sharedInstance().getCurrentUploads().length>0?s=r.a.createElement(ao,{room:this.state.room}):this.state.search||(l=this.state.statusBarVisible,s=r.a.createElement(ld.a,{room:this.state.room,isPeeking:"join"!==i,onInviteClick:this.onInviteClick,onVisible:this.onStatusBarVisible,onHidden:this.onStatusBarHidden}));const d=c()("mx_RoomView_statusArea",{mx_RoomView_statusArea_expanded:l}),m=s&&r.a.createElement("div",{className:d},r.a.createElement("div",{className:"mx_RoomView_statusAreaBox"},r.a.createElement("div",{className:"mx_RoomView_statusAreaBox_line"}),s)),u=this.state.upgradeRecommendation,h=u&&u.needsUpgrade&&this.state.room.userMayUpgradeRoom(this.context.client.credentials.userId),p=this.getHiddenHighlightCount();let g,v;var f;if(this.state.timelineRenderingType===Qa.a.Search)g=r.a.createElement(Zo,{searchInProgress:null===(f=this.state.search)||void 0===f?void 0:f.inProgress,onCancelClick:this.onCancelSearchClick,onSearch:this.onSearch,isRoomEncrypted:this.context.client.isRoomEncrypted(this.state.room.roomId)});else if(h)g=r.a.createElement(tl,{room:this.state.room});else if("join"!==i){var y,E;let e;this.props.oobData&&(e=this.props.oobData.inviterName);const t=null===(y=this.props.threepidInvite)||void 0===y?void 0:y.toEmail;if(v=r.a.createElement(Bo,{onJoinClick:this.onJoinButtonClicked,onForgetClick:this.onForgetClick,onRejectClick:this.onRejectThreepidInviteButtonClicked,joining:this.state.joining,inviterName:e,invitedEmail:t,oobData:this.props.oobData,canPreview:this.state.canPeek,room:this.state.room}),!(this.state.canPeek||null!==(E=this.state.room)&&void 0!==E&&E.isSpaceRoom()))return r.a.createElement("div",{className:"mx_RoomView"},v)}else p>0&&(g=r.a.createElement(G.a,{element:"div",className:"mx_RoomView_auxPanel_hiddenHighlights",onClick:this.onHiddenHighlightsClick},Object(N.a)("You have %(count)s unread notifications in a prior version of this room.",{count:p})));let _;if(this.state.visibleDecryptionFailures&&this.state.visibleDecryptionFailures.length>0&&(_=r.a.createElement(il,{failures:this.state.visibleDecryptionFailures})),null!==(e=this.state.room)&&void 0!==e&&e.isSpaceRoom()&&!this.props.forceTimeline)return r.a.createElement(od,{space:this.state.room,justCreatedOpts:this.props.justCreatedOpts,resizeNotifier:this.props.resizeNotifier,onJoinButtonClicked:this.onJoinButtonClicked,onRejectButtonClicked:this.props.threepidInvite?this.onRejectThreepidInviteButtonClicked:this.onRejectButtonClicked});const S=r.a.createElement(Wl,{room:this.state.room,userId:this.context.client.credentials.userId,showApps:this.state.showApps,resizeNotifier:this.props.resizeNotifier},g,_);let w;let O;"join"===i&&!this.state.search&&(w=r.a.createElement(Xr,{room:this.state.room,e2eStatus:this.state.e2eStatus,resizeNotifier:this.props.resizeNotifier,replyToEvent:this.state.replyToEvent,permalinkCreator:this.permalinkCreator}));let C,x=!1;this.state.search&&(O=r.a.createElement(Nd,{key:this.state.search.searchId,ref:this.searchResultsPanel,term:this.state.search.term,scope:this.state.search.scope,promise:this.state.search.promise,abortController:this.state.search.abortController,resizeNotifier:this.props.resizeNotifier,permalinkCreator:this.permalinkCreator,className:this.messagePanelClassNames,onUpdate:this.onSearchUpdate}),x=!0),this.state.isInitialEventHighlighted&&(C=this.state.initialEventId);const k=r.a.createElement(ur,{ref:this.gatherTimelinePanelRef,timelineSet:this.state.room.getUnfilteredTimelineSet(),overlayTimelineSet:null===(t=this.state.virtualRoom)||void 0===t?void 0:t.getUnfilteredTimelineSet(),overlayTimelineSetFilter:lr.d,showReadReceipts:this.state.showReadReceipts,manageReadReceipts:!this.state.isPeeking,sendReadReceiptOnLoad:!this.state.wasContextSwitch,manageReadMarkers:!this.state.isPeeking,hidden:x,highlightedEventId:C,eventId:this.state.initialEventId,eventScrollIntoView:this.state.initialEventScrollIntoView,eventPixelOffset:this.state.initialEventPixelOffset,onScroll:this.onMessageListScroll,onEventScrolledIntoView:this.resetJumpToEvent,onReadMarkerUpdated:this.updateTopUnreadMessagesBar,showUrlPreview:this.state.showUrlPreview,className:this.messagePanelClassNames,membersLoaded:this.state.membersLoaded,permalinkCreator:this.permalinkCreator,resizeNotifier:this.props.resizeNotifier,showReactions:!0,layout:this.state.layout,editState:this.state.editState});let j,R=null;this.state.showTopUnreadMessagesBar&&!this.state.search&&(R=r.a.createElement(cd,{onScrollUpClick:this.jumpToReadMarker,onCloseClick:this.forgetReadMarker})),!1!==this.state.atEndOfLiveTimeline||this.state.search||(j=r.a.createElement(wo,{highlight:this.state.room.getUnreadNotificationCount(te.b.Highlight)>0,numUnreadMessages:this.state.numUnreadMessages,onScrollToBottomClick:this.jumpToLiveTimeline}));const I=this.state.room&&this.state.showRightPanel?r.a.createElement(jo,{room:this.state.room,resizeNotifier:this.props.resizeNotifier,permalinkCreator:this.permalinkCreator,e2eStatus:this.state.e2eStatus}):null,T=c()("mx_RoomView_timeline",{mx_RoomView_timeline_rr_enabled:this.state.showReadReceipts}),D=c()("mx_RoomView",{mx_RoomView_inCall:Boolean(o),mx_RoomView_immersive:this.state.mainSplitContentType!==Bd.Timeline}),P=b.b.getValue("showChatEffects");let M,A;switch(this.state.mainSplitContentType){case Bd.Timeline:A="mx_MainSplit_timeline",M=r.a.createElement(r.a.Fragment,null,r.a.createElement(pr,{sensor:this.roomViewBody.current,onMeasurement:this.onMeasurement}),S,r.a.createElement("div",{className:T},r.a.createElement(ro,{parent:this.roomView.current,onFileDrop:this.onFileDrop}),R,j,k,O),m,v,w);break;case Bd.MaximisedWidget:A="mx_MainSplit_maximisedWidget",M=r.a.createElement(r.a.Fragment,null,r.a.createElement(gl,{room:this.state.room,userId:this.context.client.credentials.userId,resizeNotifier:this.props.resizeNotifier,showApps:!0}),v);break;case Bd.Call:A="mx_MainSplit_call",M=r.a.createElement(r.a.Fragment,null,r.a.createElement(Dc,{room:this.state.room,resizing:this.state.resizing,waitForCall:pc(this.state.room)}),v)}const L=c()("mx_RoomView_body",A);let U=[Ma.a.Timeline],F=this.onAppsClick,B=this.onForgetClick,V=this.onSearchClick,W=null,H=!1;switch(this.state.mainSplitContentType){case Bd.MaximisedWidget:U=[Ma.a.ThreadPanel,Ma.a.PinnedMessages],F=null,B=null,V=null;break;case Bd.Call:U=[Ma.a.ThreadPanel,Ma.a.PinnedMessages,Ma.a.NotificationPanel],pc(this.state.room)||(U.push(Ma.a.RoomSummary),null===this.state.activeCall&&U.push(Ma.a.Timeline)),F=null,B=null,V=null,this.state.room.canInvite(this.context.client.credentials.userId)&&(W=this.onInviteClick),H=!0}return r.a.createElement(Qa.b.Provider,{value:this.state},r.a.createElement("main",{className:D,ref:this.roomView,onKeyDown:this.onReactKeyDown},P&&this.roomView.current&&r.a.createElement(kc,{roomWidth:this.roomView.current.offsetWidth}),r.a.createElement(Do.a,null,r.a.createElement(xc,{room:this.state.room,searchInfo:this.state.search,oobData:this.props.oobData,inRoom:"join"===i,onSearchClick:V,onInviteClick:W,onForgetClick:"leave"===i?B:null,e2eStatus:this.state.e2eStatus,onAppsClick:this.state.hasPinnedWidgets?F:null,appsShown:this.state.showApps,excludedRightPanelPhaseButtons:U,showButtons:!this.viewsLocalRoom,enableRoomOptionsMenu:!this.viewsLocalRoom,viewingCall:H,activeCall:this.state.activeCall}),r.a.createElement(Da,{panel:I,resizeNotifier:this.props.resizeNotifier},r.a.createElement("div",{className:L,ref:this.roomViewBody,"data-layout":this.state.layout},M)))))}}i()(Hd,"contextType",rt.a);var zd=Hd;class Gd extends s.Component{constructor(e){super(e),i()(this,"onToastStoreUpdate",(()=>{this.setState({toasts:P.a.sharedInstance().getToasts(),countSeen:P.a.sharedInstance().getCountSeen()})})),this.state={toasts:P.a.sharedInstance().getToasts(),countSeen:P.a.sharedInstance().getCountSeen()},P.a.sharedInstance().on("update",this.onToastStoreUpdate)}componentWillUnmount(){P.a.sharedInstance().removeListener("update",this.onToastStoreUpdate)}render(){const e=this.state.toasts.length,t=e>1;let a,n;if(0!==e){const i=this.state.toasts[0],{title:r,icon:o,key:l,component:d,className:m,bodyClassName:u,props:h}=i,p=c()("mx_Toast_body",u),g=c()("mx_Toast_toast",m,{mx_Toast_hasIcon:o,[`mx_Toast_icon_${o}`]:o}),v=Object.assign({},h,{key:l,toastKey:l}),b=s.createElement(d,v);let f,y;(r&&t||this.state.countSeen>0)&&(f=` (${this.state.countSeen+1}/${this.state.countSeen+e})`),r&&(y=s.createElement("div",{className:"mx_Toast_title"},s.createElement("h2",null,r),s.createElement("span",{className:"mx_Toast_title_countIndicator"},f))),a=s.createElement("div",{className:g},y,s.createElement("div",{className:p},b)),n=c()("mx_ToastContainer",{mx_ToastContainer_stacked:t})}return a?s.createElement("div",{className:n,role:"alert"},a):null}}class Kd extends r.a.Component{constructor(e){super(e),this.state={loading:!0}}componentDidMount(){this.props.userId&&this.loadProfileInfo()}componentDidUpdate(e){e.userId!==this.props.userId&&this.props.userId&&this.loadProfileInfo()}async loadProfileInfo(){const e=lt.a.get();let t;this.setState({loading:!0});try{t=await e.getProfileInfo(this.props.userId)}catch(e){return H.b.createDialog(en.a,{title:Object(N.a)("Could not load user profile"),description:e&&e.message?e.message:Object(N.a)("Operation failed")}),void this.setState({loading:!1})}const a=new Oa.b({type:"m.room.member",content:t}),n=new Pa.a(null,this.props.userId);n.setMembershipEvent(a),this.setState({member:n,loading:!1})}render(){if(this.state.loading)return r.a.createElement(pn.a,null);if(this.state.member){const e=r.a.createElement(jo,{overwriteCard:{phase:Ma.a.RoomMemberInfo,state:{member:this.state.member}},resizeNotifier:this.props.resizeNotifier});return r.a.createElement(Da,{panel:e,resizeNotifier:this.props.resizeNotifier},r.a.createElement(ca.a,null))}return r.a.createElement("div",null)}}var qd=e=>{let{backgroundImage:t,blurMultiplier:a}=e;if(!t)return null;const n={};if(a){const e=getComputedStyle(document.documentElement).getPropertyValue("--lp-background-blur").replace("px",""),t=parseInt(e,10);isNaN(t)||(n.filter=`blur(${t*a}px)`)}return r.a.createElement("div",{className:"mx_BackdropPanel"},r.a.createElement("img",{role:"presentation",alt:"",style:n,className:"mx_BackdropPanel--image",src:t}))},$d=a(613);var Yd=e=>{let{isMinimized:t}=e;const a=Object(ie.b)(oc.a.instance,oc.b.MonitoringLivePosition,(()=>oc.a.instance.isMonitoringLiveLocation)),n=Object(ie.b)(oc.a.instance,oc.b.LocationPublishError,(()=>oc.a.instance.getLiveBeaconIdsWithLocationPublishError())),i=Object(ie.b)(oc.a.instance,oc.b.BeaconUpdateError,(()=>oc.a.instance.getLiveBeaconIds().filter((e=>oc.a.instance.beaconUpdateErrors.has(e))))),o=Object(ie.b)(oc.a.instance,oc.b.LivenessChange,(()=>oc.a.instance.getLiveBeaconIds())),l=!!n.length,d=!!i.length;if(((e,t)=>{Object(s.useEffect)((()=>{const a=()=>{"visible"===document.visibilityState&&e.forEach((e=>{var a;return null===(a=t.get(e))||void 0===a?void 0:a.monitorLiveness()}))};return e.length&&document.addEventListener("visibilitychange",a),()=>{document.removeEventListener("visibilitychange",a)}}),[e,t])})(o,oc.a.instance.beacons),!a)return null;const m=((e,t,a)=>{var n,i;const s=null!==(n=null!==(i=null==t?void 0:t[0])&&void 0!==i?i:null==a?void 0:a[0])&&void 0!==n?n:null==e?void 0:e[0];if(!s)return;return oc.a.instance.getBeaconById(s)})(o,i,n),u=m?()=>{v.a.dispatch({action:U.a.ViewRoom,room_id:m.roomId,metricsTrigger:void 0,event_id:m.beaconInfoId,scroll_into_view:!0,highlighted:!0})}:void 0,h=((e,t)=>e?Object(N.a)("An error occurred while stopping your live location"):t?Object(N.a)("An error occurred whilst sharing your live location"):Object(N.a)("You are sharing your live location"))(d,l);return r.a.createElement(G.a,{className:c()("mx_LeftPanelLiveShareWarning",{mx_LeftPanelLiveShareWarning__minimized:t,mx_LeftPanelLiveShareWarning__error:l||d}),title:t?h:void 0,onClick:u},t?r.a.createElement($d.a,{height:10}):h)},Jd=a(1541),Qd=a(603);class Xd extends r.a.Component{constructor(e,t){super(e,t),i()(this,"context",void 0),i()(this,"room",void 0),this.room=t.getRoom(this.props.persistentRoomId)}render(){const e=$a.a.instance.get(this.props.persistentWidgetId,this.props.persistentRoomId);return e?r.a.createElement(cs,{key:e.id,app:e,fullWidth:!0,room:this.room,userId:this.context.credentials.userId,creatorUserId:e.creatorUserId,widgetPageTitle:Wa.a.getWidgetDataTitle(e),waitForIframeLoad:e.waitForIframeLoad,miniMode:!0,showMenubar:!1,pointerEvents:this.props.pointerEvents,movePersistedElement:this.props.movePersistedElement}):null}}i()(Xd,"contextType",R.a);var Zd,em,tm=a(909);function am(){return am=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},am.apply(this,arguments)}function nm(e){return s.createElement("svg",am({fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",role:"presentation","aria-hidden":!0},e),Zd||(Zd=s.createElement("path",{d:"M8.027 15.961c1.141 1.232 3.888 3.365 4.637 3.803l.151.09c1.143.679 4.722 2.807 7.33.815 2.021-1.542 1.364-3.278.684-3.794-.466-.362-1.838-1.36-3.128-2.26-1.268-.883-1.974-.175-2.452.303l-.026.026-.96.961c-.246.245-.618.156-.974-.125a26.02 26.02 0 01-2.692-2.385l-.004-.004c-.47-.47-1.4-1.4-2.373-2.68-.28-.356-.37-.728-.125-.973l.96-.961.027-.026c.478-.478 1.186-1.184.303-2.452-.9-1.29-1.898-2.662-2.26-3.128-.516-.68-2.252-1.337-3.794.684-1.992 2.608.136 6.187.815 7.33l.09.151c.438.75 2.56 3.484 3.791 4.625z",fill:"currentColor"})),em||(em=s.createElement("path",{d:"M20.697 3.078a.638.638 0 000-.893.615.615 0 00-.88 0L17 5.045l-2.817-2.86a.615.615 0 00-.88 0 .638.638 0 000 .893l2.817 2.86-2.938 2.984a.638.638 0 000 .893.615.615 0 00.88 0L17 6.832l2.938 2.983a.615.615 0 00.88 0 .638.638 0 000-.893L17.88 5.939l2.817-2.86z",fill:"currentColor"})))}const im=e=>{let{widgetId:t,room:a,viewingRoom:n,onStartMoving:i,movePersistedElement:o}=e;const l=Object(s.useMemo)((()=>$a.a.instance.getApps(a.roomId).find((e=>e.id===t))),[a,t]),c=Object(ie.d)(a,te.d.Name,Object(s.useCallback)((()=>a.name),[a])),d=Object(gc.b)(t,a.roomId),m=Object(s.useCallback)((e=>{e.preventDefault(),e.stopPropagation(),null!==d?v.a.dispatch({action:U.a.ViewRoom,room_id:a.roomId,view_call:!0,metricsTrigger:"WebFloatingCallWindow"}):n?an.d.instance.moveToContainer(a,l,an.a.Center):v.a.dispatch({action:U.a.ViewRoom,room_id:a.roomId,metricsTrigger:"WebFloatingCallWindow"})}),[a,d,l,n]),u=Object(s.useCallback)((e=>{var t;(e.preventDefault(),e.stopPropagation(),null!==d)?d.disconnect().catch((e=>console.error("Failed to leave call",e))):null===(t=Za.a.instance.getMessagingForUid(Wa.a.getWidgetUid(l)))||void 0===t||t.transport.send(nn.a.HangupCall,{}).catch((e=>console.error("Failed to leave Jitsi",e)))}),[d,l]);return r.a.createElement("div",{className:"mx_WidgetPip",onMouseDown:i,onClick:m},r.a.createElement(ia.a,{className:"mx_WidgetPip_header"},r.a.createElement(xe.a,{onClick:m,className:"mx_WidgetPip_backButton","aria-label":Object(N.a)("Back")},r.a.createElement(tm.a,{className:"mx_Icon mx_Icon_16"}),c)),r.a.createElement(Xd,{persistentWidgetId:t,persistentRoomId:a.roomId,pointerEvents:"none",movePersistedElement:o}),(null!==d||tn.a.JITSI.matches(l.type))&&r.a.createElement(ia.a,{className:"mx_WidgetPip_footer"},r.a.createElement(xe.b,{onClick:u,tooltip:Object(N.a)("Leave"),"aria-label":Object(N.a)("Leave"),alignment:zr.a.Top},r.a.createElement(nm,{className:"mx_Icon mx_Icon_24"}))))},sm=[Ea.f.Connected,Ea.f.InviteSent,Ea.f.Connecting,Ea.f.CreateAnswer,Ea.f.CreateOffer,Ea.f.WaitLocalMedia];function rm(e){if(!e)return[null,[]];const t=B.b.instance.getAllActiveCallsForPip(e);let a=null,n=[];for(const e of t)sm.includes(e.state)&&(e.isRemoteOnHold()||null!==a?n.push(e):a=e);return null===a&&n.length>0&&(a=n[0],n=n.slice(1)),n.length>1&&ga.a.log("Found more than 1 secondary call! Other calls will not be shown."),[a,n]}class om extends r.a.Component{constructor(e){super(e),i()(this,"onMove",(()=>{var e,t;return null===(e=(t=this.props.movePersistedElement).current)||void 0===e?void 0:e.call(t)})),i()(this,"onRoomViewStoreUpdate",(()=>{var e,t;const a=rt.b.instance.roomViewStore.getRoomId(),n=this.state.viewedRoomId;if(a===n)return;const i=null===(e=lt.a.get())||void 0===e?void 0:e.getRoom(n);i&&an.d.instance.off(an.d.emissionForRoom(i),this.updateCalls);const s=null===(t=lt.a.get())||void 0===t?void 0:t.getRoom(a||void 0);if(s&&an.d.instance.on(an.d.emissionForRoom(s),this.updateCalls),!a)return;const[r,o]=rm(a);this.setState({viewedRoomId:a,primaryCall:r,secondaryCall:o[0]}),this.updateShowWidgetInPip()})),i()(this,"onWidgetPersistence",(()=>{this.updateShowWidgetInPip()})),i()(this,"onWidgetDockChanges",(()=>{this.updateShowWidgetInPip()})),i()(this,"updateCalls",(()=>{if(!this.state.viewedRoomId)return;const[e,t]=rm(this.state.viewedRoomId);this.setState({primaryCall:e,secondaryCall:t[0]}),this.updateShowWidgetInPip()})),i()(this,"onCallRemoteHold",(()=>{if(!this.state.viewedRoomId)return;const[e,t]=rm(this.state.viewedRoomId);this.setState({primaryCall:e,secondaryCall:t[0]})})),i()(this,"onDoubleClick",(()=>{var e;const t=null===(e=this.state.primaryCall)||void 0===e?void 0:e.roomId;(null!=t?t:this.state.persistentRoomId)&&v.a.dispatch({action:U.a.ViewRoom,room_id:null!=t?t:this.state.persistentRoomId,metricsTrigger:"WebFloatingCallWindow"})}));const t=rt.b.instance.roomViewStore.getRoomId(),[a,n]=rm(t);this.state={viewedRoomId:t||void 0,primaryCall:a||null,secondaryCall:n[0],persistentWidgetId:ki.b.instance.getPersistentWidgetId(),persistentRoomId:ki.b.instance.getPersistentRoomId(),showWidgetInPip:!1}}componentDidMount(){var e;B.b.instance.addListener(B.a.CallChangeRoom,this.updateCalls),B.b.instance.addListener(B.a.CallState,this.updateCalls),rt.b.instance.roomViewStore.addListener(pt.b,this.onRoomViewStoreUpdate),lt.a.get().on(Ea.d.RemoteHoldUnhold,this.onCallRemoteHold);const t=null===(e=lt.a.get())||void 0===e?void 0:e.getRoom(this.state.viewedRoomId);t&&an.d.instance.on(an.d.emissionForRoom(t),this.updateCalls),ki.b.instance.on(ki.a.Persistence,this.onWidgetPersistence),ki.b.instance.on(ki.a.Dock,this.onWidgetDockChanges),ki.b.instance.on(ki.a.Undock,this.onWidgetDockChanges)}componentWillUnmount(){B.b.instance.removeListener(B.a.CallChangeRoom,this.updateCalls),B.b.instance.removeListener(B.a.CallState,this.updateCalls);const e=lt.a.get();null==e||e.removeListener(Ea.d.RemoteHoldUnhold,this.onCallRemoteHold),rt.b.instance.roomViewStore.removeListener(pt.b,this.onRoomViewStoreUpdate);const t=null==e?void 0:e.getRoom(this.state.viewedRoomId);t&&an.d.instance.off(an.d.emissionForRoom(t),this.updateCalls),ki.b.instance.off(ki.a.Persistence,this.onWidgetPersistence),ki.b.instance.off(ki.a.Dock,this.onWidgetDockChanges),ki.b.instance.off(ki.a.Undock,this.onWidgetDockChanges)}updateShowWidgetInPip(){const e=ki.b.instance.getPersistentWidgetId(),t=ki.b.instance.getPersistentRoomId();let a=!1,n=!1;e&&lt.a.get().getRoom(t)&&(n=!ki.b.instance.isDocked(e,t),a=this.state.viewedRoomId!==t);const i=a||n;this.setState({showWidgetInPip:i,persistentWidgetId:e,persistentRoomId:t})}createVoiceBroadcastPlaybackPipContent(e){const t=this.state.viewedRoomId===e.infoEvent.getRoomId()?r.a.createElement(Et.j,{playback:e,pip:!0}):r.a.createElement(Et.B,{playback:e});return a=>{let{onStartMoving:n}=a;return r.a.createElement("div",{key:e.infoEvent.getId(),onMouseDown:n},t)}}createVoiceBroadcastPreRecordingPipContent(e){return t=>{let{onStartMoving:a}=t;return r.a.createElement("div",{onMouseDown:a},r.a.createElement(Et.p,{voiceBroadcastPreRecording:e}))}}createVoiceBroadcastRecordingPipContent(e){return t=>{let{onStartMoving:a}=t;return r.a.createElement("div",{onMouseDown:a},r.a.createElement(Et.w,{recording:e}))}}render(){let e=[];if(this.props.voiceBroadcastRecording?e=[this.createVoiceBroadcastRecordingPipContent(this.props.voiceBroadcastRecording)]:this.props.voiceBroadcastPreRecording?e=[this.createVoiceBroadcastPreRecordingPipContent(this.props.voiceBroadcastPreRecording)]:this.props.voiceBroadcastPlayback&&(e=[this.createVoiceBroadcastPlaybackPipContent(this.props.voiceBroadcastPlayback)]),this.state.primaryCall){const t=this.state.primaryCall;e.push((e=>{let{onStartMoving:a,onResize:n}=e;return r.a.createElement(Bl,{onMouseDownOnHeader:a,call:t,secondaryCall:this.state.secondaryCall,pipMode:true,onResize:n})}))}return this.state.showWidgetInPip&&e.push((e=>{let{onStartMoving:t}=e;return r.a.createElement(im,{widgetId:this.state.persistentWidgetId,room:lt.a.get().getRoom(this.state.persistentRoomId),viewingRoom:this.state.viewedRoomId===this.state.persistentRoomId,onStartMoving:t,movePersistedElement:this.props.movePersistedElement})})),e.length?r.a.createElement(Jd.a,{className:"mx_LegacyCallPreview",draggable:true,onDoubleClick:this.onDoubleClick,onMove:this.onMove},e):null}}const lm=()=>{const e=Object(s.useContext)(rt.a),t=e.voiceBroadcastPreRecordingStore,{currentVoiceBroadcastPreRecording:a}=Object(Et.Q)(t),n=e.voiceBroadcastRecordingsStore,{currentVoiceBroadcastRecording:i}=Object(Et.R)(n),o=e.voiceBroadcastPlaybacksStore,{currentVoiceBroadcastPlayback:l}=(c=o,{currentVoiceBroadcastPlayback:Object(ie.d)(c,Qd.b.CurrentChanged,(e=>null!=e?e:c.getCurrent()))});var c;const d=Object(s.useRef)();return r.a.createElement(om,{voiceBroadcastPlayback:l,voiceBroadcastPreRecording:a,voiceBroadcastRecording:i,movePersistedElement:d})};function cm(e){return e.closest("input, textarea, select, [contenteditable=true]")}class dm extends r.a.Component{constructor(e){super(e),i()(this,"_matrixClient",void 0),i()(this,"_roomView",void 0),i()(this,"_resizeContainer",void 0),i()(this,"resizeHandler",void 0),i()(this,"layoutWatcherRef",void 0),i()(this,"compactLayoutWatcherRef",void 0),i()(this,"backgroundImageWatcherRef",void 0),i()(this,"resizer",void 0),i()(this,"onCallState",(()=>{const e=B.b.instance.getAllActiveCalls();e!==this.state.activeCalls&&this.setState({activeCalls:e})})),i()(this,"refreshBackgroundImage",(async()=>{let e=b.b.getValue("RoomList.backgroundImage");e=e?Object(Ga.b)(e).srcHttp:ht.a.instance.getHttpAvatarUrl(),this.setState({backgroundImage:e})})),i()(this,"canResetTimelineInRoom",(e=>!this._roomView.current||this._roomView.current.canResetTimeline())),i()(this,"onAccountData",(e=>{"m.ignored_user_list"===e.getType()&&v.a.dispatch({action:"ignore_state_changed"})})),i()(this,"onCompactLayoutChanged",(()=>{this.setState({useCompactLayout:b.b.getValue("useCompactLayout")})})),i()(this,"onSync",((e,t,a)=>{var n,i,s;const r=null===(n=this.state.syncErrorData)||void 0===n||null===(i=n.error)||void 0===i?void 0:i.errcode,o=null==a||null===(s=a.error)||void 0===s?void 0:s.errcode;e===t&&r===o||(this.setState({syncErrorData:e===d.b.Error?a:null}),t===d.b.Prepared&&e===d.b.Syncing?this.updateServerNoticeEvents():this.calculateServerLimitToast(this.state.syncErrorData,this.state.usageLimitEventContent))})),i()(this,"onRoomStateEvents",(e=>{const t=aa.c.instance.orderedLists[T.a.ServerNotice];null!=t&&t.some((t=>t.roomId===e.getRoomId()))&&this.updateServerNoticeEvents()})),i()(this,"onUsageLimitDismissed",(()=>{this.setState({usageLimitDismissed:!0})})),i()(this,"updateServerNoticeEvents",(async()=>{const e=aa.c.instance.orderedLists[T.a.ServerNotice];if(!e)return;const t=[];let a=0;for(const n of e){const e=n.currentState.getStateEvents("m.room.pinned_events","");if(!e||!e.getContent().pinned)continue;a=e.getTs();const i=e.getContent().pinned.slice(0,2);for(const e of i){const a=(await this._matrixClient.getEventTimeline(n.getUnfilteredTimelineSet(),e)).getEvents().find((t=>t.getId()===e));a&&t.push(a)}}if(a&&this.state.usageLimitEventTs>a)return;const n=t.find((e=>e&&"m.room.message"===e.getType()&&"m.server_notice.usage_limit_reached"===e.getContent().server_notice_type)),i=null==n?void 0:n.getContent();this.calculateServerLimitToast(this.state.syncErrorData,i),this.setState({usageLimitEventContent:i,usageLimitEventTs:a,usageLimitDismissed:!1})})),i()(this,"onPaste",(e=>{const t=cm(e.target);if(t!==document.activeElement)if(null!=t&&t.focus)t.focus();else{const e=!!document.activeElement.closest(".mx_ThreadView");v.a.dispatch({action:U.a.FocusSendMessageComposer,context:e?Qa.a.Thread:Qa.a.Room},!0)}})),i()(this,"onReactKeyDown",(e=>{this.onKeyDown(e)})),i()(this,"onNativeKeyDown",(e=>{e.target===document.body&&this.onKeyDown(e)})),i()(this,"onKeyDown",(e=>{let t=!1;switch(Object(J.a)().getRoomAction(e)){case W.h.ScrollUp:case W.h.ScrollDown:case W.h.JumpToFirstMessage:case W.h.JumpToLatestMessage:this.onScrollKeyPressed(e),t=!0;break;case W.h.SearchInRoom:v.a.dispatch({action:"focus_search"}),t=!0}if(t)return e.stopPropagation(),void e.preventDefault();switch(Object(J.a)().getNavigationAction(e)){case W.h.FilterRooms:v.a.dispatch({action:"focus_room_filter"}),t=!0;break;case W.h.ToggleUserMenu:v.a.fire(U.a.ToggleUserMenu),t=!0;break;case W.h.ShowKeyboardSettings:v.a.dispatch({action:U.a.ViewUserSettings,initialTabId:Ae.a.Keyboard}),t=!0;break;case W.h.GoToHome:v.a.dispatch({action:U.a.ViewHomePage}),H.b.closeCurrentModal("homeKeyboardShortcut"),t=!0;break;case W.h.ToggleSpacePanel:v.a.fire(U.a.ToggleSpacePanel),t=!0;break;case W.h.ToggleRoomSidePanel:"room_view"===this.props.page_type&&(Aa.a.instance.togglePanel(null),t=!0);break;case W.h.SelectPrevRoom:v.a.dispatch({action:U.a.ViewRoomDelta,delta:-1,unread:!1}),t=!0;break;case W.h.SelectNextRoom:v.a.dispatch({action:U.a.ViewRoomDelta,delta:1,unread:!1}),t=!0;break;case W.h.SelectPrevUnreadRoom:v.a.dispatch({action:U.a.ViewRoomDelta,delta:-1,unread:!0});break;case W.h.SelectNextUnreadRoom:v.a.dispatch({action:U.a.ViewRoomDelta,delta:1,unread:!0});break;case W.h.PreviousVisitedRoomOrSpace:I.a.get().navigateForwardBack(!0),t=!0;break;case W.h.NextVisitedRoomOrSpace:I.a.get().navigateForwardBack(!1),t=!0}if(!t){switch(Object(J.a)().getLabsAction(e)){case W.h.ToggleHiddenEventVisibility:{const e=b.b.getValueAt(f.a.DEVICE,"showHiddenEventsInTimeline",void 0,!1);b.b.setValue("showHiddenEventsInTimeline",void 0,f.a.DEVICE,!e),t=!0;break}}}if(!t&&I.a.get().overrideBrowserShortcuts()&&e.code.startsWith("Digit")&&"Digit0"!==e.code&&Object(u.c)(e)&&(v.a.dispatch({action:U.a.SwitchSpace,num:parseInt(e.code.slice(5),10)}),t=!0),t)return e.stopPropagation(),void e.preventDefault();if(!(e.key===u.b.ALT||e.key===u.b.CONTROL||e.key===u.b.META||e.key===u.b.SHIFT)&&!e.ctrlKey&&!e.metaKey){const t=e.target!==document.body&&(e.key===u.b.SPACE||e.key===u.b.ENTER),a=1===e.key.length||"Dead"===e.key;if(!t&&a&&!cm(e.target)){const t=!!document.activeElement.closest(".mx_ThreadView");v.a.dispatch({action:U.a.FocusSendMessageComposer,context:t?Qa.a.Thread:Qa.a.Room},!0),e.stopPropagation()}}})),i()(this,"onScrollKeyPressed",(e=>{var t;null===(t=this._roomView.current)||void 0===t||t.handleScrollKey(e)})),this.state={syncErrorData:void 0,useCompactLayout:b.b.getValue("useCompactLayout"),usageLimitDismissed:!1,activeCalls:B.b.instance.getAllActiveCalls()},this._matrixClient=this.props.matrixClient,p.c.loadDevices(),Object(g.a)(),this._roomView=r.a.createRef(),this._resizeContainer=r.a.createRef(),this.resizeHandler=r.a.createRef()}componentDidMount(){document.addEventListener("keydown",this.onNativeKeyDown,!1),B.b.instance.addListener(B.a.CallState,this.onCallState),this.updateServerNoticeEvents(),this._matrixClient.on(o.b.AccountData,this.onAccountData),this._matrixClient.on(o.b.Sync,this.onSync),this.onSync(this._matrixClient.getSyncState(),null,this._matrixClient.getSyncStateData()),this._matrixClient.on(m.b.Events,this.onRoomStateEvents),this.layoutWatcherRef=b.b.watchSetting("layout",null,this.onCompactLayoutChanged),this.compactLayoutWatcherRef=b.b.watchSetting("useCompactLayout",null,this.onCompactLayoutChanged),this.backgroundImageWatcherRef=b.b.watchSetting("RoomList.backgroundImage",null,this.refreshBackgroundImage),this.resizer=this.createResizer(),this.resizer.attach(),ht.a.instance.on(pt.b,this.refreshBackgroundImage),this.loadResizerPreferences(),this.refreshBackgroundImage()}componentWillUnmount(){document.removeEventListener("keydown",this.onNativeKeyDown,!1),B.b.instance.removeListener(B.a.CallState,this.onCallState),this._matrixClient.removeListener(o.b.AccountData,this.onAccountData),this._matrixClient.removeListener(o.b.Sync,this.onSync),this._matrixClient.removeListener(m.b.Events,this.onRoomStateEvents),ht.a.instance.off(pt.b,this.refreshBackgroundImage),b.b.unwatchSetting(this.layoutWatcherRef),b.b.unwatchSetting(this.compactLayoutWatcherRef),b.b.unwatchSetting(this.backgroundImageWatcherRef),this.resizer.detach()}createResizer(){let e,t;const a={toggleSize:156,onCollapsed:e=>{t=e,e?(v.a.dispatch({action:"hide_left_panel"}),window.localStorage.setItem("mx_lhs_size","0")):v.a.dispatch({action:"show_left_panel"})},onResized:t=>{e=t,this.props.resizeNotifier.notifyLeftHandleResized()},onResizeStart:()=>{this.props.resizeNotifier.startResizing()},onResizeStop:()=>{t||window.localStorage.setItem("mx_lhs_size",""+e),this.props.resizeNotifier.stopResizing()},isItemCollapsed:e=>e.classList.contains("mx_LeftPanel_minimized"),handler:this.resizeHandler.current},n=new j(this._resizeContainer.current,x,a);return n.setClassNames({handle:"mx_ResizeHandle",vertical:"mx_ResizeHandle_vertical",reverse:"mx_ResizeHandle_reverse"}),n}loadResizerPreferences(){let e=parseInt(window.localStorage.getItem("mx_lhs_size"),10);isNaN(e)&&(e=350),this.resizer.forHandleWithId("lp-resizer").resize(e)}calculateServerLimitToast(e,t){var a;const n="M_RESOURCE_LIMIT_EXCEEDED"===(null==e||null===(a=e.error)||void 0===a?void 0:a.errcode);n&&(t=(null==e?void 0:e.error).data),t&&this.state.usageLimitDismissed?((e,t,a,n)=>{const i=Object(M.a)(e,a,{monthly_active_user:Object(N.c)("Your homeserver has exceeded its user limit."),hs_blocked:Object(N.c)("This homeserver has been blocked by its administrator."),"":Object(N.c)("Your homeserver has exceeded one of its resource limits.")}),s=Object(M.a)(e,a,{"":Object(N.c)("Contact your <a>server admin</a>.")});P.a.sharedInstance().addOrReplaceToast({key:A,title:Object(N.a)("Warning"),props:{description:r.a.createElement(r.a.Fragment,null,i," ",s),acceptLabel:Object(N.a)("Ok"),onAccept:()=>{L(),t&&t()}},component:D.a,priority:70})})(t.limit_type,this.onUsageLimitDismissed,t.admin_contact):L()}render(){let e;switch(this.props.page_type){case h.a.RoomView:e=r.a.createElement(zd,{ref:this._roomView,onRegistered:this.props.onRegistered,threepidInvite:this.props.threepidInvite,oobData:this.props.roomOobData,key:this.props.currentRoomId||"roomview",resizeNotifier:this.props.resizeNotifier,justCreatedOpts:this.props.roomJustCreatedOpts,forceTimeline:this.props.forceTimeline});break;case h.a.HomePage:e=r.a.createElement(ca.a,{justRegistered:this.props.justRegistered});break;case h.a.UserView:e=r.a.createElement(Kd,{userId:this.props.currentUserId,resizeNotifier:this.props.resizeNotifier})}const t=c()({mx_MatrixChat_wrapper:!0,mx_MatrixChat_useCompactLayout:this.state.useCompactLayout}),a=c()({mx_MatrixChat:!0,"mx_MatrixChat--with-avatar":this.state.backgroundImage}),n=this.state.activeCalls.map((e=>r.a.createElement(wa,{call:e,key:e.callId})));return r.a.createElement(R.a.Provider,{value:this._matrixClient},r.a.createElement("div",{onPaste:this.onPaste,onKeyDown:this.onReactKeyDown,className:t,"aria-hidden":this.props.hideToSRUsers},r.a.createElement(Gd,null),r.a.createElement("div",{className:a},r.a.createElement("div",{className:"mx_LeftPanel_outerWrapper"},r.a.createElement(Yd,{isMinimized:this.props.collapseLhs||!1}),r.a.createElement("nav",{className:"mx_LeftPanel_wrapper"},r.a.createElement(qd,{blurMultiplier:.5,backgroundImage:this.state.backgroundImage}),r.a.createElement(Pt,null),r.a.createElement(qd,{backgroundImage:this.state.backgroundImage}),r.a.createElement("div",{className:"mx_LeftPanel_wrapper--user",ref:this._resizeContainer,"data-collapsed":!!this.props.collapseLhs||void 0},r.a.createElement(ua,{pageType:this.props.page_type,isMinimized:this.props.collapseLhs||!1,resizeNotifier:this.props.resizeNotifier})))),r.a.createElement(y,{passRef:this.resizeHandler,id:"lp-resizer"}),r.a.createElement("div",{className:"mx_RoomView_wrapper"},e))),r.a.createElement(lm,null),r.a.createElement(pa,null),r.a.createElement(ya,null),n)}}i()(dm,"displayName","LoggedInView");t.a=dm},1571:function(e,t,a){"use strict";a.d(t,"a",(function(){return Di}));var n=a(13),i=a.n(n),s=a(120),r=a.n(s),o=a(332),l=a(121),c=a(272),d=a(1),m=a(136),u=a(122),h=a(139),p=a(131);var g=a(249),v=a(127),b=a(144),f=a(163),y=a(123),E=a(862),_=a(864),S=a(261),w=a(293),O=a(159);class C extends r.a.Component{constructor(e){var t,a,n;super(e),i()(this,"avatarUpload",Object(s.createRef)()),i()(this,"uploadAvatar",(()=>{var e;null===(e=this.avatarUpload.current)||void 0===e||e.click()})),i()(this,"removeAvatar",(()=>{this.avatarUpload.current.value="",this.setState({avatarUrl:void 0,avatarFile:null,enableProfileSave:!0})})),i()(this,"cancelProfileChanges",(async e=>{var t;e.stopPropagation(),e.preventDefault(),this.state.enableProfileSave&&this.setState({enableProfileSave:!1,displayName:this.state.originalDisplayName,avatarUrl:null!==(t=this.state.originalAvatarUrl)&&void 0!==t?t:void 0,avatarFile:null})})),i()(this,"saveProfile",(async e=>{if(e.stopPropagation(),e.preventDefault(),!this.state.enableProfileSave)return;this.setState({enableProfileSave:!1});const t=u.a.get(),a={},n=this.state.displayName.trim();try{if(this.state.originalDisplayName!==this.state.displayName&&(await t.setDisplayName(n),a.originalDisplayName=n,a.displayName=n),this.state.avatarFile){var i;d.a.log(`Uploading new avatar, ${this.state.avatarFile.name} of type ${this.state.avatarFile.type}, (${this.state.avatarFile.size}) bytes`);const{content_uri:e}=await t.uploadContent(this.state.avatarFile);await t.setAvatarUrl(e),a.avatarUrl=null!==(i=Object(f.b)(e).getSquareThumbnailHttp(96))&&void 0!==i?i:void 0,a.originalAvatarUrl=a.avatarUrl,a.avatarFile=null}else this.state.originalAvatarUrl!==this.state.avatarUrl&&await t.setAvatarUrl("")}catch(e){d.a.log("Failed to save profile",e),v.b.createDialog(b.a,{title:Object(l.a)("Failed to save your profile"),description:e&&e.message?e.message:Object(l.a)("The operation could not be completed")})}this.setState(a)})),i()(this,"onDisplayNameChanged",(e=>{this.setState({displayName:e.target.value,enableProfileSave:!0})})),i()(this,"onAvatarChanged",(e=>{var t;if(!e.target.files||!e.target.files.length)return void this.setState({avatarUrl:null!==(t=this.state.originalAvatarUrl)&&void 0!==t?t:void 0,avatarFile:null,enableProfileSave:!1});const a=e.target.files[0],n=new FileReader;n.onload=e=>{var t;this.setState({avatarUrl:null===(t=e.target)||void 0===t?void 0:t.result,avatarFile:a,enableProfileSave:!0})},n.readAsDataURL(a)}));const r=u.a.get();let o=g.a.instance.avatarMxc;o&&(o=Object(f.b)(o).getSquareThumbnailHttp(96)),this.state={userId:r.getUserId(),originalDisplayName:null!==(t=g.a.instance.displayName)&&void 0!==t?t:"",displayName:null!==(a=g.a.instance.displayName)&&void 0!==a?a:"",originalAvatarUrl:o,avatarUrl:null!==(n=o)&&void 0!==n?n:void 0,avatarFile:null,enableProfileSave:!1}}render(){var e;const t=function(e){const t=p.b.get().hosting_signup_link;if(!t)return null;if(!e)return t;if("matrix.org"!==u.a.get().getDomain())return null;try{const a=new URL(t);return a.searchParams.set("utm_campaign",e),a.toString()}catch(e){return t}}("user-settings");let a;t&&(a=r.a.createElement("span",null,Object(l.a)("<a>Upgrade</a> to your own domain",{},{a:e=>r.a.createElement(_.a,{href:t,target:"_blank",rel:"noreferrer noopener"},e)})));const n=S.a.getDisplayUserIdentifier(this.state.userId,{withDisplayName:!0}),i=null===(e=this.state.avatarUrl)||void 0===e?void 0:e.toString();return r.a.createElement("form",{onSubmit:this.saveProfile,autoComplete:"off",noValidate:!0,className:"mx_ProfileSettings"},r.a.createElement("input",{type:"file",ref:this.avatarUpload,className:"mx_ProfileSettings_avatarUpload",onClick:e=>{Object(w.a)(e),O.b.trackInteraction("WebProfileSettingsAvatarUploadButton",e)},onChange:this.onAvatarChanged,accept:"image/*"}),r.a.createElement("div",{className:"mx_ProfileSettings_profile"},r.a.createElement("div",{className:"mx_ProfileSettings_profile_controls"},r.a.createElement("span",{className:"mx_SettingsTab_subheading"},Object(l.a)("Profile")),r.a.createElement(h.a,{label:Object(l.a)("Display Name"),type:"text",value:this.state.displayName,autoComplete:"off",onChange:this.onDisplayNameChanged}),r.a.createElement("p",null,n&&r.a.createElement("span",{className:"mx_ProfileSettings_profile_controls_userId"},n),a)),r.a.createElement(E.a,{avatarUrl:i,avatarName:this.state.displayName||this.state.userId,avatarAltText:Object(l.a)("Profile picture"),uploadAvatar:this.uploadAvatar,removeAvatar:this.removeAvatar})),r.a.createElement("div",{className:"mx_ProfileSettings_buttons"},r.a.createElement(y.a,{onClick:this.cancelProfileChanges,kind:"link",disabled:!this.state.enableProfileSave},Object(l.a)("Cancel")),r.a.createElement(y.a,{onClick:this.saveProfile,kind:"primary",disabled:!this.state.enableProfileSave},Object(l.a)("Save"))))}}var x=a(125),k=a(912),j=a(279),R=a(157),I=a(134);class T extends r.a.Component{constructor(e){super(e),this.onSearchChange=this.onSearchChange.bind(this),this.state={searchQuery:"",languages:null}}componentDidMount(){const e=R.a.get();e&&e.getAvailableSpellCheckLanguages().then((e=>{e.sort((function(e,t){return e<t?-1:e>t?1:0}));const t=[];e.forEach((e=>{t.push({label:e,value:e})})),this.setState({languages:t})})).catch((e=>{this.setState({languages:[{value:"en",label:"English"}]})}))}onSearchChange(e){this.setState({searchQuery:e})}render(){if(null===this.state.languages)return r.a.createElement(I.a,null);let e;e=this.state.searchQuery?this.state.languages.filter((e=>function(e,t){return!!t.label.toUpperCase().includes(e.toUpperCase())||t.value.toUpperCase()===e.toUpperCase()}(this.state.searchQuery,e))):this.state.languages;const t=e.map((e=>r.a.createElement("div",{key:e.value},e.label)));let a=x.b.getValue("language",null,!0),n=null;return a||(a=navigator.language||navigator.userLanguage),n=this.props.value||a,r.a.createElement(j.a,{id:"mx_LanguageDropdown",className:this.props.className,onOptionChange:this.props.onOptionChange,onSearchChange:this.onSearchChange,searchEnabled:!0,value:n,label:Object(l.a)("Language Dropdown"),placeholder:Object(l.a)("Choose a locale")},t)}}class N extends r.a.Component{constructor(){super(...arguments),i()(this,"onRemove",(e=>(e.stopPropagation(),e.preventDefault(),this.props.onRemoved(this.props.language))))}render(){return r.a.createElement("div",{className:"mx_ExistingSpellCheckLanguage"},r.a.createElement("span",{className:"mx_ExistingSpellCheckLanguage_language"},this.props.language),r.a.createElement(y.a,{onClick:this.onRemove,kind:"danger_sm"},Object(l.a)("Remove")))}}class D extends r.a.Component{constructor(e){super(e),i()(this,"onRemoved",(e=>{const t=this.props.languages.filter((t=>t!==e));this.props.onLanguagesChange(t)})),i()(this,"onAddClick",(e=>{e.stopPropagation(),e.preventDefault();const t=this.state.newLanguage;this.setState({newLanguage:""}),t&&(this.props.languages.includes(t)||(this.props.languages.push(t),this.props.onLanguagesChange(this.props.languages)))})),i()(this,"onNewLanguageChange",(e=>{this.state.newLanguage!==e&&this.setState({newLanguage:e})})),this.state={newLanguage:""}}render(){const e=this.props.languages.map((e=>r.a.createElement(N,{language:e,onRemoved:this.onRemoved,key:e}))),t=r.a.createElement(y.a,{onClick:this.onAddClick,kind:"primary"},Object(l.a)("Add"));return r.a.createElement("div",{className:"mx_SpellCheckLanguages"},e,r.a.createElement("form",{onSubmit:this.onAddClick,noValidate:!0},r.a.createElement(T,{className:"mx_GeneralUserSettingsTab_spellCheckLanguageInput",value:this.state.newLanguage,onOptionChange:this.onNewLanguageChange}),t))}}var P=a(517),M=a(320),A=a(177),L=a(135),U=a(124),F=a(128);class B extends r.a.Component{constructor(e){super(e),i()(this,"onStagePhaseChange",((e,t)=>{const a={[M.c.PHASE_PREAUTH]:{body:Object(l.a)("Confirm your account deactivation by using Single Sign On to prove your identity."),continueText:Object(l.a)("Single Sign On"),continueKind:"danger"},[M.c.PHASE_POSTAUTH]:{body:Object(l.a)("Are you sure you want to deactivate your account? This is irreversible."),continueText:Object(l.a)("Confirm account deactivation"),continueKind:"danger"}},n={[M.c.LOGIN_TYPE]:a,[M.c.UNSTABLE_LOGIN_TYPE]:a,[M.b.LOGIN_TYPE]:{[M.a]:{body:Object(l.a)("To continue, please enter your account password:")}}}[e];let i=null,s=null,r=null;if(n){const e=n[t];null!=e&&e.body&&(i=e.body),null!=e&&e.continueText&&(s=e.continueText),null!=e&&e.continueKind&&(r=e.continueKind)}this.setState({bodyText:i,continueText:s,continueKind:r})})),i()(this,"onUIAuthFinished",((e,t)=>{e||(t!==P.a?(d.a.error("Error during UI Auth:",{result:t}),this.setState({errStr:Object(l.a)("There was a problem communicating with the server. Please try again.")})):this.onCancel())})),i()(this,"onUIAuthComplete",(e=>{u.a.get().deactivateAccount(e,this.state.shouldErase).then((e=>{U.a.fire(F.a.TriggerLogout),this.props.onFinished(!0)})).catch((e=>{d.a.error(e),this.setState({errStr:Object(l.a)("There was a problem communicating with the server. Please try again.")})}))})),i()(this,"onEraseFieldChange",(e=>{this.setState({shouldErase:e.currentTarget.checked,authEnabled:!1}),this.initAuth(e.currentTarget.checked)})),this.state={shouldErase:!1,errStr:null,authData:null,authEnabled:!0,bodyText:null,continueText:null,continueKind:null},this.initAuth(!1)}onCancel(){this.props.onFinished(!1)}initAuth(e){u.a.get().deactivateAccount(null,e).then((e=>{d.a.warn("User's account got deactivated without confirmation: Server had no auth"),this.setState({errStr:Object(l.a)("Server did not require any authentication")})})).catch((e=>{e&&401===e.httpStatus&&e.data?this.setState({authData:e.data,authEnabled:!0}):this.setState({errStr:Object(l.a)("Server did not return valid authentication information.")})}))}render(){let e=null;this.state.errStr&&(e=r.a.createElement("div",{className:"error"},this.state.errStr));let t=r.a.createElement("div",null,Object(l.a)("Loading…"));return this.state.authData&&this.state.authEnabled&&(t=r.a.createElement("div",null,this.state.bodyText,r.a.createElement(P.b,{matrixClient:u.a.get(),authData:this.state.authData,makeRequest:this.onUIAuthComplete,onAuthFinished:this.onUIAuthFinished,onStagePhaseChange:this.onStagePhaseChange,continueText:this.state.continueText,continueKind:this.state.continueKind}))),r.a.createElement(L.a,{className:"mx_DeactivateAccountDialog",onFinished:this.props.onFinished,titleClass:"danger",title:Object(l.a)("Deactivate Account"),screenName:"DeactivateAccount"},r.a.createElement("div",{className:"mx_Dialog_content"},r.a.createElement("p",null,Object(l.a)("Confirm that you would like to deactivate your account. If you proceed:")),r.a.createElement("ul",null,r.a.createElement("li",null,Object(l.a)("You will not be able to reactivate your account")),r.a.createElement("li",null,Object(l.a)("You will no longer be able to log in")),r.a.createElement("li",null,Object(l.a)("No one will be able to reuse your username (MXID), including you: this username will remain unavailable")),r.a.createElement("li",null,Object(l.a)("You will leave all rooms and DMs that you are in")),r.a.createElement("li",null,Object(l.a)("You will be removed from the identity server: your friends will no longer be able to find you with your email or phone number"))),r.a.createElement("p",null,Object(l.a)("Your old messages will still be visible to people who received them, just like emails you sent in the past. Would you like to hide your sent messages from people who join rooms in the future?")),r.a.createElement("div",{className:"mx_DeactivateAccountDialog_input_section"},r.a.createElement("p",null,r.a.createElement(A.b,{checked:this.state.shouldErase,onChange:this.onEraseFieldChange},Object(l.a)("Hide my messages from new joiners"))),e,t)))}}var V=a(495),W=a(291),H=a(363);async function z(e,t){const a=e.getUserId();let{threepids:n}=await e.getThreePids();if(t&&(n=n.filter((e=>e.medium===t))),n.length>0&&e.getIdentityServerUrl())try{const i=new W.a,s=await i.getAccessToken({check:!1}),r=n.map((e=>{let{medium:t,address:a}=e;return[t,a]})),o=await e.bulkLookupThreePids(r,s);for(const[e,i,s]of o.threepids){if(s!==a)continue;if(t&&e!==t)continue;const r=n.find((t=>t.medium===e&&t.address===i));r&&(r.bound=!0)}}catch(e){if("M_TERMS_NOT_SIGNED"!==e.errcode)throw e}return n}var G=a(137),K=a(156);let q;!function(e){e.Email="email",e.Phone="msisdn"}(q||(q={}));var $=a(257);function Y(){return u.a.get().idBaseUrl.split("://")[1]}class J{constructor(){i()(this,"sessionId",void 0),i()(this,"submitUrl",void 0),i()(this,"clientSecret",void 0),i()(this,"bind",void 0),i()(this,"makeAddThreepidOnlyRequest",(e=>u.a.get().addThreePidOnly({sid:this.sessionId,client_secret:this.clientSecret,auth:e}))),this.clientSecret=u.a.get().generateClientSecret()}addEmailAddress(e){return u.a.get().requestAdd3pidEmailToken(e,this.clientSecret,1).then((e=>(this.sessionId=e.sid,e)),(function(e){throw"M_THREEPID_IN_USE"===e.errcode?e.message=Object(l.a)("This email address is already in use"):e.httpStatus&&(e.message=e.message+` (Status ${e.httpStatus})`),e}))}async bindEmailAddress(e){if(this.bind=!0,await u.a.get().doesServerSupportSeparateAddAndBind()){const t=new W.a,a=await t.getAccessToken();return u.a.get().requestEmailToken(e,this.clientSecret,1,void 0,a).then((e=>(this.sessionId=e.sid,e)),(function(e){throw"M_THREEPID_IN_USE"===e.errcode?e.message=Object(l.a)("This email address is already in use"):e.httpStatus&&(e.message=e.message+` (Status ${e.httpStatus})`),e}))}return this.addEmailAddress(e)}addMsisdn(e,t){return u.a.get().requestAdd3pidMsisdnToken(e,t,this.clientSecret,1).then((e=>(this.sessionId=e.sid,this.submitUrl=e.submit_url,e)),(function(e){throw"M_THREEPID_IN_USE"===e.errcode?e.message=Object(l.a)("This phone number is already in use"):e.httpStatus&&(e.message=e.message+` (Status ${e.httpStatus})`),e}))}async bindMsisdn(e,t){if(this.bind=!0,await u.a.get().doesServerSupportSeparateAddAndBind()){const a=new W.a,n=await a.getAccessToken();return u.a.get().requestMsisdnToken(e,t,this.clientSecret,1,void 0,n).then((e=>(this.sessionId=e.sid,e)),(function(e){throw"M_THREEPID_IN_USE"===e.errcode?e.message=Object(l.a)("This phone number is already in use"):e.httpStatus&&(e.message=e.message+` (Status ${e.httpStatus})`),e}))}return this.addMsisdn(e,t)}async checkEmailLinkClicked(){try{if(await u.a.get().doesServerSupportSeparateAddAndBind())if(this.bind){const e=new W.a,t=await e.getAccessToken();await u.a.get().bindThreePid({sid:this.sessionId,client_secret:this.clientSecret,id_server:Y(),id_access_token:t})}else try{return void await this.makeAddThreepidOnlyRequest()}catch(e){if(401!==e.httpStatus||!e.data||!e.data.flows)throw e;const t={[M.c.PHASE_PREAUTH]:{title:Object(l.a)("Use Single Sign On to continue"),body:Object(l.a)("Confirm adding this email address by using Single Sign On to prove your identity."),continueText:Object(l.a)("Single Sign On"),continueKind:"primary"},[M.c.PHASE_POSTAUTH]:{title:Object(l.a)("Confirm adding email"),body:Object(l.a)("Click the button below to confirm adding this email address."),continueText:Object(l.a)("Confirm"),continueKind:"primary"}},{finished:a}=v.b.createDialog($.a,{title:Object(l.a)("Add Email Address"),matrixClient:u.a.get(),authData:e.data,makeRequest:this.makeAddThreepidOnlyRequest,aestheticsForStagePhases:{[M.c.LOGIN_TYPE]:t,[M.c.UNSTABLE_LOGIN_TYPE]:t}});return a}else await u.a.get().addThreePid({sid:this.sessionId,client_secret:this.clientSecret,id_server:Y()},this.bind)}catch(e){throw 401===e.httpStatus?e.message=Object(l.a)("Failed to verify email address: make sure you clicked the link in the email"):e.httpStatus&&(e.message+=` (Status ${e.httpStatus})`),e}}async haveMsisdnToken(e){const t=new W.a,a=await u.a.get().doesServerSupportSeparateAddAndBind();let n;if(this.submitUrl)n=await u.a.get().submitMsisdnTokenOtherUrl(this.submitUrl,this.sessionId,this.clientSecret,e);else{if(!this.bind&&a)throw new Error("The add / bind with MSISDN flow is misconfigured");n=await u.a.get().submitMsisdnToken(this.sessionId,this.clientSecret,e,await t.getAccessToken())}if(n.errcode)throw n;if(a)if(this.bind)await u.a.get().bindThreePid({sid:this.sessionId,client_secret:this.clientSecret,id_server:Y(),id_access_token:await t.getAccessToken()});else try{return void await this.makeAddThreepidOnlyRequest()}catch(e){if(401!==e.httpStatus||!e.data||!e.data.flows)throw e;const t={[M.c.PHASE_PREAUTH]:{title:Object(l.a)("Use Single Sign On to continue"),body:Object(l.a)("Confirm adding this phone number by using Single Sign On to prove your identity."),continueText:Object(l.a)("Single Sign On"),continueKind:"primary"},[M.c.PHASE_POSTAUTH]:{title:Object(l.a)("Confirm adding phone number"),body:Object(l.a)("Click the button below to confirm adding this phone number."),continueText:Object(l.a)("Confirm"),continueKind:"primary"}},{finished:a}=v.b.createDialog($.a,{title:Object(l.a)("Add Phone Number"),matrixClient:u.a.get(),authData:e.data,makeRequest:this.makeAddThreepidOnlyRequest,aestheticsForStagePhases:{[M.c.LOGIN_TYPE]:t,[M.c.UNSTABLE_LOGIN_TYPE]:t}});return a}else await u.a.get().addThreePid({sid:this.sessionId,client_secret:this.clientSecret,id_server:Y()},this.bind)}}var Q=a(641);class X extends r.a.Component{constructor(e){super(e),i()(this,"onRemove",(e=>{e.stopPropagation(),e.preventDefault(),this.setState({verifyRemove:!0})})),i()(this,"onDontRemove",(e=>{e.stopPropagation(),e.preventDefault(),this.setState({verifyRemove:!1})})),i()(this,"onActuallyRemove",(e=>{e.stopPropagation(),e.preventDefault(),u.a.get().deleteThreePid(this.props.msisdn.medium,this.props.msisdn.address).then((()=>this.props.onRemoved(this.props.msisdn))).catch((e=>{d.a.error("Unable to remove contact information: "+e),v.b.createDialog(b.a,{title:Object(l.a)("Unable to remove contact information"),description:e&&e.message?e.message:Object(l.a)("Operation failed")})}))})),this.state={verifyRemove:!1}}render(){return this.state.verifyRemove?r.a.createElement("div",{className:"mx_ExistingPhoneNumber"},r.a.createElement("span",{className:"mx_ExistingPhoneNumber_promptText"},Object(l.a)("Remove %(phone)s?",{phone:this.props.msisdn.address})),r.a.createElement(y.a,{onClick:this.onActuallyRemove,kind:"danger_sm",className:"mx_ExistingPhoneNumber_confirmBtn"},Object(l.a)("Remove")),r.a.createElement(y.a,{onClick:this.onDontRemove,kind:"link_sm",className:"mx_ExistingPhoneNumber_confirmBtn"},Object(l.a)("Cancel"))):r.a.createElement("div",{className:"mx_ExistingPhoneNumber"},r.a.createElement("span",{className:"mx_ExistingPhoneNumber_address"},"+",this.props.msisdn.address),r.a.createElement(y.a,{onClick:this.onRemove,kind:"danger_sm"},Object(l.a)("Remove")))}}class Z extends r.a.Component{constructor(e){super(e),i()(this,"onRemoved",(e=>{const t=this.props.msisdns.filter((t=>t!==e));this.props.onMsisdnsChange(t)})),i()(this,"onChangeNewPhoneNumber",(e=>{this.setState({newPhoneNumber:e.target.value})})),i()(this,"onChangeNewPhoneNumberCode",(e=>{this.setState({newPhoneNumberCode:e.target.value})})),i()(this,"onAddClick",(e=>{if(e.stopPropagation(),e.preventDefault(),!this.state.newPhoneNumber)return;const t=this.state.newPhoneNumber,a=this.state.phoneCountry,n=new J;this.setState({verifying:!0,continueDisabled:!0,addTask:n}),n.addMsisdn(a,t).then((e=>{this.setState({continueDisabled:!1,verifyMsisdn:e.msisdn})})).catch((e=>{d.a.error("Unable to add phone number "+t+" "+e),this.setState({verifying:!1,continueDisabled:!1,addTask:null}),v.b.createDialog(b.a,{title:Object(l.a)("Error"),description:e&&e.message?e.message:Object(l.a)("Operation failed")})}))})),i()(this,"onContinueClick",(e=>{e.stopPropagation(),e.preventDefault(),this.setState({continueDisabled:!0});const t=this.state.newPhoneNumberCode,a=this.state.verifyMsisdn;this.state.addTask.haveMsisdnToken(t).then((e=>{let[t]=e,n=this.state.newPhoneNumber;if(t){const e=[...this.props.msisdns,{address:a,medium:q.Phone}];this.props.onMsisdnsChange(e),n=""}this.setState({addTask:null,continueDisabled:!1,verifying:!1,verifyMsisdn:"",verifyError:null,newPhoneNumber:n,newPhoneNumberCode:""})})).catch((e=>{this.setState({continueDisabled:!1}),"M_THREEPID_AUTH_FAILED"!==e.errcode?(d.a.error("Unable to verify phone number: "+e),v.b.createDialog(b.a,{title:Object(l.a)("Unable to verify phone number."),description:e&&e.message?e.message:Object(l.a)("Operation failed")})):this.setState({verifyError:Object(l.a)("Incorrect verification code")})}))})),i()(this,"onCountryChanged",(e=>{this.setState({phoneCountry:e.iso2})})),this.state={verifying:!1,verifyError:null,verifyMsisdn:"",addTask:null,continueDisabled:!1,phoneCountry:"",newPhoneNumber:"",newPhoneNumberCode:""}}render(){const e=this.props.msisdns.map((e=>r.a.createElement(X,{msisdn:e,onRemoved:this.onRemoved,key:e.address})));let t=r.a.createElement(y.a,{onClick:this.onAddClick,kind:"primary"},Object(l.a)("Add"));if(this.state.verifying){const e=this.state.verifyMsisdn;t=r.a.createElement("div",null,r.a.createElement("div",null,Object(l.a)("A text message has been sent to +%(msisdn)s. Please enter the verification code it contains.",{msisdn:e}),r.a.createElement("br",null),this.state.verifyError),r.a.createElement("form",{onSubmit:this.onContinueClick,autoComplete:"off",noValidate:!0},r.a.createElement(h.a,{type:"text",label:Object(l.a)("Verification code"),autoComplete:"off",disabled:this.state.continueDisabled,value:this.state.newPhoneNumberCode,onChange:this.onChangeNewPhoneNumberCode}),r.a.createElement(y.a,{onClick:this.onContinueClick,kind:"primary",disabled:this.state.continueDisabled||0===this.state.newPhoneNumberCode.length},Object(l.a)("Continue"))))}const a=r.a.createElement(Q.a,{onOptionChange:this.onCountryChanged,className:"mx_PhoneNumbers_country",value:this.state.phoneCountry,disabled:this.state.verifying,isSmall:!0,showPrefix:!0});return r.a.createElement("div",{className:"mx_PhoneNumbers"},e,r.a.createElement("form",{onSubmit:this.onAddClick,autoComplete:"off",noValidate:!0,className:"mx_PhoneNumbers_new"},r.a.createElement("div",{className:"mx_PhoneNumbers_input"},r.a.createElement(h.a,{type:"text",label:Object(l.a)("Phone Number"),autoComplete:"off",disabled:this.state.verifying,prefixComponent:a,value:this.state.newPhoneNumber,onChange:this.onChangeNewPhoneNumber}))),t)}}var ee=a(325);class te extends r.a.Component{constructor(e){super(e),i()(this,"onRemove",(e=>{e.stopPropagation(),e.preventDefault(),this.setState({verifyRemove:!0})})),i()(this,"onDontRemove",(e=>{e.stopPropagation(),e.preventDefault(),this.setState({verifyRemove:!1})})),i()(this,"onActuallyRemove",(e=>{e.stopPropagation(),e.preventDefault(),u.a.get().deleteThreePid(this.props.email.medium,this.props.email.address).then((()=>this.props.onRemoved(this.props.email))).catch((e=>{d.a.error("Unable to remove contact information: "+e),v.b.createDialog(b.a,{title:Object(l.a)("Unable to remove contact information"),description:e&&e.message?e.message:Object(l.a)("Operation failed")})}))})),this.state={verifyRemove:!1}}render(){return this.state.verifyRemove?r.a.createElement("div",{className:"mx_ExistingEmailAddress"},r.a.createElement("span",{className:"mx_ExistingEmailAddress_promptText"},Object(l.a)("Remove %(email)s?",{email:this.props.email.address})),r.a.createElement(y.a,{onClick:this.onActuallyRemove,kind:"danger_sm",className:"mx_ExistingEmailAddress_confirmBtn"},Object(l.a)("Remove")),r.a.createElement(y.a,{onClick:this.onDontRemove,kind:"link_sm",className:"mx_ExistingEmailAddress_confirmBtn"},Object(l.a)("Cancel"))):r.a.createElement("div",{className:"mx_ExistingEmailAddress"},r.a.createElement("span",{className:"mx_ExistingEmailAddress_email"},this.props.email.address),r.a.createElement(y.a,{onClick:this.onRemove,kind:"danger_sm"},Object(l.a)("Remove")))}}class ae extends r.a.Component{constructor(e){super(e),i()(this,"onRemoved",(e=>{const t=this.props.emails.filter((t=>t!==e));this.props.onEmailsChange(t)})),i()(this,"onChangeNewEmailAddress",(e=>{this.setState({newEmailAddress:e.target.value})})),i()(this,"onAddClick",(e=>{if(e.stopPropagation(),e.preventDefault(),!this.state.newEmailAddress)return;const t=this.state.newEmailAddress;if(!ee.a(t))return void v.b.createDialog(b.a,{title:Object(l.a)("Invalid Email Address"),description:Object(l.a)("This doesn't appear to be a valid email address")});const a=new J;this.setState({verifying:!0,continueDisabled:!0,addTask:a}),a.addEmailAddress(t).then((()=>{this.setState({continueDisabled:!1})})).catch((e=>{d.a.error("Unable to add email address "+t+" "+e),this.setState({verifying:!1,continueDisabled:!1,addTask:null}),v.b.createDialog(b.a,{title:Object(l.a)("Unable to add email address"),description:e&&e.message?e.message:Object(l.a)("Operation failed")})}))})),i()(this,"onContinueClick",(e=>{e.stopPropagation(),e.preventDefault(),this.setState({continueDisabled:!0}),this.state.addTask.checkEmailLinkClicked().then((e=>{let[t]=e,a=this.state.newEmailAddress;if(t){const e=this.state.newEmailAddress,t=[...this.props.emails,{address:e,medium:q.Email}];this.props.onEmailsChange(t),a=""}this.setState({addTask:null,continueDisabled:!1,verifying:!1,newEmailAddress:a})})).catch((e=>{this.setState({continueDisabled:!1}),"M_THREEPID_AUTH_FAILED"===e.errcode?v.b.createDialog(b.a,{title:Object(l.a)("Your email address hasn't been verified yet"),description:Object(l.a)("Click the link in the email you received to verify and then click continue again.")}):(d.a.error("Unable to verify email address: ",e),v.b.createDialog(b.a,{title:Object(l.a)("Unable to verify email address."),description:e&&e.message?e.message:Object(l.a)("Operation failed")}))}))})),this.state={verifying:!1,addTask:null,continueDisabled:!1,newEmailAddress:""}}render(){const e=this.props.emails.map((e=>r.a.createElement(te,{email:e,onRemoved:this.onRemoved,key:e.address})));let t=r.a.createElement(y.a,{onClick:this.onAddClick,kind:"primary"},Object(l.a)("Add"));return this.state.verifying&&(t=r.a.createElement("div",null,r.a.createElement("div",null,Object(l.a)("We've sent you an email to verify your address. Please follow the instructions there and then click the button below.")),r.a.createElement(y.a,{onClick:this.onContinueClick,kind:"primary",disabled:this.state.continueDisabled},Object(l.a)("Continue")))),r.a.createElement("div",{className:"mx_EmailAddresses"},e,r.a.createElement("form",{onSubmit:this.onAddClick,autoComplete:"off",noValidate:!0,className:"mx_EmailAddresses_new"},r.a.createElement(h.a,{type:"text",label:Object(l.a)("Email Address"),autoComplete:"off",disabled:this.state.verifying,value:this.state.newEmailAddress,onChange:this.onChangeNewEmailAddress}),t))}}class ne extends r.a.Component{constructor(e){super(e),i()(this,"onRevokeClick",(e=>{e.stopPropagation(),e.preventDefault(),this.changeBinding({bind:!1,label:"revoke",errorTitle:Object(l.a)("Unable to revoke sharing for email address")})})),i()(this,"onShareClick",(e=>{e.stopPropagation(),e.preventDefault(),this.changeBinding({bind:!0,label:"share",errorTitle:Object(l.a)("Unable to share email address")})})),i()(this,"onContinueClick",(async e=>{e.stopPropagation(),e.preventDefault(),this.setState({continueDisabled:!0});try{await this.state.addTask.checkEmailLinkClicked(),this.setState({addTask:null,continueDisabled:!1,verifying:!1})}catch(e){this.setState({continueDisabled:!1}),"M_THREEPID_AUTH_FAILED"===e.errcode?v.b.createDialog(b.a,{title:Object(l.a)("Your email address hasn't been verified yet"),description:Object(l.a)("Click the link in the email you received to verify and then click continue again.")}):(d.a.error("Unable to verify email address: "+e),v.b.createDialog(b.a,{title:Object(l.a)("Unable to verify email address."),description:e&&e.message?e.message:Object(l.a)("Operation failed")}))}}));const{bound:t}=e.email;this.state={verifying:!1,addTask:null,continueDisabled:!1,bound:t}}componentDidUpdate(e){if(this.props.email!==e.email){const{bound:e}=this.props.email;this.setState({bound:e})}}async changeBinding(e){let{bind:t,label:a,errorTitle:n}=e;if(!await u.a.get().doesServerSupportSeparateAddAndBind())return this.changeBindingTangledAddBind({bind:t,label:a,errorTitle:n});const{medium:i,address:s}=this.props.email;try{if(t){const e=new J;this.setState({verifying:!0,continueDisabled:!0,addTask:e}),await e.bindEmailAddress(s),this.setState({continueDisabled:!1})}else await u.a.get().unbindThreePid(i,s);this.setState({bound:t})}catch(e){d.a.error(`Unable to ${a} email address ${s} ${e}`),this.setState({verifying:!1,continueDisabled:!1,addTask:null}),v.b.createDialog(b.a,{title:n,description:e&&e.message?e.message:Object(l.a)("Operation failed")})}}async changeBindingTangledAddBind(e){let{bind:t,label:a,errorTitle:n}=e;const{medium:i,address:s}=this.props.email,r=new J;this.setState({verifying:!0,continueDisabled:!0,addTask:r});try{await u.a.get().deleteThreePid(i,s),t?await r.bindEmailAddress(s):await r.addEmailAddress(s),this.setState({continueDisabled:!1,bound:t})}catch(e){d.a.error(`Unable to ${a} email address ${s} ${e}`),this.setState({verifying:!1,continueDisabled:!1,addTask:null}),v.b.createDialog(b.a,{title:n,description:e&&e.message?e.message:Object(l.a)("Operation failed")})}}render(){const{address:e}=this.props.email,{verifying:t,bound:a}=this.state;let n;return n=t?r.a.createElement("span",null,Object(l.a)("Verify the link in your inbox"),r.a.createElement(y.a,{className:"mx_ExistingEmailAddress_confirmBtn",kind:"primary_sm",onClick:this.onContinueClick,disabled:this.state.continueDisabled},Object(l.a)("Complete"))):a?r.a.createElement(y.a,{className:"mx_ExistingEmailAddress_confirmBtn",kind:"danger_sm",onClick:this.onRevokeClick},Object(l.a)("Revoke")):r.a.createElement(y.a,{className:"mx_ExistingEmailAddress_confirmBtn",kind:"primary_sm",onClick:this.onShareClick},Object(l.a)("Share")),r.a.createElement("div",{className:"mx_ExistingEmailAddress"},r.a.createElement("span",{className:"mx_ExistingEmailAddress_email"},e),n)}}class ie extends r.a.Component{render(){let e;return e=this.props.emails.length>0?this.props.emails.map((e=>r.a.createElement(ne,{email:e,key:e.address}))):r.a.createElement("span",{className:"mx_SettingsTab_subsectionText"},Object(l.a)("Discovery options will appear once you have added an email above.")),r.a.createElement("div",{className:"mx_EmailAddresses"},e)}}class se extends r.a.Component{constructor(e){super(e),i()(this,"onRevokeClick",(e=>{e.stopPropagation(),e.preventDefault(),this.changeBinding({bind:!1,label:"revoke",errorTitle:Object(l.a)("Unable to revoke sharing for phone number")})})),i()(this,"onShareClick",(e=>{e.stopPropagation(),e.preventDefault(),this.changeBinding({bind:!0,label:"share",errorTitle:Object(l.a)("Unable to share phone number")})})),i()(this,"onVerificationCodeChange",(e=>{this.setState({verificationCode:e.target.value})})),i()(this,"onContinueClick",(async e=>{e.stopPropagation(),e.preventDefault(),this.setState({continueDisabled:!0});const t=this.state.verificationCode;try{await this.state.addTask.haveMsisdnToken(t),this.setState({addTask:null,continueDisabled:!1,verifying:!1,verifyError:null,verificationCode:""})}catch(e){this.setState({continueDisabled:!1}),"M_THREEPID_AUTH_FAILED"!==e.errcode?(d.a.error("Unable to verify phone number: "+e),v.b.createDialog(b.a,{title:Object(l.a)("Unable to verify phone number."),description:e&&e.message?e.message:Object(l.a)("Operation failed")})):this.setState({verifyError:Object(l.a)("Incorrect verification code")})}}));const{bound:t}=e.msisdn;this.state={verifying:!1,verificationCode:"",addTask:null,continueDisabled:!1,bound:t,verifyError:null}}componentDidUpdate(e){if(this.props.msisdn!==e.msisdn){const{bound:e}=this.props.msisdn;this.setState({bound:e})}}async changeBinding(e){let{bind:t,label:a,errorTitle:n}=e;if(!await u.a.get().doesServerSupportSeparateAddAndBind())return this.changeBindingTangledAddBind({bind:t,label:a,errorTitle:n});const{medium:i,address:s}=this.props.msisdn;try{if(t){const e=new J;this.setState({verifying:!0,continueDisabled:!0,addTask:e}),await e.bindMsisdn(null,`+${s}`),this.setState({continueDisabled:!1})}else await u.a.get().unbindThreePid(i,s);this.setState({bound:t})}catch(e){d.a.error(`Unable to ${a} phone number ${s} ${e}`),this.setState({verifying:!1,continueDisabled:!1,addTask:null}),v.b.createDialog(b.a,{title:n,description:e&&e.message?e.message:Object(l.a)("Operation failed")})}}async changeBindingTangledAddBind(e){let{bind:t,label:a,errorTitle:n}=e;const{medium:i,address:s}=this.props.msisdn,r=new J;this.setState({verifying:!0,continueDisabled:!0,addTask:r});try{await u.a.get().deleteThreePid(i,s),t?await r.bindMsisdn(null,`+${s}`):await r.addMsisdn(null,`+${s}`),this.setState({continueDisabled:!1,bound:t})}catch(e){d.a.error(`Unable to ${a} phone number ${s} ${e}`),this.setState({verifying:!1,continueDisabled:!1,addTask:null}),v.b.createDialog(b.a,{title:n,description:e&&e.message?e.message:Object(l.a)("Operation failed")})}}render(){const{address:e}=this.props.msisdn,{verifying:t,bound:a}=this.state;let n;return n=t?r.a.createElement("span",{className:"mx_ExistingPhoneNumber_verification"},r.a.createElement("span",null,Object(l.a)("Please enter verification code sent via text."),r.a.createElement("br",null),this.state.verifyError),r.a.createElement("form",{onSubmit:this.onContinueClick,autoComplete:"off",noValidate:!0},r.a.createElement(h.a,{type:"text",label:Object(l.a)("Verification code"),autoComplete:"off",disabled:this.state.continueDisabled,value:this.state.verificationCode,onChange:this.onVerificationCodeChange}))):a?r.a.createElement(y.a,{className:"mx_ExistingPhoneNumber_confirmBtn",kind:"danger_sm",onClick:this.onRevokeClick},Object(l.a)("Revoke")):r.a.createElement(y.a,{className:"mx_ExistingPhoneNumber_confirmBtn",kind:"primary_sm",onClick:this.onShareClick},Object(l.a)("Share")),r.a.createElement("div",{className:"mx_ExistingPhoneNumber"},r.a.createElement("span",{className:"mx_ExistingPhoneNumber_address"},"+",e),n)}}class re extends r.a.Component{render(){let e;return e=this.props.msisdns.length>0?this.props.msisdns.map((e=>r.a.createElement(se,{msisdn:e,key:e.address}))):r.a.createElement("span",{className:"mx_SettingsTab_subsectionText"},Object(l.a)("Discovery options will appear once you have added a phone number above.")),r.a.createElement("div",{className:"mx_PhoneNumbers"},e)}}var oe,le=a(200),ce=a(343),de=a(662),me=a(154),ue=a(142),he=a(151);!function(e){e.Display="display",e.Edit="edit"}(oe||(oe={}));class pe extends r.a.Component{constructor(e){super(e),i()(this,"value",""),i()(this,"placeholder",!1),i()(this,"editableDiv",Object(s.createRef)()),i()(this,"showPlaceholder",(e=>{e?(this.editableDiv.current.textContent=this.props.placeholder,this.editableDiv.current.setAttribute("class",this.props.className+" "+this.props.placeholderClassName),this.placeholder=!0,this.value=""):(this.editableDiv.current.textContent=this.value,this.editableDiv.current.setAttribute("class",this.props.className),this.placeholder=!1)})),i()(this,"cancelEdit",(()=>{this.setState({phase:oe.Display}),this.value=this.props.initialValue,this.showPlaceholder(!this.value),this.onValueChanged(!1),this.editableDiv.current.blur()})),i()(this,"onValueChanged",(e=>{this.props.onValueChanged(this.value,e)})),i()(this,"onKeyDown",(e=>{this.placeholder&&this.showPlaceholder(!1);if(Object(he.a)().getAccessibilityAction(e)===ue.h.Enter)e.stopPropagation(),e.preventDefault()})),i()(this,"onKeyUp",(e=>{e.target.textContent?this.placeholder||(this.value=e.target.textContent):this.showPlaceholder(!0);switch(Object(he.a)().getAccessibilityAction(e)){case ue.h.Escape:this.cancelEdit();break;case ue.h.Enter:this.onFinish(e)}})),i()(this,"onClickDiv",(()=>{this.props.editable&&this.setState({phase:oe.Edit})})),i()(this,"onFocus",(e=>{const t=e.target.childNodes[0];if(t){const a=document.createRange();a.setStart(t,0),a.setEnd(t,e.target.childNodes.length);const n=window.getSelection();n.removeAllRanges(),n.addRange(a)}})),i()(this,"onFinish",((e,t)=>{const a=this,n=Object(he.a)().getAccessibilityAction(e)===ue.h.Enter||t;this.setState({phase:oe.Display},(()=>{this.value!==this.props.initialValue&&a.onValueChanged(n)}))})),i()(this,"onBlur",(e=>{window.getSelection().removeAllRanges(),this.props.blurToCancel?this.cancelEdit():this.onFinish(e,this.props.blurToSubmit),this.showPlaceholder(!this.value)})),this.state={phase:oe.Display}}componentDidUpdate(e){e.initialValue!==this.props.initialValue&&(this.value=this.props.initialValue,this.editableDiv.current&&this.showPlaceholder(!this.value))}componentDidMount(){this.value=this.props.initialValue,this.editableDiv.current&&this.showPlaceholder(!this.value)}render(){const{className:e,editable:t,initialValue:a,label:n,labelClassName:i}=this.props;let s;return s=!t||this.state.phase===oe.Display&&(n||i)&&!this.value?r.a.createElement("div",{className:e+" "+i,onClick:this.onClickDiv},n||a):r.a.createElement("div",{ref:this.editableDiv,contentEditable:!0,className:e,onKeyDown:this.onKeyDown,onKeyUp:this.onKeyUp,onFocus:this.onFocus,onBlur:this.onBlur}),s}}i()(pe,"defaultProps",{onValueChanged(){},initialValue:"",label:"",placeholder:"",editable:!0,className:"mx_EditableText",placeholderClassName:"mx_EditableText_placeholder",blurToSubmit:!1});class ge extends r.a.Component{constructor(e){super(e),i()(this,"addThreepid",void 0),i()(this,"onEmailAddressChanged",(e=>{this.setState({emailAddress:e})})),i()(this,"onSubmit",(()=>{const e=this.state.emailAddress;ee.a(e)?(this.addThreepid=new J,this.addThreepid.addEmailAddress(e).then((()=>{v.b.createDialog(me.a,{title:Object(l.a)("Verification Pending"),description:Object(l.a)("Please check your email and click on the link it contains. Once this is done, click continue."),button:Object(l.a)("Continue"),onFinished:this.onEmailDialogFinished})}),(t=>{this.setState({emailBusy:!1}),d.a.error("Unable to add email address "+e+" "+t),v.b.createDialog(b.a,{title:Object(l.a)("Unable to add email address"),description:t&&t.message?t.message:Object(l.a)("Operation failed")})})),this.setState({emailBusy:!0})):v.b.createDialog(b.a,{title:Object(l.a)("Invalid Email Address"),description:Object(l.a)("This doesn't appear to be a valid email address")})})),i()(this,"onCancelled",(()=>{this.props.onFinished(!1)})),i()(this,"onEmailDialogFinished",(e=>{e?this.verifyEmailAddress():this.setState({emailBusy:!1})})),this.state={emailAddress:"",emailBusy:!1}}verifyEmailAddress(){this.addThreepid.checkEmailLinkClicked().then((()=>{this.props.onFinished(!0)}),(e=>{if(this.setState({emailBusy:!1}),"M_THREEPID_AUTH_FAILED"==e.errcode){const e=Object(l.a)("Unable to verify email address.")+" "+Object(l.a)("Please check your email and click on the link it contains. Once this is done, click continue.");v.b.createDialog(me.a,{title:Object(l.a)("Verification Pending"),description:e,button:Object(l.a)("Continue"),onFinished:this.onEmailDialogFinished})}else d.a.error("Unable to verify email address: "+e),v.b.createDialog(b.a,{title:Object(l.a)("Unable to verify email address."),description:e&&e.message?e.message:Object(l.a)("Operation failed")})}))}render(){const e=this.state.emailBusy?r.a.createElement(I.a,null):r.a.createElement(pe,{initialValue:this.state.emailAddress,className:"mx_SetEmailDialog_email_input",placeholder:Object(l.a)("Email address"),placeholderClassName:"mx_SetEmailDialog_email_input_placeholder",blurToCancel:!1,onValueChanged:this.onEmailAddressChanged});return r.a.createElement(L.a,{className:"mx_SetEmailDialog",onFinished:this.onCancelled,title:this.props.title,contentId:"mx_Dialog_content"},r.a.createElement("div",{className:"mx_Dialog_content"},r.a.createElement("p",{id:"mx_Dialog_content"},Object(l.a)("This will allow you to reset your password and receive notifications.")),e),r.a.createElement("div",{className:"mx_Dialog_buttons"},r.a.createElement("input",{className:"mx_Dialog_primary",type:"submit",value:Object(l.a)("Continue"),onClick:this.onSubmit}),r.a.createElement("input",{type:"submit",value:Object(l.a)("Skip"),onClick:this.onCancelled})))}}const ve="field_old_password",be="field_new_password",fe="field_new_password_confirm";var ye;!function(e){e.Edit="edit",e.Uploading="uploading",e.Error="error"}(ye||(ye={}));class Ee extends r.a.Component{constructor(e){super(e),i()(this,ve,void 0),i()(this,be,void 0),i()(this,fe,void 0),i()(this,"onExportE2eKeysClicked",(()=>{v.b.createDialogAsync(a.e(7).then(a.bind(null,1562)),{matrixClient:u.a.get()})})),i()(this,"onChangeOldPassword",(e=>{this.setState({oldPassword:e.target.value})})),i()(this,"onOldPasswordValidate",(async e=>{const t=await this.validateOldPasswordRules(e);return this.markFieldValid(ve,t.valid),t})),i()(this,"validateOldPasswordRules",Object(le.a)({rules:[{key:"required",test:e=>{let{value:t,allowEmpty:a}=e;return a||!!t},invalid:()=>Object(l.a)("Passwords can't be empty")}]})),i()(this,"onChangeNewPassword",(e=>{this.setState({newPassword:e.target.value})})),i()(this,"onNewPasswordValidate",(e=>{this.markFieldValid(be,e.valid)})),i()(this,"onChangeNewPasswordConfirm",(e=>{this.setState({newPasswordConfirm:e.target.value})})),i()(this,"onNewPasswordConfirmValidate",(async e=>{const t=await this.validatePasswordConfirmRules(e);return this.markFieldValid(fe,t.valid),t})),i()(this,"validatePasswordConfirmRules",Object(le.a)({rules:[{key:"required",test:e=>{let{value:t,allowEmpty:a}=e;return a||!!t},invalid:()=>Object(l.a)("Confirm password")},{key:"match",test(e){let{value:t}=e;return!t||t===this.state.newPassword},invalid:()=>Object(l.a)("Passwords don't match")}]})),i()(this,"onClickChange",(async e=>{e.preventDefault();if(!await this.verifyFieldsBeforeSubmit())return;const t=this.state.oldPassword,a=this.state.newPassword,n=this.state.newPasswordConfirm,i=this.checkPassword(t,a,n);if(!i)return this.onChangePassword(t,a);this.props.onError(i)})),this.state={fieldValid:{},phase:ye.Edit,oldPassword:"",newPassword:"",newPasswordConfirm:""}}async onChangePassword(e,t){const a=u.a.get(),n=await a.doesServerSupportLogoutDevices(),i=(await a.getDevices()).devices.length>1;if(i&&!n&&this.props.confirm){const{finished:e}=v.b.createDialog(me.a,{title:Object(l.a)("Warning!"),description:r.a.createElement("div",null,r.a.createElement("p",null,Object(l.a)("Changing your password on this homeserver will cause all of your other devices to be signed out. This will delete the message encryption keys stored on them, and may make encrypted chat history unreadable.")),r.a.createElement("p",null,Object(l.a)("If you want to retain access to your chat history in encrypted rooms you should first export your room keys and re-import them afterwards.")),r.a.createElement("p",null,Object(l.a)("You can also ask your homeserver admin to upgrade the server to change this behaviour."))),button:Object(l.a)("Continue"),extraButtons:[r.a.createElement("button",{key:"exportRoomKeys",className:"mx_Dialog_primary",onClick:this.onExportE2eKeysClicked},Object(l.a)("Export E2E room keys"))]}),[t]=await e;if(!t)return}this.changePassword(a,e,t,n,i)}changePassword(e,t,a,n,i){const s={type:"m.login.password",identifier:{type:"m.id.user",user:e.credentials.userId},user:e.credentials.userId,password:t};this.setState({phase:ye.Uploading});const r=!n&&void 0,o=!n&&i;e.setPassword(s,a,r).then((()=>{if(this.props.shouldAskForEmail)return this.optionallySetEmail().then((e=>{this.props.onFinished({didSetEmail:e,didLogoutOutOtherDevices:o})}));this.props.onFinished({didLogoutOutOtherDevices:o})}),(e=>{this.props.onError(e)})).finally((()=>{this.setState({phase:ye.Edit,oldPassword:"",newPassword:"",newPasswordConfirm:""})}))}checkPassword(e,t,a){return t!==a?{error:Object(l.a)("New passwords don't match")}:t&&0!==t.length?void 0:{error:Object(l.a)("Passwords can't be empty")}}optionallySetEmail(){return v.b.createDialog(ge,{title:Object(l.a)("Do you want to set an email address?")}).finished.then((e=>{let[t]=e;return t}))}markFieldValid(e,t){const{fieldValid:a}=this.state;a[e]=t,this.setState({fieldValid:a})}async verifyFieldsBeforeSubmit(){const e=document.activeElement;e&&e.blur();const t=[ve,be,fe];for(const e of t){const t=this[e];t&&await t.validate({allowEmpty:!1})}if(await new Promise((e=>this.setState({},e))),this.allFieldsValid())return!0;const a=this.findFirstInvalidField(t);return!a||(a.focus(),a.validate({allowEmpty:!1,focused:!0}),!1)}allFieldsValid(){return Object.values(this.state.fieldValid).every(Boolean)}findFirstInvalidField(e){for(const t of e)if(!this.state.fieldValid[t]&&this[t])return this[t];return null}render(){const e=this.props.rowClassName,t=this.props.buttonClassName;switch(this.state.phase){case ye.Edit:return r.a.createElement("form",{className:this.props.className,onSubmit:this.onClickChange},r.a.createElement("div",{className:e},r.a.createElement(h.a,{ref:e=>this.field_old_password=e,type:"password",label:Object(l.a)("Current password"),value:this.state.oldPassword,onChange:this.onChangeOldPassword,onValidate:this.onOldPasswordValidate})),r.a.createElement("div",{className:e},r.a.createElement(ce.a,{fieldRef:e=>this.field_new_password=e,type:"password",label:Object(l.c)("New Password"),minScore:de.a,value:this.state.newPassword,autoFocus:this.props.autoFocusNewPasswordInput,onChange:this.onChangeNewPassword,onValidate:this.onNewPasswordValidate,autoComplete:"new-password"})),r.a.createElement("div",{className:e},r.a.createElement(h.a,{ref:e=>this.field_new_password_confirm=e,type:"password",label:Object(l.a)("Confirm password"),value:this.state.newPasswordConfirm,onChange:this.onChangeNewPasswordConfirm,onValidate:this.onNewPasswordConfirmValidate,autoComplete:"new-password"})),r.a.createElement(y.a,{className:t,kind:this.props.buttonKind,onClick:this.onClickChange},this.props.buttonLabel||Object(l.a)("Change Password")));case ye.Uploading:return r.a.createElement("div",{className:"mx_Dialog_content"},r.a.createElement(I.a,null))}}}i()(Ee,"defaultProps",{onFinished(){},onError(){},confirm:!0});var _e=a(182);class Se extends r.a.Component{constructor(e){super(e),i()(this,"togglePolicy",(e=>{const t=Object(_e.a)(this.state.policies);t[e].checked=!t[e].checked,this.setState({policies:t})})),i()(this,"onContinue",(()=>{!!this.state.policies.some((e=>!e.checked))||(this.setState({busy:!0}),this.props.onFinished(this.state.policies.map((e=>e.url))))})),this.state={policies:[],busy:!1}}componentDidMount(){const e=[];for(const t of this.props.policiesAndServicePairs){const a=Object.values(t.policies);for(const t of a){const a=Object(l.j)(Object.keys(t).filter((e=>"version"!==e))),n={checked:!1,url:t[a].url,name:t[a].name};e.push(n)}}this.setState({policies:e})}renderCheckboxes(){const e=[];for(let t=0;t<this.state.policies.length;t++){const a=this.state.policies[t],n=Object(l.a)("Accept <policyLink /> to continue:",{},{policyLink:()=>r.a.createElement("a",{href:a.url,rel:"noreferrer noopener",target:"_blank"},a.name,r.a.createElement("span",{className:"mx_InlineTermsAgreement_link"}))});e.push(r.a.createElement("div",{key:t,className:"mx_InlineTermsAgreement_cbContainer"},r.a.createElement("div",null,n),r.a.createElement("div",{className:"mx_InlineTermsAgreement_checkbox"},r.a.createElement(A.b,{onChange:()=>this.togglePolicy(t),checked:a.checked},Object(l.a)("Accept")))))}return e}render(){const e=!!this.state.policies.some((e=>!e.checked));return r.a.createElement("div",null,this.props.introElement,this.renderCheckboxes(),r.a.createElement(y.a,{onClick:this.onContinue,disabled:e||this.state.busy,kind:"primary_sm"},Object(l.a)("Continue")))}}var we=a(256),Oe=a.n(we),Ce=a(430),xe=a(386),ke=a(206);class je extends r.a.Component{constructor(e){super(e),i()(this,"dispatcherRef",void 0),i()(this,"onAction",(e=>{"id_server_changed"===e.action&&this.setState({currentClientIdServer:u.a.get().getIdentityServerUrl()})})),i()(this,"onIdentityServerChanged",(e=>{const t=e.target.value;this.setState({idServer:t})})),i()(this,"getTooltip",(()=>this.state.checking?r.a.createElement("div",null,r.a.createElement(ke.a,null),Object(l.a)("Checking server")):this.state.error?r.a.createElement("span",{className:"warning"},this.state.error):null)),i()(this,"idServerChangeEnabled",(()=>!!this.state.idServer&&!this.state.busy)),i()(this,"saveIdServer",(e=>{u.a.get().setAccountData("m.identity_server",{base_url:e}),this.setState({busy:!1,error:null,currentClientIdServer:e,idServer:""})})),i()(this,"checkIdServer",(async e=>{e.preventDefault();const{idServer:t,currentClientIdServer:a}=this.state;this.setState({busy:!0,checking:!0,error:null});const n=Object(H.b)(t);let i=await async function(e){if("https:"!==Oe.a.parse(e).protocol)return Object(l.a)("Identity server URL must be HTTPS");try{const t=await fetch(e+"/_matrix/identity/v2");return t.ok?null:t.status<200||t.status>=300?Object(l.a)("Not a valid identity server (status code %(code)s)",{code:t.status}):Object(l.a)("Could not connect to identity server")}catch(e){return Object(l.a)("Could not connect to identity server")}}(n);if(!i)try{this.setState({checking:!1});const e=new W.a(n);await e.getAccessToken();let i=!0;if(!await Object(Ce.b)(n)){const[e]=await this.showNoTermsWarning(n);i=e}if(i&&a&&n!==a){const[e]=await this.showServerChangeWarning({title:Object(l.a)("Change identity server"),unboundMessage:Object(l.a)("Disconnect from the identity server <current /> and connect to <new /> instead?",{},{current:e=>r.a.createElement("b",null,Object(H.a)(a)),new:e=>r.a.createElement("b",null,Object(H.a)(t))}),button:Object(l.a)("Continue")});i=e}i&&this.saveIdServer(n)}catch(e){d.a.error(e),i=Object(l.a)("Terms of service not accepted or the identity server is invalid.")}this.setState({busy:!1,checking:!1,error:i,currentClientIdServer:u.a.get().getIdentityServerUrl()})})),i()(this,"onDisconnectClicked",(async()=>{this.setState({disconnectBusy:!0});try{const[e]=await this.showServerChangeWarning({title:Object(l.a)("Disconnect identity server"),unboundMessage:Object(l.a)("Disconnect from the identity server <idserver />?",{},{idserver:e=>r.a.createElement("b",null,Object(H.a)(this.state.currentClientIdServer))}),button:Object(l.a)("Disconnect")});e&&this.disconnectIdServer()}finally{this.setState({disconnectBusy:!1})}})),i()(this,"disconnectIdServer",(()=>{u.a.get().setAccountData("m.identity_server",{base_url:null});let e="";Object(Ce.c)()&&(e=Object(H.a)(Object(Ce.c)())),this.setState({busy:!1,error:null,currentClientIdServer:u.a.get().getIdentityServerUrl(),idServer:e})}));let t="";!u.a.get().getIdentityServerUrl()&&Object(Ce.c)()&&(t=Object(H.a)(Object(Ce.c)())),this.state={defaultIdServer:t,currentClientIdServer:u.a.get().getIdentityServerUrl(),idServer:"",error:null,busy:!1,disconnectBusy:!1,checking:!1}}componentDidMount(){this.dispatcherRef=U.a.register(this.onAction)}componentWillUnmount(){U.a.unregister(this.dispatcherRef)}showNoTermsWarning(e){const{finished:t}=v.b.createDialog(me.a,{title:Object(l.a)("Identity server has no terms of service"),description:r.a.createElement("div",null,r.a.createElement("span",{className:"warning"},Object(l.a)("The identity server you have chosen does not have any terms of service.")),r.a.createElement("span",null," ",Object(l.a)("Only continue if you trust the owner of the server."))),button:Object(l.a)("Continue")});return t}async showServerChangeWarning(e){let{title:t,unboundMessage:a,button:n}=e;const{currentClientIdServer:i}=this.state;let s=[],o=!0;try{s=await Object(xe.b)(z(u.a.get()),Promise.reject(new Error("Timeout attempting to reach identity server")),1e4)}catch(e){o=!1,d.a.warn(`Unable to reach identity server at ${i} to check for 3PIDs during IS change flow`),d.a.warn(e)}const c=s.filter((e=>e.bound));let m,h=!1;const p={idserver:e=>r.a.createElement("b",null,Object(H.a)(i)),b:e=>r.a.createElement("b",null,e)};o?c.length?(m=r.a.createElement("div",null,r.a.createElement("p",null,Object(l.a)("You are still <b>sharing your personal data</b> on the identity server <idserver />.",{},p)),r.a.createElement("p",null,Object(l.a)("We recommend that you remove your email addresses and phone numbers from the identity server before disconnecting."))),h=!0,n=Object(l.a)("Disconnect anyway")):m=a:(m=r.a.createElement("div",null,r.a.createElement("p",null,Object(l.a)("You should <b>remove your personal data</b> from identity server <idserver /> before disconnecting. Unfortunately, identity server <idserver /> is currently offline or cannot be reached.",{},p)),r.a.createElement("p",null,Object(l.a)("You should:")),r.a.createElement("ul",null,r.a.createElement("li",null,Object(l.a)("check your browser plugins for anything that might block the identity server (such as Privacy Badger)")),r.a.createElement("li",null,Object(l.a)("contact the administrators of identity server <idserver />",{},{idserver:p.idserver})),r.a.createElement("li",null,Object(l.a)("wait and try again later")))),h=!0,n=Object(l.a)("Disconnect anyway"));const{finished:g}=v.b.createDialog(me.a,{title:t,description:m,button:n,cancelButton:Object(l.a)("Go back"),danger:h});return g}render(){const e=this.state.currentClientIdServer;let t,a,n;if(e?(t=Object(l.a)("Identity server (%(server)s)",{server:Object(H.a)(e)}),a=Object(l.a)("You are currently using <server></server> to discover and be discoverable by existing contacts you know. You can change your identity server below.",{},{server:t=>r.a.createElement("b",null,Object(H.a)(e))}),this.props.missingTerms&&(a=Object(l.a)("If you don't want to use <server /> to discover and be discoverable by existing contacts you know, enter another identity server below.",{},{server:t=>r.a.createElement("b",null,Object(H.a)(e))}))):(t=Object(l.a)("Identity server"),a=Object(l.a)("You are not currently using an identity server. To discover and be discoverable by existing contacts you know, add one below.")),e){let e=Object(l.a)("Disconnect"),t=Object(l.a)("Disconnecting from your identity server will mean you won't be discoverable by other users and you won't be able to invite others by email or phone.");this.props.missingTerms&&(t=Object(l.a)("Using an identity server is optional. If you choose not to use an identity server, you won't be discoverable by other users and you won't be able to invite others by email or phone."),e=Object(l.a)("Do not use an identity server")),this.state.disconnectBusy&&(e=r.a.createElement(ke.a,null)),n=r.a.createElement("div",null,r.a.createElement("span",{className:"mx_SettingsTab_subsectionText"},t),r.a.createElement(y.a,{onClick:this.onDisconnectClicked,kind:"danger_sm"},e))}return r.a.createElement("form",{className:"mx_SetIdServer",onSubmit:this.checkIdServer},r.a.createElement("span",{className:"mx_SettingsTab_subheading"},t),r.a.createElement("span",{className:"mx_SettingsTab_subsectionText"},a),r.a.createElement(h.a,{label:Object(l.a)("Enter a new identity server"),type:"text",autoComplete:"off",placeholder:this.state.defaultIdServer,value:this.state.idServer,onChange:this.onIdentityServerChanged,tooltipContent:this.getTooltip(),tooltipClassName:"mx_SetIdServer_tooltip",disabled:this.state.busy,forceValidity:!this.state.error&&null}),r.a.createElement(y.a,{type:"submit",kind:"primary_sm",onClick:this.checkIdServer,disabled:!this.idServerChangeEnabled()},Object(l.a)("Change")),n)}}var Re=a(282),Ie=a(388);class Te extends r.a.Component{constructor(e){super(e),i()(this,"onProvisioningToggled",(()=>{const e=this.state.provisioningEnabled;x.b.setValue("integrationProvisioning",null,G.a.ACCOUNT,!e).catch((t=>{d.a.error("Error changing integration manager provisioning"),d.a.error(t),this.setState({provisioningEnabled:e})})),this.setState({provisioningEnabled:!e})}));const t=Re.a.sharedInstance().getPrimaryManager();this.state={currentManager:t,provisioningEnabled:x.b.getValue("integrationProvisioning")}}render(){const e=this.state.currentManager;let t,a;return e?(t=`(${e.name})`,a=Object(l.a)("Use an integration manager <b>(%(serverName)s)</b> to manage bots, widgets, and sticker packs.",{serverName:e.name},{b:e=>r.a.createElement("b",null,e)})):a=Object(l.a)("Use an integration manager to manage bots, widgets, and sticker packs."),r.a.createElement("div",{className:"mx_SetIntegrationManager"},r.a.createElement("div",{className:"mx_SettingsFlag"},r.a.createElement("div",{className:"mx_SetIntegrationManager_heading_manager"},r.a.createElement("span",{className:"mx_SettingsTab_heading"},Object(l.a)("Manage integrations")),r.a.createElement("span",{className:"mx_SettingsTab_subheading"},t)),r.a.createElement(Ie.a,{checked:this.state.provisioningEnabled,disabled:!1,onChange:this.onProvisioningToggled})),r.a.createElement("div",{className:"mx_SettingsTab_subsectionText"},a),r.a.createElement("div",{className:"mx_SettingsTab_subsectionText"},Object(l.a)("Integration managers receive configuration data, and can modify widgets, send room invites, and set power levels on your behalf.")))}}var Ne=a(204);function De(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function Pe(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?De(Object(a),!0).forEach((function(t){i()(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):De(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}class Me extends r.a.Component{constructor(e){super(e),i()(this,"dispatcherRef",void 0),i()(this,"onAction",(e=>{"id_server_changed"===e.action&&(this.setState({haveIdServer:Boolean(u.a.get().getIdentityServerUrl())}),this.getThreepidState())})),i()(this,"onEmailsChange",(e=>{this.setState({emails:e})})),i()(this,"onMsisdnsChange",(e=>{this.setState({msisdns:e})})),i()(this,"onLanguageChange",(e=>{if(this.state.language===e)return;x.b.setValue("language",null,G.a.DEVICE,e),this.setState({language:e});const t=R.a.get();t&&(t.setLanguage([e]),t.reload())})),i()(this,"onSpellCheckLanguagesChange",(e=>{var t;this.setState({spellCheckLanguages:e}),null===(t=R.a.get())||void 0===t||t.setSpellCheckLanguages(e)})),i()(this,"onSpellCheckEnabledChange",(e=>{var t;this.setState({spellCheckEnabled:e}),null===(t=R.a.get())||void 0===t||t.setSpellCheckEnabled(e)})),i()(this,"onPasswordChangeError",(e=>{let t=e.error||e.message||"";403===e.httpStatus?t=Object(l.a)("Failed to change password. Is your password correct?"):t||(t+=` (HTTP status ${e.httpStatus})`),d.a.error("Failed to change password: "+t),v.b.createDialog(b.a,{title:Object(l.a)("Error"),description:t})})),i()(this,"onPasswordChanged",(e=>{let{didLogoutOutOtherDevices:t}=e,a=Object(l.a)("Your password was successfully changed.");t&&(a+=" "+Object(l.a)("You will not receive push notifications on other devices until you sign back in to them.")),v.b.createDialog(b.a,{title:Object(l.a)("Success"),description:a})})),i()(this,"onDeactivateClicked",(()=>{v.b.createDialog(B,{onFinished:e=>{e&&this.props.closeSettingsFn()}})})),this.state={language:l.e(),spellCheckEnabled:!1,spellCheckLanguages:[],haveIdServer:Boolean(u.a.get().getIdentityServerUrl()),serverSupportsSeparateAddAndBind:null,idServerHasUnsignedTerms:!1,requiredPolicyInfo:{hasTerms:!1,policiesAndServices:null,agreedUrls:null,resolve:null},emails:[],msisdns:[],loading3pids:!0,canChangePassword:!1,idServerName:null,externalAccountManagementUrl:void 0},this.dispatcherRef=U.a.register(this.onAction),this.getCapabilities(),this.getThreepidState()}async componentDidMount(){const e=R.a.get(),[t,a]=await Promise.all([e.getSpellCheckEnabled(),e.getSpellCheckLanguages()]);a&&this.setState({spellCheckEnabled:t,spellCheckLanguages:a})}componentWillUnmount(){U.a.unregister(this.dispatcherRef)}async getCapabilities(){const e=u.a.get(),t=await e.doesServerSupportSeparateAddAndBind(),a=(await e.getCapabilities())["m.change_password"],n=!a||!1!==a.enabled,i=m.M_AUTHENTICATION.findIn(e.getClientWellKnown()),s=null==i?void 0:i.account;this.setState({serverSupportsSeparateAddAndBind:t,canChangePassword:n,externalAccountManagementUrl:s})}async getThreepidState(){const e=u.a.get();this.checkTerms();let t=[];try{t=await z(e)}catch(e){const t=u.a.get().getIdentityServerUrl();d.a.warn(`Unable to reach identity server at ${t} to check for 3PIDs bindings in Settings`),d.a.warn(e)}this.setState({emails:t.filter((e=>"email"===e.medium)),msisdns:t.filter((e=>"msisdn"===e.medium)),loading3pids:!1})}async checkTerms(){if(!this.state.haveIdServer)return void this.setState({idServerHasUnsignedTerms:!1});const e=u.a.get().getIdentityServerUrl(),t=new W.a;try{const a=await t.getAccessToken({check:!1});await Object(V.d)([new V.a(c.a.IS,e,a)],((t,a,n)=>new Promise(((n,i)=>{this.setState({idServerName:Object(H.a)(e),requiredPolicyInfo:{hasTerms:!0,policiesAndServices:t,agreedUrls:a,resolve:n}})})))),this.setState({requiredPolicyInfo:Pe(Pe({},this.state.requiredPolicyInfo),{},{hasTerms:!1})})}catch(t){d.a.warn(`Unable to reach identity server at ${e} to check for terms in Settings`),d.a.warn(t)}}renderProfileSection(){return r.a.createElement("div",{className:"mx_SettingsTab_section"},r.a.createElement(C,null))}renderAccountSection(){let e=r.a.createElement(Ee,{className:"mx_GeneralUserSettingsTab_changePassword",rowClassName:"",buttonKind:"primary",onError:this.onPasswordChangeError,onFinished:this.onPasswordChanged}),t=null;if(x.b.getValue(K.b.ThirdPartyID)&&(this.state.haveIdServer||!0===this.state.serverSupportsSeparateAddAndBind)){const e=this.state.loading3pids?r.a.createElement(I.a,null):r.a.createElement(ae,{emails:this.state.emails,onEmailsChange:this.onEmailsChange}),a=this.state.loading3pids?r.a.createElement(I.a,null):r.a.createElement(Z,{msisdns:this.state.msisdns,onMsisdnsChange:this.onMsisdnsChange});t=r.a.createElement("div",null,r.a.createElement("span",{className:"mx_SettingsTab_subheading"},Object(l.a)("Email addresses")),e,r.a.createElement("span",{className:"mx_SettingsTab_subheading"},Object(l.a)("Phone numbers")),a)}else null===this.state.serverSupportsSeparateAddAndBind&&(t=r.a.createElement(I.a,null));let a,n=Object(l.a)("Set a new account password…");if(this.state.canChangePassword||(n=null,e=null),this.state.externalAccountManagementUrl){const{hostname:e}=new URL(this.state.externalAccountManagementUrl);a=r.a.createElement(r.a.Fragment,null,r.a.createElement("p",{className:"mx_SettingsTab_subsectionText","data-testid":"external-account-management-outer"},Object(l.a)("Your account details are managed separately at <code>%(hostname)s</code>.",{hostname:e},{code:e=>r.a.createElement("code",null,e)})),r.a.createElement(y.a,{onClick:null,element:"a",kind:"primary",target:"_blank",rel:"noreferrer noopener",href:this.state.externalAccountManagementUrl,"data-testid":"external-account-management-link"},Object(l.a)("Manage account")))}return r.a.createElement("div",{className:"mx_SettingsTab_section mx_GeneralUserSettingsTab_accountSection"},r.a.createElement("span",{className:"mx_SettingsTab_subheading"},Object(l.a)("Account")),a,r.a.createElement("p",{className:"mx_SettingsTab_subsectionText"},n),e,t)}renderLanguageSection(){return r.a.createElement("div",{className:"mx_SettingsTab_section"},r.a.createElement("span",{className:"mx_SettingsTab_subheading"},Object(l.a)("Language and region")),r.a.createElement(k.a,{className:"mx_GeneralUserSettingsTab_languageInput",onOptionChange:this.onLanguageChange,value:this.state.language}))}renderSpellCheckSection(){return r.a.createElement("div",{className:"mx_SettingsTab_section mx_SettingsTab_section_spellcheck"},r.a.createElement("span",{className:"mx_SettingsTab_subheading"},Object(l.a)("Spell check"),r.a.createElement(Ie.a,{checked:this.state.spellCheckEnabled,onChange:this.onSpellCheckEnabledChange})),this.state.spellCheckEnabled&&!Ne.a&&r.a.createElement(D,{languages:this.state.spellCheckLanguages,onLanguagesChange:this.onSpellCheckLanguagesChange}))}renderDiscoverySection(){if(this.state.requiredPolicyInfo.hasTerms){const e=r.a.createElement("span",{className:"mx_SettingsTab_subsectionText"},Object(l.a)("Agree to the identity server (%(serverName)s) Terms of Service to allow yourself to be discoverable by email address or phone number.",{serverName:this.state.idServerName}));return r.a.createElement("div",null,r.a.createElement(Se,{policiesAndServicePairs:this.state.requiredPolicyInfo.policiesAndServices,agreedUrls:this.state.requiredPolicyInfo.agreedUrls,onFinished:this.state.requiredPolicyInfo.resolve,introElement:e}),r.a.createElement(je,{missingTerms:!0}))}const e=this.state.loading3pids?r.a.createElement(I.a,null):r.a.createElement(ie,{emails:this.state.emails}),t=this.state.loading3pids?r.a.createElement(I.a,null):r.a.createElement(re,{msisdns:this.state.msisdns}),a=this.state.haveIdServer?r.a.createElement("div",{className:"mx_GeneralUserSettingsTab_discovery"},r.a.createElement("span",{className:"mx_SettingsTab_subheading"},Object(l.a)("Email addresses")),e,r.a.createElement("span",{className:"mx_SettingsTab_subheading"},Object(l.a)("Phone numbers")),t):null;return r.a.createElement("div",{className:"mx_SettingsTab_section"},a,r.a.createElement(je,{missingTerms:!1}))}renderManagementSection(){return r.a.createElement("div",{className:"mx_SettingsTab_section"},r.a.createElement("span",{className:"mx_SettingsTab_subheading"},Object(l.a)("Account management")),r.a.createElement("span",{className:"mx_SettingsTab_subsectionText"},Object(l.a)("Deactivating your account is a permanent action — be careful!")),r.a.createElement(y.a,{onClick:this.onDeactivateClicked,kind:"danger"},Object(l.a)("Deactivate Account")))}renderIntegrationManagerSection(){return x.b.getValue(K.b.Widgets)?r.a.createElement("div",{className:"mx_SettingsTab_section"},r.a.createElement(Te,null)):null}render(){const e=R.a.get().supportsSpellCheckSettings(),t=this.state.requiredPolicyInfo.hasTerms?r.a.createElement("img",{className:"mx_GeneralUserSettingsTab_warningIcon",src:a(808).default,width:"18",height:"18",alt:Object(l.a)("Warning")}):null;let n,i;return x.b.getValue(K.b.Deactivate)&&(n=r.a.createElement(r.a.Fragment,null,r.a.createElement("div",{className:"mx_SettingsTab_heading"},Object(l.a)("Deactivate account")),this.renderManagementSection())),x.b.getValue(K.b.IdentityServer)&&(i=r.a.createElement(r.a.Fragment,null,r.a.createElement("div",{className:"mx_SettingsTab_heading"},t," ",Object(l.a)("Discovery")),this.renderDiscoverySection())),r.a.createElement("div",{className:"mx_SettingsTab"},r.a.createElement("div",{className:"mx_SettingsTab_heading"},Object(l.a)("General")),this.renderProfileSection(),this.renderAccountSection(),this.renderLanguageSection(),e?this.renderSpellCheckSection():null,i,this.renderIntegrationManagerSection(),n)}}var Ae=a(148),Le=a(285),Ue=a(228),Fe=a(315),Be=a(449);class Ve extends r.a.Component{constructor(e){super(e);const t=u.a.get();t.doesServerSupportUnstableFeature("org.matrix.msc3030").then((e=>{this.setState({showJumpToDate:e})})),t.doesServerSupportUnstableFeature("org.matrix.msc3827.stable").then((e=>{this.setState({showExploringPublicSpaces:e})})),this.state={showJumpToDate:!1,showExploringPublicSpaces:!1}}render(){const e=x.b.getFeatureSettingNames(),[t,a]=e.reduce(((e,t)=>(e[x.b.getBetaInfo(t)?1:0].push(t),e)),[[],[]]);let n,i;if(a.length&&(n=r.a.createElement("div",{"data-testid":"labs-beta-section",className:"mx_SettingsTab_section"},a.map((e=>r.a.createElement(Le.b,{key:e,featureId:e}))))),p.b.get("show_labs_settings")){const e=new Be.a;t.forEach((t=>{e.getOrCreate(x.b.getLabGroup(t),[]).push(r.a.createElement(Ue.a,{level:G.a.DEVICE,name:t,key:t}))})),e.getOrCreate(Fe.b.Experimental,[]).push(r.a.createElement(Ue.a,{key:"lowBandwidth",name:"lowBandwidth",level:G.a.DEVICE})),e.getOrCreate(Fe.b.Analytics,[]).push(r.a.createElement(Ue.a,{key:"automaticErrorReporting",name:"automaticErrorReporting",level:G.a.DEVICE}),r.a.createElement(Ue.a,{key:"automaticDecryptionErrorReporting",name:"automaticDecryptionErrorReporting",level:G.a.DEVICE})),this.state.showJumpToDate&&e.getOrCreate(Fe.b.Messaging,[]).push(r.a.createElement(Ue.a,{key:"feature_jump_to_date",name:"feature_jump_to_date",level:G.a.DEVICE})),this.state.showExploringPublicSpaces&&e.getOrCreate(Fe.b.Spaces,[]).push(r.a.createElement(Ue.a,{key:"feature_exploring_public_spaces",name:"feature_exploring_public_spaces",level:G.a.DEVICE})),i=r.a.createElement(r.a.Fragment,null,Object(Ae.sortBy)(Array.from(e.entries()),"0").map((e=>{let[t,a]=e;return r.a.createElement("div",{className:"mx_SettingsTab_section",key:t,"data-testid":`labs-group-${t}`},r.a.createElement("span",{className:"mx_SettingsTab_subheading"},Object(l.a)(Fe.d[t])),a)})))}return r.a.createElement("div",{className:"mx_SettingsTab mx_LabsUserSettingsTab"},r.a.createElement("div",{className:"mx_SettingsTab_heading"},Object(l.a)("Upcoming features")),r.a.createElement("div",{className:"mx_SettingsTab_subsectionText"},Object(l.a)("What's next for %(brand)s? Labs are the best way to get things early, test out new features and help shape them before they actually launch.",{brand:p.b.get("brand")})),n,i&&r.a.createElement(r.a.Fragment,null,r.a.createElement("div",{className:"mx_SettingsTab_heading"},Object(l.a)("Early previews")),r.a.createElement("div",{className:"mx_SettingsTab_subsectionText"},Object(l.a)("Feeling experimental? Try out our latest ideas in development. These features are not finalised; they may be unstable, may change, or may be dropped altogether. <a>Learn more</a>.",{},{a:e=>r.a.createElement("a",{href:"https://github.com/vector-im/element-web/blob/develop/docs/labs.md",rel:"noreferrer noopener",target:"_blank"},e)})),i))}}var We=a(126),He=a.n(We),ze=a(143),Ge=a(260),Ke=a(400),qe=a(194);class $e extends r.a.Component{constructor(e){super(e),this.state={message:e.message}}fakeEvent(e){var t=this;let{message:a}=e;const n={type:"m.room.message",sender:this.props.userId,content:{"m.new_content":{msgtype:"m.text",body:a,displayname:this.props.displayName,avatar_url:this.props.avatarUrl},msgtype:"m.text",body:a,displayname:this.props.displayName,avatar_url:this.props.avatarUrl},unsigned:{age:97},event_id:"$9999999999999999999999999999999999999999999",room_id:"!999999999999999999:example.org"},i=new ze.b(n);return i.sender={name:this.props.displayName||this.props.userId,rawDisplayName:this.props.displayName,userId:this.props.userId,getAvatarUrl:function(){return Ge.c({avatarUrl:t.props.avatarUrl},32,32,"crop")},getMxcAvatarUrl:()=>this.props.avatarUrl},i}render(){const e=He()(this.props.className,{mx_IRCLayout:this.props.layout==qe.a.IRC,mx_EventTilePreview_loader:!this.props.userId});if(!this.props.userId)return r.a.createElement("div",{className:e},r.a.createElement(I.a,null));const t=this.fakeEvent(this.state);return r.a.createElement("div",{className:e},r.a.createElement(Ke.a,{mxEvent:t,layout:this.props.layout,as:"div"}))}}var Ye=a(259);class Je extends r.a.Component{constructor(e){super(e),i()(this,"onLayoutChange",(e=>{const t=e.target.value;this.setState({layout:t}),x.b.setValue("layout",null,G.a.DEVICE,t),this.props.onLayoutChanged(t)})),this.state={layout:x.b.getValue("layout")}}render(){const e=He()("mx_LayoutSwitcher_RadioButton",{mx_LayoutSwitcher_RadioButton_selected:this.state.layout==qe.a.IRC}),t=He()("mx_LayoutSwitcher_RadioButton",{mx_LayoutSwitcher_RadioButton_selected:this.state.layout==qe.a.Group}),a=He()("mx_LayoutSwitcher_RadioButton",{mx_LayoutSwitcher_RadioButton_selected:this.state.layout===qe.a.Bubble});return r.a.createElement("div",{className:"mx_SettingsTab_section mx_LayoutSwitcher"},r.a.createElement("span",{className:"mx_SettingsTab_subheading"},Object(l.a)("Message layout")),r.a.createElement("div",{className:"mx_LayoutSwitcher_RadioButtons"},r.a.createElement("label",{className:e},r.a.createElement($e,{className:"mx_LayoutSwitcher_RadioButton_preview",message:this.props.messagePreviewText,layout:qe.a.IRC,userId:this.props.userId,displayName:this.props.displayName,avatarUrl:this.props.avatarUrl}),r.a.createElement(Ye.a,{name:"layout",value:qe.a.IRC,checked:this.state.layout===qe.a.IRC,onChange:this.onLayoutChange},Object(l.a)("IRC (Experimental)"))),r.a.createElement("label",{className:t},r.a.createElement($e,{className:"mx_LayoutSwitcher_RadioButton_preview",message:this.props.messagePreviewText,layout:qe.a.Group,userId:this.props.userId,displayName:this.props.displayName,avatarUrl:this.props.avatarUrl}),r.a.createElement(Ye.a,{name:"layout",value:qe.a.Group,checked:this.state.layout==qe.a.Group,onChange:this.onLayoutChange},Object(l.a)("Modern"))),r.a.createElement("label",{className:a},r.a.createElement($e,{className:"mx_LayoutSwitcher_RadioButton_preview",message:this.props.messagePreviewText,layout:qe.a.Bubble,userId:this.props.userId,displayName:this.props.displayName,avatarUrl:this.props.avatarUrl}),r.a.createElement(Ye.a,{name:"layout",value:qe.a.Bubble,checked:this.state.layout==qe.a.Bubble,onChange:this.onLayoutChange},Object(l.a)("Message bubbles")))))}}class Qe extends s.Component{offset(e,t){const a=e.reduce(((e,a)=>t>a?e+1:e),0);if(0===a)return 0;if(a===e.length)return 100;const n=e[a-1],i=e[a],s=1/(e.length-1);return 100*(a-1+(t-n)/(i-n))*s}render(){const e=this.props.values.map((e=>s.createElement(Xe,{active:e<=this.props.value,label:this.props.displayFunc(e),onClick:this.props.disabled?()=>{}:()=>this.props.onSelectionChange(e),key:e,disabled:this.props.disabled})));let t=null;if(!this.props.disabled){const e=this.offset(this.props.values,this.props.value);t=s.createElement("div",{className:"mx_Slider_selection"},s.createElement("div",{className:"mx_Slider_selectionDot",style:{left:"calc(-1.195em + "+e+"%)"}},s.createElement("div",{className:"mx_Slider_selectionText"},this.props.value)),s.createElement("hr",{style:{width:e+"%"}}))}return s.createElement("div",{className:"mx_Slider"},s.createElement("div",null,s.createElement("div",{className:"mx_Slider_bar"},s.createElement("hr",{onClick:this.props.disabled?()=>{}:this.onClick.bind(this)}),t),s.createElement("div",{className:"mx_Slider_dotContainer"},e)))}onClick(e){const t=e.target.clientWidth,a=e.nativeEvent.offsetX/t,n=this.props.values[Math.round(a*(this.props.values.length-1))];this.props.onSelectionChange(n)}}class Xe extends s.PureComponent{render(){let e="mx_Slider_dot";return!this.props.disabled&&this.props.active&&(e+=" mx_Slider_dotActive"),s.createElement("span",{onClick:this.props.onClick,className:"mx_Slider_dotValue"},s.createElement("div",{className:e}),s.createElement("div",{className:"mx_Slider_labelContainer"},s.createElement("div",{className:"mx_Slider_label"},this.props.label)))}}var Ze=a(457);class et extends r.a.Component{constructor(e){super(e),i()(this,"MESSAGE_PREVIEW_TEXT",Object(l.a)("Hey you. You're the best!")),i()(this,"unmounted",!1),i()(this,"onFontSizeChanged",(e=>{this.setState({fontSize:e.toString()}),x.b.setValue("baseFontSize",null,G.a.DEVICE,e-Ze.a.SIZE_DIFF)})),i()(this,"onValidateFontSize",(async e=>{let{value:t}=e;const a=parseFloat(t),n=Ze.a.MIN_SIZE+Ze.a.SIZE_DIFF,i=Ze.a.MAX_SIZE+Ze.a.SIZE_DIFF;return isNaN(a)?{valid:!1,feedback:Object(l.a)("Size must be a number")}:n<=a&&a<=i?(x.b.setValue("baseFontSize",null,G.a.DEVICE,parseInt(t,10)-Ze.a.SIZE_DIFF),{valid:!0,feedback:Object(l.a)("Use between %(min)s pt and %(max)s pt",{min:n,max:i})}):{valid:!1,feedback:Object(l.a)("Custom font size can only be between %(min)s pt and %(max)s pt",{min:n,max:i})}})),this.state={fontSize:(x.b.getValue("baseFontSize",null)+Ze.a.SIZE_DIFF).toString(),useCustomFontSize:x.b.getValue("useCustomFontSize"),layout:x.b.getValue("layout"),userId:null,displayName:null,avatarUrl:null}}async componentDidMount(){const e=u.a.get(),t=e.getUserId(),a=await e.getProfileInfo(t);this.unmounted||this.setState({userId:t,displayName:a.displayname,avatarUrl:a.avatar_url})}componentWillUnmount(){this.unmounted=!0}render(){return r.a.createElement("div",{className:"mx_SettingsTab_section mx_FontScalingPanel"},r.a.createElement("span",{className:"mx_SettingsTab_subheading"},Object(l.a)("Font size")),r.a.createElement($e,{className:"mx_FontScalingPanel_preview",message:this.MESSAGE_PREVIEW_TEXT,layout:this.state.layout,userId:this.state.userId,displayName:this.state.displayName,avatarUrl:this.state.avatarUrl}),r.a.createElement("div",{className:"mx_FontScalingPanel_fontSlider"},r.a.createElement("div",{className:"mx_FontScalingPanel_fontSlider_smallText"},"Aa"),r.a.createElement(Qe,{values:[13,14,15,16,18],value:parseInt(this.state.fontSize,10),onSelectionChange:this.onFontSizeChanged,displayFunc:e=>"",disabled:this.state.useCustomFontSize}),r.a.createElement("div",{className:"mx_FontScalingPanel_fontSlider_largeText"},"Aa")),r.a.createElement(Ue.a,{name:"useCustomFontSize",level:G.a.ACCOUNT,onChange:e=>this.setState({useCustomFontSize:e}),useCheckbox:!0}),r.a.createElement(h.a,{type:"number",label:Object(l.a)("Font size"),autoComplete:"off",placeholder:this.state.fontSize.toString(),value:this.state.fontSize.toString(),id:"font_size_field",onValidate:this.onValidateFontSize,onChange:e=>this.setState({fontSize:e.target.value}),disabled:!this.state.useCustomFontSize,className:"mx_FontScalingPanel_customFontSizeField"}))}}var tt=a(895),at=a(463);class nt extends r.a.Component{constructor(e){super(e),i()(this,"onSizeChange",(e=>{const t=e.target.value;this.setState({size:t}),x.b.setValue("Images.size",null,G.a.ACCOUNT,t)})),this.state={size:x.b.getValue("Images.size")}}render(){return r.a.createElement("div",{className:"mx_SettingsTab_section mx_ImageSizePanel"},r.a.createElement("span",{className:"mx_SettingsTab_subheading"},Object(l.a)("Image size in the timeline")),r.a.createElement("div",{className:"mx_ImageSizePanel_radios"},r.a.createElement("label",null,r.a.createElement("div",{className:"mx_ImageSizePanel_size mx_ImageSizePanel_sizeDefault"}),r.a.createElement(Ye.a,{name:"image_size",value:at.a.Normal,checked:this.state.size===at.a.Normal,onChange:this.onSizeChange},Object(l.a)("Default"))),r.a.createElement("label",null,r.a.createElement("div",{className:"mx_ImageSizePanel_size mx_ImageSizePanel_sizeLarge"}),r.a.createElement(Ye.a,{name:"image_size",value:at.a.Large,checked:this.state.size===at.a.Large,onChange:this.onSizeChange},Object(l.a)("Large")))))}}class it extends r.a.Component{constructor(e){super(e),i()(this,"MESSAGE_PREVIEW_TEXT",Object(l.a)("Hey you. You're the best!")),i()(this,"unmounted",!1),i()(this,"onLayoutChanged",(e=>{this.setState({layout:e})})),this.state={useSystemFont:x.b.getValue("useSystemFont"),systemFont:x.b.getValue("systemFont"),showAdvanced:!1,layout:x.b.getValue("layout")}}async componentDidMount(){const e=u.a.get(),t=e.getUserId(),a=await e.getProfileInfo(t);this.unmounted||this.setState({userId:t,displayName:a.displayname,avatarUrl:a.avatar_url})}componentWillUnmount(){this.unmounted=!0}renderAdvancedSection(){if(!x.b.getValue(K.b.AdvancedSettings))return null;const e=p.b.get().brand,t=r.a.createElement(y.a,{kind:"link",onClick:()=>this.setState({showAdvanced:!this.state.showAdvanced})},this.state.showAdvanced?Object(l.a)("Hide advanced"):Object(l.a)("Show advanced"));let a;if(this.state.showAdvanced){const t=Object(l.a)("Set the name of a font installed on your system & %(brand)s will attempt to use it.",{brand:e});a=r.a.createElement(r.a.Fragment,null,r.a.createElement(Ue.a,{name:"useCompactLayout",level:G.a.DEVICE,useCheckbox:!0}),r.a.createElement(Ue.a,{name:"useSystemFont",level:G.a.DEVICE,useCheckbox:!0,onChange:e=>this.setState({useSystemFont:e})}),r.a.createElement(h.a,{className:"mx_AppearanceUserSettingsTab_systemFont",label:x.b.getDisplayName("systemFont"),onChange:e=>{this.setState({systemFont:e.target.value}),x.b.setValue("systemFont",null,G.a.DEVICE,e.target.value)},tooltipContent:t,forceTooltipVisible:!0,disabled:!this.state.useSystemFont,value:this.state.systemFont}))}return r.a.createElement("div",{className:"mx_SettingsTab_section mx_AppearanceUserSettingsTab_Advanced"},t,a)}render(){const e=p.b.get().brand;return r.a.createElement("div",{className:"mx_SettingsTab mx_AppearanceUserSettingsTab"},r.a.createElement("div",{className:"mx_SettingsTab_heading"},Object(l.a)("Customise your appearance")),r.a.createElement("div",{className:"mx_SettingsTab_subsectionText"},Object(l.a)("Appearance Settings only affect this %(brand)s session.",{brand:e})),r.a.createElement(tt.a,null),r.a.createElement(Je,{userId:this.state.userId,displayName:this.state.displayName,avatarUrl:this.state.avatarUrl,messagePreviewText:this.MESSAGE_PREVIEW_TEXT,onLayoutChanged:this.onLayoutChanged}),r.a.createElement(et,null),this.renderAdvancedSection(),r.a.createElement(nt,null))}}var st=a(16),rt=a(141),ot=a(175),lt=a(241),ct=a(364),dt=a(251);class mt extends r.a.PureComponent{constructor(e){super(e),i()(this,"unmounted",!1),i()(this,"onKeyBackupSessionsRemaining",(e=>{this.setState({sessionsRemaining:e})})),i()(this,"onKeyBackupStatus",(()=>{this.loadBackupStatus()})),i()(this,"startNewBackup",(()=>{v.b.createDialogAsync(a.e(8).then(a.bind(null,922)),{onFinished:()=>{this.loadBackupStatus()}},null,!1,!0)})),i()(this,"deleteBackup",(()=>{v.b.createDialog(me.a,{title:Object(l.a)("Delete Backup"),description:Object(l.a)("Are you sure? You will lose your encrypted messages if your keys are not backed up properly."),button:Object(l.a)("Delete Backup"),danger:!0,onFinished:e=>{e&&(this.setState({loading:!0}),u.a.get().deleteKeyBackupVersion(this.state.backupInfo.version).then((()=>{this.loadBackupStatus()})))}})})),i()(this,"restoreBackup",(async()=>{v.b.createDialog(ct.a,null,null,!1,!0)})),i()(this,"resetSecretStorage",(async()=>{this.setState({error:null});try{await Object(dt.b)((async()=>{}),!0)}catch(e){if(d.a.error("Error resetting secret storage",e),this.unmounted)return;this.setState({error:e})}this.unmounted||this.loadBackupStatus()})),this.state={loading:!0,error:null,backupKeyStored:null,backupKeyCached:null,backupKeyWellFormed:null,secretStorageKeyInAccount:null,secretStorageReady:null,backupInfo:null,backupSigStatus:null,sessionsRemaining:0}}componentDidMount(){this.checkKeyBackupStatus(),u.a.get().on(ot.b.KeyBackupStatus,this.onKeyBackupStatus),u.a.get().on(ot.b.KeyBackupSessionsRemaining,this.onKeyBackupSessionsRemaining)}componentWillUnmount(){this.unmounted=!0,u.a.get()&&(u.a.get().removeListener(ot.b.KeyBackupStatus,this.onKeyBackupStatus),u.a.get().removeListener(ot.b.KeyBackupSessionsRemaining,this.onKeyBackupSessionsRemaining))}async checkKeyBackupStatus(){this.getUpdatedDiagnostics();try{const{backupInfo:e,trustInfo:t}=await u.a.get().checkKeyBackup();this.setState({loading:!1,error:null,backupInfo:e,backupSigStatus:t})}catch(e){if(d.a.log("Unable to fetch check backup status",e),this.unmounted)return;this.setState({loading:!1,error:e,backupInfo:null,backupSigStatus:null})}}async loadBackupStatus(){this.setState({loading:!0}),this.getUpdatedDiagnostics();try{const e=await u.a.get().getKeyBackupVersion(),t=await u.a.get().isKeyBackupTrusted(e);if(this.unmounted)return;this.setState({loading:!1,error:null,backupInfo:e,backupSigStatus:t})}catch(e){if(d.a.log("Unable to fetch key backup status",e),this.unmounted)return;this.setState({loading:!1,error:e,backupInfo:null,backupSigStatus:null})}}async getUpdatedDiagnostics(){const e=u.a.get(),t=e.crypto.secretStorage,a=!!await e.isKeyBackupKeyStored(),n=await e.crypto.getSessionBackupPrivateKey(),i=!!n,s=n instanceof Uint8Array,r=await t.hasKey(),o=await e.isSecretStorageReady();this.unmounted||this.setState({backupKeyStored:a,backupKeyCached:i,backupKeyWellFormed:s,secretStorageKeyInAccount:r,secretStorageReady:o})}render(){const{loading:e,error:t,backupKeyStored:a,backupKeyCached:n,backupKeyWellFormed:i,secretStorageKeyInAccount:s,secretStorageReady:o,backupInfo:c,backupSigStatus:d,sessionsRemaining:m}=this.state;let h,p,g;const v=[];if(t)h=r.a.createElement("div",{className:"error"},Object(l.a)("Unable to load key backup status"));else if(e)h=r.a.createElement(I.a,null);else if(c){let e,t=Object(l.a)("Restore from Backup");u.a.get().getKeyBackupEnabled()?h=r.a.createElement("p",null,"✅ ",Object(l.a)("This session is backing up your keys.")):(h=r.a.createElement(r.a.Fragment,null,r.a.createElement("p",null,Object(l.a)("This session is <b>not backing up your keys</b>, but you do have an existing backup you can restore from and add to going forward.",{},{b:e=>r.a.createElement("b",null,e)})),r.a.createElement("p",null,Object(l.a)("Connect this session to key backup before signing out to avoid losing any keys that may only be on this session."))),t=Object(l.a)("Connect this session to Key Backup")),e=u.a.get().getKeyBackupEnabled()?m>0?r.a.createElement("div",null,Object(l.a)("Backing up %(sessionsRemaining)s keys…",{sessionsRemaining:m})," ",r.a.createElement("br",null)):r.a.createElement("div",null,Object(l.a)("All keys backed up")," ",r.a.createElement("br",null)):"";let a,n=d.sigs.map(((e,t)=>{const a=e.device?e.device.getDisplayName()||e.device.deviceId:null,n=t=>r.a.createElement("span",{className:e.valid?"mx_SecureBackupPanel_sigValid":"mx_SecureBackupPanel_sigInvalid"},t),i=t=>r.a.createElement("span",{className:e.device&&e.deviceTrust.isVerified()?"mx_SecureBackupPanel_deviceVerified":"mx_SecureBackupPanel_deviceNotVerified"},t),s=e=>r.a.createElement("span",{className:"mx_SecureBackupPanel_deviceName"},a),o=e.device&&e.device.getFingerprint()===u.a.get().getDeviceEd25519Key(),c=e.crossSigningId&&e.deviceId===u.a.get().getCrossSigningId();let d;return e.valid&&c?d=Object(l.a)("Backup has a <validity>valid</validity> signature from this user",{},{validity:n}):!e.valid&&c?d=Object(l.a)("Backup has a <validity>invalid</validity> signature from this user",{},{validity:n}):e.crossSigningId?d=Object(l.a)("Backup has a signature from <verify>unknown</verify> user with ID %(deviceId)s",{deviceId:e.deviceId},{verify:i}):e.device?e.valid&&o?d=Object(l.a)("Backup has a <validity>valid</validity> signature from this session",{},{validity:n}):!e.valid&&o?d=Object(l.a)("Backup has an <validity>invalid</validity> signature from this session",{},{validity:n}):e.valid&&e.deviceTrust.isVerified()?d=Object(l.a)("Backup has a <validity>valid</validity> signature from <verify>verified</verify> session <device></device>",{},{validity:n,verify:i,device:s}):e.valid&&!e.deviceTrust.isVerified()?d=Object(l.a)("Backup has a <validity>valid</validity> signature from <verify>unverified</verify> session <device></device>",{},{validity:n,verify:i,device:s}):!e.valid&&e.deviceTrust.isVerified()?d=Object(l.a)("Backup has an <validity>invalid</validity> signature from <verify>verified</verify> session <device></device>",{},{validity:n,verify:i,device:s}):e.valid||e.deviceTrust.isVerified()||(d=Object(l.a)("Backup has an <validity>invalid</validity> signature from <verify>unverified</verify> session <device></device>",{},{validity:n,verify:i,device:s})):d=Object(l.a)("Backup has a signature from <verify>unknown</verify> session with ID %(deviceId)s",{deviceId:e.deviceId},{verify:i}),r.a.createElement("div",{key:t},d)}));0===d.sigs.length&&(n=Object(l.a)("Backup is not signed by any of your sessions")),d.trusted_locally&&(a=Object(l.a)("This backup is trusted because it has been restored on this session")),p=r.a.createElement(r.a.Fragment,null,r.a.createElement("tr",null,r.a.createElement("td",null,Object(l.a)("Backup version:")),r.a.createElement("td",null,c.version)),r.a.createElement("tr",null,r.a.createElement("td",null,Object(l.a)("Algorithm:")),r.a.createElement("td",null,c.algorithm))),g=r.a.createElement(r.a.Fragment,null,e,r.a.createElement("div",null,n),r.a.createElement("div",null,a)),v.push(r.a.createElement(y.a,{key:"restore",kind:"primary",onClick:this.restoreBackup},t)),Object(lt.g)()||v.push(r.a.createElement(y.a,{key:"delete",kind:"danger",onClick:this.deleteBackup},Object(l.a)("Delete Backup")))}else h=r.a.createElement(r.a.Fragment,null,r.a.createElement("p",null,Object(l.a)("Your keys are <b>not being backed up from this session</b>.",{},{b:e=>r.a.createElement("b",null,e)})),r.a.createElement("p",null,Object(l.a)("Back up your keys before signing out to avoid losing them."))),v.push(r.a.createElement(y.a,{key:"setup",kind:"primary",onClick:this.startNewBackup},Object(l.a)("Set up")));s&&v.push(r.a.createElement(y.a,{key:"reset",kind:"danger",onClick:this.resetSecretStorage},Object(l.a)("Reset")));let b,f="";return n&&(f=", ",f+=i?Object(l.a)("well formed"):Object(l.a)("unexpected type")),v.length&&(b=r.a.createElement("div",{className:"mx_SecureBackupPanel_buttonRow"},v)),r.a.createElement("div",null,r.a.createElement("p",null,Object(l.a)("Back up your encryption keys with your account data in case you lose access to your sessions. Your keys will be secured with a unique Security Key.")),h,r.a.createElement("details",null,r.a.createElement("summary",null,Object(l.a)("Advanced")),r.a.createElement("table",{className:"mx_SecureBackupPanel_statusList"},r.a.createElement("tbody",null,r.a.createElement("tr",null,r.a.createElement("td",null,Object(l.a)("Backup key stored:")),r.a.createElement("td",null,!0===a?Object(l.a)("in secret storage"):Object(l.a)("not stored"))),r.a.createElement("tr",null,r.a.createElement("td",null,Object(l.a)("Backup key cached:")),r.a.createElement("td",null,n?Object(l.a)("cached locally"):Object(l.a)("not found locally"),f)),r.a.createElement("tr",null,r.a.createElement("td",null,Object(l.a)("Secret storage public key:")),r.a.createElement("td",null,s?Object(l.a)("in account data"):Object(l.a)("not found"))),r.a.createElement("tr",null,r.a.createElement("td",null,Object(l.a)("Secret storage:")),r.a.createElement("td",null,o?Object(l.a)("ready"):Object(l.a)("not ready"))),p)),g),b)}}const ut="e2ee.manuallyVerifyAllSessions";var ht=()=>r.a.createElement("div",{className:"mx_SettingsTab_section"},r.a.createElement("span",{className:"mx_SettingsTab_subheading"},Object(l.a)("Encryption")),r.a.createElement(Ue.a,{name:ut,level:G.a.DEVICE}),r.a.createElement("div",{className:"mx_SettingsTab_subsectionText"},Object(l.a)("Individually verify each session used by a user to mark it as trusted, not trusting cross-signed devices.")));var pt=a(210);class gt extends r.a.Component{constructor(e){super(e),i()(this,"onExportE2eKeysClicked",(()=>{v.b.createDialogAsync(a.e(7).then(a.bind(null,1562)),{matrixClient:u.a.get()})})),i()(this,"onImportE2eKeysClicked",(()=>{v.b.createDialogAsync(a.e(34).then(a.bind(null,1592)),{matrixClient:u.a.get()})})),i()(this,"updateBlacklistDevicesFlag",(e=>{u.a.get().setGlobalBlacklistUnverifiedDevices(e)}))}render(){const e=u.a.get(),t=e.deviceId;let a=e.getDeviceEd25519Key();a=a?pt.e(a):Object(l.a)("<not supported>");let n,i=null;return e.isCryptoEnabled()&&(i=r.a.createElement("div",{className:"mx_CryptographyPanel_importExportButtons"},r.a.createElement(y.a,{kind:"primary",onClick:this.onExportE2eKeysClicked},Object(l.a)("Export E2E room keys")),r.a.createElement(y.a,{kind:"primary",onClick:this.onImportE2eKeysClicked},Object(l.a)("Import E2E room keys")))),x.b.isEnabled("blacklistUnverifiedDevices")&&(n=r.a.createElement(Ue.a,{name:"blacklistUnverifiedDevices",level:G.a.DEVICE,onChange:this.updateBlacklistDevicesFlag})),r.a.createElement("div",{className:"mx_SettingsTab_section mx_CryptographyPanel"},r.a.createElement("span",{className:"mx_SettingsTab_subheading"},Object(l.a)("Cryptography")),r.a.createElement("table",{className:"mx_SettingsTab_subsectionText mx_CryptographyPanel_sessionInfo"},r.a.createElement("tbody",null,r.a.createElement("tr",null,r.a.createElement("td",null,Object(l.a)("Session ID:")),r.a.createElement("td",null,r.a.createElement("code",null,t))),r.a.createElement("tr",null,r.a.createElement("td",null,Object(l.a)("Session key:")),r.a.createElement("td",null,r.a.createElement("code",null,r.a.createElement("b",null,a)))))),i,n)}}var vt,bt=a(396),ft=a(469),yt=a(635);function Et(){return Et=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},Et.apply(this,arguments)}function _t(e){return s.createElement("svg",Et({fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 8 14",role:"presentation","aria-hidden":!0},e),vt||(vt=s.createElement("path",{d:"M1.333.333C.6.333 0 .933 0 1.666l.007 2.12c0 .354.14.687.386.94L2.667 7 .393 9.286a1.332 1.332 0 00-.386.94L0 12.333c0 .733.6 1.333 1.333 1.333h5.334c.733 0 1.333-.6 1.333-1.333v-2.107c0-.353-.14-.693-.387-.94L5.333 7l2.274-2.267C7.86 4.48 8 4.14 8 3.786v-2.12C8 .933 7.4.333 6.667.333H1.333zm5.334 9.94v1.393c0 .367-.3.667-.667.667H2a.669.669 0 01-.667-.667v-1.393c0-.18.074-.347.194-.473L4 7.333l2.473 2.473c.12.12.194.294.194.467z",fill:"currentColor"})))}var St=a(161),wt=a(176);let Ot;!function(e){e.Verified="Verified",e.Unverified="Unverified",e.Inactive="Inactive",e.Unverifiable="Unverifiable"}(Ot||(Ot={}));const Ct=7776e6,xt=e=>!!e.last_seen_ts&&e.last_seen_ts<Date.now()-Ct,kt={[Ot.Verified]:e=>!!e.isVerified,[Ot.Unverified]:e=>!e.isVerified,[Ot.Inactive]:xt},jt=(e,t)=>{const a=t.map((e=>kt[e]));return a.length?e.filter((e=>a.every((t=>t(e))))):e};var Rt;function It(){return It=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},It.apply(this,arguments)}var Tt;function Nt(){return Nt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},Nt.apply(this,arguments)}var Dt;function Pt(){return Pt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},Pt.apply(this,arguments)}var Mt;function At(){return At=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},At.apply(this,arguments)}var Lt;function Ut(){return Ut=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},Ut.apply(this,arguments)}function Ft(e){return s.createElement("svg",Ut({fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 18 18",role:"presentation","aria-hidden":!0},e),Lt||(Lt=s.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 3.05v6.22C2 15.63 9 17 9 17s7-1.37 7-7.73V3.05L9 1 2 3.05zm9.94 2.47c.19-.18.49-.17.67.02.16.18.16.45.02.63l-4.22 5.11-.03.04c-.28.34-.79.39-1.13.11a.29.29 0 01-.077-.067.912.912 0 00-.023-.023L5.34 9.26c-.2-.24-.18-.6.06-.8.2-.18.49-.18.7-.04l1.57 1.1 4.27-4z",fill:"currentColor"})))}var Bt=a(626),Vt=a(872),Wt=a.n(Vt);let Ht;!function(e){e.Desktop="Desktop",e.Mobile="Mobile",e.Web="Web",e.Unknown="Unknown"}(Ht||(Ht={}));const zt=(e,t)=>e&&[e,t].filter(Boolean).join(" "),Gt=e=>{if(!e)return{deviceType:Ht.Unknown};const t=new Wt.a(e),a=t.getBrowser(),n=t.getDevice(),i=t.getOS(),s=((e,t,a,n)=>{var i;return"Electron"===a.name?Ht.Desktop:a.name?Ht.Web:"mobile"===t.type||null!==(i=n.name)&&void 0!==i&&i.includes("Android")||e.indexOf("; iOS ")>-1?Ht.Mobile:Ht.Unknown})(e,n,a,i),r=s===Ht.Web||s===Ht.Desktop,o=zt(i.name,r?void 0:i.version),l=zt(n.vendor,n.model),c=zt(a.name,a.version),{customDeviceModel:d,customDeviceOS:m}=s!==Ht.Unknown?(e=>{if(e.includes("Mozilla/"))return{};if(!e.includes("("))return{};const t=e.substring(e.indexOf("(")+1).split("; ");return{customDeviceModel:t[0]||void 0,customDeviceOS:t[1]||void 0}})(e):{};return{deviceType:s,deviceModel:l||d,deviceOperatingSystem:o||m,client:c}},Kt={[Ht.Desktop]:function(e){return s.createElement("svg",Nt({fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 22 19",role:"presentation","aria-hidden":!0},e),Tt||(Tt=s.createElement("path",{d:"M3 15.5c-.55 0-1.02-.196-1.412-.587A1.927 1.927 0 011 13.5v-11c0-.55.196-1.021.588-1.413A1.925 1.925 0 013 .5h16c.55 0 1.021.196 1.413.587.391.392.587.863.587 1.413v11c0 .55-.196 1.021-.587 1.413A1.928 1.928 0 0119 15.5H3zm0-2h16v-11H3v11zm-2 5a.965.965 0 01-.712-.288A.965.965 0 010 17.5c0-.283.096-.52.288-.712A.965.965 0 011 16.5h20c.283 0 .52.096.712.288A.965.965 0 0122 17.5c0 .283-.096.52-.288.712A.965.965 0 0121 18.5H1zm2-5v-11 11z",fill:"currentColor"})))},[Ht.Mobile]:function(e){return s.createElement("svg",At({fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 14 23",role:"presentation","aria-hidden":!0},e),Mt||(Mt=s.createElement("path",{d:"M12 .51L2 .5c-1.1 0-2 .9-2 2v18c0 1.1.9 2 2 2h10c1.1 0 2-.9 2-2v-18c0-1.1-.9-1.99-2-1.99zm0 17.99H2v-14h10v14z",fill:"currentColor"})))},[Ht.Web]:function(e){return s.createElement("svg",Pt({fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 17",role:"presentation","aria-hidden":!0},e),Dt||(Dt=s.createElement("path",{d:"M18 16.5H2c-.55 0-1.02-.196-1.412-.587A1.927 1.927 0 010 14.5v-12c0-.55.196-1.02.588-1.412A1.923 1.923 0 012 .5h16c.55 0 1.021.196 1.413.588.391.391.587.862.587 1.412v12c0 .55-.196 1.021-.587 1.413A1.928 1.928 0 0118 16.5zM2 4.5v10h16v-10H2z",fill:"currentColor"})))},[Ht.Unknown]:function(e){return s.createElement("svg",It({fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 22 23",role:"presentation","aria-hidden":!0},e),Rt||(Rt=s.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M11 22.5c6.075 0 11-4.925 11-11S17.075.5 11 .5 0 5.425 0 11.5s4.925 11 11 11zm0-4.24a1.375 1.375 0 100-2.75 1.375 1.375 0 000 2.75zM9.09 9.428A1.91 1.91 0 0111 7.518c1.048 0 1.91.862 1.91 1.91 0 .485-.208.659-1.026 1.224-.363.25-.86.598-1.246 1.108-.415.546-.67 1.227-.67 2.093h2.063c0-.424.113-.666.25-.846.164-.217.402-.4.775-.659l.124-.084c.676-.46 1.792-1.219 1.792-2.836A3.98 3.98 0 0011 5.456a3.972 3.972 0 00-3.973 3.972H9.09z",fill:"currentColor"})))}},qt={[Ht.Desktop]:Object(l.a)("Desktop session"),[Ht.Mobile]:Object(l.a)("Mobile session"),[Ht.Web]:Object(l.a)("Web session"),[Ht.Unknown]:Object(l.a)("Unknown session type")},$t=e=>{let{isVerified:t,isSelected:a,deviceType:n}=e;const i=Kt[n]||Kt[Ht.Unknown],s=qt[n]||qt[Ht.Unknown];return r.a.createElement("div",{className:He()("mx_DeviceTypeIcon",{mx_DeviceTypeIcon_selected:a})},r.a.createElement("div",{className:"mx_DeviceTypeIcon_deviceIconWrapper"},r.a.createElement(i,{className:"mx_DeviceTypeIcon_deviceIcon",role:"img","aria-label":s})),t?r.a.createElement(Ft,{className:He()("mx_DeviceTypeIcon_verificationIcon","verified"),role:"img","aria-label":Object(l.a)("Verified")}):r.a.createElement(Bt.Icon,{className:He()("mx_DeviceTypeIcon_verificationIcon","unverified"),role:"img","aria-label":Object(l.a)("Unverified")}))};var Yt=a(615);const Jt=e=>{let{device:t}=e;return r.a.createElement(wt.a,{size:"h4"},t.display_name||t.device_id)},Qt=5184e5,Xt=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:(new Date).getTime();if(e+Qt>=t){const t=new Date(e);return Object(St.a)(t)}return Object(St.k)(new Date(e))},Zt=e=>{let{value:t,id:a}=e;return t?r.a.createElement("span",{"data-testid":`device-metadata-${a}`},t):null};var ea=e=>{let{device:t,children:a,isSelected:n,onClick:i}=e;const o=(e=>{if(xt(e))return{id:"inactive",value:r.a.createElement(r.a.Fragment,null,r.a.createElement(_t,{className:"mx_DeviceTile_inactiveIcon"}),Object(l.a)("Inactive for %(inactiveAgeDays)s+ days",{inactiveAgeDays:90})+` (${Xt(e.last_seen_ts)})`)}})(t),c=t.last_seen_ts&&`${Object(l.a)("Last activity")} ${Xt(t.last_seen_ts)}`,d=t.isVerified?Object(l.a)("Verified"):Object(l.a)("Unverified"),m=o?[o,{id:"lastSeenIp",value:t.last_seen_ip}]:[{id:"isVerified",value:d},{id:"lastActivity",value:c},{id:"lastSeenIp",value:t.last_seen_ip},{id:"deviceId",value:t.device_id}];return r.a.createElement("div",{className:He()("mx_DeviceTile",{mx_DeviceTile_interactive:!!i}),"data-testid":`device-tile-${t.device_id}`,onClick:i},r.a.createElement($t,{isVerified:t.isVerified,isSelected:n,deviceType:t.deviceType}),r.a.createElement("div",{className:"mx_DeviceTile_info"},r.a.createElement(Jt,{device:t}),r.a.createElement("div",{className:"mx_DeviceTile_metadata"},m.map(((e,t)=>{let{id:a,value:n}=e;return n?r.a.createElement(s.Fragment,{key:a},!!t&&" · ",r.a.createElement(Zt,{id:a,value:n})):null})))),r.a.createElement("div",{className:"mx_DeviceTile_actions",onClick:Object(Yt.a)((()=>{}))},a))};var ta=e=>{let{children:t,device:a,isSelected:n,onSelect:i,onClick:s}=e;return r.a.createElement("div",{className:"mx_SelectableDeviceTile"},r.a.createElement(A.b,{kind:A.a.Solid,checked:n,onChange:i,className:"mx_SelectableDeviceTile_checkbox",id:`device-tile-checkbox-${a.device_id}`,"data-testid":`device-tile-checkbox-${a.device_id}`}),r.a.createElement(ea,{device:a,onClick:s,isSelected:n},t))};function aa(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function na(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?aa(Object(a),!0).forEach((function(t){i()(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):aa(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}class ia extends r.a.Component{constructor(e){super(e),i()(this,"onDeviceToggled",(()=>{this.props.onDeviceToggled(this.props.device)})),i()(this,"onRename",(()=>{this.setState({renaming:!0})})),i()(this,"onChangeDisplayName",(e=>{this.setState({displayName:e.target.value})})),i()(this,"onRenameSubmit",(async()=>{this.setState({renaming:!1}),await u.a.get().setDeviceDetails(this.props.device.device_id,{display_name:this.state.displayName}).catch((e=>{throw d.a.error("Error setting session display name",e),new Error(Object(l.a)("Failed to set display name"))})),this.props.onDeviceChange()})),i()(this,"onRenameCancel",(()=>{this.setState({renaming:!1})})),i()(this,"onOwnDeviceSignOut",(()=>{v.b.createDialog(yt.a,{},void 0,!1,!0)})),i()(this,"verify",(async()=>{if(this.props.isOwnDevice)v.b.createDialog(bt.a,{onFinished:this.props.onDeviceChange});else{const e=u.a.get(),t=e.getUserId(),a=e.requestVerification(t,[this.props.device.device_id]);v.b.createDialog(ft.a,{verificationRequestPromise:a,member:e.getUser(t),onFinished:async()=>{(await a).cancel(),this.props.onDeviceChange()}})}})),this.state={renaming:!1,displayName:e.device.display_name}}render(){let e,t,a="";null!==this.props.verified&&(a=this.props.verified?"mx_E2EIcon_verified":"mx_E2EIcon_warning",!this.props.verified&&this.props.canBeVerified&&(e=r.a.createElement(y.a,{kind:"primary",onClick:this.verify},Object(l.a)("Verify")))),this.props.isOwnDevice&&(t=r.a.createElement(y.a,{kind:"danger_outline",onClick:this.onOwnDeviceSignOut},Object(l.a)("Sign Out")));const n=this.state.renaming?r.a.createElement("form",{className:"mx_DevicesPanel_renameForm",onSubmit:this.onRenameSubmit},r.a.createElement(h.a,{label:Object(l.a)("Display Name"),type:"text",value:this.state.displayName,autoComplete:"off",onChange:this.onChangeDisplayName,autoFocus:!0}),r.a.createElement(y.a,{onClick:this.onRenameSubmit,kind:"confirm_sm"}),r.a.createElement(y.a,{onClick:this.onRenameCancel,kind:"cancel_sm"})):r.a.createElement(r.a.Fragment,null,t,e,r.a.createElement(y.a,{kind:"primary_outline",onClick:this.onRename},Object(l.a)("Rename"))),i=na(na({},this.props.device),{},{isVerified:this.props.verified,deviceType:Ht.Unknown});return this.props.isOwnDevice?r.a.createElement("div",{className:He()("mx_DevicesPanel_device","mx_DevicesPanel_myDevice")},r.a.createElement("div",{className:"mx_DevicesPanel_deviceTrust"},r.a.createElement("span",{className:"mx_DevicesPanel_icon mx_E2EIcon "+a})),r.a.createElement(ea,{device:i},n)):r.a.createElement("div",{className:"mx_DevicesPanel_device"},r.a.createElement(ta,{device:i,onSelect:this.onDeviceToggled,isSelected:this.props.selected},n))}}const sa=(e,t)=>async a=>{await e.deleteMultipleDevices(t,a)},ra=async(e,t,a)=>{if(t.length)try{await sa(e,t)(),a(!0,void 0)}catch(i){var n;if(401!==i.httpStatus||null===(n=i.data)||void 0===n||!n.flows)throw i;const s=t.length,r={[M.c.PHASE_PREAUTH]:{title:Object(l.a)("Use Single Sign On to continue"),body:Object(l.a)("Confirm logging out these devices by using Single Sign On to prove your identity.",{count:s}),continueText:Object(l.a)("Single Sign On"),continueKind:"primary"},[M.c.PHASE_POSTAUTH]:{title:Object(l.a)("Confirm signing out these devices",{count:s}),body:Object(l.a)("Click the button below to confirm signing out these devices.",{count:s}),continueText:Object(l.a)("Sign out devices",{count:s}),continueKind:"danger"}};v.b.createDialog($.a,{title:Object(l.a)("Authentication"),matrixClient:e,authData:i.data,onFinished:a,makeRequest:sa(e,t),aestheticsForStagePhases:{[M.c.LOGIN_TYPE]:r,[M.c.UNSTABLE_LOGIN_TYPE]:r}})}};var oa=a(133);class la extends r.a.Component{constructor(e){super(e),i()(this,"context",void 0),i()(this,"unmounted",!1),i()(this,"onDevicesUpdated",(e=>{e.includes(this.context.getUserId())&&this.loadDevices()})),i()(this,"onDeviceSelectionToggled",(e=>{if(this.unmounted)return;const t=e.device_id;this.setState(((e,a)=>{const n=e.selectedDevices.slice(),i=n.indexOf(t);return-1===i?n.push(t):n.splice(i,1),{selectedDevices:n}}))})),i()(this,"selectAll",(e=>{this.setState(((t,a)=>{const n=t.selectedDevices.slice();for(const t of e){const e=t.device_id;n.includes(e)||n.push(e)}return{selectedDevices:n}}))})),i()(this,"deselectAll",(e=>{this.setState(((t,a)=>{const n=t.selectedDevices.slice();for(const t of e){const e=t.device_id,a=n.indexOf(e);-1!==a&&n.splice(a,1)}return{selectedDevices:n}}))})),i()(this,"onDeleteClick",(async()=>{if(0!==this.state.selectedDevices.length){this.setState({deleting:!0});try{await ra(this.context,this.state.selectedDevices,(e=>{e&&(this.setState({selectedDevices:[]}),this.loadDevices()),this.setState({deleting:!1})}))}catch(e){d.a.error("Error deleting sessions",e),this.setState({deleting:!1})}}})),i()(this,"renderDevice",(e=>{const t=this.context.getDeviceId(),a=this.state.devices.find((e=>e.device_id===t)),n=e.device_id===t,i=a&&this.isDeviceVerified(a)||n;return r.a.createElement(ia,{key:e.device_id,device:e,selected:this.state.selectedDevices.includes(e.device_id),isOwnDevice:n,verified:this.isDeviceVerified(e),canBeVerified:i,onDeviceChange:this.loadDevices,onDeviceToggled:this.onDeviceSelectionToggled})})),this.state={devices:[],selectedDevices:[]},this.loadDevices=this.loadDevices.bind(this)}componentDidMount(){this.context.on(ot.b.DevicesUpdated,this.onDevicesUpdated),this.loadDevices()}componentWillUnmount(){this.context.off(ot.b.DevicesUpdated,this.onDevicesUpdated),this.unmounted=!0}loadDevices(){const e=this.context;e.getDevices().then((t=>{if(this.unmounted)return;const a=e.getStoredCrossSigningForUser(e.getUserId());this.setState(((e,n)=>{const i=t.devices.map((e=>e.device_id)),s=e.selectedDevices.filter((e=>i.includes(e)));return{devices:t.devices||[],selectedDevices:s,crossSigningInfo:a}}))}),(e=>{if(this.unmounted)return;let t;404==e.httpStatus?t=Object(l.a)("Your homeserver does not support device management."):(d.a.error("Error loading sessions:",e),t=Object(l.a)("Unable to load device list")),this.setState({deviceLoadError:t})}))}deviceCompare(e,t){const a=(t.last_seen_ts||0)-(e.last_seen_ts||0);if(0!==a)return a;const n=e.device_id,i=t.device_id;return n<i?-1:n>i?1:0}isDeviceVerified(e){try{const t=this.context,a=t.getStoredDevice(t.getUserId(),e.device_id);return this.state.crossSigningInfo.checkDeviceTrust(this.state.crossSigningInfo,a,!1,!0).isCrossSigningVerified()}catch(e){return console.error("Error getting device cross-signing info",e),null}}render(){const e=r.a.createElement("div",{className:He()(this.props.className,"error")},this.state.deviceLoadError);if(void 0!==this.state.deviceLoadError)return e;const t=this.state.devices;if(void 0===t)return r.a.createElement(I.a,null);const a=this.context.getDeviceId(),n=t.find((e=>e.device_id===a));if(!n)return e;const i=t.filter((e=>e.device_id!==a));i.sort(this.deviceCompare);const s=[],o=[],c=[];for(const e of i){const t=this.isDeviceVerified(e);!0===t?s.push(e):!1===t?o.push(e):c.push(e)}const d=(e,t,a)=>{if(0===a.length)return r.a.createElement(r.a.Fragment,null);let n;if(a.length>1){const e=a.some((e=>this.state.selectedDevices.includes(e.device_id))),t=e?()=>{this.deselectAll(a)}:()=>{this.selectAll(a)},i=e?Object(l.a)("Deselect all"):Object(l.a)("Select all");n=r.a.createElement("div",{className:"mx_DevicesPanel_header_button"},r.a.createElement(y.a,{className:"mx_DevicesPanel_selectButton",kind:"secondary",onClick:t},i))}return r.a.createElement(r.a.Fragment,null,r.a.createElement("hr",null),r.a.createElement("div",{className:"mx_DevicesPanel_header"},r.a.createElement("div",{className:"mx_DevicesPanel_header_trust"},e),r.a.createElement("div",{className:"mx_DevicesPanel_header_title"},t),n),a.map(this.renderDevice))},m=d(r.a.createElement("span",{className:"mx_DevicesPanel_header_icon mx_E2EIcon mx_E2EIcon_verified"}),Object(l.a)("Verified devices"),s),u=d(r.a.createElement("span",{className:"mx_DevicesPanel_header_icon mx_E2EIcon mx_E2EIcon_warning"}),Object(l.a)("Unverified devices"),o),h=d(r.a.createElement(r.a.Fragment,null),Object(l.a)("Devices without encryption support"),c),p=this.state.deleting?r.a.createElement(I.a,{w:22,h:22}):r.a.createElement(y.a,{className:"mx_DevicesPanel_deleteButton",onClick:this.onDeleteClick,kind:"danger_outline",disabled:0===this.state.selectedDevices.length,"data-testid":"sign-out-devices-btn"},Object(l.a)("Sign out %(count)s selected devices",{count:this.state.selectedDevices.length})),g=i.length>0?r.a.createElement(r.a.Fragment,null,m,u,h,p):r.a.createElement(r.a.Fragment,null,r.a.createElement("hr",null),r.a.createElement("div",{className:"mx_DevicesPanel_noOtherDevices"},Object(l.a)("You aren't signed into any other devices."))),v=He()(this.props.className,"mx_DevicesPanel");return r.a.createElement("div",{className:v},r.a.createElement("div",{className:"mx_DevicesPanel_header"},r.a.createElement("div",{className:"mx_DevicesPanel_header_title"},Object(l.a)("This device"))),this.renderDevice(n),g)}}i()(la,"contextType",oa.a);var ca=a(145);class da extends r.a.Component{constructor(){super(...arguments),i()(this,"onConfirm",(()=>{this.props.onFinished(!0)})),i()(this,"onDecline",(()=>{this.props.onFinished(!1)}))}render(){return r.a.createElement(L.a,{className:"mx_ConfirmDestroyCrossSigningDialog",hasCancel:!0,onFinished:this.props.onFinished,title:Object(l.a)("Destroy cross-signing keys?")},r.a.createElement("div",{className:"mx_ConfirmDestroyCrossSigningDialog_content"},r.a.createElement("p",null,Object(l.a)("Deleting cross-signing keys is permanent. Anyone you have verified with will see security alerts. You almost certainly don't want to do this, unless you've lost every device you can cross-sign from."))),r.a.createElement(ca.a,{primaryButton:Object(l.a)("Clear cross-signing keys"),onPrimaryButtonClick:this.onConfirm,primaryButtonClass:"danger",cancelButton:Object(l.a)("Cancel"),onCancel:this.onDecline}))}}class ma extends r.a.PureComponent{constructor(e){super(e),i()(this,"unmounted",!1),i()(this,"onAccountData",(e=>{const t=e.getType();(t.startsWith("m.cross_signing")||t.startsWith("m.secret_storage"))&&this.getUpdatedStatus()})),i()(this,"onBootstrapClick",(()=>{this.state.crossSigningPrivateKeysInStorage?v.b.createDialog(bt.a,{},null,!1,!0):Object(dt.b)()})),i()(this,"onStatusChanged",(()=>{this.getUpdatedStatus()})),i()(this,"bootstrapCrossSigning",(async e=>{let{forceReset:t=!1}=e;this.setState({error:void 0});try{const e=u.a.get();await e.bootstrapCrossSigning({authUploadDeviceSigningKeys:async t=>{const{finished:a}=v.b.createDialog($.a,{title:Object(l.a)("Setting up keys"),matrixClient:e,makeRequest:t}),[n]=await a;if(!n)throw new Error("Cross-signing key upload auth canceled")},setupNewCrossSigning:t})}catch(e){this.setState({error:e}),d.a.error("Error bootstrapping cross-signing",e)}this.unmounted||this.getUpdatedStatus()})),i()(this,"resetCrossSigning",(()=>{v.b.createDialog(da,{onFinished:e=>{e&&this.bootstrapCrossSigning({forceReset:!0})}})})),this.state={}}componentDidMount(){const e=u.a.get();e.on(m.ClientEvent.AccountData,this.onAccountData),e.on(ot.b.UserTrustStatusChanged,this.onStatusChanged),e.on(ot.b.KeysChanged,this.onStatusChanged),this.getUpdatedStatus()}componentWillUnmount(){this.unmounted=!0;const e=u.a.get();e&&(e.removeListener(m.ClientEvent.AccountData,this.onAccountData),e.removeListener(ot.b.UserTrustStatusChanged,this.onStatusChanged),e.removeListener(ot.b.KeysChanged,this.onStatusChanged))}async getUpdatedStatus(){const e=u.a.get(),t=e.getCrossSigningCacheCallbacks(),a=e.crypto.crossSigningInfo,n=e.crypto.secretStorage,i=Boolean(a.getId()),s=Boolean(await a.isStoredInSecretStorage(n)),r=!(!t||!await t.getCrossSigningKeyCache("master")),o=!(!t||!await t.getCrossSigningKeyCache("self_signing")),l=!(!t||!await t.getCrossSigningKeyCache("user_signing")),c=await e.doesServerSupportUnstableFeature("org.matrix.e2e_cross_signing"),d=await e.isCrossSigningReady();this.setState({crossSigningPublicKeysOnDevice:i,crossSigningPrivateKeysInStorage:s,masterPrivateKeyCached:r,selfSigningPrivateKeyCached:o,userSigningPrivateKeyCached:l,homeserverSupportsCrossSigning:c,crossSigningReady:d})}render(){const{error:e,crossSigningPublicKeysOnDevice:t,crossSigningPrivateKeysInStorage:a,masterPrivateKeyCached:n,selfSigningPrivateKeyCached:i,userSigningPrivateKeyCached:s,homeserverSupportsCrossSigning:o,crossSigningReady:c}=this.state;let d,m;e&&(d=r.a.createElement("div",{className:"error"},e.toString())),m=void 0===o?r.a.createElement(I.a,null):o?c&&a?r.a.createElement("p",null,"✅ ",Object(l.a)("Cross-signing is ready for use.")):c&&!a?r.a.createElement("p",null,"⚠️ ",Object(l.a)("Cross-signing is ready but keys are not backed up.")):a?r.a.createElement("p",null,Object(l.a)("Your account has a cross-signing identity in secret storage, but it is not yet trusted by this session.")):r.a.createElement("p",null,Object(l.a)("Cross-signing is not set up.")):r.a.createElement("p",null,Object(l.a)("Your homeserver does not support cross-signing."));const u=t||a||n||i||s,h=[];if(!(t&&a&&n&&i&&s)&&o){let e=Object(l.a)("Set up Secure Backup");a&&(e=Object(l.a)("Verify this session")),h.push(r.a.createElement(y.a,{key:"setup",kind:"primary",onClick:this.onBootstrapClick},e))}let p;return u&&h.push(r.a.createElement(y.a,{key:"reset",kind:"danger",onClick:this.resetCrossSigning},Object(l.a)("Reset"))),h.length&&(p=r.a.createElement("div",{className:"mx_CrossSigningPanel_buttonRow"},h)),r.a.createElement("div",null,m,r.a.createElement("details",null,r.a.createElement("summary",null,Object(l.a)("Advanced")),r.a.createElement("table",{className:"mx_CrossSigningPanel_statusList"},r.a.createElement("tbody",null,r.a.createElement("tr",null,r.a.createElement("td",null,Object(l.a)("Cross-signing public keys:")),r.a.createElement("td",null,t?Object(l.a)("in memory"):Object(l.a)("not found"))),r.a.createElement("tr",null,r.a.createElement("td",null,Object(l.a)("Cross-signing private keys:")),r.a.createElement("td",null,a?Object(l.a)("in secret storage"):Object(l.a)("not found in storage"))),r.a.createElement("tr",null,r.a.createElement("td",null,Object(l.a)("Master private key:")),r.a.createElement("td",null,n?Object(l.a)("cached locally"):Object(l.a)("not found locally"))),r.a.createElement("tr",null,r.a.createElement("td",null,Object(l.a)("Self signing private key:")),r.a.createElement("td",null,i?Object(l.a)("cached locally"):Object(l.a)("not found locally"))),r.a.createElement("tr",null,r.a.createElement("td",null,Object(l.a)("User signing private key:")),r.a.createElement("td",null,s?Object(l.a)("cached locally"):Object(l.a)("not found locally"))),r.a.createElement("tr",null,r.a.createElement("td",null,Object(l.a)("Homeserver feature support:")),r.a.createElement("td",null,o?Object(l.a)("exists"):Object(l.a)("not found")))))),d,p)}}var ua=a(317);class ha extends r.a.PureComponent{render(){return r.a.createElement(L.a,{hasCancel:!0,onFinished:this.props.onFinished.bind(null,!1),title:Object(l.a)("Reset event store?")},r.a.createElement("div",null,r.a.createElement("p",null,Object(l.a)("You most likely do not want to reset your event index store"),r.a.createElement("br",null),Object(l.a)("If you do, please note that none of your messages will be deleted, but the search experience might be degraded for a few moments whilst the index is recreated"))),r.a.createElement(ca.a,{primaryButton:Object(l.a)("Reset event store"),onPrimaryButtonClick:this.props.onFinished.bind(null,!0),primaryButtonClass:"danger",cancelButton:Object(l.a)("Cancel"),onCancel:this.props.onFinished.bind(null,!1)}))}}class pa extends r.a.Component{constructor(e){super(e),i()(this,"updateCurrentRoom",(async()=>{const e=ua.a.get();let t;try{t=await e.getStats()}catch{return}this.setState({eventIndexSize:t.size,roomCount:t.roomCount})})),i()(this,"onManage",(async()=>{v.b.createDialogAsync(a.e(38).then(a.bind(null,1593)),{onFinished:()=>{}},null,!1,!0)})),i()(this,"onEnable",(async()=>{this.setState({enabling:!0}),await ua.a.initEventIndex(),await ua.a.get().addInitialCheckpoints(),ua.a.get().startCrawler(),await x.b.setValue("enableEventIndexing",null,G.a.DEVICE,!0),await this.updateState()})),i()(this,"confirmEventStoreReset",(()=>{const{close:e}=v.b.createDialog(ha,{onFinished:async t=>{t&&(await x.b.setValue("enableEventIndexing",null,G.a.DEVICE,!1),await ua.a.deleteEventIndex(),await this.onEnable(),e())}})})),this.state={enabling:!1,eventIndexSize:0,roomCount:0,eventIndexingEnabled:x.b.getValueAt(G.a.DEVICE,"enableEventIndexing")}}componentWillUnmount(){const e=ua.a.get();null!==e&&e.removeListener("changedCheckpoint",this.updateCurrentRoom)}componentDidMount(){this.updateState()}async updateState(){const e=ua.a.get(),t=x.b.getValueAt(G.a.DEVICE,"enableEventIndexing");let a=0,n=0;if(null!==e){e.on("changedCheckpoint",this.updateCurrentRoom);try{const t=await e.getStats();a=t.size,n=t.roomCount}catch{}}this.setState({enabling:!1,eventIndexSize:a,roomCount:n,eventIndexingEnabled:t})}render(){let e=null;const t=p.b.get().brand;if(null!==ua.a.get())e=r.a.createElement("div",null,r.a.createElement("div",{className:"mx_SettingsTab_subsectionText"},Object(l.a)("Securely cache encrypted messages locally for them to appear in search results, using %(size)s to store messages from %(rooms)s rooms.",{size:Object(pt.a)(this.state.eventIndexSize,0),count:this.state.roomCount,rooms:Object(pt.d)(this.state.roomCount)})),r.a.createElement("div",null,r.a.createElement(y.a,{kind:"primary",onClick:this.onManage},Object(l.a)("Manage"))));else if(!this.state.eventIndexingEnabled&&ua.a.supportIsInstalled())e=r.a.createElement("div",null,r.a.createElement("div",{className:"mx_SettingsTab_subsectionText"},Object(l.a)("Securely cache encrypted messages locally for them to appear in search results.")),r.a.createElement("div",null,r.a.createElement(y.a,{kind:"primary",disabled:this.state.enabling,onClick:this.onEnable},Object(l.a)("Enable")),this.state.enabling?r.a.createElement(ke.a,null):r.a.createElement("div",null)));else if(ua.a.platformHasSupport()&&!ua.a.supportIsInstalled()){const a="https://github.com/vector-im/element-desktop/blob/develop/docs/native-node-modules.md#adding-seshat-for-search-in-e2e-encrypted-rooms";e=r.a.createElement("div",{className:"mx_SettingsTab_subsectionText"},Object(l.a)("%(brand)s is missing some components required for securely caching encrypted messages locally. If you'd like to experiment with this feature, build a custom %(brand)s Desktop with <nativeLink>search components added</nativeLink>.",{brand:t},{nativeLink:e=>r.a.createElement("a",{href:a,target:"_blank",rel:"noreferrer noopener"},e)}))}else e=ua.a.platformHasSupport()?r.a.createElement("div",{className:"mx_SettingsTab_subsectionText"},r.a.createElement("p",null,this.state.enabling?r.a.createElement(ke.a,null):Object(l.a)("Message search initialisation failed")),ua.a.error&&r.a.createElement("details",null,r.a.createElement("summary",null,Object(l.a)("Advanced")),r.a.createElement("code",null,ua.a.error.message),r.a.createElement("p",null,r.a.createElement(y.a,{key:"delete",kind:"danger",onClick:this.confirmEventStoreReset},Object(l.a)("Reset"))))):r.a.createElement("div",{className:"mx_SettingsTab_subsectionText"},Object(l.a)("%(brand)s can't securely cache encrypted messages locally while running in a web browser. Use <desktopLink>%(brand)s Desktop</desktopLink> for encrypted messages to appear in search results.",{brand:t},{desktopLink:e=>r.a.createElement("a",{href:"https://element.io/get-started",target:"_blank",rel:"noreferrer noopener"},e)}));return e}}var ga=a(189),va=a(911),ba=a(389),fa=a(655),ya=a(395);class Ea extends r.a.Component{constructor(e){super(e)}render(){var e,t,a,n;const i=!(null===(e=this.props.versions)||void 0===e||null===(t=e.unstable_features)||void 0===t||!t["org.matrix.msc3882"]),s=!(null===(a=this.props.versions)||void 0===a||null===(n=a.unstable_features)||void 0===n||!n["org.matrix.msc3886"]);return i&&s?r.a.createElement(ya.a,{heading:Object(l.a)("Sign in with QR code")},r.a.createElement("div",{className:"mx_LoginWithQRSection"},r.a.createElement("p",{className:"mx_SettingsTab_subsectionText"},Object(l.a)("You can use this device to sign in a new device with a QR code. You will need to scan the QR code shown on this device with your device that's signed out.")),r.a.createElement(y.a,{onClick:this.props.onShowQr,kind:"primary"},Object(l.a)("Show QR code")))):null}}class _a extends r.a.Component{constructor(){super(...arguments),i()(this,"onUnignoreClicked",(()=>{this.props.onUnignored(this.props.userId)}))}render(){const e=`mx_SecurityUserSettingsTab_ignoredUser_${this.props.userId}`;return r.a.createElement("div",{className:"mx_SecurityUserSettingsTab_ignoredUser"},r.a.createElement(y.a,{onClick:this.onUnignoreClicked,kind:"primary_sm","aria-describedby":e,disabled:this.props.inProgress},Object(l.a)("Unignore")),r.a.createElement("span",{id:e},this.props.userId))}}class Sa extends r.a.Component{constructor(e){super(e),i()(this,"dispatcherRef",void 0),i()(this,"onAction",(e=>{let{action:t}=e;if("ignore_state_changed"===t){const e=u.a.get().getIgnoredUsers(),t=this.state.waitingUnignored.filter((t=>e.includes(t)));this.setState({ignoredUserIds:e,waitingUnignored:t})}})),i()(this,"onMyMembership",((e,t)=>{e.isSpaceRoom()||("invite"===t?this.addInvitedRoom(e):this.state.invitedRoomIds.has(e.roomId)&&this.removeInvitedRoom(e.roomId))})),i()(this,"addInvitedRoom",(e=>{this.setState((t=>{let{invitedRoomIds:a}=t;return{invitedRoomIds:new Set(a).add(e.roomId)}}))})),i()(this,"removeInvitedRoom",(e=>{this.setState((t=>{let{invitedRoomIds:a}=t;const n=new Set(a);return n.delete(e),{invitedRoomIds:n}}))})),i()(this,"onUserUnignored",(async e=>{const{ignoredUserIds:t,waitingUnignored:a}=this.state,n=t.filter((e=>!a.includes(e))),i=n.indexOf(e);-1!==i&&(n.splice(i,1),this.setState((t=>{let{waitingUnignored:a}=t;return{waitingUnignored:[...a,e]}})),u.a.get().setIgnoredUsers(n))})),i()(this,"getInvitedRooms",(()=>u.a.get().getRooms().filter((e=>e.hasMembershipState(u.a.get().getUserId(),"invite"))))),i()(this,"manageInvites",(async e=>{this.setState({managingInvites:!0});const t=Array.from(this.state.invitedRoomIds),a=u.a.get(),n=e?a.joinRoom.bind(a):a.leave.bind(a);for(let e=0;e<t.length;e++){const a=t[e];await n(a).then((()=>{this.removeInvitedRoom(a)}),(async t=>{"M_LIMIT_EXCEEDED"===t.errcode?(await Object(st.J)(t.retry_after_ms||2500),e--):d.a.warn(t)}))}this.setState({managingInvites:!1})})),i()(this,"onAcceptAllInvitesClicked",(()=>{this.manageInvites(!0)})),i()(this,"onRejectAllInvitesClicked",(()=>{this.manageInvites(!1)})),i()(this,"onShowQRClicked",(()=>{this.setState({showLoginWithQR:fa.b.Show})})),i()(this,"onLoginWithQRFinished",(()=>{this.setState({showLoginWithQR:null})}));const t=new Set(this.getInvitedRooms().map((e=>e.roomId)));this.state={ignoredUserIds:u.a.get().getIgnoredUsers(),waitingUnignored:[],managingInvites:!1,invitedRoomIds:t,showLoginWithQR:null}}componentDidMount(){this.dispatcherRef=U.a.register(this.onAction),u.a.get().on(rt.d.MyMembership,this.onMyMembership),u.a.get().getVersions().then((e=>this.setState({versions:e})))}componentWillUnmount(){U.a.unregister(this.dispatcherRef),u.a.get().removeListener(rt.d.MyMembership,this.onMyMembership)}renderIgnoredUsers(){const{waitingUnignored:e,ignoredUserIds:t}=this.state,a=null!=t&&t.length?t.map((t=>r.a.createElement(_a,{userId:t,onUnignored:this.onUserUnignored,key:t,inProgress:e.includes(t)}))):Object(l.a)("You have no ignored users.");return r.a.createElement("div",{className:"mx_SettingsTab_section"},r.a.createElement("span",{className:"mx_SettingsTab_subheading"},Object(l.a)("Ignored users")),r.a.createElement("div",{className:"mx_SettingsTab_subsectionText"},a))}renderManageInvites(){const{invitedRoomIds:e}=this.state;return 0===e.size?null:r.a.createElement("div",{className:"mx_SettingsTab_section mx_SecurityUserSettingsTab_bulkOptions"},r.a.createElement("span",{className:"mx_SettingsTab_subheading"},Object(l.a)("Bulk options")),r.a.createElement(y.a,{onClick:this.onAcceptAllInvitesClicked,kind:"primary",disabled:this.state.managingInvites},Object(l.a)("Accept all %(invitedRooms)s invites",{invitedRooms:e.size})),r.a.createElement(y.a,{onClick:this.onRejectAllInvitesClicked,kind:"danger",disabled:this.state.managingInvites},Object(l.a)("Reject all %(invitedRooms)s invites",{invitedRooms:e.size})),this.state.managingInvites?r.a.createElement(ke.a,null):r.a.createElement("div",null))}render(){const e=r.a.createElement("div",{className:"mx_SettingsTab_section"},r.a.createElement("span",{className:"mx_SettingsTab_subheading"},Object(l.a)("Secure Backup")),r.a.createElement("div",{className:"mx_SettingsTab_subsectionText"},r.a.createElement(mt,null))),t=r.a.createElement("div",{className:"mx_SettingsTab_section"},r.a.createElement("span",{className:"mx_SettingsTab_subheading"},Object(l.a)("Message search")),r.a.createElement(pa,null)),a=r.a.createElement("div",{className:"mx_SettingsTab_section"},r.a.createElement("span",{className:"mx_SettingsTab_subheading"},Object(l.a)("Cross-signing")),r.a.createElement("div",{className:"mx_SettingsTab_subsectionText"},r.a.createElement(ma,null)));let n,i,s;if(Object(ba.a)()||(n=r.a.createElement("div",{className:"mx_SecurityUserSettingsTab_warning"},Object(l.a)("Your server admin has disabled end-to-end encryption by default in private rooms & Direct Messages."))),ga.a.instance.isEnabled()){const e=()=>{Object(va.b)({primaryButton:Object(l.a)("Okay"),hasCancel:!1})};i=r.a.createElement(r.a.Fragment,null,r.a.createElement("div",{className:"mx_SettingsTab_heading"},Object(l.a)("Privacy")),r.a.createElement("div",{className:"mx_SettingsTab_section"},r.a.createElement("span",{className:"mx_SettingsTab_subheading"},Object(l.a)("Analytics")),r.a.createElement("div",{className:"mx_SettingsTab_subsectionText"},r.a.createElement("p",null,Object(l.a)("Share anonymous data to help us identify issues. Nothing personal. No third parties.")),r.a.createElement(y.a,{kind:"link",onClick:e},Object(l.a)("Learn more"))),ga.a.instance.isEnabled()&&r.a.createElement(Ue.a,{name:"pseudonymousAnalyticsOptIn",level:G.a.ACCOUNT}),r.a.createElement("span",{className:"mx_SettingsTab_subheading"},Object(l.a)("Sessions")),r.a.createElement(Ue.a,{name:"deviceClientInformationOptIn",level:G.a.ACCOUNT})))}if(x.b.getValue(K.b.AdvancedSettings)){const e=this.renderIgnoredUsers(),t=this.renderManageInvites(),a=x.b.isEnabled(ut)?r.a.createElement(ht,null):null;(e||t||a)&&(s=r.a.createElement(r.a.Fragment,null,r.a.createElement("div",{className:"mx_SettingsTab_heading"},Object(l.a)("Advanced")),r.a.createElement("div",{className:"mx_SettingsTab_section"},e,t,a)))}const o=x.b.getValue("feature_new_device_manager")?null:r.a.createElement(r.a.Fragment,null,r.a.createElement("div",{className:"mx_SettingsTab_heading"},Object(l.a)("Where you're signed in")),r.a.createElement("div",{className:"mx_SettingsTab_section","data-testid":"devices-section"},r.a.createElement("span",{className:"mx_SettingsTab_subsectionText"},Object(l.a)("Manage your signed-in devices below. A device's name is visible to people you communicate with.")),r.a.createElement(la,null)),r.a.createElement(Ea,{onShowQr:this.onShowQRClicked,versions:this.state.versions})),c=u.a.get();return this.state.showLoginWithQR?r.a.createElement("div",{className:"mx_SettingsTab mx_SecurityUserSettingsTab"},r.a.createElement(fa.d,{onFinished:this.onLoginWithQRFinished,mode:this.state.showLoginWithQR,client:c})):r.a.createElement("div",{className:"mx_SettingsTab mx_SecurityUserSettingsTab"},n,o,r.a.createElement("div",{className:"mx_SettingsTab_heading"},Object(l.a)("Encryption")),r.a.createElement("div",{className:"mx_SettingsTab_section"},e,t,a,r.a.createElement(gt,null)),i,s)}}var wa=a(238);class Oa{static encodeActions(e){const t=e.notify,a=e.sound,n=e.highlight;if(t){const e=[wa.d.Notify];return a&&e.push({set_tweak:"sound",value:a}),n?e.push({set_tweak:"highlight"}):e.push({set_tweak:"highlight",value:!1}),e}return[wa.d.DontNotify]}static decodeActions(e){let t,a=!1,n=!1;for(let i=0;i<e.length;++i){const s=e[i];if(s===wa.d.Notify)a=!0;else if(s===wa.d.DontNotify)a=!1;else{if("object"!=typeof s)return null;if("sound"===s.set_tweak)t=s.value;else{if("highlight"!==s.set_tweak)return null;n=s.value}}}void 0===n&&(n=!0);const i={notify:a,highlight:n};return void 0!==t&&(i.sound=t),i}}const Ca=Oa.encodeActions;class xa{}let ka;i()(xa,"ACTION_NOTIFY",Ca({notify:!0})),i()(xa,"ACTION_NOTIFY_DEFAULT_SOUND",Ca({notify:!0,sound:"default"})),i()(xa,"ACTION_NOTIFY_RING_SOUND",Ca({notify:!0,sound:"ring"})),i()(xa,"ACTION_HIGHLIGHT",Ca({notify:!0,highlight:!0})),i()(xa,"ACTION_HIGHLIGHT_DEFAULT_SOUND",Ca({notify:!0,sound:"default",highlight:!0})),i()(xa,"ACTION_DONT_NOTIFY",Ca({notify:!1})),i()(xa,"ACTION_DISABLED",void 0),function(e){e.Off="off",e.On="on",e.Loud="loud"}(ka||(ka={}));class ja{static actionsFor(e){return e===ka.On?xa.ACTION_NOTIFY:e===ka.Loud?xa.ACTION_HIGHLIGHT_DEFAULT_SOUND:[]}static contentRuleVectorStateKind(e){const t=Oa.decodeActions(e.actions);if(!t)return null;let a=0;t.sound&&a++,t.highlight&&a++;let n=null;switch(a){case 0:n=ka.On;break;case 2:n=ka.Loud}return n}}i()(ja,"OFF",ka.Off),i()(ja,"ON",ka.On),i()(ja,"LOUD",ka.Loud),i()(ja,"states",ka);class Ra{constructor(e){i()(this,"description",void 0),i()(this,"vectorStateToActions",void 0),this.description=e.description,this.vectorStateToActions=e.vectorStateToActions}ruleToVectorState(e){let t=!1;e&&(t=e.enabled);for(const a of Object.values(ja.states)){const n=this.vectorStateToActions[a];if(n){if(t&&JSON.stringify(Oa.decodeActions(e.actions))===JSON.stringify(Oa.decodeActions(n)))return a}else if(!t)return a}d.a.error(`Cannot translate rule actions into Vector rule state. Rule: ${JSON.stringify(e)}, Expected: ${JSON.stringify(this.vectorStateToActions)}`)}}const Ia={".m.rule.contains_display_name":new Ra({description:Object(l.c)("Messages containing my display name"),vectorStateToActions:{[ka.On]:xa.ACTION_NOTIFY,[ka.Loud]:xa.ACTION_HIGHLIGHT_DEFAULT_SOUND,[ka.Off]:xa.ACTION_DISABLED}}),".m.rule.contains_user_name":new Ra({description:Object(l.c)("Messages containing my username"),vectorStateToActions:{[ka.On]:xa.ACTION_NOTIFY,[ka.Loud]:xa.ACTION_HIGHLIGHT_DEFAULT_SOUND,[ka.Off]:xa.ACTION_DISABLED}}),".m.rule.roomnotif":new Ra({description:Object(l.c)("Messages containing @room"),vectorStateToActions:{[ka.On]:xa.ACTION_NOTIFY,[ka.Loud]:xa.ACTION_HIGHLIGHT,[ka.Off]:xa.ACTION_DISABLED}}),".m.rule.room_one_to_one":new Ra({description:Object(l.c)("Messages in one-to-one chats"),vectorStateToActions:{[ka.On]:xa.ACTION_NOTIFY,[ka.Loud]:xa.ACTION_NOTIFY_DEFAULT_SOUND,[ka.Off]:xa.ACTION_DONT_NOTIFY}}),".m.rule.encrypted_room_one_to_one":new Ra({description:Object(l.c)("Encrypted messages in one-to-one chats"),vectorStateToActions:{[ka.On]:xa.ACTION_NOTIFY,[ka.Loud]:xa.ACTION_NOTIFY_DEFAULT_SOUND,[ka.Off]:xa.ACTION_DONT_NOTIFY}}),".m.rule.message":new Ra({description:Object(l.c)("Messages in group chats"),vectorStateToActions:{[ka.On]:xa.ACTION_NOTIFY,[ka.Loud]:xa.ACTION_NOTIFY_DEFAULT_SOUND,[ka.Off]:xa.ACTION_DONT_NOTIFY}}),".m.rule.encrypted":new Ra({description:Object(l.c)("Encrypted messages in group chats"),vectorStateToActions:{[ka.On]:xa.ACTION_NOTIFY,[ka.Loud]:xa.ACTION_NOTIFY_DEFAULT_SOUND,[ka.Off]:xa.ACTION_DONT_NOTIFY}}),".m.rule.invite_for_me":new Ra({description:Object(l.c)("When I'm invited to a room"),vectorStateToActions:{[ka.On]:xa.ACTION_NOTIFY,[ka.Loud]:xa.ACTION_NOTIFY_DEFAULT_SOUND,[ka.Off]:xa.ACTION_DISABLED}}),".m.rule.call":new Ra({description:Object(l.c)("Call invitation"),vectorStateToActions:{[ka.On]:xa.ACTION_NOTIFY,[ka.Loud]:xa.ACTION_NOTIFY_RING_SOUND,[ka.Off]:xa.ACTION_DISABLED}}),".m.rule.suppress_notices":new Ra({description:Object(l.c)("Messages sent by bot"),vectorStateToActions:{[ka.On]:xa.ACTION_DISABLED,[ka.Loud]:xa.ACTION_NOTIFY_DEFAULT_SOUND,[ka.Off]:xa.ACTION_DONT_NOTIFY}}),".m.rule.tombstone":new Ra({description:Object(l.c)("When rooms are upgraded"),vectorStateToActions:{[ka.On]:xa.ACTION_NOTIFY,[ka.Loud]:xa.ACTION_HIGHLIGHT,[ka.Off]:xa.ACTION_DISABLED}})};class Ta{static parseContentRules(e){const t=Ta.categoriseContentRules(e);return t.loud.length?{vectorState:ka.Loud,rules:t.loud,externalRules:[...t.loud_but_disabled,...t.on,...t.on_but_disabled,...t.other]}:t.loud_but_disabled.length?{vectorState:ka.Off,rules:t.loud_but_disabled,externalRules:[...t.on,...t.on_but_disabled,...t.other]}:t.on.length?{vectorState:ka.On,rules:t.on,externalRules:[...t.on_but_disabled,...t.other]}:t.on_but_disabled.length?{vectorState:ka.Off,rules:t.on_but_disabled,externalRules:t.other}:{vectorState:ka.On,rules:[],externalRules:t.other}}static categoriseContentRules(e){const t={on:[],on_but_disabled:[],loud:[],loud_but_disabled:[],other:[]};for(const a in e.global)for(let n=0;n<Object.keys(e.global[a]).length;++n){const i=e.global[a][n];if("."!==i.rule_id[0]&&a===wa.e.ContentSpecific)switch(i.kind=a,ja.contentRuleVectorStateKind(i)){case ka.On:i.enabled?t.on.push(i):t.on_but_disabled.push(i);break;case ka.Loud:i.enabled?t.loud.push(i):t.loud_but_disabled.push(i);break;default:t.other.push(i)}}return t}}var Na=a(234),Da=a(461);const Pa=e=>{let{icon:t,label:a,onDeleteClick:n,disabled:i=!1}=e;return r.a.createElement("div",{className:"mx_Tag"},null==t?void 0:t(),a,n&&r.a.createElement(y.a,{className:"mx_Tag_delete",onClick:n,disabled:i},r.a.createElement(Da.a,null)))};class Ma extends r.a.PureComponent{constructor(e){super(e),i()(this,"onInputChange",(e=>{this.setState({newTag:e.target.value})})),i()(this,"onAdd",(e=>{e.preventDefault(),this.state.newTag&&(this.props.onAdd(this.state.newTag),this.setState({newTag:""}))})),this.state={newTag:""}}onRemove(e){this.props.onRemove(e)}render(){return r.a.createElement("div",{className:"mx_TagComposer"},r.a.createElement("form",{className:"mx_TagComposer_input",onSubmit:this.onAdd},r.a.createElement(h.a,{value:this.state.newTag,onChange:this.onInputChange,label:this.props.label||Object(l.a)("Keyword"),placeholder:this.props.placeholder||Object(l.a)("New keyword"),disabled:this.props.disabled,autoComplete:"off"}),r.a.createElement(y.a,{onClick:this.onAdd,kind:"primary",disabled:this.props.disabled},Object(l.a)("Add"))),r.a.createElement("div",{className:"mx_TagComposer_tags"},this.props.tags.map(((e,t)=>r.a.createElement(Pa,{label:e,key:e,onDeleteClick:this.onRemove.bind(this,e),disabled:this.props.disabled})))))}}var Aa,La,Ua=a(155),Fa=a(384);function Ba(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function Va(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?Ba(Object(a),!0).forEach((function(t){i()(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):Ba(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}!function(e){e.Loading="loading",e.Ready="ready",e.Persisting="persisting",e.Error="error"}(Aa||(Aa={})),function(e){e.Master="master",e.VectorGlobal="vector_global",e.VectorMentions="vector_mentions",e.VectorOther="vector_other",e.Other="other"}(La||(La={}));const Wa="_keywords",Ha=La.VectorMentions,za=[wa.f.DM,wa.f.EncryptedDM,wa.f.Message,wa.f.EncryptedMessage,wa.f.ContainsDisplayName,wa.f.ContainsUserName,wa.f.AtRoomNotification,wa.f.InviteToSelf,wa.f.IncomingCall,wa.f.SuppressNotices,wa.f.Tombstone];class Ga extends r.a.PureComponent{constructor(e){var t,a;super(e),a=this,i()(this,"settingWatchers",void 0),i()(this,"onMasterRuleChanged",(async e=>{this.setState({phase:Aa.Persisting});try{const t=this.state.masterPushRule;await u.a.get().setPushRuleEnabled("global",t.kind,t.rule_id,!e),await this.refreshFromServer()}catch(e){this.setState({phase:Aa.Error}),d.a.error("Error updating master push rule:",e),this.showSaveError()}})),i()(this,"updateDeviceNotifications",(async e=>{await x.b.setValue("deviceNotificationsEnabled",null,G.a.DEVICE,e)})),i()(this,"onEmailNotificationsChanged",(async(e,t)=>{this.setState({phase:Aa.Persisting});try{if(t)await u.a.get().setPusher({kind:"email",app_id:"m.email",pushkey:e,app_display_name:"Email Notifications",device_display_name:e,lang:navigator.language,data:{brand:p.b.get().brand},append:!0});else{const t=this.state.pushers.find((t=>"email"===t.kind&&t.pushkey===e));t.kind=null,await u.a.get().setPusher(t)}await this.refreshFromServer()}catch(e){this.setState({phase:Aa.Error}),d.a.error("Error updating email pusher:",e),this.showSaveError()}})),i()(this,"onDesktopNotificationsChanged",(async e=>{await x.b.setValue("notificationsEnabled",null,G.a.DEVICE,e)})),i()(this,"onDesktopShowBodyChanged",(async e=>{await x.b.setValue("notificationBodyEnabled",null,G.a.DEVICE,e)})),i()(this,"onAudioNotificationsChanged",(async e=>{await x.b.setValue("audioNotificationsEnabled",null,G.a.DEVICE,e)})),i()(this,"onRadioChecked",(async(e,t)=>{this.setState({phase:Aa.Persisting});try{const a=u.a.get();if(e.ruleId===Wa)for(const e of this.state.vectorKeywordRuleInfo.rules){let n,i;t===ka.On?(1!==e.actions.length&&(i=ja.actionsFor(t)),this.state.vectorKeywordRuleInfo.vectorState===ka.Off&&(n=!0)):t===ka.Loud?(3!==e.actions.length&&(i=ja.actionsFor(t)),this.state.vectorKeywordRuleInfo.vectorState===ka.Off&&(n=!0)):n=!1,i&&await a.setPushRuleActions("global",e.kind,e.rule_id,i),void 0!==n&&await a.setPushRuleEnabled("global",e.kind,e.rule_id,n)}else{const n=Ia[e.ruleId].vectorStateToActions[t];n?(await a.setPushRuleActions("global",e.rule.kind,e.rule.rule_id,n),await a.setPushRuleEnabled("global",e.rule.kind,e.rule.rule_id,!0)):await a.setPushRuleEnabled("global",e.rule.kind,e.rule.rule_id,!1)}await this.refreshFromServer()}catch(e){this.setState({phase:Aa.Error}),d.a.error("Error updating push rule:",e),this.showSaveError()}})),i()(this,"onClearNotificationsClicked",(async()=>{try{this.setState({clearingNotifications:!0});const e=u.a.get();await Object(Fa.a)(e)}finally{this.setState({clearingNotifications:!1})}})),i()(this,"onKeywordAdd",(e=>{const t=Object(_e.a)(this.state.vectorKeywordRuleInfo.rules);this.setState({phase:Aa.Persisting,vectorKeywordRuleInfo:Va(Va({},this.state.vectorKeywordRuleInfo),{},{rules:[...this.state.vectorKeywordRuleInfo.rules,{pattern:e}]})},(async()=>{await this.setKeywords(this.state.vectorKeywordRuleInfo.rules.map((e=>e.pattern)),t)}))})),i()(this,"onKeywordRemove",(e=>{const t=Object(_e.a)(this.state.vectorKeywordRuleInfo.rules);this.setState({phase:Aa.Persisting,vectorKeywordRuleInfo:Va(Va({},this.state.vectorKeywordRuleInfo),{},{rules:this.state.vectorKeywordRuleInfo.rules.filter((t=>t.pattern!==e))})},(async()=>{await this.setKeywords(this.state.vectorKeywordRuleInfo.rules.map((e=>e.pattern)),t)}))})),this.state={phase:Aa.Loading,deviceNotificationsEnabled:null===(t=x.b.getValue("deviceNotificationsEnabled"))||void 0===t||t,desktopNotifications:x.b.getValue("notificationsEnabled"),desktopShowBody:x.b.getValue("notificationBodyEnabled"),audioNotifications:x.b.getValue("audioNotificationsEnabled"),clearingNotifications:!1},this.settingWatchers=[x.b.watchSetting("notificationsEnabled",null,(function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];let[,,,,i]=t;return a.setState({desktopNotifications:i})})),x.b.watchSetting("deviceNotificationsEnabled",null,(function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];let[,,,,i]=t;a.setState({deviceNotificationsEnabled:i})})),x.b.watchSetting("notificationBodyEnabled",null,(function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];let[,,,,i]=t;return a.setState({desktopShowBody:i})})),x.b.watchSetting("audioNotificationsEnabled",null,(function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];let[,,,,i]=t;return a.setState({audioNotifications:i})}))]}get isInhibited(){var e;return!(null===(e=this.state.masterPushRule)||void 0===e||!e.enabled)}componentDidMount(){this.refreshFromServer(),this.refreshFromAccountData()}componentWillUnmount(){this.settingWatchers.forEach((e=>x.b.unwatchSetting(e)))}componentDidUpdate(e,t){this.state.deviceNotificationsEnabled!==t.deviceNotificationsEnabled&&this.persistLocalNotificationSettings(this.state.deviceNotificationsEnabled)}async refreshFromServer(){try{const e=(await Promise.all([this.refreshRules(),this.refreshPushers(),this.refreshThreepids()])).reduce(((e,t)=>Object.assign(t,e)),{});this.setState(Va(Va({},e),{},{phase:Aa.Ready}))}catch(e){d.a.error("Error setting up notifications for settings: ",e),this.setState({phase:Aa.Error})}}async refreshFromAccountData(){const e=u.a.get(),t=e.getAccountData(Object(Fa.d)(e.deviceId));if(t){const e=!t.getContent().is_silenced;await this.updateDeviceNotifications(e)}}persistLocalNotificationSettings(e){const t=u.a.get();return t.setAccountData(Object(Fa.d)(t.deviceId),{is_silenced:!e})}async refreshRules(){const e=await u.a.get().getPushRules(),t={[wa.f.Master]:La.Master,[wa.f.DM]:La.VectorGlobal,[wa.f.EncryptedDM]:La.VectorGlobal,[wa.f.Message]:La.VectorGlobal,[wa.f.EncryptedMessage]:La.VectorGlobal,[wa.f.ContainsDisplayName]:La.VectorMentions,[wa.f.ContainsUserName]:La.VectorMentions,[wa.f.AtRoomNotification]:La.VectorMentions,[wa.f.InviteToSelf]:La.VectorOther,[wa.f.IncomingCall]:La.VectorOther,[wa.f.SuppressNotices]:La.VectorOther,[wa.f.Tombstone]:La.VectorOther},a={[La.Master]:[],[La.VectorGlobal]:[],[La.VectorMentions]:[],[La.VectorOther]:[],[La.Other]:[]};for(const i in e.global){const s=i;for(const i of e.global[s]){var n;const e=Object.assign(i,{kind:s}),r=null!==(n=t[e.rule_id])&&void 0!==n?n:La.Other;"."===e.rule_id[0]&&a[r].push(e)}}const i={};if(!(a.master.length>0))throw new Error("Failed to locate a master push rule");i.masterPushRule=a.master[0],i.vectorKeywordRuleInfo=Ta.parseContentRules(e),i.vectorPushRules={};const s=[La.VectorGlobal,La.VectorMentions,La.VectorOther];for(const e of s){i.vectorPushRules[e]=[];for(const t of a[e]){const a=Ia[t.rule_id],n=a.ruleToVectorState(t);i.vectorPushRules[e].push({ruleId:t.rule_id,rule:t,vectorState:n,description:Object(l.a)(a.description)})}i.vectorPushRules[e].sort(((e,t)=>{let a=za.indexOf(e.ruleId),n=za.indexOf(t.ruleId);return a<0&&(a=za.length),n<0&&(n=za.length),a-n})),e===Ha&&i.vectorPushRules[e].push({ruleId:Wa,description:Object(l.a)("Messages containing keywords"),vectorState:i.vectorKeywordRuleInfo.vectorState})}return i}refreshPushers(){return u.a.get().getPushers()}refreshThreepids(){return u.a.get().getThreePids()}showSaveError(){v.b.createDialog(b.a,{title:Object(l.a)("Error saving notification preferences"),description:Object(l.a)("An error occurred whilst saving your notification preferences.")})}async setKeywords(e,t){try{e=Array.from(new Set(e)).filter((e=>!!e));const a=Array.from(new Set(t.map((e=>e.pattern)))).filter((e=>!!e)),n=Object(Ua.a)(a,e);for(const e of n.removed)for(const a of t.filter((t=>t.pattern===e)))await u.a.get().deletePushRule("global",a.kind,a.rule_id);let i=this.state.vectorKeywordRuleInfo.vectorState;i===ka.Off&&(i=t.length?ja.contentRuleVectorStateKind(t[0]):ka.On);const s=wa.e.ContentSpecific;for(const e of n.added)await u.a.get().addPushRule("global",s,e,{actions:ja.actionsFor(i),pattern:e}),i===ka.Off&&await u.a.get().setPushRuleEnabled("global",s,e,!1);await this.refreshFromServer()}catch(e){this.setState({phase:Aa.Error}),d.a.error("Error updating keyword push rules:",e),this.showSaveError()}}renderTopSection(){const e=r.a.createElement(Na.a,{"data-testid":"notif-master-switch",value:!this.isInhibited,label:Object(l.a)("Enable notifications for this account"),caption:Object(l.a)("Turn off to disable notifications on all your devices and sessions"),onChange:this.onMasterRuleChanged,disabled:this.state.phase===Aa.Persisting});if(this.isInhibited)return e;const t=(this.state.threepids||[]).filter((e=>e.medium===q.Email)).map((e=>r.a.createElement(Na.a,{"data-testid":"notif-email-switch",key:e.address,value:this.state.pushers.some((t=>"email"===t.kind&&t.pushkey===e.address)),label:Object(l.a)("Enable email notifications for %(email)s",{email:e.address}),onChange:this.onEmailNotificationsChanged.bind(this,e.address),disabled:this.state.phase===Aa.Persisting})));return r.a.createElement(r.a.Fragment,null,e,r.a.createElement(Na.a,{"data-testid":"notif-device-switch",value:this.state.deviceNotificationsEnabled,label:Object(l.a)("Enable notifications for this device"),onChange:e=>this.updateDeviceNotifications(e),disabled:this.state.phase===Aa.Persisting}),this.state.deviceNotificationsEnabled&&r.a.createElement(r.a.Fragment,null,r.a.createElement(Na.a,{"data-testid":"notif-setting-notificationsEnabled",value:this.state.desktopNotifications,onChange:this.onDesktopNotificationsChanged,label:Object(l.a)("Enable desktop notifications for this session"),disabled:this.state.phase===Aa.Persisting}),r.a.createElement(Na.a,{"data-testid":"notif-setting-notificationBodyEnabled",value:this.state.desktopShowBody,onChange:this.onDesktopShowBodyChanged,label:Object(l.a)("Show message in desktop notification"),disabled:this.state.phase===Aa.Persisting}),r.a.createElement(Na.a,{"data-testid":"notif-setting-audioNotificationsEnabled",value:this.state.audioNotifications,onChange:this.onAudioNotificationsChanged,label:Object(l.a)("Enable audible notifications for this session"),disabled:this.state.phase===Aa.Persisting})),t)}renderCategory(e){var t;if(e!==La.VectorOther&&this.isInhibited)return null;let a,n;if(e===La.VectorOther&&u.a.get().getRooms().some((e=>e.getUnreadNotificationCount()>0))&&(a=r.a.createElement(y.a,{onClick:this.onClearNotificationsClicked,disabled:this.state.clearingNotifications,kind:"danger",className:"mx_UserNotifSettings_clearNotifsButton","data-testid":"clear-notifications"},Object(l.a)("Mark all as read"))),e===La.VectorOther&&this.isInhibited)return a?r.a.createElement("div",{className:"mx_UserNotifSettings_floatingSection"},r.a.createElement("div",null,Object(l.a)("Other")),a):null;var i;e===La.VectorMentions&&(n=r.a.createElement(Ma,{tags:null===(i=this.state.vectorKeywordRuleInfo)||void 0===i?void 0:i.rules.map((e=>e.pattern)),onAdd:this.onKeywordAdd,onRemove:this.onKeywordRemove,disabled:this.state.phase===Aa.Persisting,label:Object(l.a)("Keyword"),placeholder:Object(l.a)("New keyword")}));const s={[ka.On]:Object(l.a)("On"),[ka.Off]:Object(l.a)("Off"),[ka.Loud]:Object(l.a)("Noisy")},o=(e,t)=>r.a.createElement(Ye.a,{key:e.ruleId+t,name:e.ruleId,checked:e.vectorState===t,onChange:this.onRadioChecked.bind(this,e,t),disabled:this.state.phase===Aa.Persisting,"aria-label":s[t]}),c=null===(t=this.state.vectorPushRules[e])||void 0===t?void 0:t.map((t=>r.a.createElement("fieldset",{key:e+t.ruleId,"data-testid":e+t.ruleId,className:"mx_UserNotifSettings_gridRowContainer"},r.a.createElement("legend",{className:"mx_UserNotifSettings_gridRowLabel"},t.description),o(t,ka.Off),o(t,ka.On),o(t,ka.Loud))));let d;switch(e){case La.VectorGlobal:d=Object(l.a)("Global");break;case La.VectorMentions:d=Object(l.a)("Mentions & keywords");break;case La.VectorOther:d=Object(l.a)("Other");break;default:throw new Error("Developer error: Unnamed notifications section: "+e)}return r.a.createElement(r.a.Fragment,null,r.a.createElement("div",{"data-testid":`notif-section-${e}`,className:"mx_UserNotifSettings_grid"},r.a.createElement("span",{className:"mx_UserNotifSettings_gridRowLabel mx_UserNotifSettings_gridRowHeading"},d),r.a.createElement("span",{className:"mx_UserNotifSettings_gridColumnLabel"},s[ka.Off]),r.a.createElement("span",{className:"mx_UserNotifSettings_gridColumnLabel"},s[ka.On]),r.a.createElement("span",{className:"mx_UserNotifSettings_gridColumnLabel"},s[ka.Loud]),c),a,n)}renderTargets(){var e;if(this.isInhibited)return null;const t=null===(e=this.state.pushers)||void 0===e?void 0:e.map((e=>r.a.createElement("tr",{key:e.kind+e.pushkey},r.a.createElement("td",null,e.app_display_name),r.a.createElement("td",null,e.device_display_name))));return t.length?r.a.createElement("div",{className:"mx_UserNotifSettings_floatingSection"},r.a.createElement("div",null,Object(l.a)("Notification targets")),r.a.createElement("table",null,r.a.createElement("tbody",null,t))):null}render(){return this.state.phase===Aa.Loading?r.a.createElement(I.a,null):this.state.phase===Aa.Error?r.a.createElement("p",{"data-testid":"error-message"},Object(l.a)("There was an error loading your notification settings.")):r.a.createElement("div",{className:"mx_UserNotifSettings"},this.renderTopSection(),this.renderCategory(La.VectorGlobal),this.renderCategory(La.VectorMentions),this.renderCategory(La.VectorOther),this.renderTargets())}}class Ka extends r.a.Component{render(){return r.a.createElement("div",{className:"mx_SettingsTab"},r.a.createElement("div",{className:"mx_SettingsTab_heading"},Object(l.a)("Notifications")),r.a.createElement("div",{className:"mx_SettingsTab_section mx_SettingsTab_subsectionText"},r.a.createElement(Ga,null)))}}var qa=a(213),$a=a(486);class Ya extends r.a.Component{constructor(e){super(e),i()(this,"onAutocompleteDelayChange",(e=>{this.setState({autocompleteDelay:e.target.value}),x.b.setValue("autocompleteDelay",null,G.a.DEVICE,e.target.value)})),i()(this,"onReadMarkerInViewThresholdMs",(e=>{this.setState({readMarkerInViewThresholdMs:e.target.value}),x.b.setValue("readMarkerInViewThresholdMs",null,G.a.DEVICE,e.target.value)})),i()(this,"onReadMarkerOutOfViewThresholdMs",(e=>{this.setState({readMarkerOutOfViewThresholdMs:e.target.value}),x.b.setValue("readMarkerOutOfViewThresholdMs",null,G.a.DEVICE,e.target.value)})),i()(this,"onKeyboardShortcutsClicked",(()=>{U.a.dispatch({action:F.a.ViewUserSettings,initialTabId:qa.a.Keyboard})})),this.state={disablingReadReceiptsSupported:!1,autocompleteDelay:x.b.getValueAt(G.a.DEVICE,"autocompleteDelay").toString(10),readMarkerInViewThresholdMs:x.b.getValueAt(G.a.DEVICE,"readMarkerInViewThresholdMs").toString(10),readMarkerOutOfViewThresholdMs:x.b.getValueAt(G.a.DEVICE,"readMarkerOutOfViewThresholdMs").toString(10)}}async componentDidMount(){const e=u.a.get();this.setState({disablingReadReceiptsSupported:await e.doesServerSupportUnstableFeature("org.matrix.msc2285.stable")||await e.isVersionSupported("v1.4")})}renderGroup(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:G.a.ACCOUNT;return e.map((e=>{const a=!x.b.isEnabled(e);return r.a.createElement(Ue.a,{key:e,name:e,level:t,disabled:a})}))}render(){const e=x.b.getValue("FTUE.useCaseSelection"),t=Ya.ROOM_LIST_SETTINGS.filter((e=>"breadcrumbs"!==e||!x.b.getValue("feature_breadcrumbs_v2"))).filter((t=>"FTUE.userOnboardingButton"!==t||Object($a.b)(e)));return r.a.createElement("div",{className:"mx_SettingsTab mx_PreferencesUserSettingsTab"},r.a.createElement("div",{className:"mx_SettingsTab_heading"},Object(l.a)("Preferences")),t.length>0&&r.a.createElement("div",{className:"mx_SettingsTab_section"},r.a.createElement("span",{className:"mx_SettingsTab_subheading"},Object(l.a)("Room list")),this.renderGroup(t)),r.a.createElement("div",{className:"mx_SettingsTab_section"},r.a.createElement("span",{className:"mx_SettingsTab_subheading"},Object(l.a)("Spaces")),this.renderGroup(Ya.SPACES_SETTINGS,G.a.ACCOUNT)),r.a.createElement("div",{className:"mx_SettingsTab_section"},r.a.createElement("span",{className:"mx_SettingsTab_subheading"},Object(l.a)("Keyboard shortcuts")),r.a.createElement("div",{className:"mx_SettingsFlag"},Object(l.a)("To view all keyboard shortcuts, <a>click here</a>.",{},{a:e=>r.a.createElement(y.a,{kind:"link_inline",onClick:this.onKeyboardShortcutsClicked},e)})),this.renderGroup(Ya.KEYBINDINGS_SETTINGS)),r.a.createElement("div",{className:"mx_SettingsTab_section"},r.a.createElement("span",{className:"mx_SettingsTab_subheading"},Object(l.a)("Displaying time")),this.renderGroup(Ya.TIME_SETTINGS)),r.a.createElement("div",{className:"mx_SettingsTab_section"},r.a.createElement("span",{className:"mx_SettingsTab_subheading"},Object(l.a)("Presence")),r.a.createElement("span",{className:"mx_SettingsTab_subsectionText"},Object(l.a)("Share your activity and status with others.")),r.a.createElement(Ue.a,{disabled:!this.state.disablingReadReceiptsSupported&&x.b.getValue("sendReadReceipts"),disabledDescription:Object(l.a)("Your server doesn't support disabling sending read receipts."),name:"sendReadReceipts",level:G.a.ACCOUNT}),this.renderGroup(Ya.PRESENCE_SETTINGS)),r.a.createElement("div",{className:"mx_SettingsTab_section"},r.a.createElement("span",{className:"mx_SettingsTab_subheading"},Object(l.a)("Composer")),this.renderGroup(Ya.COMPOSER_SETTINGS)),r.a.createElement("div",{className:"mx_SettingsTab_section"},r.a.createElement("span",{className:"mx_SettingsTab_subheading"},Object(l.a)("Code blocks")),this.renderGroup(Ya.CODE_BLOCKS_SETTINGS)),r.a.createElement("div",{className:"mx_SettingsTab_section"},r.a.createElement("span",{className:"mx_SettingsTab_subheading"},Object(l.a)("Images, GIFs and videos")),this.renderGroup(Ya.IMAGES_AND_VIDEOS_SETTINGS)),r.a.createElement("div",{className:"mx_SettingsTab_section"},r.a.createElement("span",{className:"mx_SettingsTab_subheading"},Object(l.a)("Timeline")),this.renderGroup(Ya.TIMELINE_SETTINGS)),r.a.createElement("div",{className:"mx_SettingsTab_section"},r.a.createElement("span",{className:"mx_SettingsTab_subheading"},Object(l.a)("Room directory")),this.renderGroup(Ya.ROOM_DIRECTORY_SETTINGS)),r.a.createElement("div",{className:"mx_SettingsTab_section"},r.a.createElement("span",{className:"mx_SettingsTab_subheading"},Object(l.a)("General")),this.renderGroup(Ya.GENERAL_SETTINGS),r.a.createElement(Ue.a,{name:"Electron.showTrayIcon",level:G.a.PLATFORM,hideIfCannotSet:!0}),r.a.createElement(Ue.a,{name:"Electron.enableHardwareAcceleration",level:G.a.PLATFORM,hideIfCannotSet:!0,label:Object(l.a)("Enable hardware acceleration (restart %(appName)s to take effect)",{appName:p.b.get().brand})}),r.a.createElement(Ue.a,{name:"Electron.alwaysShowMenuBar",level:G.a.PLATFORM,hideIfCannotSet:!0}),r.a.createElement(Ue.a,{name:"Electron.autoLaunch",level:G.a.PLATFORM,hideIfCannotSet:!0}),r.a.createElement(Ue.a,{name:"Electron.warnBeforeExit",level:G.a.PLATFORM,hideIfCannotSet:!0}),r.a.createElement(h.a,{label:Object(l.a)("Autocomplete delay (ms)"),type:"number",value:this.state.autocompleteDelay,onChange:this.onAutocompleteDelayChange}),r.a.createElement(h.a,{label:Object(l.a)("Read Marker lifetime (ms)"),type:"number",value:this.state.readMarkerInViewThresholdMs,onChange:this.onReadMarkerInViewThresholdMs}),r.a.createElement(h.a,{label:Object(l.a)("Read Marker off-screen lifetime (ms)"),type:"number",value:this.state.readMarkerOutOfViewThresholdMs,onChange:this.onReadMarkerOutOfViewThresholdMs})))}}i()(Ya,"ROOM_LIST_SETTINGS",["breadcrumbs","FTUE.userOnboardingButton"]),i()(Ya,"SPACES_SETTINGS",["Spaces.allRoomsInHome"]),i()(Ya,"KEYBINDINGS_SETTINGS",["ctrlFForSearch"]),i()(Ya,"PRESENCE_SETTINGS",["sendTypingNotifications"]),i()(Ya,"COMPOSER_SETTINGS",["MessageComposerInput.autoReplaceEmoji","MessageComposerInput.useMarkdown","MessageComposerInput.suggestEmoji","MessageComposerInput.ctrlEnterToSend","MessageComposerInput.surroundWith","MessageComposerInput.showStickersButton","MessageComposerInput.insertTrailingColon"]),i()(Ya,"TIME_SETTINGS",["showTwelveHourTimestamps","alwaysShowTimestamps"]),i()(Ya,"CODE_BLOCKS_SETTINGS",["enableSyntaxHighlightLanguageDetection","expandCodeByDefault","showCodeLineNumbers"]),i()(Ya,"IMAGES_AND_VIDEOS_SETTINGS",["urlPreviewsEnabled","autoplayGifs","autoplayVideo","showImages"]),i()(Ya,"TIMELINE_SETTINGS",["showTypingNotifications","showRedactions","showReadReceipts","showJoinLeaves","showDisplaynameChanges","showChatEffects","showAvatarChanges","Pill.shouldShowPillAvatar","TextualBody.enableBigEmoji","scrollToBottomOnMessageSent","useOnlyCurrentProfiles"]),i()(Ya,"ROOM_DIRECTORY_SETTINGS",["SpotlightSearch.showNsfwPublicRooms"]),i()(Ya,"GENERAL_SETTINGS",["promptBeforeInviteUnknownUsers"]);var Ja=a(245),Qa=a(829);class Xa extends r.a.Component{constructor(e){super(e),i()(this,"refreshMediaDevices",(async e=>{this.setState({mediaDevices:await Ja.c.getDevices(),[Ja.b.AudioOutput]:Ja.c.getAudioOutput(),[Ja.b.AudioInput]:Ja.c.getAudioInput(),[Ja.b.VideoInput]:Ja.c.getVideoInput()}),e&&e.getTracks().forEach((e=>e.stop()))})),i()(this,"requestMediaPermissions",(async()=>{const e=await Object(Qa.a)();e&&this.refreshMediaDevices(e)})),i()(this,"setDevice",((e,t)=>{Ja.c.instance.setDevice(e,t),this.setState({[t]:e})})),i()(this,"changeWebRtcMethod",(e=>{u.a.get().setForceTURN(!e)})),i()(this,"changeFallbackICEServerAllowed",(e=>{u.a.get().setFallbackICEServerAllowed(e)})),this.state={mediaDevices:null,[Ja.b.AudioOutput]:null,[Ja.b.AudioInput]:null,[Ja.b.VideoInput]:null,audioAutoGainControl:Ja.c.getAudioAutoGainControl(),audioEchoCancellation:Ja.c.getAudioEchoCancellation(),audioNoiseSuppression:Ja.c.getAudioNoiseSuppression()}}async componentDidMount(){await Ja.c.hasAnyLabeledDevices()&&this.refreshMediaDevices()}renderDeviceOptions(e,t){return e.map((e=>r.a.createElement("option",{key:`${t}-${e.deviceId}`,value:e.deviceId},e.label)))}renderDropdown(e,t){const a=this.state.mediaDevices[e].slice(0);if(0===a.length)return null;const n=Ja.c.getDefaultDevice(a);return r.a.createElement(h.a,{element:"select",label:t,value:this.state[e]||n,onChange:t=>this.setDevice(t.target.value,e)},this.renderDeviceOptions(a,e))}render(){let e,t,a,n;return this.state.mediaDevices?this.state.mediaDevices&&(t=this.renderDropdown(Ja.b.AudioOutput,Object(l.a)("Audio Output"))||r.a.createElement("p",null,Object(l.a)("No Audio Outputs detected")),a=this.renderDropdown(Ja.b.AudioInput,Object(l.a)("Microphone"))||r.a.createElement("p",null,Object(l.a)("No Microphones detected")),n=this.renderDropdown(Ja.b.VideoInput,Object(l.a)("Camera"))||r.a.createElement("p",null,Object(l.a)("No Webcams detected"))):e=r.a.createElement("div",{className:"mx_VoiceUserSettingsTab_missingMediaPermissions"},r.a.createElement("p",null,Object(l.a)("Missing media permissions, click the button below to request.")),r.a.createElement(y.a,{onClick:this.requestMediaPermissions,kind:"primary"},Object(l.a)("Request media permissions"))),r.a.createElement("div",{className:"mx_SettingsTab mx_VoiceUserSettingsTab"},r.a.createElement("div",{className:"mx_SettingsTab_heading"},Object(l.a)("Voice & Video")),e,r.a.createElement("div",{className:"mx_SettingsTab_section"},r.a.createElement("span",{className:"mx_SettingsTab_subheading"},Object(l.a)("Voice settings")),t,a,r.a.createElement(Na.a,{value:this.state.audioAutoGainControl,onChange:async e=>{await Ja.c.setAudioAutoGainControl(e),this.setState({audioAutoGainControl:Ja.c.getAudioAutoGainControl()})},label:Object(l.a)("Automatically adjust the microphone volume"),"data-testid":"voice-auto-gain"})),r.a.createElement("div",{className:"mx_SettingsTab_section"},r.a.createElement("span",{className:"mx_SettingsTab_subheading"},Object(l.a)("Video settings")),n,r.a.createElement(Ue.a,{name:"VideoView.flipVideoHorizontally",level:G.a.ACCOUNT})),r.a.createElement("div",{className:"mx_SettingsTab_heading"},Object(l.a)("Advanced")),r.a.createElement("div",{className:"mx_SettingsTab_section"},r.a.createElement("span",{className:"mx_SettingsTab_subheading"},Object(l.a)("Voice processing")),r.a.createElement("div",{className:"mx_SettingsTab_section"},r.a.createElement(Na.a,{value:this.state.audioNoiseSuppression,onChange:async e=>{await Ja.c.setAudioNoiseSuppression(e),this.setState({audioNoiseSuppression:Ja.c.getAudioNoiseSuppression()})},label:Object(l.a)("Noise suppression"),"data-testid":"voice-noise-suppression"}),r.a.createElement(Na.a,{value:this.state.audioEchoCancellation,onChange:async e=>{await Ja.c.setAudioEchoCancellation(e),this.setState({audioEchoCancellation:Ja.c.getAudioEchoCancellation()})},label:Object(l.a)("Echo cancellation"),"data-testid":"voice-echo-cancellation"})),r.a.createElement("div",{className:"mx_SettingsTab_section"},r.a.createElement("span",{className:"mx_SettingsTab_subheading"},Object(l.a)("Connection")),r.a.createElement(Ue.a,{name:"webRtcAllowPeerToPeer",level:G.a.DEVICE,onChange:this.changeWebRtcMethod}),r.a.createElement(Ue.a,{name:"fallbackICEServerAllowed",level:G.a.DEVICE,onChange:this.changeFallbackICEServerAllowed}))))}}var Za=a(218),en=a(132),tn=a.n(en),an=a(341),nn=a(236);const sn=["action"];function rn(){var e;null===(e=R.a.get())||void 0===e||e.installUpdate()}const on=[an.d.Ready,an.d.Error,an.d.NotAvailable];var ln=()=>{const[e,t]=Object(s.useState)(null);Object(nn.a)(U.a,(e=>{let{action:a}=e,n=tn()(e,sn);a===F.a.CheckUpdates&&t(n)}));const a=!!e&&!on.includes(e.status);let n;return e&&(n=r.a.createElement("span",{className:"mx_UpdateCheckButton_summary"},function(e,t){switch(e){case an.d.Error:return Object(l.a)("Error encountered (%(errorDetail)s).",{errorDetail:t});case an.d.Checking:return Object(l.a)("Checking for an update…");case an.d.NotAvailable:return Object(l.a)("No update available.");case an.d.Downloading:return Object(l.a)("Downloading update…");case an.d.Ready:return Object(l.a)("New version available. <a>Update now.</a>",{},{a:e=>r.a.createElement(y.a,{kind:"link_inline",onClick:rn},e)})}}(e.status,e.detail),a&&r.a.createElement(ke.a,null))),r.a.createElement(r.a.Fragment,null,r.a.createElement(y.a,{onClick:()=>{var e;t(null),null===(e=R.a.get())||void 0===e||e.startUpdateCheck()},kind:"primary",disabled:a},Object(l.a)("Check for update")),n)},cn=a(277),dn=a(300);class mn extends r.a.Component{constructor(e){super(e),i()(this,"onClearCacheAndReload",(()=>{R.a.get()&&(d.a.log("Clear cache & reload clicked"),u.a.get().stopClient(),u.a.get().store.deleteAllData().then((()=>{var e;null===(e=R.a.get())||void 0===e||e.reload()})))})),i()(this,"onBugReport",(()=>{v.b.createDialog(cn.a,{})})),i()(this,"onStartBotChat",(()=>{this.props.closeSettingsFn(),Object(Za.b)({dmUserId:p.b.get("welcome_user_id"),andView:!0})})),i()(this,"getVersionTextToCopy",(()=>{const{appVersion:e,olmVersion:t}=this.getVersionInfo();return`${e}\n${t}`})),i()(this,"onKeyboardShortcutsClicked",(()=>{U.a.dispatch({action:F.a.ViewUserSettings,initialTabId:qa.a.Keyboard})})),this.state={appVersion:null,canUpdate:!1}}componentDidMount(){var e,t;null===(e=R.a.get())||void 0===e||e.getAppVersion().then((e=>this.setState({appVersion:e}))).catch((e=>{d.a.error("Error getting vector version: ",e)})),null===(t=R.a.get())||void 0===t||t.canSelfUpdate().then((e=>this.setState({canUpdate:e}))).catch((e=>{d.a.error("Error getting self updatability: ",e)}))}getVersionInfo(){const e=p.b.get().brand,t=this.state.appVersion||"unknown",a=u.a.get().olmVersion,n=a?`${a[0]}.${a[1]}.${a[2]}`:"<not-enabled>";return{appVersion:`${Object(l.a)("%(brand)s version:",{brand:e})} ${t}`,olmVersion:`${Object(l.a)("Olm version:")} ${n}`}}renderLegal(){const e=p.b.get().terms_and_conditions_links;if(!e)return null;const t=[];for(const a of e)t.push(r.a.createElement("div",{key:a.url},r.a.createElement("a",{href:a.url,rel:"noreferrer noopener",target:"_blank"},a.text)));return r.a.createElement("div",{className:"mx_SettingsTab_section"},r.a.createElement("span",{className:"mx_SettingsTab_subheading"},Object(l.a)("Legal")),r.a.createElement("div",{className:"mx_SettingsTab_subsectionText"},t))}renderCredits(){return r.a.createElement("div",{className:"mx_SettingsTab_section"},r.a.createElement("span",{className:"mx_SettingsTab_subheading"},Object(l.a)("Credits")),r.a.createElement("ul",{className:"mx_SettingsTab_subsectionText"},r.a.createElement("li",null,"The"," ",r.a.createElement("a",{href:"themes/element/img/backgrounds/lake.jpg",rel:"noreferrer noopener",target:"_blank"},"default cover photo")," ","is © ",r.a.createElement("a",{href:"https://www.flickr.com/golan",rel:"noreferrer noopener",target:"_blank"},"Jesús Roncero")," ","used under the terms of ",r.a.createElement("a",{href:"https://creativecommons.org/licenses/by-sa/4.0/",rel:"noreferrer noopener",target:"_blank"},"CC-BY-SA 4.0"),"."),r.a.createElement("li",null,"The"," ",r.a.createElement("a",{href:"https://github.com/matrix-org/twemoji-colr",rel:"noreferrer noopener",target:"_blank"},"twemoji-colr")," ","font is © ",r.a.createElement("a",{href:"https://mozilla.org",rel:"noreferrer noopener",target:"_blank"},"Mozilla Foundation")," ","used under the terms of ",r.a.createElement("a",{href:"https://www.apache.org/licenses/LICENSE-2.0",rel:"noreferrer noopener",target:"_blank"},"Apache 2.0"),"."),r.a.createElement("li",null,"The"," ",r.a.createElement("a",{href:"https://twemoji.twitter.com/",rel:"noreferrer noopener",target:"_blank"},"Twemoji")," ","emoji art is © ",r.a.createElement("a",{href:"https://twemoji.twitter.com/",rel:"noreferrer noopener",target:"_blank"},"Twitter, Inc and other contributors")," ","used under the terms of ",r.a.createElement("a",{href:"https://creativecommons.org/licenses/by/4.0/",rel:"noreferrer noopener",target:"_blank"},"CC-BY 4.0"),".")))}render(){const e=p.b.get().brand;let t,a,n=Object(l.a)("For help with using %(brand)s, click <a>here</a>.",{brand:e},{a:e=>r.a.createElement("a",{href:"https://element.io/help",rel:"noreferrer noopener",target:"_blank"},e)});p.b.get("welcome_user_id")&&Object(l.e)().startsWith("en")&&(n=r.a.createElement("div",null,Object(l.a)("For help with using %(brand)s, click <a>here</a> or start a chat with our bot using the button below.",{brand:e},{a:e=>r.a.createElement("a",{href:"https://element.io/help",rel:"noreferrer noopener",target:"_blank"},e)}),r.a.createElement("div",null,r.a.createElement(y.a,{onClick:this.onStartBotChat,kind:"primary"},Object(l.a)("Chat with %(brand)s Bot",{brand:e}))))),this.state.canUpdate&&(t=r.a.createElement(ln,null)),p.b.get().bug_report_endpoint_url&&(a=r.a.createElement("div",{className:"mx_SettingsTab_section"},r.a.createElement("span",{className:"mx_SettingsTab_subheading"},Object(l.a)("Bug reporting")),r.a.createElement("div",{className:"mx_SettingsTab_subsectionText"},Object(l.a)("If you've submitted a bug via GitHub, debug logs can help us track down the problem. "),Object(l.a)("Debug logs contain application usage data including your username, the IDs or aliases of the rooms you have visited, which UI elements you last interacted with, and the usernames of other users. They do not contain messages.")),r.a.createElement(y.a,{onClick:this.onBugReport,kind:"primary"},Object(l.a)("Submit debug logs")),r.a.createElement("div",{className:"mx_SettingsTab_subsectionText"},Object(l.a)("To report a Matrix-related security issue, please read the Matrix.org <a>Security Disclosure Policy</a>.",{},{a:e=>r.a.createElement("a",{href:"https://matrix.org/security-disclosure-policy/",rel:"noreferrer noopener",target:"_blank"},e)}))));const{appVersion:i,olmVersion:s}=this.getVersionInfo();return r.a.createElement("div",{className:"mx_SettingsTab mx_HelpUserSettingsTab"},r.a.createElement("div",{className:"mx_SettingsTab_heading"},Object(l.a)("Help & About")),a,r.a.createElement("div",{className:"mx_SettingsTab_section"},r.a.createElement("span",{className:"mx_SettingsTab_subheading"},Object(l.a)("FAQ")),r.a.createElement("div",{className:"mx_SettingsTab_subsectionText"},n),r.a.createElement(y.a,{kind:"primary",onClick:this.onKeyboardShortcutsClicked},Object(l.a)("Keyboard Shortcuts"))),r.a.createElement("div",{className:"mx_SettingsTab_section"},r.a.createElement("span",{className:"mx_SettingsTab_subheading"},Object(l.a)("Versions")),r.a.createElement("div",{className:"mx_SettingsTab_subsectionText"},r.a.createElement(dn.a,{getTextToCopy:this.getVersionTextToCopy},i,r.a.createElement("br",null),s,r.a.createElement("br",null)),t)),this.renderLegal(),this.renderCredits(),r.a.createElement("div",{className:"mx_SettingsTab_section"},r.a.createElement("span",{className:"mx_SettingsTab_subheading"},Object(l.a)("Advanced")),r.a.createElement("div",{className:"mx_SettingsTab_subsectionText"},r.a.createElement("div",null,Object(l.a)("Homeserver is")," ",r.a.createElement("code",null,u.a.get().getHomeserverUrl())),r.a.createElement("div",null,Object(l.a)("Identity server is")," ",r.a.createElement("code",null,u.a.get().getIdentityServerUrl())),r.a.createElement("details",null,r.a.createElement("summary",null,Object(l.a)("Access Token")),r.a.createElement("b",null,Object(l.a)("Your access token gives full access to your account. Do not share it with anyone.")),r.a.createElement(dn.a,{getTextToCopy:()=>u.a.get().getAccessToken()},u.a.get().getAccessToken())),r.a.createElement(y.a,{onClick:this.onClearCacheAndReload,kind:"danger"},Object(l.a)("Clear cache and reload")))))}}var un=a(523),hn=a(490);class pn extends r.a.Component{constructor(e){super(e),i()(this,"onPersonalRuleChanged",(e=>{this.setState({newPersonalRule:e.target.value})})),i()(this,"onNewListChanged",(e=>{this.setState({newList:e.target.value})})),i()(this,"onAddPersonalRule",(async e=>{e.preventDefault(),e.stopPropagation();let t=hn.d;this.state.newPersonalRule.startsWith("@")&&(t=hn.e),this.setState({busy:!0});try{const e=await un.a.sharedInstance().getOrCreatePersonalList();await e.banEntity(t,this.state.newPersonalRule,Object(l.a)("Ignored/Blocked")),this.setState({newPersonalRule:""})}catch(e){d.a.error(e),v.b.createDialog(b.a,{title:Object(l.a)("Error adding ignored user/server"),description:Object(l.a)("Something went wrong. Please try again or view your console for hints.")})}finally{this.setState({busy:!1})}})),i()(this,"onSubscribeList",(async e=>{e.preventDefault(),e.stopPropagation(),this.setState({busy:!0});try{const e=await u.a.get().joinRoom(this.state.newList);await un.a.sharedInstance().subscribeToList(e.roomId),this.setState({newList:""})}catch(e){d.a.error(e),v.b.createDialog(b.a,{title:Object(l.a)("Error subscribing to list"),description:Object(l.a)("Please verify the room ID or address and try again.")})}finally{this.setState({busy:!1})}})),this.state={busy:!1,newPersonalRule:"",newList:""}}async removePersonalRule(e){this.setState({busy:!0});try{const t=un.a.sharedInstance().getPersonalList();await t.unbanEntity(e.kind,e.entity)}catch(e){d.a.error(e),v.b.createDialog(b.a,{title:Object(l.a)("Error removing ignored user/server"),description:Object(l.a)("Something went wrong. Please try again or view your console for hints.")})}finally{this.setState({busy:!1})}}async unsubscribeFromList(e){this.setState({busy:!0});try{await un.a.sharedInstance().unsubscribeFromList(e.roomId),await u.a.get().leave(e.roomId)}catch(e){d.a.error(e),v.b.createDialog(b.a,{title:Object(l.a)("Error unsubscribing from list"),description:Object(l.a)("Please try again or view your console for hints.")})}finally{this.setState({busy:!1})}}viewListRules(e){const t=u.a.get().getRoom(e.roomId),a=t?t.name:e.roomId,n=e=>{if(0===e.length)return r.a.createElement("i",null,Object(l.a)("None"));const t=[];for(const a of e)t.push(r.a.createElement("li",{key:a.kind+a.entity},r.a.createElement("code",null,a.entity)));return r.a.createElement("ul",null,t)};v.b.createDialog(me.a,{title:Object(l.a)("Ban list rules - %(roomName)s",{roomName:a}),description:r.a.createElement("div",null,r.a.createElement("h3",null,Object(l.a)("Server rules")),n(e.serverRules),r.a.createElement("h3",null,Object(l.a)("User rules")),n(e.userRules)),button:Object(l.a)("Close"),hasCancelButton:!1})}renderPersonalBanListRules(){const e=un.a.sharedInstance().getPersonalList(),t=e?[...e.userRules,...e.serverRules]:[];if(!e||t.length<=0)return r.a.createElement("i",null,Object(l.a)("You have not ignored anyone."));const a=[];for(const e of t)a.push(r.a.createElement("li",{key:e.entity,className:"mx_MjolnirUserSettingsTab_listItem"},r.a.createElement(y.a,{kind:"danger_sm",onClick:()=>this.removePersonalRule(e),disabled:this.state.busy},Object(l.a)("Remove"))," ",r.a.createElement("code",null,e.entity)));return r.a.createElement("div",null,r.a.createElement("p",null,Object(l.a)("You are currently ignoring:")),r.a.createElement("ul",null,a))}renderSubscribedBanLists(){const e=un.a.sharedInstance().getPersonalList(),t=un.a.sharedInstance().lists.filter((t=>!e||e.roomId!==t.roomId));if(!t||t.length<=0)return r.a.createElement("i",null,Object(l.a)("You are not subscribed to any lists"));const a=[];for(const e of t){const t=u.a.get().getRoom(e.roomId),n=t?r.a.createElement("span",null,t.name," (",r.a.createElement("code",null,e.roomId),")"):r.a.createElement("code",null,"list.roomId");a.push(r.a.createElement("li",{key:e.roomId,className:"mx_MjolnirUserSettingsTab_listItem"},r.a.createElement(y.a,{kind:"danger_sm",onClick:()=>this.unsubscribeFromList(e),disabled:this.state.busy},Object(l.a)("Unsubscribe"))," ",r.a.createElement(y.a,{kind:"primary_sm",onClick:()=>this.viewListRules(e),disabled:this.state.busy},Object(l.a)("View rules"))," ",n))}return r.a.createElement("div",null,r.a.createElement("p",null,Object(l.a)("You are currently subscribed to:")),r.a.createElement("ul",null,a))}render(){const e=p.b.get().brand;return r.a.createElement("div",{className:"mx_SettingsTab mx_MjolnirUserSettingsTab"},r.a.createElement("div",{className:"mx_SettingsTab_heading"},Object(l.a)("Ignored users")),r.a.createElement("div",{className:"mx_SettingsTab_section"},r.a.createElement("div",{className:"mx_SettingsTab_subsectionText"},r.a.createElement("span",{className:"warning"},Object(l.a)("⚠ These settings are meant for advanced users.")),r.a.createElement("br",null),r.a.createElement("br",null),Object(l.a)("Add users and servers you want to ignore here. Use asterisks to have %(brand)s match any characters. For example, <code>@bot:*</code> would ignore all users that have the name 'bot' on any server.",{brand:e},{code:e=>r.a.createElement("code",null,e)}),r.a.createElement("br",null),r.a.createElement("br",null),Object(l.a)("Ignoring people is done through ban lists which contain rules for who to ban. Subscribing to a ban list means the users/servers blocked by that list will be hidden from you."))),r.a.createElement("div",{className:"mx_SettingsTab_section"},r.a.createElement("span",{className:"mx_SettingsTab_subheading"},Object(l.a)("Personal ban list")),r.a.createElement("div",{className:"mx_SettingsTab_subsectionText"},Object(l.a)("Your personal ban list holds all the users/servers you personally don't want to see messages from. After ignoring your first user/server, a new room will show up in your room list named '%(myBanList)s' - stay in this room to keep the ban list in effect.",{myBanList:Object(l.a)("My Ban List")})),r.a.createElement("div",null,this.renderPersonalBanListRules()),r.a.createElement("div",null,r.a.createElement("form",{onSubmit:this.onAddPersonalRule,autoComplete:"off"},r.a.createElement(h.a,{type:"text",label:Object(l.a)("Server or user ID to ignore"),placeholder:Object(l.a)("eg: @bot:* or example.org"),value:this.state.newPersonalRule,onChange:this.onPersonalRuleChanged}),r.a.createElement(y.a,{type:"submit",kind:"primary",onClick:this.onAddPersonalRule,disabled:this.state.busy},Object(l.a)("Ignore"))))),r.a.createElement("div",{className:"mx_SettingsTab_section"},r.a.createElement("span",{className:"mx_SettingsTab_subheading"},Object(l.a)("Subscribed lists")),r.a.createElement("div",{className:"mx_SettingsTab_subsectionText"},r.a.createElement("span",{className:"warning"},Object(l.a)("Subscribing to a ban list will cause you to join it!"))," ",r.a.createElement("span",null,Object(l.a)("If this isn't what you want, please use a different tool to ignore users."))),r.a.createElement("div",null,this.renderSubscribedBanLists()),r.a.createElement("div",null,r.a.createElement("form",{onSubmit:this.onSubscribeList,autoComplete:"off"},r.a.createElement(h.a,{type:"text",label:Object(l.a)("Room ID or address of ban list"),value:this.state.newList,onChange:this.onNewListChanged}),r.a.createElement(y.a,{type:"submit",kind:"primary",onClick:this.onSubscribeList,disabled:this.state.busy},Object(l.a)("Subscribe"))))))}}var gn=a(894),vn=a(681),bn=a(642);const fn=Object.entries(ue.b).filter((e=>{let[t]=e;return t!==ue.c.LABS||p.b.get("show_labs_settings")})),yn=e=>{let{name:t}=e;const a=Object(vn.a)(t),n=Object(vn.b)(t);return a&&n?r.a.createElement("div",{className:"mx_KeyboardShortcut_shortcutRow"},a,r.a.createElement(bn.a,{value:n})):null},En=e=>{let{categoryName:t,category:a}=e;return a.categoryLabel?r.a.createElement("div",{className:"mx_SettingsTab_section",key:t},r.a.createElement("div",{className:"mx_SettingsTab_subheading"},Object(l.a)(a.categoryLabel)),r.a.createElement("div",null," ",a.settingNames.map((e=>r.a.createElement(yn,{key:e,name:e})))," ")):null};var _n=()=>r.a.createElement("div",{className:"mx_SettingsTab mx_KeyboardUserSettingsTab"},r.a.createElement("div",{className:"mx_SettingsTab_heading"},Object(l.a)("Keyboard")),fn.map((e=>{let[t,a]=e;return r.a.createElement(En,{key:t,categoryName:t,category:a})}))),Sn=a(878),wn=a(140);function On(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function Cn(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?On(Object(a),!0).forEach((function(t){i()(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):On(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}const xn=(e,t,a)=>{try{const n=e.getUserId();if(!n)throw new Error("No user id");const i=e.getStoredDevice(n,a.device_id);if(!i)throw new Error("No device info available");return t.checkDeviceTrust(t,i,!1,!0).isCrossSigningVerified()}catch(e){return d.a.error("Error getting device cross-signing info",e),null}},kn=(e,t)=>{const{name:a,version:n,url:i}=Object(Sn.a)(e,t.device_id);return{appName:a,appVersion:n,url:i}};let jn;!function(e){e.Unsupported="Unsupported",e.Default="Default"}(jn||(jn={}));const Rn=()=>{var e;const t=Object(s.useContext)(oa.a),a=t.getDeviceId(),n=t.getSafeUserId(),[i,r]=Object(s.useState)({}),[o,c]=Object(s.useState)([]),[u,h]=Object(s.useState)(new Map),[p,g]=Object(s.useState)(!0),[v,b]=Object(s.useState)(!0),[f,y]=Object(s.useState)();Object(s.useEffect)((()=>{t.doesServerSupportUnstableFeature("org.matrix.msc3881").then((e=>{b(e)}))}),[t]);const E=Object(s.useCallback)((async()=>{g(!0);try{const e=await(async(e,t)=>{const{devices:a}=await e.getDevices(),n=e.getStoredCrossSigningForUser(t);return a.reduce(((t,a)=>Cn(Cn({},t),{},{[a.device_id]:Cn(Cn(Cn({},a),{},{isVerified:xn(e,n,a)},kn(e,a)),Gt(a[m.UNSTABLE_MSC3852_LAST_SEEN_UA.name]))})),{})})(t,n);r(e);const{pushers:a}=await t.getPushers();c(a);const i=new Map;Object.keys(e).forEach((e=>{const a=`${m.LOCAL_NOTIFICATION_SETTINGS_PREFIX.name}.${e}`,n=t.getAccountData(a);n&&i.set(e,n.getContent())})),h(i),g(!1)}catch(e){404==e.httpStatus?y(jn.Unsupported):(d.a.error("Error loading sessions:",e),y(jn.Default)),g(!1)}}),[t,n]);Object(s.useEffect)((()=>{E()}),[E]),Object(s.useEffect)((()=>{const e=Object.keys(i);e.length&&Object(Sn.b)(e,t)}),[i,t]),Object(wn.a)(t,ot.b.DevicesUpdated,(e=>{e.includes(n)&&E()})),Object(wn.a)(t,m.ClientEvent.AccountData,(e=>{const t=e.getType();if(t.startsWith(m.LOCAL_NOTIFICATION_SETTINGS_PREFIX.name)){const a=new Map(u),n=t.slice(t.lastIndexOf(".")+1);a.set(n,e.getContent()),h(a)}}));const _=!(null===(e=i[a])||void 0===e||!e.isVerified)&&n?async e=>await t.requestVerification(n,[e]):void 0,S=Object(s.useCallback)((async(e,a)=>{const n=i[e];if(a!==(null==n?void 0:n.display_name))try{await t.setDeviceDetails(e,{display_name:a}),await E()}catch(e){throw d.a.error("Error setting session display name",e),new Error(Object(l.a)("Failed to set display name"))}}),[t,i,E]),w=Object(s.useCallback)((async(e,a)=>{try{const n=o.find((t=>t[m.PUSHER_DEVICE_ID.name]===e));n?await t.setPusher(Cn(Cn({},n),{},{[m.PUSHER_ENABLED.name]:a})):u.has(e)&&await t.setLocalNotificationSettings(e,{is_silenced:!a})}catch(e){throw d.a.error("Error setting pusher state",e),new Error(Object(l.a)("Failed to set pusher state"))}finally{await E()}}),[t,o,u,E]);return{devices:i,pushers:o,localNotificationSettings:u,currentDeviceId:a,isLoadingDeviceList:p,error:f,requestDeviceVerification:_,refreshDevices:E,saveDeviceName:S,setPushNotifications:w,supportsMSC3881:v}};var In,Tn=a(129),Nn=a(130),Dn=a.n(Nn);function Pn(){return Pn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},Pn.apply(this,arguments)}function Mn(e){return s.createElement("svg",Pn({fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 18 18",role:"presentation","aria-hidden":!0},e),In||(In=s.createElement("path",{d:"M4 8.818L7.125 12 14 5",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})))}const An=["value","options","selectedLabel","className"],Ln=(e,t)=>a=>{const n=e.find((e=>{let{id:t}=e;return t===a}));return n?t?`${t}: ${n.label}`:n.label:null},Un=e=>{let{value:t,options:a,selectedLabel:n,className:i}=e,s=tn()(e,An);return r.a.createElement(j.a,Dn()({},s,{value:t,className:He()("mx_FilterDropdown",i),getShortOption:Ln(a,n)}),a.map((e=>{let{id:a,label:n,description:i}=e;return r.a.createElement("div",{className:"mx_FilterDropdown_option","data-testid":`filter-option-${a}`,key:a},a===t&&r.a.createElement(Mn,{className:"mx_FilterDropdown_optionSelectedIcon"}),r.a.createElement("span",{className:"mx_FilterDropdown_optionLabel"},n),!!i&&r.a.createElement("span",{className:"mx_FilterDropdown_optionDescription"},i))})))};var Fn=a(212);const Bn=["title","description"];var Vn=e=>{let{title:t,description:a}=e,n=tn()(e,Bn);return r.a.createElement(y.a,Dn()({},n,{kind:"link_inline",onClick:()=>{v.b.createDialog(Fn.a,{title:t,description:a,button:Object(l.a)("Got it"),hasCloseButton:!0})},className:"mx_LearnMore_button"}),Object(l.a)("Learn more"))},Wn=a(458);const Hn=e=>{let{device:t,saveDeviceName:a,stopEditing:n}=e;const[i,o]=Object(s.useState)(t.display_name||""),[c,d]=Object(s.useState)(!1),[m,u]=Object(s.useState)(null);Object(s.useEffect)((()=>{o(t.display_name||"")}),[t.display_name]);const p=async e=>{d(!0),u(null),e.preventDefault();try{await a(i),n()}catch(e){u(Object(l.a)("Failed to set display name")),d(!1)}},g=`device-rename-${t.device_id}`,v=`device-rename-description-${t.device_id}`;return r.a.createElement("form",{"aria-disabled":c,className:"mx_DeviceDetailHeading_renameForm",onSubmit:p,method:"post"},r.a.createElement("p",{id:g,className:"mx_DeviceDetailHeading_renameFormHeading"},Object(l.a)("Rename session")),r.a.createElement("div",null,r.a.createElement(h.a,{"data-testid":"device-rename-input",type:"text",value:i,autoComplete:"off",onChange:e=>o(e.target.value),autoFocus:!0,disabled:c,"aria-labelledby":g,"aria-describedby":v,className:"mx_DeviceDetailHeading_renameFormInput",maxLength:100}),r.a.createElement(Wn.a,{id:v},Object(l.a)("Please be aware that session names are also visible to people you communicate with."),r.a.createElement(Vn,{title:Object(l.a)("Renaming sessions"),description:r.a.createElement(r.a.Fragment,null,r.a.createElement("p",null,Object(l.a)("Other users in direct messages and rooms that you join are able to view a full list of your sessions.")),r.a.createElement("p",null,Object(l.a)("This provides them with confidence that they are really speaking to you, but it also means they can see the session name you enter here.")))}),!!m&&r.a.createElement("span",{"data-testid":"device-rename-error",className:"mx_DeviceDetailHeading_renameFormError"},m))),r.a.createElement("div",{className:"mx_DeviceDetailHeading_renameFormButtons"},r.a.createElement(y.a,{onClick:p,kind:"primary","data-testid":"device-rename-submit-cta",disabled:c},Object(l.a)("Save")),r.a.createElement(y.a,{onClick:n,kind:"secondary","data-testid":"device-rename-cancel-cta",disabled:c},Object(l.a)("Cancel")),c&&r.a.createElement(I.a,{w:16,h:16})))},zn=e=>{let{device:t,saveDeviceName:a}=e;const[n,i]=Object(s.useState)(!1);return n?r.a.createElement(Hn,{device:t,saveDeviceName:a,stopEditing:()=>i(!1)}):r.a.createElement("div",{className:"mx_DeviceDetailHeading","data-testid":"device-detail-heading"},r.a.createElement(wt.a,{size:"h4"},t.display_name||t.device_id),r.a.createElement(y.a,{kind:"link_inline",onClick:()=>i(!0),className:"mx_DeviceDetailHeading_renameCta","data-testid":"device-heading-rename-cta"},Object(l.a)("Rename")))},Gn={[Ot.Inactive]:_t,[Ot.Verified]:Ft,[Ot.Unverified]:Bt.Icon,[Ot.Unverifiable]:Bt.Icon},Kn=e=>{let{variation:t}=e;const a=Gn[t];return r.a.createElement("div",{className:He()("mx_DeviceSecurityCard_icon",t)},r.a.createElement(a,{height:16,width:16}))};var qn=e=>{let{variation:t,heading:a,description:n,children:i}=e;return r.a.createElement("div",{className:"mx_DeviceSecurityCard"},r.a.createElement(Kn,{variation:t}),r.a.createElement("div",{className:"mx_DeviceSecurityCard_content"},r.a.createElement("p",{className:"mx_DeviceSecurityCard_heading"},a),r.a.createElement("p",{className:"mx_DeviceSecurityCard_description"},n),!!i&&r.a.createElement("div",{className:"mx_DeviceSecurityCard_actions"},i)))};const $n={[Ot.Verified]:{title:Object(l.a)("Verified sessions"),description:r.a.createElement(r.a.Fragment,null,r.a.createElement("p",null,Object(l.a)("Verified sessions are anywhere you are using this account after entering your passphrase or confirming your identity with another verified session.")),r.a.createElement("p",null,Object(l.a)("This means that you have all the keys needed to unlock your encrypted messages and confirm to other users that you trust this session.")))},[Ot.Unverified]:{title:Object(l.a)("Unverified sessions"),description:r.a.createElement(r.a.Fragment,null,r.a.createElement("p",null,Object(l.a)("Unverified sessions are sessions that have logged in with your credentials but have not been cross-verified.")),r.a.createElement("p",null,Object(l.a)("You should make especially certain that you recognise these sessions as they could represent an unauthorised use of your account.")))},[Ot.Unverifiable]:{title:Object(l.a)("Unverified session"),description:r.a.createElement(r.a.Fragment,null,r.a.createElement("p",null,Object(l.a)("This session doesn't support encryption and thus can't be verified.")),r.a.createElement("p",null,Object(l.a)("You won't be able to participate in rooms where encryption is enabled when using this session.")),r.a.createElement("p",null,Object(l.a)("For best security and privacy, it is recommended to use Matrix clients that support encryption.")))},[Ot.Inactive]:{title:Object(l.a)("Inactive sessions"),description:r.a.createElement(r.a.Fragment,null,r.a.createElement("p",null,Object(l.a)("Inactive sessions are sessions you have not used in some time, but they continue to receive encryption keys.")),r.a.createElement("p",null,Object(l.a)("Removing inactive sessions improves security and performance, and makes it easier for you to identify if a new session is suspicious.")))}},Yn=e=>{let{variation:t}=e;const{title:a,description:n}=$n[t];return r.a.createElement(Vn,{title:a,description:n})},Jn=e=>{let{device:t,isCurrentDevice:a,onVerifyDevice:n}=e;const i=((e,t)=>{if(e.isVerified){const e=t?Object(l.a)("Your current session is ready for secure messaging."):Object(l.a)("This session is ready for secure messaging.");return{variation:Ot.Verified,heading:Object(l.a)("Verified session"),description:r.a.createElement(r.a.Fragment,null,e,r.a.createElement(Yn,{variation:Ot.Verified}))}}if(null===e.isVerified)return{variation:Ot.Unverified,heading:Object(l.a)("Unverified session"),description:r.a.createElement(r.a.Fragment,null,Object(l.a)("This session doesn't support encryption and thus can't be verified."),r.a.createElement(Yn,{variation:Ot.Unverifiable}))};const a=t?Object(l.a)("Verify your current session for enhanced secure messaging."):Object(l.a)("Verify or sign out from this session for best security and reliability.");return{variation:Ot.Unverified,heading:Object(l.a)("Unverified session"),description:r.a.createElement(r.a.Fragment,null,a,r.a.createElement(Yn,{variation:Ot.Unverified}))}})(t,a);return r.a.createElement(qn,i,!1===t.isVerified&&!!n&&r.a.createElement(y.a,{kind:"primary",onClick:n,"data-testid":`verification-status-button-${t.device_id}`},Object(l.a)("Verify session")))};function Qn(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function Xn(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?Qn(Object(a),!0).forEach((function(t){i()(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):Qn(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}var Zn,ei=e=>{let{device:t,pusher:a,localNotificationSettings:n,isSigningOut:i,onVerifyDevice:s,onSignOutDevice:o,saveDeviceName:c,setPushNotifications:d,supportsMSC3881:m,className:u,isCurrentDevice:h}=e;const p=[{id:"session",values:[{label:Object(l.a)("Session ID"),value:t.device_id},{label:Object(l.a)("Last activity"),value:t.last_seen_ts&&Object(St.a)(new Date(t.last_seen_ts))}]},{id:"application",heading:Object(l.a)("Application"),values:[{label:Object(l.a)("Name"),value:t.appName},{label:Object(l.a)("Version"),value:t.appVersion},{label:Object(l.a)("URL"),value:t.url}]},{id:"device",heading:Object(l.a)("Device"),values:[{label:Object(l.a)("Model"),value:t.deviceModel},{label:Object(l.a)("Operating system"),value:t.deviceOperatingSystem},{label:Object(l.a)("Browser"),value:t.client},{label:Object(l.a)("IP address"),value:t.last_seen_ip}]}].map((e=>Xn(Xn({},e),{},{values:e.values.filter((e=>!!e.value))}))).filter((e=>e.values.length)),g=!!a||!!n;return r.a.createElement("div",{className:He()("mx_DeviceDetails",u),"data-testid":`device-detail-${t.device_id}`},r.a.createElement("section",{className:"mx_DeviceDetails_section"},r.a.createElement(zn,{device:t,saveDeviceName:c}),r.a.createElement(Jn,{device:t,onVerifyDevice:s,isCurrentDevice:!0})),r.a.createElement("section",{className:"mx_DeviceDetails_section"},r.a.createElement("p",{className:"mx_DeviceDetails_sectionHeading"},Object(l.a)("Session details")),p.map(((e,t)=>{let{heading:a,values:n,id:i}=e;return r.a.createElement("table",{className:"mx_DeviceDetails_metadataTable",key:t,"data-testid":`device-detail-metadata-${i}`},a&&r.a.createElement("thead",null,r.a.createElement("tr",null,r.a.createElement("th",null,a))),r.a.createElement("tbody",null,n.map((e=>{let{label:t,value:a}=e;return r.a.createElement("tr",{key:t},r.a.createElement("td",{className:"mxDeviceDetails_metadataLabel"},t),r.a.createElement("td",{className:"mxDeviceDetails_metadataValue"},a))}))))}))),g&&r.a.createElement("section",{className:"mx_DeviceDetails_section mx_DeviceDetails_pushNotifications","data-testid":"device-detail-push-notification"},r.a.createElement(Ie.a,{checked:function(e,t){return e?e[Tn.g.name]:!n||!n.is_silenced}(a),disabled:function(e,t){return!n&&!(!e||m)}(a),onChange:e=>null==d?void 0:d(t.device_id,e),title:Object(l.a)("Toggle push notifications on this session."),"data-testid":"device-detail-push-notification-checkbox"}),r.a.createElement("p",{className:"mx_DeviceDetails_sectionHeading"},Object(l.a)("Push notifications"),r.a.createElement("small",{className:"mx_DeviceDetails_sectionSubheading"},Object(l.a)("Receive push notifications on this session.")))),r.a.createElement("section",{className:"mx_DeviceDetails_section"},r.a.createElement(y.a,{onClick:o,kind:"danger_inline",disabled:i,"data-testid":"device-detail-sign-out-cta"},r.a.createElement("span",{className:"mx_DeviceDetails_signOutButtonContent"},Object(l.a)("Sign out of this session"),i&&r.a.createElement(I.a,{w:16,h:16})))))};function ti(){return ti=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},ti.apply(this,arguments)}function ai(e){return s.createElement("svg",ti({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 10 6",role:"presentation","aria-hidden":!0},e),Zn||(Zn=s.createElement("g",{fill:"none",fillRule:"evenodd",stroke:"currentColor",strokeLinecap:"round",strokeWidth:1.3},s.createElement("path",{d:"M1.5 1.5l3.859 3.254M9.132 1.56L5.359 4.754"}))))}var ni=a(147);const ii=["isExpanded","onClick"],si=e=>{let{isExpanded:t,onClick:a}=e,n=tn()(e,ii);const i=t?Object(l.a)("Hide details"):Object(l.a)("Show details");return r.a.createElement(ni.a,Dn()({},n,{"aria-label":i,title:i,kind:"icon",className:He()("mx_DeviceExpandDetailsButton",{mx_DeviceExpandDetailsButton_expanded:t}),onClick:a}),r.a.createElement(ai,{className:"mx_DeviceExpandDetailsButton_icon"}))};var ri=a(164),oi=a(286);const li=["selectedDeviceCount","isAllSelected","toggleSelectAll","children"];var ci=e=>{let{selectedDeviceCount:t,isAllSelected:a,toggleSelectAll:n,children:i}=e,s=tn()(e,li);const o=a?Object(l.a)("Deselect all"):Object(l.a)("Select all");return r.a.createElement("div",Dn()({className:"mx_FilteredDeviceListHeader"},s),r.a.createElement(oi.a,{label:o,alignment:ri.a.Top},r.a.createElement(A.b,{kind:A.a.Solid,checked:a,onChange:n,id:"device-select-all-checkbox","data-testid":"device-select-all-checkbox","aria-label":o})),r.a.createElement("span",{className:"mx_FilteredDeviceListHeader_label"},t>0?Object(l.a)("%(count)s sessions selected",{count:t}):Object(l.a)("Sessions")),i)};const di=(e,t)=>t.includes(e),mi=(e,t)=>(t.last_seen_ts||0)-(e.last_seen_ts||0)||(e.display_name||e.device_id).localeCompare(t.display_name||t.device_id),ui="ALL",hi={[Ot.Verified]:{title:Object(l.a)("Verified sessions"),description:Object(l.a)("For best security, sign out from any session that you don't recognize or use anymore.")},[Ot.Unverified]:{title:Object(l.a)("Unverified sessions"),description:Object(l.a)("Verify your sessions for enhanced secure messaging or sign out from those you don't recognize or use anymore.")},[Ot.Unverifiable]:{title:Object(l.a)("Unverified session"),description:Object(l.a)("This session doesn't support encryption and thus can't be verified.")},[Ot.Inactive]:{title:Object(l.a)("Inactive sessions"),description:Object(l.a)("Consider signing out from old sessions (%(inactiveAgeDays)s days or older) you don't use anymore.",{inactiveAgeDays:90})}},pi=e=>{let{filter:t}=e;if((e=>!!e&&[Ot.Inactive,Ot.Unverified,Ot.Verified].includes(e))(t)){const{title:e,description:a}=hi[t];return r.a.createElement("div",{className:"mx_FilteredDeviceList_securityCard"},r.a.createElement(qn,{variation:t,heading:e,description:r.a.createElement("span",null,a,r.a.createElement(Yn,{variation:t}))}))}return null},gi=e=>{let{filter:t,clearFilter:a}=e;return r.a.createElement("div",{className:"mx_FilteredDeviceList_noResults"},(e=>{switch(e){case Ot.Verified:return Object(l.a)("No verified sessions found.");case Ot.Unverified:return Object(l.a)("No unverified sessions found.");case Ot.Inactive:return Object(l.a)("No inactive sessions found.");default:return Object(l.a)("No sessions found.")}})(t),!!t&&r.a.createElement(r.a.Fragment,null," ",r.a.createElement(y.a,{kind:"link_inline",onClick:a,"data-testid":"devices-clear-filter-btn"},Object(l.a)("Show all"))))},vi=e=>{let{device:t,pusher:a,localNotificationSettings:n,isExpanded:i,isSigningOut:s,isSelected:o,onDeviceExpandToggle:l,onSignOutDevice:c,saveDeviceName:d,onRequestDeviceVerification:m,setPushNotifications:u,toggleSelected:h,supportsMSC3881:p}=e;return r.a.createElement("li",{className:"mx_FilteredDeviceList_listItem"},r.a.createElement(ta,{isSelected:o,onSelect:h,onClick:l,device:t},s&&r.a.createElement(I.a,{w:16,h:16}),r.a.createElement(si,{isExpanded:i,onClick:l})),i&&r.a.createElement(ei,{device:t,pusher:a,localNotificationSettings:n,isSigningOut:s,onVerifyDevice:m,onSignOutDevice:c,saveDeviceName:d,setPushNotifications:u,supportsMSC3881:p,className:"mx_FilteredDeviceList_deviceDetails"}))},bi=Object(s.forwardRef)(((e,t)=>{let{devices:a,pushers:n,localNotificationSettings:i,filter:s,expandedDeviceIds:o,signingOutDeviceIds:c,selectedDeviceIds:d,onFilterChange:m,onDeviceExpandToggle:u,saveDeviceName:h,onSignOutDevices:p,onRequestDeviceVerification:g,setPushNotifications:v,setSelectedDeviceIds:b,supportsMSC3881:f}=e;const E=((e,t)=>jt(Object.values(e),t?[t]:[]).sort(mi))(a,s);function _(e){return n.find((t=>t[Tn.f.name]===e.device_id))}const S=[{id:ui,label:Object(l.a)("All")},{id:Ot.Verified,label:Object(l.a)("Verified"),description:Object(l.a)("Ready for secure messaging")},{id:Ot.Unverified,label:Object(l.a)("Unverified"),description:Object(l.a)("Not ready for secure messaging")},{id:Ot.Inactive,label:Object(l.a)("Inactive"),description:Object(l.a)("Inactive for %(inactiveAgeDays)s days or longer",{inactiveAgeDays:90})}],w=d.length>=E.length,O=!!c.length;return r.a.createElement("div",{className:"mx_FilteredDeviceList",ref:t},r.a.createElement(ci,{selectedDeviceCount:d.length,isAllSelected:w,toggleSelectAll:()=>{b(w?[]:E.map((e=>e.device_id)))}},d.length?r.a.createElement(r.a.Fragment,null,r.a.createElement(y.a,{"data-testid":"sign-out-selection-cta",kind:"danger_inline",disabled:O,onClick:()=>p(d),className:"mx_FilteredDeviceList_headerButton"},O&&r.a.createElement(I.a,{w:16,h:16}),Object(l.a)("Sign out")),r.a.createElement(y.a,{"data-testid":"cancel-selection-cta",kind:"content_inline",disabled:O,onClick:()=>b([]),className:"mx_FilteredDeviceList_headerButton"},Object(l.a)("Cancel"))):r.a.createElement(Un,{id:"device-list-filter",label:Object(l.a)("Filter devices"),value:s||ui,onOptionChange:e=>{m(e===ui?void 0:e)},options:S,selectedLabel:Object(l.a)("Show")})),E.length?r.a.createElement(pi,{filter:s}):r.a.createElement(gi,{filter:s,clearFilter:()=>m(void 0)}),r.a.createElement("ol",{className:"mx_FilteredDeviceList_list"},E.map((e=>r.a.createElement(vi,{key:e.device_id,device:e,pusher:_(e),localNotificationSettings:i.get(e.device_id),isExpanded:o.includes(e.device_id),isSigningOut:c.includes(e.device_id),isSelected:di(e.device_id,d),onDeviceExpandToggle:()=>u(e.device_id),onSignOutDevice:()=>p([e.device_id]),saveDeviceName:t=>h(e.device_id,t),onRequestDeviceVerification:g?()=>g(e.device_id):void 0,setPushNotifications:v,toggleSelected:()=>{return t=e.device_id,void(di(t,d)?b(d.filter((e=>e!==t))):b([...d,t]));var t},supportsMSC3881:f})))))}));var fi=a(622),yi=a(628),Ei=a(149),_i=a(173);const Si=["options","title"],wi=e=>{let{options:t,title:a}=e,n=tn()(e,Si);const[i,s,o,l]=Object(Ei.q)();return r.a.createElement(r.a.Fragment,null,r.a.createElement(Ei.b,Dn()({},n,{onClick:o,title:a,isExpanded:i,inputRef:s}),r.a.createElement(yi.a,{className:"mx_KebabContextMenu_icon"})),i&&r.a.createElement(_i.e,Dn()({onFinished:l,compact:!0,rightAligned:!0,closeOnInteraction:!0},{left:(c=s.current.getBoundingClientRect()).left+window.scrollX+c.width,top:c.bottom+window.scrollY,chevronFace:Ei.a.None}),r.a.createElement(_i.c,null,t)));var c},Oi=e=>{let{onSignOutCurrentDevice:t,signOutAllOtherSessions:a,otherSessionsCount:n,disabled:i}=e;const s=[r.a.createElement(_i.b,{key:"sign-out",label:Object(l.a)("Sign out"),onClick:t,isDestructive:!0}),...a?[r.a.createElement(_i.b,{key:"sign-out-all-others",label:Object(l.a)("Sign out of all other sessions (%(otherSessionsCount)s)",{otherSessionsCount:n}),onClick:a,isDestructive:!0})]:[]];return r.a.createElement(fi.a,{heading:Object(l.a)("Current session")},r.a.createElement(wi,{disabled:i,title:Object(l.a)("Options"),options:s,"data-testid":"current-session-menu"}))};var Ci=e=>{let{device:t,isLoading:a,isSigningOut:n,localNotificationSettings:i,otherSessionsCount:o,setPushNotifications:l,onVerifyCurrentDevice:c,onSignOutCurrentDevice:d,signOutAllOtherSessions:m,saveDeviceName:u}=e;const[h,p]=Object(s.useState)(!1);return r.a.createElement(ya.a,{"data-testid":"current-session-section",heading:r.a.createElement(Oi,{onSignOutCurrentDevice:d,signOutAllOtherSessions:m,otherSessionsCount:o,disabled:a||!t||n})},a&&!t&&r.a.createElement(I.a,null),!!t&&r.a.createElement(r.a.Fragment,null,r.a.createElement(ea,{device:t,onClick:()=>p(!h)},r.a.createElement(si,{"data-testid":"current-session-toggle-details",isExpanded:h,onClick:()=>p(!h)})),h?r.a.createElement(ei,{device:t,localNotificationSettings:i,setPushNotifications:l,isSigningOut:n,onVerifyDevice:c,onSignOutDevice:d,saveDeviceName:u,className:"mx_CurrentDeviceSection_deviceDetails"}):r.a.createElement(r.a.Fragment,null,r.a.createElement("br",null),r.a.createElement(Jn,{device:t,onVerifyDevice:c,isCurrentDevice:!0}))))};var xi=e=>{let{devices:t,currentDeviceId:a,goToFilteredList:n}=e;const i=Object.values(t),s=jt(i,[Ot.Unverified]).filter((e=>e.device_id!==a)).length,o=jt(i,[Ot.Inactive]).length;if(!(s|o))return null;return r.a.createElement(ya.a,{heading:Object(l.a)("Security recommendations"),description:Object(l.a)("Improve your account security by following these recommendations."),"data-testid":"security-recommendations-section"},!!s&&r.a.createElement(qn,{variation:Ot.Unverified,heading:Object(l.a)("Unverified sessions"),description:r.a.createElement(r.a.Fragment,null,Object(l.a)("Verify your sessions for enhanced secure messaging or sign out from those you don't recognize or use anymore."),r.a.createElement(Yn,{variation:Ot.Unverified}))},r.a.createElement(y.a,{kind:"link_inline",onClick:()=>n(Ot.Unverified),"data-testid":"unverified-devices-cta"},Object(l.a)("View all")+` (${s})`)),!!o&&r.a.createElement(r.a.Fragment,null,!!s&&r.a.createElement("div",{className:"mx_SecurityRecommendations_spacing"}),r.a.createElement(qn,{variation:Ot.Inactive,heading:Object(l.a)("Inactive sessions"),description:r.a.createElement(r.a.Fragment,null,Object(l.a)("Consider signing out from old sessions (%(inactiveAgeDays)s days or older) you don't use anymore.",{inactiveAgeDays:90}),r.a.createElement(Yn,{variation:Ot.Inactive}))},r.a.createElement(y.a,{kind:"link_inline",onClick:()=>n(Ot.Inactive),"data-testid":"inactive-devices-cta"},Object(l.a)("View all")+` (${o})`))))},ki=a(865),ji=a(248);const Ri=e=>{let{otherSessionsCount:t,disabled:a,signOutAllOtherSessions:n}=e;const i=[r.a.createElement(_i.b,{key:"sign-out-all-others",label:Object(l.a)("Sign out of %(count)s sessions",{count:t}),onClick:n,isDestructive:!0})];return r.a.createElement(fi.a,{heading:Object(l.a)("Other sessions")},r.a.createElement(wi,{disabled:a,title:Object(l.a)("Options"),options:i,"data-testid":"other-sessions-menu"}))};function Ii(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var a=e[Symbol.toPrimitive];if(void 0!==a){var n=a.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}const Ti=(e,t)=>{const[a,n]=Object(s.useState)([]);return{onSignOutCurrentDevice:()=>{v.b.createDialog(yt.a,{},void 0,!1,!0)},onSignOutOtherDevices:async i=>{if(!i.length)return;if(await(async e=>{const{finished:t}=v.b.createDialog(me.a,{title:Object(l.a)("Sign out"),description:r.a.createElement("div",null,r.a.createElement("p",null,Object(l.a)("Are you sure you want to sign out of %(count)s sessions?",{count:e}))),cancelButton:Object(l.a)("Cancel"),button:Object(l.a)("Sign out")}),[a]=await t;return a})(i.length))try{n([...a,...i]),await ra(e,i,(async e=>{e&&await t(),n(a.filter((e=>!i.includes(e))))}))}catch(e){d.a.error("Error deleting sessions",e),n(a.filter((e=>!i.includes(e))))}},signingOutDeviceIds:a}};var Ni=()=>{const{devices:e,pushers:t,localNotificationSettings:a,currentDeviceId:n,isLoadingDeviceList:i,requestDeviceVerification:o,refreshDevices:c,saveDeviceName:d,setPushNotifications:m,supportsMSC3881:u}=Rn(),[h,p]=Object(s.useState)(),[g,b]=Object(s.useState)([]),[f,y]=Object(s.useState)([]),E=Object(s.useRef)(null),_=Object(s.useRef)(),S=Object(s.useContext)(oa.a),w=S.getUserId(),O=w&&S.getUser(w)||void 0,C=Object(ji.a)((()=>S.getVersions()),[S]),{[n]:x}=e,k=tn()(e,[n].map(Ii)),j=Object.keys(k).length,R=j>0,I=Object(s.useCallback)((e=>{if(!o)return;const t=o(e);v.b.createDialog(ft.a,{verificationRequestPromise:t,member:O,onFinished:async()=>{(await t).cancel(),await c()}})}),[o,c,O]),{onSignOutCurrentDevice:T,onSignOutOtherDevices:N,signingOutDeviceIds:D}=Ti(S,(async()=>{await c(),y([])}));Object(s.useEffect)((()=>()=>{clearTimeout(_.current)}),[_]),Object(s.useEffect)((()=>{y([])}),[h,y]);const P=R?()=>{N(Object.keys(k))}:void 0,[M,A]=Object(s.useState)(),L=Object(s.useCallback)((()=>{A(null)}),[A]),U=Object(s.useCallback)((()=>{A(fa.b.Show)}),[A]);return M?r.a.createElement(fa.d,{mode:M,onFinished:L,client:S}):r.a.createElement(ki.a,{heading:Object(l.a)("Sessions")},r.a.createElement(xi,{devices:e,goToFilteredList:e=>{p(e),clearTimeout(_.current),_.current=window.setTimeout((()=>{var e;return null===(e=E.current)||void 0===e?void 0:e.scrollIntoView({block:"start",inline:"nearest",behavior:"smooth"})}))},currentDeviceId:n}),r.a.createElement(Ci,{device:x,localNotificationSettings:a.get(n),setPushNotifications:m,isSigningOut:D.includes(n),isLoading:i,saveDeviceName:e=>d(n,e),onVerifyCurrentDevice:()=>{v.b.createDialog(bt.a,{onFinished:c})},onSignOutCurrentDevice:T,signOutAllOtherSessions:P,otherSessionsCount:j}),R&&r.a.createElement(ya.a,{heading:r.a.createElement(Ri,{otherSessionsCount:j,signOutAllOtherSessions:P,disabled:!!D.length}),description:Object(l.a)("For best security, verify your sessions and sign out from any session that you don't recognize or use anymore."),"data-testid":"other-sessions-section"},r.a.createElement(bi,{devices:k,pushers:t,localNotificationSettings:a,filter:h,expandedDeviceIds:g,signingOutDeviceIds:D,selectedDeviceIds:f,setSelectedDeviceIds:y,onFilterChange:p,onDeviceExpandToggle:e=>{g.includes(e)?b(g.filter((t=>t!==e))):b([...g,e])},onRequestDeviceVerification:o?I:void 0,onSignOutDevices:N,saveDeviceName:d,setPushNotifications:m,ref:E,supportsMSC3881:u})),r.a.createElement(Ea,{onShowQr:U,versions:C}))};class Di extends r.a.Component{constructor(e){super(e),i()(this,"settingsWatchers",[]),i()(this,"mjolnirChanged",((e,t,a,n)=>{this.setState({mjolnirEnabled:n})})),i()(this,"sessionManagerChanged",((e,t,a,n)=>{this.setState({newSessionManagerEnabled:n})})),this.state={mjolnirEnabled:x.b.getValue("feature_mjolnir"),newSessionManagerEnabled:x.b.getValue("feature_new_device_manager")}}componentDidMount(){this.settingsWatchers=[x.b.watchSetting("feature_mjolnir",null,this.mjolnirChanged),x.b.watchSetting("feature_new_device_manager",null,this.sessionManagerChanged)]}componentWillUnmount(){this.settingsWatchers.forEach((e=>x.b.unwatchSetting(e)))}getTabs(){const e=[];return e.push(new o.a(qa.a.General,Object(l.c)("General"),"mx_UserSettingsDialog_settingsIcon",r.a.createElement(Me,{closeSettingsFn:this.props.onFinished}),"UserSettingsGeneral")),e.push(new o.a(qa.a.Appearance,Object(l.c)("Appearance"),"mx_UserSettingsDialog_appearanceIcon",r.a.createElement(it,null),"UserSettingsAppearance")),e.push(new o.a(qa.a.Notifications,Object(l.c)("Notifications"),"mx_UserSettingsDialog_bellIcon",r.a.createElement(Ka,null),"UserSettingsNotifications")),e.push(new o.a(qa.a.Preferences,Object(l.c)("Preferences"),"mx_UserSettingsDialog_preferencesIcon",r.a.createElement(Ya,{closeSettingsFn:this.props.onFinished}),"UserSettingsPreferences")),e.push(new o.a(qa.a.Keyboard,Object(l.c)("Keyboard"),"mx_UserSettingsDialog_keyboardIcon",r.a.createElement(_n,null),"UserSettingsKeyboard")),e.push(new o.a(qa.a.Sidebar,Object(l.c)("Sidebar"),"mx_UserSettingsDialog_sidebarIcon",r.a.createElement(gn.a,null),"UserSettingsSidebar")),x.b.getValue(K.b.Voip)&&e.push(new o.a(qa.a.Voice,Object(l.c)("Voice & Video"),"mx_UserSettingsDialog_voiceIcon",r.a.createElement(Xa,null),"UserSettingsVoiceVideo")),e.push(new o.a(qa.a.Security,Object(l.c)("Security & Privacy"),"mx_UserSettingsDialog_securityIcon",r.a.createElement(Sa,{closeSettingsFn:this.props.onFinished}),"UserSettingsSecurityPrivacy")),this.state.newSessionManagerEnabled&&e.push(new o.a(qa.a.SessionManager,Object(l.c)("Sessions"),"mx_UserSettingsDialog_sessionsIcon",r.a.createElement(Ni,null),void 0)),(p.b.get("show_labs_settings")||x.b.getFeatureSettingNames().some((e=>x.b.getBetaInfo(e))))&&e.push(new o.a(qa.a.Labs,Object(l.c)("Labs"),"mx_UserSettingsDialog_labsIcon",r.a.createElement(Ve,null),"UserSettingsLabs")),this.state.mjolnirEnabled&&e.push(new o.a(qa.a.Mjolnir,Object(l.c)("Ignored users"),"mx_UserSettingsDialog_mjolnirIcon",r.a.createElement(pn,null),"UserSettingMjolnir")),e.push(new o.a(qa.a.Help,Object(l.c)("Help & About"),"mx_UserSettingsDialog_helpIcon",r.a.createElement(mn,{closeSettingsFn:()=>this.props.onFinished(!0)}),"UserSettingsHelpAbout")),e}render(){return r.a.createElement(L.a,{className:"mx_UserSettingsDialog",hasCancel:!0,onFinished:this.props.onFinished,title:Object(l.a)("Settings")},r.a.createElement("div",{className:"mx_SettingsDialog_content"},r.a.createElement(o.c,{tabs:this.getTabs(),initialTabId:this.props.initialTabId,screenName:"UserSettings"})))}}},1572:function(e,t,a){"use strict";a.d(t,"a",(function(){return G}));var n=a(13),i=a.n(n),s=a(120),r=a.n(s),o=a(1),l=a(136),c=a(16),d=a(121),m=a(127);class u{constructor(e,t){i()(this,"client",void 0),i()(this,"clientSecret",void 0),i()(this,"password",""),i()(this,"sessionId",""),i()(this,"logoutDevices",!1),i()(this,"sendAttempt",0),this.client=Object(l.createClient)({baseUrl:e,idBaseUrl:t}),this.clientSecret=this.client.generateClientSecret()}async resetPassword(e,t){let a=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.password=t,this.logoutDevices=a,this.sendAttempt++;try{const t=await this.client.requestPasswordEmailToken(e,this.clientSecret,this.sendAttempt);return this.sessionId=t.sid,t}catch(e){throw"M_THREEPID_NOT_FOUND"===e.errcode?e.message=Object(d.a)("This email address was not found"):e.httpStatus&&(e.message=e.message+` (Status ${e.httpStatus})`),e}}requestResetToken(e){return this.sendAttempt++,this.client.requestPasswordEmailToken(e,this.clientSecret,this.sendAttempt).then((e=>(this.sessionId=e.sid,e)),(function(e){throw"M_THREEPID_NOT_FOUND"===e.errcode?e.message=Object(d.a)("This email address was not found"):e.httpStatus&&(e.message=e.message+` (Status ${e.httpStatus})`),e}))}setLogoutDevices(e){this.logoutDevices=e}async setNewPassword(e){this.password=e,await this.checkEmailLinkClicked()}async checkEmailLinkClicked(){const e={sid:this.sessionId,client_secret:this.clientSecret};try{await this.client.setPassword({type:"m.login.email.identity",threepid_creds:e,threepidCreds:e},this.password,this.logoutDevices)}catch(e){throw 401===e.httpStatus?e.message=Object(d.a)("Failed to verify email address: make sure you clicked the link in the email"):404===e.httpStatus?e.message=Object(d.a)("Your email address does not appear to be associated with a Matrix ID on this homeserver."):e.httpStatus&&(e.message+=` (Status ${e.httpStatus})`),e}}}var h,p=a(319),g=a(343),v=a(662),b=a(477),f=a(478),y=a(914),E=a(177);function _(){return _=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},_.apply(this,arguments)}function S(e){return s.createElement("svg",_({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 21.333 26.667",role:"presentation","aria-hidden":!0},e),h||(h=s.createElement("path",{fill:"#8e99a4",fillRule:"evenodd",d:"M9.778 0a7.111 7.111 0 00-7.111 7.111v3.556H2a2 2 0 00-2 2v12a2 2 0 002 2h17.333a2 2 0 002-2v-12a2 2 0 00-2-2h-.666V7.11A7.111 7.111 0 0011.555 0zm5.333 10.667V7.11a3.556 3.556 0 00-3.556-3.555H9.778A3.556 3.556 0 006.222 7.11v3.556z",clipRule:"evenodd"})))}var w,O=a(154);function C(){return C=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},C.apply(this,arguments)}function x(e){return s.createElement("svg",C({fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 40 29",role:"presentation","aria-hidden":!0},e),w||(w=s.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M.261 2.576L18.905 21.16a1.64 1.64 0 002.316 0L39.773 2.668C39.92 3.084 40 3.533 40 4v21a4 4 0 01-4 4H4a4 4 0 01-4-4V4c0-.502.092-.982.261-1.424zM2.582.259C3.022.09 3.501 0 4 0h32c.533 0 1.042.104 1.508.294l-17.445 17.39L2.583.26z",fill:"#737D8C"})))}var k=a(476),j=a(391);const R=e=>{let{message:t}=e;const a=t?r.a.createElement(j.Icon,{className:"mx_Icon mx_Icon_16"}):null;return r.a.createElement("div",{className:"mx_ErrorMessage"},a,t)};var I=a(134),T=a(123);const N=e=>{let{email:t,errorText:a,homeserver:n,loading:i,onInputChanged:o,onLoginClick:l,onSubmitForm:c}=e;const m=i?r.a.createElement(I.a,{w:16,h:16}):Object(d.a)("Send email"),u=Object(s.useRef)(null);return r.a.createElement(r.a.Fragment,null,r.a.createElement(x,{className:"mx_AuthBody_icon"}),r.a.createElement("h1",null,Object(d.a)("Enter your email to reset password")),r.a.createElement("p",{className:"mx_AuthBody_text"},Object(d.a)("<b>%(homeserver)s</b> will send you a verification link to let you reset your password.",{homeserver:n},{b:e=>r.a.createElement("b",null,e)})),r.a.createElement("form",{onSubmit:async e=>{var t,a,n;await(null===(t=u.current)||void 0===t?void 0:t.validate({allowEmpty:!1}))?c(e):(null===(a=u.current)||void 0===a||a.focus(),null===(n=u.current)||void 0===n||n.validate({allowEmpty:!1,focused:!0}))}},r.a.createElement("fieldset",{disabled:i},r.a.createElement("div",{className:"mx_AuthBody_fieldRow"},r.a.createElement(k.a,{name:"reset_email",label:"Email address",labelRequired:Object(d.c)("The email address linked to your account must be entered."),labelInvalid:Object(d.c)("The email address doesn't appear to be valid."),value:t,autoFocus:!0,onChange:e=>o("email",e),fieldRef:u})),a&&r.a.createElement(R,{message:a}),r.a.createElement("button",{type:"submit",className:"mx_Login_submit"},m),r.a.createElement("div",{className:"mx_AuthBody_button-container"},r.a.createElement(T.a,{className:"mx_AuthBody_sign-in-instead-button",element:"button",kind:"link",onClick:e=>{e.preventDefault(),l()}},Object(d.a)("Sign in instead"))))))};var D=a(518),P=a(629),M=a(164);const A=(e,t)=>{const a=Object(s.useRef)(),[n,i]=Object(s.useState)(e);return Object(s.useEffect)((()=>()=>{clearTimeout(a.current)})),{toggle:()=>{i(!e),a.current=window.setTimeout((()=>i(e)),t)},value:n}},L=e=>{let{email:t,errorText:a,onReEnterEmailClick:n,onSubmitForm:i,onResendClick:s}=e;const{toggle:o,value:l}=A(!1,2500);return r.a.createElement(r.a.Fragment,null,r.a.createElement(D.a,{className:"mx_AuthBody_emailPromptIcon--shifted"}),r.a.createElement("h1",null,Object(d.a)("Check your email to continue")),r.a.createElement("div",{className:"mx_AuthBody_text"},r.a.createElement("p",null,Object(d.a)("Follow the instructions sent to <b>%(email)s</b>",{email:t},{b:e=>r.a.createElement("b",null,e)})),r.a.createElement("div",{className:"mx_AuthBody_did-not-receive"},r.a.createElement("span",{className:"mx_VerifyEMailDialog_text-light"},Object(d.a)("Wrong email address?")),r.a.createElement(T.a,{className:"mx_AuthBody_resend-button",kind:"link",onClick:n},Object(d.a)("Re-enter email address")))),a&&r.a.createElement(R,{message:a}),r.a.createElement("input",{onClick:i,type:"button",className:"mx_Login_submit",value:Object(d.a)("Next")}),r.a.createElement("div",{className:"mx_AuthBody_did-not-receive"},r.a.createElement("span",{className:"mx_VerifyEMailDialog_text-light"},Object(d.a)("Did not receive it?")),r.a.createElement(T.a,{className:"mx_AuthBody_resend-button",kind:"link",onClick:async()=>{await s(),o()}},r.a.createElement(P.a,{className:"mx_Icon mx_Icon_16"}),Object(d.a)("Resend"),r.a.createElement(M.b,{label:Object(d.a)("Verification link email resent!"),alignment:M.a.Top,visible:l}))))};var U;function F(){return F=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},F.apply(this,arguments)}function B(e){return s.createElement("svg",F({fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",role:"presentation","aria-hidden":!0},e),U||(U=s.createElement("path",{d:"M5.092 17.049l6.515 6.709L26.91 8",stroke:"currentColor",strokeWidth:2.5,strokeLinecap:"round",strokeLinejoin:"round"})))}const V=e=>{let{email:t,errorText:a,onCloseClick:n,onReEnterEmailClick:i,onResendClick:s}=e;const{toggle:o,value:l}=A(!1,2500);return r.a.createElement(r.a.Fragment,null,r.a.createElement(D.a,{className:"mx_AuthBody_emailPromptIcon"}),r.a.createElement("h1",null,Object(d.a)("Verify your email to continue")),r.a.createElement("p",null,Object(d.a)("We need to know its you before resetting your password. Click the link in the email we just sent to <b>%(email)s</b>",{email:t},{b:e=>r.a.createElement("b",null,e)})),r.a.createElement("div",{className:"mx_AuthBody_did-not-receive"},r.a.createElement("span",{className:"mx_VerifyEMailDialog_text-light"},Object(d.a)("Did not receive it?")),r.a.createElement(T.a,{className:"mx_AuthBody_resend-button",kind:"link",onClick:async()=>{await s(),o()}},r.a.createElement(P.a,{className:"mx_Icon mx_Icon_16"}),Object(d.a)("Resend"),r.a.createElement(M.b,{label:Object(d.a)("Verification link email resent!"),alignment:M.a.Top,visible:l})),a&&r.a.createElement(R,{message:a})),r.a.createElement("div",{className:"mx_AuthBody_did-not-receive"},r.a.createElement("span",{className:"mx_VerifyEMailDialog_text-light"},Object(d.a)("Wrong email address?")),r.a.createElement(T.a,{className:"mx_AuthBody_resend-button",kind:"link",onClick:i},Object(d.a)("Re-enter email address"))),r.a.createElement(T.a,{onClick:n,className:"mx_Dialog_cancelButton","aria-label":Object(d.a)("Close dialog")}))};var W=a(161),H=a(345);var z;!function(e){e[e.EnterEmail=1]="EnterEmail",e[e.SendingEmail=2]="SendingEmail",e[e.EmailSent=3]="EmailSent",e[e.PasswordInput=4]="PasswordInput",e[e.ResettingPassword=5]="ResettingPassword",e[e.Done=6]="Done"}(z||(z={}));class G extends r.a.Component{constructor(e){super(e),i()(this,"reset",void 0),i()(this,"fieldPassword",null),i()(this,"fieldPasswordConfirm",null),i()(this,"sendVerificationMail",(async()=>{try{return await this.reset.requestResetToken(this.state.email),!0}catch(e){this.handleError(e)}return!1})),i()(this,"onSubmitForm",(async e=>{if(e.preventDefault(),![z.SendingEmail,z.ResettingPassword].includes(this.state.phase)&&(this.setState({errorText:""}),await this.checkServerLiveliness(this.props.serverConfig),this.state.serverIsAlive))switch(this.state.phase){case z.EnterEmail:this.onPhaseEmailInputSubmit();break;case z.EmailSent:this.onPhaseEmailSentSubmit();break;case z.PasswordInput:this.onPhasePasswordInputSubmit()}})),i()(this,"onInputChanged",((e,t)=>{let a=t.currentTarget.value;"email"===e&&(a=a.trim()),this.setState({[e]:a})})),this.state={phase:z.EnterEmail,email:"",password:"",password2:"",errorText:null,serverIsAlive:!0,serverDeadError:"",serverSupportsControlOfDevicesLogout:!1,logoutDevices:!1},this.reset=new u(this.props.serverConfig.hsUrl,this.props.serverConfig.isUrl)}componentDidMount(){this.checkServerCapabilities(this.props.serverConfig)}componentDidUpdate(e){e.serverConfig.hsUrl===this.props.serverConfig.hsUrl&&e.serverConfig.isUrl===this.props.serverConfig.isUrl||(this.checkServerLiveliness(this.props.serverConfig),this.checkServerCapabilities(this.props.serverConfig))}async checkServerLiveliness(e){try{await H.a.validateServerConfigWithStaticUrls(e.hsUrl,e.isUrl),this.setState({serverIsAlive:!0})}catch(e){const{serverIsAlive:t,serverDeadError:a}=H.a.authComponentStateForError(e,"forgot_password");this.setState({serverIsAlive:t,errorText:a})}}async checkServerCapabilities(e){const t=Object(l.createClient)({baseUrl:e.hsUrl}),a=await t.doesServerSupportLogoutDevices();this.setState({logoutDevices:!a,serverSupportsControlOfDevicesLogout:a})}async onPhaseEmailInputSubmit(){this.phase=z.SendingEmail,await this.sendVerificationMail()?this.phase=z.EmailSent:this.phase=z.EnterEmail}handleError(e){if(429!==(null==e?void 0:e.httpStatus))"ConnectionError"!==(null==e?void 0:e.name)?this.setState({errorText:e.message}):this.setState({errorText:Object(d.a)("Cannot reach homeserver")+": "+Object(d.a)("Ensure you have a stable internet connection, or get in touch with the server admin")});else{var t;const a=parseInt(null==e||null===(t=e.data)||void 0===t?void 0:t.retry_after_ms,10),n=isNaN(a)?Object(d.a)("Too many attempts in a short time. Wait some time before trying again."):Object(d.a)("Too many attempts in a short time. Retry after %(timeout)s.",{timeout:Object(W.l)(a/1e3)});this.setState({errorText:n})}}async onPhaseEmailSentSubmit(){this.setState({phase:z.PasswordInput})}set phase(e){this.setState({phase:e})}async verifyFieldsBeforeSubmit(){const e=[this.fieldPassword,this.fieldPasswordConfirm],t=[];for(const a of e){if(!a)continue;await a.validate({allowEmpty:!1})||t.push(a)}return 0===t.length||(t[0].focus(),t[0].validate({allowEmpty:!1,focused:!0}),!1)}async onPhasePasswordInputSubmit(){if(!await this.verifyFieldsBeforeSubmit())return;if(this.state.logoutDevices){if(!await this.renderConfirmLogoutDevicesDialog())return}this.phase=z.ResettingPassword,this.reset.setLogoutDevices(this.state.logoutDevices);try{return await this.reset.setNewPassword(this.state.password),void this.setState({phase:z.Done})}catch(e){if(401!==e.httpStatus)return void this.handleError(e)}const e=m.b.createDialog(V,{email:this.state.email,errorText:this.state.errorText,onCloseClick:()=>{e.close(),this.setState({phase:z.PasswordInput})},onReEnterEmailClick:()=>{e.close(),this.setState({phase:z.EnterEmail})},onResendClick:this.sendVerificationMail},"mx_VerifyEMailDialog",!1,!1,{onBeforeClose:async e=>("backgroundClick"===e&&this.setState({phase:z.PasswordInput}),!0)});for(;this.state.phase===z.ResettingPassword;)try{await this.reset.setNewPassword(this.state.password),this.setState({phase:z.Done}),e.close()}catch(e){await Object(c.J)(2e3)}}renderEnterEmail(){return r.a.createElement(N,{email:this.state.email,errorText:this.state.errorText,homeserver:this.props.serverConfig.hsName,loading:this.state.phase===z.SendingEmail,onInputChanged:this.onInputChanged,onLoginClick:this.props.onLoginClick,onSubmitForm:this.onSubmitForm})}async renderConfirmLogoutDevicesDialog(){const{finished:e}=m.b.createDialog(O.a,{title:Object(d.a)("Warning!"),description:r.a.createElement("div",null,r.a.createElement("p",null,this.state.serverSupportsControlOfDevicesLogout?Object(d.a)("Signing out your devices will delete the message encryption keys stored on them, making encrypted chat history unreadable."):Object(d.a)("Resetting your password on this homeserver will cause all of your devices to be signed out. This will delete the message encryption keys stored on them, making encrypted chat history unreadable.")),r.a.createElement("p",null,Object(d.a)("If you want to retain access to your chat history in encrypted rooms, set up Key Backup or export your message keys from one of your other devices before proceeding."))),button:Object(d.a)("Continue")}),[t]=await e;return t}renderCheckEmail(){return r.a.createElement(L,{email:this.state.email,errorText:this.state.errorText,onReEnterEmailClick:()=>this.setState({phase:z.EnterEmail}),onResendClick:this.sendVerificationMail,onSubmitForm:this.onSubmitForm})}renderSetPassword(){const e=this.state.phase===z.ResettingPassword?r.a.createElement(I.a,{w:16,h:16}):Object(d.a)("Reset password");return r.a.createElement(r.a.Fragment,null,r.a.createElement(S,{className:"mx_AuthBody_lockIcon"}),r.a.createElement("h1",null,Object(d.a)("Reset your password")),r.a.createElement("form",{onSubmit:this.onSubmitForm},r.a.createElement("fieldset",{disabled:this.state.phase===z.ResettingPassword},r.a.createElement("div",{className:"mx_AuthBody_fieldRow"},r.a.createElement(g.a,{name:"reset_password",type:"password",label:Object(d.c)("New Password"),value:this.state.password,minScore:v.a,fieldRef:e=>this.fieldPassword=e,onChange:this.onInputChanged.bind(this,"password"),autoComplete:"new-password"}),r.a.createElement(y.a,{name:"reset_password_confirm",label:Object(d.c)("Confirm new password"),labelRequired:Object(d.c)("A new password must be entered."),labelInvalid:Object(d.c)("New passwords must match each other."),value:this.state.password2,password:this.state.password,fieldRef:e=>this.fieldPasswordConfirm=e,onChange:this.onInputChanged.bind(this,"password2"),autoComplete:"new-password"})),this.state.serverSupportsControlOfDevicesLogout?r.a.createElement("div",{className:"mx_AuthBody_fieldRow"},r.a.createElement(E.b,{onChange:()=>this.setState({logoutDevices:!this.state.logoutDevices}),checked:this.state.logoutDevices},Object(d.a)("Sign out of all devices"))):null,this.state.errorText&&r.a.createElement(R,{message:this.state.errorText}),r.a.createElement("button",{type:"submit",className:"mx_Login_submit"},e))))}renderDone(){return r.a.createElement(r.a.Fragment,null,r.a.createElement(B,{className:"mx_Icon mx_Icon_32 mx_Icon_accent"}),r.a.createElement("h1",null,Object(d.a)("Your password has been reset.")),this.state.logoutDevices?r.a.createElement("p",null,Object(d.a)("You have been logged out of all devices and will no longer receive push notifications. To re-enable notifications, sign in again on each device.")):null,r.a.createElement("input",{className:"mx_Login_submit",type:"button",onClick:this.props.onComplete,value:Object(d.a)("Return to login screen")}))}render(){let e;switch(this.state.phase){case z.EnterEmail:case z.SendingEmail:e=this.renderEnterEmail();break;case z.EmailSent:e=this.renderCheckEmail();break;case z.PasswordInput:case z.ResettingPassword:e=this.renderSetPassword();break;case z.Done:e=this.renderDone();break;default:return o.a.warn(`unknown forgot password phase ${this.state.phase}`),void this.setState({phase:z.EnterEmail})}return r.a.createElement(p.a,null,r.a.createElement(b.a,null),r.a.createElement(f.a,{className:"mx_AuthBody_forgot-password"},e))}}},1573:function(e,t,a){"use strict";a.d(t,"a",(function(){return We}));var n=a(13),i=a.n(n),s=a(126),r=a.n(s),o=a(124),l=a(127),c=a(401),d=a(132),m=a.n(d),u=a(120),h=a.n(u),p=a(143),g=a(129),v=a(30),b=a(270),f=a(203),y=a(121),E=a(166),_=a(194),S=a(135),w=a(260),O=a(400),C=a(333),x=a(318),k=a(164),j=a(147),R=a(211),I=a(330),T=a(246),N=a(432),D=a(303),P=a(557),M=a(630),A=a(191),L=a(128),U=a(180),F=a(229),B=a(661);const V=["m.relates_to"];function W(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function H(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?W(Object(a),!0).forEach((function(t){i()(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):W(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}var z;!function(e){e[e.CanSend=0]="CanSend",e[e.Sending=1]="Sending",e[e.Sent=2]="Sent",e[e.Failed=3]="Failed"}(z||(z={}));const G=e=>{let{room:t,type:a,content:n,matrixClient:i,onFinished:s}=e;const[r,l]=Object(u.useState)(z.CanSend);let c,d,m,p=!1;return r===z.CanSend?(c="mx_ForwardList_canSend",t.maySendMessage()||(p=!0,d=Object(y.a)("You don't have permission to do this"))):r===z.Sending?(c="mx_ForwardList_sending",p=!0,d=Object(y.a)("Sending"),m=h.a.createElement("div",{className:"mx_ForwardList_sendIcon","aria-label":d})):r===z.Sent?(c="mx_ForwardList_sent",p=!0,d=Object(y.a)("Sent"),m=h.a.createElement("div",{className:"mx_ForwardList_sendIcon","aria-label":d})):(c="mx_ForwardList_sendFailed",p=!0,d=Object(y.a)("Failed to send"),m=h.a.createElement(T.a,{notification:I.a.RED_EXCLAMATION})),h.a.createElement("div",{className:"mx_ForwardList_entry"},h.a.createElement(j.a,{className:"mx_ForwardList_roomButton",onClick:e=>{o.a.dispatch({action:L.a.ViewRoom,room_id:t.roomId,metricsTrigger:"WebForwardShortcut",metricsViaKeyboard:"click"!==e.type}),s(!0)},title:Object(y.a)("Open room"),alignment:k.a.Top},h.a.createElement(x.a,{room:t,avatarSize:32}),h.a.createElement("span",{className:"mx_ForwardList_entry_name"},t.name),h.a.createElement(B.a,{component:"span",className:"mx_ForwardList_entry_detail",room:t})),h.a.createElement(j.a,{kind:r===z.Failed?"danger_outline":"primary_outline",className:`mx_ForwardList_sendButton ${c}`,onClick:async()=>{l(z.Sending);try{await i.sendEvent(t.roomId,a,n),l(z.Sent)}catch(e){l(z.Failed)}},disabled:p,title:d,alignment:k.a.Top},h.a.createElement("div",{className:"mx_ForwardList_sendLabel"},Object(y.a)("Send")),m))};var K=e=>{let{matrixClient:t,event:n,permalinkCreator:i,onFinished:s}=e;const o=t.getUserId(),[l,c]=Object(u.useState)({});Object(u.useEffect)((()=>{t.getProfileInfo(o).then((e=>c(e)))}),[t,o]);const{type:d,content:x}=(e=>{const t=e.getContent(),{"m.relates_to":a}=t,n=m()(t,V),i=f.a.matches(e.getType())?g.b.RoomMessage:e.getType();if(Object(U.l)(e)&&Object(F.f)(n)||f.a.matches(e.getType())){const t=v.d.findIn(n),a=Object(F.g)(e);return{type:i,content:H(H({},n),Object(b.makeLocationContent)(void 0,a,t||Date.now(),void 0,v.a.Pin))}}return{type:i,content:n}})(n),k=new p.b({type:"m.room.message",sender:o,content:x,unsigned:{age:97},event_id:"$9999999999999999999999999999999999999999999",room_id:n.getRoomId()});k.sender={name:l.displayname||o,rawDisplayName:l.displayname,userId:o,getAvatarUrl:function(){return Object(w.c)({avatarUrl:l.avatar_url},30,30,"crop")},getMxcAvatarUrl:()=>l.avatar_url};const[j,I]=Object(u.useState)(""),T=j.toLowerCase(),L=Object(E.b)("layout");let B=Object(u.useMemo)((()=>Object(N.b)(t.getVisibleRooms().filter((e=>"join"===e.getMyMembership()&&!e.isSpaceRoom())))),[t]);T&&(B=new D.a(B,{keys:["name"],funcs:[e=>[e.getCanonicalAlias(),...e.getAltAliases()].filter(Boolean)],shouldMatchWordsOnly:!1}).match(T));const[W,z]=Object(u.useState)(20);return h.a.createElement(S.a,{title:Object(y.a)("Forward message"),className:"mx_ForwardDialog",contentId:"mx_ForwardList",onFinished:s,fixedWidth:!1},h.a.createElement("h3",null,Object(y.a)("Message preview")),h.a.createElement("div",{className:r()("mx_ForwardDialog_preview",{mx_IRCLayout:L==_.a.IRC})},h.a.createElement(O.a,{mxEvent:k,layout:L,permalinkCreator:i,as:"div"})),h.a.createElement("hr",null),h.a.createElement("div",{className:"mx_ForwardList",id:"mx_ForwardList"},h.a.createElement(C.a,{className:"mx_textinput_icon mx_textinput_search",placeholder:Object(y.a)("Search for rooms or people"),onSearch:I,autoFocus:!0}),h.a.createElement(R.a,{className:"mx_ForwardList_content"},B.length>0?h.a.createElement("div",{className:"mx_ForwardList_results"},h.a.createElement(P.a,{className:"mx_ForwardList_resultsList",truncateAt:W,createOverflowElement:function(e,t){const n=Object(y.a)("and %(count)s others...",{count:e});return h.a.createElement(M.b,{className:"mx_EntityTile_ellipsis",avatarJsx:h.a.createElement(A.a,{url:a(886).default,name:"...",width:36,height:36}),name:n,presenceState:"online",suppressOnHover:!0,onClick:()=>z(t)})},getChildren:(e,a)=>B.slice(e,a).map((e=>h.a.createElement(G,{key:e.roomId,room:e,type:d,content:x,matrixClient:t,onFinished:s}))),getChildCount:()=>B.length})):h.a.createElement("span",{className:"mx_ForwardList_noResults"},Object(y.a)("No results")))))},q=a(122),$=a(1),Y=a(218),J=a(131),Q=a(942),X=a(125),Z=a(259),ee=a(145),te=a(139),ae=a(134),ne=a(887);const ie=["org.matrix.msc3215.room.moderation.moderated_by"];var se,re;!function(e){e.Disagreement="org.matrix.msc3215.abuse.nature.disagreement",e.Toxic="org.matrix.msc3215.abuse.nature.toxic",e.Illegal="org.matrix.msc3215.abuse.nature.illegal",e.Spam="org.matrix.msc3215.abuse.nature.spam",e.Other="org.matrix.msc3215.abuse.nature.other"}(se||(se={})),function(e){e.Admin="non-standard.abuse.nature.admin"}(re||(re={}));class oe extends h.a.Component{constructor(e){super(e),i()(this,"moderation",void 0),i()(this,"onIgnoreUserTooChanged",(e=>{this.setState({ignoreUserToo:e})})),i()(this,"onReasonChange",(e=>{let{target:{value:t}}=e;this.setState({reason:t})})),i()(this,"onNatureChosen",(e=>{this.setState({nature:e.currentTarget.value})})),i()(this,"onCancel",(()=>{this.props.onFinished(!1)})),i()(this,"onSubmit",(async()=>{let e=this.state.reason||"";if(e=e.trim(),this.moderation){if(!this.state.nature||(this.state.nature==se.Other||this.state.nature==re.Admin)&&!e)return void this.setState({err:Object(y.a)("Please fill why you're reporting.")})}else if(!e)return void this.setState({err:Object(y.a)("Please fill why you're reporting.")});this.setState({busy:!0,err:null});try{const e=q.a.get(),t=this.props.mxEvent;if(this.moderation&&this.state.nature!==re.Admin){const a=this.state.nature,n=await Object(Y.c)(e,this.moderation.moderationBotUserId);await e.sendEvent(n,"org.matrix.msc3215.abuse.report",{event_id:t.getId(),room_id:t.getRoomId(),moderated_by_id:this.moderation.moderationRoomId,nature:a,reporter:e.getUserId(),comment:this.state.reason.trim()})}else await e.reportEvent(t.getRoomId(),t.getId(),-100,this.state.reason.trim());this.state.ignoreUserToo&&await e.setIgnoredUsers([...e.getIgnoredUsers(),t.getSender()]),this.props.onFinished(!0)}catch(e){$.a.error(e),this.setState({busy:!1,err:e.message})}}));let t=null,a=null;if(X.b.getValue("feature_report_to_moderators")){const n=q.a.get().getRoom(e.mxEvent.getRoomId());for(const e of ie){const i=n.currentState.getStateEvents(e,e);if(!i)continue;if(Array.isArray(i))throw new TypeError(`getStateEvents(${e}, ${e}) should return at most one state event`);const s=i.event;if(!("content"in s)||"object"!=typeof s.content){console.debug("Moderation error","state event",e,"should have an object field `content`, got",s);continue}const r=s.content;"room_id"in r&&"string"==typeof r.room_id?"user_id"in r&&"string"==typeof r.user_id?(t=r.room_id,a=r.user_id):console.debug("Moderation error","state event",e,"should have a string field `content.user_id`, got",s):console.debug("Moderation error","state event",e,"should have a string field `content.room_id`, got",s)}t&&a&&(this.moderation={moderationRoomId:t,moderationBotUserId:a})}this.state={reason:"",busy:!1,err:null,nature:null,ignoreUserToo:!1}}render(){var e;let t=null;this.state.err&&(t=h.a.createElement("div",{className:"error"},this.state.err));let a=null;this.state.busy&&(a=h.a.createElement("div",{className:"progress"},h.a.createElement(ae.a,null)));const n=h.a.createElement(ne.a,{value:this.state.ignoreUserToo,label:Object(y.a)("Ignore user"),byline:Object(y.a)("Check if you want to hide all current and future messages from this user."),onChange:this.onIgnoreUserTooChanged,disabled:this.state.busy}),i=null===(e=J.b.getObject("report_event"))||void 0===e?void 0:e.get("admin_message_md","adminMessageMD");let s;if(i){const e=new Q.a(i).toHTML({externalLinks:!0});s=h.a.createElement("p",{dangerouslySetInnerHTML:{__html:e}})}if(this.moderation){const e=q.a.get(),i=J.b.get("validated_server_config").hsName;let s;switch(this.state.nature){case se.Disagreement:s=Object(y.a)("What this user is writing is wrong.\nThis will be reported to the room moderators.");break;case se.Toxic:s=Object(y.a)("This user is displaying toxic behaviour, for instance by insulting other users or sharing adult-only content in a family-friendly room or otherwise violating the rules of this room.\nThis will be reported to the room moderators.");break;case se.Illegal:s=Object(y.a)("This user is displaying illegal behaviour, for instance by doxing people or threatening violence.\nThis will be reported to the room moderators who may escalate this to legal authorities.");break;case se.Spam:s=Object(y.a)("This user is spamming the room with ads, links to ads or to propaganda.\nThis will be reported to the room moderators.");break;case re.Admin:s=e.isRoomEncrypted(this.props.mxEvent.getRoomId())?Object(y.a)("This room is dedicated to illegal or toxic content or the moderators fail to moderate illegal or toxic content.\nThis will be reported to the administrators of %(homeserver)s. The administrators will NOT be able to read the encrypted content of this room.",{homeserver:i}):Object(y.a)("This room is dedicated to illegal or toxic content or the moderators fail to moderate illegal or toxic content.\nThis will be reported to the administrators of %(homeserver)s.",{homeserver:i});break;case se.Other:s=Object(y.a)("Any other reason. Please describe the problem.\nThis will be reported to the room moderators.");break;default:s=Object(y.a)("Please pick a nature and describe what makes this message abusive.")}return h.a.createElement(S.a,{className:"mx_ReportEventDialog",onFinished:this.props.onFinished,title:Object(y.a)("Report Content"),contentId:"mx_ReportEventDialog"},h.a.createElement("div",null,h.a.createElement(Z.a,{name:"nature",value:se.Disagreement,checked:this.state.nature==se.Disagreement,onChange:this.onNatureChosen},Object(y.a)("Disagree")),h.a.createElement(Z.a,{name:"nature",value:se.Toxic,checked:this.state.nature==se.Toxic,onChange:this.onNatureChosen},Object(y.a)("Toxic Behaviour")),h.a.createElement(Z.a,{name:"nature",value:se.Illegal,checked:this.state.nature==se.Illegal,onChange:this.onNatureChosen},Object(y.a)("Illegal Content")),h.a.createElement(Z.a,{name:"nature",value:se.Spam,checked:this.state.nature==se.Spam,onChange:this.onNatureChosen},Object(y.a)("Spam or propaganda")),h.a.createElement(Z.a,{name:"nature",value:re.Admin,checked:this.state.nature==re.Admin,onChange:this.onNatureChosen},Object(y.a)("Report the entire room")),h.a.createElement(Z.a,{name:"nature",value:se.Other,checked:this.state.nature==se.Other,onChange:this.onNatureChosen},Object(y.a)("Other")),h.a.createElement("p",null,s),h.a.createElement(te.a,{className:"mx_ReportEventDialog_reason",element:"textarea",label:Object(y.a)("Reason"),rows:5,onChange:this.onReasonChange,value:this.state.reason,disabled:this.state.busy}),a,t,n),h.a.createElement(ee.a,{primaryButton:Object(y.a)("Send report"),onPrimaryButtonClick:this.onSubmit,focus:!0,onCancel:this.onCancel,disabled:this.state.busy}))}return h.a.createElement(S.a,{className:"mx_ReportEventDialog",onFinished:this.props.onFinished,title:Object(y.a)("Report Content to Your Homeserver Administrator"),contentId:"mx_ReportEventDialog"},h.a.createElement("div",{className:"mx_ReportEventDialog",id:"mx_ReportEventDialog"},h.a.createElement("p",null,Object(y.a)("Reporting this message will send its unique 'event ID' to the administrator of your homeserver. If messages in this room are encrypted, your homeserver administrator will not be able to read the message text or view any files or images.")),s,h.a.createElement(te.a,{className:"mx_ReportEventDialog_reason",element:"textarea",label:Object(y.a)("Reason"),rows:5,onChange:this.onReasonChange,value:this.state.reason,disabled:this.state.busy}),a,t,n),h.a.createElement(ee.a,{primaryButton:Object(y.a)("Send report"),onPrimaryButtonClick:this.onSubmit,focus:!0,onCancel:this.onCancel,disabled:this.state.busy}))}}var le=a(332),ce=a(177),de=a(137),me=a(281);let ue;!function(e){e.Appearance="SPACE_PREFERENCE_APPEARANCE_TAB"}(ue||(ue={}));const he=e=>{let{space:t}=e;const a=Object(E.b)("Spaces.showPeopleInSpace",t.roomId);return h.a.createElement("div",{className:"mx_SettingsTab"},h.a.createElement("div",{className:"mx_SettingsTab_heading"},Object(y.a)("Sections to show")),h.a.createElement("div",{className:"mx_SettingsTab_section"},h.a.createElement(ce.b,{checked:!!a,onChange:e=>{X.b.setValue("Spaces.showPeopleInSpace",t.roomId,de.a.ROOM_ACCOUNT,!a)}},Object(y.a)("People")),h.a.createElement("p",null,Object(y.a)("This groups your chats with members of this space. Turning this off will hide those chats from your view of %(spaceName)s.",{spaceName:t.name}))))};var pe=e=>{let{space:t,initialTabId:a,onFinished:n}=e;const i=[new le.a(ue.Appearance,Object(y.c)("Appearance"),"mx_SpacePreferencesDialog_appearanceIcon",h.a.createElement(he,{space:t}))];return h.a.createElement(S.a,{className:"mx_SpacePreferencesDialog",hasCancel:!0,onFinished:n,title:Object(y.a)("Preferences"),fixedWidth:!1},h.a.createElement("h4",null,h.a.createElement(me.a,{room:t})),h.a.createElement("div",{className:"mx_SettingsDialog_content"},h.a.createElement(le.c,{tabs:i,initialTabId:a})))},ge=a(236),ve=a(123),be=a(817),fe=a(376),ye=a(493),Ee=a(631);var _e=e=>{var t,a,n;let{matrixClient:i,space:s,onFinished:r}=e;const[o,l]=Object(u.useState)(!1),[c,d]=Object(u.useState)(""),m=i.getUserId(),[p,v]=Object(u.useState)(null),b=s.currentState.maySendStateEvent(g.b.RoomAvatar,m),f=null!==p,[E,_]=Object(u.useState)(s.name),S=s.currentState.maySendStateEvent(g.b.RoomName,m),O=E!==s.name,C=null!==(t=null===(a=Object(Ee.a)(s))||void 0===a?void 0:a.text)&&void 0!==t?t:"",[x,k]=Object(u.useState)(C),j=s.currentState.maySendStateEvent(g.b.RoomTopic,m),R=x!==C;return h.a.createElement("div",{className:"mx_SettingsTab"},h.a.createElement("div",{className:"mx_SettingsTab_heading"},Object(y.a)("General")),h.a.createElement("div",null,Object(y.a)("Edit settings relating to your space.")),c&&h.a.createElement("div",{className:"mx_SpaceRoomView_errorText"},c),h.a.createElement("div",{className:"mx_SettingsTab_section"},h.a.createElement(be.b,{avatarUrl:null!==(n=Object(w.b)(s,80,80,"crop"))&&void 0!==n?n:void 0,avatarDisabled:o||!b,setAvatar:v,name:E,nameDisabled:o||!S,setName:_,topic:x,topicDisabled:o||!j,setTopic:k}),h.a.createElement(ve.a,{onClick:()=>{v(null),_(s.name),k(C)},disabled:o||!(f||O||R),kind:"link"},Object(y.a)("Cancel")),h.a.createElement(ve.a,{onClick:async()=>{l(!0);const e=[];if(f&&(p?e.push((async()=>{const{content_uri:e}=await i.uploadContent(p);await i.sendStateEvent(s.roomId,g.b.RoomAvatar,{url:e},"")})()):e.push(i.sendStateEvent(s.roomId,g.b.RoomAvatar,{},""))),O&&e.push(i.setRoomName(s.roomId,E)),R){const t=Object(fe.b)(x,{forceHTML:!1});e.push(i.setRoomTopic(s.roomId,x,t))}const t=await Promise.allSettled(e);l(!1);const a=t.filter((e=>"rejected"===e.status));a.length>0&&($.a.error("Failed to save space settings: ",a),d(Object(y.a)("Failed to save space settings.")))},disabled:o,kind:"primary"},o?Object(y.a)("Saving…"):Object(y.a)("Save Changes"))),h.a.createElement("span",{className:"mx_SettingsTab_subheading"},Object(y.a)("Leave Space")),h.a.createElement("div",{className:"mx_SettingsTab_section mx_SettingsTab_subsectionText"},h.a.createElement(ve.a,{kind:"danger",onClick:()=>{Object(ye.b)(s)}},Object(y.a)("Leave Space"))))},Se=a(160),we=a(933),Oe=a(394),Ce=a(234),xe=a(863),ke=a(947),je=a(311),Re=a(340),Ie=a(248);var Te=e=>{let{matrixClient:t,space:a,closeSettingsFn:n}=e;const[i,s]=Object(u.useState)(""),r=Object(Ie.a)((async()=>t.doesServerSupportUnstableFeature("org.matrix.msc3827.stable")),[t],!1),o=t.getUserId(),l=Object(je.a)(a,(e=>e.getJoinRule())),[c,d]=Object(xe.a)((()=>{var e,t;return(null===(e=a.currentState.getStateEvents(g.b.RoomGuestAccess,""))||void 0===e||null===(t=e.getContent())||void 0===t?void 0:t.guest_access)===Se.a.CanJoin}),(e=>t.sendStateEvent(a.roomId,g.b.RoomGuestAccess,{guest_access:e?Se.a.CanJoin:Se.a.Forbidden},"")),(()=>s(Object(y.a)("Failed to update the guest access of this space")))),[m,p]=Object(xe.a)((()=>{var e,t;return(null===(e=a.currentState.getStateEvents(g.b.RoomHistoryVisibility,""))||void 0===e||null===(t=e.getContent())||void 0===t?void 0:t.history_visibility)||Se.b.Shared}),(e=>t.sendStateEvent(a.roomId,g.b.RoomHistoryVisibility,{history_visibility:e},"")),(()=>s(Object(y.a)("Failed to update the history visibility of this space")))),[v,b]=Object(Oe.a)(),f=a.currentState.maySendStateEvent(g.b.RoomGuestAccess,o),E=a.currentState.maySendStateEvent(g.b.RoomHistoryVisibility,o),_=a.currentState.mayClientSendStateEvent(g.b.RoomCanonicalAlias,t),S=a.currentState.getStateEvents(g.b.RoomCanonicalAlias,"");let w,O;return l===Se.c.Public&&(w=h.a.createElement("div",null,h.a.createElement(ve.a,{"data-testid":"toggle-guest-access-btn",onClick:b,kind:"link",className:"mx_SettingsTab_showAdvanced"},v?Object(y.a)("Hide advanced"):Object(y.a)("Show advanced")),v&&h.a.createElement("div",{className:"mx_SettingsTab_toggleWithDescription"},h.a.createElement(Ce.a,{value:c,onChange:d,disabled:!f,label:Object(y.a)("Enable guest access")}),h.a.createElement("p",null,Object(y.a)("Guests can join a space without having an account."),h.a.createElement("br",null),Object(y.a)("This may be useful for public spaces."))))),a.getJoinRule()===Se.c.Public&&(O=h.a.createElement(h.a.Fragment,null,h.a.createElement("span",{className:"mx_SettingsTab_subheading"},Object(y.a)("Address")),h.a.createElement(we.a,{roomId:a.roomId,canSetCanonicalAlias:_,canSetAliases:!0,canonicalAliasEvent:null!=S?S:void 0,hidePublishSetting:!r}))),h.a.createElement("div",{className:"mx_SettingsTab"},h.a.createElement("div",{className:"mx_SettingsTab_heading"},Object(y.a)("Visibility")),i&&h.a.createElement("div",{"data-testid":"space-settings-error",className:"mx_SpaceRoomView_errorText"},i),h.a.createElement(Re.a,{"data-testid":"access-fieldset",legend:Object(y.a)("Access"),description:Object(y.a)("Decide who can view and join %(spaceName)s.",{spaceName:a.name})},h.a.createElement(ke.a,{room:a,onError:()=>s(Object(y.a)("Failed to update the visibility of this space")),closeSettingsFn:n}),w,h.a.createElement("div",{className:"mx_SettingsTab_toggleWithDescription"},h.a.createElement(Ce.a,{value:m===Se.b.WorldReadable,onChange:e=>{p(e?Se.b.WorldReadable:Se.b.Shared)},disabled:!E,label:Object(y.a)("Preview Space")}),h.a.createElement("p",null,Object(y.a)("Allow people to preview your space before they join."),h.a.createElement("br",null),h.a.createElement("b",null,Object(y.a)("Recommended for public spaces."))))),O)},Ne=a(156),De=a(860),Pe=a(931);let Me;!function(e){e.General="SPACE_GENERAL_TAB",e.Visibility="SPACE_VISIBILITY_TAB",e.Roles="SPACE_ROLES_TAB",e.Advanced="SPACE_ADVANCED_TAB"}(Me||(Me={}));var Ae=e=>{let{matrixClient:t,space:a,onFinished:n}=e;Object(ge.a)(o.a,(e=>{e.action===L.a.AfterLeaveRoom&&e.room_id===a.roomId&&n(!1)}));const i=Object(u.useMemo)((()=>[new le.a(Me.General,Object(y.c)("General"),"mx_SpaceSettingsDialog_generalIcon",h.a.createElement(_e,{matrixClient:t,space:a,onFinished:n})),new le.a(Me.Visibility,Object(y.c)("Visibility"),"mx_SpaceSettingsDialog_visibilityIcon",h.a.createElement(Te,{matrixClient:t,space:a,closeSettingsFn:n})),new le.a(Me.Roles,Object(y.c)("Roles & Permissions"),"mx_RoomSettingsDialog_rolesIcon",h.a.createElement(Pe.a,{roomId:a.roomId})),X.b.getValue(Ne.b.AdvancedSettings)?new le.a(Me.Advanced,Object(y.c)("Advanced"),"mx_RoomSettingsDialog_warningIcon",h.a.createElement(De.a,{roomId:a.roomId,closeSettingsFn:n})):null].filter(Boolean)),[t,a,n]);return h.a.createElement(S.a,{title:Object(y.a)("Space settings"),className:"mx_SpaceSettingsDialog",contentId:"mx_SpaceSettingsDialog",onFinished:n,fixedWidth:!1},h.a.createElement("div",{className:"mx_SpaceSettingsDialog_content",id:"mx_SpaceSettingsDialog",title:Object(y.a)("Settings - %(spaceName)s",{spaceName:a.name})},h.a.createElement(le.c,{tabs:i})))},Le=a(939),Ue=a(390),Fe=a(159),Be=a(250),Ve=a(153);class We{constructor(){i()(this,"isRegistered",!1),i()(this,"onDispatch",(e=>{switch(e.action){case"open_room_settings":l.b.createDialog(c.c,{roomId:e.room_id||Ve.b.instance.roomViewStore.getRoomId(),initialTabId:e.initial_tab_id},void 0,!1,!0);break;case L.a.OpenForwardDialog:l.b.createDialog(K,{matrixClient:q.a.get(),event:e.event,permalinkCreator:e.permalinkCreator});break;case L.a.OpenReportEventDialog:l.b.createDialog(oe,{mxEvent:e.event},"mx_Dialog_reportEvent");break;case L.a.OpenSpacePreferences:l.b.createDialog(pe,{initialTabId:e.initalTabId,space:e.space},void 0,!1,!0);break;case L.a.OpenSpaceSettings:l.b.createDialog(Ae,{matrixClient:e.space.client,space:e.space},void 0,!1,!0);break;case L.a.OpenInviteDialog:l.b.createDialog(Le.a,{kind:e.kind,call:e.call,roomId:e.roomId},r()("mx_InviteDialog_flexWrapper",e.className),!1,!0).finished.then((t=>{var a;null===(a=e.onFinishedCallback)||void 0===a||a.call(e,t)}));break;case L.a.OpenAddToExistingSpaceDialog:{const t=e.space;l.b.createDialog(Ue.d,{onCreateRoomClick:e=>{Object(Be.g)(t),Fe.b.trackInteraction("WebAddExistingToSpaceDialogCreateRoomButton",e)},onAddSubspaceClick:()=>Object(Be.f)(t),space:t,onFinished:e=>{e&&Ve.b.instance.roomViewStore.getRoomId()===t.roomId&&o.a.fire(L.a.UpdateSpaceHierarchy)}},"mx_AddExistingToSpaceDialog_wrapper");break}}}))}prepare(){this.isRegistered||(o.a.register(this.onDispatch),this.isRegistered=!0)}}i()(We,"instance",new We)},1575:function(e,t,a){"use strict";a.d(t,"a",(function(){return V}));var n=a(13),i=a.n(n),s=a(1),r=a(175),o=a(136),l=a(122),c=a(124),d=a(121),m=a(235),u=a(198),h=a(128);const p="mx_snooze_bulk_unverified_device_nag",g="reviewsessions",v=e=>{u.a.sharedInstance().addOrReplaceToast({key:g,title:Object(d.a)("You have unverified sessions"),icon:"verification_warning",props:{description:Object(d.a)("Review to ensure your account is safe"),acceptLabel:Object(d.a)("Review"),onAccept:()=>{V.sharedInstance().dismissUnverifiedSessions(e),c.a.dispatch({action:h.a.ViewUserDeviceSettings})},rejectLabel:Object(d.a)("Later"),onReject:()=>{V.sharedInstance().dismissUnverifiedSessions(e),(()=>{try{localStorage.setItem(p,String(Date.now()))}catch(e){s.a.error("Failed to persist bulk unverified device nag snooze",e)}})()}},component:m.a,priority:50})};var b=a(127),f=a(396),y=a(251),E=a(294),_=a(134);const S="setupencryption",w=e=>{switch(e){case k.SET_UP_ENCRYPTION:return Object(d.a)("Set up Secure Backup");case k.UPGRADE_ENCRYPTION:return Object(d.a)("Encryption upgrade available");case k.VERIFY_THIS_SESSION:return Object(d.a)("Verify this session")}},O=e=>{switch(e){case k.SET_UP_ENCRYPTION:case k.UPGRADE_ENCRYPTION:return"secure_backup";case k.VERIFY_THIS_SESSION:return"verification_warning"}},C=e=>{switch(e){case k.SET_UP_ENCRYPTION:return Object(d.a)("Continue");case k.UPGRADE_ENCRYPTION:return Object(d.a)("Upgrade");case k.VERIFY_THIS_SESSION:return Object(d.a)("Verify")}},x=e=>{switch(e){case k.SET_UP_ENCRYPTION:case k.UPGRADE_ENCRYPTION:return Object(d.a)("Safeguard against losing access to encrypted messages & data");case k.VERIFY_THIS_SESSION:return Object(d.a)("Other users may not trust it")}};let k;!function(e){e.SET_UP_ENCRYPTION="set_up_encryption",e.UPGRADE_ENCRYPTION="upgrade_encryption",e.VERIFY_THIS_SESSION="verify_this_session"}(k||(k={}));const j=()=>{V.sharedInstance().dismissEncryptionSetup()},R=e=>{var t;if(null!==(t=E.a.setupEncryptionNeeded)&&void 0!==t&&t.call(E.a,e))return;u.a.sharedInstance().addOrReplaceToast({key:S,title:w(e),icon:O(e),props:{description:x(e),acceptLabel:C(e),onAccept:async()=>{if(e===k.VERIFY_THIS_SESSION)b.b.createDialog(f.a,{},void 0,!1,!0);else{const e=b.b.createDialog(_.a,void 0,"mx_Dialog_spinner",!1,!0);try{await Object(y.b)()}finally{e.close()}}},rejectLabel:Object(d.a)("Later"),onReject:j},component:m.a,priority:e===k.VERIFY_THIS_SESSION?95:40})},I=()=>{u.a.sharedInstance().dismissToast(S)};function T(e){return"unverified_session_"+e}const N=async e=>{const t=l.a.get(),a=await t.getDevice(e);u.a.sharedInstance().addOrReplaceToast({key:T(e),title:Object(d.a)("New login. Was this you?"),icon:"verification_warning",props:{description:a.display_name,detail:Object(d.a)("%(deviceId)s from %(ip)s",{deviceId:e,ip:a.last_seen_ip}),acceptLabel:Object(d.a)("Check your devices"),onAccept:()=>{V.sharedInstance().dismissUnverifiedSessions([e]),c.a.dispatch({action:h.a.ViewUserDeviceSettings})},rejectLabel:Object(d.a)("Later"),onReject:()=>{V.sharedInstance().dismissUnverifiedSessions([e])}},component:m.a,priority:80})},D=e=>{u.a.sharedInstance().dismissToast(T(e))};var P=a(241),M=a(359);var A=a(131),L=a(157),U=a(878),F=a(125),B=a(156);class V{constructor(){i()(this,"dispatcherRef",void 0),i()(this,"dismissed",new Set),i()(this,"dismissedThisDeviceToast",!1),i()(this,"keyBackupInfo",null),i()(this,"keyBackupFetchedAt",null),i()(this,"keyBackupStatusChecked",!1),i()(this,"ourDeviceIdsAtStart",null),i()(this,"displayingToastsForDeviceIds",new Set),i()(this,"running",!1),i()(this,"shouldRecordClientInformation",!1),i()(this,"enableBulkUnverifiedSessionsReminder",!0),i()(this,"deviceClientInformationSettingWatcherRef",void 0),i()(this,"onWillUpdateDevices",(async(e,t)=>{if(t)return;const a=l.a.get().getUserId();e.includes(a)&&this.ensureDeviceIdsAtStartPopulated()})),i()(this,"onDevicesUpdated",(e=>{e.includes(l.a.get().getUserId())&&this.recheck()})),i()(this,"onDeviceVerificationChanged",(e=>{e===l.a.get().getUserId()&&this.recheck()})),i()(this,"onUserTrustStatusChanged",(e=>{e===l.a.get().getUserId()&&this.recheck()})),i()(this,"onCrossSingingKeysChanged",(()=>{this.recheck()})),i()(this,"onAccountData",(e=>{(e.getType().startsWith("m.secret_storage.")||e.getType().startsWith("m.cross_signing.")||"m.megolm_backup.v1"===e.getType())&&this.recheck()})),i()(this,"onSync",((e,t)=>{"PREPARED"===e&&null===t&&this.recheck()})),i()(this,"onRoomStateEvents",(e=>{e.getType()===o.EventType.RoomEncryption&&this.recheck()})),i()(this,"onAction",(e=>{let{action:t}=e;t===h.a.OnLoggedIn&&(this.recheck(),this.updateClientInformation())})),i()(this,"checkKeyBackupStatus",(async()=>{if(this.keyBackupStatusChecked)return;const e=l.a.get().getKeyBackupEnabled();this.keyBackupStatusChecked=null!==e,!1===e&&c.a.dispatch({action:h.a.ReportKeyBackupNotEnabled})})),i()(this,"onRecordClientInformationSettingChange",((e,t,a,n,i)=>{const s=this.shouldRecordClientInformation;this.shouldRecordClientInformation=!!i,this.shouldRecordClientInformation!==s&&this.updateClientInformation()})),i()(this,"updateClientInformation",(async()=>{try{this.shouldRecordClientInformation?await Object(U.c)(l.a.get(),A.b.get(),L.a.get()):await Object(U.d)(l.a.get())}catch(e){s.a.error("Failed to update client information",e)}}))}static sharedInstance(){return window.mxDeviceListener||(window.mxDeviceListener=new V),window.mxDeviceListener}start(){this.running=!0,l.a.get().on(r.b.WillUpdateDevices,this.onWillUpdateDevices),l.a.get().on(r.b.DevicesUpdated,this.onDevicesUpdated),l.a.get().on(r.b.DeviceVerificationChanged,this.onDeviceVerificationChanged),l.a.get().on(r.b.UserTrustStatusChanged,this.onUserTrustStatusChanged),l.a.get().on(r.b.KeysChanged,this.onCrossSingingKeysChanged),l.a.get().on(o.ClientEvent.AccountData,this.onAccountData),l.a.get().on(o.ClientEvent.Sync,this.onSync),l.a.get().on(o.RoomStateEvent.Events,this.onRoomStateEvents),this.shouldRecordClientInformation=F.b.getValue("deviceClientInformationOptIn"),this.enableBulkUnverifiedSessionsReminder=F.b.getValue(B.b.BulkUnverifiedSessionsReminder),this.deviceClientInformationSettingWatcherRef=F.b.watchSetting("deviceClientInformationOptIn",null,this.onRecordClientInformationSettingChange),this.dispatcherRef=c.a.register(this.onAction),this.recheck(),this.updateClientInformation()}stop(){this.running=!1,l.a.get()&&(l.a.get().removeListener(r.b.WillUpdateDevices,this.onWillUpdateDevices),l.a.get().removeListener(r.b.DevicesUpdated,this.onDevicesUpdated),l.a.get().removeListener(r.b.DeviceVerificationChanged,this.onDeviceVerificationChanged),l.a.get().removeListener(r.b.UserTrustStatusChanged,this.onUserTrustStatusChanged),l.a.get().removeListener(r.b.KeysChanged,this.onCrossSingingKeysChanged),l.a.get().removeListener(o.ClientEvent.AccountData,this.onAccountData),l.a.get().removeListener(o.ClientEvent.Sync,this.onSync),l.a.get().removeListener(o.RoomStateEvent.Events,this.onRoomStateEvents)),this.deviceClientInformationSettingWatcherRef&&F.b.unwatchSetting(this.deviceClientInformationSettingWatcherRef),this.dispatcherRef&&(c.a.unregister(this.dispatcherRef),this.dispatcherRef=null),this.dismissed.clear(),this.dismissedThisDeviceToast=!1,this.keyBackupInfo=null,this.keyBackupFetchedAt=null,this.keyBackupStatusChecked=!1,this.ourDeviceIdsAtStart=null,this.displayingToastsForDeviceIds=new Set}async dismissUnverifiedSessions(e){s.a.log("Dismissing unverified sessions: "+Array.from(e).join(","));for(const t of e)this.dismissed.add(t);this.recheck()}dismissEncryptionSetup(){this.dismissedThisDeviceToast=!0,this.recheck()}ensureDeviceIdsAtStartPopulated(){if(null===this.ourDeviceIdsAtStart){const e=l.a.get();this.ourDeviceIdsAtStart=new Set(e.getStoredDevicesForUser(e.getUserId()).map((e=>e.deviceId)))}}async getKeyBackupInfo(){const e=(new Date).getTime();return(!this.keyBackupInfo||this.keyBackupFetchedAt<e-3e5)&&(this.keyBackupInfo=await l.a.get().getKeyBackupVersion(),this.keyBackupFetchedAt=e),this.keyBackupInfo}shouldShowSetupEncryptionToast(){if(Object(y.d)())return!1;const e=l.a.get();return e&&e.getRooms().some((t=>e.isRoomEncrypted(t.roomId)))}async recheck(){if(!this.running)return;const e=l.a.get();if(!await e.doesServerSupportUnstableFeature("org.matrix.e2e_cross_signing"))return;if(!e.isCryptoEnabled())return;if(!e.isInitialSyncComplete())return;const t=await e.isCrossSigningReady(),a=await e.isSecretStorageReady(),n=t&&a;if(this.dismissedThisDeviceToast||n)I(),this.checkKeyBackupStatus();else if(this.shouldShowSetupEncryptionToast())if(await e.downloadKeys([e.getUserId()]),!e.getCrossSigningId()&&e.getStoredCrossSigningForUser(e.getUserId()))R(k.VERIFY_THIS_SESSION),this.checkKeyBackupStatus();else{await this.getKeyBackupInfo()?R(k.UPGRADE_ENCRYPTION):(await e.waitForClientWellKnown(),Object(P.g)()&&function(){const e=window.matrixChat;return(null==e?void 0:e.state.view)===M.a.LOGGED_IN}()?(I(),Object(y.b)()):R(k.SET_UP_ENCRYPTION))}this.ensureDeviceIdsAtStartPopulated();const i=new Set,r=new Set,o=t&&await e.checkDeviceTrust(e.getUserId(),e.deviceId).isCrossSigningVerified();if(t){const t=e.getStoredDevicesForUser(e.getUserId());for(const a of t){if(a.deviceId===e.deviceId)continue;var c;if(!(await e.checkDeviceTrust(e.getUserId(),a.deviceId)).isCrossSigningVerified()&&!this.dismissed.has(a.deviceId))null!==(c=this.ourDeviceIdsAtStart)&&void 0!==c&&c.has(a.deviceId)?i.add(a.deviceId):r.add(a.deviceId)}}s.a.debug("Old unverified sessions: "+Array.from(i).join(",")),s.a.debug("New unverified sessions: "+Array.from(r).join(",")),s.a.debug("Currently showing toasts for: "+Array.from(this.displayingToastsForDeviceIds).join(","));const d=(()=>{try{const e=localStorage.getItem(p),t=Number.parseInt(e||"",10);return Number.isInteger(t)&&t+6048e5>Date.now()}catch(e){return!1}})();i.size>0&&o&&this.enableBulkUnverifiedSessionsReminder&&!d?v(i):u.a.sharedInstance().dismissToast(g);for(const e of r)N(e);for(const e of this.displayingToastsForDeviceIds)r.has(e)||(s.a.debug("Hiding unverified session toast for "+e),D(e));this.displayingToastsForDeviceIds=r}}},1578:function(e,t,a){"use strict";a.d(t,"a",(function(){return E}));var n=a(13),i=a.n(n),s=a(120),r=a.n(s),o=a(509),l=a(417),c=a(1),d=a(122),m=a(121),u=a(163),h=a(145);class p extends r.a.Component{render(){return r.a.createElement("div",null,r.a.createElement("h2",null,Object(m.a)("Verified!")),r.a.createElement("p",null,Object(m.a)("You've successfully verified this user.")),r.a.createElement("p",null,Object(m.a)("Secure messages with this user are end-to-end encrypted and not able to be read by third parties.")),r.a.createElement(h.a,{onPrimaryButtonClick:this.props.onDone,primaryButton:Object(m.a)("Got It"),hasCancel:!1}))}}class g extends r.a.Component{render(){return r.a.createElement("div",null,r.a.createElement("p",null,Object(m.a)("The other party cancelled the verification.")),r.a.createElement(h.a,{primaryButton:Object(m.a)("OK"),hasCancel:!1,onPrimaryButtonClick:this.props.onDone}))}}var v=a(191),b=a(134),f=a(875),y=a(135);class E extends r.a.Component{constructor(e){super(e),i()(this,"showSasEvent",void 0),i()(this,"onFinished",(()=>{this.props.onFinished(3===this.state.phase)})),i()(this,"onCancelClick",(()=>{this.props.onFinished(3===this.state.phase)})),i()(this,"onContinueClick",(()=>{this.setState({phase:2}),this.props.verifier.verify().then((()=>{this.setState({phase:3})})).catch((e=>{c.a.log("Verification failed",e)}))})),i()(this,"onVerifierShowSas",(e=>{this.showSasEvent=e,this.setState({phase:1,sas:e.sas})})),i()(this,"onVerifierCancel",(()=>{this.setState({phase:4})})),i()(this,"onSasMatchesClick",(()=>{this.showSasEvent.confirm(),this.setState({phase:2})})),i()(this,"onVerifiedDoneClick",(()=>{this.props.onFinished(!0)}));let t=0;this.props.verifier.hasBeenCancelled&&(c.a.log("Verifier was cancelled in the background."),t=4),this.showSasEvent=null,this.state={phase:t,sasVerified:!1,opponentProfile:null,opponentProfileError:null,sas:null},this.props.verifier.on(o.b.ShowSas,this.onVerifierShowSas),this.props.verifier.on(l.c.Cancel,this.onVerifierCancel),this.fetchOpponentProfile()}componentWillUnmount(){4!==this.state.phase&&3!==this.state.phase&&this.props.verifier.cancel(new Error("User cancel")),this.props.verifier.removeListener(o.b.ShowSas,this.onVerifierShowSas)}async fetchOpponentProfile(){try{const e=await d.a.get().getProfileInfo(this.props.verifier.userId);this.setState({opponentProfile:e})}catch(e){this.setState({opponentProfileError:e})}}renderPhaseStart(){const e=this.props.verifier.userId===d.a.get().getUserId();let t;const a=this.state.opponentProfile;if(a){const e=a.avatar_url?Object(u.b)(a.avatar_url).getSquareThumbnailHttp(48):null;t=r.a.createElement("div",{className:"mx_IncomingSasDialog_opponentProfile"},r.a.createElement(v.a,{name:a.displayname,idName:this.props.verifier.userId,url:e,width:48,height:48,resizeMethod:"crop"}),r.a.createElement("h2",null,a.displayname))}else t=this.state.opponentProfileError?r.a.createElement("div",null,r.a.createElement(v.a,{name:this.props.verifier.userId.slice(1),idName:this.props.verifier.userId,width:48,height:48}),r.a.createElement("h2",null,this.props.verifier.userId)):r.a.createElement(b.a,null);const n=[r.a.createElement("p",{key:"p1"},Object(m.a)("Verify this user to mark them as trusted. Trusting users gives you extra peace of mind when using end-to-end encrypted messages.")),r.a.createElement("p",{key:"p2"},Object(m.a)("Verifying this user will mark their session as trusted, and also mark your session as trusted to them."))],i=[r.a.createElement("p",{key:"p1"},Object(m.a)("Verify this device to mark it as trusted. Trusting this device gives you and other users extra peace of mind when using end-to-end encrypted messages.")),r.a.createElement("p",{key:"p2"},Object(m.a)("Verifying this device will mark it as trusted, and users who have verified with you will trust this device."))];return r.a.createElement("div",null,t,e?i:n,r.a.createElement(h.a,{primaryButton:Object(m.a)("Continue"),hasCancel:!0,onPrimaryButtonClick:this.onContinueClick,onCancel:this.onCancelClick}))}renderPhaseShowSas(){return r.a.createElement(f.a,{sas:this.showSasEvent.sas,onCancel:this.onCancelClick,onDone:this.onSasMatchesClick,isSelf:this.props.verifier.userId===d.a.get().getUserId(),inDialog:!0})}renderPhaseWaitForPartnerToConfirm(){return r.a.createElement("div",null,r.a.createElement(b.a,null),r.a.createElement("p",null,Object(m.a)("Waiting for partner to confirm…")))}renderPhaseVerified(){return r.a.createElement(p,{onDone:this.onVerifiedDoneClick})}renderPhaseCancelled(){return r.a.createElement(g,{onDone:this.onCancelClick})}render(){let e;switch(this.state.phase){case 0:e=this.renderPhaseStart();break;case 1:e=this.renderPhaseShowSas();break;case 2:e=this.renderPhaseWaitForPartnerToConfirm();break;case 3:e=this.renderPhaseVerified();break;case 4:e=this.renderPhaseCancelled()}return r.a.createElement(y.a,{title:Object(m.a)("Incoming Verification Request"),onFinished:this.onFinished,fixedWidth:!1},e)}}},1579:function(e,t,a){"use strict";a.d(t,"a",(function(){return b}));var n=a(126),i=a.n(n),s=a(120),r=a.n(s),o=a(121),l=a(474),c=a(130),d=a.n(c),m=a(132),u=a.n(m);const h=["children","className"];function p(e){let{children:t,className:a}=e,n=u()(e,h);const s=i()(a,"mx_SplashPage");return r.a.createElement("main",d()({},n,{className:s}),t)}var g=a(123);function v(e){let t,{useCase:a,onClick:n,selected:s}=e;switch(a){case l.a.PersonalMessaging:t=Object(o.a)("Friends and family");break;case l.a.WorkMessaging:t=Object(o.a)("Coworkers and teams");break;case l.a.CommunityMessaging:t=Object(o.a)("Online community members")}return r.a.createElement(g.a,{className:i()("mx_UseCaseSelectionButton",{mx_UseCaseSelectionButton_selected:s}),onClick:async()=>n(a)},r.a.createElement("div",{className:i()("mx_UseCaseSelectionButton_icon",{mx_UseCaseSelectionButton_messaging:a===l.a.PersonalMessaging,mx_UseCaseSelectionButton_work:a===l.a.WorkMessaging,mx_UseCaseSelectionButton_community:a===l.a.CommunityMessaging})}),r.a.createElement("span",null,t),r.a.createElement("div",{className:"mx_UseCaseSelectionButton_selectedIcon"}))}function b(e){let{onFinished:t}=e;const[a,n]=Object(s.useState)(null);return Object(s.useEffect)((()=>{if(a){let e=window.setTimeout((()=>{e=null,t(a)}),1500);return()=>{clearTimeout(e),e=null}}}),[a,t]),r.a.createElement(p,{className:i()("mx_UseCaseSelection",{mx_UseCaseSelection_selected:null!==a})},r.a.createElement("div",{className:"mx_UseCaseSelection_title mx_UseCaseSelection_slideIn"},r.a.createElement("h1",null,Object(o.a)("You're in"))),r.a.createElement("div",{className:"mx_UseCaseSelection_info mx_UseCaseSelection_slideInDelayed"},r.a.createElement("h2",null,Object(o.a)("Who will you chat to the most?")),r.a.createElement("h3",null,Object(o.a)("We'll help you get connected."))),r.a.createElement("div",{className:"mx_UseCaseSelection_options mx_UseCaseSelection_slideInDelayed"},r.a.createElement(v,{useCase:l.a.PersonalMessaging,selected:a===l.a.PersonalMessaging,onClick:n}),r.a.createElement(v,{useCase:l.a.WorkMessaging,selected:a===l.a.WorkMessaging,onClick:n}),r.a.createElement(v,{useCase:l.a.CommunityMessaging,selected:a===l.a.CommunityMessaging,onClick:n})),r.a.createElement("div",{className:"mx_UseCaseSelection_skip mx_UseCaseSelection_slideInDelayed"},r.a.createElement(g.a,{kind:"link",onClick:async()=>n(l.a.Skip)},Object(o.a)("Skip"))))}},1581:function(e,t,a){"use strict";a.d(t,"a",(function(){return g}));var n=a(120),i=a.n(n),s=a(126),r=a.n(s),o=a(131),l=a(319),c=a(121),d=a(125),m=a(156),u=a(918),h=a(638);const p=`<a href="https://matrix.org" target="_blank" rel="noreferrer noopener">\n <img width="79" height="34" alt="Matrix" style="padding-left: 1px;vertical-align: middle" src="${a(1550).default}"/>\n</a>`;Object(c.c)("Sign in with SSO");class g extends i.a.PureComponent{render(){const e=o.b.getObject("embedded_pages");let t=null;return e&&(t=e.get("welcome_url")),t||(t="welcome.html"),i.a.createElement(l.a,null,i.a.createElement("div",{className:r()("mx_Welcome",{mx_WelcomePage_registrationDisabled:!d.b.getValue(m.b.Registration)})},i.a.createElement(h.a,{className:"mx_WelcomePage",url:t,replaceMap:{"$riot:ssoUrl":"#/start_sso","$riot:casUrl":"#/start_cas",$matrixLogo:p,"[matrix]":p}}),i.a.createElement(u.a,null)))}}},1582:function(e,t,a){"use strict";a.d(t,"a",(function(){return y}));var n=a(120),i=a.n(n),s=a(319),r=a(917),o=a(13),l=a.n(o),c=a(1),d=a(122),m=a(121),u=a(127),h=a(320),p=a(145),g=a(135),v=a(134),b=a(257);class f extends i.a.PureComponent{constructor(e){super(e),l()(this,"doBootstrapUIAuth",(async e=>{if(this.state.canUploadKeysWithPasswordOnly&&this.state.accountPassword)await e({type:"m.login.password",identifier:{type:"m.id.user",user:d.a.get().getUserId()},user:d.a.get().getUserId(),password:this.state.accountPassword});else if(this.props.tokenLogin)await e({});else{const t={[h.c.PHASE_PREAUTH]:{title:Object(m.a)("Use Single Sign On to continue"),body:Object(m.a)("To continue, use Single Sign On to prove your identity."),continueText:Object(m.a)("Single Sign On"),continueKind:"primary"},[h.c.PHASE_POSTAUTH]:{title:Object(m.a)("Confirm encryption setup"),body:Object(m.a)("Click the button below to confirm setting up encryption."),continueText:Object(m.a)("Confirm"),continueKind:"primary"}},{finished:a}=u.b.createDialog(b.a,{title:Object(m.a)("Setting up keys"),matrixClient:d.a.get(),makeRequest:e,aestheticsForStagePhases:{[h.c.LOGIN_TYPE]:t,[h.c.UNSTABLE_LOGIN_TYPE]:t}}),[n]=await a;if(!n)throw new Error("Cross-signing key upload auth canceled")}})),l()(this,"bootstrapCrossSigning",(async()=>{this.setState({error:null});const e=d.a.get();try{await e.bootstrapCrossSigning({authUploadDeviceSigningKeys:this.doBootstrapUIAuth}),this.props.onFinished(!0)}catch(e){if(this.props.tokenLogin)return void this.props.onFinished(!1);this.setState({error:e}),c.a.error("Error bootstrapping cross-signing",e)}})),l()(this,"onCancel",(()=>{this.props.onFinished(!1)})),this.state={error:null,canUploadKeysWithPasswordOnly:!!e.accountPassword||null,accountPassword:e.accountPassword||""},this.state.accountPassword||this.queryKeyUploadAuth()}componentDidMount(){this.bootstrapCrossSigning()}async queryKeyUploadAuth(){try{await d.a.get().uploadDeviceSigningKeys(null,{}),c.a.log("uploadDeviceSigningKeys unexpectedly succeeded without UI auth!")}catch(e){if(!e.data||!e.data.flows)return void c.a.log("uploadDeviceSigningKeys advertised no flows!");const t=e.data.flows.some((e=>1===e.stages.length&&"m.login.password"===e.stages[0]));this.setState({canUploadKeysWithPasswordOnly:t})}}render(){let e;return e=this.state.error?i.a.createElement("div",null,i.a.createElement("p",null,Object(m.a)("Unable to set up keys")),i.a.createElement("div",{className:"mx_Dialog_buttons"},i.a.createElement(p.a,{primaryButton:Object(m.a)("Retry"),onPrimaryButtonClick:this.bootstrapCrossSigning,onCancel:this.onCancel}))):i.a.createElement("div",null,i.a.createElement(v.a,null)),i.a.createElement(g.a,{className:"mx_CreateCrossSigningDialog",onFinished:this.props.onFinished,title:Object(m.a)("Setting up keys"),hasCancel:!1,fixedWidth:!1},i.a.createElement("div",null,e))}}class y extends i.a.Component{render(){return i.a.createElement(s.a,null,i.a.createElement(r.a,null,i.a.createElement(f,{onFinished:this.props.onFinished,accountPassword:this.props.accountPassword,tokenLogin:this.props.tokenLogin})))}}},1583:function(e,t,a){"use strict";a.d(t,"a",(function(){return P}));var n=a(13),i=a.n(n),s=a(136),r=a(120),o=a.n(r),l=a(126),c=a.n(l),d=a(1),m=a(342),u=a(121),h=a(382),p=a(345),g=a(467),v=a(122),b=a(319),f=a(468),y=a(124),E=a(643),_=a(941),S=a(662),w=a(123),O=a(478),C=a(477),x=a(517),k=a(134),j=a(519);function R(e){var t,a;let{title:n,icon:i,serverPicker:s,children:l}=e;const c=Object(r.useContext)(j.a);if(!c)return null;const d=c.state.length?c.state[0]:null;return o.a.createElement(r.Fragment,null,null!==(t=null==d?void 0:d.icon)&&void 0!==t?t:i,o.a.createElement("h1",null,null!==(a=null==d?void 0:d.title)&&void 0!==a?a:n),l,!0!==(null==d?void 0:d.hideServerPicker)&&s)}var I=a(694),T=a(125);function N(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}const D=function(){if(T.b.getValue("debug_registration")){for(var e=arguments.length,t=new Array(e),a=0;a<e;a++)t[a]=arguments[a];d.a.log.call(console,"Registration debuglog:",...t)}};class P extends o.a.Component{constructor(e){super(e),i()(this,"loginLogic",void 0),i()(this,"latestServerConfig",void 0),i()(this,"unloadCallback",(e=>{if(this.state.doingUIAuth)return e.preventDefault(),e.returnValue="",""})),i()(this,"onFormSubmit",(async e=>{this.setState({errorText:"",busy:!0,formVals:e,doingUIAuth:!0})})),i()(this,"requestEmailToken",((e,t,a,n)=>this.state.matrixClient.requestRegisterEmailToken(e,t,a,this.props.makeRegistrationUrl({client_secret:t,hs_url:this.state.matrixClient.getHomeserverUrl(),is_url:this.state.matrixClient.getIdentityServerUrl(),session_id:n})))),i()(this,"onUIAuthFinished",(async(e,t)=>{if(D("Registration: ui authentication finished: ",{success:e,response:t}),!e){var a;let e=t.message||t.toString();if(t instanceof s.MatrixError&&"M_RESOURCE_LIMIT_EXCEEDED"===t.errcode){const a=Object(h.a)(t.data.limit_type,t.data.admin_contact,{monthly_active_user:Object(u.c)("This homeserver has hit its Monthly Active User limit."),hs_blocked:Object(u.c)("This homeserver has been blocked by its administrator."),"":Object(u.c)("This homeserver has exceeded one of its resource limits.")}),n=Object(h.a)(t.data.limit_type,t.data.admin_contact,{"":Object(u.c)("Please <a>contact your service administrator</a> to continue using this service.")});e=o.a.createElement("div",null,o.a.createElement("p",null,a),o.a.createElement("p",null,n))}else if(null!==(a=t.required_stages)&&void 0!==a&&a.includes(s.AuthType.Msisdn)){let a=!1;for(const e of t.available_flows)a=a||e.stages.includes(s.AuthType.Msisdn);a||(e=Object(u.a)("This server does not support authentication with a phone number."))}else t instanceof s.MatrixError&&"M_USER_IN_USE"===t.errcode?e=Object(u.a)("Someone already has that username, please try another."):t instanceof s.MatrixError&&"M_THREEPID_IN_USE"===t.errcode&&(e=Object(u.a)("That e-mail address or phone number is already in use."));return void this.setState({busy:!1,doingUIAuth:!1,errorText:e})}v.a.setJustRegisteredUserId(t.user_id);const n={doingUIAuth:!1,registeredUsername:t.user_id,differentLoggedInUserId:null,completedNoSignin:!1,busy:!0},[i,r]=await g.b();i&&!r&&i!==t.user_id&&(d.a.log(`Found a session for ${i} but ${t.user_id} has just registered.`),n.differentLoggedInUserId=i);const l=Boolean(this.state.formVals.email),c=Boolean(t.access_token);D("Registration: ui auth finished:",{hasEmail:l,hasAccessToken:c}),l||!c||n.differentLoggedInUserId?(n.busy=!1,n.completedNoSignin=!0):(await this.props.onLoggedIn({userId:t.user_id,deviceId:t.device_id,homeserverUrl:this.state.matrixClient.getHomeserverUrl(),identityServerUrl:this.state.matrixClient.getIdentityServerUrl(),accessToken:t.access_token},this.state.formVals.password),this.setupPushers()),this.setState(n)})),i()(this,"onLoginClick",(e=>{e.preventDefault(),e.stopPropagation(),this.props.onLoginClick()})),i()(this,"onGoToFormClicked",(e=>{e.preventDefault(),e.stopPropagation(),this.replaceClient(this.props.serverConfig),this.setState({busy:!1,doingUIAuth:!1})})),i()(this,"makeRegisterRequest",(e=>{const t={username:this.state.formVals.username,password:this.state.formVals.password,initial_device_display_name:this.props.defaultDeviceDisplayName,auth:void 0,inhibit_login:void 0};return e&&(t.auth=e),D("Registration: sending registration request:",e),this.state.matrixClient.registerRequest(t)})),i()(this,"onLoginClickWithCheck",(async e=>{e.preventDefault();const t=await g.h({ignoreGuest:!0});return t||this.props.onLoginClick(),t})),this.state={busy:!1,errorText:null,formVals:{email:this.props.email},doingUIAuth:Boolean(this.props.sessionId),flows:null,completedNoSignin:!1,serverIsAlive:!0,serverErrorIsFatal:!1,serverDeadError:""};const{hsUrl:t,isUrl:a}=this.props.serverConfig;this.loginLogic=new f.a(t,a,null,{defaultDeviceDisplayName:"Element login check"})}componentDidMount(){this.replaceClient(this.props.serverConfig),window.addEventListener("beforeunload",this.unloadCallback)}componentWillUnmount(){window.removeEventListener("beforeunload",this.unloadCallback)}componentDidUpdate(e){e.serverConfig.hsUrl===this.props.serverConfig.hsUrl&&e.serverConfig.isUrl===this.props.serverConfig.isUrl||this.replaceClient(this.props.serverConfig)}async replaceClient(e){this.latestServerConfig=e;const{hsUrl:t,isUrl:a}=e;this.setState({errorText:null,serverDeadError:null,serverErrorIsFatal:!1,busy:!0});try{if(await p.a.validateServerConfigWithStaticUrls(t,a),e!==this.latestServerConfig)return;this.setState({serverIsAlive:!0,serverErrorIsFatal:!1})}catch(t){if(e!==this.latestServerConfig)return;if(this.setState(function(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?N(Object(a),!0).forEach((function(t){i()(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):N(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}({busy:!1},p.a.authComponentStateForError(t,"register"))),this.state.serverErrorIsFatal)return}const n=Object(s.createClient)({baseUrl:t,idBaseUrl:a});let r;this.loginLogic.setHomeserverUrl(t),this.loginLogic.setIdentityServerUrl(a);try{const t=await this.loginLogic.getFlows();if(e!==this.latestServerConfig)return;r=t.find((e=>"m.login.sso"===e.type||"m.login.cas"===e.type))}catch(t){if(e!==this.latestServerConfig)return;d.a.error("Failed to get login flows to check for SSO support",t)}this.setState({matrixClient:n,ssoFlow:r,busy:!1});try{if(!this.state.doingUIAuth){if(await this.makeRegisterRequest(null),e!==this.latestServerConfig)return;d.a.log("Expecting 401 from register request but got success!")}}catch(t){if(e!==this.latestServerConfig)return;401===t.httpStatus?this.setState({flows:t.data.flows}):403===t.httpStatus||"M_FORBIDDEN"===t.errcode?r?y.a.dispatch({action:"start_login"}):this.setState({serverErrorIsFatal:!0,errorText:Object(u.a)("Registration has been disabled on this homeserver."),flows:[]}):(d.a.log("Unable to query for supported registration methods.",t),this.setState({errorText:Object(u.a)("Unable to query for supported registration methods."),flows:[]}))}}setupPushers(){if(!this.props.brand)return Promise.resolve();const e=v.a.get();return e.getPushers().then((t=>{const a=t.pushers;for(let t=0;t<a.length;++t)if("email"===a[t].kind){const n=a[t];n.data={brand:this.props.brand},e.setPusher(n).then((()=>{d.a.log("Set email branding to "+this.props.brand)}),(e=>{d.a.error("Couldn't set email branding: "+e)}))}}),(e=>{d.a.error("Couldn't get pushers: "+e)}))}getUIAuthInputs(){return{emailAddress:this.state.formVals.email,phoneCountry:this.state.formVals.phoneCountry,phoneNumber:this.state.formVals.phoneNumber}}renderRegisterComponent(){if(this.state.matrixClient&&this.state.doingUIAuth)return o.a.createElement(x.b,{matrixClient:this.state.matrixClient,makeRequest:this.makeRegisterRequest,onAuthFinished:this.onUIAuthFinished,inputs:this.getUIAuthInputs(),requestEmailToken:this.requestEmailToken,sessionId:this.props.sessionId,clientSecret:this.props.clientSecret,emailSid:this.props.idSid,poll:!0});if(!this.state.matrixClient&&!this.state.busy)return null;if(this.state.busy||!this.state.flows)return o.a.createElement("div",{className:"mx_AuthBody_spinner"},o.a.createElement(k.a,null));if(this.state.flows.length){let e;if(this.state.ssoFlow){let t;(this.state.ssoFlow.identity_providers||[]).length>1&&(t=o.a.createElement("h2",{className:"mx_AuthBody_centered"},Object(u.a)("Continue with %(ssoButtons)s",{ssoButtons:""}).trim())),e=o.a.createElement(o.a.Fragment,null,t,o.a.createElement(E.a,{matrixClient:this.loginLogic.createTemporaryClient(),flow:this.state.ssoFlow,loginType:"m.login.sso"===this.state.ssoFlow.type?"sso":"cas",fragmentAfterLogin:this.props.fragmentAfterLogin,action:m.c.REGISTER}),o.a.createElement("h2",{className:"mx_AuthBody_centered"},Object(u.a)("%(ssoButtons)s Or %(usernamePassword)s",{ssoButtons:"",usernamePassword:""}).trim()))}return o.a.createElement(o.a.Fragment,null,e,o.a.createElement(S.b,{defaultUsername:this.state.formVals.username,defaultEmail:this.state.formVals.email,defaultPhoneCountry:this.state.formVals.phoneCountry,defaultPhoneNumber:this.state.formVals.phoneNumber,defaultPassword:this.state.formVals.password,onRegisterClick:this.onFormSubmit,flows:this.state.flows,serverConfig:this.props.serverConfig,canSubmit:!this.state.serverErrorIsFatal,matrixClient:this.state.matrixClient}))}}render(){let e;const t=this.state.errorText;let a;if(t&&(e=o.a.createElement("div",{className:"mx_Login_error"},t)),!this.state.serverIsAlive){const e=c()({mx_Login_error:!0,mx_Login_serverError:!0,mx_Login_serverErrorNonFatal:!this.state.serverErrorIsFatal});a=o.a.createElement("div",{className:e},this.state.serverDeadError)}const n=o.a.createElement("span",{className:"mx_AuthBody_changeFlow"},Object(u.a)("Already have an account? <a>Sign in here</a>",{},{a:e=>o.a.createElement(w.a,{kind:"link_inline",onClick:this.onLoginClick},e)}));let i,s;if(this.state.doingUIAuth&&(i=o.a.createElement(w.a,{kind:"link",className:"mx_AuthBody_changeFlow",onClick:this.onGoToFormClicked},Object(u.a)("Go back"))),this.state.completedNoSignin){let e;e=this.state.differentLoggedInUserId?o.a.createElement("div",null,o.a.createElement("p",null,Object(u.a)("Your new account (%(newAccountId)s) is registered, but you're already logged into a different account (%(loggedInUserId)s).",{newAccountId:this.state.registeredUsername,loggedInUserId:this.state.differentLoggedInUserId})),o.a.createElement("p",null,o.a.createElement(w.a,{kind:"link_inline",onClick:async e=>{await this.onLoginClickWithCheck(e)&&y.a.dispatch({action:"view_welcome_page"})}},Object(u.a)("Continue with previous account")))):o.a.createElement("h2",null,Object(u.a)("<a>Log in</a> to your new account.",{},{a:e=>o.a.createElement(w.a,{kind:"link_inline",onClick:async e=>{await this.onLoginClickWithCheck(e)&&y.a.dispatch({action:"view_home_page"})}},e)})),s=o.a.createElement("div",null,o.a.createElement("h1",null,Object(u.a)("Registration Successful")),e)}else s=o.a.createElement(r.Fragment,null,o.a.createElement("div",{className:"mx_Register_mainContent"},o.a.createElement(R,{title:Object(u.a)("Create account"),serverPicker:o.a.createElement(_.a,{title:Object(u.a)("Host account on"),dialogTitle:Object(u.a)("Decide where your account is hosted"),serverConfig:this.props.serverConfig,onServerConfigChange:this.state.doingUIAuth?void 0:this.props.onServerConfigChange})},e,a),this.renderRegisterComponent()),o.a.createElement("div",{className:"mx_Register_footerActions"},i,n));return o.a.createElement(b.a,null,o.a.createElement(C.a,null),o.a.createElement(I.b,null,o.a.createElement(O.a,{flex:!0},s)))}}},1584:function(e,t,a){"use strict";a.d(t,"a",(function(){return B}));var n=a(13),i=a.n(n),s=a(120),r=a.n(s),o=a(193),l=a(126),c=a.n(l),d=a(1),m=a(342),u=a(121),h=a(468),p=a(131),g=a(382),v=a(345),b=a(319),f=a(157),y=a(125),E=a(156),_=a(123),S=a(200),w=a(139),O=a(641),C=a(476);let x,k,j;const R=/^[0-9()\-\s]*$/;var I;!function(e){e.Email="login_field_email",e.MatrixId="login_field_mxid",e.Phone="login_field_phone",e.Password="login_field_phone"}(I||(I={})),x=I.Email,k=I.Phone,j=I.MatrixId;class T extends r.a.PureComponent{constructor(e){super(e),i()(this,x,void 0),i()(this,k,void 0),i()(this,j,void 0),i()(this,"onForgotPasswordClick",(e=>{e.preventDefault(),e.stopPropagation(),this.props.onForgotPasswordClick()})),i()(this,"onSubmitForm",(async e=>{e.preventDefault();if(await this.verifyFieldsBeforeSubmit())switch(this.state.loginType){case I.Email:case I.MatrixId:this.props.onSubmit(this.props.username,void 0,void 0,this.state.password);break;case I.Phone:this.props.onSubmit(void 0,this.props.phoneCountry,this.props.phoneNumber,this.state.password)}})),i()(this,"onUsernameChanged",(e=>{this.props.onUsernameChanged(e.target.value)})),i()(this,"onUsernameBlur",(e=>{this.props.onUsernameBlur(e.target.value)})),i()(this,"onLoginTypeChange",(e=>{const t=e.target.value;this.setState({loginType:t}),this.props.onUsernameChanged("")})),i()(this,"onPhoneCountryChanged",(e=>{this.props.onPhoneCountryChanged(e.iso2)})),i()(this,"onPhoneNumberChanged",(e=>{this.props.onPhoneNumberChanged(e.target.value)})),i()(this,"onPasswordChanged",(e=>{this.setState({password:e.target.value})})),i()(this,"validateUsernameRules",Object(S.a)({rules:[{key:"required",test(e){let{value:t,allowEmpty:a}=e;return a||!!t},invalid:()=>Object(u.a)("Enter username")}]})),i()(this,"onUsernameValidate",(async e=>{const t=await this.validateUsernameRules(e);return this.markFieldValid(I.MatrixId,t.valid),t})),i()(this,"onEmailValidate",(e=>{this.markFieldValid(I.Email,e.valid)})),i()(this,"validatePhoneNumberRules",Object(S.a)({rules:[{key:"required",test(e){let{value:t,allowEmpty:a}=e;return a||!!t},invalid:()=>Object(u.a)("Enter phone number")},{key:"number",test:e=>{let{value:t}=e;return!t||R.test(t)},invalid:()=>Object(u.a)("That phone number doesn't look quite right, please check and try again")}]})),i()(this,"onPhoneNumberValidate",(async e=>{const t=await this.validatePhoneNumberRules(e);return this.markFieldValid(I.Password,t.valid),t})),i()(this,"validatePasswordRules",Object(S.a)({rules:[{key:"required",test(e){let{value:t,allowEmpty:a}=e;return a||!!t},invalid:()=>Object(u.a)("Enter password")}]})),i()(this,"onPasswordValidate",(async e=>{const t=await this.validatePasswordRules(e);return this.markFieldValid(I.Password,t.valid),t})),this.state={fieldValid:{},loginType:I.MatrixId,password:""}}async verifyFieldsBeforeSubmit(){const e=document.activeElement;e&&e.blur();const t=[this.state.loginType,I.Password];for(const e of t){const t=this[e];t&&await t.validate({allowEmpty:!1})}if(await new Promise((e=>this.setState({},e))),this.allFieldsValid())return!0;const a=this.findFirstInvalidField(t);return!a||(a.focus(),a.validate({allowEmpty:!1,focused:!0}),!1)}allFieldsValid(){return Object.values(this.state.fieldValid).every(Boolean)}findFirstInvalidField(e){for(const t of e)if(!this.state.fieldValid[t]&&this[t])return this[t];return null}markFieldValid(e,t){const{fieldValid:a}=this.state;a[e]=t,this.setState({fieldValid:a})}renderLoginField(e,t){const a={error:!1};switch(e){case I.Email:return a.error=this.props.loginIncorrect&&!this.props.username,r.a.createElement(C.a,{id:"mx_LoginForm_email",className:c()(a),name:"username",autoComplete:"email",type:"email",key:"email_input",placeholder:"joe@example.com",value:this.props.username,onChange:this.onUsernameChanged,onBlur:this.onUsernameBlur,disabled:this.props.busy,autoFocus:t,onValidate:this.onEmailValidate,fieldRef:e=>{this[I.Email]=e}});case I.MatrixId:return a.error=this.props.loginIncorrect&&!this.props.username,r.a.createElement(w.a,{id:"mx_LoginForm_username",className:c()(a),name:"username",autoComplete:"username",key:"username_input",type:"text",label:Object(u.a)("Username"),placeholder:Object(u.a)("Username").toLocaleLowerCase(),value:this.props.username,onChange:this.onUsernameChanged,onBlur:this.onUsernameBlur,disabled:this.props.busy,autoFocus:t,onValidate:this.onUsernameValidate,ref:e=>{this[I.MatrixId]=e}});case I.Phone:{a.error=this.props.loginIncorrect&&!this.props.phoneNumber;const e=r.a.createElement(O.a,{value:this.props.phoneCountry,isSmall:!0,showPrefix:!0,onOptionChange:this.onPhoneCountryChanged});return r.a.createElement(w.a,{id:"mx_LoginForm_phone",className:c()(a),name:"phoneNumber",autoComplete:"tel-national",key:"phone_input",type:"text",label:Object(u.a)("Phone"),value:this.props.phoneNumber,prefixComponent:e,onChange:this.onPhoneNumberChanged,disabled:this.props.busy,autoFocus:t,onValidate:this.onPhoneNumberValidate,ref:e=>{this[I.Password]=e}})}}}isLoginEmpty(){switch(this.state.loginType){case I.Email:case I.MatrixId:return!this.props.username;case I.Phone:return!this.props.phoneCountry||!this.props.phoneNumber}}render(){let e;this.props.onForgotPasswordClick&&(e=r.a.createElement(_.a,{className:"mx_Login_forgot",disabled:this.props.busy,kind:"link",onClick:this.onForgotPasswordClick},Object(u.a)("Forgot password?")));const t=c()({error:this.props.loginIncorrect&&!this.isLoginEmpty()}),a=!this.isLoginEmpty(),n=this.renderLoginField(this.state.loginType,!a);let i;return p.b.get().disable_3pid_login||(i=r.a.createElement("div",{className:"mx_Login_type_container"},r.a.createElement("label",{className:"mx_Login_type_label"},Object(u.a)("Sign in with")),r.a.createElement(w.a,{element:"select",value:this.state.loginType,onChange:this.onLoginTypeChange,disabled:this.props.busy},r.a.createElement("option",{key:I.MatrixId,value:I.MatrixId},Object(u.a)("Username")),r.a.createElement("option",{key:I.Email,value:I.Email},Object(u.a)("Email address")),r.a.createElement("option",{key:I.Password,value:I.Password},Object(u.a)("Phone"))))),r.a.createElement("div",null,r.a.createElement("form",{onSubmit:this.onSubmitForm},i,n,r.a.createElement(w.a,{id:"mx_LoginForm_password",className:t,autoComplete:"current-password",type:"password",name:"password",label:Object(u.a)("Password"),value:this.state.password,onChange:this.onPasswordChanged,disabled:this.props.busy,autoFocus:a,onValidate:this.onPasswordValidate,ref:e=>this[I.Password]=e}),e,!this.props.busy&&r.a.createElement("input",{className:"mx_Login_submit",type:"submit",value:Object(u.a)("Sign in"),disabled:this.props.disableSubmit})))}}i()(T,"defaultProps",{onUsernameChanged:function(){},onUsernameBlur:function(){},onPhoneCountryChanged:function(){},onPhoneNumberChanged:function(){},loginIncorrect:!1,disableSubmit:!1});var N=a(206),D=a(134),P=a(643),M=a(941),A=a(478),L=a(477);function U(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function F(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?U(Object(a),!0).forEach((function(t){i()(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):U(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}Object(u.c)("Invalid homeserver discovery response"),Object(u.c)("Failed to get autodiscovery configuration from server"),Object(u.c)("Invalid base_url for m.homeserver"),Object(u.c)("Homeserver URL does not appear to be a valid Matrix homeserver"),Object(u.c)("Invalid identity server discovery response"),Object(u.c)("Invalid base_url for m.identity_server"),Object(u.c)("Identity server URL does not appear to be a valid identity server"),Object(u.c)("General failure");class B extends r.a.PureComponent{constructor(e){super(e),i()(this,"unmounted",!1),i()(this,"loginLogic",void 0),i()(this,"stepRendererMap",void 0),i()(this,"isBusy",(()=>this.state.busy||this.props.busy)),i()(this,"onPasswordLogin",(async(e,t,a,n)=>{if(!this.state.serverIsAlive){this.setState({busy:!0});let e=!0;try{await v.a.validateServerConfigWithStaticUrls(this.props.serverConfig.hsUrl,this.props.serverConfig.isUrl),this.setState({serverIsAlive:!0,errorText:""})}catch(t){const a=v.a.authComponentStateForError(t);this.setState(F({busy:!1,busyLoggingIn:!1},a)),e=!a.serverErrorIsFatal}if(!e)return}this.setState({busy:!0,busyLoggingIn:!0,errorText:null,loginIncorrect:!1}),this.loginLogic.loginViaPassword(e,t,a,n).then((e=>{this.setState({serverIsAlive:!0}),this.props.onLoggedIn(e,n)}),(t=>{if(this.unmounted)return;let a;const n=(null==e?void 0:e.indexOf("@"))>0;if(400===t.httpStatus&&n)a=Object(u.a)("This homeserver does not support login using email address.");else if("M_RESOURCE_LIMIT_EXCEEDED"===t.errcode){const e=Object(g.a)(t.data.limit_type,t.data.admin_contact,{monthly_active_user:Object(u.c)("This homeserver has hit its Monthly Active User limit."),hs_blocked:Object(u.c)("This homeserver has been blocked by its administrator."),"":Object(u.c)("This homeserver has exceeded one of its resource limits.")}),n=Object(g.a)(t.data.limit_type,t.data.admin_contact,{"":Object(u.c)("Please <a>contact your service administrator</a> to continue using this service.")});a=r.a.createElement("div",null,r.a.createElement("div",null,e),r.a.createElement("div",{className:"mx_Login_smallError"},n))}else a=401===t.httpStatus||403===t.httpStatus?"M_USER_DEACTIVATED"===t.errcode?Object(u.a)("This account has been deactivated."):p.b.get("disable_custom_urls")?r.a.createElement("div",null,r.a.createElement("div",null,Object(u.a)("Incorrect username and/or password.")),r.a.createElement("div",{className:"mx_Login_smallError"},Object(u.a)("Please note you are logging into the %(hs)s server, not matrix.org.",{hs:this.props.serverConfig.hsName}))):Object(u.a)("Incorrect username and/or password."):this.errorTextFromError(t);this.setState({busy:!1,busyLoggingIn:!1,errorText:a,loginIncorrect:401===t.httpStatus||403===t.httpStatus})}))})),i()(this,"onUsernameChanged",(e=>{this.setState({username:e})})),i()(this,"onUsernameBlur",(async e=>{const t="@"===e[0];if(this.setState({username:e,busy:t,errorText:null,canTryLogin:!0}),t){const t=e.split(":").slice(1).join(":");try{const e=await v.a.validateServerName(t);this.props.onServerConfigChange(e),this.setState({busy:!1})}catch(e){d.a.error("Problem parsing URL or unhandled error doing .well-known discovery:",e);let t=Object(u.a)("Failed to perform homeserver discovery");e.translatedMessage&&(t=e.translatedMessage);let a=t,n={};v.a.isLivelinessError(e)&&(a=this.state.errorText,n=v.a.authComponentStateForError(e)),this.setState(F({busy:!1,errorText:a},n))}}})),i()(this,"onPhoneCountryChanged",(e=>{this.setState({phoneCountry:e})})),i()(this,"onPhoneNumberChanged",(e=>{this.setState({phoneNumber:e})})),i()(this,"onRegisterClick",(e=>{e.preventDefault(),e.stopPropagation(),this.props.onRegisterClick()})),i()(this,"onTryRegisterClick",(e=>{var t,a;const n=null===(t=this.state.flows)||void 0===t?void 0:t.find((e=>"m.login.password"===e.type)),i=null===(a=this.state.flows)||void 0===a?void 0:a.find((e=>"m.login.sso"===e.type||"m.login.cas"===e.type));if(i&&!n){e.preventDefault(),e.stopPropagation();const t="m.login.sso"===i.type?"sso":"cas";f.a.get().startSingleSignOn(this.loginLogic.createTemporaryClient(),t,this.props.fragmentAfterLogin,m.c.REGISTER)}else this.onRegisterClick(e)})),i()(this,"isSupportedFlow",(e=>!!this.stepRendererMap[e.type]||(d.a.log("Skipping flow",e,"due to unsupported login type",e.type),!1))),i()(this,"renderPasswordStep",(()=>r.a.createElement(T,{onSubmit:this.onPasswordLogin,username:this.state.username,phoneCountry:this.state.phoneCountry,phoneNumber:this.state.phoneNumber,onUsernameChanged:this.onUsernameChanged,onUsernameBlur:this.onUsernameBlur,onPhoneCountryChanged:this.onPhoneCountryChanged,onPhoneNumberChanged:this.onPhoneNumberChanged,onForgotPasswordClick:this.props.onForgotPasswordClick,loginIncorrect:this.state.loginIncorrect,serverConfig:this.props.serverConfig,disableSubmit:this.isBusy(),busy:this.props.isSyncing||this.state.busyLoggingIn}))),i()(this,"renderSsoStep",(e=>{const t=this.state.flows.find((t=>t.type==="m.login."+e));return r.a.createElement(P.a,{matrixClient:this.loginLogic.createTemporaryClient(),flow:t,loginType:e,fragmentAfterLogin:this.props.fragmentAfterLogin,primary:!this.state.flows.find((e=>"m.login.password"===e.type)),action:m.c.LOGIN})})),this.state={busy:!1,busyLoggingIn:null,errorText:null,loginIncorrect:!1,canTryLogin:!0,flows:null,username:e.defaultUsername?e.defaultUsername:"",phoneCountry:null,phoneNumber:"",serverIsAlive:!0,serverErrorIsFatal:!1,serverDeadError:""},this.stepRendererMap={"m.login.password":this.renderPasswordStep,"m.login.cas":()=>this.renderSsoStep("cas"),"m.login.sso":()=>this.renderSsoStep("sso")}}componentDidMount(){this.initLoginLogic(this.props.serverConfig)}componentWillUnmount(){this.unmounted=!0}componentDidUpdate(e){e.serverConfig.hsUrl===this.props.serverConfig.hsUrl&&e.serverConfig.isUrl===this.props.serverConfig.isUrl||this.initLoginLogic(this.props.serverConfig)}async initLoginLogic(e){let{hsUrl:t,isUrl:a}=e,n=!1;this.props.serverConfig.isDefault&&t===this.props.serverConfig.hsUrl&&a===this.props.serverConfig.isUrl&&(n=!0);const i=n?this.props.fallbackHsUrl:null,s=new h.a(t,a,i,{defaultDeviceDisplayName:this.props.defaultDeviceDisplayName});this.loginLogic=s,this.setState({busy:!0,loginIncorrect:!1});try{const{warning:e}=await v.a.validateServerConfigWithStaticUrls(t,a);e?this.setState(F(F({},v.a.authComponentStateForError(e)),{},{errorText:""})):this.setState({serverIsAlive:!0,errorText:""})}catch(e){this.setState(F({busy:!1},v.a.authComponentStateForError(e)))}s.getFlows().then((e=>{const t=e.filter(this.isSupportedFlow);t.length>0?this.setState({flows:t}):this.setState({errorText:Object(u.a)("This homeserver doesn't offer any login flows which are supported by this client.")})}),(e=>{this.setState({errorText:this.errorTextFromError(e),loginIncorrect:!1,canTryLogin:!1})})).finally((()=>{this.setState({busy:!1})}))}errorTextFromError(e){let t=e.errcode;!t&&e.httpStatus&&(t="HTTP "+e.httpStatus);let a=Object(u.a)("There was a problem communicating with the homeserver, please try again later.")+(t?" ("+t+")":"");return e instanceof o.b&&(a="https:"!==window.location.protocol||!this.props.serverConfig.hsUrl.startsWith("http:")&&this.props.serverConfig.hsUrl.startsWith("http")?r.a.createElement("span",null,Object(u.a)("Can't connect to homeserver - please check your connectivity, ensure your <a>homeserver's SSL certificate</a> is trusted, and that a browser extension is not blocking requests.",{},{a:e=>r.a.createElement("a",{target:"_blank",rel:"noreferrer noopener",href:this.props.serverConfig.hsUrl},e)})):r.a.createElement("span",null,Object(u.a)("Can't connect to homeserver via HTTP when an HTTPS URL is in your browser bar. Either use HTTPS or <a>enable unsafe scripts</a>.",{},{a:e=>r.a.createElement("a",{target:"_blank",rel:"noreferrer noopener",href:"https://www.google.com/search?&q=enable%20unsafe%20scripts"},e)}))),a}renderLoginComponentForFlows(){if(!this.state.flows)return null;const e=["m.login.password","m.login.sso"].map((e=>this.state.flows.find((t=>t.type===e)))).filter(Boolean);return r.a.createElement(r.a.Fragment,null,e.map((e=>{const t=this.stepRendererMap[e.type];return r.a.createElement(r.a.Fragment,{key:e.type},t())})))}render(){const e=this.isBusy()&&!this.state.busyLoggingIn?r.a.createElement("div",{className:"mx_Login_loader"},r.a.createElement(D.a,null)):null,t=this.state.errorText;let a,n,i;if(t&&(a=r.a.createElement("div",{className:"mx_Login_error"},t)),!this.state.serverIsAlive){const e=c()({mx_Login_error:!0,mx_Login_serverError:!0,mx_Login_serverErrorNonFatal:!this.state.serverErrorIsFatal});n=r.a.createElement("div",{className:e},this.state.serverDeadError)}return this.props.isSyncing||this.state.busyLoggingIn?i=r.a.createElement("div",{className:"mx_AuthBody_paddedFooter"},r.a.createElement("div",{className:"mx_AuthBody_paddedFooter_title"},r.a.createElement(N.a,{w:20,h:20}),this.props.isSyncing?Object(u.a)("Syncing…"):Object(u.a)("Signing In…")),this.props.isSyncing&&r.a.createElement("div",{className:"mx_AuthBody_paddedFooter_subtitle"},Object(u.a)("If you've joined lots of rooms, this might take a while"))):y.b.getValue(E.b.Registration)&&(i=r.a.createElement("span",{className:"mx_AuthBody_changeFlow"},Object(u.a)("New? <a>Create account</a>",{},{a:e=>r.a.createElement(_.a,{kind:"link_inline",onClick:this.onTryRegisterClick},e)}))),r.a.createElement(b.a,null,r.a.createElement(L.a,{disableLanguageSelector:this.props.isSyncing||this.state.busyLoggingIn}),r.a.createElement(A.a,null,r.a.createElement("h1",null,Object(u.a)("Sign in"),e),a,n,r.a.createElement(M.a,{serverConfig:this.props.serverConfig,onServerConfigChange:this.props.onServerConfigChange}),this.renderLoginComponentForFlows(),i))}}},1585:function(e,t,a){"use strict";a.d(t,"b",(function(){return o})),a.d(t,"a",(function(){return r}));var n=a(13),i=a.n(n),s=a(1);let r;!function(e){e.APP_STARTUP="mx_AppStartup",e.PAGE_CHANGE="mx_PageChange",e.RESEND_EVENT="mx_ResendEvent",e.SEND_E2EE_EVENT="mx_SendE2EEEvent",e.SEND_ATTACHMENT="mx_SendAttachment",e.SWITCH_ROOM="mx_SwithRoom",e.JUMP_TO_ROOM="mx_JumpToRoom",e.JOIN_ROOM="mx_JoinRoom",e.CREATE_DM="mx_CreateDM",e.PEEK_ROOM="mx_PeekRoom",e.VERIFY_E2EE_USER="mx_VerifyE2EEUser",e.LOGIN="mx_Login",e.REGISTER="mx_Register",e.SETUP_VOIP_CALL="mx_SetupVoIPCall"}(r||(r={}));class o{constructor(){i()(this,"START_PREFIX","start:"),i()(this,"STOP_PREFIX","stop:"),i()(this,"listeners",[]),i()(this,"entries",[])}static get instance(){return o._instance||(o._instance=new o),o._instance}start(e,t){if(!this.supportsPerformanceApi())return;const a=this.buildKey(e,t);performance.getEntriesByName(this.START_PREFIX+a).length>0?s.a.warn(`Recording already started for: ${e}`):performance.mark(this.START_PREFIX+a)}stop(e,t){if(!this.supportsPerformanceApi())return;const a=this.buildKey(e,t);if(0===performance.getEntriesByName(this.START_PREFIX+a).length)return void s.a.warn(`No recording started for: ${e}`);performance.mark(this.STOP_PREFIX+a),performance.measure(a,this.START_PREFIX+a,this.STOP_PREFIX+a),this.clear(e,t);const n=performance.getEntriesByName(a).pop();return this.entries.push(n),this.listeners.forEach((e=>{this.shouldEmit(e,n)&&e.callback([n])})),n}clear(e,t){if(!this.supportsPerformanceApi())return;const a=this.buildKey(e,t);performance.clearMarks(this.START_PREFIX+a),performance.clearMarks(this.STOP_PREFIX+a)}getEntries(){let{name:e,type:t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.entries.filter((a=>{const n=!e||a.name===e,i=!t||a.entryType===t;return n&&i}))}addPerformanceDataCallback(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(this.listeners.push(e),t){const t=this.entries.filter((t=>this.shouldEmit(e,t)));t.length>0&&e.callback(t)}}removePerformanceDataCallback(e){e?this.listeners.splice(this.listeners.findIndex((t=>t.callback===e)),1):this.listeners=[]}supportsPerformanceApi(){return void 0!==performance&&void 0!==performance.mark}shouldEmit(e,t){return!e.entryNames||e.entryNames.includes(t.name)}buildKey(e,t){return`${e}${t?`:${t}`:""}`}}i()(o,"_instance",void 0),window.mxPerformanceMonitor=o.instance,window.mxPerformanceEntryNames=r},1586:function(e,t,a){"use strict";a.d(t,"a",(function(){return j}));var n=a(13),i=a.n(n),s=a(120),r=a.n(s),o=a(1),l=a(342),c=a(121),d=a(124),m=a(467),u=a(127),h=a(122),p=a(468),g=a(319),v=a(341),b=a(643),f=a(135),y=a(145);class E extends r.a.Component{constructor(){super(...arguments),i()(this,"onConfirm",(()=>{this.props.onFinished(!0)})),i()(this,"onDecline",(()=>{this.props.onFinished(!1)}))}render(){return r.a.createElement(f.a,{className:"mx_ConfirmWipeDeviceDialog",hasCancel:!0,onFinished:this.props.onFinished,title:Object(c.a)("Clear all data in this session?")},r.a.createElement("div",{className:"mx_ConfirmWipeDeviceDialog_content"},r.a.createElement("p",null,Object(c.a)("Clearing all data from this session is permanent. Encrypted messages will be lost unless their keys have been backed up."))),r.a.createElement(y.a,{primaryButton:Object(c.a)("Clear all data"),onPrimaryButtonClick:this.onConfirm,primaryButtonClass:"danger",cancelButton:Object(c.a)("Cancel"),onCancel:this.onDecline}))}}var _,S=a(139),w=a(123),O=a(134),C=a(477),x=a(478);!function(e){e[e.Loading=0]="Loading",e[e.Password=1]="Password",e[e.CAS=2]="CAS",e[e.SSO=3]="SSO",e[e.PasswordWithSocialSignOn=4]="PasswordWithSocialSignOn",e[e.Unsupported=5]="Unsupported"}(_||(_={}));const k={"m.login.password":_.Password,"m.login.cas":_.CAS,"m.login.sso":_.SSO};class j extends r.a.Component{constructor(e){super(e),i()(this,"onClearAll",(()=>{u.b.createDialog(E,{onFinished:e=>{e&&(o.a.log("Clearing data from soft-logged-out session"),m.i())}})})),i()(this,"onPasswordChange",(e=>{this.setState({password:e.target.value})})),i()(this,"onForgotPassword",(()=>{d.a.dispatch({action:"start_password_recovery"})})),i()(this,"onPasswordLogin",(async e=>{e.preventDefault(),e.stopPropagation(),this.setState({busy:!0});const t=h.a.get().getHomeserverUrl(),a=h.a.get().getIdentityServerUrl(),n={identifier:{type:"m.id.user",user:h.a.get().getUserId()},password:this.state.password,device_id:h.a.get().getDeviceId()};let i=null;try{i=await Object(p.b)(t,a,"m.login.password",n)}catch(e){let t=Object(c.a)("Failed to re-authenticate due to a homeserver problem");return"M_FORBIDDEN"!==e.errcode||401!==e.httpStatus&&403!==e.httpStatus||(t=Object(c.a)("Incorrect password")),void this.setState({busy:!1,errorText:t})}m.e(i).catch((e=>{o.a.error(e),this.setState({busy:!1,errorText:Object(c.a)("Failed to re-authenticate")})}))})),this.state={loginView:_.Loading,keyBackupNeeded:!0,busy:!1,password:"",errorText:"",flows:[]}}componentDidMount(){if(!m.g())return void d.a.dispatch({action:"start_login"});this.initLogin();const e=h.a.get();e.isCryptoEnabled()&&e.countSessionsNeedingBackup().then((e=>{this.setState({keyBackupNeeded:e>0})}))}async initLogin(){const e=this.props.realQueryParams;if(e&&e.loginToken)return this.setState({loginView:_.Loading}),void this.trySsoLogin();const t=h.a.get(),a=(await t.loginFlows()).flows,n=a.map((e=>k[e.type])),i=n.includes(_.Password)&&n.includes(_.SSO),s=n.filter((e=>!!e))[0]||_.Unsupported,r=i?_.PasswordWithSocialSignOn:s;this.setState({flows:a,loginView:r})}async trySsoLogin(){this.setState({busy:!0});const e=localStorage.getItem(v.a),t=localStorage.getItem(v.c)||h.a.get().getIdentityServerUrl(),a={token:this.props.realQueryParams.loginToken,device_id:h.a.get().getDeviceId()};let n=null;try{n=await Object(p.b)(e,t,"m.login.token",a)}catch(e){return o.a.error(e),void this.setState({busy:!1,loginView:_.Unsupported})}m.e(n).then((()=>{this.props.onTokenLoginCompleted&&this.props.onTokenLoginCompleted()})).catch((e=>{o.a.error(e),this.setState({busy:!1,loginView:_.Unsupported})}))}renderPasswordForm(e){let t=null;return this.state.errorText&&(t=r.a.createElement("span",{className:"mx_Login_error"},this.state.errorText)),r.a.createElement("form",{onSubmit:this.onPasswordLogin},e?r.a.createElement("p",null,e):null,t,r.a.createElement(S.a,{type:"password",label:Object(c.a)("Password"),onChange:this.onPasswordChange,value:this.state.password,disabled:this.state.busy}),r.a.createElement(w.a,{onClick:this.onPasswordLogin,kind:"primary",type:"submit",disabled:this.state.busy},Object(c.a)("Sign In")),r.a.createElement(w.a,{onClick:this.onForgotPassword,kind:"link"},Object(c.a)("Forgotten your password?")))}renderSsoForm(e){const t=this.state.loginView===_.CAS?"cas":"sso",a=this.state.flows.find((e=>e.type==="m.login."+t));return r.a.createElement("div",null,e?r.a.createElement("p",null,e):null,r.a.createElement(b.a,{matrixClient:h.a.get(),flow:a,loginType:t,fragmentAfterLogin:this.props.fragmentAfterLogin,primary:!this.state.flows.find((e=>"m.login.password"===e.type)),action:l.c.LOGIN}))}renderSignInSection(){if(this.state.loginView===_.Loading)return r.a.createElement(O.a,null);let e=null;return this.state.keyBackupNeeded&&(e=Object(c.a)("Regain access to your account and recover encryption keys stored in this session. Without them, you won't be able to read all of your secure messages in any session.")),this.state.loginView===_.Password?(e||(e=Object(c.a)("Enter your password to sign in and regain access to your account.")),this.renderPasswordForm(e)):this.state.loginView===_.SSO||this.state.loginView===_.CAS?(e||(e=Object(c.a)("Sign in and regain access to your account.")),this.renderSsoForm(e)):this.state.loginView===_.PasswordWithSocialSignOn?(e||(e=Object(c.a)("Sign in and regain access to your account.")),r.a.createElement(r.a.Fragment,null,r.a.createElement("p",null,e),this.renderSsoForm(null),r.a.createElement("h2",{className:"mx_AuthBody_centered"},Object(c.a)("%(ssoButtons)s Or %(usernamePassword)s",{ssoButtons:"",usernamePassword:""}).trim()),this.renderPasswordForm(null))):r.a.createElement("p",null,Object(c.a)("You cannot sign in to your account. Please contact your homeserver admin for more information."))}render(){return r.a.createElement(g.a,null,r.a.createElement(C.a,null),r.a.createElement(x.a,null,r.a.createElement("h1",null,Object(c.a)("You're signed out")),r.a.createElement("h2",null,Object(c.a)("Sign in")),r.a.createElement("div",null,this.renderSignInSection()),r.a.createElement("h2",null,Object(c.a)("Clear personal data")),r.a.createElement("p",null,Object(c.a)("Warning: your personal data (including encryption keys) is still stored in this session. Clear it if you're finished using this session, or want to sign in to another account.")),r.a.createElement("div",null,r.a.createElement(w.a,{onClick:this.onClearAll,kind:"danger"},Object(c.a)("Clear all data")))))}}},1589:function(e,t,a){"use strict";a.d(t,"a",(function(){return T}));var n=a(13),i=a.n(n),s=a(148),r=a(120),o=a.n(r),l=a(442),c=a(121),d=a(122),m=a(127),u=a(131),h=a(137),p=a(125),g=a(130),v=a.n(g),b=a(126),f=a.n(b),y=a(149);function E(e){let{label:t,description:a,onClick:n,isSelected:i,adornment:s}=e;return o.a.createElement(l.a,{active:i,className:"mx_GenericDropdownMenu_Option mx_GenericDropdownMenu_Option--item",onClick:n},o.a.createElement("div",{className:"mx_GenericDropdownMenu_Option--label"},o.a.createElement("span",null,t),o.a.createElement("span",null,a)),s)}function _(e){let{label:t,description:a,adornment:n,children:i}=e;return o.a.createElement(o.a.Fragment,null,o.a.createElement("div",{className:"mx_GenericDropdownMenu_Option mx_GenericDropdownMenu_Option--header"},o.a.createElement("div",{className:"mx_GenericDropdownMenu_Option--label"},o.a.createElement("span",null,t),o.a.createElement("span",null,a)),n),i)}function S(e){return"options"in e}function w(e){let{value:t,onChange:a,options:n,selectedLabel:i,onOpen:s,onClose:r,toKey:l,className:c,AdditionalOptions:d}=e;const[m,u,h,p]=Object(y.q)(),g=n.flatMap((e=>S(e)?[e,...e.options]:[e])).find((e=>l?l(e.key)===l(t):e.key===t));let b;b=n&&S(n[0])?o.a.createElement(o.a.Fragment,null,n.map((e=>{var t;return o.a.createElement(_,{key:null!==(t=null==l?void 0:l(e.key))&&void 0!==t?t:e.key,label:e.label,description:e.description,adornment:e.adornment},e.options.map((e=>{var t;return o.a.createElement(E,{key:null!==(t=null==l?void 0:l(e.key))&&void 0!==t?t:e.key,label:e.label,description:e.description,onClick:t=>{a(e.key),p(),null==r||r(t)},adornment:e.adornment,isSelected:e===g})})))}))):o.a.createElement(o.a.Fragment,null,n.map((e=>{var t;return o.a.createElement(E,{key:null!==(t=null==l?void 0:l(e.key))&&void 0!==t?t:e.key,label:e.label,description:e.description,onClick:t=>{a(e.key),p(),null==r||r(t)},adornment:e.adornment,isSelected:e===g})})));const w=m?o.a.createElement(y.n,v()({onFinished:p,chevronFace:y.a.Top,wrapperClassName:f()("mx_GenericDropdownMenu_wrapper",c)},Object(y.i)(u.current.getBoundingClientRect())),b,d&&o.a.createElement(d,{menuDisplayed:m,openMenu:h,closeMenu:p})):null;return o.a.createElement(o.a.Fragment,null,o.a.createElement(y.b,{className:"mx_GenericDropdownMenu_button",inputRef:u,isExpanded:m,onClick:e=>{h(),null==s||s(e)}},i(g)),w)}var O=a(559),C=a(123),x=a(200);function k(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}const j=Object(x.a)({deriveData:async e=>{let{value:t}=e;try{return await d.a.get().publicRooms({limit:1,server:t}),{}}catch(e){return{error:e}}},rules:[{key:"required",test:async e=>{let{value:t}=e;return!!t},invalid:()=>Object(c.a)("Enter a server name")},{key:"available",final:!0,test:async(e,t)=>{let{error:a}=t;return!a},valid:()=>Object(c.a)("Looks good"),invalid:e=>{let{error:t}=e;return"M_FORBIDDEN"===(null==t?void 0:t.errcode)?Object(c.a)("You are not allowed to view this server's rooms list"):Object(c.a)("Can't find this server or its room list")}}]});function R(e){for(var t=arguments.length,a=new Array(t>1?t-1:0),n=1;n<t;n++)a[n-1]=arguments[n];for(const t of a)e.delete(t)}function I(){var e,t;const[a,n]=function(e,t){let a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const[i,s]=Object(r.useState)(p.b.getValue(e,null!=a?a:void 0,n)),o=Object(r.useCallback)((async n=>{s(n),p.b.setValue(e,a,t,n)}),[t,a,e]);return Object(r.useEffect)((()=>{const t=p.b.watchSetting(e,a,(()=>{s(p.b.getValue(e,a,n))}));return()=>{p.b.unwatchSetting(t)}}),[e,a,n]),[i,o]}("room_directory_servers",h.a.ACCOUNT),i=d.a.getHomeserverName(),s=new Set(null!==(e=null===(t=u.b.getObject("room_directory"))||void 0===t?void 0:t.get("servers"))&&void 0!==e?e:[]);R(s,i);const o=new Set(a);return R(o,i),R(o,...s),{allServers:[i,...Array.from(s).sort(),...Array.from(o).sort()],homeServer:i,userDefinedServers:Array.from(o).sort(),setUserDefinedServers:n}}const T=e=>{let{protocols:t,config:a,setConfig:n}=e;const{allServers:d,homeServer:u,userDefinedServers:h,setUserDefinedServers:p}=I(),g=d.map((e=>function(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?k(Object(a),!0).forEach((function(t){i()(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):k(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}({key:{roomServer:e,instanceId:null},label:e,description:e===u?Object(c.a)("Your server"):null,options:[{key:{roomServer:e,instanceId:void 0},label:Object(c.a)("Matrix")},...e===u&&t?Object.values(t).flatMap((e=>e.instances)).map((t=>({key:{roomServer:e,instanceId:t.instance_id},label:t.desc}))):[]]},h.includes(e)?{adornment:o.a.createElement(C.a,{className:"mx_NetworkDropdown_removeServer",alt:Object(c.a)("Remove server “%(roomServer)s”",{roomServer:e}),onClick:()=>p(Object(s.without)(h,e))})}:{}))),v=Object(r.useCallback)((e=>{let{closeMenu:t}=e;return o.a.createElement(o.a.Fragment,null,o.a.createElement("span",{className:"mx_GenericDropdownMenu_divider"}),o.a.createElement(l.a,{active:!1,className:"mx_GenericDropdownMenu_Option mx_GenericDropdownMenu_Option--item",onClick:async()=>{t();const{finished:e}=m.b.createDialog(O.a,{title:Object(c.a)("Add a new server"),description:Object(c.a)("Enter the name of a new server you want to explore."),button:Object(c.a)("Add"),hasCancel:!1,placeholder:Object(c.a)("Server name"),validator:j,fixedWidth:!1},"mx_NetworkDropdown_dialog"),[a,i]=await e;a&&(d.includes(i)||(p([...h,i]),n({roomServer:i})))}},o.a.createElement("div",{className:"mx_GenericDropdownMenu_Option--label"},o.a.createElement("span",{className:"mx_NetworkDropdown_addServer"},Object(c.a)("Add new server…")))))}),[d,n,p,h]);return o.a.createElement(w,{className:"mx_NetworkDropdown_wrapper",value:a,toKey:e=>e?`${e.roomServer}-${e.instanceId}`:"null",options:g,onChange:e=>n(e),selectedLabel:e=>null!=e&&e.key?Object(c.a)("Show: %(instance)s rooms (%(server)s)",{server:e.key.roomServer,instance:e.key.instanceId?e.label:"Matrix"}):Object(c.a)("Show: Matrix rooms"),AdditionalOptions:v})}},281:function(e,t,a){"use strict";var n=a(120),i=a.n(n),s=a(141),r=a(140);t.a=e=>{let{room:t,children:a}=e;const[o,l]=Object(n.useState)(null==t?void 0:t.name);return Object(r.c)(t,s.d.Name,(()=>{l(null==t?void 0:t.name)})),Object(n.useEffect)((()=>{l(null==t?void 0:t.name)}),[t]),a?a(o):i.a.createElement(i.a.Fragment,null,o||"")}},313:function(e,t,a){"use strict";var n=a(172).default;t.__esModule=!0,t.default=t.ReactReduxContext=void 0;var i=n(a(120)).default.createContext(null);t.ReactReduxContext=i;var s=i;t.default=s},317:function(e,t,a){"use strict";var n=a(13),i=a.n(n),s=a(1),r=a(157),o=a(17),l=a(186),c=a(179),d=a(141),m=a(150),u=a(16),h=a(129),p=a(146),g=a(122),v=a(125),b=a(137);class f extends o.EventEmitter{constructor(){super(...arguments),i()(this,"crawlerCheckpoints",[]),i()(this,"crawler",null),i()(this,"currentCheckpoint",null),i()(this,"onSync",(async(e,t,a)=>{var n;const i=null===(n=r.a.get())||void 0===n?void 0:n.getEventIndexingManager();if("PREPARED"===t&&"SYNCING"===e){return await i.isEventIndexEmpty()&&await this.addInitialCheckpoints(),void this.startCrawler()}"SYNCING"===t&&"SYNCING"===e&&await i.commitLiveEvents()})),i()(this,"onRoomTimeline",(async(e,t,a,n,i)=>{if(!t)return;const s=g.a.get();return s.isRoomEncrypted(e.getRoomId())?e.isRedaction()?this.redactEvent(e):void(!a&&i&&i.liveEvent&&!e.isRedacted()&&(await s.decryptEventIfNeeded(e),await this.addLiveEventToIndex(e))):void 0})),i()(this,"onRoomStateEvent",(async(e,t)=>{g.a.get().isRoomEncrypted(t.roomId)&&(e.getType()!==h.b.RoomEncryption||await this.isRoomIndexed(t.roomId)||(s.a.log("EventIndex: Adding a checkpoint for a newly encrypted room",t.roomId),this.addRoomCheckpoint(t.roomId,!0)))})),i()(this,"redactEvent",(async e=>{var t;const a=null===(t=r.a.get())||void 0===t?void 0:t.getEventIndexingManager();try{await a.deleteEvent(e.getAssociatedId())}catch(e){s.a.log("EventIndex: Error deleting event from index",e)}})),i()(this,"onTimelineReset",(async e=>{e&&g.a.get().isRoomEncrypted(e.roomId)&&(s.a.log("EventIndex: Adding a checkpoint because of a limited timeline",e.roomId),this.addRoomCheckpoint(e.roomId,!1))}))}async init(){var e;const t=null===(e=r.a.get())||void 0===e?void 0:e.getEventIndexingManager();this.crawlerCheckpoints=await t.loadCheckpoints(),s.a.log("EventIndex: Loaded checkpoints",this.crawlerCheckpoints),this.registerListeners()}registerListeners(){const e=g.a.get();e.on(p.b.Sync,this.onSync),e.on(d.d.Timeline,this.onRoomTimeline),e.on(d.d.TimelineReset,this.onTimelineReset),e.on(m.b.Events,this.onRoomStateEvent)}removeListeners(){const e=g.a.get();null!==e&&(e.removeListener(p.b.Sync,this.onSync),e.removeListener(d.d.Timeline,this.onRoomTimeline),e.removeListener(d.d.TimelineReset,this.onTimelineReset),e.removeListener(m.b.Events,this.onRoomStateEvent))}async addInitialCheckpoints(){var e;const t=null===(e=r.a.get())||void 0===e?void 0:e.getEventIndexingManager(),a=g.a.get(),n=a.getRooms().filter((e=>a.isRoomEncrypted(e.roomId)));s.a.log("EventIndex: Adding initial crawler checkpoints"),await Promise.all(n.map((async e=>{const a=e.getLiveTimeline().getPaginationToken(c.a.Backward),n={roomId:e.roomId,token:a,direction:c.a.Backward,fullCrawl:!0},i={roomId:e.roomId,token:a,direction:c.a.Forward};try{n.token&&(await t.addCrawlerCheckpoint(n),this.crawlerCheckpoints.push(n)),i.token&&(await t.addCrawlerCheckpoint(i),this.crawlerCheckpoints.push(i))}catch(t){s.a.log("EventIndex: Error adding initial checkpoints for room",e.roomId,n,i,t)}})))}isValidEvent(e){const t=[h.b.RoomMessage,h.b.RoomName,h.b.RoomTopic].includes(e.getType())&&!e.isRedacted()&&!e.isDecryptionFailure();let a=!0,n=!0;if(e.getType()!==h.b.RoomMessage||e.isRedacted())e.getType()!==h.b.RoomTopic||e.isRedacted()?e.getType()!==h.b.RoomName||e.isRedacted()||e.getContent().name||(n=!1):e.getContent().topic||(n=!1);else{const t=e.getContent().msgtype;a=!!t&&!t.startsWith("m.key.verification"),e.getContent().body||(n=!1)}return t&&a&&n}eventToJson(e){const t=e.toJSON(),a=e.isEncrypted()?t.decrypted:t;return e.isEncrypted()?(a.curve25519Key=e.getSenderKey(),a.ed25519Key=e.getClaimedEd25519Key(),a.algorithm=e.getWireContent().algorithm,a.forwardingCurve25519KeyChain=e.getForwardingCurve25519KeyChain()):(delete a.curve25519Key,delete a.ed25519Key,delete a.algorithm,delete a.forwardingCurve25519KeyChain),a}async addLiveEventToIndex(e){var t,a,n;const i=null===(t=r.a.get())||void 0===t?void 0:t.getEventIndexingManager();if(!i||!this.isValidEvent(e))return;const s=this.eventToJson(e),o={displayname:null===(a=e.sender)||void 0===a?void 0:a.rawDisplayName,avatar_url:null===(n=e.sender)||void 0===n?void 0:n.getMxcAvatarUrl()};await i.addEventToIndex(s,o)}emitNewCheckpoint(){this.emit("changedCheckpoint",this.currentRoom())}async addEventsFromLiveTimeline(e){const t=e.getEvents();for(let e=0;e<t.length;e++){const a=t[e];await this.addLiveEventToIndex(a)}}async addRoomCheckpoint(e){var t;let a=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const n=null===(t=r.a.get())||void 0===t?void 0:t.getEventIndexingManager(),i=g.a.get().getRoom(e);if(!i)return;const o=i.getLiveTimeline(),l=o.getPaginationToken(c.a.Backward);if(!l)return void await this.addEventsFromLiveTimeline(o);const d={roomId:i.roomId,token:l,fullCrawl:a,direction:c.a.Backward};s.a.log("EventIndex: Adding checkpoint",d);try{await n.addCrawlerCheckpoint(d)}catch(e){s.a.log("EventIndex: Error adding new checkpoint for room",i.roomId,d,e)}this.crawlerCheckpoints.push(d)}async crawlerFunc(){var e;let t=!1;const a=g.a.get(),n=null===(e=r.a.get())||void 0===e?void 0:e.getEventIndexingManager();this.crawler={cancel:()=>{t=!0}};let i=!1;for(;!t;){let e=v.b.getValueAt(b.a.DEVICE,"crawlerSleepTime");if(e=Math.max(e,100),i&&(e=5e3),null!==this.currentCheckpoint&&(this.currentCheckpoint=null,this.emitNewCheckpoint()),await Object(u.J)(e),t)break;const r=this.crawlerCheckpoints.shift();if(void 0===r){i=!0;continue}this.currentCheckpoint=r,this.emitNewCheckpoint(),i=!1;const o=a.getEventMapper({preventReEmit:!0});let l;try{l=await a.createMessagesRequest(r.roomId,r.token,100,r.direction)}catch(e){if(403===e.httpStatus){s.a.log("EventIndex: Removing checkpoint as we don't have ","permissions to fetch messages from this room.",r);try{await n.removeCrawlerCheckpoint(r)}catch(e){s.a.log("EventIndex: Error removing checkpoint",r,e)}continue}s.a.log("EventIndex: Error crawling using checkpoint:",r,",",e),this.crawlerCheckpoints.push(r);continue}if(t){this.crawlerCheckpoints.push(r);break}if(0===l.chunk.length){s.a.log("EventIndex: Done with the checkpoint",r);try{await n.removeCrawlerCheckpoint(r)}catch(e){s.a.log("EventIndex: Error removing checkpoint",r,e)}continue}const c=l.chunk.map(o);let d=[];void 0!==l.state&&(d=l.state.map(o));const m={};d.forEach((e=>{e.event.content&&"join"===e.event.content.membership&&(m[e.event.sender]={displayname:e.event.content.displayname,avatar_url:e.event.content.avatar_url})}));const h=c.filter((e=>e.isEncrypted())).map((e=>a.decryptEventIfNeeded(e,{isRetry:!0,emit:!1})));await Promise.all(h);const p=c.filter(this.isValidEvent),g=c.filter((e=>e.isRedaction())),f=p.map((e=>{const t=this.eventToJson(e);let a={};t.sender in m&&(a=m[t.sender]);return{event:t,profile:a}}));let y;l.end&&(y={roomId:r.roomId,token:l.end,fullCrawl:r.fullCrawl,direction:r.direction});try{for(let e=0;e<g.length;e++){const t=g[e],a=t.getAssociatedId();a?await n.deleteEvent(a):s.a.warn("EventIndex: Redaction event doesn't contain a valid associated event id",t)}const e=await n.addHistoricEvents(f,y,r);if(!y){s.a.log("EventIndex: The server didn't return a valid ","new checkpoint, not continuing the crawl.",r);continue}!0===e&&!0!==y.fullCrawl?(s.a.log("EventIndex: Checkpoint had already all events","added, stopping the crawl",r),await n.removeCrawlerCheckpoint(y)):(!0===e&&s.a.log("EventIndex: Checkpoint had already all events","added, but continuing due to a full crawl",r),this.crawlerCheckpoints.push(y))}catch(e){s.a.log("EventIndex: Error during a crawl",e),this.crawlerCheckpoints.push(r)}}this.crawler=null}startCrawler(){null===this.crawler&&this.crawlerFunc()}stopCrawler(){null!==this.crawler&&this.crawler.cancel()}async close(){var e;const t=null===(e=r.a.get())||void 0===e?void 0:e.getEventIndexingManager();this.removeListeners(),this.stopCrawler(),await t.closeEventIndex()}async search(e){var t;return(null===(t=r.a.get())||void 0===t?void 0:t.getEventIndexingManager()).searchEventIndex(e)}async loadFileEvents(e){var t;let a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10,n=arguments.length>2?arguments[2]:void 0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:c.b.BACKWARDS;const o=g.a.get(),d=null===(t=r.a.get())||void 0===t?void 0:t.getEventIndexingManager(),m={roomId:e.roomId,limit:a};let u;n&&(m.fromEvent=n,m.direction=i);try{u=await d.loadFileEvents(m)}catch(e){return s.a.log("EventIndex: Error getting file events",e),[]}const p=o.getEventMapper();return u.map((t=>{const a=p(t.event),n=new l.a(e.roomId,a.getSender());n.name=t.profile.displayname+" ("+a.getSender()+")";const i=p({content:{membership:"join",avatar_url:t.profile.avatar_url,displayname:t.profile.displayname},type:h.b.RoomMember,event_id:a.getId()+":eventIndex",room_id:a.getRoomId(),sender:a.getSender(),origin_server_ts:a.getTs(),state_key:a.getSender()});return n.events.member=i,a.sender=n,a}))}async populateFileTimeline(e,t,a){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:10,i=arguments.length>4?arguments[4]:void 0,r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:c.b.BACKWARDS;const o=await this.loadFileEvents(a,n,i,r);null===i&&(o.reverse(),r=r==c.b.BACKWARDS?c.b.FORWARDS:c.b.BACKWARDS),o.forEach((a=>{e.eventIdToTimeline(a.getId())||e.addEventToTimeline(a,t,r==c.b.BACKWARDS)}));let l=!1,d="";return o.length>0&&(d=o[o.length-1].getId(),l=!0),s.a.log("EventIndex: Populating file panel with",o.length,"events and setting the pagination token to",d),t.setPaginationToken(d,c.b.BACKWARDS),l}paginateTimelineWindow(e,t,a,n){const i=t.getTimelineIndex(a);if(!i)return Promise.resolve(!1);if(i.pendingPaginate)return i.pendingPaginate;if(t.extend(a,n))return Promise.resolve(!0);const s=(async(e,t,a,n,i)=>{var s;const r=t.timeline,o=r.getTimelineSet(),l=null!==(s=r.getPaginationToken(n))&&void 0!==s?s:void 0,c=await this.populateFileTimeline(o,r,a,i,l,n);return t.pendingPaginate=void 0,e.extend(n,i),c})(t,i,e,a,n);return i.pendingPaginate=s,s}async getStats(){var e;const t=null===(e=r.a.get())||void 0===e?void 0:e.getEventIndexingManager();return null==t?void 0:t.getStats()}async isRoomIndexed(e){var t;const a=null===(t=r.a.get())||void 0===t?void 0:t.getEventIndexingManager();return null==a?void 0:a.isRoomIndexed(e)}currentRoom(){if(null===this.currentCheckpoint&&0===this.crawlerCheckpoints.length)return null;const e=g.a.get();return null!==this.currentCheckpoint?e.getRoom(this.currentCheckpoint.roomId):e.getRoom(this.crawlerCheckpoints[0].roomId)}crawlingRooms(){const e=new Set,t=new Set;this.crawlerCheckpoints.forEach(((e,a)=>{t.add(e.roomId)})),null!==this.currentCheckpoint&&t.add(this.currentCheckpoint.roomId);const a=g.a.get();return a.getRooms().filter((e=>a.isRoomEncrypted(e.roomId))).forEach(((t,a)=>{e.add(t.roomId)})),{crawlingRooms:t,totalRooms:e}}}class y{constructor(){i()(this,"index",null),i()(this,"error",null),i()(this,"_supportIsInstalled",!1)}async init(){var e;const t=null===(e=r.a.get())||void 0===e?void 0:e.getEventIndexingManager();return t?(this._supportIsInstalled=await t.supportsEventIndexing(),this.supportIsInstalled()?v.b.getValueAt(b.a.DEVICE,"enableEventIndexing")?this.initEventIndex():(s.a.log("EventIndex: Event indexing is disabled, not initializing"),!1):(s.a.log("EventIndex: Event indexing isn't installed for the platform, not initializing."),!1)):(s.a.log("EventIndex: Platform doesn't support event indexing, not initializing."),!1)}async initEventIndex(){var e;const t=new f,a=null===(e=r.a.get())||void 0===e?void 0:e.getEventIndexingManager(),n=g.a.get();if(!a||!n)throw new Error("Unable to init event index");const i=n.getUserId(),o=n.getDeviceId();try{await a.initEventIndex(i,o);const e=await a.getUserVersion(),n=await a.isEventIndexEmpty();n?await a.setUserVersion(1):0!==e||n||(await a.closeEventIndex(),await this.deleteEventIndex(),await a.initEventIndex(i,o),await a.setUserVersion(1)),s.a.log("EventIndex: Successfully initialized the event index"),await t.init()}catch(e){return s.a.log("EventIndex: Error initializing the event index",e),this.error=e,!1}return this.index=t,!0}platformHasSupport(){var e;return null!=(null===(e=r.a.get())||void 0===e?void 0:e.getEventIndexingManager())}supportIsInstalled(){return this._supportIsInstalled}get(){return this.index}start(){null!==this.index&&this.index.startCrawler()}stop(){null!==this.index&&this.index.stopCrawler()}async unset(){null!==this.index&&(await this.index.close(),this.index=null)}async deleteEventIndex(){var e;const t=null===(e=r.a.get())||void 0===e?void 0:e.getEventIndexingManager();t&&(await this.unset(),s.a.log("EventIndex: Deleting event index."),await t.deleteEventIndex())}}window.mxEventIndexPeg||(window.mxEventIndexPeg=new y);t.a=window.mxEventIndexPeg},32:function(e,t,a){"use strict";let n;a.d(t,"a",(function(){return n})),function(e){e.CanChangeViewedRoom="io.element.view_room",e.RequiresClient="io.element.requires_client"}(n||(n={}))},342:function(e,t,a){"use strict";a.d(t,"a",(function(){return n})),a.d(t,"b",(function(){return i})),a.d(t,"c",(function(){return s}));const n=new(a(15).c)("delegated_oidc_compatibility","org.matrix.msc3824.delegated_oidc_compatibility");let i,s;!function(e){e.Gitlab="gitlab",e.Github="github",e.Apple="apple",e.Google="google",e.Facebook="facebook",e.Twitter="twitter"}(i||(i={})),function(e){e.LOGIN="login",e.REGISTER="register"}(s||(s={}))},343:function(e,t,a){"use strict";var n=a(13),i=a.n(n),s=a(120),r=a.n(s),o=a(126),l=a.n(o),c=a(131),d=a(200),m=a(121),u=a(139);class h extends s.PureComponent{constructor(){super(...arguments),i()(this,"validate",Object(d.a)({description:function(e){const t=e?e.score:0;return r.a.createElement("progress",{className:"mx_PassphraseField_progress",max:4,value:t})},deriveData:async e=>{let{value:t}=e;if(!t)return null;const{scorePassword:n}=await a.e(31).then(a.bind(null,925));return n(t)},rules:[{key:"required",test:e=>{let{value:t,allowEmpty:a}=e;return a||!!t},invalid:()=>Object(m.a)(this.props.labelEnterPassword)},{key:"complexity",test:async function(e,t){let{value:a}=e;if(!a)return!1;const n=t.score>=this.props.minScore;return c.b.get("dangerously_allow_unsafe_and_insecure_passwords")||n},valid:function(e){return e.score>=this.props.minScore?Object(m.a)(this.props.labelStrongPassword):Object(m.a)(this.props.labelAllowedButUnsafe)},invalid:function(e){if(!e)return null;const{feedback:t}=e;return t.warning||t.suggestions[0]||Object(m.a)("Keep going…")}}]})),i()(this,"onValidate",(async e=>{const t=await this.validate(e);return this.props.onValidate&&this.props.onValidate(t),t}))}render(){return r.a.createElement(u.a,{id:this.props.id,autoFocus:this.props.autoFocus,className:l()("mx_PassphraseField",this.props.className),ref:this.props.fieldRef,type:"password",autoComplete:"new-password",label:Object(m.a)(this.props.label),value:this.props.value,onChange:this.props.onChange,onValidate:this.onValidate})}}i()(h,"defaultProps",{label:Object(m.c)("Password"),labelEnterPassword:Object(m.c)("Enter password"),labelStrongPassword:Object(m.c)("Nice, strong password!"),labelAllowedButUnsafe:Object(m.c)("Password is allowed, but unsafe")}),t.a=h},345:function(e,t,a){"use strict";a.d(t,"a",(function(){return h}));var n=a(120),i=a.n(n),s=a(321),r=a(1),o=a(121);var l=a(131),c=a(13),d=a.n(c);class m{constructor(){d()(this,"hsUrl",void 0),d()(this,"hsName",void 0),d()(this,"hsNameIsDifferent",void 0),d()(this,"isUrl",void 0),d()(this,"isDefault",void 0),d()(this,"isNameResolvable",void 0),d()(this,"warning",void 0)}}const u=[s.a.ERROR_INVALID_HOMESERVER,s.a.ERROR_INVALID_IDENTITY_SERVER];class h{static isLivelinessError(e){return!!e&&!!u.find((t=>"string"==typeof e?t===e:t===e.message))}static authComponentStateForError(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"login";if(!e)return{serverIsAlive:!0,serverErrorIsFatal:!1,serverDeadError:null};let a=Object(o.a)("Cannot reach homeserver"),n=Object(o.a)("Ensure you have a stable internet connection, or get in touch with the server admin");if(!h.isLivelinessError(e)){const e=l.b.get().brand;a=Object(o.a)("Your %(brand)s is misconfigured",{brand:e}),n=Object(o.a)("Ask your %(brand)s admin to check <a>your config</a> for incorrect or duplicate entries.",{brand:e},{a:e=>i.a.createElement("a",{href:"https://github.com/vector-im/element-web/blob/master/docs/config.md",target:"_blank",rel:"noreferrer noopener"},e)})}let r=!0;return("string"==typeof e?e:e.message)===s.a.ERROR_INVALID_IDENTITY_SERVER&&(r=!1,a=Object(o.a)("Cannot reach identity server"),n="register"===t?Object(o.a)("You can register, but some features will be unavailable until the identity server is back online. If you keep seeing this warning, check your configuration or contact a server admin."):"reset_password"===t?Object(o.a)("You can reset your password, but some features will be unavailable until the identity server is back online. If you keep seeing this warning, check your configuration or contact a server admin."):Object(o.a)("You can log in, but some features will be unavailable until the identity server is back online. If you keep seeing this warning, check your configuration or contact a server admin.")),{serverIsAlive:!1,serverErrorIsFatal:r,serverDeadError:i.a.createElement("div",null,i.a.createElement("strong",null,a),i.a.createElement("div",null,n))}}static async validateServerConfigWithStaticUrls(e,t){let a=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!e)throw Object(o.i)(Object(o.c)("No homeserver URL provided"));const n={"m.homeserver":{base_url:e}};t&&(n["m.identity_server"]={base_url:t});const i=await s.a.fromDiscoveryConfig(n),r=new URL(e).hostname;return h.buildValidatedConfigFromDiscovery(r,i,a,!0)}static async validateServerName(e){const t=await s.a.findClientConfig(e);return h.buildValidatedConfigFromDiscovery(e,t)}static buildValidatedConfigFromDiscovery(e,t){let a=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(!t||!t["m.homeserver"])throw r.a.error("Ended up in a state of not knowing which homeserver to connect to."),Object(o.i)(Object(o.c)("Unexpected error resolving homeserver configuration"));const i=t["m.homeserver"],c=t["m.identity_server"],d=l.b.get("validated_server_config");let u=d&&d.isUrl;if(c&&c.state===s.a.SUCCESS)u=c.base_url;else if(c&&c.state!==s.a.PROMPT){if(r.a.error("Error determining preferred identity server URL:",c),c.state===s.a.FAIL_ERROR){if(-1!==s.a.ALL_ERRORS.indexOf(c.error))throw Object(o.i)(c.error);throw Object(o.i)(Object(o.c)("Unexpected error resolving identity server configuration"))}i.error=s.a.ERROR_INVALID_IDENTITY_SERVER,c.base_url&&(u=c.base_url)}if(i.state!==s.a.SUCCESS&&(r.a.error("Error processing homeserver config:",i),!a||!h.isLivelinessError(i.error))){if(-1!==s.a.ALL_ERRORS.indexOf(i.error))throw Object(o.i)(i.error);throw Object(o.i)(Object(o.c)("Unexpected error resolving homeserver configuration"))}const p=i.base_url;let g=e||i.server_name;const v=new URL(p);if(g||(g=v.hostname),!g)throw r.a.error("Failed to parse homeserver name from homeserver URL"),Object(o.i)(Object(o.c)("Unexpected error resolving homeserver configuration"));return function(e,t){const a=new e;return Object.assign(a,t),a}(m,{hsUrl:p,hsName:g,hsNameIsDifferent:v.hostname!==g,isUrl:u,isDefault:!1,warning:i.error,isNameResolvable:!n})}}},396:function(e,t,a){"use strict";a.d(t,"a",(function(){return u}));var n=a(13),i=a.n(n),s=a(120),r=a.n(s),o=a(873),l=a(135),c=a(121),d=a(470);function m(e){return e===d.a.Done?a(1455).default:a(877).default}class u extends r.a.Component{constructor(e){super(e),i()(this,"store",void 0),i()(this,"onStoreUpdate",(()=>{this.setState({icon:m(this.store.phase)})})),this.store=d.b.sharedInstance(),this.state={icon:m(this.store.phase)}}componentDidMount(){this.store.on("update",this.onStoreUpdate)}componentWillUnmount(){this.store.removeListener("update",this.onStoreUpdate)}render(){return r.a.createElement(l.a,{headerImage:this.state.icon,onFinished:this.props.onFinished,title:Object(c.a)("Verify this session")},r.a.createElement(o.a,{onFinished:this.props.onFinished}))}}},397:function(e,t,a){(function(a){var n,i,s;i=[],n=function(){"use strict";function t(e,t){return void 0===t?t={autoBom:!1}:"object"!=typeof t&&(console.warn("Deprecated: Expected third argument to be a object"),t={autoBom:!t}),t.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob(["\ufeff",e],{type:e.type}):e}function n(e,t,a){var n=new XMLHttpRequest;n.open("GET",e),n.responseType="blob",n.onload=function(){l(n.response,t,a)},n.onerror=function(){console.error("could not download file")},n.send()}function i(e){var t=new XMLHttpRequest;t.open("HEAD",e,!1);try{t.send()}catch(e){}return 200<=t.status&&299>=t.status}function s(e){try{e.dispatchEvent(new MouseEvent("click"))}catch(a){var t=document.createEvent("MouseEvents");t.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),e.dispatchEvent(t)}}var r="object"==typeof window&&window.window===window?window:"object"==typeof self&&self.self===self?self:"object"==typeof a&&a.global===a?a:void 0,o=r.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),l=r.saveAs||("object"!=typeof window||window!==r?function(){}:"download"in HTMLAnchorElement.prototype&&!o?function(e,t,a){var o=r.URL||r.webkitURL,l=document.createElement("a");t=t||e.name||"download",l.download=t,l.rel="noopener","string"==typeof e?(l.href=e,l.origin===location.origin?s(l):i(l.href)?n(e,t,a):s(l,l.target="_blank")):(l.href=o.createObjectURL(e),setTimeout((function(){o.revokeObjectURL(l.href)}),4e4),setTimeout((function(){s(l)}),0))}:"msSaveOrOpenBlob"in navigator?function(e,a,r){if(a=a||e.name||"download","string"!=typeof e)navigator.msSaveOrOpenBlob(t(e,r),a);else if(i(e))n(e,a,r);else{var o=document.createElement("a");o.href=e,o.target="_blank",setTimeout((function(){s(o)}))}}:function(e,t,a,i){if((i=i||open("","_blank"))&&(i.document.title=i.document.body.innerText="downloading..."),"string"==typeof e)return n(e,t,a);var s="application/octet-stream"===e.type,l=/constructor/i.test(r.HTMLElement)||r.safari,c=/CriOS\/[\d]+/.test(navigator.userAgent);if((c||s&&l||o)&&"undefined"!=typeof FileReader){var d=new FileReader;d.onloadend=function(){var e=d.result;e=c?e:e.replace(/^data:[^;]*;/,"data:attachment/file;"),i?i.location.href=e:location=e,i=null},d.readAsDataURL(e)}else{var m=r.URL||r.webkitURL,u=m.createObjectURL(e);i?i.location=u:location.href=u,i=null,setTimeout((function(){m.revokeObjectURL(u)}),4e4)}});r.saveAs=l.saveAs=l,e.exports=l},void 0===(s="function"==typeof n?n.apply(t,i):n)||(e.exports=s)}).call(this,a(14))},400:function(e,t,a){"use strict";var n=a(130),i=a.n(n),s=a(13),r=a.n(s),o=a(120),l=a.n(o),c=a(126),d=a.n(c),m=a(129),u=a(143),h=a(170),p=a(1),g=a(141),v=a(188),b=a(175),f=a(121),y=a(124),E=a(167),_=a(125),S=a(210),w=a(128),O=a(134),C=a(951),x=a(550),k=a(123),j=a(225),R=a(138),I=a(122);class T extends l.a.Component{constructor(e,t){super(e,t),r()(this,"context",void 0),r()(this,"unmounted",!1),r()(this,"room",void 0),r()(this,"blockquoteRef",l.a.createRef()),r()(this,"canCollapse",(()=>this.state.events.length>1)),r()(this,"collapse",(()=>{this.initialize()})),r()(this,"onQuoteClick",(async e=>{const t=[this.state.loadedEv,...this.state.events];let a=null;t.length>0&&(a=await this.getNextEvent(t[0])),this.setState({loadedEv:a,events:t}),y.a.fire(w.a.FocusSendMessageComposer)})),this.state={events:[],loadedEv:null,loading:!0,err:!1},this.room=this.matrixClient.getRoom(this.props.parentEv.getRoomId())}get matrixClient(){return I.a.get()}componentDidMount(){this.initialize(),this.trySetExpandableQuotes()}componentDidUpdate(){this.props.onHeightChanged(),this.trySetExpandableQuotes()}componentWillUnmount(){this.unmounted=!0}trySetExpandableQuotes(){if(void 0===this.props.isQuoteExpanded&&this.blockquoteRef.current){const e=this.blockquoteRef.current.querySelector(".mx_EventTile_body");if(e){const t=e.querySelector("code"),a=!!t&&t.offsetHeight>=60;(e.offsetHeight>=60||a)&&this.props.setQuoteExpanded(!1)}}}async initialize(){const{parentEv:e}=this.props,t=await this.getEvent(Object(j.b)(e));if(!this.unmounted)if(t){const e=await this.getNextEvent(t);this.setState({events:[t],loadedEv:e,loading:!1})}else this.setState({err:!0})}async getNextEvent(e){try{const t=Object(j.b)(e);return await this.getEvent(t)}catch(e){return null}}async getEvent(e){if(!e)return null;const t=this.room.findEventById(e);if(t)return t;try{await this.matrixClient.getEventTimeline(this.room.getUnfilteredTimelineSet(),e)}catch(e){return null}return this.room.findEventById(e)}getReplyChainColorClass(e){return Object(S.f)(e.getSender()).replace("Username","ReplyChain")}render(){let e=null;if(this.state.err)e=l.a.createElement("blockquote",{className:"mx_ReplyChain mx_ReplyChain_error"},Object(f.a)("Unable to load event that was replied to, it either does not exist or you do not have permission to view it."));else if(this.state.loadedEv&&Object(j.c)(this.state.events[0])){const t=this.state.loadedEv,a=this.matrixClient.getRoom(t.getRoomId());e=l.a.createElement("blockquote",{className:`mx_ReplyChain ${this.getReplyChainColorClass(t)}`},Object(f.a)("<a>In reply to</a> <pill>",{},{a:e=>l.a.createElement(k.a,{kind:"link_inline",className:"mx_ReplyChain_show",onClick:this.onQuoteClick},e),pill:l.a.createElement(x.b,{type:x.a.UserMention,room:a,url:Object(E.i)(t.getSender()),shouldShowPillAvatar:_.b.getValue("Pill.shouldShowPillAvatar")})}))}else if(this.props.forExport){const t=Object(j.b)(this.props.parentEv);e=l.a.createElement("p",{className:"mx_ReplyChain_Export"},Object(f.a)("In reply to <a>this message</a>",{},{a:e=>l.a.createElement("a",{className:"mx_reply_anchor",href:`#${t}`,"data-scroll-to":t}," ",e," ")}))}else this.state.loading&&(e=l.a.createElement(O.a,{w:16,h:16}));const{isQuoteExpanded:t}=this.props,a=this.state.events.map((e=>{const a=d()({mx_ReplyChain:!0,[this.getReplyChainColorClass(e)]:!0,"mx_ReplyChain--expanded":!0===t,"mx_ReplyChain--collapsed":!1===t});return l.a.createElement("blockquote",{ref:this.blockquoteRef,className:a,key:e.getId()},l.a.createElement(C.a,{mxEvent:e,onHeightChanged:this.props.onHeightChanged,permalinkCreator:this.props.permalinkCreator,toggleExpandedQuote:()=>this.props.setQuoteExpanded(!this.props.isQuoteExpanded),getRelationsForEvent:this.props.getRelationsForEvent}))}));return l.a.createElement("div",{className:"mx_ReplyChain_wrapper"},l.a.createElement("div",null,e),l.a.createElement("div",null,a))}}r()(T,"contextType",R.b);var N,D=a(194),P=a(161),M=a(853),A=a(268),L=a(162),U=a(653),F=a(149),B=a(182),V=a(164),W=a(330),H=a(246),z=a(157),G=a(171),K=a(880),q=a(767),$=a(203),Y=a(628);function J(){return J=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},J.apply(this,arguments)}function Q(e){return o.createElement("svg",J({fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 18 18",role:"presentation","aria-hidden":!0},e),N||(N=o.createElement("path",{d:"M3 14h12M5 10.5l7-7",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})))}var X,Z,ee=a(882),te=a(629);function ae(){return ae=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},ae.apply(this,arguments)}function ne(e){return o.createElement("svg",ae({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 18 18",role:"presentation","aria-hidden":!0},e),X||(X=o.createElement("path",{fill:"currentColor",d:"M5 5.25a.75.75 0 000 1.5h8a.75.75 0 000-1.5H5zm0 3a.75.75 0 000 1.5h4a.75.75 0 100-1.5H5z"})),Z||(Z=o.createElement("path",{fill:"currentColor",fillRule:"evenodd",d:"M3 .25A2.75 2.75 0 00.25 3v14a.75.75 0 001.2.6L4.916 15c.217-.162.48-.25.75-.25H15A2.75 2.75 0 0017.75 12V3A2.75 2.75 0 0015 .25H3zM1.75 3c0-.69.56-1.25 1.25-1.25h12c.69 0 1.25.56 1.25 1.25v9c0 .69-.56 1.25-1.25 1.25H5.666a2.75 2.75 0 00-1.65.55L1.75 15.5V3z",clipRule:"evenodd"})))}var ie;function se(){return se=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},se.apply(this,arguments)}function re(e){return o.createElement("svg",se({fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",role:"presentation","aria-hidden":!0},e),ie||(ie=o.createElement("path",{d:"M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V9c0-1.1-.9-2-2-2H8c-1.1 0-2 .9-2 2v10zM18 4h-2.5l-.71-.71c-.18-.18-.44-.29-.7-.29H9.91c-.26 0-.52.11-.7.29L8.5 4H6c-.55 0-1 .45-1 1s.45 1 1 1h12c.55 0 1-.45 1-1s-.45-1-1-1z",fill:"currentColor"})))}var oe;function le(){return le=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},le.apply(this,arguments)}function ce(e){return o.createElement("svg",le({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 21.87 20.801",role:"presentation","aria-hidden":!0},e),oe||(oe=o.createElement("path",{fill:"currentColor",d:"M4.178 20.801l6.758-4.91 6.756 4.91-2.58-7.946 6.758-4.91h-8.352L10.936 0 8.354 7.945H0l6.758 4.91-2.58 7.946z"})))}var de,me=a(883);function ue(){return ue=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},ue.apply(this,arguments)}function he(e){return o.createElement("svg",ue({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 11 14",role:"presentation","aria-hidden":!0},e),de||(de=o.createElement("path",{fill:"currentColor",fillRule:"evenodd",d:"M.22 8.494a.753.753 0 011.062-.002l3.724 3.7L8.718 8.48a.753.753 0 011.062-.002.747.747 0 01.002 1.06L5.54 13.78a.753.753 0 01-1.063.002L.221 9.552a.747.747 0 01-.002-1.058zm9.562-2.988a.753.753 0 01-1.062.002l-3.724-3.7L1.283 5.52a.753.753 0 01-1.062.002.747.747 0 01-.002-1.06L4.462.22A.753.753 0 015.524.218l4.257 4.23a.747.747 0 01.001 1.058z",clipRule:"evenodd"})))}var pe;function ge(){return ge=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},ge.apply(this,arguments)}function ve(e){return o.createElement("svg",ge({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 11 14",role:"presentation","aria-hidden":!0},e),pe||(pe=o.createElement("path",{fill:"currentColor",fillRule:"evenodd",d:"M.22.234A.753.753 0 011.281.232l3.724 3.7L8.718.22A.753.753 0 019.781.218a.747.747 0 01.001 1.06L5.54 5.52a.753.753 0 01-1.063.002L.221 1.292A.747.747 0 01.219.235zm9.562 13.532a.753.753 0 01-1.062.002l-3.724-3.7-3.713 3.712a.753.753 0 01-1.062.002.747.747 0 01-.002-1.06L4.462 8.48a.753.753 0 011.062-.002l4.257 4.23a.747.747 0 01.001 1.058z",clipRule:"evenodd"})))}var be=a(180),fe=a(471),ye=a(169),Ee=a(443),_e=a(496),Se=a(839),we=a(838);class Oe extends l.a.PureComponent{constructor(e){super(e),r()(this,"downloader",new we.a),r()(this,"onDownloadClick",(async()=>{if(this.state.loading)return;if(this.props.mediaEventHelperGet().media.isEncrypted&&this.setState({tooltip:Object(f.c)("Decrypting")}),this.setState({loading:!0}),this.state.blob)return this.doDownload();const e=await this.props.mediaEventHelperGet().sourceBlob.value;this.setState({blob:e}),await this.doDownload()})),this.state={loading:!1,tooltip:Object(f.c)("Downloading")}}async doDownload(){await this.downloader.download({blob:this.state.blob,name:this.props.mediaEventHelperGet().fileName}),this.setState({loading:!1})}render(){let e;this.state.loading&&(e=l.a.createElement(O.a,{w:18,h:18}));const t=d()({mx_MessageActionBar_iconButton:!0,mx_MessageActionBar_downloadButton:!0,mx_MessageActionBar_downloadSpinnerButton:!!e});return l.a.createElement(ye.b,{className:t,title:e?Object(f.a)(this.state.tooltip):Object(f.a)("Download"),onClick:this.onDownloadClick,disabled:!!e},l.a.createElement(Se.Icon,null),e)}}var Ce,xe,ke=a(552),je=a(371),Re=a(204),Ie=a(142);const Te=JSON.parse(null!==(Ce=null===(xe=localStorage)||void 0===xe?void 0:xe.getItem("io_element_favouriteMessages"))&&void 0!==Ce?Ce:"[]");var Ne=a(262);const De=e=>{let{mxEvent:t,getTile:a,getReplyChain:n,permalinkCreator:s,onFocusChange:r,getRelationsForEvent:c}=e;const[d,m,u,h]=Object(F.q)(),[p,g]=Object(ye.i)(m);Object(o.useEffect)((()=>{r(d)}),[r,d]);const v=Object(o.useCallback)((e=>{e.preventDefault(),e.stopPropagation(),u(),p()}),[u,p]);let b;if(d){const e=a&&a(),r=n&&n(),o=m.current.getBoundingClientRect();b=l.a.createElement(U.a,i()({},Object(F.i)(o),{mxEvent:t,permalinkCreator:s,eventTileOps:e&&e.getEventTileOps?e.getEventTileOps():void 0,collapseReplyChain:r&&r.canCollapse()?r.collapse:void 0,onFinished:h,getRelationsForEvent:c}))}return l.a.createElement(l.a.Fragment,null,l.a.createElement(F.c,{className:"mx_MessageActionBar_iconButton mx_MessageActionBar_optionsButton",title:Object(f.a)("Options"),onClick:v,onContextMenu:v,isExpanded:d,inputRef:m,onFocus:p,tabIndex:g?0:-1},l.a.createElement(Y.a,null)),b)},Pe=e=>{let{mxEvent:t,reactions:a,onFocusChange:n}=e;const[s,r,c,d]=Object(F.q)(),[m,u]=Object(ye.i)(r);let h;if(Object(o.useEffect)((()=>{n(s)}),[n,s]),s){const e=r.current.getBoundingClientRect();h=l.a.createElement(F.n,i()({},Object(F.i)(e),{onFinished:d,managed:!1}),l.a.createElement(ke.a,{mxEvent:t,reactions:a,onFinished:d}))}const p=Object(o.useCallback)((e=>{e.preventDefault(),e.stopPropagation(),c(),m()}),[c,m]);return l.a.createElement(l.a.Fragment,null,l.a.createElement(F.c,{className:"mx_MessageActionBar_iconButton",title:Object(f.a)("React"),onClick:p,onContextMenu:p,isExpanded:s,inputRef:r,onFocus:m,tabIndex:u?0:-1},l.a.createElement(ee.a,null)),h)},Me=e=>{var t;let{mxEvent:a}=e;const n=Object(o.useContext)(je.a),i=null==a||null===(t=a.getRelation())||void 0===t?void 0:t.rel_type,s=!!i&&i!==m.h.Thread,r=e=>{e.preventDefault(),e.stopPropagation(),a.getThread()&&!a.isThreadRoot?y.b.dispatch({action:w.a.ShowThread,rootEvent:a.getThread().rootEvent,initialEvent:a,scroll_into_view:!0,highlighted:!0,push:n.isCard}):y.b.dispatch({action:w.a.ShowThread,rootEvent:a,push:n.isCard})};return l.a.createElement(ye.b,{className:"mx_MessageActionBar_iconButton mx_MessageActionBar_threadButton",disabled:s,tooltip:l.a.createElement(l.a.Fragment,null,l.a.createElement("div",{className:"mx_Tooltip_title"},s?Object(f.a)("Can't create a thread from an event with an existing relation"):Object(f.a)("Reply in thread"))),title:s?Object(f.a)("Can't create a thread from an event with an existing relation"):Object(f.a)("Reply in thread"),onClick:r,onContextMenu:r},l.a.createElement(ne,null))},Ae=e=>{let{mxEvent:t}=e;const{isFavourite:a,toggleFavourite:n}=function(){const[,e]=Object(o.useState)(),t=e=>Te.includes(e);return{isFavourite:t,toggleFavourite:a=>{t(a)?Te.splice(Te.indexOf(a),1):Te.push(a),localStorage.setItem("io_element_favouriteMessages",JSON.stringify(Te)),e([])}}}(),i=t.getId(),s=d()("mx_MessageActionBar_iconButton mx_MessageActionBar_favouriteButton",{mx_MessageActionBar_favouriteButton_fillstar:a(i)}),r=Object(o.useCallback)((e=>{e.preventDefault(),e.stopPropagation(),n(i)}),[n,i]);return l.a.createElement(ye.b,{className:s,title:Object(f.a)("Favourite"),onClick:r,onContextMenu:r,"data-testid":i},l.a.createElement(ce,null))};class Le extends l.a.PureComponent{constructor(){super(...arguments),r()(this,"onDecrypted",(()=>{this.forceUpdate()})),r()(this,"onBeforeRedaction",(()=>{this.forceUpdate()})),r()(this,"onSent",(()=>{this.forceUpdate()})),r()(this,"onFocusChange",(e=>{var t,a;null===(t=(a=this.props).onFocusChange)||void 0===t||t.call(a,e)})),r()(this,"onReplyClick",(e=>{e.preventDefault(),e.stopPropagation(),y.a.dispatch({action:"reply_to_event",event:this.props.mxEvent,context:this.context.timelineRenderingType})})),r()(this,"onEditClick",(e=>{e.preventDefault(),e.stopPropagation(),Object(be.e)(this.props.mxEvent,this.context.timelineRenderingType,this.props.getRelationsForEvent)})),r()(this,"forbiddenThreadHeadMsgType",[m.e.KeyVerificationRequest]),r()(this,"onResendClick",(e=>{e.preventDefault(),e.stopPropagation(),this.runActionOnFailedEv((e=>Ee.a.resend(e)))})),r()(this,"onCancelClick",(e=>{this.runActionOnFailedEv((e=>Ee.a.removeFromQueue(e)),(e=>Object(be.b)(e.status)))}))}componentDidMount(){this.props.mxEvent.status&&this.props.mxEvent.status!==u.a.SENT&&this.props.mxEvent.on(u.c.Status,this.onSent);I.a.get().decryptEventIfNeeded(this.props.mxEvent),this.props.mxEvent.isBeingDecrypted()&&this.props.mxEvent.once(u.c.Decrypted,this.onDecrypted),this.props.mxEvent.on(u.c.BeforeRedaction,this.onBeforeRedaction)}componentWillUnmount(){this.props.mxEvent.off(u.c.Status,this.onSent),this.props.mxEvent.off(u.c.Decrypted,this.onDecrypted),this.props.mxEvent.off(u.c.BeforeRedaction,this.onBeforeRedaction)}get showReplyInThreadAction(){const e=this.context.timelineRenderingType!==R.a.Thread,t=!(this.forbiddenThreadHeadMsgType.includes(this.props.mxEvent.getContent().msgtype)||$.b.matches(this.props.mxEvent.getType())||this.props.mxEvent.getType()===Ne.b);return e&&t}runActionOnFailedEv(e,t){t||(t=()=>!0);const a=this.props.mxEvent,n=a.replacingEvent(),i=[a.localRedactionEvent(),n,a];for(const a of i)if(a&&t(a)){e(a);break}}render(){const e=[];Object(be.c)(this.props.mxEvent)&&e.push(l.a.createElement(ye.b,{className:"mx_MessageActionBar_iconButton",title:Object(f.a)("Edit"),onClick:this.onEditClick,onContextMenu:this.onEditClick,key:"edit"},l.a.createElement(Q,null)));const t=l.a.createElement(ye.b,{className:"mx_MessageActionBar_iconButton",title:Object(f.a)("Delete"),onClick:this.onCancelClick,onContextMenu:this.onCancelClick,key:"cancel"},l.a.createElement(re,null)),a=l.a.createElement(Me,{mxEvent:this.props.mxEvent,key:"reply_thread"}),n=this.props.mxEvent,i=n.replacingEvent()&&n.replacingEvent().status,s=n.localRedactionEvent()&&n.localRedactionEvent().status,r=Object(be.b)(n.status)||Object(be.b)(i)||Object(be.b)(s),o=[n.status,i,s].includes(u.a.NOT_SENT);if(r&&o)e.splice(0,0,l.a.createElement(ye.b,{className:"mx_MessageActionBar_iconButton",title:Object(f.a)("Retry"),onClick:this.onResendClick,onContextMenu:this.onResendClick,key:"resend"},l.a.createElement(te.a,null))),e.push(t);else{if(Object(be.k)(this.props.mxEvent)?(this.context.canSendMessages&&(this.showReplyInThreadAction&&e.splice(0,0,a),e.splice(0,0,l.a.createElement(ye.b,{className:"mx_MessageActionBar_iconButton",title:Object(f.a)("Reply"),onClick:this.onReplyClick,onContextMenu:this.onReplyClick,key:"reply"},l.a.createElement(me.a,null)))),this.context.canReact&&e.splice(0,0,l.a.createElement(Pe,{mxEvent:this.props.mxEvent,reactions:this.props.reactions,onFocusChange:this.onFocusChange,key:"react"})),_.b.getValue("feature_favourite_messages")&&e.splice(-1,0,l.a.createElement(Ae,{key:"favourite",mxEvent:this.props.mxEvent})),_e.a.isEligible(this.props.mxEvent)&&e.splice(0,0,l.a.createElement(Oe,{mxEvent:this.props.mxEvent,mediaEventHelperGet:()=>{var e,t,a,n;return null===(e=(t=this.props).getTile)||void 0===e||null===(a=(n=e.call(t)).getMediaHelper)||void 0===a?void 0:a.call(n)},key:"download"}))):this.context.timelineRenderingType===R.a.Room&&this.props.mxEvent.getThread()&&e.unshift(a),r&&e.push(t),void 0!==this.props.isQuoteExpanded&&Object(j.c)(this.props.mxEvent)){const t=d()({mx_MessageActionBar_iconButton:!0,mx_MessageActionBar_expandCollapseMessageButton:!0}),a=l.a.createElement(l.a.Fragment,null,l.a.createElement("div",{className:"mx_Tooltip_title"},this.props.isQuoteExpanded?Object(f.a)("Collapse quotes"):Object(f.a)("Expand quotes")),l.a.createElement("div",{className:"mx_Tooltip_sub"},Object(f.a)(Ie.a[Re.b.SHIFT])+" + "+Object(f.a)("Click")));e.push(l.a.createElement(ye.b,{className:t,title:this.props.isQuoteExpanded?Object(f.a)("Collapse quotes"):Object(f.a)("Expand quotes"),tooltip:a,onClick:this.props.toggleThreadExpanded,key:"expand"},this.props.isQuoteExpanded?l.a.createElement(ve,null):l.a.createElement(he,null)))}e.push(l.a.createElement(De,{mxEvent:this.props.mxEvent,getReplyChain:this.props.getReplyChain,getTile:this.props.getTile,permalinkCreator:this.props.permalinkCreator,onFocusChange:this.onFocusChange,key:"menu",getRelationsForEvent:this.props.getRelationsForEvent}))}return l.a.createElement(fe.a,{className:"mx_MessageActionBar","aria-label":Object(f.a)("Message Actions"),"aria-live":"off"},e)}}r()(Le,"contextType",R.b);var Ue=a(351),Fe=a(328),Be=a(196),Ve=a(133);class We extends l.a.PureComponent{constructor(){super(...arguments),r()(this,"context",void 0)}render(){const{content:e,reactionEvents:t,mxEvent:a,visible:n}=this.props,i=this.context.getRoom(a.getRoomId());let s,r;if(i){const a=[];for(const e of t){const t=i.getMember(e.getSender()),n=t?t.name:e.getSender();a.push(n)}const n=Object(Be.k)(e);s=l.a.createElement("div",null,Object(f.a)("<reactors/><reactedWith>reacted with %(shortName)s</reactedWith>",{shortName:n},{reactors:()=>l.a.createElement("div",{className:"mx_Tooltip_title"},Object(S.b)(a,6)),reactedWith:e=>n?l.a.createElement("div",{className:"mx_Tooltip_sub"},e):null}))}return s&&(r=l.a.createElement(V.b,{visible:n,label:s})),r}}r()(We,"contextType",Ve.a);class He extends l.a.PureComponent{constructor(){super(...arguments),r()(this,"context",void 0),r()(this,"state",{tooltipRendered:!1,tooltipVisible:!1}),r()(this,"onClick",(()=>{const{mxEvent:e,myReactionEvent:t,content:a}=this.props;t?this.context.redactEvent(e.getRoomId(),t.getId()):(this.context.sendEvent(e.getRoomId(),"m.reaction",{"m.relates_to":{rel_type:"m.annotation",event_id:e.getId(),key:a}}),y.a.dispatch({action:"message_sent"}))})),r()(this,"onMouseOver",(()=>{this.setState({tooltipRendered:!0,tooltipVisible:!0})})),r()(this,"onMouseLeave",(()=>{this.setState({tooltipVisible:!1})}))}render(){const{mxEvent:e,content:t,count:a,reactionEvents:n,myReactionEvent:i}=this.props,s=d()({mx_ReactionsRowButton:!0,mx_ReactionsRowButton_selected:!!i});let r;this.state.tooltipRendered&&(r=l.a.createElement(We,{mxEvent:this.props.mxEvent,content:t,reactionEvents:n,visible:this.state.tooltipVisible}));const o=this.context.getRoom(e.getRoomId());let c;if(o){const e=[];for(const t of n){const a=o.getMember(t.getSender());e.push((null==a?void 0:a.name)||t.getSender())}const a=Object(S.b)(e,6);c=t?Object(f.a)("%(reactors)s reacted with %(content)s",{reactors:a,content:t}):a}return l.a.createElement(k.a,{className:s,"aria-label":c,onClick:this.onClick,disabled:this.props.disabled,onMouseOver:this.onMouseOver,onMouseLeave:this.onMouseLeave},l.a.createElement("span",{className:"mx_ReactionsRowButton_content","aria-hidden":"true"},t),l.a.createElement("span",{className:"mx_ReactionsRowButton_count","aria-hidden":"true"},a),r)}}r()(He,"contextType",Ve.a);const ze=e=>{let{mxEvent:t,reactions:a}=e;const[n,s,r,o]=Object(F.q)();let c;if(n){const e=s.current.getBoundingClientRect();c=l.a.createElement(F.n,i()({},Object(F.i)(e),{onFinished:o,managed:!1}),l.a.createElement(ke.a,{mxEvent:t,reactions:a,onFinished:o}))}return l.a.createElement(l.a.Fragment,null,l.a.createElement(Fe.a,{className:d()("mx_ReactionsRow_addReactionButton",{mx_ReactionsRow_addReactionButton_active:n}),title:Object(f.a)("Add reaction"),onClick:r,onContextMenu:e=>{e.preventDefault(),r()},isExpanded:n,inputRef:s}),c)};class Ge extends l.a.PureComponent{constructor(e,t){super(e,t),r()(this,"context",void 0),r()(this,"onDecrypted",(()=>{this.forceUpdate()})),r()(this,"onReactionsChange",(()=>{this.setState({myReactions:this.getMyReactions()}),this.forceUpdate()})),r()(this,"onShowAllClick",(()=>{this.setState({showAll:!0})})),this.context=t,this.state={myReactions:this.getMyReactions(),showAll:!1}}componentDidMount(){const{mxEvent:e,reactions:t}=this.props;(e.isBeingDecrypted()||e.shouldAttemptDecryption())&&e.once(u.c.Decrypted,this.onDecrypted),t&&(t.on(Ue.b.Add,this.onReactionsChange),t.on(Ue.b.Remove,this.onReactionsChange),t.on(Ue.b.Redaction,this.onReactionsChange))}componentWillUnmount(){const{mxEvent:e,reactions:t}=this.props;e.off(u.c.Decrypted,this.onDecrypted),t&&(t.off(Ue.b.Add,this.onReactionsChange),t.off(Ue.b.Remove,this.onReactionsChange),t.off(Ue.b.Redaction,this.onReactionsChange))}componentDidUpdate(e){this.props.reactions&&e.reactions!==this.props.reactions&&(this.props.reactions.on(Ue.b.Add,this.onReactionsChange),this.props.reactions.on(Ue.b.Remove,this.onReactionsChange),this.props.reactions.on(Ue.b.Redaction,this.onReactionsChange),this.onReactionsChange())}getMyReactions(){const e=this.props.reactions;if(!e)return null;const t=this.context.room.client.getUserId(),a=e.getAnnotationsBySender()[t];return a?[...a.values()]:null}render(){const{mxEvent:e,reactions:t}=this.props,{myReactions:a,showAll:n}=this.state;if(!t||!Object(be.k)(e))return null;let i,s,r=t.getSortedAnnotationsByKey().map((t=>{let[n,i]=t;const s=i.size;if(!s)return null;const r=a&&a.find((e=>!e.isRedacted()&&e.getRelation().key===n));return l.a.createElement(He,{key:n,content:n,count:s,mxEvent:e,reactionEvents:i,myReactionEvent:r,disabled:!this.context.canReact||r&&!r.isRedacted()&&!this.context.canSelfRedact})})).filter((e=>!!e));return r.length?(r.length>9&&!n&&(r=r.slice(0,8),i=l.a.createElement(k.a,{kind:"link_inline",className:"mx_ReactionsRow_showAll",onClick:this.onShowAllClick},Object(f.a)("Show all"))),this.context.canReact&&(s=l.a.createElement(ze,{mxEvent:e,reactions:t})),l.a.createElement("div",{className:"mx_ReactionsRow",role:"toolbar","aria-label":Object(f.a)("Reactions")},r,i,s)):null}}r()(Ge,"contextType",R.b);var Ke=a(627),qe=a(649),$e=a(226),Ye=a(884),Je=a(524),Qe=a(159),Xe=a(127),Ze=a(131),et=a(277),tt=a(553);class at extends l.a.Component{constructor(e){super(e),r()(this,"onBugReport",(()=>{Xe.b.createDialog(et.a,{label:"react-soft-crash-tile",error:this.state.error})})),r()(this,"onViewSource",(()=>{Xe.b.createDialog(tt.a,{mxEvent:this.props.mxEvent},"mx_Dialog_viewsource")})),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}render(){if(this.state.error){const{mxEvent:e}=this.props,t={mx_EventTile:!0,mx_EventTile_info:!0,mx_EventTile_content:!0,mx_EventTile_tileError:!0};let a,n;return Ze.b.get().bug_report_endpoint_url&&(a=l.a.createElement(l.a.Fragment,null," ",l.a.createElement(k.a,{kind:"link",onClick:this.onBugReport},Object(f.a)("Submit logs")))),e&&_.b.getValue("developerMode")&&(n=l.a.createElement(l.a.Fragment,null," ",l.a.createElement(k.a,{onClick:this.onViewSource,kind:"link"},Object(f.a)("View Source")))),l.a.createElement("li",{className:d()(t),"data-layout":this.props.layout},l.a.createElement("div",{className:"mx_EventTile_line"},l.a.createElement("span",null,Object(f.a)("Can't load this message"),e&&` (${e.getType()})`,a,n)))}return this.props.children}}var nt=a(237),it=a(132),st=a.n(it),rt=a(140),ot=a(248);const lt=["mxEvent","thread"],ct=e=>{var t,a;let{thread:n,showDisplayname:i=!1}=e;const s=Object(o.useContext)(Ve.a),r=Object(rt.d)(n,h.f.Update,(()=>n.replyToEvent)),[c,d]=Object(o.useState)(null==r?void 0:r.getContent());Object(rt.c)(r,u.c.Replaced,(()=>{d(r.getContent())}));const m=(null==r?void 0:r.shouldAttemptDecryption())||(null==r?void 0:r.isBeingDecrypted());Object(rt.c)(m?r:null,u.c.Decrypted,(()=>{d(r.getContent())}));const p=Object(ot.a)((async()=>{if(r)return await s.decryptEventIfNeeded(r),qe.a.instance.generatePreviewForEvent(r)}),[r,c]);return p&&r?l.a.createElement(l.a.Fragment,null,l.a.createElement(G.b,{member:r.sender,fallbackUserId:r.getSender(),width:24,height:24,className:"mx_ThreadSummary_avatar"}),i&&l.a.createElement("div",{className:"mx_ThreadSummary_sender"},null!==(t=null===(a=r.sender)||void 0===a?void 0:a.name)&&void 0!==t?t:r.getSender()),r.isDecryptionFailure()?l.a.createElement("div",{className:"mx_ThreadSummary_content mx_DecryptionFailureBody",title:Object(f.a)("Unable to decrypt message")},l.a.createElement("span",{className:"mx_ThreadSummary_message-preview"},Object(f.a)("Unable to decrypt message"))):l.a.createElement("div",{className:"mx_ThreadSummary_content",title:p},l.a.createElement("span",{className:"mx_ThreadSummary_message-preview"},p))):null};var dt=e=>{let{mxEvent:t,thread:a}=e,n=st()(e,lt);const s=Object(o.useContext)(R.b),r=Object(o.useContext)(je.a),c=Object(rt.d)(a,h.f.Update,(()=>a.length));if(!c)return null;let d=c;return s.narrow||(d=Object(f.a)("%(count)s reply",{count:c})),l.a.createElement(k.a,i()({},n,{className:"mx_ThreadSummary",onClick:e=>{y.a.dispatch({action:w.a.ShowThread,rootEvent:t,push:r.isCard}),Qe.b.trackInteraction("WebRoomTimelineThreadSummaryButton",e)},"aria-label":Object(f.a)("Open thread")}),l.a.createElement("span",{className:"mx_ThreadSummary_replies_amount"},d),l.a.createElement(ct,{thread:a,showDisplayname:!s.narrow}),l.a.createElement("div",{className:"mx_ThreadSummary_chevron"}))},mt=a(185),ut=a.n(mt);class ht extends l.a.Component{constructor(e){super(e),r()(this,"nodes",{}),r()(this,"children",void 0),this.updateChildren(this.props.children)}componentDidUpdate(){this.updateChildren(this.props.children)}applyStyles(e,t){Object.entries(t).forEach((t=>{let[a,n]=t;e.style[a]=n}))}updateChildren(e){const t=this.children||{};this.children={},l.a.Children.toArray(e).forEach((e=>{if(t[e.key]){const a=t[e.key],n=ut.a.findDOMNode(this.nodes[a.key]);n&&n.style.left!==e.props.style.left&&this.applyStyles(n,{left:e.props.style.left}),this.children[e.key]=l.a.cloneElement(a,e.props,e.props.children)}else{const t={},a=e.props.style,n=this.props.startStyles;if(n.length>0){const e=n[0];t.style=e}t.ref=t=>this.collectNode(e.key,t,a),this.children[e.key]=l.a.cloneElement(e,t)}}))}collectNode(e,t,a){if(t&&void 0===this.nodes[e]&&this.props.startStyles.length>0){const e=this.props.startStyles,n=ut.a.findDOMNode(t);for(let t=1;t<e.length;++t)this.applyStyles(n,e[t]);window.setTimeout((()=>{this.applyStyles(n,a)}),0)}this.nodes[e]=t}render(){return l.a.createElement(l.a.Fragment,null,Object.values(this.children))}}r()(ht,"defaultProps",{startStyles:[]});var pt=a(551);class gt extends l.a.PureComponent{constructor(e){super(e),r()(this,"avatar",Object(o.createRef)()),this.state={suppressDisplay:!this.props.suppressAnimation}}componentWillUnmount(){const e=this.props.readReceiptInfo;e&&(this.props.checkUnmounting&&this.props.checkUnmounting()||this.buildReadReceiptInfo(e))}componentDidMount(){this.state.suppressDisplay&&this.animateMarker()}componentDidUpdate(e){const t=e.offset!==this.props.offset,a=e.hidden!==this.props.hidden;(t||a)&&this.animateMarker()}buildReadReceiptInfo(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=this.avatar.current,a=t.offsetParent;if(!(a&&a instanceof HTMLElement))return p.a.warn(`ReadReceiptMarker for ${this.props.fallbackUserId} has no valid horizontalContainer`),e.top=0,e.right=0,e.parent=null,e;const n=a.offsetParent;return n&&n instanceof HTMLElement?(e.top=t.offsetTop,e.right=t.getBoundingClientRect().right-a.getBoundingClientRect().right,e.parent=n,e):(p.a.warn(`ReadReceiptMarker for ${this.props.fallbackUserId} has no valid verticalContainer`),e.top=0,e.right=0,e.parent=null,e)}readReceiptPosition(e){return e.parent?e.top+e.parent.getBoundingClientRect().top:(p.a.warn(`ReadReceiptMarker for ${this.props.fallbackUserId} has no offsetParent`),0)}animateMarker(){const e=this.props.readReceiptInfo,t=this.buildReadReceiptInfo(),a=this.readReceiptPosition(t),n=e?this.readReceiptPosition(e):-ft,i=[];null!=e&&e.right&&i.push({top:n-a,right:e.right}),i.push({top:n-a,right:0}),this.setState({suppressDisplay:!1,startStyles:i})}render(){if(this.state.suppressDisplay)return l.a.createElement("div",{ref:this.avatar});const e={right:Object(pt.a)(this.props.offset),top:"0px"};return l.a.createElement(ht,{startStyles:this.state.startStyles},l.a.createElement(G.a,{member:this.props.member,fallbackUserId:this.props.fallbackUserId,"aria-hidden":"true","aria-live":"off",width:14,height:14,resizeMethod:"crop",style:e,inputRef:this.avatar,hideTitle:!0,tabIndex:-1}))}}var vt=a(211);function bt(e){const[t,a]=Object(o.useState)(!1);return[{showTooltip:()=>a(!0),hideTooltip:()=>a(!1)},l.a.createElement(V.b,i()({},e,{visible:t}))]}const ft=16;function yt(e){let{readReceipts:t,readReceiptMap:a,checkUnmounting:n,suppressAnimation:s,isTwelveHour:r}=e;const[o,c,d,m]=Object(F.q)(),u=t.length>4,h=u?3:4,p=function(e,t){return t?Object(f.a)("%(members)s and more",{members:e.join(", ")}):e.length>1?Object(f.a)("%(members)s and %(last)s",{last:e.pop(),members:e.join(", ")}):e.length?e[0]:null}(t.slice(0,h).map((e=>{var t,a;return null!==(t=null===(a=e.roomMember)||void 0===a?void 0:a.name)&&void 0!==t?t:e.userId})),u),[{showTooltip:g,hideTooltip:v},b]=bt({label:l.a.createElement(l.a.Fragment,null,l.a.createElement("div",{className:"mx_Tooltip_title"},Object(f.a)("Seen by %(count)s people",{count:t.length})),l.a.createElement("div",{className:"mx_Tooltip_sub"},p)),alignment:V.a.TopRight});if(0===t.length)return l.a.createElement("div",{className:"mx_EventTile_msgOption"},l.a.createElement("div",{className:"mx_ReadReceiptGroup"},l.a.createElement("div",{className:"mx_ReadReceiptGroup_button"},l.a.createElement("span",{className:"mx_ReadReceiptGroup_container"}))));const y=t.map(((e,t)=>{const{hidden:i,position:o}=function(e,t){return e<t?{hidden:!1,position:e}:{hidden:!0,position:0}}(t,h),c=e.userId;let d;return a&&(d=a[c],d||(d={},a[c]=d)),l.a.createElement(gt,{key:c,member:e.roomMember,fallbackUserId:c,offset:10*o,hidden:i,readReceiptInfo:d,checkUnmounting:n,suppressAnimation:s,timestamp:e.ts,showTwelveHour:r})})).reverse();let E;const _=t.length-h;let S;if(_>0&&(E=l.a.createElement("span",{className:"mx_ReadReceiptGroup_remainder","aria-live":"off"},"+",_)),o){const e=c.current.getBoundingClientRect();S=l.a.createElement(F.n,i()({menuClassName:"mx_ReadReceiptGroup_popup",onFinished:m},Object(F.i)(e)),l.a.createElement(vt.a,null,l.a.createElement(_t,{className:"mx_ReadReceiptGroup_title"},Object(f.a)("Seen by %(count)s people",{count:t.length})),t.map((e=>l.a.createElement(Et,i()({key:e.userId},e,{isTwelveHour:r,onAfterClick:m}))))))}return l.a.createElement("div",{className:"mx_EventTile_msgOption"},l.a.createElement("div",{className:"mx_ReadReceiptGroup",role:"group","aria-label":Object(f.a)("Read receipts")},l.a.createElement(k.a,{className:"mx_ReadReceiptGroup_button",inputRef:c,"aria-label":p,"aria-haspopup":"true",onClick:d,onMouseOver:g,onMouseLeave:v,onFocus:g,onBlur:v},E,l.a.createElement("span",{className:"mx_ReadReceiptGroup_container",style:{width:10*Math.min(h,t.length)+ft-10}},y)),b,S))}function Et(e){var t,a;let{userId:n,roomMember:i,ts:s,isTwelveHour:r,onAfterClick:o}=e;const[{showTooltip:c,hideTooltip:d},m]=bt({alignment:V.a.Top,tooltipClassName:"mx_ReadReceiptGroup_person--tooltip",label:l.a.createElement(l.a.Fragment,null,l.a.createElement("div",{className:"mx_Tooltip_title"},null!==(t=null==i?void 0:i.rawDisplayName)&&void 0!==t?t:n),l.a.createElement("div",{className:"mx_Tooltip_sub"},n))});return l.a.createElement(F.d,{className:"mx_ReadReceiptGroup_person",onClick:()=>{y.a.dispatch({action:w.a.ViewUser,member:null!=i?i:{userId:n},push:!1}),null==o||o()},onMouseOver:c,onMouseLeave:d,onFocus:c,onBlur:d,onWheel:d},l.a.createElement(G.b,{member:i,fallbackUserId:n,width:24,height:24,"aria-hidden":"true","aria-live":"off",resizeMethod:"crop",hideTitle:!0}),l.a.createElement("div",{className:"mx_ReadReceiptGroup_name"},l.a.createElement("p",null,null!==(a=null==i?void 0:i.name)&&void 0!==a?a:n),l.a.createElement("p",{className:"mx_ReadReceiptGroup_secondary"},Object(P.a)(new Date(s),r))),m)}function _t(e){let{className:t,children:a}=e;const n=Object(o.useRef)(),[i]=Object(ye.i)(n);return l.a.createElement("h3",{className:t,role:"menuitem",onFocus:i,tabIndex:-1,ref:n},a)}var St,wt=a(217),Ot=a(202),Ct=a(832),xt=a(807);function kt(e){let{room:t,threadId:a}=e;const{symbol:n,count:i,color:s}=Object(Ct.a)(t,a);return l.a.createElement(xt.a,{symbol:n,count:i,color:s})}function jt(){return jt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},jt.apply(this,arguments)}function Rt(e){return o.createElement("svg",jt({fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",role:"presentation","aria-hidden":!0},e),St||(St=o.createElement("path",{d:"M12.528 6.54l.5-.498c1.377-1.378 3.598-1.391 4.96-.03 1.361 1.362 1.348 3.583-.03 4.96l-2.37 2.37c-1.378 1.378-3.599 1.391-4.96.03m.844 4.087l-.5.499c-1.377 1.378-3.598 1.391-4.96.03-1.361-1.362-1.348-3.583.03-4.96l2.37-2.37c1.378-1.378 3.599-1.391 4.96-.03",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round"})))}var It;function Tt(){return Tt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},Tt.apply(this,arguments)}function Nt(e){return o.createElement("svg",Tt({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 16 16",role:"presentation","aria-hidden":!0},e),It||(It=o.createElement("path",{fill:"currentColor",fillRule:"evenodd",d:"M1 2.75A.75.75 0 011.75 2h.005a.75.75 0 010 1.5H1.75A.75.75 0 011 2.75zm2.495 0a.75.75 0 01.75-.75h.01a.75.75 0 010 1.5h-.01a.75.75 0 01-.75-.75zm2.5 0a.75.75 0 01.75-.75h.01a.75.75 0 010 1.5h-.01a.75.75 0 01-.75-.75zm2.5 0a.75.75 0 01.75-.75h.01a.75.75 0 010 1.5h-.01a.75.75 0 01-.75-.75zm2.5 0a.75.75 0 01.75-.75h.01a.75.75 0 010 1.5h-.01a.75.75 0 01-.75-.75zm2.5 0a.75.75 0 01.75-.75h.005a.75.75 0 010 1.5h-.005a.75.75 0 01-.75-.75zM1 6.75A.75.75 0 011.75 6h8.5a.75.75 0 010 1.5h-8.5A.75.75 0 011 6.75zm0 3A.75.75 0 011.75 9h4.5a.75.75 0 010 1.5h-4.5A.75.75 0 011 9.75zm0 4a.75.75 0 01.75-.75h.005a.75.75 0 010 1.5H1.75a.75.75 0 01-.75-.75zm2.495 0a.75.75 0 01.75-.75h.01a.75.75 0 010 1.5h-.01a.75.75 0 01-.75-.75zm2.5 0a.75.75 0 01.75-.75h.01a.75.75 0 010 1.5h-.01a.75.75 0 01-.75-.75zm2.5 0a.75.75 0 01.75-.75h.01a.75.75 0 010 1.5h-.01a.75.75 0 01-.75-.75zm2.5 0a.75.75 0 01.75-.75h.01a.75.75 0 010 1.5h-.01a.75.75 0 01-.75-.75zm2.5 0a.75.75 0 01.75-.75h.005a.75.75 0 010 1.5h-.005a.75.75 0 01-.75-.75z",clipRule:"evenodd"})))}function Dt(e){let{viewInRoom:t,copyLinkToThread:a}=e;return l.a.createElement(fe.a,{className:"mx_MessageActionBar","aria-label":Object(f.a)("Message Actions"),"aria-live":"off"},l.a.createElement(ye.b,{className:"mx_MessageActionBar_iconButton",onClick:t,title:Object(f.a)("View in room"),key:"view_in_room"},l.a.createElement(Nt,null)),l.a.createElement(ye.b,{className:"mx_MessageActionBar_iconButton",onClick:a,title:Object(f.a)("Copy link to thread"),key:"copy_link_to_thread"},l.a.createElement(Rt,null)))}function Pt(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function Mt(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?Pt(Object(a),!0).forEach((function(t){r()(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):Pt(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}class At extends l.a.Component{constructor(e,t){super(e,t),r()(this,"suppressReadReceiptAnimation",void 0),r()(this,"isListeningForReceipts",void 0),r()(this,"tile",l.a.createRef()),r()(this,"replyChain",l.a.createRef()),r()(this,"ref",Object(o.createRef)()),r()(this,"context",void 0),r()(this,"updateThread",(e=>{this.setState({thread:e})})),r()(this,"onNewThread",(e=>{if(e.id===this.props.mxEvent.getId()){this.updateThread(e);I.a.get().getRoom(this.props.mxEvent.getRoomId()).off(h.f.New,this.onNewThread)}})),r()(this,"viewInRoom",(e=>{e.preventDefault(),e.stopPropagation(),y.a.dispatch({action:w.a.ViewRoom,event_id:this.props.mxEvent.getId(),highlighted:!0,room_id:this.props.mxEvent.getRoomId(),metricsTrigger:void 0})})),r()(this,"copyLinkToThread",(async e=>{e.preventDefault(),e.stopPropagation();const{permalinkCreator:t,mxEvent:a}=this.props,n=t.forEvent(a.getId());await Object($e.b)(n)})),r()(this,"onRoomReceipt",((e,t)=>{t===I.a.get().getRoom(this.props.mxEvent.getRoomId())&&(this.shouldShowSentReceipt||this.shouldShowSendingReceipt||this.isListeningForReceipts)&&this.forceUpdate((()=>{this.shouldShowSentReceipt||this.shouldShowSendingReceipt||(I.a.get().removeListener(g.d.Receipt,this.onRoomReceipt),this.isListeningForReceipts=!1)}))})),r()(this,"onDecrypted",(()=>{this.verifyEvent(),this.forceUpdate(this.props.onHeightChanged)})),r()(this,"onDeviceVerificationChanged",((e,t)=>{e===this.props.mxEvent.getSender()&&this.verifyEvent()})),r()(this,"onUserVerificationChanged",((e,t)=>{e===this.props.mxEvent.getSender()&&this.verifyEvent()})),r()(this,"onReplaced",(()=>{this.verifyEvent()})),r()(this,"onSenderProfileClick",(()=>{y.a.dispatch({action:w.a.ComposerInsert,userId:this.props.mxEvent.getSender(),timelineRenderingType:this.context.timelineRenderingType})})),r()(this,"onPermalinkClicked",(e=>{e.preventDefault(),y.a.dispatch({action:w.a.ViewRoom,event_id:this.props.mxEvent.getId(),highlighted:!0,room_id:this.props.mxEvent.getRoomId(),metricsTrigger:this.context.timelineRenderingType===R.a.Search?"MessageSearch":void 0})})),r()(this,"onActionBarFocusChange",(e=>{this.setState({actionBarFocused:e})})),r()(this,"getTile",(()=>this.tile.current)),r()(this,"getReplyChain",(()=>this.replyChain.current)),r()(this,"getReactions",(()=>{if(!this.props.showReactions||!this.props.getRelationsForEvent)return null;const e=this.props.mxEvent.getId();return this.props.getRelationsForEvent(e,"m.annotation","m.reaction")})),r()(this,"onReactionsCreated",((e,t)=>{"m.annotation"===e&&"m.reaction"===t&&this.setState({reactions:this.getReactions()})})),r()(this,"onContextMenu",(e=>{this.showContextMenu(e)})),r()(this,"onTimestampContextMenu",(e=>{var t;this.showContextMenu(e,null===(t=this.props.permalinkCreator)||void 0===t?void 0:t.forEvent(this.props.mxEvent.getId()))})),r()(this,"onCloseMenu",(()=>{this.setState({contextMenu:null,actionBarFocused:!1})})),r()(this,"setQuoteExpanded",(e=>{this.setState({isQuoteExpanded:e})}));const a=this.thread;this.state={actionBarFocused:!1,verified:null,reactions:this.getReactions(),contextMenu:null,hover:!1,thread:a},this.suppressReadReceiptAnimation=!0,this.isListeningForReceipts=!1}get isEligibleForSpecialReceipt(){if(this.props.readReceipts&&this.props.readReceipts.length>0)return!1;if(!this.props.mxEvent)return!1;if(!I.a.get().getRoom(this.props.mxEvent.getRoomId()))return!1;const e=I.a.get().getUserId();if(this.props.mxEvent.getSender()!==e)return!1;return!![m.b.Sticker,m.b.RoomMessage,m.b.RoomMessageEncrypted,m.b.PollStart].includes(this.props.mxEvent.getType())}get shouldShowSentReceipt(){if(!this.isEligibleForSpecialReceipt)return!1;if(!this.props.lastSuccessful)return!1;if(this.props.eventSendStatus&&this.props.eventSendStatus!==u.a.SENT)return!1;const e=this.props.readReceipts||[],t=I.a.get().getUserId();return!e.some((e=>e.userId!==t))}get shouldShowSendingReceipt(){return!!this.isEligibleForSpecialReceipt&&!(!this.props.eventSendStatus||this.props.eventSendStatus===u.a.SENT)}componentDidMount(){this.suppressReadReceiptAnimation=!1;const e=I.a.get();this.props.forExport||(e.on(b.b.DeviceVerificationChanged,this.onDeviceVerificationChanged),e.on(b.b.UserTrustStatusChanged,this.onUserVerificationChanged),this.props.mxEvent.on(u.c.Decrypted,this.onDecrypted),this.props.mxEvent.on(u.c.Replaced,this.onReplaced),Ye.a.instance.addVisibleEvent(this.props.mxEvent),this.props.showReactions&&this.props.mxEvent.on(u.c.RelationsCreated,this.onReactionsCreated),(this.shouldShowSentReceipt||this.shouldShowSendingReceipt)&&(e.on(g.d.Receipt,this.onRoomReceipt),this.isListeningForReceipts=!0)),this.props.mxEvent.on(h.f.Update,this.updateThread),e.decryptEventIfNeeded(this.props.mxEvent);const t=e.getRoom(this.props.mxEvent.getRoomId());null==t||t.on(h.f.New,this.onNewThread),this.verifyEvent()}shouldComponentUpdate(e,t){return!!Object(B.c)(this.state,t)||!this.propsEqual(this.props,e)}componentWillUnmount(){const e=I.a.get();if(e){e.removeListener(b.b.DeviceVerificationChanged,this.onDeviceVerificationChanged),e.removeListener(b.b.UserTrustStatusChanged,this.onUserVerificationChanged),e.removeListener(g.d.Receipt,this.onRoomReceipt);const t=e.getRoom(this.props.mxEvent.getRoomId());null==t||t.off(h.f.New,this.onNewThread)}this.isListeningForReceipts=!1,this.props.mxEvent.removeListener(u.c.Decrypted,this.onDecrypted),this.props.mxEvent.removeListener(u.c.Replaced,this.onReplaced),this.props.showReactions&&this.props.mxEvent.removeListener(u.c.RelationsCreated,this.onReactionsCreated),this.props.mxEvent.off(h.f.Update,this.updateThread)}componentDidUpdate(e,t){t.verified!==this.state.verified&&this.props.onHeightChanged&&this.props.onHeightChanged(),this.isListeningForReceipts||!this.shouldShowSentReceipt&&!this.shouldShowSendingReceipt||(I.a.get().on(g.d.Receipt,this.onRoomReceipt),this.isListeningForReceipts=!0),e.eventSendStatus!==this.props.eventSendStatus&&this.verifyEvent()}get thread(){var e;let t=this.props.mxEvent.getThread();if(!t){const e=I.a.get().getRoom(this.props.mxEvent.getRoomId());t=null==e?void 0:e.findThreadForEvent(this.props.mxEvent)}return null!==(e=t)&&void 0!==e?e:null}renderThreadPanelSummary(){return this.state.thread?l.a.createElement("div",{className:"mx_ThreadPanel_replies"},l.a.createElement("span",{className:"mx_ThreadPanel_replies_amount"},this.state.thread.length),l.a.createElement(ct,{thread:this.state.thread})):null}renderThreadInfo(){var e;return(null===(e=this.state.thread)||void 0===e?void 0:e.id)===this.props.mxEvent.getId()?l.a.createElement(dt,{mxEvent:this.props.mxEvent,thread:this.state.thread,"data-testid":"thread-summary"}):this.context.timelineRenderingType===R.a.Search&&this.props.mxEvent.threadRootId?this.props.highlightLink?l.a.createElement("a",{className:"mx_ThreadSummary_icon",href:this.props.highlightLink},Object(f.a)("From a thread")):l.a.createElement("p",{className:"mx_ThreadSummary_icon"},Object(f.a)("From a thread")):void 0}verifyEvent(){var e;const t=null!==(e=this.props.mxEvent.replacingEvent())&&void 0!==e?e:this.props.mxEvent;if(!t.isEncrypted()||t.isRedacted())return void this.setState({verified:null});const a=I.a.get().getEventEncryptionInfo(t),n=t.getSender(),i=I.a.get().checkUserTrust(n);if(a.mismatchedSender)return void this.setState({verified:A.a.Warning});if(!i.isCrossSigningVerified())return void this.setState({verified:a.authenticated?A.a.Normal:A.a.Unauthenticated});const s=a.sender&&I.a.get().checkDeviceTrust(n,a.sender.deviceId);s?s.isVerified()?a.authenticated?this.setState({verified:A.a.Verified}):this.setState({verified:A.a.Unauthenticated}):this.setState({verified:A.a.Warning}):this.setState({verified:A.a.Unknown})}propsEqual(e,t){const a=Object.keys(e),n=Object.keys(t);if(a.length!==n.length)return!1;for(let n=0;n<a.length;n++){const i=a[n];if(!t.hasOwnProperty(i))return!1;if("readReceipts"===i){const a=e[i],n=t[i];if(a===n)continue;if(!a||!n)return!1;if(a.length!==n.length)return!1;for(let e=0;e<a.length;e++){if(a[e].userId!==n[e].userId)return!1;if(a[e].roomMember!==n[e].roomMember)return!1}}else if(e[i]!==t[i])return!1}return!0}shouldHighlight(){if(this.props.forExport)return!1;if(this.context.timelineRenderingType===R.a.Notification)return!1;if(this.context.timelineRenderingType===R.a.ThreadsList)return!1;const e=I.a.get().getPushActionsForEvent(this.props.mxEvent.replacingEvent()||this.props.mxEvent);return!(!e||!e.tweaks)&&(this.props.mxEvent.getSender()!==I.a.get().credentials.userId&&e.tweaks.highlight)}renderE2EPadlock(){var e;const t=null!==(e=this.props.mxEvent.replacingEvent())&&void 0!==e?e:this.props.mxEvent;if(!Object(wt.a)(t.getRoomId())){if(t.isDecryptionFailure())return l.a.createElement(Ht,null);if(t.isEncrypted()&&!t.isRedacted())return this.state.verified===A.a.Normal||this.state.verified===A.a.Verified?void 0:this.state.verified===A.a.Unauthenticated?l.a.createElement(Wt,null):this.state.verified===A.a.Unknown?l.a.createElement(Vt,null):l.a.createElement(Ft,null);if(I.a.get().isRoomEncrypted(t.getRoomId())){if(t.status===u.a.ENCRYPTING)return;if(t.status===u.a.NOT_SENT)return;if(t.isState())return;if(t.isRedacted())return;return l.a.createElement(Bt,null)}return null}}showContextMenu(e,t){const a=e.target,n=a instanceof HTMLAnchorElement?a:a.closest("a");a instanceof HTMLImageElement||(z.a.get().allowOverridingNativeContextMenus()||!Object($e.c)()&&!n)&&(this.props.editState||(e.preventDefault(),e.stopPropagation(),this.setState({contextMenu:{position:{left:e.clientX,top:e.clientY,bottom:e.clientY},link:(null==n?void 0:n.href)||t},actionBarFocused:!0})))}shouldHideEvent(){var e;return(null===(e=this.props.callEventGrouper)||void 0===e?void 0:e.hangupReason)===v.c.Replaced}renderContextMenu(){if(!this.state.contextMenu)return null;const e=this.getTile(),t=this.getReplyChain(),a=null!=e&&e.getEventTileOps?e.getEventTileOps():void 0,n=null!=t&&t.canCollapse()?t.collapse:void 0;return l.a.createElement(U.a,i()({},Object(F.j)(this.state.contextMenu.position),{mxEvent:this.props.mxEvent,permalinkCreator:this.props.permalinkCreator,eventTileOps:a,collapseReplyChain:n,onFinished:this.onCloseMenu,rightClick:!0,reactions:this.state.reactions,link:this.state.contextMenu.link,getRelationsForEvent:this.props.getRelationsForEvent}))}render(){var e,t,a;const n=this.props.mxEvent.getContent().msgtype,i=this.props.mxEvent.getType(),{hasRenderer:s,isBubbleMessage:r,isInfoMessage:o,isLeftAlignedBubbleMessage:c,noBubbleEvent:u,isSeeingThroughMessageHiddenForModeration:h}=Object(Ke.a)(this.props.mxEvent,this.context.showHiddenEvents,this.shouldHideEvent()),{isQuoteExpanded:g}=this.state;if(!s){const{mxEvent:e}=this.props;return p.a.warn(`Event type not supported: type:${i} isState:${e.isState()}`),l.a.createElement("div",{className:"mx_EventTile mx_EventTile_info mx_MNoticeBody"},l.a.createElement("div",{className:"mx_EventTile_line"},Object(f.a)("This event could not be displayed")))}const v=_e.a.isEligible(this.props.mxEvent),b=d()("mx_EventTile_line",{mx_EventTile_mediaLine:v,mx_EventTile_image:this.props.mxEvent.getType()===m.b.RoomMessage&&this.props.mxEvent.getContent().msgtype===m.e.Image,mx_EventTile_sticker:this.props.mxEvent.getType()===m.b.Sticker,mx_EventTile_emote:this.props.mxEvent.getType()===m.b.RoomMessage&&this.props.mxEvent.getContent().msgtype===m.e.Emote}),E=-1!==["sending","queued","encrypting"].indexOf(this.props.eventSendStatus),_=Object(nt.d)(this.props.mxEvent)&&this.props.isRedacted,S=this.props.mxEvent.isDecryptionFailure();let O=this.props.continuation;this.context.timelineRenderingType!==R.a.Room&&this.context.timelineRenderingType!==R.a.Search&&this.context.timelineRenderingType!==R.a.Thread&&this.props.layout!==D.a.Bubble&&(O=!1);const C=this.context.timelineRenderingType===R.a.Notification,x=!!this.props.editState,k=d()({mx_EventTile_bubbleContainer:r,mx_EventTile_leftAlignedBubble:c,mx_EventTile:!0,mx_EventTile_isEditing:x,mx_EventTile_info:o,mx_EventTile_12hr:this.props.isTwelveHour,mx_EventTile_sending:!x&&E,mx_EventTile_highlight:this.shouldHighlight(),mx_EventTile_selected:this.props.isSelectedEvent||this.state.contextMenu,mx_EventTile_continuation:O||i===m.b.CallInvite||Ot.d.CALL_EVENT_TYPE.matches(i),mx_EventTile_last:this.props.last,mx_EventTile_lastInSection:this.props.lastInSection,mx_EventTile_contextual:this.props.contextual,mx_EventTile_actionBarFocused:this.state.actionBarFocused,mx_EventTile_verified:!r&&this.state.verified===A.a.Verified,mx_EventTile_unverified:!r&&this.state.verified===A.a.Warning,mx_EventTile_unknown:!r&&this.state.verified===A.a.Unknown,mx_EventTile_bad:S,mx_EventTile_emote:n===m.e.Emote,mx_EventTile_noSender:this.props.hideSender,mx_EventTile_clamp:this.context.timelineRenderingType===R.a.ThreadsList||C,mx_EventTile_noBubble:u}),N=null!==this.props.eventSendStatus?"off":void 0;let U="#";this.props.permalinkCreator&&(U=this.props.permalinkCreator.forEvent(this.props.mxEvent.getId()));const F=this.props.mxEvent.status?void 0:this.props.mxEvent.getId();let B,V,W=null,H=null;if(C?(B=24,V=!0):o?(B=14,V=!1):this.context.timelineRenderingType===R.a.ThreadsList||this.context.timelineRenderingType===R.a.Thread&&!this.props.continuation?(B=32,V=!0):i===m.b.RoomCreate||r?(B=0,V=!1):this.props.layout==D.a.IRC?(B=14,V=!0):this.props.continuation&&this.context.timelineRenderingType!==R.a.File||i===m.b.CallInvite||Ot.d.CALL_EVENT_TYPE.matches(i)?(B=0,V=!1):(B=30,V=!0),this.props.mxEvent.sender&&B){let e;e=this.props.mxEvent.getContent().third_party_invite?this.props.mxEvent.target:this.props.mxEvent.sender;const t=![R.a.ThreadsList,R.a.Notification].includes(this.context.timelineRenderingType);W=l.a.createElement("div",{className:"mx_EventTile_avatar"},l.a.createElement(G.b,{member:e,width:B,height:B,viewUserOnClick:t,forceHistorical:this.props.mxEvent.getType()===m.b.RoomMember}))}V&&!0!==this.props.hideSender&&(H=this.context.timelineRenderingType===R.a.Room||this.context.timelineRenderingType===R.a.Search||this.context.timelineRenderingType===R.a.Pinned||this.context.timelineRenderingType===R.a.Thread?l.a.createElement(K.a,{onClick:this.onSenderProfileClick,mxEvent:this.props.mxEvent}):this.context.timelineRenderingType===R.a.ThreadsList?l.a.createElement(K.a,{mxEvent:this.props.mxEvent,withTooltip:!0}):l.a.createElement(K.a,{mxEvent:this.props.mxEvent}));const z=!x&&!this.props.forExport?l.a.createElement(Le,{mxEvent:this.props.mxEvent,reactions:this.state.reactions,permalinkCreator:this.props.permalinkCreator,getTile:this.getTile,getReplyChain:this.getReplyChain,onFocusChange:this.onActionBarFocusChange,isQuoteExpanded:g,toggleThreadExpanded:()=>this.setQuoteExpanded(!g),getRelationsForEvent:this.props.getRelationsForEvent}):void 0,$=this.props.mxEvent.getTs()&&(this.props.alwaysShowTimestamps||this.props.last||this.state.hover||this.state.actionBarFocused||Boolean(this.state.contextMenu));let Y=this.context.timelineRenderingType!==R.a.ThreadsList?this.props.mxEvent.getTs():null===(e=this.state.thread)||void 0===e||null===(t=e.replyToEvent)||void 0===t?void 0:t.getTs();"number"!=typeof Y&&(Y=this.props.mxEvent.getTs());const J=l.a.createElement(q.a,{showRelative:this.context.timelineRenderingType===R.a.ThreadsList,showTwelveHour:this.props.isTwelveHour,ts:Y}),Q=$&&Y?J:null;let X;_||(X=l.a.createElement(Ge,{mxEvent:this.props.mxEvent,reactions:this.state.reactions,key:"mx_EventTile_reactionsRow"}));const Z=l.a.createElement("a",{href:U,onClick:this.onPermalinkClicked,"aria-label":Object(P.m)(new Date(this.props.mxEvent.getTs()),this.props.isTwelveHour),onContextMenu:this.onTimestampContextMenu},Q),ee=this.props.layout===D.a.IRC,te=ee?null:Z,ae=ee?Z:null,ne=this.props.layout===D.a.Bubble?J:null,ie=!ee&&!r&&this.renderE2EPadlock(),se=ee&&!r&&this.renderE2EPadlock();let re;var oe,le;this.props.showReadReceipts&&(re=this.shouldShowSentReceipt||this.shouldShowSendingReceipt?l.a.createElement(Gt,{messageState:this.props.mxEvent.getAssociatedStatus()}):l.a.createElement(yt,{readReceipts:null!==(oe=this.props.readReceipts)&&void 0!==oe?oe:[],readReceiptMap:null!==(le=this.props.readReceiptMap)&&void 0!==le?le:{},checkUnmounting:this.props.checkUnmounting,suppressAnimation:this.suppressReadReceiptAnimation,isTwelveHour:this.props.isTwelveHour}));let ce;Object(nt.c)(this.props.mxEvent,this.context.showHiddenEvents)&&Object(j.c)(this.props.mxEvent)&&(ce=l.a.createElement(T,{parentEv:this.props.mxEvent,onHeightChanged:this.props.onHeightChanged,ref:this.replyChain,forExport:this.props.forExport,permalinkCreator:this.props.permalinkCreator,layout:this.props.layout,alwaysShowTimestamps:this.props.alwaysShowTimestamps||this.state.hover,isQuoteExpanded:g,setQuoteExpanded:this.setQuoteExpanded,getRelationsForEvent:this.props.getRelationsForEvent}));const de=(null===(a=this.props.mxEvent)||void 0===a?void 0:a.getSender())===I.a.get().getUserId();switch(this.context.timelineRenderingType){case R.a.Thread:return l.a.createElement(this.props.as||"li",{ref:this.ref,className:k,"aria-live":N,"aria-atomic":!0,"data-scroll-tokens":F,"data-has-reply":!!ce,"data-layout":this.props.layout,"data-self":de,"data-event-id":this.props.mxEvent.getId(),onMouseEnter:()=>this.setState({hover:!0}),onMouseLeave:()=>this.setState({hover:!1})},[l.a.createElement("div",{className:"mx_EventTile_senderDetails",key:"mx_EventTile_senderDetails"},W,H),l.a.createElement("div",{className:b,key:"mx_EventTile_line",onContextMenu:this.onContextMenu},this.renderContextMenu(),ce,Object(nt.g)(R.a.Thread,Mt(Mt({},this.props),{},{ref:this.tile,isSeeingThroughMessageHiddenForModeration:h,highlights:this.props.highlights,highlightLink:this.props.highlightLink,onHeightChanged:()=>this.props.onHeightChanged,permalinkCreator:this.props.permalinkCreator}),this.context.showHiddenEvents),z,l.a.createElement("a",{href:U,onClick:this.onPermalinkClicked},Q),re),X]);case R.a.Notification:case R.a.ThreadsList:{const e=I.a.get().getRoom(this.props.mxEvent.getRoomId());return l.a.createElement(this.props.as||"li",{ref:this.ref,className:k,tabIndex:-1,"aria-live":N,"aria-atomic":"true","data-scroll-tokens":F,"data-layout":this.props.layout,"data-shape":this.context.timelineRenderingType,"data-self":de,"data-has-reply":!!ce,onMouseEnter:()=>this.setState({hover:!0}),onMouseLeave:()=>this.setState({hover:!1}),onClick:e=>{var t;const a=e.currentTarget;let n=-1;switch(a.parentElement&&(n=Array.from(a.parentElement.children).indexOf(a)),this.context.timelineRenderingType){case R.a.Notification:this.viewInRoom(e);break;case R.a.ThreadsList:y.a.dispatch({action:w.a.ShowThread,rootEvent:this.props.mxEvent,push:!0}),Qe.b.trackInteraction("WebThreadsPanelThreadItem",e,null!==(t=n)&&void 0!==t?t:-1)}}},l.a.createElement(l.a.Fragment,null,l.a.createElement("div",{className:"mx_EventTile_details"},H,C&&e?l.a.createElement("span",{className:"mx_EventTile_truncated"}," ",Object(f.a)(" in <strong>%(room)s</strong>",{room:e.name},{strong:e=>l.a.createElement("strong",null,e)})):"",Q),C&&e?l.a.createElement("div",{className:"mx_EventTile_avatar"},l.a.createElement(L.a,{room:e,width:28,height:28})):W,l.a.createElement("div",{className:b,key:"mx_EventTile_line"},l.a.createElement("div",{className:"mx_EventTile_body"},this.props.mxEvent.isRedacted()?l.a.createElement(Je.a,{mxEvent:this.props.mxEvent}):this.props.mxEvent.isDecryptionFailure()?l.a.createElement(M.a,{mxEvent:this.props.mxEvent}):qe.a.instance.generatePreviewForEvent(this.props.mxEvent)),this.renderThreadPanelSummary()),this.context.timelineRenderingType===R.a.ThreadsList&&l.a.createElement(Dt,{viewInRoom:this.viewInRoom,copyLinkToThread:this.copyLinkToThread}),re,l.a.createElement(kt,{room:e||void 0,threadId:this.props.mxEvent.getId()})))}case R.a.File:return l.a.createElement(this.props.as||"li",{className:k,"aria-live":N,"aria-atomic":!0,"data-scroll-tokens":F},[l.a.createElement("div",{className:b,key:"mx_EventTile_line",onContextMenu:this.onContextMenu},this.renderContextMenu(),Object(nt.g)(R.a.File,Mt(Mt({},this.props),{},{ref:this.tile,isSeeingThroughMessageHiddenForModeration:h,highlights:this.props.highlights,highlightLink:this.props.highlightLink,onHeightChanged:this.props.onHeightChanged,permalinkCreator:this.props.permalinkCreator}),this.context.showHiddenEvents)),l.a.createElement("a",{className:"mx_EventTile_senderDetailsLink",key:"mx_EventTile_senderDetailsLink",href:U,onClick:this.onPermalinkClicked},l.a.createElement("div",{className:"mx_EventTile_senderDetails",onContextMenu:this.onTimestampContextMenu},H,Q))]);default:return l.a.createElement(this.props.as||"li",{ref:this.ref,className:k,tabIndex:-1,"aria-live":N,"aria-atomic":"true","data-scroll-tokens":F,"data-layout":this.props.layout,"data-self":de,"data-event-id":this.props.mxEvent.getId(),"data-has-reply":!!ce,onMouseEnter:()=>this.setState({hover:!0}),onMouseLeave:()=>this.setState({hover:!1})},l.a.createElement(l.a.Fragment,null,ae,H,se,W,l.a.createElement("div",{className:b,key:"mx_EventTile_line",onContextMenu:this.onContextMenu},this.renderContextMenu(),te,ie,ce,Object(nt.g)(this.context.timelineRenderingType,Mt(Mt({},this.props),{},{ref:this.tile,isSeeingThroughMessageHiddenForModeration:h,timestamp:ne,highlights:this.props.highlights,highlightLink:this.props.highlightLink,onHeightChanged:this.props.onHeightChanged,permalinkCreator:this.props.permalinkCreator}),this.context.showHiddenEvents),z,this.props.layout===D.a.IRC&&l.a.createElement(l.a.Fragment,null,X,this.renderThreadInfo())),this.props.layout!==D.a.IRC&&l.a.createElement(l.a.Fragment,null,X,this.renderThreadInfo()),re))}}}r()(At,"defaultProps",{onHeightChanged:function(){},forExport:!1,layout:D.a.Group}),r()(At,"contextType",R.b);const Lt=Object(o.forwardRef)(((e,t)=>l.a.createElement(l.a.Fragment,null,l.a.createElement(at,{mxEvent:e.mxEvent,layout:e.layout},l.a.createElement(At,i()({ref:t},e))))));var Ut;t.a=Lt;function Ft(e){return l.a.createElement(zt,i()({title:Object(f.a)("Encrypted by an unverified session"),icon:Ut.Warning},e))}function Bt(e){return l.a.createElement(zt,i()({title:Object(f.a)("Unencrypted"),icon:Ut.Warning},e))}function Vt(e){return l.a.createElement(zt,i()({title:Object(f.a)("Encrypted by a deleted session"),icon:Ut.Normal},e))}function Wt(e){return l.a.createElement(zt,i()({title:Object(f.a)("The authenticity of this encrypted message can't be guaranteed on this device."),icon:Ut.Normal},e))}function Ht(e){return l.a.createElement(zt,i()({title:Object(f.a)("This message could not be decrypted"),icon:Ut.DecryptionFailure},e))}!function(e){e.Normal="normal",e.Warning="warning",e.DecryptionFailure="decryption_failure"}(Ut||(Ut={}));class zt extends l.a.Component{constructor(e){super(e),r()(this,"onHoverStart",(()=>{this.setState({hover:!0})})),r()(this,"onHoverEnd",(()=>{this.setState({hover:!1})})),this.state={hover:!1}}render(){let e=null;this.state.hover&&(e=l.a.createElement(V.b,{className:"mx_EventTile_e2eIcon_tooltip",label:this.props.title}));const t=`mx_EventTile_e2eIcon mx_EventTile_e2eIcon_${this.props.icon}`;return l.a.createElement("div",{className:t,onMouseEnter:this.onHoverStart,onMouseLeave:this.onHoverEnd},e)}}function Gt(e){let{messageState:t}=e;const a=!t||"sent"===t,n="not_sent"===t,i=d()({mx_EventTile_receiptSent:a,mx_EventTile_receiptSending:!a&&!n});let s=null;n&&(s=l.a.createElement(H.a,{notification:W.a.RED_EXCLAMATION}));let r=Object(f.a)("Sending your message…");"encrypting"===t?r=Object(f.a)("Encrypting your message…"):a?r=Object(f.a)("Your message was sent"):n&&(r=Object(f.a)("Failed to send"));const[{showTooltip:o,hideTooltip:c},m]=bt({label:r,alignment:V.a.TopRight});return l.a.createElement("div",{className:"mx_EventTile_msgOption"},l.a.createElement("div",{className:"mx_ReadReceiptGroup"},l.a.createElement("div",{className:"mx_ReadReceiptGroup_button",onMouseOver:o,onMouseLeave:c,onFocus:o,onBlur:c},l.a.createElement("span",{className:"mx_ReadReceiptGroup_container"},l.a.createElement("span",{className:i},s))),m))}},467:function(e,t,a){"use strict";(function(e){a.d(t,"h",(function(){return q})),a.d(t,"b",(function(){return $})),a.d(t,"a",(function(){return Y})),a.d(t,"d",(function(){return J})),a.d(t,"c",(function(){return X})),a.d(t,"j",(function(){return te})),a.d(t,"k",(function(){return ne})),a.d(t,"e",(function(){return ie})),a.d(t,"i",(function(){return ce})),a.d(t,"l",(function(){return de})),a.d(t,"g",(function(){return me})),a.d(t,"f",(function(){return ue})),a.d(t,"m",(function(){return ve}));var n=a(136),i=a(289),s=a(322),r=a(1),o=a(342),l=a(122),c=a(294),d=a(317),m=a(938),u=a(274),h=a(624),p=a(1452),g=a(124),v=a(165),b=a(127),f=a(331),y=a(157),E=a(468),_=a(429),S=a(125),w=a(198),O=a(282),C=a(523),x=a(1575),k=a(564),j=a(341),R=a(879),I=a(189),T=a(184),N=a(1456),D=a(144),P=a(121),M=a(1457),A=a(1458),L=a(1459),U=a(1460),F=a(575),B=a(131),V=a(1573),W=a(128),H=a(521),z=a(153);const G="mx_hs_url",K="mx_is_url";async function q(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{let t=e.enableGuest||!1;const a=e.guestHsUrl,n=e.guestIsUrl,i=e.fragmentQueryParams||{},s=e.defaultDeviceDisplayName;if(t&&!a&&(r.a.warn("Cannot enable guest access: can't determine HS URL to use"),t=!1),t&&i.guest_user_id&&i.guest_access_token)return r.a.log("Using guest access credentials"),se({userId:i.guest_user_id,accessToken:i.guest_access_token,homeserverUrl:a,identityServerUrl:n,guest:!0},!0).then((()=>!0));return!!await te({ignoreGuest:Boolean(e.ignoreGuest)})||!!t&&Q(a,n,s)}catch(e){return!(e instanceof re)&&ae(e)}}async function $(){const{hsUrl:e,userId:t,hasAccessToken:a,isGuest:n}=await X();return e&&t&&a?[t,n]:[null,null]}function Y(e,t,a){if(!e.loginToken)return Promise.resolve(!1);const i=localStorage.getItem(j.a),s=localStorage.getItem(j.c);return i?Object(E.b)(i,s,"m.login.token",{token:e.loginToken,initial_device_display_name:t}).then((function(e){return r.a.log("Logged in with token"),ge().then((async()=>(await oe(e),sessionStorage.setItem("mx_fresh_login",String(!0)),!0)))})).catch((e=>(b.b.createDialog(D.a,{title:Object(P.a)("We couldn't log you in"),description:"ConnectionError"===e.name?Object(P.a)("Your homeserver was unreachable and was not able to log you in. Please try again. If this continues, please contact your homeserver administrator."):Object(P.a)("Your homeserver rejected your log in attempt. This could be due to things just taking too long. Please try again. If this continues, please contact your homeserver administrator."),button:Object(P.a)("Try again"),onFinished:e=>{if(e){var t;const e=Object(n.createClient)({baseUrl:i,idBaseUrl:s}),r=localStorage.getItem(j.b)||void 0;null===(t=y.a.get())||void 0===t||t.startSingleSignOn(e,"sso",a,r,o.c.LOGIN)}}}),r.a.error("Failed to log in with login token:"),r.a.error(e),!1))):(r.a.warn("Cannot log in with token: can't determine HS URL to use"),b.b.createDialog(D.a,{title:Object(P.a)("We couldn't log you in"),description:Object(P.a)("We asked the browser to remember which homeserver you use to let you sign in, but unfortunately your browser has forgotten it. Go to the sign in page and try again."),button:Object(P.a)("Try again")}),Promise.resolve(!1))}function J(e){if(e.reason===i.c.TOGGLED_LAZY_LOADING)return Promise.resolve().then((()=>{const t=e.value;return new Promise(t?e=>{b.b.createDialog(M.a,{onFinished:e})}:e=>{b.b.createDialog(A.a,{onFinished:e,host:window.location.host})})})).then((()=>l.a.get().store.deleteAllData())).then((()=>{y.a.get().reload()}))}function Q(e,t,a){r.a.log(`Doing guest login on ${e}`);return Object(n.createClient)({baseUrl:e}).registerGuest({body:{initial_device_display_name:a}}).then((a=>(r.a.log(`Registered as guest: ${a.user_id}`),se({userId:a.user_id,deviceId:a.device_id,accessToken:a.access_token,homeserverUrl:e,identityServerUrl:t,guest:!0},!0).then((()=>!0)))),(e=>(r.a.error("Failed to register as guest",e),!1)))}async function X(){const e=localStorage.getItem(G),t=localStorage.getItem(K);let a;try{a=await _.c("account","mx_access_token")}catch(e){r.a.error("StorageManager.idbLoad failed for account:mx_access_token",e)}if(!a&&(a=localStorage.getItem("mx_access_token"),a))try{await _.d("account","mx_access_token",a),localStorage.removeItem("mx_access_token")}catch(e){r.a.error("migration of access token to IndexedDB failed",e)}const n="true"===localStorage.getItem("mx_has_access_token")||!!a,i=localStorage.getItem("mx_user_id"),s=localStorage.getItem("mx_device_id");let o;return o=null!==localStorage.getItem("mx_is_guest")?"true"===localStorage.getItem("mx_is_guest"):"true"===localStorage.getItem("matrix-is-guest"),{hsUrl:e,isUrl:t,hasAccessToken:n,accessToken:a,userId:i,deviceId:s,isGuest:o}}async function Z(e){const t=new Uint8Array(e.length);for(let a=0;a<e.length;a++)t[a]=e.charCodeAt(a);const a=await window.crypto.subtle.importKey("raw",t,"HKDF",!1,["deriveBits"]);return t.fill(0),new Uint8Array(await window.crypto.subtle.deriveBits({name:"HKDF",hash:"SHA-256",salt:new Uint8Array(32),info:new Uint8Array(0)},a,256))}async function ee(){if(await new Promise((e=>{b.b.createDialog(U.a,{onFinished:e})})))throw await ge(),new re("Aborting login in progress because of storage inconsistency")}async function te(e){const t=null==e?void 0:e.ignoreGuest;if(!localStorage)return!1;const{hsUrl:a,isUrl:n,hasAccessToken:i,accessToken:o,userId:l,deviceId:c,isGuest:d}=await X();if(i&&!o&&await ee(),o&&l&&a){if(t&&d)return r.a.log("Ignoring stored guest account: "+l),!1;let e=o;const i=await y.a.get().getPickleKey(l,c);if(i){if(r.a.log("Got pickle key"),"string"!=typeof o){const t=await Z(i);e=await Object(s.b)(o,t,"access_token"),t.fill(0)}}else r.a.log("No pickle key available");const m="true"===sessionStorage.getItem("mx_fresh_login");return sessionStorage.removeItem("mx_fresh_login"),r.a.log(`Restoring session for ${l}`),await se({userId:l,deviceId:c,accessToken:e,homeserverUrl:a,identityServerUrl:n,guest:d,pickleKey:i,freshLogin:m},!1),!0}return r.a.log("No previous session found."),!1}async function ae(e){r.a.error("Unable to load session",e);const t=b.b.createDialog(L.a,{error:e}),[a]=await t.finished;return a?(await ge(),!1):q()}async function ne(e){e.freshLogin=!0,ve();const t=e.userId&&e.deviceId?await y.a.get().createPickleKey(e.userId,e.deviceId):null;return t?r.a.log("Created pickle key"):r.a.log("Pickle key not created"),se(Object.assign({},e,{pickleKey:t}),!0)}async function ie(e){const t=l.a.get().getUserId(),a=l.a.get().getDeviceId();ve(),localStorage.removeItem("mx_soft_logout"),le=!1;const n=e.userId!==t||e.deviceId!==a;return n&&r.a.warn("Clearing all data: Old session belongs to a different user/session"),e.pickleKey||(r.a.info("Lifecycle#hydrateSession: Pickle key not provided - trying to get one"),e.pickleKey=await y.a.get().getPickleKey(e.userId,e.deviceId)),se(e,n)}async function se(e,t){e.guest=Boolean(e.guest);const a=me();r.a.log("setLoggedIn: mxid: "+e.userId+" deviceId: "+e.deviceId+" guest: "+e.guest+" hs: "+e.homeserverUrl+" softLogout: "+a," freshLogin: "+e.freshLogin),g.a.dispatch({action:"on_logging_in"},!0),t&&await ge();const n=await _.a();n.dataInLocalStorage&&n.cryptoInited&&!n.dataInCryptoStore&&await ee(),l.a.replaceUsingCreds(e),Object(F.c)(e.userId),I.a.instance.isEnabled()&&I.a.instance.startListeningToSettingsChanges();const i=l.a.get();if(e.freshLogin&&S.b.getValue("feature_dehydration")){const t=await i.rehydrateDevice();t&&(e.deviceId=t),delete e.freshLogin}if(localStorage)try{await oe(e),sessionStorage.removeItem("mx_fresh_login")}catch(e){r.a.warn("Error using local storage: can't persist session!",e)}else r.a.warn("No local storage available: can't persist session!");return g.a.fire(W.a.OnLoggedIn),await he(!a),i}g.a.register((e=>{if(e.action===W.a.TriggerLogout)pe();else if(e.action===W.a.OverwriteLogin){se(e.credentials,!0)}}));class re extends Error{}async function oe(e){var t;if(localStorage.setItem(G,e.homeserverUrl),e.identityServerUrl&&localStorage.setItem(K,e.identityServerUrl),localStorage.setItem("mx_user_id",e.userId),localStorage.setItem("mx_is_guest",JSON.stringify(e.guest)),e.accessToken?localStorage.setItem("mx_has_access_token","true"):localStorage.deleteItem("mx_has_access_token"),e.pickleKey){let t;try{const a=await Z(e.pickleKey);t=await Object(s.c)(e.accessToken,a,"access_token"),a.fill(0)}catch(e){r.a.warn("Could not encrypt access token",e)}try{await _.d("account","mx_access_token",t||e.accessToken)}catch(t){localStorage.setItem("mx_access_token",e.accessToken)}localStorage.setItem("mx_has_pickle_key",String(!0))}else{try{await _.d("account","mx_access_token",e.accessToken)}catch(t){localStorage.setItem("mx_access_token",e.accessToken)}"true"===localStorage.getItem("mx_has_pickle_key")&&r.a.error("Expected a pickle key, but none provided. Encryption may not work.")}e.deviceId&&localStorage.setItem("mx_device_id",e.deviceId),null===(t=c.a.persistCredentials)||void 0===t||t.call(c.a,e),r.a.log(`Session persisted for ${e.userId}`)}let le=!1;function ce(){if(!l.a.get())return;if(I.a.instance.logout(),l.a.get().isGuest())return void e((()=>pe()));le=!0;const t=l.a.get();y.a.get().destroyPickleKey(t.getUserId(),t.getDeviceId()),t.logout(!0).then(pe,(e=>{r.a.warn("Failed to call logout API: token will not be invalidated",e),pe()}))}function de(){l.a.get()&&(localStorage.setItem("mx_soft_logout","true"),r.a.log("Soft logout initiated"),le=!0,g.a.dispatch({action:"on_client_not_viable"}),ve(!1))}function me(){return"true"===localStorage.getItem("mx_soft_logout")}function ue(){return le}async function he(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];r.a.log("Lifecycle: Starting MatrixClient"),g.a.dispatch({action:"will_start_client"},!0),z.b.instance.typingStore.reset(),w.a.sharedInstance().reset(),V.a.instance.prepare(),u.default.start(),h.a.sharedInstance().start(),v.a.makeShared().start(),O.a.sharedInstance().startWatching(),f.b.instance.start(),T.b.instance.start(),C.a.sharedInstance().start(),e?(await d.a.init(),await l.a.start()):(r.a.warn("Caller requested only auxiliary services be started"),await l.a.assign()),S.b.runMigrations(),x.a.sharedInstance().start(),S.b.getValue("lowBandwidth")||p.a.start(),k.a.getInstance().start(),g.a.dispatch({action:"client_started"}),me()&&de()}async function pe(){var e;g.a.fire(W.a.OnLoggedOut,!0),ve(),await ge({deleteEverything:!0}),null===(e=N.a.onLoggedOutAndStorageCleared)||void 0===e||e.call(N.a),B.b.get().logout_redirect_url&&(r.a.log("Redirecting to external provider to finish logout"),window.setTimeout((()=>{window.location.href=B.b.get().logout_redirect_url}),100)),le=!1}async function ge(e){var t;if(window.localStorage){const t=R.a.instance.getWireInvites(),a=window.localStorage.getItem("mx_registration_time");window.localStorage.clear(),H.a.clear();try{await _.b("account","mx_access_token")}catch(e){r.a.error("idbDelete failed for account:mx_access_token",e)}null!=e&&e.deleteEverything||(t.forEach((e=>{const t=e.roomId;delete e.roomId,R.a.instance.storeInvite(t,e)})),a&&window.localStorage.setItem("mx_registration_time",a))}null===(t=window.sessionStorage)||void 0===t||t.clear();const a=Object(m.a)({baseUrl:""});await d.a.deleteEventIndex(),await a.clearStores()}function ve(){var e;let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];u.default.stop(),T.b.instance.stop(),h.a.sharedInstance().stop(),z.b.instance.typingStore.reset(),p.a.stop(),f.b.instance.stop(),O.a.sharedInstance().stopWatching(),C.a.sharedInstance().stop(),x.a.sharedInstance().stop(),null===(e=v.a.shared())||void 0===e||e.stop(),d.a.stop();const a=l.a.get();a&&(a.stopClient(),a.removeAllListeners(),t&&(l.a.unset(),d.a.unset()))}window.mxLoginWithAccessToken=async(e,t)=>{const a=Object(n.createClient)({baseUrl:e,accessToken:t}),{user_id:i}=await a.whoami();await se({homeserverUrl:e,accessToken:t,userId:i},!0)}}).call(this,a(54).setImmediate)},468:function(e,t,a){"use strict";a.d(t,"a",(function(){return c})),a.d(t,"b",(function(){return d}));var n=a(13),i=a.n(n),s=a(136),r=a(1),o=a(342),l=a(294);class c{constructor(e,t,a,n){this.hsUrl=e,this.isUrl=t,this.fallbackHsUrl=a,i()(this,"flows",[]),i()(this,"defaultDeviceDisplayName",void 0),i()(this,"tempClient",null),this.defaultDeviceDisplayName=n.defaultDeviceDisplayName}getHomeserverUrl(){return this.hsUrl}getIdentityServerUrl(){return this.isUrl}setHomeserverUrl(e){this.tempClient=null,this.hsUrl=e}setIdentityServerUrl(e){this.tempClient=null,this.isUrl=e}createTemporaryClient(){return this.tempClient||(this.tempClient=Object(s.createClient)({baseUrl:this.hsUrl,idBaseUrl:this.isUrl})),this.tempClient}async getFlows(){const e=this.createTemporaryClient(),{flows:t}=await e.loginFlows(),a=t.find((e=>"m.login.sso"===e.type&&o.a.findIn(e)));return this.flows=a?[a]:t,this.flows}loginViaPassword(e,t,a,n){const i=!!e&&e.indexOf("@")>0;let s;s=t&&a?{type:"m.id.phone",country:t,phone:a,number:a}:i?{type:"m.id.thirdparty",medium:"email",address:e}:{type:"m.id.user",user:e};const o={password:n,identifier:s,initial_device_display_name:this.defaultDeviceDisplayName},l=e=>d(this.fallbackHsUrl,this.isUrl,"m.login.password",o).catch((t=>{throw r.a.log("fallback HS login failed",t),e}));let c=null;return d(this.hsUrl,this.isUrl,"m.login.password",o).catch((e=>{if(c=e,403===e.httpStatus&&this.fallbackHsUrl)return l(c);throw c})).catch((e=>{throw r.a.log("Login failed",e),e}))}}async function d(e,t,a,n){var i;const o=Object(s.createClient)({baseUrl:e,idBaseUrl:t}),c=await o.login(a,n),d=c.well_known;d&&(d["m.homeserver"]&&d["m.homeserver"].base_url&&(e=d["m.homeserver"].base_url,r.a.log(`Overrode homeserver setting with ${e} from login response`)),d["m.identity_server"]&&d["m.identity_server"].base_url&&(t=d["m.identity_server"].base_url,r.a.log(`Overrode IS setting with ${t} from login response`)));const m={homeserverUrl:e,identityServerUrl:t,userId:c.user_id,deviceId:c.device_id,accessToken:c.access_token};return null===(i=l.a.examineLoginResponse)||void 0===i||i.call(l.a,c,m),m}},469:function(e,t,a){"use strict";a.d(t,"a",(function(){return c}));var n=a(120),i=a.n(n),s=a(122),r=a(121),o=a(135),l=a(656);class c extends i.a.Component{constructor(e){super(e),this.state={verificationRequest:this.props.verificationRequest},this.props.verificationRequestPromise&&this.props.verificationRequestPromise.then((e=>{this.setState({verificationRequest:e})}))}render(){const e=this.state.verificationRequest,t=e&&e.otherUserId,a=this.props.member||t&&s.a.get().getUser(t),n=e&&e.isSelfVerification?Object(r.a)("Verify other device"):Object(r.a)("Verification Request");return i.a.createElement(o.a,{className:"mx_InfoDialog",onFinished:this.props.onFinished,contentId:"mx_Dialog_content",title:n,hasCancel:!0},i.a.createElement(l.a,{layout:"dialog",verificationRequest:this.props.verificationRequest,verificationRequestPromise:this.props.verificationRequestPromise,onClose:this.props.onFinished,member:a,isRoomEncrypted:!1}))}}},470:function(e,t,a){"use strict";a.d(t,"a",(function(){return g})),a.d(t,"b",(function(){return v}));var n=a(13),i=a.n(n),s=a(17),r=a.n(s),o=a(239),l=a(1),c=a(175),d=a(122),m=a(251),u=a(127),h=a(257),p=a(121);let g;!function(e){e[e.Loading=0]="Loading",e[e.Intro=1]="Intro",e[e.Busy=2]="Busy",e[e.Done=3]="Done",e[e.ConfirmSkip=4]="ConfirmSkip",e[e.Finished=5]="Finished",e[e.ConfirmReset=6]="ConfirmReset"}(g||(g={}));class v extends r.a{constructor(){super(...arguments),i()(this,"started",void 0),i()(this,"phase",void 0),i()(this,"verificationRequest",null),i()(this,"backupInfo",null),i()(this,"keyId",null),i()(this,"keyInfo",null),i()(this,"hasDevicesToVerifyAgainst",void 0),i()(this,"onUserTrustStatusChanged",(e=>{if(e!==d.a.get().getUserId())return;d.a.get().getCrossSigningId()&&(this.phase=g.Done,this.emit("update"))})),i()(this,"onVerificationRequest",(e=>{this.setActiveVerificationRequest(e)})),i()(this,"onVerificationRequestChange",(()=>{var e,t;if(null!==(e=this.verificationRequest)&&void 0!==e&&e.cancelled)this.verificationRequest.off(o.l.Change,this.onVerificationRequestChange),this.verificationRequest=null,this.emit("update");else if((null===(t=this.verificationRequest)||void 0===t?void 0:t.phase)===o.b){this.verificationRequest.off(o.l.Change,this.onVerificationRequestChange),this.verificationRequest=null;const e=d.a.get().getCrossSigningId();this.phase=e?g.Done:g.Busy,this.emit("update")}}))}static sharedInstance(){return window.mxSetupEncryptionStore||(window.mxSetupEncryptionStore=new v),window.mxSetupEncryptionStore}start(){if(this.started)return;this.started=!0,this.phase=g.Loading;const e=d.a.get();e.on(c.b.VerificationRequest,this.onVerificationRequest),e.on(c.b.UserTrustStatusChanged,this.onUserTrustStatusChanged);const t=e.getVerificationRequestsToDeviceInProgress(e.getUserId());t.length&&this.setActiveVerificationRequest(t[t.length-1]),this.fetchKeyInfo()}stop(){var e;this.started&&(this.started=!1,null===(e=this.verificationRequest)||void 0===e||e.off(o.l.Change,this.onVerificationRequestChange),d.a.get()&&(d.a.get().removeListener(c.b.VerificationRequest,this.onVerificationRequest),d.a.get().removeListener(c.b.UserTrustStatusChanged,this.onUserTrustStatusChanged)))}async fetchKeyInfo(){if(!this.started)return;const e=d.a.get(),t=await e.isSecretStored("m.cross_signing.master");null===t||0===Object.keys(t).length?(this.keyId=null,this.keyInfo=null):(this.keyId=Object.keys(t)[0],this.keyInfo=t[this.keyId]);const a=await e.getDehydratedDevice(),n=e.getUserId(),i=e.getStoredCrossSigningForUser(n);this.hasDevicesToVerifyAgainst=e.getStoredDevicesForUser(n).some((e=>e.getIdentityKey()&&(!a||e.deviceId!=a.device_id)&&(null==i?void 0:i.checkDeviceTrust(i,e,!1,!0).isCrossSigningVerified()))),this.phase=g.Intro,this.emit("update")}async usePassPhrase(){this.phase=g.Busy,this.emit("update");const e=d.a.get();try{const t=await e.getKeyBackupVersion();this.backupInfo=t,this.emit("update"),await new Promise(((a,n)=>{Object(m.b)((async()=>{await e.checkOwnCrossSigningTrust(),a(),t&&await e.restoreKeyBackupWithSecretStorage(t)})).catch(n)})),e.getCrossSigningId()&&(this.phase=g.Done,this.emit("update"))}catch(e){e instanceof m.a||l.a.log(e),this.phase=g.Intro,this.emit("update")}}skip(){this.phase=g.ConfirmSkip,this.emit("update")}skipConfirm(){this.phase=g.Finished,this.emit("update")}returnAfterSkip(){this.phase=g.Intro,this.emit("update")}reset(){this.phase=g.ConfirmReset,this.emit("update")}async resetConfirm(){try{await Object(m.b)((async()=>{const e=d.a.get();await e.bootstrapCrossSigning({authUploadDeviceSigningKeys:async t=>{const{finished:a}=u.b.createDialog(h.a,{title:Object(p.a)("Setting up keys"),matrixClient:e,makeRequest:t}),[n]=await a;if(!n)throw new Error("Cross-signing key upload auth canceled")},setupNewCrossSigning:!0}),this.phase=g.Finished}),!0)}catch(e){l.a.error("Error resetting cross-signing",e),this.phase=g.Intro}this.emit("update")}returnAfterReset(){this.phase=g.Intro,this.emit("update")}done(){var e;this.phase=g.Finished,this.emit("update"),null===(e=d.a.get().crypto)||void 0===e||e.cancelAndResendAllOutgoingKeyRequests()}async setActiveVerificationRequest(e){this.started&&e.otherUserId===d.a.get().getUserId()&&(this.verificationRequest&&this.verificationRequest.off(o.l.Change,this.onVerificationRequestChange),this.verificationRequest=e,await e.accept(),e.on(o.l.Change,this.onVerificationRequestChange),this.emit("update"))}lostKeys(){return!this.hasDevicesToVerifyAgainst&&!this.keyInfo}}},471:function(e,t,a){"use strict";var n=a(130),i=a.n(n),s=a(132),r=a.n(s),o=a(120),l=a.n(o),c=a(169),d=a(151),m=a(142);const u=["children"];t.a=e=>{let{children:t}=e,a=r()(e,u);return l.a.createElement(c.d,{handleHomeEnd:!0,handleLeftRight:!0,onKeyDown:e=>{const t=e.target;if("INPUT"===t.tagName)return;let a=!0;switch(Object(d.a)().getAccessibilityAction(e)){case m.h.ArrowUp:case m.h.ArrowDown:t.hasAttribute("aria-haspopup")&&t.click();break;default:a=!1}a&&(e.preventDefault(),e.stopPropagation())}},(e=>{let{onKeyDownHandler:n}=e;return l.a.createElement("div",i()({},a,{onKeyDown:n,role:"toolbar"}),t)}))}},472:function(e,t,a){"use strict";a.d(t,"a",(function(){return p}));var n=a(13),i=a.n(n),s=a(141),r=a(16),o=a(146),l=a(125),c=a(201),d=a(124),m=a(155),u=a(137),h=a(128);class p extends c.a{constructor(){super(d.a),i()(this,"waitingRooms",[]),i()(this,"onMyMembership",(async e=>{const t=l.b.getValue("breadcrumbs",null,!0);this.meetsRoomRequirement&&Object(r.t)(t)&&await l.b.setValue("breadcrumbs",null,u.a.ACCOUNT,!0)})),i()(this,"onRoom",(async e=>{const t=this.waitingRooms.find((t=>t.roomId===e.roomId));t&&(this.waitingRooms.splice(this.waitingRooms.indexOf(t),1),Date.now()-t.addedTs>9e4||await this.appendRoom(e))})),l.b.monitorSetting("breadcrumb_rooms",null),l.b.monitorSetting("breadcrumbs",null),l.b.monitorSetting("feature_breadcrumbs_v2",null)}static get instance(){return p.internalInstance}get rooms(){return this.state.rooms||[]}get visible(){return!!this.state.enabled&&this.meetsRoomRequirement}get meetsRoomRequirement(){var e;return!!l.b.getValue("feature_breadcrumbs_v2")||(null===(e=this.matrixClient)||void 0===e?void 0:e.getVisibleRooms().length)>=20}async onAction(e){if(this.matrixClient)if(e.action===h.a.SettingUpdated)"breadcrumb_rooms"===e.settingName?await this.updateRooms():"breadcrumbs"!==e.settingName&&"feature_breadcrumbs_v2"!==e.settingName||await this.updateState({enabled:l.b.getValue("breadcrumbs",null)});else if(e.action===h.a.ViewRoom)if(e.auto_join&&!this.matrixClient.getRoom(e.room_id))this.waitingRooms.push({roomId:e.room_id,addedTs:Date.now()});else{const t=this.matrixClient.getRoom(e.room_id),a=null==t?void 0:t.getMyMembership();t&&"join"===a&&await this.appendRoom(t)}else if(e.action===h.a.JoinRoom){const t=this.matrixClient.getRoom(e.roomId);t&&await this.appendRoom(t)}}async onReady(){await this.updateRooms(),await this.updateState({enabled:l.b.getValue("breadcrumbs",null)}),this.matrixClient.on(s.d.MyMembership,this.onMyMembership),this.matrixClient.on(o.b.Room,this.onRoom)}async onNotReady(){this.matrixClient.removeListener(s.d.MyMembership,this.onMyMembership),this.matrixClient.removeListener(o.b.Room,this.onRoom)}async updateRooms(){let e=l.b.getValue("breadcrumb_rooms");e&&0!==e.length||(e=[]);const t=e.map((e=>this.matrixClient.getRoom(e))).filter((e=>!!e)),a=this.state.rooms||[];Object(m.d)(t,a)&&await this.updateState({rooms:t})}async appendRoom(e){let t=!1;const a=(this.state.rooms||[]).slice(),n=this.matrixClient.getRoomUpgradeHistory(e.roomId);if(n.length>1){e=n[n.length-1];for(let e=0;e<n.length-1;e++){const i=a.findIndex((t=>t.roomId===n[e].roomId));-1!==i&&(a.splice(i,1),t=!0)}}const i=a.findIndex((t=>t.roomId===e.roomId));if(0!==i&&(-1!==i&&a.splice(i,1),a.splice(0,0,e),t=!0),a.length>20&&(a.splice(20,a.length-20),t=!0),t){await this.updateState({rooms:a});const e=a.map((e=>e.roomId));e.length>0&&await l.b.setValue("breadcrumb_rooms",null,u.a.ACCOUNT,e)}}}i()(p,"internalInstance",(()=>{const e=new p;return e.start(),e})())},473:function(e,t,a){"use strict";a.d(t,"a",(function(){return r})),a.d(t,"b",(function(){return o}));var n=a(1),i=a(241),s=a(26);function r(e){const t=new s.a(e).get("embedded_pages");let a=t?new s.a(t).get("home_url"):null;var r;(a||(a=e.welcomePageUrl,a&&n.a.warn("You are using a deprecated config option: `welcomePageUrl`. Please use `embedded_pages.home_url` instead, per https://github.com/vector-im/element-web/issues/21428")),a)||(a=null===(r=Object(i.d)())||void 0===r?void 0:r.home_url);return a}function o(e){const t=new s.a(e).get("embedded_pages");return!!t&&!0===new s.a(t).get("login_for_welcome")}},474:function(e,t,a){"use strict";let n;a.d(t,"a",(function(){return n})),function(e){e.PersonalMessaging="PersonalMessaging",e.WorkMessaging="WorkMessaging",e.CommunityMessaging="CommunityMessaging",e.Skip="Skip"}(n||(n={}))},475:function(e,t,a){"use strict";a.d(t,"a",(function(){return g}));var n=a(13),i=a.n(n),s=a(120),r=a.n(s),o=a(1),l=a(121),c=a(122),d=a(157),m=a(127),u=a(131),h=a(277),p=a(123);class g extends r.a.PureComponent{constructor(e){super(e),i()(this,"onClearCacheAndReload",(()=>{d.a.get()&&(c.a.get().stopClient(),c.a.get().store.deleteAllData().then((()=>{d.a.get().reload()})))})),i()(this,"onBugReport",(()=>{m.b.createDialog(h.a,{label:"react-soft-crash",error:this.state.error})})),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){let{componentStack:a}=t;o.a.error(e),o.a.error("The above error occurred while React was rendering the following components:",a)}render(){if(this.state.error){const e="https://github.com/vector-im/element-web/issues/new/choose";let t,a;return u.b.get().bug_report_endpoint_url&&(t=r.a.createElement(r.a.Fragment,null,r.a.createElement("p",null,Object(l.a)("Please <newIssueLink>create a new issue</newIssueLink> on GitHub so that we can investigate this bug.",{},{newIssueLink:t=>r.a.createElement("a",{target:"_blank",rel:"noreferrer noopener",href:e},t)})),r.a.createElement("p",null,Object(l.a)("If you've submitted a bug via GitHub, debug logs can help us track down the problem. "),Object(l.a)("Debug logs contain application usage data including your username, the IDs or aliases of the rooms you have visited, which UI elements you last interacted with, and the usernames of other users. They do not contain messages.")),r.a.createElement(p.a,{onClick:this.onBugReport,kind:"primary"},Object(l.a)("Submit debug logs")))),c.a.get()&&(a=r.a.createElement(p.a,{onClick:this.onClearCacheAndReload,kind:"danger"},Object(l.a)("Clear cache and reload"))),r.a.createElement("div",{className:"mx_ErrorBoundary"},r.a.createElement("div",{className:"mx_ErrorBoundary_body"},r.a.createElement("h1",null,Object(l.a)("Something went wrong!")),t,a))}return this.props.children}}},476:function(e,t,a){"use strict";var n=a(13),i=a.n(n),s=a(120),r=a.n(s),o=a(139),l=a(121),c=a(200),d=a(325);class m extends s.PureComponent{constructor(){super(...arguments),i()(this,"validate",Object(c.a)({rules:[{key:"required",test:e=>{let{value:t,allowEmpty:a}=e;return a||!!t},invalid:()=>Object(l.a)(this.props.labelRequired)},{key:"email",test:e=>{let{value:t}=e;return!t||d.a(t)},invalid:()=>Object(l.a)(this.props.labelInvalid)}]})),i()(this,"onValidate",(async e=>{let t=this.validate;this.props.validationRules&&(t=this.props.validationRules);const a=await t(e);return this.props.onValidate&&this.props.onValidate(a),a}))}render(){return r.a.createElement(o.a,{id:this.props.id,ref:this.props.fieldRef,type:"text",label:Object(l.a)(this.props.label),value:this.props.value,autoFocus:this.props.autoFocus,onChange:this.props.onChange,onValidate:this.onValidate})}}i()(m,"defaultProps",{label:Object(l.c)("Email"),labelRequired:Object(l.c)("Enter email address"),labelInvalid:Object(l.c)("Doesn't look like a valid email address")}),t.a=m},477:function(e,t,a){"use strict";a.d(t,"a",(function(){return o}));var n=a(120),i=a.n(n),s=a(1551),r=a(918);class o extends i.a.Component{render(){return i.a.createElement("div",{className:"mx_AuthHeader"},i.a.createElement(s.a,null),i.a.createElement(r.a,{disabled:this.props.disableLanguageSelector}))}}},478:function(e,t,a){"use strict";a.d(t,"a",(function(){return o}));var n=a(126),i=a.n(n),s=a(120),r=a.n(s);function o(e){let{flex:t,className:a,children:n}=e;return r.a.createElement("main",{className:i()("mx_AuthBody",a,{mx_AuthBody_flex:t})},n)}},486:function(e,t,a){"use strict";a.d(t,"b",(function(){return lt})),a.d(t,"a",(function(){return ct}));var n=a(120),i=a.n(n),s=a(136),r=a(122),o=a(140);var l=a(166),c=a(1),d=a(274),m=a(165);function u(e,t){const[a,i]=Object(n.useState)(e),o=r.a.get(),l=function(e){const t=Object(n.useRef)(e);return t.current=e,Object(n.useCallback)((function(){return t.current(...arguments)}),[])}(t);return Object(n.useEffect)((()=>{if(a)return;let e=null,t=!0;const n=async()=>{null!==e&&(clearTimeout(e),e=null),i(await l(o)),t&&(e=window.setTimeout(n,5e3))};return n().catch((e=>c.a.warn("could not update user onboarding context",e))),o.on(s.ClientEvent.AccountData,n),()=>{t=!1,o.off(s.ClientEvent.AccountData,n),null!==e&&(clearTimeout(e),e=null)}}),[o,l,a]),a}var h,p,g,v,b,f,y,E,_,S,w,O,C,x,k,j,R,I,T,N,D,P,M,A,L,U,F,B=a(13),V=a.n(B);function W(){return W=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},W.apply(this,arguments)}function H(e){return n.createElement("svg",W({viewBox:"0 0 564 168",xmlns:"http://www.w3.org/2000/svg",role:"presentation","aria-hidden":!0},e),h||(h=n.createElement("defs",null,n.createElement("radialGradient",{id:"f-droid_svg__a",cx:113,cy:-12.89,r:59.662,gradientTransform:"matrix(0 1.9611 -1.9778 0 5.51 -198.6)",gradientUnits:"userSpaceOnUse"},n.createElement("stop",{stopColor:"#fff",stopOpacity:.098,offset:0}),n.createElement("stop",{stopColor:"#fff",stopOpacity:0,offset:1})))),p||(p=n.createElement("path",{d:"M22 2h520c11.08 0 20 8.92 20 20v124c0 11.08-8.92 20-20 20H22c-11.08 0-20-8.92-20-20V22C2 10.92 10.92 2 22 2z",stroke:"#a6a6a6",strokeWidth:4})),g||(g=n.createElement("path",{d:"M199.26 45.46v-6.682h-5.499v-2.766h8.831v10.681q-1.949 1.383-4.299 2.1-2.349.7-5.015.7-5.832 0-9.131-3.4-3.283-3.415-3.283-9.497 0-6.099 3.283-9.498 3.3-3.416 9.131-3.416 2.433 0 4.616.6 2.2.6 4.049 1.766v3.583q-1.867-1.583-3.966-2.383-2.1-.8-4.416-.8-4.565 0-6.865 2.55-2.283 2.549-2.283 7.598 0 5.032 2.283 7.581 2.3 2.55 6.865 2.55 1.783 0 3.183-.3 1.4-.317 2.516-.967zm9.48-21.33h15.729v2.833h-12.364v7.365h11.847v2.832h-11.847v9.015h12.664v2.832H208.74zm18.12 0h21.045v2.833h-8.831v22.045h-3.383V26.963h-8.83zm35.14 0h3.366v24.877H262zm6.61 0h21.045v2.833h-8.831v22.045h-3.383V26.963h-8.83zm45.24 2.28q-3.666 0-5.832 2.733-2.15 2.732-2.15 7.448 0 4.699 2.15 7.431 2.166 2.733 5.832 2.733t5.799-2.733q2.15-2.732 2.15-7.431 0-4.716-2.15-7.448-2.133-2.733-5.799-2.733zm0-2.733q5.232 0 8.365 3.516 3.132 3.5 3.132 9.398 0 5.882-3.132 9.397-3.133 3.5-8.365 3.5-5.249 0-8.398-3.5-3.132-3.499-3.132-9.397t3.132-9.398q3.15-3.516 8.398-3.516zm16.76.453h4.532l11.031 20.812V24.13h3.266v24.877h-4.532l-11.031-20.812v20.812h-3.266z",fill:"#fff","aria-label":"GET IT ON"})),v||(v=n.createElement("path",{d:"M180.81 136v-8.118l7.19-1.391V78.017l-7.19-1.392v-8.164h53.762v18.508h-10.391l-.603-8.071h-22.034v18.6h23.657v10.438h-23.657v18.555l7.236 1.391V136zm62.16-23.66v-10.437h26.162v10.437zM277.29 136v-8.118l7.283-1.53v-48.15l-7.283-1.577v-8.164h29.641q9.045 0 15.957 4.268 6.912 4.221 10.762 11.736 3.897 7.468 3.897 17.163v1.252q0 9.602-3.85 17.117-3.804 7.468-10.67 11.736-6.865 4.268-15.91 4.268zm20.828-10.344h8.303q5.613 0 9.51-2.922 3.896-2.97 5.937-8.118 2.087-5.149 2.087-11.736v-1.299q0-6.68-2.087-11.782-2.041-5.149-5.938-8.025-3.896-2.922-9.509-2.922h-8.303zM344.79 136v-8.118l6.494-1.391V95.366l-7.19-1.392V85.81h19.807l.51 6.216.093 1.113q1.856-4.082 4.593-6.17 2.736-2.087 6.54-2.087 1.206 0 2.644.232 1.438.186 2.551.51l-1.438 12.478-6.726-.37q-2.876-.14-4.685.974-1.763 1.113-3.154 3.2v24.585l6.494 1.392V136zm63.08.98q-7.422 0-12.756-3.247t-8.164-9q-2.83-5.797-2.83-13.312v-.974q0-7.469 2.83-13.22 2.83-5.799 8.118-9.046 5.334-3.293 12.71-3.293 7.468 0 12.756 3.293 5.288 3.247 8.117 9t2.83 13.266v.974q0 7.515-2.83 13.313-2.83 5.752-8.117 9-5.289 3.247-12.664 3.247zm0-10.391q3.525 0 5.752-1.902t3.293-5.288q1.067-3.433 1.067-7.979v-.974q0-4.453-1.067-7.839-1.066-3.433-3.34-5.335-2.226-1.948-5.798-1.948-3.479 0-5.752 1.948-2.273 1.902-3.34 5.335-1.02 3.386-1.02 7.84v.973q0 4.546 1.02 7.979 1.067 3.433 3.34 5.334 2.273 1.856 5.845 1.856zM437.1 136v-8.118l6.54-1.391V95.366l-7.236-1.392V85.81h20.781v40.681l6.494 1.392V136zm6.077-60.813v-11.55h14.009v11.55zm44.293 61.793q-5.984 0-10.298-3.062-4.268-3.107-6.54-8.627-2.273-5.567-2.273-12.988v-.975q0-7.932 2.273-13.87 2.319-5.937 6.586-9.23 4.268-3.34 10.205-3.34 4.129 0 7.237 1.67 3.108 1.623 5.38 4.638V73.198l-7.236-1.391v-8.164h20.781v62.854l6.494 1.391v8.118h-18.23l-1.02-6.123q-2.366 3.479-5.66 5.288-3.246 1.81-7.7 1.81zm4.036-10.53q2.83 0 4.963-1.206 2.134-1.206 3.572-3.479v-21.292q-1.392-2.412-3.526-3.71-2.133-1.346-4.917-1.346-3.386 0-5.566 2.04-2.134 1.995-3.154 5.567-.974 3.572-.974 8.303v.975q0 6.587 2.226 10.39 2.227 3.758 7.376 3.758z",fill:"#fff","aria-label":"F-Droid"})),b||(b=n.createElement("path",{d:"M146.34 25.898l-11.184 14.474",fill:"#8ab000",stroke:"#769616",strokeLinecap:"round",strokeWidth:6.579})),f||(f=n.createElement("path",{d:"M146.29 22.477c1.192.032 2.003.497 2.579 1.182-5.332 6.34-6.232 7.344-13.513 16.37-2.684 3.472-5.479 1.677-2.795-1.794l11.184-14.474a3.26 3.26 0 012.545-1.284z",color:"#000",fill:"#fff",fillOpacity:.298})),y||(y=n.createElement("path",{d:"M148.89 23.793a3.29 3.29 0 01.058 4.095l-11.184 14.474c-2.684 3.474-3.026-1.61-3.026-1.61s9.829-11.87 14.153-16.959z",color:"#000",fill:"#263238",fillOpacity:.2})),E||(E=n.createElement("path",{d:"M147 23.003c1.153 0 2.526.374 2.168 2.103-.27 1.318-12.263 15.984-12.263 15.984-2.684 3.47-6.563 1.779-3.879-1.693l11.142-14.4c.685-.763 1.603-1.957 2.832-1.994z",color:"#000",fill:"#8ab000"})),_||(_=n.createElement("path",{d:"M33.653 25.898l11.184 14.474",fill:"#8ab000",stroke:"#769616",strokeLinecap:"round",strokeWidth:6.579})),S||(S=n.createElement("path",{d:"M33.711 22.477c-1.192.032-2.003.497-2.579 1.182 5.332 6.34 6.232 7.344 13.513 16.37 2.684 3.472 5.479 1.677 2.795-1.794L36.256 23.76a3.26 3.26 0 00-2.545-1.284z",color:"#000",fill:"#fff",fillOpacity:.298})),w||(w=n.createElement("path",{d:"M31.108 23.793a3.29 3.29 0 00-.058 4.095l11.184 14.474c2.684 3.474 3.026-1.61 3.026-1.61s-9.829-11.87-14.153-16.959z",color:"#000",fill:"#263238",fillOpacity:.2})),O||(O=n.createElement("path",{d:"M32.993 23.003c-1.153 0-2.526.374-2.168 2.103.27 1.318 12.263 15.984 12.263 15.984 2.684 3.47 6.563 1.779 3.879-1.693l-11.142-14.4c-.685-.763-1.603-1.957-2.832-1.994z",color:"#000",fill:"#8ab000"})),C||(C=n.createElement("path",{d:"M47.893 35.109h84.211a7.878 7.878 0 017.895 7.894v18.211a7.878 7.878 0 01-7.895 7.895H47.893a7.878 7.878 0 01-7.895-7.895v-18.21a7.878 7.878 0 017.895-7.895z",fill:"#aeea00"})),x||(x=n.createElement("path",{d:"M47.893 42.74h84.211a7.878 7.878 0 017.895 7.895v10.526a7.878 7.878 0 01-7.895 7.895H47.893a7.878 7.878 0 01-7.895-7.895V50.635a7.878 7.878 0 017.895-7.895z",fill:"#263238",fillOpacity:.2})),k||(k=n.createElement("path",{d:"M47.893 35.109h84.211a7.878 7.878 0 017.895 7.894V53.53a7.878 7.878 0 01-7.895 7.895H47.893a7.878 7.878 0 01-7.895-7.895V43.003a7.878 7.878 0 017.895-7.894z",fill:"#fff",fillOpacity:.298})),j||(j=n.createElement("path",{d:"M47.893 38.003h84.211c4.374 0 7.895 2.883 7.895 6.462v15.079c0 3.58-3.521 6.462-7.895 6.462H47.893c-4.374 0-7.895-2.882-7.895-6.462V44.465c0-3.58 3.521-6.462 7.895-6.462z",fill:"#aeea00"})),R||(R=n.createElement("path",{d:"M47.893 71.944h84.211a7.878 7.878 0 017.895 7.895v52.211a7.878 7.878 0 01-7.895 7.895H47.893a7.878 7.878 0 01-7.895-7.895V79.839a7.878 7.878 0 017.895-7.895z",fill:"#1976d2"})),I||(I=n.createElement("path",{d:"M47.893 105.89h84.211a7.878 7.878 0 017.895 7.895v18.42a7.878 7.878 0 01-7.895 7.896H47.893a7.878 7.878 0 01-7.895-7.895v-18.421a7.878 7.878 0 017.895-7.895z",fill:"#263238",fillOpacity:.2})),T||(T=n.createElement("path",{d:"M47.893 71.681h84.211a7.878 7.878 0 017.895 7.895v18.421a7.878 7.878 0 01-7.895 7.895H47.893a7.878 7.878 0 01-7.895-7.895V79.576a7.878 7.878 0 017.895-7.895z",fill:"#fff",fillOpacity:.2})),N||(N=n.createElement("path",{d:"M47.893 75.102h84.211c4.374 0 7.895 3.19 7.895 7.154v47.693c0 3.963-3.521 7.153-7.895 7.153H47.893c-4.374 0-7.895-3.19-7.895-7.153V82.256c0-3.963 3.521-7.154 7.895-7.154z",fill:"#1976d2"})),D||(D=n.createElement("path",{d:"M89.998 89.714c-7.579 0-14 5.224-15.876 12.237h8.455a8.46 8.46 0 017.421-4.342 8.495 8.495 0 018.553 8.553 8.495 8.495 0 01-8.553 8.552 8.471 8.471 0 01-7.71-4.868h-8.3c1.69 7.279 8.242 12.763 16.01 12.763 9.038 0 16.449-7.41 16.449-16.448 0-9.037-7.41-16.448-16.448-16.448z",color:"#000",fill:"#0d47a1"})),P||(P=n.createElement("path",{d:"M115.13 106.16a25.132 25.132 0 01-25.132 25.132 25.132 25.132 0 01-25.131-25.132 25.132 25.132 0 0125.131-25.132 25.132 25.132 0 0125.132 25.132z",fill:"none",stroke:"#0d47a1",strokeLinecap:"round",strokeWidth:5})),M||(M=n.createElement("path",{d:"M73.55 52.477a8.882 10.197 0 01-8.88 10.198 8.882 10.197 0 01-8.882-10.198 8.882 10.197 0 018.881-10.197 8.882 10.197 0 018.882 10.197z",fill:"#263238",fillOpacity:.2})),A||(A=n.createElement("path",{d:"M73.55 53.793a8.882 8.882 0 01-8.88 8.882 8.882 8.882 0 01-8.882-8.882 8.882 8.882 0 018.881-8.882 8.882 8.882 0 018.882 8.882z",fill:"#fff"})),L||(L=n.createElement("path",{d:"M124.87 52.477a8.882 10.197 0 01-8.882 10.198 8.882 10.197 0 01-8.881-10.198 8.882 10.197 0 018.881-10.197 8.882 10.197 0 018.882 10.197z",fill:"#263238",fillOpacity:.2})),U||(U=n.createElement("path",{d:"M124.87 53.793a8.882 8.882 0 01-8.882 8.882 8.882 8.882 0 01-8.881-8.882 8.882 8.882 0 018.881-8.882 8.882 8.882 0 018.882 8.882z",fill:"#fff"})),F||(F=n.createElement("path",{d:"M33.71 22.47a3.29 3.29 0 00-2.662 5.336l9.474 12.262a7.894 7.894 0 00-.527 2.824v18.211a7.877 7.877 0 007.895 7.895h84.21a7.877 7.877 0 007.895-7.895v-18.21c0-1-.19-1.95-.525-2.827l9.472-12.26a3.29 3.29 0 00-2.433-5.334 3.29 3.29 0 00-2.772 1.31l-9.013 11.666a7.91 7.91 0 00-2.623-.45H47.89c-.922 0-1.8.163-2.621.45l-9.016-11.666a3.29 3.29 0 00-2.543-1.312zm14.18 49.527a7.877 7.877 0 00-7.894 7.894v52.211a7.877 7.877 0 007.894 7.895h84.211a7.877 7.877 0 007.894-7.895v-52.21a7.877 7.877 0 00-7.894-7.895z",color:"#000",fill:"url(#f-droid_svg__a)",fillRule:"evenodd"})))}var z,G,K,q,$,Y,J,Q,X,Z,ee,te,ae,ne,ie,se,re,oe,le,ce,de,me;function ue(){return ue=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},ue.apply(this,arguments)}function he(e){return n.createElement("svg",ue({viewBox:"0 0 180 53.332",xmlns:"http://www.w3.org/2000/svg",role:"presentation","aria-hidden":!0},e),z||(z=n.createElement("defs",null,n.createElement("linearGradient",{id:"google-play_svg__a",x2:1,gradientTransform:"scale(-31.64 31.64) rotate(45 -.903 -.925)",gradientUnits:"userSpaceOnUse"},n.createElement("stop",{stopColor:"#00a0ff",offset:0}),n.createElement("stop",{stopColor:"#00a1ff",offset:.007}),n.createElement("stop",{stopColor:"#00beff",offset:.26}),n.createElement("stop",{stopColor:"#00d2ff",offset:.512}),n.createElement("stop",{stopColor:"#00dfff",offset:.76}),n.createElement("stop",{stopColor:"#00e3ff",offset:1})),n.createElement("linearGradient",{id:"google-play_svg__b",x2:1,gradientTransform:"matrix(-32.255 0 0 32.255 45.098 26.675)",gradientUnits:"userSpaceOnUse"},n.createElement("stop",{stopColor:"#ffe000",offset:0}),n.createElement("stop",{stopColor:"#ffbd00",offset:.409}),n.createElement("stop",{stopColor:"orange",offset:.775}),n.createElement("stop",{stopColor:"#ff9c00",offset:1})),n.createElement("linearGradient",{id:"google-play_svg__c",x2:1,gradientTransform:"scale(-42.903 42.903) rotate(45 -1.222 -.585)",gradientUnits:"userSpaceOnUse"},n.createElement("stop",{stopColor:"#ff3a44",offset:0}),n.createElement("stop",{stopColor:"#c31162",offset:1})),n.createElement("linearGradient",{id:"google-play_svg__d",x2:1,gradientTransform:"scale(19.156 -19.156) rotate(-44.998 .238 -.62)",gradientUnits:"userSpaceOnUse"},n.createElement("stop",{stopColor:"#32a071",offset:0}),n.createElement("stop",{stopColor:"#2da771",offset:.069}),n.createElement("stop",{stopColor:"#15cf74",offset:.476}),n.createElement("stop",{stopColor:"#06e775",offset:.801}),n.createElement("stop",{stopColor:"#00f076",offset:1})),n.createElement("linearGradient",{id:"google-play_svg__e",x2:1,gradientTransform:"matrix(-32.255 0 0 32.255 45.098 26.675)",gradientUnits:"userSpaceOnUse"},n.createElement("stop",{stopColor:"#ccb300",offset:0}),n.createElement("stop",{stopColor:"#cc9700",offset:.409}),n.createElement("stop",{stopColor:"#cc8400",offset:.775}),n.createElement("stop",{stopColor:"#cc7d00",offset:1})),n.createElement("linearGradient",{id:"google-play_svg__f",x2:1,gradientTransform:"scale(-42.903 42.903) rotate(45 -1.222 -.585)",gradientUnits:"userSpaceOnUse"},n.createElement("stop",{stopColor:"#cc2e36",offset:0}),n.createElement("stop",{stopColor:"#9c0e4e",offset:1})),n.createElement("linearGradient",{id:"google-play_svg__g",x2:1,gradientTransform:"scale(-31.64 31.64) rotate(45 -.903 -.925)",gradientUnits:"userSpaceOnUse"},n.createElement("stop",{stopColor:"#008de0",offset:0}),n.createElement("stop",{stopColor:"#008de0",offset:.007}),n.createElement("stop",{stopColor:"#00a7e0",offset:.26}),n.createElement("stop",{stopColor:"#00b8e0",offset:.512}),n.createElement("stop",{stopColor:"#00c4e0",offset:.76}),n.createElement("stop",{stopColor:"#00c7e0",offset:1})),n.createElement("linearGradient",{id:"google-play_svg__h",x2:1,gradientTransform:"scale(-42.903 42.903) rotate(45 -1.222 -.585)",gradientUnits:"userSpaceOnUse"},n.createElement("stop",{stopColor:"#e0333c",offset:0}),n.createElement("stop",{stopColor:"#ab0f56",offset:1})),n.createElement("linearGradient",{id:"google-play_svg__i",x2:1,gradientTransform:"matrix(-32.255 0 0 32.255 45.098 26.675)",gradientUnits:"userSpaceOnUse"},n.createElement("stop",{stopColor:"#e0c500",offset:0}),n.createElement("stop",{stopColor:"#e0a600",offset:.409}),n.createElement("stop",{stopColor:"#e09100",offset:.775}),n.createElement("stop",{stopColor:"#e08900",offset:1})),n.createElement("linearGradient",{id:"google-play_svg__j",x2:1,gradientTransform:"matrix(-32.255 0 0 32.255 45.098 26.675)",gradientUnits:"userSpaceOnUse"},n.createElement("stop",{stopColor:"#ffe840",offset:0}),n.createElement("stop",{stopColor:"#ffce40",offset:.409}),n.createElement("stop",{stopColor:"#ffbc40",offset:.775}),n.createElement("stop",{stopColor:"#ffb540",offset:1})),n.createElement("linearGradient",{id:"google-play_svg__k",x2:1,gradientTransform:"scale(-31.64 31.64) rotate(45 -.903 -.925)",gradientUnits:"userSpaceOnUse"},n.createElement("stop",{stopColor:"#40b8ff",offset:0}),n.createElement("stop",{stopColor:"#40b9ff",offset:.007}),n.createElement("stop",{stopColor:"#40ceff",offset:.26}),n.createElement("stop",{stopColor:"#40ddff",offset:.512}),n.createElement("stop",{stopColor:"#40e7ff",offset:.76}),n.createElement("stop",{stopColor:"#40eaff",offset:1})),n.createElement("linearGradient",{id:"google-play_svg__l",x2:1,gradientTransform:"scale(19.156 -19.156) rotate(-44.998 .238 -.62)",gradientUnits:"userSpaceOnUse"},n.createElement("stop",{stopColor:"#65b895",offset:0}),n.createElement("stop",{stopColor:"#62bd95",offset:.069}),n.createElement("stop",{stopColor:"#50db97",offset:.476}),n.createElement("stop",{stopColor:"#44ed98",offset:.801}),n.createElement("stop",{stopColor:"#40f498",offset:1})))),G||(G=n.createElement("path",{d:"M173.33 53.332H6.67c-3.667 0-6.667-3-6.667-6.667V6.668c0-3.667 3-6.667 6.667-6.667h166.66c3.667 0 6.667 3 6.667 6.667v39.997c0 3.666-3 6.666-6.667 6.666"})),K||(K=n.createElement("path",{d:"M101.93 17.465v-5.118l-.044-1.544-.202.074 4.107 6.588h1.28V9.199h-1.295v4.816l.044 1.544.202-.074-3.927-6.286h-1.458v8.266",fill:"#fff"})),q||(q=n.createElement("path",{d:"M173.33 0H6.67C3.003 0 .003 3 .003 6.666v40c0 3.666 3 6.666 6.667 6.666h166.66c3.667 0 6.667-3 6.667-6.667V6.668c0-3.667-3-6.667-6.667-6.667m0 1.067c3.088 0 5.6 2.512 5.6 5.6v39.997c0 3.087-2.512 5.6-5.6 5.6H6.67a5.607 5.607 0 01-5.6-5.6v-40c0-3.087 2.512-5.6 5.6-5.6h166.66",fill:"#a6a6a6"})),$||($=n.createElement("path",{d:"M63.356 13.657c0-.203-.02-.41-.058-.628l-.02-.11h-4.121v1.229h3.038v-.134l-.133-.011c-.058.67-.272 1.176-.632 1.537-.573.571-1.276.853-2.14.854-.81 0-1.499-.28-2.092-.85-.587-.568-.88-1.294-.881-2.212.001-.917.294-1.643.881-2.21.593-.571 1.281-.85 2.092-.851.902.002 1.582.3 2.088.901l.094.112.806-.807.086-.087-.079-.093c-.327-.39-.764-.7-1.3-.93a4.259 4.259 0 00-1.695-.347c-1.185-.001-2.208.416-3.038 1.24-.833.823-1.252 1.857-1.251 3.072-.001 1.215.418 2.25 1.252 3.073.829.824 1.852 1.24 3.037 1.24 1.234 0 2.258-.41 3.036-1.226l-.003.002c.691-.69 1.034-1.622 1.033-2.764M69.502 9.2h-4.937v8.265h4.937v-1.25h-3.643v-2.27h3.286v-1.227h-3.286v-2.27h3.643m4.335 0h2.234v-1.25h-5.764v1.25h2.235v7.017h1.295m7.239 0V9.199h-1.294v8.266m5.853-7.017h2.235v-1.25h-5.764v1.25h2.234v7.017h1.295m6.652-4.132c0-.903.284-1.627.85-2.203.57-.575 1.252-.858 2.078-.86.825.002 1.509.285 2.078.86.566.576.85 1.3.85 2.203s-.284 1.627-.85 2.202c-.57.576-1.253.858-2.078.86-.826-.002-1.508-.284-2.076-.86s-.852-1.3-.852-2.202zm5.957 3.058c.808-.83 1.217-1.86 1.216-3.058 0-1.193-.41-2.22-1.221-3.054-.813-.837-1.83-1.26-3.024-1.259-1.2-.001-2.221.42-3.028 1.254-.81.83-1.217 1.86-1.216 3.059-.001 1.199.406 2.228 1.214 3.06s1.83 1.253 3.03 1.251c1.2.002 2.22-.419 3.029-1.253m-7.387 12.612c-3.136 0-5.693 2.384-5.693 5.67 0 3.266 2.557 5.67 5.693 5.67s5.691-2.405 5.691-5.67c0-3.287-2.555-5.67-5.691-5.67zm0 2.232c1.719 0 3.2 1.397 3.2 3.438 0 2.019-1.481 3.435-3.2 3.435-1.718 0-3.201-1.416-3.201-3.435 0-2.041 1.483-3.438 3.201-3.438zm-12.422-2.232c-3.136 0-5.693 2.384-5.693 5.67 0 3.266 2.557 5.67 5.693 5.67s5.693-2.405 5.693-5.67c0-3.287-2.557-5.67-5.693-5.67zm0 2.232c1.718 0 3.201 1.397 3.201 3.438 0 2.019-1.483 3.435-3.201 3.435-1.719 0-3.2-1.416-3.2-3.435 0-2.041 1.481-3.438 3.2-3.438zm-14.772-.494v2.407h5.757c-.172 1.353-.623 2.34-1.31 3.028-.838.838-2.148 1.762-4.447 1.762-3.544 0-6.315-2.857-6.315-6.401s2.771-6.402 6.315-6.402c1.912 0 3.308.752 4.34 1.719l1.696-1.697c-1.439-1.375-3.35-2.427-6.036-2.427-4.854 0-8.935 3.952-8.935 8.807s4.08 8.806 8.935 8.806c2.621 0 4.597-.859 6.143-2.47 1.59-1.59 2.084-3.823 2.084-5.627 0-.56-.043-1.074-.129-1.504zm55.554-1.74c-2.921 0-5.348 2.3-5.348 5.672 0 3.179 2.405 5.67 5.627 5.67 2.6 0 4.105-1.59 4.727-2.514l-1.934-1.287c-.644.946-1.525 1.566-2.793 1.566-1.267 0-2.17-.578-2.75-1.716l7.582-3.137-.256-.645c-.472-1.268-1.912-3.609-4.855-3.609zm.086 2.191c.989 0 1.826.495 2.105 1.203l-5.068 2.106c-.065-2.191 1.696-3.309 2.963-3.309zm-9.126 8.807h2.493V23.332h-2.492zm-7.15-10.996c-2.835 0-5.434 2.49-5.434 5.691 0 3.18 2.599 5.65 5.434 5.65 1.353 0 2.428-.602 2.986-1.29h.086v.816c0 2.17-1.16 3.33-3.03 3.33-1.524 0-2.47-1.095-2.856-2.02l-2.17.903c.624 1.504 2.278 3.352 5.027 3.352 2.921 0 5.39-1.72 5.39-5.908v-10.18h-2.36v.921h-.087c-.558-.666-1.633-1.265-2.986-1.265zm.215 2.232c1.697 0 3.03 1.461 3.03 3.46 0 1.975-1.333 3.414-3.03 3.414-1.72 0-3.158-1.439-3.158-3.415 0-1.997 1.44-3.459 3.158-3.459zm26.545-7.904v16.668h2.486v-6.315h3.475c2.758 0 5.469-1.997 5.469-5.177s-2.711-5.176-5.47-5.176zm2.486 2.32h3.54c1.86 0 2.915 1.54 2.915 2.858 0 1.29-1.056 2.855-2.916 2.855h-3.539zm18.914 3.321c-1.8 0-3.667.792-4.44 2.55l2.21.923c.472-.922 1.349-1.223 2.273-1.223 1.286 0 2.594.773 2.615 2.144v.172c-.45-.257-1.414-.642-2.594-.642-2.38 0-4.804 1.308-4.804 3.752 0 2.23 1.951 3.668 4.138 3.668 1.673 0 2.596-.751 3.176-1.631h.084v1.287h2.402v-6.39c0-2.96-2.208-4.61-5.06-4.61zm.385 5.938c1.095 0 1.608.236 2.273.558-.193 1.544-1.52 2.639-2.957 2.639l-.002-.002c-.815 0-1.951-.405-1.951-1.414 0-1.286 1.416-1.781 2.637-1.781zm13.415-5.575l-2.852 7.227h-.085l-2.96-7.227h-2.68l4.438 10.1-2.53 5.619h2.596l6.84-15.719zm-22.4 10.664h2.488V23.331h-2.488z",fill:"#fff"})),Y||(Y=n.createElement("path",{d:"M14.007 43.191l-.099-.095c-.388-.41-.617-1.047-.617-1.873v.194V11.93v.203c0-.894.267-1.567.714-1.97l16.516 16.515-16.515 16.515m-.71-31.48v-.004.003m0-.01",fill:"url(#google-play_svg__a)"})),J||(J=n.createElement("path",{d:"M36.025 32.378l.126-.071 6.522-3.706c.622-.354 1.036-.782 1.243-1.236-.206.454-.621.883-1.243 1.236l-6.522 3.706-.126.071m.002-.195l-5.506-5.507 5.505-5.506 6.647 3.776c.844.48 1.318 1.098 1.397 1.73v.002c-.08.63-.553 1.248-1.397 1.728l-6.646 3.777",fill:"url(#google-play_svg__b)"})),Q||(Q=n.createElement("path",{d:"M15.184 43.819a1.723 1.723 0 00.002 0 2.515 2.515 0 00-.002 0m0-.195c-.46 0-.863-.15-1.177-.433l16.515-16.516 5.506 5.507L16.68 43.176c-.536.304-1.043.447-1.494.447m-1.182-.241a1.814 1.814 0 01-.086-.084l.086.084",fill:"url(#google-play_svg__c)"})),X||(X=n.createElement("path",{d:"M30.52 26.676L14.004 10.16a1.716 1.716 0 011.177-.433c.452 0 .96.145 1.496.449L36.025 21.17l-5.506 5.506m5.63-5.63L16.677 9.98c-.536-.304-1.044-.448-1.496-.448h-.005.007c.451 0 .959.144 1.494.448L36.15 21.045",fill:"url(#google-play_svg__d)"})),Z||(Z=n.createElement("path",{d:"M15.313 43.811c.42-.024.883-.168 1.371-.445l19.353-10.995-19.353 10.994c-.487.277-.952.42-1.371.445m-1.301-.43l-.004-.004a.038.038 0 01.004.004m-.09-.088l-.009-.008c.004.002.006.006.009.008"})),ee||(ee=n.createElement("path",{d:"M36.025 32.378l.126-.071-.126.071",fill:"url(#google-play_svg__e)"})),te||(te=n.createElement("path",{d:"M15.185 43.819c-.461 0-.864-.15-1.178-.434a.038.038 0 00-.005-.003l-.086-.084-.008-.008.099-.1c.314.284.716.434 1.177.434.451 0 .958-.144 1.494-.448l19.348-10.994.124.124-.126.072L16.677 43.37c-.488.276-.952.42-1.37.444a2.515 2.515 0 01-.123.004",fill:"url(#google-play_svg__f)"})),ae||(ae=n.createElement("path",{d:"M13.914 43.285c-.388-.411-.617-1.049-.617-1.874 0 .825.23 1.462.617 1.873"})),ne||(ne=n.createElement("path",{d:"M13.908 43.29c-.388-.41-.617-1.047-.617-1.873v-.194c0 .825.23 1.462.617 1.873l.099.095-.099.099",fill:"url(#google-play_svg__g)"})),ie||(ie=n.createElement("path",{d:"M13.908 43.29l.099-.1v.001l-.099.099",fill:"url(#google-play_svg__h)"})),se||(se=n.createElement("path",{d:"M36.151 32.307l-.124-.124 6.646-3.777c.844-.48 1.318-1.098 1.397-1.728 0 .231-.051.463-.154.688-.207.453-.62.882-1.243 1.235l-6.522 3.706",fill:"url(#google-play_svg__i)"})),re||(re=n.createElement("path",{d:"M44.083 26.667c0-.698-.467-1.395-1.398-1.924l-6.523-3.707 6.523 3.706c.932.53 1.399 1.228 1.398 1.925",fill:"#404040"})),oe||(oe=n.createElement("path",{d:"M44.07 26.675c-.08-.632-.553-1.25-1.397-1.73l-6.647-3.775.124-.124 6.523 3.706c.93.529 1.397 1.226 1.397 1.923",fill:"url(#google-play_svg__j)"})),le||(le=n.createElement("path",{d:"M13.297 11.917v-.002.002m.006-.217v-.003.003m0-.006v-.006.006m0-.008c.077-1.37.822-2.16 1.876-2.165a1.715 1.715 0 00-1.166.433l-.004.003c-.033.03-.064.061-.095.093-.35.37-.57.925-.61 1.636",fill:"#404040"})),ce||(ce=n.createElement("path",{d:"M13.291 12.132v-.204c0-.073.002-.145.006-.215V11.7c.04-.71.261-1.265.61-1.635l.098.097c-.447.404-.714 1.077-.714 1.97m.712-2.16l.003-.004-.003.003",fill:"url(#google-play_svg__k)"})),de||(de=n.createElement("path",{d:"M15.178 9.521h.004-.004",fill:"#404040"})),me||(me=n.createElement("path",{d:"M36.025 21.17L16.677 10.176c-.536-.304-1.044-.448-1.496-.448-.46 0-.863.15-1.177.432l-.097-.097a1.78 1.78 0 01.095-.094l.003-.003c.312-.28.71-.43 1.166-.433h.01c.452 0 .96.144 1.496.448l19.472 11.064-.125.125",fill:"url(#google-play_svg__l)"})))}var pe,ge,ve;function be(){return be=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},be.apply(this,arguments)}function fe(e){return n.createElement("svg",be({viewBox:"0 0 159.55 53.333",xmlns:"http://www.w3.org/2000/svg",role:"presentation","aria-hidden":!0},e),pe||(pe=n.createElement("path",{d:"M146.84.001H12.71c-.489 0-.972 0-1.46.003-.407.002-.812.01-1.224.016-.888.023-1.786.077-2.672.236a8.876 8.876 0 00-2.535.836A8.58 8.58 0 001.09 4.825a8.782 8.782 0 00-.833 2.538c-.16.883-.216 1.776-.24 2.669-.012.409-.013.82-.02 1.228v30.818c.007.414.008.815.02 1.23.024.893.08 1.786.24 2.669.155.893.418 1.73.833 2.539a8.28 8.28 0 001.571 2.152 8.356 8.356 0 002.158 1.571 8.95 8.95 0 002.535.842c.886.158 1.784.21 2.672.235.412.01.817.015 1.225.015.488.002.97.002 1.46.002h134.13c.48 0 .966 0 1.445-.002.408 0 .824-.006 1.23-.015.894-.025 1.79-.077 2.667-.235a9.083 9.083 0 002.544-.842 8.417 8.417 0 002.157-1.57 8.556 8.556 0 001.573-2.153c.41-.809.676-1.646.826-2.54.165-.882.216-1.775.249-2.669.004-.414.004-.815.004-1.229.01-.484.01-.966.01-1.458V12.715c0-.488 0-.972-.01-1.455 0-.409 0-.82-.004-1.228-.033-.893-.084-1.786-.25-2.67a8.763 8.763 0 00-.825-2.537 8.626 8.626 0 00-1.573-2.162 8.641 8.641 0 00-2.157-1.57 9.02 9.02 0 00-2.544-.837c-.877-.159-1.773-.213-2.667-.236-.406-.006-.822-.014-1.23-.016C147.807 0 147.322 0 146.84 0",fill:"#b2b1b1"})),ge||(ge=n.createElement("path",{d:"M11.267 52.166c-.407 0-.803-.005-1.206-.014-.745-.021-1.63-.062-2.492-.217a7.847 7.847 0 01-2.21-.731 7.214 7.214 0 01-1.862-1.355 7.092 7.092 0 01-1.36-1.862 7.616 7.616 0 01-.724-2.21c-.163-.897-.205-1.807-.222-2.5-.01-.28-.02-1.217-.02-1.217v-30.8s.012-.922.02-1.193c.017-.698.059-1.607.22-2.495.143-.818.38-1.54.725-2.216.354-.7.808-1.325 1.353-1.864a7.423 7.423 0 011.87-1.363 7.762 7.762 0 012.204-.726c.898-.16 1.808-.2 2.5-.219l1.204-.016h137.02l1.217.017c.684.017 1.595.057 2.48.217.802.14 1.53.38 2.227.73.684.35 1.31.808 1.855 1.354a7.38 7.38 0 011.365 1.873c.344.681.577 1.403.715 2.198.153.841.2 1.705.23 2.517.004.377.004.783.004 1.187.012.5.012.975.012 1.455V40.62c0 .485 0 .957-.012 1.434 0 .434 0 .831-.005 1.24-.028.785-.076 1.648-.228 2.47a7.664 7.664 0 01-.72 2.228 7.297 7.297 0 01-1.353 1.847 7.268 7.268 0 01-1.866 1.363 7.855 7.855 0 01-2.225.733c-.853.155-1.737.197-2.492.218-.39.009-.8.014-1.197.014l-1.445.003-135.58-.003",fill:"#040403"})),ve||(ve=n.createElement("path",{d:"M33.032 27.068c-.034-3.668 3.002-5.452 3.141-5.536-1.72-2.507-4.385-2.85-5.321-2.877-2.239-.235-4.41 1.34-5.551 1.34-1.162 0-2.92-1.317-4.81-1.278-2.436.038-4.715 1.448-5.964 3.638-2.579 4.464-.656 11.026 1.814 14.633 1.236 1.769 2.68 3.742 4.57 3.672 1.85-.077 2.54-1.18 4.773-1.18 2.212 0 2.86 1.18 4.788 1.135 1.984-.032 3.235-1.775 4.427-3.559 1.428-2.026 2.002-4.02 2.024-4.123-.046-.016-3.854-1.469-3.891-5.865m-3.643-10.786c.994-1.244 1.675-2.936 1.486-4.654-1.44.064-3.24.995-4.276 2.213-.918 1.072-1.738 2.83-1.526 4.481 1.618.12 3.278-.816 4.316-2.04m21.362 17.839h5.002l-2.466-7.261h-.068zm5.658 2.066h-6.312l-1.515 4.475h-2.673l5.977-16.557h2.778l5.977 16.557h-2.718l-1.514-4.475m14.596-1.56c0-2.444-1.263-4.05-3.19-4.05-1.893 0-3.166 1.64-3.166 4.05 0 2.432 1.273 4.061 3.166 4.061 1.927 0 3.19-1.595 3.19-4.061zm2.547 0c0 3.751-2.008 6.161-5.038 6.161-1.72 0-3.086-.77-3.798-2.112h-.057v5.98h-2.478V28.591h2.398v2.007h.046c.689-1.295 2.157-2.134 3.844-2.134 3.063 0 5.083 2.422 5.083 6.162m10.738.001c0-2.444-1.263-4.05-3.19-4.05-1.893 0-3.166 1.64-3.166 4.05 0 2.432 1.273 4.061 3.166 4.061 1.927 0 3.19-1.595 3.19-4.061zm2.547 0c0 3.751-2.008 6.161-5.038 6.161-1.72 0-3.086-.77-3.798-2.112h-.057v5.98h-2.478V28.591h2.398v2.007h.046c.689-1.295 2.157-2.134 3.844-2.134 3.063 0 5.083 2.422 5.083 6.162m8.78 1.422c.184 1.642 1.78 2.72 3.96 2.72 2.088 0 3.59-1.078 3.59-2.558 0-1.285-.906-2.055-3.052-2.582l-2.146-.517c-3.04-.735-4.451-2.157-4.451-4.463 0-2.857 2.489-4.82 6.024-4.82 3.499 0 5.897 1.963 5.978 4.82h-2.501c-.15-1.653-1.516-2.65-3.512-2.65s-3.362 1.01-3.362 2.477c0 1.171.873 1.86 3.007 2.387l1.824.448c3.397.804 4.808 2.168 4.808 4.59 0 3.097-2.467 5.038-6.392 5.038-3.671 0-6.15-1.895-6.31-4.89h2.536m15.514-10.314v2.857h2.296v1.962h-2.296v6.655c0 1.034.46 1.515 1.469 1.515.253 0 .655-.035.815-.057v1.95c-.274.07-.826.115-1.376.115-2.444 0-3.397-.918-3.397-3.26v-6.918h-1.755V28.59h1.755v-2.857h2.49m12.551 8.894c0-2.605-1.194-4.143-3.202-4.143-2.007 0-3.2 1.55-3.2 4.143 0 2.616 1.193 4.142 3.2 4.142 2.008 0 3.202-1.526 3.202-4.142zm-8.927 0c0-3.798 2.237-6.184 5.725-6.184 3.5 0 5.727 2.386 5.727 6.184 0 3.809-2.215 6.185-5.727 6.185-3.51 0-5.725-2.376-5.725-6.185m13.495-6.036h2.363v2.055h.058c.378-1.367 1.48-2.182 2.903-2.182.356 0 .653.047.85.093v2.318c-.197-.082-.633-.15-1.114-.15-1.595 0-2.582 1.079-2.582 2.777v7.16h-2.478V28.591m9.218 4.922h6.035c-.058-1.847-1.239-3.064-2.96-3.064-1.71 0-2.948 1.24-3.075 3.064zm8.376 3.603c-.333 2.192-2.467 3.696-5.197 3.696-3.512 0-5.692-2.353-5.692-6.128 0-3.786 2.192-6.242 5.588-6.242 3.34 0 5.44 2.294 5.44 5.954v.85h-8.527v.15c0 2.064 1.298 3.418 3.248 3.418 1.376 0 2.456-.654 2.788-1.698h2.352M48.803 18.473h1.5c1.664 0 2.623-1.037 2.623-2.862 0-1.797-.975-2.845-2.623-2.845h-1.5zm1.638-6.831c2.36 0 3.744 1.45 3.744 3.953 0 2.542-1.374 4.003-3.744 4.003h-2.873v-7.956h2.873m9.583 4.951c0-1.301-.584-2.062-1.61-2.062-1.03 0-1.61.76-1.61 2.062 0 1.312.58 2.067 1.61 2.067 1.026 0 1.61-.76 1.61-2.067zm-4.443 0c0-1.936 1.08-3.115 2.833-3.115 1.748 0 2.829 1.18 2.829 3.115 0 1.946-1.076 3.12-2.83 3.12-1.758 0-2.832-1.174-2.832-3.12m13.188 3.005H67.54l-1.24-4.422h-.095l-1.235 4.422h-1.218l-1.654-6.004h1.201l1.076 4.581h.088l1.234-4.58h1.138l1.234 4.58h.094l1.07-4.58h1.185l-1.649 6.003m3.042-6.004h1.14v.954h.089c.291-.667.888-1.07 1.791-1.07 1.34 0 2.078.805 2.078 2.233v3.887h-1.184v-3.59c0-.965-.42-1.444-1.296-1.444s-1.434.585-1.434 1.522v3.512h-1.184v-6.004m6.986-2.344h1.185v8.347h-1.185V11.25m7.276 5.343c0-1.301-.585-2.062-1.61-2.062-1.03 0-1.61.76-1.61 2.062 0 1.312.58 2.067 1.61 2.067 1.025 0 1.61-.76 1.61-2.067zm-4.444 0c0-1.936 1.08-3.115 2.833-3.115 1.749 0 2.83 1.18 2.83 3.115 0 1.946-1.076 3.12-2.83 3.12-1.758 0-2.833-1.174-2.833-3.12m10.769.794v-.501l-1.466.093c-.827.056-1.202.337-1.202.866 0 .54.47.855 1.113.855.894 0 1.555-.569 1.555-1.313zm-3.86.513c0-1.08.805-1.703 2.234-1.792l1.626-.094v-.518c0-.634-.42-.992-1.23-.992-.66 0-1.119.243-1.25.667h-1.147c.12-1.031 1.09-1.693 2.453-1.693 1.505 0 2.354.75 2.354 2.018v4.102h-1.14v-.844h-.095c-.357.601-1.014.943-1.803.943-1.158 0-2.001-.7-2.001-1.797m7.82-1.307c0 1.273.6 2.04 1.604 2.04 1 0 1.617-.778 1.617-2.035 0-1.251-.624-2.04-1.617-2.04-.997 0-1.604.772-1.604 2.035zm-1.224 0c0-1.897.976-3.1 2.492-3.1.822 0 1.516.392 1.842 1.054h.088V11.25h1.185v8.347h-1.135v-.948h-.094c-.358.656-1.058 1.047-1.886 1.047-1.527 0-2.492-1.201-2.492-3.103m14.953 0c0-1.301-.584-2.062-1.61-2.062-1.03 0-1.61.76-1.61 2.062 0 1.312.58 2.067 1.61 2.067 1.026 0 1.61-.76 1.61-2.067zm-4.443 0c0-1.936 1.08-3.115 2.833-3.115 1.748 0 2.829 1.18 2.829 3.115 0 1.946-1.076 3.12-2.83 3.12-1.757 0-2.832-1.174-2.832-3.12m7.252-2.999h1.141v.954h.089c.291-.667.888-1.07 1.791-1.07 1.34 0 2.078.805 2.078 2.233v3.887h-1.184v-3.59c0-.965-.42-1.444-1.296-1.444s-1.434.585-1.434 1.522v3.512h-1.184v-6.004m11.793-1.494v1.521h1.3v.999h-1.3v3.087c0 .629.258.904.849.904.182 0 .286-.011.451-.027v.987c-.193.032-.414.06-.644.06-1.318 0-1.843-.464-1.843-1.621v-3.39h-.953v-.999h.953V12.1h1.187m2.919-.85h1.175v3.308h.094c.291-.673.925-1.075 1.83-1.075 1.279 0 2.068.81 2.068 2.238v3.876h-1.186v-3.583c0-.96-.447-1.445-1.284-1.445-.972 0-1.512.612-1.512 1.522v3.506h-1.185V11.25m7.914 4.792h3.033c-.028-.943-.601-1.555-1.479-1.555-.876 0-1.488.617-1.554 1.555zm4.168 1.935c-.27 1.075-1.23 1.737-2.602 1.737-1.72 0-2.773-1.18-2.773-3.1 0-1.918 1.076-3.136 2.768-3.136 1.67 0 2.679 1.142 2.679 3.026v.414h-4.24v.067c.04 1.052.652 1.72 1.598 1.72.719 0 1.21-.26 1.43-.728h1.14",fill:"#fff"})))}var ye=a(121),Ee=a(131),_e=a(123),Se=a(446),we=a(176),Oe=a(135);const Ce="https://play.google.com/store/apps/details?id=im.vector.app",xe=e=>{var t,a,n,s,r;let{onFinished:o}=e;const l=Ee.b.get("brand"),c=Ee.b.getObject("desktop_builds"),d=Ee.b.getObject("mobile_builds"),m=null!==(t=null==d?void 0:d.get("ios"))&&void 0!==t?t:"https://apps.apple.com/app/vector/id1083446067",u=null!==(a=null!==(n=null==d?void 0:d.get("android"))&&void 0!==n?n:null==d?void 0:d.get("fdroid"))&&void 0!==a?a:Ce,h=null!==(s=null==d?void 0:d.get("android"))&&void 0!==s?s:Ce,p=null!==(r=null==d?void 0:d.get("fdroid"))&&void 0!==r?r:"https://f-droid.org/repository/browse/?fdid=im.vector.app";return i.a.createElement(Oe.a,{title:Object(ye.a)("Download %(brand)s",{brand:l}),className:"mx_AppDownloadDialog",fixedWidth:!0,onFinished:o},(null==c?void 0:c.get("available"))&&i.a.createElement("div",{className:"mx_AppDownloadDialog_desktop"},i.a.createElement(we.a,{size:"h3"},Object(ye.a)("Download %(brand)s Desktop",{brand:l})),i.a.createElement(_e.a,{kind:"primary",element:"a",href:null==c?void 0:c.get("url"),target:"_blank",onClick:()=>{}},Object(ye.a)("Download %(brand)s Desktop",{brand:l}))),i.a.createElement("div",{className:"mx_AppDownloadDialog_mobile"},i.a.createElement("div",{className:"mx_AppDownloadDialog_app"},i.a.createElement(we.a,{size:"h3"},Object(ye.a)("iOS")),i.a.createElement(Se.a,{data:m,margin:0,width:172}),i.a.createElement("div",{className:"mx_AppDownloadDialog_info"},Object(ye.a)("%(qrCode)s or %(appLinks)s",{appLinks:"",qrCode:""})),i.a.createElement("div",{className:"mx_AppDownloadDialog_links"},i.a.createElement(_e.a,{element:"a",href:m,target:"_blank","aria-label":Object(ye.a)("Download on the App Store"),onClick:()=>{}},i.a.createElement(fe,null)))),i.a.createElement("div",{className:"mx_AppDownloadDialog_app"},i.a.createElement(we.a,{size:"h3"},Object(ye.a)("Android")),i.a.createElement(Se.a,{data:u,margin:0,width:172}),i.a.createElement("div",{className:"mx_AppDownloadDialog_info"},Object(ye.a)("%(qrCode)s or %(appLinks)s",{appLinks:"",qrCode:""})),i.a.createElement("div",{className:"mx_AppDownloadDialog_links"},i.a.createElement(_e.a,{element:"a",href:h,target:"_blank","aria-label":Object(ye.a)("Get it on Google Play"),onClick:()=>{}},i.a.createElement(he,null)),i.a.createElement(_e.a,{element:"a",href:p,target:"_blank","aria-label":Object(ye.a)("Get it on F-Droid"),onClick:()=>{}},i.a.createElement(H,null))))),i.a.createElement("div",{className:"mx_AppDownloadDialog_legal"},i.a.createElement("p",null,Object(ye.a)("App Store® and the Apple logo® are trademarks of Apple Inc.")),i.a.createElement("p",null,Object(ye.a)("Google Play and the Google Play logo are trademarks of Google LLC."))))};var ke=a(213),je=a(128),Re=a(124),Ie=a(127),Te=a(159),Ne=a(474);function De(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function Pe(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?De(Object(a),!0).forEach((function(t){V()(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):De(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}const Me=e=>{Te.b.trackInteraction("WebUserOnboardingTaskSendDm",e),Re.a.dispatch({action:"view_create_chat"})},Ae=[{id:"create-account",title:Object(ye.a)("Create account"),description:Object(ye.a)("You made it!"),completed:()=>!0},{id:"find-friends",title:Object(ye.a)("Find and invite your friends"),description:Object(ye.a)("Its what youre here for, so lets get to it"),completed:e=>e.hasDmRooms,relevant:[Ne.a.PersonalMessaging,Ne.a.Skip],action:{label:Object(ye.a)("Find friends"),onClick:Me}},{id:"find-coworkers",title:Object(ye.a)("Find and invite your co-workers"),description:Object(ye.a)("Get stuff done by finding your teammates"),completed:e=>e.hasDmRooms,relevant:[Ne.a.WorkMessaging],action:{label:Object(ye.a)("Find people"),onClick:Me}},{id:"find-community-members",title:Object(ye.a)("Find and invite your community members"),description:Object(ye.a)("Get stuff done by finding your teammates"),completed:e=>e.hasDmRooms,relevant:[Ne.a.CommunityMessaging],action:{label:Object(ye.a)("Find people"),onClick:Me}},{id:"download-apps",title:()=>Object(ye.a)("Download %(brand)s",{brand:Ee.b.get("brand")}),description:()=>Object(ye.a)("Dont miss a thing by taking %(brand)s with you",{brand:Ee.b.get("brand")}),completed:e=>e.hasDevices,action:{label:Object(ye.a)("Download apps"),onClick:e=>{Te.b.trackInteraction("WebUserOnboardingTaskDownloadApps",e),Ie.b.createDialog(xe,{},"mx_AppDownloadDialog_wrapper",!1,!0)}}},{id:"setup-profile",title:Object(ye.a)("Set up your profile"),description:Object(ye.a)("Make sure people know its really you"),completed:e=>e.hasAvatar,action:{label:Object(ye.a)("Your profile"),onClick:e=>{Te.b.trackInteraction("WebUserOnboardingTaskSetupProfile",e),Re.a.dispatch({action:je.a.ViewUserSettings,initialTabId:ke.a.General})}}},{id:"permission-notifications",title:Object(ye.a)("Turn on notifications"),description:Object(ye.a)("Dont miss a reply or important message"),completed:e=>e.hasNotificationsEnabled,action:{label:Object(ye.a)("Enable notifications"),onClick:e=>{Te.b.trackInteraction("WebUserOnboardingTaskEnableNotifications",e),d.Notifier.setEnabled(!0)},hideOnComplete:!0}}];var Le=a(473),Ue=a(211),Fe=a(638),Be=a(191),Ve=a(249),We=a(152),He=a(133),ze=a(904);const Ge=e=>{Te.b.trackInteraction("WebHomeCreateChatButton",e),Re.a.dispatch({action:"view_create_chat"})},Ke=e=>{Te.b.trackInteraction("WebHomeExploreRoomsButton",e),Re.a.fire(je.a.ViewRoomDirectory)},qe=e=>{Te.b.trackInteraction("WebHomeCreateRoomButton",e),Re.a.dispatch({action:"view_create_room"})},$e=e=>({displayName:Ve.a.instance.displayName||e,avatarUrl:Ve.a.instance.getHttpAvatarUrl(ze.a)}),Ye=()=>{const e=Object(n.useContext)(He.a),t=e.getUserId(),[a,i]=Object(n.useState)($e(t));return Object(o.a)(Ve.a.instance,We.b,(()=>{i($e(t))})),n.createElement("div",null,n.createElement(ze.b,{hasAvatar:!!a.avatarUrl,hasAvatarLabel:Object(ye.b)("Great, that'll help people know it's you"),noAvatarLabel:Object(ye.b)("Add a photo so people know it's you."),setAvatarUrl:t=>e.setAvatarUrl(t),isUserAvatar:!0,onClick:e=>Te.b.trackInteraction("WebHomeMiniAvatarUploadButton",e)},n.createElement(Be.a,{idName:t,name:a.displayName,url:a.avatarUrl,width:ze.a,height:ze.a,resizeMethod:"crop"})),n.createElement("h1",null,Object(ye.b)("Welcome %(name)s",{name:a.displayName})),n.createElement("h2",null,Object(ye.b)("Now, let's help you get started")))};var Je=e=>{let{justRegistered:t=!1}=e;const a=Ee.b.get(),i=Object(Le.a)(a);if(i)return n.createElement(Fe.a,{className:"mx_HomePage",url:i,scrollbar:!0});let s;if(t||!Ve.a.instance.getHttpAvatarUrl(ze.a))s=n.createElement(Ye,null);else{var r;const e=Ee.b.getObject("branding"),t=null!==(r=null==e?void 0:e.get("auth_header_logo_url"))&&void 0!==r?r:"themes/element/img/logos/element-logo.svg";s=n.createElement(n.Fragment,null,n.createElement("img",{src:t,alt:a.brand}),n.createElement("h1",null,Object(ye.b)("Welcome to %(appName)s",{appName:a.brand})),n.createElement("h2",null,Object(ye.b)("Own your conversations.")))}return n.createElement(Ue.a,{className:"mx_HomePage mx_HomePage_default",element:"main"},n.createElement("div",{className:"mx_HomePage_default_wrapper"},s,n.createElement("div",{className:"mx_HomePage_default_buttons"},n.createElement(_e.a,{onClick:Ge,className:"mx_HomePage_button_sendDm"},Object(ye.b)("Send a Direct Message")),n.createElement(_e.a,{onClick:Ke,className:"mx_HomePage_button_explore"},Object(ye.b)("Explore Public Rooms")),n.createElement(_e.a,{onClick:qe,className:"mx_HomePage_button_createGroup"},Object(ye.b)("Create a Group Chat")))))};const Qe=e=>{Te.b.trackInteraction("WebUserOnboardingHeaderSendDm",e),Re.a.dispatch({action:"view_create_chat"})};function Xe(e){let t,i,s,r,{useCase:o}=e;switch(o){case Ne.a.PersonalMessaging:t=Object(ye.a)("Secure messaging for friends and family"),i=Object(ye.a)("With free end-to-end encrypted messaging, and unlimited voice and video calls, %(brand)s is a great way to stay in touch.",{brand:Ee.b.get("brand")}),s=a(905),r=Object(ye.a)("Start your first chat");break;case Ne.a.WorkMessaging:t=Object(ye.a)("Secure messaging for work"),i=Object(ye.a)("With free end-to-end encrypted messaging, and unlimited voice and video calls, %(brand)s is a great way to stay in touch.",{brand:Ee.b.get("brand")}),s=a(1518),r=Object(ye.a)("Find your co-workers");break;case Ne.a.CommunityMessaging:t=Object(ye.a)("Community ownership"),i=Object(ye.a)("Keep ownership and control of community discussion.\nScale to support millions, with powerful moderation and interoperability."),s=a(1519),r=Object(ye.a)("Find your people");break;default:t=Object(ye.a)("Welcome to %(brand)s",{brand:Ee.b.get("brand")}),i=Object(ye.a)("With free end-to-end encrypted messaging, and unlimited voice and video calls, %(brand)s is a great way to stay in touch.",{brand:Ee.b.get("brand")}),s=a(905),r=Object(ye.a)("Start your first chat")}return n.createElement("div",{className:"mx_UserOnboardingHeader"},n.createElement("div",{className:"mx_UserOnboardingHeader_content"},n.createElement(we.a,{size:"h1"},t,n.createElement("span",{className:"mx_UserOnboardingHeader_dot"},".")),n.createElement("p",null,i),n.createElement(_e.a,{onClick:Qe,kind:"primary"},r)),n.createElement("img",{className:"mx_UserOnboardingHeader_image",src:s,alt:""}))}var Ze=a(491),et=a(633),tt=a(459);function at(){return Object(tt.a)()?i.a.createElement("div",{className:"mx_UserOnboardingFeedback","data-testid":"user-onboarding-feedback"},i.a.createElement("div",{className:"mx_UserOnboardingFeedback_content"},i.a.createElement(we.a,{size:"h4",className:"mx_UserOnboardingFeedback_title"},Object(ye.a)("How are you finding %(brand)s so far?",{brand:Ee.b.get("brand")})),i.a.createElement("div",{className:"mx_UserOnboardingFeedback_text"},Object(ye.a)("Wed appreciate any feedback on how youre finding %(brand)s.",{brand:Ee.b.get("brand")}))),i.a.createElement(_e.a,{kind:"primary_outline",className:"mx_UserOnboardingFeedback_action",onClick:()=>{Ie.b.createDialog(et.a,{feature:"use-case-selection"})}},Object(ye.a)("Feedback"))):i.a.createElement(i.a.Fragment,null)}var nt=a(126),it=a.n(nt);function st(e){var t;let{task:a,completed:i=!1}=e;const s="function"==typeof a.title?a.title():a.title,r="function"==typeof a.description?a.description():a.description;return n.createElement("li",{"data-testid":"user-onboarding-task",className:it()("mx_UserOnboardingTask",{mx_UserOnboardingTask_completed:i})},n.createElement("div",{className:"mx_UserOnboardingTask_number",role:"checkbox","aria-disabled":"true","aria-checked":i,"aria-labelledby":`mx_UserOnboardingTask_${a.id}`}),n.createElement("div",{id:`mx_UserOnboardingTask_${a.id}`,className:"mx_UserOnboardingTask_content"},n.createElement(we.a,{size:"h4",className:"mx_UserOnboardingTask_title"},s),n.createElement("div",{className:"mx_UserOnboardingTask_description"},r)),a.action&&(!a.action.hideOnComplete||!i)&&n.createElement(_e.a,{element:"a",className:"mx_UserOnboardingTask_action",kind:"primary_outline",href:a.action.href,target:"_blank",onClick:null!==(t=a.action.onClick)&&void 0!==t?t:null},a.action.label))}function rt(e){let{tasks:t}=e;const{completed:a,waiting:i,total:s}=(e=>{const t=e.filter((e=>!0===e.completed)).length,a=e.filter((e=>!1===e.completed)).length;return{completed:t,waiting:a,total:t+a}})(t);return n.createElement("div",{className:"mx_UserOnboardingList","data-testid":"user-onboarding-list"},n.createElement("div",{className:"mx_UserOnboardingList_header"},n.createElement(we.a,{size:"h3",className:"mx_UserOnboardingList_title"},i>0?Object(ye.a)("Only %(count)s steps to go",{count:i}):Object(ye.a)("You did it!")),n.createElement("div",{className:"mx_UserOnboardingList_hint"},Object(ye.a)("Complete these to get the most out of %(brand)s",{brand:Ee.b.get("brand")}))),n.createElement("div",{className:"mx_UserOnboardingList_progress"},n.createElement(Ze.a,{value:a,max:s,animated:!0}),0===i&&n.createElement(at,null)),n.createElement("ol",{className:"mx_UserOnboardingList_list"},t.map((e=>n.createElement(st,{key:e.id,completed:e.completed,task:e})))))}const ot=new Date(1656633600);function lt(e){return null!==e||r.a.userRegisteredAfter(ot)}function ct(e){let{justRegistered:t=!1}=e;const a=Ee.b.get(),i=Object(Le.a)(a),c=Object(l.b)("FTUE.useCaseSelection"),h=function(e){var t;const a=null!==(t=Object(l.b)("FTUE.useCaseSelection"))&&void 0!==t?t:Ne.a.Skip;return Object(n.useMemo)((()=>Ae.filter((e=>!e.relevant||e.relevant.includes(a))).map((t=>Pe(Pe({},t),{},{completed:t.completed(e)})))),[e,a])}(function(){const e=u(!1,(async e=>{const t=await e.getProfileInfo(e.getUserId());return Boolean(null==t?void 0:t.avatar_url)})),t=u(!1,(async e=>{const t=e.getDeviceId(),a=await e.getDevices();return Boolean(a.devices.find((e=>e.device_id!==t)))})),a=u(!1,(async()=>{var e;const t=null!==(e=m.a.shared().getUniqueRoomsWithIndividuals())&&void 0!==e?e:{};return Boolean(Object.keys(t).length)})),i=u(!1,(async()=>d.Notifier.isPossible()));return Object(n.useMemo)((()=>({hasAvatar:e,hasDevices:t,hasDmRooms:a,hasNotificationsEnabled:i})),[e,t,a,i])}()),p=function(){const e=r.a.get();return Object(o.b)(e,s.ClientEvent.Sync,(()=>e.isInitialSyncComplete()))}(),[g,v]=Object(n.useState)(!1);return Object(n.useEffect)((()=>{if(p){const e=window.setTimeout((()=>{v(!0)}),2800);return()=>{clearTimeout(e)}}v(!1)}),[p,v]),lt(c)?i?n.createElement(Fe.a,{className:"mx_HomePage",url:i,scrollbar:!0}):n.createElement(Ue.a,{className:"mx_UserOnboardingPage"},n.createElement(Xe,{useCase:c}),g&&n.createElement(rt,{tasks:h})):n.createElement(Je,{justRegistered:t})}},487:function(e,t,a){"use strict";a.d(t,"a",(function(){return u})),a.d(t,"b",(function(){return h})),a.d(t,"c",(function(){return p})),a.d(t,"d",(function(){return g}));var n,i,s=a(13),r=a.n(s),o=a(10),l=a(410),c=a(1),d=a(16);!function(e){e.Start="m.login.start",e.Finish="m.login.finish",e.Progress="m.login.progress"}(n||(n={})),function(e){e.Success="success",e.Failure="failure",e.Verified="verified",e.Declined="declined",e.Unsupported="unsupported"}(i||(i={}));const m=new o.UnstableValue("login_token","org.matrix.msc3906.login_token");class u{constructor(e,t,a){this.channel=e,this.client=t,this.onFailure=a,r()(this,"newDeviceId",void 0),r()(this,"newDeviceKey",void 0),r()(this,"ourIntent",g.RECIPROCATE_LOGIN_ON_EXISTING_DEVICE),r()(this,"_code",void 0)}get code(){return this._code}async generateCode(){this._code||(this._code=JSON.stringify(await this.channel.generateCode(this.ourIntent)))}async startAfterShowingCode(){const e=await this.channel.connect();c.a.info(`Connected to secure channel with checksum: ${e} our intent is ${this.ourIntent}`);if((await Object(l.c)(await this.client.getVersions())).get(l.a.LoginTokenRequest)===l.b.Unsupported)return c.a.info("Server doesn't support MSC3882"),await this.send({type:n.Finish,outcome:i.Unsupported}),void await this.cancel(p.HomeserverLacksSupport);await this.send({type:n.Progress,protocols:[m.name]}),c.a.info("Waiting for other device to chose protocol");const{type:t,protocol:a,outcome:s}=await this.receive();if(t!==n.Finish)if(t===n.Progress){if(a&&m.matches(a))return e;await this.cancel(p.UnsupportedAlgorithm)}else await this.cancel(p.Unknown);else if("unsupported"===(null!=s?s:""))await this.cancel(p.UnsupportedAlgorithm);else await this.cancel(p.Unknown)}async receive(){return await this.channel.receive()}async send(e){await this.channel.send(e)}async declineLoginOnExistingDevice(){c.a.info("User declined sign in"),await this.send({type:n.Finish,outcome:i.Declined})}async approveLoginOnExistingDevice(e){await this.send({type:n.Progress,login_token:e,homeserver:this.client.baseUrl}),c.a.info("Waiting for outcome");const t=await this.receive();if(!t)return;const{outcome:a,device_id:i,device_key:s}=t;if("success"!==a)throw new Error("Linking failed");return this.newDeviceId=i,this.newDeviceKey=s,i}async verifyAndCrossSignDevice(e){if(!this.client.crypto)throw new Error("Crypto not available on client");if(!this.newDeviceId)throw new Error("No new device ID set");if(e.getFingerprint()!==this.newDeviceKey)throw new Error(`New device has different keys than expected: ${this.newDeviceKey} vs ${e.getFingerprint()}`);const t=this.client.getUserId();if(!t)throw new Error("No user ID set");c.a.info(`Marking device ${this.newDeviceId} as verified`);const a=await this.client.crypto.setDeviceVerification(t,this.newDeviceId,!0,!1,!0),s=this.client.crypto.crossSigningInfo.getId("master");return await this.send({type:n.Finish,outcome:i.Verified,verifying_device_id:this.client.getDeviceId(),verifying_device_key:this.client.getDeviceEd25519Key(),master_key:s}),a}async verifyNewDeviceOnExistingDevice(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1e4;if(!this.newDeviceId)throw new Error("No new device to sign");if(!this.newDeviceKey)return void c.a.info("No new device key to sign");if(!this.client.crypto)throw new Error("Crypto not available on client");const t=this.client.getUserId();if(!t)throw new Error("No user ID set");let a=this.client.crypto.getStoredDevice(t,this.newDeviceId);if(a||(c.a.info("Going to wait for new device to be online"),await Object(d.J)(e),a=this.client.crypto.getStoredDevice(t,this.newDeviceId)),a)return await this.verifyAndCrossSignDevice(a);throw new Error("Device not online within timeout")}async cancel(e){var t;null===(t=this.onFailure)||void 0===t||t.call(this,e),await this.channel.cancel(e)}async close(){await this.channel.close()}}class h extends Error{constructor(e,t){super(e),this.code=t}}let p,g;!function(e){e.UserDeclined="user_declined",e.OtherDeviceNotSignedIn="other_device_not_signed_in",e.OtherDeviceAlreadySignedIn="other_device_already_signed_in",e.Unknown="unknown",e.Expired="expired",e.UserCancelled="user_cancelled",e.InvalidCode="invalid_code",e.UnsupportedAlgorithm="unsupported_algorithm",e.DataMismatch="data_mismatch",e.UnsupportedTransport="unsupported_transport",e.HomeserverLacksSupport="homeserver_lacks_support"}(p||(p={})),function(e){e.LOGIN_ON_NEW_DEVICE="login.start",e.RECIPROCATE_LOGIN_ON_EXISTING_DEVICE="login.reciprocate"}(g||(g={}))},626:function(e,t,a){"use strict";a.r(t),a.d(t,"Icon",(function(){return r}));var n,i=a(120);function s(){return s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},s.apply(this,arguments)}function r(e){return i.createElement("svg",s({fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 18 18",role:"presentation","aria-hidden":!0},e),n||(n=i.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 9.27V3.05L9 1l7 2.05v6.22C16 15.63 9 17 9 17s-7-1.37-7-7.73zM8.92 4.4c-.57.04-.99.54-.94 1.11l.32 4c.03.35.3.62.65.65h.06c.37 0 .68-.28.71-.65l.32-4v-.16a1.06 1.06 0 00-1.12-.95zm.96 7.72a.88.88 0 11-1.76 0 .88.88 0 011.76 0z",fill:"currentColor"})))}t.default="img/e2e/warning.d370b49.svg"},627:function(e,t,a){"use strict";a.d(t,"a",(function(){return u}));var n=a(129),i=a(187),s=a(203),r=a(125),o=a(237),l=a(122),c=a(180),d=a(202),m=a(192);function u(e,t,a){const u=e.getContent(),h=u.msgtype,p=e.getType();let g=!1;if(r.b.getValue("feature_msc3531_hide_messages_pending_moderation"))switch(Object(c.h)(e)){case c.a.VISIBLE_FOR_ALL:case c.a.HIDDEN_TO_CURRENT_USER:break;case c.a.SEE_THROUGH_FOR_CURRENT_USER:g=!0}let v=Object(o.e)(e,l.a.get(),t),b=p.startsWith("m.key.verification")||p===n.b.RoomMessage&&(null==h?void 0:h.startsWith("m.key.verification"))||p===n.b.RoomCreate||p===n.b.RoomEncryption||v===o.b;const f=!b&&(p===n.b.CallInvite||d.d.CALL_EVENT_TYPE.matches(p));let y=((e,t,a,r)=>!(a||r||e===n.b.RoomMessage||e===n.b.RoomMessageEncrypted||e===n.b.Sticker||e===n.b.RoomCreate||i.e.matches(e)||i.a.matches(e)||s.b.matches(e)||e===m.g&&(null==t?void 0:t.state)===m.h.Started))(p,u,b,f);const E=p===n.b.RoomMessage&&h===n.e.Emote||i.e.matches(p)||s.b.matches(p)||Object(c.l)(e)||p===m.g;return!a&&Object(o.c)(e,t)||(v=Object(o.e)(e,l.a.get(),t,!0),v===o.a&&(b=!1,y=!0)),{hasRenderer:!!v,isInfoMessage:y,isBubbleMessage:b,isLeftAlignedBubbleMessage:f,noBubbleEvent:E,isSeeingThroughMessageHiddenForModeration:g}}},628:function(e,t,a){"use strict";a.d(t,"a",(function(){return l}));var n,i,s,r=a(120);function o(){return o=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},o.apply(this,arguments)}function l(e){return r.createElement("svg",o({fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 18 18",role:"presentation","aria-hidden":!0},e),n||(n=r.createElement("circle",{cx:4.25,cy:9,r:1.25,fill:"currentColor"})),i||(i=r.createElement("circle",{cx:9,cy:9,r:1.25,fill:"currentColor"})),s||(s=r.createElement("circle",{cx:13.75,cy:9,r:1.25,fill:"currentColor"})))}},629:function(e,t,a){"use strict";a.d(t,"a",(function(){return r}));var n,i=a(120);function s(){return s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},s.apply(this,arguments)}function r(e){return i.createElement("svg",s({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 17 16",role:"presentation","aria-hidden":!0},e),n||(n=i.createElement("path",{fill:"currentColor",fillRule:"evenodd",d:"M4.523 2.964a6.418 6.418 0 0110.36 4.369h1.29c.26 0 .416.292.272.51l-2.006 3.011a.327.327 0 01-.544 0l-2.006-3.012a.327.327 0 01.272-.509h1.21a4.918 4.918 0 00-7.918-3.192 3.684 3.684 0 01-.184.136l-.014.01-.004.003-.002.001h-.001v.001l-.415-.625.414.625a.75.75 0 01-.83-1.25l.003-.001.02-.014a1.7 1.7 0 00.083-.063zm-.895 5.703H4.84a.327.327 0 00.272-.51L3.106 5.146a.327.327 0 00-.545 0L.555 8.157a.328.328 0 00.273.51h1.29a6.418 6.418 0 0010.503 4.251.75.75 0 00-.963-1.15 4.918 4.918 0 01-8.03-3.102z",clipRule:"evenodd"})))}},630:function(e,t,a){"use strict";a.d(t,"a",(function(){return p})),a.d(t,"b",(function(){return b}));var n=a(13),i=a.n(n),s=a(120),r=a.n(s),o=a(126),l=a.n(o),c=a(123),d=a(121),m=a(268),u=a(191),h=a(885);let p;!function(e){e.Admin="admin",e.Moderator="moderator"}(p||(p={}));const g={[p.Admin]:Object(d.c)("Admin"),[p.Moderator]:Object(d.c)("Mod")},v={offline:"mx_EntityTile_offline",online:"mx_EntityTile_online",unavailable:"mx_EntityTile_unavailable"};class b extends r.a.PureComponent{constructor(e){super(e),this.state={hover:!1}}render(){const e={mx_EntityTile:!0,mx_EntityTile_noHover:this.props.suppressOnHover};this.props.className&&(e[this.props.className]=!0);var t,n;let i;e[(t=this.props.presenceState,n=this.props.presenceLastActiveAgo,!1===this.props.showPresence?"mx_EntityTile_online_beenactive":"offline"===t?n?v.offline+"_beenactive":v.offline+"_neveractive":t?v[t]:v.offline+"_neveractive")]=!0;const s=this.props.nameJSX||this.props.name;if(this.props.suppressOnHover)i=this.props.subtextLabel?r.a.createElement("div",{className:"mx_EntityTile_details"},r.a.createElement("div",{className:"mx_EntityTile_name"},s),r.a.createElement("span",{className:"mx_EntityTile_subtext"},this.props.subtextLabel)):r.a.createElement("div",{className:"mx_EntityTile_name"},s);else{const e=this.props.presenceLastActiveAgo?Date.now()-(this.props.presenceLastTs-this.props.presenceLastActiveAgo):-1;let t=null;this.props.showPresence&&(t=r.a.createElement(h.a,{activeAgo:e,currentlyActive:this.props.presenceCurrentlyActive,presenceState:this.props.presenceState})),this.props.subtextLabel&&(t=r.a.createElement("span",{className:"mx_EntityTile_subtext"},this.props.subtextLabel)),i=r.a.createElement("div",{className:"mx_EntityTile_details"},r.a.createElement("div",{className:"mx_EntityTile_name"},s),t)}let o,p;this.props.showInviteButton&&(o=r.a.createElement("div",{className:"mx_EntityTile_invite"},r.a.createElement("img",{src:a(1461).default,width:"16",height:"16"})));const b=this.props.powerStatus;if(b){const e=Object(d.a)(g[b]);p=r.a.createElement("div",{className:"mx_EntityTile_power"},e)}let f;const{e2eStatus:y}=this.props;y&&(f=r.a.createElement(m.b,{status:y,isUser:!0,bordered:!0}));const E=this.props.avatarJsx||r.a.createElement(u.a,{name:this.props.name,width:36,height:36,"aria-hidden":"true"});return r.a.createElement("div",null,r.a.createElement(c.a,{className:l()(e),title:this.props.title,onClick:this.props.onClick},r.a.createElement("div",{className:"mx_EntityTile_avatar"},E,f),i,p,o))}}i()(b,"defaultProps",{onClick:()=>{},presenceState:"offline",presenceLastActiveAgo:0,presenceLastTs:0,showInviteButton:!1,suppressOnHover:!1,showPresence:!0})},631:function(e,t,a){"use strict";a.d(t,"a",(function(){return l})),a.d(t,"b",(function(){return c}));var n=a(120),i=a(129),s=a(150),r=a(270),o=a(140);const l=e=>{var t,a;const n=null==e||null===(t=e.currentState)||void 0===t||null===(a=t.getStateEvents(i.b.RoomTopic,""))||void 0===a?void 0:a.getContent();return n?Object(r.parseTopicContent)(n):null};function c(e){const[t,a]=Object(n.useState)(l(e));return Object(o.c)(e.currentState,s.b.Events,(t=>{t.getType()===i.b.RoomTopic&&a(l(e))})),Object(n.useEffect)((()=>{a(l(e))}),[e]),t}},632:function(e,t,a){"use strict";a.d(t,"a",(function(){return i}));var n=a(120);const i=e=>{const t=Object(n.useRef)(null);return[Object(n.useCallback)((e=>{t.current=e}),[]),Object(n.useCallback)(((a,n)=>{t.current===a&&e(n)}),[e])]}},633:function(e,t,a){"use strict";var n=a(120),i=a.n(n),s=a(154),r=a(121),o=a(139),l=a(123),c=a(131),d=a(127),m=a(277),u=a(212),h=a(379),p=a(394),g=a(177);t.a=e=>{const t=Object(n.useRef)(),[a,v]=Object(n.useState)(""),[b,f]=Object(p.a)(!1);Object(n.useEffect)((()=>{var e;null===(e=t.current)||void 0===e||e.focus()}),[]);const y=()=>{e.onFinished(),d.b.createDialog(m.a,{})},E=c.b.get().bug_report_endpoint_url,_=!!E;let S;E&&(S=i.a.createElement("div",{className:"mx_FeedbackDialog_section mx_FeedbackDialog_rateApp"},i.a.createElement("h3",null,Object(r.a)("Comment")),i.a.createElement("p",null,Object(r.a)("Your platform and username will be noted to help us use your feedback as much as we can.")),i.a.createElement(o.a,{id:"feedbackComment",label:Object(r.a)("Feedback"),type:"text",autoComplete:"off",value:a,element:"textarea",onChange:e=>{v(e.target.value)},ref:t}),i.a.createElement(g.b,{checked:b,onChange:f},Object(r.a)("You may contact me if you want to follow up or to let me test out upcoming ideas"))));let w=null;return E&&(w=i.a.createElement("p",{className:"mx_FeedbackDialog_section_microcopy"},Object(r.a)("PRO TIP: If you start a bug, please submit <debugLogsLink>debug logs</debugLogsLink> to help us track down the problem.",{},{debugLogsLink:e=>i.a.createElement(l.a,{kind:"link_inline",onClick:y},e)}))),i.a.createElement(s.a,{className:"mx_FeedbackDialog",hasCancelButton:!!_,title:Object(r.a)("Feedback"),description:i.a.createElement(i.a.Fragment,null,i.a.createElement("div",{className:"mx_FeedbackDialog_section mx_FeedbackDialog_reportBug"},i.a.createElement("h3",null,Object(r.a)("Report a bug")),i.a.createElement("p",null,Object(r.a)("Please view <existingIssuesLink>existing bugs on Github</existingIssuesLink> first. No match? <newIssueLink>Start a new one</newIssueLink>.",{},{existingIssuesLink:e=>i.a.createElement("a",{target:"_blank",rel:"noreferrer noopener",href:"https://github.com/vector-im/element-web/issues?q=is%3Aopen+is%3Aissue+sort%3Areactions-%2B1-desc"},e),newIssueLink:e=>i.a.createElement("a",{target:"_blank",rel:"noreferrer noopener",href:"https://github.com/vector-im/element-web/issues/new/choose"},e)})),w),S),button:_?Object(r.a)("Send feedback"):Object(r.a)("Go back"),buttonDisabled:_&&!a,onFinished:t=>{if(_&&t){if(E){const t=e.feature?`${e.feature}-feedback`:"feedback";Object(h.c)(E,t,a,b)}d.b.createDialog(u.a,{title:Object(r.a)("Feedback sent"),description:Object(r.a)("Thank you!")})}e.onFinished()}})}},634:function(e,t,a){"use strict";var n=a(130),i=a.n(n),s=a(132),r=a.n(s),o=a(120),l=a.n(o),c=a(129),d=a(173),m=a(121),u=a(250),h=a(493),p=a(133),g=a(124),v=a(285),b=a(125),f=a(166),y=a(128),E=a(220),_=a(156),S=a(159);const w=["space","hideHeader","onFinished"];t.a=e=>{let{space:t,hideHeader:a,onFinished:n}=e,s=r()(e,w);const O=Object(o.useContext)(p.a).getUserId();let C=null;if("public"===t.getJoinRule()||t.canInvite(O)){const e=e=>{e.preventDefault(),e.stopPropagation(),Object(u.i)(t),n()};C=l.a.createElement(d.b,{"data-testid":"invite-option",className:"mx_SpacePanel_contextMenu_inviteButton",iconClassName:"mx_SpacePanel_iconInvite",label:Object(m.a)("Invite"),onClick:e})}let x=null,k=null;if(Object(u.d)(t)){const e=e=>{e.preventDefault(),e.stopPropagation(),Object(u.k)(t),n()};x=l.a.createElement(d.b,{"data-testid":"settings-option",iconClassName:"mx_SpacePanel_iconSettings",label:Object(m.a)("Settings"),onClick:e})}else{const e=e=>{e.preventDefault(),e.stopPropagation(),Object(h.b)(t),n()};k=l.a.createElement(d.b,{"data-testid":"leave-option",iconClassName:"mx_SpacePanel_iconLeave",className:"mx_IconizedContextMenu_option_red",label:Object(m.a)("Leave space"),onClick:e})}let j=null;if(b.b.getValue("developerMode")){const e=e=>{e.preventDefault(),e.stopPropagation(),g.a.dispatch({action:y.a.ViewRoom,room_id:t.roomId,forceTimeline:!0,metricsTrigger:void 0}),n()};j=l.a.createElement(d.b,{iconClassName:"mx_SpacePanel_iconSettings",label:Object(m.a)("See room timeline (devtools)"),onClick:e})}const R=Object(f.a)("feature_video_rooms"),I=Object(f.a)("feature_element_call_video_rooms"),T=t.currentState.maySendStateEvent(c.b.SpaceChild,O),N=T&&Object(E.a)(_.a.CreateRooms),D=N&&R,P=T&&Object(E.a)(_.a.CreateSpaces);let M=null;if(N||P){const e=e=>{e.preventDefault(),e.stopPropagation(),S.b.trackInteraction("WebSpaceContextMenuNewRoomItem",e),Object(u.g)(t),n()},a=e=>{e.preventDefault(),e.stopPropagation(),Object(u.g)(t,I?c.j.UnstableCall:c.j.ElementVideo),n()},i=e=>{e.preventDefault(),e.stopPropagation(),Object(u.h)(t),n()};M=l.a.createElement(l.a.Fragment,null,l.a.createElement("div",{"data-testid":"add-to-space-header",className:"mx_SpacePanel_contextMenu_separatorLabel"},Object(m.a)("Add")),N&&l.a.createElement(d.b,{"data-testid":"new-room-option",iconClassName:"mx_SpacePanel_iconPlus",label:Object(m.a)("Room"),onClick:e}),D&&l.a.createElement(d.b,{"data-testid":"new-video-room-option",iconClassName:"mx_SpacePanel_iconPlus",label:Object(m.a)("Video room"),onClick:a},l.a.createElement(v.a,null)),P&&l.a.createElement(d.b,{"data-testid":"new-subspace-option",iconClassName:"mx_SpacePanel_iconPlus",label:Object(m.a)("Space"),onClick:i},l.a.createElement(v.a,null)))}const A=e=>{e.preventDefault(),e.stopPropagation(),g.a.dispatch({action:y.a.ViewRoom,room_id:t.roomId,metricsTrigger:void 0}),n()};return l.a.createElement(d.e,i()({},s,{onFinished:n,className:"mx_SpacePanel_contextMenu",compact:!0}),!a&&l.a.createElement("div",{className:"mx_SpacePanel_contextMenu_header"},t.name),l.a.createElement(d.c,{first:!0},l.a.createElement(d.b,{iconClassName:"mx_SpacePanel_iconHome",label:Object(m.a)("Space home"),onClick:e=>{S.b.trackInteraction("WebSpaceContextMenuHomeItem",e),A(e)}}),C,l.a.createElement(d.b,{iconClassName:"mx_SpacePanel_iconExplore",label:N?Object(m.a)("Manage & explore rooms"):Object(m.a)("Explore rooms"),onClick:e=>{S.b.trackInteraction("WebSpaceContextMenuExploreRoomsItem",e),A(e)}}),l.a.createElement(d.b,{iconClassName:"mx_SpacePanel_iconPreferences",label:Object(m.a)("Preferences"),onClick:e=>{e.preventDefault(),e.stopPropagation(),Object(u.j)(t),n()}}),j,x,k,M))}},635:function(e,t,a){"use strict";a.d(t,"a",(function(){return b}));var n=a(13),i=a.n(n),s=a(120),r=a.n(s),o=a(1),l=a(127),c=a(124),d=a(121),m=a(122),u=a(364),h=a(154),p=a(135),g=a(134),v=a(145);class b extends r.a.Component{constructor(e){super(e),i()(this,"onExportE2eKeysClicked",(()=>{l.b.createDialogAsync(a.e(7).then(a.bind(null,1562)),{matrixClient:m.a.get()})})),i()(this,"onFinished",(e=>{e&&c.a.dispatch({action:"logout"}),this.props.onFinished(e)})),i()(this,"onSetRecoveryMethodClick",(()=>{this.state.backupInfo?l.b.createDialog(u.a,null,null,!1,!0):l.b.createDialogAsync(a.e(8).then(a.bind(null,922)),null,null,!1,!0),this.props.onFinished(!0)})),i()(this,"onLogoutConfirm",(()=>{c.a.dispatch({action:"logout"}),this.props.onFinished(!0)}));const t=m.a.get(),n=t.isCryptoEnabled()&&!t.getKeyBackupEnabled();this.state={shouldLoadBackupStatus:n,loading:n,backupInfo:null,error:null},n&&this.loadBackupStatus()}async loadBackupStatus(){try{const e=await m.a.get().getKeyBackupVersion();this.setState({loading:!1,backupInfo:e})}catch(e){o.a.log("Unable to fetch key backup status",e),this.setState({loading:!1,error:e})}}render(){if(this.state.shouldLoadBackupStatus){const e=r.a.createElement("div",null,r.a.createElement("p",null,Object(d.a)("Encrypted messages are secured with end-to-end encryption. Only you and the recipient(s) have the keys to read these messages.")),r.a.createElement("p",null,Object(d.a)("When you sign out, these keys will be deleted from this device, which means you won't be able to read encrypted messages unless you have the keys for them on your other devices, or backed them up to the server.")),r.a.createElement("p",null,Object(d.a)("Back up your keys before signing out to avoid losing them.")));let t;if(this.state.loading)t=r.a.createElement(g.a,null);else{let a;a=this.state.backupInfo?Object(d.a)("Connect this session to Key Backup"):Object(d.a)("Start using Key Backup"),t=r.a.createElement("div",null,r.a.createElement("div",{className:"mx_Dialog_content",id:"mx_Dialog_content"},e),r.a.createElement(v.a,{primaryButton:a,hasCancel:!1,onPrimaryButtonClick:this.onSetRecoveryMethodClick,focus:!0},r.a.createElement("button",{onClick:this.onLogoutConfirm},Object(d.a)("I don't want my encrypted messages"))),r.a.createElement("details",null,r.a.createElement("summary",null,Object(d.a)("Advanced")),r.a.createElement("p",null,r.a.createElement("button",{onClick:this.onExportE2eKeysClicked},Object(d.a)("Manually export keys")))))}return r.a.createElement(p.a,{title:Object(d.a)("You'll lose access to your encrypted messages"),contentId:"mx_Dialog_content",hasCancel:!0,onFinished:this.onFinished},t)}return r.a.createElement(h.a,{hasCancelButton:!0,title:Object(d.a)("Sign out"),description:Object(d.a)("Are you sure you want to sign out?"),button:Object(d.a)("Sign out"),onFinished:this.onFinished})}}i()(b,"defaultProps",{onFinished:function(){}})},636:function(e,t,a){"use strict";t.__esModule=!0,t.createSubscription=function(e,t){var a,s=i;function r(){l.onStateChange&&l.onStateChange()}function o(){var i,o,l;a||(a=t?t.addNestedSub(r):e.subscribe(r),i=(0,n.getBatch)(),o=null,l=null,s={clear:function(){o=null,l=null},notify:function(){i((function(){for(var e=o;e;)e.callback(),e=e.next}))},get:function(){for(var e=[],t=o;t;)e.push(t),t=t.next;return e},subscribe:function(e){var t=!0,a=l={callback:e,next:null,prev:l};return a.prev?a.prev.next=a:o=a,function(){t&&null!==o&&(t=!1,a.next?a.next.prev=a.prev:l=a.prev,a.prev?a.prev.next=a.next:o=a.next)}}})}var l={addNestedSub:function(e){return o(),s.subscribe(e)},notifyNestedSubs:function(){s.notify()},handleChangeWrapper:r,isSubscribed:function(){return Boolean(a)},trySubscribe:o,tryUnsubscribe:function(){a&&(a(),a=void 0,s.clear(),s=i)},getListeners:function(){return s}};return l};var n=a(896);var i={notify:function(){},get:function(){return[]}}},637:function(e,t,a){"use strict";t.__esModule=!0,t.useIsomorphicLayoutEffect=void 0;var n=a(120),i="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement?n.useLayoutEffect:n.useEffect;t.useIsomorphicLayoutEffect=i},638:function(e,t,a){"use strict";a.d(t,"a",(function(){return b}));var n=a(13),i=a.n(n),s=a(120),r=a.n(s),o=a(436),l=a.n(o),c=a(126),d=a.n(c),m=a(1),u=a(121),h=a(124),p=a(122),g=a(133),v=a(211);class b extends r.a.PureComponent{constructor(e,t){super(e,t),i()(this,"unmounted",!1),i()(this,"dispatcherRef",null),i()(this,"onAction",(e=>{"client_started"===e.action&&this.forceUpdate()})),this.state={page:""}}translate(e){return l()(Object(u.a)(e))}async fetchEmbed(){let e;try{e=await fetch(this.props.url,{method:"GET"})}catch(e){if(this.unmounted)return;return m.a.warn(`Error loading page: ${e}`),void this.setState({page:Object(u.a)("Couldn't load page")})}if(this.unmounted)return;if(!e.ok)return m.a.warn(`Error loading page: ${e.status}`),void this.setState({page:Object(u.a)("Couldn't load page")});let t=(await e.text()).replace(/_t\(['"]([\s\S]*?)['"]\)/gm,((e,t)=>this.translate(t)));this.props.replaceMap&&Object.keys(this.props.replaceMap).forEach((e=>{t=t.split(e).join(this.props.replaceMap[e])})),this.setState({page:t})}componentDidMount(){this.unmounted=!1,this.props.url&&(this.fetchEmbed(),this.dispatcherRef=h.a.register(this.onAction))}componentWillUnmount(){this.unmounted=!0,null!==this.dispatcherRef&&h.a.unregister(this.dispatcherRef)}render(){const e=this.context||p.a.get(),t=!e||e.isGuest(),a=this.props.className,n=d()({[a]:!0,[`${a}_guest`]:t,[`${a}_loggedIn`]:!!e}),i=r.a.createElement("div",{className:`${a}_body`,dangerouslySetInnerHTML:{__html:this.state.page}});return this.props.scrollbar?r.a.createElement(v.a,{className:n},i):r.a.createElement("div",{className:n},i)}}i()(b,"contextType",g.a)},639:function(e,t,a){"use strict";a.d(t,"a",(function(){return f}));var n=a(13),i=a.n(n),s=a(179),r=a(397),o=a(1),l=a(1528),c=a.n(l),d=a(122),m=a(906),u=a(525),h=a(163),p=a(161),g=a(180),v=a(121),b=a(131);class f{constructor(e,t,a,n){if(this.room=e,this.exportType=t,this.exportOptions=a,this.setProgressText=n,i()(this,"files",[]),i()(this,"client",void 0),i()(this,"cancelled",!1),a.maxSize<1048576||a.maxSize>8388608e3||a.numberOfMessages>10**8)throw new Error("Invalid export options");this.client=d.a.get(),window.addEventListener("beforeunload",this.onBeforeUnload)}get destinationFileName(){return this.makeFileNameNoExtension(b.b.get().brand)+".zip"}onBeforeUnload(e){return e.preventDefault(),e.returnValue=Object(v.a)("Are you sure you want to exit during this export?")}updateProgress(e){let t=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];(!(arguments.length>1&&void 0!==arguments[1])||arguments[1])&&o.a.log(e),t&&this.setProgressText(e)}addFile(e,t){const a={name:e,blob:t};this.files.push(a)}makeFileNameNoExtension(){var e;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"matrix";const a=c()(null!==(e=this.room.name)&&void 0!==e?e:Object(v.a)("Unnamed Room")).trim()||"Unnamed Room",n=Object(p.e)(new Date).replace(/:/g,"-");return`${c()(t)} - ${a} - Chat Export - ${n}`}async downloadZIP(){const e=this.destinationFileName,t=e.substring(0,e.lastIndexOf(".")),{default:n}=await a.e(42).then(a.t.bind(null,1563,7)),i=new n;if(this.cancelled)return this.cleanUp();this.updateProgress(Object(v.a)("Generating a ZIP"));for(const e of this.files)i.file(t+"/"+e.name,e.blob);const s=await i.generateAsync({type:"blob"});Object(r.saveAs)(s,t+".zip")}cleanUp(){return o.a.log("Cleaning up..."),window.removeEventListener("beforeunload",this.onBeforeUnload),""}async cancelExport(){o.a.log("Cancelling export..."),this.cancelled=!0}downloadPlainText(e,t){const a=new Blob([t],{type:"text/plain"});Object(r.saveAs)(a,e)}setEventMetadata(e){const t=this.client.getRoom(this.room.roomId).currentState;return e.sender=t.getSentinelMember(e.getSender()),"m.room.member"===e.getType()&&(e.target=t.getSentinelMember(e.getStateKey())),e}getLimit(){let e;switch(this.exportType){case m.b.LastNMessages:e=this.exportOptions.numberOfMessages;break;case m.b.Timeline:e=40;break;default:e=10**8}return e}async getRequiredEvents(){const e=this.client.getEventMapper();let t=null,a=this.getLimit();const n=[];for(;a;){const i=Math.min(a,1e3),r=await this.client.createMessagesRequest(this.room.roomId,t,i,s.a.Backward);if(this.cancelled)return this.cleanUp(),[];if(0===r.chunk.length)break;a-=r.chunk.length;const o=r.chunk.map(e);for(const e of o)n.push(e);this.exportType===m.b.LastNMessages?this.updateProgress(Object(v.a)("Fetched %(count)s events out of %(total)s",{count:n.length,total:this.exportOptions.numberOfMessages})):this.updateProgress(Object(v.a)("Fetched %(count)s events so far",{count:n.length})),t=r.end}for(let e=0;e<Math.floor(n.length/2);e++)[n[e],n[n.length-e-1]]=[n[n.length-e-1],n[e]];const i=n.filter((e=>e.isEncrypted())).map((e=>this.client.decryptEventIfNeeded(e,{isRetry:!0,emit:!1})));await Promise.all(i);for(let e=0;e<n.length;e++)this.setEventMetadata(n[e]);return n}async getMediaBlob(e){let t;try{const a=e.isEncrypted(),n=e.getContent();if(a&&n.hasOwnProperty("file")&&"m.sticker"!==e.getType())t=await Object(u.c)(n.file);else{const e=Object(h.a)(n),a=await fetch(e.srcHttp);t=await a.blob()}}catch(e){o.a.log("Error decrypting media")}return t}splitFileName(e){const t=e.lastIndexOf(".");if(-1===t)return[e,""];return[e.slice(0,t),"."+e.slice(t+1)]}getFilePath(e){let t;switch(e.getContent().msgtype){case"m.image":t="images";break;case"m.video":t="videos";break;case"m.audio":t="audio";break;default:t="m.sticker"===e.getType()?"stickers":"files"}const a=Object(p.d)(new Date(e.getTs()));let[n,i]=this.splitFileName(e.getContent().body);return"m.sticker"===e.getType()&&(i=".png"),Object(g.m)(e)&&(i=".ogg"),t+"/"+n+"-"+a+i}isReply(e){const t=(e.isEncrypted()?e.event.content:e.getContent())["m.relates_to"];return!(!t||!t["m.in_reply_to"])}isAttachment(e){const t=["m.sticker","m.image","m.file","m.video","m.audio"];return e.getType()===t[0]||t.includes(e.getContent().msgtype)}}},641:function(e,t,a){"use strict";a.d(t,"a",(function(){return h}));var n=a(13),i=a.n(n),s=a(120),r=a.n(s),o=a(913),l=a(131),c=a(121),d=a(279);const m={};for(const e of o.a)m[e.iso2]=e;function u(e,t){return"+"===e[0]&&(e=e.slice(1)),0==t.name.toUpperCase().indexOf(e.toUpperCase())||(t.iso2==e.toUpperCase()||-1!==t.prefix.indexOf(e))}class h extends r.a.Component{constructor(e){super(e),i()(this,"onSearchChange",(e=>{this.setState({searchQuery:e})})),i()(this,"onOptionChange",(e=>{this.props.onOptionChange(m[e])})),i()(this,"getShortOption",(e=>{if(!this.props.isSmall)return;let t;return this.props.showPrefix&&(t="+"+m[e].prefix),r.a.createElement("span",{className:"mx_CountryDropdown_shortOption"},this.flagImgForIso2(e),t)}));let t=o.a[0];const a=l.b.get("default_country_code");if(a){const e=o.a.find((e=>e.iso2===a.toUpperCase()));e&&(t=e)}this.state={searchQuery:"",defaultCountry:t}}componentDidMount(){this.props.value||this.props.onOptionChange(this.state.defaultCountry)}flagImgForIso2(e){return r.a.createElement("div",{className:"mx_Dropdown_option_emoji"},Object(o.b)(e))}render(){let e;if(this.state.searchQuery){if(e=o.a.filter(u.bind(this,this.state.searchQuery)),2==this.state.searchQuery.length&&m[this.state.searchQuery.toUpperCase()]){const t=m[this.state.searchQuery.toUpperCase()];e=e.filter((e=>e.iso2!=t.iso2)),e.unshift(t)}}else e=o.a;const t=e.map((e=>r.a.createElement("div",{className:"mx_CountryDropdown_option",key:e.iso2},this.flagImgForIso2(e.iso2),Object(c.a)(e.name)," (+",e.prefix,")"))),a=this.props.value||this.state.defaultCountry.iso2;return r.a.createElement(d.a,{id:"mx_CountryDropdown",className:this.props.className+" mx_CountryDropdown",onOptionChange:this.onOptionChange,onSearchChange:this.onSearchChange,menuWidth:298,getShortOption:this.getShortOption,value:a,searchEnabled:!0,disabled:this.props.disabled,label:Object(c.a)("Country Dropdown")},t)}}},642:function(e,t,a){"use strict";a.d(t,"a",(function(){return c}));var n=a(120),i=a.n(n),s=a(142),r=a(204),o=a(121);const l=e=>{let{name:t,last:a}=e;const n=s.g[t],r=s.a[t];return i.a.createElement(i.a.Fragment,null,i.a.createElement("kbd",null," ",n||r&&Object(o.a)(r)||t," "),!a&&"+")},c=e=>{let{value:t,className:a="mx_KeyboardShortcut"}=e;if(!t)return null;const n=[];return t.ctrlOrCmdKey?n.push(i.a.createElement(l,{key:"ctrlOrCmdKey",name:r.a?r.b.META:r.b.CONTROL})):t.ctrlKey?n.push(i.a.createElement(l,{key:"ctrlKey",name:r.b.CONTROL})):t.metaKey&&n.push(i.a.createElement(l,{key:"metaKey",name:r.b.META})),t.altKey&&n.push(i.a.createElement(l,{key:"altKey",name:r.b.ALT})),t.shiftKey&&n.push(i.a.createElement(l,{key:"shiftKey",name:r.b.SHIFT})),i.a.createElement("div",{className:a},n,i.a.createElement(l,{name:t.key,last:!0}))}},643:function(e,t,a){"use strict";var n=a(130),i=a.n(n),s=a(132),r=a.n(s),o=a(120),l=a.n(o),c=a(148),d=a(126),m=a.n(d),u=a(342),h=a(157),p=a(123),g=a(121),v=a(147),b=a(163),f=a(189);const y=["matrixClient","loginType","fragmentAfterLogin","idp","primary","mini","action","flow"],E=e=>{let t,{matrixClient:n,loginType:s,fragmentAfterLogin:o,idp:c,primary:d,mini:E,action:_,flow:S}=e,w=r()(e,y);t=c?Object(g.a)("Continue with %(provider)s",{provider:c.name}):u.a.findIn(S)?Object(g.a)("Continue"):Object(g.a)("Sign in with single sign-on");const O=()=>{var e,t;const a=(e=>{switch(e){case u.b.Apple:return"Apple";case u.b.Facebook:return"Facebook";case u.b.Github:return"GitHub";case u.b.Gitlab:return"GitLab";case u.b.Google:return"Google";default:return"SSO"}})(null!==(e=null==c?void 0:c.brand)&&void 0!==e?e:"");f.a.instance.setAuthenticationType(a),null===(t=h.a.get())||void 0===t||t.startSingleSignOn(n,s,o,null==c?void 0:c.id,_)};let C,x;const k=null!=c&&c.brand?(e=>{switch(e){case u.b.Apple:return a(1552).default;case u.b.Facebook:return a(1553).default;case u.b.Github:return a(1554).default;case u.b.Gitlab:return a(1555).default;case u.b.Google:return a(1556).default;case u.b.Twitter:return a(1557).default;default:return null}})(c.brand):null;if(null!=c&&c.brand&&k){const e=c.brand.split(".").pop();x=`mx_SSOButton_brand_${e}`,C=l.a.createElement("img",{src:k,height:"24",width:"24",alt:e})}else if("string"==typeof(null==c?void 0:c.icon)&&c.icon.startsWith("mxc://")){const e=Object(b.b)(c.icon,n).getSquareThumbnailHttp(24);C=l.a.createElement("img",{src:e,height:"24",width:"24",alt:c.name})}const j=x?{[x]:x}:void 0,R=m()("mx_SSOButton",{mx_SSOButton_mini:E,mx_SSOButton_default:!c,mx_SSOButton_primary:d},j);return E?l.a.createElement(v.a,i()({},w,{title:t,className:R,onClick:O}),C):l.a.createElement(p.a,i()({},w,{className:R,onClick:O}),C,t)};t.a=e=>{let{matrixClient:t,flow:a,loginType:n,fragmentAfterLogin:i,primary:s,action:r}=e;const o=a.identity_providers||[];if(o.length<2)return l.a.createElement("div",{className:"mx_SSOButtons"},l.a.createElement(E,{matrixClient:t,loginType:n,fragmentAfterLogin:i,idp:o[0],primary:s,action:r,flow:a}));const d=Math.ceil(o.length/6),m=Math.ceil(o.length/d);return l.a.createElement("div",{className:"mx_SSOButtons"},Object(c.chunk)(o,m).map((e=>l.a.createElement("div",{key:e[0].id,className:"mx_SSOButtons_row"},e.map((e=>l.a.createElement(E,{key:e.id,matrixClient:t,loginType:n,fragmentAfterLogin:i,idp:e,mini:!0,primary:s,action:r,flow:a})))))))}},652:function(e,t,a){"use strict";a.d(t,"b",(function(){return ue})),a.d(t,"a",(function(){return he}));var n=a(13),i=a.n(n),s=a(120),r=a.n(s),o=a(185),l=a.n(o),c=a(126),d=a.n(c),m=a(129),u=a(143),h=a(1),p=a(150),g=a(203),v=a(16),b=a(367),f=a(161),y=a(122),E=a(125),_=a(138),S=a(194),w=a(121),O=a(400),C=a(295);class x extends r.a.Component{constructor(e){super(e),i()(this,"onMouseDown",(e=>{this.setState({location:{currentX:e.clientX,currentY:e.clientY}}),document.addEventListener("mousemove",this.state.onMouseMove),document.addEventListener("mouseup",this.state.onMouseUp)})),i()(this,"onMouseUp",(e=>{document.removeEventListener("mousemove",this.state.onMouseMove),document.removeEventListener("mouseup",this.state.onMouseUp),this.props.onMouseUp(e)})),this.state={onMouseMove:this.onMouseMove.bind(this),onMouseUp:this.onMouseUp.bind(this),location:{currentX:0,currentY:0}}}onMouseMove(e){const t=this.props.dragFunc(this.state.location,e);this.setState({location:t})}render(){return r.a.createElement("div",{className:this.props.className,onMouseDown:this.onMouseDown})}}var k=a(137);class j extends r.a.Component{constructor(e){super(e),i()(this,"dragFunc",((e,t)=>{const a=t.clientX-e.currentX,n=this.state.width+a;return n<this.props.minWidth||n>this.props.maxWidth?e:(this.setState({width:n}),this.updateCSSWidth.bind(this)(n),{currentX:t.clientX,currentY:e.currentY})})),i()(this,"onMoueUp",(()=>{this.props.roomId&&E.b.setValue("ircDisplayNameWidth",this.props.roomId,k.a.ROOM_DEVICE,this.state.width)})),this.state={width:E.b.getValue("ircDisplayNameWidth",this.props.roomId),IRCLayoutRoot:null}}componentDidMount(){this.setState({IRCLayoutRoot:document.querySelector(".mx_IRCLayout")},(()=>this.updateCSSWidth(this.state.width)))}updateCSSWidth(e){this.state.IRCLayoutRoot.style.setProperty("--name-width",e+"px")}render(){return r.a.createElement(x,{className:"mx_ProfileResizer",dragFunc:this.dragFunc,onMouseUp:this.onMoueUp})}}var R=a(165),I=a(907),T=a(179),N=a(310);var D=()=>{var e;const{room:t}=Object(s.useContext)(_.b),a=t.getLiveTimeline().getState(T.b.BACKWARDS),n=a.getStateEvents("m.room.encryption")[0],i=null===(e=a.getStateEvents("m.room.history_visibility")[0])||void 0===e?void 0:e.getContent().history_visibility;let o;return"invited"==i?o=Object(w.a)("You don't have permission to view messages from before you were invited."):"joined"==i?o=Object(w.a)("You don't have permission to view messages from before you joined."):n&&(o=Object(w.a)("Encrypted messages before this point are unavailable.")),r.a.createElement(N.a,{className:"mx_HistoryTile",title:Object(w.a)("You can't see earlier messages"),subtitle:o})},P=a(124),M=a(141),A=a(186);function L(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const a=[],n=Object.keys(e.currentState.members);for(const i of n)e.currentState.members[i].typing&&-1===t.indexOf(i)&&a.push(e.currentState.members[i]);return a}var U=a(329),F=a(171);class B extends r.a.Component{constructor(){var e;super(...arguments),i()(this,"state",{usersTyping:(e=this.props.room,L(e,[y.a.get().getUserId()])),delayedStopTypingTimers:{}}),i()(this,"isVisible",(()=>B.isVisible(this.state))),i()(this,"onRoomTimeline",((e,t)=>{if((null==t?void 0:t.roomId)===this.props.room.roomId){const t=e.getSender(),a=this.state.usersTyping.filter((e=>e.userId!==t));a.length!==this.state.usersTyping.length&&this.setState({usersTyping:a}),this.abortUserTimer(t)}})),i()(this,"onRoomMemberTyping",(()=>{const e=function(e){return L(e,[y.a.get().getUserId()].concat(y.a.get().getIgnoredUsers()))}(this.props.room);this.setState({delayedStopTypingTimers:this.updateDelayedStopTypingTimers(e),usersTyping:e})}))}componentDidMount(){y.a.get().on(A.b.Typing,this.onRoomMemberTyping),y.a.get().on(M.d.Timeline,this.onRoomTimeline)}componentDidUpdate(e,t){const a=B.isVisible(t),n=B.isVisible(this.state);this.props.onShown&&!a&&n?this.props.onShown():this.props.onHidden&&a&&!n&&this.props.onHidden()}componentWillUnmount(){const e=y.a.get();e&&(e.removeListener(A.b.Typing,this.onRoomMemberTyping),e.removeListener(M.d.Timeline,this.onRoomTimeline)),Object.values(this.state.delayedStopTypingTimers).forEach((e=>e.abort()))}static isVisible(e){return 0!==e.usersTyping.length||0!==Object.keys(e.delayedStopTypingTimers).length}updateDelayedStopTypingTimers(e){const t=this.state.usersTyping.filter((t=>!e.some((e=>t.userId===e.userId)))),a=e.filter((e=>!this.state.usersTyping.some((t=>e.userId===t.userId))));a.forEach((e=>{const t=this.state.delayedStopTypingTimers[e.userId];t&&t.abort()}));let n=Object.assign({},this.state.delayedStopTypingTimers);return n=a.reduce(((e,t)=>(delete e[t.userId],e)),n),n=t.reduce(((e,t)=>{if(!e[t.userId]){const a=new U.a(5e3);e[t.userId]=a,a.start(),a.finished().then((()=>this.removeUserTimer(t.userId)),(()=>{}))}return e}),n),n}abortUserTimer(e){const t=this.state.delayedStopTypingTimers[e];t&&(t.abort(),this.removeUserTimer(e))}removeUserTimer(e){if(this.state.delayedStopTypingTimers[e]){const t=Object.assign({},this.state.delayedStopTypingTimers);delete t[e],this.setState({delayedStopTypingTimers:t})}}renderTypingIndicatorAvatars(e,t){let a=0;e.length>t&&(a=e.length-t+1,e=e.slice(0,t-1));const n=e.map((e=>r.a.createElement(F.b,{key:e.userId,member:e,width:24,height:24,resizeMethod:"crop",viewUserOnClick:!0,"aria-live":"off"})));return a>0&&n.push(r.a.createElement("span",{className:"mx_WhoIsTypingTile_remainingAvatarPlaceholder",key:"others"},"+",a)),n}render(){let e=this.state.usersTyping;const t=Object.keys(this.state.delayedStopTypingTimers).map((e=>this.props.room.getMember(e)));e=e.concat(t),e.sort(((e,t)=>Object(v.g)(e.name,t.name)));const a=function(e,t){let a=0;if(e.length>t&&(a=e.length-t+1),0===e.length)return"";if(1===e.length)return Object(w.a)("%(displayName)s is typing …",{displayName:e[0].name});const n=e.map((e=>e.name));if(a>=1)return Object(w.a)("%(names)s and %(count)s others are typing …",{names:n.slice(0,t-1).join(", "),count:a});{const e=n.pop();return Object(w.a)("%(names)s and %(lastPerson)s are typing …",{names:n.join(", "),lastPerson:e})}}(e,this.props.whoIsTypingLimit);return a?r.a.createElement("li",{className:"mx_WhoIsTypingTile","aria-atomic":"true"},r.a.createElement("div",{className:"mx_WhoIsTypingTile_avatars"},this.renderTypingIndicatorAvatars(e,this.props.whoIsTypingLimit)),r.a.createElement("div",{className:"mx_WhoIsTypingTile_label"},a)):null}}i()(B,"defaultProps",{whoIsTypingLimit:3});var V=a(447),W=a(148),H=a(394),z=a(123);var G=e=>{let{events:t,children:a,threshold:n=3,onToggle:i,startExpanded:o=!1,summaryMembers:l=[],summaryText:c,layout:d=S.a.Group,"data-testid":m}=e;const[u,p]=Object(H.a)(o);Object(s.useEffect)((()=>{i&&i()}),[u]);const g=t.map((e=>e.getId())).join(",");if(t.length<n)return r.a.createElement("li",{className:"mx_GenericEventListSummary","data-scroll-tokens":g,"data-expanded":!0,"data-layout":d},r.a.createElement("ol",{className:"mx_GenericEventListSummary_unstyledList"},a));let v;if(u)v=r.a.createElement(r.a.Fragment,null,r.a.createElement("div",{className:"mx_GenericEventListSummary_line"}," "),r.a.createElement("ol",{className:"mx_GenericEventListSummary_unstyledList"},a));else{const e=Object(W.uniqBy)(l.filter((e=>!(null==e||!e.getMxcAvatarUrl)||(h.a.error("EventListSummary given null summaryMember, termites may be afoot eating event senders",l),!1))),(e=>e.getMxcAvatarUrl())).map((e=>r.a.createElement(F.b,{key:e.userId,member:e,width:14,height:14})));v=r.a.createElement("div",{className:"mx_EventTile_line"},r.a.createElement("div",{className:"mx_EventTile_info"},r.a.createElement("span",{className:"mx_GenericEventListSummary_avatars",onClick:p},e),r.a.createElement("span",{className:"mx_TextualEvent mx_GenericEventListSummary_summary"},c)))}return r.a.createElement("li",{className:"mx_GenericEventListSummary","data-scroll-tokens":g,"data-expanded":u+"","data-layout":d,"data-testid":m},r.a.createElement(z.a,{kind:"link_inline",className:"mx_GenericEventListSummary_toggle",onClick:p,"aria-expanded":u},u?Object(w.a)("collapse"):Object(w.a)("expand")),v)},K=a(210),q=a(231),$=a(181),Y=a(754),J=a(174);const Q=()=>{J.a.instance.setCard({phase:$.a.PinnedMessages},!1)},X=[m.b.RoomMember];var Z;!function(e){e.Joined="joined",e.Left="left",e.JoinedAndLeft="joined_and_left",e.LeftAndJoined="left_and_joined",e.InviteReject="invite_reject",e.InviteWithdrawal="invite_withdrawal",e.Invited="invited",e.Banned="banned",e.Unbanned="unbanned",e.Kicked="kicked",e.ChangedName="changed_name",e.ChangedAvatar="changed_avatar",e.NoChange="no_change",e.ServerAcl="server_acl",e.ChangedPins="pinned_messages",e.MessageRemoved="message_removed",e.HiddenEvent="hidden_event"}(Z||(Z={}));class ee extends r.a.Component{constructor(){super(...arguments),i()(this,"context",void 0)}shouldComponentUpdate(e){return e.events.length!==this.props.events.length||e.events.length<this.props.threshold||e.layout!==this.props.layout}generateSummary(e,t){const a=t.map((t=>{const a=e[t],n=this.renderNameList(a),i=t.split(","),s=ee.getCanonicalTransitions(i),r=ee.coalesceRepeatedTransitions(s).map((e=>ee.getDescriptionForTransition(e.transitionType,a.length,e.repeats))),o=Object(K.b)(r);return Object(w.a)("%(nameList)s %(transitionList)s",{nameList:n,transitionList:o})}));return a?Object(Y.a)(a,", "):null}renderNameList(e){return Object(K.b)(e,this.props.summaryLength)}static getCanonicalTransitions(e){const t={[Z.Joined]:{after:Z.Left,newTransition:Z.JoinedAndLeft},[Z.Left]:{after:Z.Joined,newTransition:Z.LeftAndJoined}},a=[];for(let n=0;n<e.length;n++){const i=e[n],s=e[n+1];let r=i;n<e.length-1&&t[i]&&t[i].after===s&&(r=t[i].newTransition,n++),a.push(r)}return a}static coalesceRepeatedTransitions(e){const t=[];for(const a of e)t.length>0&&t[t.length-1].transitionType===a?t[t.length-1].repeats+=1:t.push({transitionType:a,repeats:1});return t}static getDescriptionForTransition(e,t,a){var n;let i;switch(e){case Z.Joined:i=t>1?Object(w.a)("%(severalUsers)sjoined %(count)s times",{severalUsers:"",count:a}):Object(w.a)("%(oneUser)sjoined %(count)s times",{oneUser:"",count:a});break;case Z.Left:i=t>1?Object(w.a)("%(severalUsers)sleft %(count)s times",{severalUsers:"",count:a}):Object(w.a)("%(oneUser)sleft %(count)s times",{oneUser:"",count:a});break;case Z.JoinedAndLeft:i=t>1?Object(w.a)("%(severalUsers)sjoined and left %(count)s times",{severalUsers:"",count:a}):Object(w.a)("%(oneUser)sjoined and left %(count)s times",{oneUser:"",count:a});break;case Z.LeftAndJoined:i=t>1?Object(w.a)("%(severalUsers)sleft and rejoined %(count)s times",{severalUsers:"",count:a}):Object(w.a)("%(oneUser)sleft and rejoined %(count)s times",{oneUser:"",count:a});break;case Z.InviteReject:i=t>1?Object(w.a)("%(severalUsers)srejected their invitations %(count)s times",{severalUsers:"",count:a}):Object(w.a)("%(oneUser)srejected their invitation %(count)s times",{oneUser:"",count:a});break;case Z.InviteWithdrawal:i=t>1?Object(w.a)("%(severalUsers)shad their invitations withdrawn %(count)s times",{severalUsers:"",count:a}):Object(w.a)("%(oneUser)shad their invitation withdrawn %(count)s times",{oneUser:"",count:a});break;case Z.Invited:i=t>1?Object(w.a)("were invited %(count)s times",{count:a}):Object(w.a)("was invited %(count)s times",{count:a});break;case Z.Banned:i=t>1?Object(w.a)("were banned %(count)s times",{count:a}):Object(w.a)("was banned %(count)s times",{count:a});break;case Z.Unbanned:i=t>1?Object(w.a)("were unbanned %(count)s times",{count:a}):Object(w.a)("was unbanned %(count)s times",{count:a});break;case Z.Kicked:i=t>1?Object(w.a)("were removed %(count)s times",{count:a}):Object(w.a)("was removed %(count)s times",{count:a});break;case Z.ChangedName:i=t>1?Object(w.a)("%(severalUsers)schanged their name %(count)s times",{severalUsers:"",count:a}):Object(w.a)("%(oneUser)schanged their name %(count)s times",{oneUser:"",count:a});break;case Z.ChangedAvatar:i=t>1?Object(w.a)("%(severalUsers)schanged their avatar %(count)s times",{severalUsers:"",count:a}):Object(w.a)("%(oneUser)schanged their avatar %(count)s times",{oneUser:"",count:a});break;case Z.NoChange:i=t>1?Object(w.a)("%(severalUsers)smade no changes %(count)s times",{severalUsers:"",count:a}):Object(w.a)("%(oneUser)smade no changes %(count)s times",{oneUser:"",count:a});break;case Z.ServerAcl:i=t>1?Object(w.a)("%(severalUsers)schanged the server ACLs %(count)s times",{severalUsers:"",count:a}):Object(w.a)("%(oneUser)schanged the server ACLs %(count)s times",{oneUser:"",count:a});break;case Z.ChangedPins:i=t>1?Object(w.a)("%(severalUsers)schanged the <a>pinned messages</a> for the room %(count)s times",{severalUsers:"",count:a},{a:e=>r.a.createElement(z.a,{kind:"link_inline",onClick:Q},e)}):Object(w.a)("%(oneUser)schanged the <a>pinned messages</a> for the room %(count)s times",{oneUser:"",count:a},{a:e=>r.a.createElement(z.a,{kind:"link_inline",onClick:Q},e)});break;case Z.MessageRemoved:i=t>1?Object(w.a)("%(severalUsers)sremoved a message %(count)s times",{severalUsers:"",count:a}):Object(w.a)("%(oneUser)sremoved a message %(count)s times",{oneUser:"",count:a});break;case Z.HiddenEvent:i=t>1?Object(w.a)("%(severalUsers)ssent %(count)s hidden messages",{severalUsers:"",count:a}):Object(w.a)("%(oneUser)ssent %(count)s hidden messages",{oneUser:"",count:a})}return null!==(n=i)&&void 0!==n?n:null}static getTransitionSequence(e){return e.map(ee.getTransition)}static getTransition(e){if(e.mxEvent.isRedacted())return Z.MessageRemoved;switch(e.mxEvent.getType()){case m.b.RoomThirdPartyInvite:return Object(q.c)(e.mxEvent)?Z.Invited:Z.InviteWithdrawal;case m.b.RoomServerAcl:return Z.ServerAcl;case m.b.RoomPinnedEvents:return Z.ChangedPins;case m.b.RoomMember:switch(e.mxEvent.getContent().membership){case"invite":return Z.Invited;case"ban":return Z.Banned;case"join":return"join"===e.mxEvent.getPrevContent().membership?e.mxEvent.getContent().displayname!==e.mxEvent.getPrevContent().displayname?Z.ChangedName:e.mxEvent.getContent().avatar_url!==e.mxEvent.getPrevContent().avatar_url?Z.ChangedAvatar:Z.NoChange:Z.Joined;case"leave":if(e.mxEvent.getSender()===e.mxEvent.getStateKey())return"invite"===e.mxEvent.getPrevContent().membership?Z.InviteReject:Z.Left;switch(e.mxEvent.getPrevContent().membership){case"invite":return Z.InviteWithdrawal;case"ban":return Z.Unbanned;default:return Z.Kicked}default:return null}default:return Z.HiddenEvent}}getAggregate(e){const t={},a={};return Object.keys(e).forEach((n=>{const i=e[n][0],s=i.displayName,r=ee.getTransitionSequence(e[n]).join(",");t[r]||(t[r]=[],a[r]=-1),t[r].push(s),(-1===a[r]||i.index<a[r])&&(a[r]=i.index)})),{names:t,indices:a}}render(){const e=this.props.events,t=new Map,a={};e.forEach(((e,n)=>{const i=e.getType();let s=e.getSender();if(i===m.b.RoomThirdPartyInvite)s=e.getContent().display_name;else if(i===m.b.RoomMember)s=e.getStateKey();else if(e.isRedacted()){var r,o;s=null===(r=e.getUnsigned())||void 0===r||null===(o=r.redacted_because)||void 0===o?void 0:o.sender}a[s]||(a[s]=[]);let l=s;if(e.isRedacted()){var c,d;const e=null===(c=this.context)||void 0===c||null===(d=c.room)||void 0===d?void 0:d.getMember(s);e&&(l=e.name,t.set(s,e))}else e.target&&X.includes(i)?(l=e.target.name,t.set(s,e.target)):e.sender&&i!==m.b.RoomThirdPartyInvite&&(l=e.sender.name,t.set(s,e.sender));a[s].push({mxEvent:e,displayName:l,index:n})}));const n=this.getAggregate(a),i=Object.keys(n.names).sort(((e,t)=>n.indices[e]-n.indices[t]));return r.a.createElement(G,{"data-testid":this.props["data-testid"],events:this.props.events,threshold:this.props.threshold,onToggle:this.props.onToggle,startExpanded:this.props.startExpanded,children:this.props.children,summaryMembers:[...t.values()],layout:this.props.layout,summaryText:this.generateSummary(n.names,i)})}}i()(ee,"contextType",_.b),i()(ee,"defaultProps",{summaryLength:1,threshold:3,avatarsMaxLength:5,layout:S.a.Group});var te=a(498),ae=a(475),ne=a(134),ie=a(128),se=a(627),re=a(237),oe=a(833),le=a(180),ce=a(192);const de=[m.b.Sticker,m.b.RoomMessage],me=[m.b.RoomMember,m.b.RoomThirdPartyInvite,m.b.RoomServerAcl,m.b.RoomPinnedEvents];function ue(e,t,a,n){return n!==_.a.ThreadsList&&(!(null==e||!e.sender||!t.sender)&&(!(t.getTs()-e.getTs()>3e5)&&(t.isRedacted()===e.isRedacted()&&(!!(t.getType()===e.getType()||de.includes(t.getType())&&de.includes(e.getType()))&&(t.sender.userId===e.sender.userId&&t.sender.name===e.sender.name&&t.sender.getMxcAvatarUrl()===e.sender.getMxcAvatarUrl()&&((!Object(le.i)(t)&&!Object(le.i)(e)||n===_.a.Thread)&&!!Object(re.c)(e,a)))))))}class he extends r.a.Component{constructor(e,t){super(e,t),i()(this,"context",void 0),i()(this,"readReceiptMap",{}),i()(this,"readReceiptsByEvent",{}),i()(this,"readReceiptsByUserId",{}),i()(this,"_showHiddenEvents",void 0),i()(this,"isMounted",!1),i()(this,"readMarkerNode",Object(s.createRef)()),i()(this,"whoIsTyping",Object(s.createRef)()),i()(this,"scrollPanel",Object(s.createRef)()),i()(this,"showTypingNotificationsWatcherRef",void 0),i()(this,"eventTiles",{}),i()(this,"grouperKeyMap",new WeakMap),i()(this,"calculateRoomMembersCount",(()=>{this.setState({hideSender:this.shouldHideSender()})})),i()(this,"onShowTypingNotificationsChange",(()=>{this.setState({showTypingNotifications:E.b.getValue("showTypingNotifications")})})),i()(this,"isUnmounting",(()=>!this.isMounted)),i()(this,"collectGhostReadMarker",(e=>{e&&requestAnimationFrame((()=>{e.style.width="10%",e.style.opacity="0"}))})),i()(this,"onGhostTransitionEnd",(e=>{const t=e.target.dataset.eventid;this.setState({ghostReadMarkers:this.state.ghostReadMarkers.filter((e=>e!==t))})})),i()(this,"collectEventTile",((e,t)=>{this.eventTiles[e]=t})),i()(this,"onHeightChanged",(()=>{const e=this.scrollPanel.current;e&&e.checkScroll()})),i()(this,"onTypingShown",(()=>{const e=this.scrollPanel.current;e.checkScroll(),e&&e.getScrollState().stuckAtBottom&&e.preventShrinking()})),i()(this,"onTypingHidden",(()=>{const e=this.scrollPanel.current;e&&(e.updatePreventShrinking(),e.checkScroll())})),this.state={ghostReadMarkers:[],showTypingNotifications:E.b.getValue("showTypingNotifications"),hideSender:this.shouldHideSender()},this._showHiddenEvents=E.b.getValue("showHiddenEventsInTimeline"),this.showTypingNotificationsWatcherRef=E.b.watchSetting("showTypingNotifications",null,this.onShowTypingNotificationsChange)}componentDidMount(){var e;this.calculateRoomMembersCount(),null===(e=this.props.room)||void 0===e||e.currentState.on(p.b.Update,this.calculateRoomMembersCount),this.isMounted=!0}componentWillUnmount(){var e;this.isMounted=!1,null===(e=this.props.room)||void 0===e||e.currentState.off(p.b.Update,this.calculateRoomMembersCount),E.b.unwatchSetting(this.showTypingNotificationsWatcherRef)}componentDidUpdate(e,t){if(e.layout!==this.props.layout&&this.calculateRoomMembersCount(),e.readMarkerVisible&&this.props.readMarkerEventId!==e.readMarkerEventId){const t=this.state.ghostReadMarkers;t.push(e.readMarkerEventId),this.setState({ghostReadMarkers:t})}const a=this.pendingEditItem;if(!this.props.editState&&this.props.room&&a){const e=this.props.room.findEventById(a);P.a.dispatch({action:ie.a.EditEvent,event:null!=e&&e.isRedacted()?null:e,timelineRenderingType:this.context.timelineRenderingType})}}shouldHideSender(){var e;return(null===(e=this.props.room)||void 0===e?void 0:e.getInvitedAndJoinedMemberCount())<=2&&this.props.layout===S.a.Bubble}getNodeForEventId(e){var t,a;if(this.eventTiles)return null===(t=this.eventTiles[e])||void 0===t||null===(a=t.ref)||void 0===a?void 0:a.current}getTileForEventId(e){if(this.eventTiles&&e)return this.eventTiles[e]}isAtBottom(){var e;return null===(e=this.scrollPanel.current)||void 0===e?void 0:e.isAtBottom()}getScrollState(){var e,t;return null!==(e=null===(t=this.scrollPanel.current)||void 0===t?void 0:t.getScrollState())&&void 0!==e?e:null}getReadMarkerPosition(){const e=this.readMarkerNode.current,t=this.scrollPanel.current;if(!e||!t)return null;const a=l.a.findDOMNode(t).getBoundingClientRect(),n=e.getBoundingClientRect();return n.bottom+2<a.top?-1:n.top<a.bottom?0:1}scrollToTop(){var e;null===(e=this.scrollPanel.current)||void 0===e||e.scrollToTop()}scrollToBottom(){var e;null===(e=this.scrollPanel.current)||void 0===e||e.scrollToBottom()}handleScrollKey(e){var t;null===(t=this.scrollPanel.current)||void 0===t||t.handleScrollKey(e)}scrollToEvent(e,t,a){this.scrollPanel.current&&this.scrollPanel.current.scrollToToken(e,t,a)}scrollToEventIfNeeded(e){const t=this.getNodeForEventId(e);t&&t.scrollIntoView({block:"nearest",behavior:"instant"})}get showHiddenEvents(){var e,t;return null!==(e=null===(t=this.context)||void 0===t?void 0:t.showHiddenEvents)&&void 0!==e?e:this._showHiddenEvents}shouldShowEvent(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(this.props.hideThreadedMessages&&this.props.room){const{shouldLiveInRoom:t}=this.props.room.eventShouldLiveIn(e,this.props.events);if(!t)return!1}return!y.a.get().isUserIgnored(e.getSender())&&(!(!this.showHiddenEvents||t)||!!Object(re.c)(e,this.showHiddenEvents)&&(this.props.highlightedEventId===e.getId()||!Object(b.a)(e,this.context)))}readMarkerForEvent(e,t){const a=!t&&this.props.readMarkerVisible;if(this.props.readMarkerEventId===e){let t;return a&&(t=r.a.createElement("hr",{className:"mx_RoomView_myReadMarker",style:{opacity:1,width:"99%"}})),r.a.createElement("li",{key:"readMarker_"+e,ref:this.readMarkerNode,className:"mx_RoomView_myReadMarker_container","data-scroll-tokens":e},t)}if(this.state.ghostReadMarkers.includes(e)){const t=r.a.createElement("hr",{className:"mx_RoomView_myReadMarker",ref:this.collectGhostReadMarker,onTransitionEnd:this.onGhostTransitionEnd,"data-eventid":e});return r.a.createElement("li",{key:"_readuptoghost_"+e,className:"mx_RoomView_myReadMarker_container"},t)}return null}getNextEventInfo(e,t){return{nextEvent:t<e.length-1?e[t+1]:null,nextTile:e.slice(t+1).find((e=>this.shouldShowEvent(e)))}}get pendingEditItem(){if(this.props.room)try{return localStorage.getItem(Object(oe.a)(this.props.room.roomId,this.context.timelineRenderingType))}catch(e){return void h.a.error(e)}}getEventTiles(){let e,t,a=-1;for(e=this.props.events.length-1;e>=0;e--){const n=this.props.events[e];if(this.shouldShowEvent(n)&&(void 0===t&&(t=n),!n.status)){a=e;break}}const n=[];let i=null;this.readReceiptsByEvent={},this.props.showReadReceipts&&(this.readReceiptsByEvent=this.getReadReceiptsByShownEvent());let s=null;for(e=0;e<this.props.events.length;e++){const r=this.props.events[e],o=r.getId(),l=r===t,{nextEvent:c,nextTile:d}=this.getNextEventInfo(this.props.events,e);if(s){if(s.shouldGroup(r)){s.add(r);continue}n.push(...s.getTiles()),i=s.getNewPrevEvent(),s=null}for(const e of be)if(e.canStartGroup(this,r)&&!this.props.disableGrouping){s=new e(this,r,i,t,c,d);break}if(!s){this.shouldShowEvent(r)&&(n.push(...this.getTilesForEvent(i,r,l,!1,c,d)),i=r);const t=this.readMarkerForEvent(o,e>=a);t&&n.push(t)}}return s&&n.push(...s.getTiles()),n}getTilesForEvent(e,t){var a;let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=arguments.length>3&&void 0!==arguments[3]&&arguments[3],s=arguments.length>4?arguments[4]:void 0,o=arguments.length>5?arguments[5]:void 0;const l=[],c=(null===(a=this.props.editState)||void 0===a?void 0:a.getEvent().getId())===t.getId();let d=t.getTs(),m=t.getDate();t.status&&(m=new Date,d=m.getTime());const h=this.wantsDateSeparator(e,m);if(h&&!i&&this.props.room){const e=r.a.createElement("li",{key:d},r.a.createElement(te.a,{key:d,roomId:this.props.room.roomId,ts:d}));l.push(e)}let p=!0;if(o){const e=o;p=this.wantsDateSeparator(t,e.getDate()||new Date)||t.getSender()!==e.getSender()||Object(se.a)(e,this.showHiddenEvents).isInfoMessage||!ue(t,e,this.showHiddenEvents,this.context.timelineRenderingType)}const g=!h&&ue(e,t,this.showHiddenEvents,this.context.timelineRenderingType),v=t.getId(),b=v===this.props.highlightedEventId,f=this.readReceiptsByEvent[v];let E=!1;const _=e=>!e||e===u.a.SENT,S=_(t.getAssociatedStatus()),w=s&&this.shouldShowEvent(s);(!w&&S||w&&S&&!_(s.getAssociatedStatus()))&&(E=!0),o&&o!==s&&_(o.getAssociatedStatus())&&(E=!1),E=E&&t.getSender()===y.a.get().getUserId();const C=this.props.callEventGroupers.get(t.getContent().call_id);return l.push(r.a.createElement(O.a,{key:t.getTxnId()||v,as:"li",ref:this.collectEventTile.bind(this,v),alwaysShowTimestamps:this.props.alwaysShowTimestamps,mxEvent:t,continuation:g,isRedacted:t.isRedacted(),replacingEventId:t.replacingEventId(),editState:c&&this.props.editState,onHeightChanged:this.onHeightChanged,readReceipts:f,readReceiptMap:this.readReceiptMap,showUrlPreview:this.props.showUrlPreview,checkUnmounting:this.isUnmounting,eventSendStatus:t.getAssociatedStatus(),isTwelveHour:this.props.isTwelveHour,permalinkCreator:this.props.permalinkCreator,last:n,lastInSection:p,lastSuccessful:E,isSelectedEvent:b,getRelationsForEvent:this.props.getRelationsForEvent,showReactions:this.props.showReactions,layout:this.props.layout,showReadReceipts:this.props.showReadReceipts,callEventGrouper:C,hideSender:this.state.hideSender})),l}wantsDateSeparator(e,t){return this.context.timelineRenderingType!==_.a.ThreadsList&&(null==e?!this.props.canBackPaginate:Object(f.o)(e.getDate()||void 0,t))}getReadReceiptsForEvent(e){const t=y.a.get().credentials.userId,{room:a}=this.props;if(!a)return null;const n=this.context.threadId?a.getThread(this.context.threadId):a,i=[];return n?(n.getReceiptsForEvent(e).forEach((e=>{if(!e.userId||!Object(v.v)(e.type)||e.userId===t)return;if(y.a.get().isUserIgnored(e.userId))return;const n=a.getMember(e.userId);i.push({userId:e.userId,roomMember:n,ts:e.data?e.data.ts:0})})),i):(h.a.debug("Discarding request, could not find the receiptDestination for event: "+this.context.threadId),i)}getReadReceiptsByShownEvent(){const e={},t={};let a;for(const n of this.props.events){if(this.shouldShowEvent(n)&&(a=n.getId()),!a)continue;const i=e[a]||[],s=this.getReadReceiptsForEvent(n);e[a]=i.concat(s);for(const e of s)t[e.userId]={lastShownEventId:a,receipt:e}}for(const a in this.readReceiptsByUserId){if(t[a])continue;const{lastShownEventId:n,receipt:i}=this.readReceiptsByUserId[a],s=e[n]||[];e[n]=s.concat(i),t[a]={lastShownEventId:n,receipt:i}}this.readReceiptsByUserId=t;for(const t in e)e[t].sort(((e,t)=>t.ts-e.ts));return e}updateTimelineMinHeight(){const e=this.scrollPanel.current;if(e){const t=e.isAtBottom(),a=this.whoIsTyping.current,n=a&&a.isVisible();t&&n&&e.preventShrinking()}}onTimelineReset(){const e=this.scrollPanel.current;e&&e.clearPreventShrinking()}render(){let e,t;this.props.backPaginating&&(e=r.a.createElement("li",{key:"_topSpinner"},r.a.createElement(ne.a,null))),this.props.forwardPaginating&&(t=r.a.createElement("li",{key:"_bottomSpinner"},r.a.createElement(ne.a,null)));const a=this.props.hidden?{display:"none"}:{};let n;this.props.room&&this.state.showTypingNotifications&&this.context.timelineRenderingType===_.a.Room&&(n=r.a.createElement(B,{room:this.props.room,onShown:this.onTypingShown,onHidden:this.onTypingHidden,ref:this.whoIsTyping}));let i=null;this.props.layout==S.a.IRC&&(i=r.a.createElement(j,{minWidth:20,maxWidth:600,roomId:this.props.room?this.props.room.roomId:null}));const s=d()(this.props.className,{mx_MessagePanel_narrow:this.context.narrow});return r.a.createElement(ae.a,null,r.a.createElement(V.a,{ref:this.scrollPanel,className:s,onScroll:this.props.onScroll,onFillRequest:this.props.onFillRequest,onUnfillRequest:this.props.onUnfillRequest,style:a,stickyBottom:this.props.stickyBottom,resizeNotifier:this.props.resizeNotifier,fixedChildren:i},e,this.getEventTiles(),n,t))}}i()(he,"contextType",_.b),i()(he,"defaultProps",{disableGrouping:!1});class pe{constructor(e,t,a,n,s,r){this.panel=e,this.event=t,this.prevEvent=a,this.lastShownEvent=n,this.nextEvent=s,this.nextEventTile=r,i()(this,"events",[]),i()(this,"ejectedEvents",[]),i()(this,"readMarker",void 0),this.readMarker=e.readMarkerForEvent(t.getId(),t===n)}}i()(pe,"canStartGroup",((e,t)=>!0));class ge extends pe{shouldGroup(e){const t=this.panel,a=this.event;if(!t.shouldShowEvent(e))return!0;if(t.wantsDateSeparator(this.event,e.getDate()))return!1;if(e.getType()===m.b.RoomMember&&(e.getStateKey()!==a.getSender()||"join"!==e.getContent().membership))return!1;const n=e.getType();return!g.b.matches(n)&&(ce.g!==n&&!(!e.isState()||e.getSender()!==a.getSender()))}add(e){const t=this.panel;this.readMarker=this.readMarker||t.readMarkerForEvent(e.getId(),e===this.lastShownEvent),t.shouldShowEvent(e)&&(e.getType()===m.b.RoomEncryption?this.ejectedEvents.push(e):this.events.push(e))}getTiles(){if(!this.events||!this.events.length)return[];const e=this.panel,t=[],a=this.event,n=this.lastShownEvent;if(e.wantsDateSeparator(this.prevEvent,a.getDate())){const e=a.getTs();t.push(r.a.createElement("li",{key:e+"~"},r.a.createElement(te.a,{roomId:a.getRoomId(),ts:e})))}e.shouldShowEvent(a)&&t.push(...e.getTilesForEvent(a,a));for(const i of this.ejectedEvents)t.push(...e.getTilesForEvent(a,i,a===n,true));const i=this.events.map((t=>e.getTilesForEvent(t,t,t===n,true))).reduce(((e,t)=>e.concat(t)),[]),s=this.events[this.events.length-1];let o;const l=s.getRoomId(),c=s.sender?s.sender.name:s.getSender();return o=R.a.shared().getUserIdForRoomId(l)?Object(w.a)("%(creator)s created this DM.",{creator:c}):Object(w.a)("%(creator)s created and configured the room.",{creator:c}),t.push(r.a.createElement(I.a,{key:"newroomintro"})),t.push(r.a.createElement(G,{key:"roomcreationsummary",events:this.events,onToggle:e.onHeightChanged,summaryMembers:[s.sender],summaryText:o,layout:this.panel.props.layout},i)),this.readMarker&&t.push(this.readMarker),t}getNewPrevEvent(){return this.event}}i()(ge,"canStartGroup",(function(e,t){return t.getType()===m.b.RoomCreate}));class ve extends pe{constructor(e,t,a,n,i,s){super(e,t,a,n,i,s),this.panel=e,this.event=t,this.prevEvent=a,this.lastShownEvent=n,this.events=[t]}shouldGroup(e){return!this.panel.shouldShowEvent(e)||!this.panel.wantsDateSeparator(this.events[0],e.getDate())&&(!(!e.isState()||!me.includes(e.getType()))||(!!e.isRedacted()||!(!this.panel.showHiddenEvents||this.panel.shouldShowEvent(e,!0))))}add(e){(e.getType()!==m.b.RoomMember||Object(C.a)(e,this.panel.showHiddenEvents))&&(this.readMarker=this.readMarker||this.panel.readMarkerForEvent(e.getId(),e===this.lastShownEvent),(this.panel.showHiddenEvents||this.panel.shouldShowEvent(e))&&this.events.push(e))}generateKey(){return"eventlistsummary-"+this.events[0].getId()}getTiles(){var e;if(null===(e=this.events)||void 0===e||!e.length)return[];const t=this.panel,a=this.lastShownEvent,n=[];if(t.wantsDateSeparator(this.prevEvent,this.events[0].getDate())){const e=this.events[0].getTs();n.push(r.a.createElement("li",{key:e+"~"},r.a.createElement(te.a,{roomId:this.events[0].getRoomId(),ts:e})))}const i=this.events.find((e=>this.panel.grouperKeyMap.get(e))),s=i?this.panel.grouperKeyMap.get(i):this.generateKey();i||this.panel.grouperKeyMap.set(this.events[0],s);let o=!1,l=this.events.map(((e,n)=>(e.getId()===t.props.highlightedEventId&&(o=!0),t.getTilesForEvent(0===n?this.prevEvent:this.events[n-1],e,e===a,true,this.nextEvent,this.nextEventTile)))).reduce(((e,t)=>e.concat(t)),[]);return 0===l.length&&(l=null),this.panel.props.canBackPaginate||this.prevEvent||n.push(r.a.createElement(D,{key:"historytile"})),n.push(r.a.createElement(ee,{key:s,"data-testid":s,events:this.events,onToggle:t.onHeightChanged,startExpanded:o,layout:this.panel.props.layout},l)),this.readMarker&&n.push(this.readMarker),n}getNewPrevEvent(){return this.events[this.events.length-1]}}i()(ve,"canStartGroup",(function(e,t){return!!e.shouldShowEvent(t)&&(!(!t.isState()||!me.includes(t.getType()))||(!!t.isRedacted()||!(!e.showHiddenEvents||e.shouldShowEvent(t,!0))))}));const be=[ge,ve]},655:function(e,t,a){"use strict";a.d(t,"b",(function(){return b})),a.d(t,"c",(function(){return f})),a.d(t,"a",(function(){return y})),a.d(t,"d",(function(){return E}));var n=a(13),i=a.n(n),s=a(120),r=a.n(s),o=a(487),l=a(915),c=a(916),d=a(1),m=a(121),u=a(127),h=a(257);function p(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function g(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?p(Object(a),!0).forEach((function(t){i()(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):p(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}var v=a(1545);let b,f,y;!function(e){e.Show="show"}(b||(b={})),function(e){e[e.Loading=0]="Loading",e[e.ShowingQR=1]="ShowingQR",e[e.Connecting=2]="Connecting",e[e.Connected=3]="Connected",e[e.WaitingForDevice=4]="WaitingForDevice",e[e.Verifying=5]="Verifying",e[e.Error=6]="Error"}(f||(f={})),function(e){e[e.Cancel=0]="Cancel",e[e.Decline=1]="Decline",e[e.Approve=2]="Approve",e[e.TryAgain=3]="TryAgain",e[e.Back=4]="Back"}(y||(y={}));class E extends r.a.Component{constructor(e){super(e),i()(this,"approveLogin",(async()=>{if(!this.state.rendezvous)throw new Error("Rendezvous not found");this.setState({phase:f.Loading});try{d.a.info("Requesting login token");const{login_token:a}=await(e=this.props.client.requestLoginToken,t={matrixClient:this.props.client,title:Object(m.a)("Sign in new device")},async function(){for(var a=arguments.length,n=new Array(a),i=0;i<a;i++)n[i]=arguments[i];return new Promise(((a,i)=>{const s=e.bind(t.matrixClient);s(void 0,...n).then((e=>a(e))).catch((e=>{var r;if(401!==e.httpStatus||null===(r=e.data)||void 0===r||!r.flows)return i(e);u.b.createDialog(h.a,g(g({},t),{},{authData:e.data,makeRequest:e=>s(e,...n),onFinished:(e,t)=>{e?a(t):i(t)}}))}))}))})();this.setState({phase:f.WaitingForDevice});if(!await this.state.rendezvous.approveLoginOnExistingDevice(a))return;if(!this.props.client.crypto)return void this.props.onFinished(!0);this.setState({phase:f.Verifying}),await this.state.rendezvous.verifyNewDeviceOnExistingDevice(),this.props.onFinished(!0)}catch(e){d.a.error("Error whilst approving sign in",e),this.setState({phase:f.Error,failureReason:o.c.Unknown})}var e,t})),i()(this,"generateCode",(async()=>{let e;try{const t=new l.a({onFailure:this.onFailure,client:this.props.client}),a=new c.a(t,void 0,this.onFailure);e=new o.a(a,this.props.client,this.onFailure),await e.generateCode(),this.setState({phase:f.ShowingQR,rendezvous:e,failureReason:void 0})}catch(e){return d.a.error("Error whilst generating QR code",e),void this.setState({phase:f.Error,failureReason:o.c.HomeserverLacksSupport})}try{const t=await e.startAfterShowingCode();this.setState({phase:f.Connected,confirmationDigits:t})}catch(e){d.a.error("Error whilst doing QR login",e),this.state.phase!==f.Error&&this.setState({phase:f.Error,failureReason:o.c.Unknown})}})),i()(this,"onFailure",(e=>{d.a.info(`Rendezvous failed: ${e}`),this.setState({phase:f.Error,failureReason:e})})),i()(this,"onClick",(async e=>{var t,a,n;switch(e){case y.Cancel:await(null===(t=this.state.rendezvous)||void 0===t?void 0:t.cancel(o.c.UserCancelled)),this.reset(),this.props.onFinished(!1);break;case y.Approve:await this.approveLogin();break;case y.Decline:await(null===(a=this.state.rendezvous)||void 0===a?void 0:a.declineLoginOnExistingDevice()),this.reset(),this.props.onFinished(!1);break;case y.TryAgain:this.reset(),await this.updateMode(this.props.mode);break;case y.Back:await(null===(n=this.state.rendezvous)||void 0===n?void 0:n.cancel(o.c.UserCancelled)),this.props.onFinished(!1)}})),this.state={phase:f.Loading}}componentDidMount(){this.updateMode(this.props.mode).then((()=>{}))}componentDidUpdate(e){e.mode!==this.props.mode&&this.updateMode(this.props.mode).then((()=>{}))}async updateMode(e){if(this.setState({phase:f.Loading}),this.state.rendezvous){const e=this.state.rendezvous;e.onFailure=void 0,await e.cancel(o.c.UserCancelled),this.setState({rendezvous:void 0})}e===b.Show&&await this.generateCode()}componentWillUnmount(){this.state.rendezvous&&(this.state.rendezvous.onFailure=void 0,this.state.rendezvous.cancel(o.c.UserCancelled).then((()=>{})))}reset(){this.setState({rendezvous:void 0,confirmationDigits:void 0,failureReason:void 0})}render(){var e;return r.a.createElement(v.a,{onClick:this.onClick,phase:this.state.phase,code:this.state.phase===f.ShowingQR?null===(e=this.state.rendezvous)||void 0===e?void 0:e.code:void 0,confirmationDigits:this.state.phase===f.Connected?this.state.confirmationDigits:void 0,failureReason:this.state.phase===f.Error?this.state.failureReason:void 0})}}},656:function(e,t,a){"use strict";var n=a(120),i=a.n(n),s=a(239),r=a(874),o=a(13),l=a.n(o),c=a(175),d=a(416),m=a(509),u=a(1),h=a(122),p=a(446);class g extends i.a.PureComponent{render(){return i.a.createElement(p.a,{data:[{data:this.props.qrCodeData.getBuffer(),mode:"byte"}],className:"mx_VerificationQRCode",width:196})}}var v=a(121),b=a(131),f=a(268),y=a(134),E=a(123),_=a(875);class S extends i.a.PureComponent{constructor(e){super(e),l()(this,"hasVerifier",void 0),l()(this,"onReciprocateYesClick",(()=>{this.setState({reciprocateButtonClicked:!0}),this.state.reciprocateQREvent.confirm()})),l()(this,"onReciprocateNoClick",(()=>{this.setState({reciprocateButtonClicked:!0}),this.state.reciprocateQREvent.cancel()})),l()(this,"startSAS",(async()=>{this.setState({emojiButtonClicked:!0});const e=this.props.request.beginKeyVerification(c.e.SAS);try{await e.verify()}catch(e){u.a.error(e)}})),l()(this,"onSasMatchesClick",(()=>{this.state.sasEvent.confirm()})),l()(this,"onSasMismatchesClick",(()=>{this.state.sasEvent.mismatch()})),l()(this,"updateVerifierState",(()=>{const{request:e}=this.props,t=e.verifier.sasEvent,a=e.verifier.reciprocateQREvent;e.verifier.off(m.b.ShowSas,this.updateVerifierState),e.verifier.off(d.b.ShowReciprocateQr,this.updateVerifierState),this.setState({sasEvent:t,reciprocateQREvent:a})})),l()(this,"onRequestChange",(async()=>{const{request:e}=this.props,t=this.hasVerifier;if(this.hasVerifier=!!e.verifier,!t&&this.hasVerifier){e.verifier.on(m.b.ShowSas,this.updateVerifierState),e.verifier.on(d.b.ShowReciprocateQr,this.updateVerifierState);try{await e.verifier.verify()}catch(e){u.a.error("error verify",e)}}})),this.state={},this.hasVerifier=!1}renderQRPhase(){const{member:e,request:t}=this.props,a=t.otherPartySupportsMethod(c.e.SAS),n=t.otherPartySupportsMethod(d.d),s=b.b.get().brand,r=a||n?null:i.a.createElement("p",null,Object(v.a)("The device you are trying to verify doesn't support scanning a QR code or emoji verification, which is what %(brand)s supports. Try with a different client.",{brand:s}));if("dialog"===this.props.layout){let e,s;n&&(e=i.a.createElement("div",{className:"mx_VerificationPanel_QRPhase_startOption"},i.a.createElement("p",null,Object(v.a)("Scan this unique code")),i.a.createElement(g,{qrCodeData:t.qrCodeData}))),a&&(s=i.a.createElement("div",{className:"mx_VerificationPanel_QRPhase_startOption"},i.a.createElement("p",null,Object(v.a)("Compare unique emoji")),i.a.createElement("span",{className:"mx_VerificationPanel_QRPhase_helpText"},Object(v.a)("Compare a unique set of emoji if you don't have a camera on either device")),i.a.createElement(E.a,{disabled:this.state.emojiButtonClicked,onClick:this.startSAS,kind:"primary"},Object(v.a)("Start"))));const o=e&&s?i.a.createElement("div",{className:"mx_VerificationPanel_QRPhase_betweenText"},Object(v.a)("%(qrCode)s or %(emojiCompare)s",{emojiCompare:"",qrCode:""})):null;return i.a.createElement("div",null,Object(v.a)("Verify this device by completing one of the following:"),i.a.createElement("div",{className:"mx_VerificationPanel_QRPhase_startOptions"},e,o,s,r))}let o,l;if(n&&(o=i.a.createElement("div",{className:"mx_UserInfo_container"},i.a.createElement("h3",null,Object(v.a)("Verify by scanning")),i.a.createElement("p",null,Object(v.a)("Ask %(displayName)s to scan your code:",{displayName:e.displayName||e.name||e.userId})),i.a.createElement("div",{className:"mx_VerificationPanel_qrCode"},i.a.createElement(g,{qrCodeData:t.qrCodeData})))),a){const e=this.state.emojiButtonClicked,t=n?Object(v.a)("If you can't scan the code above, verify by comparing unique emoji."):Object(v.a)("Verify by comparing unique emoji.");l=i.a.createElement("div",{className:"mx_UserInfo_container"},i.a.createElement("h3",null,Object(v.a)("Verify by emoji")),i.a.createElement("p",null,t),i.a.createElement(E.a,{disabled:e,kind:"primary",className:"mx_UserInfo_wideButton mx_VerificationPanel_verifyByEmojiButton",onClick:this.startSAS},Object(v.a)("Verify by emoji")))}const m=r?i.a.createElement("div",{className:"mx_UserInfo_container"},r):null;return i.a.createElement(i.a.Fragment,null,o,l,m)}getDevice(){const e=this.props.request&&this.props.request.channel.deviceId;return h.a.get().getStoredDevice(h.a.get().getUserId(),e)}renderQRReciprocatePhase(){const{member:e,request:t}=this.props,a=t.isSelfVerification?Object(v.a)("Almost there! Is your other device showing the same shield?"):Object(v.a)("Almost there! Is %(displayName)s showing the same shield?",{displayName:e.displayName||e.name||e.userId});let n;return n=this.state.reciprocateQREvent?i.a.createElement(i.a.Fragment,null,i.a.createElement("p",null,a),i.a.createElement(f.b,{isUser:!0,status:f.a.Verified,size:128,hideTooltip:!0}),i.a.createElement("div",{className:"mx_VerificationPanel_reciprocateButtons"},i.a.createElement(E.a,{kind:"danger",disabled:this.state.reciprocateButtonClicked,onClick:this.onReciprocateNoClick},Object(v.a)("No")),i.a.createElement(E.a,{kind:"primary",disabled:this.state.reciprocateButtonClicked,onClick:this.onReciprocateYesClick},Object(v.a)("Yes")))):i.a.createElement("p",null,i.a.createElement(y.a,null)),i.a.createElement("div",{className:"mx_UserInfo_container mx_VerificationPanel_reciprocate_section"},i.a.createElement("h3",null,Object(v.a)("Verify by scanning")),n)}renderVerifiedPhase(){const{member:e,request:t}=this.props;let a,n;if(t.isSelfVerification||(a=this.props.isRoomEncrypted?Object(v.a)("Verify all users in a room to ensure it's secure."):Object(v.a)("In encrypted rooms, verify all users to ensure it's secure.")),t.isSelfVerification){const e=this.getDevice();e?n=Object(v.a)("You've successfully verified %(deviceName)s (%(deviceId)s)!",{deviceName:e?e.getDisplayName():"",deviceId:this.props.request.channel.deviceId}):(u.a.warn("Verified device we don't know about: "+this.props.request.channel.deviceId),n=Object(v.a)("You've successfully verified your device!"))}else n=Object(v.a)("You've successfully verified %(displayName)s!",{displayName:e.displayName||e.name||e.userId});return i.a.createElement("div",{className:"mx_UserInfo_container mx_VerificationPanel_verified_section"},i.a.createElement("p",null,n),i.a.createElement(f.b,{isUser:!0,status:f.a.Verified,size:128,hideTooltip:!0}),a?i.a.createElement("p",null,a):null,i.a.createElement(E.a,{kind:"primary",className:"mx_UserInfo_wideButton",onClick:this.props.onClose},Object(v.a)("Got it")))}renderCancelledPhase(){const{member:e,request:t}=this.props;let a,n;return a=t.isSelfVerification?Object(v.a)("Start verification again from the notification."):Object(v.a)("Start verification again from their profile."),"m.timeout"===t.cancellationCode?n=Object(v.a)("Verification timed out.")+` ${a}`:t.cancellingUserId===t.otherUserId?(n=t.isSelfVerification?Object(v.a)("You cancelled verification on your other device."):Object(v.a)("%(displayName)s cancelled verification.",{displayName:e.displayName||e.name||e.userId}),n=`${n} ${a}`):n=Object(v.a)("You cancelled verification.")+` ${a}`,i.a.createElement("div",{className:"mx_UserInfo_container"},i.a.createElement("h3",null,Object(v.a)("Verification cancelled")),i.a.createElement("p",null,n),i.a.createElement(E.a,{kind:"primary",className:"mx_UserInfo_wideButton",onClick:this.props.onClose},Object(v.a)("Got it")))}render(){const{member:e,phase:t,request:a}=this.props,n=e.displayName||e.name||e.userId;switch(t){case s.g.Ready:return this.renderQRPhase();case s.g.Started:switch(a.chosenMethod){case c.e.RECIPROCATE_QR_CODE:return this.renderQRReciprocatePhase();case c.e.SAS:{const e=this.state.sasEvent?i.a.createElement(_.a,{displayName:n,device:this.getDevice(),sas:this.state.sasEvent.sas,onCancel:this.onSasMismatchesClick,onDone:this.onSasMatchesClick,inDialog:this.props.inDialog,isSelf:a.isSelfVerification}):i.a.createElement(y.a,null);return i.a.createElement("div",{className:"mx_UserInfo_container"},e)}default:return null}case s.g.Done:return this.renderVerifiedPhase();case s.g.Cancelled:return this.renderCancelledPhase()}return u.a.error("VerificationPanel unhandled phase:",t),null}componentDidMount(){const{request:e}=this.props;if(e.on(s.l.Change,this.onRequestChange),e.verifier){const t=e.verifier.sasEvent,a=e.verifier.reciprocateQREvent;this.setState({sasEvent:t,reciprocateQREvent:a})}this.onRequestChange()}componentWillUnmount(){const{request:e}=this.props;e.verifier&&(e.verifier.off(m.b.ShowSas,this.updateVerifierState),e.verifier.off(d.b.ShowReciprocateQr,this.updateVerifierState)),e.off(s.l.Change,this.onRequestChange)}}var w=a(218),O=a(140),C=a(127),x=a(181),k=a(174),j=a(144);const R=["m.key_mismatch","m.user_error","m.mismatched_sas"];t.a=e=>{const{verificationRequest:t,verificationRequestPromise:o,member:l,onClose:c,layout:d,isRoomEncrypted:m}=e,[u,p]=Object(n.useState)(t),[g,b]=Object(n.useState)(!1),[f,y]=Object(n.useState)(null==u?void 0:u.phase);Object(n.useEffect)((()=>{p(t),t&&(b(!1),y(t.phase))}),[t]),Object(n.useEffect)((()=>{o&&async function(){b(!0);const e=await o;b(!1),p(e),y(e.phase)}()}),[o]);const E=Object(n.useCallback)((()=>{u&&u.cancelled&&R.includes(u.cancellationCode)?C.b.createDialog(j.a,{headerImage:a(877).default,title:Object(v.a)("Your messages are not secure"),description:i.a.createElement("div",null,Object(v.a)("One of the following may be compromised:"),i.a.createElement("ul",null,i.a.createElement("li",null,Object(v.a)("Your homeserver")),i.a.createElement("li",null,Object(v.a)("The homeserver the user you're verifying is connected to")),i.a.createElement("li",null,Object(v.a)("Yours, or the other users' internet connection")),i.a.createElement("li",null,Object(v.a)("Yours, or the other users' session")))),onFinished:c}):u&&y(u.phase)}),[c,u]);Object(O.c)(u,s.l.Change,E);const _=Object(n.useCallback)((async()=>{b(!0);const e=h.a.get();let t;try{const a=await Object(w.c)(e,l.userId);t=await e.requestVerificationDM(l.userId,a)}catch(e){return console.error("Error starting verification",e),b(!1),void C.b.createDialog(j.a,{headerImage:a(626).default,title:Object(v.a)("Error starting verification"),description:Object(v.a)("We were unable to start a chat with the other user.")})}p(t),y(t.phase),k.a.instance.currentCard.phase!=x.a.EncryptionPanel&&k.a.instance.pushCard({phase:x.a.EncryptionPanel,state:{member:l,verificationRequest:t}}),k.a.instance.isOpen||k.a.instance.togglePanel(null)}),[l]),I=!u&&g||u&&(f===s.d||f===s.f||void 0===f),T=u?u.isSelfVerification:l.userId===h.a.get().getUserId();if(!u||I){const e=!u&&g||u&&u.initiatedByMe;return i.a.createElement(r.b,{isRoomEncrypted:m,onStartVerification:_,member:l,isSelfVerification:T,waitingForOtherParty:I&&e,waitingForNetwork:I&&!e,inDialog:"dialog"===d})}return i.a.createElement(S,{isRoomEncrypted:m,layout:d,onClose:c,member:l,request:u,key:u.channel.transactionId,inDialog:"dialog"===d,phase:f})}},661:function(e,t,a){"use strict";a.d(t,"a",(function(){return g}));var n=a(13),i=a.n(n),s=a(132),r=a.n(s),o=a(120),l=a.n(o),c=a(178),d=a(121),m=a(165);const u=["room","component"];function h(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function p(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?h(Object(a),!0).forEach((function(t){i()(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):h(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}function g(e){let{room:t,component:a}=e,n=r()(e,u);const i=function(e){const t=m.a.shared().getUserIdForRoomId(e.roomId),a=e.getMembers().length>2;if(!e.isSpaceRoom()&&t&&!a)return{details:t};const[n,i,...s]=c.a.instance.getKnownParents(e.roomId);if(i&&(null==s||!s.length)){var r,o;const t=null===(r=e.client.getRoom(n))||void 0===r?void 0:r.name,a=null===(o=e.client.getRoom(i))||void 0===o?void 0:o.name;return{details:Object(d.a)("%(space1Name)s and %(space2Name)s",{space1Name:t,space2Name:a}),ariaLabel:Object(d.a)("In spaces %(space1Name)s and %(space2Name)s.",{space1Name:t,space2Name:a})}}if(n){var l;const t=null===(l=e.client.getRoom(n))||void 0===l?void 0:l.name,a=s.length;return{details:Object(d.a)("%(spaceName)s and %(count)s others",{spaceName:t,count:a}),ariaLabel:Object(d.a)("In %(spaceName)s and %(count)s other spaces.",{spaceName:t,count:a})}}return{details:e.getCanonicalAlias()}}(t);return i?l.a.createElement(null!=a?a:"div",p(p({},n),{},{"aria-label":i.ariaLabel}),[i.details]):null}},662:function(e,t,a){"use strict";a.d(t,"a",(function(){return N})),a.d(t,"b",(function(){return D}));var n=a(13),i=a.n(n),s=a(120),r=a.n(s),o=a(1),l=a(136),c=a(325),d=a(913),m=a(127),u=a(121),h=a(131),p=a(891),g=a(200),v=a(476),b=a(343),f=a(139),y=a(135),E=a(145);var _=e=>{let{onFinished:t}=e;const[a,n]=Object(s.useState)(""),i=Object(s.useRef)(),r=async e=>{if(e.preventDefault(),a){if(!await i.current.validate({}))return i.current.focus(),void i.current.validate({focused:!0})}t(!0,a)};return s.createElement(y.a,{title:Object(u.a)("Continuing without email"),className:"mx_RegistrationEmailPromptDialog",contentId:"mx_RegistrationEmailPromptDialog",onFinished:()=>t(!1),fixedWidth:!1},s.createElement("div",{className:"mx_Dialog_content",id:"mx_RegistrationEmailPromptDialog"},s.createElement("p",null,Object(u.a)("Just a heads up, if you don't add an email and forget your password, you could <b>permanently lose access to your account</b>.",{},{b:e=>s.createElement("b",null,e)})),s.createElement("form",{onSubmit:r},s.createElement(v.a,{fieldRef:i,autoFocus:!0,label:Object(u.c)("Email (optional)"),value:a,onChange:e=>{const t=e.target;n(t.value)}}))),s.createElement(E.a,{primaryButton:Object(u.a)("Continue"),onPrimaryButtonClick:r,hasCancel:!1}))},S=a(641),w=a(914),O=a(189);let C,x,k,j,R;var I,T;!function(e){e.Email="field_email",e.PhoneNumber="field_phone_number",e.Username="field_username",e.Password="field_password",e.PasswordConfirm="field_password_confirm"}(I||(I={})),function(e){e[e.Unknown=0]="Unknown",e[e.Available=1]="Available",e[e.Unavailable=2]="Unavailable",e[e.Error=3]="Error",e[e.Invalid=4]="Invalid"}(T||(T={}));const N=3;C=I.Email,x=I.Password,k=I.PasswordConfirm,j=I.Username,R=I.PhoneNumber;class D extends r.a.PureComponent{constructor(e){super(e),i()(this,C,void 0),i()(this,x,void 0),i()(this,k,void 0),i()(this,j,void 0),i()(this,R,void 0),i()(this,"onSubmit",(async e=>{if(e.preventDefault(),e.persist(),!this.props.canSubmit)return;if(await this.verifyFieldsBeforeSubmit())if(""===this.state.email){if(!this.showEmail())return void this.doSubmit(e);m.b.createDialog(_,{onFinished:async(t,a)=>{t&&this.setState({email:a},(()=>{this.doSubmit(e)}))}})}else this.doSubmit(e)})),i()(this,"onEmailChange",(e=>{this.setState({email:e.target.value.trim()})})),i()(this,"onEmailValidate",(e=>{this.markFieldValid(I.Email,e.valid)})),i()(this,"validateEmailRules",Object(g.a)({description:()=>Object(u.a)("Use an email address to recover your account"),hideDescriptionIfValid:!0,rules:[{key:"required",test(e){let{value:t,allowEmpty:a}=e;return a||!this.authStepIsRequired("m.login.email.identity")||!!t},invalid:()=>Object(u.a)("Enter email address (required on this homeserver)")},{key:"email",test:e=>{let{value:t}=e;return!t||c.a(t)},invalid:()=>Object(u.a)("Doesn't look like a valid email address")}]})),i()(this,"onPasswordChange",(e=>{this.setState({password:e.target.value})})),i()(this,"onPasswordValidate",(e=>{this.markFieldValid(I.Password,e.valid)})),i()(this,"onPasswordConfirmChange",(e=>{this.setState({passwordConfirm:e.target.value})})),i()(this,"onPasswordConfirmValidate",(e=>{this.markFieldValid(I.PasswordConfirm,e.valid)})),i()(this,"onPhoneCountryChange",(e=>{this.setState({phoneCountry:e.iso2})})),i()(this,"onPhoneNumberChange",(e=>{this.setState({phoneNumber:e.target.value})})),i()(this,"onPhoneNumberValidate",(async e=>{const t=await this.validatePhoneNumberRules(e);return this.markFieldValid(I.PhoneNumber,t.valid),t})),i()(this,"validatePhoneNumberRules",Object(g.a)({description:()=>Object(u.a)("Other users can invite you to rooms using your contact details"),hideDescriptionIfValid:!0,rules:[{key:"required",test(e){let{value:t,allowEmpty:a}=e;return a||!this.authStepIsRequired("m.login.msisdn")||!!t},invalid:()=>Object(u.a)("Enter phone number (required on this homeserver)")},{key:"email",test:e=>{let{value:t}=e;return!t||Object(d.c)(t)},invalid:()=>Object(u.a)("That phone number doesn't look quite right, please check and try again")}]})),i()(this,"onUsernameChange",(e=>{this.setState({username:e.target.value})})),i()(this,"onUsernameValidate",(async e=>{const t=await this.validateUsernameRules(e);return this.markFieldValid(I.Username,t.valid),t})),i()(this,"validateUsernameRules",Object(g.a)({description:(e,t)=>{if(!t.every((e=>{let{key:t,valid:a}=e;return"available"===t||a})))return Object(u.a)("Use lowercase letters, numbers, dashes and underscores only")},hideDescriptionIfValid:!0,async deriveData(e){let{value:t}=e;if(!t)return T.Unknown;try{return await this.props.matrixClient.isUsernameAvailable(t)?T.Available:T.Unavailable}catch(e){return e instanceof l.MatrixError&&"M_INVALID_USERNAME"===e.errcode?T.Invalid:T.Error}},rules:[{key:"required",test:e=>{let{value:t,allowEmpty:a}=e;return a||!!t},invalid:()=>Object(u.a)("Enter username")},{key:"safeLocalpart",test:(e,t)=>{let{value:a}=e;return(!a||p.a.test(a))&&t!==T.Invalid},invalid:()=>Object(u.a)("Some characters not allowed")},{key:"available",final:!0,test:async(e,t)=>{let{value:a}=e;return!a||t===T.Available},invalid:e=>e===T.Error?Object(u.a)("Unable to check if username has been taken. Try again later."):Object(u.a)("Someone already has that username. Try another or if it is you, sign in below.")}]})),this.state={fieldValid:{},phoneCountry:this.props.defaultPhoneCountry,username:this.props.defaultUsername||"",email:this.props.defaultEmail||"",phoneNumber:this.props.defaultPhoneNumber||"",password:this.props.defaultPassword||"",passwordConfirm:this.props.defaultPassword||"",passwordComplexity:null}}doSubmit(e){O.a.instance.setAuthenticationType("Password");const t=this.state.email.trim(),a=this.props.onRegisterClick({username:this.state.username.trim(),password:this.state.password.trim(),email:t,phoneCountry:this.state.phoneCountry,phoneNumber:this.state.phoneNumber});a&&(e.target.disabled=!0,a.finally((function(){e.target.disabled=!1})))}async verifyFieldsBeforeSubmit(){const e=document.activeElement;e&&e.blur();const t=[I.Username,I.Password,I.PasswordConfirm,I.Email,I.PhoneNumber];for(const e of t){const t=this[e];t&&await t.validate({allowEmpty:!1})}if(await new Promise((e=>this.setState({},e))),this.allFieldsValid())return!0;const a=this.findFirstInvalidField(t);return!a||(a.focus(),a.validate({allowEmpty:!1,focused:!0}),!1)}allFieldsValid(){return Object.values(this.state.fieldValid).every(Boolean)}findFirstInvalidField(e){for(const t of e)if(!this.state.fieldValid[t]&&this[t])return this[t];return null}markFieldValid(e,t){const{fieldValid:a}=this.state;a[e]=t,this.setState({fieldValid:a})}authStepIsRequired(e){return this.props.flows.every((t=>t.stages.includes(e)))}authStepIsUsed(e){return this.props.flows.some((t=>t.stages.includes(e)))}showEmail(){return!!this.authStepIsUsed("m.login.email.identity")}showPhoneNumber(){return!(h.b.get().disable_3pid_login||!this.authStepIsUsed("m.login.msisdn"))}renderEmail(){if(!this.showEmail())return null;const e=this.authStepIsRequired("m.login.email.identity")?Object(u.c)("Email"):Object(u.c)("Email (optional)");return r.a.createElement(v.a,{fieldRef:e=>this[I.Email]=e,label:e,value:this.state.email,validationRules:this.validateEmailRules.bind(this),onChange:this.onEmailChange,onValidate:this.onEmailValidate})}renderPassword(){return r.a.createElement(b.a,{id:"mx_RegistrationForm_password",fieldRef:e=>this[I.Password]=e,minScore:N,value:this.state.password,onChange:this.onPasswordChange,onValidate:this.onPasswordValidate})}renderPasswordConfirm(){return r.a.createElement(w.a,{id:"mx_RegistrationForm_passwordConfirm",fieldRef:e=>this[I.PasswordConfirm]=e,autoComplete:"new-password",value:this.state.passwordConfirm,password:this.state.password,onChange:this.onPasswordConfirmChange,onValidate:this.onPasswordConfirmValidate})}renderPhoneNumber(){if(!this.showPhoneNumber())return null;const e=this.authStepIsRequired("m.login.msisdn")?Object(u.a)("Phone"):Object(u.a)("Phone (optional)"),t=r.a.createElement(S.a,{value:this.state.phoneCountry,isSmall:!0,showPrefix:!0,onOptionChange:this.onPhoneCountryChange});return r.a.createElement(f.a,{ref:e=>this[I.PhoneNumber]=e,type:"text",label:e,value:this.state.phoneNumber,prefixComponent:t,onChange:this.onPhoneNumberChange,onValidate:this.onPhoneNumberValidate})}renderUsername(){return r.a.createElement(f.a,{id:"mx_RegistrationForm_username",ref:e=>this[I.Username]=e,type:"text",autoFocus:!0,label:Object(u.a)("Username"),placeholder:Object(u.a)("Username").toLocaleLowerCase(),value:this.state.username,onChange:this.onUsernameChange,onValidate:this.onUsernameValidate})}render(){const e=r.a.createElement("input",{className:"mx_Login_submit",type:"submit",value:Object(u.a)("Register"),disabled:!this.props.canSubmit});let t=null;return this.showEmail()&&(t=this.showPhoneNumber()?r.a.createElement("div",null,Object(u.a)("Add an email to be able to reset your password.")," ",Object(u.a)("Use email or phone to optionally be discoverable by existing contacts.")):r.a.createElement("div",null,Object(u.a)("Add an email to be able to reset your password.")," ",Object(u.a)("Use email to optionally be discoverable by existing contacts."))),r.a.createElement("div",null,r.a.createElement("form",{onSubmit:this.onSubmit},r.a.createElement("div",{className:"mx_AuthBody_fieldRow"},this.renderUsername()),r.a.createElement("div",{className:"mx_AuthBody_fieldRow"},this.renderPassword(),this.renderPasswordConfirm()),r.a.createElement("div",{className:"mx_AuthBody_fieldRow"},this.renderEmail(),this.renderPhoneNumber()),t,e))}}i()(D,"defaultProps",{onValidationChange:o.a.error,canSubmit:!0})},873:function(e,t,a){"use strict";a.d(t,"a",(function(){return v}));var n=a(13),i=a.n(n),s=a(120),r=a.n(s),o=a(1),l=a(121),c=a(122),d=a(127),m=a(469),u=a(470),h=a(656),p=a(123),g=a(134);class v extends r.a.Component{constructor(e){super(e),i()(this,"onStoreUpdate",(()=>{const e=u.b.sharedInstance();e.phase!==u.a.Finished?this.setState({phase:e.phase,verificationRequest:e.verificationRequest,backupInfo:e.backupInfo,lostKeys:e.lostKeys()}):this.props.onFinished()})),i()(this,"onUsePassphraseClick",(async()=>{u.b.sharedInstance().usePassPhrase()})),i()(this,"onVerifyClick",(()=>{const e=c.a.get(),t=e.getUserId(),a=e.requestVerification(t);this.props.onFinished(),d.b.createDialog(m.a,{verificationRequestPromise:a,member:e.getUser(t),onFinished:async()=>{(await a).cancel(),this.props.onFinished()}})})),i()(this,"onSkipConfirmClick",(()=>{u.b.sharedInstance().skipConfirm()})),i()(this,"onSkipBackClick",(()=>{u.b.sharedInstance().returnAfterSkip()})),i()(this,"onResetClick",(e=>{e.preventDefault();u.b.sharedInstance().reset()})),i()(this,"onResetConfirmClick",(()=>{this.props.onFinished();u.b.sharedInstance().resetConfirm()})),i()(this,"onResetBackClick",(()=>{u.b.sharedInstance().returnAfterReset()})),i()(this,"onDoneClick",(()=>{u.b.sharedInstance().done()})),i()(this,"onEncryptionPanelClose",(()=>{this.props.onFinished()}));const t=u.b.sharedInstance();t.on("update",this.onStoreUpdate),t.start(),this.state={phase:t.phase,verificationRequest:t.verificationRequest,backupInfo:t.backupInfo,lostKeys:t.lostKeys()}}componentWillUnmount(){const e=u.b.sharedInstance();e.off("update",this.onStoreUpdate),e.stop()}render(){const{phase:e,lostKeys:t}=this.state;if(this.state.verificationRequest)return r.a.createElement(h.a,{layout:"dialog",verificationRequest:this.state.verificationRequest,onClose:this.onEncryptionPanelClose,member:c.a.get().getUser(this.state.verificationRequest.otherUserId),isRoomEncrypted:!1});if(e===u.a.Intro){if(t)return r.a.createElement("div",null,r.a.createElement("p",null,Object(l.a)("It looks like you don't have a Security Key or any other devices you can verify against. This device will not be able to access old encrypted messages. In order to verify your identity on this device, you'll need to reset your verification keys.")),r.a.createElement("div",{className:"mx_CompleteSecurity_actionRow"},r.a.createElement(p.a,{kind:"primary",onClick:this.onResetConfirmClick},Object(l.a)("Proceed with reset"))));{const e=u.b.sharedInstance();let t,n,i;return e.keyInfo&&(a=e.keyInfo,Boolean(a.passphrase&&a.passphrase.salt&&a.passphrase.iterations))?t=Object(l.a)("Verify with Security Key or Phrase"):e.keyInfo&&(t=Object(l.a)("Verify with Security Key")),t&&(n=r.a.createElement(p.a,{kind:"primary",onClick:this.onUsePassphraseClick},t)),e.hasDevicesToVerifyAgainst&&(i=r.a.createElement(p.a,{kind:"primary",onClick:this.onVerifyClick},Object(l.a)("Verify with another device"))),r.a.createElement("div",null,r.a.createElement("p",null,Object(l.a)("Verify your identity to access encrypted messages and prove your identity to others.")),r.a.createElement("div",{className:"mx_CompleteSecurity_actionRow"},i,n),r.a.createElement("div",{className:"mx_SetupEncryptionBody_reset"},Object(l.a)("Forgotten or lost all recovery methods? <a>Reset all</a>",null,{a:e=>r.a.createElement(p.a,{kind:"link_inline",className:"mx_SetupEncryptionBody_reset_link",onClick:this.onResetClick},e)})))}}if(e===u.a.Done){let e;return e=this.state.backupInfo?r.a.createElement("p",null,Object(l.a)("Your new device is now verified. It has access to your encrypted messages, and other users will see it as trusted.")):r.a.createElement("p",null,Object(l.a)("Your new device is now verified. Other users will see it as trusted.")),r.a.createElement("div",null,r.a.createElement("div",{className:"mx_CompleteSecurity_heroIcon mx_E2EIcon_verified"}),e,r.a.createElement("div",{className:"mx_CompleteSecurity_actionRow"},r.a.createElement(p.a,{kind:"primary",onClick:this.onDoneClick},Object(l.a)("Done"))))}return e===u.a.ConfirmSkip?r.a.createElement("div",null,r.a.createElement("p",null,Object(l.a)("Without verifying, you won't have access to all your messages and may appear as untrusted to others.")),r.a.createElement("div",{className:"mx_CompleteSecurity_actionRow"},r.a.createElement(p.a,{kind:"danger_outline",onClick:this.onSkipConfirmClick},Object(l.a)("I'll verify later")),r.a.createElement(p.a,{kind:"primary",onClick:this.onSkipBackClick},Object(l.a)("Go Back")))):e===u.a.ConfirmReset?r.a.createElement("div",null,r.a.createElement("p",null,Object(l.a)("Resetting your verification keys cannot be undone. After resetting, you won't have access to old encrypted messages, and any friends who have previously verified you will see security warnings until you re-verify with them.")),r.a.createElement("p",null,Object(l.a)("Please only proceed if you're sure you've lost all of your other devices and your Security Key.")),r.a.createElement("div",{className:"mx_CompleteSecurity_actionRow"},r.a.createElement(p.a,{kind:"danger_outline",onClick:this.onResetConfirmClick},Object(l.a)("Proceed with reset")),r.a.createElement(p.a,{kind:"primary",onClick:this.onResetBackClick},Object(l.a)("Go Back")))):e===u.a.Busy||e===u.a.Loading?r.a.createElement(g.a,null):void o.a.log(`SetupEncryptionBody: Unknown phase ${e}`);var a}}},874:function(e,t,a){"use strict";a.d(t,"a",(function(){return l}));var n=a(120),i=a.n(n),s=a(121),r=a(123),o=a(134);const l=e=>{let{text:t}=e;return i.a.createElement("div",{className:"mx_EncryptionInfo_spinner"},i.a.createElement(o.a,null),t)};t.b=e=>{let t,a,{waitingForOtherParty:n,waitingForNetwork:o,member:c,onStartVerification:d,isRoomEncrypted:m,inDialog:u,isSelfVerification:h}=e;if(n&&h)t=i.a.createElement("div",null,Object(s.a)("To proceed, please accept the verification request on your other device."));else if(n||o){let e;e=n?Object(s.a)("Waiting for %(displayName)s to accept…",{displayName:c.displayName||c.name||c.userId}):Object(s.a)("Accepting…"),t=i.a.createElement(l,{text:e})}else t=i.a.createElement(r.a,{kind:"primary",className:"mx_UserInfo_wideButton mx_UserInfo_startVerification",onClick:d},Object(s.a)("Start Verification"));return a=m?i.a.createElement("div",null,i.a.createElement("p",null,Object(s.a)("Messages in this room are end-to-end encrypted.")),i.a.createElement("p",null,Object(s.a)("Your messages are secured and only you and the recipient have the unique keys to unlock them."))):i.a.createElement("div",null,i.a.createElement("p",null,Object(s.a)("Messages in this room are not end-to-end encrypted.")),i.a.createElement("p",null,Object(s.a)("In encrypted rooms, your messages are secured and only you and the recipient have the unique keys to unlock them."))),u?t:i.a.createElement(i.a.Fragment,null,i.a.createElement("div",{"data-test-id":"encryption-info-description",className:"mx_UserInfo_container"},i.a.createElement("h3",null,Object(s.a)("Encryption")),a),i.a.createElement("div",{className:"mx_UserInfo_container"},i.a.createElement("h3",null,Object(s.a)("Verify User")),i.a.createElement("div",null,i.a.createElement("p",null,Object(s.a)("For extra security, verify this user by checking a one-time code on both of your devices.")),i.a.createElement("p",null,Object(s.a)("To be secure, do this in person or use a trusted way to communicate.")),t)))}},875:function(e,t,a){"use strict";a.d(t,"a",(function(){return m}));var n=a(13),i=a.n(n),s=a(120),r=a.n(s),o=a(121),l=a(874),c=a(123),d=a(876);class m extends r.a.Component{constructor(e){super(e),i()(this,"onMatchClick",(()=>{this.setState({pending:!0}),this.props.onDone()})),i()(this,"onDontMatchClick",(()=>{this.setState({cancelling:!0}),this.props.onCancel()})),this.state={pending:!1}}componentWillMount(){Object(d.a)()}render(){let e,t,a;if(this.props.sas.emoji){const a=this.props.sas.emoji.map(((e,t)=>{return r.a.createElement("div",{className:"mx_VerificationShowSas_emojiSas_block",key:t},r.a.createElement("div",{className:"mx_VerificationShowSas_emojiSas_emoji"},e[0]),r.a.createElement("div",{className:"mx_VerificationShowSas_emojiSas_label"},Object(o.a)((a=e[1]).charAt(0).toUpperCase()+a.slice(1))));var a}));e=r.a.createElement("div",{className:"mx_VerificationShowSas_emojiSas"},a.slice(0,4),r.a.createElement("div",{className:"mx_VerificationShowSas_emojiSas_break"}),a.slice(4)),t=this.props.isSelf?Object(o.a)("Confirm the emoji below are displayed on both devices, in the same order:"):Object(o.a)("Verify this user by confirming the following emoji appear on their screen.")}else{if(!this.props.sas.decimal)return r.a.createElement("div",null,Object(o.a)("Unable to find a supported verification method."),r.a.createElement(c.a,{kind:"primary",onClick:this.props.onCancel},Object(o.a)("Cancel")));{const a=this.props.sas.decimal.map(((e,t)=>r.a.createElement("span",{key:t},e)));e=r.a.createElement("div",{className:"mx_VerificationShowSas_decimalSas"},a),t=this.props.isSelf?Object(o.a)("Verify this device by confirming the following number appears on its screen."):Object(o.a)("Verify this user by confirming the following number appears on their screen.")}}if(this.state.pending&&this.props.isSelf){let e;e=this.props.device?Object(o.a)("Waiting for you to verify on your other device, %(deviceName)s (%(deviceId)s)…",{deviceName:this.props.device?this.props.device.getDisplayName():"",deviceId:this.props.device?this.props.device.deviceId:""}):Object(o.a)("Waiting for you to verify on your other device…"),a=r.a.createElement("p",null,e)}else if(this.state.pending||this.state.cancelling){let e;if(this.state.pending){const{displayName:t}=this.props;e=Object(o.a)("Waiting for %(displayName)s to verify…",{displayName:t})}else e=Object(o.a)("Cancelling…");a=r.a.createElement(l.a,{text:e})}else a=r.a.createElement("div",{className:"mx_VerificationShowSas_buttonRow"},r.a.createElement(c.a,{onClick:this.onDontMatchClick,kind:"danger"},Object(o.a)("They don't match")),r.a.createElement(c.a,{onClick:this.onMatchClick,kind:"primary"},Object(o.a)("They match")));return r.a.createElement("div",{className:"mx_VerificationShowSas"},r.a.createElement("p",null,t),e,r.a.createElement("p",null,this.props.isSelf?"":Object(o.a)("To be secure, do this in person or use a trusted way to communicate.")),a)}}Object(o.c)("Dog"),Object(o.c)("Cat"),Object(o.c)("Lion"),Object(o.c)("Horse"),Object(o.c)("Unicorn"),Object(o.c)("Pig"),Object(o.c)("Elephant"),Object(o.c)("Rabbit"),Object(o.c)("Panda"),Object(o.c)("Rooster"),Object(o.c)("Penguin"),Object(o.c)("Turtle"),Object(o.c)("Fish"),Object(o.c)("Octopus"),Object(o.c)("Butterfly"),Object(o.c)("Flower"),Object(o.c)("Tree"),Object(o.c)("Cactus"),Object(o.c)("Mushroom"),Object(o.c)("Globe"),Object(o.c)("Moon"),Object(o.c)("Cloud"),Object(o.c)("Fire"),Object(o.c)("Banana"),Object(o.c)("Apple"),Object(o.c)("Strawberry"),Object(o.c)("Corn"),Object(o.c)("Pizza"),Object(o.c)("Cake"),Object(o.c)("Heart"),Object(o.c)("Smiley"),Object(o.c)("Robot"),Object(o.c)("Hat"),Object(o.c)("Glasses"),Object(o.c)("Spanner"),Object(o.c)("Santa"),Object(o.c)("Thumbs up"),Object(o.c)("Umbrella"),Object(o.c)("Hourglass"),Object(o.c)("Clock"),Object(o.c)("Gift"),Object(o.c)("Light bulb"),Object(o.c)("Book"),Object(o.c)("Pencil"),Object(o.c)("Paperclip"),Object(o.c)("Scissors"),Object(o.c)("Lock"),Object(o.c)("Key"),Object(o.c)("Hammer"),Object(o.c)("Telephone"),Object(o.c)("Flag"),Object(o.c)("Train"),Object(o.c)("Bicycle"),Object(o.c)("Aeroplane"),Object(o.c)("Rocket"),Object(o.c)("Trophy"),Object(o.c)("Ball"),Object(o.c)("Guitar"),Object(o.c)("Trumpet"),Object(o.c)("Bell"),Object(o.c)("Anchor"),Object(o.c)("Headphones"),Object(o.c)("Folder"),Object(o.c)("Pin")},876:function(e,t,a){"use strict";a.d(t,"a",(function(){return r}));var n=a(1);async function i(){n.a.log("Checking for COLR support");const{userAgent:e}=navigator;if(e.includes("Firefox"))return n.a.log("Browser is Firefox - assuming COLR is supported"),!0;if(!e.includes("Chrome")&&e.includes("Safari"))return function(e){n.a.log("Browser is Safari - checking version for COLR support");try{const t=e.match(/Mac OS X ([\d|_]+).*Version\/([\d|.]+).*Safari/);if(t){const e=t[1],a=t[2],i=e.split("_").map((e=>parseInt(e,10))),s=a.split(".").map((e=>parseInt(e,10))),r=i[0]>=10&&i[1]>=14&&s[0]>=12;return n.a.log(`COLR support on Safari requires macOS 10.14 and Safari 12, detected Safari ${a} on macOS ${e}, COLR supported: ${r}`),r}}catch(e){n.a.error("Error in Safari COLR version check",e)}return n.a.warn("Couldn't determine Safari version to check COLR font support, assuming no."),!1}(e);try{const e=document.createElement("canvas"),t=e.getContext("2d"),a=new Image,i=`\n <svg xmlns="http://www.w3.org/2000/svg" width="20" height="100" style="background:#fff;fill:#000;">\n <style type="text/css">\n @font-face {\n font-family: "chromacheck-colr";\n src: url(data:application/x-font-woff;base64,${"d09GRgABAAAAAAKAAAwAAAAAAowAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABDT0xSAAACVAAAABYAAAAYAAIAJUNQQUwAAAJsAAAAEgAAABLJAAAQT1MvMgAAAYAAAAA6AAAAYBfxJ0pjbWFwAAABxAAAACcAAAAsAAzpM2dseWYAAAH0AAAAGgAAABoNIh0kaGVhZAAAARwAAAAvAAAANgxLumdoaGVhAAABTAAAABUAAAAkCAEEAmhtdHgAAAG8AAAABgAAAAYEAAAAbG9jYQAAAewAAAAGAAAABgANAABtYXhwAAABZAAAABsAAAAgAg4AHW5hbWUAAAIQAAAAOAAAAD4C5wsecG9zdAAAAkgAAAAMAAAAIAADAAB4AWNgZGAAYQ5+qdB4fpuvDNIsDCBwaQGTAIi+VlscBaJZGMDiHAxMIAoAtjIF/QB4AWNgZGBgYQACOAkUQQWMAAGRABAAAAB4AWNgZGBgYGJgAdMMUJILJMQgAWICAAH3AC4AeAFjYGFhYJzAwMrAwDST6QwDA0M/hGZ8zWDMyMmAChgFkDgKQMBw4CXDSwYWEBdIYgAFBgYA/8sIdAAABAAAAAAAAAB4AWNgYGBkYAZiBgYeBhYGBSDNAoRA/kuG//8hpDgjWJ4BAFVMBiYAAAAAAAANAAAAAQAAAAAEAAQAAAMAABEhESEEAPwABAD8AAAAeAEtxgUNgAAAAMHHIQTShTlOAty9/4bf7AARCwlBNhBw4L/43qXjYGUmf19TMuLcj/BJL3XfBg54AWNgZsALAAB9AAR4AWNgYGAEYj4gFgGygGwICQACOwAoAAAAAAABAAEAAQAAAA4AAAAAyP8AAA=="}) format("woff");\n }\n </style>\n <text x="0" y="0" font-size="20">\n <tspan font-family="chromacheck-colr" x="0" dy="20">&#xe900;</tspan>\n </text>\n </svg>`;e.width=20,e.height=100,a.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(i),n.a.log("Waiting for COLR SVG to load"),await new Promise((e=>a.onload=e)),n.a.log("Drawing canvas to detect COLR support"),t.drawImage(a,0,0);const s=200===t.getImageData(10,10,1,1).data[0];return n.a.log("Canvas check revealed COLR is supported? "+s),s}catch(e){return n.a.error("Couldn't load COLR font",e),!1}}let s=!1;async function r(){if(!s)if(s=!0,await i()){const e=`url('${a(1453)}')`;document.fonts.add(new FontFace("Twemoji",e,{})),document.fonts.add(new FontFace("Twemoji",e,{weight:"600"})),document.fonts.add(new FontFace("Twemoji",e,{weight:"700"}))}else{const e=`url('${a(1454)}')`;document.fonts.add(new FontFace("Twemoji",e,{})),document.fonts.add(new FontFace("Twemoji",e,{weight:"600"})),document.fonts.add(new FontFace("Twemoji",e,{weight:"700"}))}}},877:function(e,t,a){"use strict";a.r(t),a.d(t,"Icon",(function(){return r}));var n,i=a(120);function s(){return s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},s.apply(this,arguments)}function r(e){return i.createElement("svg",s({fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 18 18",role:"presentation","aria-hidden":!0},e),n||(n=i.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 9.27V3.05L9 1l7 2.05v6.22C16 15.63 9 17 9 17s-7-1.37-7-7.73zM8.92 4.4c-.57.04-.99.54-.94 1.11l.32 4c.03.35.3.62.65.65h.06c.37 0 .68-.28.71-.65l.32-4v-.16a1.06 1.06 0 00-1.12-.95zm.96 7.72a.88.88 0 11-1.76 0 .88.88 0 011.76 0z",fill:"#020202"})))}t.default="img/e2e/warning-deprecated.6a3ebca.svg"},878:function(e,t,a){"use strict";a.d(t,"c",(function(){return s})),a.d(t,"b",(function(){return r})),a.d(t,"d",(function(){return o})),a.d(t,"a",(function(){return c}));const n="io.element.matrix_client_information.",i=e=>`${n}${e}`,s=async(e,t,a)=>{const n=e.getDeviceId(),{brand:s}=t,r=await a.getAppVersion(),o=i(n),l=(()=>{if(window.electron)return;const e=new URL(window.location.href);return[e.host,e.pathname.replace(/\/$/,"")].join("")})();await e.setAccountData(o,{name:s,version:r,url:l})},r=(e,t)=>{Object.values(t.store.accountData).forEach((a=>{if(!a.getType().startsWith(n))return;const[,i]=a.getType().split(n);i&&!e.includes(i)&&t.deleteAccountData(a.getType())}))},o=async e=>{const t=e.getDeviceId(),a=i(t),n=c(e,t);(n.name||n.version||n.url)&&await e.deleteAccountData(a)},l=e=>e&&"string"==typeof e?e:void 0,c=(e,t)=>{const a=e.getAccountData(i(t));if(!a)return{};const{name:n,version:s,url:r}=a.getContent();return{name:l(n),version:l(s),url:l(r)}}},879:function(e,t,a){"use strict";(function(e){a.d(t,"a",(function(){return d}));var n=a(13),i=a.n(n),s=a(17),r=a.n(s),o=a(770);function l(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}const c="mx_threepid_invite_";class d extends r.a{static get instance(){return d._instance||(d._instance=new d),d._instance}storeInvite(e,t){const a=function(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?l(Object(a),!0).forEach((function(t){i()(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):l(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}({roomId:e},t),n=this.generateIdOf(a);return localStorage.setItem(`${c}${n}`,JSON.stringify(a)),this.translateInvite(a)}getWireInvites(){const e=[];for(let t=0;t<localStorage.length;t++){const a=localStorage.key(t);a.startsWith(c)&&e.push(JSON.parse(localStorage.getItem(a)))}return e}getInvites(){return this.getWireInvites().map((e=>this.translateInvite(e)))}pickBestInvite(){return this.getInvites()[0]}resolveInvite(e){localStorage.removeItem(`${c}${e.id}`)}generateIdOf(t){return o.base32.stringify(e.from(JSON.stringify(t)))}translateInvite(e){return{id:this.generateIdOf(e),roomId:e.roomId,toEmail:e.email,signUrl:e.signurl,roomName:e.room_name,roomAvatarUrl:e.room_avatar_url,inviterName:e.inviter_name}}translateToWireFormat(e){return{email:e.toEmail,signurl:e.signUrl,room_name:e.roomName,room_avatar_url:e.roomAvatarUrl,inviter_name:e.inviterName}}}i()(d,"_instance",void 0)}).call(this,a(53).Buffer)},880:function(e,t,a){"use strict";a.d(t,"a",(function(){return l}));var n=a(120),i=a.n(n),s=a(129),r=a(881),o=a(753);function l(e){var t;let{mxEvent:a,onClick:n,withTooltip:l}=e;const c=Object(o.a)({userId:a.getSender(),member:a.sender});return a.getContent().msgtype!==s.e.Emote?i.a.createElement(r.a,{fallbackName:null!==(t=a.getSender())&&void 0!==t?t:"",onClick:n,member:c,colored:!0,emphasizeDisplayName:!0,withTooltip:l}):null}},881:function(e,t,a){"use strict";a.d(t,"a",(function(){return d}));var n=a(120),i=a.n(n),s=a(126),r=a.n(s),o=a(121),l=a(210),c=a(261);class d extends i.a.Component{render(){const{fallbackName:e,member:t,colored:a,emphasizeDisplayName:n,withTooltip:s,onClick:d}=this.props,m=(null==t?void 0:t.rawDisplayName)||e,u=null==t?void 0:t.userId;let h,p,g;if(a&&(h=Object(l.f)(e)),u){var v,b;const e=null!==(v=null===(b=c.a.getDisplayUserIdentifier)||void 0===b?void 0:b.call(c.a,u,{withDisplayName:!0,roomId:t.roomId}))&&void 0!==v?v:u;null!=t&&t.disambiguate&&(p=i.a.createElement("span",{className:"mx_DisambiguatedProfile_mxid"},e)),g=Object(o.a)("%(displayName)s (%(matrixId)s)",{displayName:m,matrixId:e})}const f=r()(h,{mx_DisambiguatedProfile_displayName:n});return i.a.createElement("div",{className:"mx_DisambiguatedProfile",title:s?g:void 0,onClick:d},i.a.createElement("span",{className:f,dir:"auto"},m),p)}}},882:function(e,t,a){"use strict";a.d(t,"a",(function(){return r}));var n,i=a(120);function s(){return s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},s.apply(this,arguments)}function r(e){return i.createElement("svg",s({fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",role:"presentation","aria-hidden":!0},e),n||(n=i.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M20 1a1 1 0 00-1 1v2h-2a1 1 0 100 2h2v2a1 1 0 102 0V6h2a1 1 0 100-2h-2V2a1 1 0 00-1-1zM7 9.5C7 8.67 7.67 8 8.5 8s1.5.67 1.5 1.5S9.33 11 8.5 11 7 10.33 7 9.5zm8.5 1.5c.83 0 1.5-.67 1.5-1.5S16.33 8 15.5 8 14 8.67 14 9.5s.67 1.5 1.5 1.5zM12 17.5c2.33 0 4.31-1.46 5.11-3.5H6.89c.8 2.04 2.78 3.5 5.11 3.5zM4 12a8 8 0 019.774-7.803 1 1 0 10.442-1.95A10.03 10.03 0 0012 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10c0-.212-.007-.423-.02-.632a1 1 0 10-1.996.125A8 8 0 114 12z",fill:"currentColor"})))}},883:function(e,t,a){"use strict";a.d(t,"a",(function(){return o}));var n,i,s=a(120);function r(){return r=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},r.apply(this,arguments)}function o(e){return s.createElement("svg",r({fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 18 18",role:"presentation","aria-hidden":!0},e),n||(n=s.createElement("path",{d:"M10.066 14.25h1.57c1.858 0 3.364-1.567 3.364-3.5s-1.506-3.5-3.364-3.5H4.534",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round"})),i||(i=s.createElement("path",{d:"M6.524 3.75L3 7.286l3.524 3.535",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})))}},884:function(e,t,a){"use strict";a.d(t,"a",(function(){return o}));var n=a(13),i=a.n(n),s=a(189);class r{constructor(e,t){this.failedEventId=e,this.errorCode=t,i()(this,"ts",void 0),this.ts=Date.now()}}class o{constructor(e,t){if(this.fn=e,this.errorCodeMapFn=t,i()(this,"failures",new Map),i()(this,"visibleEvents",new Set),i()(this,"visibleFailures",new Map),i()(this,"failureCounts",{}),i()(this,"trackedEvents",new Set),i()(this,"checkInterval",null),i()(this,"trackInterval",null),!e||"function"!=typeof e)throw new Error("DecryptionFailureTracker requires tracking function");if("function"!=typeof t)throw new Error("DecryptionFailureTracker second constructor argument should be a function")}static get instance(){return o.internalInstance}eventDecrypted(e,t){"m.megolm.v1.aes-sha2"==e.getWireContent().algorithm&&(t?this.addDecryptionFailure(new r(e.getId(),t.code)):this.removeDecryptionFailuresForEvent(e))}addVisibleEvent(e){const t=e.getId();this.trackedEvents.has(t)||(this.visibleEvents.add(t),this.failures.has(t)&&!this.visibleFailures.has(t)&&this.visibleFailures.set(t,this.failures.get(t)))}addDecryptionFailure(e){const t=e.failedEventId;this.trackedEvents.has(t)||(this.failures.set(t,e),this.visibleEvents.has(t)&&!this.visibleFailures.has(t)&&this.visibleFailures.set(t,e))}removeDecryptionFailuresForEvent(e){const t=e.getId();this.failures.delete(t),this.visibleFailures.delete(t)}start(){this.checkInterval=window.setInterval((()=>this.checkFailures(Date.now())),o.CHECK_INTERVAL_MS),this.trackInterval=window.setInterval((()=>this.trackFailures()),o.TRACK_INTERVAL_MS)}stop(){this.checkInterval&&clearInterval(this.checkInterval),this.trackInterval&&clearInterval(this.trackInterval),this.failures=new Map,this.visibleEvents=new Set,this.visibleFailures=new Map,this.failureCounts={}}checkFailures(e){const t=new Set,a=new Map;for(const[n,i]of this.visibleFailures)e>i.ts+o.GRACE_PERIOD_MS?(t.add(i),this.trackedEvents.add(n)):a.set(n,i);this.visibleFailures=a,this.aggregateFailures(t)}aggregateFailures(e){for(const t of e){const e=t.errorCode;this.failureCounts[e]=(this.failureCounts[e]||0)+1}}trackFailures(){for(const e of Object.keys(this.failureCounts))if(this.failureCounts[e]>0){const t=this.errorCodeMapFn(e);this.fn(this.failureCounts[e],t,e),this.failureCounts[e]=0}}}i()(o,"internalInstance",new o(((e,t,a)=>{for(let n=0;n<e;n++)s.a.instance.trackEvent({eventName:"Error",domain:"E2EE",name:t,context:`mxc_crypto_error_type_${a}`})}),(e=>{switch(e){case"MEGOLM_UNKNOWN_INBOUND_SESSION_ID":return"OlmKeysNotSentError";case"OLM_UNKNOWN_MESSAGE_INDEX":return"OlmIndexError";case void 0:return"OlmUnspecifiedError";default:return"UnknownError"}}))),i()(o,"TRACK_INTERVAL_MS",6e4),i()(o,"CHECK_INTERVAL_MS",5e3),i()(o,"GRACE_PERIOD_MS",4e3)},885:function(e,t,a){"use strict";a.d(t,"a",(function(){return d}));var n=a(13),i=a.n(n),s=a(120),r=a.n(s),o=a(15),l=a(121);const c=new o.c("busy","org.matrix.msc3026.busy");class d extends r.a.Component{getDuration(e){if(!e)return;const t=Math.round(e/1e3),a=t%60,n=Math.round(t/60)%60,i=Math.round(t/3600)%24,s=Math.round(t/86400);return t<60?t<0?Object(l.a)("%(duration)ss",{duration:0}):Object(l.a)("%(duration)ss",{duration:a}):t<3600?Object(l.a)("%(duration)sm",{duration:n}):t<86400?Object(l.a)("%(duration)sh",{duration:i}):Object(l.a)("%(duration)sd",{duration:s})}getPrettyPresence(e,t,a){if(c.matches(e))return Object(l.a)("Busy");if(!a&&void 0!==t&&t>0){const a=this.getDuration(t);return"online"===e?Object(l.a)("Online for %(duration)s",{duration:a}):"unavailable"===e?Object(l.a)("Idle for %(duration)s",{duration:a}):"offline"===e?Object(l.a)("Offline for %(duration)s",{duration:a}):Object(l.a)("Unknown for %(duration)s",{duration:a})}return"online"===e?Object(l.a)("Online"):"unavailable"===e?Object(l.a)("Idle"):"offline"===e?Object(l.a)("Offline"):Object(l.a)("Unknown")}render(){return r.a.createElement("div",{className:"mx_PresenceLabel"},this.getPrettyPresence(this.props.presenceState,this.props.activeAgo,this.props.currentlyActive))}}i()(d,"defaultProps",{activeAgo:-1})},886:function(e,t,a){"use strict";a.r(t),a.d(t,"Icon",(function(){return r}));var n,i=a(120);function s(){return s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},s.apply(this,arguments)}function r(e){return i.createElement("svg",s({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",role:"presentation","aria-hidden":!0},e),n||(n=i.createElement("g",{fill:"none",fillRule:"evenodd"},i.createElement("path",{fill:"#ECECEC",d:"M0 0h24v24H0z"}),i.createElement("path",{d:"M7.338 13.154c.504 0 .826-.378.826-.882 0-.518-.322-.882-.826-.882-.49 0-.826.364-.826.882-.014.504.336.882.826.882zm4.662 0c.504 0 .84-.378.84-.882-.014-.518-.336-.882-.826-.882-.49 0-.84.364-.84.882-.014.504.336.882.826.882zm4.662 0c.518 0 .84-.378.84-.882 0-.518-.336-.882-.826-.882-.49 0-.84.364-.84.882 0 .504.336.882.826.882z",fill:"#454545"}))))}t.default="img/ellipsis.429f53e.svg"},887:function(e,t,a){"use strict";var n=a(120),i=a.n(n),s=a(177);t.a=e=>{let{value:t,label:a,byline:n,disabled:r,onChange:o}=e;return i.a.createElement("label",{className:"mx_LabelledCheckbox"},i.a.createElement(s.b,{disabled:r,checked:t,onChange:e=>o(e.target.checked)}),i.a.createElement("div",{className:"mx_LabelledCheckbox_labels"},i.a.createElement("span",{className:"mx_LabelledCheckbox_label"},a),n?i.a.createElement("span",{className:"mx_LabelledCheckbox_byline"},n):null))}},888:function(e,t,a){"use strict";function n(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}var i=a(254),s=function(){function e(e,t){var a=this;n(this,"_dispatcher",void 0),n(this,"_dispatchToken",void 0),this._dispatcher=function(e){e&&e.length||i(!1),!1;return e[0].getDispatcher()}(e);var s=e.map((function(e){return e.getDispatchToken()}));this._dispatchToken=this._dispatcher.register((function(e){a._dispatcher.waitFor(s),t()}))}return e.prototype.release=function(){this._dispatcher.unregister(this._dispatchToken)},e}();e.exports=s},889:function(e,t,a){"use strict";function n(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}var i=a(1472).EventEmitter,s=a(254),r=function(){function e(e){var t=this;n(this,"_dispatchToken",void 0),n(this,"__changed",void 0),n(this,"__changeEvent",void 0),n(this,"__className",void 0),n(this,"__dispatcher",void 0),n(this,"__emitter",void 0),this.__className=this.constructor.name,this.__changed=!1,this.__changeEvent="change",this.__dispatcher=e,this.__emitter=new i,this._dispatchToken=e.register((function(e){t.__invokeOnDispatch(e)}))}var t=e.prototype;return t.addListener=function(e){return this.__emitter.addListener(this.__changeEvent,e)},t.getDispatcher=function(){return this.__dispatcher},t.getDispatchToken=function(){return this._dispatchToken},t.hasChanged=function(){return this.__dispatcher.isDispatching()||s(!1),this.__changed},t.__emitChange=function(){this.__dispatcher.isDispatching()||s(!1),this.__changed=!0},t.__invokeOnDispatch=function(e){this.__changed=!1,this.__onDispatch(e),this.__changed&&this.__emitter.emit(this.__changeEvent)},t.__onDispatch=function(e){s(!1)},e}();e.exports=r},890:function(e,t,a){"use strict";var n=function(e){var t,a;function n(t,a,n){var i;return(i=e.call(this,t)||this).listener=a,i.context=n,i}return a=e,(t=n).prototype=Object.create(a.prototype),t.prototype.constructor=t,t.__proto__=a,n}(a(1474));e.exports=n},891:function(e,t,a){"use strict";a.d(t,"a",(function(){return d})),a.d(t,"b",(function(){return m}));var n=a(120),i=a.n(n),s=a(124),r=a(127),o=a(121),l=a(154),c=a(128);const d=/^[a-z0-9=_\-./]+$/;async function m(e){void 0===e&&(e={});const t=r.b.createDialog(l.a,{hasCancelButton:!0,quitOnly:!0,title:Object(o.a)("Sign In or Create Account"),description:Object(o.a)("Use your account or create a new one to continue."),button:Object(o.a)("Create Account"),extraButtons:[i.a.createElement("button",{key:"start_login",onClick:()=>{t.close(),s.a.dispatch({action:"start_login",screenAfterLogin:e.screen_after})}},Object(o.a)("Sign In"))],onFinished:t=>{t?s.a.dispatch({action:"start_registration",screenAfterLogin:e.screen_after}):e.go_home_on_cancel?s.a.dispatch({action:c.a.ViewHomePage}):e.go_welcome_on_cancel&&s.a.dispatch({action:"view_welcome_page"})}})}},892:function(e,t,a){"use strict";(function(e){a.d(t,"a",(function(){return ge}));var n=a(130),i=a.n(n),s=a(126),r=a.n(s),o=a(148),l=a(136),c=a(16),d=a(120),m=a.n(d),u=a(436),h=a.n(u),p=a(142),g=a(169),v=a(163),b=a(128),f=a(124),y=a(1480),E=a(1481),_=a(1482),S=a(1483),w=a(1484),O=a(1485),C=a(151),x=a(121),k=a(122),j=a(127),R=a(189),I=a(385),T=a(231),N=a(137),D=a(125),P=a(472),M=a(219),A=a(432),L=a(153),U=a(208),F=a(178),B=a(402),V=a(165),W=a(167),H=a(697),z=a(226),G=a(191),K=a(318),q=a(857),$=a(1589),Y=a(123),J=a(887),Q=a(134),X=a(246),Z=a(135),ee=a(633),te=a(1486),ae=a(1487),ne=a(1488),ie=a(661),se=a(1489),re=a(217),oe=a(459),le=a(162),ce=a(166);const de=50,me=24;function ue(e){var t,a;return!0===(null===(t=e.current)||void 0===t||null===(a=t.id)||void 0===a?void 0:a.startsWith("mx_SpotlightDialog_button_recentlyViewed_"))}function he(e,t){const a=new Set;return e&&a.add(null),t&&a.add(l.RoomType.Space),a}var pe;let ge;function ve(e){switch(e){case ge.People:return Object(x.a)("People");case ge.PublicRooms:return Object(x.a)("Public rooms")}}!function(e){e[e.People=0]="People",e[e.Rooms=1]="Rooms",e[e.Spaces=2]="Spaces",e[e.Suggestions=3]="Suggestions",e[e.PublicRooms=4]="PublicRooms"}(pe||(pe={})),function(e){e[e.People=0]="People",e[e.PublicRooms=1]="PublicRooms"}(ge||(ge={}));const be=e=>!(null==e||!e.room),fe=e=>!(null==e||!e.publicRoom),ye=e=>!(null==e||!e.member),Ee=e=>{var t,a,n,i,s;return{publicRoom:e,section:pe.PublicRooms,filter:[ge.PublicRooms],query:[e.room_id.toLowerCase(),null===(t=e.canonical_alias)||void 0===t?void 0:t.toLowerCase(),null===(a=e.name)||void 0===a?void 0:a.toLowerCase(),h()(null!==(n=null===(i=e.topic)||void 0===i?void 0:i.toLowerCase())&&void 0!==n?n:"",{allowedTags:[]}),...(null===(s=e.aliases)||void 0===s?void 0:s.map((e=>e.toLowerCase())))||[]].filter(Boolean)}},_e=e=>{const t=k.a.get().getUserId();if(V.a.shared().getUserIdForRoomId(e.roomId)){const a=e.getMembers().filter((e=>e.userId!==t)),n=[...a.map((e=>e.name.toLowerCase())),...a.map((e=>e.userId.toLowerCase()))].filter(Boolean);return{room:e,section:pe.People,filter:[ge.People],query:n}}return e.isSpaceRoom()?{room:e,section:pe.Spaces,filter:[]}:{room:e,section:pe.Rooms,filter:[]}},Se=e=>({member:e,section:pe.Suggestions,filter:[ge.People],query:[e.userId.toLowerCase(),e.name.toLowerCase()].filter(Boolean)}),we=new A.a,Oe=(e,t)=>e.getVisibleRooms(t).filter((e=>!Object(re.a)(e)&&("join"===e.getMyMembership()||"invite"==e.getMyMembership()))),Ce=function(e,t){let a=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return Object.values(Oe(e,t).filter((e=>!a||!V.a.shared().getUserIdForRoomId(e.roomId))).reduce(((e,t)=>{for(const a of t.getJoinedMembers())e[a.userId]=a;return e}),{})).filter((t=>t.userId!==e.getUserId()))},xe=(e,t)=>t.hasMentions?Object(x.a)("%(count)s unread messages including mentions.",{count:t.count}):t.hasUnreadCount?Object(x.a)("%(count)s unread messages.",{count:t.count}):t.isUnread?Object(x.a)("Unread messages."):void 0,ke=t=>{var a,n;let{initialText:s="",initialFilter:u=null,onFinished:h}=t;const A=Object(d.useRef)(),re=Object(d.useRef)(),ke=k.a.get(),je=Object(d.useContext)(g.c),[Re,Ie]=Object(d.useState)(s),[Te,Ne]=Object(E.a)(),[De,Pe]=Object(d.useState)(u),Me=Object(d.useCallback)((e=>{var t,a,n;Pe(e),null===(t=A.current)||void 0===t||t.focus(),null===(a=re.current)||void 0===a||null===(n=a.scrollTo)||void 0===n||n.call(a,{top:0})}),[]),Ae=Object(d.useMemo)((()=>{const e=Object(H.a)(ke),t=Object(H.b)(ke);return Object(H.c)(e,t)}),[ke]),Le=Object(ce.a)("feature_dynamic_room_predecessors"),Ue=Object(W.i)(ke.getUserId()),[Fe,Be]=Object(d.useState)(!1),Ve=Object(d.useMemo)((()=>Re.trim()),[Re]),We=Object(ce.a)("feature_exploring_public_spaces"),{loading:He,publicRooms:ze,protocols:Ge,config:Ke,setConfig:qe,search:$e}=Object(S.a)(),[Ye,Je]=Object(d.useState)(!0),[Qe,Xe]=Object(d.useState)(!1),{loading:Ze,users:et,search:tt}=Object(O.a)(),{loading:at,profile:nt,search:it}=Object(_.a)(),st=Object(d.useMemo)((()=>[{query:Ve,roomTypes:he(Ye,Qe),limit:de}]),[Ve,Ye,Qe]);Object(y.a)(De===ge.PublicRooms,$e,st),Object(y.a)(De===ge.People,tt,st),Object(y.a)(De===ge.People,it,st);const rt=Object(d.useMemo)((()=>{const e=[],t=Oe(ke,Le).map(_e),a=t.reduce(((e,t)=>{const a=V.a.shared().getUserIdForRoomId(t.room.roomId);return a?(t.room.getJoinedMemberCount()>2||e.add(a),e):e}),new Set);for(const t of[...Ce(ke,Le),...et])a.has(t.userId)||(a.add(t.userId),e.push(Se(t)));return[...F.a.instance.enabledMetaSpaces.map((e=>({section:pe.Spaces,filter:[],avatar:m.a.createElement("div",{className:r()("mx_SpotlightDialog_metaspaceResult",`mx_SpotlightDialog_metaspaceResult_${e}`)}),name:Object(U.g)(e,F.a.instance.allRoomsInHome),onClick(){F.a.instance.setActiveSpace(e)}}))),...t,...e,...(nt&&!a.has(nt.user_id)?[new B.a(nt)]:[]).map(Se),...ze.map(Ee)].filter((e=>null===De||e.filter.includes(De)))}),[ke,et,nt,ze,De,Le]),ot=Object(d.useMemo)((()=>{const e={[pe.People]:[],[pe.Rooms]:[],[pe.Spaces]:[],[pe.Suggestions]:[],[pe.PublicRooms]:[]};if(Ve){const t=Ve.toLowerCase(),a=Object(c.z)(Ve);rt.forEach((n=>{var i,s,r;if(be(n)){if(!(null!==(i=n.room.normalizedName)&&void 0!==i&&i.includes(a)||null!==(s=n.room.getCanonicalAlias())&&void 0!==s&&s.toLowerCase().includes(t)||null!==(r=n.query)&&void 0!==r&&r.some((e=>e.includes(t)))))return}else if(ye(n)){var o;if(null===(o=n.query)||void 0===o||!o.some((e=>e.includes(t))))return}else if(fe(n)){var l;if(null===(l=n.query)||void 0===l||!l.some((e=>e.includes(t))))return}else{var c;if(!(n.name.toLowerCase().includes(t)||null!==(c=n.query)&&void 0!==c&&c.some((e=>e.includes(t)))))return}e[n.section].push(n)}))}else De===ge.PublicRooms?rt.forEach((t=>{fe(t)&&e[t.section].push(t)})):De===ge.People&&rt.forEach((t=>{ye(t)&&e[t.section].push(t)}));const t=ke.getUserId();for(const a of Object.values(e))a.sort(((e,a)=>be(e)||be(a)?be(a)&&be(e)?we.getLastTs(a.room,t)-we.getLastTs(e.room,t):-1:ye(e)||ye(a)?ye(a)&&ye(e)?Ae(e.member,a.member):-1:void 0));return e}),[Ve,De,ke,rt,Ae]);((e,t,a)=>{Object(d.useEffect)((()=>{if(!t)return;const n=window.setTimeout((()=>{R.a.instance.trackEvent({eventName:"WebSearch",viaSpotlight:a,numResults:e,queryLength:t})}),1e3);return()=>{clearTimeout(n)}}),[e,t,a])})(Object(o.sum)(Object.values(ot).map((e=>e.length))),Re.length,!0);const lt=F.a.instance.activeSpaceRoom,[ct,dt]=Object(w.a)(null!=lt?lt:void 0,Re);Object(d.useEffect)((()=>{e((()=>{var e,t,a;let n;je.state.refs&&(n=je.state.refs[0]),je.dispatch({type:g.f.SetFocus,payload:{ref:n}}),null===(e=n)||void 0===e||null===(t=e.current)||void 0===t||null===(a=t.scrollIntoView)||void 0===a||a.call(t,{block:"nearest"})}))}),[ot,De]);const mt=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],a=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(t){const t=new Set(D.b.getValue("SpotlightSearch.recentSearches",null).reverse());t.delete(e.roomId),t.add(e.roomId),D.b.setValue("SpotlightSearch.recentSearches",null,N.a.ACCOUNT,Array.from(t).reverse().slice(0,10))}f.a.dispatch({action:b.a.ViewRoom,metricsTrigger:"WebUnifiedSearch",metricsViaKeyboard:a,room_id:e.roomId,room_alias:e.roomAlias,auto_join:e.autoJoin,should_peek:e.shouldPeek}),h()};let ut,ht;if((Ve||De!==ge.PublicRooms)&&(ut=m.a.createElement("div",{className:"mx_SpotlightDialog_section mx_SpotlightDialog_otherSearches",role:"group","aria-labelledby":"mx_SpotlightDialog_section_otherSearches"},m.a.createElement("h4",{id:"mx_SpotlightDialog_section_otherSearches"},Ve?Object(x.a)('Use "%(query)s" to search',{query:Re}):Object(x.a)("Search for")),m.a.createElement("div",null,De!==ge.PublicRooms&&m.a.createElement(te.a,{id:"mx_SpotlightDialog_button_explorePublicRooms",className:"mx_SpotlightDialog_explorePublicRooms",onClick:()=>Me(ge.PublicRooms)},ve(ge.PublicRooms)),De!==ge.People&&m.a.createElement(te.a,{id:"mx_SpotlightDialog_button_startChat",className:"mx_SpotlightDialog_startChat",onClick:()=>Me(ge.People)},ve(ge.People))))),Ve||null!==De){const e=e=>{if(be(e)){const t=M.a.instance.getRoomState(e.room),a=xe(e.room,t),n={"aria-label":a?`${e.room.name} ${a}`:e.room.name,"aria-describedby":`mx_SpotlightDialog_button_result_${e.room.roomId}_details`};return m.a.createElement(te.a,i()({id:`mx_SpotlightDialog_button_result_${e.room.roomId}`,key:`${pe[e.section]}-${e.room.roomId}`,onClick:t=>{mt({roomId:e.room.roomId},!0,"click"!==(null==t?void 0:t.type))},endAdornment:m.a.createElement(ne.a,{room:e.room})},n),m.a.createElement(K.a,{room:e.room,avatarSize:me,tooltipProps:{tabIndex:-1}}),e.room.name,m.a.createElement(X.a,{notification:t}),m.a.createElement(ie.a,{id:`mx_SpotlightDialog_button_result_${e.room.roomId}_details`,className:"mx_SpotlightDialog_result_details",room:e.room}))}if(ye(e))return m.a.createElement(te.a,{id:`mx_SpotlightDialog_button_result_${e.member.userId}`,key:`${pe[e.section]}-${e.member.userId}`,onClick:()=>{Object(B.e)(ke,[e.member]),h()},"aria-label":e.member instanceof l.RoomMember?e.member.rawDisplayName:e.member.name,"aria-describedby":`mx_SpotlightDialog_button_result_${e.member.userId}_details`},m.a.createElement(q.a,{user:e.member,size:me}),e.member instanceof l.RoomMember?e.member.rawDisplayName:e.member.name,m.a.createElement("div",{id:`mx_SpotlightDialog_button_result_${e.member.userId}_details`,className:"mx_SpotlightDialog_result_details"},e.member.userId));if(fe(e)){const t=ke.getRoom(e.publicRoom.room_id),a="join"===(null==t?void 0:t.getMyMembership())||e.publicRoom.world_readable||ke.isGuest(),n=t=>{var a;const{publicRoom:n}=e;mt({roomAlias:n.canonical_alias||(null===(a=n.aliases)||void 0===a?void 0:a[0]),roomId:n.room_id,autoJoin:!e.publicRoom.world_readable&&!ke.isGuest(),shouldPeek:e.publicRoom.world_readable||ke.isGuest()},!0,"click"!==t.type)};return m.a.createElement(te.a,{id:`mx_SpotlightDialog_button_result_${e.publicRoom.room_id}`,className:"mx_SpotlightDialog_result_multiline",key:`${pe[e.section]}-${e.publicRoom.room_id}`,onClick:n,endAdornment:m.a.createElement(Y.a,{kind:a?"primary_outline":"primary",onClick:n,tabIndex:-1},a?Object(x.a)("View"):Object(x.a)("Join")),"aria-labelledby":`mx_SpotlightDialog_button_result_${e.publicRoom.room_id}_name`,"aria-describedby":`mx_SpotlightDialog_button_result_${e.publicRoom.room_id}_alias`,"aria-details":`mx_SpotlightDialog_button_result_${e.publicRoom.room_id}_details`},m.a.createElement(le.a,{className:"mx_SearchResultAvatar",oobData:{roomId:e.publicRoom.room_id,name:e.publicRoom.name,avatarUrl:e.publicRoom.avatar_url,roomType:e.publicRoom.room_type},width:me,height:me}),m.a.createElement(ae.a,{room:e.publicRoom,labelId:`mx_SpotlightDialog_button_result_${e.publicRoom.room_id}_name`,descriptionId:`mx_SpotlightDialog_button_result_${e.publicRoom.room_id}_alias`,detailsId:`mx_SpotlightDialog_button_result_${e.publicRoom.room_id}_details`}))}return m.a.createElement(te.a,{id:`mx_SpotlightDialog_button_result_${e.name}`,key:`${pe[e.section]}-${e.name}`,onClick:e.onClick},e.avatar,e.name,e.description)};let t,a,n,s,r,c,d,u,p,g;ot[pe.People].length&&(t=m.a.createElement("div",{className:"mx_SpotlightDialog_section mx_SpotlightDialog_results",role:"group","aria-labelledby":"mx_SpotlightDialog_section_people"},m.a.createElement("h4",{id:"mx_SpotlightDialog_section_people"},Object(x.a)("Recent Conversations")),m.a.createElement("div",null,ot[pe.People].slice(0,de).map(e)))),ot[pe.Suggestions].length&&De===ge.People&&(a=m.a.createElement("div",{className:"mx_SpotlightDialog_section mx_SpotlightDialog_results",role:"group","aria-labelledby":"mx_SpotlightDialog_section_suggestions"},m.a.createElement("h4",{id:"mx_SpotlightDialog_section_suggestions"},Object(x.a)("Suggestions")),m.a.createElement("div",null,ot[pe.Suggestions].slice(0,de).map(e)))),ot[pe.Rooms].length&&(n=m.a.createElement("div",{className:"mx_SpotlightDialog_section mx_SpotlightDialog_results",role:"group","aria-labelledby":"mx_SpotlightDialog_section_rooms"},m.a.createElement("h4",{id:"mx_SpotlightDialog_section_rooms"},Object(x.a)("Rooms")),m.a.createElement("div",null,ot[pe.Rooms].slice(0,de).map(e)))),ot[pe.Spaces].length&&(s=m.a.createElement("div",{className:"mx_SpotlightDialog_section mx_SpotlightDialog_results",role:"group","aria-labelledby":"mx_SpotlightDialog_section_spaces"},m.a.createElement("h4",{id:"mx_SpotlightDialog_section_spaces"},Object(x.a)("Spaces you're in")),m.a.createElement("div",null,ot[pe.Spaces].slice(0,de).map(e)))),De===ge.PublicRooms&&(r=m.a.createElement("div",{className:"mx_SpotlightDialog_section mx_SpotlightDialog_results",role:"group","aria-labelledby":"mx_SpotlightDialog_section_publicRooms"},m.a.createElement("div",{className:"mx_SpotlightDialog_sectionHeader"},m.a.createElement("h4",{id:"mx_SpotlightDialog_section_publicRooms"},Object(x.a)("Suggestions")),m.a.createElement("div",{className:"mx_SpotlightDialog_options"},We&&m.a.createElement(m.a.Fragment,null,m.a.createElement(J.a,{label:Object(x.a)("Show rooms"),value:Ye,onChange:Je}),m.a.createElement(J.a,{label:Object(x.a)("Show spaces"),value:Qe,onChange:Xe})),m.a.createElement($.a,{protocols:Ge,config:null!=Ke?Ke:null,setConfig:qe}))),m.a.createElement("div",null," ",Ye||Qe?ot[pe.PublicRooms].slice(0,de).map(e):m.a.createElement("div",{className:"mx_SpotlightDialog_otherSearches_messageSearchText"},Object(x.a)("You cannot search for rooms that are neither a room nor a space"))," "))),ct.length&&lt&&null===De&&(c=m.a.createElement("div",{className:"mx_SpotlightDialog_section mx_SpotlightDialog_results",role:"group","aria-labelledby":"mx_SpotlightDialog_section_spaceRooms"},m.a.createElement("h4",{id:"mx_SpotlightDialog_section_spaceRooms"},Object(x.a)("Other rooms in %(spaceName)s",{spaceName:lt.name})),m.a.createElement("div",null,ct.slice(0,de).map((e=>m.a.createElement(te.a,{id:`mx_SpotlightDialog_button_result_${e.room_id}`,key:e.room_id,onClick:t=>{mt({roomId:e.room_id},!0,"click"!==(null==t?void 0:t.type))}},m.a.createElement(G.a,{name:e.name,idName:e.room_id,url:e.avatar_url?Object(v.b)(e.avatar_url).getSquareThumbnailHttp(me):null,width:me,height:me}),e.name||e.canonical_alias,e.name&&e.canonical_alias&&m.a.createElement("div",{className:"mx_SpotlightDialog_result_details"},e.canonical_alias)))),dt&&m.a.createElement(Q.a,null)))),!Ve.startsWith("#")||!Ve.includes(":")||Object(I.a)(Ve)&&ke.getRoom(Object(I.a)(Ve))||(d=m.a.createElement("div",{className:"mx_SpotlightDialog_section mx_SpotlightDialog_otherSearches",role:"group"},m.a.createElement("div",null,m.a.createElement(te.a,{id:"mx_SpotlightDialog_button_joinRoomAlias",className:"mx_SpotlightDialog_joinRoomAlias",onClick:e=>{f.a.dispatch({action:b.a.ViewRoom,room_alias:Ve,auto_join:!0,metricsTrigger:"WebUnifiedSearch",metricsViaKeyboard:"click"!==(null==e?void 0:e.type)}),h()}},Object(x.a)("Join %(roomAddress)s",{roomAddress:Ve}))))),De===ge.People?u=m.a.createElement("div",{className:"mx_SpotlightDialog_section mx_SpotlightDialog_hiddenResults",role:"group"},m.a.createElement("h4",null,Object(x.a)("Some results may be hidden for privacy")),m.a.createElement("div",{className:"mx_SpotlightDialog_otherSearches_messageSearchText"},Object(x.a)("If you can't see who you're looking for, send them your invite link.")),m.a.createElement(se.a,{id:"mx_SpotlightDialog_button_inviteLink",className:"mx_SpotlightDialog_inviteLink",onClick:()=>{Be(!0),Object(z.b)(Ue)},onHideTooltip:()=>Be(!1),title:Fe?Object(x.a)("Copied!"):Object(x.a)("Copy")},m.a.createElement("span",{className:"mx_AccessibleButton mx_AccessibleButton_hasKind mx_AccessibleButton_kind_primary_outline"},Object(x.a)("Copy invite link")))):Ve&&De===ge.PublicRooms&&(u=m.a.createElement("div",{className:"mx_SpotlightDialog_section mx_SpotlightDialog_hiddenResults",role:"group"},m.a.createElement("h4",null,Object(x.a)("Some results may be hidden")),m.a.createElement("div",{className:"mx_SpotlightDialog_otherSearches_messageSearchText"},Object(x.a)("If you can't find the room you're looking for, ask for an invite or create a new room.")),m.a.createElement(te.a,{id:"mx_SpotlightDialog_button_createNewRoom",className:"mx_SpotlightDialog_createRoom",onClick:()=>f.a.dispatch({action:"view_create_room",public:!0,defaultName:Object(o.capitalize)(Ve)})},m.a.createElement("span",{className:"mx_AccessibleButton mx_AccessibleButton_hasKind mx_AccessibleButton_kind_primary_outline"},Object(x.a)("Create new room"))))),De===ge.People&&(p=m.a.createElement("div",{className:"mx_SpotlightDialog_section mx_SpotlightDialog_otherSearches",role:"group","aria-labelledby":"mx_SpotlightDialog_section_groupChat"},m.a.createElement("h4",{id:"mx_SpotlightDialog_section_groupChat"},Object(x.a)("Other options")),m.a.createElement(te.a,{id:"mx_SpotlightDialog_button_startGroupChat",className:"mx_SpotlightDialog_startGroupChat",onClick:()=>Object(T.f)(Ve)},Object(x.a)("Start a group chat")))),null===De&&(g=m.a.createElement("div",{className:"mx_SpotlightDialog_section mx_SpotlightDialog_otherSearches",role:"group","aria-labelledby":"mx_SpotlightDialog_section_messageSearch"},m.a.createElement("h4",{id:"mx_SpotlightDialog_section_messageSearch"},Object(x.a)("Other searches")),m.a.createElement("div",{className:"mx_SpotlightDialog_otherSearches_messageSearchText"},Object(x.a)("To search messages, look for this icon at the top of a room <icon/>",{},{icon:()=>m.a.createElement("div",{className:"mx_SpotlightDialog_otherSearches_messageSearchIcon"})})))),ht=m.a.createElement(m.a.Fragment,null,t,a,n,s,c,r,d,u,ut,p,g)}else{let e;Te.length&&(e=m.a.createElement("div",{className:"mx_SpotlightDialog_section mx_SpotlightDialog_recentSearches",role:"group",tabIndex:-1,"aria-labelledby":"mx_SpotlightDialog_section_recentSearches"},m.a.createElement("h4",null,m.a.createElement("span",{id:"mx_SpotlightDialog_section_recentSearches"},Object(x.a)("Recent searches")),m.a.createElement(Y.a,{kind:"link",onClick:Ne},Object(x.a)("Clear"))),m.a.createElement("div",null,Te.map((e=>{const t=M.a.instance.getRoomState(e),a=xe(0,t),n={"aria-label":a?`${e.name} ${a}`:e.name,"aria-describedby":`mx_SpotlightDialog_button_recentSearch_${e.roomId}_details`};return m.a.createElement(te.a,i()({id:`mx_SpotlightDialog_button_recentSearch_${e.roomId}`,key:e.roomId,onClick:t=>{mt({roomId:e.roomId},!0,"click"!==(null==t?void 0:t.type))},endAdornment:m.a.createElement(ne.a,{room:e})},n),m.a.createElement(K.a,{room:e,avatarSize:me,tooltipProps:{tabIndex:-1}}),e.name,m.a.createElement(X.a,{notification:t}),m.a.createElement(ie.a,{id:`mx_SpotlightDialog_button_recentSearch_${e.roomId}_details`,className:"mx_SpotlightDialog_result_details",room:e}))}))))),ht=m.a.createElement(m.a.Fragment,null,m.a.createElement("div",{className:"mx_SpotlightDialog_section mx_SpotlightDialog_recentlyViewed",role:"group","aria-labelledby":"mx_SpotlightDialog_section_recentlyViewed"},m.a.createElement("h4",{id:"mx_SpotlightDialog_section_recentlyViewed"},Object(x.a)("Recently viewed")),m.a.createElement("div",null,P.a.instance.rooms.filter((e=>e.roomId!==L.b.instance.roomViewStore.getRoomId())).map((e=>m.a.createElement(se.a,{id:`mx_SpotlightDialog_button_recentlyViewed_${e.roomId}`,title:e.name,key:e.roomId,onClick:t=>{mt({roomId:e.roomId},!1,"click"!==t.type)}},m.a.createElement(K.a,{room:e,avatarSize:32,tooltipProps:{tabIndex:-1}}),e.name))))),e,ut)}const pt=Object(oe.a)()?()=>{j.b.createDialog(ee.a,{feature:"spotlight"})}:null,gt=null===(a=je.state.activeRef)||void 0===a||null===(n=a.current)||void 0===n?void 0:n.id;return m.a.createElement(m.a.Fragment,null,m.a.createElement("div",{id:"mx_SpotlightDialog_keyboardPrompt"},Object(x.a)("Use <arrows/> to scroll",{},{arrows:()=>m.a.createElement(m.a.Fragment,null,m.a.createElement("kbd",null,"↓"),m.a.createElement("kbd",null,"↑"),null!==!De&&!Re&&m.a.createElement("kbd",null,"←"),null!==!De&&!Re&&m.a.createElement("kbd",null,"→"))})),m.a.createElement(Z.a,{className:"mx_SpotlightDialog",onFinished:h,hasCancel:!1,onKeyDown:e=>{if(Object(C.a)().getNavigationAction(e)===p.h.FilterRooms)e.stopPropagation(),e.preventDefault(),h();let t;const a=Object(C.a)().getAccessibilityAction(e);switch(a){case p.h.Escape:e.stopPropagation(),e.preventDefault(),h();break;case p.h.ArrowUp:case p.h.ArrowDown:if(e.stopPropagation(),e.preventDefault(),je.state.refs.length>0){let e=je.state.refs;if(!Re&&null!==!De){const t=ue(je.state.activeRef)?je.state.activeRef:e.find(ue);e=e.filter((e=>e===t||!ue(e)))}const n=e.indexOf(je.state.activeRef);t=Object(g.h)(e,n+(a===p.h.ArrowUp?-1:1))}break;case p.h.ArrowLeft:case p.h.ArrowRight:if(!Re&&null!==!De&&je.state.refs.length>0&&ue(je.state.activeRef)){e.stopPropagation(),e.preventDefault();const n=je.state.refs.filter(ue),i=n.indexOf(je.state.activeRef);t=Object(g.h)(n,i+(a===p.h.ArrowLeft?-1:1))}}var n;t&&(je.dispatch({type:g.f.SetFocus,payload:{ref:t}}),null===(n=t.current)||void 0===n||n.scrollIntoView({block:"nearest"}))},screenName:"UnifiedSearch","aria-label":Object(x.a)("Search Dialog")},m.a.createElement("div",{className:"mx_SpotlightDialog_searchBox mx_textinput"},null!==De&&m.a.createElement("div",{className:r()("mx_SpotlightDialog_filter",{mx_SpotlightDialog_filterPeople:De===ge.People,mx_SpotlightDialog_filterPublicRooms:De===ge.PublicRooms})},m.a.createElement("span",null,ve(De)),m.a.createElement(Y.a,{tabIndex:-1,alt:Object(x.a)("Remove search filter for %(filter)s",{filter:ve(De)}),className:"mx_SpotlightDialog_filter--close",onClick:()=>Me(null)})),m.a.createElement("input",{ref:A,autoFocus:!0,type:"text",autoComplete:"off",autoCapitalize:"off",autoCorrect:"off",spellCheck:"false",placeholder:Object(x.a)("Search"),value:Re,onChange:e=>{const t=e.currentTarget.value;Ie(t)},onKeyDown:e=>{var t,a;switch(Object(C.a)().getAccessibilityAction(e)){case p.h.Backspace:Re||null===De||(e.stopPropagation(),e.preventDefault(),Me(null));break;case p.h.Enter:e.stopPropagation(),e.preventDefault(),null===(t=je.state.activeRef)||void 0===t||null===(a=t.current)||void 0===a||a.click()}},"aria-owns":"mx_SpotlightDialog_content","aria-activedescendant":gt,"aria-label":Object(x.a)("Search"),"aria-describedby":"mx_SpotlightDialog_keyboardPrompt"}),(He||Ze||at)&&m.a.createElement(Q.a,{w:24,h:24})),m.a.createElement("div",{ref:re,id:"mx_SpotlightDialog_content",role:"listbox","aria-activedescendant":gt,"aria-describedby":"mx_SpotlightDialog_keyboardPrompt"},ht),m.a.createElement("div",{className:"mx_SpotlightDialog_footer"},pt&&Object(x.a)("Results not as expected? Please <a>give feedback</a>.",{},{a:e=>m.a.createElement(Y.a,{kind:"link_inline",onClick:pt},e)}),pt&&m.a.createElement(Y.a,{kind:"primary_outline",onClick:pt},Object(x.a)("Feedback")))))};t.b=e=>m.a.createElement(g.d,null,(()=>m.a.createElement(ke,e)))}).call(this,a(54).setImmediate)},893:function(e,t,a){"use strict";a.d(t,"a",(function(){return r}));var n=a(13),i=a.n(n),s=a(129);class r{constructor(e,t,a){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];this.root=e,this.pageSize=t,this.maxDepth=a,this.suggestedOnly=n,i()(this,"viaMap",new Map),i()(this,"backRefs",new Map),i()(this,"roomMap",new Map),i()(this,"loadRequest",void 0),i()(this,"nextBatch",void 0),i()(this,"_rooms",void 0),i()(this,"serverSupportError",void 0)}get noSupport(){return!!this.serverSupportError}get canLoadMore(){return!!this.serverSupportError||!!this.nextBatch||!this._rooms}get loading(){return!!this.loadRequest}get rooms(){return this._rooms}async load(){let e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.pageSize;if(this.loadRequest)return this.loadRequest.then((e=>e.rooms));this.loadRequest=this.root.client.getRoomHierarchy(this.root.roomId,t,this.maxDepth,this.suggestedOnly,this.nextBatch);try{({rooms:e,next_batch:this.nextBatch}=await this.loadRequest)}catch(e){if("M_UNRECOGNIZED"!==e.errcode)throw e;return this.serverSupportError=e,[]}finally{this.loadRequest=void 0}return this._rooms?this._rooms=this._rooms.concat(e):this._rooms=e,e.forEach((e=>{this.roomMap.set(e.room_id,e),e.children_state.forEach((t=>{if(t.type!==s.b.SpaceChild)return;const a=t.state_key;if(this.backRefs.has(a)||this.backRefs.set(a,[]),this.backRefs.get(a).push(e.room_id),Array.isArray(t.content.via)){this.viaMap.has(a)||this.viaMap.set(a,new Set);const e=this.viaMap.get(a);t.content.via.forEach((t=>e.add(t)))}}))})),e}getRelation(e,t){var a;return null===(a=this.roomMap.get(e))||void 0===a?void 0:a.children_state.find((e=>e.state_key===t))}isSuggested(e,t){var a;return null===(a=this.getRelation(e,t))||void 0===a?void 0:a.content.suggested}removeRelation(e,t){const a=this.backRefs.get(t);1===(null==a?void 0:a.length)?this.backRefs.delete(t):null!=a&&a.length&&this.backRefs.set(t,a.filter((t=>t!==e)));const n=this.roomMap.get(e);n&&(n.children_state=n.children_state.filter((e=>e.state_key!==t)))}}},894:function(e,t,a){"use strict";a.d(t,"b",(function(){return v}));var n=a(13),i=a.n(n),s=a(120),r=a.n(s),o=a(121),l=a(125),c=a(137),d=a(177),m=a(166),u=a(208),h=a(159);function p(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function g(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?p(Object(a),!0).forEach((function(t){i()(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):p(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}const v=(e,t)=>a=>{const n=l.b.getValue("Spaces.enabledMetaSpaces");l.b.setValue("Spaces.enabledMetaSpaces",null,c.a.ACCOUNT,g(g({},n),{},{[e]:a.target.checked})),h.b.trackInteraction(t,a,[u.a.Home,null,u.a.Favourites,u.a.People,u.a.Orphans].indexOf(e))};t.a=()=>{const{[u.a.Home]:e,[u.a.Favourites]:t,[u.a.People]:a,[u.a.Orphans]:n}=Object(m.b)("Spaces.enabledMetaSpaces"),i=Object(m.b)("Spaces.allRoomsInHome");return r.a.createElement("div",{className:"mx_SettingsTab mx_SidebarUserSettingsTab"},r.a.createElement("div",{className:"mx_SettingsTab_heading"},Object(o.a)("Sidebar")),r.a.createElement("div",{className:"mx_SettingsTab_section"},r.a.createElement("div",{className:"mx_SettingsTab_subheading"},Object(o.a)("Spaces to show")),r.a.createElement("div",{className:"mx_SettingsTab_subsectionText"},Object(o.a)("Spaces are ways to group rooms and people. Alongside the spaces you're in, you can use some pre-built ones too.")),r.a.createElement(d.b,{checked:!!e,onChange:v(u.a.Home,"WebSettingsSidebarTabSpacesCheckbox"),className:"mx_SidebarUserSettingsTab_homeCheckbox",disabled:e},Object(o.a)("Home")),r.a.createElement("div",{className:"mx_SidebarUserSettingsTab_checkboxMicrocopy"},Object(o.a)("Home is useful for getting an overview of everything.")),r.a.createElement(d.b,{checked:i,disabled:!e,onChange:e=>{l.b.setValue("Spaces.allRoomsInHome",null,c.a.ACCOUNT,e.target.checked),h.b.trackInteraction("WebSettingsSidebarTabSpacesCheckbox",e,1)},className:"mx_SidebarUserSettingsTab_homeAllRoomsCheckbox"},Object(o.a)("Show all rooms")),r.a.createElement("div",{className:"mx_SidebarUserSettingsTab_checkboxMicrocopy"},Object(o.a)("Show all your rooms in Home, even if they're in a space.")),r.a.createElement(d.b,{checked:!!t,onChange:v(u.a.Favourites,"WebSettingsSidebarTabSpacesCheckbox"),className:"mx_SidebarUserSettingsTab_favouritesCheckbox"},Object(o.a)("Favourites")),r.a.createElement("div",{className:"mx_SidebarUserSettingsTab_checkboxMicrocopy"},Object(o.a)("Group all your favourite rooms and people in one place.")),r.a.createElement(d.b,{checked:!!a,onChange:v(u.a.People,"WebSettingsSidebarTabSpacesCheckbox"),className:"mx_SidebarUserSettingsTab_peopleCheckbox"},Object(o.a)("People")),r.a.createElement("div",{className:"mx_SidebarUserSettingsTab_checkboxMicrocopy"},Object(o.a)("Group all your people in one place.")),r.a.createElement(d.b,{checked:!!n,onChange:v(u.a.Orphans,"WebSettingsSidebarTabSpacesCheckbox"),className:"mx_SidebarUserSettingsTab_orphansCheckbox"},Object(o.a)("Rooms outside of a space")),r.a.createElement("div",{className:"mx_SidebarUserSettingsTab_checkboxMicrocopy"},Object(o.a)("Group all your rooms that aren't part of a space in one place."))))}},895:function(e,t,a){"use strict";a.d(t,"a",(function(){return S}));var n=a(13),i=a.n(n),s=a(120),r=a.n(s),o=a(1),l=a(121),c=a(125),d=a(312),m=a(466),u=a(123),h=a(124),p=a(128),g=a(177),v=a(139),b=a(334),f=a(137),y=a(159);function E(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function _(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?E(Object(a),!0).forEach((function(t){i()(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):E(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}class S extends r.a.Component{constructor(e){super(e),i()(this,"themeTimer",void 0),i()(this,"onThemeChange",(e=>{if(this.state.theme===e)return;y.b.trackInteraction("WebSettingsAppearanceTabThemeSelector");const t=c.b.getValue("theme");c.b.setValue("theme",null,f.a.DEVICE,e).catch((()=>{h.a.dispatch({action:p.a.RecheckTheme}),this.setState({theme:t})})),this.setState({theme:e}),h.a.dispatch({action:p.a.RecheckTheme,forceTheme:e})})),i()(this,"onUseSystemThemeChanged",(e=>{this.setState({useSystemTheme:e}),c.b.setValue("use_system_theme",null,f.a.DEVICE,e),h.a.dispatch({action:p.a.RecheckTheme})})),i()(this,"onAddCustomTheme",(async()=>{let e=c.b.getValue("custom_themes");e||(e=[]),e=e.map((e=>e)),this.themeTimer&&clearTimeout(this.themeTimer);try{const t=await fetch(this.state.customThemeUrl),a=await t.json();if(!a||"string"!=typeof a.name||"object"!=typeof a.colors)return void this.setState({customThemeMessage:{text:Object(l.a)("Invalid theme schema."),isError:!0}});e.push(a)}catch(e){return o.a.error(e),void this.setState({customThemeMessage:{text:Object(l.a)("Error downloading theme information."),isError:!0}})}await c.b.setValue("custom_themes",null,f.a.ACCOUNT,e),this.setState({customThemeUrl:"",customThemeMessage:{text:Object(l.a)("Theme added!"),isError:!1}}),this.themeTimer=window.setTimeout((()=>{this.setState({customThemeMessage:{text:"",isError:!1}})}),3e3)})),i()(this,"onCustomThemeChange",(e=>{this.setState({customThemeUrl:e.target.value})})),this.state=_(_({},S.calculateThemeState()),{},{customThemeUrl:"",customThemeMessage:{isError:!1,text:""}})}static calculateThemeState(){const e=c.b.getValue("theme"),t=c.b.getValueAt(f.a.DEVICE,"use_system_theme",null,!1,!0),a=c.b.getValueAt(f.a.DEVICE,"theme",null,!1,!0);return t?{theme:e,useSystemTheme:!0}:a?{theme:e,useSystemTheme:!1}:{theme:e,useSystemTheme:c.b.getValueAt(f.a.DEVICE,"use_system_theme")}}renderHighContrastCheckbox(){if(!this.state.useSystemTheme&&(Object(d.c)(this.state.theme)||Object(d.g)(this.state.theme)))return r.a.createElement("div",null,r.a.createElement(g.b,{checked:Object(d.g)(this.state.theme),onChange:e=>this.highContrastThemeChanged(e.target.checked)},Object(l.a)("Use high contrast")))}highContrastThemeChanged(e){let t;t=e?Object(d.c)(this.state.theme):Object(d.d)(this.state.theme),t&&this.onThemeChange(t)}render(){let e,t;if((new m.a).isSystemThemeSupported()&&(e=r.a.createElement("div",null,r.a.createElement(g.b,{checked:this.state.useSystemTheme,onChange:e=>this.onUseSystemThemeChanged(e.target.checked)},c.b.getDisplayName("use_system_theme")))),c.b.getValue("feature_custom_themes")){let e;this.state.customThemeMessage.text&&(e=this.state.customThemeMessage.isError?r.a.createElement("div",{className:"text-error"},this.state.customThemeMessage.text):r.a.createElement("div",{className:"text-success"},this.state.customThemeMessage.text)),t=r.a.createElement("div",{className:"mx_SettingsTab_section"},r.a.createElement("form",{onSubmit:this.onAddCustomTheme},r.a.createElement(v.a,{label:Object(l.a)("Custom theme URL"),type:"text",id:"mx_GeneralUserSettingsTab_customThemeInput",autoComplete:"off",onChange:this.onCustomThemeChange,value:this.state.customThemeUrl}),r.a.createElement(u.a,{onClick:this.onAddCustomTheme,type:"submit",kind:"primary_sm",disabled:!this.state.customThemeUrl.trim()},Object(l.a)("Add theme")),e))}const a=Object(d.f)();return r.a.createElement("div",{className:"mx_SettingsTab_section mx_ThemeChoicePanel"},r.a.createElement("span",{className:"mx_SettingsTab_subheading"},Object(l.a)("Theme")),e,r.a.createElement("div",{className:"mx_ThemeSelectors"},r.a.createElement(b.a,{name:"theme",definitions:a.map((e=>({value:e.id,label:e.name,disabled:this.state.useSystemTheme,className:"mx_ThemeSelector_"+e.id}))),onChange:this.onThemeChange,value:this.apparentSelectedThemeId(),outlined:!0})),this.renderHighContrastCheckbox(),t)}apparentSelectedThemeId(){if(this.state.useSystemTheme)return;const e=Object(d.d)(this.state.theme);return e||this.state.theme}}},896:function(e,t,a){"use strict";t.__esModule=!0,t.setBatch=t.getBatch=void 0;var n=function(e){e()};t.setBatch=function(e){return n=e};t.getBatch=function(){return n}},897:function(e,t,a){"use strict";var n=a(172).default,i=a(240).default;t.__esModule=!0,t.default=function(e,t){void 0===t&&(t={});var a=t,n=a.getDisplayName,i=void 0===n?function(e){return"ConnectAdvanced("+e+")"}:n,m=a.methodName,S=void 0===m?"connectAdvanced":m,w=a.renderCountProp,O=void 0===w?void 0:w,C=a.shouldHandleStateChanges,x=void 0===C||C,k=a.storeKey,j=void 0===k?"store":k,R=(a.withRef,a.forwardRef),I=void 0!==R&&R,T=a.context,N=void 0===T?u.ReactReduxContext:T,D=(0,r.default)(a,h);0;var P=N;return function(t){var a=t.displayName||t.name||"Component",n=i(a),m=(0,s.default)({},D,{getDisplayName:i,methodName:S,renderCountProp:O,shouldHandleStateChanges:x,storeKey:j,displayName:n,wrappedComponentName:a,WrappedComponent:t}),u=D.pure;var h=u?l.useMemo:function(e){return e()};function w(a){var n=(0,l.useMemo)((function(){var e=a.reactReduxForwardedRef,t=(0,r.default)(a,p);return[a.context,e,t]}),[a]),i=n[0],o=n[1],u=n[2],S=(0,l.useMemo)((function(){return i&&i.Consumer&&(0,c.isContextConsumer)(l.default.createElement(i.Consumer,null))?i:P}),[i,P]),w=(0,l.useContext)(S),O=Boolean(a.store)&&Boolean(a.store.getState)&&Boolean(a.store.dispatch);Boolean(w)&&Boolean(w.store);var C=O?a.store:w.store,k=(0,l.useMemo)((function(){return function(t){return e(t.dispatch,m)}(C)}),[C]),j=(0,l.useMemo)((function(){if(!x)return v;var e=(0,d.createSubscription)(C,O?null:w.subscription),t=e.notifyNestedSubs.bind(e);return[e,t]}),[C,O,w]),R=j[0],I=j[1],T=(0,l.useMemo)((function(){return O?w:(0,s.default)({},w,{subscription:R})}),[O,w,R]),N=(0,l.useReducer)(b,g,_),D=N[0][0],M=N[1];if(D&&D.error)throw D.error;var A=(0,l.useRef)(),L=(0,l.useRef)(u),U=(0,l.useRef)(),F=(0,l.useRef)(!1),B=h((function(){return U.current&&u===L.current?U.current:k(C.getState(),u)}),[C,D,u]);f(y,[L,A,F,u,B,U,I]),f(E,[x,C,R,k,L,A,F,U,I,M],[C,R,k]);var V=(0,l.useMemo)((function(){return l.default.createElement(t,(0,s.default)({},B,{ref:o}))}),[o,t,B]);return(0,l.useMemo)((function(){return x?l.default.createElement(S.Provider,{value:T},V):V}),[S,V,T])}var C=u?l.default.memo(w):w;if(C.WrappedComponent=t,C.displayName=w.displayName=n,I){var k=l.default.forwardRef((function(e,t){return l.default.createElement(C,(0,s.default)({},e,{reactReduxForwardedRef:t}))}));return k.displayName=n,k.WrappedComponent=t,(0,o.default)(k,t)}return(0,o.default)(C,t)}};var s=n(a(130)),r=n(a(405)),o=n(a(1497)),l=i(a(120)),c=a(1500),d=a(636),m=a(637),u=a(313),h=["getDisplayName","methodName","renderCountProp","shouldHandleStateChanges","storeKey","withRef","forwardRef","context"],p=["reactReduxForwardedRef"],g=[],v=[null,null];function b(e,t){var a=e[1];return[t.payload,a+1]}function f(e,t,a){(0,m.useIsomorphicLayoutEffect)((function(){return e.apply(void 0,t)}),a)}function y(e,t,a,n,i,s,r){e.current=n,t.current=i,a.current=!1,s.current&&(s.current=null,r())}function E(e,t,a,n,i,s,r,o,l,c){if(e){var d=!1,m=null,u=function(){if(!d){var e,a,u=t.getState();try{e=n(u,i.current)}catch(e){a=e,m=e}a||(m=null),e===s.current?r.current||l():(s.current=e,o.current=e,r.current=!0,c({type:"STORE_UPDATED",payload:{error:a}}))}};a.onStateChange=u,a.trySubscribe(),u();return function(){if(d=!0,a.tryUnsubscribe(),a.onStateChange=null,m)throw m}}}var _=function(){return[null,0]}},898:function(e,t,a){"use strict";function n(e,t){return e===t?0!==e||0!==t||1/e==1/t:e!=e&&t!=t}t.__esModule=!0,t.default=function(e,t){if(n(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;var a=Object.keys(e),i=Object.keys(t);if(a.length!==i.length)return!1;for(var s=0;s<a.length;s++)if(!Object.prototype.hasOwnProperty.call(t,a[s])||!n(e[a[s]],t[a[s]]))return!1;return!0}},899:function(e,t,a){"use strict";var n=a(172).default;t.__esModule=!0,t.getDependsOnOwnProps=i,t.wrapMapToPropsConstant=function(e){return function(t,a){var n=e(t,a);function i(){return n}return i.dependsOnOwnProps=!1,i}},t.wrapMapToPropsFunc=function(e,t){return function(t,a){a.displayName;var n=function(e,t){return n.dependsOnOwnProps?n.mapToProps(e,t):n.mapToProps(e)};return n.dependsOnOwnProps=!0,n.mapToProps=function(t,a){n.mapToProps=e,n.dependsOnOwnProps=i(e);var s=n(t,a);return"function"==typeof s&&(n.mapToProps=s,n.dependsOnOwnProps=i(s),s=n(t,a)),s},n}};n(a(900));function i(e){return null!==e.dependsOnOwnProps&&void 0!==e.dependsOnOwnProps?Boolean(e.dependsOnOwnProps):1!==e.length}},900:function(e,t,a){"use strict";var n=a(172).default;t.__esModule=!0,t.default=function(e,t,a){(0,i.default)(e)||(0,s.default)(a+"() in "+t+" must return a plain object. Instead received "+e+".")};var i=n(a(1505)),s=n(a(901))},901:function(e,t,a){"use strict";t.__esModule=!0,t.default=function(e){"undefined"!=typeof console&&"function"==typeof console.error&&console.error(e);try{throw new Error(e)}catch(e){}}},902:function(e,t,a){"use strict";t.__esModule=!0,t.createStoreHook=r,t.useStore=void 0;var n=a(120),i=a(313),s=a(903);function r(e){void 0===e&&(e=i.ReactReduxContext);var t=e===i.ReactReduxContext?s.useReduxContext:function(){return(0,n.useContext)(e)};return function(){return t().store}}var o=r();t.useStore=o},903:function(e,t,a){"use strict";t.__esModule=!0,t.useReduxContext=function(){0;return(0,n.useContext)(i.ReactReduxContext)};var n=a(120),i=a(313)},904:function(e,t,a){"use strict";a.d(t,"a",(function(){return p}));var n=a(126),i=a.n(n),s=a(129),r=a(120),o=a.n(r),l=a(133),c=a(138),d=a(614),m=a(293),u=a(123),h=a(134);const p=52;t.b=e=>{var t;let{hasAvatar:a,hasAvatarLabel:n,noAvatarLabel:p,setAvatarUrl:g,isUserAvatar:v,children:b,onClick:f}=e;const y=Object(r.useContext)(l.a),[E,_]=Object(r.useState)(!1),[S,w]=Object(r.useState)(!1),[O,C]=Object(r.useState)(!1);Object(d.c)((()=>{C(!0)}),3e3),Object(d.c)((()=>{C(!1)}),13e3);const x=Object(r.useRef)(),k=a||E?n:p,{room:j}=Object(r.useContext)(c.b);if(!(v||(null==j||null===(t=j.currentState)||void 0===t?void 0:t.maySendStateEvent(s.b.RoomAvatar,y.getUserId()))))return o.a.createElement(o.a.Fragment,null,b);const R=!!k&&(S||O);return o.a.createElement(o.a.Fragment,null,o.a.createElement("input",{type:"file",ref:x,className:"mx_MiniAvatarUploader_input",onClick:e=>{Object(m.a)(e),null==f||f(e)},onChange:async e=>{var t;if(null===(t=e.target.files)||void 0===t||!t.length)return;_(!0);const a=e.target.files[0],{content_uri:n}=await y.uploadContent(a);await g(n),_(!1)},accept:"image/*"}),o.a.createElement(u.a,{className:i()("mx_MiniAvatarUploader",{mx_MiniAvatarUploader_busy:E,mx_MiniAvatarUploader_hasAvatar:a}),disabled:E,onClick:()=>{x.current.click()},onMouseOver:()=>w(!0),onMouseLeave:()=>w(!1)},b,o.a.createElement("div",{className:"mx_MiniAvatarUploader_indicator"},E?o.a.createElement(h.a,{w:20,h:20}):o.a.createElement("div",{className:"mx_MiniAvatarUploader_cameraIcon"})),o.a.createElement("div",{className:i()("mx_Tooltip",{mx_Tooltip_visible:R,mx_Tooltip_invisible:!R})},o.a.createElement("div",{className:"mx_Tooltip_chevron"}),k)))}},905:function(e,t){e.exports="img/user-onboarding/PersonalMessaging.b5ba3c4.png"},906:function(e,t,a){"use strict";a.d(t,"a",(function(){return i})),a.d(t,"b",(function(){return s})),a.d(t,"c",(function(){return r})),a.d(t,"d",(function(){return o}));var n=a(121);let i,s;!function(e){e.Html="Html",e.PlainText="PlainText",e.Json="Json"}(i||(i={})),function(e){e.Timeline="Timeline",e.Beginning="Beginning",e.LastNMessages="LastNMessages"}(s||(s={}));const r=e=>{switch(e){case i.Html:return Object(n.a)("HTML");case i.Json:return Object(n.a)("JSON");case i.PlainText:return Object(n.a)("Plain Text");default:throw new Error("Unknown format")}},o=e=>{switch(e){case s.Beginning:return Object(n.a)("From the beginning");case s.LastNMessages:return Object(n.a)("Specify a number of messages");case s.Timeline:return Object(n.a)("Current Timeline");default:throw new Error("Unknown type: "+e)}}},907:function(e,t,a){"use strict";(function(e){var n=a(120),i=a.n(n),s=a(129),r=a(133),o=a(138),l=a(165),c=a(121),d=a(123),m=a(904),u=a(162),h=a(124),p=a(128),g=a(178),v=a(250),b=a(310),f=a(401),y=a(122),E=a(220),_=a(156),S=a(389),w=a(299);t.a=()=>{var t;const a=Object(n.useContext)(r.a),{room:O,roomId:C}=Object(n.useContext)(o.b),x=O instanceof w.b,k=x?null===(t=O.targets[0])||void 0===t?void 0:t.userId:l.a.shared().getUserIdForRoomId(C);let j;if(k){let e,t=Object(c.a)("This is the beginning of your direct message history with <displayName/>.");x?t=Object(c.a)("Send your first message to invite <displayName/> to chat"):O.getJoinedMemberCount()+O.getInvitedMemberCount()===2&&(e=Object(c.a)("Only the two of you are in this conversation, unless either of you invites anyone to join."));const a=null==O?void 0:O.getMember(k),n=(null==O?void 0:O.name)||(null==a?void 0:a.rawDisplayName)||k;j=i.a.createElement(i.a.Fragment,null,i.a.createElement(u.a,{room:O,width:m.a,height:m.a,onClick:()=>{h.a.dispatch({action:p.a.ViewUser,member:a||{userId:k}})}}),i.a.createElement("h2",null,O.name),i.a.createElement("p",null,Object(c.a)(t,{},{displayName:()=>i.a.createElement("b",null,n)})),e&&i.a.createElement("p",null,e))}else{var R,I,T,N,D,P,M;const t=O&&"join"===O.getMyMembership(),n=null===(R=O.currentState.getStateEvents(s.b.RoomTopic,""))||void 0===R||null===(I=R.getContent())||void 0===I?void 0:I.topic,r=t&&O.currentState.maySendStateEvent(s.b.RoomTopic,a.getUserId()),o=()=>{h.a.dispatch({action:"open_room_settings",room_id:C},!0),e((()=>{window.document.getElementById("profileTopic").focus()}))};let l;r&&n?l=Object(c.a)("Topic: %(topic)s (<a>edit</a>)",{topic:n},{a:e=>i.a.createElement(d.a,{kind:"link_inline",onClick:o},e)}):n?l=Object(c.a)("Topic: %(topic)s ",{topic:n}):r&&(l=Object(c.a)("<a>Add a topic</a> to help people know what it is about.",{},{a:e=>i.a.createElement(d.a,{kind:"link_inline",onClick:o},e)}));const p=null===(T=O.currentState.getStateEvents(s.b.RoomCreate,""))||void 0===T?void 0:T.getSender(),b=(null==O||null===(N=O.getMember(p))||void 0===N?void 0:N.rawDisplayName)||p;let f,y,S;f=p===a.getUserId()?Object(c.a)("You created this room."):Object(c.a)("%(displayName)s created this room.",{displayName:b}),null!==(D=g.a.instance.activeSpaceRoom)&&void 0!==D&&D.canInvite(a.getUserId())&&g.a.instance.isRoomInSpace(g.a.instance.activeSpace,O.roomId)&&(y=g.a.instance.activeSpaceRoom),y&&Object(E.a)(_.a.InviteUsers)?S=i.a.createElement("div",{className:"mx_NewRoomIntro_buttons"},i.a.createElement(d.a,{className:"mx_NewRoomIntro_inviteButton",kind:"primary",onClick:()=>{Object(v.i)(y)}},Object(c.a)("Invite to %(spaceName)s",{spaceName:y.name})),O.canInvite(a.getUserId())&&i.a.createElement(d.a,{className:"mx_NewRoomIntro_inviteButton",kind:"primary_outline",onClick:()=>{h.a.dispatch({action:"view_invite",roomId:C})}},Object(c.a)("Invite to just this room"))):O.canInvite(a.getUserId())&&Object(E.a)(_.a.InviteUsers)&&(S=i.a.createElement("div",{className:"mx_NewRoomIntro_buttons"},i.a.createElement(d.a,{className:"mx_NewRoomIntro_inviteButton",kind:"primary",onClick:()=>{h.a.dispatch({action:"view_invite",roomId:C})}},Object(c.a)("Invite to this room"))));const w=null===(P=O.currentState.getStateEvents(s.b.RoomAvatar,""))||void 0===P||null===(M=P.getContent())||void 0===M?void 0:M.url;let x=i.a.createElement(u.a,{room:O,width:m.a,height:m.a,viewAvatarOnClick:!!w});w||(x=i.a.createElement(m.b,{hasAvatar:!1,noAvatarLabel:Object(c.a)("Add a photo, so people can easily spot your room."),setAvatarUrl:e=>a.sendStateEvent(C,s.b.RoomAvatar,{url:e},"")},x)),j=i.a.createElement(i.a.Fragment,null,x,i.a.createElement("h2",null,O.name),i.a.createElement("p",null,f," ",Object(c.a)("This is the start of <roomName/>.",{},{roomName:()=>i.a.createElement("b",null,O.name)})),i.a.createElement("p",null,l),S)}const A=Object(c.a)("Your private messages are normally encrypted, but this room isn't. Usually this is due to an unsupported device or method being used, like email invites.");let L;O.currentState.mayClientSendStateEvent(s.b.RoomEncryption,y.a.get())&&!x&&(L=i.a.createElement(d.a,{kind:"link_inline",onClick:function(e){e.preventDefault(),h.a.dispatch({action:"open_room_settings",initial_tab_id:f.b})}},Object(c.a)("Enable encryption in settings.")));const U=i.a.createElement("span",null," ",A," ",L," ");return i.a.createElement("li",{className:"mx_NewRoomIntro"},!function(e,t){const a=e.isRoomEncrypted(t.roomId);return"public"===t.getJoinRule()||!Object(S.a)()||a}(a,O)&&i.a.createElement(b.a,{className:"mx_cryptoEvent mx_cryptoEvent_icon_warning",title:Object(c.a)("End-to-end encryption isn't enabled"),subtitle:U}),j)}}).call(this,a(54).setImmediate)},909:function(e,t,a){"use strict";a.d(t,"a",(function(){return r}));var n,i=a(120);function s(){return s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},s.apply(this,arguments)}function r(e){return i.createElement("svg",s({fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 18 14",role:"presentation","aria-hidden":!0},e),n||(n=i.createElement("path",{d:"M17 7H1m0 0l6 6M1 7l6-6",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})))}},910:function(e,t,a){"use strict";a.d(t,"a",(function(){return y})),a.d(t,"c",(function(){return E})),a.d(t,"b",(function(){return _}));var n=a(120),i=a.n(n),s=a(121),r=a(131),o=a(124),l=a(123),c=a(235),d=a(198),m=a(911),u=a(128),h=a(125);const p=()=>{o.a.dispatch({action:u.a.PseudonymousAnalyticsAccept})},g=()=>{o.a.dispatch({action:u.a.PseudonymousAnalyticsReject})},v=()=>{Object(m.b)({onFinished:e=>{e===m.a.Primary&&p()},primaryButton:Object(s.a)("Enable")})},b=()=>{Object(m.b)({onFinished:e=>{e===m.a.Primary?p():e===m.a.Cancel&&g()},primaryButton:Object(s.a)("That's fine"),cancelButton:Object(s.a)("Stop")})},f="analytics";function y(){return r.b.get("privacy_policy_url")}const E=()=>{var e;const t=h.b.getValue("analyticsOptIn",null,!0);let a;if(t)a={description:Object(s.a)("You previously consented to share anonymous usage data with us. We're updating how that works."),acceptLabel:Object(s.a)("That's fine"),onAccept:p,rejectLabel:Object(s.a)("Learn more"),onReject:b};else{if(null!=t)return;{const e=e=>i.a.createElement(l.a,{kind:"link_inline",onClick:v},e);a={description:Object(s.a)("Share anonymous data to help us identify issues. Nothing personal. No third parties. <LearnMoreLink>Learn More</LearnMoreLink>",{},{LearnMoreLink:e}),acceptLabel:Object(s.a)("Yes"),onAccept:p,rejectLabel:Object(s.a)("No"),onReject:g}}}const n=null!==(e=r.b.get("analytics_owner"))&&void 0!==e?e:r.b.get().brand;d.a.sharedInstance().addOrReplaceToast({key:f,title:Object(s.a)("Help improve %(analyticsOwner)s",{analyticsOwner:n}),props:a,component:c.a,className:"mx_AnalyticsToast",priority:10})},_=()=>{d.a.sharedInstance().dismissToast(f)}},911:function(e,t,a){"use strict";a.d(t,"a",(function(){return p})),a.d(t,"b",(function(){return v}));var n=a(13),i=a.n(n),s=a(120),r=a.n(s),o=a(135),l=a(121),c=a(145),d=a(127),m=a(131),u=a(910);function h(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}let p;!function(e){e[e.Primary=0]="Primary",e[e.Cancel=1]="Cancel"}(p||(p={}));const g=e=>{let{onFinished:t,analyticsOwner:a,privacyPolicyUrl:n,primaryButton:i,cancelButton:s,hasCancel:d}=e;const m=n?r.a.createElement("span",null,Object(l.a)("You can read all our terms <PrivacyPolicyUrl>here</PrivacyPolicyUrl>",{},{PrivacyPolicyUrl:e=>r.a.createElement("a",{href:n,rel:"norefferer noopener",target:"_blank"},e,r.a.createElement("span",{className:"mx_AnalyticsPolicyLink"}))})):"";return r.a.createElement(o.a,{className:"mx_AnalyticsLearnMoreDialog",contentId:"mx_AnalyticsLearnMore",title:Object(l.a)("Help improve %(analyticsOwner)s",{analyticsOwner:a}),onFinished:t},r.a.createElement("div",{className:"mx_Dialog_content"},r.a.createElement("div",{className:"mx_AnalyticsLearnMore_image_holder"}),r.a.createElement("div",{className:"mx_AnalyticsLearnMore_copy"},Object(l.a)("Help us identify issues and improve %(analyticsOwner)s by sharing anonymous usage data. To understand how people use multiple devices, we'll generate a random identifier, shared by your devices.",{analyticsOwner:a})),r.a.createElement("ul",{className:"mx_AnalyticsLearnMore_bullets"},r.a.createElement("li",null,Object(l.a)("We <Bold>don't</Bold> record or profile any account data",{},{Bold:e=>r.a.createElement("b",null,e)})),r.a.createElement("li",null,Object(l.a)("We <Bold>don't</Bold> share information with third parties",{},{Bold:e=>r.a.createElement("b",null,e)})),r.a.createElement("li",null,Object(l.a)("You can turn this off anytime in settings"))),m),r.a.createElement(c.a,{primaryButton:i,cancelButton:s,onPrimaryButtonClick:()=>null==t?void 0:t(p.Primary),onCancel:()=>null==t?void 0:t(p.Cancel),hasCancel:d}))},v=e=>{var t;const a=Object(u.a)(),n=null!==(t=m.b.get("analytics_owner"))&&void 0!==t?t:m.b.get("brand");d.b.createDialog(g,function(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?h(Object(a),!0).forEach((function(t){i()(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):h(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}({privacyPolicyUrl:a,analyticsOwner:n},e),"mx_AnalyticsLearnMoreDialog_wrapper")}},912:function(e,t,a){"use strict";a.d(t,"a",(function(){return m}));var n=a(13),i=a.n(n),s=a(120),r=a.n(s),o=a(121),l=a(125),c=a(134),d=a(279);class m extends r.a.Component{constructor(e){super(e),i()(this,"onSearchChange",(e=>{this.setState({searchQuery:e})})),this.state={searchQuery:"",langs:null}}componentDidMount(){if(o.d().then((e=>{e.sort((function(e,t){return e.label<t.label?-1:e.label>t.label?1:0})),this.setState({langs:e})})).catch((()=>{this.setState({langs:[{value:"en",label:"English"}]})})),!this.props.value){const e=o.h();this.props.onOptionChange(e)}}render(){if(null===this.state.langs)return r.a.createElement(c.a,null);let e;e=this.state.searchQuery?this.state.langs.filter((e=>function(e,t){return!!t.label.toUpperCase().includes(e.toUpperCase())||t.value.toUpperCase()===e.toUpperCase()}(this.state.searchQuery,e))):this.state.langs;const t=e.map((e=>r.a.createElement("div",{key:e.value},e.label)));let a=l.b.getValue("language",null,!0),n=null;return a||(a=navigator.language||navigator.userLanguage),n=this.props.value||a,r.a.createElement(d.a,{id:"mx_LanguageDropdown",className:this.props.className,onOptionChange:this.props.onOptionChange,onSearchChange:this.onSearchChange,searchEnabled:!0,value:n,label:Object(o.a)("Language Dropdown"),disabled:this.props.disabled},t)}}},913:function(e,t,a){"use strict";a.d(t,"c",(function(){return s})),a.d(t,"b",(function(){return l})),a.d(t,"a",(function(){return c}));var n=a(121);const i=/^[0-9 -.]+$/;function s(e){return i.test(e)}const r=127462-"A".charCodeAt(0),o=/^[A-Z]{2}$/,l=e=>o.test(e)?String.fromCodePoint(...e.split("").map((e=>r+e.charCodeAt(0)))):"",c=[{iso2:"GB",name:Object(n.c)("United Kingdom"),prefix:"44"},{iso2:"US",name:Object(n.c)("United States"),prefix:"1"},{iso2:"AF",name:Object(n.c)("Afghanistan"),prefix:"93"},{iso2:"AX",name:Object(n.c)("Åland Islands"),prefix:"358"},{iso2:"AL",name:Object(n.c)("Albania"),prefix:"355"},{iso2:"DZ",name:Object(n.c)("Algeria"),prefix:"213"},{iso2:"AS",name:Object(n.c)("American Samoa"),prefix:"1"},{iso2:"AD",name:Object(n.c)("Andorra"),prefix:"376"},{iso2:"AO",name:Object(n.c)("Angola"),prefix:"244"},{iso2:"AI",name:Object(n.c)("Anguilla"),prefix:"1"},{iso2:"AQ",name:Object(n.c)("Antarctica"),prefix:"672"},{iso2:"AG",name:Object(n.c)("Antigua & Barbuda"),prefix:"1"},{iso2:"AR",name:Object(n.c)("Argentina"),prefix:"54"},{iso2:"AM",name:Object(n.c)("Armenia"),prefix:"374"},{iso2:"AW",name:Object(n.c)("Aruba"),prefix:"297"},{iso2:"AU",name:Object(n.c)("Australia"),prefix:"61"},{iso2:"AT",name:Object(n.c)("Austria"),prefix:"43"},{iso2:"AZ",name:Object(n.c)("Azerbaijan"),prefix:"994"},{iso2:"BS",name:Object(n.c)("Bahamas"),prefix:"1"},{iso2:"BH",name:Object(n.c)("Bahrain"),prefix:"973"},{iso2:"BD",name:Object(n.c)("Bangladesh"),prefix:"880"},{iso2:"BB",name:Object(n.c)("Barbados"),prefix:"1"},{iso2:"BY",name:Object(n.c)("Belarus"),prefix:"375"},{iso2:"BE",name:Object(n.c)("Belgium"),prefix:"32"},{iso2:"BZ",name:Object(n.c)("Belize"),prefix:"501"},{iso2:"BJ",name:Object(n.c)("Benin"),prefix:"229"},{iso2:"BM",name:Object(n.c)("Bermuda"),prefix:"1"},{iso2:"BT",name:Object(n.c)("Bhutan"),prefix:"975"},{iso2:"BO",name:Object(n.c)("Bolivia"),prefix:"591"},{iso2:"BA",name:Object(n.c)("Bosnia"),prefix:"387"},{iso2:"BW",name:Object(n.c)("Botswana"),prefix:"267"},{iso2:"BV",name:Object(n.c)("Bouvet Island"),prefix:"47"},{iso2:"BR",name:Object(n.c)("Brazil"),prefix:"55"},{iso2:"IO",name:Object(n.c)("British Indian Ocean Territory"),prefix:"246"},{iso2:"VG",name:Object(n.c)("British Virgin Islands"),prefix:"1"},{iso2:"BN",name:Object(n.c)("Brunei"),prefix:"673"},{iso2:"BG",name:Object(n.c)("Bulgaria"),prefix:"359"},{iso2:"BF",name:Object(n.c)("Burkina Faso"),prefix:"226"},{iso2:"BI",name:Object(n.c)("Burundi"),prefix:"257"},{iso2:"KH",name:Object(n.c)("Cambodia"),prefix:"855"},{iso2:"CM",name:Object(n.c)("Cameroon"),prefix:"237"},{iso2:"CA",name:Object(n.c)("Canada"),prefix:"1"},{iso2:"CV",name:Object(n.c)("Cape Verde"),prefix:"238"},{iso2:"BQ",name:Object(n.c)("Caribbean Netherlands"),prefix:"599"},{iso2:"KY",name:Object(n.c)("Cayman Islands"),prefix:"1"},{iso2:"CF",name:Object(n.c)("Central African Republic"),prefix:"236"},{iso2:"TD",name:Object(n.c)("Chad"),prefix:"235"},{iso2:"CL",name:Object(n.c)("Chile"),prefix:"56"},{iso2:"CN",name:Object(n.c)("China"),prefix:"86"},{iso2:"CX",name:Object(n.c)("Christmas Island"),prefix:"61"},{iso2:"CC",name:Object(n.c)("Cocos (Keeling) Islands"),prefix:"61"},{iso2:"CO",name:Object(n.c)("Colombia"),prefix:"57"},{iso2:"KM",name:Object(n.c)("Comoros"),prefix:"269"},{iso2:"CG",name:Object(n.c)("Congo - Brazzaville"),prefix:"242"},{iso2:"CD",name:Object(n.c)("Congo - Kinshasa"),prefix:"243"},{iso2:"CK",name:Object(n.c)("Cook Islands"),prefix:"682"},{iso2:"CR",name:Object(n.c)("Costa Rica"),prefix:"506"},{iso2:"HR",name:Object(n.c)("Croatia"),prefix:"385"},{iso2:"CU",name:Object(n.c)("Cuba"),prefix:"53"},{iso2:"CW",name:Object(n.c)("Curaçao"),prefix:"599"},{iso2:"CY",name:Object(n.c)("Cyprus"),prefix:"357"},{iso2:"CZ",name:Object(n.c)("Czech Republic"),prefix:"420"},{iso2:"CI",name:Object(n.c)("Côte dIvoire"),prefix:"225"},{iso2:"DK",name:Object(n.c)("Denmark"),prefix:"45"},{iso2:"DJ",name:Object(n.c)("Djibouti"),prefix:"253"},{iso2:"DM",name:Object(n.c)("Dominica"),prefix:"1"},{iso2:"DO",name:Object(n.c)("Dominican Republic"),prefix:"1"},{iso2:"EC",name:Object(n.c)("Ecuador"),prefix:"593"},{iso2:"EG",name:Object(n.c)("Egypt"),prefix:"20"},{iso2:"SV",name:Object(n.c)("El Salvador"),prefix:"503"},{iso2:"GQ",name:Object(n.c)("Equatorial Guinea"),prefix:"240"},{iso2:"ER",name:Object(n.c)("Eritrea"),prefix:"291"},{iso2:"EE",name:Object(n.c)("Estonia"),prefix:"372"},{iso2:"ET",name:Object(n.c)("Ethiopia"),prefix:"251"},{iso2:"FK",name:Object(n.c)("Falkland Islands"),prefix:"500"},{iso2:"FO",name:Object(n.c)("Faroe Islands"),prefix:"298"},{iso2:"FJ",name:Object(n.c)("Fiji"),prefix:"679"},{iso2:"FI",name:Object(n.c)("Finland"),prefix:"358"},{iso2:"FR",name:Object(n.c)("France"),prefix:"33"},{iso2:"GF",name:Object(n.c)("French Guiana"),prefix:"594"},{iso2:"PF",name:Object(n.c)("French Polynesia"),prefix:"689"},{iso2:"TF",name:Object(n.c)("French Southern Territories"),prefix:"262"},{iso2:"GA",name:Object(n.c)("Gabon"),prefix:"241"},{iso2:"GM",name:Object(n.c)("Gambia"),prefix:"220"},{iso2:"GE",name:Object(n.c)("Georgia"),prefix:"995"},{iso2:"DE",name:Object(n.c)("Germany"),prefix:"49"},{iso2:"GH",name:Object(n.c)("Ghana"),prefix:"233"},{iso2:"GI",name:Object(n.c)("Gibraltar"),prefix:"350"},{iso2:"GR",name:Object(n.c)("Greece"),prefix:"30"},{iso2:"GL",name:Object(n.c)("Greenland"),prefix:"299"},{iso2:"GD",name:Object(n.c)("Grenada"),prefix:"1"},{iso2:"GP",name:Object(n.c)("Guadeloupe"),prefix:"590"},{iso2:"GU",name:Object(n.c)("Guam"),prefix:"1"},{iso2:"GT",name:Object(n.c)("Guatemala"),prefix:"502"},{iso2:"GG",name:Object(n.c)("Guernsey"),prefix:"44"},{iso2:"GN",name:Object(n.c)("Guinea"),prefix:"224"},{iso2:"GW",name:Object(n.c)("Guinea-Bissau"),prefix:"245"},{iso2:"GY",name:Object(n.c)("Guyana"),prefix:"592"},{iso2:"HT",name:Object(n.c)("Haiti"),prefix:"509"},{iso2:"HM",name:Object(n.c)("Heard & McDonald Islands"),prefix:"672"},{iso2:"HN",name:Object(n.c)("Honduras"),prefix:"504"},{iso2:"HK",name:Object(n.c)("Hong Kong"),prefix:"852"},{iso2:"HU",name:Object(n.c)("Hungary"),prefix:"36"},{iso2:"IS",name:Object(n.c)("Iceland"),prefix:"354"},{iso2:"IN",name:Object(n.c)("India"),prefix:"91"},{iso2:"ID",name:Object(n.c)("Indonesia"),prefix:"62"},{iso2:"IR",name:Object(n.c)("Iran"),prefix:"98"},{iso2:"IQ",name:Object(n.c)("Iraq"),prefix:"964"},{iso2:"IE",name:Object(n.c)("Ireland"),prefix:"353"},{iso2:"IM",name:Object(n.c)("Isle of Man"),prefix:"44"},{iso2:"IL",name:Object(n.c)("Israel"),prefix:"972"},{iso2:"IT",name:Object(n.c)("Italy"),prefix:"39"},{iso2:"JM",name:Object(n.c)("Jamaica"),prefix:"1"},{iso2:"JP",name:Object(n.c)("Japan"),prefix:"81"},{iso2:"JE",name:Object(n.c)("Jersey"),prefix:"44"},{iso2:"JO",name:Object(n.c)("Jordan"),prefix:"962"},{iso2:"KZ",name:Object(n.c)("Kazakhstan"),prefix:"7"},{iso2:"KE",name:Object(n.c)("Kenya"),prefix:"254"},{iso2:"KI",name:Object(n.c)("Kiribati"),prefix:"686"},{iso2:"XK",name:Object(n.c)("Kosovo"),prefix:"383"},{iso2:"KW",name:Object(n.c)("Kuwait"),prefix:"965"},{iso2:"KG",name:Object(n.c)("Kyrgyzstan"),prefix:"996"},{iso2:"LA",name:Object(n.c)("Laos"),prefix:"856"},{iso2:"LV",name:Object(n.c)("Latvia"),prefix:"371"},{iso2:"LB",name:Object(n.c)("Lebanon"),prefix:"961"},{iso2:"LS",name:Object(n.c)("Lesotho"),prefix:"266"},{iso2:"LR",name:Object(n.c)("Liberia"),prefix:"231"},{iso2:"LY",name:Object(n.c)("Libya"),prefix:"218"},{iso2:"LI",name:Object(n.c)("Liechtenstein"),prefix:"423"},{iso2:"LT",name:Object(n.c)("Lithuania"),prefix:"370"},{iso2:"LU",name:Object(n.c)("Luxembourg"),prefix:"352"},{iso2:"MO",name:Object(n.c)("Macau"),prefix:"853"},{iso2:"MK",name:Object(n.c)("Macedonia"),prefix:"389"},{iso2:"MG",name:Object(n.c)("Madagascar"),prefix:"261"},{iso2:"MW",name:Object(n.c)("Malawi"),prefix:"265"},{iso2:"MY",name:Object(n.c)("Malaysia"),prefix:"60"},{iso2:"MV",name:Object(n.c)("Maldives"),prefix:"960"},{iso2:"ML",name:Object(n.c)("Mali"),prefix:"223"},{iso2:"MT",name:Object(n.c)("Malta"),prefix:"356"},{iso2:"MH",name:Object(n.c)("Marshall Islands"),prefix:"692"},{iso2:"MQ",name:Object(n.c)("Martinique"),prefix:"596"},{iso2:"MR",name:Object(n.c)("Mauritania"),prefix:"222"},{iso2:"MU",name:Object(n.c)("Mauritius"),prefix:"230"},{iso2:"YT",name:Object(n.c)("Mayotte"),prefix:"262"},{iso2:"MX",name:Object(n.c)("Mexico"),prefix:"52"},{iso2:"FM",name:Object(n.c)("Micronesia"),prefix:"691"},{iso2:"MD",name:Object(n.c)("Moldova"),prefix:"373"},{iso2:"MC",name:Object(n.c)("Monaco"),prefix:"377"},{iso2:"MN",name:Object(n.c)("Mongolia"),prefix:"976"},{iso2:"ME",name:Object(n.c)("Montenegro"),prefix:"382"},{iso2:"MS",name:Object(n.c)("Montserrat"),prefix:"1"},{iso2:"MA",name:Object(n.c)("Morocco"),prefix:"212"},{iso2:"MZ",name:Object(n.c)("Mozambique"),prefix:"258"},{iso2:"MM",name:Object(n.c)("Myanmar"),prefix:"95"},{iso2:"NA",name:Object(n.c)("Namibia"),prefix:"264"},{iso2:"NR",name:Object(n.c)("Nauru"),prefix:"674"},{iso2:"NP",name:Object(n.c)("Nepal"),prefix:"977"},{iso2:"NL",name:Object(n.c)("Netherlands"),prefix:"31"},{iso2:"NC",name:Object(n.c)("New Caledonia"),prefix:"687"},{iso2:"NZ",name:Object(n.c)("New Zealand"),prefix:"64"},{iso2:"NI",name:Object(n.c)("Nicaragua"),prefix:"505"},{iso2:"NE",name:Object(n.c)("Niger"),prefix:"227"},{iso2:"NG",name:Object(n.c)("Nigeria"),prefix:"234"},{iso2:"NU",name:Object(n.c)("Niue"),prefix:"683"},{iso2:"NF",name:Object(n.c)("Norfolk Island"),prefix:"672"},{iso2:"KP",name:Object(n.c)("North Korea"),prefix:"850"},{iso2:"MP",name:Object(n.c)("Northern Mariana Islands"),prefix:"1"},{iso2:"NO",name:Object(n.c)("Norway"),prefix:"47"},{iso2:"OM",name:Object(n.c)("Oman"),prefix:"968"},{iso2:"PK",name:Object(n.c)("Pakistan"),prefix:"92"},{iso2:"PW",name:Object(n.c)("Palau"),prefix:"680"},{iso2:"PS",name:Object(n.c)("Palestine"),prefix:"970"},{iso2:"PA",name:Object(n.c)("Panama"),prefix:"507"},{iso2:"PG",name:Object(n.c)("Papua New Guinea"),prefix:"675"},{iso2:"PY",name:Object(n.c)("Paraguay"),prefix:"595"},{iso2:"PE",name:Object(n.c)("Peru"),prefix:"51"},{iso2:"PH",name:Object(n.c)("Philippines"),prefix:"63"},{iso2:"PN",name:Object(n.c)("Pitcairn Islands"),prefix:"870"},{iso2:"PL",name:Object(n.c)("Poland"),prefix:"48"},{iso2:"PT",name:Object(n.c)("Portugal"),prefix:"351"},{iso2:"PR",name:Object(n.c)("Puerto Rico"),prefix:"1"},{iso2:"QA",name:Object(n.c)("Qatar"),prefix:"974"},{iso2:"RO",name:Object(n.c)("Romania"),prefix:"40"},{iso2:"RU",name:Object(n.c)("Russia"),prefix:"7"},{iso2:"RW",name:Object(n.c)("Rwanda"),prefix:"250"},{iso2:"RE",name:Object(n.c)("Réunion"),prefix:"262"},{iso2:"WS",name:Object(n.c)("Samoa"),prefix:"685"},{iso2:"SM",name:Object(n.c)("San Marino"),prefix:"378"},{iso2:"SA",name:Object(n.c)("Saudi Arabia"),prefix:"966"},{iso2:"SN",name:Object(n.c)("Senegal"),prefix:"221"},{iso2:"RS",name:Object(n.c)("Serbia"),prefix:"381 p"},{iso2:"SC",name:Object(n.c)("Seychelles"),prefix:"248"},{iso2:"SL",name:Object(n.c)("Sierra Leone"),prefix:"232"},{iso2:"SG",name:Object(n.c)("Singapore"),prefix:"65"},{iso2:"SX",name:Object(n.c)("Sint Maarten"),prefix:"1"},{iso2:"SK",name:Object(n.c)("Slovakia"),prefix:"421"},{iso2:"SI",name:Object(n.c)("Slovenia"),prefix:"386"},{iso2:"SB",name:Object(n.c)("Solomon Islands"),prefix:"677"},{iso2:"SO",name:Object(n.c)("Somalia"),prefix:"252"},{iso2:"ZA",name:Object(n.c)("South Africa"),prefix:"27"},{iso2:"GS",name:Object(n.c)("South Georgia & South Sandwich Islands"),prefix:"500"},{iso2:"KR",name:Object(n.c)("South Korea"),prefix:"82"},{iso2:"SS",name:Object(n.c)("South Sudan"),prefix:"211"},{iso2:"ES",name:Object(n.c)("Spain"),prefix:"34"},{iso2:"LK",name:Object(n.c)("Sri Lanka"),prefix:"94"},{iso2:"BL",name:Object(n.c)("St. Barthélemy"),prefix:"590"},{iso2:"SH",name:Object(n.c)("St. Helena"),prefix:"290 n"},{iso2:"KN",name:Object(n.c)("St. Kitts & Nevis"),prefix:"1"},{iso2:"LC",name:Object(n.c)("St. Lucia"),prefix:"1"},{iso2:"MF",name:Object(n.c)("St. Martin"),prefix:"590"},{iso2:"PM",name:Object(n.c)("St. Pierre & Miquelon"),prefix:"508"},{iso2:"VC",name:Object(n.c)("St. Vincent & Grenadines"),prefix:"1"},{iso2:"SD",name:Object(n.c)("Sudan"),prefix:"249"},{iso2:"SR",name:Object(n.c)("Suriname"),prefix:"597"},{iso2:"SJ",name:Object(n.c)("Svalbard & Jan Mayen"),prefix:"47"},{iso2:"SZ",name:Object(n.c)("Swaziland"),prefix:"268"},{iso2:"SE",name:Object(n.c)("Sweden"),prefix:"46"},{iso2:"CH",name:Object(n.c)("Switzerland"),prefix:"41"},{iso2:"SY",name:Object(n.c)("Syria"),prefix:"963"},{iso2:"ST",name:Object(n.c)("São Tomé & Príncipe"),prefix:"239"},{iso2:"TW",name:Object(n.c)("Taiwan"),prefix:"886"},{iso2:"TJ",name:Object(n.c)("Tajikistan"),prefix:"992"},{iso2:"TZ",name:Object(n.c)("Tanzania"),prefix:"255"},{iso2:"TH",name:Object(n.c)("Thailand"),prefix:"66"},{iso2:"TL",name:Object(n.c)("Timor-Leste"),prefix:"670"},{iso2:"TG",name:Object(n.c)("Togo"),prefix:"228"},{iso2:"TK",name:Object(n.c)("Tokelau"),prefix:"690"},{iso2:"TO",name:Object(n.c)("Tonga"),prefix:"676"},{iso2:"TT",name:Object(n.c)("Trinidad & Tobago"),prefix:"1"},{iso2:"TN",name:Object(n.c)("Tunisia"),prefix:"216"},{iso2:"TR",name:Object(n.c)("Turkey"),prefix:"90"},{iso2:"TM",name:Object(n.c)("Turkmenistan"),prefix:"993"},{iso2:"TC",name:Object(n.c)("Turks & Caicos Islands"),prefix:"1"},{iso2:"TV",name:Object(n.c)("Tuvalu"),prefix:"688"},{iso2:"VI",name:Object(n.c)("U.S. Virgin Islands"),prefix:"1"},{iso2:"UG",name:Object(n.c)("Uganda"),prefix:"256"},{iso2:"UA",name:Object(n.c)("Ukraine"),prefix:"380"},{iso2:"AE",name:Object(n.c)("United Arab Emirates"),prefix:"971"},{iso2:"UY",name:Object(n.c)("Uruguay"),prefix:"598"},{iso2:"UZ",name:Object(n.c)("Uzbekistan"),prefix:"998"},{iso2:"VU",name:Object(n.c)("Vanuatu"),prefix:"678"},{iso2:"VA",name:Object(n.c)("Vatican City"),prefix:"39"},{iso2:"VE",name:Object(n.c)("Venezuela"),prefix:"58"},{iso2:"VN",name:Object(n.c)("Vietnam"),prefix:"84"},{iso2:"WF",name:Object(n.c)("Wallis & Futuna"),prefix:"681"},{iso2:"EH",name:Object(n.c)("Western Sahara"),prefix:"212"},{iso2:"YE",name:Object(n.c)("Yemen"),prefix:"967"},{iso2:"ZM",name:Object(n.c)("Zambia"),prefix:"260"},{iso2:"ZW",name:Object(n.c)("Zimbabwe"),prefix:"263"}]},914:function(e,t,a){"use strict";var n=a(13),i=a.n(n),s=a(120),r=a.n(s),o=a(139),l=a(200),c=a(121);class d extends s.PureComponent{constructor(){super(...arguments),i()(this,"validate",Object(l.a)({rules:[{key:"required",test:e=>{let{value:t,allowEmpty:a}=e;return a||!!t},invalid:()=>Object(c.a)(this.props.labelRequired)},{key:"match",test:e=>{let{value:t}=e;return!t||t===this.props.password},invalid:()=>Object(c.a)(this.props.labelInvalid)}]})),i()(this,"onValidate",(async e=>{const t=await this.validate(e);return this.props.onValidate&&this.props.onValidate(t),t}))}render(){return r.a.createElement(o.a,{id:this.props.id,ref:this.props.fieldRef,type:"password",label:Object(c.a)(this.props.label),autoComplete:this.props.autoComplete,value:this.props.value,onChange:this.props.onChange,onValidate:this.onValidate})}}i()(d,"defaultProps",{label:Object(c.c)("Confirm password"),labelRequired:Object(c.c)("Confirm password"),labelInvalid:Object(c.c)("Passwords don't match")}),t.a=d},915:function(e,t,a){"use strict";(function(e){a.d(t,"a",(function(){return m}));var n=a(13),i=a.n(n),s=a(10),r=a(1),o=a(16),l=a(487),c=a(193);const d=new s.UnstableValue("http.v1","org.matrix.msc3886.http.v1");class m{constructor(e){let{onFailure:t,client:a,fallbackRzServer:n,fetchFn:s}=e;i()(this,"uri",void 0),i()(this,"etag",void 0),i()(this,"expiresAt",void 0),i()(this,"client",void 0),i()(this,"fallbackRzServer",void 0),i()(this,"fetchFn",void 0),i()(this,"cancelled",!1),i()(this,"_ready",!1),i()(this,"onFailure",void 0),this.fetchFn=s,this.onFailure=t,this.client=a,this.fallbackRzServer=n}get ready(){return this._ready}async details(){if(!this.uri)throw new Error("Rendezvous not set up");return{type:d.name,uri:this.uri}}fetch(t,a){return this.fetchFn?this.fetchFn(t,a):e.fetch(t,a)}async getPostEndpoint(){try{if(await this.client.doesServerSupportUnstableFeature("org.matrix.msc3886"))return`${this.client.baseUrl}${c.a.Unstable}/org.matrix.msc3886/rendezvous`}catch(e){r.a.warn("Failed to get unstable features",e)}return this.fallbackRzServer}async send(e){var t,a;if(this.cancelled)return;const n=this.uri?"PUT":"POST",i=null!==(t=this.uri)&&void 0!==t?t:await this.getPostEndpoint();if(!i)throw new Error("Invalid rendezvous URI");const s={"content-type":"application/json"};this.etag&&(s["if-match"]=this.etag);const r=await this.fetch(i,{method:n,headers:s,body:JSON.stringify(e)});if(404===r.status)return this.cancel(l.c.Unknown);if(this.etag=null!==(a=r.headers.get("etag"))&&void 0!==a?a:void 0,"POST"===n){var o;const e=r.headers.get("location");if(!e)throw new Error("No rendezvous URI given");const t=r.headers.get("expires");t&&(this.expiresAt=new Date(t));const a=null!==(o=r.url)&&void 0!==o?o:i;this.uri=new URL(e,`${a}${a.endsWith("/")?"":"/"}`).href,this._ready=!0}}async receive(){if(!this.uri)throw new Error("Rendezvous not set up");for(;;){if(this.cancelled)return;const a={};this.etag&&(a["if-none-match"]=this.etag);const n=await this.fetch(this.uri,{method:"GET",headers:a});if(404===n.status)return void this.cancel(l.c.Unknown);var e;if("application/json"!==n.headers.get("content-type"))this.etag=null!==(e=n.headers.get("etag"))&&void 0!==e?e:void 0;else if(200===n.status){var t;return this.etag=null!==(t=n.headers.get("etag"))&&void 0!==t?t:void 0,n.json()}await Object(o.J)(1e3)}}async cancel(e){var t;if(e===l.c.Unknown&&this.expiresAt&&this.expiresAt.getTime()<Date.now()&&(e=l.c.Expired),this.cancelled=!0,this._ready=!1,null===(t=this.onFailure)||void 0===t||t.call(this,e),this.uri&&e===l.c.UserDeclined)try{await this.fetch(this.uri,{method:"DELETE"})}catch(e){r.a.warn(e)}}}}).call(this,a(14))},916:function(e,t,a){"use strict";(function(e){a.d(t,"a",(function(){return d}));var n=a(13),i=a.n(n),s=a(487),r=a(199),o=a(415),l=a(674);const c=new(a(15).c)("m.rendezvous.v1.curve25519-aes-sha256","org.matrix.msc3903.rendezvous.v1.curve25519-aes-sha256");class d{constructor(t,a,n){this.transport=t,this.theirPublicKey=a,this.onFailure=n,i()(this,"olmSAS",void 0),i()(this,"ourPublicKey",void 0),i()(this,"aesKey",void 0),i()(this,"connected",!1),this.olmSAS=new e.Olm.SAS,this.ourPublicKey=Object(r.decodeBase64)(this.olmSAS.get_pubkey())}async generateCode(e){if(this.transport.ready)throw new Error("Code already generated");await this.transport.send({algorithm:c.name});return{rendezvous:{algorithm:c.name,key:Object(r.encodeBase64)(this.ourPublicKey),transport:await this.transport.details()},intent:e}}async connect(){if(this.connected)throw new Error("Channel already connected");if(!this.olmSAS)throw new Error("Channel closed");const e=!this.theirPublicKey;if(e){const e=await this.transport.receive();if(!e)throw new Error("No response from other device");const t=e,{key:a,algorithm:n}=t;if(!n||!c.matches(n)||!a)throw new s.b("Unsupported algorithm: "+n,s.c.UnsupportedAlgorithm);this.theirPublicKey=Object(r.decodeBase64)(a)}else await this.transport.send({algorithm:c.name,key:Object(r.encodeBase64)(this.ourPublicKey)});this.connected=!0,this.olmSAS.set_their_key(Object(r.encodeBase64)(this.theirPublicKey));const t=e?this.ourPublicKey:this.theirPublicKey,a=e?this.theirPublicKey:this.ourPublicKey;let n=c.name;n+=`|${Object(r.encodeBase64)(t)}`,n+=`|${Object(r.encodeBase64)(a)}`;const i=this.olmSAS.generate_bytes(n,32);this.aesKey=await async function(e){if(!o.c)throw new Error("Web Crypto is not available");return o.c.importKey("raw",e,{name:"AES-GCM"},!1,["encrypt","decrypt"])}(i),i.fill(0);const d=this.olmSAS.generate_bytes(n,5);return Object(l.a)(Array.from(d)).join("-")}async encrypt(e){if(!o.c)throw new Error("Web Crypto is not available");const t=new Uint8Array(32);o.b.getRandomValues(t);const a=(new o.a).encode(JSON.stringify(e)),n=await o.c.encrypt({name:"AES-GCM",iv:t,tagLength:128},this.aesKey,a);return{iv:Object(r.encodeBase64)(t),ciphertext:Object(r.encodeBase64)(n)}}async send(e){if(!this.olmSAS)throw new Error("Channel closed");if(!this.aesKey)throw new Error("Shared secret not set up");return this.transport.send(await this.encrypt(e))}async decrypt(e){let{iv:t,ciphertext:a}=e;if(!a||!t)throw new Error("Missing ciphertext and/or iv");const n=Object(r.decodeBase64)(a);if(!o.c)throw new Error("Web Crypto is not available");const i=await o.c.decrypt({name:"AES-GCM",iv:Object(r.decodeBase64)(t),tagLength:128},this.aesKey,n);return JSON.parse((new TextDecoder).decode(new Uint8Array(i)))}async receive(){if(!this.olmSAS)throw new Error("Channel closed");if(!this.aesKey)throw new Error("Shared secret not set up");const e=await this.transport.receive();if(!e)return;const t=e;if(t.ciphertext&&t.iv)return this.decrypt(t);throw new Error("Data received but no ciphertext")}async close(){this.olmSAS&&(this.olmSAS.free(),this.olmSAS=void 0)}async cancel(e){try{await this.transport.cancel(e)}finally{await this.close()}}}}).call(this,a(14))},917:function(e,t,a){"use strict";a.d(t,"a",(function(){return s}));var n=a(120),i=a.n(n);class s extends i.a.PureComponent{render(){return i.a.createElement("div",{className:"mx_CompleteSecurityBody"},this.props.children)}}},918:function(e,t,a){"use strict";a.d(t,"a",(function(){return u}));var n=a(120),i=a.n(n),s=a(131),r=a(121),o=a(125),l=a(157),c=a(137),d=a(912);function m(e){Object(r.e)()!==e&&(o.b.setValue("language",null,c.a.DEVICE,e),l.a.get().reload())}function u(e){let{disabled:t}=e;return s.b.get("disable_login_language_selector")?i.a.createElement("div",null):i.a.createElement(d.a,{className:"mx_AuthBody_language",onOptionChange:m,value:Object(r.e)(),disabled:t})}},941:function(e,t,a){"use strict";var n=a(120),i=a.n(n),s=a(123),r=a(121),o=a(244),l=a(131),c=a(127),d=a(13),m=a.n(d),u=a(321),h=a(1),p=a(345),g=a(135),v=a(139),b=a(259),f=a(200);class y extends i.a.PureComponent{constructor(e){super(e),m()(this,"defaultServer",void 0),m()(this,"fieldRef",Object(n.createRef)()),m()(this,"validatedConf",void 0),m()(this,"onDefaultChosen",(()=>{this.setState({defaultChosen:!0})})),m()(this,"onOtherChosen",(()=>{this.setState({defaultChosen:!1})})),m()(this,"onHomeserverChange",(e=>{this.setState({otherHomeserver:e.target.value})})),m()(this,"validate",Object(f.a)({deriveData:async e=>{let{value:t}=e,a=t.trim();if(!a.includes("://"))try{const e=await u.a.findClientConfig(a);return this.validatedConf=p.a.buildValidatedConfigFromDiscovery(a,e),{}}catch(e){h.a.error(`Attempted ${a} as a server_name but it failed`,e)}a.includes("://")||(a="https://"+a);try{return this.validatedConf=await p.a.validateServerConfigWithStaticUrls(a),{}}catch(e){h.a.error(e);if(p.a.authComponentStateForError(e).serverErrorIsFatal){let t=Object(r.a)("Unable to validate homeserver");return e.translatedMessage&&(t=e.translatedMessage),{error:t}}try{return this.validatedConf=await p.a.validateServerConfigWithStaticUrls(a,null,!0),{}}catch(e){return h.a.error(e),{error:Object(r.a)("Invalid URL")}}}},rules:[{key:"required",test:e=>{let{value:t,allowEmpty:a}=e;return a||!!t},invalid:()=>Object(r.a)("Specify a homeserver")},{key:"valid",test:async function(e,t){let{value:a}=e,{error:n}=t;return!a||!n},invalid:function(e){let{error:t}=e;return t}}]})),m()(this,"onHomeserverValidate",(e=>this.validate(e))),m()(this,"onSubmit",(async e=>{e.preventDefault();if(!await this.fieldRef.current.validate({allowEmpty:!1})&&!this.state.defaultChosen)return this.fieldRef.current.focus(),void this.fieldRef.current.validate({allowEmpty:!1,focused:!0});this.props.onFinished(this.state.defaultChosen?this.defaultServer:this.validatedConf)}));const t=l.b.get();this.defaultServer=t.validated_server_config;const{serverConfig:a}=this.props;let i="";a.isDefault||(i=a.isNameResolvable&&a.hsName?a.hsName:a.hsUrl),this.state={defaultChosen:a.isDefault,otherHomeserver:i}}render(){let e;"matrix.org"===this.defaultServer.hsName&&(e=Object(r.a)("Matrix.org is the biggest public homeserver in the world, so it's a good place for many."));let t=this.defaultServer.hsName;return this.defaultServer.hsNameIsDifferent&&(t=i.a.createElement(o.a,{class:"mx_Login_underlinedServerName",tooltip:this.defaultServer.hsUrl},this.defaultServer.hsName)),i.a.createElement(g.a,{title:this.props.title||Object(r.a)("Sign into your homeserver"),className:"mx_ServerPickerDialog",contentId:"mx_ServerPickerDialog",onFinished:this.props.onFinished,fixedWidth:!1,hasCancel:!0},i.a.createElement("form",{className:"mx_Dialog_content",id:"mx_ServerPickerDialog",onSubmit:this.onSubmit},i.a.createElement("p",null,Object(r.a)("We call the places where you can host your account 'homeservers'.")," ",e),i.a.createElement(b.a,{name:"defaultChosen",value:"true",checked:this.state.defaultChosen,onChange:this.onDefaultChosen},t),i.a.createElement(b.a,{name:"defaultChosen",value:"false",className:"mx_ServerPickerDialog_otherHomeserverRadio",checked:!this.state.defaultChosen,onChange:this.onOtherChosen,childrenInLabel:!1,"aria-label":Object(r.a)("Other homeserver")},i.a.createElement(v.a,{type:"text",className:"mx_ServerPickerDialog_otherHomeserver",label:Object(r.a)("Other homeserver"),onChange:this.onHomeserverChange,onFocus:this.onOtherChosen,ref:this.fieldRef,onValidate:this.onHomeserverValidate,value:this.state.otherHomeserver,validateOnChange:!1,validateOnFocus:!1,autoFocus:!0,id:"mx_homeserverInput"})),i.a.createElement("p",null,Object(r.a)("Use your preferred Matrix homeserver if you have one, or host your own.")),i.a.createElement(s.a,{className:"mx_ServerPickerDialog_continue",kind:"primary",onClick:this.onSubmit},Object(r.a)("Continue")),i.a.createElement("h2",null,Object(r.a)("Learn more")),i.a.createElement("a",{href:"https://matrix.org/faq/#what-is-a-homeserver%3F",target:"_blank",rel:"noreferrer noopener"},Object(r.a)("About homeservers"))))}}var E=a(212);const _=()=>{const e=l.b.get().brand;c.b.createDialog(E.a,{title:Object(r.a)("Server Options"),description:Object(r.a)("You can use the custom server options to sign into other Matrix servers by specifying a different homeserver URL. This allows you to use %(brand)s with an existing Matrix account on a different homeserver.",{brand:e}),button:Object(r.a)("Dismiss"),hasCloseButton:!1,fixedWidth:!1},"mx_ServerPicker_helpDialog")};t.a=e=>{let{title:t,dialogTitle:a,serverConfig:n,onServerConfigChange:d}=e;const m=l.b.get("disable_custom_urls");let u;if(!m&&d){const e=()=>{((e,t,a)=>{c.b.createDialog(y,{title:e,serverConfig:t,onFinished:a})})(a,n,(e=>{e&&d(e)}))};u=i.a.createElement(s.a,{className:"mx_ServerPicker_change",kind:"link",onClick:e},Object(r.a)("Edit"))}let h,p=n.isNameResolvable?n.hsName:n.hsUrl;return n.hsNameIsDifferent&&(p=i.a.createElement(o.a,{class:"mx_Login_underlinedServerName",tooltip:n.hsUrl},n.hsName)),"matrix.org"===n.hsName&&(h=i.a.createElement("span",{className:"mx_ServerPicker_desc"},Object(r.a)("Join millions for free on the largest public server"))),i.a.createElement("div",{className:"mx_ServerPicker"},i.a.createElement("h2",null,t||Object(r.a)("Homeserver")),m?null:i.a.createElement(s.a,{className:"mx_ServerPicker_help",onClick:_,"aria-label":Object(r.a)("Help")}),i.a.createElement("span",{className:"mx_ServerPicker_server",title:"string"==typeof p?p:void 0},p),u,h)}},951:function(e,t,a){"use strict";a.d(t,"a",(function(){return x}));var n=a(13),i=a.n(n),s=a(120),r=a.n(s),o=a(126),l=a.n(o),c=a(143),d=a(129),m=a(1),u=a(121),h=a(124),p=a(128),g=a(880),v=a(663);class b extends v.a{constructor(){super(...arguments),i()(this,"onClick",(e=>{e.preventDefault()}))}wrapImage(e,t){return t}render(){if(this.state.error)return super.render();const e=this.props.mxEvent.getContent(),t=this.messageContent(this.state.contentUrl,this.state.thumbUrl,e,44);return r.a.createElement("div",{className:"mx_MImageReplyBody"},t)}}var f=a(180),y=a(627),E=a(337),_=a(171),S=a(848),w=a(237);function O(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function C(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?O(Object(a),!0).forEach((function(t){i()(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):O(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}class x extends r.a.PureComponent{constructor(){super(...arguments),i()(this,"anchorElement",Object(s.createRef)()),i()(this,"onDecrypted",(()=>{this.forceUpdate(),this.props.onHeightChanged&&this.props.onHeightChanged()})),i()(this,"onEventRequiresUpdate",(()=>{this.forceUpdate()})),i()(this,"onClick",(e=>{const t=e.target;"a"===t.tagName.toLowerCase()&&null!==t.closest("a")&&t!==this.anchorElement.current||(e.preventDefault(),this.props.toggleExpandedQuote&&e.shiftKey?this.props.toggleExpandedQuote():h.a.dispatch({action:p.a.ViewRoom,event_id:this.props.mxEvent.getId(),highlighted:!0,room_id:this.props.mxEvent.getRoomId(),metricsTrigger:void 0}))}))}componentDidMount(){this.props.mxEvent.on(c.c.Decrypted,this.onDecrypted),this.props.mxEvent.on(c.c.BeforeRedaction,this.onEventRequiresUpdate),this.props.mxEvent.on(c.c.Replaced,this.onEventRequiresUpdate)}componentWillUnmount(){this.props.mxEvent.removeListener(c.c.Decrypted,this.onDecrypted),this.props.mxEvent.removeListener(c.c.BeforeRedaction,this.onEventRequiresUpdate),this.props.mxEvent.removeListener(c.c.Replaced,this.onEventRequiresUpdate)}render(){const e=this.props.mxEvent,t=e.getContent().msgtype,a=e.getType(),{hasRenderer:n,isInfoMessage:i,isSeeingThroughMessageHiddenForModeration:s}=Object(y.a)(e,!1);if(!n){const{mxEvent:e}=this.props;return m.a.warn(`Event type not supported: type:${e.getType()} isState:${e.isState()}`),r.a.createElement("div",{className:"mx_ReplyTile mx_ReplyTile_info mx_MNoticeBody"},Object(u.a)("This event could not be displayed"))}const o=l()("mx_ReplyTile",{mx_ReplyTile_inline:t===d.e.Emote,mx_ReplyTile_info:i&&!e.isRedacted(),mx_ReplyTile_audio:t===d.e.Audio,mx_ReplyTile_video:t===d.e.Video});let c,h="#";this.props.permalinkCreator&&(h=this.props.permalinkCreator.forEvent(e.getId()));i||a===d.b.RoomCreate||(c=r.a.createElement("div",{className:"mx_ReplyTile_sender"},r.a.createElement(_.b,{member:e.sender,fallbackUserId:e.getSender(),width:16,height:16}),r.a.createElement(g.a,{mxEvent:e})));const p={[d.e.Image]:b,[d.e.Audio]:Object(f.m)(e)?S.a:E.a,[d.e.Video]:E.a},v={[d.b.Sticker]:b};return r.a.createElement("div",{className:o},r.a.createElement("a",{href:h,onClick:this.onClick,ref:this.anchorElement},c,Object(w.f)(C(C({},this.props),{},{ref:null,showUrlPreview:!1,overrideBodyTypes:p,overrideEventTypes:v,maxImageHeight:96,isSeeingThroughMessageHiddenForModeration:s,highlights:this.props.highlights,highlightLink:this.props.highlightLink,onHeightChanged:this.props.onHeightChanged,permalinkCreator:this.props.permalinkCreator}),!1)))}}i()(x,"defaultProps",{onHeightChanged:()=>{}})}}]);
//# sourceMappingURL=vendors~element-web-app.js.map