var CreateAmtRemoteTerminal=function(e,r){var l={};l.DivId=e,l.DivElement=document.getElementById(e),l.protocol=1,r.protocol&&(l.protocol=r.protocol),l.terminalEmulation=1,l.fxEmulation=0,l.lineFeed="\r\n",l.debugmode=0,l.width=80,l.height=25,l.heightLock=0;var m,f=["000000","BB0000","00BB00","BBBB00","0000BB","BB00BB","00BBBB","BBBBBB","555555","FF5555","55FF55","FFFF55","5555FF","FF55FF","55FFFF","FFFFFF"],u=0,g=7,w=0,C=!0,S=0,T=0,a=0,h=0,o=0,c=[],s=0,d=0,b=[],k=[],n=!1,v=!0,p=!1,y=[],t="";l.title=null,l.onTitleChange=null,l.Start=function(){},l.Init=function(e,r){l.width=e||80,l.height=r||25;for(var t=0;t":p=!1,o=0;break;case"7":a=S,h=T,o=0;break;case"8":S=a,T=h,o=0;break;case"M":for(var t=m[1];t>=m[0]+1;t--)for(var i=0;im[0]-1;t--)for(i=0;il.height&&(T=l.height));break;case"C":1==t&&(0==r[0]?S++:S+=r[0],S>l.width&&(S=l.width));break;case"D":1==t&&(0==r[0]?S--:S-=r[0],S<0&&(S=0));break;case"d":1==t&&(T=(T=r[0]-1)>l.height?l.height:T)<0&&(T=0);break;case"G":1==t&&(S=(S=r[0]-1)<0?0:S)>l.width-1&&(S=l.width-1);break;case"P":var h=1;for(1==t&&(h=r[0]),n=S;nl.height&&(r[0]=l.height),r[1]>l.width&&(r[1]=l.width),T=r[0]-1,r[1]-1):T=0;break;case"m":for(n=0;nl.height-1&&(m[0]=l.height-1),m[1]<0&&(m[1]=0),m[1]>l.height-1&&(m[1]=l.height-1),m[0]>m[1]&&(m[0]=m[1]);break;case"S":h=1;1==t&&(h=r[0]);for(var c=m[0];c<=m[1]-h;c++)for(var f=0;fm[0]+h;c--)for(f=0;fm[0];c--)for(f=0;f=l.width&&(s=0,d++);break;default:console.log("Unknown terminal code",e,r,i)}}}(e,c,s+1,d),o=0;break;case 4:case 5:o=0;break;case 6:var n=e.charCodeAt(0);";"==e?s++:7==n?(function(e){if(0==e.length)return;var r=parseInt(e[0]);(0==r||2==r)&&1l.width&&(S=l.width),T>l.height-1&&(T=l.height-1),e){case"\b":0m[1]&&(l.recordLineTobackBuffer(0),P(1),T=m[1]),l.lineFeed="\r",S=0;break;case"\r":S=0;break;default:S>=l.width&&(S=0,C&&T++,T>=l.height-1&&(P(1),T=l.height-1)),F(e),S++}}}function F(e){k[T][S]=e,b[T][S]=(g<<6)+(w<<12)+u}function E(){for(var e=(g<<6)+(w<<12)+u,r=S;r")},l.TermDrawLine=function(e,r,t){for(var i,n,a,h,o=1,c=0;c>h&63],1&i&&(e+=";text-decoration:underline"),e+=';">',t=""+(t=""),o=i),n=k[r][c]){case"&":e+="&";break;case"<":e+="<";break;case">":e+=">";break;case" ":e+=" ";break;default:e+=n}return[e,t]},l.TermDraw=function(){for(var e="",r="",t=0;t")}var n=(y=800"+n+r+e+"",l.DivElement.scrollTop=l.DivElement.scrollHeight,0==l.heightLock&&setTimeout(l.TermLockHeight,10)},l.TermLockHeight=function(){l.heightLock=l.DivElement.clientHeight,l.DivElement.style.height=l.DivElement.parentNode.style.height=l.heightLock+"px",l.DivElement.style["overflow-y"]="scroll"},l.TermInit=function(){l.TermResetScreen()},l.heightLock=0,l.DivElement.style.height="",null!=r&&null!=r.cols&&null!=r.rows?l.Init(r.cols,r.rows):l.Init(),l}