(window.webpackJsonp=window.webpackJsonp||[]).push([[123],{"6xWC":function(tt,ue,l){"use strict";l.r(ue);var y=l("tJVT"),c=l("q1tI"),N=l.n(c);function W(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function te(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function ne(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?e.apply(this,a):function(){for(var s=arguments.length,m=new Array(s),g=0;g1&&arguments[1]!==void 0?arguments[1]:{};H.initial(e),H.handler(t);var n={current:e},r=C(ye)(n,t),a=C(re)(n),i=C(H.changes)(e),s=C(Y)(n);function m(){var V=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(T){return T};return H.selector(V),V(n.current)}function g(V){je(r,a,i,s)(V)}return[m,g]}function Y(e,t){return S(t)?t(e.current):t}function re(e,t){return e.current=de(de({},e.current),t),t}function ye(e,t,n){return S(t)?t(e.current):Object.keys(n).forEach(function(r){var a;return(a=t[r])===null||a===void 0?void 0:a.call(t,e.current[r])}),n}var Ce={create:k},fe=Ce,K={paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.25.2/min/vs"}},z=K;function U(e){return function t(){for(var n=this,r=arguments.length,a=new Array(r),i=0;i=e.length?e.apply(this,a):function(){for(var s=arguments.length,m=new Array(s),g=0;g2&&arguments[2]!==void 0?arguments[2]:!0,r=Object(c.useRef)(!0);Object(c.useEffect)(r.current||!n?function(){r.current=!1}:e,t)}var x=Nt;function ie(){}function qe(e,t,n,r){return St(e,r)||Lt(e,t,n,r)}function St(e,t){return e.editor.getModel(Qe(e,t))}function Lt(e,t,n,r){return e.editor.createModel(t,n,r&&Qe(e,r))}function Qe(e,t){return e.Uri.parse(t)}function Rt(e){return e===void 0}function we(e){var t=e.original,n=e.modified,r=e.language,a=e.originalLanguage,i=e.modifiedLanguage,s=e.originalModelPath,m=e.modifiedModelPath,g=e.keepCurrentOriginalModel,V=e.keepCurrentModifiedModel,T=e.theme,Z=e.loading,P=e.options,Pe=e.height,Ne=e.width,Se=e.className,Le=e.wrapperClassName,Re=e.beforeMount,Ue=e.onMount,xe=Object(c.useState)(!1),$=Object(y.a)(xe,2),M=$[0],Ie=$[1],ge=Object(c.useState)(!0),h=Object(y.a)(ge,2),he=h[0],ke=h[1],D=Object(c.useRef)(null),O=Object(c.useRef)(null),ve=Object(c.useRef)(null),_=Object(c.useRef)(Ue),d=Object(c.useRef)(Re);De(function(){var p=ae.init();return p.then(function(E){return(O.current=E)&&ke(!1)}).catch(function(E){return(E==null?void 0:E.type)!=="cancelation"&&console.error("Monaco initialization: error:",E)}),function(){return D.current?Ve():p.cancel()}}),x(function(){var p=D.current.getModifiedEditor();p.getOption(O.current.editor.EditorOption.readOnly)?p.setValue(n):n!==p.getValue()&&(p.executeEdits("",[{range:p.getModel().getFullModelRange(),text:n,forceMoveMarkers:!0}]),p.pushUndoStop())},[n],M),x(function(){D.current.getModel().original.setValue(t)},[t],M),x(function(){var p=D.current.getModel(),E=p.original,G=p.modified;O.current.editor.setModelLanguage(E,a||r),O.current.editor.setModelLanguage(G,i||r)},[r,a,i],M),x(function(){O.current.editor.setTheme(T)},[T],M),x(function(){D.current.updateOptions(P)},[P],M);var ce=Object(c.useCallback)(function(){d.current(O.current);var p=O.current.editor.createModel(t,a||r,s&&O.current.Uri.parse(s)),E=O.current.editor.createModel(n,i||r,m&&O.current.Uri.parse(m));D.current.setModel({original:p,modified:E})},[r,n,i,t,a,s,m]),be=Object(c.useCallback)(function(){D.current=O.current.editor.createDiffEditor(ve.current,Object(Q.a)({automaticLayout:!0},P)),ce(),O.current.editor.setTheme(T),Ie(!0)},[P,T,ce]);Object(c.useEffect)(function(){M&&_.current(D.current,O.current)},[M]),Object(c.useEffect)(function(){!he&&!M&&be()},[he,M,be]);function Ve(){var p=D.current.getModel();if(!g){var E;(E=p.original)===null||E===void 0||E.dispose()}if(!V){var G;(G=p.modified)===null||G===void 0||G.dispose()}D.current.dispose()}return N.a.createElement(Ye,{width:Ne,height:Pe,isEditorReady:M,loading:Z,_ref:ve,className:Se,wrapperClassName:Le})}we.propTypes={original:o.a.string,modified:o.a.string,language:o.a.string,originalLanguage:o.a.string,modifiedLanguage:o.a.string,originalModelPath:o.a.string,modifiedModelPath:o.a.string,keepCurrentOriginalModel:o.a.bool,keepCurrentModifiedModel:o.a.bool,theme:o.a.string,loading:o.a.oneOfType([o.a.element,o.a.string]),options:o.a.object,width:o.a.oneOfType([o.a.number,o.a.string]),height:o.a.oneOfType([o.a.number,o.a.string]),className:o.a.string,wrapperClassName:o.a.string,beforeMount:o.a.func,onMount:o.a.func},we.defaultProps={theme:"light",loading:"Loading...",options:{},keepCurrentOriginalModel:!1,keepCurrentModifiedModel:!1,width:"100%",height:"100%",beforeMount:ie,onMount:ie};var Ut=we,xt=Object(c.memo)(Ut),qt=xt;function It(){var e=Object(c.useState)(ae.__getMonacoInstance()),t=Object(y.a)(e,2),n=t[0],r=t[1];return De(function(){var a;return n||(a=ae.init(),a.then(function(i){r(i)})),function(){var i;return(i=a)===null||i===void 0?void 0:i.cancel()}}),n}var Qt=It;function kt(e){var t=Object(c.useRef)();return Object(c.useEffect)(function(){t.current=e},[e]),t.current}var Vt=kt,Wt=fe.create({backup:null}),Ze=Object(y.a)(Wt,2),$e=Ze[0],Ht=Ze[1],pe=new Map;function Ae(e){var t=e.defaultValue,n=e.defaultLanguage,r=e.defaultPath,a=e.value,i=e.language,s=e.path,m=e.theme,g=e.line,V=e.loading,T=e.options,Z=e.overrideServices,P=e.saveViewState,Pe=e.keepCurrentModel,Ne=e.width,Se=e.height,Le=e.className,Re=e.wrapperClassName,Ue=e.beforeMount,xe=e.onMount,$=e.onChange,M=e.onValidate,Ie=Object(c.useState)(!1),ge=Object(y.a)(Ie,2),h=ge[0],he=ge[1],ke=Object(c.useState)(!0),D=Object(y.a)(ke,2),O=D[0],ve=D[1],_=Object(c.useRef)(null),d=Object(c.useRef)(null),ce=Object(c.useRef)(null),be=Object(c.useRef)(xe),Ve=Object(c.useRef)(Ue),p=Object(c.useRef)(null),E=Object(c.useRef)(a),G=Vt(s);De(function(){var v=ae.init();return v.then(function(b){return(_.current=b)&&ve(!1)}).catch(function(b){return(b==null?void 0:b.type)!=="cancelation"&&console.error("Monaco initialization: error:",b)}),function(){return d.current?Yt():v.cancel()}}),x(function(){var v=qe(_.current,t||a,n||i,s);v!==d.current.getModel()&&(P&&pe.set(G,d.current.saveViewState()),d.current.setModel(v),P&&d.current.restoreViewState(pe.get(s)))},[s],h),x(function(){d.current.updateOptions(T)},[T],h),x(function(){d.current.getOption(_.current.editor.EditorOption.readOnly)?d.current.setValue(a):a!==d.current.getValue()&&(d.current.executeEdits("",[{range:d.current.getModel().getFullModelRange(),text:a,forceMoveMarkers:!0}]),d.current.pushUndoStop())},[a],h),x(function(){_.current.editor.setModelLanguage(d.current.getModel(),i)},[i],h),x(function(){Rt(g)||d.current.revealLine(g)},[g],h),x(function(){_.current.editor.setTheme(m)},[m],h);var et=Object(c.useCallback)(function(){Ve.current(_.current);var v=s||r,b=qe(_.current,a||t,n||i,v);d.current=_.current.editor.create(ce.current,Object(Q.a)({model:b,automaticLayout:!0},T),Z),P&&d.current.restoreViewState(pe.get(v)),_.current.editor.setTheme(m),$e().backup||Ht({backup:_.current.editor.setModelMarkers}),he(!0)},[t,n,r,a,i,s,T,Z,P,m]);Object(c.useEffect)(function(){h&&be.current(d.current,_.current)},[h]),Object(c.useEffect)(function(){!O&&!h&&et()},[O,h,et]),E.current=a,Object(c.useEffect)(function(){if(h&&$){var v,b;(v=p.current)===null||v===void 0||v.dispose(),p.current=(b=d.current)===null||b===void 0?void 0:b.onDidChangeModelContent(function(Ee){var ee=d.current.getValue();E.current!==ee&&$(ee,Ee)})}},[h,$]),Object(c.useEffect)(function(){h&&(_.current.editor.setModelMarkers=function(v,b,Ee){var ee;(ee=$e().backup)===null||ee===void 0||ee.call(_.current.editor,v,b,Ee),M==null||M(Ee)})},[h,M]);function Yt(){var v;if((v=p.current)===null||v===void 0||v.dispose(),Pe)P&&pe.set(s,d.current.saveViewState());else{var b;(b=d.current.getModel())===null||b===void 0||b.dispose()}d.current.dispose()}return N.a.createElement(Ye,{width:Ne,height:Se,isEditorReady:h,loading:V,_ref:ce,className:Le,wrapperClassName:Re})}Ae.propTypes={defaultValue:o.a.string,defaultPath:o.a.string,defaultLanguage:o.a.string,value:o.a.string,language:o.a.string,path:o.a.string,theme:o.a.string,line:o.a.number,loading:o.a.oneOfType([o.a.element,o.a.string]),options:o.a.object,overrideServices:o.a.object,saveViewState:o.a.bool,keepCurrentModel:o.a.bool,width:o.a.oneOfType([o.a.number,o.a.string]),height:o.a.oneOfType([o.a.number,o.a.string]),className:o.a.string,wrapperClassName:o.a.string,beforeMount:o.a.func,onMount:o.a.func,onChange:o.a.func,onValidate:o.a.func},Ae.defaultProps={theme:"light",loading:"Loading...",options:{},overrideServices:{},saveViewState:!0,keepCurrentModel:!1,width:"100%",height:"100%",beforeMount:ie,onMount:ie,onValidate:ie};var zt=Ae,Bt=Object(c.memo)(zt),Kt=Bt,Ft=l("9kvl"),Jt=l("Dqnf"),Xt=l("dhSg");ae.config({"vs/nls":{availableLanguages:{"*":"zh-cn"}}});var Gt=function(t){var n=t.index,r=t.loading,a=t.dispatch,i=Object(c.useState)("// type your cod222e..."),s=Object(y.a)(i,2),m=s[0],g=s[1],V={selectOnLineNumbers:!0},T=function(){},Z=function(){};return Object(c.useEffect)(function(){setTimeout(function(){Xt.a.publish("create-socket",1)},500)},[]),N.a.createElement("div",null,N.a.createElement(Jt.a,{sshConfigData:{host:"106.75.231.63",port:"2021",ws_url:"wss://pre-webssh.educoder.net/ws",username:"root",password:"123123",game_id:4799882,webssh_url:"http://172.16.94.254:8890/bridge",secret:"Dron_123123",width:1004,height:603,rows:33,columns:104},sid:1}),N.a.createElement(Kt,{width:800,height:400,language:"javascript",theme:"hc-black",value:m,options:V,onChange:T,editorDidMount:Z}))},Zt=ue.default=Object(Ft.a)(function(e){var t=e.index,n=e.loading;return{index:t,loading:n.models.index}})(Gt)},Dqnf:function(tt,ue,l){"use strict";var y=l("k1fw"),c=l("tJVT"),N=l("rAM+"),W=l("q1tI"),te=l.n(W),ne=l("J66h"),We=l.n(ne),se=l("/POA"),He=l.n(se),Oe=l("q7KB"),Me=l.n(Oe),B=l("dhSg"),_e=l("bdgK");function le(C,j,I){var S=I._core._renderService.dimensions.actualCellWidth||9.5,L=I._core._renderService.dimensions.actualCellHeight||18,f=Math.floor(j/L),w=Math.floor(C/S);return[w,f]}function de(C,j){var I=new _e.default(function(S){var L=Object(N.a)(S),f;try{for(L.s();!(f=L.n()).done;){var w=f.value;if(w.target.offsetHeight>0||w.target.offsetWidth>0){var R=le(w.target.offsetWidth,w.target.offsetHeight,C),F=Object(c.a)(R,2),J=F[0],A=F[1];console.log("cols, rows",J,A),C.resize(J,A),B.a.publish("ssh-xterm-resize",{columns:J,rows:A,width:w.target.offsetWidth,height:w.target.offsetHeight})}}}catch(u){L.e(u)}finally{L.f()}});return I.observe(j),I}var je=3e4;ue.a=function(C){var j=C.sshConfigData,I=C.sid,S=Object(W.useState)(null),L=Object(c.a)(S,2),f=L[0],w=L[1],R=j.ws_url,F=j.password,J=j.port,A=Object(W.useRef)(),u=Object(W.useRef)(),H=Object(W.useRef)(!1);return Object(W.useEffect)(function(){if(A.current&&R){var k=new se.Terminal({fontSize:16,rendererType:"dom"});k.open(A.current),k.onData(function(re){u.current&&(u.current.readyState===1&&(u.current.send(JSON.stringify({tp:"client",data:re})),B.a.publish("on-operating-ssh")))}),k.write("Connecting..."),w(k);var Y=de(k,A.current);return function(){k.dispose(),Y.unobserve(A.current)}}},[R,A.current]),Object(W.useEffect)(function(){if(f&&R){var k=function(){var z=new WebSocket(R);u.current=z,z.onopen=function(){var U=f.element.parentElement;if(U){var X=U.offsetWidth,q=U.offsetHeight;console.log("init",{tp:"init",data:Object(y.a)(Object(y.a)({},j),{},{secret:F,width:X,height:q,rows:f.rows,columns:f.cols})}),z.send(JSON.stringify({tp:"init",data:Object(y.a)(Object(y.a)({},j),{},{secret:F,width:X,height:q,rows:f.rows,columns:f.cols})}))}f.focus()},z.onerror=function(U){console.log("------in socket error----",U,z,R)},z.onmessage=function(U){H.current||(f.write("\r"),setTimeout(function(){},1e3)),H.current=!0,console.log("event:",U);var X=ne.Base64.decode(U.data.toString()),q=f._core._renderService.dimensions.actualCellWidth||9.5;console.log("data:",X,q,f),f.write(X)},z.onclose=function(U){Y&&clearInterval(Y),f.write(`\r connection closed`)}},Y=setInterval(function(){u.current&&u.current.send(JSON.stringify({tp:"h"}))},je),re=B.a.subscribe("create-socket",function(K){I==K&&(u.current&&u.current.readyState===1?f.focus():k(),f.focus())}),ye=B.a.subscribe("close-socket",function(K){I===K&&(u.current&&(u.current.close(),H.current=!1,f.clear()),u.current=null)}),Ce=B.a.subscribe("ssh-xterm-resize",function(K){u.current&&u.current.readyState===1&&u.current.send(JSON.stringify({tp:"resize",data:Object(y.a)({},K)}))}),fe=B.a.subscribe("ssh-add-connect-time",function(){u.current&&u.current.readyState===1&&u.current.send(JSON.stringify({tp:"overtime"}))});return function(){ye(),re(),Ce(),fe(),u.current&&(u.current.close(),H.current=!1)}}},[f,R,J]),te.a.createElement("div",{ref:A,className:"xterm-panel"},R?null:te.a.createElement("p",{style:{color:"#fff"}},"\u6B63\u5728\u8FDE\u63A5\u547D\u4EE4\u884C\u670D\u52A1..."))}}}]);