diff --git a/js/dist/gotty-bundle.js b/js/dist/gotty-bundle.js index b95cbae..db822a9 100644 --- a/js/dist/gotty-bundle.js +++ b/js/dist/gotty-bundle.js @@ -24,7 +24,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ -Object.defineProperty(t,"__esModule",{value:!0});var c=r(15),u=r(1),d=r(22),p=r(23),f=r(25),g=r(2),m=r(16),y=r(18),b=r(19),_=r(17),C=r(20),w=r(24),S=r(9),v=r(10),A="undefined"!=typeof window?window.document:null;n(i,u.EventEmitter),i.prototype.eraseAttr=function(){return-512&this.defAttr|511&this.curAttr},i.tangoColors=["#2e3436","#cc0000","#4e9a06","#c4a000","#3465a4","#75507b","#06989a","#d3d7cf","#555753","#ef2929","#8ae234","#fce94f","#729fcf","#ad7fa8","#34e2e2","#eeeeec"],i.colors=function(){function e(e,r,i){o.push("#"+t(e)+t(r)+t(i))}function t(e){return(e=e.toString(16)).length<2?"0"+e:e}var r,o=i.tangoColors.slice(),s=[0,95,135,175,215,255];for(r=0;r<216;r++)e(s[r/36%6|0],s[r/6%6|0],s[r%6]);for(r=0;r<24;r++)e(s=8+10*r,s,s);return o}(),i._colors=i.colors.slice(),i.vcolors=function(){for(var e,t=[],r=i.colors,o=0;o<256;o++)e=parseInt(r[o].substring(1),16),t.push([e>>16&255,e>>8&255,255&e]);return t}(),i.defaults={colors:i.colors,theme:"default",convertEol:!1,termName:"xterm",geometry:[80,24],cursorBlink:!1,cursorStyle:"block",visualBell:!1,popOnBell:!1,scrollback:1e3,screenKeys:!1,debug:!1,cancelEvents:!1,disableStdin:!1,useFlowControl:!1,tabStopWidth:8},i.options={},i.focus=null,function(e,t,r){if(e.forEach)return e.forEach(t,r);for(var i=0;it){var o=this.lines.length-t,s=this.ydisp-o<0;this.lines.trimStart(o),this.ybase=Math.max(this.ybase-o,0),this.ydisp=Math.max(this.ydisp-o,0),s&&this.refresh(0,this.rows-1)}this.lines.maxLength=t,this.viewport.syncScrollArea()}}switch(this[e]=t,this.options[e]=t,e){case"cursorBlink":this.setCursorBlinking(t);break;case"cursorStyle":this.element.classList.toggle("xterm-cursor-style-underline","underline"===t),this.element.classList.toggle("xterm-cursor-style-bar","bar"===t);break;case"tabStopWidth":this.setupStops()}},i.prototype.restartCursorBlinking=function(){this.setCursorBlinking(this.options.cursorBlink)},i.prototype.setCursorBlinking=function(e){if(this.element.classList.toggle("xterm-cursor-blink",e),this.clearCursorBlinkingInterval(),e){var t=this;this.cursorBlinkInterval=setInterval(function(){t.element.classList.toggle("xterm-cursor-blink-on")},600)}},i.prototype.clearCursorBlinkingInterval=function(){this.element.classList.remove("xterm-cursor-blink-on"),this.cursorBlinkInterval&&(clearInterval(this.cursorBlinkInterval),this.cursorBlinkInterval=null)},i.bindFocus=function(e){o(e.textarea,"focus",function(t){e.sendFocus&&e.send(g.C0.ESC+"[I"),e.element.classList.add("focus"),e.showCursor(),e.restartCursorBlinking.apply(e),i.focus=e,e.emit("focus",{terminal:e})})},i.prototype.blur=function(){return this.textarea.blur()},i.bindBlur=function(e){o(e.textarea,"blur",function(t){e.refresh(e.y,e.y),e.sendFocus&&e.send(g.C0.ESC+"[O"),e.element.classList.remove("focus"),e.clearCursorBlinkingInterval.apply(e),i.focus=null,e.emit("blur",{terminal:e})})},i.prototype.initGlobal=function(){var e=this,t=this;i.bindKeys(this),i.bindFocus(this),i.bindBlur(this),o(this.element,"copy",function(r){e.mouseEvents||p.copyHandler(r,t,e.selectionManager)});var r=function(e){return p.pasteHandler(e,t)};o(this.textarea,"paste",r),o(this.element,"paste",r),t.browser.isFirefox?o(this.element,"mousedown",function(t){2==t.button&&p.rightClickHandler(t,e.textarea,e.selectionManager)}):o(this.element,"contextmenu",function(t){p.rightClickHandler(t,e.textarea,e.selectionManager)}),t.browser.isLinux&&o(this.element,"auxclick",function(t){1===t.button&&p.moveTextAreaUnderMouseCursor(t,e.textarea,e.selectionManager)})},i.bindKeys=function(e){o(e.element,"keydown",function(t){A.activeElement==this&&e.keyDown(t)},!0),o(e.element,"keypress",function(t){A.activeElement==this&&e.keyPress(t)},!0),o(e.element,"keyup",function(t){h(t)||e.focus(e)},!0),o(e.textarea,"keydown",function(t){e.keyDown(t)},!0),o(e.textarea,"keypress",function(t){e.keyPress(t),this.value=""},!0),o(e.textarea,"compositionstart",e.compositionHelper.compositionstart.bind(e.compositionHelper)),o(e.textarea,"compositionupdate",e.compositionHelper.compositionupdate.bind(e.compositionHelper)),o(e.textarea,"compositionend",e.compositionHelper.compositionend.bind(e.compositionHelper)),e.on("refresh",e.compositionHelper.updateCompositionElements.bind(e.compositionHelper)),e.on("refresh",function(t){e.queueLinkification(t.start,t.end)})},i.prototype.insertRow=function(e){return"object"!=typeof e&&(e=A.createElement("div")),this.rowContainer.appendChild(e),this.children.push(e),e},i.prototype.open=function(e,t){var r=this,i=this,s=0;if(this.parent=e||this.parent,!this.parent)throw new Error("Terminal requires a parent element.");for(this.context=this.parent.ownerDocument.defaultView,this.document=this.parent.ownerDocument,this.body=this.document.getElementsByTagName("body")[0],this.element=this.document.createElement("div"),this.element.classList.add("terminal"),this.element.classList.add("xterm"),this.element.classList.add("xterm-theme-"+this.theme),this.setCursorBlinking(this.options.cursorBlink),this.element.setAttribute("tabindex",0),this.viewportElement=A.createElement("div"),this.viewportElement.classList.add("xterm-viewport"),this.element.appendChild(this.viewportElement),this.viewportScrollArea=A.createElement("div"),this.viewportScrollArea.classList.add("xterm-scroll-area"),this.viewportElement.appendChild(this.viewportScrollArea),this.selectionContainer=A.createElement("div"),this.selectionContainer.classList.add("xterm-selection"),this.element.appendChild(this.selectionContainer),this.rowContainer=A.createElement("div"),this.rowContainer.classList.add("xterm-rows"),this.element.appendChild(this.rowContainer),this.children=[],this.linkifier.attachToDom(A,this.children),this.helperContainer=A.createElement("div"),this.helperContainer.classList.add("xterm-helpers"),this.element.appendChild(this.helperContainer),this.textarea=A.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this.textarea.addEventListener("focus",function(){i.emit("focus",{terminal:i})}),this.textarea.addEventListener("blur",function(){i.emit("blur",{terminal:i})}),this.helperContainer.appendChild(this.textarea),this.compositionView=A.createElement("div"),this.compositionView.classList.add("composition-view"),this.compositionHelper=new c.CompositionHelper(this.textarea,this.compositionView,this),this.helperContainer.appendChild(this.compositionView),this.charSizeStyleElement=A.createElement("style"),this.helperContainer.appendChild(this.charSizeStyleElement);s div{height:"+this.charMeasure.height+"px;}"},i.prototype.bindMouse=function(){function e(e){var t,r;if(t=n(e),r=v.getRawByteCoords(e,l.rowContainer,l.charMeasure,l.cols,l.rows))switch(i(t,r),e.overrideType||e.type){case"mousedown":h=t;break;case"mouseup":h=32}}function t(e){var t,r=h;(t=v.getRawByteCoords(e,l.rowContainer,l.charMeasure,l.cols,l.rows))&&i(r+=32,t)}function r(e,t){if(l.utfMouse){if(2047===t)return e.push(0);t<127?e.push(t):(t>2047&&(t=2047),e.push(192|t>>6),e.push(128|63&t))}else{if(255===t)return e.push(0);t>127&&(t=127),e.push(t)}}function i(e,t){if(l.vt300Mouse){e&=3,t.x-=32,t.y-=32;var i=g.C0.ESC+"[24";if(0===e)i+="1";else if(1===e)i+="3";else if(2===e)i+="5";else{if(3===e)return;i+="0"}return i+="~["+t.x+","+t.y+"]\r",void l.send(i)}return l.decLocator?(e&=3,t.x-=32,t.y-=32,0===e?e=2:1===e?e=4:2===e?e=6:3===e&&(e=3),void l.send(g.C0.ESC+"["+e+";"+(3===e?4:0)+";"+t.y+";"+t.x+";"+(t.page||0)+"&w")):l.urxvtMouse?(t.x-=32,t.y-=32,t.x++,t.y++,void l.send(g.C0.ESC+"["+e+";"+t.x+";"+t.y+"M")):l.sgrMouse?(t.x-=32,t.y-=32,void l.send(g.C0.ESC+"[<"+((3==(3&e)?-4&e:e)-32)+";"+t.x+";"+t.y+(3==(3&e)?"m":"M"))):(r(i=[],e),r(i,t.x),r(i,t.y),void l.send(g.C0.ESC+"[M"+String.fromCharCode.apply(String,i)))}function n(e){var t,r,i,o,s;switch(e.overrideType||e.type){case"mousedown":t=null!=e.button?+e.button:null!=e.which?e.which-1:null,l.browser.isMSIE&&(t=1===t?0:4===t?1:t);break;case"mouseup":t=3;break;case"DOMMouseScroll":t=e.detail<0?64:65;break;case"wheel":t=e.wheelDeltaY>0?64:65}return r=e.shiftKey?4:0,i=e.metaKey?8:0,o=e.ctrlKey?16:0,s=r|i|o,l.vt200Mouse?s&=o:l.normalMouse||(s=0),t=32+(s<<2)+t}var a=this.element,l=this,h=32;o(a,"mousedown",function(r){if(l.mouseEvents)return e(r),l.focus(),l.vt200Mouse?(r.overrideType="mouseup",e(r),l.cancel(r)):(l.normalMouse&&o(l.document,"mousemove",t),l.x10Mouse||o(l.document,"mouseup",function r(i){return e(i),l.normalMouse&&s(l.document,"mousemove",t),s(l.document,"mouseup",r),l.cancel(i)}),l.cancel(r))}),o(a,"wheel",function(t){if(l.mouseEvents&&!(l.x10Mouse||l.vt300Mouse||l.decLocator))return e(t),l.cancel(t)}),o(a,"wheel",function(e){if(!l.mouseEvents)return l.viewport.onWheel(e),l.cancel(e)}),o(a,"touchstart",function(e){if(!l.mouseEvents)return l.viewport.onTouchStart(e),l.cancel(e)}),o(a,"touchmove",function(e){if(!l.mouseEvents)return l.viewport.onTouchMove(e),l.cancel(e)})},i.prototype.destroy=function(){this.readable=!1,this.writable=!1,this._events={},this.handler=function(){},this.write=function(){},this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element)},i.prototype.refresh=function(e,t){this.renderer&&this.renderer.queueRefresh(e,t)},i.prototype.queueLinkification=function(e,t){if(this.linkifier)for(var r=e;r<=t;r++)this.linkifier.linkifyRow(r)},i.prototype.showCursor=function(){this.cursorState||(this.cursorState=1,this.refresh(this.y,this.y))},i.prototype.scroll=function(e){var t;this.lines.length===this.lines.maxLength&&(this.lines.trimStart(1),this.ybase--,0!==this.ydisp&&this.ydisp--),this.ybase++,this.userScrolling||(this.ydisp=this.ybase),t=this.ybase+this.rows-1,(t-=this.rows-1-this.scrollBottom)===this.lines.length?this.lines.push(this.blankLine(void 0,e)):this.lines.splice(t,0,this.blankLine(void 0,e)),0!==this.scrollTop&&(0!==this.ybase&&(this.ybase--,this.userScrolling||(this.ydisp=this.ybase)),this.lines.splice(this.ybase+this.scrollTop,1)),this.updateRange(this.scrollTop),this.updateRange(this.scrollBottom),this.emit("scroll",this.ydisp)},i.prototype.scrollDisp=function(e,t){if(e<0){if(0===this.ydisp)return;this.userScrolling=!0}else e+this.ydisp>=this.ybase&&(this.userScrolling=!1);this.ydisp+=e,this.ydisp>this.ybase?this.ydisp=this.ybase:this.ydisp<0&&(this.ydisp=0),t||this.emit("scroll",this.ydisp),this.refresh(0,this.rows-1)},i.prototype.scrollPages=function(e){this.scrollDisp(e*(this.rows-1))},i.prototype.scrollToTop=function(){this.scrollDisp(-this.ydisp)},i.prototype.scrollToBottom=function(){this.scrollDisp(this.ybase-this.ydisp)},i.prototype.write=function(e){if(this.writeBuffer.push(e),this.options.useFlowControl&&!this.xoffSentToCatchUp&&this.writeBuffer.length>=5&&(this.send(g.C0.DC3),this.xoffSentToCatchUp=!0),!this.writeInProgress&&this.writeBuffer.length>0){this.writeInProgress=!0;var t=this;setTimeout(function(){t.innerWrite()})}},i.prototype.innerWrite=function(){for(var e=this.writeBuffer.splice(0,300);e.length>0;){var t=e.shift();t.length;this.xoffSentToCatchUp&&0===e.length&&0===this.writeBuffer.length&&(this.send(g.C0.DC1),this.xoffSentToCatchUp=!1),this.refreshStart=this.y,this.refreshEnd=this.y;var r=this.parser.parse(t);this.parser.setState(r),this.updateRange(this.y),this.refresh(this.refreshStart,this.refreshEnd)}if(this.writeBuffer.length>0){var i=this;setTimeout(function(){i.innerWrite()},0)}else this.writeInProgress=!1},i.prototype.writeln=function(e){this.write(e+"\r\n")},i.prototype.attachCustomKeydownHandler=function(e){console.warn("attachCustomKeydownHandler() is DEPRECATED and will be removed soon. Please use attachCustomKeyEventHandler() instead."),this.attachCustomKeyEventHandler(e)},i.prototype.attachCustomKeyEventHandler=function(e){this.customKeyEventHandler=e},i.prototype.setHypertextLinkHandler=function(e){if(!this.linkifier)throw new Error("Cannot attach a hypertext link handler before Terminal.open is called");this.linkifier.setHypertextLinkHandler(e),this.refresh(0,this.rows-1)},i.prototype.setHypertextValidationCallback=function(e){if(!this.linkifier)throw new Error("Cannot attach a hypertext validation callback before Terminal.open is called");this.linkifier.setHypertextValidationCallback(e),this.refresh(0,this.rows-1)},i.prototype.registerLinkMatcher=function(e,t,r){if(this.linkifier){var i=this.linkifier.registerLinkMatcher(e,t,r);return this.refresh(0,this.rows-1),i}},i.prototype.deregisterLinkMatcher=function(e){this.linkifier&&this.linkifier.deregisterLinkMatcher(e)&&this.refresh(0,this.rows-1)},i.prototype.hasSelection=function(){return this.selectionManager.hasSelection},i.prototype.getSelection=function(){return this.selectionManager.selectionText},i.prototype.clearSelection=function(){this.selectionManager.clearSelection()},i.prototype.selectAll=function(){this.selectionManager.selectAll()},i.prototype.keyDown=function(e){if(this.customKeyEventHandler&&!1===this.customKeyEventHandler(e))return!1;if(this.restartCursorBlinking(),!this.compositionHelper.keydown.bind(this.compositionHelper)(e))return this.ybase!==this.ydisp&&this.scrollToBottom(),!1;var t=this.evaluateKeyEscapeSequence(e);return t.key===g.C0.DC3?this.writeStopped=!0:t.key===g.C0.DC1&&(this.writeStopped=!1),t.scrollDisp?(this.scrollDisp(t.scrollDisp),this.cancel(e,!0)):!!a(this,e)||(t.cancel&&this.cancel(e,!0),!t.key||(this.emit("keydown",e),this.emit("key",t.key,e),this.showCursor(),this.handler(t.key),this.cancel(e,!0)))},i.prototype.evaluateKeyEscapeSequence=function(e){var t={cancel:!1,key:void 0,scrollDisp:void 0},r=e.shiftKey<<0|e.altKey<<1|e.ctrlKey<<2|e.metaKey<<3;switch(e.keyCode){case 8:if(e.shiftKey){t.key=g.C0.BS;break}t.key=g.C0.DEL;break;case 9:if(e.shiftKey){t.key=g.C0.ESC+"[Z";break}t.key=g.C0.HT,t.cancel=!0;break;case 13:t.key=g.C0.CR,t.cancel=!0;break;case 27:t.key=g.C0.ESC,t.cancel=!0;break;case 37:r?(t.key=g.C0.ESC+"[1;"+(r+1)+"D",t.key==g.C0.ESC+"[1;3D"&&(t.key=this.browser.isMac?g.C0.ESC+"b":g.C0.ESC+"[1;5D")):this.applicationCursor?t.key=g.C0.ESC+"OD":t.key=g.C0.ESC+"[D";break;case 39:r?(t.key=g.C0.ESC+"[1;"+(r+1)+"C",t.key==g.C0.ESC+"[1;3C"&&(t.key=this.browser.isMac?g.C0.ESC+"f":g.C0.ESC+"[1;5C")):this.applicationCursor?t.key=g.C0.ESC+"OC":t.key=g.C0.ESC+"[C";break;case 38:r?(t.key=g.C0.ESC+"[1;"+(r+1)+"A",t.key==g.C0.ESC+"[1;3A"&&(t.key=g.C0.ESC+"[1;5A")):this.applicationCursor?t.key=g.C0.ESC+"OA":t.key=g.C0.ESC+"[A";break;case 40:r?(t.key=g.C0.ESC+"[1;"+(r+1)+"B",t.key==g.C0.ESC+"[1;3B"&&(t.key=g.C0.ESC+"[1;5B")):this.applicationCursor?t.key=g.C0.ESC+"OB":t.key=g.C0.ESC+"[B";break;case 45:e.shiftKey||e.ctrlKey||(t.key=g.C0.ESC+"[2~");break;case 46:t.key=r?g.C0.ESC+"[3;"+(r+1)+"~":g.C0.ESC+"[3~";break;case 36:r?t.key=g.C0.ESC+"[1;"+(r+1)+"H":this.applicationCursor?t.key=g.C0.ESC+"OH":t.key=g.C0.ESC+"[H";break;case 35:r?t.key=g.C0.ESC+"[1;"+(r+1)+"F":this.applicationCursor?t.key=g.C0.ESC+"OF":t.key=g.C0.ESC+"[F";break;case 33:e.shiftKey?t.scrollDisp=-(this.rows-1):t.key=g.C0.ESC+"[5~";break;case 34:e.shiftKey?t.scrollDisp=this.rows-1:t.key=g.C0.ESC+"[6~";break;case 112:t.key=r?g.C0.ESC+"[1;"+(r+1)+"P":g.C0.ESC+"OP";break;case 113:t.key=r?g.C0.ESC+"[1;"+(r+1)+"Q":g.C0.ESC+"OQ";break;case 114:t.key=r?g.C0.ESC+"[1;"+(r+1)+"R":g.C0.ESC+"OR";break;case 115:t.key=r?g.C0.ESC+"[1;"+(r+1)+"S":g.C0.ESC+"OS";break;case 116:t.key=r?g.C0.ESC+"[15;"+(r+1)+"~":g.C0.ESC+"[15~";break;case 117:t.key=r?g.C0.ESC+"[17;"+(r+1)+"~":g.C0.ESC+"[17~";break;case 118:t.key=r?g.C0.ESC+"[18;"+(r+1)+"~":g.C0.ESC+"[18~";break;case 119:t.key=r?g.C0.ESC+"[19;"+(r+1)+"~":g.C0.ESC+"[19~";break;case 120:t.key=r?g.C0.ESC+"[20;"+(r+1)+"~":g.C0.ESC+"[20~";break;case 121:t.key=r?g.C0.ESC+"[21;"+(r+1)+"~":g.C0.ESC+"[21~";break;case 122:t.key=r?g.C0.ESC+"[23;"+(r+1)+"~":g.C0.ESC+"[23~";break;case 123:t.key=r?g.C0.ESC+"[24;"+(r+1)+"~":g.C0.ESC+"[24~";break;default:!e.ctrlKey||e.shiftKey||e.altKey||e.metaKey?this.browser.isMac||!e.altKey||e.ctrlKey||e.metaKey?this.browser.isMac&&!e.altKey&&!e.ctrlKey&&e.metaKey&&65===e.keyCode&&this.selectAll():e.keyCode>=65&&e.keyCode<=90?t.key=g.C0.ESC+String.fromCharCode(e.keyCode+32):192===e.keyCode?t.key=g.C0.ESC+"`":e.keyCode>=48&&e.keyCode<=57&&(t.key=g.C0.ESC+(e.keyCode-48)):e.keyCode>=65&&e.keyCode<=90?t.key=String.fromCharCode(e.keyCode-64):32===e.keyCode?t.key=String.fromCharCode(0):e.keyCode>=51&&e.keyCode<=55?t.key=String.fromCharCode(e.keyCode-51+27):56===e.keyCode?t.key=String.fromCharCode(127):219===e.keyCode?t.key=String.fromCharCode(27):220===e.keyCode?t.key=String.fromCharCode(28):221===e.keyCode&&(t.key=String.fromCharCode(29))}return t},i.prototype.setgLevel=function(e){this.glevel=e,this.charset=this.charsets[e]},i.prototype.setgCharset=function(e,t){this.charsets[e]=t,this.glevel===e&&(this.charset=t)},i.prototype.keyPress=function(e){var t;if(this.customKeyEventHandler&&!1===this.customKeyEventHandler(e))return!1;if(this.cancel(e),e.charCode)t=e.charCode;else if(null==e.which)t=e.keyCode;else{if(0===e.which||0===e.charCode)return!1;t=e.which}return!(!t||(e.altKey||e.ctrlKey||e.metaKey)&&!a(this,e))&&(t=String.fromCharCode(t),this.emit("keypress",t,e),this.emit("key",t,e),this.showCursor(),this.handler(t),!0)},i.prototype.send=function(e){var t=this;this.queue||setTimeout(function(){t.handler(t.queue),t.queue=""},1),this.queue+=e},i.prototype.bell=function(){if(this.visualBell){var e=this;this.element.style.borderColor="white",setTimeout(function(){e.element.style.borderColor=""},10),this.popOnBell&&this.focus()}},i.prototype.log=function(){if(this.debug&&this.context.console&&this.context.console.log){var e=Array.prototype.slice.call(arguments);this.context.console.log.apply(this.context.console,e)}},i.prototype.error=function(){if(this.debug&&this.context.console&&this.context.console.error){var e=Array.prototype.slice.call(arguments);this.context.console.error.apply(this.context.console,e)}},i.prototype.resize=function(e,t){if(!isNaN(e)&&!isNaN(t)){t>this.getOption("scrollback")&&this.setOption("scrollback",t);var r,i,o,s,n;if(e!==this.cols||t!==this.rows){if(e<1&&(e=1),t<1&&(t=1),(o=this.cols)0&&this.lines.length<=this.ybase+this.y+n+1?(this.ybase--,n++,this.ydisp>0&&this.ydisp--):this.lines.push(this.blankLine())),this.children.lengtht;)if(this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++)),this.children.length>t){if(!(r=this.children.shift()))continue;r.parentNode.removeChild(r)}this.rows=t,this.y>=t&&(this.y=t-1),n&&(this.y+=n),this.x>=e&&(this.x=e-1),this.scrollTop=0,this.scrollBottom=t-1,this.charMeasure.measure(),this.refresh(0,this.rows-1),this.normal=null,this.geometry=[this.cols,this.rows],this.emit("resize",{terminal:this,cols:e,rows:t})}}},i.prototype.updateRange=function(e){ethis.refreshEnd&&(this.refreshEnd=e)},i.prototype.maxRange=function(){this.refreshStart=0,this.refreshEnd=this.rows-1},i.prototype.setupStops=function(e){for(null!=e?this.tabs[e]||(e=this.prevStop(e)):(this.tabs={},e=0);e0;);return e>=this.cols?this.cols-1:e<0?0:e},i.prototype.nextStop=function(e){for(null==e&&(e=this.x);!this.tabs[++e]&&e=this.cols?this.cols-1:e<0?0:e},i.prototype.eraseRight=function(e,t){var r=this.lines.get(this.ybase+t);if(r){for(var i=[this.eraseAttr()," ",1];ethis.scrollBottom&&(this.y--,this.scroll()),this.x>=this.cols&&this.x--},i.prototype.reverseIndex=function(){this.y===this.scrollTop?(this.lines.shiftElements(this.y+this.ybase,this.rows-1,1),this.lines.set(this.y+this.ybase,this.blankLine(!0)),this.updateRange(this.scrollTop),this.updateRange(this.scrollBottom)):this.y--},i.prototype.reset=function(){this.options.rows=this.rows,this.options.cols=this.cols;var e=this.customKeyEventHandler,t=this.cursorBlinkInterval;i.call(this,this.options),this.customKeyEventHandler=e,this.cursorBlinkInterval=t,this.refresh(0,this.rows-1),this.viewport.syncScrollArea()},i.prototype.tabSet=function(){this.tabs[this.x]=!0},i.prototype.matchColor=l,l._cache={},l.distance=function(e,t,r,i,o,s){return Math.pow(30*(e-i),2)+Math.pow(59*(t-o),2)+Math.pow(11*(r-s),2)},i.EventEmitter=u.EventEmitter,i.inherits=n,i.on=o,i.off=s,i.cancel=function(e,t){if(this.cancelEvents||t)return e.preventDefault(),e.stopPropagation(),!1},e.exports=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(){this._events=this._events||{}}return e.prototype.on=function(e,t){this._events[e]=this._events[e]||[],this._events[e].push(t)},e.prototype.off=function(e,t){if(this._events[e])for(var r=this._events[e],i=r.length;i--;)if(r[i]===t||r[i].listener===t)return void r.splice(i,1)},e.prototype.removeAllListeners=function(e){this._events[e]&&delete this._events[e]},e.prototype.once=function(e,t){function r(){var i=Array.prototype.slice.call(arguments);return this.off(e,r),t.apply(this,i)}return r.listener=t,this.on(e,r)},e.prototype.emit=function(e){for(var t=[],r=1;r>16&255,e>>8&255,255&e]);return t}(),i.defaults={colors:i.colors,theme:"default",convertEol:!1,termName:"xterm",geometry:[80,24],cursorBlink:!1,cursorStyle:"block",visualBell:!1,popOnBell:!1,scrollback:5e3,screenKeys:!1,debug:!1,cancelEvents:!1,disableStdin:!1,useFlowControl:!1,tabStopWidth:8},i.options={},i.focus=null,function(e,t,r){if(e.forEach)return e.forEach(t,r);for(var i=0;it){var o=this.lines.length-t,s=this.ydisp-o<0;this.lines.trimStart(o),this.ybase=Math.max(this.ybase-o,0),this.ydisp=Math.max(this.ydisp-o,0),s&&this.refresh(0,this.rows-1)}this.lines.maxLength=t,this.viewport.syncScrollArea()}}switch(this[e]=t,this.options[e]=t,e){case"cursorBlink":this.setCursorBlinking(t);break;case"cursorStyle":this.element.classList.toggle("xterm-cursor-style-underline","underline"===t),this.element.classList.toggle("xterm-cursor-style-bar","bar"===t);break;case"tabStopWidth":this.setupStops()}},i.prototype.restartCursorBlinking=function(){this.setCursorBlinking(this.options.cursorBlink)},i.prototype.setCursorBlinking=function(e){if(this.element.classList.toggle("xterm-cursor-blink",e),this.clearCursorBlinkingInterval(),e){var t=this;this.cursorBlinkInterval=setInterval(function(){t.element.classList.toggle("xterm-cursor-blink-on")},600)}},i.prototype.clearCursorBlinkingInterval=function(){this.element.classList.remove("xterm-cursor-blink-on"),this.cursorBlinkInterval&&(clearInterval(this.cursorBlinkInterval),this.cursorBlinkInterval=null)},i.bindFocus=function(e){o(e.textarea,"focus",function(t){e.sendFocus&&e.send(g.C0.ESC+"[I"),e.element.classList.add("focus"),e.showCursor(),e.restartCursorBlinking.apply(e),i.focus=e,e.emit("focus",{terminal:e})})},i.prototype.blur=function(){return this.textarea.blur()},i.bindBlur=function(e){o(e.textarea,"blur",function(t){e.refresh(e.y,e.y),e.sendFocus&&e.send(g.C0.ESC+"[O"),e.element.classList.remove("focus"),e.clearCursorBlinkingInterval.apply(e),i.focus=null,e.emit("blur",{terminal:e})})},i.prototype.initGlobal=function(){var e=this,t=this;i.bindKeys(this),i.bindFocus(this),i.bindBlur(this),o(this.element,"copy",function(r){e.mouseEvents||p.copyHandler(r,t,e.selectionManager)});var r=function(e){return p.pasteHandler(e,t)};o(this.textarea,"paste",r),o(this.element,"paste",r),t.browser.isFirefox?o(this.element,"mousedown",function(t){2==t.button&&p.rightClickHandler(t,e.textarea,e.selectionManager)}):o(this.element,"contextmenu",function(t){p.rightClickHandler(t,e.textarea,e.selectionManager)}),t.browser.isLinux&&o(this.element,"auxclick",function(t){1===t.button&&p.moveTextAreaUnderMouseCursor(t,e.textarea,e.selectionManager)})},i.bindKeys=function(e){o(e.element,"keydown",function(t){A.activeElement==this&&e.keyDown(t)},!0),o(e.element,"keypress",function(t){A.activeElement==this&&e.keyPress(t)},!0),o(e.element,"keyup",function(t){h(t)||e.focus(e)},!0),o(e.textarea,"keydown",function(t){e.keyDown(t)},!0),o(e.textarea,"keypress",function(t){e.keyPress(t),this.value=""},!0),o(e.textarea,"compositionstart",e.compositionHelper.compositionstart.bind(e.compositionHelper)),o(e.textarea,"compositionupdate",e.compositionHelper.compositionupdate.bind(e.compositionHelper)),o(e.textarea,"compositionend",e.compositionHelper.compositionend.bind(e.compositionHelper)),e.on("refresh",e.compositionHelper.updateCompositionElements.bind(e.compositionHelper)),e.on("refresh",function(t){e.queueLinkification(t.start,t.end)})},i.prototype.insertRow=function(e){return"object"!=typeof e&&(e=A.createElement("div")),this.rowContainer.appendChild(e),this.children.push(e),e},i.prototype.open=function(e,t){var r=this,i=this,s=0;if(this.parent=e||this.parent,!this.parent)throw new Error("Terminal requires a parent element.");for(this.context=this.parent.ownerDocument.defaultView,this.document=this.parent.ownerDocument,this.body=this.document.getElementsByTagName("body")[0],this.element=this.document.createElement("div"),this.element.classList.add("terminal"),this.element.classList.add("xterm"),this.element.classList.add("xterm-theme-"+this.theme),this.setCursorBlinking(this.options.cursorBlink),this.element.setAttribute("tabindex",0),this.viewportElement=A.createElement("div"),this.viewportElement.classList.add("xterm-viewport"),this.element.appendChild(this.viewportElement),this.viewportScrollArea=A.createElement("div"),this.viewportScrollArea.classList.add("xterm-scroll-area"),this.viewportElement.appendChild(this.viewportScrollArea),this.selectionContainer=A.createElement("div"),this.selectionContainer.classList.add("xterm-selection"),this.element.appendChild(this.selectionContainer),this.rowContainer=A.createElement("div"),this.rowContainer.classList.add("xterm-rows"),this.element.appendChild(this.rowContainer),this.children=[],this.linkifier.attachToDom(A,this.children),this.helperContainer=A.createElement("div"),this.helperContainer.classList.add("xterm-helpers"),this.element.appendChild(this.helperContainer),this.textarea=A.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this.textarea.addEventListener("focus",function(){i.emit("focus",{terminal:i})}),this.textarea.addEventListener("blur",function(){i.emit("blur",{terminal:i})}),this.helperContainer.appendChild(this.textarea),this.compositionView=A.createElement("div"),this.compositionView.classList.add("composition-view"),this.compositionHelper=new c.CompositionHelper(this.textarea,this.compositionView,this),this.helperContainer.appendChild(this.compositionView),this.charSizeStyleElement=A.createElement("style"),this.helperContainer.appendChild(this.charSizeStyleElement);s div{height:"+this.charMeasure.height+"px;}"},i.prototype.bindMouse=function(){function e(e){var t,r;if(t=n(e),r=v.getRawByteCoords(e,l.rowContainer,l.charMeasure,l.cols,l.rows))switch(i(t,r),e.overrideType||e.type){case"mousedown":h=t;break;case"mouseup":h=32}}function t(e){var t,r=h;(t=v.getRawByteCoords(e,l.rowContainer,l.charMeasure,l.cols,l.rows))&&i(r+=32,t)}function r(e,t){if(l.utfMouse){if(2047===t)return e.push(0);t<127?e.push(t):(t>2047&&(t=2047),e.push(192|t>>6),e.push(128|63&t))}else{if(255===t)return e.push(0);t>127&&(t=127),e.push(t)}}function i(e,t){if(l.vt300Mouse){e&=3,t.x-=32,t.y-=32;var i=g.C0.ESC+"[24";if(0===e)i+="1";else if(1===e)i+="3";else if(2===e)i+="5";else{if(3===e)return;i+="0"}return i+="~["+t.x+","+t.y+"]\r",void l.send(i)}return l.decLocator?(e&=3,t.x-=32,t.y-=32,0===e?e=2:1===e?e=4:2===e?e=6:3===e&&(e=3),void l.send(g.C0.ESC+"["+e+";"+(3===e?4:0)+";"+t.y+";"+t.x+";"+(t.page||0)+"&w")):l.urxvtMouse?(t.x-=32,t.y-=32,t.x++,t.y++,void l.send(g.C0.ESC+"["+e+";"+t.x+";"+t.y+"M")):l.sgrMouse?(t.x-=32,t.y-=32,void l.send(g.C0.ESC+"[<"+((3==(3&e)?-4&e:e)-32)+";"+t.x+";"+t.y+(3==(3&e)?"m":"M"))):(r(i=[],e),r(i,t.x),r(i,t.y),void l.send(g.C0.ESC+"[M"+String.fromCharCode.apply(String,i)))}function n(e){var t,r,i,o,s;switch(e.overrideType||e.type){case"mousedown":t=null!=e.button?+e.button:null!=e.which?e.which-1:null,l.browser.isMSIE&&(t=1===t?0:4===t?1:t);break;case"mouseup":t=3;break;case"DOMMouseScroll":t=e.detail<0?64:65;break;case"wheel":t=e.wheelDeltaY>0?64:65}return r=e.shiftKey?4:0,i=e.metaKey?8:0,o=e.ctrlKey?16:0,s=r|i|o,l.vt200Mouse?s&=o:l.normalMouse||(s=0),t=32+(s<<2)+t}var a=this.element,l=this,h=32;o(a,"mousedown",function(r){if(l.mouseEvents)return e(r),l.focus(),l.vt200Mouse?(r.overrideType="mouseup",e(r),l.cancel(r)):(l.normalMouse&&o(l.document,"mousemove",t),l.x10Mouse||o(l.document,"mouseup",function r(i){return e(i),l.normalMouse&&s(l.document,"mousemove",t),s(l.document,"mouseup",r),l.cancel(i)}),l.cancel(r))}),o(a,"wheel",function(t){if(l.mouseEvents&&!(l.x10Mouse||l.vt300Mouse||l.decLocator))return e(t),l.cancel(t)}),o(a,"wheel",function(e){if(!l.mouseEvents)return l.viewport.onWheel(e),l.cancel(e)}),o(a,"touchstart",function(e){if(!l.mouseEvents)return l.viewport.onTouchStart(e),l.cancel(e)}),o(a,"touchmove",function(e){if(!l.mouseEvents)return l.viewport.onTouchMove(e),l.cancel(e)})},i.prototype.destroy=function(){this.readable=!1,this.writable=!1,this._events={},this.handler=function(){},this.write=function(){},this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element)},i.prototype.refresh=function(e,t){this.renderer&&this.renderer.queueRefresh(e,t)},i.prototype.queueLinkification=function(e,t){if(this.linkifier)for(var r=e;r<=t;r++)this.linkifier.linkifyRow(r)},i.prototype.showCursor=function(){this.cursorState||(this.cursorState=1,this.refresh(this.y,this.y))},i.prototype.scroll=function(e){var t;this.lines.length===this.lines.maxLength&&(this.lines.trimStart(1),this.ybase--,0!==this.ydisp&&this.ydisp--),this.ybase++,this.userScrolling||(this.ydisp=this.ybase),t=this.ybase+this.rows-1,(t-=this.rows-1-this.scrollBottom)===this.lines.length?this.lines.push(this.blankLine(void 0,e)):this.lines.splice(t,0,this.blankLine(void 0,e)),0!==this.scrollTop&&(0!==this.ybase&&(this.ybase--,this.userScrolling||(this.ydisp=this.ybase)),this.lines.splice(this.ybase+this.scrollTop,1)),this.updateRange(this.scrollTop),this.updateRange(this.scrollBottom),this.emit("scroll",this.ydisp)},i.prototype.scrollDisp=function(e,t){if(e<0){if(0===this.ydisp)return;this.userScrolling=!0}else e+this.ydisp>=this.ybase&&(this.userScrolling=!1);this.ydisp+=e,this.ydisp>this.ybase?this.ydisp=this.ybase:this.ydisp<0&&(this.ydisp=0),t||this.emit("scroll",this.ydisp),this.refresh(0,this.rows-1)},i.prototype.scrollPages=function(e){this.scrollDisp(e*(this.rows-1))},i.prototype.scrollToTop=function(){this.scrollDisp(-this.ydisp)},i.prototype.scrollToBottom=function(){this.scrollDisp(this.ybase-this.ydisp)},i.prototype.write=function(e){if(this.writeBuffer.push(e),this.options.useFlowControl&&!this.xoffSentToCatchUp&&this.writeBuffer.length>=5&&(this.send(g.C0.DC3),this.xoffSentToCatchUp=!0),!this.writeInProgress&&this.writeBuffer.length>0){this.writeInProgress=!0;var t=this;setTimeout(function(){t.innerWrite()})}},i.prototype.innerWrite=function(){for(var e=this.writeBuffer.splice(0,300);e.length>0;){var t=e.shift();t.length;this.xoffSentToCatchUp&&0===e.length&&0===this.writeBuffer.length&&(this.send(g.C0.DC1),this.xoffSentToCatchUp=!1),this.refreshStart=this.y,this.refreshEnd=this.y;var r=this.parser.parse(t);this.parser.setState(r),this.updateRange(this.y),this.refresh(this.refreshStart,this.refreshEnd)}if(this.writeBuffer.length>0){var i=this;setTimeout(function(){i.innerWrite()},0)}else this.writeInProgress=!1},i.prototype.writeln=function(e){this.write(e+"\r\n")},i.prototype.attachCustomKeydownHandler=function(e){console.warn("attachCustomKeydownHandler() is DEPRECATED and will be removed soon. Please use attachCustomKeyEventHandler() instead."),this.attachCustomKeyEventHandler(e)},i.prototype.attachCustomKeyEventHandler=function(e){this.customKeyEventHandler=e},i.prototype.setHypertextLinkHandler=function(e){if(!this.linkifier)throw new Error("Cannot attach a hypertext link handler before Terminal.open is called");this.linkifier.setHypertextLinkHandler(e),this.refresh(0,this.rows-1)},i.prototype.setHypertextValidationCallback=function(e){if(!this.linkifier)throw new Error("Cannot attach a hypertext validation callback before Terminal.open is called");this.linkifier.setHypertextValidationCallback(e),this.refresh(0,this.rows-1)},i.prototype.registerLinkMatcher=function(e,t,r){if(this.linkifier){var i=this.linkifier.registerLinkMatcher(e,t,r);return this.refresh(0,this.rows-1),i}},i.prototype.deregisterLinkMatcher=function(e){this.linkifier&&this.linkifier.deregisterLinkMatcher(e)&&this.refresh(0,this.rows-1)},i.prototype.hasSelection=function(){return this.selectionManager.hasSelection},i.prototype.getSelection=function(){return this.selectionManager.selectionText},i.prototype.clearSelection=function(){this.selectionManager.clearSelection()},i.prototype.selectAll=function(){this.selectionManager.selectAll()},i.prototype.keyDown=function(e){if(this.customKeyEventHandler&&!1===this.customKeyEventHandler(e))return!1;if(this.restartCursorBlinking(),!this.compositionHelper.keydown.bind(this.compositionHelper)(e))return this.ybase!==this.ydisp&&this.scrollToBottom(),!1;var t=this.evaluateKeyEscapeSequence(e);return t.key===g.C0.DC3?this.writeStopped=!0:t.key===g.C0.DC1&&(this.writeStopped=!1),t.scrollDisp?(this.scrollDisp(t.scrollDisp),this.cancel(e,!0)):!!a(this,e)||(t.cancel&&this.cancel(e,!0),!t.key||(this.emit("keydown",e),this.emit("key",t.key,e),this.showCursor(),this.handler(t.key),this.cancel(e,!0)))},i.prototype.evaluateKeyEscapeSequence=function(e){var t={cancel:!1,key:void 0,scrollDisp:void 0},r=e.shiftKey<<0|e.altKey<<1|e.ctrlKey<<2|e.metaKey<<3;switch(e.keyCode){case 8:if(e.shiftKey){t.key=g.C0.BS;break}t.key=g.C0.DEL;break;case 9:if(e.shiftKey){t.key=g.C0.ESC+"[Z";break}t.key=g.C0.HT,t.cancel=!0;break;case 13:t.key=g.C0.CR,t.cancel=!0;break;case 27:t.key=g.C0.ESC,t.cancel=!0;break;case 37:r?(t.key=g.C0.ESC+"[1;"+(r+1)+"D",t.key==g.C0.ESC+"[1;3D"&&(t.key=this.browser.isMac?g.C0.ESC+"b":g.C0.ESC+"[1;5D")):this.applicationCursor?t.key=g.C0.ESC+"OD":t.key=g.C0.ESC+"[D";break;case 39:r?(t.key=g.C0.ESC+"[1;"+(r+1)+"C",t.key==g.C0.ESC+"[1;3C"&&(t.key=this.browser.isMac?g.C0.ESC+"f":g.C0.ESC+"[1;5C")):this.applicationCursor?t.key=g.C0.ESC+"OC":t.key=g.C0.ESC+"[C";break;case 38:r?(t.key=g.C0.ESC+"[1;"+(r+1)+"A",t.key==g.C0.ESC+"[1;3A"&&(t.key=g.C0.ESC+"[1;5A")):this.applicationCursor?t.key=g.C0.ESC+"OA":t.key=g.C0.ESC+"[A";break;case 40:r?(t.key=g.C0.ESC+"[1;"+(r+1)+"B",t.key==g.C0.ESC+"[1;3B"&&(t.key=g.C0.ESC+"[1;5B")):this.applicationCursor?t.key=g.C0.ESC+"OB":t.key=g.C0.ESC+"[B";break;case 45:e.shiftKey||e.ctrlKey||(t.key=g.C0.ESC+"[2~");break;case 46:t.key=r?g.C0.ESC+"[3;"+(r+1)+"~":g.C0.ESC+"[3~";break;case 36:r?t.key=g.C0.ESC+"[1;"+(r+1)+"H":this.applicationCursor?t.key=g.C0.ESC+"OH":t.key=g.C0.ESC+"[H";break;case 35:r?t.key=g.C0.ESC+"[1;"+(r+1)+"F":this.applicationCursor?t.key=g.C0.ESC+"OF":t.key=g.C0.ESC+"[F";break;case 33:e.shiftKey?t.scrollDisp=-(this.rows-1):t.key=g.C0.ESC+"[5~";break;case 34:e.shiftKey?t.scrollDisp=this.rows-1:t.key=g.C0.ESC+"[6~";break;case 112:t.key=r?g.C0.ESC+"[1;"+(r+1)+"P":g.C0.ESC+"OP";break;case 113:t.key=r?g.C0.ESC+"[1;"+(r+1)+"Q":g.C0.ESC+"OQ";break;case 114:t.key=r?g.C0.ESC+"[1;"+(r+1)+"R":g.C0.ESC+"OR";break;case 115:t.key=r?g.C0.ESC+"[1;"+(r+1)+"S":g.C0.ESC+"OS";break;case 116:t.key=r?g.C0.ESC+"[15;"+(r+1)+"~":g.C0.ESC+"[15~";break;case 117:t.key=r?g.C0.ESC+"[17;"+(r+1)+"~":g.C0.ESC+"[17~";break;case 118:t.key=r?g.C0.ESC+"[18;"+(r+1)+"~":g.C0.ESC+"[18~";break;case 119:t.key=r?g.C0.ESC+"[19;"+(r+1)+"~":g.C0.ESC+"[19~";break;case 120:t.key=r?g.C0.ESC+"[20;"+(r+1)+"~":g.C0.ESC+"[20~";break;case 121:t.key=r?g.C0.ESC+"[21;"+(r+1)+"~":g.C0.ESC+"[21~";break;case 122:t.key=r?g.C0.ESC+"[23;"+(r+1)+"~":g.C0.ESC+"[23~";break;case 123:t.key=r?g.C0.ESC+"[24;"+(r+1)+"~":g.C0.ESC+"[24~";break;default:!e.ctrlKey||e.shiftKey||e.altKey||e.metaKey?this.browser.isMac||!e.altKey||e.ctrlKey||e.metaKey?this.browser.isMac&&!e.altKey&&!e.ctrlKey&&e.metaKey&&65===e.keyCode&&this.selectAll():e.keyCode>=65&&e.keyCode<=90?t.key=g.C0.ESC+String.fromCharCode(e.keyCode+32):192===e.keyCode?t.key=g.C0.ESC+"`":e.keyCode>=48&&e.keyCode<=57&&(t.key=g.C0.ESC+(e.keyCode-48)):e.keyCode>=65&&e.keyCode<=90?t.key=String.fromCharCode(e.keyCode-64):32===e.keyCode?t.key=String.fromCharCode(0):e.keyCode>=51&&e.keyCode<=55?t.key=String.fromCharCode(e.keyCode-51+27):56===e.keyCode?t.key=String.fromCharCode(127):219===e.keyCode?t.key=String.fromCharCode(27):220===e.keyCode?t.key=String.fromCharCode(28):221===e.keyCode&&(t.key=String.fromCharCode(29))}return t},i.prototype.setgLevel=function(e){this.glevel=e,this.charset=this.charsets[e]},i.prototype.setgCharset=function(e,t){this.charsets[e]=t,this.glevel===e&&(this.charset=t)},i.prototype.keyPress=function(e){var t;if(this.customKeyEventHandler&&!1===this.customKeyEventHandler(e))return!1;if(this.cancel(e),e.charCode)t=e.charCode;else if(null==e.which)t=e.keyCode;else{if(0===e.which||0===e.charCode)return!1;t=e.which}return!(!t||(e.altKey||e.ctrlKey||e.metaKey)&&!a(this,e))&&(t=String.fromCharCode(t),this.emit("keypress",t,e),this.emit("key",t,e),this.showCursor(),this.handler(t),!0)},i.prototype.send=function(e){var t=this;this.queue||setTimeout(function(){t.handler(t.queue),t.queue=""},1),this.queue+=e},i.prototype.bell=function(){if(this.visualBell){var e=this;this.element.style.borderColor="white",setTimeout(function(){e.element.style.borderColor=""},10),this.popOnBell&&this.focus()}},i.prototype.log=function(){if(this.debug&&this.context.console&&this.context.console.log){var e=Array.prototype.slice.call(arguments);this.context.console.log.apply(this.context.console,e)}},i.prototype.error=function(){if(this.debug&&this.context.console&&this.context.console.error){var e=Array.prototype.slice.call(arguments);this.context.console.error.apply(this.context.console,e)}},i.prototype.resize=function(e,t){if(!isNaN(e)&&!isNaN(t)){t>this.getOption("scrollback")&&this.setOption("scrollback",t);var r,i,o,s,n;if(e!==this.cols||t!==this.rows){if(e<1&&(e=1),t<1&&(t=1),(o=this.cols)0&&this.lines.length<=this.ybase+this.y+n+1?(this.ybase--,n++,this.ydisp>0&&this.ydisp--):this.lines.push(this.blankLine())),this.children.lengtht;)if(this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++)),this.children.length>t){if(!(r=this.children.shift()))continue;r.parentNode.removeChild(r)}this.rows=t,this.y>=t&&(this.y=t-1),n&&(this.y+=n),this.x>=e&&(this.x=e-1),this.scrollTop=0,this.scrollBottom=t-1,this.charMeasure.measure(),this.refresh(0,this.rows-1),this.normal=null,this.geometry=[this.cols,this.rows],this.emit("resize",{terminal:this,cols:e,rows:t})}}},i.prototype.updateRange=function(e){ethis.refreshEnd&&(this.refreshEnd=e)},i.prototype.maxRange=function(){this.refreshStart=0,this.refreshEnd=this.rows-1},i.prototype.setupStops=function(e){for(null!=e?this.tabs[e]||(e=this.prevStop(e)):(this.tabs={},e=0);e0;);return e>=this.cols?this.cols-1:e<0?0:e},i.prototype.nextStop=function(e){for(null==e&&(e=this.x);!this.tabs[++e]&&e=this.cols?this.cols-1:e<0?0:e},i.prototype.eraseRight=function(e,t){var r=this.lines.get(this.ybase+t);if(r){for(var i=[this.eraseAttr()," ",1];ethis.scrollBottom&&(this.y--,this.scroll()),this.x>=this.cols&&this.x--},i.prototype.reverseIndex=function(){this.y===this.scrollTop?(this.lines.shiftElements(this.y+this.ybase,this.rows-1,1),this.lines.set(this.y+this.ybase,this.blankLine(!0)),this.updateRange(this.scrollTop),this.updateRange(this.scrollBottom)):this.y--},i.prototype.reset=function(){this.options.rows=this.rows,this.options.cols=this.cols;var e=this.customKeyEventHandler,t=this.cursorBlinkInterval;i.call(this,this.options),this.customKeyEventHandler=e,this.cursorBlinkInterval=t,this.refresh(0,this.rows-1),this.viewport.syncScrollArea()},i.prototype.tabSet=function(){this.tabs[this.x]=!0},i.prototype.matchColor=l,l._cache={},l.distance=function(e,t,r,i,o,s){return Math.pow(30*(e-i),2)+Math.pow(59*(t-o),2)+Math.pow(11*(r-s),2)},i.EventEmitter=u.EventEmitter,i.inherits=n,i.on=o,i.off=s,i.cancel=function(e,t){if(this.cancelEvents||t)return e.preventDefault(),e.stopPropagation(),!1},e.exports=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(){this._events=this._events||{}}return e.prototype.on=function(e,t){this._events[e]=this._events[e]||[],this._events[e].push(t)},e.prototype.off=function(e,t){if(this._events[e])for(var r=this._events[e],i=r.length;i--;)if(r[i]===t||r[i].listener===t)return void r.splice(i,1)},e.prototype.removeAllListeners=function(e){this._events[e]&&delete this._events[e]},e.prototype.once=function(e,t){function r(){var i=Array.prototype.slice.call(arguments);return this.off(e,r),t.apply(this,i)}return r.listener=t,this.on(e,r)},e.prototype.emit=function(e){for(var t=[],r=1;r