You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 lines
385 KiB
1 lines
385 KiB
{"version":3,"sources":["webpack:///app.f5dd70a.js","webpack:///webpack/bootstrap bd9a577b27d35638d000","webpack:///./js/utils.js","webpack:///./js/lib/chibi.js","webpack:///./js/modal.js","webpack:///./js/notif.js","webpack:///./js/term/themes.js","webpack:///./node_modules/events/events.js","webpack:///./js/term/demo.js","webpack:///./js/index.js","webpack:///./js/lib/polyfills.js","webpack:///./js/appcommon.js","webpack:///./js/wifi.js","webpack:///./js/lang.js","webpack:///./js/term/index.js","webpack:///./js/term/screen.js","webpack:///./js/term/screen_parser.js","webpack:///./js/term/screen_renderer.js","webpack:///./js/term/connection.js","webpack:///./js/term/input.js","webpack:///./js/term/upload.js","webpack:///./js/term/soft_keyboard.js","webpack:///./js/term/debug_screen.js"],"names":["modules","__webpack_require__","moduleId","installedModules","exports","module","i","l","call","m","c","d","name","getter","o","Object","defineProperty","configurable","enumerable","get","n","__esModule","object","property","prototype","hasOwnProperty","p","s","mk","a","document","createElement","qs","querySelector","qsa","querySelectorAll","cr","b","which","bool","parse2B","arguments","length","charCodeAt","parse3B","encode2B","String","fromCharCode","encode3B","e","_typeof","Symbol","iterator","constructor","q","replace","charAt","toUpperCase","f","currentStyle","getComputedStyle","getPropertyValue","g","encodeURIComponent","h","style","display","j","Array","nodeName","elements","disabled","type","value","selected","checked","substring","k","split","classList","remove","add","toggle","contains","r","innerHTML","lastChild","parentNode","insertBefore","nextSibling","appendChild","firstChild","nodeType","each","apply","first","shift","last","pop","odd","push","even","hide","show","removeChild","css","getClass","className","setClass","addClass","removeClass","toggleClass","hasClass","html","htmlBefore","htmlAfter","htmlAppend","htmlPrepend","attr","toLowerCase","cssText","setAttribute","getAttribute","data","val","on","addEventListener","attachEvent","off","removeEventListener","detachEvent","window","onload","ajax","assign","method","nocache","timeout","loader","callback","_loader","url","indexOf","XMLHttpRequest","Date","toString","open","setTimeout","console","error","abort","onreadystatechange","readyState","responseText","status","clearTimeout","setRequestHeader","send","post","ready","loaded","t","&","<",">","\"","'","/","`","=","htmlEscape","$","modal","curCloseCb","init","this","stopImmediatePropagation","$balloon","timerHideBegin","timerHideEnd","nt","canCancel","stopTimeouts","resolveColor","themes","buildColorTable","fgbgThemes","colorTable256","fill","SELECTION_FG","SELECTION_BG","themePreview","forEach","dataset","fg","test","color","bg","backgroundColor","EventEmitter","_events","_maxListeners","undefined","isFunction","arg","isNumber","isObject","isUndefined","defaultMaxListeners","setMaxListeners","isNaN","TypeError","emit","er","handler","len","args","listeners","Error","err","context","slice","addListener","listener","newListener","warned","trace","once","removeListener","fired","list","position","splice","removeAllListeners","key","listenerCount","evlistener","emitter","_toConsumableArray","isArray","from","_possibleConstructorReturn","ReferenceError","_inherits","create","writable","setPrototypeOf","__proto__","_classCallCheck","_get","Function","getOwnPropertyDescriptor","getPrototypeOf","_createClass","_require","_require2","ANSIParser","reset","joinChunks","currentSequence","sequence","map","next","done","codePointAt","match","parseSequence","return","getRainbowColor","Math","PI","floor","sin","ScrollingTerminal","width","height","termScreen","parser","handleParsed","_lastLoad","now","load","serialize","showPage","min","max","cursor","x","y","visible","trackMouse","theme","rainbow","clear","screen","scroll","newLine","moveBack","writeChar","deleteForward","insertBlanks","clampCursor","write","scheduleLoad","fromCodePoint","_scheduledLoad","clearInterval","_rainbowTimer","setInterval","Process","demoData","buttons","1","2","3","4","5","child","destroy","substr","mouseReceiver","demoshIndex","screenfetch","location","hostname","devicePixelRatio","filter","trim","local-echo","includes","info","showSplash","then","printText"," ",".","-","*","#","repeat","abs","Promise","join","colors","ls","shell","Number","isFinite","terminal","drawnScreenFG","rainbowTimer","mouse","randomData","highlighted","random","scrollOffset","render","sudo","index","run","make","pwd","cd","whoami","navigator","userAgent","uname","mkdir","rm","cp","mv","ln","touch","exit","github","DemoShell","history","historyIndex","cursorPos","prompt","unshift","copyFromHistoryIndex","warn","moveForward","parse","spawn","demoInterface","input","mouseMove","mouseDown","mouseUp","didInit","termInit","RangeError","pageShown","notify","keyCode","ctrlKey","submit","wheelDelta","createEvent","initEvent","dispatchEvent","fireEvent","preventDefault","search","decodeURIComponent","childNodes","textContent","innerWidth","removeAttribute","href","noAutoShow","id","tr","toFixed","JSON","log","result","inProgress","APs","sort","rssi","enc","parseInt","essid","rssi_perc","_demo","_demo_aps","_root","sta_ssid","sta_password","sta_active_ip","sta_active_ssid","startScanning","WiFi","_tr","Notify","TermScreen","TermConnection","TermInput","TermUpload","initSoftKeyboard","attachDebugScreen","conn","termUpload","statusScreen","title","loading","screenFG","screenBG","screenAttrs","onerror","canvas","labels","fitIntoWidth","fitIntoHeight","innerHeight","Element","requestFullscreen","webkitRequestFullscreen","updateSize","termUpl","ScreenParser","ScreenRenderer","ctx","getContext","renderer","_debug","audioCtx","AudioContext","webkitAudioContext","Proxy","set","blinking","hanging","_window","fontFamily","fontSize","gridScaleX","gridScaleY","debug","graphics","_windowScale","windowState","selection","selectable","start","end","mouseMode","clicks","movement","scheduleSizeUpdate","scheduleDraw","bracketedPaste","blinkingCellCount","reverseVideo","screenToGrid","getNormalizedSelection","altKey","button","offsetX","offsetY","onMouseDown","concat","getBoundingClientRect","clientX","left","clientY","top","touches","passive","gridToScreen","transform","copySelectionToClipboard","onMouseMove","onMouseUp","onMouseWheel","deltaY","_scheduledSizeUpdate","weight","getCellSize","font","getFont","measureText","ceil","getCharSize","round","resetDrawn","draw","isInSelection","getSelectedText","body","select","execCommand","Notification","permission","focus","requestPermission","pow","_lastBeep","_convolver","createConvolver","sampleRate","createBuffer","getChannelData","buffer","connect","destination","createOscillator","createGain","gain","frequency","currentTime","stop","requestAnimationFrame","contentLoaded","resetCursorBlink","setAlts","setMouseMode","u","v","w","z","A","B","C","D","E","opacity","defaultFg","defaultBg","setDefaultColors","palette","loadContent","loadLabels","beep","showNotification","stringify","frakturExceptions","_palette","defaultBgNum","defaultFgNum","blinkStyleOn","blinkInterval","cursorBlinkOn","cursorBlinkInterval","resetBlink","drawnScreen","drawnScreenBG","drawnScreenAttrs","drawnCursor","_scheduledDraw","cellWidth","cellHeight","fillStyle","getColor","clearRect","fillRect","charSize","text","attrs","globalAlpha","alphaToFraktur","beginPath","rect","fillText","strokeStyle","lineWidth","lineCap","moveTo","lineTo","F","G","stroke","drawStatus","startDrawLoop","stopDrawLoop","setTransform","drawStart","textAlign","textBaseline","Map","ha","ia","ja","ka","la","ma","na","oa","pa","qa","ra","sa","has","cell","isCursor","inSelection","keys","getAdjacentCells","save","ta","ua","va","wa","xa","clipRect","clip","ya","H","I","J","za","K","L","M","N","O","drawBackground","Aa","setCell","P","Q","R","S","T","Ba","Ca","U","V","W","X","Y","Da","Z","_","aa","ba","ca","da","ea","fa","drawCharacter","ga","restore","drawEnd","translate","rotate","_drawTimerThread","drawTimerLoop","demo","ws","heartbeatTimeout","pingInterval","xoff","autoXoffTimeout","reconnTimeout","forceClosing","disconnectTimeout","hidden","closeSocket","heartbeat","code","close","alert","WebSocket","onWSOpen","onWSClose","onWSMessage","onHeartbeatFail","allFn","metaKey","clipboardData","setData","getData","setContent","all_fn","6","8","9","12","13","16","17","18","19","20","27","32","33","34","35","36","37","38","39","40","41","42","43","44","45","46","58","59","60","61","62","63","64","91","92","93","106","107","109","110","111","144","145","160","161","162","163","164","165","166","167","168","169","170","171","172","173","174","175","176","186","187","188","189","190","192","194","219","220","221","222","224","np_alt","cu_alt","fn_alt","mt_click","mt_move","no_keys","crlf_mode","Backspace","Tab","Enter","Control+Enter","Escape","ArrowUp","ArrowDown","ArrowRight","ArrowLeft","Home","Insert","Delete","End","PageUp","PageDown","F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12","Shift+F1","Shift+F2","Shift+F3","Shift+F4","Shift+F5","Shift+F6","Shift+F7","Shift+F8","Shift+F9","Shift+F10","Shift+F11","Shift+F12","Numpad0","Numpad1","Numpad2","Numpad3","Numpad4","Numpad5","Numpad6","Numpad7","Numpad8","Numpad9","Numpad*","Numpad+","Numpad-","Numpad.","Numpad/","Control+]","Control+\\","Control+[","Control+^","Control+_","Control+ArrowLeft","Control+ArrowRight","Control+ArrowUp","Control+ArrowDown","Control+Home","Control+End","Shift+ArrowLeft","Shift+ArrowRight","Shift+ArrowUp","Shift+ArrowDown","Shift+Home","Shift+End","Alt+ArrowLeft","Alt+ArrowRight","Meta+ArrowLeft","Meta+ArrowRight","Alt+Backspace","Meta+Backspace","Control+Shift+C","Control+Insert","Control+F12","activeElement","HTMLTextAreaElement","alt","ctrl","meta","shiftKey","sendString","blockKeys","handleKeyDown","softModifiers","CR","LF","CRLF","canSend","FileReader","target","files","confirm","readAsText","_slicedToArray","startsWith","stopPropagation","isComposing","inputType","Control","Esc","←","↓","↑","→","pointerEvents","createPattern","strokeRect"],"mappings":"CAAS,SAAUA,GCInB,QAAAC,GAAAC,GAGA,GAAAC,EAAAD,GACA,MAAAC,GAAAD,GAAAE,OAGA,IAAAC,GAAAF,EAAAD,IACAI,EAAAJ,EACAK,GAAA,EACAH,WAUA,OANAJ,GAAAE,GAAAM,KAAAH,EAAAD,QAAAC,IAAAD,QAAAH,GAGAI,EAAAE,GAAA,EAGAF,EAAAD,QAvBA,GAAAD,KA4BAF,GAAAQ,EAAAT,EAGAC,EAAAS,EAAAP,EAGAF,EAAAU,EAAA,SAAAP,EAAAQ,EAAAC,GACAZ,EAAAa,EAAAV,EAAAQ,IACAG,OAAAC,eAAAZ,EAAAQ,GACAK,cAAA,EACAC,YAAA,EACAC,IAAAN,KAMAZ,EAAAmB,EAAA,SAAAf,GACA,GAAAQ,GAAAR,KAAAgB,WACA,WAA2B,MAAAhB,GAAA,SAC3B,WAAiC,MAAAA,GAEjC,OADAJ,GAAAU,EAAAE,EAAA,IAAAA,GACAA,GAIAZ,EAAAa,EAAA,SAAAQ,EAAAC,GAAsD,MAAAR,QAAAS,UAAAC,eAAAjB,KAAAc,EAAAC,IAGtDtB,EAAAyB,EAAA,GAGAzB,IAAA0B,EAAA,KDMM,SAAUtB,EAAQD,EAASH,GAEjC,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,KAAAA,EACApC,EAAQ8X,YAAR,gBAAAnX,EAAA,MAAAyB,EAAA,QAAApD,EAAA,QAAAC,EAAA,WAAoG+C,EAAUuF,SAAS","file":"app.f5dd70a.js","sourcesContent":["/******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, {\n/******/ \t\t\t\tconfigurable: false,\n/******/ \t\t\t\tenumerable: true,\n/******/ \t\t\t\tget: getter\n/******/ \t\t\t});\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = 7);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\nexports.mk=function(a){return document.createElement(a)},exports.qs=function(a){return document.querySelector(a)},exports.qsa=function(a){return document.querySelectorAll(a)},exports.cr=function(a){return function(b){(10===b.which||13===b.which||32===b.which)&&a()}},exports.bool=function(a){return 1===a||'1'===a||!0===a||'true'===a},exports.parse2B=function(a){var b=1<arguments.length&&arguments[1]!==void 0?arguments[1]:0;return a.charCodeAt(b++)-1+127*(a.charCodeAt(b)-1)},exports.parse3B=function(a){var b=1<arguments.length&&arguments[1]!==void 0?arguments[1]:0;return a.charCodeAt(b)-1+127*(a.charCodeAt(b+1)-1)+127*(127*(a.charCodeAt(b+2)-1))},exports.encode2B=function(a){var b=String.fromCharCode;var c,d;return c=a%127,a=(a-c)/127,c+=1,d=a+1,b(c)+b(d)},exports.encode3B=function(a){var b=String.fromCharCode;var c,d,e;return c=a%127,a=(a-c)/127,c+=1,d=a%127,a=(a-d)/127,d+=1,e=a+1,b(c)+b(d)+b(e)};\n\n/***/ }),\n/* 1 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\nvar _typeof='function'==typeof Symbol&&'symbol'==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&'function'==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?'symbol':typeof a};(function(){'use strict';function a(){var a;for(p=!0,a=0;a<n.length;a+=1)n[a]();n=[]}function b(){var b;for(q=!0,p||a(),b=0;b<o.length;b+=1)o[b]();o=[]}function c(a,b){var c;for(c=b.length-1;0<=c;c-=1)a(b[c])}function e(a){return a.replace(/-\\w/g,function(a){return a.charAt(1).toUpperCase()})}function f(a,b){return a.currentStyle?a.currentStyle[e(b)]:d.getComputedStyle?d.getComputedStyle(a,null).getPropertyValue(b):null}function g(a,b){return encodeURIComponent(a).replace(/%20/g,'+')+'='+encodeURIComponent(b).replace(/%20/g,'+')}function h(a,b,c){try{a.style[e(b)]=c}catch(a){}}function i(a){a.style.display='','none'===f(a,'display')&&(a.style.display='block')}function j(a){var b,d,e,f='';if(a.constructor===Object){for(b in a)if(a.hasOwnProperty(b))if(a[b].constructor===Array)for(d=0;d<a[b].length;d+=1)f+='&'+g(b,a[b][d]);else f+='&'+g(b,a[b]);}else c(function(a){if('FORM'===a.nodeName)for(d=0;d<a.elements.length;d+=1)if(b=a.elements[d],!b.disabled)switch(b.type){case'button':case'image':case'file':case'submit':case'reset':break;case'select-one':0<b.length&&(f+='&'+g(b.name,b.value));break;case'select-multiple':for(e=0;e<b.length;e+=1)b[e].selected&&(f+='&'+g(b.name,b[e].value));break;case'checkbox':case'radio':b.checked&&(f+='&'+g(b.name,b.value));break;default:f+='&'+g(b.name,b.value);}},a);return 0<f.length?f.substring(1):''}function k(a,b,d){var e,f,g=!1;return a&&(e=a.split(/\\s+/),c(function(a){for(f=0;f<e.length;f+=1){var c=e[f];if('remove'===b)a.classList.remove(c);else if('add'===b)a.classList.add(c);else if('toggle'===b)a.classList.toggle(c);else if('has'===b&&a.classList.contains(c)){g=!0;break}}},d)),g}function l(a,b,d){var e,f;a&&c(function(c){for(e=r.createElement('div'),e.innerHTML=a;null!==(f=e.lastChild);)try{'before'===b?c.parentNode.insertBefore(f,c):'after'===b?c.parentNode.insertBefore(f,c.nextSibling):'append'===b?c.appendChild(f):'prepend'===b&&c.insertBefore(f,c.firstChild)}catch(a){break}},d)}function m(a){var b,g,j,n=[],o=!1;if(a)if(a.nodeType&&1===a.nodeType)n=[a];else if('object'===('undefined'==typeof a?'undefined':_typeof(a)))o='number'!=typeof a.length,n=a;else if('string'==typeof a)for(g=r.querySelectorAll(a),j=0;j<g.length;j+=1)n[j]=g[j];return b=o?{}:n,b.each=function(a){return'function'==typeof a&&c(function(b){return a.apply(b,arguments)},n),b},b.first=function(){return m(n.shift())},b.last=function(){return m(n.pop())},b.odd=function(){var a,b=[];for(a=0;a<n.length;a+=2)b.push(n[a]);return m(b)},b.even=function(){var a,b=[];for(a=1;a<n.length;a+=2)b.push(n[a]);return m(b)},b.hide=function(){return c(function(a){a.style.display='none'},n),b},b.show=function(){return c(function(a){i(a)},n),b},b.toggle=function(a){return'undefined'==typeof a?c(function(a){'none'===f(a,'display')?i(a):a.style.display='none'},n):a?b.show():b.hide(),b},b.remove=function(){return c(function(a){try{a.parentNode.removeChild(a)}catch(a){}},n),m()},b.css=function(a,d){if(a){if(d||''===d)return c(function(b){h(b,a,d)},n),b;if(n[0]){if(n[0].style[e(a)])return n[0].style[e(a)];if(f(n[0],a))return f(n[0],a)}}},b.getClass=function(){if(n[0]&&0<n[0].className.length)return n[0].className.replace(/^[\\s\\uFEFF\\xA0]+|[\\s\\uFEFF\\xA0]+$/g,'').replace(/\\s+/,' ')},b.setClass=function(a){return(a||''===a)&&c(function(b){b.className=a},n),b},b.addClass=function(a){return k(a,'add',n),b},b.removeClass=function(a){return k(a,'remove',n),b},b.toggleClass=function(a,c){var d='undefined'==typeof c?'toggle':+c?'add':'remove';return k(a,d,n),b},b.hasClass=function(a){return k(a,'has',n)},b.html=function(a){return a||''===a?(c(function(b){b.innerHTML=a},n),b):n[0]?n[0].innerHTML:void 0},b.htmlBefore=function(a){return l(a,'before',n),b},b.htmlAfter=function(a){return l(a,'after',n),b},b.htmlAppend=function(a){return l(a,'append',n),b},b.htmlPrepend=function(a){return l(a,'prepend',n),b},b.attr=function(a,d){if(a){if(a=a.toLowerCase(),'undefined'!=typeof d)return c(function(b){'style'===a?b.style.cssText=d:'class'===a?b.className=d:b.setAttribute(a,d)},n),b;if(n[0])if('style'===a){if(n[0].style.cssText)return n[0].style.cssText;}else if('class'===a){if(n[0].className)return n[0].className;}else if(n[0].getAttribute(a))return n[0].getAttribute(a)}},b.data=function(a,c){if(a)return b.attr('data-'+a,c)},b.val=function(a){var d,e,f;if('undefined'!=typeof a)return c(function(b){switch(b.nodeName){case'SELECT':for(('string'==typeof a||'number'==typeof a)&&(a=[a]),e=0;e<b.length;e+=1)for(f=0;f<a.length;f+=1)if(b[e].selected='',b[e].value===''+a[f]){b[e].selected='selected';break}break;case'INPUT':case'TEXTAREA':case'BUTTON':b.value=a;}},n),b;if(n[0])switch(n[0].nodeName){case'SELECT':for(d=[],e=0;e<n[0].length;e+=1)n[0][e].selected&&d.push(n[0][e].value);return 1<d.length?d:d[0];case'INPUT':case'TEXTAREA':case'BUTTON':return n[0].value;}},b.checked=function(a){return'boolean'==typeof a?(c(function(b){'INPUT'===b.nodeName&&('checkbox'===b.type||'radio'===b.type)&&(b.checked=a)},n),b):n[0]&&'INPUT'===n[0].nodeName&&('checkbox'===n[0].type||'radio'===n[0].type)?!!n[0].checked:void 0},b.on=function(e,f){return(a===d||a===r)&&(n=[a]),c(function(a){r.addEventListener?a.addEventListener(e,f,!1):r.attachEvent&&(a[e+f]=function(){return f.apply(a,arguments)},a.attachEvent('on'+e,a[e+f]))},n),b},b.off=function(e,f){return(a===d||a===r)&&(n=[a]),c(function(a){r.addEventListener?a.removeEventListener(e,f,!1):r.attachEvent&&(a.detachEvent('on'+e,a[e+f]),a[e+f]=null)},n),b},b}var n=[],o=[],p=!1,q=!1,r=document,d=window;r.addEventListener?(r.addEventListener('DOMContentLoaded',a,!1),d.addEventListener('load',b,!1)):r.attachEvent?(r.attachEvent('onreadystatechange',a),d.attachEvent('onload',b)):d.onload=b,m.ajax=function(a){var b=Object.assign({method:'GET',nocache:!0,timeout:5e3,loader:!0,callback:null},a);b.method=b.method.toUpperCase();var c=b.loader?m._loader:function(){};var d=b.url;var e=b.method;var f=null;b.data&&(f=j(b.data)),f&&'GET'===e&&(d+=-1===d.indexOf('?')?'?'+f:'&'+f,f=null);var g=new XMLHttpRequest;if(b.nocache){var h=(+new Date).toString(36);d+=(-1===d.indexOf('?')?'?':'&')+'_='+h}c(!0),g.open(e,d,!0),g.timeout=b.timeout;var i=setTimeout(function(){console.error('XHR timed out.'),g.abort(),c(!1)},b.timeout+10);return g.onreadystatechange=function(){4===g.readyState&&(c(!1),b.callback&&b.callback(g.responseText,g.status),clearTimeout(i))},g.setRequestHeader('X-Requested-With','XMLHttpRequest'),'POST'===e&&g.setRequestHeader('Content-Type','application/x-www-form-urlencoded'),g.send(f),g},m._loader=function(){},m.get=function(a,b,c){return c=c||{},c.url=a,c.callback=b,c.method='GET',m.ajax(c)},m.post=function(a,b,c){return c=c||{},c.url=a,c.callback=b,c.method='POST',m.ajax(c)},m.ready=function(a){if(a){if(p)return a(),m;n.push(a)}},m.loaded=function(a){if(a){if(q)return a(),m;o.push(a)}};var t={\"&\":'&',\"<\":'<',\">\":'>','\"':'"',\"'\":''',\"/\":'/',\"`\":'`',\"=\":'='};m.htmlEscape=function(a){return(a+'').replace(/[&<>\"'`=\\/]/g,function(a){return t[a]})},module.exports=m})();\n\n/***/ }),\n/* 2 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\nvar $=__webpack_require__(1);var modal={};var curCloseCb=null;modal.show=function(a,b){var c=$(a);c.removeClass('hidden visible'),setTimeout(function(){c.addClass('visible')},1),curCloseCb=b},modal.hide=function(a){var b=$(a);b.removeClass('visible'),setTimeout(function(){b.addClass('hidden'),curCloseCb&&curCloseCb()},500)},modal.init=function(){$('.Modal').on('click',function(){$(this).hasClass('no-close')||modal.hide(this)}),$('.Dialog').on('click',function(a){a.stopImmediatePropagation()}),$(window).on('keydown',function(a){27===a.which&&modal.hide('.Modal')})},module.exports=modal;\n\n/***/ }),\n/* 3 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\nvar $=__webpack_require__(1);var modal=__webpack_require__(2);var nt={};var sel='#notif';var $balloon;var timerHideBegin;var timerHideEnd;var canCancel=!1;var stopTimeouts=function(){clearTimeout(timerHideBegin),clearTimeout(timerHideEnd)};nt.show=function(a,b,c){$balloon.toggleClass('error',!0===c),$balloon.html(a),modal.show($balloon),stopTimeouts(),(!b||0>=b)&&(b=2500),timerHideBegin=setTimeout(nt.hide,b),canCancel=!1,setTimeout(function(){canCancel=!0},500)},nt.hide=function(){var a=$(sel);a.removeClass('visible'),timerHideEnd=setTimeout(function(){a.addClass('hidden')},250)},nt.init=function(){$balloon=$(sel),$(document).on('click',function(){canCancel&&nt.hide(this)}),$balloon.on('click',function(a){return a.stopImmediatePropagation(),!1}),$balloon.on('mouseenter',function(){stopTimeouts(),$balloon.removeClass('hidden').addClass('visible')})},module.exports=nt;\n\n/***/ }),\n/* 4 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\nvar themes=exports.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']];exports.fgbgThemes=[['#AAAAAA','#000000'],['#EFF0F1','#31363B'],['#FFFFFF','#000000'],['#00FF00','#000000'],['#E53C00','#000000'],['#FFFFFF','#300A24'],['#839496','#002B36'],['#657B83','#FDF6E3'],['#000000','#FFFFDD'],['#000000','#FFFFFF']];var colorTable256=null;exports.buildColorTable=function(){if(null!=colorTable256)return colorTable256;colorTable256=Array(16).fill('rgba(0, 0, 0, 0)');for(var a=0;6>a;a++)for(var b=0;6>b;b++)for(var c=0;6>c;c++){var d=40*a+(a?55:0);var e=40*b+(b?55:0);var f=40*c+(c?55:0);colorTable256.push('rgb('+d+', '+e+', '+f+')')}for(var g=0;24>g;g++){var h=10*g+8;colorTable256.push('rgb('+h+', '+h+', '+h+')')}return colorTable256},exports.SELECTION_FG='#333',exports.SELECTION_BG='#b2d7fe';function resolveColor(a,b){return b=+b,b=16>b?themes[a][b]:exports.buildColorTable()[b],b}exports.themePreview=function(a){document.querySelectorAll('[data-fg]').forEach(function(b){var c=b.dataset.fg;/^\\d+$/.test(c)&&(c=resolveColor(a,c)),b.style.color=c}),document.querySelectorAll('[data-bg]').forEach(function(b){var c=b.dataset.bg;/^\\d+$/.test(c)&&(c=resolveColor(a,c)),b.style.backgroundColor=c})};\n\n/***/ }),\n/* 5 */\n/***/ (function(module, exports) {\n\n// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nfunction EventEmitter() {\n this._events = this._events || {};\n this._maxListeners = this._maxListeners || undefined;\n}\nmodule.exports = EventEmitter;\n\n// Backwards-compat with node 0.10.x\nEventEmitter.EventEmitter = EventEmitter;\n\nEventEmitter.prototype._events = undefined;\nEventEmitter.prototype._maxListeners = undefined;\n\n// By default EventEmitters will print a warning if more than 10 listeners are\n// added to it. This is a useful default which helps finding memory leaks.\nEventEmitter.defaultMaxListeners = 10;\n\n// Obviously not all Emitters should be limited to 10. This function allows\n// that to be increased. Set to zero for unlimited.\nEventEmitter.prototype.setMaxListeners = function(n) {\n if (!isNumber(n) || n < 0 || isNaN(n))\n throw TypeError('n must be a positive number');\n this._maxListeners = n;\n return this;\n};\n\nEventEmitter.prototype.emit = function(type) {\n var er, handler, len, args, i, listeners;\n\n if (!this._events)\n this._events = {};\n\n // If there is no 'error' event listener then throw.\n if (type === 'error') {\n if (!this._events.error ||\n (isObject(this._events.error) && !this._events.error.length)) {\n er = arguments[1];\n if (er instanceof Error) {\n throw er; // Unhandled 'error' event\n } else {\n // At least give some kind of context to the user\n var err = new Error('Uncaught, unspecified \"error\" event. (' + er + ')');\n err.context = er;\n throw err;\n }\n }\n }\n\n handler = this._events[type];\n\n if (isUndefined(handler))\n return false;\n\n if (isFunction(handler)) {\n switch (arguments.length) {\n // fast cases\n case 1:\n handler.call(this);\n break;\n case 2:\n handler.call(this, arguments[1]);\n break;\n case 3:\n handler.call(this, arguments[1], arguments[2]);\n break;\n // slower\n default:\n args = Array.prototype.slice.call(arguments, 1);\n handler.apply(this, args);\n }\n } else if (isObject(handler)) {\n args = Array.prototype.slice.call(arguments, 1);\n listeners = handler.slice();\n len = listeners.length;\n for (i = 0; i < len; i++)\n listeners[i].apply(this, args);\n }\n\n return true;\n};\n\nEventEmitter.prototype.addListener = function(type, listener) {\n var m;\n\n if (!isFunction(listener))\n throw TypeError('listener must be a function');\n\n if (!this._events)\n this._events = {};\n\n // To avoid recursion in the case that type === \"newListener\"! Before\n // adding it to the listeners, first emit \"newListener\".\n if (this._events.newListener)\n this.emit('newListener', type,\n isFunction(listener.listener) ?\n listener.listener : listener);\n\n if (!this._events[type])\n // Optimize the case of one listener. Don't need the extra array object.\n this._events[type] = listener;\n else if (isObject(this._events[type]))\n // If we've already got an array, just append.\n this._events[type].push(listener);\n else\n // Adding the second element, need to change to array.\n this._events[type] = [this._events[type], listener];\n\n // Check for listener leak\n if (isObject(this._events[type]) && !this._events[type].warned) {\n if (!isUndefined(this._maxListeners)) {\n m = this._maxListeners;\n } else {\n m = EventEmitter.defaultMaxListeners;\n }\n\n if (m && m > 0 && this._events[type].length > m) {\n this._events[type].warned = true;\n console.error('(node) warning: possible EventEmitter memory ' +\n 'leak detected. %d listeners added. ' +\n 'Use emitter.setMaxListeners() to increase limit.',\n this._events[type].length);\n if (typeof console.trace === 'function') {\n // not supported in IE 10\n console.trace();\n }\n }\n }\n\n return this;\n};\n\nEventEmitter.prototype.on = EventEmitter.prototype.addListener;\n\nEventEmitter.prototype.once = function(type, listener) {\n if (!isFunction(listener))\n throw TypeError('listener must be a function');\n\n var fired = false;\n\n function g() {\n this.removeListener(type, g);\n\n if (!fired) {\n fired = true;\n listener.apply(this, arguments);\n }\n }\n\n g.listener = listener;\n this.on(type, g);\n\n return this;\n};\n\n// emits a 'removeListener' event iff the listener was removed\nEventEmitter.prototype.removeListener = function(type, listener) {\n var list, position, length, i;\n\n if (!isFunction(listener))\n throw TypeError('listener must be a function');\n\n if (!this._events || !this._events[type])\n return this;\n\n list = this._events[type];\n length = list.length;\n position = -1;\n\n if (list === listener ||\n (isFunction(list.listener) && list.listener === listener)) {\n delete this._events[type];\n if (this._events.removeListener)\n this.emit('removeListener', type, listener);\n\n } else if (isObject(list)) {\n for (i = length; i-- > 0;) {\n if (list[i] === listener ||\n (list[i].listener && list[i].listener === listener)) {\n position = i;\n break;\n }\n }\n\n if (position < 0)\n return this;\n\n if (list.length === 1) {\n list.length = 0;\n delete this._events[type];\n } else {\n list.splice(position, 1);\n }\n\n if (this._events.removeListener)\n this.emit('removeListener', type, listener);\n }\n\n return this;\n};\n\nEventEmitter.prototype.removeAllListeners = function(type) {\n var key, listeners;\n\n if (!this._events)\n return this;\n\n // not listening for removeListener, no need to emit\n if (!this._events.removeListener) {\n if (arguments.length === 0)\n this._events = {};\n else if (this._events[type])\n delete this._events[type];\n return this;\n }\n\n // emit removeListener for all listeners on all events\n if (arguments.length === 0) {\n for (key in this._events) {\n if (key === 'removeListener') continue;\n this.removeAllListeners(key);\n }\n this.removeAllListeners('removeListener');\n this._events = {};\n return this;\n }\n\n listeners = this._events[type];\n\n if (isFunction(listeners)) {\n this.removeListener(type, listeners);\n } else if (listeners) {\n // LIFO order\n while (listeners.length)\n this.removeListener(type, listeners[listeners.length - 1]);\n }\n delete this._events[type];\n\n return this;\n};\n\nEventEmitter.prototype.listeners = function(type) {\n var ret;\n if (!this._events || !this._events[type])\n ret = [];\n else if (isFunction(this._events[type]))\n ret = [this._events[type]];\n else\n ret = this._events[type].slice();\n return ret;\n};\n\nEventEmitter.prototype.listenerCount = function(type) {\n if (this._events) {\n var evlistener = this._events[type];\n\n if (isFunction(evlistener))\n return 1;\n else if (evlistener)\n return evlistener.length;\n }\n return 0;\n};\n\nEventEmitter.listenerCount = function(emitter, type) {\n return emitter.listenerCount(type);\n};\n\nfunction isFunction(arg) {\n return typeof arg === 'function';\n}\n\nfunction isNumber(arg) {\n return typeof arg === 'number';\n}\n\nfunction isObject(arg) {\n return typeof arg === 'object' && arg !== null;\n}\n\nfunction isUndefined(arg) {\n return arg === void 0;\n}\n\n\n/***/ }),\n/* 6 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\nvar _get=function a(b,c,d){null===b&&(b=Function.prototype);var e=Object.getOwnPropertyDescriptor(b,c);if(e===void 0){var f=Object.getPrototypeOf(b);return null===f?void 0:a(f,c,d)}if('value'in e)return e.value;var g=e.get;return void 0===g?void 0:g.call(d)};var _createClass=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1,d.configurable=!0,'value'in d&&(d.writable=!0),Object.defineProperty(a,d.key,d)}}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}();function _toConsumableArray(a){if(Array.isArray(a)){for(var b=0,c=Array(a.length);b<a.length;b++)c[b]=a[b];return c}return Array.from(a)}function _possibleConstructorReturn(a,b){if(!a)throw new ReferenceError('this hasn\\'t been initialised - super() hasn\\'t been called');return b&&('object'==typeof b||'function'==typeof b)?b:a}function _inherits(a,b){if('function'!=typeof b&&null!==b)throw new TypeError('Super expression must either be null or a function, not '+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError('Cannot call a class as a function')}var EventEmitter=__webpack_require__(5);var _require=__webpack_require__(0),parse2B=_require.parse2B;var _require2=__webpack_require__(4),themes=_require2.themes;var ANSIParser=function(){function a(b){_classCallCheck(this,a),this.reset(),this.handler=b,this.joinChunks=!0}return _createClass(a,[{key:'reset',value:function reset(){this.currentSequence=0,this.sequence=''}},{key:'parseSequence',value:function parseSequence(a){if('['===a[0]){var b=a[a.length-1];var c=a.substring(1,a.length-1);var d=c?c.split(';').map(function(a){return+a.replace(/\\D/g,'')}):[];var e=d.length?d[0]:1;if('H'===b)this.handler('set-cursor',(0|d[0])-1,(0|d[1])-1);else if('A'<=b&&'D'>=b)this.handler('move-cursor-'+('B'>=b?'y':'x'),('B'===b||'C'===b?1:-1)*e);else if('E'===b||'F'===b)this.handler('move-cursor-line',('E'===b?1:-1)*e);else if('G'===b)this.handler('set-cursor-x',e-1);else if('J'===b){var f=d.length?d[0]:2;2===f&&this.handler('clear')}else if('P'===b)this.handler('delete',e);else if('@'===b)this.handler('insert-blanks',e);else if('q'===b)this.handler('set-cursor-style',e);else if('m'===b){if(!d.length||0===d[0])return void this.handler('reset-style');var g=d[0];if(1===g)this.handler('add-attrs',1);else if(2===g)this.handler('add-attrs',2);else if(3===g)this.handler('add-attrs',4);else if(4===g)this.handler('add-attrs',8);else if(5===g||6===g)this.handler('add-attrs',16);else if(7===g)this.handler('add-attrs',-1);else if(9===g)this.handler('add-attrs',64);else if(20===g)this.handler('add-attrs',32);else if(30<=g&&37>=g)this.handler('set-color-fg',g%10);else if(40<=g&&47>=g)this.handler('set-color-bg',g%10);else if(39===g)this.handler('reset-color-fg');else if(49===g)this.handler('reset-color-bg');else if(90<=g&&98>=g)this.handler('set-color-fg',g%10+8);else if(100<=g&&108>=g)this.handler('set-color-bg',g%10+8);else if((38===g||48===g)&&5===d[1]){var h=255&(0|d[2]);38===g&&this.handler('set-color-fg',h),48===g&&this.handler('set-color-bg',h)}}else('h'===b||'l'===b)&&'?25'===c&&('h'===b?this.handler('show-cursor'):'l'===b&&this.handler('hide-cursor'))}}},{key:'write',value:function write(a){var b=!0;var c=!1;var d=void 0;try{for(var e,f=a.toString()[Symbol.iterator]();!(b=(e=f.next()).done);b=!0){var g=e.value;var h=g.codePointAt(0);27===h?this.currentSequence=1:1===this.currentSequence&&'['===g?(this.currentSequence=2,this.sequence+='['):this.currentSequence&&g.match(/[\\x40-\\x7e]/)?(this.parseSequence(this.sequence+g),this.currentSequence=0,this.sequence=''):1<this.currentSequence?this.sequence+=g:1===this.currentSequence?(this.currentSequence=0,this.handler('write',g)):3>h?this.handler('_null'):3===h?this.handler('sigint'):6>=h?this.handler('_null'):7===h?this.handler('bell'):8===h?this.handler('back'):9===h?this.handler('tab'):10===h?this.handler('new-line'):13===h?this.handler('return'):21===h?this.handler('delete-line'):23===h?this.handler('delete-word'):this.handler('write',g)}}catch(a){c=!0,d=a}finally{try{!b&&f.return&&f.return()}finally{if(c)throw d}}this.joinChunks||this.reset()}}]),a}();var TERM_DEFAULT_STYLE=0;var TERM_MIN_DRAW_DELAY=10;var getRainbowColor=function(a){var c=Math.PI;var d=Math.floor;var e=Math.sin;var f=d(2.5*e(a)+2.5);var h=d(2.5*e(a+2/3*c)+2.5);var g=d(2.5*e(a+4/3*c)+2.5);return 16+36*f+6*h+g};var ScrollingTerminal=function(){function a(b){var c=this;_classCallCheck(this,a),this.width=80,this.height=25,this.termScreen=b,this.parser=new ANSIParser(function(){return c.handleParsed.apply(c,arguments)}),this.reset(),this._lastLoad=Date.now(),this.termScreen.load(this.serialize()),window.showPage()}var b=Math.min;var c=Math.max;return _createClass(a,[{key:'reset',value:function reset(){this.style=TERM_DEFAULT_STYLE,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 clear(){this.screen=[];for(var a=0;a<this.width*this.height;a++)this.screen.push([' ',this.style])}},{key:'scroll',value:function scroll(){this.screen.splice(0,this.width);for(var a=0;a<this.width;a++)this.screen.push([' ',TERM_DEFAULT_STYLE]);this.cursor.y--}},{key:'newLine',value:function newLine(){this.cursor.y++,this.cursor.y>=this.height&&this.scroll()}},{key:'writeChar',value:function writeChar(a){this.screen[this.cursor.y*this.width+this.cursor.x]=[a,this.style],this.cursor.x++,this.cursor.x>=this.width&&(this.cursor.x=0,this.newLine())}},{key:'moveBack',value:function moveBack(){var a=0<arguments.length&&void 0!==arguments[0]?arguments[0]:1;for(var b=0;b<a;b++)this.cursor.x--,0>this.cursor.x&&(this.cursor.x=0<this.cursor.y?this.width-1:0,this.cursor.y=c(0,this.cursor.y-1))}},{key:'moveForward',value:function moveForward(){var a=0<arguments.length&&void 0!==arguments[0]?arguments[0]:1;for(var b=0;b<a;b++)this.cursor.x++,this.cursor.x>=this.width&&(this.cursor.x=0,this.cursor.y++,this.cursor.y>=this.height&&this.scroll())}},{key:'deleteChar',value:function deleteChar(){this.moveBack(),this.screen.splice((this.cursor.y+1)*this.width,0,[' ',TERM_DEFAULT_STYLE]),this.screen.splice(this.cursor.y*this.width+this.cursor.x,1)}},{key:'deleteForward',value:function deleteForward(a){a=b(this.width,a);for(var c=0;c<a;c++)this.screen.splice((this.cursor.y+1)*this.width,0,[' ',TERM_DEFAULT_STYLE]);this.screen.splice(this.cursor.y*this.width+this.cursor.x,a)}},{key:'clampCursor',value:function clampCursor(){0>this.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 handleParsed(a){'write'===a?this.writeChar(1>=arguments.length?void 0:arguments[1]):'delete'===a?this.deleteForward(1>=arguments.length?void 0:arguments[1]):'insert-blanks'===a?this.insertBlanks(1>=arguments.length?void 0:arguments[1]):'clear'===a?this.clear():'bell'===a?this.termScreen.load('B'):'back'===a?this.moveBack():'new-line'===a?this.newLine():'return'===a?this.cursor.x=0:'set-cursor'===a?(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'===a?(this.cursor.y+=1>=arguments.length?void 0:arguments[1],this.clampCursor()):'move-cursor-x'===a?(this.cursor.x+=1>=arguments.length?void 0:arguments[1],this.clampCursor()):'move-cursor-line'===a?(this.cursor.x=0,this.cursor.y+=1>=arguments.length?void 0:arguments[1],this.clampCursor()):'set-cursor-x'===a?this.cursor.x=1>=arguments.length?void 0:arguments[1]:'set-cursor-style'===a?this.cursor.style=c(0,b(6,1>=arguments.length?void 0:arguments[1])):'reset-style'===a?this.style=TERM_DEFAULT_STYLE:'add-attrs'===a?this.style|=(1>=arguments.length?void 0:arguments[1])<<16:'set-color-fg'===a?this.style=16777216|4294967040&this.style|(1>=arguments.length?void 0:arguments[1]):'set-color-bg'===a?this.style=33554432|4294902015&this.style|(1>=arguments.length?void 0:arguments[1])<<8:'reset-color-fg'===a?this.style&=4294901504:'reset-color-bg'===a?this.style&=4294770943:'hide-cursor'===a?this.cursor.visible=!1:'show-cursor'===a&&(this.cursor.visible=!0)}},{key:'write',value:function write(a){this.parser.write(a),this.scheduleLoad()}},{key:'serialize',value:function serialize(){var a=String.fromCodePoint;var b='S';b+=a(this.height+1)+a(this.width+1),b+=a(this.cursor.y+1)+a(this.cursor.x+1);var c=+this.cursor.visible;c|=96*+this.trackMouse,c|=384,c|=this.cursor.style<<9,b+=a(c+1);var d=null;var e=0;var f=!0;var g=!1;var h=void 0;try{for(var i,j=this.screen[Symbol.iterator]();!(f=(i=j.next()).done);f=!0){var k=i.value;var l=k[1];if(this.rainbow){var m=e%this.width;var n=Math.floor(e/this.width);l=16777216|4294705152&l|getRainbowColor((m+n)/10+Date.now()/1e3),e++}if(l!==d){var o=255&l;var p=255&l>>8;var q=65535&l>>16;var r=o!=(255&d);var s=p!=(255&d>>8);var t=q!=(65535&d>>16);r&&s?b+='\\x03'+a((65535&l)+1):r?b+='\\x05'+a(o+1):s&&(b+='\\x06'+a(p+1)),t&&(b+='\\x04'+a(q+1)),d=l}b+=k[0]}}catch(a){g=!0,h=a}finally{try{!f&&j.return&&j.return()}finally{if(g)throw h}}return b}},{key:'scheduleLoad',value:function scheduleLoad(){var a=this;clearTimeout(this._scheduledLoad),this._lastLoad<Date.now()-TERM_MIN_DRAW_DELAY?(this.termScreen.load(this.serialize(),{theme:this.theme}),this.theme=-1):this._scheduledLoad=setTimeout(function(){a.termScreen.load(a.serialize())},TERM_MIN_DRAW_DELAY-this._lastLoad)}},{key:'rainbowTimer',value:function rainbowTimer(){var a=this;this.rainbow&&(clearInterval(this._rainbowTimer),this._rainbowTimer=setInterval(function(){a.rainbow&&a.scheduleLoad()},50))}}]),a}();var Process=function(a){function b(){return _classCallCheck(this,b),_possibleConstructorReturn(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}return _inherits(b,a),_createClass(b,[{key:'write',value:function write(a){this.emit('in',a)}},{key:'destroy',value:function destroy(){this.emit('exit',0)}},{key:'run',value:function run(){}}]),b}(EventEmitter);var demoData={buttons:{1:'',2:'',3:'',4:'',5:function _(a,b){b.child&&b.child.destroy();var c='info\\r';var d=function(){b.write(c[0]),c=c.substr(1),c&&setTimeout(d,100)};setTimeout(d,200)}},mouseReceiver:null};var demoshIndex={clear:function(a){function b(){return _classCallCheck(this,b),_possibleConstructorReturn(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}return _inherits(b,a),_createClass(b,[{key:'run',value:function run(){this.emit('write','\\x1B[2J\\x1B[1;1H'),this.destroy()}}]),b}(Process),screenfetch:function(a){function b(){return _classCallCheck(this,b),_possibleConstructorReturn(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}return _inherits(b,a),_createClass(b,[{key:'run',value:function run(){var a=this;var b=('\\n ###. ESPTerm Demo\\n \\'###. Hostname: '+window.location.hostname+'\\n \\'###. Shell: ESPTerm Demo Shell\\n \\'###. Resolution: 80x25@'+window.devicePixelRatio+'x\\n :###-\\n .###\\'\\n .###\\'\\n .###\\' ###############\\n ###\\' ###############\\n ').split('\\n').filter(function(a){return a.trim()});var c='';for(var e=0;e<b.length;e++)for(var f=0;80>f;f++)c+=b[e][f]?'\\x1B[38;5;'+getRainbowColor((f+e)/10)+'m'+b[e][f]:' ';this.emit('write','\\r\\n\\x1B[?25l');var d=function(){a.emit('write',c.substr(0,80)),c=c.substr(80),c.length?setTimeout(d,50):(a.emit('write','\\r\\n\\x1B[?25h'),a.destroy())};d()}}]),b}(Process),\"local-echo\":function(a){function b(){return _classCallCheck(this,b),_possibleConstructorReturn(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}return _inherits(b,a),_createClass(b,[{key:'run',value:function run(){for(var a=arguments.length,b=Array(a),c=0;c<a;c++)b[c]=arguments[c];b.includes('--suppress-note')||this.emit('write','\\x1B[38;5;239mNote: not all terminal features are supported or and may not work as expected in this demo\\x1B[0m\\r\\n')}},{key:'write',value:function write(a){this.emit('write',a)}}]),b}(Process),info:function(a){function b(){return _classCallCheck(this,b),_possibleConstructorReturn(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}return _inherits(b,a),_createClass(b,[{key:'run',value:function run(){var a=this;for(var b=arguments.length,c=Array(b),d=0;d<b;d++)c[d]=arguments[d];var e=c.includes('--fast');this.showSplash().then(function(){a.printText(e)})}},{key:'showSplash',value:function showSplash(){var a=this;var b=['',' -#####- -###*..#####- ######-',' -#* -#- .## .##. *#-',' -##### .-###*..#####- *#- -*##*- #*-#--#**#-*##-',' -#* -#-.##. *#- *##@#* ##. -#* *# .#*',' -#####--####- .##. *#- -*#@@- ##. -#* *# .#*',' '].filter(function(a){return a.trim()});var c={\" \":-231,\".\":4,\"-\":8,\"*\":17,\"#\":24};var d={\" \":' ',\".\":'\\u2591',\"-\":'\\u2592',\"*\":'\\u2593',\"#\":'\\u2588'};for(var j in b)79>b[j].length&&(b[j]+=' '.repeat(79-b[j].length));this.emit('write','\\r\\n'.repeat(b.length+1)),this.emit('write','\\x1B[A'.repeat(b.length)),this.emit('write','\\x1B[?25l');var e=0;var f=0;var g=function(b,c){var d=Math.abs;var g=b-e;var h=c-f;a.emit('write','\\x1B['+d(g)+(0<g?'C':'D')),a.emit('write','\\x1B['+d(h)+(0<h?'B':'A')),e=b,f=c};var h=function(e,f){if(g(e,f),'@'===b[f][e])a.emit('write','\\x1B[48;5;238m\\x1B[38;5;255m\\u2584\\b');else{var h=231+c[b[f][e]];var i=d[b[f][e]];a.emit('write','\\x1B[48;5;'+h+'m\\x1B[38;5;'+h+'m'+i+'\\b')}};return new Promise(function(c){var d=14;var e=0;var f=function(){for(var i=0;i<b.length;i++){var j=d-i;0<j&&h(j,i)}69>++d?3<=++e?(setTimeout(f,20),e=0):f():(g(0,b.length),a.emit('write','\\x1B[m\\x1B[?25h'),c())};f()})}},{key:'printText',value:function printText(){var a=0<arguments.length&&void 0!==arguments[0]&&arguments[0];var b=['',' ESPTerm is a VT100-like terminal emulator running on the ESP8266 WiFi chip.','',' \\x1B[93mThis is an online demo of the web user interface, simulating a simple ',' terminal in your browser.\\x1B[m','',' Type \\x1B[92mls\\x1B[m to list available commands.',' Use the \\x1B[94mlinks\\x1B[m below this screen for a demo of the options and more info.',''];if(a)this.emit('write',b.join('\\r\\n')+'\\r\\n'),this.destroy();else{var c=this;var d=function(){c.emit('write',b.shift()+'\\r\\n'),b.length?setTimeout(d,17):c.destroy()};d()}}}]),b}(Process),colors:function(a){function b(){return _classCallCheck(this,b),_possibleConstructorReturn(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}return _inherits(b,a),_createClass(b,[{key:'run',value:function run(){this.emit('write','\\r\\n');this.emit('write',' ');for(var a=0;16>a;a++)this.emit('write','\\x1B['+(8>a?'3'+a:'9'+(a-8))+'m'),this.emit('write','foreground-color'[a]+' ');this.emit('write','\\r\\n ');for(var c=0;16>c;c++)this.emit('write','\\x1B['+(8>c?'4'+c:'10'+(c-8))+'m ');this.emit('write','\\x1B[m\\r\\n');for(var d=0;6>d;d++){this.emit('write',' ');for(var e=0;6>e;e++){for(var f=0;6>f;f++)this.emit('write','\\x1B[48;5;'+(16+36*d+6*e+f)+'m ');this.emit('write','\\x1B[m')}this.emit('write','\\r\\n')}this.emit('write',' ');for(var b=0;24>b;b++)this.emit('write','\\x1B[48;5;'+(232+b)+'m ');this.emit('write','\\x1B[m\\r\\n\\n'),this.destroy()}}]),b}(Process),ls:function(a){function b(){return _classCallCheck(this,b),_possibleConstructorReturn(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}return _inherits(b,a),_createClass(b,[{key:'run',value:function run(){for(var a in this.emit('write','\\x1B[92mList of demo commands\\x1B[m\\r\\n'),demoshIndex)'string'!=typeof demoshIndex[a]&&this.emit('write',a+'\\r\\n');this.destroy()}}]),b}(Process),theme:function(a){function b(a){_classCallCheck(this,b);var c=_possibleConstructorReturn(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));return c.shell=a,c}return _inherits(b,a),_createClass(b,[{key:'run',value:function run(){var a=0|+(0>=arguments.length?void 0:arguments[0]);var b=themes.length;return!arguments.length||!Number.isFinite(a)||0>a||a>=b?(this.emit('write','\\x1B[31mUsage: theme [0\\u2013'+(b-1)+']\\r\\n'),void this.destroy()):void(this.shell.terminal.theme=a,this.shell.terminal.termScreen.drawnScreenFG=[],this.emit('write',''),this.destroy())}}]),b}(Process),cursor:function(a){function b(){return _classCallCheck(this,b),_possibleConstructorReturn(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}return _inherits(b,a),_createClass(b,[{key:'run',value:function run(){for(var a=arguments.length,b=Array(a),c=0;c<a;c++)b[c]=arguments[c];var d=b.includes('--steady');b.includes('block')?this.emit('write','\\x1B['+2*d+' q'):b.includes('line')?this.emit('write','\\x1B['+(3+d)+' q'):b.includes('bar')||b.includes('beam')?this.emit('write','\\x1B['+(5+d)+' q'):this.emit('write','\\x1B[31mUsage: cursor [block|line|bar] [--steady]\\r\\n'),this.destroy()}}]),b}(Process),rainbow:function(a){function b(a){_classCallCheck(this,b);var c=_possibleConstructorReturn(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));return c.shell=a,c}return _inherits(b,a),_createClass(b,[{key:'run',value:function run(){this.shell.terminal.rainbow=!this.shell.terminal.rainbow,this.shell.terminal.rainbowTimer(),this.emit('write',''),this.destroy()}}]),b}(Process),mouse:function(a){function b(a){_classCallCheck(this,b);var c=_possibleConstructorReturn(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));return c.shell=a,c}return _inherits(b,a),_createClass(b,[{key:'run',value:function run(){this.shell.terminal.trackMouse=!0,demoData.mouseReceiver=this,this.randomData=[],this.highlighted={};var a='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';for(var b=0;23>b;b++){var c='';for(var d=0;79>d;d++)c+=a[Math.floor(a.length*Math.random())];this.randomData.push(c)}this.scrollOffset=0,this.render()}},{key:'render',value:function render(){this.emit('write','\\x1B[m\\x1B[2J\\x1B[1;1H'),this.emit('write','\\x1B[97m\\x1B[1mMouse Demo\\r\\n\\x1B[mMouse movement, clicking and scrolling!');for(var a=0;23>a;a++){var b=a+this.scrollOffset;b=(b%this.randomData.length+this.randomData.length)%this.randomData.length;var c=this.randomData[b];var d='\\x1B['+(3+a)+';1H\\x1B[38;5;239m';for(var e in c)this.highlighted[80*(a+2)+ +e]&&(d+='\\x1B[97m'),d+=c[e],this.highlighted[80*(a+2)+ +e]&&(d+='\\x1B[38;5;239m');this.emit('write',d)}this.mouse&&this.emit('write','\\x1B['+(this.mouse.y+1)+';'+(this.mouse.x+1)+'H')}},{key:'mouseMove',value:function mouseMove(a,b){this.mouse={x:a,y:b},this.render()}},{key:'mouseDown',value:function mouseDown(a,b,c){4===c?this.scrollOffset--:5===c?this.scrollOffset++:this.highlighted[80*b+a]=!this.highlighted[80*b+a],this.render()}},{key:'mouseUp',value:function mouseUp(){}},{key:'destroy',value:function destroy(){this.shell.terminal.write('\\x1B[2J\\x1B[1;1H'),this.shell.terminal.trackMouse=!1,demoData.mouseReceiver===this&&(demoData.mouseReceiver=null),_get(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),'destroy',this).call(this)}}]),b}(Process),sudo:function(a){function b(a){_classCallCheck(this,b);var c=_possibleConstructorReturn(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));return c.shell=a,c}return _inherits(b,a),_createClass(b,[{key:'run',value:function run(){var a=this;for(var d=arguments.length,e=Array(d),f=0;f<d;f++)e[f]=arguments[f];if(0===e.length)this.emit('write','\\x1B[31mUsage: sudo <command>\\x1B[m\\r\\n'),this.destroy();else if(4===e.length&&'make me a sandwich'===e.join(' ').toLowerCase()){var g='\\x1B[33m';var b='\\x1B[32m';var i='\\x1B[38;5;229m';var c='\\x1B[38;5;225m';this.emit('write',' '+g+'_.---._\\r\\n _.-~ ~-._\\r\\n _.-~ ~-._\\r\\n _.-~ ~---._\\r\\n _.-~ ~\\\\\\r\\n .-~ _.;\\r\\n :-._ _.-~ ./\\r\\n `-._~-._ _..__.-~ _.-~\\r\\n'+(' '+i+'/ '+g+'~-._~-._ / .__..--'+i+'~-'+b+'---._\\r\\n')+(i+' \\\\_____(_'+g+';-._\\\\. _.-~_/'+i+' ~)'+b+'.. . \\\\\\r\\n')+(b+' /(_____ '+g+'\\\\`--...--~_.-~'+i+'______..-+'+b+'_______)\\r\\n')+(b+' .(_________/'+g+'`--...--~/'+b+' _/ '+c+' '+g+'/\\\\\\r\\n')+(g+' /-._'+c+' \\\\_ '+b+'(___./_..-~'+c+'__.....'+g+'__..-~./\\r\\n')+(g+' `-._~-._'+c+' ~\\\\--------~ .-~'+g+'_..__.-~ _.-~\\r\\n')+(g+' ~-._~-._ '+c+'~---------` '+g+'/ .__..--~\\r\\n')+(g+' ~-._\\\\. _.-~_/\\r\\n')+(g+' \\\\`--...--~_.-~\\r\\n')+(g+' `--...--~'+'\\x1B[0m'+'\\r\\n')),this.destroy()}else{var h=e.shift();if(this.shell.index[h]){var j=this.shell.index[h];if(j instanceof Function){var k=new j(this);var l=function(b){return a.emit('write',b)};k.on('write',l),k.on('exit',function(){k.removeListener('write',l),a.destroy()}),k.run.apply(k,e)}else this.emit('write',j),this.destroy()}else this.emit('write','sudo: '+h+': command not found\\r\\n'),this.destroy()}}}]),b}(Process),make:function(a){function b(){return _classCallCheck(this,b),_possibleConstructorReturn(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}return _inherits(b,a),_createClass(b,[{key:'run',value:function run(){for(var a=arguments.length,b=Array(a),c=0;c<a;c++)b[c]=arguments[c];0===b.length?this.emit('write','\\x1B[31mmake: *** No targets specified. Stop.\\x1B[0m\\r\\n'):3===b.length&&'me a sandwich'===b.join(' ').toLowerCase()?this.emit('write','\\x1B[31mmake: me a sandwich : Permission denied\\x1B[0m\\r\\n'):this.emit('write','\\x1B[31mmake: *** No rule to make target \\''+b.join(' ').toLowerCase()+'\\'. Stop.\\x1B[0m\\r\\n'),this.destroy()}}]),b}(Process),pwd:'/this/is/a/demo\\r\\n',cd:'\\x1B[38;5;239mNo directories to change to\\r\\n',whoami:window.navigator.userAgent+'\\r\\n',hostname:''+window.location.hostname,uname:'ESPTerm Demo\\r\\n',mkdir:'\\x1B[38;5;239mDid not create a directory because this is a demo.\\r\\n',rm:'\\x1B[38;5;239mDid not delete anything because this is a demo.\\r\\n',cp:'\\x1B[38;5;239mNothing to copy because this is a demo.\\r\\n',mv:'\\x1B[38;5;239mNothing to move because this is a demo.\\r\\n',ln:'\\x1B[38;5;239mNothing to link because this is a demo.\\r\\n',touch:'\\x1B[38;5;239mNothing to touch\\r\\n',exit:'\\x1B[38;5;239mNowhere to go\\r\\n',github:function(a){function b(){return _classCallCheck(this,b),_possibleConstructorReturn(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}return _inherits(b,a),_createClass(b,[{key:'run',value:function run(){window.open('https://github.com/espterm/espterm-firmware'),this.destroy()}}]),b}(Process)};var DemoShell=function(){function a(b,c){var d=this;_classCallCheck(this,a),this.terminal=b,this.terminal.reset(),this.parser=new ANSIParser(function(){return d.handleParsed.apply(d,arguments)}),this.history=[],this.historyIndex=0,this.cursorPos=0,this.child=null,this.index=demoshIndex,c?this.run('info'):this.prompt()}return _createClass(a,[{key:'write',value:function write(a){this.child?3===a.codePointAt(0)?this.child.destroy():this.child.write(a):this.parser.write(a)}},{key:'prompt',value:function prompt(){var a=0<arguments.length&&void 0!==arguments[0]?arguments[0]:!0;0!==this.terminal.cursor.x&&this.terminal.write('\\x1B[m\\x1B[38;5;238m\\u23CE\\r\\n'),this.terminal.write('\\x1B[34;1mdemosh \\x1B[m'),a||this.terminal.write('\\x1B[31m'),this.terminal.write('$ \\x1B[m'),this.history.unshift(''),this.cursorPos=0}},{key:'copyFromHistoryIndex',value:function copyFromHistoryIndex(){if(this.historyIndex){var a=this.history[this.historyIndex];this.history[0]=a,this.historyIndex=0}}},{key:'handleParsed',value:function handleParsed(a){if(this.terminal.write('\\b\\x1B[P'.repeat(this.cursorPos)),'write'===a)this.copyFromHistoryIndex(),this.history[0]=this.history[0].substr(0,this.cursorPos)+(1>=arguments.length?void 0:arguments[1])+this.history[0].substr(this.cursorPos),this.cursorPos++;else if('back'===a)this.copyFromHistoryIndex(),this.history[0]=this.history[0].substr(0,this.cursorPos-1)+this.history[0].substr(this.cursorPos),this.cursorPos--,0>this.cursorPos&&(this.cursorPos=0);else if('tab'===a)console.warn('TAB not implemented');else if('move-cursor-x'===a)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'===a)this.copyFromHistoryIndex(),this.history[0]='',this.cursorPos=0;else if('delete-word'===a){this.copyFromHistoryIndex();var b=this.history[0].substr(0,this.cursorPos).split(' ');b.pop(),this.history[0]=b.join(' ')+this.history[0].substr(this.cursorPos),this.cursorPos=b.join(' ').length}else'move-cursor-y'===a&&(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'===a&&(this.terminal.write('\\r\\n'),this.parse(this.history[this.historyIndex]))}},{key:'parse',value:function parse(a){'help'===a&&(a='info'),this.run(a)}},{key:'run',value:function run(a){var b=[''];var c=!1;var d=!0;var e=!1;var f=void 0;try{for(var g,h=a.trim()[Symbol.iterator]();!(d=(g=h.next()).done);d=!0){var j=g.value;c&&j!==c?b[b.length-1]+=j:c?c=!1:'\"'===j||'\\''===j?c=j:j.match(/\\s/)?b[b.length-1]&&b.push(''):b[b.length-1]+=j}}catch(a){e=!0,f=a}finally{try{!d&&h.return&&h.return()}finally{if(e)throw f}}var i=b.shift();i in this.index?this.spawn(i,b):(this.terminal.write('demosh: Unknown command: '+i+'\\r\\n'),this.prompt(!1))}},{key:'spawn',value:function spawn(a){var b=this;var c=1<arguments.length&&void 0!==arguments[1]?arguments[1]:[];var d=this.index[a];if(d instanceof Function){var e;this.child=new d(this);var f=function(a){return b.terminal.write(a)};this.child.on('write',f),this.child.on('exit',function(a){b.child&&b.child.removeListener('write',f),b.child=null,b.prompt(!a)}),(e=this.child).run.apply(e,_toConsumableArray(c))}else this.terminal.write(d),this.prompt()}}]),a}();window.demoInterface=module.exports={input:function input(a){var b=a[0];var c=a.substr(1);if('s'===b)this.shell.write(c);else if('b'===b){var d=c.charCodeAt(0);var e=demoData.buttons[d];e&&('string'==typeof e?this.shell.write(e):e instanceof Function&&e(this.terminal,this.shell))}else if('m'===b||'p'===b||'r'===b){var f=parse2B(c,0);var g=parse2B(c,2);var h=parse2B(c,4);var i=parse2B(c,6);demoData.mouseReceiver&&('m'===b?demoData.mouseReceiver.mouseMove(g,f,h,i):'p'===b?demoData.mouseReceiver.mouseDown(g,f,h,i):'r'===b&&demoData.mouseReceiver.mouseUp(g,f,h,i))}},didInit:!1,init:function init(a){this.didInit||(this.didInit=!0,this.terminal=new ScrollingTerminal(a),this.shell=new DemoShell(this.terminal,!0))}};\n\n/***/ }),\n/* 7 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__(8),__webpack_require__(2),__webpack_require__(3),__webpack_require__(9);try{__webpack_require__(6)}catch(a){}__webpack_require__(10);var $=__webpack_require__(1);var _require=__webpack_require__(0),qs=_require.qs;window.termInit=__webpack_require__(12),window.$=$,window.qs=qs,window.themes=__webpack_require__(4);\n\n/***/ }),\n/* 8 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\nString.fromCodePoint||function(){var a=function(){try{var a={};var b=Object.defineProperty;var c=b(a,a,a)&&b}catch(a){}return c}();var b=String.fromCharCode;var c=Math.floor;var d=function(){var a=[];var d;var e;var f=-1;var g=arguments.length;if(!g)return'';for(var h='';++f<g;){var i=+arguments[f];if(!isFinite(i)||0>i||1114111<i||c(i)!=i)throw RangeError('Invalid code point: '+i);65535>=i?a.push(i):(i-=65536,d=(i>>10)+55296,e=i%1024+56320,a.push(d,e)),(f+1==g||a.length>16384)&&(h+=b.apply(null,a),a.length=0)}return h};a?a(String,'fromCodePoint',{value:d,configurable:!0,writable:!0}):String.fromCodePoint=d}();\n\n/***/ }),\n/* 9 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\nvar $=__webpack_require__(1);var _require=__webpack_require__(0),mk=_require.mk,qs=_require.qs,qsa=_require.qsa,cr=_require.cr;var modal=__webpack_require__(2);var notify=__webpack_require__(3);$.ready(function(){function a(){$('#menu').toggleClass('expanded')}$('#brand').on('click',a).on('keypress',cr(a)),$('.Row.checkbox').forEach(function(a){var b=a.querySelector('input');var c=a.querySelector('.box');$(c).toggleClass('checked',b.value);var d=function(){b.value=1-b.value,$(c).toggleClass('checked',b.value)};$(a).on('click',d).on('keypress',cr(d))}),$('.Box.mobcol,.Box.fold').forEach(function(a){var b=a.querySelector('h2');var c=function(){$(a).hasClass('d-expanded')?$(a).removeClass('d-expanded'):$(a).toggleClass('expanded')};$(b).on('click',c).on('keypress',cr(c))}),$('form').forEach(function(a){$(a).on('keypress',function(b){(10===b.keyCode||13===b.keyCode)&&b.ctrlKey&&a.submit()})}),setInterval(function(){$('.anim-dots').each(function(a){var b=$(a);var c=b.html()+'.';5===c.length&&(c='.'),b.html(c)})},1e3),$('input[type=number]').on('mousewheel',function(a){var b=Number.isFinite;var c=$(this);var d=+c.val();isNaN(d)&&(d=1);var e=+(c.attr('step')||1);var f=+c.attr('min');var g=+c.attr('max');if(0<a.wheelDelta?d+=e:d-=e,b(f)||(d=Math.max(d,+f)),b(g)||(d=Math.min(d,+g)),c.val(d),'createEvent'in document){var h=document.createEvent('HTMLEvents');h.initEvent('change',!1,!0),c[0].dispatchEvent(h)}else c[0].fireEvent('onchange');a.preventDefault()});var b=window.location.search.indexOf('err=');if(-1!==b&&qs('.Box.errors')){var d=decodeURIComponent(window.location.search.substr(b+4)).split(',');var e=[];d.forEach(function(a){var b=qsa('label[for=\"'+a+'\"]');if(b)for(var c=0;c<b.length;c++){var d=b[c];d.classList.add('error'),0===c&&e.push(d.childNodes[0].textContent.trim().replace(/: ?$/,''))}else e.push(a)}),qs('.Box.errors .list').innerHTML=e.join(', '),qs('.Box.errors').classList.remove('hidden')}var c=window.location.search.indexOf('msg=');if(-1!==c&&qs('.Box.message')){var f=decodeURIComponent(window.location.search.substr(c+4));var g=qs('.Box.message');g.innerHTML=f,g.classList.remove('hidden'),setTimeout(function(){g.classList.add('hiding'),setTimeout(function(){g.classList.add('hidden')},1e3)},2e3)}if(modal.init(),notify.init(),550<window.innerWidth){$('.Box h2').forEach(function(a){a.removeAttribute('tabindex')});var h=qs('#brand');h&&h.addEventListener('click',function(){window.location.href='/'})}}),$._loader=function(a){$('#loader').toggleClass('show',a)};var pageShown=!1;function showPage(){pageShown=!0,$('#content').addClass('load')}window.showPage=showPage,$.ready(function(){!0===window.noAutoShow?setTimeout(function(){if(!pageShown){var a=mk('P');a.id='load-failed',a.innerHTML='Server connection failed! Trying again<span class=\"anim-dots\" style=\"width:1.5em;text-align:left;display:inline-block\">.</span>',qs('#screen').appendChild(a),showPage()}},2e3):setTimeout(function(){showPage()},1)});\n\n/***/ }),\n/* 10 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\nvar $=__webpack_require__(1);var _require=__webpack_require__(0),mk=_require.mk,bool=_require.bool;var tr=__webpack_require__(11);(function(a){function b(a){return'+'+(0.25*a.value).toFixed(2)+' dBm'}function c(a,b,c){$('#sta_ssid').val(a),$('#sta_password').val(b),$('#sta-nw').toggleClass('hidden',0===a.length),$('#sta-nw-nil').toggleClass('hidden',0<a.length),$('#sta-nw .essid').html($.htmlEscape(a));var d=!b||0===b.length;$('#sta-nw .passwd').toggleClass('hidden',d),$('#sta-nw .nopasswd').toggleClass('hidden',!d),$('#sta-nw .ip').html(0<c.length?tr('wifi.connected_ip_is')+c:tr('wifi.not_conn'))}function d(a,b){if(200!==b)return void f(5e3);try{a=JSON.parse(a)}catch(a){return console.log(a),void f(5e3)}var d=!bool(a.result.inProgress)&&0<a.result.APs.length;if(f(d?15000:1e3),!!d){var e=$('#ap-list');$('#ap-list .AP').remove(),e.toggleClass('hidden',!d),$('#ap-loader').toggleClass('hidden',d),a.result.APs.sort(function(c,a){return a.rssi-c.rssi}).forEach(function(a){if(a.enc=parseInt(a.enc),!(4<a.enc)){var b=mk('div');var d=$(b).data('ssid',a.essid).data('pwd',a.enc).attr('tabindex',0).addClass('AP');a.essid===h&&d.addClass('selected');var f=mk('div');var i=$.htmlEscape(a.essid);$(f).addClass('inner').htmlAppend('<div class=\"rssi\">'+a.rssi_perc+'</div>').htmlAppend('<div class=\"essid\" title=\"'+i+'\">'+i+'</div>').htmlAppend('<div class=\"auth\">'+g[a.enc]+'</div>'),d.on('click',function(){var a=$(this);var b=a.data('ssid');var d='';+a.data('pwd')&&(d=window.prompt(tr('wifi.enter_passwd').replace(':ssid:',b)),!d)||($('#sta_password').val(d),$('#sta_ssid').val(b),c(b,d,''))}),b.appendChild(f),e[0].appendChild(b)}})}}function e(){window._demo?d(window._demo_aps,200):$.get('http://'+window._root+'/cfg/wifi/scan',d)}function f(a){setTimeout(e,a)}var g=['Open','WEP','WPA','WPA2','WPA/WPA2'];var h;a.init=function(a){$('.Row.range').forEach(function(a){var c=a.querySelector('input');var d=a.querySelector('.x-disp1');var e=a.querySelector('.x-disp2');var f=b(c);$(d).html(f),$(e).html(f),$(c).on('input',function(){f=b(c),$(d).html(f),$(e).html(f)})}),$('#forget-sta').on('click',function(){return c('','',''),!1}),c(a.sta_ssid,a.sta_password,a.sta_active_ip),h=a.sta_active_ssid},a.startScanning=function(){$('#ap-loader').removeClass('hidden'),$('#ap-scan').addClass('hidden'),$('#ap-loader .anim-dots').html('.'),e()}})(window.WiFi={});\n\n/***/ }),\n/* 11 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\nvar _tr={\"wifi.connected_ip_is\":\"Connected, IP is \",\"wifi.not_conn\":\"Not connected.\",\"wifi.enter_passwd\":\"Enter password for \\\":ssid:\\\"\"};module.exports=function(a){return _tr[a]||\"?\"+a+\"?\"};\n\n/***/ }),\n/* 12 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\nvar _require=__webpack_require__(0),qs=_require.qs,mk=_require.mk;var Notify=__webpack_require__(3);var TermScreen=__webpack_require__(13);var TermConnection=__webpack_require__(16);var TermInput=__webpack_require__(17);var TermUpload=__webpack_require__(18);var initSoftKeyboard=__webpack_require__(19);var attachDebugScreen=__webpack_require__(20);module.exports=function(a){var b=new TermScreen;var c=new TermConnection(b);var d=TermInput(c,b);var e=TermUpload(c,d,b);b.input=d,b.conn=c,d.termUpload=e;var f=null;var g=function(a){var c=1<arguments.length&&void 0!==arguments[1]?arguments[1]:250;clearTimeout(f),f=setTimeout(function(){b.window.statusScreen=a},c)};c.on('open',function(){g({title:'Connecting',loading:!0})}),c.on('connect',function(){g({title:'Waiting for content',loading:!0})}),c.on('load',function(){clearTimeout(f),b.window.statusScreen&&(b.window.statusScreen=null)}),c.on('disconnect',function(){g({title:'Disconnected'}),b.screen=[],b.screenFG=[],b.screenBG=[],b.screenAttrs=[]}),c.on('silence',function(){g({title:'Waiting for server',loading:!0},0)}),c.on('ping-success',function(){g({title:'Re-connecting',loading:!0},0)}),c.init(),d.init(a),e.init(),Notify.init(),window.onerror=function(a,b,c,d){return Notify.show('<b>JS ERROR!</b><br>'+a+'<br>at '+b+':'+c+':'+d,1e4,!0),!1},qs('#screen').appendChild(b.canvas),b.load(a.labels,a),initSoftKeyboard(b,d),attachDebugScreen&&attachDebugScreen(b);var h=!1;var i=!1;var j=function(){h?(b.window.fitIntoWidth=window.screen.width,b.window.fitIntoHeight=window.screen.height):(b.window.fitIntoWidth=i?window.innerWidth-20:0,b.window.fitIntoHeight=i?window.innerHeight:0)};j(),window.addEventListener('resize',j);var k=function(){i=!i;var a=qs('#resize-button-icon');i?(a.classList.remove('icn-resize-small'),a.classList.add('icn-resize-full')):(a.classList.remove('icn-resize-full'),a.classList.add('icn-resize-small')),j()};if(qs('#term-fit-screen').addEventListener('click',function(){return k(),!1}),window.Element.prototype.requestFullscreen||window.Element.prototype.webkitRequestFullscreen){setInterval(function checkForFullscreen(){h&&(window.innerWidth!==window.screen.width||window.innerHeight!==window.screen.height)&&(h=!1,j())},500);var l=mk('a');l.href='#',l.addEventListener('click',function(a){a.preventDefault(),h=!0,j(),b.updateSize(),b.canvas.requestFullscreen?b.canvas.requestFullscreen():b.canvas.webkitRequestFullscreen()});var m=mk('i');m.classList.add('icn-resize-full'),l.appendChild(m);var n=mk('span');n.textContent='Fullscreen',l.appendChild(n),qs('#term-nav').insertBefore(l,qs('#term-nav').firstChild)}window.termScreen=b,window.conn=c,window.input=d,window.termUpl=e};\n\n/***/ }),\n/* 13 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\nvar _createClass=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1,d.configurable=!0,'value'in d&&(d.writable=!0),Object.defineProperty(a,d.key,d)}}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}();function _toConsumableArray(a){if(Array.isArray(a)){for(var b=0,c=Array(a.length);b<a.length;b++)c[b]=a[b];return c}return Array.from(a)}function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError('Cannot call a class as a function')}function _possibleConstructorReturn(a,b){if(!a)throw new ReferenceError('this hasn\\'t been initialised - super() hasn\\'t been called');return b&&('object'==typeof b||'function'==typeof b)?b:a}function _inherits(a,b){if('function'!=typeof b&&null!==b)throw new TypeError('Super expression must either be null or a function, not '+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}var EventEmitter=__webpack_require__(5);var $=__webpack_require__(1);var _require=__webpack_require__(0),mk=_require.mk,qs=_require.qs;var notify=__webpack_require__(3);var ScreenParser=__webpack_require__(14);var ScreenRenderer=__webpack_require__(15);module.exports=function(a){function b(){_classCallCheck(this,b);var a=_possibleConstructorReturn(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));a.canvas=mk('canvas'),a.ctx=a.canvas.getContext('2d'),a.parser=new ScreenParser(a),a.renderer=new ScreenRenderer(a),a._debug=null,'AudioContext'in window||'webkitAudioContext'in window?a.audioCtx=new(window.AudioContext||window.webkitAudioContext):console.warn('No AudioContext!'),a.input=new Proxy({},{get:function get(){return function(){return console.warn('TermScreen#input not set!')}}}),a.conn=new Proxy({},{get:function get(){return function(){return console.warn('TermScreen#conn not set!')}},set:function set(){return function(){return console.warn('TermScreen#conn not set!')}}}),a.cursor={x:0,y:0,blinking:!0,visible:!0,hanging:!1,style:'block'},a._window={width:0,height:0,devicePixelRatio:1,fontFamily:'\"DejaVu Sans Mono\", \"Liberation Mono\", \"Inconsolata\", \"Menlo\", monospace',fontSize:20,gridScaleX:1,gridScaleY:1.2,fitIntoWidth:0,fitIntoHeight:0,debug:!1,graphics:0,statusScreen:null},a._windowScale=1,a.windowState={width:0,height:0,devicePixelRatio:0,gridScaleX:0,gridScaleY:0,fontFamily:'',fontSize:0,fitIntoWidth:0,fitIntoHeight:0},a.selection={selectable:!0,start:[0,0],end:[0,0]},a.mouseMode={clicks:!1,movement:!1};var c=a;a.window=new Proxy(a._window,{set:function set(a,b,d){return a[b]=d,c.scheduleSizeUpdate(),c.renderer.scheduleDraw('window:'+b+'='+d),c.emit('update-window:'+b,d),!0}}),a.bracketedPaste=!1,a.blinkingCellCount=0,a.reverseVideo=!1,a.screen=[],a.screenFG=[],a.screenBG=[],a.screenAttrs=[];var d=!1;var f=function(b,c){d||(d=!0,a.selection.start=a.selection.end=a.screenToGrid(b,c,!0),a.renderer.scheduleDraw('select-start'))};var g=function(b,c){d&&(a.selection.end=a.screenToGrid(b,c,!0),a.renderer.scheduleDraw('select-move'))};var h=function(b,c){d&&(d=!1,a.selection.end=a.screenToGrid(b,c,!0),a.renderer.scheduleDraw('select-end'),Object.assign(a.selection,a.getNormalizedSelection()))};a.canvas.addEventListener('mousedown',function(b){if((a.selection.selectable||b.altKey)&&0===b.button)f(b.offsetX,b.offsetY);else{var c;(c=a.input).onMouseDown.apply(c,_toConsumableArray(a.screenToGrid(b.offsetX,b.offsetY)).concat([b.button+1]))}}),window.addEventListener('mousemove',function(a){g(a.offsetX,a.offsetY)}),window.addEventListener('mouseup',function(a){h(a.offsetX,a.offsetY)});var i=null;var j=0;var k=!1;var l=function(b){var c=a.canvas.getBoundingClientRect();return[b.clientX-c.left,b.clientY-c.top]};return a.canvas.addEventListener('touchstart',function(a){i=l(a.touches[0]),k=!1,j=Date.now()},{passive:!0}),a.canvas.addEventListener('touchmove',function(a){i=l(a.touches[0]),d||!1!=k?d&&(a.preventDefault(),g.apply(void 0,_toConsumableArray(i))):j<Date.now()-500&&f.apply(void 0,_toConsumableArray(i)),k=!0}),a.canvas.addEventListener('touchend',function(b){if(b.touches[0]&&(i=l(b.touches[0])),d){b.preventDefault(),h.apply(void 0,_toConsumableArray(i));var c=qs('#touch-select-menu');c.classList.add('open');var e=c.getBoundingClientRect();var f=a.gridToScreen((a.selection.start[0]+a.selection.end[0])/2,a.selection.start[1]-1);f[0]-=e.width/2,f[1]-=e.height/2,c.style.transform='translate('+f[0]+'px, '+f[1]+'px)'}k||a.emit('tap',Object.assign(b,{x:i[0],y:i[1]})),i=null}),a.on('tap',function(b){a.selection.start[0]!==a.selection.end[0]||a.selection.start[1]!==a.selection.end[1]?(a.selection.start=a.selection.end=[0,0],qs('#touch-select-menu').classList.remove('open'),a.renderer.scheduleDraw('select-reset')):(b.preventDefault(),a.emit('open-soft-keyboard'))}),$.ready(function(){var b=qs('#touch-select-copy-btn');b&&b.addEventListener('click',function(){a.copySelectionToClipboard()})}),a.canvas.addEventListener('mousemove',function(b){if(!d){var c;(c=a.input).onMouseMove.apply(c,_toConsumableArray(a.screenToGrid(b.offsetX,b.offsetY)))}}),a.canvas.addEventListener('mouseup',function(b){if(!d){var c;(c=a.input).onMouseUp.apply(c,_toConsumableArray(a.screenToGrid(b.offsetX,b.offsetY)).concat([b.button+1]))}}),a.canvas.addEventListener('wheel',function(b){if(a.mouseMode.clicks){var c;(c=a.input).onMouseWheel.apply(c,_toConsumableArray(a.screenToGrid(b.offsetX,b.offsetY)).concat([0<b.deltaY?1:-1])),b.preventDefault()}}),a.canvas.addEventListener('contextmenu',function(b){a.mouseMode.clicks&&b.preventDefault(),h(b.offsetX,b.offsetY)}),a}var c=Math.floor;return _inherits(b,a),_createClass(b,[{key:'scheduleSizeUpdate',value:function scheduleSizeUpdate(){var a=this;clearTimeout(this._scheduledSizeUpdate),this._scheduledSizeUpdate=setTimeout(function(){return a.updateSize()},1)}},{key:'getFont',value:function getFont(){var a=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};var b=a.style||'normal';var c=a.weight||'normal';return b+' normal '+c+' '+this.window.fontSize+'px '+this.window.fontFamily}},{key:'screenToGrid',value:function screenToGrid(a,b){var d=2<arguments.length&&void 0!==arguments[2]&&arguments[2];var e=this.getCellSize();return[c((a+(d?e.width/2:0))/e.width),c(b/e.height)]}},{key:'gridToScreen',value:function gridToScreen(a,b){var c=this;var d=2<arguments.length&&void 0!==arguments[2]&&arguments[2];var e=this.getCellSize();return[a*e.width,b*e.height].map(function(a){return d?a*c._windowScale:a})}},{key:'getCharSize',value:function getCharSize(){return this.ctx.font=this.getFont(),{width:c(this.ctx.measureText(' ').width),height:this.window.fontSize}}},{key:'getCellSize',value:function getCellSize(){var a=Math.ceil;var b=this.getCharSize();return{width:a(b.width*this.window.gridScaleX),height:a(b.height*this.window.gridScaleY)}}},{key:'updateSize',value:function updateSize(){var a=Math.round;this._window.devicePixelRatio=a(2*(this._windowScale*(window.devicePixelRatio||1)))/2;var b=!1;for(var h in this.windowState)this.windowState.hasOwnProperty(h)&&this.windowState[h]!==this.window[h]&&(b=!0,this.windowState[h]=this.window[h]);if(b){var c=this.window,d=c.width,e=c.height,f=c.fitIntoWidth,g=c.fitIntoHeight;var i=this.getCellSize();var j=d*i.width;var k=e*i.height;if(f&&g){var l=j/k;l<f/g?(k=g,j=k*l):(j=f,k=j/l)}else f?(k=f/(j/k),j=f):g&&(j=g*(j/k),k=g);this._windowScale=j/(d*i.width);var m=this._window.devicePixelRatio=a(2*(this._windowScale*(window.devicePixelRatio||1)))/2;this.canvas.width=d*m*i.width,this.canvas.style.width=j+'px',this.canvas.height=e*m*i.height,this.canvas.style.height=k+'px',this.renderer.resetDrawn(),this.renderer.draw('update-size')}}},{key:'getNormalizedSelection',value:function getNormalizedSelection(){var a=this.selection,b=a.start,c=a.end;if(b[1]>c[1]||b[1]===c[1]&&b[0]>c[0]){var d=[c,b];b=d[0],c=d[1]}return{start:b,end:c}}},{key:'isInSelection',value:function isInSelection(a,b){var c=this.getNormalizedSelection(),d=c.start,e=c.end;var f=d[0]<=a;var g=a<e[0];var h=b===d[1];var i=b===e[1];return h&&i?f&&g:h?f:i?g:d[1]<b&&b<e[1]}},{key:'getSelectedText',value:function getSelectedText(){var a=this.window.width*this.window.height;var b=[];var d=-1;for(var e=0;e<a;e++){var f=e%this.window.width;var g=c(e/this.window.width);this.isInSelection(f,g)&&(d!==g&&(d=g,b.push('')),b[b.length-1]+=this.screen[e])}return b.join('\\n')}},{key:'copySelectionToClipboard',value:function copySelectionToClipboard(){var a=this.getSelectedText();if(a){var b=mk('textarea');document.body.appendChild(b),b.value=a,b.select(),document.execCommand('copy')?notify.show('Copied to clipboard'):notify.show('Failed to copy'),document.body.removeChild(b)}}},{key:'showNotification',value:function showNotification(a){if(console.info('Notification: '+a),window.Notification&&'granted'===window.Notification.permission){var b=new window.Notification('ESPTerm',{body:a});b.addEventListener('click',function(){return window.focus()})}else window.Notification&&'denied'!==window.Notification.permission?window.Notification.requestPermission():notify.show(a)}},{key:'beep',value:function beep(){var a=Math.pow;var b=this.audioCtx;if(b&&!(this._lastBeep&&this._lastBeep>Date.now()-50)){if(this._lastBeep=Date.now(),!this._convolver){this._convolver=b.createConvolver();var j=0.8*b.sampleRate;var k=b.createBuffer(2,j,b.sampleRate);for(var l=0;l<j;l++)k.getChannelData(0)[l]=a(1-l/j,7+Math.random()),k.getChannelData(1)[l]=a(1-l/j,7+Math.random());this._convolver.buffer=k,this._convolver.connect(b.destination)}var c=b.createOscillator();var d=b.createGain();c.connect(d),d.gain.value=4,c.frequency.value=750,c.type='sine';var e=b.createOscillator();var f=b.createGain();e.connect(f),f.gain.value=2,e.frequency.value=400,e.type='sine',d.connect(this._convolver),f.connect(this._convolver);var g=b.currentTime;c.start(),c.stop(g+0.5),e.start(g+0.05),e.stop(g+0.8);var h=function(){b.currentTime<g+0.8&&window.requestAnimationFrame(h),d.gain.value*=0.8,f.gain.value*=0.8};h()}}},{key:'load',value:function load(){var a;(a=this.parser).load.apply(a,arguments)}}]),b}(EventEmitter);\n\n/***/ }),\n/* 14 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\nvar _createClass=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1,d.configurable=!0,'value'in d&&(d.writable=!0),Object.defineProperty(a,d.key,d)}}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}();function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError('Cannot call a class as a function')}var $=__webpack_require__(1);var _require=__webpack_require__(0),qs=_require.qs;var _require2=__webpack_require__(4),themes=_require2.themes;var SEQ_REPEAT=2;var SEQ_SET_COLORS=3;var SEQ_SET_ATTRS=4;var SEQ_SET_FG=5;var SEQ_SET_BG=6;module.exports=function(){function a(b){_classCallCheck(this,a),this.screen=b,this.contentLoaded=!1}return _createClass(a,[{key:'loadContent',value:function loadContent(a){var b=this;var c=0;var d=Array.from?Array.from(a):a.split('');if(!this.contentLoaded){var y=qs('#load-failed');y&&y.parentNode.removeChild(y),this.contentLoaded=!0}var e=d[c++].codePointAt(0)-1;var f=d[c++].codePointAt(0)-1;var g=this.screen.window.height!==e||this.screen.window.width!==f;this.screen.window.height=e,this.screen.window.width=f;var h=d[c++].codePointAt(0)-1,i=d[c++].codePointAt(0)-1;var k=i!==this.screen.cursor.x||h!==this.screen.cursor.y;this.screen.cursor.x=i,this.screen.cursor.y=h,k&&(this.screen.renderer.resetCursorBlink(),this.screen.emit('cursor-moved'));var l=d[c++].codePointAt(0)-1;this.screen.cursor.visible=!!(1&l),this.screen.cursor.hanging=!!(2&l),this.screen.input.setAlts(!!(4&l),!!(8&l),!!(16&l),!!(4096&l));var m=!!(32&l);var n=!!(64&l);var o=7&l>>9;0<o&&o--;var p=o>>1;var q=!(1&o);0==p?this.screen.cursor.style='block':1==p?this.screen.cursor.style='line':2==p&&(this.screen.cursor.style='bar'),this.screen.cursor.blinking!==q&&(this.screen.cursor.blinking=q,this.screen.renderer.resetCursorBlink()),this.screen.input.setMouseMode(m,n),this.screen.selection.selectable=!m&&!n,$(this.screen.canvas).toggleClass('selectable',this.screen.selection.selectable),this.screen.mouseMode={clicks:m,movement:n};$('.x-term-conf-btn').toggleClass('hidden',!!!(256&l)),$('#action-buttons').toggleClass('hidden',!!!(128&l)),this.screen.bracketedPaste=!!(8192&l),this.screen.reverseVideo=!!(16384&l);var r=7;var s=0;var t=0;var u=0;var v=' ';var w=this.screen.window.width*this.screen.window.height;g&&(this.screen.updateSize(),this.screen.blinkingCellCount=0,this.screen.screen=Array(w).fill(' '),this.screen.screenFG=Array(w).fill(' '),this.screen.screenBG=Array(w).fill(' '),this.screen.screenAttrs=Array(w).fill(0));var x=16;for(var z=function(){var a=t;var c=256&t;var d=512&t;0!=(a&x)&&(' '==v&&0==(a&200)||r==s&&c&&d)&&(a^=x),(b.screen.screenAttrs[u]&x)!=(a&x)&&(a&x?b.screen.blinkingCellCount++:b.screen.blinkingCellCount--),b.screen.screen[u]=v,b.screen.screenFG[u]=r,b.screen.screenBG[u]=s,b.screen.screenAttrs[u]=a};c<d.length&&u<w;){var A=d[c++];var B=A.codePointAt(0);var C=void 0;switch(B){case SEQ_REPEAT:var D=d[c++].codePointAt(0)-1;for(var E=0;E<D&&(z(),!(++u>w));E++);break;case SEQ_SET_COLORS:C=d[c++].codePointAt(0)-1,r=255&C,s=255&C>>8;break;case SEQ_SET_ATTRS:C=d[c++].codePointAt(0)-1,t=65535&C;break;case SEQ_SET_FG:C=d[c++].codePointAt(0)-1,r=255&C;break;case SEQ_SET_BG:C=d[c++].codePointAt(0)-1,s=255&C;break;default:32>B&&(A='\\uFFFD'),v=A,z(),u++;}}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 loadLabels(a){var b=a.split('\\x01');var c=b[0];qs('#screen-title').textContent=c,0===c.length&&(c='Terminal'),qs('title').textContent=c+' :: ESPTerm',$('#action-buttons button').forEach(function(a,c){var d=b[c+1].trim();a.innerHTML=d?$.htmlEscape(d):' ',a.style.opacity=d?1:0.2})}},{key:'load',value:function load(a){var b=1<arguments.length&&void 0!==arguments[1]?arguments[1]:null;var c=a.substr(1);switch(b&&('undefined'!=typeof b.defaultFg&&'undefined'!=typeof b.defaultBg&&this.screen.renderer.setDefaultColors(b.defaultFg,b.defaultBg),'undefined'!=typeof b.theme&&0<=b.theme&&b.theme<themes.length&&(this.screen.renderer.palette=themes[b.theme])),a[0]){case'S':this.loadContent(c);break;case'T':this.loadLabels(c);break;case'B':this.screen.beep();break;case'G':this.screen.showNotification(c);break;default:console.warn('Bad data message type; ignoring.\\n'+JSON.stringify(a));}}}]),a}();\n\n/***/ }),\n/* 15 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\nvar _createClass=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1,d.configurable=!0,'value'in d&&(d.writable=!0),Object.defineProperty(a,d.key,d)}}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}();function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError('Cannot call a class as a function')}var _require=__webpack_require__(4),themes=_require.themes,buildColorTable=_require.buildColorTable,SELECTION_FG=_require.SELECTION_FG,SELECTION_BG=_require.SELECTION_BG;var frakturExceptions={C:'\\u212D',H:'\\u210C',I:'\\u2111',R:'\\u211C',Z:'\\u2128'};module.exports=function(){function a(b){_classCallCheck(this,a),this.screen=b,this.ctx=b.ctx,this._palette=null,this.defaultBgNum=0,this.defaultFgNum=7,this.colorTable256=buildColorTable(),this.resetDrawn(),this.blinkStyleOn=!1,this.blinkInterval=null,this.cursorBlinkOn=!1,this.cursorBlinkInterval=null,this.resetBlink(),this.resetCursorBlink()}return _createClass(a,[{key:'resetDrawn',value:function resetDrawn(){this.drawnScreen=[],this.drawnScreenFG=[],this.drawnScreenBG=[],this.drawnScreenAttrs=[],this.drawnCursor=[-1,-1,'']}},{key:'setDefaultColors',value:function setDefaultColors(a,b){this.defaultFgNum=a,this.defaultBgNum=b,this.resetDrawn(),this.scheduleDraw('defaultColors')}},{key:'scheduleDraw',value:function scheduleDraw(a){var b=this;var c=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1;clearTimeout(this._scheduledDraw),this._scheduledDraw=setTimeout(function(){return b.draw(a)},c)}},{key:'getColor',value:function getColor(a){if(16>a&&a in this.palette)return this.palette[a];if(-1===a)return SELECTION_FG;if(-2===a)return SELECTION_BG;if(15<a&&256>a)return this.colorTable256[a];if(255<a){a-=256;var b=255&a>>16;var c=255&a>>8;var d=255&a;return'rgb('+b+', '+c+', '+d+')'}return 0==Date.now()/1e3%2?'#f0f':'#0f0'}},{key:'resetCursorBlink',value:function resetCursorBlink(){var a=this;this.cursorBlinkOn=!0,clearInterval(this.cursorBlinkInterval),this.cursorBlinkInterval=setInterval(function(){a.cursorBlinkOn=!a.screen.cursor.blinking||!a.cursorBlinkOn,a.screen.cursor.blinking&&a.scheduleDraw('cursor-blink')},500)}},{key:'resetBlink',value:function resetBlink(){var a=this;this.blinkStyleOn=!0,clearInterval(this.blinkInterval);var b=0;this.blinkInterval=setInterval(function(){0>=a.screen.blinkingCellCount||(b++,4<=b&&a.blinkStyleOn?(a.blinkStyleOn=!1,b=0,a.scheduleDraw('blink-style')):1<=b&&!a.blinkStyleOn&&(a.blinkStyleOn=!0,b=0,a.scheduleDraw('blink-style')))},200)}},{key:'drawBackground',value:function drawBackground(a){var b=a.x,c=a.y,d=a.cellWidth,e=a.cellHeight,f=a.bg;var g=this.ctx;g.fillStyle=this.getColor(f),g.clearRect(b*d,c*e,d,e),g.fillRect(b*d,c*e,d,e)}},{key:'drawCharacter',value:function drawCharacter(b){var c=Math.round;var d=b.x,e=b.y,f=b.charSize,g=b.cellWidth,h=b.cellHeight,i=b.text,j=b.fg,k=b.attrs;if(i){var l=this.ctx;var m=!1;var n=!1;var o=!1;2&k&&(l.globalAlpha=0.5),8&k&&(m=!0),32&k&&(i=a.alphaToFraktur(i)),64&k&&(n=!0),128&k&&(o=!0),l.fillStyle=this.getColor(j);var p=i.codePointAt(0);if(9600<=p&&9631>=p){l.beginPath();var q=d*g;var r=e*h;var s=g;var t=h;var u=g/2;var v=h/2;if(9600===p)l.rect(q,r,s,v);else if(9608>=p){var w=(1-(p-9600)/8)*t;l.rect(q,r+w,s,t-w)}else if(9615>=p){l.rect(q,r,s-(p-9608)/8*s,t)}else if(9616===p)l.rect(q+u,r,u,t);else if(9619>=p){var x,y,z;9617===p?(x=s/4,y=t/10,z=1):9618===p?(x=s/6,y=s/10,z=1):9619===p&&(x=s/4,y=s/7,z=2);var A=!1;for(var B=0;B<t;B+=y){for(var C=0;C<s;C+=x){var D=Math.min(z,t-B);l.rect(d*s+(A?s-C-z:C),e*t+B,z,D)}A=!A}}else 9620===p?l.rect(d*s,e*t,s,t/8):9621===p?l.rect((d+7/8)*s,e*t,s/8,t):9622===p?l.rect(q,r+v,u,v):9623===p?l.rect(q+u,r+v,u,v):9624===p?l.rect(q,r,u,v):9625===p?(l.rect(q,r,u,t),l.rect(q+u,r+v,u,v)):9626===p?(l.rect(q,r,u,v),l.rect(q+u,r+v,u,v)):9627===p?(l.rect(q,r,u,t),l.rect(q+u,r,u,v)):9628===p?(l.rect(q,r,s,v),l.rect(q+u,r+v,u,v)):9629===p?l.rect(q+u,r,u,v):9630===p?(l.rect(q,r+v,u,v),l.rect(q+u,r,u,v)):9631===p&&(l.rect(q,r+v,u,v),l.rect(q+u,r,u,t));l.fill()}else l.fillText(i,(d+0.5)*g,(e+0.5)*h);if(m||n||o){if(l.strokeStyle=this.getColor(j),l.lineWidth=1,l.lineCap='round',l.beginPath(),m){var E=c(e*h+f.height)+0.5;l.moveTo(d*g,E),l.lineTo((d+1)*g,E)}if(n){var F=c((e+0.5)*h)+0.5;l.moveTo(d*g,F),l.lineTo((d+1)*g,F)}if(o){var G=c(e*h)+0.5;l.moveTo(d*g,G),l.lineTo((d+1)*g,G)}l.stroke()}l.globalAlpha=1}}},{key:'getAdjacentCells',value:function getAdjacentCells(a){var b=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1;var c=this.screen.window,d=c.width,e=c.height;var f=[];for(var g=-b;g<=b;g++)for(var h=-b;h<=b;h++)(0!==g||0!==h)&&f.push(a+g+h*d);return f.filter(function(a){return 0<=a&&a<d*e})}},{key:'draw',value:function draw(a){var b=this;var c=this.ctx;var d=this.screen.window,e=d.width,f=d.height,g=d.devicePixelRatio,h=d.statusScreen;if(h)return this.drawStatus(h),void this.startDrawLoop();this.stopDrawLoop();var i=this.screen.getCharSize();var j=this.screen.getCellSize(),k=j.width,l=j.height;c.setTransform(g,0,0,g,0,0),this.screen.window.debug&&this.screen._debug&&this.screen._debug.drawStart(a),c.font=this.screen.getFont(),c.textAlign='center',c.textBaseline='middle';var m=new Map;var n=new Map;for(var ha=0;ha<e*f;ha++){var ia=ha%e;var ja=Math.floor(ha/e);var ka=!this.screen.cursor.hanging&&this.screen.cursor.x===ia&&this.screen.cursor.y===ja&&this.screen.cursor.visible&&this.cursorBlinkOn;var la=ia===this.drawnCursor[0]&&ja===this.drawnCursor[1];var ma=this.screen.isInSelection(ia,ja);var na=this.screen.screen[ha];var oa=0|this.screen.screenFG[ha];var pa=0|this.screen.screenBG[ha];var qa=0|this.screen.screenAttrs[ha];if(256&qa||(oa=this.defaultFgNum),512&qa||(pa=this.defaultBgNum),1024&qa){var o=[pa,oa];oa=o[0],pa=o[1]}if(this.screen.reverseVideo){var p=[pa,oa];oa=p[0],pa=p[1]}16&qa&&!this.blinkStyleOn&&(na=''),ma&&(oa=-1,pa=-2);var ra=na!==this.drawnScreen[ha]||oa!==this.drawnScreenFG[ha]||pa!==this.drawnScreenBG[ha]||qa!==this.drawnScreenAttrs[ha]||ka!==la||ka&&this.screen.cursor.style!==this.drawnCursor[2];var sa=qa&5;m.has(sa)||m.set(sa,[]),m.get(sa).push({cell:ha,x:ia,y:ja,text:na,fg:oa,bg:pa,attrs:qa,isCursor:ka,inSelection:ma}),n.set(ha,ra)}var q=new Map;var r=function(a){return' '!==a&&c.measureText(a).width>=k+0.05};var s=function(a){var c=n.get(a)||q.get(a)||!1;var d=b.screen.screen[a];var e=r(d);var f=e?2:1;if(!c){var l=!1;var g=!0;var h=!1;var i=void 0;try{for(var j,k=b.getAdjacentCells(a,f)[Symbol.iterator]();!(g=(j=k.next()).done);g=!0){var m=j.value;if(n.get(m)&&(2>b.screen.window.graphics||e||r(b.screen.screen[m]))){l=!0;break}}}catch(a){h=!0,i=a}finally{try{!g&&k.return&&k.return()}finally{if(h)throw i}}l&&(c=!0)}q.set(a,c)};var t=!0;var u=!1;var v=void 0;try{for(var w,z=n.keys()[Symbol.iterator]();!(t=(w=z.next()).done);t=!0){var x=w.value;s(x)}}catch(a){u=!0,v=a}finally{try{!t&&z.return&&z.return()}finally{if(u)throw v}}if(1<=this.screen.window.graphics){var y=this.screen.window.debug&&this.screen._debug;c.save(),c.beginPath();for(var ta=0;ta<f;ta++){var ua=null;for(var va=0;va<e;va++){var wa=ta*e+va;var xa=q.get(wa);xa&&null==ua&&(ua=va),xa||null===ua||(c.rect(ua*k,ta*l,(va-ua)*k,l),y&&this.screen._debug.clipRect(ua*k,ta*l,(va-ua)*k,l),ua=null)}null!==ua&&(c.rect(ua*k,ta*l,(e-ua)*k,l),y&&this.screen._debug.clipRect(ua*k,ta*l,(e-ua)*k,l))}c.clip()}var A=!0;var B=!1;var C=void 0;try{for(var D,E=m.keys()[Symbol.iterator]();!(A=(D=E.next()).done);A=!0){var ya=D.value;var F=!0;var G=!1;var H=void 0;try{for(var I,J=m.get(ya)[Symbol.iterator]();!(F=(I=J.next()).done);F=!0){var za=I.value;var K=za.cell,L=za.x,M=za.y,N=za.text,O=za.bg;if(q.get(K)&&(this.drawBackground({x:L,y:M,cellWidth:k,cellHeight:l,bg:O}),this.screen.window.debug&&this.screen._debug)){var Aa=+q.get(K);Aa|=+n.get(K)<<1,Aa|=+r(N)<<2,this.screen._debug.setCell(K,Aa)}}}catch(a){G=!0,H=a}finally{try{!F&&J.return&&J.return()}finally{if(G)throw H}}}}catch(a){B=!0,C=a}finally{try{!A&&E.return&&E.return()}finally{if(B)throw C}}this.drawnCursor=[-1,-1,-1];var P=!0;var Q=!1;var R=void 0;try{for(var S,T=m.keys()[Symbol.iterator]();!(P=(S=T.next()).done);P=!0){var Ba=S.value;var Ca={};1&Ba&&(Ca.weight='bold'),4&Ba&&(Ca.style='italic'),c.font=this.screen.getFont(Ca);var U=!0;var V=!1;var W=void 0;try{for(var X,Y=m.get(Ba)[Symbol.iterator]();!(U=(X=Y.next()).done);U=!0){var Da=X.value;var Z=Da.cell,$=Da.x,_=Da.y,aa=Da.text,ba=Da.fg,ca=Da.bg,da=Da.attrs,ea=Da.isCursor,fa=Da.inSelection;if(q.get(Z)&&(this.drawCharacter({x:$,y:_,charSize:i,cellWidth:k,cellHeight:l,text:aa,fg:ba,attrs:da}),this.drawnScreen[Z]=aa,this.drawnScreenFG[Z]=ba,this.drawnScreenBG[Z]=ca,this.drawnScreenAttrs[Z]=da,ea&&(this.drawnCursor=[$,_,this.screen.cursor.style]),ea&&!fa)){if(c.save(),c.beginPath(),'block'===this.screen.cursor.style)c.rect($*k,_*l,k,l);else if('bar'===this.screen.cursor.style){c.rect($*k,_*l,2,l)}else if('line'===this.screen.cursor.style){c.rect($*k,_*l+i.height,k,2)}c.clip();var ga=[ca,ba];ba=ga[0],ca=ga[1],ba===ca&&(ca=0===ba?7:0),this.drawBackground({x:$,y:_,cellWidth:k,cellHeight:l,bg:ca}),this.drawCharacter({x:$,y:_,charSize:i,cellWidth:k,cellHeight:l,text:aa,fg:ba,attrs:da}),c.restore()}}}catch(a){V=!0,W=a}finally{try{!U&&Y.return&&Y.return()}finally{if(V)throw W}}}}catch(a){Q=!0,R=a}finally{try{!P&&T.return&&T.return()}finally{if(Q)throw R}}1<=this.screen.window.graphics&&c.restore(),this.screen.window.debug&&this.screen._debug&&this.screen._debug.drawEnd(),this.screen.emit('draw')}},{key:'drawStatus',value:function drawStatus(a){var b=this.ctx;var c=this.screen.window,d=c.fontFamily,e=c.width,f=c.height,g=c.devicePixelRatio;this.drawnScreen=[];var h=this.screen.getCellSize();var j=e*h.width;var k=f*h.height;if(b.setTransform(g,0,0,g,0,0),b.clearRect(0,0,j,k),b.font='24px '+d,b.fillStyle='#fff',b.textAlign='center',b.textBaseline='middle',b.fillText(a.title||'',j/2,k/2-50),a.loading){b.save(),b.translate(j/2,k/2+20),b.strokeStyle='#fff',b.lineWidth=5,b.lineCap='round';var l=Date.now()/1e3;for(var m=0;12>m;m++){b.rotate(Math.PI/6);var i=(12*l-m)%12;b.globalAlpha=Math.max(0.2,1-i/3),b.beginPath(),b.moveTo(0,15),b.lineTo(0,30),b.stroke()}b.restore()}}},{key:'startDrawLoop',value:function startDrawLoop(){if(!this._drawTimerThread){var a=Math.random().toString(36);this._drawTimerThread=a,this.drawTimerLoop(a)}}},{key:'stopDrawLoop',value:function stopDrawLoop(){this._drawTimerThread=null}},{key:'drawTimerLoop',value:function drawTimerLoop(a){var b=this;a&&a===this._drawTimerThread&&(window.requestAnimationFrame(function(){return b.drawTimerLoop(a)}),this.draw('draw-loop'))}},{key:'palette',get:function get(){return this._palette||themes[0]},set:function set(a){this._palette!==a&&(this._palette=a,this.resetDrawn(),this.scheduleDraw('palette'))}}],[{key:'alphaToFraktur',value:function alphaToFraktur(a){var b=String.fromCodePoint;return'a'<=a&&'z'>=a?a=b(119997+a.charCodeAt(0)):'A'<=a&&'Z'>=a&&(a=frakturExceptions[a]||b(120003+a.charCodeAt(0))),a}}]),a}();\n\n/***/ }),\n/* 16 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\nvar _createClass=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1,d.configurable=!0,'value'in d&&(d.writable=!0),Object.defineProperty(a,d.key,d)}}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}();function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError('Cannot call a class as a function')}function _possibleConstructorReturn(a,b){if(!a)throw new ReferenceError('this hasn\\'t been initialised - super() hasn\\'t been called');return b&&('object'==typeof b||'function'==typeof b)?b:a}function _inherits(a,b){if('function'!=typeof b&&null!==b)throw new TypeError('Super expression must either be null or a function, not '+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}var EventEmitter=__webpack_require__(5);var $=__webpack_require__(1);var demo;try{demo=__webpack_require__(6)}catch(a){}module.exports=function(a){function b(a){_classCallCheck(this,b);var c=_possibleConstructorReturn(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));return c.screen=a,c.ws=null,c.heartbeatTimeout=null,c.pingInterval=null,c.xoff=!1,c.autoXoffTimeout=null,c.reconnTimeout=null,c.forceClosing=!1,c.pageShown=!1,c.disconnectTimeout=null,document.addEventListener('visibilitychange',function(){!0===document.hidden?(console.info('Window lost focus, freeing socket'),c.disconnectTimeout=setTimeout(function(){c.closeSocket(),clearTimeout(c.heartbeatTimeout)},1e3)):(clearTimeout(c.disconnectTimeout),console.info('Window got focus, re-connecting'),c.init())},!1),c}return _inherits(b,a),_createClass(b,[{key:'onWSOpen',value:function onWSOpen(){console.log('CONNECTED'),this.heartbeat(),this.send('i'),this.forceClosing=!1,this.emit('connect')}},{key:'onWSClose',value:function onWSClose(a){var b=this;return this.forceClosing?void(this.forceClosing=!1):void(console.warn('SOCKET CLOSED, code '+a.code+'. Reconnecting...'),1e3>a.code&&console.error('Bad code from socket!'),clearTimeout(this.reconnTimeout),this.reconnTimeout=setTimeout(function(){return b.init()},2e3),this.emit('disconnect',a.code))}},{key:'onWSMessage',value:function onWSMessage(a){var b=this;try{switch(a.data.charAt(0)){case'.':break;case'-':this.xoff=!0,this.autoXoffTimeout=setTimeout(function(){b.xoff=!1},250);break;case'+':this.xoff=!1,clearTimeout(this.autoXoffTimeout);break;default:this.screen.load(a.data),this.pageShown||(window.showPage(),this.pageShown=!0);}this.heartbeat()}catch(a){console.error(a)}}},{key:'canSend',value:function canSend(){return!this.xoff}},{key:'send',value:function send(a){return window._demo?('undefined'==typeof window.demoInterface?console.log('TX: '+JSON.stringify(a)):demo.input(a),!0):this.xoff?(console.log('Can\\'t send, flood control.'),!1):!!this.ws&&(1===this.ws.readyState?('string'!=typeof a&&(a=JSON.stringify(a)),this.ws.send(a),!0):(console.error('Socket not ready'),!1))}},{key:'closeSocket',value:function closeSocket(){this.ws&&(this.forceClosing=!0,1===this.ws.readyState&&this.ws.close(),this.ws=null)}},{key:'init',value:function init(){var a=this;return window._demo?void('undefined'==typeof window.demoInterface?window.alert('Demoing non-demo build!'):demo.init(this.screen)):void(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 a.onWSOpen.apply(a,arguments)}),this.ws.addEventListener('close',function(){return a.onWSClose.apply(a,arguments)}),this.ws.addEventListener('message',function(){return a.onWSMessage.apply(a,arguments)}),console.log('Opening socket.'),this.heartbeat(),this.emit('open'))}},{key:'heartbeat',value:function heartbeat(){var a=this;clearTimeout(this.heartbeatTimeout),this.heartbeatTimeout=setTimeout(function(){return a.onHeartbeatFail()},2500)}},{key:'onHeartbeatFail',value:function onHeartbeatFail(){var a=this;this.closeSocket(),this.emit('silence'),console.error('Heartbeat lost, probing server...'),clearInterval(this.pingInterval),this.pingInterval=setInterval(function(){console.log('> ping'),a.emit('ping'),$.get('http://'+window._root+'/system/ping',function(b,c){200===c?(clearInterval(a.pingInterval),console.info('Server ready, opening socket\\u2026'),a.emit('ping-success'),a.init()):a.emit('ping-fail',c)},{timeout:100,loader:!1})},1e3)}}]),b}(EventEmitter);\n\n/***/ }),\n/* 17 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\nvar $=__webpack_require__(1);var _require=__webpack_require__(0),encode2B=_require.encode2B;module.exports=function(a,b){function c(b){return a.send('s'+b)}function d(b){a.send('b'+g(b))}function e(a){var d=a.allFn;window.addEventListener('keypress',function(a){if(p()&&!(a.ctrlKey||a.metaKey)){var b='';a.key&&1===a.key.length?b=a.key:a.which&&229!==a.which&&(b=String.fromCodePoint(a.which)),0<b.length&&32<=b.charCodeAt(0)&&(32===a.which&&a.preventDefault(),c(b))}}),window.addEventListener('keydown',s),window.addEventListener('copy',function(a){if(p()){var c=b.getSelectedText();c&&(a.preventDefault(),a.clipboardData.setData('text/plain',c))}}),window.addEventListener('paste',function(a){if(p()){a.preventDefault();var d=a.clipboardData.getData('text/plain');d.includes('\\n')||90<d.length?(!h.termUpload&&console.error('input.termUpload is undefined'),h.termUpload.setContent(d),h.termUpload.open()):(b.bracketedPaste&&(d='\\x1B[200~'+d+'\\x1B[201~'),c(d))}}),k.all_fn=d}function f(){return w}var g=String.fromCharCode;var h;var j={3:'Cancel',6:'Help',8:'Backspace',9:'Tab',12:'Clear',13:'Enter',16:'Shift',17:'Control',18:'Alt',19:'Pause',20:'CapsLock',27:'Escape',32:' ',33:'PageUp',34:'PageDown',35:'End',36:'Home',37:'ArrowLeft',38:'ArrowUp',39:'ArrowRight',40:'ArrowDown',41:'Select',42:'Print',43:'Execute',44:'PrintScreen',45:'Insert',46:'Delete',58:':',59:';',60:'<',61:'=',62:'>',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'};for(var x=48;57>=x;x++)j[x]=g(x);for(var i=65;90>=i;i++)j[i]=g(i);for(var y=112;131>=y;y++)j[y]='F'+(y-112+1);for(var z=96;105>=z;z++)j[z]='Numpad'+(z-96);var k={np_alt:!1,cu_alt:!1,fn_alt:!1,mt_click:!1,mt_move:!1,no_keys:!1,crlf_mode:!1,all_fn:!1};var l=function(a,b){return k.fn_alt?a:b};var m=function(a,b){return k.cu_alt?a:b};var n=function(a,b){return k.np_alt?a:b};var o={Backspace:'\\b',Tab:'\\t',Enter:function Enter(){return k.crlf_mode?'\\r\\n':'\\r'},\"Control+Enter\":'\\n',Escape:'\\x1B',ArrowUp:function ArrowUp(){return m('\\x1BOA','\\x1B[A')},ArrowDown:function ArrowDown(){return m('\\x1BOB','\\x1B[B')},ArrowRight:function ArrowRight(){return m('\\x1BOC','\\x1B[C')},ArrowLeft:function ArrowLeft(){return m('\\x1BOD','\\x1B[D')},Home:function Home(){return m('\\x1BOH',l('\\x1B[H','\\x1B[1~'))},Insert:'\\x1B[2~',Delete:'\\x1B[3~',End:function End(){return m('\\x1BOF',l('\\x1B[F','\\x1B[4~'))},PageUp:'\\x1B[5~',PageDown:'\\x1B[6~',F1:function F1(){return l('\\x1BOP','\\x1B[11~')},F2:function F2(){return l('\\x1BOQ','\\x1B[12~')},F3:function F3(){return l('\\x1BOR','\\x1B[13~')},F4:function F4(){return l('\\x1BOS','\\x1B[14~')},F5:'\\x1B[15~',F6:'\\x1B[17~',F7:'\\x1B[18~',F8:'\\x1B[19~',F9:'\\x1B[20~',F10:'\\x1B[21~',F11:'\\x1B[23~',F12:'\\x1B[24~',\"Shift+F1\":function ShiftF1(){return l('\\x1BO1;2P','\\x1B[25~')},\"Shift+F2\":function ShiftF2(){return l('\\x1BO1;2Q','\\x1B[26~')},\"Shift+F3\":function ShiftF3(){return l('\\x1BO1;2R','\\x1B[28~')},\"Shift+F4\":function ShiftF4(){return l('\\x1BO1;2S','\\x1B[29~')},\"Shift+F5\":function ShiftF5(){return l('\\x1B[15;2~','\\x1B[31~')},\"Shift+F6\":function ShiftF6(){return l('\\x1B[17;2~','\\x1B[32~')},\"Shift+F7\":function ShiftF7(){return l('\\x1B[18;2~','\\x1B[33~')},\"Shift+F8\":function ShiftF8(){return l('\\x1B[19;2~','\\x1B[34~')},\"Shift+F9\":function ShiftF9(){return l('\\x1B[20;2~','\\x1B[35~')},\"Shift+F10\":function ShiftF10(){return l('\\x1B[21;2~','\\x1B[36~')},\"Shift+F11\":function ShiftF11(){return l('\\x1B[22;2~','\\x1B[37~')},\"Shift+F12\":function ShiftF12(){return l('\\x1B[23;2~','\\x1B[38~')},Numpad0:function Numpad0(){return n('\\x1BOp','0')},Numpad1:function Numpad1(){return n('\\x1BOq','1')},Numpad2:function Numpad2(){return n('\\x1BOr','2')},Numpad3:function Numpad3(){return n('\\x1BOs','3')},Numpad4:function Numpad4(){return n('\\x1BOt','4')},Numpad5:function Numpad5(){return n('\\x1BOu','5')},Numpad6:function Numpad6(){return n('\\x1BOv','6')},Numpad7:function Numpad7(){return n('\\x1BOw','7')},Numpad8:function Numpad8(){return n('\\x1BOx','8')},Numpad9:function Numpad9(){return n('\\x1BOy','9')},\"Numpad*\":function Numpad(){return n('\\x1BOR','*')},\"Numpad+\":function Numpad(){return n('\\x1BOl','+')},\"Numpad-\":function Numpad(){return n('\\x1BOS','-')},\"Numpad.\":function Numpad(){return n('\\x1BOn','.')},\"Numpad/\":function Numpad(){return n('\\x1BOQ','/')},\"Control+]\":'\\x1B',\"Control+\\\\\":'\\x1C',\"Control+[\":'\\x1D',\"Control+^\":'\\x1E',\"Control+_\":'\\x1F',\"Control+ArrowLeft\":'\\x1F[1;5D',\"Control+ArrowRight\":'\\x1F[1;5C',\"Control+ArrowUp\":'\\x1F[1;5A',\"Control+ArrowDown\":'\\x1F[1;5B',\"Control+Home\":'\\x1F[1;5H',\"Control+End\":'\\x1F[1;5F',\"Shift+ArrowLeft\":'\\x1F[1;2D',\"Shift+ArrowRight\":'\\x1F[1;2C',\"Shift+ArrowUp\":'\\x1F[1;2A',\"Shift+ArrowDown\":'\\x1F[1;2B',\"Shift+Home\":'\\x1F[1;2H',\"Shift+End\":'\\x1F[1;2F',\"Alt+ArrowLeft\":'\\x1Bb',\"Alt+ArrowRight\":'\\x1Bf',\"Meta+ArrowLeft\":'\\x01',\"Meta+ArrowRight\":'\\x05',\"Alt+Backspace\":'\\x17',\"Meta+Backspace\":'\\x15',\"Control+Shift+C\":function ControlShiftC(){b.copySelectionToClipboard()},\"Control+Insert\":function ControlInsert(){b.copySelectionToClipboard()},\"Control+F12\":function ControlF12(){b.window.debug^=1}};for(var A=1;26>=A;A++)o['Control+'+g(64+A)]=g(A);var p=function(){return!k.no_keys&&!(document.activeElement instanceof window.HTMLTextAreaElement)};var q=['F5','F11','F12','Shift+F5'];var r={alt:!1,ctrl:!1,meta:!1,shift:!1};var s=function(a){if(p()){var b=[];(a.altKey||r.alt)&&b.push('Alt'),(a.ctrlKey||r.ctrl)&&b.push('Control'),(a.metaKey||r.meta)&&b.push('Meta'),(a.shiftKey||r.shift)&&b.push('Shift');var d=j[a.which]||a.key;if(!((a.ctrlKey||a.metaKey)&&'V'===d)){var e=null;for(var f in o){var g=f.split('+');var h=g.pop();if(h===d&&g.sort().join()===b.join()){if(q.includes(f)&&!k.all_fn)continue;e=o[f];break}}e&&(e instanceof Function&&(e=e()),a.preventDefault(),'string'==typeof e&&c(e))}}};var t=0;var u=0;var v=0;var w=0;return window.addEventListener('keydown',function(a){a.ctrlKey&&(w|=1),a.shiftKey&&(w|=2),a.altKey&&(w|=4),a.metaKey&&(w|=8)}),window.addEventListener('keyup',function(a){w=0,a.ctrlKey&&(w|=1),a.shiftKey&&(w|=2),a.altKey&&(w|=4),a.metaKey&&(w|=8)}),h={init:function(a){e(a),$('#action-buttons button').forEach(function(a){a.addEventListener('click',function(){d(+this.dataset.n)})}),window.addEventListener('mousedown',function(a){0===a.button&&(t=1),1===a.button&&(u=1),2===a.button&&(v=1)}),window.addEventListener('mouseup',function(a){0===a.button&&(t=0),1===a.button&&(u=0),2===a.button&&(v=0)})},sendString:c,setAlts:function setAlts(a,b,c,d){(k.cu_alt!==a||k.np_alt!==b||k.fn_alt!==c||k.crlf_mode!==d)&&(k.cu_alt=a,k.np_alt=b,k.fn_alt=c,k.crlf_mode=d)},setMouseMode:function setMouseMode(a,b){k.mt_click=a,k.mt_move=b},onMouseMove:function onMouseMove(c,d){if(k.mt_move){var e=t?1:u?2:v?3:0;var b=f();a.send('m'+encode2B(d)+encode2B(c)+encode2B(e)+encode2B(b))}},onMouseDown:function onMouseDown(c,d,e){if(k.mt_click&&!(3<e||1>e)){var b=f();a.send('p'+encode2B(d)+encode2B(c)+encode2B(e)+encode2B(b))}},onMouseUp:function onMouseUp(c,d,e){if(k.mt_click&&!(3<e||1>e)){var b=f();a.send('r'+encode2B(d)+encode2B(c)+encode2B(e)+encode2B(b))}},onMouseWheel:function onMouseWheel(c,d,e){if(k.mt_click){var g=f();var h=0>e?4:5;a.send('p'+encode2B(d)+encode2B(c)+encode2B(h)+encode2B(g))}},blockKeys:function blockKeys(a){k.no_keys=a},handleKeyDown:s,softModifiers:r},h};\n\n/***/ }),\n/* 18 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\nvar $=__webpack_require__(1);var _require=__webpack_require__(0),qs=_require.qs;var modal=__webpack_require__(2);module.exports=function(a,b,c){function d(){f('Ready...'),modal.show('#fu_modal',e),$('#fu_form').toggleClass('busy',!1),b.blockKeys(!0)}function e(){console.log('Upload modal closed.'),clearTimeout(m),l=0,b.blockKeys(!1)}function f(a){qs('#fu_prog').textContent=a}function g(){var a=qs('#fu_text').value;return a.length?void(k=a.split('\\n'),l=0,q=0,n=qs('#fu_delay').value,0>n&&(n=0,qs('#fu_delay').value=n),o={CR:'\\r',LF:'\\n',CRLF:'\\r\\n'}[qs('#fu_crlf').value],$('#fu_form').toggleClass('busy',!0),f('Starting...'),h()):void j()}function h(){if($('#fu_modal').hasClass('visible')){if(!a.canSend())return void(m=setTimeout(h,1));0===q&&(p='',0===l&&c.bracketedPaste&&(p='\\x1B[200~'),p+=k[l++]+o,l===k.length&&c.bracketedPaste&&(p+='\\x1B[201~'));var d;if(p.length-q<=r?(d=p.substr(q,r),q=0):(d=p.substr(q,r),q+=r),!b.sendString(d))return void f('FAILED!');var e=Math.round(1e3*(l/k.length))/10;f(l+' / '+k.length+' ('+e+'%)'),k.length>l||0<q?m=setTimeout(h,n):i()}}function i(){a.canSend()?(f('Done.'),j()):(f('Waiting for Tx buffer...'),setTimeout(i,100))}function j(){modal.hide('#fu_modal')}var k,l,m,n,o,p,q;var r=128;return{init:function init(){qs('#fu_file').addEventListener('change',function(a){var b=new window.FileReader;var c=a.target.files[0];var d=c.type||'application/octet-stream';return console.log('Selected file type: '+d),d.match(/text\\/.*|application\\/(json|csv|.*xml.*|.*script.*|x-php)/)||window.confirm('This does not look like a text file: '+d+'\\nReally load?')?void(b.onload=function(a){var b=a.target.result.replace(/[\\r\\n]+/,'\\n');qs('#fu_text').value=b},console.log('Loading file...'),b.readAsText(c)):void(qs('#fu_file').value='')},!1),qs('#term-fu-open').addEventListener('click',function(){return d(),!1}),qs('#term-fu-start').addEventListener('click',function(){return g(),!1}),qs('#term-fu-close').addEventListener('click',function(){return j(),!1})},open:d,setContent:function setContent(a){qs('#fu_text').value=a}}};\n\n/***/ }),\n/* 19 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\nvar _slicedToArray=function(){function a(a,b){var c=[];var d=!0;var e=!1;var f=void 0;try{for(var g,h=a[Symbol.iterator]();!(d=(g=h.next()).done)&&(c.push(g.value),!(b&&c.length===b));d=!0);}catch(a){e=!0,f=a}finally{try{!d&&h['return']&&h['return']()}finally{if(e)throw f}}return c}return function(b,c){if(Array.isArray(b))return b;if(Symbol.iterator in Object(b))return a(b,c);throw new TypeError('Invalid attempt to destructure non-iterable instance')}}();var _require=__webpack_require__(0),qs=_require.qs;module.exports=function(a,b){var c=qs('#softkb-input');if(c){var d=document.createElement('div');d.id='keyboard-shortcut-bar',navigator.userAgent.match(/iPad|iPhone|iPod/)&&qs('#screen').appendChild(d);var e=!1;var f=function(){if(e){var b=a.gridToScreen(a.cursor.x,a.cursor.y,!0),d=_slicedToArray(b,2),f=d[0],g=d[1];c.style.transform='translate('+f+'px, '+g+'px)'}};c.addEventListener('focus',function(){e=!0,f(),d.classList.add('open')}),c.addEventListener('blur',function(){e=!1,d.classList.remove('open')}),a.on('cursor-moved',f),qs('#term-kb-open').addEventListener('click',function(a){a.preventDefault(),c.focus()});var g='';var h=function(a){var c=!1;a.length>g.length?a.startsWith(g)?b.sendString(a.substr(g.length)):c=!0:a.length<g.length?g.startsWith(a)?b.sendString('\\b'.repeat(g.length-a.length)):c=!0:a!==g&&(c=!0),c&&b.sendString('\\b'.repeat(g.length)+a),g=a};c.addEventListener('keydown',function(a){'Unidentified'===a.key||(c.value='',a.stopPropagation(),b.handleKeyDown(a))}),c.addEventListener('keypress',function(a){a.stopPropagation()}),c.addEventListener('input',function(a){a.stopPropagation(),a.isComposing&&'data'in a?h(a.data):a.isComposing?h(c.value):'insertCompositionText'===a.inputType?b.sendString(a.data):'deleteContentBackward'===a.inputType?(g='',h('')):'insertText'===a.inputType&&b.sendString(a.data)}),c.addEventListener('compositionstart',function(){g=''}),c.addEventListener('compositionend',function(){g='',c.value=''}),a.on('open-soft-keyboard',function(){return c.focus()});var i={Control:'ctrl',Esc:27,Tab:9,\"←\":37,\"↓\":40,\"↑\":38,\"→\":39};var j=!1;var k=function(a){var c=document.createElement('button');c.classList.add('shortcut-button'),c.textContent=a,d.appendChild(c);var f=i[a];'string'==typeof f&&c.classList.add('modifier'),c.addEventListener('touchstart',function(a){j=!1,'string'==typeof f&&(b.softModifiers[f]=!0,c.classList.add('enabled'),a.preventDefault())}),window.addEventListener('touchmove',function(){j=!0}),c.addEventListener('touchend',function(a){if(a.preventDefault(),'number'==typeof f){if(j)return;b.handleKeyDown({which:f,preventDefault:function preventDefault(){}})}else'string'==typeof f&&(c.classList.remove('enabled'),b.softModifiers[f]=!1)})};for(var l in i)k(l)}};\n\n/***/ }),\n/* 20 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\nvar _slicedToArray=function(){function a(a,b){var c=[];var d=!0;var e=!1;var f=void 0;try{for(var g,h=a[Symbol.iterator]();!(d=(g=h.next()).done)&&(c.push(g.value),!(b&&c.length===b));d=!0);}catch(a){e=!0,f=a}finally{try{!d&&h['return']&&h['return']()}finally{if(e)throw f}}return c}return function(b,c){if(Array.isArray(b))return b;if(Symbol.iterator in Object(b))return a(b,c);throw new TypeError('Invalid attempt to destructure non-iterable instance')}}();function _toConsumableArray(a){if(Array.isArray(a)){for(var b=0,c=Array(a.length);b<a.length;b++)c[b]=a[b];return c}return Array.from(a)}var _require=__webpack_require__(0),mk=_require.mk;module.exports=function(a){var b=mk('canvas');var c=b.getContext('2d');b.style.position='absolute',b.style.top='6px',b.style.left='6px',b.style.pointerEvents='none';var d=function(){b.parentNode||a.canvas.parentNode.appendChild(b)};var e=function(){b.parentNode&&b.parentNode.removeChild(b)};var f=function(){var c=a.window,d=c.width,e=c.height,f=c.devicePixelRatio;var g=a.getCellSize();b.width=d*g.width*f,b.height=e*g.height*f,b.style.width=d*g.width+'px',b.style.height=e*g.height+'px'};var g,h,i;var j=new Map;var k=[];var l;a._debug={drawStart:function drawStart(a){i=a,g=Date.now(),k=[]},drawEnd:function drawEnd(){h=Date.now(),console.log('Draw: '+i+' ('+(h-g)+' ms) with fancy graphics: '+a.window.graphics),l()},setCell:function setCell(a,b){j.set(a,[b,Date.now()])},clipRect:function clipRect(){for(var a=arguments.length,b=Array(a),c=0;c<a;c++)b[c]=arguments[c];k.push(b)}};var m;{var t=document.createElement('canvas');t.width=t.height=12;var u=t.getContext('2d');u.lineWidth=1,u.strokeStyle='#00f',u.beginPath(),u.moveTo(0,0),u.lineTo(-4,12),u.moveTo(4,0),u.lineTo(0,12),u.moveTo(8,0),u.lineTo(4,12),u.moveTo(12,0),u.lineTo(8,12),u.moveTo(16,0),u.lineTo(12,12),u.stroke(),m=c.createPattern(t,'repeat')}var n=!1;var o=function(){n&&window.requestAnimationFrame(o);var b=a.window,d=b.devicePixelRatio,f=b.width,g=b.height;var h=a.getCellSize(),i=h.width,l=h.height;var p=Date.now();c.setTransform(d,0,0,d,0,0),c.clearRect(0,0,f*i,g*l);var q=0;for(var D=0;D<f*g;D++)if(j.has(D)&&0!==j.get(D)[0]){var r=j.get(D),s=_slicedToArray(r,2),t=s[0],u=s[1];var v=(p-u)/1e3;if(!(1<v)){q++,c.globalAlpha=0.5*Math.max(0,1-v);var w=D%f;var x=Math.floor(D/f);1&t&&(c.fillStyle='#f0f'),2&t&&(c.fillStyle='#0f0'),c.fillRect(w*i,x*l,i,l),4&t&&(c.lineWidth=2,c.strokeStyle='#f00',c.strokeRect(w*i,x*l,i,l))}}if(k.length){c.globalAlpha=0.5,c.beginPath();var y=!0;var z=!1;var A=void 0;try{for(var B,C=k[Symbol.iterator]();!(y=(B=C.next()).done);y=!0){var E=B.value;c.rect.apply(c,_toConsumableArray(E))}}catch(a){z=!0,A=a}finally{try{!y&&C.return&&C.return()}finally{if(z)throw A}}c.fillStyle=m,c.fill()}0==q&&(n=!1,e())};l=function(){n||(d(),f(),n=!0,o())};var p=mk('div');p.classList.add('debug-toolbar');var q=!1;var r=function(){a.canvas.parentNode.appendChild(p)};var s=function(){p.parentNode.removeChild(p)};a.on('update-window:debug',function(a){a!==q&&(q=a,a?r():s())}),a.on('draw',function(){if(q){var b=a.cursor.y*a.window.width+a.cursor.x;var c=a.screenFG[b];var d=a.screenBG[b];var e=(a.screen[b]||'').codePointAt(0);var f=a.screenAttrs[b];var g=e.toString(16).toUpperCase();4>g.length&&(g=('0000'+g).substr(-4)),g='U+'+g,p.textContent='Cursor cell ('+b+'): '+g+' FG: '+c+' BG: '+d+' Attrs: '+f.toString(2)}})};\n\n/***/ })\n/******/ ]);\n\n\n// WEBPACK FOOTER //\n// app.f5dd70a.js"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 7);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap bd9a577b27d35638d000","/** Make a node */\nexports.mk = function mk (e) {\n return document.createElement(e)\n}\n\n/** Find one by query */\nexports.qs = function qs (s) {\n return document.querySelector(s)\n}\n\n/** Find all by query */\nexports.qsa = function qsa (s) {\n return document.querySelectorAll(s)\n}\n\n/**\n * Filter 'spacebar' and 'return' from keypress handler,\n * and when they're pressed, fire the callback.\n * use $(...).on('keypress', cr(handler))\n */\nexports.cr = function cr (hdl) {\n return function (e) {\n if (e.which === 10 || e.which === 13 || e.which === 32) {\n hdl()\n }\n }\n}\n\n/** Convert any to bool safely */\nexports.bool = function bool (x) {\n return (x === 1 || x === '1' || x === true || x === 'true')\n}\n\n/** Decode number from 2B encoding */\nexports.parse2B = function parse2B (s, i = 0) {\n return (s.charCodeAt(i++) - 1) + (s.charCodeAt(i) - 1) * 127\n}\n\n/** Decode number from 3B encoding */\nexports.parse3B = function parse3B (s, i = 0) {\n return (s.charCodeAt(i) - 1) + (s.charCodeAt(i + 1) - 1) * 127 + (s.charCodeAt(i + 2) - 1) * 127 * 127\n}\n\n/** Encode using 2B encoding, returns string. */\nexports.encode2B = function encode2B (n) {\n let lsb, msb\n lsb = (n % 127)\n n = ((n - lsb) / 127)\n lsb += 1\n msb = (n + 1)\n return String.fromCharCode(lsb) + String.fromCharCode(msb)\n}\n\n/** Encode using 3B encoding, returns string. */\nexports.encode3B = function encode3B (n) {\n let lsb, msb, xsb\n lsb = (n % 127)\n n = (n - lsb) / 127\n lsb += 1\n msb = (n % 127)\n n = (n - msb) / 127\n msb += 1\n xsb = (n + 1)\n return String.fromCharCode(lsb) + String.fromCharCode(msb) + String.fromCharCode(xsb)\n}\n\n\n\n// WEBPACK FOOTER //\n// ./js/utils.js","/*!chibi 3.0.7, Copyright 2012-2016 Kyle Barrow, released under MIT license */\n\n// MODIFIED VERSION.\n(function () {\n\t'use strict';\n\n\tvar readyfn = [],\n\t\tloadedfn = [],\n\t\tdomready = false,\n\t\tpageloaded = false,\n\t\td = document,\n\t\tw = window;\n\n\t// Fire any function calls on ready event\n\tfunction fireReady() {\n\t\tvar i;\n\t\tdomready = true;\n\t\tfor (i = 0; i < readyfn.length; i += 1) {\n\t\t\treadyfn[i]();\n\t\t}\n\t\treadyfn = [];\n\t}\n\n\t// Fire any function calls on loaded event\n\tfunction fireLoaded() {\n\t\tvar i;\n\t\tpageloaded = true;\n\t\t// For browsers with no DOM loaded support\n\t\tif (!domready) {\n\t\t\tfireReady();\n\t\t}\n\t\tfor (i = 0; i < loadedfn.length; i += 1) {\n\t\t\tloadedfn[i]();\n\t\t}\n\t\tloadedfn = [];\n\t}\n\n\t// Check DOM ready, page loaded\n\tif (d.addEventListener) {\n\t\t// Standards\n\t\td.addEventListener('DOMContentLoaded', fireReady, false);\n\t\tw.addEventListener('load', fireLoaded, false);\n\t} else if (d.attachEvent) {\n\t\t// IE\n\t\td.attachEvent('onreadystatechange', fireReady);\n\t\t// IE < 9\n\t\tw.attachEvent('onload', fireLoaded);\n\t} else {\n\t\t// Anything else\n\t\tw.onload = fireLoaded;\n\t}\n\n\t// Utility functions\n\n\t// Loop through node array\n\tfunction nodeLoop(fn, nodes) {\n\t\tvar i;\n\t\t// Good idea to walk up the DOM\n\t\tfor (i = nodes.length - 1; i >= 0; i -= 1) {\n\t\t\tfn(nodes[i]);\n\t\t}\n\t}\n\n\t// Convert to camel case\n\tfunction cssCamel(property) {\n\t\treturn property.replace(/-\\w/g, function (result) {\n\t\t\treturn result.charAt(1).toUpperCase();\n\t\t});\n\t}\n\n\t// Get computed style\n\tfunction computeStyle(elm, property) {\n\t\t// IE, everything else or null\n\t\treturn (elm.currentStyle) ? elm.currentStyle[cssCamel(property)] : (w.getComputedStyle) ? w.getComputedStyle(elm, null).getPropertyValue(property) : null;\n\n\t}\n\n\t// Returns URI encoded query string pair\n\tfunction queryPair(name, value) {\n\t\treturn encodeURIComponent(name).replace(/%20/g, '+') + '=' + encodeURIComponent(value).replace(/%20/g, '+');\n\t}\n\n\t// Set CSS, important to wrap in try to prevent error thown on unsupported property\n\tfunction setCss(elm, property, value) {\n\t\ttry {\n\t\t\telm.style[cssCamel(property)] = value;\n\t\t} catch (e) {\n\t\t}\n\t}\n\n\t// Show CSS\n\tfunction showCss(elm) {\n\t\telm.style.display = '';\n\t\t// For elements still hidden by style block\n\t\tif (computeStyle(elm, 'display') === 'none') {\n\t\t\telm.style.display = 'block';\n\t\t}\n\t}\n\n\t// Serialize form & JSON values\n\tfunction serializeData(nodes) {\n\t\tvar querystring = '', subelm, i, j;\n\t\tif (nodes.constructor === Object) { // Serialize JSON data\n\t\t\tfor (subelm in nodes) {\n\t\t\t\tif (nodes.hasOwnProperty(subelm)) {\n\t\t\t\t\tif (nodes[subelm].constructor === Array) {\n\t\t\t\t\t\tfor (i = 0; i < nodes[subelm].length; i += 1) {\n\t\t\t\t\t\t\tquerystring += '&' + queryPair(subelm, nodes[subelm][i]);\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tquerystring += '&' + queryPair(subelm, nodes[subelm]);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} else { // Serialize node data\n\t\t\tnodeLoop(function (elm) {\n\t\t\t\tif (elm.nodeName === 'FORM') {\n\t\t\t\t\tfor (i = 0; i < elm.elements.length; i += 1) {\n\t\t\t\t\t\tsubelm = elm.elements[i];\n\n\t\t\t\t\t\tif (!subelm.disabled) {\n\t\t\t\t\t\t\tswitch (subelm.type) {\n\t\t\t\t\t\t\t\t// Ignore buttons, unsupported XHR 1 form fields\n\t\t\t\t\t\t\t\tcase 'button':\n\t\t\t\t\t\t\t\tcase 'image':\n\t\t\t\t\t\t\t\tcase 'file':\n\t\t\t\t\t\t\t\tcase 'submit':\n\t\t\t\t\t\t\t\tcase 'reset':\n\t\t\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t\t\tcase 'select-one':\n\t\t\t\t\t\t\t\t\tif (subelm.length > 0) {\n\t\t\t\t\t\t\t\t\t\tquerystring += '&' + queryPair(subelm.name, subelm.value);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t\t\tcase 'select-multiple':\n\t\t\t\t\t\t\t\t\tfor (j = 0; j < subelm.length; j += 1) {\n\t\t\t\t\t\t\t\t\t\tif (subelm[j].selected) {\n\t\t\t\t\t\t\t\t\t\t\tquerystring += '&' + queryPair(subelm.name, subelm[j].value);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t\t\tcase 'checkbox':\n\t\t\t\t\t\t\t\tcase 'radio':\n\t\t\t\t\t\t\t\t\tif (subelm.checked) {\n\t\t\t\t\t\t\t\t\t\tquerystring += '&' + queryPair(subelm.name, subelm.value);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t\t\t// Everything else including shinny new HTML5 input types\n\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\tquerystring += '&' + queryPair(subelm.name, subelm.value);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}, nodes);\n\t\t}\n\t\t// Tidy up first &\n\t\treturn (querystring.length > 0) ? querystring.substring(1) : '';\n\t}\n\n\t// Class helper\n\tfunction classHelper(classes, action, nodes) {\n\t\tvar classarray, search, i, replace, has = false;\n\t\tif (classes) {\n\t\t\t// Trim any whitespace\n\t\t\tclassarray = classes.split(/\\s+/);\n\t\t\tnodeLoop(function (elm) {\n\t\t\t\tfor (i = 0; i < classarray.length; i += 1) {\n\t\t\t\t\tvar clz = classarray[i];\n\t\t\t\t\tif (action === 'remove') {\n\t\t\t\t\t\telm.classList.remove(clz);\n\t\t\t\t\t}\n\t\t\t\t\telse if (action === 'add') {\n\t\t\t\t\t\telm.classList.add(clz);\n\t\t\t\t\t}\n\t\t\t\t\telse if (action === 'toggle') {\n\t\t\t\t\t\telm.classList.toggle(clz);\n\t\t\t\t\t}\n\t\t\t\t\telse if (action === 'has') {\n\t\t\t\t\t\tif (elm.classList.contains(clz)) {\n\t\t\t\t\t\t\thas = true;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t// search = new RegExp('\\\\b' + classarray[i] + '\\\\b', 'g');\n\t\t\t\t\t// replace = new RegExp(' *' + classarray[i] + '\\\\b', 'g');\n\t\t\t\t\t// if (action === 'remove') {\n\t\t\t\t\t// \telm.className = elm.className.replace(search, '');\n\t\t\t\t\t// } else if (action === 'toggle') {\n\t\t\t\t\t// \telm.className = (elm.className.match(search)) ? elm.className.replace(replace, '') : elm.className + ' ' + classarray[i];\n\t\t\t\t\t// } else if (action === 'has') {\n\t\t\t\t\t// \tif (elm.className.match(search)) {\n\t\t\t\t\t// \t\thas = true;\n\t\t\t\t\t// \t\tbreak;\n\t\t\t\t\t// \t}\n\t\t\t\t\t// }\n\t\t\t\t}\n\t\t\t}, nodes);\n\t\t}\n\t\treturn has;\n\t}\n\n\t// HTML insertion helper\n\tfunction insertHtml(value, position, nodes) {\n\t\tvar tmpnodes, tmpnode;\n\t\tif (value) {\n\t\t\tnodeLoop(function (elm) {\n\t\t\t\t// No insertAdjacentHTML support for FF < 8 and IE doesn't allow insertAdjacentHTML table manipulation, so use this instead\n\t\t\t\t// Convert string to node. We can't innerHTML on a document fragment\n\t\t\t\ttmpnodes = d.createElement('div');\n\t\t\t\ttmpnodes.innerHTML = value;\n\t\t\t\twhile ((tmpnode = tmpnodes.lastChild) !== null) {\n\t\t\t\t\t// Catch error in unlikely case elm has been removed\n\t\t\t\t\ttry {\n\t\t\t\t\t\tif (position === 'before') {\n\t\t\t\t\t\t\telm.parentNode.insertBefore(tmpnode, elm);\n\t\t\t\t\t\t} else if (position === 'after') {\n\t\t\t\t\t\t\telm.parentNode.insertBefore(tmpnode, elm.nextSibling);\n\t\t\t\t\t\t} else if (position === 'append') {\n\t\t\t\t\t\t\telm.appendChild(tmpnode);\n\t\t\t\t\t\t} else if (position === 'prepend') {\n\t\t\t\t\t\t\telm.insertBefore(tmpnode, elm.firstChild);\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}, nodes);\n\t\t}\n\t}\n\n\t// Get nodes and return chibi\n\tfunction chibi(selector) {\n\t\tvar cb, nodes = [], json = false, nodelist, i;\n\n\t\tif (selector) {\n\n\t\t\t// Element node, would prefer to use (selector instanceof HTMLElement) but no IE support\n\t\t\tif (selector.nodeType && selector.nodeType === 1) {\n\t\t\t\tnodes = [selector]; // return element as node list\n\t\t\t} else if (typeof selector === 'object') {\n\t\t\t\t// JSON, document object or node list, would prefer to use (selector instanceof NodeList) but no IE support\n\t\t\t\tjson = (typeof selector.length !== 'number');\n\t\t\t\tnodes = selector;\n\t\t\t} else if (typeof selector === 'string') {\n\t\t\t\tnodelist = d.querySelectorAll(selector);\n\n\t\t\t\t// Convert node list to array so results have full access to array methods\n\t\t\t\t// Array.prototype.slice.call not supported in IE < 9 and often slower than loop anyway\n\t\t\t\tfor (i = 0; i < nodelist.length; i += 1) {\n\t\t\t\t\tnodes[i] = nodelist[i];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Only attach nodes if not JSON\n\t\tcb = json ? {} : nodes;\n\n\t\t// Public functions\n\n\t\t// Executes a function on nodes\n\t\tcb.each = function (fn) {\n\t\t\tif (typeof fn === 'function') {\n\t\t\t\tnodeLoop(function (elm) {\n\t\t\t\t\t// <= IE 8 loses scope so need to apply\n\t\t\t\t\treturn fn.apply(elm, arguments);\n\t\t\t\t}, nodes);\n\t\t\t}\n\t\t\treturn cb;\n\t\t};\n\t\t// Find first\n\t\tcb.first = function () {\n\t\t\treturn chibi(nodes.shift());\n\t\t};\n\t\t// Find last\n\t\tcb.last = function () {\n\t\t\treturn chibi(nodes.pop());\n\t\t};\n\t\t// Find odd\n\t\tcb.odd = function () {\n\t\t\tvar odds = [], i;\n\t\t\tfor (i = 0; i < nodes.length; i += 2) {\n\t\t\t\todds.push(nodes[i]);\n\t\t\t}\n\t\t\treturn chibi(odds);\n\t\t};\n\t\t// Find even\n\t\tcb.even = function () {\n\t\t\tvar evens = [], i;\n\t\t\tfor (i = 1; i < nodes.length; i += 2) {\n\t\t\t\tevens.push(nodes[i]);\n\t\t\t}\n\t\t\treturn chibi(evens);\n\t\t};\n\t\t// Hide node\n\t\tcb.hide = function () {\n\t\t\tnodeLoop(function (elm) {\n\t\t\t\telm.style.display = 'none';\n\t\t\t}, nodes);\n\t\t\treturn cb;\n\t\t};\n\t\t// Show node\n\t\tcb.show = function () {\n\t\t\tnodeLoop(function (elm) {\n\t\t\t\tshowCss(elm);\n\t\t\t}, nodes);\n\t\t\treturn cb;\n\t\t};\n\t\t// Toggle node display\n\t\tcb.toggle = function (state) {\n\t\t\tif (typeof state != 'undefined') { // ADDED\n\t\t\t\tif (state)\n\t\t\t\t\tcb.show();\n\t\t\t\telse\n\t\t\t\t\tcb.hide();\n\t\t\t} else {\n\t\t\t\tnodeLoop(function (elm) {\n\t\t\t\t\t// computeStyle instead of style.display == 'none' catches elements that are hidden via style block\n\t\t\t\t\tif (computeStyle(elm, 'display') === 'none') {\n\t\t\t\t\t\tshowCss(elm);\n\t\t\t\t\t} else {\n\t\t\t\t\t\telm.style.display = 'none';\n\t\t\t\t\t}\n\n\t\t\t\t}, nodes);\n\t\t\t}\n\t\t\treturn cb;\n\t\t};\n\t\t// Remove node\n\t\tcb.remove = function () {\n\t\t\tnodeLoop(function (elm) {\n\t\t\t\t// Catch error in unlikely case elm has been removed\n\t\t\t\ttry {\n\t\t\t\t\telm.parentNode.removeChild(elm);\n\t\t\t\t} catch (e) {\n\t\t\t\t}\n\t\t\t}, nodes);\n\t\t\treturn chibi();\n\t\t};\n\t\t// Get/Set CSS\n\t\tcb.css = function (property, value) {\n\t\t\tif (property) {\n\t\t\t\tif (value || value === '') {\n\t\t\t\t\tnodeLoop(function (elm) {\n\t\t\t\t\t\tsetCss(elm, property, value);\n\t\t\t\t\t}, nodes);\n\t\t\t\t\treturn cb;\n\t\t\t\t}\n\t\t\t\tif (nodes[0]) {\n\t\t\t\t\tif (nodes[0].style[cssCamel(property)]) {\n\t\t\t\t\t\treturn nodes[0].style[cssCamel(property)];\n\t\t\t\t\t}\n\t\t\t\t\tif (computeStyle(nodes[0], property)) {\n\t\t\t\t\t\treturn computeStyle(nodes[0], property);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t\t// Get class(es)\n\t\tcb.getClass = function () {\n\t\t\tif (nodes[0] && nodes[0].className.length > 0) {\n\t\t\t\t// Weak IE trim support\n\t\t\t\treturn nodes[0].className.replace(/^[\\s\\uFEFF\\xA0]+|[\\s\\uFEFF\\xA0]+$/g, '').replace(/\\s+/, ' ');\n\t\t\t}\n\t\t};\n\t\t// Set (replaces) classes\n\t\tcb.setClass = function (classes) {\n\t\t\tif (classes || classes === '') {\n\t\t\t\tnodeLoop(function (elm) {\n\t\t\t\t\telm.className = classes;\n\t\t\t\t}, nodes);\n\t\t\t}\n\t\t\treturn cb;\n\t\t};\n\t\t// Add class\n\t\tcb.addClass = function (classes) {\n\t\t\tclassHelper(classes, 'add', nodes);\n\t\t\t// if (classes) {\n\t\t\t// \tnodeLoop(function (elm) {\n\t\t\t// \t\telm.className += ' ' + classes;\n\t\t\t// \t}, nodes);\n\t\t\t// }\n\t\t\treturn cb;\n\t\t};\n\t\t// Remove class\n\t\tcb.removeClass = function (classes) {\n\t\t\tclassHelper(classes, 'remove', nodes);\n\t\t\treturn cb;\n\t\t};\n\t\t// Toggle class\n\t\tcb.toggleClass = function (classes, set) {\n\t\t\tvar method = ((typeof set === 'undefined') ? 'toggle' : (+set ? 'add' : 'remove'));\n\t\t\tclassHelper(classes, method, nodes);\n\t\t\treturn cb;\n\t\t};\n\t\t// Has class\n\t\tcb.hasClass = function (classes) {\n\t\t\treturn classHelper(classes, 'has', nodes);\n\t\t};\n\t\t// Get/set HTML\n\t\tcb.html = function (value) {\n\t\t\tif (value || value === '') {\n\t\t\t\tnodeLoop(function (elm) {\n\t\t\t\t\telm.innerHTML = value;\n\t\t\t\t}, nodes);\n\t\t\t\treturn cb;\n\t\t\t}\n\t\t\tif (nodes[0]) {\n\t\t\t\treturn nodes[0].innerHTML;\n\t\t\t}\n\t\t};\n\t\t// Insert HTML before selector\n\t\tcb.htmlBefore = function (value) {\n\t\t\tinsertHtml(value, 'before', nodes);\n\t\t\treturn cb;\n\t\t};\n\t\t// Insert HTML after selector\n\t\tcb.htmlAfter = function (value) {\n\t\t\tinsertHtml(value, 'after', nodes);\n\t\t\treturn cb;\n\t\t};\n\t\t// Insert HTML after selector innerHTML\n\t\tcb.htmlAppend = function (value) {\n\t\t\tinsertHtml(value, 'append', nodes);\n\t\t\treturn cb;\n\t\t};\n\t\t// Insert HTML before selector innerHTML\n\t\tcb.htmlPrepend = function (value) {\n\t\t\tinsertHtml(value, 'prepend', nodes);\n\t\t\treturn cb;\n\t\t};\n\t\t// Get/Set HTML attributes\n\t\tcb.attr = function (property, value) {\n\t\t\tif (property) {\n\t\t\t\tproperty = property.toLowerCase();\n\t\t\t\t// IE < 9 doesn't allow style or class via get/setAttribute so switch. cssText returns prettier CSS anyway\n\t\t\t\tif (typeof value !== 'undefined') {//FIXED BUG HERE\n\t\t\t\t\tnodeLoop(function (elm) {\n\t\t\t\t\t\tif (property === 'style') {\n\t\t\t\t\t\t\telm.style.cssText = value;\n\t\t\t\t\t\t} else if (property === 'class') {\n\t\t\t\t\t\t\telm.className = value;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\telm.setAttribute(property, value);\n\t\t\t\t\t\t}\n\t\t\t\t\t}, nodes);\n\t\t\t\t\treturn cb;\n\t\t\t\t}\n\t\t\t\tif (nodes[0]) {\n\t\t\t\t\tif (property === 'style') {\n\t\t\t\t\t\tif (nodes[0].style.cssText) {\n\t\t\t\t\t\t\treturn nodes[0].style.cssText;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (property === 'class') {\n\t\t\t\t\t\tif (nodes[0].className) {\n\t\t\t\t\t\t\treturn nodes[0].className;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif (nodes[0].getAttribute(property)) {\n\t\t\t\t\t\t\treturn nodes[0].getAttribute(property);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t\t// Get/Set HTML data property\n\t\tcb.data = function (key, value) {\n\t\t\tif (key) {\n\t\t\t\treturn cb.attr('data-' + key, value);\n\t\t\t}\n\t\t};\n\t\t// Get/Set form element values\n\t\tcb.val = function (value) {\n\t\t\tvar values, i, j;\n\t\t\tif (typeof value != 'undefined') { // FIXED A BUG HERE\n\t\t\t\tnodeLoop(function (elm) {\n\t\t\t\t\tswitch (elm.nodeName) {\n\t\t\t\t\t\tcase 'SELECT':\n\t\t\t\t\t\t\tif (typeof value === 'string' || typeof value === 'number') {\n\t\t\t\t\t\t\t\tvalue = [value];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tfor (i = 0; i < elm.length; i += 1) {\n\t\t\t\t\t\t\t\t// Multiple select\n\t\t\t\t\t\t\t\tfor (j = 0; j < value.length; j += 1) {\n\t\t\t\t\t\t\t\t\telm[i].selected = '';\n\t\t\t\t\t\t\t\t\tif (elm[i].value === \"\"+value[j]) {\n\t\t\t\t\t\t\t\t\t\telm[i].selected = 'selected';\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 'INPUT':\n\t\t\t\t\t\tcase 'TEXTAREA':\n\t\t\t\t\t\tcase 'BUTTON':\n\t\t\t\t\t\t\telm.value = value;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}, nodes);\n\n\t\t\t\treturn cb;\n\t\t\t}\n\t\t\tif (nodes[0]) {\n\t\t\t\tswitch (nodes[0].nodeName) {\n\t\t\t\t\tcase 'SELECT':\n\t\t\t\t\t\tvalues = [];\n\t\t\t\t\t\tfor (i = 0; i < nodes[0].length; i += 1) {\n\t\t\t\t\t\t\tif (nodes[0][i].selected) {\n\t\t\t\t\t\t\t\tvalues.push(nodes[0][i].value);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn (values.length > 1) ? values : values[0];\n\t\t\t\t\tcase 'INPUT':\n\t\t\t\t\tcase 'TEXTAREA':\n\t\t\t\t\tcase 'BUTTON':\n\t\t\t\t\t\treturn nodes[0].value;\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t\t// Return matching checked checkbox or radios\n\t\tcb.checked = function (check) {\n\t\t\tif (typeof check === 'boolean') {\n\t\t\t\tnodeLoop(function (elm) {\n\t\t\t\t\tif (elm.nodeName === 'INPUT' && (elm.type === 'checkbox' || elm.type === 'radio')) {\n\t\t\t\t\t\telm.checked = check;\n\t\t\t\t\t}\n\t\t\t\t}, nodes);\n\t\t\t\treturn cb;\n\t\t\t}\n\t\t\tif (nodes[0] && nodes[0].nodeName === 'INPUT' && (nodes[0].type === 'checkbox' || nodes[0].type === 'radio')) {\n\t\t\t\treturn (!!nodes[0].checked);\n\t\t\t}\n\t\t};\n\t\t// Add event handler\n\t\tcb.on = function (event, fn) {\n\t\t\tif (selector === w || selector === d) {\n\t\t\t\tnodes = [selector];\n\t\t\t}\n\t\t\tnodeLoop(function (elm) {\n\t\t\t\tif (d.addEventListener) {\n\t\t\t\t\telm.addEventListener(event, fn, false);\n\t\t\t\t} else if (d.attachEvent) {\n\t\t\t\t\t// <= IE 8 loses scope so need to apply, we add this to object so we can detach later (can't detach anonymous functions)\n\t\t\t\t\telm[event + fn] = function () {\n\t\t\t\t\t\treturn fn.apply(elm, arguments);\n\t\t\t\t\t};\n\t\t\t\t\telm.attachEvent('on' + event, elm[event + fn]);\n\t\t\t\t}\n\t\t\t}, nodes);\n\t\t\treturn cb;\n\t\t};\n\t\t// Remove event handler\n\t\tcb.off = function (event, fn) {\n\t\t\tif (selector === w || selector === d) {\n\t\t\t\tnodes = [selector];\n\t\t\t}\n\t\t\tnodeLoop(function (elm) {\n\t\t\t\tif (d.addEventListener) {\n\t\t\t\t\telm.removeEventListener(event, fn, false);\n\t\t\t\t} else if (d.attachEvent) {\n\t\t\t\t\telm.detachEvent('on' + event, elm[event + fn]);\n\t\t\t\t\t// Tidy up\n\t\t\t\t\telm[event + fn] = null;\n\t\t\t\t}\n\t\t\t}, nodes);\n\t\t\treturn cb;\n\t\t};\n\t\treturn cb;\n\t}\n\n\t// Basic XHR\n\tchibi.ajax = function (options) { // if options is a number, it's timeout in ms\n\t\tvar opts = Object.assign({\n\t\t\tmethod: 'GET',\n\t\t\tnocache: true,\n\t\t\ttimeout: 5000,\n\t\t\tloader: true,\n\t\t\tcallback: null\n\t\t}, options);\n\t\topts.method = opts.method.toUpperCase();\n\n\t\tvar loaderFn = opts.loader ? chibi._loader : function(){};\n\t\tvar url = opts.url;\n\t\tvar method = opts.method;\n\t\tvar query = null;\n\n\t\tif (opts.data) {\n\t\t\tquery = serializeData(opts.data);\n\t\t}\n\n\t\tif (query && (method === 'GET')) {\n\t\t\turl += (url.indexOf('?') === -1) ? '?' + query : '&' + query;\n\t\t\tquery = null;\n\t\t}\n\n\t\tvar xhr = new XMLHttpRequest();\n\n\t\t// prevent caching\n\t\tif (opts.nocache) {\n\t\t\tvar ts = (+(new Date())).toString(36);\n\t\t\turl += ((url.indexOf('?') === -1) ? '?' : '&') + '_=' + ts;\n\t\t}\n\n\t\tloaderFn(true);\n\n\t\txhr.open(method, url, true);\n\t\txhr.timeout = opts.timeout;\n\n\t\t// Abort after given timeout\n\t\tvar abortTmeo = setTimeout(function () {\n\t\t\tconsole.error(\"XHR timed out.\");\n\t\t\txhr.abort();\n\t\t\tloaderFn(false);\n\t\t}, opts.timeout + 10);\n\n\t\txhr.onreadystatechange = function () {\n\t\t\tif (xhr.readyState === 4) {\n\t\t\t\tloaderFn(false);\n\n\t\t\t\topts.callback && opts.callback(xhr.responseText, xhr.status);\n\n\t\t\t\tclearTimeout(abortTmeo);\n\t\t\t}\n\t\t};\n\n\t\txhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');\n\t\tif (method === 'POST') {\n\t\t\txhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');\n\t\t}\n\n\t\txhr.send(query);\n\t\treturn xhr;\n\t};\n\n\tchibi._loader = function(){};\n\n\t// Alias to cb.ajax(url, 'get', callback)\n\tchibi.get = function (url, callback, opts) {\n\t\topts = opts || {};\n\t\topts.url = url;\n\t\topts.callback = callback;\n\t\topts.method = 'GET';\n\t\treturn chibi.ajax(opts);\n\t};\n\n\t// Alias to cb.ajax(url, 'post', callback)\n\tchibi.post = function (url, callback, opts) {\n\t\topts = opts || {};\n\t\topts.url = url;\n\t\topts.callback = callback;\n\t\topts.method = 'POST';\n\t\treturn chibi.ajax(opts);\n\t};\n\n\t// Fire on DOM ready\n\tchibi.ready = function (fn) {\n\t\tif (fn) {\n\t\t\tif (domready) {\n\t\t\t\tfn();\n\t\t\t\treturn chibi;\n\t\t\t} else {\n\t\t\t\treadyfn.push(fn);\n\t\t\t}\n\t\t}\n\t};\n\n\t// Fire on page loaded\n\tchibi.loaded = function (fn) {\n\t\tif (fn) {\n\t\t\tif (pageloaded) {\n\t\t\t\tfn();\n\t\t\t\treturn chibi;\n\t\t\t} else {\n\t\t\t\tloadedfn.push(fn);\n\t\t\t}\n\t\t}\n\t};\n\n\tvar entityMap = {\n\t\t'&': '&',\n\t\t'<': '<',\n\t\t'>': '>',\n\t\t'\"': '"',\n\t\t\"'\": ''',\n\t\t'/': '/',\n\t\t'`': '`',\n\t\t'=': '='\n\t};\n\n\tchibi.htmlEscape = function(string) {\n\t\treturn String(string).replace(/[&<>\"'`=\\/]/g, function (s) {\n\t\t\treturn entityMap[s];\n\t\t});\n\t};\n\n\t// Set Chibi's global namespace here ($)\n\tmodule.exports = chibi;\n}());\n\n\n\n// WEBPACK FOOTER //\n// ./js/lib/chibi.js","const $ = require('./lib/chibi')\n\n/** Module for toggling a modal overlay */\nlet modal = {}\nlet curCloseCb = null\n\nmodal.show = function (sel, closeCb) {\n let $m = $(sel)\n $m.removeClass('hidden visible')\n setTimeout(function () {\n $m.addClass('visible')\n }, 1)\n curCloseCb = closeCb\n}\n\nmodal.hide = function (sel) {\n let $m = $(sel)\n $m.removeClass('visible')\n setTimeout(function () {\n $m.addClass('hidden')\n if (curCloseCb) curCloseCb()\n }, 500) // transition time\n}\n\nmodal.init = function () {\n // close modal by click outside the dialog\n $('.Modal').on('click', function () {\n if ($(this).hasClass('no-close')) return // this is a no-close modal\n modal.hide(this)\n })\n\n $('.Dialog').on('click', function (e) {\n e.stopImmediatePropagation()\n })\n\n // Hide all modals on esc\n $(window).on('keydown', function (e) {\n if (e.which === 27) {\n modal.hide('.Modal')\n }\n })\n}\n\nmodule.exports = modal\n\n\n\n// WEBPACK FOOTER //\n// ./js/modal.js","const $ = require('./lib/chibi')\nconst modal = require('./modal')\n\nlet nt = {}\nconst sel = '#notif'\nlet $balloon\n\nlet timerHideBegin // timeout to start hiding (transition)\nlet timerHideEnd // timeout to add the hidden class\nlet canCancel = false\n\nlet stopTimeouts = function () {\n clearTimeout(timerHideBegin)\n clearTimeout(timerHideEnd)\n}\n\nnt.show = function (message, timeout, isError) {\n $balloon.toggleClass('error', isError === true)\n $balloon.html(message)\n modal.show($balloon)\n stopTimeouts()\n\n if (!timeout || timeout <= 0) {\n timeout = 2500\n }\n\n timerHideBegin = setTimeout(nt.hide, timeout)\n\n canCancel = false\n setTimeout(() => {\n canCancel = true\n }, 500)\n}\n\nnt.hide = function () {\n let $m = $(sel)\n $m.removeClass('visible')\n timerHideEnd = setTimeout(function () {\n $m.addClass('hidden')\n }, 250) // transition time\n}\n\nnt.init = function () {\n $balloon = $(sel)\n\n // close by click outside\n $(document).on('click', function () {\n if (!canCancel) return\n nt.hide(this)\n })\n\n // click caused by selecting, prevent it from bubbling\n $balloon.on('click', function (e) {\n e.stopImmediatePropagation()\n return false\n })\n\n // stop fading if moused\n $balloon.on('mouseenter', function () {\n stopTimeouts()\n $balloon.removeClass('hidden').addClass('visible')\n })\n}\n\nmodule.exports = nt\n\n\n\n// WEBPACK FOOTER //\n// ./js/notif.js","\nconst themes = exports.themes = [\n [ // Tango\n '#111213', '#CC0000', '#4E9A06', '#C4A000', '#3465A4', '#75507B', '#06989A', '#D3D7CF',\n '#555753', '#EF2929', '#8AE234', '#FCE94F', '#729FCF', '#AD7FA8', '#34E2E2', '#EEEEEC'\n ],\n [ // Linux (CGA)\n '#000000', '#aa0000', '#00aa00', '#aa5500', '#0000aa', '#aa00aa', '#00aaaa', '#aaaaaa',\n '#555555', '#ff5555', '#55ff55', '#ffff55', '#5555ff', '#ff55ff', '#55ffff', '#ffffff'\n ],\n [ // xterm\n '#000000', '#cd0000', '#00cd00', '#cdcd00', '#0000ee', '#cd00cd', '#00cdcd', '#e5e5e5',\n '#7f7f7f', '#ff0000', '#00ff00', '#ffff00', '#5c5cff', '#ff00ff', '#00ffff', '#ffffff'\n ],\n [ // rxvt\n '#000000', '#cd0000', '#00cd00', '#cdcd00', '#0000cd', '#cd00cd', '#00cdcd', '#faebd7',\n '#404040', '#ff0000', '#00ff00', '#ffff00', '#0000ff', '#ff00ff', '#00ffff', '#ffffff'\n ],\n [ // Ambience\n '#2e3436', '#cc0000', '#4e9a06', '#c4a000', '#3465a4', '#75507b', '#06989a', '#d3d7cf',\n '#555753', '#ef2929', '#8ae234', '#fce94f', '#729fcf', '#ad7fa8', '#34e2e2', '#eeeeec'\n ],\n [ // Solarized light\n '#073642', '#dc322f', '#859900', '#b58900', '#268bd2', '#d33682', '#2aa198', '#eee8d5',\n '#002b36', '#cb4b16', '#586e75', '#657b83', '#839496', '#6c71c4', '#93a1a1', '#fdf6e3'\n ],\n [ // CGA NTSC\n '#000000', '#69001A', '#117800', '#769100', '#1A00A6', '#8019AB', '#289E76', '#A4A4A4',\n '#484848', '#C54E76', '#6DD441', '#D2ED46', '#765BFF', '#DC75FF', '#84FAD2', '#FFFFFF'\n ],\n [ // ZX Spectrum\n '#000000', '#aa0000', '#00aa00', '#aaaa00', '#0000aa', '#aa00aa', '#00aaaa', '#aaaaaa',\n '#000000', '#ff0000', '#00FF00', '#ffff00', '#0000ff', '#ff00ff', '#00ffff', '#ffffff'\n ],\n [ // Apple II\n '#000000', '#722640', '#0E5940', '#808080', '#40337F', '#E434FE', '#1B9AFE', '#BFB3FF',\n '#404C00', '#E46501', '#1BCB01', '#BFCC80', '#808080', '#F1A6BF', '#8DD9BF', '#ffffff'\n ],\n [ // Commodore\n '#000000', '#8D3E37', '#55A049', '#AAB95D', '#40318D', '#80348B', '#72C1C8', '#D59F74',\n '#8B5429', '#B86962', '#94E089', '#FFFFB2', '#8071CC', '#AA5FB6', '#87D6DD', '#ffffff'\n ]\n]\n\nexports.fgbgThemes = [\n ['#AAAAAA', '#000000'], // GREY_ON_BLACK\n ['#EFF0F1', '#31363B'], // BREEZE\n ['#FFFFFF', '#000000'], // WHITE_ON_BLACK\n ['#00FF00', '#000000'], // GREEN_ON_BLACK\n ['#E53C00', '#000000'], // ORANGE_ON_BLACK\n ['#FFFFFF', '#300A24'], // AMBIENCE\n ['#839496', '#002B36'], // SOLARIZED_DARK\n ['#657B83', '#FDF6E3'], // SOLARIZED_LIGHT\n ['#000000', '#FFFFDD'], // BLACK_ON_YELLOW\n ['#000000', '#FFFFFF'] // BLACK_ON_WHITE\n]\n\nlet colorTable256 = null\n\nexports.buildColorTable = function () {\n if (colorTable256 !== null) return colorTable256\n\n // 256color lookup table\n // should not be used to look up 0-15 (will return transparent)\n colorTable256 = new Array(16).fill('rgba(0, 0, 0, 0)')\n\n // fill color table\n // colors 16-231 are a 6x6x6 color cube\n for (let red = 0; red < 6; red++) {\n for (let green = 0; green < 6; green++) {\n for (let blue = 0; blue < 6; blue++) {\n let redValue = red * 40 + (red ? 55 : 0)\n let greenValue = green * 40 + (green ? 55 : 0)\n let blueValue = blue * 40 + (blue ? 55 : 0)\n colorTable256.push(`rgb(${redValue}, ${greenValue}, ${blueValue})`)\n }\n }\n }\n // colors 232-255 are a grayscale ramp, sans black and white\n for (let gray = 0; gray < 24; gray++) {\n let value = gray * 10 + 8\n colorTable256.push(`rgb(${value}, ${value}, ${value})`)\n }\n\n return colorTable256\n}\n\nexports.SELECTION_FG = '#333'\nexports.SELECTION_BG = '#b2d7fe'\n\nfunction resolveColor (themeN, shade) {\n shade = +shade\n if (shade < 16) shade = themes[themeN][shade]\n else {\n shade = exports.buildColorTable()[shade]\n }\n return shade\n}\n\nexports.themePreview = function (n) {\n document.querySelectorAll('[data-fg]').forEach((elem) => {\n let shade = elem.dataset.fg\n if (/^\\d+$/.test(shade)) shade = resolveColor(n, shade)\n elem.style.color = shade\n })\n document.querySelectorAll('[data-bg]').forEach((elem) => {\n let shade = elem.dataset.bg\n if (/^\\d+$/.test(shade)) shade = resolveColor(n, shade)\n elem.style.backgroundColor = shade\n })\n}\n\n\n\n// WEBPACK FOOTER //\n// ./js/term/themes.js","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nfunction EventEmitter() {\n this._events = this._events || {};\n this._maxListeners = this._maxListeners || undefined;\n}\nmodule.exports = EventEmitter;\n\n// Backwards-compat with node 0.10.x\nEventEmitter.EventEmitter = EventEmitter;\n\nEventEmitter.prototype._events = undefined;\nEventEmitter.prototype._maxListeners = undefined;\n\n// By default EventEmitters will print a warning if more than 10 listeners are\n// added to it. This is a useful default which helps finding memory leaks.\nEventEmitter.defaultMaxListeners = 10;\n\n// Obviously not all Emitters should be limited to 10. This function allows\n// that to be increased. Set to zero for unlimited.\nEventEmitter.prototype.setMaxListeners = function(n) {\n if (!isNumber(n) || n < 0 || isNaN(n))\n throw TypeError('n must be a positive number');\n this._maxListeners = n;\n return this;\n};\n\nEventEmitter.prototype.emit = function(type) {\n var er, handler, len, args, i, listeners;\n\n if (!this._events)\n this._events = {};\n\n // If there is no 'error' event listener then throw.\n if (type === 'error') {\n if (!this._events.error ||\n (isObject(this._events.error) && !this._events.error.length)) {\n er = arguments[1];\n if (er instanceof Error) {\n throw er; // Unhandled 'error' event\n } else {\n // At least give some kind of context to the user\n var err = new Error('Uncaught, unspecified \"error\" event. (' + er + ')');\n err.context = er;\n throw err;\n }\n }\n }\n\n handler = this._events[type];\n\n if (isUndefined(handler))\n return false;\n\n if (isFunction(handler)) {\n switch (arguments.length) {\n // fast cases\n case 1:\n handler.call(this);\n break;\n case 2:\n handler.call(this, arguments[1]);\n break;\n case 3:\n handler.call(this, arguments[1], arguments[2]);\n break;\n // slower\n default:\n args = Array.prototype.slice.call(arguments, 1);\n handler.apply(this, args);\n }\n } else if (isObject(handler)) {\n args = Array.prototype.slice.call(arguments, 1);\n listeners = handler.slice();\n len = listeners.length;\n for (i = 0; i < len; i++)\n listeners[i].apply(this, args);\n }\n\n return true;\n};\n\nEventEmitter.prototype.addListener = function(type, listener) {\n var m;\n\n if (!isFunction(listener))\n throw TypeError('listener must be a function');\n\n if (!this._events)\n this._events = {};\n\n // To avoid recursion in the case that type === \"newListener\"! Before\n // adding it to the listeners, first emit \"newListener\".\n if (this._events.newListener)\n this.emit('newListener', type,\n isFunction(listener.listener) ?\n listener.listener : listener);\n\n if (!this._events[type])\n // Optimize the case of one listener. Don't need the extra array object.\n this._events[type] = listener;\n else if (isObject(this._events[type]))\n // If we've already got an array, just append.\n this._events[type].push(listener);\n else\n // Adding the second element, need to change to array.\n this._events[type] = [this._events[type], listener];\n\n // Check for listener leak\n if (isObject(this._events[type]) && !this._events[type].warned) {\n if (!isUndefined(this._maxListeners)) {\n m = this._maxListeners;\n } else {\n m = EventEmitter.defaultMaxListeners;\n }\n\n if (m && m > 0 && this._events[type].length > m) {\n this._events[type].warned = true;\n console.error('(node) warning: possible EventEmitter memory ' +\n 'leak detected. %d listeners added. ' +\n 'Use emitter.setMaxListeners() to increase limit.',\n this._events[type].length);\n if (typeof console.trace === 'function') {\n // not supported in IE 10\n console.trace();\n }\n }\n }\n\n return this;\n};\n\nEventEmitter.prototype.on = EventEmitter.prototype.addListener;\n\nEventEmitter.prototype.once = function(type, listener) {\n if (!isFunction(listener))\n throw TypeError('listener must be a function');\n\n var fired = false;\n\n function g() {\n this.removeListener(type, g);\n\n if (!fired) {\n fired = true;\n listener.apply(this, arguments);\n }\n }\n\n g.listener = listener;\n this.on(type, g);\n\n return this;\n};\n\n// emits a 'removeListener' event iff the listener was removed\nEventEmitter.prototype.removeListener = function(type, listener) {\n var list, position, length, i;\n\n if (!isFunction(listener))\n throw TypeError('listener must be a function');\n\n if (!this._events || !this._events[type])\n return this;\n\n list = this._events[type];\n length = list.length;\n position = -1;\n\n if (list === listener ||\n (isFunction(list.listener) && list.listener === listener)) {\n delete this._events[type];\n if (this._events.removeListener)\n this.emit('removeListener', type, listener);\n\n } else if (isObject(list)) {\n for (i = length; i-- > 0;) {\n if (list[i] === listener ||\n (list[i].listener && list[i].listener === listener)) {\n position = i;\n break;\n }\n }\n\n if (position < 0)\n return this;\n\n if (list.length === 1) {\n list.length = 0;\n delete this._events[type];\n } else {\n list.splice(position, 1);\n }\n\n if (this._events.removeListener)\n this.emit('removeListener', type, listener);\n }\n\n return this;\n};\n\nEventEmitter.prototype.removeAllListeners = function(type) {\n var key, listeners;\n\n if (!this._events)\n return this;\n\n // not listening for removeListener, no need to emit\n if (!this._events.removeListener) {\n if (arguments.length === 0)\n this._events = {};\n else if (this._events[type])\n delete this._events[type];\n return this;\n }\n\n // emit removeListener for all listeners on all events\n if (arguments.length === 0) {\n for (key in this._events) {\n if (key === 'removeListener') continue;\n this.removeAllListeners(key);\n }\n this.removeAllListeners('removeListener');\n this._events = {};\n return this;\n }\n\n listeners = this._events[type];\n\n if (isFunction(listeners)) {\n this.removeListener(type, listeners);\n } else if (listeners) {\n // LIFO order\n while (listeners.length)\n this.removeListener(type, listeners[listeners.length - 1]);\n }\n delete this._events[type];\n\n return this;\n};\n\nEventEmitter.prototype.listeners = function(type) {\n var ret;\n if (!this._events || !this._events[type])\n ret = [];\n else if (isFunction(this._events[type]))\n ret = [this._events[type]];\n else\n ret = this._events[type].slice();\n return ret;\n};\n\nEventEmitter.prototype.listenerCount = function(type) {\n if (this._events) {\n var evlistener = this._events[type];\n\n if (isFunction(evlistener))\n return 1;\n else if (evlistener)\n return evlistener.length;\n }\n return 0;\n};\n\nEventEmitter.listenerCount = function(emitter, type) {\n return emitter.listenerCount(type);\n};\n\nfunction isFunction(arg) {\n return typeof arg === 'function';\n}\n\nfunction isNumber(arg) {\n return typeof arg === 'number';\n}\n\nfunction isObject(arg) {\n return typeof arg === 'object' && arg !== null;\n}\n\nfunction isUndefined(arg) {\n return arg === void 0;\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/events/events.js\n// module id = 5\n// module chunks = 0","const EventEmitter = require('events')\nconst { parse2B } = require('../utils')\nconst { themes } = require('./themes')\n\nclass ANSIParser {\n constructor (handler) {\n this.reset()\n this.handler = handler\n this.joinChunks = true\n }\n reset () {\n this.currentSequence = 0\n this.sequence = ''\n }\n parseSequence (sequence) {\n if (sequence[0] === '[') {\n let type = sequence[sequence.length - 1]\n let content = sequence.substring(1, sequence.length - 1)\n\n let numbers = content ? content.split(';').map(i => +i.replace(/\\D/g, '')) : []\n let numOr1 = numbers.length ? numbers[0] : 1\n if (type === 'H') {\n this.handler('set-cursor', (numbers[0] | 0) - 1, (numbers[1] | 0) - 1)\n } else if (type >= 'A' && type <= 'D') {\n this.handler(`move-cursor-${type <= 'B' ? 'y' : 'x'}`, ((type === 'B' || type === 'C') ? 1 : -1) * numOr1)\n } else if (type === 'E' || type === 'F') {\n this.handler('move-cursor-line', (type === 'E' ? 1 : -1) * numOr1)\n } else if (type === 'G') {\n this.handler('set-cursor-x', numOr1 - 1)\n } else if (type === 'J') {\n let number = numbers.length ? numbers[0] : 2\n if (number === 2) this.handler('clear')\n } else if (type === 'P') {\n this.handler('delete', numOr1)\n } else if (type === '@') {\n this.handler('insert-blanks', numOr1)\n } else if (type === 'q') this.handler('set-cursor-style', numOr1)\n else if (type === 'm') {\n if (!numbers.length || numbers[0] === 0) {\n this.handler('reset-style')\n return\n }\n let type = numbers[0]\n if (type === 1) this.handler('add-attrs', 1) // bold\n else if (type === 2) this.handler('add-attrs', 1 << 1) // faint\n else if (type === 3) this.handler('add-attrs', 1 << 2) // italic\n else if (type === 4) this.handler('add-attrs', 1 << 3) // underline\n else if (type === 5 || type === 6) this.handler('add-attrs', 1 << 4) // blink\n else if (type === 7) this.handler('add-attrs', -1) // invert\n else if (type === 9) this.handler('add-attrs', 1 << 6) // strike\n else if (type === 20) this.handler('add-attrs', 1 << 5) // fraktur\n else if (type >= 30 && type <= 37) this.handler('set-color-fg', type % 10)\n else if (type >= 40 && type <= 47) this.handler('set-color-bg', type % 10)\n else if (type === 39) this.handler('reset-color-fg')\n else if (type === 49) this.handler('reset-color-bg')\n else if (type >= 90 && type <= 98) this.handler('set-color-fg', (type % 10) + 8)\n else if (type >= 100 && type <= 108) this.handler('set-color-bg', (type % 10) + 8)\n else if (type === 38 || type === 48) {\n if (numbers[1] === 5) {\n let color = (numbers[2] | 0) & 0xFF\n if (type === 38) this.handler('set-color-fg', color)\n if (type === 48) this.handler('set-color-bg', color)\n }\n }\n } else if (type === 'h' || type === 'l') {\n if (content === '?25') {\n if (type === 'h') this.handler('show-cursor')\n else if (type === 'l') this.handler('hide-cursor')\n }\n }\n }\n }\n write (text) {\n for (let character of text.toString()) {\n let code = character.codePointAt(0)\n if (code === 0x1b) this.currentSequence = 1\n else if (this.currentSequence === 1 && character === '[') {\n this.currentSequence = 2\n this.sequence += '['\n } else if (this.currentSequence && character.match(/[\\x40-\\x7e]/)) {\n this.parseSequence(this.sequence + character)\n this.currentSequence = 0\n this.sequence = ''\n } else if (this.currentSequence > 1) this.sequence += character\n else if (this.currentSequence === 1) {\n // something something nothing\n this.currentSequence = 0\n this.handler('write', character)\n } else if (code < 0x03) this.handler('_null')\n else if (code === 0x03) this.handler('sigint')\n else if (code <= 0x06) this.handler('_null')\n else if (code === 0x07) this.handler('bell')\n else if (code === 0x08) this.handler('back')\n else if (code === 0x09) this.handler('tab')\n else if (code === 0x0a) this.handler('new-line')\n else if (code === 0x0d) this.handler('return')\n else if (code === 0x15) this.handler('delete-line')\n else if (code === 0x17) this.handler('delete-word')\n else this.handler('write', character)\n }\n if (!this.joinChunks) this.reset()\n }\n}\nconst TERM_DEFAULT_STYLE = 0\nconst TERM_MIN_DRAW_DELAY = 10\n\nlet getRainbowColor = t => {\n let r = Math.floor(Math.sin(t) * 2.5 + 2.5)\n let g = Math.floor(Math.sin(t + 2 / 3 * Math.PI) * 2.5 + 2.5)\n let b = Math.floor(Math.sin(t + 4 / 3 * Math.PI) * 2.5 + 2.5)\n return 16 + 36 * r + 6 * g + b\n}\n\nclass ScrollingTerminal {\n constructor (screen) {\n this.width = 80\n this.height = 25\n this.termScreen = screen\n this.parser = new ANSIParser((...args) => this.handleParsed(...args))\n\n this.reset()\n\n this._lastLoad = Date.now()\n this.termScreen.load(this.serialize())\n\n window.showPage()\n }\n reset () {\n this.style = TERM_DEFAULT_STYLE\n this.cursor = { x: 0, y: 0, style: 1, visible: true }\n this.trackMouse = false\n this.theme = -1\n this.rainbow = false\n this.parser.reset()\n this.clear()\n }\n clear () {\n this.screen = []\n for (let i = 0; i < this.width * this.height; i++) {\n this.screen.push([' ', this.style])\n }\n }\n scroll () {\n this.screen.splice(0, this.width)\n for (let i = 0; i < this.width; i++) {\n this.screen.push([' ', TERM_DEFAULT_STYLE])\n }\n this.cursor.y--\n }\n newLine () {\n this.cursor.y++\n if (this.cursor.y >= this.height) this.scroll()\n }\n writeChar (character) {\n this.screen[this.cursor.y * this.width + this.cursor.x] = [character, this.style]\n this.cursor.x++\n if (this.cursor.x >= this.width) {\n this.cursor.x = 0\n this.newLine()\n }\n }\n moveBack (n = 1) {\n for (let i = 0; i < n; i++) {\n this.cursor.x--\n if (this.cursor.x < 0) {\n if (this.cursor.y > 0) this.cursor.x = this.width - 1\n else this.cursor.x = 0\n this.cursor.y = Math.max(0, this.cursor.y - 1)\n }\n }\n }\n moveForward (n = 1) {\n for (let i = 0; i < n; i++) {\n this.cursor.x++\n if (this.cursor.x >= this.width) {\n this.cursor.x = 0\n this.cursor.y++\n if (this.cursor.y >= this.height) this.scroll()\n }\n }\n }\n deleteChar () { // FIXME unused?\n this.moveBack()\n this.screen.splice((this.cursor.y + 1) * this.width, 0, [' ', TERM_DEFAULT_STYLE])\n this.screen.splice(this.cursor.y * this.width + this.cursor.x, 1)\n }\n deleteForward (n) {\n n = Math.min(this.width, n)\n for (let i = 0; i < n; i++) this.screen.splice((this.cursor.y + 1) * this.width, 0, [' ', TERM_DEFAULT_STYLE])\n this.screen.splice(this.cursor.y * this.width + this.cursor.x, n)\n }\n clampCursor () {\n if (this.cursor.x < 0) this.cursor.x = 0\n if (this.cursor.y < 0) this.cursor.y = 0\n if (this.cursor.x > this.width - 1) this.cursor.x = this.width - 1\n if (this.cursor.y > this.height - 1) this.cursor.y = this.height - 1\n }\n handleParsed (action, ...args) {\n if (action === 'write') {\n this.writeChar(args[0])\n } else if (action === 'delete') {\n this.deleteForward(args[0])\n } else if (action === 'insert-blanks') {\n this.insertBlanks(args[0]) // FIXME undefined?\n } else if (action === 'clear') {\n this.clear()\n } else if (action === 'bell') {\n this.termScreen.load('B')\n } else if (action === 'back') {\n this.moveBack()\n } else if (action === 'new-line') {\n this.newLine()\n } else if (action === 'return') {\n this.cursor.x = 0\n } else if (action === 'set-cursor') {\n this.cursor.x = args[1]\n this.cursor.y = args[0]\n this.clampCursor()\n } else if (action === 'move-cursor-y') {\n this.cursor.y += args[0]\n this.clampCursor()\n } else if (action === 'move-cursor-x') {\n this.cursor.x += args[0]\n this.clampCursor()\n } else if (action === 'move-cursor-line') {\n this.cursor.x = 0\n this.cursor.y += args[0]\n this.clampCursor()\n } else if (action === 'set-cursor-x') {\n this.cursor.x = args[0]\n } else if (action === 'set-cursor-style') {\n this.cursor.style = Math.max(0, Math.min(6, args[0]))\n } else if (action === 'reset-style') {\n this.style = TERM_DEFAULT_STYLE\n } else if (action === 'add-attrs') {\n this.style |= (args[0] << 16)\n } else if (action === 'set-color-fg') {\n this.style = (this.style & 0xFFFFFF00) | (1 << 8 << 16) | args[0]\n } else if (action === 'set-color-bg') {\n this.style = (this.style & 0xFFFF00FF) | (1 << 9 << 16) | (args[0] << 8)\n } else if (action === 'reset-color-fg') {\n this.style = this.style & 0xFFFEFF00\n } else if (action === 'reset-color-bg') {\n this.style = this.style & 0xFFFD00FF\n } else if (action === 'hide-cursor') {\n this.cursor.visible = false\n } else if (action === 'show-cursor') {\n this.cursor.visible = true\n }\n }\n write (text) {\n this.parser.write(text)\n this.scheduleLoad()\n }\n serialize () {\n let serialized = 'S'\n serialized += String.fromCodePoint(this.height + 1) + String.fromCodePoint(this.width + 1)\n serialized += String.fromCodePoint(this.cursor.y + 1) + String.fromCodePoint(this.cursor.x + 1)\n\n let attributes = +this.cursor.visible\n attributes |= (3 << 5) * +this.trackMouse // track mouse controls both\n attributes |= 3 << 7 // buttons/links always visible\n attributes |= (this.cursor.style << 9)\n serialized += String.fromCodePoint(attributes + 1)\n\n let lastStyle = null\n let index = 0\n for (let cell of this.screen) {\n let style = cell[1]\n if (this.rainbow) {\n let x = index % this.width\n let y = Math.floor(index / this.width)\n // C instead of F in mask and 1 << 8 in attrs to change attr bits 8 and 9\n style = (style & 0xFFFC0000) | (1 << 8 << 16) | getRainbowColor((x + y) / 10 + Date.now() / 1000)\n index++\n }\n if (style !== lastStyle) {\n let foreground = style & 0xFF\n let background = (style >> 8) & 0xFF\n let attributes = (style >> 16) & 0xFFFF\n let setForeground = foreground !== (lastStyle & 0xFF)\n let setBackground = background !== ((lastStyle >> 8) & 0xFF)\n let setAttributes = attributes !== ((lastStyle >> 16) & 0xFFFF)\n\n if (setForeground && setBackground) serialized += '\\x03' + String.fromCodePoint((style & 0xFFFF) + 1)\n else if (setForeground) serialized += '\\x05' + String.fromCodePoint(foreground + 1)\n else if (setBackground) serialized += '\\x06' + String.fromCodePoint(background + 1)\n if (setAttributes) serialized += '\\x04' + String.fromCodePoint(attributes + 1)\n lastStyle = style\n }\n serialized += cell[0]\n }\n return serialized\n }\n scheduleLoad () {\n clearTimeout(this._scheduledLoad)\n if (this._lastLoad < Date.now() - TERM_MIN_DRAW_DELAY) {\n this.termScreen.load(this.serialize(), { theme: this.theme })\n this.theme = -1 // prevent useless theme setting next time\n } else {\n this._scheduledLoad = setTimeout(() => {\n this.termScreen.load(this.serialize())\n }, TERM_MIN_DRAW_DELAY - this._lastLoad)\n }\n }\n rainbowTimer () {\n if (!this.rainbow) return\n clearInterval(this._rainbowTimer)\n this._rainbowTimer = setInterval(() => {\n if (this.rainbow) this.scheduleLoad()\n }, 50)\n }\n}\n\nclass Process extends EventEmitter {\n write (data) {\n this.emit('in', data)\n }\n destroy () {\n // death.\n this.emit('exit', 0)\n }\n run () {\n // noop\n }\n}\n\nlet demoData = {\n buttons: {\n 1: '',\n 2: '',\n 3: '',\n 4: '',\n 5: function (terminal, shell) {\n if (shell.child) shell.child.destroy()\n let chars = 'info\\r'\n let loop = function () {\n shell.write(chars[0])\n chars = chars.substr(1)\n if (chars) setTimeout(loop, 100)\n }\n setTimeout(loop, 200)\n }\n },\n mouseReceiver: null\n}\n\nlet demoshIndex = {\n clear: class Clear extends Process {\n run () {\n this.emit('write', '\\x1b[2J\\x1b[1;1H')\n this.destroy()\n }\n },\n screenfetch: class Screenfetch extends Process {\n run () {\n let image = `\n ###. ESPTerm Demo\n '###. Hostname: ${window.location.hostname}\n '###. Shell: ESPTerm Demo Shell\n '###. Resolution: 80x25@${window.devicePixelRatio}x\n :###-\n .###'\n .###'\n .###' ###############\n ###' ###############\n `.split('\\n').filter(line => line.trim())\n\n let chars = ''\n for (let y = 0; y < image.length; y++) {\n for (let x = 0; x < 80; x++) {\n if (image[y][x]) {\n chars += `\\x1b[38;5;${getRainbowColor((x + y) / 10)}m${image[y][x]}`\n } else chars += ' '\n }\n }\n\n this.emit('write', '\\r\\n\\x1b[?25l')\n let loop = () => {\n this.emit('write', chars.substr(0, 80))\n chars = chars.substr(80)\n if (chars.length) setTimeout(loop, 50)\n else {\n this.emit('write', '\\r\\n\\x1b[?25h')\n this.destroy()\n }\n }\n loop()\n }\n },\n 'local-echo': class LocalEcho extends Process {\n run (...args) {\n if (!args.includes('--suppress-note')) {\n this.emit('write', '\\x1b[38;5;239mNote: not all terminal features are supported or and may not work as expected in this demo\\x1b[0m\\r\\n')\n }\n }\n write (data) {\n this.emit('write', data)\n }\n },\n 'info': class Info extends Process {\n run (...args) {\n let fast = args.includes('--fast')\n this.showSplash().then(() => {\n this.printText(fast)\n })\n }\n showSplash () {\n let splash = `\n -#####- -###*..#####- ######-\n -#* -#- .## .##. *#-\n -##### .-###*..#####- *#- -*##*- #*-#--#**#-*##-\n -#* -#-.##. *#- *##@#* ##. -#* *# .#*\n -#####--####- .##. *#- -*#@@- ##. -#* *# .#*\n `.split('\\n').filter(line => line.trim())\n let levels = {\n ' ': -231,\n '.': 4,\n '-': 8,\n '*': 17,\n '#': 24\n }\n let characters = {\n ' ': ' ',\n '.': '░',\n '-': '▒',\n '*': '▓',\n '#': '█'\n }\n for (let i in splash) {\n if (splash[i].length < 79) splash[i] += ' '.repeat(79 - splash[i].length)\n }\n this.emit('write', '\\r\\n'.repeat(splash.length + 1))\n this.emit('write', '\\x1b[A'.repeat(splash.length))\n this.emit('write', '\\x1b[?25l')\n\n let cursorX = 0\n let cursorY = 0\n let moveTo = (x, y) => {\n let moveX = x - cursorX\n let moveY = y - cursorY\n this.emit('write', `\\x1b[${Math.abs(moveX)}${moveX > 0 ? 'C' : 'D'}`)\n this.emit('write', `\\x1b[${Math.abs(moveY)}${moveY > 0 ? 'B' : 'A'}`)\n cursorX = x\n cursorY = y\n }\n let drawCell = (x, y) => {\n moveTo(x, y)\n if (splash[y][x] === '@') {\n this.emit('write', '\\x1b[48;5;238m\\x1b[38;5;255m▄\\b')\n } else {\n let level = 231 + levels[splash[y][x]]\n let character = characters[splash[y][x]]\n this.emit('write', `\\x1b[48;5;${level}m\\x1b[38;5;${level}m${character}\\b`)\n }\n }\n return new Promise((resolve, reject) => {\n const self = this\n let x = 14\n let cycles = 0\n let loop = function () {\n for (let y = 0; y < splash.length; y++) {\n let dx = x - y\n if (dx > 0) drawCell(dx, y)\n }\n\n if (++x < 69) {\n if (++cycles >= 3) {\n setTimeout(loop, 20)\n cycles = 0\n } else loop()\n } else {\n moveTo(0, splash.length)\n self.emit('write', '\\x1b[m\\x1b[?25h')\n resolve()\n }\n }\n loop()\n })\n }\n printText (fast = false) {\n // lots of printing\n let parts = [\n '',\n ' ESPTerm is a VT100-like terminal emulator running on the ESP8266 WiFi chip.',\n '',\n ' \\x1b[93mThis is an online demo of the web user interface, simulating a simple ',\n ' terminal in your browser.\\x1b[m',\n '',\n ' Type \\x1b[92mls\\x1b[m to list available commands.',\n ' Use the \\x1b[94mlinks\\x1b[m below this screen for a demo of the options and more info.',\n ''\n ]\n\n if (fast) {\n this.emit('write', parts.join('\\r\\n') + '\\r\\n')\n this.destroy()\n } else {\n const self = this\n let loop = function () {\n self.emit('write', parts.shift() + '\\r\\n')\n if (parts.length) setTimeout(loop, 17)\n else self.destroy()\n }\n loop()\n }\n }\n },\n colors: class PrintColors extends Process {\n run () {\n this.emit('write', '\\r\\n')\n let fgtext = 'foreground-color'\n this.emit('write', ' ')\n for (let i = 0; i < 16; i++) {\n this.emit('write', '\\x1b[' + (i < 8 ? `3${i}` : `9${i - 8}`) + 'm')\n this.emit('write', fgtext[i] + ' ')\n }\n this.emit('write', '\\r\\n ')\n for (let i = 0; i < 16; i++) {\n this.emit('write', '\\x1b[' + (i < 8 ? `4${i}` : `10${i - 8}`) + 'm ')\n }\n this.emit('write', '\\x1b[m\\r\\n')\n for (let r = 0; r < 6; r++) {\n this.emit('write', ' ')\n for (let g = 0; g < 6; g++) {\n for (let b = 0; b < 6; b++) {\n this.emit('write', `\\x1b[48;5;${16 + r * 36 + g * 6 + b}m `)\n }\n this.emit('write', '\\x1b[m')\n }\n this.emit('write', '\\r\\n')\n }\n this.emit('write', ' ')\n for (let g = 0; g < 24; g++) {\n this.emit('write', `\\x1b[48;5;${232 + g}m `)\n }\n this.emit('write', '\\x1b[m\\r\\n\\n')\n this.destroy()\n }\n },\n ls: class ListCommands extends Process {\n run () {\n this.emit('write', '\\x1b[92mList of demo commands\\x1b[m\\r\\n')\n for (let i in demoshIndex) {\n if (typeof demoshIndex[i] === 'string') continue\n this.emit('write', i + '\\r\\n')\n }\n this.destroy()\n }\n },\n theme: class SetTheme extends Process {\n constructor (shell) {\n super()\n this.shell = shell\n }\n run (...args) {\n let theme = +args[0] | 0\n const maxnum = themes.length\n if (!args.length || !Number.isFinite(theme) || theme < 0 || theme >= maxnum) {\n this.emit('write', `\\x1b[31mUsage: theme [0–${maxnum - 1}]\\r\\n`)\n this.destroy()\n return\n }\n this.shell.terminal.theme = theme\n // HACK: reset drawn screen to prevent only partly redrawn screen\n this.shell.terminal.termScreen.drawnScreenFG = []\n this.emit('write', '')\n this.destroy()\n }\n },\n cursor: class SetCursor extends Process {\n run (...args) {\n let steady = args.includes('--steady')\n if (args.includes('block')) {\n this.emit('write', `\\x1b[${2 * steady} q`)\n } else if (args.includes('line')) {\n this.emit('write', `\\x1b[${3 + steady} q`)\n } else if (args.includes('bar') || args.includes('beam')) {\n this.emit('write', `\\x1b[${5 + steady} q`)\n } else {\n this.emit('write', '\\x1b[31mUsage: cursor [block|line|bar] [--steady]\\r\\n')\n }\n this.destroy()\n }\n },\n rainbow: class ToggleRainbow extends Process {\n constructor (shell) {\n super()\n this.shell = shell\n }\n run () {\n this.shell.terminal.rainbow = !this.shell.terminal.rainbow\n this.shell.terminal.rainbowTimer()\n this.emit('write', '')\n this.destroy()\n }\n },\n mouse: class ShowMouse extends Process {\n constructor (shell) {\n super()\n this.shell = shell\n }\n run () {\n this.shell.terminal.trackMouse = true\n demoData.mouseReceiver = this\n this.randomData = []\n this.highlighted = {}\n let characters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'\n for (let i = 0; i < 23; i++) {\n let line = ''\n for (let j = 0; j < 79; j++) {\n line += characters[Math.floor(characters.length * Math.random())]\n }\n this.randomData.push(line)\n }\n this.scrollOffset = 0\n this.render()\n }\n render () {\n this.emit('write', '\\x1b[m\\x1b[2J\\x1b[1;1H')\n this.emit('write', '\\x1b[97m\\x1b[1mMouse Demo\\r\\n\\x1b[mMouse movement, clicking and scrolling!')\n\n // render random data for scrolling\n for (let y = 0; y < 23; y++) {\n let index = y + this.scrollOffset\n // proper modulo:\n index = ((index % this.randomData.length) + this.randomData.length) % this.randomData.length\n let line = this.randomData[index]\n let lineData = `\\x1b[${3 + y};1H\\x1b[38;5;239m`\n for (let x in line) {\n if (this.highlighted[(y + 2) * 80 + (+x)]) lineData += '\\x1b[97m'\n lineData += line[x]\n if (this.highlighted[(y + 2) * 80 + (+x)]) lineData += '\\x1b[38;5;239m'\n }\n this.emit('write', lineData)\n }\n\n // move cursor to mouse\n if (this.mouse) {\n this.emit('write', `\\x1b[${this.mouse.y + 1};${this.mouse.x + 1}H`)\n }\n }\n mouseMove (x, y) {\n this.mouse = { x, y }\n this.render()\n }\n mouseDown (x, y, button) {\n if (button === 4) this.scrollOffset--\n else if (button === 5) this.scrollOffset++\n else this.highlighted[y * 80 + x] = !this.highlighted[y * 80 + x]\n this.render()\n }\n mouseUp (x, y, button) {}\n destroy () {\n this.shell.terminal.write('\\x1b[2J\\x1b[1;1H')\n this.shell.terminal.trackMouse = false\n if (demoData.mouseReceiver === this) demoData.mouseReceiver = null\n super.destroy()\n }\n },\n sudo: class Sudo extends Process {\n constructor (shell) {\n super()\n this.shell = shell\n }\n run (...args) {\n if (args.length === 0) {\n this.emit('write', '\\x1b[31mUsage: sudo <command>\\x1b[m\\r\\n')\n this.destroy()\n } else if (args.length === 4 && args.join(' ').toLowerCase() === 'make me a sandwich') {\n const b = '\\x1b[33m'\n const r = '\\x1b[0m'\n const l = '\\x1b[32m'\n const c = '\\x1b[38;5;229m'\n const h = '\\x1b[38;5;225m'\n this.emit('write',\n ` ${b}_.---._\\r\\n` +\n ` _.-~ ~-._\\r\\n` +\n ` _.-~ ~-._\\r\\n` +\n ` _.-~ ~---._\\r\\n` +\n ` _.-~ ~\\\\\\r\\n` +\n ` .-~ _.;\\r\\n` +\n ` :-._ _.-~ ./\\r\\n` +\n ` \\`-._~-._ _..__.-~ _.-~\\r\\n` +\n ` ${c}/ ${b}~-._~-._ / .__..--${c}~-${l}---._\\r\\n` +\n `${c} \\\\_____(_${b};-._\\\\. _.-~_/${c} ~)${l}.. . \\\\\\r\\n` +\n `${l} /(_____ ${b}\\\\\\`--...--~_.-~${c}______..-+${l}_______)\\r\\n` +\n `${l} .(_________/${b}\\`--...--~/${l} _/ ${h} ${b}/\\\\\\r\\n` +\n `${b} /-._${h} \\\\_ ${l}(___./_..-~${h}__.....${b}__..-~./\\r\\n` +\n `${b} \\`-._~-._${h} ~\\\\--------~ .-~${b}_..__.-~ _.-~\\r\\n` +\n `${b} ~-._~-._ ${h}~---------\\` ${b}/ .__..--~\\r\\n` +\n `${b} ~-._\\\\. _.-~_/\\r\\n` +\n `${b} \\\\\\`--...--~_.-~\\r\\n` +\n `${b} \\`--...--~${r}\\r\\n`)\n this.destroy()\n } else {\n let name = args.shift()\n if (this.shell.index[name]) {\n let Process = this.shell.index[name]\n if (Process instanceof Function) {\n let child = new Process(this)\n let write = data => this.emit('write', data)\n child.on('write', write)\n child.on('exit', code => {\n child.removeListener('write', write)\n this.destroy()\n })\n child.run(...args)\n } else {\n this.emit('write', Process)\n this.destroy()\n }\n } else {\n this.emit('write', `sudo: ${name}: command not found\\r\\n`)\n this.destroy()\n }\n }\n }\n },\n make: class Make extends Process {\n run (...args) {\n if (args.length === 0) this.emit('write', '\\x1b[31mmake: *** No targets specified. Stop.\\x1b[0m\\r\\n')\n else if (args.length === 3 && args.join(' ').toLowerCase() === 'me a sandwich') {\n this.emit('write', '\\x1b[31mmake: me a sandwich : Permission denied\\x1b[0m\\r\\n')\n } else {\n this.emit('write', `\\x1b[31mmake: *** No rule to make target '${args.join(' ').toLowerCase()}'. Stop.\\x1b[0m\\r\\n`)\n }\n this.destroy()\n }\n },\n pwd: '/this/is/a/demo\\r\\n',\n cd: '\\x1b[38;5;239mNo directories to change to\\r\\n',\n whoami: `${window.navigator.userAgent}\\r\\n`,\n hostname: `${window.location.hostname}`,\n uname: 'ESPTerm Demo\\r\\n',\n mkdir: '\\x1b[38;5;239mDid not create a directory because this is a demo.\\r\\n',\n rm: '\\x1b[38;5;239mDid not delete anything because this is a demo.\\r\\n',\n cp: '\\x1b[38;5;239mNothing to copy because this is a demo.\\r\\n',\n mv: '\\x1b[38;5;239mNothing to move because this is a demo.\\r\\n',\n ln: '\\x1b[38;5;239mNothing to link because this is a demo.\\r\\n',\n touch: '\\x1b[38;5;239mNothing to touch\\r\\n',\n exit: '\\x1b[38;5;239mNowhere to go\\r\\n',\n github: class GoToGithub extends Process {\n run () {\n window.open('https://github.com/espterm/espterm-firmware')\n this.destroy()\n }\n }\n}\n\nclass DemoShell {\n constructor (terminal, printInfo) {\n this.terminal = terminal\n this.terminal.reset()\n this.parser = new ANSIParser((...args) => this.handleParsed(...args))\n this.history = []\n this.historyIndex = 0\n this.cursorPos = 0\n this.child = null\n this.index = demoshIndex\n\n if (printInfo) this.run('info')\n else this.prompt()\n }\n write (text) {\n if (this.child) {\n if (text.codePointAt(0) === 3) this.child.destroy()\n else this.child.write(text)\n } else this.parser.write(text)\n }\n prompt (success = true) {\n if (this.terminal.cursor.x !== 0) this.terminal.write('\\x1b[m\\x1b[38;5;238m⏎\\r\\n')\n this.terminal.write('\\x1b[34;1mdemosh \\x1b[m')\n if (!success) this.terminal.write('\\x1b[31m')\n this.terminal.write('$ \\x1b[m')\n this.history.unshift('')\n this.cursorPos = 0\n }\n copyFromHistoryIndex () {\n if (!this.historyIndex) return\n let current = this.history[this.historyIndex]\n this.history[0] = current\n this.historyIndex = 0\n }\n handleParsed (action, ...args) {\n this.terminal.write('\\b\\x1b[P'.repeat(this.cursorPos))\n if (action === 'write') {\n this.copyFromHistoryIndex()\n this.history[0] = this.history[0].substr(0, this.cursorPos) + args[0] + this.history[0].substr(this.cursorPos)\n this.cursorPos++\n } else if (action === 'back') {\n this.copyFromHistoryIndex()\n this.history[0] = this.history[0].substr(0, this.cursorPos - 1) + this.history[0].substr(this.cursorPos)\n this.cursorPos--\n if (this.cursorPos < 0) this.cursorPos = 0\n } else if (action === 'tab') {\n console.warn('TAB not implemented') // TODO completion\n } else if (action === 'move-cursor-x') {\n this.cursorPos = Math.max(0, Math.min(this.history[this.historyIndex].length, this.cursorPos + args[0]))\n } else if (action === 'delete-line') {\n this.copyFromHistoryIndex()\n this.history[0] = ''\n this.cursorPos = 0\n } else if (action === 'delete-word') {\n this.copyFromHistoryIndex()\n let words = this.history[0].substr(0, this.cursorPos).split(' ')\n words.pop()\n this.history[0] = words.join(' ') + this.history[0].substr(this.cursorPos)\n this.cursorPos = words.join(' ').length\n } else if (action === 'move-cursor-y') {\n this.historyIndex -= args[0]\n if (this.historyIndex < 0) this.historyIndex = 0\n if (this.historyIndex >= this.history.length) this.historyIndex = this.history.length - 1\n this.cursorPos = this.history[this.historyIndex].length\n }\n\n this.terminal.write(this.history[this.historyIndex])\n this.terminal.write('\\b'.repeat(this.history[this.historyIndex].length))\n this.terminal.moveForward(this.cursorPos)\n this.terminal.write('') // dummy. Apply the moveFoward\n\n if (action === 'return') {\n this.terminal.write('\\r\\n')\n this.parse(this.history[this.historyIndex])\n }\n }\n parse (input) {\n if (input === 'help') input = 'info'\n // TODO: basic chaining (i.e. semicolon)\n this.run(input)\n }\n run (command) {\n let parts = ['']\n\n let inQuote = false\n for (let character of command.trim()) {\n if (inQuote && character !== inQuote) {\n parts[parts.length - 1] += character\n } else if (inQuote) {\n inQuote = false\n } else if (character === '\"' || character === \"'\") {\n inQuote = character\n } else if (character.match(/\\s/)) {\n if (parts[parts.length - 1]) parts.push('')\n } else parts[parts.length - 1] += character\n }\n\n let name = parts.shift()\n\n if (name in this.index) {\n this.spawn(name, parts)\n } else {\n this.terminal.write(`demosh: Unknown command: ${name}\\r\\n`)\n this.prompt(false)\n }\n }\n spawn (name, args = []) {\n let Process = this.index[name]\n if (Process instanceof Function) {\n this.child = new Process(this)\n let write = data => this.terminal.write(data)\n this.child.on('write', write)\n this.child.on('exit', code => {\n if (this.child) this.child.removeListener('write', write)\n this.child = null\n this.prompt(!code)\n })\n this.child.run(...args)\n } else {\n this.terminal.write(Process)\n this.prompt()\n }\n }\n}\n\nwindow.demoInterface = module.exports = {\n input (data) {\n let type = data[0]\n let content = data.substr(1)\n\n if (type === 's') {\n this.shell.write(content)\n } else if (type === 'b') {\n let button = content.charCodeAt(0)\n let action = demoData.buttons[button]\n if (action) {\n if (typeof action === 'string') this.shell.write(action)\n else if (action instanceof Function) action(this.terminal, this.shell)\n }\n } else if (type === 'm' || type === 'p' || type === 'r') {\n let row = parse2B(content, 0)\n let column = parse2B(content, 2)\n let button = parse2B(content, 4)\n let modifiers = parse2B(content, 6)\n\n if (demoData.mouseReceiver) {\n if (type === 'm') demoData.mouseReceiver.mouseMove(column, row, button, modifiers)\n else if (type === 'p') demoData.mouseReceiver.mouseDown(column, row, button, modifiers)\n else if (type === 'r') demoData.mouseReceiver.mouseUp(column, row, button, modifiers)\n }\n }\n },\n didInit: false,\n init (screen) {\n if (this.didInit) return\n this.didInit = true\n this.terminal = new ScrollingTerminal(screen)\n this.shell = new DemoShell(this.terminal, true)\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./js/term/demo.js","require('./lib/polyfills')\nrequire('./modal')\nrequire('./notif')\nrequire('./appcommon')\ntry { require('./term/demo') } catch (err) {}\nrequire('./wifi')\n\nconst $ = require('./lib/chibi')\nconst { qs } = require('./utils')\n\n/* Export stuff to the global scope for inline scripts */\nwindow.termInit = require('./term')\nwindow.$ = $\nwindow.qs = qs\n\nwindow.themes = require('./term/themes')\n\n\n\n// WEBPACK FOOTER //\n// ./js/index.js","/*! http://mths.be/fromcodepoint v0.1.0 by @mathias */\nif (!String.fromCodePoint) {\n (function () {\n var defineProperty = (function () {\n // IE 8 only supports `Object.defineProperty` on DOM elements\n try {\n var object = {};\n var $defineProperty = Object.defineProperty;\n var result = $defineProperty(object, object, object) && $defineProperty;\n } catch (error) {\n }\n return result;\n }());\n var stringFromCharCode = String.fromCharCode;\n var floor = Math.floor;\n var fromCodePoint = function () {\n var MAX_SIZE = 0x4000;\n var codeUnits = [];\n var highSurrogate;\n var lowSurrogate;\n var index = -1;\n var length = arguments.length;\n if (!length) {\n return '';\n }\n var result = '';\n while (++index < length) {\n var codePoint = Number(arguments[index]);\n if (\n !isFinite(codePoint) || // `NaN`, `+Infinity`, or `-Infinity`\n codePoint < 0 || // not a valid Unicode code point\n codePoint > 0x10FFFF || // not a valid Unicode code point\n floor(codePoint) != codePoint // not an integer\n ) {\n throw RangeError('Invalid code point: ' + codePoint);\n }\n if (codePoint <= 0xFFFF) { // BMP code point\n codeUnits.push(codePoint);\n } else { // Astral code point; split in surrogate halves\n // http://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae\n codePoint -= 0x10000;\n highSurrogate = (codePoint >> 10) + 0xD800;\n lowSurrogate = (codePoint % 0x400) + 0xDC00;\n codeUnits.push(highSurrogate, lowSurrogate);\n }\n if (index + 1 == length || codeUnits.length > MAX_SIZE) {\n result += stringFromCharCode.apply(null, codeUnits);\n codeUnits.length = 0;\n }\n }\n return result;\n };\n if (defineProperty) {\n defineProperty(String, 'fromCodePoint', {\n 'value': fromCodePoint,\n 'configurable': true,\n 'writable': true\n });\n } else {\n String.fromCodePoint = fromCodePoint;\n }\n }());\n}\n\n\n\n// WEBPACK FOOTER //\n// ./js/lib/polyfills.js","const $ = require('./lib/chibi')\nconst { mk, qs, qsa, cr } = require('./utils')\nconst modal = require('./modal')\nconst notify = require('./notif')\n\n/** Global generic init */\n$.ready(function () {\n // Opening menu on mobile / narrow screen\n function menuOpen () {\n $('#menu').toggleClass('expanded')\n }\n $('#brand')\n .on('click', menuOpen)\n .on('keypress', cr(menuOpen))\n\n // Checkbox UI (checkbox CSS and hidden input with int value)\n $('.Row.checkbox').forEach(function (x) {\n let inp = x.querySelector('input')\n let box = x.querySelector('.box')\n\n $(box).toggleClass('checked', inp.value)\n\n let hdl = function () {\n inp.value = 1 - inp.value\n $(box).toggleClass('checked', inp.value)\n }\n\n $(x).on('click', hdl).on('keypress', cr(hdl))\n })\n\n // Expanding boxes on mobile\n $('.Box.mobcol,.Box.fold').forEach(function (x) {\n let h = x.querySelector('h2')\n\n let hdl = function () {\n if ($(x).hasClass('d-expanded')) {\n $(x).removeClass('d-expanded')\n } else {\n $(x).toggleClass('expanded')\n }\n }\n $(h).on('click', hdl).on('keypress', cr(hdl))\n })\n\n $('form').forEach(function (x) {\n $(x).on('keypress', function (e) {\n if ((e.keyCode === 10 || e.keyCode === 13) && e.ctrlKey) {\n x.submit()\n }\n })\n })\n\n // loader dots...\n setInterval(function () {\n $('.anim-dots').each(function (x) {\n let $x = $(x)\n let dots = $x.html() + '.'\n if (dots.length === 5) dots = '.'\n $x.html(dots)\n })\n }, 1000)\n\n // flipping number boxes with the mouse wheel\n $('input[type=number]').on('mousewheel', function (e) {\n let $this = $(this)\n let val = +$this.val()\n if (isNaN(val)) val = 1\n\n const step = +($this.attr('step') || 1)\n const min = +$this.attr('min')\n const max = +$this.attr('max')\n if (e.wheelDelta > 0) {\n val += step\n } else {\n val -= step\n }\n\n if (!Number.isFinite(min)) val = Math.max(val, +min)\n if (!Number.isFinite(max)) val = Math.min(val, +max)\n $this.val(val)\n\n if ('createEvent' in document) {\n let evt = document.createEvent('HTMLEvents')\n evt.initEvent('change', false, true)\n $this[0].dispatchEvent(evt)\n } else {\n $this[0].fireEvent('onchange')\n }\n\n e.preventDefault()\n })\n\n // populate the form errors box from GET arg ?err=...\n // (a way to pass errors back from server via redirect)\n let errAt = window.location.search.indexOf('err=')\n if (errAt !== -1 && qs('.Box.errors')) {\n let errs = decodeURIComponent(window.location.search.substr(errAt + 4)).split(',')\n let humanReadableErrors = []\n errs.forEach(function (er) {\n let lbls = qsa('label[for=\"' + er + '\"]')\n if (lbls) {\n for (let i = 0; i < lbls.length; i++) {\n let lbl = lbls[i]\n lbl.classList.add('error')\n if (i === 0) humanReadableErrors.push(lbl.childNodes[0].textContent.trim().replace(/: ?$/, ''))\n }\n } else {\n humanReadableErrors.push(er)\n }\n })\n\n qs('.Box.errors .list').innerHTML = humanReadableErrors.join(', ')\n qs('.Box.errors').classList.remove('hidden')\n }\n\n let msgAt = window.location.search.indexOf('msg=')\n if (msgAt !== -1 && qs('.Box.message')) {\n let msg = decodeURIComponent(window.location.search.substr(msgAt + 4))\n let box = qs('.Box.message')\n box.innerHTML = msg\n box.classList.remove('hidden')\n setTimeout(() => {\n box.classList.add('hiding')\n setTimeout(() => {\n box.classList.add('hidden')\n }, 1000)\n }, 2000)\n }\n\n modal.init()\n notify.init()\n\n // remove tabindices from h2 if wide\n if (window.innerWidth > 550) {\n $('.Box h2').forEach(function (x) {\n x.removeAttribute('tabindex')\n })\n\n // brand works as a link back to term in widescreen mode\n let br = qs('#brand')\n br && br.addEventListener('click', function () {\n window.location.href = '/' // go to terminal\n })\n }\n})\n\n// setup the ajax loader\n$._loader = function (vis) {\n $('#loader').toggleClass('show', vis)\n}\n\nlet pageShown = false\n// reveal content on load\nfunction showPage () {\n pageShown = true\n $('#content').addClass('load')\n}\n// HACKITY HACK: fix this later\nwindow.showPage = showPage\n\n// Auto reveal pages other than the terminal (sets window.noAutoShow)\n$.ready(function () {\n if (window.noAutoShow === true) {\n setTimeout(function () {\n if (!pageShown) {\n let bnr = mk('P')\n bnr.id = 'load-failed'\n bnr.innerHTML =\n 'Server connection failed! Trying again' +\n '<span class=\"anim-dots\" style=\"width:1.5em;text-align:left;display:inline-block\">.</span>'\n qs('#screen').appendChild(bnr)\n showPage()\n }\n }, 2000)\n } else {\n setTimeout(function () {\n showPage()\n }, 1)\n }\n})\n\n\n\n// WEBPACK FOOTER //\n// ./js/appcommon.js","const $ = require('./lib/chibi')\nconst { mk, bool } = require('./utils')\nconst tr = require('./lang')\n\n;(function (w) {\n const authStr = ['Open', 'WEP', 'WPA', 'WPA2', 'WPA/WPA2']\n let curSSID\n\n // Get XX % for a slider input\n function calc_dBm (inp) {\n return `+${(inp.value * 0.25).toFixed(2)} dBm`\n }\n\n // Display selected STA SSID etc\n function selectSta (name, password, ip) {\n $('#sta_ssid').val(name)\n $('#sta_password').val(password)\n\n $('#sta-nw').toggleClass('hidden', name.length === 0)\n $('#sta-nw-nil').toggleClass('hidden', name.length > 0)\n\n $('#sta-nw .essid').html($.htmlEscape(name))\n const nopw = !password || password.length === 0\n $('#sta-nw .passwd').toggleClass('hidden', nopw)\n $('#sta-nw .nopasswd').toggleClass('hidden', !nopw)\n $('#sta-nw .ip').html(ip.length > 0 ? tr('wifi.connected_ip_is') + ip : tr('wifi.not_conn'))\n }\n\n /** Update display for received response */\n function onScan (resp, status) {\n // var ap_json = {\n // \"result\": {\n // \"inProgress\": \"0\",\n // \"APs\": [\n // {\"essid\": \"Chlivek\", \"bssid\": \"88:f7:c7:52:b3:99\", \"rssi\": \"204\", \"enc\": \"4\", \"channel\": \"1\"},\n // {\"essid\": \"TyNikdy\", \"bssid\": \"5c:f4:ab:0d:f1:1b\", \"rssi\": \"164\", \"enc\": \"3\", \"channel\": \"1\"},\n // ]\n // }\n // };\n\n if (status !== 200) {\n // bad response\n rescan(5000) // wait 5sm then retry\n return\n }\n\n try {\n resp = JSON.parse(resp)\n } catch (e) {\n console.log(e)\n rescan(5000)\n return\n }\n\n const done = !bool(resp.result.inProgress) && (resp.result.APs.length > 0)\n rescan(done ? 15000 : 1000)\n if (!done) return // no redraw yet\n\n // clear the AP list\n let $list = $('#ap-list')\n // remove old APs\n $('#ap-list .AP').remove()\n\n $list.toggleClass('hidden', !done)\n $('#ap-loader').toggleClass('hidden', done)\n\n // scan done\n resp.result.APs.sort(function (a, b) {\n return b.rssi - a.rssi\n }).forEach(function (ap) {\n ap.enc = parseInt(ap.enc)\n\n if (ap.enc > 4) return // hide unsupported auths\n\n let item = mk('div')\n\n let $item = $(item)\n .data('ssid', ap.essid)\n .data('pwd', ap.enc)\n .attr('tabindex', 0)\n .addClass('AP')\n\n // mark current SSID\n if (ap.essid === curSSID) {\n $item.addClass('selected')\n }\n\n let inner = mk('div')\n let escapedSSID = $.htmlEscape(ap.essid)\n $(inner).addClass('inner')\n .htmlAppend(`<div class=\"rssi\">${ap.rssi_perc}</div>`)\n .htmlAppend(`<div class=\"essid\" title=\"${escapedSSID}\">${escapedSSID}</div>`)\n .htmlAppend(`<div class=\"auth\">${authStr[ap.enc]}</div>`)\n\n $item.on('click', function () {\n let $th = $(this)\n\n const conn_ssid = $th.data('ssid')\n let conn_pass = ''\n\n if (+$th.data('pwd')) {\n // this AP needs a password\n conn_pass = window.prompt(tr('wifi.enter_passwd').replace(':ssid:', conn_ssid))\n if (!conn_pass) return\n }\n\n $('#sta_password').val(conn_pass)\n $('#sta_ssid').val(conn_ssid)\n selectSta(conn_ssid, conn_pass, '')\n })\n\n item.appendChild(inner)\n $list[0].appendChild(item)\n })\n }\n\n function startScanning () {\n $('#ap-loader').removeClass('hidden')\n $('#ap-scan').addClass('hidden')\n $('#ap-loader .anim-dots').html('.')\n\n scanAPs()\n }\n\n /** Ask the CGI what APs are visible (async) */\n function scanAPs () {\n if (window._demo) {\n onScan(window._demo_aps, 200)\n } else {\n $.get('http://' + window._root + '/cfg/wifi/scan', onScan)\n }\n }\n\n function rescan (time) {\n setTimeout(scanAPs, time)\n }\n\n /** Set up the WiFi page */\n function wifiInit (cfg) {\n // Update slider value displays\n $('.Row.range').forEach(function (x) {\n let inp = x.querySelector('input')\n let disp1 = x.querySelector('.x-disp1')\n let disp2 = x.querySelector('.x-disp2')\n let t = calc_dBm(inp)\n $(disp1).html(t)\n $(disp2).html(t)\n $(inp).on('input', function () {\n t = calc_dBm(inp)\n $(disp1).html(t)\n $(disp2).html(t)\n })\n })\n\n // Forget STA credentials\n $('#forget-sta').on('click', () => {\n selectSta('', '', '')\n return false\n })\n\n selectSta(cfg.sta_ssid, cfg.sta_password, cfg.sta_active_ip)\n curSSID = cfg.sta_active_ssid\n }\n\n w.init = wifiInit\n w.startScanning = startScanning\n})(window.WiFi = {})\n\n\n\n// WEBPACK FOOTER //\n// ./js/wifi.js","// Generated from PHP locale file\nlet _tr = {\n \"wifi.connected_ip_is\": \"Connected, IP is \",\n \"wifi.not_conn\": \"Not connected.\",\n \"wifi.enter_passwd\": \"Enter password for \\\":ssid:\\\"\"\n};\n\nmodule.exports = function tr (key) { return _tr[key] || '?' + key + '?' }\n\n\n\n// WEBPACK FOOTER //\n// ./js/lang.js","const { qs, mk } = require('../utils')\nconst Notify = require('../notif')\nconst TermScreen = require('./screen')\nconst TermConnection = require('./connection')\nconst TermInput = require('./input')\nconst TermUpload = require('./upload')\nconst initSoftKeyboard = require('./soft_keyboard')\nconst attachDebugScreen = require('./debug_screen')\n\n/** Init the terminal sub-module - called from HTML */\nmodule.exports = function (opts) {\n const screen = new TermScreen()\n const conn = new TermConnection(screen)\n const input = TermInput(conn, screen)\n const termUpload = TermUpload(conn, input, screen)\n screen.input = input\n screen.conn = conn\n input.termUpload = termUpload\n\n let showSplashTimeout = null\n let showSplash = (obj, delay = 250) => {\n clearTimeout(showSplashTimeout)\n showSplashTimeout = setTimeout(() => {\n screen.window.statusScreen = obj\n }, delay)\n }\n\n conn.on('open', () => {\n // console.log('*open')\n showSplash({ title: 'Connecting', loading: true })\n })\n conn.on('connect', () => {\n // console.log('*connect')\n showSplash({ title: 'Waiting for content', loading: true })\n })\n conn.on('load', () => {\n // console.log('*load')\n clearTimeout(showSplashTimeout)\n if (screen.window.statusScreen) screen.window.statusScreen = null\n })\n conn.on('disconnect', () => {\n // console.log('*disconnect')\n showSplash({ title: 'Disconnected' })\n screen.screen = []\n screen.screenFG = []\n screen.screenBG = []\n screen.screenAttrs = []\n })\n conn.on('silence', () => {\n // console.log('*silence')\n showSplash({ title: 'Waiting for server', loading: true }, 0)\n })\n // conn.on('ping-fail', () => { screen.window.statusScreen = { title: 'Disconnected' } })\n conn.on('ping-success', () => {\n // console.log('*ping-success')\n showSplash({ title: 'Re-connecting', loading: true }, 0)\n })\n\n conn.init()\n input.init(opts)\n termUpload.init()\n Notify.init()\n\n window.onerror = function (errorMsg, file, line, col) {\n Notify.show(`<b>JS ERROR!</b><br>${errorMsg}<br>at ${file}:${line}:${col}`, 10000, true)\n return false\n }\n\n qs('#screen').appendChild(screen.canvas)\n screen.load(opts.labels, opts) // load labels and theme\n\n initSoftKeyboard(screen, input)\n if (attachDebugScreen) attachDebugScreen(screen)\n\n let isFullscreen = false\n let fitScreen = false\n let fitScreenIfNeeded = function fitScreenIfNeeded () {\n if (isFullscreen) {\n screen.window.fitIntoWidth = window.screen.width\n screen.window.fitIntoHeight = window.screen.height\n } else {\n screen.window.fitIntoWidth = fitScreen ? window.innerWidth - 20 : 0\n screen.window.fitIntoHeight = fitScreen ? window.innerHeight : 0\n }\n }\n fitScreenIfNeeded()\n window.addEventListener('resize', fitScreenIfNeeded)\n\n let toggleFitScreen = function () {\n fitScreen = !fitScreen\n const resizeButtonIcon = qs('#resize-button-icon')\n if (fitScreen) {\n resizeButtonIcon.classList.remove('icn-resize-small')\n resizeButtonIcon.classList.add('icn-resize-full')\n } else {\n resizeButtonIcon.classList.remove('icn-resize-full')\n resizeButtonIcon.classList.add('icn-resize-small')\n }\n fitScreenIfNeeded()\n }\n\n qs('#term-fit-screen').addEventListener('click', function () {\n toggleFitScreen()\n return false\n })\n\n // add fullscreen mode & button\n if (window.Element.prototype.requestFullscreen || window.Element.prototype.webkitRequestFullscreen) {\n let checkForFullscreen = function () {\n // document.fullscreenElement is not really supported yet, so here's a hack\n if (isFullscreen && (window.innerWidth !== window.screen.width || window.innerHeight !== window.screen.height)) {\n isFullscreen = false\n fitScreenIfNeeded()\n }\n }\n setInterval(checkForFullscreen, 500)\n\n // (why are the buttons anchors?)\n let button = mk('a')\n button.href = '#'\n button.addEventListener('click', e => {\n e.preventDefault()\n\n isFullscreen = true\n fitScreenIfNeeded()\n screen.updateSize()\n\n if (screen.canvas.requestFullscreen) screen.canvas.requestFullscreen()\n else screen.canvas.webkitRequestFullscreen()\n })\n let icon = mk('i')\n icon.classList.add('icn-resize-full') // TODO: less confusing icons\n button.appendChild(icon)\n let span = mk('span')\n span.textContent = 'Fullscreen'\n button.appendChild(span)\n qs('#term-nav').insertBefore(button, qs('#term-nav').firstChild)\n }\n\n // for debugging\n window.termScreen = screen\n window.conn = conn\n window.input = input\n window.termUpl = termUpload\n}\n\n\n\n// WEBPACK FOOTER //\n// ./js/term/index.js","const EventEmitter = require('events')\nconst $ = require('../lib/chibi')\nconst { mk, qs } = require('../utils')\nconst notify = require('../notif')\nconst ScreenParser = require('./screen_parser')\nconst ScreenRenderer = require('./screen_renderer')\n\nmodule.exports = class TermScreen extends EventEmitter {\n constructor () {\n super()\n\n this.canvas = mk('canvas')\n this.ctx = this.canvas.getContext('2d')\n\n this.parser = new ScreenParser(this)\n this.renderer = new ScreenRenderer(this)\n\n // debug screen handle\n this._debug = null\n\n if ('AudioContext' in window || 'webkitAudioContext' in window) {\n this.audioCtx = new (window.AudioContext || window.webkitAudioContext)()\n } else {\n console.warn('No AudioContext!')\n }\n\n // dummy. Handle for Input\n this.input = new Proxy({}, {\n get () {\n return () => console.warn('TermScreen#input not set!')\n }\n })\n // dummy. Handle for Conn\n this.conn = new Proxy({}, {\n get () {\n return () => console.warn('TermScreen#conn not set!')\n },\n set (a, b) {\n return () => console.warn('TermScreen#conn not set!')\n }\n })\n\n this.cursor = {\n x: 0,\n y: 0,\n blinking: true,\n visible: true,\n hanging: false,\n style: 'block'\n }\n\n this._window = {\n width: 0,\n height: 0,\n devicePixelRatio: 1,\n fontFamily: '\"DejaVu Sans Mono\", \"Liberation Mono\", \"Inconsolata\", \"Menlo\", monospace',\n fontSize: 20,\n gridScaleX: 1.0,\n gridScaleY: 1.2,\n fitIntoWidth: 0,\n fitIntoHeight: 0,\n debug: false,\n graphics: 0,\n statusScreen: null\n }\n\n // scaling caused by fitIntoWidth/fitIntoHeight\n this._windowScale = 1\n\n // properties of this.window that require updating size and redrawing\n this.windowState = {\n width: 0,\n height: 0,\n devicePixelRatio: 0,\n gridScaleX: 0,\n gridScaleY: 0,\n fontFamily: '',\n fontSize: 0,\n fitIntoWidth: 0,\n fitIntoHeight: 0\n }\n\n // current selection\n this.selection = {\n // when false, this will prevent selection in favor of mouse events,\n // though alt can be held to override it\n selectable: true,\n\n // selection start and end (x, y) tuples\n start: [0, 0],\n end: [0, 0]\n }\n\n // mouse features\n this.mouseMode = { clicks: false, movement: false }\n\n // make writing to window update size and draw\n const self = this\n this.window = new Proxy(this._window, {\n set (target, key, value, receiver) {\n target[key] = value\n self.scheduleSizeUpdate()\n self.renderer.scheduleDraw(`window:${key}=${value}`)\n self.emit(`update-window:${key}`, value)\n return true\n }\n })\n\n this.bracketedPaste = false\n this.blinkingCellCount = 0\n this.reverseVideo = false\n\n this.screen = []\n this.screenFG = []\n this.screenBG = []\n this.screenAttrs = []\n\n let selecting = false\n\n let selectStart = (x, y) => {\n if (selecting) return\n selecting = true\n this.selection.start = this.selection.end = this.screenToGrid(x, y, true)\n this.renderer.scheduleDraw('select-start')\n }\n\n let selectMove = (x, y) => {\n if (!selecting) return\n this.selection.end = this.screenToGrid(x, y, true)\n this.renderer.scheduleDraw('select-move')\n }\n\n let selectEnd = (x, y) => {\n if (!selecting) return\n selecting = false\n this.selection.end = this.screenToGrid(x, y, true)\n this.renderer.scheduleDraw('select-end')\n Object.assign(this.selection, this.getNormalizedSelection())\n }\n\n // bind event listeners\n\n this.canvas.addEventListener('mousedown', e => {\n if ((this.selection.selectable || e.altKey) && e.button === 0) {\n selectStart(e.offsetX, e.offsetY)\n } else {\n this.input.onMouseDown(...this.screenToGrid(e.offsetX, e.offsetY),\n e.button + 1)\n }\n })\n\n window.addEventListener('mousemove', e => {\n selectMove(e.offsetX, e.offsetY)\n })\n\n window.addEventListener('mouseup', e => {\n selectEnd(e.offsetX, e.offsetY)\n })\n\n // touch event listeners\n\n let touchPosition = null\n let touchDownTime = 0\n let touchSelectMinTime = 500\n let touchDidMove = false\n\n let getTouchPositionOffset = touch => {\n let rect = this.canvas.getBoundingClientRect()\n return [touch.clientX - rect.left, touch.clientY - rect.top]\n }\n\n this.canvas.addEventListener('touchstart', e => {\n touchPosition = getTouchPositionOffset(e.touches[0])\n touchDidMove = false\n touchDownTime = Date.now()\n }, { passive: true })\n\n this.canvas.addEventListener('touchmove', e => {\n touchPosition = getTouchPositionOffset(e.touches[0])\n\n if (!selecting && touchDidMove === false) {\n if (touchDownTime < Date.now() - touchSelectMinTime) {\n selectStart(...touchPosition)\n }\n } else if (selecting) {\n e.preventDefault()\n selectMove(...touchPosition)\n }\n\n touchDidMove = true\n })\n\n this.canvas.addEventListener('touchend', e => {\n if (e.touches[0]) {\n touchPosition = getTouchPositionOffset(e.touches[0])\n }\n\n if (selecting) {\n e.preventDefault()\n selectEnd(...touchPosition)\n\n // selection ended; show touch select menu\n let touchSelectMenu = qs('#touch-select-menu')\n touchSelectMenu.classList.add('open')\n let rect = touchSelectMenu.getBoundingClientRect()\n\n // use middle position for x and one line above for y\n let selectionPos = this.gridToScreen(\n (this.selection.start[0] + this.selection.end[0]) / 2,\n this.selection.start[1] - 1\n )\n selectionPos[0] -= rect.width / 2\n selectionPos[1] -= rect.height / 2\n touchSelectMenu.style.transform = `translate(${selectionPos[0]}px, ${\n selectionPos[1]}px)`\n }\n\n if (!touchDidMove) {\n this.emit('tap', Object.assign(e, {\n x: touchPosition[0],\n y: touchPosition[1]\n }))\n }\n\n touchPosition = null\n })\n\n this.on('tap', e => {\n if (this.selection.start[0] !== this.selection.end[0] ||\n this.selection.start[1] !== this.selection.end[1]) {\n // selection is not empty\n // reset selection\n this.selection.start = this.selection.end = [0, 0]\n qs('#touch-select-menu').classList.remove('open')\n this.renderer.scheduleDraw('select-reset')\n } else {\n e.preventDefault()\n this.emit('open-soft-keyboard')\n }\n })\n\n $.ready(() => {\n let copyButton = qs('#touch-select-copy-btn')\n if (copyButton) {\n copyButton.addEventListener('click', () => {\n this.copySelectionToClipboard()\n })\n }\n })\n\n this.canvas.addEventListener('mousemove', e => {\n if (!selecting) {\n this.input.onMouseMove(...this.screenToGrid(e.offsetX, e.offsetY))\n }\n })\n\n this.canvas.addEventListener('mouseup', e => {\n if (!selecting) {\n this.input.onMouseUp(...this.screenToGrid(e.offsetX, e.offsetY),\n e.button + 1)\n }\n })\n\n this.canvas.addEventListener('wheel', e => {\n if (this.mouseMode.clicks) {\n this.input.onMouseWheel(...this.screenToGrid(e.offsetX, e.offsetY),\n e.deltaY > 0 ? 1 : -1)\n\n // prevent page scrolling\n e.preventDefault()\n }\n })\n\n this.canvas.addEventListener('contextmenu', e => {\n if (this.mouseMode.clicks) {\n // prevent mouse keys getting stuck\n e.preventDefault()\n }\n selectEnd(e.offsetX, e.offsetY)\n })\n }\n\n /**\n * Schedule a size update in the next millisecond\n */\n scheduleSizeUpdate () {\n clearTimeout(this._scheduledSizeUpdate)\n this._scheduledSizeUpdate = setTimeout(() => this.updateSize(), 1)\n }\n\n /**\n * Returns a CSS font string with this TermScreen's font settings and the\n * font modifiers.\n * @param {Object} modifiers\n * @param {string} [modifiers.style] - the font style\n * @param {string} [modifiers.weight] - the font weight\n * @returns {string} a CSS font string\n */\n getFont (modifiers = {}) {\n let fontStyle = modifiers.style || 'normal'\n let fontWeight = modifiers.weight || 'normal'\n return `${fontStyle} normal ${fontWeight} ${this.window.fontSize}px ${this.window.fontFamily}`\n }\n\n /**\n * Converts screen coordinates to grid coordinates.\n * @param {number} x - x in pixels\n * @param {number} y - y in pixels\n * @param {boolean} rounded - whether to round the coord, used for select highlighting\n * @returns {number[]} a tuple of (x, y) in cells\n */\n screenToGrid (x, y, rounded = false) {\n let cellSize = this.getCellSize()\n\n return [\n Math.floor((x + (rounded ? cellSize.width / 2 : 0)) / cellSize.width),\n Math.floor(y / cellSize.height)\n ]\n }\n\n /**\n * Converts grid coordinates to screen coordinates.\n * @param {number} x - x in cells\n * @param {number} y - y in cells\n * @param {boolean} [withScale] - when true, will apply window scale\n * @returns {number[]} a tuple of (x, y) in pixels\n */\n gridToScreen (x, y, withScale = false) {\n let cellSize = this.getCellSize()\n\n return [x * cellSize.width, y * cellSize.height].map(v => withScale ? v * this._windowScale : v)\n }\n\n /**\n * The character size, used for calculating the cell size. The space character\n * is used for measuring.\n * @returns {Object} the character size with `width` and `height` in pixels\n */\n getCharSize () {\n this.ctx.font = this.getFont()\n\n return {\n width: Math.floor(this.ctx.measureText(' ').width),\n height: this.window.fontSize\n }\n }\n\n /**\n * The cell size, which is the character size multiplied by the grid scale.\n * @returns {Object} the cell size with `width` and `height` in pixels\n */\n getCellSize () {\n let charSize = this.getCharSize()\n\n return {\n width: Math.ceil(charSize.width * this.window.gridScaleX),\n height: Math.ceil(charSize.height * this.window.gridScaleY)\n }\n }\n\n /**\n * Updates the canvas size if it changed\n */\n updateSize () {\n // see below (this is just updating it)\n this._window.devicePixelRatio = Math.round(this._windowScale * (window.devicePixelRatio || 1) * 2) / 2\n\n let didChange = false\n for (let key in this.windowState) {\n if (this.windowState.hasOwnProperty(key) && this.windowState[key] !== this.window[key]) {\n didChange = true\n this.windowState[key] = this.window[key]\n }\n }\n\n if (didChange) {\n const {\n width,\n height,\n fitIntoWidth,\n fitIntoHeight\n } = this.window\n const cellSize = this.getCellSize()\n\n // real height of the canvas element in pixels\n let realWidth = width * cellSize.width\n let realHeight = height * cellSize.height\n\n if (fitIntoWidth && fitIntoHeight) {\n let terminalAspect = realWidth / realHeight\n let fitAspect = fitIntoWidth / fitIntoHeight\n\n if (terminalAspect < fitAspect) {\n // align heights\n realHeight = fitIntoHeight\n realWidth = realHeight * terminalAspect\n } else {\n // align widths\n realWidth = fitIntoWidth\n realHeight = realWidth / terminalAspect\n }\n } else if (fitIntoWidth) {\n realHeight = fitIntoWidth / (realWidth / realHeight)\n realWidth = fitIntoWidth\n } else if (fitIntoHeight) {\n realWidth = fitIntoHeight * (realWidth / realHeight)\n realHeight = fitIntoHeight\n }\n\n // store new window scale\n this._windowScale = realWidth / (width * cellSize.width)\n\n // the DPR must be rounded to a very nice value to prevent gaps between cells\n let devicePixelRatio = this._window.devicePixelRatio = Math.round(this._windowScale * (window.devicePixelRatio || 1) * 2) / 2\n\n this.canvas.width = width * devicePixelRatio * cellSize.width\n this.canvas.style.width = `${realWidth}px`\n this.canvas.height = height * devicePixelRatio * cellSize.height\n this.canvas.style.height = `${realHeight}px`\n\n // the screen has been cleared (by changing canvas width)\n this.renderer.resetDrawn()\n\n // draw immediately; the canvas shouldn't flash\n this.renderer.draw('update-size')\n }\n }\n\n /**\n * Returns a normalized version of the current selection, such that `start`\n * is always before `end`.\n * @returns {Object} the normalized selection, with `start` and `end`\n */\n getNormalizedSelection () {\n let { start, end } = this.selection\n // if the start line is after the end line, or if they're both on the same\n // line but the start column comes after the end column, swap\n if (start[1] > end[1] || (start[1] === end[1] && start[0] > end[0])) {\n [start, end] = [end, start]\n }\n return { start, end }\n }\n\n /**\n * Returns whether or not a given cell is in the current selection.\n * @param {number} col - the column (x)\n * @param {number} line - the line (y)\n * @returns {boolean}\n */\n isInSelection (col, line) {\n let { start, end } = this.getNormalizedSelection()\n let colAfterStart = start[0] <= col\n let colBeforeEnd = col < end[0]\n let onStartLine = line === start[1]\n let onEndLine = line === end[1]\n\n if (onStartLine && onEndLine) return colAfterStart && colBeforeEnd\n else if (onStartLine) return colAfterStart\n else if (onEndLine) return colBeforeEnd\n else return start[1] < line && line < end[1]\n }\n\n /**\n * Sweeps for selected cells and joins them in a multiline string.\n * @returns {string} the selection\n */\n getSelectedText () {\n const screenLength = this.window.width * this.window.height\n let lines = []\n let previousLineIndex = -1\n\n for (let cell = 0; cell < screenLength; cell++) {\n let x = cell % this.window.width\n let y = Math.floor(cell / this.window.width)\n\n if (this.isInSelection(x, y)) {\n if (previousLineIndex !== y) {\n previousLineIndex = y\n lines.push('')\n }\n lines[lines.length - 1] += this.screen[cell]\n }\n }\n\n return lines.join('\\n')\n }\n\n /**\n * Copies the selection to clipboard and creates a notification balloon.\n */\n copySelectionToClipboard () {\n let selectedText = this.getSelectedText()\n // don't copy anything if nothing is selected\n if (!selectedText) return\n let textarea = mk('textarea')\n document.body.appendChild(textarea)\n textarea.value = selectedText\n textarea.select()\n if (document.execCommand('copy')) {\n notify.show('Copied to clipboard')\n } else {\n notify.show('Failed to copy')\n }\n document.body.removeChild(textarea)\n }\n\n /**\n * Shows an actual notification (if possible) or a notification balloon.\n * @param {string} text - the notification content\n */\n showNotification (text) {\n console.info(`Notification: ${text}`)\n if (window.Notification && window.Notification.permission === 'granted') {\n let notification = new window.Notification('ESPTerm', {\n body: text\n })\n notification.addEventListener('click', () => window.focus())\n } else {\n if (window.Notification && window.Notification.permission !== 'denied') {\n window.Notification.requestPermission()\n } else {\n // Fallback using the built-in notification balloon\n notify.show(text)\n }\n }\n }\n\n /**\n * Creates a beep sound.\n */\n beep () {\n const audioCtx = this.audioCtx\n if (!audioCtx) return\n\n // prevent screeching\n if (this._lastBeep && this._lastBeep > Date.now() - 50) return\n this._lastBeep = Date.now()\n\n if (!this._convolver) {\n this._convolver = audioCtx.createConvolver()\n let impulseLength = audioCtx.sampleRate * 0.8\n let impulse = audioCtx.createBuffer(2, impulseLength, audioCtx.sampleRate)\n for (let i = 0; i < impulseLength; i++) {\n impulse.getChannelData(0)[i] = (1 - i / impulseLength) ** (7 + Math.random())\n impulse.getChannelData(1)[i] = (1 - i / impulseLength) ** (7 + Math.random())\n }\n this._convolver.buffer = impulse\n this._convolver.connect(audioCtx.destination)\n }\n\n // main beep\n const mainOsc = audioCtx.createOscillator()\n const mainGain = audioCtx.createGain()\n mainOsc.connect(mainGain)\n mainGain.gain.value = 4\n mainOsc.frequency.value = 750\n mainOsc.type = 'sine'\n\n // surrogate beep (making it sound like 'oops')\n const surrOsc = audioCtx.createOscillator()\n const surrGain = audioCtx.createGain()\n surrOsc.connect(surrGain)\n surrGain.gain.value = 2\n surrOsc.frequency.value = 400\n surrOsc.type = 'sine'\n\n mainGain.connect(this._convolver)\n surrGain.connect(this._convolver)\n\n let startTime = audioCtx.currentTime\n mainOsc.start()\n mainOsc.stop(startTime + 0.5)\n surrOsc.start(startTime + 0.05)\n surrOsc.stop(startTime + 0.8)\n\n let loop = function () {\n if (audioCtx.currentTime < startTime + 0.8) window.requestAnimationFrame(loop)\n mainGain.gain.value *= 0.8\n surrGain.gain.value *= 0.8\n }\n loop()\n }\n\n load (...args) {\n this.parser.load(...args)\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./js/term/screen.js","const $ = require('../lib/chibi')\nconst { qs } = require('../utils')\nconst { themes } = require('./themes')\n\n// constants for decoding the update blob\nconst SEQ_REPEAT = 2\nconst SEQ_SET_COLORS = 3\nconst SEQ_SET_ATTRS = 4\nconst SEQ_SET_FG = 5\nconst SEQ_SET_BG = 6\n\nmodule.exports = class ScreenParser {\n constructor (screen) {\n this.screen = screen\n\n // true if TermScreen#load was called at least once\n this.contentLoaded = false\n }\n /**\n * Parses the content of an `S` message and schedules a draw\n * @param {string} str - the message content\n */\n loadContent (str) {\n // current index\n let i = 0\n let strArray = Array.from ? Array.from(str) : str.split('')\n\n // Uncomment to capture screen content for the demo page\n // console.log(JSON.stringify(`S${str}`))\n\n if (!this.contentLoaded) {\n let errmsg = qs('#load-failed')\n if (errmsg) errmsg.parentNode.removeChild(errmsg)\n this.contentLoaded = true\n }\n\n // window size\n const newHeight = strArray[i++].codePointAt(0) - 1\n const newWidth = strArray[i++].codePointAt(0) - 1\n const resized = (this.screen.window.height !== newHeight) || (this.screen.window.width !== newWidth)\n this.screen.window.height = newHeight\n this.screen.window.width = newWidth\n\n // cursor position\n let [cursorY, cursorX] = [\n strArray[i++].codePointAt(0) - 1,\n strArray[i++].codePointAt(0) - 1\n ]\n let cursorMoved = (cursorX !== this.screen.cursor.x || cursorY !== this.screen.cursor.y)\n this.screen.cursor.x = cursorX\n this.screen.cursor.y = cursorY\n\n if (cursorMoved) {\n this.screen.renderer.resetCursorBlink()\n this.screen.emit('cursor-moved')\n }\n\n // attributes\n let attributes = strArray[i++].codePointAt(0) - 1\n\n this.screen.cursor.visible = !!(attributes & 1)\n this.screen.cursor.hanging = !!(attributes & (1 << 1))\n\n this.screen.input.setAlts(\n !!(attributes & (1 << 2)), // cursors alt\n !!(attributes & (1 << 3)), // numpad alt\n !!(attributes & (1 << 4)), // fn keys alt\n !!(attributes & (1 << 12)) // crlf mode\n )\n\n let trackMouseClicks = !!(attributes & (1 << 5))\n let trackMouseMovement = !!(attributes & (1 << 6))\n\n // 0 - Block blink 2 - Block steady (1 is unused)\n // 3 - Underline blink 4 - Underline steady\n // 5 - I-bar blink 6 - I-bar steady\n let cursorShape = (attributes >> 9) & 0x07\n\n // if it's not zero, decrement such that the two most significant bits\n // are the type and the least significant bit is the blink state\n if (cursorShape > 0) cursorShape--\n\n let cursorStyle = cursorShape >> 1\n let cursorBlinking = !(cursorShape & 1)\n\n if (cursorStyle === 0) this.screen.cursor.style = 'block'\n else if (cursorStyle === 1) this.screen.cursor.style = 'line'\n else if (cursorStyle === 2) this.screen.cursor.style = 'bar'\n\n if (this.screen.cursor.blinking !== cursorBlinking) {\n this.screen.cursor.blinking = cursorBlinking\n this.screen.renderer.resetCursorBlink()\n }\n\n this.screen.input.setMouseMode(trackMouseClicks, trackMouseMovement)\n this.screen.selection.selectable = !trackMouseClicks && !trackMouseMovement\n $(this.screen.canvas).toggleClass('selectable', this.screen.selection.selectable)\n this.screen.mouseMode = {\n clicks: trackMouseClicks,\n movement: trackMouseMovement\n }\n\n let showButtons = !!(attributes & (1 << 7))\n let showConfigLinks = !!(attributes & (1 << 8))\n\n $('.x-term-conf-btn').toggleClass('hidden', !showConfigLinks)\n $('#action-buttons').toggleClass('hidden', !showButtons)\n\n this.screen.bracketedPaste = !!(attributes & (1 << 13))\n this.screen.reverseVideo = !!(attributes & (1 << 14))\n\n // content\n let fg = 7\n let bg = 0\n let attrs = 0\n let cell = 0 // cell index\n let lastChar = ' '\n let screenLength = this.screen.window.width * this.screen.window.height\n\n if (resized) {\n this.screen.updateSize()\n this.screen.blinkingCellCount = 0\n this.screen.screen = new Array(screenLength).fill(' ')\n this.screen.screenFG = new Array(screenLength).fill(' ')\n this.screen.screenBG = new Array(screenLength).fill(' ')\n this.screen.screenAttrs = new Array(screenLength).fill(0)\n }\n\n const MASK_LINE_ATTR = 0xC8\n const MASK_BLINK = 1 << 4\n\n let setCellContent = () => {\n // Remove blink attribute if it wouldn't have any effect\n let myAttrs = attrs\n let hasFG = attrs & (1 << 8)\n let hasBG = attrs & (1 << 9)\n if ((myAttrs & MASK_BLINK) !== 0 &&\n ((lastChar === ' ' && ((myAttrs & MASK_LINE_ATTR) === 0)) || // no line styles\n (fg === bg && hasFG && hasBG) // invisible text\n )\n ) {\n myAttrs ^= MASK_BLINK\n }\n // update blinking cells counter if blink state changed\n if ((this.screen.screenAttrs[cell] & MASK_BLINK) !== (myAttrs & MASK_BLINK)) {\n if (myAttrs & MASK_BLINK) this.screen.blinkingCellCount++\n else this.screen.blinkingCellCount--\n }\n\n this.screen.screen[cell] = lastChar\n this.screen.screenFG[cell] = fg\n this.screen.screenBG[cell] = bg\n this.screen.screenAttrs[cell] = myAttrs\n }\n\n while (i < strArray.length && cell < screenLength) {\n let character = strArray[i++]\n let charCode = character.codePointAt(0)\n\n let data\n switch (charCode) {\n case SEQ_REPEAT:\n let count = strArray[i++].codePointAt(0) - 1\n for (let j = 0; j < count; j++) {\n setCellContent()\n if (++cell > screenLength) break\n }\n break\n\n case SEQ_SET_COLORS:\n data = strArray[i++].codePointAt(0) - 1\n fg = data & 0xFF\n bg = (data >> 8) & 0xFF\n break\n\n case SEQ_SET_ATTRS:\n data = strArray[i++].codePointAt(0) - 1\n attrs = data & 0xFFFF\n break\n\n case SEQ_SET_FG:\n data = strArray[i++].codePointAt(0) - 1\n fg = data & 0xFF\n break\n\n case SEQ_SET_BG:\n data = strArray[i++].codePointAt(0) - 1\n bg = data & 0xFF\n break\n\n default:\n if (charCode < 32) character = '\\ufffd'\n lastChar = character\n setCellContent()\n cell++\n }\n }\n\n if (this.screen.window.debug) console.log(`Blinky cells: ${this.screen.blinkingCellCount}`)\n\n this.screen.renderer.scheduleDraw('load', 16)\n this.screen.conn.emit('load')\n }\n\n /**\n * Parses the content of a `T` message and updates the screen title and button\n * labels.\n * @param {string} str - the message content\n */\n loadLabels (str) {\n let pieces = str.split('\\x01')\n let screenTitle = pieces[0]\n qs('#screen-title').textContent = screenTitle\n if (screenTitle.length === 0) screenTitle = 'Terminal'\n qs('title').textContent = `${screenTitle} :: ESPTerm`\n $('#action-buttons button').forEach((button, i) => {\n let label = pieces[i + 1].trim()\n // if empty string, use the \"dim\" effect and put nbsp instead to\n // stretch the button vertically\n button.innerHTML = label ? $.htmlEscape(label) : ' '\n button.style.opacity = label ? 1 : 0.2\n })\n }\n\n /**\n * Loads a message from the server, and optionally a theme.\n * @param {string} str - the message\n * @param {object} [opts] - options\n * @param {number} [opts.theme] - theme\n * @param {number} [opts.defaultFg] - default foreground\n * @param {number} [opts.defaultBg] - default background\n */\n load (str, opts = null) {\n const content = str.substr(1)\n\n if (opts) {\n if (typeof opts.defaultFg !== 'undefined' && typeof opts.defaultBg !== 'undefined') {\n this.screen.renderer.setDefaultColors(opts.defaultFg, opts.defaultBg)\n }\n\n if (typeof opts.theme !== 'undefined') {\n if (opts.theme >= 0 && opts.theme < themes.length) {\n this.screen.renderer.palette = themes[opts.theme]\n }\n }\n }\n\n switch (str[0]) {\n case 'S':\n this.loadContent(content)\n break\n\n case 'T':\n this.loadLabels(content)\n break\n\n case 'B':\n this.screen.beep()\n break\n\n case 'G':\n this.screen.showNotification(content)\n break\n\n default:\n console.warn(`Bad data message type; ignoring.\\n${JSON.stringify(str)}`)\n }\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./js/term/screen_parser.js","const { themes, buildColorTable, SELECTION_FG, SELECTION_BG } = require('./themes')\n\n// Some non-bold Fraktur symbols are outside the contiguous block\nconst frakturExceptions = {\n 'C': '\\u212d',\n 'H': '\\u210c',\n 'I': '\\u2111',\n 'R': '\\u211c',\n 'Z': '\\u2128'\n}\n\nmodule.exports = class ScreenRenderer {\n constructor (screen) {\n this.screen = screen\n this.ctx = screen.ctx\n\n this._palette = null // colors 0-15\n this.defaultBgNum = 0\n this.defaultFgNum = 7\n\n // 256color lookup table\n // should not be used to look up 0-15 (will return transparent)\n this.colorTable256 = buildColorTable()\n\n this.resetDrawn()\n\n this.blinkStyleOn = false\n this.blinkInterval = null\n this.cursorBlinkOn = false\n this.cursorBlinkInterval = null\n\n // start blink timers\n this.resetBlink()\n this.resetCursorBlink()\n }\n\n resetDrawn () {\n // used to determine if a cell should be redrawn; storing the current state\n // as it is on screen\n this.drawnScreen = []\n this.drawnScreenFG = []\n this.drawnScreenBG = []\n this.drawnScreenAttrs = []\n this.drawnCursor = [-1, -1, '']\n }\n\n /**\n * The color palette. Should define 16 colors in an array.\n * @type {string[]}\n */\n get palette () {\n return this._palette || themes[0]\n }\n\n /** @type {string[]} */\n set palette (palette) {\n if (this._palette !== palette) {\n this._palette = palette\n this.resetDrawn()\n this.scheduleDraw('palette')\n }\n }\n\n setDefaultColors (fg, bg) {\n this.defaultFgNum = fg\n this.defaultBgNum = bg\n this.resetDrawn()\n this.scheduleDraw('defaultColors')\n }\n\n /**\n * Schedule a draw in the next millisecond\n * @param {string} why - the reason why the draw occured (for debugging)\n * @param {number} [aggregateTime] - time to wait for more scheduleDraw calls\n * to occur. 1 ms by default.\n */\n scheduleDraw (why, aggregateTime = 1) {\n clearTimeout(this._scheduledDraw)\n this._scheduledDraw = setTimeout(() => this.draw(why), aggregateTime)\n }\n\n /**\n * Returns the specified color. If `i` is in the palette, it will return the\n * palette color. If `i` is between 16 and 255, it will return the 256color\n * value. If `i` is larger than 255, it will return an RGB color value. If `i`\n * is -1 (foreground) or -2 (background), it will return the selection colors.\n * @param {number} i - the color\n * @returns {string} the CSS color\n */\n getColor (i) {\n // return palette color if it exists\n if (i < 16 && i in this.palette) return this.palette[i]\n\n // -1 for selection foreground, -2 for selection background\n if (i === -1) return SELECTION_FG\n if (i === -2) return SELECTION_BG\n\n // 256 color\n if (i > 15 && i < 256) return this.colorTable256[i]\n\n // true color, encoded as (hex) + 256 (such that #000 == 256)\n if (i > 255) {\n i -= 256\n let red = (i >> 16) & 0xFF\n let green = (i >> 8) & 0xFF\n let blue = i & 0xFF\n return `rgb(${red}, ${green}, ${blue})`\n }\n\n // return error color\n return (Date.now() / 1000) % 2 === 0 ? '#f0f' : '#0f0'\n }\n\n /**\n * Resets the cursor blink to on and restarts the timer\n */\n resetCursorBlink () {\n this.cursorBlinkOn = true\n clearInterval(this.cursorBlinkInterval)\n this.cursorBlinkInterval = setInterval(() => {\n this.cursorBlinkOn = this.screen.cursor.blinking\n ? !this.cursorBlinkOn\n : true\n if (this.screen.cursor.blinking) this.scheduleDraw('cursor-blink')\n }, 500)\n }\n\n /**\n * Resets the blink style to on and restarts the timer\n */\n resetBlink () {\n this.blinkStyleOn = true\n clearInterval(this.blinkInterval)\n let intervals = 0\n this.blinkInterval = setInterval(() => {\n if (this.screen.blinkingCellCount <= 0) return\n\n intervals++\n if (intervals >= 4 && this.blinkStyleOn) {\n this.blinkStyleOn = false\n intervals = 0\n this.scheduleDraw('blink-style')\n } else if (intervals >= 1 && !this.blinkStyleOn) {\n this.blinkStyleOn = true\n intervals = 0\n this.scheduleDraw('blink-style')\n }\n }, 200)\n }\n\n /**\n * Draws a cell's background with the given parameters.\n * @param {Object} options\n * @param {number} options.x - x in cells\n * @param {number} options.y - y in cells\n * @param {number} options.cellWidth - cell width in pixels\n * @param {number} options.cellHeight - cell height in pixels\n * @param {number} options.bg - the background color\n */\n drawBackground ({ x, y, cellWidth, cellHeight, bg }) {\n const ctx = this.ctx\n ctx.fillStyle = this.getColor(bg)\n ctx.clearRect(x * cellWidth, y * cellHeight, cellWidth, cellHeight)\n ctx.fillRect(x * cellWidth, y * cellHeight, cellWidth, cellHeight)\n }\n\n /**\n * Draws a cell's character with the given parameters. Won't do anything if\n * text is an empty string.\n * @param {Object} options\n * @param {number} options.x - x in cells\n * @param {number} options.y - y in cells\n * @param {Object} options.charSize - the character size, an object with\n * `width` and `height` in pixels\n * @param {number} options.cellWidth - cell width in pixels\n * @param {number} options.cellHeight - cell height in pixels\n * @param {string} options.text - the cell content\n * @param {number} options.fg - the foreground color\n * @param {number} options.attrs - the cell's attributes\n */\n drawCharacter ({ x, y, charSize, cellWidth, cellHeight, text, fg, attrs }) {\n if (!text) return\n\n const ctx = this.ctx\n\n let underline = false\n let strike = false\n let overline = false\n if (attrs & (1 << 1)) ctx.globalAlpha = 0.5\n if (attrs & (1 << 3)) underline = true\n if (attrs & (1 << 5)) text = ScreenRenderer.alphaToFraktur(text)\n if (attrs & (1 << 6)) strike = true\n if (attrs & (1 << 7)) overline = true\n\n ctx.fillStyle = this.getColor(fg)\n\n let codePoint = text.codePointAt(0)\n if (codePoint >= 0x2580 && codePoint <= 0x259F) {\n // block elements\n ctx.beginPath()\n const left = x * cellWidth\n const top = y * cellHeight\n const cw = cellWidth\n const ch = cellHeight\n const c2w = cellWidth / 2\n const c2h = cellHeight / 2\n\n // http://www.fileformat.info/info/unicode/block/block_elements/utf8test.htm\n // 0x00 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x09 0x0A 0x0B 0x0C 0x0D 0x0E 0x0F\n // 0x2580 ▀ ▁ ▂ ▃ ▄ ▅ ▆ ▇ █ ▉ ▊ ▋ ▌ ▍ ▎ ▏\n // 0x2590 ▐ ░ ▒ ▓ ▔ ▕ ▖ ▗ ▘ ▙ ▚ ▛ ▜ ▝ ▞ ▟\n\n if (codePoint === 0x2580) {\n // upper half block >▀<\n ctx.rect(left, top, cw, c2h)\n } else if (codePoint <= 0x2588) {\n // lower n eighth block (increasing) >▁< to >█<\n let offset = (1 - (codePoint - 0x2580) / 8) * ch\n ctx.rect(left, top + offset, cw, ch - offset)\n } else if (codePoint <= 0x258F) {\n // left n eighth block (decreasing) >▉< to >▏<\n let offset = (codePoint - 0x2588) / 8 * cw\n ctx.rect(left, top, cw - offset, ch)\n } else if (codePoint === 0x2590) {\n // right half block >▐<\n ctx.rect(left + c2w, top, c2w, ch)\n } else if (codePoint <= 0x2593) {\n // shading >░< >▒< >▓<\n\n // dot spacing by dividing cell size by a constant. This could be\n // reworked to always return a whole number, but that would require\n // prime factorization, and doing that without a loop would let you\n // take over the world, which is not within the scope of this project.\n let dotSpacingX, dotSpacingY, dotSize\n if (codePoint === 0x2591) {\n dotSpacingX = cw / 4\n dotSpacingY = ch / 10\n dotSize = 1\n } else if (codePoint === 0x2592) {\n dotSpacingX = cw / 6\n dotSpacingY = cw / 10\n dotSize = 1\n } else if (codePoint === 0x2593) {\n dotSpacingX = cw / 4\n dotSpacingY = cw / 7\n dotSize = 2\n }\n\n let alignRight = false\n for (let dy = 0; dy < ch; dy += dotSpacingY) {\n for (let dx = 0; dx < cw; dx += dotSpacingX) {\n // prevent overflow\n let dotSizeY = Math.min(dotSize, ch - dy)\n ctx.rect(x * cw + (alignRight ? cw - dx - dotSize : dx), y * ch + dy, dotSize, dotSizeY)\n }\n alignRight = !alignRight\n }\n } else if (codePoint === 0x2594) {\n // upper one eighth block >▔<\n ctx.rect(x * cw, y * ch, cw, ch / 8)\n } else if (codePoint === 0x2595) {\n // right one eighth block >▕<\n ctx.rect((x + 7 / 8) * cw, y * ch, cw / 8, ch)\n } else if (codePoint === 0x2596) {\n // left bottom quadrant >▖<\n ctx.rect(left, top + c2h, c2w, c2h)\n } else if (codePoint === 0x2597) {\n // right bottom quadrant >▗<\n ctx.rect(left + c2w, top + c2h, c2w, c2h)\n } else if (codePoint === 0x2598) {\n // left top quadrant >▘<\n ctx.rect(left, top, c2w, c2h)\n } else if (codePoint === 0x2599) {\n // left chair >▙<\n ctx.rect(left, top, c2w, ch)\n ctx.rect(left + c2w, top + c2h, c2w, c2h)\n } else if (codePoint === 0x259A) {\n // quadrants lt rb >▚<\n ctx.rect(left, top, c2w, c2h)\n ctx.rect(left + c2w, top + c2h, c2w, c2h)\n } else if (codePoint === 0x259B) {\n // left chair upside down >▛<\n ctx.rect(left, top, c2w, ch)\n ctx.rect(left + c2w, top, c2w, c2h)\n } else if (codePoint === 0x259C) {\n // right chair upside down >▜<\n ctx.rect(left, top, cw, c2h)\n ctx.rect(left + c2w, top + c2h, c2w, c2h)\n } else if (codePoint === 0x259D) {\n // right top quadrant >▝<\n ctx.rect(left + c2w, top, c2w, c2h)\n } else if (codePoint === 0x259E) {\n // quadrants lb rt >▞<\n ctx.rect(left, top + c2h, c2w, c2h)\n ctx.rect(left + c2w, top, c2w, c2h)\n } else if (codePoint === 0x259F) {\n // right chair upside down >▟<\n ctx.rect(left, top + c2h, c2w, c2h)\n ctx.rect(left + c2w, top, c2w, ch)\n }\n\n ctx.fill()\n } else {\n // Draw other characters using the text renderer\n ctx.fillText(text, (x + 0.5) * cellWidth, (y + 0.5) * cellHeight)\n }\n\n // -- line drawing - a reference for a possible future rect/line implementation ---\n // http://www.fileformat.info/info/unicode/block/box_drawing/utf8test.htm\n // 0x00 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x09 0x0A 0x0B 0x0C 0x0D 0x0E 0x0F\n // 0x2500 ─ ━ │ ┃ ┄ ┅ ┆ ┇ ┈ ┉ ┊ ┋ ┌ ┍ ┎ ┏\n // 0x2510 ┐ ┑ ┒ ┓ └ ┕ ┖ ┗ ┘ ┙ ┚ ┛ ├ ┝ ┞ ┟\n // 0x2520 ┠ ┡ ┢ ┣ ┤ ┥ ┦ ┧ ┨ ┩ ┪ ┫ ┬ ┭ ┮ ┯\n // 0x2530 ┰ ┱ ┲ ┳ ┴ ┵ ┶ ┷ ┸ ┹ ┺ ┻ ┼ ┽ ┾ ┿\n // 0x2540 ╀ ╁ ╂ ╃ ╄ ╅ ╆ ╇ ╈ ╉ ╊ ╋ ╌ ╍ ╎ ╏\n // 0x2550 ═ ║ ╒ ╓ ╔ ╕ ╖ ╗ ╘ ╙ ╚ ╛ ╜ ╝ ╞ ╟\n // 0x2560 ╠ ╡ ╢ ╣ ╤ ╥ ╦ ╧ ╨ ╩ ╪ ╫ ╬ ╭ ╮ ╯\n // 0x2570 ╰ ╱ ╲ ╳ ╴ ╵ ╶ ╷ ╸ ╹ ╺ ╻ ╼ ╽ ╾ ╿\n\n if (underline || strike || overline) {\n ctx.strokeStyle = this.getColor(fg)\n ctx.lineWidth = 1\n ctx.lineCap = 'round'\n ctx.beginPath()\n\n if (underline) {\n let lineY = Math.round(y * cellHeight + charSize.height) + 0.5\n ctx.moveTo(x * cellWidth, lineY)\n ctx.lineTo((x + 1) * cellWidth, lineY)\n }\n\n if (strike) {\n let lineY = Math.round((y + 0.5) * cellHeight) + 0.5\n ctx.moveTo(x * cellWidth, lineY)\n ctx.lineTo((x + 1) * cellWidth, lineY)\n }\n\n if (overline) {\n let lineY = Math.round(y * cellHeight) + 0.5\n ctx.moveTo(x * cellWidth, lineY)\n ctx.lineTo((x + 1) * cellWidth, lineY)\n }\n\n ctx.stroke()\n }\n\n ctx.globalAlpha = 1\n }\n\n /**\n * Returns all adjacent cell indices given a radius.\n * @param {number} cell - the center cell index\n * @param {number} [radius] - the radius. 1 by default\n * @returns {number[]} an array of cell indices\n */\n getAdjacentCells (cell, radius = 1) {\n const { width, height } = this.screen.window\n const screenLength = width * height\n\n let cells = []\n\n for (let x = -radius; x <= radius; x++) {\n for (let y = -radius; y <= radius; y++) {\n if (x === 0 && y === 0) continue\n cells.push(cell + x + y * width)\n }\n }\n\n return cells.filter(cell => cell >= 0 && cell < screenLength)\n }\n\n /**\n * Updates the screen.\n * @param {string} why - the draw reason (for debugging)\n */\n draw (why) {\n const ctx = this.ctx\n const {\n width,\n height,\n devicePixelRatio,\n statusScreen\n } = this.screen.window\n\n if (statusScreen) {\n // draw status screen instead\n this.drawStatus(statusScreen)\n this.startDrawLoop()\n return\n } else this.stopDrawLoop()\n\n const charSize = this.screen.getCharSize()\n const { width: cellWidth, height: cellHeight } = this.screen.getCellSize()\n const screenLength = width * height\n\n ctx.setTransform(devicePixelRatio, 0, 0, devicePixelRatio, 0, 0)\n\n if (this.screen.window.debug && this.screen._debug) this.screen._debug.drawStart(why)\n\n ctx.font = this.screen.getFont()\n ctx.textAlign = 'center'\n ctx.textBaseline = 'middle'\n\n // bits in the attr value that affect the font\n const FONT_MASK = 0b101\n\n // Map of (attrs & FONT_MASK) -> Array of cell indices\n let fontGroups = new Map()\n\n // Map of (cell index) -> boolean, whether or not a cell has updated\n let updateMap = new Map()\n\n for (let cell = 0; cell < screenLength; cell++) {\n let x = cell % width\n let y = Math.floor(cell / width)\n let isCursor = !this.screen.cursor.hanging &&\n this.screen.cursor.x === x &&\n this.screen.cursor.y === y &&\n this.screen.cursor.visible &&\n this.cursorBlinkOn\n\n let wasCursor = x === this.drawnCursor[0] && y === this.drawnCursor[1]\n\n let inSelection = this.screen.isInSelection(x, y)\n\n let text = this.screen.screen[cell]\n let fg = this.screen.screenFG[cell] | 0\n let bg = this.screen.screenBG[cell] | 0\n let attrs = this.screen.screenAttrs[cell] | 0\n\n if (!(attrs & (1 << 8))) fg = this.defaultFgNum\n if (!(attrs & (1 << 9))) bg = this.defaultBgNum\n\n if (attrs & (1 << 10)) [fg, bg] = [bg, fg] // swap - reversed character colors\n if (this.screen.reverseVideo) [fg, bg] = [bg, fg] // swap - reversed all screen\n\n if (attrs & (1 << 4) && !this.blinkStyleOn) {\n // blinking is enabled and blink style is off\n // set text to nothing so drawCharacter doesn't draw anything\n text = ''\n }\n\n if (inSelection) {\n fg = -1\n bg = -2\n }\n\n let didUpdate = text !== this.drawnScreen[cell] || // text updated\n fg !== this.drawnScreenFG[cell] || // foreground updated, and this cell has text\n bg !== this.drawnScreenBG[cell] || // background updated\n attrs !== this.drawnScreenAttrs[cell] || // attributes updated\n isCursor !== wasCursor || // cursor blink/position updated\n (isCursor && this.screen.cursor.style !== this.drawnCursor[2]) // cursor style updated\n\n let font = attrs & FONT_MASK\n if (!fontGroups.has(font)) fontGroups.set(font, [])\n\n fontGroups.get(font).push({ cell, x, y, text, fg, bg, attrs, isCursor, inSelection })\n updateMap.set(cell, didUpdate)\n }\n\n // Map of (cell index) -> boolean, whether or not a cell should be redrawn\n const redrawMap = new Map()\n\n let isTextWide = text =>\n text !== ' ' && ctx.measureText(text).width >= (cellWidth + 0.05)\n\n // decide for each cell if it should be redrawn\n let updateRedrawMapAt = cell => {\n let shouldUpdate = updateMap.get(cell) || redrawMap.get(cell) || false\n\n // TODO: fonts (necessary?)\n let text = this.screen.screen[cell]\n let isWideCell = isTextWide(text)\n let checkRadius = isWideCell ? 2 : 1\n\n if (!shouldUpdate) {\n // check adjacent cells\n let adjacentDidUpdate = false\n\n for (let adjacentCell of this.getAdjacentCells(cell, checkRadius)) {\n // update this cell if:\n // - the adjacent cell updated (For now, this'll always be true because characters can be slightly larger than they say they are)\n // - the adjacent cell updated and this cell or the adjacent cell is wide\n if (updateMap.get(adjacentCell) && (this.screen.window.graphics < 2 || isWideCell || isTextWide(this.screen.screen[adjacentCell]))) {\n adjacentDidUpdate = true\n break\n }\n }\n\n if (adjacentDidUpdate) shouldUpdate = true\n }\n\n redrawMap.set(cell, shouldUpdate)\n }\n\n for (let cell of updateMap.keys()) updateRedrawMapAt(cell)\n\n // mask to redrawing regions only\n if (this.screen.window.graphics >= 1) {\n let debug = this.screen.window.debug && this.screen._debug\n ctx.save()\n ctx.beginPath()\n for (let y = 0; y < height; y++) {\n let regionStart = null\n for (let x = 0; x < width; x++) {\n let cell = y * width + x\n let redrawing = redrawMap.get(cell)\n if (redrawing && regionStart === null) regionStart = x\n if (!redrawing && regionStart !== null) {\n ctx.rect(regionStart * cellWidth, y * cellHeight, (x - regionStart) * cellWidth, cellHeight)\n if (debug) this.screen._debug.clipRect(regionStart * cellWidth, y * cellHeight, (x - regionStart) * cellWidth, cellHeight)\n regionStart = null\n }\n }\n if (regionStart !== null) {\n ctx.rect(regionStart * cellWidth, y * cellHeight, (width - regionStart) * cellWidth, cellHeight)\n if (debug) this.screen._debug.clipRect(regionStart * cellWidth, y * cellHeight, (width - regionStart) * cellWidth, cellHeight)\n }\n }\n ctx.clip()\n }\n\n // pass 1: backgrounds\n for (let font of fontGroups.keys()) {\n for (let data of fontGroups.get(font)) {\n let { cell, x, y, text, bg } = data\n\n if (redrawMap.get(cell)) {\n this.drawBackground({ x, y, cellWidth, cellHeight, bg })\n\n if (this.screen.window.debug && this.screen._debug) {\n // set cell flags\n let flags = (+redrawMap.get(cell))\n flags |= (+updateMap.get(cell)) << 1\n flags |= (+isTextWide(text)) << 2\n this.screen._debug.setCell(cell, flags)\n }\n }\n }\n }\n\n // reset drawn cursor\n this.drawnCursor = [-1, -1, -1]\n\n // pass 2: characters\n for (let font of fontGroups.keys()) {\n // set font once because in Firefox, this is a really slow action for some\n // reason\n let modifiers = {}\n if (font & 1) modifiers.weight = 'bold'\n if (font & 1 << 2) modifiers.style = 'italic'\n ctx.font = this.screen.getFont(modifiers)\n\n for (let data of fontGroups.get(font)) {\n let { cell, x, y, text, fg, bg, attrs, isCursor, inSelection } = data\n\n if (redrawMap.get(cell)) {\n this.drawCharacter({\n x, y, charSize, cellWidth, cellHeight, text, fg, attrs\n })\n\n this.drawnScreen[cell] = text\n this.drawnScreenFG[cell] = fg\n this.drawnScreenBG[cell] = bg\n this.drawnScreenAttrs[cell] = attrs\n\n if (isCursor) this.drawnCursor = [x, y, this.screen.cursor.style]\n\n if (isCursor && !inSelection) {\n ctx.save()\n ctx.beginPath()\n if (this.screen.cursor.style === 'block') {\n // block\n ctx.rect(x * cellWidth, y * cellHeight, cellWidth, cellHeight)\n } else if (this.screen.cursor.style === 'bar') {\n // vertical bar\n let barWidth = 2\n ctx.rect(x * cellWidth, y * cellHeight, barWidth, cellHeight)\n } else if (this.screen.cursor.style === 'line') {\n // underline\n let lineHeight = 2\n ctx.rect(x * cellWidth, y * cellHeight + charSize.height, cellWidth, lineHeight)\n }\n ctx.clip()\n\n // swap foreground/background\n ;[fg, bg] = [bg, fg]\n\n // HACK: ensure cursor is visible\n if (fg === bg) bg = fg === 0 ? 7 : 0\n\n this.drawBackground({ x, y, cellWidth, cellHeight, bg })\n this.drawCharacter({\n x, y, charSize, cellWidth, cellHeight, text, fg, attrs\n })\n ctx.restore()\n }\n }\n }\n }\n\n if (this.screen.window.graphics >= 1) ctx.restore()\n\n if (this.screen.window.debug && this.screen._debug) this.screen._debug.drawEnd()\n\n this.screen.emit('draw')\n }\n\n drawStatus (statusScreen) {\n const ctx = this.ctx\n const {\n fontFamily,\n width,\n height,\n devicePixelRatio\n } = this.screen.window\n\n // reset drawnScreen to force redraw when statusScreen is disabled\n this.drawnScreen = []\n\n const cellSize = this.screen.getCellSize()\n const screenWidth = width * cellSize.width\n const screenHeight = height * cellSize.height\n\n ctx.setTransform(devicePixelRatio, 0, 0, devicePixelRatio, 0, 0)\n ctx.clearRect(0, 0, screenWidth, screenHeight)\n\n ctx.font = `24px ${fontFamily}`\n ctx.fillStyle = '#fff'\n ctx.textAlign = 'center'\n ctx.textBaseline = 'middle'\n ctx.fillText(statusScreen.title || '', screenWidth / 2, screenHeight / 2 - 50)\n\n if (statusScreen.loading) {\n // show loading spinner\n ctx.save()\n ctx.translate(screenWidth / 2, screenHeight / 2 + 20)\n\n ctx.strokeStyle = '#fff'\n ctx.lineWidth = 5\n ctx.lineCap = 'round'\n\n let t = Date.now() / 1000\n\n for (let i = 0; i < 12; i++) {\n ctx.rotate(Math.PI / 6)\n let offset = ((t * 12) - i) % 12\n ctx.globalAlpha = Math.max(0.2, 1 - offset / 3)\n ctx.beginPath()\n ctx.moveTo(0, 15)\n ctx.lineTo(0, 30)\n ctx.stroke()\n }\n\n ctx.restore()\n }\n }\n\n startDrawLoop () {\n if (this._drawTimerThread) return\n let threadID = Math.random().toString(36)\n this._drawTimerThread = threadID\n this.drawTimerLoop(threadID)\n }\n\n stopDrawLoop () {\n this._drawTimerThread = null\n }\n\n drawTimerLoop (threadID) {\n if (!threadID || threadID !== this._drawTimerThread) return\n window.requestAnimationFrame(() => this.drawTimerLoop(threadID))\n this.draw('draw-loop')\n }\n\n /**\n * Converts an alphabetic character to its fraktur variant.\n * @param {string} character - the character\n * @returns {string} the converted character\n */\n static alphaToFraktur (character) {\n if (character >= 'a' && character <= 'z') {\n character = String.fromCodePoint(0x1d51e - 0x61 + character.charCodeAt(0))\n } else if (character >= 'A' && character <= 'Z') {\n character = frakturExceptions[character] || String.fromCodePoint(0x1d504 - 0x41 + character.charCodeAt(0))\n }\n return character\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./js/term/screen_renderer.js","const EventEmitter = require('events')\nconst $ = require('../lib/chibi')\nlet demo\ntry { demo = require('./demo') } catch (err) {}\n\n/** Handle connections */\nmodule.exports = class TermConnection extends EventEmitter {\n constructor (screen) {\n super()\n\n this.screen = screen\n this.ws = null\n this.heartbeatTimeout = null\n this.pingInterval = null\n this.xoff = false\n this.autoXoffTimeout = null\n this.reconnTimeout = null\n this.forceClosing = false\n\n this.pageShown = false\n\n this.disconnectTimeout = null\n\n document.addEventListener('visibilitychange', () => {\n if (document.hidden === true) {\n console.info('Window lost focus, freeing socket')\n // Delayed, avoid disconnecting if the background time is short\n this.disconnectTimeout = setTimeout(() => {\n this.closeSocket()\n clearTimeout(this.heartbeatTimeout)\n }, 1000)\n } else {\n clearTimeout(this.disconnectTimeout)\n console.info('Window got focus, re-connecting')\n this.init()\n }\n }, false)\n }\n\n onWSOpen (evt) {\n console.log('CONNECTED')\n this.heartbeat()\n this.send('i')\n this.forceClosing = false\n\n this.emit('connect')\n }\n\n onWSClose (evt) {\n if (this.forceClosing) {\n this.forceClosing = false\n return\n }\n console.warn('SOCKET CLOSED, code ' + evt.code + '. Reconnecting...')\n if (evt.code < 1000) {\n console.error('Bad code from socket!')\n // this sometimes happens for unknown reasons, code < 1000 is invalid\n // location.reload()\n }\n\n clearTimeout(this.reconnTimeout)\n this.reconnTimeout = setTimeout(() => this.init(), 2000)\n\n this.emit('disconnect', evt.code)\n }\n\n onWSMessage (evt) {\n try {\n switch (evt.data.charAt(0)) {\n case '.':\n // heartbeat, no-op message\n break\n\n case '-':\n // console.log('xoff');\n this.xoff = true\n this.autoXoffTimeout = setTimeout(() => {\n this.xoff = false\n }, 250)\n break\n\n case '+':\n // console.log('xon');\n this.xoff = false\n clearTimeout(this.autoXoffTimeout)\n break\n\n default:\n this.screen.load(evt.data)\n if (!this.pageShown) {\n window.showPage()\n this.pageShown = true\n }\n break\n }\n this.heartbeat()\n } catch (e) {\n console.error(e)\n }\n }\n\n canSend () {\n return !this.xoff\n }\n\n send (message) {\n if (window._demo) {\n if (typeof window.demoInterface !== 'undefined') {\n demo.input(message)\n } else {\n console.log(`TX: ${JSON.stringify(message)}`)\n }\n return true // Simulate success\n }\n if (this.xoff) {\n // TODO queue\n console.log(\"Can't send, flood control.\")\n return false\n }\n\n if (!this.ws) return false // for dry testing\n if (this.ws.readyState !== 1) {\n console.error('Socket not ready')\n return false\n }\n if (typeof message !== 'string') {\n message = JSON.stringify(message)\n }\n this.ws.send(message)\n return true\n }\n\n /** Safely close the socket */\n closeSocket () {\n if (this.ws) {\n this.forceClosing = true\n if (this.ws.readyState === 1) this.ws.close()\n this.ws = null\n }\n }\n\n init () {\n if (window._demo) {\n if (typeof window.demoInterface === 'undefined') {\n window.alert('Demoing non-demo build!') // this will catch mistakes when deploying to the website\n } else {\n demo.init(this.screen)\n }\n return\n }\n\n clearTimeout(this.reconnTimeout)\n clearTimeout(this.heartbeatTimeout)\n\n this.closeSocket()\n\n this.ws = new window.WebSocket('ws://' + window._root + '/term/update.ws')\n this.ws.addEventListener('open', (...args) => this.onWSOpen(...args))\n this.ws.addEventListener('close', (...args) => this.onWSClose(...args))\n this.ws.addEventListener('message', (...args) => this.onWSMessage(...args))\n console.log('Opening socket.')\n this.heartbeat()\n\n this.emit('open')\n }\n\n heartbeat () {\n clearTimeout(this.heartbeatTimeout)\n this.heartbeatTimeout = setTimeout(() => this.onHeartbeatFail(), 2500)\n }\n\n onHeartbeatFail () {\n this.closeSocket()\n this.emit('silence')\n console.error('Heartbeat lost, probing server...')\n clearInterval(this.pingInterval)\n\n this.pingInterval = setInterval(() => {\n console.log('> ping')\n this.emit('ping')\n $.get('http://' + window._root + '/system/ping', (resp, status) => {\n if (status === 200) {\n clearInterval(this.pingInterval)\n console.info('Server ready, opening socket…')\n this.emit('ping-success')\n this.init()\n // location.reload()\n } else this.emit('ping-fail', status)\n }, {\n timeout: 100,\n loader: false // we have loader on-screen\n })\n }, 1000)\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./js/term/connection.js","const $ = require('../lib/chibi')\nconst { encode2B } = require('../utils')\n\n/**\n * User input\n *\n * --- Rx messages: ---\n * S - screen content (binary encoding of the entire screen with simple compression)\n * T - text labels - Title and buttons, \\0x01-separated\n * B - beep\n * . - heartbeat\n *\n * --- Tx messages ---\n * s - string\n * b - action button\n * p - mb press\n * r - mb release\n * m - mouse move\n */\nmodule.exports = function (conn, screen) {\n // handle for input object\n let input\n\n const KEY_NAMES = {\n 0x03: 'Cancel',\n 0x06: 'Help',\n 0x08: 'Backspace',\n 0x09: 'Tab',\n 0x0C: 'Clear',\n 0x0D: 'Enter',\n 0x10: 'Shift',\n 0x11: 'Control',\n 0x12: 'Alt',\n 0x13: 'Pause',\n 0x14: 'CapsLock',\n 0x1B: 'Escape',\n 0x20: ' ',\n 0x21: 'PageUp',\n 0x22: 'PageDown',\n 0x23: 'End',\n 0x24: 'Home',\n 0x25: 'ArrowLeft',\n 0x26: 'ArrowUp',\n 0x27: 'ArrowRight',\n 0x28: 'ArrowDown',\n 0x29: 'Select',\n 0x2A: 'Print',\n 0x2B: 'Execute',\n 0x2C: 'PrintScreen',\n 0x2D: 'Insert',\n 0x2E: 'Delete',\n 0x3A: ':',\n 0x3B: ';',\n 0x3C: '<',\n 0x3D: '=',\n 0x3E: '>',\n 0x3F: '?',\n 0x40: '@',\n 0x5B: 'Meta',\n 0x5C: 'Meta',\n 0x5D: 'ContextMenu',\n 0x6A: 'Numpad*',\n 0x6B: 'Numpad+',\n 0x6D: 'Numpad-',\n 0x6E: 'Numpad.',\n 0x6F: 'Numpad/',\n 0x90: 'NumLock',\n 0x91: 'ScrollLock',\n 0xA0: '^',\n 0xA1: '!',\n 0xA2: '\"',\n 0xA3: '#',\n 0xA4: '$',\n 0xA5: '%',\n 0xA6: '&',\n 0xA7: '_',\n 0xA8: '(',\n 0xA9: ')',\n 0xAA: '*',\n 0xAB: '+',\n 0xAC: '|',\n 0xAD: '-',\n 0xAE: '{',\n 0xAF: '}',\n 0xB0: '~',\n 0xBA: ';',\n 0xBB: '=',\n 0xBC: 'Numpad,',\n 0xBD: '-',\n 0xBE: 'Numpad,',\n 0xC0: '`',\n 0xC2: 'Numpad,',\n 0xDB: '[',\n 0xDC: '\\\\',\n 0xDD: ']',\n 0xDE: \"'\",\n 0xE0: 'Meta'\n }\n // numbers 0-9\n for (let i = 0x30; i <= 0x39; i++) KEY_NAMES[i] = String.fromCharCode(i)\n // characters A-Z\n for (let i = 0x41; i <= 0x5A; i++) KEY_NAMES[i] = String.fromCharCode(i)\n // function F1-F20\n for (let i = 0x70; i <= 0x83; i++) KEY_NAMES[i] = `F${i - 0x70 + 1}`\n // numpad 0-9\n for (let i = 0x60; i <= 0x69; i++) KEY_NAMES[i] = `Numpad${i - 0x60}`\n\n let cfg = {\n np_alt: false, // Application Numpad Mode\n cu_alt: false, // Application Cursors Mode\n fn_alt: false, // SS3 function keys mode\n mt_click: false, // Mouse click tracking\n mt_move: false, // Mouse move tracking\n no_keys: false, // Suppress any key / clipboard event intercepting\n crlf_mode: false, // Enter sends CR LF\n all_fn: false // Capture also F5, F11 and F12\n }\n\n /** Fn alt choice for key message */\n const fa = (alt, normal) => cfg.fn_alt ? alt : normal\n\n /** Cursor alt choice for key message */\n const ca = (alt, normal) => cfg.cu_alt ? alt : normal\n\n /** Numpad alt choice for key message */\n const na = (alt, normal) => cfg.np_alt ? alt : normal\n\n const keymap = {\n /* eslint-disable key-spacing */\n 'Backspace': '\\x08',\n 'Tab': '\\x09',\n 'Enter': () => cfg.crlf_mode ? '\\x0d\\x0a' : '\\x0d',\n 'Control+Enter': '\\x0a',\n 'Escape': '\\x1b',\n 'ArrowUp': () => ca('\\x1bOA', '\\x1b[A'),\n 'ArrowDown': () => ca('\\x1bOB', '\\x1b[B'),\n 'ArrowRight': () => ca('\\x1bOC', '\\x1b[C'),\n 'ArrowLeft': () => ca('\\x1bOD', '\\x1b[D'),\n 'Home': () => ca('\\x1bOH', fa('\\x1b[H', '\\x1b[1~')),\n 'Insert': '\\x1b[2~',\n 'Delete': '\\x1b[3~',\n 'End': () => ca('\\x1bOF', fa('\\x1b[F', '\\x1b[4~')),\n 'PageUp': '\\x1b[5~',\n 'PageDown': '\\x1b[6~',\n 'F1': () => fa('\\x1bOP', '\\x1b[11~'),\n 'F2': () => fa('\\x1bOQ', '\\x1b[12~'),\n 'F3': () => fa('\\x1bOR', '\\x1b[13~'),\n 'F4': () => fa('\\x1bOS', '\\x1b[14~'),\n 'F5': '\\x1b[15~', // note the disconnect\n 'F6': '\\x1b[17~',\n 'F7': '\\x1b[18~',\n 'F8': '\\x1b[19~',\n 'F9': '\\x1b[20~',\n 'F10': '\\x1b[21~', // note the disconnect\n 'F11': '\\x1b[23~',\n 'F12': '\\x1b[24~',\n 'Shift+F1': () => fa('\\x1bO1;2P', '\\x1b[25~'),\n 'Shift+F2': () => fa('\\x1bO1;2Q', '\\x1b[26~'), // note the disconnect\n 'Shift+F3': () => fa('\\x1bO1;2R', '\\x1b[28~'),\n 'Shift+F4': () => fa('\\x1bO1;2S', '\\x1b[29~'), // note the disconnect\n 'Shift+F5': () => fa('\\x1b[15;2~', '\\x1b[31~'),\n 'Shift+F6': () => fa('\\x1b[17;2~', '\\x1b[32~'),\n 'Shift+F7': () => fa('\\x1b[18;2~', '\\x1b[33~'),\n 'Shift+F8': () => fa('\\x1b[19;2~', '\\x1b[34~'),\n 'Shift+F9': () => fa('\\x1b[20;2~', '\\x1b[35~'), // 35-38 are not standard - but what is?\n 'Shift+F10': () => fa('\\x1b[21;2~', '\\x1b[36~'),\n 'Shift+F11': () => fa('\\x1b[22;2~', '\\x1b[37~'),\n 'Shift+F12': () => fa('\\x1b[23;2~', '\\x1b[38~'),\n 'Numpad0': () => na('\\x1bOp', '0'),\n 'Numpad1': () => na('\\x1bOq', '1'),\n 'Numpad2': () => na('\\x1bOr', '2'),\n 'Numpad3': () => na('\\x1bOs', '3'),\n 'Numpad4': () => na('\\x1bOt', '4'),\n 'Numpad5': () => na('\\x1bOu', '5'),\n 'Numpad6': () => na('\\x1bOv', '6'),\n 'Numpad7': () => na('\\x1bOw', '7'),\n 'Numpad8': () => na('\\x1bOx', '8'),\n 'Numpad9': () => na('\\x1bOy', '9'),\n 'Numpad*': () => na('\\x1bOR', '*'),\n 'Numpad+': () => na('\\x1bOl', '+'),\n 'Numpad-': () => na('\\x1bOS', '-'),\n 'Numpad.': () => na('\\x1bOn', '.'),\n 'Numpad/': () => na('\\x1bOQ', '/'),\n // we don't implement numlock key (should change in numpad_alt mode,\n // but it's even more useless than the rest and also has the side\n // effect of changing the user's numlock state)\n\n // shortcuts\n 'Control+]': '\\x1b', // alternate way to enter ESC\n 'Control+\\\\': '\\x1c',\n 'Control+[': '\\x1d',\n 'Control+^': '\\x1e',\n 'Control+_': '\\x1f',\n\n // extra controls\n 'Control+ArrowLeft': '\\x1f[1;5D',\n 'Control+ArrowRight': '\\x1f[1;5C',\n 'Control+ArrowUp': '\\x1f[1;5A',\n 'Control+ArrowDown': '\\x1f[1;5B',\n 'Control+Home': '\\x1f[1;5H',\n 'Control+End': '\\x1f[1;5F',\n\n // extra shift controls\n 'Shift+ArrowLeft': '\\x1f[1;2D',\n 'Shift+ArrowRight': '\\x1f[1;2C',\n 'Shift+ArrowUp': '\\x1f[1;2A',\n 'Shift+ArrowDown': '\\x1f[1;2B',\n 'Shift+Home': '\\x1f[1;2H',\n 'Shift+End': '\\x1f[1;2F',\n\n // macOS text editing commands\n 'Alt+ArrowLeft': '\\x1bb', // ⌥← to go back a word (^[b)\n 'Alt+ArrowRight': '\\x1bf', // ⌥→ to go forward one word (^[f)\n 'Meta+ArrowLeft': '\\x01', // ⌘← to go to the beginning of a line (^A)\n 'Meta+ArrowRight': '\\x05', // ⌘→ to go to the end of a line (^E)\n 'Alt+Backspace': '\\x17', // ⌥⌫ to delete a word (^W)\n 'Meta+Backspace': '\\x15', // ⌘⌫ to delete to the beginning of a line (^U)\n\n // copy to clipboard\n 'Control+Shift+C' () {\n screen.copySelectionToClipboard()\n },\n 'Control+Insert' () {\n screen.copySelectionToClipboard()\n },\n\n // toggle debug mode\n 'Control+F12' () {\n screen.window.debug ^= 1\n }\n /* eslint-enable key-spacing */\n }\n\n // ctrl+[A-Z] sent as simple low ASCII codes\n for (let i = 1; i <= 26; i++) {\n keymap[`Control+${String.fromCharCode(0x40 + i)}`] = String.fromCharCode(i)\n }\n\n /** Send a literal message */\n function sendString (str) {\n return conn.send('s' + str)\n }\n\n /** Send a button event */\n function sendButton (n) {\n conn.send('b' + String.fromCharCode(n))\n }\n\n const shouldAcceptEvent = function () {\n if (cfg.no_keys) return false\n if (document.activeElement instanceof window.HTMLTextAreaElement) return false\n return true\n }\n\n const keyBlacklist = [\n 'F5', 'F11', 'F12', 'Shift+F5'\n ]\n\n let softModifiers = {\n alt: false,\n ctrl: false,\n meta: false,\n shift: false\n }\n\n const handleKeyDown = function (e) {\n if (!shouldAcceptEvent()) return\n\n let modifiers = []\n // sorted alphabetically\n if (e.altKey || softModifiers.alt) modifiers.push('Alt')\n if (e.ctrlKey || softModifiers.ctrl) modifiers.push('Control')\n if (e.metaKey || softModifiers.meta) modifiers.push('Meta')\n if (e.shiftKey || softModifiers.shift) modifiers.push('Shift')\n\n let key = KEY_NAMES[e.which] || e.key\n\n // ignore clipboard events\n if ((e.ctrlKey || e.metaKey) && key === 'V') return\n\n let binding = null\n\n for (let name in keymap) {\n let itemModifiers = name.split('+')\n let itemKey = itemModifiers.pop()\n\n if (itemKey === key && itemModifiers.sort().join() === modifiers.join()) {\n if (keyBlacklist.includes(name) && !cfg.all_fn) continue\n binding = keymap[name]\n break\n }\n }\n\n if (binding) {\n if (binding instanceof Function) binding = binding()\n e.preventDefault()\n if (typeof binding === 'string') {\n sendString(binding)\n }\n }\n }\n\n /** Bind/rebind key messages */\n function initKeys ({ allFn }) {\n // This takes care of text characters typed\n window.addEventListener('keypress', function (evt) {\n if (!shouldAcceptEvent()) return\n if (evt.ctrlKey || evt.metaKey) return\n\n let str = ''\n if (evt.key && evt.key.length === 1) str = evt.key\n else if (evt.which && evt.which !== 229) str = String.fromCodePoint(evt.which)\n\n if (str.length > 0 && str.charCodeAt(0) >= 32) {\n // prevent space from scrolling\n if (evt.which === 32) evt.preventDefault()\n sendString(str)\n }\n })\n\n window.addEventListener('keydown', handleKeyDown)\n window.addEventListener('copy', e => {\n if (!shouldAcceptEvent()) return\n let selectedText = screen.getSelectedText()\n if (selectedText) {\n e.preventDefault()\n e.clipboardData.setData('text/plain', selectedText)\n }\n })\n window.addEventListener('paste', e => {\n if (!shouldAcceptEvent()) return\n e.preventDefault()\n let string = e.clipboardData.getData('text/plain')\n if (string.includes('\\n') || string.length > 90) {\n if (!input.termUpload) console.error('input.termUpload is undefined')\n input.termUpload.setContent(string)\n input.termUpload.open()\n } else {\n // simple string, just paste it\n if (screen.bracketedPaste) string = `\\x1b[200~${string}\\x1b[201~`\n sendString(string)\n }\n })\n\n cfg.all_fn = allFn\n }\n\n // mouse button states\n let mb1 = 0\n let mb2 = 0\n let mb3 = 0\n\n /** Init the Input module */\n function init (opts) {\n initKeys(opts)\n\n // Button presses\n $('#action-buttons button').forEach(s => {\n s.addEventListener('click', function (evt) {\n sendButton(+this.dataset['n'])\n })\n })\n\n // global mouse state tracking - for motion reporting\n window.addEventListener('mousedown', evt => {\n if (evt.button === 0) mb1 = 1\n if (evt.button === 1) mb2 = 1\n if (evt.button === 2) mb3 = 1\n })\n\n window.addEventListener('mouseup', evt => {\n if (evt.button === 0) mb1 = 0\n if (evt.button === 1) mb2 = 0\n if (evt.button === 2) mb3 = 0\n })\n }\n\n // record modifier keys\n // bits: Meta, Alt, Shift, Ctrl\n let modifiers = 0b0000\n\n window.addEventListener('keydown', e => {\n if (e.ctrlKey) modifiers |= 1\n if (e.shiftKey) modifiers |= 2\n if (e.altKey) modifiers |= 4\n if (e.metaKey) modifiers |= 8\n })\n window.addEventListener('keyup', e => {\n modifiers = 0\n if (e.ctrlKey) modifiers |= 1\n if (e.shiftKey) modifiers |= 2\n if (e.altKey) modifiers |= 4\n if (e.metaKey) modifiers |= 8\n })\n\n /** Prepare modifiers byte for mouse message */\n function packModifiersForMouse () {\n return modifiers\n }\n\n input = {\n /** Init the Input module */\n init,\n\n /** Send a literal string message */\n sendString,\n\n /** Enable alternate key modes (cursors, numpad, fn) */\n setAlts: function (cu, np, fn, crlf) {\n if (cfg.cu_alt !== cu || cfg.np_alt !== np || cfg.fn_alt !== fn || cfg.crlf_mode !== crlf) {\n cfg.cu_alt = cu\n cfg.np_alt = np\n cfg.fn_alt = fn\n cfg.crlf_mode = crlf\n }\n },\n\n setMouseMode (click, move) {\n cfg.mt_click = click\n cfg.mt_move = move\n },\n\n // Mouse events\n onMouseMove (x, y) {\n if (!cfg.mt_move) return\n const b = mb1 ? 1 : mb2 ? 2 : mb3 ? 3 : 0\n const m = packModifiersForMouse()\n conn.send('m' + encode2B(y) + encode2B(x) + encode2B(b) + encode2B(m))\n },\n\n onMouseDown (x, y, b) {\n if (!cfg.mt_click) return\n if (b > 3 || b < 1) return\n const m = packModifiersForMouse()\n conn.send('p' + encode2B(y) + encode2B(x) + encode2B(b) + encode2B(m))\n },\n\n onMouseUp (x, y, b) {\n if (!cfg.mt_click) return\n if (b > 3 || b < 1) return\n const m = packModifiersForMouse()\n conn.send('r' + encode2B(y) + encode2B(x) + encode2B(b) + encode2B(m))\n // console.log(\"B \",b,\" M \",m);\n },\n\n onMouseWheel (x, y, dir) {\n if (!cfg.mt_click) return\n // -1 ... btn 4 (away from user)\n // +1 ... btn 5 (towards user)\n const m = packModifiersForMouse()\n const b = (dir < 0 ? 4 : 5)\n conn.send('p' + encode2B(y) + encode2B(x) + encode2B(b) + encode2B(m))\n // console.log(\"B \",b,\" M \",m);\n },\n\n /**\n * Prevent capturing keys. This is used for text input\n * modals on the terminal screen\n */\n blockKeys (yes) {\n cfg.no_keys = yes\n },\n\n handleKeyDown,\n softModifiers\n }\n return input\n}\n\n\n\n// WEBPACK FOOTER //\n// ./js/term/input.js","const $ = require('../lib/chibi')\nconst { qs } = require('../utils')\nconst modal = require('../modal')\n\n/** File upload utility */\nmodule.exports = function (conn, input, screen) {\n let lines, // array of lines without newlines\n line_i, // current line index\n fuTout, // timeout handle for line sending\n send_delay_ms, // delay between lines (ms)\n nl_str, // newline string to use\n curLine, // current line (when using fuOil)\n inline_pos // Offset in line (for long lines)\n\n // lines longer than this are split to chunks\n // sending a super-ling string through the socket is not a good idea\n const MAX_LINE_LEN = 128\n\n function openUploadDialog () {\n updateStatus('Ready...')\n modal.show('#fu_modal', onDialogClose)\n $('#fu_form').toggleClass('busy', false)\n input.blockKeys(true)\n }\n\n function onDialogClose () {\n console.log('Upload modal closed.')\n clearTimeout(fuTout)\n line_i = 0\n input.blockKeys(false)\n }\n\n function updateStatus (msg) {\n qs('#fu_prog').textContent = msg\n }\n\n function startUpload () {\n let v = qs('#fu_text').value\n if (!v.length) {\n fuClose()\n return\n }\n\n lines = v.split('\\n')\n line_i = 0\n inline_pos = 0 // offset in line\n send_delay_ms = qs('#fu_delay').value\n\n // sanitize - 0 causes overflows\n if (send_delay_ms < 0) {\n send_delay_ms = 0\n qs('#fu_delay').value = send_delay_ms\n }\n\n nl_str = {\n 'CR': '\\r',\n 'LF': '\\n',\n 'CRLF': '\\r\\n'\n }[qs('#fu_crlf').value]\n\n $('#fu_form').toggleClass('busy', true)\n updateStatus('Starting...')\n uploadLine()\n }\n\n function uploadLine () {\n if (!$('#fu_modal').hasClass('visible')) {\n // Modal is closed, cancel\n return\n }\n\n if (!conn.canSend()) {\n // postpone\n fuTout = setTimeout(uploadLine, 1)\n return\n }\n\n if (inline_pos === 0) {\n curLine = ''\n if (line_i === 0) {\n if (screen.bracketedPaste) {\n curLine = '\\x1b[200~'\n }\n }\n\n curLine += lines[line_i++] + nl_str\n\n if (line_i === lines.length) {\n if (screen.bracketedPaste) {\n curLine += '\\x1b[201~'\n }\n }\n }\n\n let chunk\n if ((curLine.length - inline_pos) <= MAX_LINE_LEN) {\n chunk = curLine.substr(inline_pos, MAX_LINE_LEN)\n inline_pos = 0\n } else {\n chunk = curLine.substr(inline_pos, MAX_LINE_LEN)\n inline_pos += MAX_LINE_LEN\n }\n\n if (!input.sendString(chunk)) {\n updateStatus('FAILED!')\n return\n }\n\n let pt = Math.round((line_i / lines.length) * 1000) / 10\n updateStatus(`${line_i} / ${lines.length} (${pt}%)`)\n\n if (lines.length > line_i || inline_pos > 0) {\n fuTout = setTimeout(uploadLine, send_delay_ms)\n } else {\n closeWhenReady()\n }\n }\n\n function closeWhenReady () {\n if (!conn.canSend()) {\n // stuck in XOFF still, wait to process...\n updateStatus('Waiting for Tx buffer...')\n setTimeout(closeWhenReady, 100)\n } else {\n updateStatus('Done.')\n // delay to show it\n fuClose()\n }\n }\n\n function fuClose () {\n modal.hide('#fu_modal')\n }\n\n return {\n init: function () {\n qs('#fu_file').addEventListener('change', function (evt) {\n let reader = new window.FileReader()\n let file = evt.target.files[0]\n let ftype = file.type || 'application/octet-stream'\n console.log('Selected file type: ' + ftype)\n if (!ftype.match(/text\\/.*|application\\/(json|csv|.*xml.*|.*script.*|x-php)/)) {\n // Deny load of blobs like img - can crash browser and will get corrupted anyway\n if (!window.confirm(`This does not look like a text file: ${ftype}\\nReally load?`)) {\n qs('#fu_file').value = ''\n return\n }\n }\n reader.onload = function (e) {\n const txt = e.target.result.replace(/[\\r\\n]+/, '\\n')\n qs('#fu_text').value = txt\n }\n console.log('Loading file...')\n reader.readAsText(file)\n }, false)\n\n qs('#term-fu-open').addEventListener('click', function () {\n openUploadDialog()\n return false\n })\n\n qs('#term-fu-start').addEventListener('click', function () {\n startUpload()\n return false\n })\n\n qs('#term-fu-close').addEventListener('click', function () {\n fuClose()\n return false\n })\n },\n open: openUploadDialog,\n setContent (content) {\n qs('#fu_text').value = content\n }\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./js/term/upload.js","const { qs } = require('../utils')\n\nmodule.exports = function (screen, input) {\n const keyInput = qs('#softkb-input')\n if (!keyInput) return // abort, we're not on the terminal page\n\n const shortcutBar = document.createElement('div')\n shortcutBar.id = 'keyboard-shortcut-bar'\n if (navigator.userAgent.match(/iPad|iPhone|iPod/)) {\n qs('#screen').appendChild(shortcutBar)\n }\n\n let keyboardOpen = false\n\n // moves the input to where the cursor is on the canvas.\n // this is because most browsers will always scroll to wherever the focused\n // input is\n let updateInputPosition = function () {\n if (!keyboardOpen) return\n\n let [x, y] = screen.gridToScreen(screen.cursor.x, screen.cursor.y, true)\n keyInput.style.transform = `translate(${x}px, ${y}px)`\n }\n\n keyInput.addEventListener('focus', () => {\n keyboardOpen = true\n updateInputPosition()\n shortcutBar.classList.add('open')\n })\n\n keyInput.addEventListener('blur', () => {\n keyboardOpen = false\n shortcutBar.classList.remove('open')\n })\n\n screen.on('cursor-moved', updateInputPosition)\n\n qs('#term-kb-open').addEventListener('click', e => {\n e.preventDefault()\n keyInput.focus()\n })\n\n // Chrome for Android doesn't send proper keydown/keypress events with\n // real key values instead of 229 “Unidentified,” so here's a workaround\n // that deals with the input composition events.\n\n let lastCompositionString = ''\n\n // sends the difference between the last and the new composition string\n let sendInputDelta = function (newValue) {\n let resend = false\n if (newValue.length > lastCompositionString.length) {\n if (newValue.startsWith(lastCompositionString)) {\n // characters have been added at the end\n input.sendString(newValue.substr(lastCompositionString.length))\n } else resend = true\n } else if (newValue.length < lastCompositionString.length) {\n if (lastCompositionString.startsWith(newValue)) {\n // characters have been removed at the end\n input.sendString('\\b'.repeat(lastCompositionString.length -\n newValue.length))\n } else resend = true\n } else if (newValue !== lastCompositionString) resend = true\n\n if (resend) {\n // the entire string changed; resend everything\n input.sendString('\\b'.repeat(lastCompositionString.length) +\n newValue)\n }\n lastCompositionString = newValue\n }\n\n keyInput.addEventListener('keydown', e => {\n if (e.key === 'Unidentified') return\n\n keyInput.value = ''\n\n e.stopPropagation()\n input.handleKeyDown(e)\n })\n\n keyInput.addEventListener('keypress', e => {\n // prevent key duplication on iOS (because Safari *does* send proper events)\n e.stopPropagation()\n })\n\n keyInput.addEventListener('input', e => {\n e.stopPropagation()\n\n if (e.isComposing && 'data' in e) {\n sendInputDelta(e.data)\n } else if (e.isComposing) {\n // Firefox Mobile doesn't support InputEvent#data, so here's a hack\n // that just takes the input value and uses that\n sendInputDelta(keyInput.value)\n } else {\n if (e.inputType === 'insertCompositionText') input.sendString(e.data)\n else if (e.inputType === 'deleteContentBackward') {\n lastCompositionString = ''\n sendInputDelta('')\n } else if (e.inputType === 'insertText') {\n input.sendString(e.data)\n }\n }\n })\n\n keyInput.addEventListener('compositionstart', e => {\n lastCompositionString = ''\n })\n\n keyInput.addEventListener('compositionend', e => {\n lastCompositionString = ''\n keyInput.value = ''\n })\n\n screen.on('open-soft-keyboard', () => keyInput.focus())\n\n // shortcut bar\n const shortcuts = {\n Control: 'ctrl',\n Esc: 0x1b,\n Tab: 0x09,\n '←': 0x25,\n '↓': 0x28,\n '↑': 0x26,\n '→': 0x27\n }\n\n let touchMoved = false\n\n for (const shortcut in shortcuts) {\n const button = document.createElement('button')\n button.classList.add('shortcut-button')\n button.textContent = shortcut\n shortcutBar.appendChild(button)\n\n const key = shortcuts[shortcut]\n if (typeof key === 'string') button.classList.add('modifier')\n button.addEventListener('touchstart', e => {\n touchMoved = false\n if (typeof key === 'string') {\n // modifier button\n input.softModifiers[key] = true\n button.classList.add('enabled')\n\n // prevent default. This prevents scrolling, but also prevents the\n // selection popup\n e.preventDefault()\n }\n })\n window.addEventListener('touchmove', e => {\n touchMoved = true\n })\n button.addEventListener('touchend', e => {\n e.preventDefault()\n if (typeof key === 'number') {\n if (touchMoved) return\n let fakeEvent = { which: key, preventDefault: () => {} }\n input.handleKeyDown(fakeEvent)\n } else if (typeof key === 'string') {\n button.classList.remove('enabled')\n input.softModifiers[key] = false\n }\n })\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./js/term/soft_keyboard.js","const { mk } = require('../utils')\n\nmodule.exports = function attachDebugScreen (screen) {\n const debugCanvas = mk('canvas')\n const ctx = debugCanvas.getContext('2d')\n\n debugCanvas.style.position = 'absolute'\n // hackity hack should probably set this in CSS\n debugCanvas.style.top = '6px'\n debugCanvas.style.left = '6px'\n debugCanvas.style.pointerEvents = 'none'\n\n let addCanvas = function () {\n if (!debugCanvas.parentNode) screen.canvas.parentNode.appendChild(debugCanvas)\n }\n let removeCanvas = function () {\n if (debugCanvas.parentNode) debugCanvas.parentNode.removeChild(debugCanvas)\n }\n let updateCanvasSize = function () {\n let { width, height, devicePixelRatio } = screen.window\n let cellSize = screen.getCellSize()\n debugCanvas.width = width * cellSize.width * devicePixelRatio\n debugCanvas.height = height * cellSize.height * devicePixelRatio\n debugCanvas.style.width = `${width * cellSize.width}px`\n debugCanvas.style.height = `${height * cellSize.height}px`\n }\n\n let startTime, endTime, lastReason\n let cells = new Map()\n let clippedRects = []\n\n let startDrawing\n\n screen._debug = {\n drawStart (reason) {\n lastReason = reason\n startTime = Date.now()\n clippedRects = []\n },\n drawEnd () {\n endTime = Date.now()\n console.log(`Draw: ${lastReason} (${(endTime - startTime)} ms) with fancy graphics: ${screen.window.graphics}`)\n startDrawing()\n },\n setCell (cell, flags) {\n cells.set(cell, [flags, Date.now()])\n },\n clipRect (...args) {\n clippedRects.push(args)\n }\n }\n\n let clipPattern\n {\n let patternCanvas = document.createElement('canvas')\n patternCanvas.width = patternCanvas.height = 12\n let pctx = patternCanvas.getContext('2d')\n pctx.lineWidth = 1\n pctx.strokeStyle = '#00f'\n pctx.beginPath()\n pctx.moveTo(0, 0)\n pctx.lineTo(0 - 4, 12)\n pctx.moveTo(4, 0)\n pctx.lineTo(4 - 4, 12)\n pctx.moveTo(8, 0)\n pctx.lineTo(8 - 4, 12)\n pctx.moveTo(12, 0)\n pctx.lineTo(12 - 4, 12)\n pctx.moveTo(16, 0)\n pctx.lineTo(16 - 4, 12)\n pctx.stroke()\n clipPattern = ctx.createPattern(patternCanvas, 'repeat')\n }\n\n let isDrawing = false\n\n let drawLoop = function () {\n if (isDrawing) window.requestAnimationFrame(drawLoop)\n\n let { devicePixelRatio, width, height } = screen.window\n let { width: cellWidth, height: cellHeight } = screen.getCellSize()\n let screenLength = width * height\n let now = Date.now()\n\n ctx.setTransform(devicePixelRatio, 0, 0, devicePixelRatio, 0, 0)\n ctx.clearRect(0, 0, width * cellWidth, height * cellHeight)\n\n let activeCells = 0\n for (let cell = 0; cell < screenLength; cell++) {\n if (!cells.has(cell) || cells.get(cell)[0] === 0) continue\n\n let [flags, timestamp] = cells.get(cell)\n let elapsedTime = (now - timestamp) / 1000\n\n if (elapsedTime > 1) continue\n\n activeCells++\n ctx.globalAlpha = 0.5 * Math.max(0, 1 - elapsedTime)\n\n let x = cell % width\n let y = Math.floor(cell / width)\n\n if (flags & 1) {\n // redrawn\n ctx.fillStyle = '#f0f'\n }\n if (flags & 2) {\n // updated\n ctx.fillStyle = '#0f0'\n }\n\n ctx.fillRect(x * cellWidth, y * cellHeight, cellWidth, cellHeight)\n\n if (flags & 4) {\n // wide cell\n ctx.lineWidth = 2\n ctx.strokeStyle = '#f00'\n ctx.strokeRect(x * cellWidth, y * cellHeight, cellWidth, cellHeight)\n }\n }\n\n if (clippedRects.length) {\n ctx.globalAlpha = 0.5\n ctx.beginPath()\n\n for (let rect of clippedRects) {\n ctx.rect(...rect)\n }\n\n ctx.fillStyle = clipPattern\n ctx.fill()\n }\n\n if (activeCells === 0) {\n isDrawing = false\n removeCanvas()\n }\n }\n\n startDrawing = function () {\n if (isDrawing) return\n addCanvas()\n updateCanvasSize()\n isDrawing = true\n drawLoop()\n }\n\n // debug toolbar\n const toolbar = mk('div')\n toolbar.classList.add('debug-toolbar')\n let toolbarAttached = false\n\n const attachToolbar = function () {\n screen.canvas.parentNode.appendChild(toolbar)\n }\n const detachToolbar = function () {\n toolbar.parentNode.removeChild(toolbar)\n }\n\n screen.on('update-window:debug', debug => {\n if (debug !== toolbarAttached) {\n toolbarAttached = debug\n if (debug) attachToolbar()\n else detachToolbar()\n }\n })\n\n screen.on('draw', () => {\n if (!toolbarAttached) return\n let cursorCell = screen.cursor.y * screen.window.width + screen.cursor.x\n let cellFG = screen.screenFG[cursorCell]\n let cellBG = screen.screenBG[cursorCell]\n let cellCode = (screen.screen[cursorCell] || '').codePointAt(0)\n let cellAttrs = screen.screenAttrs[cursorCell]\n let hexcode = cellCode.toString(16).toUpperCase()\n if (hexcode.length < 4) hexcode = `0000${hexcode}`.substr(-4)\n hexcode = `U+${hexcode}`\n toolbar.textContent = `Cursor cell (${cursorCell}): ${hexcode} FG: ${cellFG} BG: ${cellBG} Attrs: ${cellAttrs.toString(2)}`\n })\n}\n\n\n\n// WEBPACK FOOTER //\n// ./js/term/debug_screen.js"],"sourceRoot":""} |