(window.webpackJsonp=window.webpackJsonp||[]).push([[125],{"6xWC":function(tt,ue,l){"use strict";l.r(ue);var y=l("k16G"),s=l("q1tI"),x=l.n(s);function H(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 c=arguments.length,m=new Array(c),g=0;g1&&arguments[1]!==void 0?arguments[1]:{};V.initial(e),V.handler(t);var n={current:e},r=C(ye)(n,t),a=C(re)(n),i=C(V.changes)(e),c=C(Y)(n);function m(){var W=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(T){return T};return V.selector(W),W(n.current)}function g(W){je(r,a,i,c)(W)}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 R(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 c=arguments.length,m=new Array(c),g=0;g2&&arguments[2]!==void 0?arguments[2]:!0,r=Object(s.useRef)(!0);Object(s.useEffect)(r.current||!n?function(){r.current=!1}:e,t)}var U=xt;function ie(){}function qe(e,t,n,r){return St(e,r)||Nt(e,t,n,r)}function St(e,t){return e.editor.getModel(Qe(e,t))}function Nt(e,t,n,r){return e.editor.createModel(t,n,r&&Qe(e,r))}function Qe(e,t){return e.Uri.parse(t)}function Lt(e){return e===void 0}function De(e){var t=e.original,n=e.modified,r=e.language,a=e.originalLanguage,i=e.modifiedLanguage,c=e.originalModelPath,m=e.modifiedModelPath,g=e.keepCurrentOriginalModel,W=e.keepCurrentModifiedModel,T=e.theme,Z=e.loading,P=e.options,Pe=e.height,xe=e.width,Se=e.className,Ne=e.wrapperClassName,Le=e.beforeMount,Re=e.onMount,Ue=Object(s.useState)(!1),$=Object(y.a)(Ue,2),M=$[0],Ie=$[1],ge=Object(s.useState)(!0),h=Object(y.a)(ge,2),he=h[0],ke=h[1],w=Object(s.useRef)(null),O=Object(s.useRef)(null),ve=Object(s.useRef)(null),_=Object(s.useRef)(Re),d=Object(s.useRef)(Le);we(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 w.current?We():p.cancel()}}),U(function(){var p=w.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),U(function(){w.current.getModel().original.setValue(t)},[t],M),U(function(){var p=w.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),U(function(){O.current.editor.setTheme(T)},[T],M),U(function(){w.current.updateOptions(P)},[P],M);var se=Object(s.useCallback)(function(){d.current(O.current);var p=O.current.editor.createModel(t,a||r,c&&O.current.Uri.parse(c)),E=O.current.editor.createModel(n,i||r,m&&O.current.Uri.parse(m));w.current.setModel({original:p,modified:E})},[r,n,i,t,a,c,m]),be=Object(s.useCallback)(function(){w.current=O.current.editor.createDiffEditor(ve.current,Object(Q.a)({automaticLayout:!0},P)),se(),O.current.editor.setTheme(T),Ie(!0)},[P,T,se]);Object(s.useEffect)(function(){M&&_.current(w.current,O.current)},[M]),Object(s.useEffect)(function(){!he&&!M&&be()},[he,M,be]);function We(){var p=w.current.getModel();if(!g){var E;(E=p.original)===null||E===void 0||E.dispose()}if(!W){var G;(G=p.modified)===null||G===void 0||G.dispose()}w.current.dispose()}return x.a.createElement(Ye,{width:xe,height:Pe,isEditorReady:M,loading:Z,_ref:ve,className:Se,wrapperClassName:Ne})}De.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},De.defaultProps={theme:"light",loading:"Loading...",options:{},keepCurrentOriginalModel:!1,keepCurrentModifiedModel:!1,width:"100%",height:"100%",beforeMount:ie,onMount:ie};var Rt=De,Ut=Object(s.memo)(Rt),qt=Ut;function It(){var e=Object(s.useState)(ae.__getMonacoInstance()),t=Object(y.a)(e,2),n=t[0],r=t[1];return we(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(s.useRef)();return Object(s.useEffect)(function(){t.current=e},[e]),t.current}var Wt=kt,Ht=fe.create({backup:null}),Ze=Object(y.a)(Ht,2),$e=Ze[0],Vt=Ze[1],pe=new Map;function Ae(e){var t=e.defaultValue,n=e.defaultLanguage,r=e.defaultPath,a=e.value,i=e.language,c=e.path,m=e.theme,g=e.line,W=e.loading,T=e.options,Z=e.overrideServices,P=e.saveViewState,Pe=e.keepCurrentModel,xe=e.width,Se=e.height,Ne=e.className,Le=e.wrapperClassName,Re=e.beforeMount,Ue=e.onMount,$=e.onChange,M=e.onValidate,Ie=Object(s.useState)(!1),ge=Object(y.a)(Ie,2),h=ge[0],he=ge[1],ke=Object(s.useState)(!0),w=Object(y.a)(ke,2),O=w[0],ve=w[1],_=Object(s.useRef)(null),d=Object(s.useRef)(null),se=Object(s.useRef)(null),be=Object(s.useRef)(Ue),We=Object(s.useRef)(Re),p=Object(s.useRef)(null),E=Object(s.useRef)(a),G=Wt(c);we(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()}}),U(function(){var v=qe(_.current,t||a,n||i,c);v!==d.current.getModel()&&(P&&pe.set(G,d.current.saveViewState()),d.current.setModel(v),P&&d.current.restoreViewState(pe.get(c)))},[c],h),U(function(){d.current.updateOptions(T)},[T],h),U(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),U(function(){_.current.editor.setModelLanguage(d.current.getModel(),i)},[i],h),U(function(){Lt(g)||d.current.revealLine(g)},[g],h),U(function(){_.current.editor.setTheme(m)},[m],h);var et=Object(s.useCallback)(function(){We.current(_.current);var v=c||r,b=qe(_.current,a||t,n||i,v);d.current=_.current.editor.create(se.current,Object(Q.a)({model:b,automaticLayout:!0},T),Z),P&&d.current.restoreViewState(pe.get(v)),_.current.editor.setTheme(m),$e().backup||Vt({backup:_.current.editor.setModelMarkers}),he(!0)},[t,n,r,a,i,c,T,Z,P,m]);Object(s.useEffect)(function(){h&&be.current(d.current,_.current)},[h]),Object(s.useEffect)(function(){!O&&!h&&et()},[O,h,et]),E.current=a,Object(s.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(s.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(c,d.current.saveViewState());else{var b;(b=d.current.getModel())===null||b===void 0||b.dispose()}d.current.dispose()}return x.a.createElement(Ye,{width:xe,height:Se,isEditorReady:h,loading:W,_ref:se,className:Ne,wrapperClassName:Le})}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(s.memo)(zt),Kt=Bt,Ft=l("9kvl"),Xt=l("Dqnf"),Jt=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(s.useState)("// type your cod222e..."),c=Object(y.a)(i,2),m=c[0],g=c[1],W={selectOnLineNumbers:!0},T=function(){},Z=function(){};return Object(s.useEffect)(function(){setTimeout(function(){Jt.a.publish("create-socket",1)},500)},[]),x.a.createElement("div",null,x.a.createElement(Xt.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}),x.a.createElement(Kt,{width:800,height:400,language:"javascript",theme:"hc-black",value:m,options:W,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("XEnU"),s=l("k16G"),x=l("Cmcn"),H=l("q1tI"),te=l.n(H),ne=l("J66h"),He=l.n(ne),ce=l("/POA"),Ve=l.n(ce),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,N=I._core._renderService.dimensions.actualCellHeight||18,f=Math.floor(j/N),D=Math.floor(C/S);return[D,f]}function de(C,j){var I=new _e.default(function(S){var N=Object(x.a)(S),f;try{for(N.s();!(f=N.n()).done;){var D=f.value;if(D.target.offsetHeight>0||D.target.offsetWidth>0){var L=le(D.target.offsetWidth,D.target.offsetHeight,C),F=Object(s.a)(L,2),X=F[0],A=F[1];console.log("cols, rows",X,A),C.resize(X,A),B.a.publish("ssh-xterm-resize",{columns:X,rows:A,width:D.target.offsetWidth,height:D.target.offsetHeight})}}}catch(u){N.e(u)}finally{N.f()}});return I.observe(j),I}var je=3e4;ue.a=function(C){var j=C.sshConfigData,I=C.sid,S=Object(H.useState)(null),N=Object(s.a)(S,2),f=N[0],D=N[1],L=j.ws_url,F=j.password,X=j.port,A=Object(H.useRef)(),u=Object(H.useRef)(),V=Object(H.useRef)(!1);return Object(H.useEffect)(function(){if(A.current&&L){var k=new ce.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..."),D(k);var Y=de(k,A.current);return function(){k.dispose(),Y.unobserve(A.current)}}},[L,A.current]),Object(H.useEffect)(function(){if(f&&L){var k=function(){var z=new WebSocket(L);u.current=z,z.onopen=function(){var R=f.element.parentElement;if(R){var J=R.offsetWidth,q=R.offsetHeight;console.log("init",{tp:"init",data:Object(y.a)(Object(y.a)({},j),{},{secret:F,width:J,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:J,height:q,rows:f.rows,columns:f.cols})}))}f.focus()},z.onerror=function(R){console.log("------in socket error----",R,z,L)},z.onmessage=function(R){V.current||(f.write("\r"),setTimeout(function(){},1e3)),V.current=!0,console.log("event:",R);var J=ne.Base64.decode(R.data.toString()),q=f._core._renderService.dimensions.actualCellWidth||9.5;console.log("data:",J,q,f),f.write(J)},z.onclose=function(R){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(),V.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(),V.current=!1)}}},[f,L,X]),te.a.createElement("div",{ref:A,className:"xterm-panel"},L?null:te.a.createElement("p",{style:{color:"#fff"}},"\u6B63\u5728\u8FDE\u63A5\u547D\u4EE4\u884C\u670D\u52A1..."))}}}]);