"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[724],{38724:function(e,r,n){n.r(r);var t=n(85893),c=n(94460),u=n(67294);let l=e=>{let{background:r="",clipViewport:n=!1,compressionLevel:t=2,dragViewport:u=!1,focusOnClick:l=!1,onConnect:o,onDisconnect:s,onWsClose:i,onWsError:a,qualityLevel:d=6,resizeSession:v=!0,rfb:f,rfbScreen:E,scaleViewport:p=!0,showDotCursor:m=!1,url:w,viewOnly:h=!1}=e;if(!(null==E?void 0:E.current)||(null==f?void 0:f.current))return;E.current.innerHTML="",f.current=new c.Z(E.current,w),f.current.background=r,f.current.clipViewport=n,f.current.compressionLevel=t,f.current.dragViewport=u,f.current.focusOnClick=l,f.current.qualityLevel=d,f.current.resizeSession=v,f.current.scaleViewport=p,f.current.showDotCursor=m,f.current.viewOnly=h,o&&f.current.addEventListener("connect",o),s&&f.current.addEventListener("disconnect",s);let k=f.current._sock,_=k._eventHandlers.close,L=k._eventHandlers.error;k.on("close",e=>{_(e),null==i||i.call(null,e)}),k.on("error",e=>{L(e),null==a||a.call(null,e)})},o=e=>{(null==e?void 0:e.current)&&(e.current.disconnect(),e.current=null)},s=e=>{let{onConnect:r,onDisconnect:n,onWsClose:c,onWsError:s,rfb:i,rfbConnectArgs:a,rfbScreen:d,url:v}=e;return(0,u.useEffect)(()=>{if(a){let{url:e=v}=a;e&&l({onConnect:r,onDisconnect:n,onWsClose:c,onWsError:s,rfb:i,rfbScreen:d,url:e,...a})}else o(i)},[v,r,n,c,s,i,a,d]),(0,u.useEffect)(()=>()=>{o(i)},[i]),(0,t.jsx)("div",{style:{width:"100%",height:"75vh"},ref:d,onMouseEnter:()=>{document.activeElement&&document.activeElement instanceof HTMLElement&&document.activeElement.blur(),(null==i?void 0:i.current)&&i.current.focus()}})};s.displayName="VncDisplay",r.default=s}}]);