!function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,t),i.l=!0,i.exports}var n={};t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=7)}([function(e,t,n){"use strict";t.mk=function(e){return document.createElement(e)},t.qs=function(e){return document.querySelector(e)},t.qsa=function(e){return document.querySelectorAll(e)},t.cr=function(e){return function(t){(10===t.which||13===t.which||32===t.which)&&e()}},t.bool=function(e){return 1===e||"1"===e||!0===e||"true"===e},t.parse2B=function(e){var t=1":">",'"':""","'":"'","/":"/","`":"`","=":"="};d.htmlEscape=function(e){return(e+"").replace(/[&<>"'`=\/]/g,function(e){return b[e]})},e.exports=d}()},function(e,t,n){"use strict";var r=n(1),i={},o=null;i.show=function(e,t){var n=r(e);n.removeClass("hidden visible"),setTimeout(function(){n.addClass("visible")},1),o=t},i.hide=function(e){var t=r(e);t.removeClass("visible"),setTimeout(function(){t.addClass("hidden"),o&&o()},500)},i.init=function(){r(".Modal").on("click",function(){r(this).hasClass("no-close")||i.hide(this)}),r(".Dialog").on("click",function(e){e.stopImmediatePropagation()}),r(window).on("keydown",function(e){27===e.which&&i.hide(".Modal")})},e.exports=i},function(e,t,n){"use strict";var r,i,o,s=n(1),a=n(2),c={},l=!1,u=function(){clearTimeout(i),clearTimeout(o)};c.show=function(e,t,n){r.toggleClass("error",!0===n),r.html(e),a.show(r),u(),(!t||0>=t)&&(t=2500),i=setTimeout(c.hide,t),l=!1,setTimeout(function(){l=!0},500)},c.hide=function(){var e=s("#notif");e.removeClass("visible"),o=setTimeout(function(){e.addClass("hidden")},250)},c.init=function(){r=s("#notif"),s(document).on("click",function(){l&&c.hide(this)}),r.on("click",function(e){return e.stopImmediatePropagation(),!1}),r.on("mouseenter",function(){u(),r.removeClass("hidden").addClass("visible")})},e.exports=c},function(e,t,n){"use strict";function r(e,n){return n=+n,n=16>n?i[e][n]:t.buildColorTable()[n]}var i=t.themes=[["#111213","#CC0000","#4E9A06","#C4A000","#3465A4","#75507B","#06989A","#D3D7CF","#555753","#EF2929","#8AE234","#FCE94F","#729FCF","#AD7FA8","#34E2E2","#EEEEEC"],["#000000","#aa0000","#00aa00","#aa5500","#0000aa","#aa00aa","#00aaaa","#aaaaaa","#555555","#ff5555","#55ff55","#ffff55","#5555ff","#ff55ff","#55ffff","#ffffff"],["#000000","#cd0000","#00cd00","#cdcd00","#0000ee","#cd00cd","#00cdcd","#e5e5e5","#7f7f7f","#ff0000","#00ff00","#ffff00","#5c5cff","#ff00ff","#00ffff","#ffffff"],["#000000","#cd0000","#00cd00","#cdcd00","#0000cd","#cd00cd","#00cdcd","#faebd7","#404040","#ff0000","#00ff00","#ffff00","#0000ff","#ff00ff","#00ffff","#ffffff"],["#2e3436","#cc0000","#4e9a06","#c4a000","#3465a4","#75507b","#06989a","#d3d7cf","#555753","#ef2929","#8ae234","#fce94f","#729fcf","#ad7fa8","#34e2e2","#eeeeec"],["#073642","#dc322f","#859900","#b58900","#268bd2","#d33682","#2aa198","#eee8d5","#002b36","#cb4b16","#586e75","#657b83","#839496","#6c71c4","#93a1a1","#fdf6e3"],["#000000","#69001A","#117800","#769100","#1A00A6","#8019AB","#289E76","#A4A4A4","#484848","#C54E76","#6DD441","#D2ED46","#765BFF","#DC75FF","#84FAD2","#FFFFFF"],["#000000","#aa0000","#00aa00","#aaaa00","#0000aa","#aa00aa","#00aaaa","#aaaaaa","#000000","#ff0000","#00FF00","#ffff00","#0000ff","#ff00ff","#00ffff","#ffffff"],["#000000","#722640","#0E5940","#808080","#40337F","#E434FE","#1B9AFE","#BFB3FF","#404C00","#E46501","#1BCB01","#BFCC80","#808080","#F1A6BF","#8DD9BF","#ffffff"],["#000000","#8D3E37","#55A049","#AAB95D","#40318D","#80348B","#72C1C8","#D59F74","#8B5429","#B86962","#94E089","#FFFFB2","#8071CC","#AA5FB6","#87D6DD","#ffffff"]];t.fgbgThemes=[["#AAAAAA","#000000"],["#EFF0F1","#31363B"],["#FFFFFF","#000000"],["#00FF00","#000000"],["#E53C00","#000000"],["#FFFFFF","#300A24"],["#839496","#002B36"],["#657B83","#FDF6E3"],["#000000","#FFFFDD"],["#000000","#FFFFFF"]];var o=null;t.buildColorTable=function(){if(null!=o)return o;o=Array(16).fill("rgba(0, 0, 0, 0)");for(var e=0;6>e;e++)for(var t=0;6>t;t++)for(var n=0;6>n;n++){var r=40*e+(e?55:0),i=40*t+(t?55:0),s=40*n+(n?55:0);o.push("rgb("+r+", "+i+", "+s+")")}for(var a=0;24>a;a++){var c=10*a+8;o.push("rgb("+c+", "+c+", "+c+")")}return o},t.SELECTION_FG="#333",t.SELECTION_BG="#b2d7fe",t.themePreview=function(e){document.querySelectorAll("[data-fg]").forEach(function(t){var n=t.dataset.fg;/^\d+$/.test(n)&&(n=r(e,n)),t.style.color=n}),document.querySelectorAll("[data-bg]").forEach(function(t){var n=t.dataset.bg;/^\d+$/.test(n)&&(n=r(e,n)),t.style.backgroundColor=n})}},function(e,t){function n(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function r(e){return"function"==typeof e}function i(e){return"number"==typeof e}function o(e){return"object"==typeof e&&null!==e}function s(e){return void 0===e}e.exports=n,n.EventEmitter=n,n.prototype._events=void 0,n.prototype._maxListeners=void 0,n.defaultMaxListeners=10,n.prototype.setMaxListeners=function(e){if(!i(e)||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},n.prototype.emit=function(e){var t,n,i,a,c,l;if(this._events||(this._events={}),"error"===e&&(!this._events.error||o(this._events.error)&&!this._events.error.length)){if((t=arguments[1])instanceof Error)throw t;var u=new Error('Uncaught, unspecified "error" event. ('+t+")");throw u.context=t,u}if(n=this._events[e],s(n))return!1;if(r(n))switch(arguments.length){case 1:n.call(this);break;case 2:n.call(this,arguments[1]);break;case 3:n.call(this,arguments[1],arguments[2]);break;default:a=Array.prototype.slice.call(arguments,1),n.apply(this,a)}else if(o(n))for(a=Array.prototype.slice.call(arguments,1),l=n.slice(),i=l.length,c=0;c0&&this._events[e].length>i&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace()),this},n.prototype.on=n.prototype.addListener,n.prototype.once=function(e,t){function n(){this.removeListener(e,n),i||(i=!0,t.apply(this,arguments))}if(!r(t))throw TypeError("listener must be a function");var i=!1;return n.listener=t,this.on(e,n),this},n.prototype.removeListener=function(e,t){var n,i,s,a;if(!r(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(n=this._events[e],s=n.length,i=-1,n===t||r(n.listener)&&n.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(o(n)){for(a=s;a-- >0;)if(n[a]===t||n[a].listener&&n[a].listener===t){i=a;break}if(i<0)return this;1===n.length?(n.length=0,delete this._events[e]):n.splice(i,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},n.prototype.removeAllListeners=function(e){var t,n;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(n=this._events[e],r(n))this.removeListener(e,n);else if(n)for(;n.length;)this.removeListener(e,n[n.length-1]);return delete this._events[e],this},n.prototype.listeners=function(e){return this._events&&this._events[e]?r(this._events[e])?[this._events[e]]:this._events[e].slice():[]},n.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(r(t))return 1;if(t)return t.length}return 0},n.listenerCount=function(e,t){return e.listenerCount(t)}},function(e,t,n){"use strict";function r(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t=t)this.handler("move-cursor-"+("B">=t?"y":"x"),("B"===t||"C"===t?1:-1)*i);else if("E"===t||"F"===t)this.handler("move-cursor-line",("E"===t?1:-1)*i);else if("G"===t)this.handler("set-cursor-x",i-1);else if("J"===t){var o=r.length?r[0]:2;2===o&&this.handler("clear")}else if("P"===t)this.handler("delete",i);else if("@"===t)this.handler("insert-blanks",i);else if("q"===t)this.handler("set-cursor-style",i);else if("m"===t){if(!r.length||0===r[0])return void this.handler("reset-style");var s=r[0];if(1===s)this.handler("add-attrs",1);else if(2===s)this.handler("add-attrs",2);else if(3===s)this.handler("add-attrs",4);else if(4===s)this.handler("add-attrs",8);else if(5===s||6===s)this.handler("add-attrs",16);else if(7===s)this.handler("add-attrs",-1);else if(9===s)this.handler("add-attrs",64);else if(20===s)this.handler("add-attrs",32);else if(30<=s&&37>=s)this.handler("set-color-fg",s%10);else if(40<=s&&47>=s)this.handler("set-color-bg",s%10);else if(39===s)this.handler("reset-color-fg");else if(49===s)this.handler("reset-color-bg");else if(90<=s&&98>=s)this.handler("set-color-fg",s%10+8);else if(100<=s&&108>=s)this.handler("set-color-bg",s%10+8);else if((38===s||48===s)&&5===r[1]){var a=255&(0|r[2]);38===s&&this.handler("set-color-fg",a),48===s&&this.handler("set-color-bg",a)}}else("h"===t||"l"===t)&&"?25"===n&&("h"===t?this.handler("show-cursor"):"l"===t&&this.handler("hide-cursor"))}}},{key:"write",value:function(e){var t=!0,n=!1,r=void 0;try{for(var i,o=e.toString()[Symbol.iterator]();!(t=(i=o.next()).done);t=!0){var s=i.value,a=s.codePointAt(0);27===a?this.currentSequence=1:1===this.currentSequence&&"["===s?(this.currentSequence=2,this.sequence+="["):this.currentSequence&&s.match(/[\x40-\x7e]/)?(this.parseSequence(this.sequence+s),this.currentSequence=0,this.sequence=""):1a?this.handler("_null"):3===a?this.handler("sigint"):6>=a?this.handler("_null"):7===a?this.handler("bell"):8===a?this.handler("back"):9===a?this.handler("tab"):10===a?this.handler("new-line"):13===a?this.handler("return"):21===a?this.handler("delete-line"):23===a?this.handler("delete-word"):this.handler("write",s)}}catch(e){n=!0,r=e}finally{try{!t&&o.return&&o.return()}finally{if(n)throw r}}this.joinChunks||this.reset()}}]),e}(),m=function(e){var t=Math.PI,n=Math.floor,r=Math.sin;return 16+36*n(2.5*r(e)+2.5)+6*n(2.5*r(e+2/3*t)+2.5)+n(2.5*r(e+4/3*t)+2.5)},p=function(){function e(t){var n=this;s(this,e),this.width=80,this.height=25,this.termScreen=t,this.parser=new v(function(){return n.handleParsed.apply(n,arguments)}),this.reset(),this._lastLoad=Date.now(),this.termScreen.load(this.serialize()),window.showPage()}var t=Math.min,n=Math.max;return c(e,[{key:"reset",value:function(){this.style=0,this.cursor={x:0,y:0,style:1,visible:!0},this.trackMouse=!1,this.theme=-1,this.rainbow=!1,this.parser.reset(),this.clear()}},{key:"clear",value:function(){this.screen=[];for(var e=0;e=this.height&&this.scroll()}},{key:"writeChar",value:function(e){this.screen[this.cursor.y*this.width+this.cursor.x]=[e,this.style],++this.cursor.x>=this.width&&(this.cursor.x=0,this.newLine())}},{key:"moveBack",value:function(){for(var e=0--this.cursor.x&&(this.cursor.x=0=this.width&&(this.cursor.x=0,++this.cursor.y>=this.height&&this.scroll())}},{key:"deleteChar",value:function(){this.moveBack(),this.screen.splice((this.cursor.y+1)*this.width,0,[" ",0]),this.screen.splice(this.cursor.y*this.width+this.cursor.x,1)}},{key:"deleteForward",value:function(e){e=t(this.width,e);for(var n=0;nthis.cursor.x&&(this.cursor.x=0),0>this.cursor.y&&(this.cursor.y=0),this.cursor.x>this.width-1&&(this.cursor.x=this.width-1),this.cursor.y>this.height-1&&(this.cursor.y=this.height-1)}},{key:"handleParsed",value:function(e){"write"===e?this.writeChar(1>=arguments.length?void 0:arguments[1]):"delete"===e?this.deleteForward(1>=arguments.length?void 0:arguments[1]):"insert-blanks"===e?this.insertBlanks(1>=arguments.length?void 0:arguments[1]):"clear"===e?this.clear():"bell"===e?this.termScreen.load("B"):"back"===e?this.moveBack():"new-line"===e?this.newLine():"return"===e?this.cursor.x=0:"set-cursor"===e?(this.cursor.x=2>=arguments.length?void 0:arguments[2],this.cursor.y=1>=arguments.length?void 0:arguments[1],this.clampCursor()):"move-cursor-y"===e?(this.cursor.y+=1>=arguments.length?void 0:arguments[1],this.clampCursor()):"move-cursor-x"===e?(this.cursor.x+=1>=arguments.length?void 0:arguments[1],this.clampCursor()):"move-cursor-line"===e?(this.cursor.x=0,this.cursor.y+=1>=arguments.length?void 0:arguments[1],this.clampCursor()):"set-cursor-x"===e?this.cursor.x=1>=arguments.length?void 0:arguments[1]:"set-cursor-style"===e?this.cursor.style=n(0,t(6,1>=arguments.length?void 0:arguments[1])):"reset-style"===e?this.style=0:"add-attrs"===e?this.style|=(1>=arguments.length?void 0:arguments[1])<<16:"set-color-fg"===e?this.style=16777216|4294967040&this.style|(1>=arguments.length?void 0:arguments[1]):"set-color-bg"===e?this.style=33554432|4294902015&this.style|(1>=arguments.length?void 0:arguments[1])<<8:"reset-color-fg"===e?this.style&=4294901504:"reset-color-bg"===e?this.style&=4294770943:"hide-cursor"===e?this.cursor.visible=!1:"show-cursor"===e&&(this.cursor.visible=!0)}},{key:"write",value:function(e){this.parser.write(e),this.scheduleLoad()}},{key:"serialize",value:function(){var e=String.fromCodePoint,t="S";t+=e(this.height+1)+e(this.width+1),t+=e(this.cursor.y+1)+e(this.cursor.x+1);var n=+this.cursor.visible;n|=96*+this.trackMouse,n|=384,n|=this.cursor.style<<9,t+=e(n+1);var r=null,i=0,o=!0,s=!1,a=void 0;try{for(var c,l=this.screen[Symbol.iterator]();!(o=(c=l.next()).done);o=!0){var u=c.value,h=u[1];if(this.rainbow){var f=i%this.width,d=Math.floor(i/this.width);h=16777216|4294705152&h|m((f+d)/10+Date.now()/1e3),i++}if(h!==r){var v=255&h,p=255&h>>8,w=65535&h>>16,y=v!=(255&r),g=p!=(255&r>>8),b=w!=(65535&r>>16);y&&g?t+=""+e(1+(65535&h)):y?t+=""+e(v+1):g&&(t+=""+e(p+1)),b&&(t+=""+e(w+1)),r=h}t+=u[0]}}catch(e){s=!0,a=e}finally{try{!o&&l.return&&l.return()}finally{if(s)throw a}}return t}},{key:"scheduleLoad",value:function(){var e=this;clearTimeout(this._scheduledLoad),this._lastLoadi;i++)n+=t[r][i]?"[38;5;"+m((i+r)/10)+"m"+t[r][i]:" ";this.emit("write","\r\n[?25l");var o=function(){e.emit("write",n.substr(0,80)),n=n.substr(80),n.length?setTimeout(o,50):(e.emit("write","\r\n[?25h"),e.destroy())};o()}}]),t}(w),"local-echo":function(e){function t(){return s(this,t),i(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return o(t,e),c(t,[{key:"run",value:function(){for(var e=arguments.length,t=Array(e),n=0;nt[i].length&&(t[i]+=" ".repeat(79-t[i].length));this.emit("write","\r\n".repeat(t.length+1)),this.emit("write","".repeat(t.length)),this.emit("write","[?25l");var o=0,s=0,a=function(t,n){var r=Math.abs,i=t-o,a=n-s;e.emit("write","["+r(i)+(0++r?3<=++i?(setTimeout(o,20),i=0):o():(a(0,t.length),e.emit("write","[?25h"),n())};o()})}},{key:"printText",value:function(){var e=0e;e++)this.emit("write","["+(8>e?"3"+e:"9"+(e-8))+"m"),this.emit("write","foreground-color"[e]+" ");this.emit("write","\r\n ");for(var t=0;16>t;t++)this.emit("write","["+(8>t?"4"+t:"10"+(t-8))+"m ");this.emit("write","\r\n");for(var n=0;6>n;n++){this.emit("write"," ");for(var r=0;6>r;r++){for(var i=0;6>i;i++)this.emit("write","[48;5;"+(16+36*n+6*r+i)+"m ");this.emit("write","")}this.emit("write","\r\n")}this.emit("write"," ");for(var o=0;24>o;o++)this.emit("write","[48;5;"+(232+o)+"m ");this.emit("write","\r\n\n"),this.destroy()}}]),t}(w),ls:function(e){function t(){return s(this,t),i(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return o(t,e),c(t,[{key:"run",value:function(){for(var e in this.emit("write","List of demo commands\r\n"),g)"string"!=typeof g[e]&&this.emit("write",e+"\r\n");this.destroy()}}]),t}(w),theme:function(e){function t(e){s(this,t);var n=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return n.shell=e,n}return o(t,e),c(t,[{key:"run",value:function(){var e=0|+(0>=arguments.length?void 0:arguments[0]),t=d.length;return!arguments.length||!Number.isFinite(e)||0>e||e>=t?(this.emit("write","Usage: theme [0–"+(t-1)+"]\r\n"),void this.destroy()):(this.shell.terminal.theme=e,this.shell.terminal.termScreen.drawnScreenFG=[],this.emit("write",""),void this.destroy())}}]),t}(w),cursor:function(e){function t(){return s(this,t),i(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return o(t,e),c(t,[{key:"run",value:function(){for(var e=arguments.length,t=Array(e),n=0;nt;t++){for(var n="",r=0;79>r;r++)n+=e[Math.floor(e.length*Math.random())];this.randomData.push(n)}this.scrollOffset=0,this.render()}},{key:"render",value:function(){this.emit("write",""),this.emit("write","Mouse Demo\r\nMouse movement, clicking and scrolling!");for(var e=0;23>e;e++){var t=e+this.scrollOffset;t=(t%this.randomData.length+this.randomData.length)%this.randomData.length;var n=this.randomData[t],r="["+(3+e)+";1H";for(var i in n)this.highlighted[80*(e+2)+ +i]&&(r+=""),r+=n[i],this.highlighted[80*(e+2)+ +i]&&(r+="");this.emit("write",r)}this.mouse&&this.emit("write","["+(this.mouse.y+1)+";"+(this.mouse.x+1)+"H")}},{key:"mouseMove",value:function(e,t){this.mouse={x:e,y:t},this.render()}},{key:"mouseDown",value:function(e,t,n){4===n?this.scrollOffset--:5===n?this.scrollOffset++:this.highlighted[80*t+e]=!this.highlighted[80*t+e],this.render()}},{key:"mouseUp",value:function(){}},{key:"destroy",value:function(){this.shell.terminal.write(""),this.shell.terminal.trackMouse=!1,y.mouseReceiver===this&&(y.mouseReceiver=null),a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"destroy",this).call(this)}}]),t}(w),sudo:function(e){function t(e){s(this,t);var n=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return n.shell=e,n}return o(t,e),c(t,[{key:"run",value:function(){for(var e=this,t=arguments.length,n=Array(t),r=0;r\r\n"),this.destroy();else if(4===n.length&&"make me a sandwich"===n.join(" ").toLowerCase()){var i="",o="",s="",a="";this.emit("write"," _.---._\r\n _.-~ ~-._\r\n _.-~ ~-._\r\n _.-~ ~---._\r\n _.-~ ~\\\r\n .-~ _.;\r\n :-._ _.-~ ./\r\n `-._~-._ _..__.-~ _.-~\r\n "+s+"/ "+i+"~-._~-._ / .__..--"+s+"~-"+o+"---._\r\n"+s+" \\_____(_"+i+";-._\\. _.-~_/"+s+" ~)"+o+".. . \\\r\n"+o+" /(_____ "+i+"\\`--...--~_.-~"+s+"______..-+"+o+"_______)\r\n"+o+" .(_________/"+i+"`--...--~/"+o+" _/ "+a+" "+i+"/\\\r\n"+i+" /-._"+a+" \\_ "+o+"(___./_..-~"+a+"__....."+i+"__..-~./\r\n"+i+" `-._~-._"+a+" ~\\--------~ .-~"+i+"_..__.-~ _.-~\r\n"+i+" ~-._~-._ "+a+"~---------` "+i+"/ .__..--~\r\n"+i+" ~-._\\. _.-~_/\r\n"+i+" \\`--...--~_.-~\r\n"+i+" `--...--~\r\n"),this.destroy()}else{var c=n.shift();if(this.shell.index[c]){var l=this.shell.index[c];if(l instanceof Function){var u=new l(this),h=function(t){return e.emit("write",t)};u.on("write",h),u.on("exit",function(){u.removeListener("write",h),e.destroy()}),u.run.apply(u,n)}else this.emit("write",l),this.destroy()}else this.emit("write","sudo: "+c+": command not found\r\n"),this.destroy()}}}]),t}(w),make:function(e){function t(){return s(this,t),i(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return o(t,e),c(t,[{key:"run",value:function(){for(var e=arguments.length,t=Array(e),n=0;n=arguments.length?void 0:arguments[1])+this.history[0].substr(this.cursorPos),this.cursorPos++;else if("back"===e)this.copyFromHistoryIndex(),this.history[0]=this.history[0].substr(0,this.cursorPos-1)+this.history[0].substr(this.cursorPos),0>--this.cursorPos&&(this.cursorPos=0);else if("tab"===e)console.warn("TAB not implemented");else if("move-cursor-x"===e)this.cursorPos=Math.max(0,Math.min(this.history[this.historyIndex].length,this.cursorPos+(1>=arguments.length?void 0:arguments[1])));else if("delete-line"===e)this.copyFromHistoryIndex(),this.history[0]="",this.cursorPos=0;else if("delete-word"===e){this.copyFromHistoryIndex();var t=this.history[0].substr(0,this.cursorPos).split(" ");t.pop(),this.history[0]=t.join(" ")+this.history[0].substr(this.cursorPos),this.cursorPos=t.join(" ").length}else"move-cursor-y"===e&&(this.historyIndex-=1>=arguments.length?void 0:arguments[1],0>this.historyIndex&&(this.historyIndex=0),this.historyIndex>=this.history.length&&(this.historyIndex=this.history.length-1),this.cursorPos=this.history[this.historyIndex].length);this.terminal.write(this.history[this.historyIndex]),this.terminal.write("\b".repeat(this.history[this.historyIndex].length)),this.terminal.moveForward(this.cursorPos),this.terminal.write(""),"return"===e&&(this.terminal.write("\r\n"),this.parse(this.history[this.historyIndex]))}},{key:"parse",value:function(e){"help"===e&&(e="info"),this.run(e)}},{key:"run",value:function(e){var t=[""],n=!1,r=!0,i=!1,o=void 0;try{for(var s,a=e.trim()[Symbol.iterator]();!(r=(s=a.next()).done);r=!0){var c=s.value;n&&c!==n?t[t.length-1]+=c:n?n=!1:'"'===c||"'"===c?n=c:c.match(/\s/)?t[t.length-1]&&t.push(""):t[t.length-1]+=c}}catch(e){i=!0,o=e}finally{try{!r&&a.return&&a.return()}finally{if(i)throw o}}var l=t.shift();l in this.index?this.spawn(l,t):(this.terminal.write("demosh: Unknown command: "+l+"\r\n"),this.prompt(!1))}},{key:"spawn",value:function(e){var t=this,n=1c||1114111=c?i.push(c):(c-=65536,e=55296+(c>>10),r=c%1024+56320,i.push(e,r)),(o+1==s||i.length>16384)&&(a+=t.apply(null,i),i.length=0)}return a};e?e(String,"fromCodePoint",{value:r,configurable:!0,writable:!0}):String.fromCodePoint=r}()},function(e,t,n){"use strict";function r(){f=!0,i("#content").addClass("load")}var i=n(1),o=n(0),s=o.mk,a=o.qs,c=o.qsa,l=o.cr,u=n(2),h=n(3);i.ready(function(){function e(){i("#menu").toggleClass("expanded")}i("#brand").on("click",e).on("keypress",l(e)),i(".Row.checkbox").forEach(function(e){var t=e.querySelector("input"),n=e.querySelector(".box");i(n).toggleClass("checked",t.value);var r=function(){t.value=1-t.value,i(n).toggleClass("checked",t.value)};i(e).on("click",r).on("keypress",l(r))}),i(".Box.mobcol,.Box.fold").forEach(function(e){var t=e.querySelector("h2"),n=function(){i(e).hasClass("d-expanded")?i(e).removeClass("d-expanded"):i(e).toggleClass("expanded")};i(t).on("click",n).on("keypress",l(n))}),i("form").forEach(function(e){i(e).on("keypress",function(t){(10===t.keyCode||13===t.keyCode)&&t.ctrlKey&&e.submit()})}),setInterval(function(){i(".anim-dots").each(function(e){var t=i(e),n=t.html()+".";5===n.length&&(n="."),t.html(n)})},1e3),i("input[type=number]").on("mousewheel",function(e){var t=Number.isFinite,n=i(this),r=+n.val();isNaN(r)&&(r=1);var o=+(n.attr("step")||1),s=+n.attr("min"),a=+n.attr("max");if(0.',a("#screen").appendChild(e),r()}},2e3):setTimeout(function(){r()},1)})},function(e,t,n){"use strict";var r=n(1),i=n(0),o=i.mk,s=i.bool,a=n(11);!function(e){function t(e){return"+"+(.25*e.value).toFixed(2)+" dBm"}function n(e,t,n){r("#sta_ssid").val(e),r("#sta_password").val(t),r("#sta-nw").toggleClass("hidden",0===e.length),r("#sta-nw-nil").toggleClass("hidden",0'+e.rssi_perc+"").htmlAppend('
'+l+"
").htmlAppend('
'+h[e.enc]+"
"),i.on("click",function(){var e=r(this),t=e.data("ssid"),i="";+e.data("pwd")&&!(i=window.prompt(a("wifi.enter_passwd").replace(":ssid:",t)))||(r("#sta_password").val(i),r("#sta_ssid").val(t),n(t,i,""))}),t.appendChild(s),c[0].appendChild(t)}})}}function c(){window._demo?i(window._demo_aps,200):r.get("http://"+window._root+"/cfg/wifi/scan",i)}function l(e){setTimeout(c,e)}var u,h=["Open","WEP","WPA","WPA2","WPA/WPA2"];e.init=function(e){r(".Row.range").forEach(function(e){var n=e.querySelector("input"),i=e.querySelector(".x-disp1"),o=e.querySelector(".x-disp2"),s=t(n);r(i).html(s),r(o).html(s),r(n).on("input",function(){s=t(n),r(i).html(s),r(o).html(s)})}),r("#forget-sta").on("click",function(){return n("","",""),!1}),n(e.sta_ssid,e.sta_password,e.sta_active_ip),u=e.sta_active_ssid},e.startScanning=function(){r("#ap-loader").removeClass("hidden"),r("#ap-scan").addClass("hidden"),r("#ap-loader .anim-dots").html("."),c()}}(window.WiFi={})},function(e,t,n){"use strict";var r={"wifi.connected_ip_is":"Connected, IP is ","wifi.not_conn":"Not connected.","wifi.enter_passwd":'Enter password for ":ssid:"'};e.exports=function(e){return r[e]||"?"+e+"?"}},function(e,t,n){"use strict";var r=n(0),i=r.qs,o=r.mk,s=n(3),a=n(13),c=n(16),l=n(17),u=n(18),h=n(19),f=n(20);e.exports=function(e){var t=new a,n=new c(t),r=l(n,t),d=u(n,r,t);t.input=r,t.conn=n,r.termUpload=d;var v=null,m=function(e){var n=1JS ERROR!
"+e+"
at "+t+":"+n+":"+r,1e4,!0),!1},i("#screen").appendChild(t.canvas),t.load(e.labels,e),h(t,r),f&&f(t);var p=!1,w=!1,y=function(){p?(t.window.fitIntoWidth=window.screen.width,t.window.fitIntoHeight=window.screen.height):(t.window.fitIntoWidth=w?window.innerWidth-20:0,t.window.fitIntoHeight=w?window.innerHeight:0)};y(),window.addEventListener("resize",y);var g=function(){w=!w;var e=i("#resize-button-icon");w?(e.classList.remove("icn-resize-small"),e.classList.add("icn-resize-full")):(e.classList.remove("icn-resize-full"),e.classList.add("icn-resize-small")),y()};if(i("#term-fit-screen").addEventListener("click",function(){return g(),!1}),window.Element.prototype.requestFullscreen||window.Element.prototype.webkitRequestFullscreen){setInterval(function(){p&&(window.innerWidth!==window.screen.width||window.innerHeight!==window.screen.height)&&(p=!1,y())},500);var b=o("a");b.href="#",b.addEventListener("click",function(e){e.preventDefault(),p=!0,y(),t.updateSize(),t.canvas.requestFullscreen?t.canvas.requestFullscreen():t.canvas.webkitRequestFullscreen()});var _=o("i");_.classList.add("icn-resize-full"),b.appendChild(_);var k=o("span");k.textContent="Fullscreen",b.appendChild(k),i("#term-nav").insertBefore(b,i("#term-nav").firstChild)}window.termScreen=t,window.conn=n,window.input=r,window.termUpl=d}},function(e,t,n){"use strict";function r(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);tn[1]||t[1]===n[1]&&t[0]>n[0]){var r=[n,t];t=r[0],n=r[1]}return{start:t,end:n}}},{key:"isInSelection",value:function(e,t){var n=this.getNormalizedSelection(),r=n.start,i=n.end,o=r[0]<=e,s=eDate.now()-50)){if(this._lastBeep=Date.now(),!this._convolver){this._convolver=t.createConvolver();for(var n=.8*t.sampleRate,r=t.createBuffer(2,n,t.sampleRate),i=0;i>9;0>1,y=!(1&p);0==w?this.screen.cursor.style="block":1==w?this.screen.cursor.style="line":2==w&&(this.screen.cursor.style="bar"),this.screen.cursor.blinking!==y&&(this.screen.cursor.blinking=y,this.screen.renderer.resetCursorBlink()),this.screen.input.setMouseMode(v,m),this.screen.selection.selectable=!v&&!m,o(this.screen.canvas).toggleClass("selectable",this.screen.selection.selectable),this.screen.mouseMode={clicks:v,movement:m},o(".x-term-conf-btn").toggleClass("hidden",!(256&d)),o("#action-buttons").toggleClass("hidden",!(128&d)),this.screen.bracketedPaste=!!(8192&d),this.screen.reverseVideo=!!(16384&d);var g=7,b=0,_=0,k=0,C=" ",x=this.screen.window.width*this.screen.window.height;l&&(this.screen.updateSize(),this.screen.blinkingCellCount=0,this.screen.screen=Array(x).fill(" "),this.screen.screenFG=Array(x).fill(" "),this.screen.screenBG=Array(x).fill(" "),this.screen.screenAttrs=Array(x).fill(0));for(var S=function(){var e=_,n=256&_,r=512&_;0!=(16&e)&&(" "==C&&0==(200&e)||g==b&&n&&r)&&(e^=16),(16&t.screen.screenAttrs[k])!=(16&e)&&(16&e?t.screen.blinkingCellCount++:t.screen.blinkingCellCount--),t.screen.screen[k]=C,t.screen.screenFG[k]=g,t.screen.screenBG[k]=b,t.screen.screenAttrs[k]=e};nx));L++);break;case 3:A=r[n++].codePointAt(0)-1,g=255&A,b=255&A>>8;break;case 4:A=r[n++].codePointAt(0)-1,_=65535&A;break;case 5:A=r[n++].codePointAt(0)-1,g=255&A;break;case 6:A=r[n++].codePointAt(0)-1,b=255&A;break;default:32>E&&(T="�"),C=T,S(),k++}}this.screen.window.debug&&console.log("Blinky cells: "+this.screen.blinkingCellCount),this.screen.renderer.scheduleDraw("load",16),this.screen.conn.emit("load")}},{key:"loadLabels",value:function(e){var t=e.split(""),n=t[0];a("#screen-title").textContent=n,0===n.length&&(n="Terminal"),a("title").textContent=n+" :: ESPTerm",o("#action-buttons button").forEach(function(e,n){var r=t[n+1].trim();e.innerHTML=r?o.htmlEscape(r):" ",e.style.opacity=r?1:.2})}},{key:"load",value:function(e){var t=1e&&e in this.palette)return this.palette[e];if(-1===e)return c;if(-2===e)return l;if(15e)return this.colorTable256[e];if(255>16)+", "+(255&e>>8)+", "+(255&e)+")"}return 0==Date.now()/1e3%2?"#f0f":"#0f0"}},{key:"resetCursorBlink",value:function(){var e=this;this.cursorBlinkOn=!0,clearInterval(this.cursorBlinkInterval),this.cursorBlinkInterval=setInterval(function(){e.cursorBlinkOn=!e.screen.cursor.blinking||!e.cursorBlinkOn,e.screen.cursor.blinking&&e.scheduleDraw("cursor-blink")},500)}},{key:"resetBlink",value:function(){var e=this;this.blinkStyleOn=!0,clearInterval(this.blinkInterval);var t=0;this.blinkInterval=setInterval(function(){0>=e.screen.blinkingCellCount||(t++,4<=t&&e.blinkStyleOn?(e.blinkStyleOn=!1,t=0,e.scheduleDraw("blink-style")):1<=t&&!e.blinkStyleOn&&(e.blinkStyleOn=!0,t=0,e.scheduleDraw("blink-style")))},200)}},{key:"drawBackground",value:function(e){var t=e.x,n=e.y,r=e.cellWidth,i=e.cellHeight,o=e.bg,s=this.ctx;s.fillStyle=this.getColor(o),s.clearRect(t*r,n*i,r,i),s.fillRect(t*r,n*i,r,i)}},{key:"drawCharacter",value:function(t){var n=Math.round,r=t.x,i=t.y,o=t.charSize,s=t.cellWidth,a=t.cellHeight,c=t.text,l=t.fg,u=t.attrs;if(c){var h=this.ctx,f=!1,d=!1,v=!1;2&u&&(h.globalAlpha=.5),8&u&&(f=!0),32&u&&(c=e.alphaToFraktur(c)),64&u&&(d=!0),128&u&&(v=!0),h.fillStyle=this.getColor(l);var m=c.codePointAt(0);if(9600<=m&&9631>=m){h.beginPath();var p=r*s,w=i*a,y=s,g=a,b=s/2,_=a/2;if(9600===m)h.rect(p,w,y,_);else if(9608>=m){var k=(1-(m-9600)/8)*g;h.rect(p,w+k,y,g-k)}else if(9615>=m)h.rect(p,w,y-(m-9608)/8*y,g);else if(9616===m)h.rect(p+b,w,b,g);else if(9619>=m){var C,x,S;9617===m?(C=y/4,x=g/10,S=1):9618===m?(C=y/6,x=y/10,S=1):9619===m&&(C=y/4,x=y/7,S=2);for(var T=!1,E=0;E=u+.05},L=!0,P=!1,O=void 0;try{for(var D,B=d.keys()[Symbol.iterator]();!(L=(D=B.next()).done);L=!0){var N=D.value;!function(e){var n=d.get(e)||A.get(e)||!1,r=t.screen.screen[e],i=F(r),o=i?2:1;if(!n){var s=!1,a=!0,c=!1,l=void 0;try{for(var u,h=t.getAdjacentCells(e,o)[Symbol.iterator]();!(a=(u=h.next()).done);a=!0){var f=u.value;if(d.get(f)&&(2>t.screen.window.graphics||i||F(t.screen.screen[f]))){s=!0;break}}}catch(e){c=!0,l=e}finally{try{!a&&h.return&&h.return()}finally{if(c)throw l}}s&&(n=!0)}A.set(e,n)}(N)}}catch(e){P=!0,O=e}finally{try{!L&&B.return&&B.return()}finally{if(P)throw O}}if(1<=this.screen.window.graphics){var M=this.screen.window.debug&&this.screen._debug;n.save(),n.beginPath();for(var I=0;Ih;h++){t.rotate(Math.PI/6);var f=(12*u-h)%12;t.globalAlpha=Math.max(.2,1-f/3),t.beginPath(),t.moveTo(0,15),t.lineTo(0,30),t.stroke()}t.restore()}}},{key:"startDrawLoop",value:function(){if(!this._drawTimerThread){var e=Math.random().toString(36);this._drawTimerThread=e,this.drawTimerLoop(e)}}},{key:"stopDrawLoop",value:function(){this._drawTimerThread=null}},{key:"drawTimerLoop",value:function(e){var t=this;e&&e===this._drawTimerThread&&(window.requestAnimationFrame(function(){return t.drawTimerLoop(e)}),this.draw("draw-loop"))}},{key:"palette",get:function(){return this._palette||s[0]},set:function(e){this._palette!==e&&(this._palette=e,this.resetDrawn(),this.scheduleDraw("palette"))}}],[{key:"alphaToFraktur",value:function(e){var t=String.fromCodePoint;return"a"<=e&&"z">=e?e=t(119997+e.charCodeAt(0)):"A"<=e&&"Z">=e&&(e=u[e]||t(120003+e.charCodeAt(0))),e}}]),e}()},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var s,a=function(){function e(e,t){for(var n=0;ne.code&&console.error("Bad code from socket!"),clearTimeout(this.reconnTimeout),this.reconnTimeout=setTimeout(function(){return t.init()},2e3),void this.emit("disconnect",e.code))}},{key:"onWSMessage",value:function(e){var t=this;try{switch(e.data.charAt(0)){case".":break;case"-":this.xoff=!0,this.autoXoffTimeout=setTimeout(function(){t.xoff=!1},250);break;case"+":this.xoff=!1,clearTimeout(this.autoXoffTimeout);break;default:this.screen.load(e.data),this.pageShown||(window.showPage(),this.pageShown=!0)}this.heartbeat()}catch(e){console.error(e)}}},{key:"canSend",value:function(){return!this.xoff}},{key:"send",value:function(e){return window._demo?(void 0===window.demoInterface?console.log("TX: "+JSON.stringify(e)):s.input(e),!0):this.xoff?(console.log("Can't send, flood control."),!1):!!this.ws&&(1===this.ws.readyState?("string"!=typeof e&&(e=JSON.stringify(e)),this.ws.send(e),!0):(console.error("Socket not ready"),!1))}},{key:"closeSocket",value:function(){this.ws&&(this.forceClosing=!0,1===this.ws.readyState&&this.ws.close(),this.ws=null)}},{key:"init",value:function(){var e=this;return window._demo?void(void 0===window.demoInterface?window.alert("Demoing non-demo build!"):s.init(this.screen)):(clearTimeout(this.reconnTimeout),clearTimeout(this.heartbeatTimeout),this.closeSocket(),this.ws=new window.WebSocket("ws://"+window._root+"/term/update.ws"),this.ws.addEventListener("open",function(){return e.onWSOpen.apply(e,arguments)}),this.ws.addEventListener("close",function(){return e.onWSClose.apply(e,arguments)}),this.ws.addEventListener("message",function(){return e.onWSMessage.apply(e,arguments)}),console.log("Opening socket."),this.heartbeat(),void this.emit("open"))}},{key:"heartbeat",value:function(){var e=this;clearTimeout(this.heartbeatTimeout),this.heartbeatTimeout=setTimeout(function(){return e.onHeartbeatFail()},2500)}},{key:"onHeartbeatFail",value:function(){var e=this;this.closeSocket(),this.emit("silence"),console.error("Heartbeat lost, probing server..."),clearInterval(this.pingInterval),this.pingInterval=setInterval(function(){console.log("> ping"),e.emit("ping"),l.get("http://"+window._root+"/system/ping",function(t,n){200===n?(clearInterval(e.pingInterval),console.info("Server ready, opening socket…"),e.emit("ping-success"),e.init()):e.emit("ping-fail",n)},{timeout:100,loader:!1})},1e3)}}]),t}(c)},function(e,t,n){"use strict";var r=n(1),i=n(0),o=i.encode2B;e.exports=function(e,t){function n(t){return e.send("s"+t)}function i(t){e.send("b"+l(t))}function s(e){var r=e.allFn;window.addEventListener("keypress",function(e){if(_()&&!e.ctrlKey&&!e.metaKey){var t="";e.key&&1===e.key.length?t=e.key:e.which&&229!==e.which&&(t=String.fromCodePoint(e.which)),0",63:"?",64:"@",91:"Meta",92:"Meta",93:"ContextMenu",106:"Numpad*",107:"Numpad+",109:"Numpad-",110:"Numpad.",111:"Numpad/",144:"NumLock",145:"ScrollLock",160:"^",161:"!",162:'"',163:"#",164:"$",165:"%",166:"&",167:"_",168:"(",169:")",170:"*",171:"+",172:"|",173:"-",174:"{",175:"}",176:"~",186:";",187:"=",188:"Numpad,",189:"-",190:"Numpad,",192:"`",194:"Numpad,",219:"[",220:"\\",221:"]",222:"'",224:"Meta"},h=48;57>=h;h++)u[h]=l(h);for(var f=65;90>=f;f++)u[f]=l(f);for(var d=112;131>=d;d++)u[d]="F"+(d-112+1);for(var v=96;105>=v;v++)u[v]="Numpad"+(v-96);for(var m={np_alt:!1,cu_alt:!1,fn_alt:!1,mt_click:!1,mt_move:!1,no_keys:!1,crlf_mode:!1,all_fn:!1},p=function(e,t){return m.fn_alt?e:t},w=function(e,t){return m.cu_alt?e:t},y=function(e,t){return m.np_alt?e:t},g={Backspace:"\b",Tab:"\t",Enter:function(){return m.crlf_mode?"\r\n":"\r"},"Control+Enter":"\n",Escape:"",ArrowUp:function(){return w("OA","")},ArrowDown:function(){return w("OB","")},ArrowRight:function(){return w("OC","")},ArrowLeft:function(){return w("OD","")},Home:function(){return w("OH",p("","[1~"))},Insert:"[2~",Delete:"[3~",End:function(){return w("OF",p("","[4~"))},PageUp:"[5~",PageDown:"[6~",F1:function(){return p("OP","[11~")},F2:function(){return p("OQ","[12~")},F3:function(){return p("OR","[13~")},F4:function(){return p("OS","[14~")},F5:"[15~",F6:"[17~",F7:"[18~",F8:"[19~",F9:"[20~",F10:"[21~",F11:"[23~",F12:"[24~","Shift+F1":function(){return p("O1;2P","[25~")},"Shift+F2":function(){return p("O1;2Q","[26~")},"Shift+F3":function(){return p("O1;2R","[28~")},"Shift+F4":function(){return p("O1;2S","[29~")},"Shift+F5":function(){return p("[15;2~","[31~")},"Shift+F6":function(){return p("[17;2~","[32~")},"Shift+F7":function(){return p("[18;2~","[33~")},"Shift+F8":function(){return p("[19;2~","[34~")},"Shift+F9":function(){return p("[20;2~","[35~")},"Shift+F10":function(){return p("[21;2~","[36~")},"Shift+F11":function(){return p("[22;2~","[37~")},"Shift+F12":function(){return p("[23;2~","[38~")},Numpad0:function(){return y("Op","0")},Numpad1:function(){return y("Oq","1")},Numpad2:function(){return y("Or","2")},Numpad3:function(){return y("Os","3")},Numpad4:function(){return y("Ot","4")},Numpad5:function(){return y("Ou","5")},Numpad6:function(){return y("Ov","6")},Numpad7:function(){return y("Ow","7")},Numpad8:function(){return y("Ox","8")},Numpad9:function(){return y("Oy","9")},"Numpad*":function(){return y("OR","*")},"Numpad+":function(){return y("Ol","+")},"Numpad-":function(){return y("OS","-")},"Numpad.":function(){return y("On",".")},"Numpad/":function(){return y("OQ","/")},"Control+]":"","Control+\\":"","Control+[":"","Control+^":"","Control+_":"","Control+ArrowLeft":"[1;5D","Control+ArrowRight":"[1;5C","Control+ArrowUp":"[1;5A","Control+ArrowDown":"[1;5B","Control+Home":"[1;5H","Control+End":"[1;5F","Shift+ArrowLeft":"[1;2D","Shift+ArrowRight":"[1;2C","Shift+ArrowUp":"[1;2A","Shift+ArrowDown":"[1;2B","Shift+Home":"[1;2H","Shift+End":"[1;2F","Alt+ArrowLeft":"b","Alt+ArrowRight":"f","Meta+ArrowLeft":"","Meta+ArrowRight":"","Alt+Backspace":"","Meta+Backspace":"","Control+Shift+C":function(){t.copySelectionToClipboard()},"Control+Insert":function(){t.copySelectionToClipboard()},"Control+F12":function(){t.window.debug^=1}},b=1;26>=b;b++)g["Control+"+l(64+b)]=l(b);var _=function(){return!(m.no_keys||document.activeElement instanceof window.HTMLTextAreaElement)},k=["F5","F11","F12","Shift+F5"],C={alt:!1,ctrl:!1,meta:!1,shift:!1},x=function(e){if(_()){var t=[];(e.altKey||C.alt)&&t.push("Alt"),(e.ctrlKey||C.ctrl)&&t.push("Control"),(e.metaKey||C.meta)&&t.push("Meta"),(e.shiftKey||C.shift)&&t.push("Shift");var r=u[e.which]||e.key;if(!e.ctrlKey&&!e.metaKey||"V"!==r){var i=null;for(var o in g){var s=o.split("+");if(s.pop()===r&&s.sort().join()===t.join()){if(k.includes(o)&&!m.all_fn)continue;i=g[o];break}}i&&(i instanceof Function&&(i=i()),e.preventDefault(),"string"==typeof i&&n(i))}}},S=0,T=0,E=0,A=0;return window.addEventListener("keydown",function(e){e.ctrlKey&&(A|=1),e.shiftKey&&(A|=2),e.altKey&&(A|=4),e.metaKey&&(A|=8)}),window.addEventListener("keyup",function(e){A=0,e.ctrlKey&&(A|=1),e.shiftKey&&(A|=2),e.altKey&&(A|=4),e.metaKey&&(A|=8)}),c={init:function(e){s(e),r("#action-buttons button").forEach(function(e){e.addEventListener("click",function(){i(+this.dataset.n)})}),window.addEventListener("mousedown",function(e){0===e.button&&(S=1),1===e.button&&(T=1),2===e.button&&(E=1)}),window.addEventListener("mouseup",function(e){0===e.button&&(S=0),1===e.button&&(T=0),2===e.button&&(E=0)})},sendString:n,setAlts:function(e,t,n,r){(m.cu_alt!==e||m.np_alt!==t||m.fn_alt!==n||m.crlf_mode!==r)&&(m.cu_alt=e,m.np_alt=t,m.fn_alt=n,m.crlf_mode=r)},setMouseMode:function(e,t){m.mt_click=e,m.mt_move=t},onMouseMove:function(t,n){if(m.mt_move){var r=S?1:T?2:E?3:0,i=a();e.send("m"+o(n)+o(t)+o(r)+o(i))}},onMouseDown:function(t,n,r){if(m.mt_click&&!(3r)){var i=a();e.send("p"+o(n)+o(t)+o(r)+o(i))}},onMouseUp:function(t,n,r){if(m.mt_click&&!(3r)){var i=a();e.send("r"+o(n)+o(t)+o(r)+o(i))}},onMouseWheel:function(t,n,r){if(m.mt_click){var i=a(),s=0>r?4:5;e.send("p"+o(n)+o(t)+o(s)+o(i))}},blockKeys:function(e){m.no_keys=e},handleKeyDown:x,softModifiers:C}}},function(e,t,n){"use strict";var r=n(1),i=n(0),o=i.qs,s=n(2);e.exports=function(e,t,n){function i(){c("Ready..."),s.show("#fu_modal",a),r("#fu_form").toggleClass("busy",!1),t.blockKeys(!0)}function a(){console.log("Upload modal closed."),clearTimeout(m),v=0,t.blockKeys(!1)}function c(e){o("#fu_prog").textContent=e}function l(){var e=o("#fu_text").value;return e.length?(d=e.split("\n"),v=0,g=0,p=o("#fu_delay").value,0>p&&(p=0,o("#fu_delay").value=p),w={CR:"\r",LF:"\n",CRLF:"\r\n"}[o("#fu_crlf").value],r("#fu_form").toggleClass("busy",!0),c("Starting..."),void u()):void f()}function u(){if(r("#fu_modal").hasClass("visible")){if(!e.canSend())return void(m=setTimeout(u,1));0===g&&(y="",0===v&&n.bracketedPaste&&(y="[200~"),y+=d[v++]+w,v===d.length&&n.bracketedPaste&&(y+="[201~"));var i;if(y.length-g<=b?(i=y.substr(g,b),g=0):(i=y.substr(g,b),g+=b),!t.sendString(i))return void c("FAILED!");var o=Math.round(v/d.length*1e3)/10;c(v+" / "+d.length+" ("+o+"%)"),d.length>v||0c.length?e.startsWith(c)?t.sendString(e.substr(c.length)):n=!0:e.lengths.length&&(s=("0000"+s).substr(-4)),s="U+"+s,b.textContent="Cursor cell ("+t+"): "+s+" FG: "+n+" BG: "+r+" Attrs: "+o.toString(2)}})}}]); //# sourceMappingURL=app.f5dd70a.js.map