Skip to content

Instantly share code, notes, and snippets.

@seangenabe
Created February 8, 2014 16:31
Show Gist options
  • Save seangenabe/8886310 to your computer and use it in GitHub Desktop.
Save seangenabe/8886310 to your computer and use it in GitHub Desktop.
requirebin sketch
var hat = require('hat');
var term = require('term');
term.appendTo('body');
term.writeln(hat());
require=function e(t,r,n){function i(o,a){if(!r[o]){if(!t[o]){var u="function"==typeof require&&require;if(!a&&u)return u(o,!0);if(s)return s(o,!0);throw Error("Cannot find module '"+o+"'")}var c=r[o]={exports:{}};t[o][0].call(c.exports,function(e){var r=t[o][1][e];return i(r?r:e)},c,c.exports,e,t,r,n)}return r[o].exports}for(var s="function"==typeof require&&require,o=0;n.length>o;o++)i(n[o]);return i}({q9zHYP:[function(t,e){var r=e.exports=function(t,e){if(e||(e=16),void 0===t&&(t=128),0>=t)return"0";for(var n=Math.log(Math.pow(2,t))/Math.log(e),i=2;1/0===n;i*=2)n=Math.log(Math.pow(2,t/i))/Math.log(e)*i;for(var s=n-Math.floor(n),o="",i=0;Math.floor(n)>i;i++){var a=Math.floor(Math.random()*e).toString(e);o=a+o}if(s){var u=Math.pow(e,s),a=Math.floor(Math.random()*u).toString(e);o=a+o}var c=parseInt(o,e);return 1/0!==c&&c>=Math.pow(2,t)?r(t,e):o};r.rack=function(t,e,n){var i=function(i){var o=0;do{if(o++>10){if(!n)throw Error("too many ID collisions, use more bits");t+=n}var a=r(t,e)}while(Object.hasOwnProperty.call(s,a));return s[a]=i,a},s=i.hats={};return i.get=function(t){return i.hats[t]},i.set=function(t,e){return i.hats[t]=e,i},i.bits=t||128,i.base=e||16,i}},{}],hat:[function(t,e){e.exports=t("q9zHYP")},{}]},{},[]),require=function e(t,r,n){function i(o,a){if(!r[o]){if(!t[o]){var u="function"==typeof require&&require;if(!a&&u)return u(o,!0);if(s)return s(o,!0);throw Error("Cannot find module '"+o+"'")}var c=r[o]={exports:{}};t[o][0].call(c.exports,function(e){var r=t[o][1][e];return i(r?r:e)},c,c.exports,e,t,r,n)}return r[o].exports}for(var s="function"==typeof require&&require,o=0;n.length>o;o++)i(n[o]);return i}({ThRicn:[function(t,e){"use strict";function r(t){var e=t.getAttribute("style")||"";t.setAttribute("style",e+"overflow-y: auto; /* white-space: pre; */")}function n(t){t&&(t.scrollTop=t.scrollHeight)}var i=t("./term"),s=t("through");e.exports=function(t){var e=new i(t);e.open();var o=s(e.write.bind(e));return o.appendTo=function(t){"string"==typeof t&&(t=document.querySelector(t)),t.appendChild(e.element),r(t),o.container=t,e.element.style.position="relative"},o.writeln=function(t){e.writeln(t),o.tail&&n(o.container)},o.write=function(t){e.write(t),o.tail&&n(o.container)},o.reset=e.reset.bind(e),o.element=e.element,o.term=e,o}},{"./term":30,through:29}],hypernal:[function(t,e){e.exports=t("ThRicn")},{}],3:[function(t,e){"use strict";e.exports=function(t){t.prototype.blankLine=function(t){for(var e=t?this.curAttr:this.defAttr,r=[e," "],n=[],i=0;this.cols>i;i++)n[i]=r;return n}}},{}],4:[function(t,e){"use strict";e.exports=function(t){t.charsets={},t.charsets.SCLD={"`":"◆",a:"▒",b:" ",c:"\f",d:"\r",e:"\n",f:"°",g:"±",h:"␤",i:" ",j:"┘",k:"┐",l:"┌",m:"└",n:"┼",o:"⎺",p:"⎻",q:"─",r:"⎼",s:"⎽",t:"├",u:"┤",v:"┴",w:"┬",x:"│",y:"≤",z:"≥","{":"π","|":"≠","}":"£","~":"·"},t.charsets.UK=null,t.charsets.US=null,t.charsets.Dutch=null,t.charsets.Finnish=null,t.charsets.French=null,t.charsets.FrenchCanadian=null,t.charsets.German=null,t.charsets.Italian=null,t.charsets.NorwegianDanish=null,t.charsets.Spanish=null,t.charsets.Swedish=null,t.charsets.Swiss=null,t.charsets.ISOLatin=null}},{}],5:[function(t,e){"use strict";e.exports=function(t){t.colors=["#2e3436","#cc0000","#4e9a06","#c4a000","#3465a4","#75507b","#06989a","#d3d7cf","#555753","#ef2929","#8ae234","#fce94f","#729fcf","#ad7fa8","#34e2e2","#eeeeec"],t.colors=function(){function e(t,e,n){i.push("#"+r(t)+r(e)+r(n))}function r(t){return t=t.toString(16),2>t.length?"0"+t:t}var n,i=t.colors,s=[0,95,135,175,215,255];for(n=0;216>n;n++)e(s[0|n/36%6],s[0|n/6%6],s[n%6]);for(n=0;24>n;n++)s=8+10*n,e(s,s,s);return i}(),t.defaultColors={bg:"#000000",fg:"#f0f0f0"},t.colors[256]=t.defaultColors.bg,t.colors[257]=t.defaultColors.fg}},{}],6:[function(t,e){"use strict";e.exports=function(t){t.prototype.charAttributes=function(t){for(var e,r,n,i=t.length,s=0;i>s;s++)if(n=t[s],n>=30&&37>=n)this.curAttr=-261633&this.curAttr|n-30<<9;else if(n>=40&&47>=n)this.curAttr=-512&this.curAttr|n-40;else if(n>=90&&97>=n)n+=8,this.curAttr=-261633&this.curAttr|n-90<<9;else if(n>=100&&107>=n)n+=8,this.curAttr=-512&this.curAttr|n-100;else if(0===n)this.curAttr=this.defAttr;else if(1===n)this.curAttr=this.curAttr|1<<18;else if(4===n)this.curAttr=this.curAttr|2<<18;else if(7===n||27===n){if(7===n){if(4&this.curAttr>>18)continue;this.curAttr=this.curAttr|4<<18}else if(27===n){if(4&~(this.curAttr>>18))continue;this.curAttr=-1048577&this.curAttr}e=511&this.curAttr,r=511&this.curAttr>>9,this.curAttr=-262144&this.curAttr|(e<<9|r)}else if(22===n)this.curAttr=-262145&this.curAttr;else if(24===n)this.curAttr=-524289&this.curAttr;else if(39===n)this.curAttr=-261633&this.curAttr,this.curAttr=this.curAttr|(511&this.defAttr>>9)<<9;else if(49===n)this.curAttr=-512&this.curAttr,this.curAttr=this.curAttr|511&this.defAttr;else if(38===n){if(5!==t[s+1])continue;s+=2,n=255&t[s],this.curAttr=-261633&this.curAttr|n<<9}else if(48===n){if(5!==t[s+1])continue;s+=2,n=255&t[s],this.curAttr=-512&this.curAttr|n}}}},{}],7:[function(t,e){"use strict";e.exports=function(t){t.prototype.saveCursor=function(){this.savedX=this.x,this.savedY=this.y},t.prototype.restoreCursor=function(){this.x=this.savedX||0,this.y=this.savedY||0},t.prototype.cursorUp=function(t){var e=t[0];1>e&&(e=1),this.y-=e,0>this.y&&(this.y=0)},t.prototype.cursorDown=function(t){var e=t[0];1>e&&(e=1),this.y+=e,this.y>=this.rows&&(this.y=this.rows-1)},t.prototype.cursorForward=function(t){var e=t[0];1>e&&(e=1),this.x+=e,this.x>=this.cols&&(this.x=this.cols-1)},t.prototype.cursorBackward=function(t){var e=t[0];1>e&&(e=1),this.x-=e,0>this.x&&(this.x=0)},t.prototype.cursorPos=function(t){var e,r;e=t[0]-1,r=t.length>=2?t[1]-1:0,0>e?e=0:e>=this.rows&&(e=this.rows-1),0>r?r=0:r>=this.cols&&(r=this.cols-1),this.x=r,this.y=e},t.prototype.cursorNextLine=function(t){var e=t[0];1>e&&(e=1),this.y+=e,this.y>=this.rows&&(this.y=this.rows-1),this.x=0},t.prototype.cursorPrecedingLine=function(t){var e=t[0];1>e&&(e=1),this.y-=e,0>this.y&&(this.y=0),this.x=0},t.prototype.cursorCharAbsolute=function(t){var e=t[0];1>e&&(e=1),this.x=e-1},t.prototype.cursorForwardTab=function(t){for(var e=t[0]||1;e--;)this.x=this.nextStop()},t.prototype.cursorBackwardTab=function(t){for(var e=t[0]||1;e--;)this.x=this.prevStop()}}},{}],8:[function(t,e){"use strict";e.exports=function(t){t.prototype.insertChars=function(t){var e,r,n,i;for(e=t[0],1>e&&(e=1),r=this.y+this.ybase,n=this.x,i=[this.curAttr," "];e--&&this.cols>n;)this.lines[r].splice(n++,0,i),this.lines[r].pop()},t.prototype.insertLines=function(t){var e,r,n;for(e=t[0],1>e&&(e=1),r=this.y+this.ybase,n=this.rows-1-this.scrollBottom,n=this.rows-1+this.ybase-n+1;e--;)this.lines.splice(r,0,this.blankLine(!0)),this.lines.splice(n,1);this.updateRange(this.y),this.updateRange(this.scrollBottom)},t.prototype.deleteLines=function(t){var e,r,n;for(e=t[0],1>e&&(e=1),r=this.y+this.ybase,n=this.rows-1-this.scrollBottom,n=this.rows-1+this.ybase-n;e--;)this.lines.splice(n+1,0,this.blankLine(!0)),this.lines.splice(r,1);this.updateRange(this.y),this.updateRange(this.scrollBottom)},t.prototype.deleteChars=function(t){var e,r,n;for(e=t[0],1>e&&(e=1),r=this.y+this.ybase,n=[this.curAttr," "];e--;)this.lines[r].splice(this.x,1),this.lines[r].push(n)},t.prototype.eraseChars=function(t){var e,r,n,i;for(e=t[0],1>e&&(e=1),r=this.y+this.ybase,n=this.x,i=[this.curAttr," "];e--&&this.cols>n;)this.lines[r][n++]=i}}},{}],9:[function(t,e){"use strict";e.exports=function(t){t.prototype.charPosAbsolute=function(t){var e=t[0];1>e&&(e=1),this.x=e-1,this.x>=this.cols&&(this.x=this.cols-1)},t.prototype.HPositionRelative=function(t){var e=t[0];1>e&&(e=1),this.x+=e,this.x>=this.cols&&(this.x=this.cols-1)},t.prototype.linePosAbsolute=function(t){var e=t[0];1>e&&(e=1),this.y=e-1,this.y>=this.rows&&(this.y=this.rows-1)},t.prototype.VPositionRelative=function(t){var e=t[0];1>e&&(e=1),this.y+=e,this.y>=this.rows&&(this.y=this.rows-1)},t.prototype.HVPosition=function(t){1>t[0]&&(t[0]=1),1>t[1]&&(t[1]=1),this.y=t[0]-1,this.y>=this.rows&&(this.y=this.rows-1),this.x=t[1]-1,this.x>=this.cols&&(this.x=this.cols-1)}}},{}],10:[function(t,e){"use strict";e.exports=function(t){t.prototype.repeatPrecedingCharacter=function(t){for(var e=t[0]||1,r=this.lines[this.ybase+this.y],n=r[this.x-1]||[this.defAttr," "];e--;)r[this.x++]=n}}},{}],11:[function(t,e){"use strict";e.exports=function(t){t.prototype.softReset=function(){this.cursorHidden=!1,this.insertMode=!1,this.originMode=!1,this.wraparoundMode=!1,this.applicationKeypad=!1,this.scrollTop=0,this.scrollBottom=this.rows-1,this.curAttr=this.defAttr,this.x=this.y=0,this.charset=null,this.glevel=0,this.charsets=[null]}}},{}],12:[function(t,e){"use strict";e.exports=function(t){t.prototype.tabClear=function(t){var e=t[0];0>=e?delete this.tabs[this.x]:3===e&&(this.tabs={})}}},{}],13:[function(t,e){"use strict";e.exports=function(t){t.prototype.log=function(){if(t.debug&&window.console&&window.console.log){var e=Array.prototype.slice.call(arguments);window.console.log.apply(window.console,e)}},t.prototype.error=function(){if(t.debug&&window.console&&window.console.error){var e=Array.prototype.slice.call(arguments);window.console.error.apply(window.console,e)}}}},{}],14:[function(t,e){"use strict";e.exports=function(t){t.prototype.destroy=function(){this.readable=!1,this.writable=!1,this._events={},this.handler=function(){},this.write=function(){}}}},{}],15:[function(t,e){"use strict";e.exports=function(t){t.prototype.eraseRight=function(t,e){for(var r=this.lines[this.ybase+e],n=[this.curAttr," "];this.cols>t;t++)r[t]=n;this.updateRange(e)},t.prototype.eraseLeft=function(t,e){var r=this.lines[this.ybase+e],n=[this.curAttr," "];for(t++;t--;)r[t]=n;this.updateRange(e)},t.prototype.eraseLine=function(t){this.eraseRight(0,t)},t.prototype.eraseInDisplay=function(t){var e;switch(t[0]){case 0:for(this.eraseRight(this.x,this.y),e=this.y+1;this.rows>e;e++)this.eraseLine(e);break;case 1:for(this.eraseLeft(this.x,this.y),e=this.y;e--;)this.eraseLine(e);break;case 2:for(e=this.rows;e--;)this.eraseLine(e);break;case 3:}},t.prototype.eraseInLine=function(t){switch(t[0]){case 0:this.eraseRight(this.x,this.y);break;case 1:this.eraseLeft(this.x,this.y);break;case 2:this.eraseLine(this.y)}}}},{}],16:[function(t,e){"use strict";var r=t("../states");e.exports=function(t){t.prototype.index=function(){this.y++,this.y>this.scrollBottom&&(this.y--,this.scroll()),this.state=r.normal},t.prototype.reverseIndex=function(){var t;this.y--,this.y<this.scrollTop&&(this.y++,this.lines.splice(this.y+this.ybase,0,this.blankLine(!0)),t=this.rows-1-this.scrollBottom,this.lines.splice(this.rows-1+this.ybase-t+1,1),this.updateRange(this.scrollTop),this.updateRange(this.scrollBottom)),this.state=r.normal}}},{"../states":25}],17:[function(t,e){"use strict";e.exports=function(t){t.prototype.reset=function(){t.call(this,this.cols,this.rows),this.refresh(0,this.rows-1)}}},{}],18:[function(t,e){"use strict";var r=t("../states");e.exports=function(t){t.prototype.tabSet=function(){this.tabs[this.x]=!0,this.state=r.normal}}},{"../states":25}],19:[function(t,e){"use strict";function r(){var t=document.createElement("span");t.innerHTML="hello world",document.body.appendChild(t);var e=t.scrollWidth;t.style.fontWeight="bold";var r=t.scrollWidth;return document.body.removeChild(t),e!==r}e.exports=function(t){t.prototype.open=function(){var e,n=0;for(this.element=document.createElement("div"),this.element.className="terminal",this.children=[];this.rows>n;n++)e=document.createElement("div"),this.element.appendChild(e),this.children.push(e);this.refresh(0,this.rows-1),null===t.brokenBold&&(t.brokenBold=r()),this.element.style.backgroundColor=t.defaultColors.bg,this.element.style.color=t.defaultColors.fg}}},{}],20:[function(t,e){"use strict";e.exports=function(t){t.termName="xterm",t.geometry=[80,24],t.cursorBlink=!0,t.visualBell=!1,t.popOnBell=!1,t.scrollback=1e3,t.screenKeys=!1,t.programFeatures=!1,t.debug=!1}},{}],21:[function(t,e){"use strict";function r(){for(;this.y>=this.rows;){this.lines.push(this.blankLine());var t=document.createElement("div");this.element.appendChild(t),this.children.push(t),this.rows++}}e.exports=function(t){t.prototype.updateRange=function(t){this.refreshStart>t&&(this.refreshStart=t),t>this.refreshEnd&&(this.refreshEnd=t),r.bind(this)()},t.prototype.maxRange=function(){this.refreshStart=0,this.refreshEnd=this.rows-1}}},{}],22:[function(t,e){"use strict";e.exports=function(t){t.prototype.refresh=function(e,r){var n,i,s,o,a,u,c,h,f,l,p,d,g,y;for(c=this.cols,i=e;r>=i;i++){if(g=i+this.ydisp,o=this.lines[g],!o)return this.reset();for(a="",n=i===this.y&&this.cursorState&&this.ydisp===this.ybase&&!this.cursorHidden?this.x:-1,f=this.defAttr,s=0;c>s;s++){switch(h=o[s][0],u=o[s][1],s===n&&(h=-1),h!==f&&(f!==this.defAttr&&(a+="</span>"),h!==this.defAttr&&(-1===h?a+='<span class="reverse-video">':(a+='<span style="',p=511&h,l=511&h>>9,d=h>>18,1&d&&(t.brokenBold||(a+="font-weight:bold;"),8>l&&(l+=8)),2&d&&(a+="text-decoration:underline;"),256!==p&&(a+="background-color:"+t.colors[p]+";"),257!==l&&(a+="color:"+t.colors[l]+";"),a+='">'))),u){case"&":a+="&";break;case"<":a+="<";break;case">":a+=">";break;default:a+=" ">=u?" ":u}f=h}f!==this.defAttr&&(a+="</span>"),this.children[i].innerHTML=a}y&&y.appendChild(this.element)}}},{}],23:[function(t,e){"use strict";e.exports=function(t){t.prototype.setgCharset=function(t,e){this.charsets[t]=e,this.glevel===t&&(this.charset=e)}}},{}],24:[function(t,e){"use strict";e.exports=function(t){t.prototype.setgLevel=function(t){this.glevel=t,this.charset=this.charsets[t]}}},{}],25:[function(t,e){"use strict";e.exports={normal:0,escaped:1,csi:2,osc:3,charset:4,dcs:5,ignore:6}},{}],26:[function(t,e){"use strict";e.exports=function(t){t.prototype.setupStops=function(t){for(null!=t?this.tabs[t]||(t=this.prevStop(t)):(this.tabs={},t=0);this.cols>t;t+=8)this.tabs[t]=!0},t.prototype.prevStop=function(t){for(null==t&&(t=this.x);!this.tabs[--t]&&t>0;);return t>=this.cols?this.cols-1:0>t?0:t},t.prototype.nextStop=function(t){for(null==t&&(t=this.x);!this.tabs[++t]&&this.cols>t;);return t>=this.cols?this.cols-1:0>t?0:t}}},{}],27:[function(t,e){"use strict";e.exports=function(t){t.prototype.ch=function(t){return t?[this.curAttr," "]:[this.defAttr," "]},t.prototype.is=function(e){var r=this.termName||t.termName;return 0===(r+"").indexOf(e)}}},{}],28:[function(t,e){"use strict";function r(t){return t.replace(/([^\r])\n/g,"$1\r\n")}function n(t){return/(^|\n) /.test(t)?t.split("\n").map(function(t){for(var e=0;" "===t.charAt(0);)t=t.slice(1),e++;for(;e--;)t="&nbsp;"+t;return t}).join("\r\n"):t}var i=t("./states");e.exports=function(t){t.prototype.write=function(e){e=r(e),e=n(e);var s,o,a=e.length,u=0;for(this.refreshStart=this.y,this.refreshEnd=this.y,this.ybase!==this.ydisp&&(this.ydisp=this.ybase,this.maxRange());a>u;u++)switch(o=e[u],this.state){case i.normal:switch(o){case"":this.bell();break;case"\n":case" ":case"\f":this.convertEol&&(this.x=0),this.y++;break;case"\r":this.x=0;break;case"\b":this.x>0&&this.x--;break;case" ":this.x=this.nextStop();break;case"":this.setgLevel(1);break;case"":this.setgLevel(0);break;case"":this.state=i.escaped;break;default:o>=" "&&(this.charset&&this.charset[o]&&(o=this.charset[o]),this.x>=this.cols&&(this.x=0,this.y++),this.lines[this.y+this.ybase]&&(this.lines[this.y+this.ybase][this.x]=[this.curAttr,o]),this.x++,this.updateRange(this.y))}break;case i.escaped:switch(o){case"[":this.params=[],this.currentParam=0,this.state=i.csi;break;case"]":this.params=[],this.currentParam=0,this.state=i.osc;break;case"P":this.params=[],this.currentParam=0,this.state=i.dcs;break;case"_":this.stateType="apc",this.state=i.ignore;break;case"^":this.stateType="pm",this.state=i.ignore;break;case"c":this.reset();break;case"E":this.x=0;break;case"D":this.index();break;case"M":this.reverseIndex();break;case"%":this.setgLevel(0),this.setgCharset(0,t.charsets.US),this.state=i.normal,u++;break;case"(":case")":case"*":case"+":case"-":case".":switch(o){case"(":this.gcharset=0;break;case")":this.gcharset=1;break;case"*":this.gcharset=2;break;case"+":this.gcharset=3;break;case"-":this.gcharset=1;break;case".":this.gcharset=2}this.state=i.charset;break;case"/":this.gcharset=3,this.state=i.charset,u--;break;case"N":break;case"O":break;case"n":this.setgLevel(2);break;case"o":this.setgLevel(3);break;case"|":this.setgLevel(3);break;case"}":this.setgLevel(2);break;case"~":this.setgLevel(1);break;case"7":this.saveCursor(),this.state=i.normal;break;case"8":this.restoreCursor(),this.state=i.normal;break;case"#":this.state=i.normal,u++;break;case"H":this.tabSet();break;case"=":this.log("Serial port requested application keypad."),this.applicationKeypad=!0,this.state=i.normal;break;case">":this.log("Switching back to normal keypad."),this.applicationKeypad=!1,this.state=i.normal;break;default:this.state=i.normal,this.error("Unknown ESC control: %s.",o)}break;case i.charset:switch(o){case"0":s=t.charsets.SCLD;break;case"A":s=t.charsets.UK;break;case"B":s=t.charsets.US;break;case"4":s=t.charsets.Dutch;break;case"C":case"5":s=t.charsets.Finnish;break;case"R":s=t.charsets.French;break;case"Q":s=t.charsets.FrenchCanadian;break;case"K":s=t.charsets.German;break;case"Y":s=t.charsets.Italian;break;case"E":case"6":s=t.charsets.NorwegianDanish;break;case"Z":s=t.charsets.Spanish;break;case"H":case"7":s=t.charsets.Swedish;break;case"=":s=t.charsets.Swiss;break;case"/":s=t.charsets.ISOLatin,u++;break;default:s=t.charsets.US}this.setgCharset(this.gcharset,s),this.gcharset=null,this.state=i.normal;break;case i.osc:if(""===o||""===o){switch(""===o&&u++,this.params.push(this.currentParam),this.params[0]){case 0:case 1:case 2:this.params[1]&&(this.title=this.params[1],this.handleTitle(this.title));break;case 3:break;case 4:case 5:break;case 10:case 11:case 12:case 13:case 14:case 15:case 16:case 17:case 18:case 19:break;case 46:break;case 50:break;case 51:break;case 52:break;case 104:case 105:case 110:case 111:case 112:case 113:case 114:case 115:case 116:case 117:case 118:}this.params=[],this.currentParam=0,this.state=i.normal}else this.params.length?this.currentParam+=o:o>="0"&&"9">=o?this.currentParam=10*this.currentParam+o.charCodeAt(0)-48:";"===o&&(this.params.push(this.currentParam),this.currentParam="");break;case i.csi:if("?"===o||">"===o||"!"===o){this.prefix=o;break}if(o>="0"&&"9">=o){this.currentParam=10*this.currentParam+o.charCodeAt(0)-48;break}if("$"===o||'"'===o||" "===o||"'"===o){this.postfix=o;break}if(this.params.push(this.currentParam),this.currentParam=0,";"===o)break;switch(this.state=i.normal,o){case"A":this.cursorUp(this.params);break;case"B":this.cursorDown(this.params);break;case"C":this.cursorForward(this.params);break;case"D":this.cursorBackward(this.params);break;case"H":this.cursorPos(this.params);break;case"J":this.eraseInDisplay(this.params);break;case"K":this.eraseInLine(this.params);break;case"m":this.charAttributes(this.params);break;case"n":this.deviceStatus(this.params);break;case"@":this.insertChars(this.params);break;case"E":this.cursorNextLine(this.params);break;case"F":this.cursorPrecedingLine(this.params);break;case"G":this.cursorCharAbsolute(this.params);break;case"L":this.insertLines(this.params);break;case"M":this.deleteLines(this.params);break;case"P":this.deleteChars(this.params);break;case"X":this.eraseChars(this.params);break;case"`":this.charPosAbsolute(this.params);break;case"a":this.HPositionRelative(this.params);break;case"c":break;case"d":this.linePosAbsolute(this.params);break;case"e":this.VPositionRelative(this.params);break;case"f":this.HVPosition(this.params);break;case"h":break;case"l":break;case"r":break;case"s":this.saveCursor(this.params);break;case"u":this.restoreCursor(this.params);break;case"I":this.cursorForwardTab(this.params);break;case"S":break;case"T":2>this.params.length&&!this.prefix;break;case"Z":this.cursorBackwardTab(this.params);break;case"b":this.repeatPrecedingCharacter(this.params);break;case"g":this.tabClear(this.params);break;case"p":switch(this.prefix){case"!":this.softReset(this.params)}break;default:this.error("Unknown CSI code: %s.",o)}this.prefix="",this.postfix="";break;case i.dcs:if(""===o||""===o){switch(""===o&&u++,this.prefix){case"":break;case"$q":var c=this.currentParam;switch(c){case'"q':c='0"q';break;case'"p':c='61"p';break;case"r":c=""+(this.scrollTop+1)+";"+(this.scrollBottom+1)+"r";break;case"m":c="0m";break;default:this.error("Unknown DCS Pt: %s.",c),c=""}break;case"+p":break;default:this.error("Unknown DCS prefix: %s.",this.prefix)}this.currentParam=0,this.prefix="",this.state=i.normal}else this.currentParam?this.currentParam+=o:this.prefix||"$"===o||"+"===o?2===this.prefix.length?this.currentParam=o:this.prefix+=o:this.currentParam=o;break;case i.ignore:""===o||""===o?(""===o&&u++,this.stateData="",this.state=i.normal):(this.stateData||(this.stateData=""),this.stateData+=o)}this.updateRange(this.y),this.refresh(this.refreshStart,this.refreshEnd)},t.prototype.writeln=function(t){t=t.replace(/ /g,"&nbsp;"),this.write(t+" \r\n")}}},{"./states":25}],29:[function(t,e,r){function n(t,e,r){function n(){for(;c.length&&!f.paused;){var t=c.shift();if(null===t)return f.emit("end");f.emit("data",t)}}function o(){f.writable=!1,e.call(f),!f.readable&&f.autoDestroy&&f.destroy()}t=t||function(t){this.queue(t)},e=e||function(){this.queue(null)};var a=!1,u=!1,c=[],h=!1,f=new s;return f.readable=f.writable=!0,f.paused=!1,f.autoDestroy=!(r&&r.autoDestroy===!1),f.write=function(e){return t.call(this,e),!f.paused},f.queue=f.push=function(t){return h?f:(null==t&&(h=!0),c.push(t),n(),f)},f.on("end",function(){f.readable=!1,!f.writable&&f.autoDestroy&&i.nextTick(function(){f.destroy()})}),f.end=function(t){return a?void 0:(a=!0,arguments.length&&f.write(t),o(),f)},f.destroy=function(){return u?void 0:(u=!0,a=!0,c.length=0,f.writable=f.readable=!1,f.emit("close"),f)},f.pause=function(){return f.paused?void 0:(f.paused=!0,f)},f.resume=function(){return f.paused&&(f.paused=!1,f.emit("resume")),n(),f.paused||f.emit("drain"),f},f}var i=t("__browserify_process"),s=t("stream");r=e.exports=n,n.through=n},{__browserify_process:33,stream:37}],30:[function(t,e){"use strict";function r(t){if(t=t||{},!(this instanceof r))return new r(t);this.cols=t.cols||500,this.rows=t.rows||100,this.ybase=0,this.ydisp=0,this.x=0,this.y=0,this.cursorState=0,this.cursorHidden=!1,this.convertEol=!1,this.state=n.normal,this.queue="",this.scrollTop=0,this.scrollBottom=this.rows-1,this.applicationKeypad=!1,this.originMode=!1,this.insertMode=!1,this.wraparoundMode=!1,this.normal=null,this.charset=null,this.gcharset=null,this.glevel=0,this.charsets=[null],this.element,this.children,this.refreshStart,this.refreshEnd,this.savedX,this.savedY,this.savedCols,this.readable=!0,this.writable=!0,this.defAttr=131840,this.curAttr=this.defAttr,this.params=[],this.currentParam=0,this.prefix="",this.postfix="",this.lines=[];for(var e=this.rows;e--;)this.lines.push(this.blankLine());this.tabs,this.setupStops()}var n=t("./lib/states");e.exports=r,t("./lib/colors")(r),t("./lib/options")(r),t("./lib/open")(r),t("./lib/destroy")(r),t("./lib/refresh")(r),t("./lib/write")(r),t("./lib/setgLevel"),t("./lib/setgCharset"),t("./lib/debug")(r),t("./lib/stops")(r),t("./lib/erase")(r),t("./lib/blankLine")(r),t("./lib/range")(r),t("./lib/util")(r),t("./lib/esc/index.js")(r),t("./lib/esc/reset.js")(r),t("./lib/esc/tabSet.js")(r),t("./lib/csi/charAttributes")(r),t("./lib/csi/insert-delete")(r),t("./lib/csi/position")(r),t("./lib/csi/cursor")(r),t("./lib/csi/repeatPrecedingCharacter")(r),t("./lib/csi/tabClear")(r),t("./lib/csi/softReset")(r),t("./lib/charsets.js")(r)},{"./lib/blankLine":3,"./lib/charsets.js":4,"./lib/colors":5,"./lib/csi/charAttributes":6,"./lib/csi/cursor":7,"./lib/csi/insert-delete":8,"./lib/csi/position":9,"./lib/csi/repeatPrecedingCharacter":10,"./lib/csi/softReset":11,"./lib/csi/tabClear":12,"./lib/debug":13,"./lib/destroy":14,"./lib/erase":15,"./lib/esc/index.js":16,"./lib/esc/reset.js":17,"./lib/esc/tabSet.js":18,"./lib/open":19,"./lib/options":20,"./lib/range":21,"./lib/refresh":22,"./lib/setgCharset":23,"./lib/setgLevel":24,"./lib/states":25,"./lib/stops":26,"./lib/util":27,"./lib/write":28}],31:[function(t,e,r){var n=t("__browserify_process");n.EventEmitter||(n.EventEmitter=function(){});var i=r.EventEmitter=n.EventEmitter,s="function"==typeof Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)},o=10;i.prototype.setMaxListeners=function(t){this._events||(this._events={}),this._events.maxListeners=t},i.prototype.emit=function(t){if("error"===t&&(!this._events||!this._events.error||s(this._events.error)&&!this._events.error.length))throw arguments[1]instanceof Error?arguments[1]:Error("Uncaught, unspecified 'error' event.");if(!this._events)return!1;var e=this._events[t];if(!e)return!1;if("function"==typeof e){switch(arguments.length){case 1:e.call(this);break;case 2:e.call(this,arguments[1]);break;case 3:e.call(this,arguments[1],arguments[2]);break;default:var r=Array.prototype.slice.call(arguments,1);e.apply(this,r)}return!0}if(s(e)){for(var r=Array.prototype.slice.call(arguments,1),n=e.slice(),i=0,o=n.length;o>i;i++)n[i].apply(this,r);return!0}return!1},i.prototype.addListener=function(t,e){if("function"!=typeof e)throw Error("addListener only takes instances of Function");if(this._events||(this._events={}),this.emit("newListener",t,e),this._events[t])if(s(this._events[t])){if(!this._events[t].warned){var r;r=void 0!==this._events.maxListeners?this._events.maxListeners:o,r&&r>0&&this._events[t].length>r&&(this._events[t].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[t].length),console.trace())}this._events[t].push(e)}else this._events[t]=[this._events[t],e];else this._events[t]=e;return this},i.prototype.on=i.prototype.addListener,i.prototype.once=function(t,e){var r=this;return r.on(t,function n(){r.removeListener(t,n),e.apply(this,arguments)}),this},i.prototype.removeListener=function(t,e){if("function"!=typeof e)throw Error("removeListener only takes instances of Function");if(!this._events||!this._events[t])return this;var r=this._events[t];if(s(r)){var n=r.indexOf(e);if(0>n)return this;r.splice(n,1),0==r.length&&delete this._events[t]}else this._events[t]===e&&delete this._events[t];return this},i.prototype.removeAllListeners=function(t){return t&&this._events&&this._events[t]&&(this._events[t]=null),this},i.prototype.listeners=function(t){return this._events||(this._events={}),this._events[t]||(this._events[t]=[]),s(this._events[t])||(this._events[t]=[this._events[t]]),this._events[t]}},{__browserify_process:33}],32:[function(t,e){e.exports="function"==typeof Object.create?function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:function(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}},{}],33:[function(t,e){var r=e.exports={};r.nextTick=function(){var t="undefined"!=typeof window&&window.setImmediate,e="undefined"!=typeof window&&window.postMessage&&window.addEventListener;if(t)return function(t){return window.setImmediate(t)};if(e){var r=[];return window.addEventListener("message",function(t){if(t.source===window&&"process-tick"===t.data&&(t.stopPropagation(),r.length>0)){var e=r.shift();e()}},!0),function(t){r.push(t),window.postMessage("process-tick","*")}}return function(t){setTimeout(t,0)}}(),r.title="browser",r.browser=!0,r.env={},r.argv=[],r.binding=function(){throw Error("process.binding is not supported")},r.cwd=function(){return"/"},r.chdir=function(){throw Error("process.chdir is not supported")}},{}],34:[function(t,e,r){function n(t,e){var r=typeof t;if("base64"===e&&"string"===r)for(t=ue(t);0!==t.length%4;)t+="=";var i;if("number"===r)i=pe(t);else if("string"===r)i=n.byteLength(t,e);else{if("object"!==r)throw Error("First argument needs to be a number, array or string.");i=pe(t.length)}var s=fe(new Uint8Array(i));if(n.isBuffer(t))s.set(t);else if(de(t))for(var o=0;i>o;o++)s[o]=n.isBuffer(t)?t.readUInt8(o):t[o];else"string"===r&&s.write(t,0,e);return s}function i(t,e,r,i){r=Number(r)||0;var s=t.length-r;i?(i=Number(i),i>s&&(i=s)):i=s;var o=e.length;if(0!==o%2)throw Error("Invalid hex string");i>o/2&&(i=o/2);for(var a=0;i>a;a++){var u=parseInt(e.substr(2*a,2),16);if(isNaN(u))throw Error("Invalid hex string");t[r+a]=u}return n._charsWritten=2*a,a}function s(t,e,r,i){return n._charsWritten=be(ye(e),t,r,i)}function o(t,e,r,i){return n._charsWritten=be(ve(e),t,r,i)}function a(t,e,r,n){return o(t,e,r,n)}function u(t,e,r,i){return n._charsWritten=be(me(e),t,r,i)}function c(t,e,r,n){if(isFinite(e))isFinite(r)||(n=r,r=void 0);else{var c=n;n=e,e=r,r=c}e=Number(e)||0;var h=this.length-e;switch(r?(r=Number(r),r>h&&(r=h)):r=h,n=((n||"utf8")+"").toLowerCase()){case"hex":return i(this,t,e,r);case"utf8":case"utf-8":return s(this,t,e,r);case"ascii":return o(this,t,e,r);case"binary":return a(this,t,e,r);case"base64":return u(this,t,e,r);default:throw Error("Unknown encoding")}}function h(t,e,r){var n=this instanceof he?this._proxy:this;if(t=((t||"utf8")+"").toLowerCase(),e=Number(e)||0,r=void 0!==r?Number(r):r=n.length,r===e)return"";switch(t){case"hex":return v(n,e,r);case"utf8":case"utf-8":return d(n,e,r);case"ascii":return g(n,e,r);case"binary":return y(n,e,r);case"base64":return p(n,e,r);default:throw Error("Unknown encoding")}}function f(){return{type:"Buffer",data:Array.prototype.slice.call(this,0)}}function l(t,e,r,n){var i=this;if(r||(r=0),n||0===n||(n=this.length),e||(e=0),n!==r&&0!==t.length&&0!==i.length){if(r>n)throw Error("sourceEnd < sourceStart");if(0>e||e>=t.length)throw Error("targetStart out of bounds");if(0>r||r>=i.length)throw Error("sourceStart out of bounds");if(0>n||n>i.length)throw Error("sourceEnd out of bounds");n>this.length&&(n=this.length),n-r>t.length-e&&(n=t.length-e+r);for(var s=0;n-r>s;s++)t[s+e]=this[s+r]}}function p(e,r,n){var i=e.slice(r,n);return t("base64-js").fromByteArray(i)}function d(t,e,r){for(var n=t.slice(e,r),i="",s="",o=0;n.length>o;)127>=n[o]?(i+=we(s)+String.fromCharCode(n[o]),s=""):s+="%"+n[o].toString(16),o++;return i+we(s)}function g(t,e,r){for(var n=t.slice(e,r),i="",s=0;n.length>s;s++)i+=String.fromCharCode(n[s]);return i}function y(t,e,r){return g(t,e,r)}function v(t,e,r){var n=t.length;(!e||0>e)&&(e=0),(!r||0>r||r>n)&&(r=n);for(var i="",s=e;r>s;s++)i+=ge(t[s]);return i}function m(t,e){var r=this.length;return t=le(t,r,0),e=le(e,r,r),fe(this.subarray(t,e))}function b(t,e){var r=this;return e||(Ee(void 0!==t&&null!==t,"missing offset"),Ee(r.length>t,"Trying to read beyond buffer length")),t>=r.length?void 0:r[t]}function w(t,e,r,n){n||(Ee("boolean"==typeof r,"missing or invalid endian"),Ee(void 0!==e&&null!==e,"missing offset"),Ee(t.length>e+1,"Trying to read beyond buffer length"));var i=t.length;if(!(e>=i)){if(e+1===i){var s=new DataView(new ArrayBuffer(2));return s.setUint8(0,t[i-1]),s.getUint16(0,r)}return t._dataview.getUint16(e,r)}}function _(t,e){return w(this,t,!0,e)}function x(t,e){return w(this,t,!1,e)}function k(t,e,r,n){n||(Ee("boolean"==typeof r,"missing or invalid endian"),Ee(void 0!==e&&null!==e,"missing offset"),Ee(t.length>e+3,"Trying to read beyond buffer length"));var i=t.length;if(!(e>=i)){if(e+3>=i){for(var s=new DataView(new ArrayBuffer(4)),o=0;i>o+e;o++)s.setUint8(o,t[o+e]);return s.getUint32(0,r)}return t._dataview.getUint32(e,r)}}function E(t,e){return k(this,t,!0,e)}function S(t,e){return k(this,t,!1,e)}function L(t,e){var r=this;return e||(Ee(void 0!==t&&null!==t,"missing offset"),Ee(r.length>t,"Trying to read beyond buffer length")),t>=r.length?void 0:r._dataview.getInt8(t)}function A(t,e,r,n){n||(Ee("boolean"==typeof r,"missing or invalid endian"),Ee(void 0!==e&&null!==e,"missing offset"),Ee(t.length>e+1,"Trying to read beyond buffer length"));var i=t.length;
if(!(e>=i)){if(e+1===i){var s=new DataView(new ArrayBuffer(2));return s.setUint8(0,t[i-1]),s.getInt16(0,r)}return t._dataview.getInt16(e,r)}}function M(t,e){return A(this,t,!0,e)}function j(t,e){return A(this,t,!1,e)}function I(t,e,r,n){n||(Ee("boolean"==typeof r,"missing or invalid endian"),Ee(void 0!==e&&null!==e,"missing offset"),Ee(t.length>e+3,"Trying to read beyond buffer length"));var i=t.length;if(!(e>=i)){if(e+3>=i){for(var s=new DataView(new ArrayBuffer(4)),o=0;i>o+e;o++)s.setUint8(o,t[o+e]);return s.getInt32(0,r)}return t._dataview.getInt32(e,r)}}function C(t,e){return I(this,t,!0,e)}function B(t,e){return I(this,t,!1,e)}function O(t,e,r,n){return n||(Ee("boolean"==typeof r,"missing or invalid endian"),Ee(t.length>e+3,"Trying to read beyond buffer length")),t._dataview.getFloat32(e,r)}function D(t,e){return O(this,t,!0,e)}function U(t,e){return O(this,t,!1,e)}function R(t,e,r,n){return n||(Ee("boolean"==typeof r,"missing or invalid endian"),Ee(t.length>e+7,"Trying to read beyond buffer length")),t._dataview.getFloat64(e,r)}function T(t,e){return R(this,t,!0,e)}function P(t,e){return R(this,t,!1,e)}function z(t,e,r){var n=this;r||(Ee(void 0!==t&&null!==t,"missing value"),Ee(void 0!==e&&null!==e,"missing offset"),Ee(n.length>e,"trying to write beyond buffer length"),_e(t,255)),e>=n.length||(n[e]=t)}function q(t,e,r,n,i){i||(Ee(void 0!==e&&null!==e,"missing value"),Ee("boolean"==typeof n,"missing or invalid endian"),Ee(void 0!==r&&null!==r,"missing offset"),Ee(t.length>r+1,"trying to write beyond buffer length"),_e(e,65535));var s=t.length;if(!(r>=s))if(r+1===s){var o=new DataView(new ArrayBuffer(2));o.setUint16(0,e,n),t[r]=o.getUint8(0)}else t._dataview.setUint16(r,e,n)}function N(t,e,r){q(this,t,e,!0,r)}function F(t,e,r){q(this,t,e,!1,r)}function H(t,e,r,n,i){i||(Ee(void 0!==e&&null!==e,"missing value"),Ee("boolean"==typeof n,"missing or invalid endian"),Ee(void 0!==r&&null!==r,"missing offset"),Ee(t.length>r+3,"trying to write beyond buffer length"),_e(e,4294967295));var s=t.length;if(!(r>=s))if(r+3>=s){var o=new DataView(new ArrayBuffer(4));o.setUint32(0,e,n);for(var a=0;s>a+r;a++)t[a+r]=o.getUint8(a)}else t._dataview.setUint32(r,e,n)}function G(t,e,r){H(this,t,e,!0,r)}function J(t,e,r){H(this,t,e,!1,r)}function $(t,e,r){var n=this;r||(Ee(void 0!==t&&null!==t,"missing value"),Ee(void 0!==e&&null!==e,"missing offset"),Ee(n.length>e,"Trying to write beyond buffer length"),xe(t,127,-128)),e>=n.length||n._dataview.setInt8(e,t)}function W(t,e,r,n,i){i||(Ee(void 0!==e&&null!==e,"missing value"),Ee("boolean"==typeof n,"missing or invalid endian"),Ee(void 0!==r&&null!==r,"missing offset"),Ee(t.length>r+1,"Trying to write beyond buffer length"),xe(e,32767,-32768));var s=t.length;if(!(r>=s))if(r+1===s){var o=new DataView(new ArrayBuffer(2));o.setInt16(0,e,n),t[r]=o.getUint8(0)}else t._dataview.setInt16(r,e,n)}function X(t,e,r){W(this,t,e,!0,r)}function K(t,e,r){W(this,t,e,!1,r)}function V(t,e,r,n,i){i||(Ee(void 0!==e&&null!==e,"missing value"),Ee("boolean"==typeof n,"missing or invalid endian"),Ee(void 0!==r&&null!==r,"missing offset"),Ee(t.length>r+3,"Trying to write beyond buffer length"),xe(e,2147483647,-2147483648));var s=t.length;if(!(r>=s))if(r+3>=s){var o=new DataView(new ArrayBuffer(4));o.setInt32(0,e,n);for(var a=0;s>a+r;a++)t[a+r]=o.getUint8(a)}else t._dataview.setInt32(r,e,n)}function Y(t,e,r){V(this,t,e,!0,r)}function Z(t,e,r){V(this,t,e,!1,r)}function Q(t,e,r,n,i){i||(Ee(void 0!==e&&null!==e,"missing value"),Ee("boolean"==typeof n,"missing or invalid endian"),Ee(void 0!==r&&null!==r,"missing offset"),Ee(t.length>r+3,"Trying to write beyond buffer length"),ke(e,3.4028234663852886e38,-3.4028234663852886e38));var s=t.length;if(!(r>=s))if(r+3>=s){var o=new DataView(new ArrayBuffer(4));o.setFloat32(0,e,n);for(var a=0;s>a+r;a++)t[a+r]=o.getUint8(a)}else t._dataview.setFloat32(r,e,n)}function te(t,e,r){Q(this,t,e,!0,r)}function ee(t,e,r){Q(this,t,e,!1,r)}function re(t,e,r,n,i){i||(Ee(void 0!==e&&null!==e,"missing value"),Ee("boolean"==typeof n,"missing or invalid endian"),Ee(void 0!==r&&null!==r,"missing offset"),Ee(t.length>r+7,"Trying to write beyond buffer length"),ke(e,1.7976931348623157e308,-1.7976931348623157e308));var s=t.length;if(!(r>=s))if(r+7>=s){var o=new DataView(new ArrayBuffer(8));o.setFloat64(0,e,n);for(var a=0;s>a+r;a++)t[a+r]=o.getUint8(a)}else t._dataview.setFloat64(r,e,n)}function ne(t,e,r){re(this,t,e,!0,r)}function ie(t,e,r){re(this,t,e,!1,r)}function se(t,e,r){if(t||(t=0),e||(e=0),r||(r=this.length),"string"==typeof t&&(t=t.charCodeAt(0)),"number"!=typeof t||isNaN(t))throw Error("value is not a number");if(e>r)throw Error("end < start");if(r!==e&&0!==this.length){if(0>e||e>=this.length)throw Error("start out of bounds");if(0>r||r>this.length)throw Error("end out of bounds");for(var n=e;r>n;n++)this[n]=t}}function oe(){for(var t=[],e=this.length,n=0;e>n;n++)if(t[n]=ge(this[n]),n===r.INSPECT_MAX_BYTES){t[n+1]="...";break}return"<Buffer "+t.join(" ")+">"}function ae(){return new n(this).buffer}function ue(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function ce(){var t=new Uint8Array(0);t.foo=function(){return 42};try{return 42===t.foo()}catch(e){return!1}}function he(t){this._arr=t,0!==t.byteLength&&(this._dataview=new DataView(t.buffer,t.byteOffset,t.byteLength))}function fe(t){if(void 0===Se&&(Se=ce()),Se)return t.write=c,t.toString=h,t.toLocaleString=h,t.toJSON=f,t.copy=l,t.slice=m,t.readUInt8=b,t.readUInt16LE=_,t.readUInt16BE=x,t.readUInt32LE=E,t.readUInt32BE=S,t.readInt8=L,t.readInt16LE=M,t.readInt16BE=j,t.readInt32LE=C,t.readInt32BE=B,t.readFloatLE=D,t.readFloatBE=U,t.readDoubleLE=T,t.readDoubleBE=P,t.writeUInt8=z,t.writeUInt16LE=N,t.writeUInt16BE=F,t.writeUInt32LE=G,t.writeUInt32BE=J,t.writeInt8=$,t.writeInt16LE=X,t.writeInt16BE=K,t.writeInt32LE=Y,t.writeInt32BE=Z,t.writeFloatLE=te,t.writeFloatBE=ee,t.writeDoubleLE=ne,t.writeDoubleBE=ie,t.fill=se,t.inspect=oe,t.toArrayBuffer=ae,t._isBuffer=!0,0!==t.byteLength&&(t._dataview=new DataView(t.buffer,t.byteOffset,t.byteLength)),t;var e=new he(t),r=new Proxy(e,Le);return e._proxy=r,r}function le(t,e,r){return"number"!=typeof t?r:(t=~~t,t>=e?e:t>=0?t:(t+=e,t>=0?t:0))}function pe(t){return t=~~Math.ceil(+t),0>t?0:t}function de(t){return Array.isArray(t)||n.isBuffer(t)||t&&"object"==typeof t&&"number"==typeof t.length}function ge(t){return 16>t?"0"+t.toString(16):t.toString(16)}function ye(t){for(var e=[],r=0;t.length>r;r++)if(127>=t.charCodeAt(r))e.push(t.charCodeAt(r));else for(var n=encodeURIComponent(t.charAt(r)).substr(1).split("%"),i=0;n.length>i;i++)e.push(parseInt(n[i],16));return e}function ve(t){for(var e=[],r=0;t.length>r;r++)e.push(255&t.charCodeAt(r));return e}function me(e){return t("base64-js").toByteArray(e)}function be(t,e,r,n){for(var i=0;n>i&&!(i+r>=e.length||i>=t.length);)e[i+r]=t[i],i++;return i}function we(t){try{return decodeURIComponent(t)}catch(e){return String.fromCharCode(65533)}}function _e(t,e){Ee("number"==typeof t,"cannot write a non-number as a number"),Ee(t>=0,"specified a negative value for writing an unsigned value"),Ee(e>=t,"value is larger than maximum value for type"),Ee(Math.floor(t)===t,"value has a fractional component")}function xe(t,e,r){Ee("number"==typeof t,"cannot write a non-number as a number"),Ee(e>=t,"value larger than maximum allowed value"),Ee(t>=r,"value smaller than minimum allowed value"),Ee(Math.floor(t)===t,"value has a fractional component")}function ke(t,e,r){Ee("number"==typeof t,"cannot write a non-number as a number"),Ee(e>=t,"value larger than maximum allowed value"),Ee(t>=r,"value smaller than minimum allowed value")}function Ee(t,e){if(!t)throw Error(e||"Failed assertion")}r.Buffer=n,r.SlowBuffer=n,r.INSPECT_MAX_BYTES=50,n.poolSize=8192;var Se;n.isEncoding=function(t){switch((t+"").toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}},n.isBuffer=function(t){return t&&t._isBuffer},n.byteLength=function(t,e){switch(e||"utf8"){case"hex":return t.length/2;case"utf8":case"utf-8":return ye(t).length;case"ascii":case"binary":return t.length;case"base64":return me(t).length;default:throw Error("Unknown encoding")}},n.concat=function(t,e){if(!Array.isArray(t))throw Error("Usage: Buffer.concat(list, [totalLength])\nlist should be an Array.");var r,i;if(0===t.length)return new n(0);if(1===t.length)return t[0];if("number"!=typeof e)for(e=0,r=0;t.length>r;r++)i=t[r],e+=i.length;var s=new n(e),o=0;for(r=0;t.length>r;r++)i=t[r],i.copy(s,o),o+=i.length;return s},he.prototype.write=c,he.prototype.toString=h,he.prototype.toLocaleString=h,he.prototype.toJSON=f,he.prototype.copy=l,he.prototype.slice=m,he.prototype.readUInt8=b,he.prototype.readUInt16LE=_,he.prototype.readUInt16BE=x,he.prototype.readUInt32LE=E,he.prototype.readUInt32BE=S,he.prototype.readInt8=L,he.prototype.readInt16LE=M,he.prototype.readInt16BE=j,he.prototype.readInt32LE=C,he.prototype.readInt32BE=B,he.prototype.readFloatLE=D,he.prototype.readFloatBE=U,he.prototype.readDoubleLE=T,he.prototype.readDoubleBE=P,he.prototype.writeUInt8=z,he.prototype.writeUInt16LE=N,he.prototype.writeUInt16BE=F,he.prototype.writeUInt32LE=G,he.prototype.writeUInt32BE=J,he.prototype.writeInt8=$,he.prototype.writeInt16LE=X,he.prototype.writeInt16BE=K,he.prototype.writeInt32LE=Y,he.prototype.writeInt32BE=Z,he.prototype.writeFloatLE=te,he.prototype.writeFloatBE=ee,he.prototype.writeDoubleLE=ne,he.prototype.writeDoubleBE=ie,he.prototype.fill=se,he.prototype.inspect=oe,he.prototype.toArrayBuffer=ae,he.prototype._isBuffer=!0,he.prototype.subarray=function(){return this._arr.subarray.apply(this._arr,arguments)},he.prototype.set=function(){return this._arr.set.apply(this._arr,arguments)};var Le={get:function(t,e){return e in t?t[e]:t._arr[e]},set:function(t,e,r){t._arr[e]=r}}},{"base64-js":35}],35:[function(t,e){(function(){"use strict";function t(t){var e,r,i,s,o,a;if(t.length%4>0)throw"Invalid string. Length must be a multiple of 4";for(o=t.indexOf("="),o=o>0?t.length-o:0,a=[],i=o>0?t.length-4:t.length,e=0,r=0;i>e;e+=4,r+=3)s=n.indexOf(t[e])<<18|n.indexOf(t[e+1])<<12|n.indexOf(t[e+2])<<6|n.indexOf(t[e+3]),a.push((16711680&s)>>16),a.push((65280&s)>>8),a.push(255&s);return 2===o?(s=n.indexOf(t[e])<<2|n.indexOf(t[e+1])>>4,a.push(255&s)):1===o&&(s=n.indexOf(t[e])<<10|n.indexOf(t[e+1])<<4|n.indexOf(t[e+2])>>2,a.push(255&s>>8),a.push(255&s)),a}function r(t){function e(t){return n[63&t>>18]+n[63&t>>12]+n[63&t>>6]+n[63&t]}var r,i,s,o=t.length%3,a="";for(r=0,s=t.length-o;s>r;r+=3)i=(t[r]<<16)+(t[r+1]<<8)+t[r+2],a+=e(i);switch(o){case 1:i=t[t.length-1],a+=n[i>>2],a+=n[63&i<<4],a+="==";break;case 2:i=(t[t.length-2]<<8)+t[t.length-1],a+=n[i>>10],a+=n[63&i>>4],a+=n[63&i<<2],a+="="}return a}var n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";e.exports.toByteArray=t,e.exports.fromByteArray=r})()},{}],36:[function(t,e){function r(t){return this instanceof r?(o.call(this,t),a.call(this,t),t&&t.readable===!1&&(this.readable=!1),t&&t.writable===!1&&(this.writable=!1),this.allowHalfOpen=!0,t&&t.allowHalfOpen===!1&&(this.allowHalfOpen=!1),this.once("end",n),void 0):new r(t)}function n(){if(!this.allowHalfOpen&&!this._writableState.ended){var t=this;s(function(){t.end()})}}e.exports=r;var i=t("inherits"),s=t("setimmediate"),o=t("./readable.js"),a=t("./writable.js");i(r,o),r.prototype.pipe=a.prototype.pipe,r.prototype.write=a.prototype.write,r.prototype.end=a.prototype.end,r.prototype._write=a.prototype._write},{"./readable.js":40,"./writable.js":42,inherits:32,setimmediate:38}],37:[function(t,e){function r(){n.call(this)}e.exports=r;var n=t("events").EventEmitter,i=t("inherits");i(r,n),r.Readable=t("./readable.js"),r.Writable=t("./writable.js"),r.Duplex=t("./duplex.js"),r.Transform=t("./transform.js"),r.PassThrough=t("./passthrough.js"),r.Stream=r,r.prototype.pipe=function(t,e){function r(e){t.writable&&!1===t.write(e)&&c.pause&&c.pause()}function i(){c.readable&&c.resume&&c.resume()}function s(){h||(h=!0,t.end())}function o(){h||(h=!0,"function"==typeof t.destroy&&t.destroy())}function a(t){if(u(),0===n.listenerCount(this,"error"))throw t}function u(){c.removeListener("data",r),t.removeListener("drain",i),c.removeListener("end",s),c.removeListener("close",o),c.removeListener("error",a),t.removeListener("error",a),c.removeListener("end",u),c.removeListener("close",u),t.removeListener("close",u)}var c=this;c.on("data",r),t.on("drain",i),t._isStdio||e&&e.end===!1||(c.on("end",s),c.on("close",o));var h=!1;return c.on("error",a),t.on("error",a),c.on("end",u),c.on("close",u),t.on("close",u),t.emit("pipe",c),t}},{"./duplex.js":36,"./passthrough.js":39,"./readable.js":40,"./transform.js":41,"./writable.js":42,events:31,inherits:32}],38:[function(require,module,exports){var process=require("__browserify_process"),global="undefined"!=typeof self?self:"undefined"!=typeof window?window:{};(function(global,undefined){"use strict";function canUseNextTick(){return"object"==typeof process&&"[object process]"===Object.prototype.toString.call(process)}function canUseMessageChannel(){return!!global.MessageChannel}function canUsePostMessage(){if(!global.postMessage||global.importScripts)return!1;var t=!0,e=global.onmessage;return global.onmessage=function(){t=!1},global.postMessage("","*"),global.onmessage=e,t}function canUseReadyStateChange(){return"document"in global&&"onreadystatechange"in global.document.createElement("script")}function installNextTickImplementation(t){t.setImmediate=function(){var t=tasks.addFromSetImmediateArguments(arguments);return process.nextTick(function(){tasks.runIfPresent(t)}),t}}function installMessageChannelImplementation(t){var e=new global.MessageChannel;e.port1.onmessage=function(t){var e=t.data;tasks.runIfPresent(e)},t.setImmediate=function(){var t=tasks.addFromSetImmediateArguments(arguments);return e.port2.postMessage(t),t}}function installPostMessageImplementation(t){function e(t,e){return"string"==typeof t&&t.substring(0,e.length)===e}function r(t){if(t.source===global&&e(t.data,n)){var r=t.data.substring(n.length);tasks.runIfPresent(r)}}var n="com.bn.NobleJS.setImmediate"+Math.random();global.addEventListener?global.addEventListener("message",r,!1):global.attachEvent("onmessage",r),t.setImmediate=function(){var t=tasks.addFromSetImmediateArguments(arguments);return global.postMessage(n+t,"*"),t}}function installReadyStateChangeImplementation(t){t.setImmediate=function(){var t=tasks.addFromSetImmediateArguments(arguments),e=global.document.createElement("script");return e.onreadystatechange=function(){tasks.runIfPresent(t),e.onreadystatechange=null,e.parentNode.removeChild(e),e=null},global.document.documentElement.appendChild(e),t}}function installSetTimeoutImplementation(t){t.setImmediate=function(){var t=tasks.addFromSetImmediateArguments(arguments);return global.setTimeout(function(){tasks.runIfPresent(t)},0),t}}var tasks=function(){function Task(t,e){this.handler=t,this.args=e}Task.prototype.run=function(){if("function"==typeof this.handler)this.handler.apply(undefined,this.args);else{var scriptSource=""+this.handler;eval(scriptSource)}};var nextHandle=1,tasksByHandle={},currentlyRunningATask=!1;return{addFromSetImmediateArguments:function(t){var e=t[0],r=Array.prototype.slice.call(t,1),n=new Task(e,r),i=nextHandle++;return tasksByHandle[i]=n,i},runIfPresent:function(t){if(currentlyRunningATask)global.setTimeout(function(){tasks.runIfPresent(t)},0);else{var e=tasksByHandle[t];if(e){currentlyRunningATask=!0;try{e.run()}finally{delete tasksByHandle[t],currentlyRunningATask=!1}}}},remove:function(t){delete tasksByHandle[t]}}}();if(!global.setImmediate){var attachTo="function"==typeof Object.getPrototypeOf&&"setTimeout"in Object.getPrototypeOf(global)?Object.getPrototypeOf(global):global;canUseNextTick()?installNextTickImplementation(attachTo):canUsePostMessage()?installPostMessageImplementation(attachTo):canUseMessageChannel()?installMessageChannelImplementation(attachTo):canUseReadyStateChange()?installReadyStateChangeImplementation(attachTo):installSetTimeoutImplementation(attachTo),attachTo.clearImmediate=tasks.remove}})("object"==typeof global&&global?global:this)},{__browserify_process:33}],39:[function(t,e){function r(t){return this instanceof r?(n.call(this,t),void 0):new r(t)}e.exports=r;var n=t("./transform.js"),i=t("inherits");i(r,n),r.prototype._transform=function(t,e,r){r(null,t)}},{"./transform.js":41,inherits:32}],40:[function(t,e){function r(e){e=e||{};var r=e.highWaterMark;this.highWaterMark=r||0===r?r:16384,this.highWaterMark=~~this.highWaterMark,this.buffer=[],this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=!1,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.calledRead=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.objectMode=!!e.objectMode,this.defaultEncoding=e.defaultEncoding||"utf8",this.ranOut=!1,this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(k||(k=t("string_decoder").StringDecoder),this.decoder=new k(e.encoding),this.encoding=e.encoding)}function n(t){return this instanceof n?(this._readableState=new r(t,this),this.readable=!0,S.call(this),void 0):new n(t)}function i(t,e,r,n,i){var o=u(e,r);if(o)t.emit("error",o);else if(null===r||void 0===r)e.reading=!1,e.ended||c(t,e);else if(e.objectMode||r&&r.length>0)if(e.ended&&!i){var a=Error("stream.push() after EOF");t.emit("error",a)}else if(e.endEmitted&&i){var a=Error("stream.unshift() after end event");t.emit("error",a)}else!e.decoder||i||n||(r=e.decoder.write(r)),e.length+=e.objectMode?1:r.length,i?e.buffer.unshift(r):(e.reading=!1,e.buffer.push(r)),e.needReadable&&h(t),l(t,e);else i||(e.reading=!1);return s(e)}function s(t){return!t.ended&&(t.needReadable||t.length<t.highWaterMark||0===t.length)}function o(t){if(t>=j)t=j;else{t--;for(var e=1;32>e;e<<=1)t|=t>>e;t++}return t}function a(t,e){return 0===e.length&&e.ended?0:e.objectMode?0===t?0:1:isNaN(t)||null===t?e.flowing&&e.buffer.length?e.buffer[0].length:e.length:0>=t?0:(t>e.highWaterMark&&(e.highWaterMark=o(t)),t>e.length?e.ended?e.length:(e.needReadable=!0,0):t)}function u(t,e){var r=null;return L.isBuffer(e)||"string"==typeof e||null===e||void 0===e||t.objectMode||r||(r=new TypeError("Invalid non-string/buffer chunk")),r}function c(t,e){if(e.decoder&&!e.ended){var r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,e.length>0?h(t):b(t)}function h(t){var e=t._readableState;e.needReadable=!1,e.emittedReadable||(e.emittedReadable=!0,e.sync?A(function(){f(t)}):f(t))}function f(t){t.emit("readable")}function l(t,e){e.readingMore||(e.readingMore=!0,A(function(){p(t,e)}))}function p(t,e){for(var r=e.length;!e.reading&&!e.flowing&&!e.ended&&e.length<e.highWaterMark&&(t.read(0),r!==e.length);)r=e.length;e.readingMore=!1}function d(t){return function(){var e=t._readableState;e.awaitDrain--,0===e.awaitDrain&&g(t)}}function g(t){function e(t){var e=t.write(r);!1===e&&n.awaitDrain++}var r,n=t._readableState;for(n.awaitDrain=0;n.pipesCount&&null!==(r=t.read());)if(1===n.pipesCount?e(n.pipes,0,null):w(n.pipes,e),t.emit("data",r),n.awaitDrain>0)return;return 0===n.pipesCount?(n.flowing=!1,E.listenerCount(t,"data")>0&&v(t),void 0):(n.ranOut=!0,void 0)}function y(){this._readableState.ranOut&&(this._readableState.ranOut=!1,g(this))}function v(t,e){var r=t._readableState;if(r.flowing)throw Error("Cannot switch to old mode now.");var n=e||!1,i=!1;t.readable=!0,t.pipe=S.prototype.pipe,t.on=t.addListener=S.prototype.on,t.on("readable",function(){i=!0;for(var e;!n&&null!==(e=t.read());)t.emit("data",e);null===e&&(i=!1,t._readableState.needReadable=!0)}),t.pause=function(){n=!0,this.emit("pause")},t.resume=function(){n=!1,i?A(function(){t.emit("readable")}):this.read(0),this.emit("resume")},t.emit("readable")}function m(t,e){var r,n=e.buffer,i=e.length,s=!!e.decoder,o=!!e.objectMode;if(0===n.length)return null;if(0===i)r=null;else if(o)r=n.shift();else if(!t||t>=i)r=s?n.join(""):L.concat(n,i),n.length=0;else if(n[0].length>t){var a=n[0];r=a.slice(0,t),n[0]=a.slice(t)}else if(t===n[0].length)r=n.shift();else{r=s?"":new L(t);for(var u=0,c=0,h=n.length;h>c&&t>u;c++){var a=n[0],f=Math.min(t-u,a.length);s?r+=a.slice(0,f):a.copy(r,u,0,f),a.length>f?n[0]=a.slice(f):n.shift(),u+=f}}return r}function b(t){var e=t._readableState;if(e.length>0)throw Error("endReadable called on non-empty stream");!e.endEmitted&&e.calledRead&&(e.ended=!0,A(function(){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}))}function w(t,e){for(var r=0,n=t.length;n>r;r++)e(t[r],r)}function _(t,e){for(var r=0,n=t.length;n>r;r++)if(t[r]===e)return r;return-1}var x=t("__browserify_process");e.exports=n,n.ReadableState=r;var k,E=t("events").EventEmitter,S=t("./index.js"),L=t("buffer").Buffer,A=t("setimmediate"),M=t("inherits");M(n,S),n.prototype.push=function(t,e){var r=this._readableState;return"string"!=typeof t||r.objectMode||(e=e||r.defaultEncoding,e!==r.encoding&&(t=new L(t,e),e="")),i(this,r,t,e,!1)},n.prototype.unshift=function(t){var e=this._readableState;return i(this,e,t,"",!0)},n.prototype.setEncoding=function(e){k||(k=t("string_decoder").StringDecoder),this._readableState.decoder=new k(e),this._readableState.encoding=e};var j=8388608;n.prototype.read=function(t){var e=this._readableState;e.calledRead=!0;var r=t;if(("number"!=typeof t||t>0)&&(e.emittedReadable=!1),0===t&&e.needReadable&&(e.length>=e.highWaterMark||e.ended))return h(this),null;if(t=a(t,e),0===t&&e.ended)return 0===e.length&&b(this),null;var n=e.needReadable;e.length-t<=e.highWaterMark&&(n=!0),(e.ended||e.reading)&&(n=!1),n&&(e.reading=!0,e.sync=!0,0===e.length&&(e.needReadable=!0),this._read(e.highWaterMark),e.sync=!1),n&&!e.reading&&(t=a(r,e));var i;return i=t>0?m(t,e):null,null===i&&(e.needReadable=!0,t=0),e.length-=t,0!==e.length||e.ended||(e.needReadable=!0),e.ended&&!e.endEmitted&&0===e.length&&b(this),i},n.prototype._read=function(){this.emit("error",Error("not implemented"))},n.prototype.pipe=function(t,e){function r(t){t===c&&i()}function n(){t.end()}function i(){t.removeListener("close",o),t.removeListener("finish",a),t.removeListener("drain",p),t.removeListener("error",s),t.removeListener("unpipe",r),c.removeListener("end",n),c.removeListener("end",i),(!t._writableState||t._writableState.needDrain)&&p()}function s(e){u(),0===v&&0===E.listenerCount(t,"error")&&t.emit("error",e)}function o(){t.removeListener("finish",a),u()}function a(){t.removeListener("close",o),u()}function u(){c.unpipe(t)}var c=this,h=this._readableState;switch(h.pipesCount){case 0:h.pipes=t;break;case 1:h.pipes=[h.pipes,t];break;default:h.pipes.push(t)}h.pipesCount+=1;var f=(!e||e.end!==!1)&&t!==x.stdout&&t!==x.stderr,l=f?n:i;h.endEmitted?A(l):c.once("end",l),t.on("unpipe",r);var p=d(c);t.on("drain",p);var v=E.listenerCount(t,"error");return t.once("error",s),t.once("close",o),t.once("finish",a),t.emit("pipe",c),h.flowing||(this.on("readable",y),h.flowing=!0,A(function(){g(c)})),t},n.prototype.unpipe=function(t){var e=this._readableState;if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes?this:(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,this.removeListener("readable",y),e.flowing=!1,t&&t.emit("unpipe",this),this);if(!t){var r=e.pipes,n=e.pipesCount;e.pipes=null,e.pipesCount=0,this.removeListener("readable",y),e.flowing=!1;for(var i=0;n>i;i++)r[i].emit("unpipe",this);return this}var i=_(e.pipes,t);return-1===i?this:(e.pipes.splice(i,1),e.pipesCount-=1,1===e.pipesCount&&(e.pipes=e.pipes[0]),t.emit("unpipe",this),this)},n.prototype.on=function(t,e){var r=S.prototype.on.call(this,t,e);if("data"!==t||this._readableState.flowing||v(this),"readable"===t&&this.readable){var n=this._readableState;n.readableListening||(n.readableListening=!0,n.emittedReadable=!1,n.needReadable=!0,n.reading?n.length&&h(this,n):this.read(0))}return r},n.prototype.addListener=n.prototype.on,n.prototype.resume=function(){v(this),this.read(0),this.emit("resume")},n.prototype.pause=function(){v(this,!0),this.emit("pause")},n.prototype.wrap=function(t){var e=this._readableState,r=!1,n=this;t.on("end",function(){if(e.decoder&&!e.ended){var t=e.decoder.end();t&&t.length&&n.push(t)}n.push(null)}),t.on("data",function(i){if(e.decoder&&(i=e.decoder.write(i)),i&&(e.objectMode||i.length)){var s=n.push(i);s||(r=!0,t.pause())}});for(var i in t)"function"==typeof t[i]&&this[i]===void 0&&(this[i]=function(e){return function(){return t[e].apply(t,arguments)}}(i));var s=["error","close","destroy","pause","resume"];return w(s,function(e){t.on(e,function(t){return n.emit.apply(n,e,t)})}),n._read=function(){r&&(r=!1,t.resume())},n},n._fromList=m},{"./index.js":37,__browserify_process:33,buffer:34,events:31,inherits:32,setimmediate:38,string_decoder:43}],41:[function(t,e){function r(t,e){this.afterTransform=function(t,r){return n(e,t,r)},this.needTransform=!1,this.transforming=!1,this.writecb=null,this.writechunk=null}function n(t,e,r){var n=t._transformState;n.transforming=!1;var i=n.writecb;if(!i)return t.emit("error",Error("no writecb in Transform class"));n.writechunk=null,n.writecb=null,null!==r&&void 0!==r&&t.push(r),i&&i(e);var s=t._readableState;s.reading=!1,(s.needReadable||s.length<s.highWaterMark)&&t._read(s.highWaterMark)}function i(t){if(!(this instanceof i))return new i(t);o.call(this,t),this._transformState=new r(t,this);var e=this;this._readableState.needReadable=!0,this._readableState.sync=!1,this.once("finish",function(){"function"==typeof this._flush?this._flush(function(t){s(e,t)}):s(e)})}function s(t,e){if(e)return t.emit("error",e);var r=t._writableState;t._readableState;var n=t._transformState;if(r.length)throw Error("calling transform done when ws.length != 0");if(n.transforming)throw Error("calling transform done when still transforming");return t.push(null)}e.exports=i;var o=t("./duplex.js"),a=t("inherits");a(i,o),i.prototype.push=function(t,e){return this._transformState.needTransform=!1,o.prototype.push.call(this,t,e)},i.prototype._transform=function(){throw Error("not implemented")},i.prototype._write=function(t,e,r){var n=this._transformState;if(n.writecb=r,n.writechunk=t,n.writeencoding=e,!n.transforming){var i=this._readableState;(n.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},i.prototype._read=function(){var t=this._transformState;t.writechunk&&t.writecb&&!t.transforming?(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform)):t.needTransform=!0}},{"./duplex.js":36,inherits:32}],42:[function(t,e){function r(t,e,r){this.chunk=t,this.encoding=e,this.callback=r}function n(t,e){t=t||{};var r=t.highWaterMark;this.highWaterMark=r||0===r?r:16384,this.objectMode=!!t.objectMode,this.highWaterMark=~~this.highWaterMark,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1;var n=t.decodeStrings===!1;this.decodeStrings=!n,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){l(e,t)},this.writecb=null,this.writelen=0,this.buffer=[]}function i(t){return this instanceof i||this instanceof w.Duplex?(this._writableState=new n(t,this),this.writable=!0,w.call(this),void 0):new i(t)}function s(t,e,r){var n=Error("write after end");t.emit("error",n),_(function(){r(n)})}function o(t,e,r,n){var i=!0;if(!x.isBuffer(r)&&"string"!=typeof r&&null!==r&&void 0!==r&&!e.objectMode){var s=new TypeError("Invalid non-string/buffer chunk");t.emit("error",s),_(function(){n(s)}),i=!1}return i}function a(t,e,r){return t.objectMode||t.decodeStrings===!1||"string"!=typeof e||(e=new x(e,r)),e}function u(t,e,n,i,s){n=a(e,n,i);var o=e.objectMode?1:n.length;e.length+=o;var u=e.length<e.highWaterMark;return e.needDrain=!u,e.writing?e.buffer.push(new r(n,i,s)):c(t,e,o,n,i,s),u}function c(t,e,r,n,i,s){e.writelen=r,e.writecb=s,e.writing=!0,e.sync=!0,t._write(n,i,e.onwrite),e.sync=!1}function h(t,e,r,n,i){r?_(function(){i(n)}):i(n),t.emit("error",n)}function f(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}function l(t,e){var r=t._writableState,n=r.sync,i=r.writecb;if(f(r),e)h(t,r,n,e,i);else{var s=y(t,r);s||r.bufferProcessing||!r.buffer.length||g(t,r),n?_(function(){p(t,r,s,i)}):p(t,r,s,i)}}function p(t,e,r,n){r||d(t,e),n(),r&&v(t,e)}function d(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}function g(t,e){e.bufferProcessing=!0;for(var r=0;e.buffer.length>r;r++){var n=e.buffer[r],i=n.chunk,s=n.encoding,o=n.callback,a=e.objectMode?1:i.length;if(c(t,e,a,i,s,o),e.writing){r++;break}}e.bufferProcessing=!1,e.buffer.length>r?e.buffer=e.buffer.slice(r):e.buffer.length=0}function y(t,e){return e.ending&&0===e.length&&!e.finished&&!e.writing}function v(t,e){var r=y(t,e);return r&&(e.finished=!0,t.emit("finish")),r}function m(t,e,r){e.ending=!0,v(t,e),r&&(e.finished?_(r):t.once("finish",r)),e.ended=!0}e.exports=i,i.WritableState=n;var b=t("inherits"),w=t("./index.js"),_=t("setimmediate"),x=t("buffer").Buffer;b(i,w),i.prototype.pipe=function(){this.emit("error",Error("Cannot pipe. Not readable."))},i.prototype.write=function(t,e,r){var n=this._writableState,i=!1;return"function"==typeof e&&(r=e,e=null),x.isBuffer(t)?e="buffer":e||(e=n.defaultEncoding),"function"!=typeof r&&(r=function(){}),n.ended?s(this,n,r):o(this,n,t,r)&&(i=u(this,n,t,e,r)),i},i.prototype._write=function(t,e,r){r(Error("not implemented"))},i.prototype.end=function(t,e,r){var n=this._writableState;"function"==typeof t?(r=t,t=null,e=null):"function"==typeof e&&(r=e,e=null),t!==void 0&&null!==t&&this.write(t,e),n.ending||n.finished||m(this,n,r)}},{"./index.js":37,buffer:34,inherits:32,setimmediate:38}],43:[function(t,e,r){function n(t){if(t&&!a.isEncoding(t))throw Error("Unknown encoding: "+t)}function i(t){return t.toString(this.encoding)}function s(t){var e=this.charReceived=t.length%2;return this.charLength=e?2:0,e}function o(t){var e=this.charReceived=t.length%3;return this.charLength=e?3:0,e}var a=t("buffer").Buffer,u=r.StringDecoder=function(t){switch(this.encoding=(t||"utf8").toLowerCase().replace(/[-_]/,""),n(t),this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2,this.detectIncompleteChar=s;break;case"base64":this.surrogateSize=3,this.detectIncompleteChar=o;break;default:return this.write=i,void 0}this.charBuffer=new a(6),this.charReceived=0,this.charLength=0};u.prototype.write=function(t){for(var e="",r=0;this.charLength;){var n=t.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:t.length;if(t.copy(this.charBuffer,this.charReceived,r,n),this.charReceived+=n-r,r=n,this.charReceived<this.charLength)return"";e=this.charBuffer.slice(0,this.charLength).toString(this.encoding);var i=e.charCodeAt(e.length-1);if(!(i>=55296&&56319>=i)){if(this.charReceived=this.charLength=0,n==t.length)return e;t=t.slice(n,t.length);break}this.charLength+=this.surrogateSize,e=""}var s=this.detectIncompleteChar(t),o=t.length;this.charLength&&(t.copy(this.charBuffer,0,t.length-s,o),this.charReceived=s,o-=s),e+=t.toString(this.encoding,0,o);var o=e.length-1,i=e.charCodeAt(o);if(i>=55296&&56319>=i){var a=this.surrogateSize;return this.charLength+=a,this.charReceived+=a,this.charBuffer.copy(this.charBuffer,a,0,a),this.charBuffer.write(e.charAt(e.length-1),this.encoding),e.substring(0,o)}return e},u.prototype.detectIncompleteChar=function(t){for(var e=t.length>=3?3:t.length;e>0;e--){var r=t[t.length-e];if(1==e&&6==r>>5){this.charLength=2;break}if(2>=e&&14==r>>4){this.charLength=3;break}if(3>=e&&30==r>>3){this.charLength=4;break}}return e},u.prototype.end=function(t){var e="";if(t&&t.length&&(e=this.write(t)),this.charReceived){var r=this.charReceived,n=this.charBuffer,i=this.encoding;e+=n.slice(0,r).toString(i)}return e}},{buffer:34}]},{},[]);var hat=require("hat"),term=require("hypernal")();term.appendTo("body"),term.writeln(hat());
<style type='text/css'>html, body { margin: 0; padding: 0; border: 0; }
body, html { height: 100%; width: 100%; }</style>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment