"use strict";(self.webpackChunkelement_web=self.webpackChunkelement_web||[]).push([[797],{"./src/async-components/views/dialogs/eventindex/ManageEventIndexDialog.tsx":(e,t,s)=>{s.r(t),s.d(t,{default:()=>_});var n=s("./node_modules/@babel/runtime/helpers/esm/defineProperty.js"),o=s("./node_modules/react/index.js"),a=s("./src/languageHandler.tsx"),i=s("./src/SdkConfig.ts"),r=s("./src/settings/SettingsStore.ts"),l=s("./src/Modal.tsx"),c=s("./src/utils/FormattingUtils.ts"),m=s("./src/indexing/EventIndexPeg.ts"),u=s("./src/settings/SettingLevel.ts"),g=s("./src/components/views/elements/Field.tsx"),d=s("./src/components/views/dialogs/BaseDialog.tsx"),h=s("./src/components/views/elements/DialogButtons.tsx");class _ extends o.Component{constructor(e){super(e),(0,n.A)(this,"updateCurrentRoom",(async e=>{var t,s,n,o;const a=m.A.get();if(!a)return;let i;try{i=await a.getStats()}catch{return}let r=null;e&&(r=e.name);const l=a.crawlingRooms(),c=l.crawlingRooms.size,u=l.totalRooms.size;this.setState({eventIndexSize:null!==(t=null===(s=i)||void 0===s?void 0:s.size)&&void 0!==t?t:0,eventCount:null!==(n=null===(o=i)||void 0===o?void 0:o.eventCount)&&void 0!==n?n:0,crawlingRoomsCount:c,roomCount:u,currentRoom:r})})),(0,n.A)(this,"onDisable",(async()=>{const e=(await s.e(5438).then(s.bind(s,"./src/async-components/views/dialogs/eventindex/DisableEventIndexDialog.tsx"))).default;l.Ay.createDialog(e,void 0,void 0,!1,!0)})),(0,n.A)(this,"onCrawlerSleepTimeChange",(e=>{this.setState({crawlerSleepTime:parseInt(e.target.value,10)}),r.A.setValue("crawlerSleepTime",null,u.p.DEVICE,e.target.value)})),this.state={eventIndexSize:0,eventCount:0,crawlingRoomsCount:0,roomCount:0,currentRoom:null,crawlerSleepTime:r.A.getValueAt(u.p.DEVICE,"crawlerSleepTime")}}componentWillUnmount(){const e=m.A.get();null!==e&&e.removeListener("changedCheckpoint",this.updateCurrentRoom)}async componentDidMount(){let e=0,t=0,s=0,n=0,o=null;const a=m.A.get();if(null!==a){a.on("changedCheckpoint",this.updateCurrentRoom);try{const t=await a.getStats();t&&(e=t.size,n=t.eventCount)}catch{}const i=a.crawlingRooms();t=i.crawlingRooms.size,s=i.totalRooms.size;const r=a.currentRoom();r&&(o=r.name)}this.setState({eventIndexSize:e,eventCount:n,crawlingRoomsCount:t,roomCount:s,currentRoom:o})}render(){const e=i.Ay.get().brand;let t;t=null===this.state.currentRoom?(0,a._t)("settings|security|message_search_indexing_idle"):(0,a._t)("settings|security|message_search_indexing",{currentRoom:this.state.currentRoom});const s=Math.max(0,this.state.roomCount-this.state.crawlingRoomsCount),n=o.createElement("div",null,(0,a._t)("settings|security|message_search_intro",{brand:e}),o.createElement("div",{className:"mx_SettingsTab_subsectionText"},t,o.createElement("br",null),(0,a._t)("settings|security|message_search_space_used")," ",(0,c.z3)(this.state.eventIndexSize,0),o.createElement("br",null),(0,a._t)("settings|security|message_search_indexed_messages")," ",(0,c.Zl)(this.state.eventCount),o.createElement("br",null),(0,a._t)("settings|security|message_search_indexed_rooms")," ",(0,a._t)("settings|security|message_search_room_progress",{doneRooms:(0,c.Zl)(s),totalRooms:(0,c.Zl)(this.state.roomCount)})," ",o.createElement("br",null),o.createElement(g.A,{label:(0,a._t)("settings|security|message_search_sleep_time"),type:"number",value:this.state.crawlerSleepTime.toString(),onChange:this.onCrawlerSleepTimeChange})));return o.createElement(d.A,{className:"mx_ManageEventIndexDialog",onFinished:this.props.onFinished,title:(0,a._t)("settings|security|message_search_section")},n,o.createElement(h.A,{primaryButton:(0,a._t)("action|done"),onPrimaryButtonClick:this.props.onFinished,primaryButtonClass:"primary",cancelButton:(0,a._t)("action|disable"),onCancel:this.onDisable,cancelButtonClass:"danger"}))}}}}]);
//# sourceMappingURL=797.js.map