"use strict";(self.webpackChunkelement_web=self.webpackChunkelement_web||[]).push([[8533],{"./src/async-components/views/dialogs/eventindex/ManageEventIndexDialog.tsx"(e,t,s){s.r(t),s.d(t,{default:()=>_});var n=s("../../node_modules/.pnpm/@babel+runtime@7.29.7/node_modules/@babel/runtime/helpers/esm/defineProperty.js"),o=s("../../node_modules/.pnpm/react@19.2.7/node_modules/react/index.js"),i=s("./src/languageHandler.tsx"),a=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"),d=s("./src/components/views/elements/Field.tsx"),g=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,i,a;const r=m.A.get();if(!r)return;let l;try{l=await r.getStats()}catch{return}let c=null;e&&(c=e.name);const u=r.crawlingRooms(),d=u.crawlingRooms.size,g=u.totalRooms.size;this.setState({eventIndexSize:null!==(t=null===(s=l)||void 0===s?void 0:s.size)&&void 0!==t?t:0,eventCount:null!==(n=null===(o=l)||void 0===o?void 0:o.eventCount)&&void 0!==n?n:0,eventIndexRoomCount:null!==(i=null===(a=l)||void 0===a?void 0:a.roomCount)&&void 0!==i?i:0,crawlingRoomsCount:d,roomCount:g,currentRoom:c})}),(0,n.A)(this,"onDisable",async()=>{const e=(await s.e(9158).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.valueAsNumber)}),this.state={eventIndexSize:0,eventCount:0,eventIndexRoomCount: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(){const e=m.A.get();if(null!==e){e.on("changedCheckpoint",this.updateCurrentRoom);const t=e.currentRoom();await this.updateCurrentRoom(t)}}render(){const e=a.A.get().brand;let t;t=null===this.state.currentRoom?(0,i._t)("settings|security|message_search_indexing_idle"):(0,i._t)("settings|security|message_search_indexing",{currentRoom:this.state.currentRoom});const s=Math.max(0,this.state.eventIndexRoomCount-this.state.crawlingRoomsCount),n=o.createElement("div",null,(0,i._t)("settings|security|message_search_intro",{brand:e}),o.createElement("div",{className:"mx_SettingsTab_subsectionText"},t,o.createElement("br",null),(0,i._t)("settings|security|message_search_space_used")," ",(0,c.z3)(this.state.eventIndexSize,0),o.createElement("br",null),(0,i._t)("settings|security|message_search_indexed_messages")," ",(0,c.Zl)(this.state.eventCount),o.createElement("br",null),(0,i._t)("settings|security|message_search_indexed_rooms")," ",(0,i._t)("settings|security|message_search_room_progress",{doneRooms:(0,c.Zl)(s),totalRooms:(0,c.Zl)(this.state.roomCount)})," ",o.createElement("br",null),(0,i._t)("settings|security|message_search_pending_rooms",{pendingRooms:(0,c.Zl)(this.state.crawlingRoomsCount)}),o.createElement("br",null),o.createElement(d.A,{label:(0,i._t)("settings|security|message_search_sleep_time"),type:"number",value:this.state.crawlerSleepTime.toString(),onChange:this.onCrawlerSleepTimeChange})));return o.createElement(g.A,{className:"mx_ManageEventIndexDialog",onFinished:this.props.onFinished,title:(0,i._t)("settings|security|message_search_section")},n,o.createElement(h.A,{primaryButton:(0,i._t)("action|done"),onPrimaryButtonClick:this.props.onFinished,primaryButtonClass:"primary",cancelButton:(0,i._t)("action|disable"),onCancel:this.onDisable,cancelButtonClass:"danger"}))}}}}]);
//# sourceMappingURL=8533.js.map