"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[906],{7906:function(e,n,t){t.d(n,{S:function(){return R},M:function(){return J}});var r=t(4051),o=t.n(r),s=t(5893),c=t(7294),a=t(5152),i=t(7357),l=t(4799),u=t(8333),d=t(9309),f=t(5861),x=t(3321),h=t(1496),v=t(594),p=t(1846),m=t(3679),y=t(7169),g="0xffe3",w="0xffe9",b=[{keys:"Ctrl + Alt + Delete",scans:[]},{keys:"Ctrl + Alt + F1",scans:[g,w,"0xffbe"]},{keys:"Ctrl + Alt + F2",scans:[g,w,"0xffbf"]},{keys:"Ctrl + Alt + F3",scans:[g,w,"0xffc0"]},{keys:"Ctrl + Alt + F4",scans:[g,w,"0xffc1"]},{keys:"Ctrl + Alt + F5",scans:[g,w,"0xffc2"]},{keys:"Ctrl + Alt + F6",scans:[g,w,"0xffc3"]},{keys:"Ctrl + Alt + F7",scans:[g,w,"0xffc4"]},{keys:"Ctrl + Alt + F8",scans:[g,w,"0xffc5"]},{keys:"Ctrl + Alt + F9",scans:[g,w,"0xffc6"]}],j=t(8336);function k(e,n,t,r,o,s,c){try{var a=e[s](c),i=a.value}catch(l){return void t(l)}a.done?n(i):Promise.resolve(i).then(r,o)}var C=function(){var e,n=(e=o().mark((function e(n,t,r){var s,c,a;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s=new AbortController,c=setTimeout((function(){return s.abort()}),r),e.next=4,fetch(n,{method:"PUT",headers:{"Content-Type":"application/json","Keep-Alive":"timeout=120"},signal:s.signal,body:JSON.stringify(t)});case 4:return a=e.sent,clearTimeout(c),e.abrupt("return",a);case 7:case"end":return e.stop()}}),e)})),function(){var n=this,t=arguments;return new Promise((function(r,o){var s=e.apply(n,t);function c(e){k(s,r,o,c,a,"next",e)}function a(e){k(s,r,o,c,a,"throw",e)}c(void 0)}))});return function(e,t,r){return n.apply(this,arguments)}}(),B=C,P=t(2416),Z=t(2152);function A(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t=0;t-=1)w.current.sendKey(e[t],0)}else w.current.sendCtrlAltDel();g(null)}}(t)},className:E.keysItem,children:(0,s.jsx)(f.Z,{variant:"subtitle1",children:n})},n)}))})]})]})]}):(0,s.jsx)(i.Z,{display:"flex",className:E.spinnerBox,children:_?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(i.Z,{style:{paddingBottom:"2em"},children:(0,s.jsx)(P.z,{text:"There was a problem connecting to the server, please try again"})}),(0,s.jsx)(x.Z,{variant:"contained",onClick:function(){D(!1)},style:{textTransform:"none"},children:(0,s.jsx)(f.Z,{className:E.buttonText,variant:"subtitle1",children:"Reconnect"})})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(P.z,{text:"Establishing connection with ".concat(r)}),(0,s.jsx)(P.z,{text:"This may take a few minutes"}),(0,s.jsx)(Z.Z,{})]})})]})})};D.defaultProps={onClickCloseButton:void 0};var R=D,z=t(9628),O=t(2787),L=t(2029),M=t(1706);function V(e,n,t,r,o,s,c){try{var a=e[s](c),i=a.value}catch(l){return void t(l)}a.done?n(i):Promise.resolve(i).then(r,o)}var G={externalPreview:"",headerEndAdornment:null,isExternalPreviewStale:!1,isFetchPreview:!0,isShowControls:!0,isUseInnerPanel:!1,onClickConnectButton:void 0,onClickPreview:void 0,serverName:""},K=function(e){var n=e.children;return e.isUseInnerPanel?(0,s.jsx)(m.Lg,{children:n}):(0,s.jsx)(m.s_,{children:n})},q=function(e){var n=e.children,t=e.isUseInnerPanel,r=e.text;return t?(0,s.jsxs)(m.CH,{children:[r?(0,s.jsx)(P.Ac,{text:r}):(0,s.jsx)(s.Fragment,{}),n]}):(0,s.jsxs)(m.V9,{children:[r?(0,s.jsx)(P.z,{text:r}):(0,s.jsx)(s.Fragment,{}),n]})},H=function(e){var n=e.externalPreview,t=void 0===n?G.externalPreview:n,r=e.headerEndAdornment,a=e.isExternalPreviewStale,u=void 0===a?G.isExternalPreviewStale:a,d=e.isFetchPreview,f=void 0===d?G.isFetchPreview:d,x=e.isShowControls,h=void 0===x?G.isShowControls:x,v=e.isUseInnerPanel,p=void 0===v?G.isUseInnerPanel:v,m=e.onClickPreview,g=e.serverName,w=e.serverUUID,b=e.onClickConnectButton,j=void 0===b?m:b,k=(0,c.useState)(!1),C=k[0],B=k[1],P=(0,c.useState)(""),Z=P[0],A=P[1];return(0,c.useEffect)((function(){var e;f?(e=o().mark((function e(){var n,t,r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,fetch("".concat(L.Z,"/server/").concat(w,"?ss"),{method:"GET",headers:{"Content-Type":"application/json"}});case 3:return n=e.sent,e.next=6,n.json();case 6:t=e.sent,r=t.screenshot,A(r),B(!1),e.next=15;break;case 12:e.prev=12,e.t0=e.catch(0),B(!0);case 15:case"end":return e.stop()}}),e,null,[[0,12]])})),function(){var n=this,t=arguments;return new Promise((function(r,o){var s=e.apply(n,t);function c(e){V(s,r,o,c,a,"next",e)}function a(e){V(s,r,o,c,a,"throw",e)}c(void 0)}))})():t&&(A(t),B(u))}),[t,u,f,w]),(0,s.jsxs)(K,{isUseInnerPanel:p,children:[(0,s.jsx)(q,{isUseInnerPanel:p,text:g,children:r}),(0,s.jsxs)(i.Z,{sx:{display:"flex",width:"100%","& > :not(:last-child)":{marginRight:"1em"}},children:[(0,s.jsx)(i.Z,{children:(0,s.jsx)(l.Z,{component:"span",onClick:m,sx:{borderRadius:y.n_,color:y.s7,padding:0},children:Z?(0,s.jsx)(i.Z,{alt:"",component:"img",src:"data:image/png;base64,".concat(Z),sx:{height:"100%",opacity:C?"0.4":"1",padding:p?".2em":0,width:"100%"}}):(0,s.jsx)(z.Z,{sx:{height:"100%",width:"100%"}})})}),h&&(0,s.jsx)(i.Z,{children:(0,s.jsx)(M.Z,{onClick:j,children:(0,s.jsx)(O.Z,{})})})]})]})};H.defaultProps=G;var J=H}}]);