text: (this["webpackJsonpbb-manager"]=this["webpackJsonpbb-manager"]||[]).push([[0],{127:function(e,t){},197:function(e){e.exports=JSON.parse('{"v":"Mi4zLjQ="}')},248:function(e,t,a){},249:function(e,t,a){},301:function(e,t){},333:function(e,t,a){"use strict";a.r(t);var n=a(0),c=a.n(n),r=a(20),i=a.n(r),o=(a(248),a(249),a(8)),s=a(134),l=a.n(s),d=a(188),j=a(189),b=a(22),u=a(6),h=a(384),O=a(405),x=a(403),m=a(389),f=a(416),g=a(402),p=a(386),v=a(408),y=a(397),w=a(401),k=a(399),C=a(400),S=a(398),I=a(404),T=a(59),F=a(409),B=a(345),P=a(407),W=a(406),D=a(341),N=a(411),A=a(410),z=a(111),E=a.n(z),R=a(414),L=a(412),q=a(422),M=a(204),U=a.n(M),Y=a(203),H=a.n(Y),G=a(202),J=a.n(G),Z=a(342),K=a(338),X=a(420),_=a(344),Q=a(394),V=a(418),$=a(413),ee=a(393),te=a(388),ae=a(194),ne=a.n(ae),ce=a(1),re=Object(h.a)((function(e){return{cardHeader:{backgroundColor:"#000"},content:{padding:e.spacing(2)}}}));function ie(e){var t=re(),a=e.bot,c=e.mode,r=Object(n.useState)(a.status),i=Object(o.a)(r,2),s=i[0],l=i[1],d=Object(n.useState)(""),j=Object(o.a)(d,2),b=j[0],u=j[1],h=Object(n.useState)(a.status),O=Object(o.a)(h,2),x=O[0],g=O[1];Object(n.useEffect)((function(){var e;return l(a.status),u(a.live),e="new"===a.status?"new":"new-disabled"===a.status||"disabled"===a.status?"disabled":""===a.live?"enabled":"stopped"===a.live?Object(ce.jsxs)("span",{children:[Object(ce.jsxs)("span",{children:[a.status," / "]}),Object(ce.jsx)("span",{style:{color:"#f00"},children:"stopped"})]}):"enabled / running",g(e),function(){}}),[a]);return Object(ce.jsx)(p.a,{item:!0,xs:12,sm:6,md:4,children:Object(ce.jsxs)(te.a,{children:[Object(ce.jsxs)(p.a,{container:!0,direction:"row",children:[Object(ce.jsx)(p.a,{item:!0,xs:12,children:Object(ce.jsx)(f.a,{className:t.cardHeader,children:Object(ce.jsx)(T.a,{gutterBottom:!0,variant:"button",component:"h2",children:Object(ce.jsx)(f.a,{color:"#FFF",ml:2,mr:2,children:a.botname})})})}),Object(ce.jsx)(p.a,{item:!0,xs:12,className:t.content,children:Object(ce.jsxs)(T.a,{variant:"button",children:[Object(ce.jsxs)("div",{children:["Bot ID: ",Object(ce.jsx)("b",{children:a.botID})]}),Object(ce.jsx)("div",{children:Object(ce.jsxs)("span",{children:["Status: ",Object(ce.jsx)("b",{children:x})]})})]})})]}),Object(ce.jsxs)(p.a,{container:!0,direction:"row",className:t.content,children:[Object(ce.jsx)(p.a,{item:!0,xs:7,children:Object(ce.jsx)(m.a,{variant:"contained",onClick:function(){e.callback(a.botID,"dashboard")},disabled:"disabled"===s||"running"!==b,children:"Dashboard"})}),Object(ce.jsx)(p.a,{item:!0,xs:2,children:Object(ce.jsx)(m.a,{size:"small",color:"primary",onClick:function(){var t;"enabled"===s?t="disabled":"new"===s?t="new-disabled":"new-disabled"===s?t="new":"disabled"===s&&(t="enabled"),l(t),u(""),e.callback(a.botID,"status",t)},children:Object(ce.jsx)(ne.a,{color:"disabled"===s||"new-disabled"===s?"disabled":"light"===c?"primary":"secondary"})})}),Object(ce.jsx)(p.a,{item:!0,xs:2,children:Object(ce.jsx)(m.a,{size:"small",color:"light"===c?"primary":"secondary",onClick:function(){e.callback(a.botID,"delete")},children:Object(ce.jsx)(E.a,{})})}),Object(ce.jsx)(p.a,{item:!0,xs:1})]})]})})}var oe,se,le=a(210),de=a(396),je=a(417),be=a(423),ue=a(140),he=a.n(ue),Oe=Object(u.a)((function(e){return{tooltip:{backgroundColor:"light"===e.palette.type?"#FFFFFF":"#000000",color:"light"===e.palette.type?"#000000":"#FFFFFF",maxWidth:800,fontSize:e.typography.pxToRem(14),border:"1px solid #888888"}}}))(q.a),xe=a(395),me=a(206),fe=function(e,t){var a=c.a.useState(localStorage.getItem(e)||t),n=Object(o.a)(a,2),r=n[0],i=n[1];return c.a.useEffect((function(){localStorage.setItem(e,r)}),[r]),[r,i]},ge=a(196),pe=a.n(ge),ve=a(77),ye=localStorage.getItem("uuid"),we=localStorage.getItem("publicKey"),ke=new ve.Crypt({md:"sha256",rsaStandard:"RSA-OAEP"}),Ce=pe()("/",{auth:{encryptedUuid:(oe=new Date,!!(ye&&we&&we.includes("-----BEGIN PUBLIC KEY-----"))&&ke.encrypt(we,"".concat(ye,"@").concat(oe.getTime())))}}),Se=Object(n.createContext)(),Ie=function(e){var t=Object(n.useState)({status:"disconnected",updated:"---",serverversion:"0.0",servertime:"---",access:{allow:!1,reason:"initial state",token:null},externalip:"",publicKey:""}),a=Object(o.a)(t,2),c=a[0],r=a[1];return Object(ce.jsx)(Se.Provider,{value:[c,r],children:e.children})},Te=Object(n.createContext)(),Fe=function(e){var t=Object(n.useState)({}),a=Object(o.a)(t,2),c=a[0],r=a[1];return Object(ce.jsx)(Te.Provider,{value:[c,r],children:e.children})},Be=Object(n.createContext)(),Pe=function(e){var t=Object(n.useState)(null),a=Object(o.a)(t,2),c=a[0],r=a[1];return Object(ce.jsx)(Be.Provider,{value:[c,r],children:e.children})},We=a(337),De=a(141),Ne=a.n(De),Ae=a(142),ze=a(198),Ee=a(421),Re=a(205),Le=a(392),qe=a(79),Me=a(135),Ue=a.n(Me),Ye=a(136),He=a.n(Ye),Ge=a(197),Je=a(78),Ze=a(137),Ke=a.n(Ze),Xe=a(138),_e=a(415);function Qe(){return Object(ce.jsx)(f.a,{color:"#FFF",height:54,p:2,children:Object(ce.jsxs)(T.a,{variant:"body2",align:"center",children:["Copyright \xa9 ",Object(ce.jsx)(ee.a,{style:{color:"#ffffff",textDecoration:"none"},href:"https://hodlerhacks.com/",target:"_blank",rel:"noopener",children:"hodlerhacks.com"})," ",(new Date).getFullYear()]})})}var Ve=Object(u.a)({checked:{},track:{backgroundColor:"#999"}})(Q.a),$e=Object(u.a)((function(e){return{tooltip:{backgroundColor:e.palette.common.white,color:"rgba(0, 0, 0, 0.87)",boxShadow:e.shadows[1],fontSize:12}}}))(q.a);function et(){var e=fe("mode","light"),t=Object(o.a)(e,2),a=t[0],r=t[1],i=fe("badge","false"),s=Object(o.a)(i,2),z=s[0],R=s[1],q=Object(n.useContext)(Se),M=Object(o.a)(q,2),U=M[0],Y=U.status,H=U.serverversion,G=U.servertime,Q=U.access,te=U.externalip,ae=U.publicKey,ne=M[1],re=Object(n.useContext)(Te),oe=Object(o.a)(re,2),be=oe[0],ue=oe[1],ge=Object(n.useContext)(Be),pe=Object(o.a)(ge,2),ye=pe[0],we=pe[1],ke=Object(qe.b)(),Ie=ke.enqueueSnackbar,Fe=ke.closeSnackbar,Pe=Je.version,De=Object(n.useState)(!1),Ne=Object(o.a)(De,2),Me=Ne[0],Ye=Ne[1],Ze=Object(n.useState)(!1),et=Object(o.a)(Ze,2),at=et[0],nt=et[1],ct=Object(n.useState)(!0),rt=Object(o.a)(ct,2),it=rt[0],ot=rt[1],st=Object(n.useState)(!1),lt=Object(o.a)(st,2),dt=lt[0],jt=lt[1],bt=Object(n.useState)(!1),ut=Object(o.a)(bt,2),ht=ut[0],Ot=ut[1],xt=Object(n.useState)(!1),mt=Object(o.a)(xt,2),ft=(mt[0],mt[1]),gt=Object(n.useState)(!1),pt=Object(o.a)(gt,2),vt=pt[0],yt=pt[1],wt=Object(n.useState)({}),kt=Object(o.a)(wt,2),Ct=kt[0],St=kt[1],It=Object(n.useState)(""),Tt=Object(o.a)(It,2),Ft=Tt[0],Bt=Tt[1],Pt=Object(n.useState)(!1),Wt=Object(o.a)(Pt,2),Dt=Wt[0],Nt=Wt[1],At=Object(n.useState)(),zt=Object(o.a)(At,2),Et=zt[0],Rt=zt[1],Lt=Object(n.useState)(),qt=Object(o.a)(Lt,2),Mt=qt[0],Ut=qt[1],Yt=Object(n.useState)(be.timeshift||"0"),Ht=Object(o.a)(Yt,2),Gt=Ht[0],Jt=Ht[1],Zt=Object(n.useState)(be.telegramToken||""),Kt=Object(o.a)(Zt,2),Xt=Kt[0],_t=Kt[1],Qt=Object(n.useState)(be.telegramUsername||""),Vt=Object(o.a)(Qt,2),$t=Vt[0],ea=Vt[1],ta=Object(n.useState)(be.loginRequired||!1),aa=Object(o.a)(ta,2),na=aa[0],ca=aa[1],ra=Object(n.useState)(be.bbUsername||""),ia=Object(o.a)(ra,2),oa=ia[0],sa=ia[1],la=Object(n.useState)(be.bbPassword||""),da=Object(o.a)(la,2),ja=da[0],ba=da[1],ua=Object(n.useState)(be.f2aRequired||!1),ha=Object(o.a)(ua,2),Oa=ha[0],xa=ha[1],ma=Object(n.useState)(be.whitelistEnabled||!1),fa=Object(o.a)(ma,2),ga=fa[0],pa=fa[1],va=Object(n.useState)(be.whitelist||[]),ya=Object(o.a)(va,2),wa=ya[0],ka=ya[1],Ca=Object(n.useState)(be.temporaryAccessAllowed||!1),Sa=Object(o.a)(Ca,2),Ia=Sa[0],Ta=Sa[1],Fa=Object(n.useState)(be.telegramChatId||null),Ba=Object(o.a)(Fa,2),Pa=Ba[0],Wa=Ba[1],Da=Object(n.useState)(""),Na=Object(o.a)(Da,2),Aa=Na[0],za=Na[1],Ea=Object(n.useState)(0),Ra=Object(o.a)(Ea,2),La=Ra[0],qa=Ra[1],Ma=Object(n.useState)(0),Ua=Object(o.a)(Ma,2),Ya=Ua[0],Ha=Ua[1],Ga=Object(n.useState)(!1),Ja=Object(o.a)(Ga,2),Za=Ja[0],Ka=Ja[1],Xa=Object(n.useState)([]),_a=Object(o.a)(Xa,2),Qa=_a[0],Va=_a[1],$a=fe("last-msg",0),en=Object(o.a)($a,2),tn=en[0],an=en[1],nn=Object(n.useState)({number:0,title:"",message:"",lock:!1}),cn=Object(o.a)(nn,2),rn=cn[0],on=cn[1],sn=Object(n.useState)(!1),ln=Object(o.a)(sn,2),dn=ln[0],jn=ln[1],bn=Object(n.useState)("sm"),un=Object(o.a)(bn,2),hn=un[0],On=un[1],xn=Object(n.useState)("#fff"),mn=Object(o.a)(xn,2),fn=mn[0],gn=mn[1],pn=fe("latest-version",Pe),vn=Object(o.a)(pn,2),yn=vn[0],wn=vn[1],kn=Ke.a.enc.Base64.parse(Ge.v).toString(Ke.a.enc.Utf8),Cn=kn.split("."),Sn=Cn[0]+"."+Cn[1],In=kn,Tn=Object(n.useRef)(!1),Fn=new ve.Crypt({md:"sha256",rsaStandard:"RSA-OAEP"});Object(n.useEffect)((function(){return document.title="BB | Bot Manager",window.addEventListener("storage",(function(){var e=localStorage.getItem("mode");r(e)})),function(){}}),[]),Object(n.useEffect)((function(){return Jt(be.timeshift||"0"),_t(be.telegramToken||""),ea(be.telegramUsername||""),pa(be.whitelistEnabled||!1),ca(be.loginRequired||!1),sa(be.bbUsername||""),ba(be.bbPassword||""),xa(be.f2aRequired||!1),ka(be.whitelist||[]),Ta(be.temporaryAccessAllowed||!1),Wa(be.telegramChatId),!be.loginRequired&&!be.temporaryAccessAllowed||""!==be.telegramToken&&""!==be.telegramUsername&&be.telegramChatId?R("false"):R("true"),function(){}}),[be]);var Bn=Math.min(480,function(){var e=Object(n.useState)(0),t=Object(o.a)(e,2),a=t[0],c=t[1];return Object(n.useLayoutEffect)((function(){function e(){c(window.innerWidth)}return window.addEventListener("resize",e),e(),function(){return window.removeEventListener("resize",e)}}),[]),a}()),Pn=Bn-50,Wn=Object(h.a)((function(e){return{root:{display:"flex"},logo:{maxWidth:60,padding:10},heroContent:{backgroundColor:"light"===a?"#fff":"#000",padding:e.spacing(4,0,2)},heroButtons:{marginTop:e.spacing(4)},cardGrid:{paddingTop:e.spacing(6),paddingBottom:e.spacing(6)},card:{height:"100%",display:"flex",flexDirection:"column"},cardHeader:{backgroundColor:"#000"},cardContent:{flexGrow:1},form:{width:"100%",marginTop:e.spacing(1)},footer:{marginTop:"auto",backgroundColor:"#000000"},bottomPush:{position:"fixed",width:"100%",bottom:0,paddingBottom:0},backdrop:{zIndex:e.zIndex.drawer+2,color:"#fff"},appBar:{zIndex:e.zIndex.drawer+1},drawer:{width:Bn,flexShrink:0},drawerPaper:{width:Bn},drawerContainer:{overflow:"auto"},button:{marginTop:e.spacing(3),marginLeft:e.spacing(1),width:"80px"},textinput:{width:Pn}}}))(),Dn=Object(me.a)({palette:{type:a}}),Nn=Object(u.a)({root:{"&:hover":{backgroundColor:"transparent"},"&:click":{backgroundColor:"#f00"}}})(m.a);Object(n.useEffect)((function(){return ft("disconnected"===Y&&null!==ye),function(){}}),[Y]),Object(n.useEffect)((function(){return yt(H&&"0.0"!==H&&H!==Pe),function(){}}),[H]);var An=function(e){return Object(ce.jsx)(c.a.Fragment,{children:Object(ce.jsx)(m.a,{style:{color:"#bbbbbb"},onClick:function(){Fe(e)},children:"Dismiss"})})};Object(n.useEffect)((function(){return null!==ye&&ot(!1),function(){}}),[ye]),Object(n.useEffect)((function(){return Ce.on("notification",(function(e){Ie(e,{variant:"error",autoHideDuration:8e3,action:An})})),function(){}}),[]),Object(n.useEffect)((function(){var e=50,t=50,a=yn>Pe;return Ka(a),e+=a?140:40,Q&&Q.token&&(e+=50,t+=50),qa(e),Ha(t),function(){}}),[yn,Pe,Q]);var zn=function(){Tn.current=!0,nc(tc.current)},En=function(){jt(!1)},Rn=function(e,t,a){if("delete"===t)!function(e){var t=ye.find((function(t){return t.botID===e}));St({botID:e,botname:t.botname}),Bt(""),jt(!0)}(e);else if("dashboard"===t){var n,c="bot".concat(e),r=window.location.href;r.includes(":5000")&&(r=r.replace(":5000",":4000")),n=r+c,window.open(n,"_blank")}else{var i=ye.find((function(t){return t.botID===e}));i.status=a,i.live="stopped",Ce&&(Ce.emit("update-bot",i,Q.token),we(ye))}},Ln=function(e){r("light"===a?"dark":"light")},qn=function(){Ot(!0)},Mn=function(){Ot(!1)},Un=function(){Rt(Gn(Gt)[0]),Ut(Gn(Gt)[1]),Nt(!0)},Yn=function(){Nt(!1)},Hn=function(){Jt(be.timeshift),_t(be.telegramToken),ea(be.telegramUsername),ca(be.loginRequired),sa(be.bbUsername),ba(be.bbPassword),xa(be.f2aRequired),pa(be.whitelistEnabled),ka(be.whitelist),Ta(be.temporaryAccessAllowed),Yn()},Gn=function(e){var t=new Date,a=Object(Re.a)(G,"yyyy/MM/dd HH:mm:ss",new Date),n=Object(Ae.a)(a,t),c=Object(ze.a)(t,n),r=c.getHours().toString().padStart(2,"0")+":"+c.getMinutes().toString().padStart(2,"0"),i=c;return 0!==e&&(i=Object(Ee.a)(c,{hours:e})),[r,i.getHours().toString().padStart(2,"0")+":"+i.getMinutes().toString().padStart(2,"0")]};Object(n.useEffect)((function(){return Rt(Gn(Gt)[0]),Ut(Gn(Gt)[1]),function(){}}),[G,Gt]);var Jn=function(e){ca(e.target.checked)},Zn=function(e){xa(e.target.checked)},Kn=function(e){Ta(e.target.checked)},Xn=function(e){var t=null,a=null;if(He.a.isValid(e)){var n=He.a.parse(e);"ipv6"===n.kind()?(n.isIPv4MappedAddress()&&(t=n.toIPv4Address().toString()),a=n.toString()):(t=n.toString(),a=n.toIPv4MappedAddress().toString())}return{show:t||a,store:a}},_n=function(){Ce&&Ce.emit("logout",Q.token),ne({status:Y,serverversion:H,servertime:G,access:{allow:!1,reason:"logged out",token:null},externalip:te,publicKey:ae})},Qn=function(){Ye(!1)},Vn=function(){nt(!1)},$n=new Date,ec=$n,tc=Object(n.useRef)(tn);tc.current=tn;var ac=function(){setTimeout((function(){nc(tc.current)}),6e4)};function nc(e){return cc.apply(this,arguments)}function cc(){return(cc=Object(j.a)(l.a.mark((function e(t){var a,n,c,r,i,o,s;return l.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a=new Date,n=Object(Ae.a)(a,$n),!($n!==ec&&n<4)||Tn.current){e.next=6;break}ac(),e.next=24;break;case 6:return $n=new Date,"https://api-eu-central-1.graphcms.com/v2/ckoytzv3lotky01w59glace7y/master",c=new Xe.GraphQLClient("https://api-eu-central-1.graphcms.com/v2/ckoytzv3lotky01w59glace7y/master"),r={authorization:"Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6ImdjbXMtbWFpbi1wcm9kdWN0aW9uIn0.eyJ2ZXJzaW9uIjozLCJpYXQiOjE2MjE2NjgzMzgsImF1ZCI6WyJodHRwczovL2FwaS1ldS1jZW50cmFsLTEuZ3JhcGhjbXMuY29tL3YyL2Nrb3l0enYzbG90a3kwMXc1OWdsYWNlN3kvbWFzdGVyIiwiaHR0cHM6Ly9tYW5hZ2VtZW50LW5leHQuZ3JhcGhjbXMuY29tIl0sImlzcyI6Imh0dHBzOi8vbWFuYWdlbWVudC5ncmFwaGNtcy5jb20vIiwic3ViIjoiYjZlOTBmODAtZmEzYS00ODJmLWE0NTAtMTY3YTFmZTliNzIzIiwianRpIjoiY2tvemZnaWE0Mno4bTAxdzU5bHU5ZTA3NSJ9.cEJ5isSubzX1ymlpkfyvfgZ6zyUMFiFOVaD4N84NoEOxwGZ8DtYM1k4DlCjoeCcTR8Ftr43bIGDxR4apANAG_-wf9Nge9T2MAuKa9z2sCWA5jnYtTHYU-x1Hx_ShpHAl1wPjrSpTMquV3bRlKQBm6EQTreoaQZgBXY25ClLbVzXFcohcDn3RGi3hHVRvxNLr0F7ETwFJnbowm9UX66vz2SP-5-u-CBKUxSipKMO5za0MZiIWoprSdE0f22xVXp8up3k_6-5x22mS88P2OFgMXoA-UBFS8nz6jRE_fRULzCouKYyJG3oQ10ovuZ1M729GQ0rMv9fkJroVKyS4i8KgglwPPBwQbaD2LCJXINKXYC65DmKyJ9UjWxQ9Lv6akcnkT7CkeqEqzwLnCEQgZEmJS_PBFDu40LMS8UbnwDcntJznA8rH_jsD7IkMdyRyXmns6fbLOc91Q1idBCk-VqUzkL0FzfscCVpkg1J7kGtGeW4YEWhWyPze4ZO4IxM9WRoSsCDUOx3EXklA0WSdR2M6IRnoFL-qoawOLQaaPACy8-QGmaAL6N6fuMIHUWavOTYnyLip0oyy74sUHz4S4sx4mAf5pexlvDcxM_6RIRnCQ84THsM2KwpoWkpR-F2s4pIyfYYn-4R7MNENfPGxNm4INjBYrCOWyZN_vXHGBa4uw2U"},i={last:parseInt(t),bbm:Sn},o=Object(Xe.gql)(se||(se=Object(d.a)(['\n                query getMessages($bbm: String!, $last: Int!) {\n                    messages(where: {\n                        number_gt: $last\n                        OR: [\n                        {bbvReceive: "any"},\n                        {bbvReceive_contains: $bbm}\n                        ]\n                        archived_not: true\n                    }, orderBy: number_ASC) {\n                        id\n                        number\n                        bbvReceive\n                        bbvNew\n                        title\n                        message\n                        dialogWidth\n                        lock\n                    }\n                }\n                ']))),e.prev=12,e.next=15,c.request(o,i,r);case 15:s=e.sent,Va(s.messages),e.next=21;break;case 19:e.prev=19,e.t0=e.catch(12);case 21:Tn.current&&0===s.messages.length&&(gn("#ff9800"),setTimeout((function(){gn("#fff")}),1500)),Tn.current=!1,ac();case 24:case"end":return e.stop()}}),e,null,[[12,19]])})))).apply(this,arguments)}return Object(n.useEffect)((function(){if(Qa.length>0){var e=Qa[0];if(e.bbvNew&&wn(e.bbvNew),2!==(e.bbvReceive.match(/\./g)||[]).length||e.bbvReceive===In){var t=!1;if(e.bbvNew&&In>=e.bbvNew&&(t=!0),t){an(e.number);var a=Qa.slice(1,Qa.length);Va(a)}else{if(null===e.dialogWidth){var n=e.message.length;On(n<400?"sm":n<800?"md":n<3e3?"lg":"xl")}else On(e.dialogWidth);var c={number:e.number,title:e.title,message:e.message,width:e.dialogWidth,lock:e.lock,updated:t};on(c),jn(!0)}}else{var r=Qa.slice(1,Qa.length);Va(r)}}}),[Qa]),Object(n.useEffect)((function(){nc(tn)}),[]),Object(ce.jsx)(xe.a,{theme:Dn,children:vt?Object(ce.jsxs)(y.a,{open:!0,fullWidth:!0,maxWidth:"sm",children:[Object(ce.jsx)(k.a,{children:Object(ce.jsxs)(C.a,{children:[Object(ce.jsx)(T.a,{variant:"overline",color:"secondary",children:"New version has been installed"}),Object(ce.jsx)(C.a,{}),Object(ce.jsx)(T.a,{variant:"overline",color:"textPrimary",children:"Please refresh the browser window to load the latest version"})]})}),Object(ce.jsx)(w.a,{children:Object(ce.jsx)(m.a,{variant:"contained",onClick:function(){window.location.reload()},color:"secondary",children:"Refresh"})})]}):Object(ce.jsxs)(c.a.Fragment,{children:[Object(ce.jsx)(le.a,{className:Wn.backdrop,open:it,children:Object(ce.jsx)(de.a,{color:"inherit"})}),Object(ce.jsxs)(y.a,{open:dn,fullWidth:!0,maxWidth:hn,children:[Object(ce.jsx)(S.a,{id:"dialog-title",children:rn.title}),Object(ce.jsx)(k.a,{children:Object(ce.jsx)(C.a,{id:"dialog-description",children:Object(ce.jsx)(_e.a,{linkTarget:"_blank",children:rn.message})})}),Object(ce.jsx)(w.a,{children:Object(ce.jsx)(m.a,{variant:"contained",id:rn.number,onClick:function(e){var t=e.target.parentElement.id;an(t),jn(!1);var a=Qa.slice(1,Qa.length);Va(a)},color:"secondary",disabled:rn.lock,children:"Close"})})]}),Object(ce.jsx)(g.a,{}),Object(ce.jsx)(x.a,{position:"relative",className:Wn.appBar,children:Object(ce.jsxs)(I.a,{children:[Object(ce.jsx)("img",{src:"/logo192.png",alt:"Balance Bot Logo",className:Wn.logo}),Object(ce.jsxs)(p.a,{container:!0,direction:"row",alignItems:"center",nowrap:"true",children:[Object(ce.jsxs)(p.a,{item:!0,xs:!0,zeroMinWidth:!0,children:[Object(ce.jsx)(f.a,{mt:1.5,children:Object(ce.jsx)(T.a,{variant:"h6",color:"inherit",noWrap:!0,children:"Balance Bot"})}),Object(ce.jsx)(f.a,{mt:-1,style:{color:"#959FD6"},children:Object(ce.jsxs)(T.a,{variant:"caption",color:"inherit",noWrap:!0,children:["v",Pe]})})]}),Object(ce.jsx)(V.a,{xsDown:!0,children:Object(ce.jsx)(tt,{wdt:La,update:Za,logout:Q&&Q.token,onLogout:_n,badge:z,openDrawer:Un,handleUpdateOpen:qn,checkForUpdate:zn,checkIconColor:fn})}),Object(ce.jsx)(V.a,{smUp:!0,children:Object(ce.jsx)(tt,{wdt:Ya,update:Za,logout:Q&&Q.token,onLogout:_n,badge:z,openDrawer:Un,handleUpdateOpen:qn,checkForUpdate:zn,checkIconColor:fn})})]})]})}),Object(ce.jsxs)(O.a,{className:Wn.drawer,anchor:"right",open:Dt,onClose:Hn,classes:{paper:Wn.drawerPaper},children:[Object(ce.jsx)(I.a,{}),Object(ce.jsx)("div",{style:{padding:20},children:Object(ce.jsxs)(p.a,{container:!0,spacing:3,children:["true"===z&&Object(ce.jsx)(je.a,{severity:"error",children:"Configure and start your Telegram bot when enabling login or allowing temporary access from other IP addresses"}),Object(ce.jsx)(p.a,{item:!0,xs:10,children:Object(ce.jsx)(T.a,{variant:"h4",children:"General Settings"})}),Object(ce.jsxs)(p.a,{item:!0,xs:1,children:[Object(ce.jsx)(Le.a,{onClickAway:Qn,children:Object(ce.jsx)(Oe,{interactive:!0,title:Object(ce.jsx)(c.a.Fragment,{children:Object(ce.jsxs)(f.a,{m:2,children:[Object(ce.jsx)("div",{children:Object(ce.jsx)("b",{children:"Server timezone adjustment"})}),Object(ce.jsx)("div",{children:"If you're hosting Balance Bot in the cloud, and the server's timezone is different from your local timezone, you can use this setting to adjust for that so that timestamps for orders and other events are provided in your local timezone. This setting will be applied to all your individual bots."}),Object(ce.jsx)("div",{children:"\xa0"}),Object(ce.jsx)("div",{children:Object(ce.jsx)("b",{children:"Telegram Bot"})}),Object(ce.jsx)("div",{children:"You can receive notifications from Bot Manager and your bot(s) on Telegram. To do so, take the following steps:"}),Object(ce.jsx)("div",{children:"\xa0"}),Object(ce.jsxs)("div",{children:["1. Create a Telegram bot by sending '/newbot' to the BotFather (Telegram's uber bot): ",Object(ce.jsx)(ee.a,{href:"https://t.me/botfather",target:"_blank",rel:"noopener",color:"secondary",children:"https://t.me/botfather"})]}),Object(ce.jsx)("div",{children:"2. Answer BotFather's questions, i.e. pick a name and a username for your bot"}),Object(ce.jsx)("div",{children:"3. Copy the token provided by BotFather and paste it here in the settings"}),Object(ce.jsx)("div",{children:"4. Enter your personal Telegram username (your name on Telegram preceded by @, NOT the username for your Telegram bot) here in the settings"}),Object(ce.jsxs)("div",{children:["5. Open your Telegram bot using the link provided by BotFather: ",Object(ce.jsx)(ee.a,{href:"#",color:"secondary",children:"t.me/[botname]"})]}),Object(ce.jsx)("div",{children:"6. Tap the 'start' button at the bottom, or type '/start' for further instructions"})]})}),onClose:Qn,open:Me,disableFocusListener:!0,disableHoverListener:!0,disableTouchListener:!0,children:Object(ce.jsx)(We.a,{onClick:Me?Qn:function(){Ye(!0)},children:Object(ce.jsx)(he.a,{color:"secondary"})})})}),Object(ce.jsx)(p.a,{item:!0,xs:1})]}),Object(ce.jsx)(p.a,{item:!0,xs:12,children:Object(ce.jsxs)(K.a,{children:[Object(ce.jsx)(B.a,{id:"server-timezone",children:"Adjust for server timezone"}),Object(ce.jsxs)(_.a,{labelId:"server-timezone",value:Gt,onChange:function(e){Jt(e.target.value),Ut(Gn(e.target.value)[1])},className:Wn.textinput,children:[Object(ce.jsx)(P.a,{value:12,children:"+12:00"}),Object(ce.jsx)(P.a,{value:11,children:"+11:00"}),Object(ce.jsx)(P.a,{value:10,children:"+10:00"}),Object(ce.jsx)(P.a,{value:9,children:"+09:00"}),Object(ce.jsx)(P.a,{value:8,children:"+08:00"}),Object(ce.jsx)(P.a,{value:7,children:"+07:00"}),Object(ce.jsx)(P.a,{value:6,children:"+06:00"}),Object(ce.jsx)(P.a,{value:5,children:"+05:00"}),Object(ce.jsx)(P.a,{value:4,children:"+04:00"}),Object(ce.jsx)(P.a,{value:3,children:"+03:00"}),Object(ce.jsx)(P.a,{value:2,children:"+02:00"}),Object(ce.jsx)(P.a,{value:1,children:"+01:00"}),Object(ce.jsx)(P.a,{value:0,children:"No adjustment"}),Object(ce.jsx)(P.a,{value:-1,children:"-01:00"}),Object(ce.jsx)(P.a,{value:-2,children:"-02:00"}),Object(ce.jsx)(P.a,{value:-3,children:"-03:00"}),Object(ce.jsx)(P.a,{value:-4,children:"-04:00"}),Object(ce.jsx)(P.a,{value:-5,children:"-05:00"}),Object(ce.jsx)(P.a,{value:-6,children:"-06:00"}),Object(ce.jsx)(P.a,{value:-7,children:"-07:00"}),Object(ce.jsx)(P.a,{value:-8,children:"-08:00"}),Object(ce.jsx)(P.a,{value:-9,children:"-09:00"}),Object(ce.jsx)(P.a,{value:-10,children:"-10:00"}),Object(ce.jsx)(P.a,{value:-11,children:"-11:00"}),Object(ce.jsx)(P.a,{value:-12,children:"-12:00"})]}),Object(ce.jsxs)(Z.a,{children:["Current server time: ",Et," - Adjusted server time: ",Mt]})]})}),Object(ce.jsx)(p.a,{item:!0,xs:12,children:Object(ce.jsx)(v.a,{id:"telegram-token",name:"telegram-token",label:"Telegram Token",helperText:"Token for your Telegram bot as provided by BotFather",type:"password",value:Xt,onChange:function(e){_t(e.target.value)},className:Wn.textinput,autoComplete:"off"})}),Object(ce.jsx)(p.a,{item:!0,xs:12,children:Object(ce.jsx)(v.a,{id:"telegram-username",name:"telegram-username",label:"Telegram Username",helperText:"Your Telegram username",value:$t,onChange:function(e){ea(e.target.value)},className:Wn.textinput})}),Object(ce.jsx)(p.a,{item:!0,xs:10,children:Object(ce.jsx)(T.a,{variant:"h4",children:"Security Settings"})}),Object(ce.jsxs)(p.a,{item:!0,xs:1,children:[Object(ce.jsx)(Le.a,{onClickAway:Vn,children:Object(ce.jsx)(Oe,{interactive:!0,title:Object(ce.jsx)(c.a.Fragment,{children:Object(ce.jsxs)(f.a,{m:2,children:[Object(ce.jsx)("div",{children:Object(ce.jsx)("b",{children:"Security Settings"})}),Object(ce.jsx)("div",{children:"If you're running Balance Bot in the cloud, it is highly recommended to only allow access from selected IP addresses (like your home IP address). Alternatively, or additionally, you may want to require login before getting access. You should use at least one of these options to prevent others from accessing your Balance Bot deployment."}),Object(ce.jsx)("div",{children:"\xa0"}),Object(ce.jsx)("div",{children:Object(ce.jsx)("b",{children:"Require login to access"})}),Object(ce.jsx)("div",{children:"Check this option to require logging in using a username and password. For improved security, after logging in, your session will expire after 60 minutes. Optionally, you can activate Two Factor Authentication (2FA) through your Telegram bot (requires Telegram configuration, see General Settings above)."}),Object(ce.jsx)("div",{children:"\xa0"}),Object(ce.jsx)("div",{children:Object(ce.jsx)("b",{children:"Enable IP whitelist"})}),Object(ce.jsx)("div",{children:"Check this option to allow access to Balance Bot from selected IP addresses only, and add your trusted IP address(es) to the IP whitelist. By default, your current IP address is added to the IP whitelist when enabling the option, to prevent you from being locked out."}),Object(ce.jsx)("div",{children:"\xa0"}),Object(ce.jsx)("div",{children:Object(ce.jsx)("b",{children:"Allow temporary access"})}),Object(ce.jsx)("div",{children:"There may be occassions when you want to access Balance Bot from an IP address that is not whitelisted. By checking the temporary access option, if you're trying to access Balance Bot from a non-whitelisted IP address, you will receive a message in your Telegram Bot and you can approve temporary access from that IP address (requires Telegram configuration, see General Settings above). If you have login enabled, you will be asked for your username and password instead."}),Object(ce.jsx)("div",{children:"\xa0"}),Object(ce.jsx)("div",{children:"Note: for security reasons, it is NOT recommended to access Balance Bot over public wifi networks."})]})}),onClose:Vn,open:at,disableFocusListener:!0,disableHoverListener:!0,disableTouchListener:!0,children:Object(ce.jsx)(We.a,{onClick:at?Vn:function(){nt(!0)},children:Object(ce.jsx)(he.a,{color:"secondary"})})})}),Object(ce.jsx)(p.a,{item:!0,xs:1})]}),Object(ce.jsx)(f.a,{pl:2,mt:-2,children:Object(ce.jsx)(T.a,{variant:"overline",color:"secondary",children:"For security reasons, don't use public wifi networks"})}),Object(ce.jsx)(p.a,{item:!0,xs:12,children:""!==Xt&&""!==$t&&Pa||na?Object(ce.jsx)(F.a,{control:Object(ce.jsx)(X.a,{color:"secondary",name:"login-required",disabled:!1,checked:na,onChange:Jn}),label:"Require login to access"}):Object(ce.jsx)($e,{title:"Requires Telegram bot to be set up and started",children:Object(ce.jsx)(F.a,{control:Object(ce.jsx)(X.a,{color:"secondary",name:"login-required",disabled:!0,checked:na,onChange:Jn}),label:"Require login to access"})})}),Object(ce.jsxs)(f.a,{p:2,display:na?"inline":"none",bgcolor:"dark"===a?"#757575":"#e0e0e0",width:"100%",children:[Object(ce.jsx)(p.a,{item:!0,xs:12,children:Object(ce.jsx)(v.a,{id:"bb-username",name:"bb-username",label:"Username",helperText:"Your Balance Bot username",value:oa,onChange:function(e){sa(e.target.value)},className:Wn.textinput,disabled:!na,autoComplete:"off"})}),Object(ce.jsx)(p.a,{item:!0,xs:12,children:Object(ce.jsx)(v.a,{id:"bb-password",name:"bb-password",label:"Password",helperText:"Your Balance Bot password",type:"password",value:ja,onChange:function(e){ba(e.target.value)},className:Wn.textinput,disabled:!na,autoComplete:"off"})}),Object(ce.jsx)(p.a,{item:!0,xs:12,children:""!==Xt&&""!==$t&&Pa||Oa?Object(ce.jsx)(F.a,{control:Object(ce.jsx)(X.a,{color:"secondary",name:"f2a-required",disabled:!1,checked:Oa,onChange:Zn}),label:"Require 2FA through Telegram bot to log in"}):Object(ce.jsx)($e,{title:"Requires Telegram bot to be set up and started",children:Object(ce.jsx)(F.a,{control:Object(ce.jsx)(X.a,{color:"secondary",name:"f2a-required",disabled:!0,checked:Oa,onChange:Zn}),label:"Require 2FA through Telegram bot to log in"})})})]}),Object(ce.jsx)(p.a,{item:!0,xs:12,children:Object(ce.jsx)(F.a,{control:Object(ce.jsx)(X.a,{color:"secondary",name:"whitelist-enabled",checked:ga,onChange:function(e){if(e.target.checked&&!wa.includes(Xn(te).store)){var t=wa;t.push(Xn(te).store),ka(t)}pa(e.target.checked)}}),label:"Enable IP whitelist"})}),Object(ce.jsxs)(f.a,{p:2,display:ga?"inline":"none",bgcolor:"dark"===a?"#757575":"#e0e0e0",width:"100%",children:[Object(ce.jsx)(p.a,{item:!0,xs:12,children:Object(ce.jsx)(T.a,{variant:"overline",color:"textSecondary",children:"IP Whitelist"})}),Object(ce.jsx)(p.a,{item:!0,xs:12,children:Object(ce.jsx)(W.a,{dense:!0,children:wa.map((function(e){return e===Xn(te).store?Object(ce.jsxs)(D.a,{children:[Object(ce.jsx)(A.a,{primary:Xn(e).show}),Object(ce.jsx)(N.a,{children:Object(ce.jsx)(m.a,{color:"secondary",edge:"end",size:"small",disableFocusRipple:!0,disableRipple:!0,disabled:!0,children:"Current IP"})})]},e):Object(ce.jsxs)(D.a,{children:[Object(ce.jsx)(A.a,{primary:Xn(e).show}),Object(ce.jsx)(N.a,{children:Object(ce.jsx)(We.a,{edge:"end",size:"small",onClick:function(){return function(e){var t=wa;t=t.filter((function(t){return t!==e})),ka(t)}(e)},children:Object(ce.jsx)(E.a,{})})})]},e)}))})}),Object(ce.jsxs)(p.a,{item:!0,container:!0,justify:"space-between",xs:12,children:[Object(ce.jsx)(p.a,{item:!0,xs:9,children:Object(ce.jsx)(v.a,{id:"new-ip",name:"new-ip",label:"IP Address",value:Aa,onChange:function(e){/^[0-9,a-f,.,:]*$/.test(e.target.value)&&za(e.target.value)},className:Wn.textinput})}),Object(ce.jsx)(p.a,{item:!0,xs:1,children:Object(ce.jsx)(L.a,{size:"small",color:"secondary",onClick:function(){if(wa.includes(Xn(Aa).store))Ie("IP address already whitelisted",{variant:"error",autoHideDuration:8e3,action:An});else if(Ue.a.v4({exact:!0}).test(Aa)||Ue.a.v6({exact:!0}).test(Aa)){var e=wa;e.push(Xn(Aa).store),za(""),ka(e)}else Ie("Invalid IP address",{variant:"error",autoHideDuration:8e3,action:An})},children:Object(ce.jsx)(J.a,{})})})]}),Object(ce.jsx)(p.a,{item:!0,xs:12,children:""!==Xt&&""!==$t&&Pa||Ia?Object(ce.jsx)(F.a,{control:Object(ce.jsx)(X.a,{color:"secondary",name:"temporary-access-allowed",disabled:!1,checked:Ia,onChange:Kn}),label:"Allow controlled temporary access from other IPs"}):Object(ce.jsx)($e,{title:"Requires Telegram bot to be set up and started",children:Object(ce.jsx)(F.a,{control:Object(ce.jsx)(X.a,{color:"secondary",name:"temporary-access-allowed",disabled:!0,checked:Ia,onChange:Kn}),label:"Allow controlled temporary access from other IPs"})})})]}),Object(ce.jsx)(p.a,{item:!0,xs:3,children:Object(ce.jsx)(m.a,{variant:"contained",color:"primary",onClick:Hn,className:Wn.button,children:"Cancel"})}),Object(ce.jsx)(p.a,{item:!0,xs:3,children:Object(ce.jsx)(m.a,{variant:"contained",color:"primary",onClick:function(){(!0===Oa&&!1===be.f2aRequired||!0===Ia&&!1===be.temporaryAccessAllowed)&&!Pa?Ie("Set up your Telegram bot and try again",{variant:"error",autoHideDuration:8e3,action:An}):function(){if(!na||""!==oa&&""!==ja){var e={timeshift:Gt,telegramToken:Xt,telegramUsername:$t,loginRequired:na,bbUsername:oa,bbPassword:ja,f2aRequired:Oa,whitelistEnabled:ga,whitelist:wa,temporaryAccessAllowed:Ia,telegramChatId:Pa},t=(new Date).getTime(),a=e;"************"!==ja&&(a=""!==ja?Object(b.a)(Object(b.a)({},a),{},{bbPassword:Fn.encrypt(ae,"".concat(ja,"@").concat(t))}):Object(b.a)(Object(b.a)({},a),{},{bbPassword:""})),"************"!==Xt&&(a=""!==Xt?Object(b.a)(Object(b.a)({},a),{},{telegramToken:Fn.encrypt(ae,"".concat(Xt,"@").concat(t))}):Object(b.a)(Object(b.a)({},a),{},{telegramToken:""})),Ce&&Ce.emit("store-settings",a,Q.token),""!==e.telegramToken&&(e.telegramToken="************"),""!==e.bbPassword&&(e.bbPassword="************"),ue(e),Yn()}else Ie("Please enter a username and password",{variant:"error",autoHideDuration:8e3,action:An})}()},className:Wn.button,children:"Save"})})]})})]}),Object(ce.jsxs)("main",{children:[Object(ce.jsx)("div",{className:Wn.heroContent,children:Object(ce.jsxs)($.a,{maxWidth:"sm",children:[Object(ce.jsx)(T.a,{component:"h1",variant:"h2",align:"center",color:"textPrimary",gutterBottom:!0,children:"Bot Manager"}),Object(ce.jsx)(T.a,{variant:"h5",align:"center",color:"textSecondary",paragraph:!0,children:"Create, start, stop & delete your bots"}),Object(ce.jsx)("div",{className:Wn.heroButtons,children:Object(ce.jsx)(p.a,{container:!0,spacing:2,justify:"center",children:Object(ce.jsx)(p.a,{item:!0,children:Object(ce.jsx)(m.a,{variant:"contained",color:"primary",onClick:function(){ot(!0),Ce&&Ce.emit("add-bot",Q.token)},children:"Add new bot"})})})})]})}),Object(ce.jsxs)($.a,{className:Wn.cardGrid,maxWidth:"md",children:[Object(ce.jsx)(p.a,{container:!0,spacing:4,children:ye&&ye.length>0&&ye.map((function(e){return Object(ce.jsx)(ie,{bot:e,mode:a,callback:Rn},e.botID)}))}),Object(ce.jsx)(f.a,{mb:4})]})]}),Object(ce.jsx)("div",{className:Wn.bottomPush,children:Object(ce.jsx)("footer",{className:Wn.footer,children:Object(ce.jsxs)(p.a,{container:!0,alignItems:"center",children:[Object(ce.jsxs)(p.a,{container:!0,item:!0,xs:12,sm:6,md:3,alignItems:"center",justify:"flex-start",children:[Object(ce.jsx)(p.a,{item:!0,children:Object(ce.jsx)(F.a,{onChange:Ln,value:a,control:Object(ce.jsx)(Ve,{checked:"dark"===a,color:"secondary"}),label:Object(ce.jsx)(T.a,{variant:"button",children:Object(ce.jsx)(f.a,{color:"#FFF",children:"Light"})}),labelPlacement:"start"})}),Object(ce.jsx)(p.a,{item:!0,children:Object(ce.jsx)(Nn,{disableRipple:!0,onClick:Ln,children:Object(ce.jsx)(T.a,{variant:"button",children:Object(ce.jsx)(f.a,{color:"#FFF",children:"Dark"})})})})]}),Object(ce.jsxs)(V.a,{xsDown:!0,children:[Object(ce.jsx)(p.a,{item:!0,xs:!1,sm:6,md:6,children:Object(ce.jsx)(Qe,{})}),Object(ce.jsx)(V.a,{xsDown:!0,children:Object(ce.jsx)(p.a,{item:!0,xs:!1,md:3})})]})]})})}),Object(ce.jsxs)(y.a,{open:dt,onClose:En,children:[Object(ce.jsx)(S.a,{children:"Confirm Delete"}),Object(ce.jsxs)(k.a,{children:[Object(ce.jsxs)(C.a,{children:["Warning: your bot, its configuration, and all its data will be deleted. Enter the bot name to confirm deletion: ",Object(ce.jsx)("b",{children:Ct.botname})]}),Object(ce.jsx)(v.a,{autoFocus:!0,color:"light"===a?"primary":"secondary",margin:"dense",id:"botname",label:"Bot name",type:"text",value:Ft,onChange:function(e){Bt(e.target.value)},fullWidth:!0})]}),Object(ce.jsxs)(w.a,{children:[Object(ce.jsx)(m.a,{variant:"contained",onClick:En,color:"light"===a?"primary":"secondary",children:"Cancel"}),Object(ce.jsx)(m.a,{variant:"contained",onClick:function(e){Ft===Ct.botname&&(jt(!1),Ce&&Ce.emit("delete-bot",Ct.botID,Q.token))},color:"light"===a?"primary":"secondary",children:"Delete bot"})]})]}),Object(ce.jsxs)(y.a,{open:ht,onClose:Mn,children:[Object(ce.jsx)(S.a,{children:"Confirm Update"}),Object(ce.jsx)(k.a,{children:Object(ce.jsx)(C.a,{children:"Do you want to update to the latest version? Balance Bot will be unavailable until the update has completed. This may take a few minutes. Just wait for the Bot Manager to reappear."})}),Object(ce.jsxs)(w.a,{children:[Object(ce.jsx)(m.a,{variant:"contained",onClick:Mn,color:"light"===a?"primary":"secondary",children:"Cancel"}),Object(ce.jsx)(m.a,{variant:"contained",onClick:function(){Ot(!1),Ce&&Ce.emit("update-bb",Q.token)},color:"light"===a?"primary":"secondary",children:"Update"})]})]})]})})}var tt=function(e){var t=e.wdt,a=e.update,n=e.logout,c=e.onLogout,r=e.badge,i=e.openDrawer,o=e.handleUpdateOpen,s=e.checkForUpdate,l=e.checkIconColor;return Object(ce.jsxs)(p.a,{item:!0,xs:!0,container:!0,direction:"row",alignItems:"center",justify:"flex-end",style:{maxWidth:t},children:[a?Object(ce.jsx)(V.a,{xsDown:!0,children:Object(ce.jsx)(p.a,{item:!0,style:{width:"130px"},children:Object(ce.jsx)(be.a,{onClick:o,label:"Update Available",style:{backgroundColor:"#959FD6",color:"white"}})})}):Object(ce.jsx)(V.a,{xsDown:!0,children:Object(ce.jsx)(p.a,{item:!0,style:{width:"40px"},children:Object(ce.jsx)($e,{title:"Check for updates",children:Object(ce.jsx)(We.a,{onClick:s,children:Object(ce.jsx)(H.a,{style:{color:l}})})})})}),Object(ce.jsx)(p.a,{item:!0,children:Object(ce.jsx)($e,{title:"Settings",children:Object(ce.jsx)(We.a,{onClick:i,children:"false"===r?Object(ce.jsx)(Ne.a,{style:{color:"#fff"}}):Object(ce.jsx)(R.a,{badgeContent:"!",color:"secondary",children:Object(ce.jsx)(Ne.a,{style:{color:"#fff"}})})})})}),n&&Object(ce.jsx)(p.a,{item:!0,style:{width:"48px"},children:Object(ce.jsx)($e,{title:"Logout",children:Object(ce.jsx)(We.a,{onClick:c,children:Object(ce.jsx)(U.a,{style:{color:"#ffffff"}})})})})]})},at=Object(h.a)((function(e){return{root:{display:"flex"},appBar:{zIndex:e.zIndex.drawer+1},logo:{maxWidth:60,padding:10},content:{justify:"flex-start",alignItems:"flex-start",flexGrow:1,padding:e.spacing(2)},footer:{marginTop:"auto",backgroundColor:"#000000"},bottomPush:{position:"fixed",width:"100%",bottom:0,paddingBottom:0,zIndex:e.zIndex.drawer+1}}}));function nt(){return Object(ce.jsx)(f.a,{color:"#FFF",height:54,p:2,children:Object(ce.jsxs)(T.a,{variant:"body2",align:"center",children:["Copyright \xa9 ",Object(ce.jsx)(ee.a,{style:{color:"#ffffff",textDecoration:"none"},href:"https://hodlerhacks.com/",target:"_blank",rel:"noopener",children:"hodlerhacks.com"})," ",(new Date).getFullYear()]})})}function ct(){var e=Je.version,t=fe("mode","light"),a=Object(o.a)(t,2),r=a[0],i=(a[1],Object(n.useContext)(Se)),s=Object(o.a)(i,2),l=s[0],d=l.status,j=l.access,b=(l.serverversion,l.publicKey),u=(s[1],Object(n.useState)(!1)),h=Object(o.a)(u,2),O=h[0],F=h[1],B=Object(n.useState)("initial state"),P=Object(o.a)(B,2),W=P[0],D=P[1],N=Object(n.useState)(!1),A=Object(o.a)(N,2),z=A[0],E=A[1],R=Object(n.useState)(!1),L=Object(o.a)(R,2),q=L[0],M=L[1],U=Object(n.useState)(""),Y=Object(o.a)(U,2),H=Y[0],G=Y[1],J=Object(n.useState)(""),Z=Object(o.a)(J,2),K=Z[0],X=Z[1],_=new ve.Crypt({md:"sha256",rsaStandard:"RSA-OAEP"});Object(n.useEffect)((function(){document.title="BB | Bot Dashboard";var e=function(){var e=window.location.pathname.match(/user\/(\w{3,})/);return e?e[1]:""}();return e&&(G(e),M(!0)),function(){}}),[]),Object(n.useEffect)((function(){return"disconnected"===d?setTimeout((function(){"disconnected"===d&&E(!0)}),4e3):E(!1),function(){}}),[d]),Object(n.useEffect)((function(){return j&&(F(!1),E(!1),!0===j.allow?D(""):!1===j.allow&&"login required"===j.reason?(D("Please log in"),F(!0)):!1===j.allow&&"2FA required"===j.reason?D("Add your client's IP address to the IP whitelist, or temporarily allow access through your Telegram bot"):!1===j.allow&&"temporary access not allowed"===j.reason?D("Add your client's IP address to the IP whitelist"):!1===j.allow&&"access timeout"===j.reason?ee():!1===j.allow&&"temporary access timeout"===j.reason?D("Your temporary access has expired"):!1===j.allow&&"2FA login required"===j.reason?D("2FA required - approve login through your Telegram bot"):!1===j.allow&&"invalid credentials"===j.reason?(D("Incorrect username or password - please try again"),F(!0)):!1===j.allow&&"2FA login rejected"===j.reason?D("2FA login was rejected"):!1===j.allow&&"temporary access rejected"===j.reason?D("Temporary access was rejected"):!1===j.allow&&"logged out"===j.reason?ee():!1===j.allow&&"initial state"===j.reason?(D("initial state"),setTimeout((function(){"initial state"===j.reason&&E(!0)}),4e3)):!1===j.allow&&"reload"===j.reason&&ee()),function(){}}),[j]);var Q=Object(me.a)({palette:{type:r}}),V=at(),$=function(e){"username"===e.target.id&&G(e.target.value),"password"===e.target.id&&X(e.target.value)},ee=function(){window.location.reload()},te=Object(qe.b)(),ae=te.enqueueSnackbar,ne=te.closeSnackbar,re=function(e){return Object(ce.jsx)(c.a.Fragment,{children:Object(ce.jsx)(m.a,{style:{color:"#bbbbbb"},onClick:function(){ne(e)},children:"Dismiss"})})};return Object(ce.jsxs)(xe.a,{theme:Q,children:[Object(ce.jsx)(c.a.Fragment,{children:Object(ce.jsxs)("div",{className:V.root,children:[Object(ce.jsx)(g.a,{}),Object(ce.jsx)(x.a,{position:"fixed",className:V.appBar,children:Object(ce.jsxs)(I.a,{children:[Object(ce.jsx)("img",{src:"/logo192.png",alt:"Balance Bot Logo",className:V.logo}),Object(ce.jsx)(p.a,{container:!0,direction:"row",alignItems:"center",nowrap:"true",children:Object(ce.jsxs)(p.a,{item:!0,xs:!0,zeroMinWidth:!0,children:[Object(ce.jsx)(f.a,{mt:1.5,children:Object(ce.jsx)(T.a,{variant:"h6",color:"inherit",noWrap:!0,children:"Balance Bot"})}),Object(ce.jsx)(f.a,{mt:-1,style:{color:"#959FD6"},children:Object(ce.jsxs)(T.a,{variant:"caption",color:"inherit",noWrap:!0,children:["v",e]})})]})})]})}),Object(ce.jsx)("main",{className:V.content,children:Object(ce.jsx)(I.a,{})})]})}),"disconnected"===d&&"initial state"!==W?Object(ce.jsxs)(y.a,{open:z,fullWidth:!0,maxWidth:"sm",children:[Object(ce.jsxs)(k.a,{children:[Object(ce.jsx)(C.a,{children:Object(ce.jsx)(T.a,{variant:"overline",color:"secondary",children:"The connection with the server has been lost"})}),Object(ce.jsx)(C.a,{children:Object(ce.jsx)(T.a,{variant:"overline",color:"textPrimary",children:"Balance Bot may have stopped running"})})]}),Object(ce.jsx)(w.a,{children:Object(ce.jsx)(m.a,{variant:"contained",onClick:ee,color:"secondary",children:"Retry"})})]}):O?Object(ce.jsxs)(c.a.Fragment,{children:[Object(ce.jsx)(g.a,{}),Object(ce.jsxs)(y.a,{open:!0,fullWidth:!0,maxWidth:"sm",children:[Object(ce.jsx)(S.a,{children:W}),Object(ce.jsxs)(k.a,{children:[!q&&Object(ce.jsx)(v.a,{variant:"outlined",margin:"normal",required:!0,fullWidth:!0,id:"username",label:"Username",name:"username",onChange:$}),Object(ce.jsx)(v.a,{variant:"outlined",margin:"normal",required:!0,fullWidth:!0,name:"password",label:"Password",type:"password",id:"password",onChange:$}),Object(ce.jsx)(f.a,{m:3}),Object(ce.jsx)(m.a,{fullWidth:!0,variant:"contained",color:"secondary",onClick:function(){var e=(new Date).getTime();Ce&&Ce.emit("login",{username:H,password:_.encrypt(b,"".concat(K,"@").concat(e))})},children:"Log In"}),Object(ce.jsx)(f.a,{m:3}),Object(ce.jsx)(m.a,{fullWidth:!0,onClick:function(){Ce&&Ce.emit("reset-password"),ae("See your Telegram bot to reset password",{variant:"success",autoHideDuration:8e3,action:re})},color:"default",style:{fontSize:"10px"},children:"Forgot password"})]})]})]}):"initial state"===W?Object(ce.jsxs)(y.a,{open:z,fullWidth:!0,maxWidth:"sm",children:[Object(ce.jsxs)(k.a,{children:[Object(ce.jsx)(C.a,{children:Object(ce.jsx)(T.a,{variant:"overline",color:"secondary",children:"Balance Bot seems to be down"})}),Object(ce.jsx)(C.a,{children:Object(ce.jsx)(T.a,{variant:"overline",color:"textPrimary",children:"Please check your server and try again"})})]}),Object(ce.jsx)(w.a,{children:Object(ce.jsx)(m.a,{variant:"contained",onClick:ee,color:"secondary",children:"Retry"})})]}):!j.allow&&Object(ce.jsxs)(y.a,{open:!0,fullWidth:!0,maxWidth:"sm",children:[Object(ce.jsxs)(k.a,{children:[Object(ce.jsx)(C.a,{children:Object(ce.jsx)(T.a,{variant:"overline",color:"secondary",children:"Notification"})}),Object(ce.jsx)(C.a,{children:Object(ce.jsx)(T.a,{variant:"overline",color:"textPrimary",children:W})})]}),Object(ce.jsx)(w.a,{children:Object(ce.jsx)(m.a,{variant:"contained",onClick:ee,color:"secondary",children:"Back"})})]}),Object(ce.jsx)("div",{className:V.bottomPush,children:Object(ce.jsx)("footer",{className:V.footer,children:Object(ce.jsx)(p.a,{container:!0,alignItems:"center",children:Object(ce.jsx)(p.a,{item:!0,xs:!1,sm:12,md:12,children:Object(ce.jsx)(nt,{})})})})})]})}var rt=function(){var e=Object(n.useContext)(Se)[0],t=e.status,a=e.access,c=Object(n.useState)(!0),r=Object(o.a)(c,2),i=r[0],s=r[1];return Object(n.useEffect)((function(){return s(!a.allow||"disconnected"===t),function(){}}),[a,t]),Object(ce.jsx)("div",{children:i?Object(ce.jsx)(ct,{}):Object(ce.jsx)(et,{})})},it=a(419);function ot(){var e=Je.version,t=Object(n.useContext)(Se),a=Object(o.a)(t,2),c=a[0],r=c.status,i=c.serverversion,s=c.publicKey,l=a[1],d=Object(n.useContext)(Te)[1],j=Object(n.useContext)(Be)[1],u=fe("publicKey",""),h=Object(o.a)(u,2),O=h[0],x=h[1],m=fe("uuid",""),f=Object(o.a)(m,2),g=f[0],p=f[1];return Object(n.useEffect)((function(){return void 0!==O&&s&&s.includes("-----BEGIN PUBLIC KEY-----")&&(s!==O?(x(s),setTimeout((function(){window.location.reload()}),500)):"starting"===r&&"0.0"!==i&&e!==i?window.location.reload():"starting"===r&&l((function(e){return Object(b.a)(Object(b.a)({},e),{},{status:"connected"})}))),function(){}}),[s,O,r,i]),Object(n.useEffect)((function(){return""===g&&(p(Object(it.a)()),setTimeout((function(){window.location.reload()}),500)),function(){}}),[]),Object(n.useEffect)((function(){return Ce.on("status",(function(e){l((function(t){return Object(b.a)(Object(b.a)({},t),e)}))})),Ce.on("settings",(function(e){d(e)})),Ce.on("bots",(function(e){j(e)})),Ce.on("disconnect",(function(e){l((function(e){return Object(b.a)(Object(b.a)({},e),{},{status:"disconnected"})}))})),function(){Ce.disconnect()}}),[]),null}var st=function(){return Object(ce.jsx)(qe.a,{maxSnack:5,children:Object(ce.jsx)(Ie,{children:Object(ce.jsx)(Fe,{children:Object(ce.jsxs)(Pe,{children:[Object(ce.jsx)(ot,{}),Object(ce.jsx)(g.a,{}),Object(ce.jsx)(rt,{})]})})})})},lt=function(e){e&&e instanceof Function&&a.e(3).then(a.bind(null,425)).then((function(t){var a=t.getCLS,n=t.getFID,c=t.getFCP,r=t.getLCP,i=t.getTTFB;a(e),n(e),c(e),r(e),i(e)}))};i.a.render(Object(ce.jsx)(c.a.StrictMode,{children:Object(ce.jsx)(st,{})}),document.getElementById("root")),lt()},78:function(e){e.exports=JSON.parse('{"version":"2.3.4"}')}},[[333,1,2]]]);
  //# sourceMappingURL=main.c630376d.chunk.js.map