(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[753],{6187:function(e,n,t){"use strict";t.d(n,{Z:function(){return _}});var r=t(5893),o=t(6265),i=t(7294),s=t(5258),c=t(1120),a=t(7748),l=t(282),u=[{text:"Files",image:"/pngs/files_on.png",uri:"/striker?files=true"},{text:"Tasks",image:"/pngs/tasks_no-jobs_icon.png",uri:"/striker?jobs=true"},{text:"Configure",image:"/pngs/configure_icon_on.png",uri:"/striker?configure=true"},{text:"Striker",image:"/pngs/striker_icon_on.png",uri:"/striker?striker=true"},{text:"Anvil",image:"/pngs/anvil_icon_on.png",uri:"/striker?anvil=true"},{text:"Email",image:"/pngs/email_on.png",uri:"/striker?email=true"},{text:"Logout",image:"/pngs/users_icon_on.png",uri:"/striker?logout=true"},{text:"Help",image:"/pngs/help_icon_on.png",uri:"https://alteeve.com/w/Support"}],d={width:"40em",height:"40em"},p=t(8788),f=t(7159),x=t(2822),m=t(998),h=t(5517),g=t(7623),b=t(442),j=t(4724);function v(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function y(e){for(var n=1;n ./VncDisplay"]}}),S=(0,l.Z)((function(){return{displayBox:{width:"75vw",height:"75vh",paddingTop:"1em",paddingBottom:0,paddingLeft:0,paddingRight:0},spinnerBox:{flexDirection:"column",width:"75vw",height:"75vh",alignItems:"center",justifyContent:"center"},closeButton:{borderRadius:8,backgroundColor:w.hM,"&:hover":{backgroundColor:w.hM}},keyboardButton:{borderRadius:8,backgroundColor:w.lD,"&:hover":{backgroundColor:w.lD}},closeBox:{paddingBottom:"1em",paddingLeft:".7em",paddingRight:0},buttonsBox:{paddingTop:0},keysItem:{backgroundColor:w.lD,paddingRight:"3em","&:hover":{backgroundColor:w.lD}},buttonText:{color:w.E5}}})),P=function(e){var n=e.setMode,t=e.uuid,o=e.serverName,s=(0,i.useState)(null),c=s[0],l=s[1],u=(0,i.useRef)(),f=(0,i.useRef)(void 0),Z=(0,i.useState)(void 0),k=Z[0],P=Z[1],T=(0,i.useState)(!1),E=T[0],A=T[1],R=S();(0,i.useEffect)((function(){f.current=window.location.hostname,k||(0,p.Z)(d().mark((function e(){var n;return d().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,_("".concat("/cgi-bin","/manage_vnc_pipes"),{server_uuid:t,is_open:!0},12e4);case 3:return n=e.sent,e.t0=P,e.next=7,n.json();case 7:e.t1=e.sent,(0,e.t0)(e.t1),e.next=14;break;case 11:e.prev=11,e.t2=e.catch(0),A(!0);case 14:case"end":return e.stop()}}),e,null,[[0,11]])})))()}),[t,k,E]);var F=function(){var e=(0,p.Z)(d().mark((function e(){return d().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,N.Z)("".concat("/cgi-bin","/manage_vnc_pipes"),{server_uuid:t,is_open:!1});case 2:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return(0,r.jsxs)(y.s_,{children:[(0,r.jsx)(a.Z,{flexGrow:1,children:(0,r.jsx)(O.z,{text:"Server: ".concat(o)})}),k?(0,r.jsxs)(a.Z,{display:"flex",className:R.displayBox,children:[(0,r.jsx)(D,{rfb:u,url:"".concat(k.protocol,"://").concat(f.current,":").concat(k.forward_port),viewOnly:!1,focusOnClick:!1,clipViewport:!1,dragViewport:!1,scaleViewport:!0,resizeSession:!0,showDotCursor:!1,background:"",qualityLevel:6,compressionLevel:2}),(0,r.jsxs)(a.Z,{children:[(0,r.jsx)(a.Z,{className:R.closeBox,children:(0,r.jsx)(v.Z,{className:R.closeButton,style:{color:w.lD},component:"span",onClick:function(){F(),n(!0)},children:(0,r.jsx)(b.Z,{})})}),(0,r.jsxs)(a.Z,{className:R.closeBox,children:[(0,r.jsx)(v.Z,{className:R.keyboardButton,style:{color:w.E5},component:"span",onClick:function(e){l(e.currentTarget)},children:(0,r.jsx)(j.Z,{})}),(0,r.jsx)(x.Z,{anchorEl:c,keepMounted:!0,open:Boolean(c),onClose:function(){return l(null)},children:C.map((function(e){var n=e.keys,t=e.scans;return(0,r.jsx)(m.Z,{onClick:function(){return function(e){if(u.current){if(e.length){for(var n=0;n<=e.length-1;n+=1)u.current.sendKey(e[n],1);for(var t=e.length-1;t>=0;t-=1)u.current.sendKey(e[t],0)}else u.current.sendCtrlAltDel();l(null)}}(t)},className:R.keysItem,children:(0,r.jsx)(h.Z,{variant:"subtitle1",children:n})},n)}))})]})]})]}):(0,r.jsx)(a.Z,{display:"flex",className:R.spinnerBox,children:E?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(a.Z,{style:{paddingBottom:"2em"},children:(0,r.jsx)(O.z,{text:"There was a problem connecting to the server, please try again"})}),(0,r.jsx)(g.Z,{variant:"contained",onClick:function(){A(!1)},style:{textTransform:"none"},children:(0,r.jsx)(h.Z,{className:R.buttonText,variant:"subtitle1",children:"Reconnect"})})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(O.z,{text:"Establishing connection with ".concat(o)}),(0,r.jsx)(O.z,{text:"This may take a few minutes"}),(0,r.jsx)(B.Z,{})]})})]})},T=t(306),E=t(4849),A=(0,l.Z)((function(){return{displayBox:{padding:0,paddingTop:".7em",width:"100%"},fullScreenButton:{borderRadius:8,backgroundColor:w.lD,"&:hover":{backgroundColor:w.lD}},fullScreenBox:{paddingLeft:"1em",padding:0},imageButton:{padding:0,color:w.lD},imageIcon:{borderRadius:8,padding:0,backgroundColor:w.s7,fontSize:"8em"}}})),R=function(e){var n=e.setMode,t=e.serverName,o=A();return(0,r.jsxs)(y.s_,{children:[(0,r.jsx)(a.Z,{flexGrow:1,children:(0,r.jsx)(O.z,{text:"Server: ".concat(t)})}),(0,r.jsxs)(a.Z,{display:"flex",className:o.displayBox,children:[(0,r.jsx)(a.Z,{children:(0,r.jsx)(v.Z,{className:o.imageButton,style:{color:w.E5},component:"span",onClick:function(){return n(!1)},children:(0,r.jsx)(E.Z,{className:o.imageIcon})})}),(0,r.jsx)(a.Z,{className:o.fullScreenBox,children:(0,r.jsx)(v.Z,{className:o.fullScreenButton,style:{color:w.E5},component:"span",onClick:function(){return n(!1)},children:(0,r.jsx)(T.Z,{})})})]})]})},F=t(6187),z=(0,l.Z)((function(e){return{preview:(0,o.Z)({width:"25%",height:"100%"},e.breakpoints.down("md"),{width:"100%"}),fullView:{display:"flex",flexDirection:"row",width:"100%",justifyContent:"center"}}})),L=function(){var e=(0,i.useState)(!0),n=e[0],t=e[1],o=z(),l=(0,s.useRouter)().query,u=l.uuid,d=l.server_name;return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(c.default,{children:(0,r.jsx)("title",{children:d})}),(0,r.jsx)(F.Z,{}),"string"===typeof u&&(n?(0,r.jsx)(a.Z,{className:o.preview,children:(0,r.jsx)(R,{setMode:t,serverName:d})}):(0,r.jsx)(a.Z,{className:o.fullView,children:(0,r.jsx)(P,{setMode:t,uuid:u,serverName:d})}))]})}},8954:function(e,n,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/server",function(){return t(3871)}])}},function(e){e.O(0,[774,642,643,888,179],(function(){return n=8954,e(e.s=n);var n}));var n=e.O();_N_E=n}]);