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