Skip to content

Instantly share code, notes, and snippets.

@chrisdickinson
Created August 28, 2013 18:05
Show Gist options
  • Save chrisdickinson/6369208 to your computer and use it in GitHub Desktop.
Save chrisdickinson/6369208 to your computer and use it in GitHub Desktop.
requirebin sketch
var term = require('hypernal')()
term.appendTo(document.body);
var termEl = term.term.element
termEl.style['font'] = '13px Monaco, mono'
termEl.style.height = '100%'
termEl.style.padding = '5px'
termEl.style.overflow = 'auto'
termEl.style['white-space'] = 'pre'
term.write(data())
function data() {
return JSON.parse('"usage: jik [--help] <ast-selector> [<action>] <filename> [<filename>...]\\n\\n search a javascript file or directory using the provided \\u001b[4m<ast-selector>\\u001b[0m\\n and execution \\u001b[4m<action>\\u001b[0m on each matching AST node.\\n\\n if \\u001b[4m<filename>\\u001b[0m is a directory, that directory will be traversed and any\\n file ending with \\".js\\" will be searched. \\n\\n \\u001b[4maction\\u001b[0m must be valid javascript if present, surrounded by \\"{}\\". the following\\n objects and functions are available to you:\\n\\n console - the console object.\\n $NODE - the current node.\\n $LINE - the line of the current node.\\n $FILE - the current filename.\\n $LAST - is the current node the last match in $FILE?\\n $COUNT - the number of times the action\\n has been called in the current file.\\n $POS - a macro for (!$COUNT ? $FILE + \'\\\\n\' : \'\') + $LINE + \':\'\\n parents([node,] selector) - returns the parent matching selector or an empty object.\\n pos(node) - returns an object with {line, col} attributes.\\n is([node,] selector) - returns whether or not the given node (or if\\n not given, $NODE) matches selector.\\n follow(file) - recurse into file.\\n require(module) - requires module.\\n\\n if not specified, the default \\u001b[4maction\\u001b[0m is \'{print($POS, $NODE)}\'.\\n\\n \\u001b[4mast-selectors\\u001b[0m\\n\\n The AST selector language follows the same general rules as\\n CSS selectors. The following \\"tag\\" style selectors are available:\\n\\n block if(x) \\u001b[31m{\\n \\u001b[31m // also works with\\n \\u001b[31m // for, do, while, etc\\n \\u001b[31m}\\u001b[0m\\n\\n expr var x = 2, y = 3\\n \\u001b[31my = x + 3 \\n if(x + 1) {\\n ...\\n\\n ternary var y = \\u001b[31mx ? 1 : 2\\u001b[0m;\\n\\n if \\u001b[31mif(x) {\\n \\u001b[31m} else {\\n \\u001b[31m}\\n if:first-child if(\\u001b[31mx\\u001b[0m) {\\n } else {\\n }\\n if > *:first-child + * if(x) \\u001b[31m{\\n \\u001b[31m} \\u001b[0melse {\\n }\\n if > *:first-child + * + * if(x) {\\n } else \\u001b[31m{\\n \\u001b[31m}\\n if > *:first-child + * + if if(x) {\\n } else \\u001b[31mif(...) {\\n \\u001b[31m}\\n\\n break \\u001b[31mbreak\\u001b[0m;\\n break[label] \\u001b[31mbreak example\\u001b[0m; \\n\\n continue \\u001b[31mcontinue\\u001b[0m;\\n continue[label] \\u001b[31mcontinue example\\u001b[0m; \\n\\n with \\u001b[31mwith(ex) {\\u001b[0m; \\n \\u001b[31m}\\u001b[0m; \\n\\n switch \\u001b[31mswitch(ex) {\\u001b[0m; \\n \\u001b[31m}\\u001b[0m; \\n\\n return \\u001b[31mreturn\\u001b[0m;\\n return[argument] \\u001b[31mreturn anything\\u001b[0m;\\n return > * return \\u001b[31manything\\u001b[0m;\\n\\n while \\u001b[31mwhile(x) { }\\u001b[0m\\n do-while \\u001b[31mdo { } while(x)\\u001b[0m\\n for \\u001b[31mfor(var x; y; z) { }\\u001b[0m\\n for-in \\u001b[31mfor(var k in o) { }\\u001b[0m\\n for-in[left] > *:first-child for(\\u001b[31mvar k\\u001b[0m in o) { }\\u001b[0m\\n for-in[right] > *:first-child + * for(var k in \\u001b[31mo\\u001b[0m) { }\\u001b[0m\\n for-in > *:last-child for(var k in o) \\u001b[31m{ }\\u001b[0m\\n\\n variable-decl \\u001b[31mvar x = 3, y = 2, z\\u001b[0m;\\n variable-decl[kind=const] \\u001b[31mconst x = 3, y = 2, z\\u001b[0m;\\n variable-decl[kind=var] \\u001b[31mvar x = 3, y = 2, z\\u001b[0m;\\n variable-decl[kind=let] \\u001b[31mlet x = 3, y = 2, z\\u001b[0m;\\n\\n variable var \\u001b[31mx = 3\\u001b[0m, \\u001b[31my = 2\\u001b[0m, \\u001b[31mz\\u001b[0m;\\n variable[init] var \\u001b[31mx = 3\\u001b[0m, \\u001b[31my = 2\\u001b[0m, z;\\n variable > id:first-child var \\u001b[31mx\\u001b[0m = 3, \\u001b[31my\\u001b[0m = 2, \\u001b[31mz\\u001b[0m;\\n\\n binary \\u001b[31mx + 2\\u001b[0m, \\u001b[31mx || y\\u001b[0m\\n binary[operator=\\\\+] \\u001b[31mx + 2\\u001b[0m, x || y\\n\\n assign \\u001b[31mx = y\\u001b[0m\\n assign[operator=\\\\>\\\\>\\\\=] \\u001b[31mx = y\\u001b[0m\\n\\n array y = \\u001b[31m[0, 1, 2]\\u001b[0m\\n\\n object y = \\u001b[31m{a: 0, b: 1, c: 2}\\u001b[0m\\n object > * > :any(literal, id):first-child\\n y = {\\u001b[31ma\\u001b[0m: 0, \\u001b[31mb\\u001b[0m: 1, \\u001b[31m\\"c\\"\\u001b[0m: 2}\\n object > * > :any(literal, id):first-child + *\\n y = {a: \\u001b[31m0\\u001b[0m, b: \\u001b[31m1\\u001b[0m, \\"c\\": \\u001b[31m2\\u001b[0m}\\n\\n function \\u001b[31mfunction() {}\\u001b[0m\\n function[id] \\u001b[31mfunction name() {}\\u001b[0m\\n\\n sequence var x = \\u001b[31m0, 1, 2\\u001b[0m // x == 2\\n\\n update \\u001b[31m++x\\u001b[31m, \\u001b[31my++\\u001b[0m\\n update[prefix] \\u001b[31m++x\\u001b[0m, y++\\n\\n unary \\u001b[31mvoid x\\u001b[0m, \\u001b[31m~x\\u001b[0m, \\u001b[31m!x\\u001b[0m, \\u001b[31mdelete x\\u001b[0m, \\u001b[31mtypeof x\\n unary[operator=void] \\u001b[31mvoid x\\u001b[0m, ~x, !x, delete x, typeof x\\n\\n call x(y, z)\\n call > *:first-child \\u001b[31mx\\u001b[0m(y, z)\\n call > *:first-child ~ * x(\\u001b[31my\\u001b[0m, \\u001b[31mz\\u001b[0m)\\n\\n new new Callee(arg, arg, arg)\\n new[callee] > *:first-child new \\u001b[31mCallee\\u001b[0m(arg, arg, arg)\\n new[callee] > *:first-child ~ * new Callee(\\u001b[31marg\\u001b[0m, \\u001b[31marg\\u001b[0m, \\u001b[31marg\\u001b[0m)\\n\\n lookup \\u001b[31mobj.x\\u001b[0m, \\u001b[31mobj[\\"hello\\" + x]\\u001b[0m\\n lookup[computed] obj.x, \\u001b[31mobj[\\"hello\\" + x]\\u001b[0m\\n lookup > * + expr obj.x, obj[\\u001b[31m\\"hello\\" + x\\u001b[0m]\\n lookup > * + id obj.\\u001b[31mx\\u001b[0m, obj[\\"hello\\" + x]\\n lookup > * + * obj.\\u001b[31mx\\u001b[0m, obj[\\u001b[31m\\"hello\\" + x\\u001b[0m]\\n lookup > *:first-child \\u001b[31mobj\\u001b[0m.x, \\u001b[31mobj\\u001b[0m[\\"hello\\" + x]\\n\\n case switch(x) { \\u001b[31mcase 3\\u001b[0m: arf; \\u001b[31mdefault\\u001b[0m: barf; }\\n case[test] switch(x) { \\u001b[31mcase 3\\u001b[0m: arf; default: barf; }\\n\\n throw \\u001b[31mthrow\\n\\n label \\u001b[31mexample:\\u001b[0m\\n var x = 3;\\n\\n try \\u001b[31mtry {\\n \\u001b[31m} catch(err) {\\n \\u001b[31m}\\n try[handlers] \\u001b[31mtry {\\n \\u001b[31m} catch(err) {\\n \\u001b[31m}\\n try[finalizer] \\u001b[31mtry {\\n \\u001b[31m} finally {\\n \\u001b[31m}\\n try > catch try {\\n } \\u001b[31mcatch(err) {\\n catch ... } \\u001b[31mcatch(err) {\\n \\u001b[31m}\\n this \\u001b[31mthis\\n id \\u001b[31mx\\u001b[0m, \\u001b[31marf\\u001b[0m, \\u001b[31m$barf\\u001b[0m, \\u001b[31mx_y\\n literal \\u001b[31m0\\u001b[0m, \\u001b[31mNaN\\u001b[0m, \\u001b[31m\\"hi\\"\\u001b[0m, \\u001b[31mtrue\\u001b[0m, \\u001b[31mfalse\\u001b[0m, \\u001b[31mnull\\u001b[0m, \\u001b[31m3.2\\u001b[0m, \\u001b[31m/asdf/\\n\\n The following operators are available:\\n\\n parent-sel > direct-child-sel Selects only nodes who match\\n direct-child-sel and whose \\n direct parents match parent-sel.\\n \\n parent-sel indirect-child-sel Selects nodes who match\\n indirect-child-sel and who\\n descend from any node matching\\n parent-sel.\\n\\n child-sel + sibling-sel Selects nodes who match sibling-sel\\n and who are directly next to a node\\n that matches child-sel.\\n\\n child-sel ~ sibling-sel Selects nodes who match sibling-sel\\n and who possess a prior sibling matching\\n child-sel.\\n\\n complex selector-one, selector-two Selects nodes who match either the selector\\n to the left or the right of the comma.\\n\\n [attr] attr is present on this node and is\\n truthy.\\n\\n [attr=value] attr is present on this node and matches\\n value.\\n\\n [attr$=value] attr is present on this node and ends with\\n value.\\n \\n [attr^=value] attr is present on this node and begins with\\n value.\\n \\n [attr*=value] attr is present on this node and contains value.\\n\\n :first-child Node is the first child of its parent.\\n\\n :last-child Node is the last child of its parent.\\n\\n :empty Node has no children.\\n\\n :root Node is the root of the tree.\\n\\n :contains(text) The source code of node contains text.\\n\\n :any(selector, selector) True if any selector matches node.\\n\\n"')
}
function data(){return JSON.parse('"usage: jik [--help] <ast-selector> [<action>] <filename> [<filename>...]\\n\\n search a javascript file or directory using the provided \\u001b[4m<ast-selector>\\u001b[0m\\n and execution \\u001b[4m<action>\\u001b[0m on each matching AST node.\\n\\n if \\u001b[4m<filename>\\u001b[0m is a directory, that directory will be traversed and any\\n file ending with \\".js\\" will be searched. \\n\\n \\u001b[4maction\\u001b[0m must be valid javascript if present, surrounded by \\"{}\\". the following\\n objects and functions are available to you:\\n\\n console - the console object.\\n $NODE - the current node.\\n $LINE - the line of the current node.\\n $FILE - the current filename.\\n $LAST - is the current node the last match in $FILE?\\n $COUNT - the number of times the action\\n has been called in the current file.\\n $POS - a macro for (!$COUNT ? $FILE + \'\\\\n\' : \'\') + $LINE + \':\'\\n parents([node,] selector) - returns the parent matching selector or an empty object.\\n pos(node) - returns an object with {line, col} attributes.\\n is([node,] selector) - returns whether or not the given node (or if\\n not given, $NODE) matches selector.\\n follow(file) - recurse into file.\\n require(module) - requires module.\\n\\n if not specified, the default \\u001b[4maction\\u001b[0m is \'{print($POS, $NODE)}\'.\\n\\n \\u001b[4mast-selectors\\u001b[0m\\n\\n The AST selector language follows the same general rules as\\n CSS selectors. The following \\"tag\\" style selectors are available:\\n\\n block if(x) \\u001b[31m{\\n \\u001b[31m // also works with\\n \\u001b[31m // for, do, while, etc\\n \\u001b[31m}\\u001b[0m\\n\\n expr var x = 2, y = 3\\n \\u001b[31my = x + 3 \\n if(x + 1) {\\n ...\\n\\n ternary var y = \\u001b[31mx ? 1 : 2\\u001b[0m;\\n\\n if \\u001b[31mif(x) {\\n \\u001b[31m} else {\\n \\u001b[31m}\\n if:first-child if(\\u001b[31mx\\u001b[0m) {\\n } else {\\n }\\n if > *:first-child + * if(x) \\u001b[31m{\\n \\u001b[31m} \\u001b[0melse {\\n }\\n if > *:first-child + * + * if(x) {\\n } else \\u001b[31m{\\n \\u001b[31m}\\n if > *:first-child + * + if if(x) {\\n } else \\u001b[31mif(...) {\\n \\u001b[31m}\\n\\n break \\u001b[31mbreak\\u001b[0m;\\n break[label] \\u001b[31mbreak example\\u001b[0m; \\n\\n continue \\u001b[31mcontinue\\u001b[0m;\\n continue[label] \\u001b[31mcontinue example\\u001b[0m; \\n\\n with \\u001b[31mwith(ex) {\\u001b[0m; \\n \\u001b[31m}\\u001b[0m; \\n\\n switch \\u001b[31mswitch(ex) {\\u001b[0m; \\n \\u001b[31m}\\u001b[0m; \\n\\n return \\u001b[31mreturn\\u001b[0m;\\n return[argument] \\u001b[31mreturn anything\\u001b[0m;\\n return > * return \\u001b[31manything\\u001b[0m;\\n\\n while \\u001b[31mwhile(x) { }\\u001b[0m\\n do-while \\u001b[31mdo { } while(x)\\u001b[0m\\n for \\u001b[31mfor(var x; y; z) { }\\u001b[0m\\n for-in \\u001b[31mfor(var k in o) { }\\u001b[0m\\n for-in[left] > *:first-child for(\\u001b[31mvar k\\u001b[0m in o) { }\\u001b[0m\\n for-in[right] > *:first-child + * for(var k in \\u001b[31mo\\u001b[0m) { }\\u001b[0m\\n for-in > *:last-child for(var k in o) \\u001b[31m{ }\\u001b[0m\\n\\n variable-decl \\u001b[31mvar x = 3, y = 2, z\\u001b[0m;\\n variable-decl[kind=const] \\u001b[31mconst x = 3, y = 2, z\\u001b[0m;\\n variable-decl[kind=var] \\u001b[31mvar x = 3, y = 2, z\\u001b[0m;\\n variable-decl[kind=let] \\u001b[31mlet x = 3, y = 2, z\\u001b[0m;\\n\\n variable var \\u001b[31mx = 3\\u001b[0m, \\u001b[31my = 2\\u001b[0m, \\u001b[31mz\\u001b[0m;\\n variable[init] var \\u001b[31mx = 3\\u001b[0m, \\u001b[31my = 2\\u001b[0m, z;\\n variable > id:first-child var \\u001b[31mx\\u001b[0m = 3, \\u001b[31my\\u001b[0m = 2, \\u001b[31mz\\u001b[0m;\\n\\n binary \\u001b[31mx + 2\\u001b[0m, \\u001b[31mx || y\\u001b[0m\\n binary[operator=\\\\+] \\u001b[31mx + 2\\u001b[0m, x || y\\n\\n assign \\u001b[31mx = y\\u001b[0m\\n assign[operator=\\\\>\\\\>\\\\=] \\u001b[31mx = y\\u001b[0m\\n\\n array y = \\u001b[31m[0, 1, 2]\\u001b[0m\\n\\n object y = \\u001b[31m{a: 0, b: 1, c: 2}\\u001b[0m\\n object > * > :any(literal, id):first-child\\n y = {\\u001b[31ma\\u001b[0m: 0, \\u001b[31mb\\u001b[0m: 1, \\u001b[31m\\"c\\"\\u001b[0m: 2}\\n object > * > :any(literal, id):first-child + *\\n y = {a: \\u001b[31m0\\u001b[0m, b: \\u001b[31m1\\u001b[0m, \\"c\\": \\u001b[31m2\\u001b[0m}\\n\\n function \\u001b[31mfunction() {}\\u001b[0m\\n function[id] \\u001b[31mfunction name() {}\\u001b[0m\\n\\n sequence var x = \\u001b[31m0, 1, 2\\u001b[0m // x == 2\\n\\n update \\u001b[31m++x\\u001b[31m, \\u001b[31my++\\u001b[0m\\n update[prefix] \\u001b[31m++x\\u001b[0m, y++\\n\\n unary \\u001b[31mvoid x\\u001b[0m, \\u001b[31m~x\\u001b[0m, \\u001b[31m!x\\u001b[0m, \\u001b[31mdelete x\\u001b[0m, \\u001b[31mtypeof x\\n unary[operator=void] \\u001b[31mvoid x\\u001b[0m, ~x, !x, delete x, typeof x\\n\\n call x(y, z)\\n call > *:first-child \\u001b[31mx\\u001b[0m(y, z)\\n call > *:first-child ~ * x(\\u001b[31my\\u001b[0m, \\u001b[31mz\\u001b[0m)\\n\\n new new Callee(arg, arg, arg)\\n new[callee] > *:first-child new \\u001b[31mCallee\\u001b[0m(arg, arg, arg)\\n new[callee] > *:first-child ~ * new Callee(\\u001b[31marg\\u001b[0m, \\u001b[31marg\\u001b[0m, \\u001b[31marg\\u001b[0m)\\n\\n lookup \\u001b[31mobj.x\\u001b[0m, \\u001b[31mobj[\\"hello\\" + x]\\u001b[0m\\n lookup[computed] obj.x, \\u001b[31mobj[\\"hello\\" + x]\\u001b[0m\\n lookup > * + expr obj.x, obj[\\u001b[31m\\"hello\\" + x\\u001b[0m]\\n lookup > * + id obj.\\u001b[31mx\\u001b[0m, obj[\\"hello\\" + x]\\n lookup > * + * obj.\\u001b[31mx\\u001b[0m, obj[\\u001b[31m\\"hello\\" + x\\u001b[0m]\\n lookup > *:first-child \\u001b[31mobj\\u001b[0m.x, \\u001b[31mobj\\u001b[0m[\\"hello\\" + x]\\n\\n case switch(x) { \\u001b[31mcase 3\\u001b[0m: arf; \\u001b[31mdefault\\u001b[0m: barf; }\\n case[test] switch(x) { \\u001b[31mcase 3\\u001b[0m: arf; default: barf; }\\n\\n throw \\u001b[31mthrow\\n\\n label \\u001b[31mexample:\\u001b[0m\\n var x = 3;\\n\\n try \\u001b[31mtry {\\n \\u001b[31m} catch(err) {\\n \\u001b[31m}\\n try[handlers] \\u001b[31mtry {\\n \\u001b[31m} catch(err) {\\n \\u001b[31m}\\n try[finalizer] \\u001b[31mtry {\\n \\u001b[31m} finally {\\n \\u001b[31m}\\n try > catch try {\\n } \\u001b[31mcatch(err) {\\n catch ... } \\u001b[31mcatch(err) {\\n \\u001b[31m}\\n this \\u001b[31mthis\\n id \\u001b[31mx\\u001b[0m, \\u001b[31marf\\u001b[0m, \\u001b[31m$barf\\u001b[0m, \\u001b[31mx_y\\n literal \\u001b[31m0\\u001b[0m, \\u001b[31mNaN\\u001b[0m, \\u001b[31m\\"hi\\"\\u001b[0m, \\u001b[31mtrue\\u001b[0m, \\u001b[31mfalse\\u001b[0m, \\u001b[31mnull\\u001b[0m, \\u001b[31m3.2\\u001b[0m, \\u001b[31m/asdf/\\n\\n The following operators are available:\\n\\n parent-sel > direct-child-sel Selects only nodes who match\\n direct-child-sel and whose \\n direct parents match parent-sel.\\n \\n parent-sel indirect-child-sel Selects nodes who match\\n indirect-child-sel and who\\n descend from any node matching\\n parent-sel.\\n\\n child-sel + sibling-sel Selects nodes who match sibling-sel\\n and who are directly next to a node\\n that matches child-sel.\\n\\n child-sel ~ sibling-sel Selects nodes who match sibling-sel\\n and who possess a prior sibling matching\\n child-sel.\\n\\n complex selector-one, selector-two Selects nodes who match either the selector\\n to the left or the right of the comma.\\n\\n [attr] attr is present on this node and is\\n truthy.\\n\\n [attr=value] attr is present on this node and matches\\n value.\\n\\n [attr$=value] attr is present on this node and ends with\\n value.\\n \\n [attr^=value] attr is present on this node and begins with\\n value.\\n \\n [attr*=value] attr is present on this node and contains value.\\n\\n :first-child Node is the first child of its parent.\\n\\n :last-child Node is the last child of its parent.\\n\\n :empty Node has no children.\\n\\n :root Node is the root of the tree.\\n\\n :contains(text) The source code of node contains text.\\n\\n :any(selector, selector) True if any selector matches node.\\n\\n"')}require=function(t,e,s){function r(s,n){if(!e[s]){if(!t[s]){var a="function"==typeof require&&require;if(!n&&a)return a(s,!0);if(i)return i(s,!0);throw Error("Cannot find module '"+s+"'")}var o=e[s]={exports:{}};t[s][0].call(o.exports,function(e){var i=t[s][1][e];return r(i?i:e)},o,o.exports)}return e[s].exports}for(var i="function"==typeof require&&require,n=0;s.length>n;n++)r(s[n]);return r}({hypernal:[function(t,e){e.exports=t("kBgJmx")},{}],kBgJmx:[function(t,e){"use strict";function s(t){var e=t.getAttribute("style")||"";t.setAttribute("style",e+"overflow-y: auto; /* white-space: pre; */")}function r(t){t&&(t.scrollTop=t.scrollHeight)}var i=t("./term"),n=t("through");e.exports=function(t){var e=new i(t);e.open();var a=n(e.write.bind(e));return a.appendTo=function(t){"string"==typeof t&&(t=document.querySelector(t)),t.appendChild(e.element),s(t),a.container=t,e.element.style.position="relative"},a.writeln=function(t){e.writeln(t),a.tail&&r(a.container)},a.write=function(t){e.write(t),a.tail&&r(a.container)},a.reset=e.reset.bind(e),a.element=e.element,a.term=e,a}},{"./term":1,through:2}],1:[function(t,e){"use strict";function s(t){if(t=t||{},!(this instanceof s))return new s(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=r.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 r=t("./lib/states");e.exports=s,t("./lib/colors")(s),t("./lib/options")(s),t("./lib/open")(s),t("./lib/destroy")(s),t("./lib/refresh")(s),t("./lib/write")(s),t("./lib/setgLevel"),t("./lib/setgCharset"),t("./lib/debug")(s),t("./lib/stops")(s),t("./lib/erase")(s),t("./lib/blankLine")(s),t("./lib/range")(s),t("./lib/util")(s),t("./lib/esc/index.js")(s),t("./lib/esc/reset.js")(s),t("./lib/esc/tabSet.js")(s),t("./lib/csi/charAttributes")(s),t("./lib/csi/insert-delete")(s),t("./lib/csi/position")(s),t("./lib/csi/cursor")(s),t("./lib/csi/repeatPrecedingCharacter")(s),t("./lib/csi/tabClear")(s),t("./lib/csi/softReset")(s),t("./lib/charsets.js")(s)},{"./lib/esc/index.js":3,"./lib/esc/reset.js":4,"./lib/esc/tabSet.js":5,"./lib/charsets.js":6,"./lib/states":7,"./lib/colors":8,"./lib/options":9,"./lib/open":10,"./lib/destroy":11,"./lib/refresh":12,"./lib/write":13,"./lib/setgLevel":14,"./lib/setgCharset":15,"./lib/debug":16,"./lib/stops":17,"./lib/erase":18,"./lib/blankLine":19,"./lib/range":20,"./lib/util":21,"./lib/csi/insert-delete":22,"./lib/csi/charAttributes":23,"./lib/csi/position":24,"./lib/csi/cursor":25,"./lib/csi/repeatPrecedingCharacter":26,"./lib/csi/tabClear":27,"./lib/csi/softReset":28}],4:[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)}}},{}],6:[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}},{}],7:[function(t,e){"use strict";e.exports={normal:0,escaped:1,csi:2,osc:3,charset:4,dcs:5,ignore:6}},{}],8:[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,r){i.push("#"+s(t)+s(e)+s(r))}function s(t){return t=t.toString(16),2>t.length?"0"+t:t}var r,i=t.colors,n=[0,95,135,175,215,255];for(r=0;216>r;r++)e(n[0|r/36%6],n[0|r/6%6],n[r%6]);for(r=0;24>r;r++)n=8+10*r,e(n,n,n);return i}(),t.defaultColors={bg:"#000000",fg:"#f0f0f0"},t.colors[256]=t.defaultColors.bg,t.colors[257]=t.defaultColors.fg}},{}],9:[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}},{}],10:[function(t,e){"use strict";function s(){var t=document.createElement("span");t.innerHTML="hello world",document.body.appendChild(t);var e=t.scrollWidth;t.style.fontWeight="bold";var s=t.scrollWidth;return document.body.removeChild(t),e!==s}e.exports=function(t){t.prototype.open=function(){var e,r=0;for(this.element=document.createElement("div"),this.element.className="terminal",this.children=[];this.rows>r;r++)e=document.createElement("div"),this.element.appendChild(e),this.children.push(e);this.refresh(0,this.rows-1),null===t.brokenBold&&(t.brokenBold=s()),this.element.style.backgroundColor=t.defaultColors.bg,this.element.style.color=t.defaultColors.fg}}},{}],11:[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(){}}}},{}],12:[function(t,e){"use strict";e.exports=function(t){t.prototype.refresh=function(e,s){var r,i,n,a,o,c,h,u,l,b,p,f,m,d;for(h=this.cols,i=e;s>=i;i++){if(m=i+this.ydisp,a=this.lines[m],!a)return this.reset();for(o="",r=i===this.y&&this.cursorState&&this.ydisp===this.ybase&&!this.cursorHidden?this.x:-1,l=this.defAttr,n=0;h>n;n++){switch(u=a[n][0],c=a[n][1],n===r&&(u=-1),u!==l&&(l!==this.defAttr&&(o+="</span>"),u!==this.defAttr&&(-1===u?o+='<span class="reverse-video">':(o+='<span style="',p=511&u,b=511&u>>9,f=u>>18,1&f&&(t.brokenBold||(o+="font-weight:bold;"),8>b&&(b+=8)),2&f&&(o+="text-decoration:underline;"),256!==p&&(o+="background-color:"+t.colors[p]+";"),257!==b&&(o+="color:"+t.colors[b]+";"),o+='">'))),c){case"&":o+="&";break;case"<":o+="<";break;case">":o+=">";break;default:o+=" ">=c?" ":c}l=u}l!==this.defAttr&&(o+="</span>"),this.children[i].innerHTML=o}d&&d.appendChild(this.element)}}},{}],14:[function(t,e){"use strict";e.exports=function(t){t.prototype.setgLevel=function(t){this.glevel=t,this.charset=this.charsets[t]}}},{}],15:[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)}}},{}],16:[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)}}}},{}],17:[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}}},{}],18:[function(t,e){"use strict";e.exports=function(t){t.prototype.eraseRight=function(t,e){for(var s=this.lines[this.ybase+e],r=[this.curAttr," "];this.cols>t;t++)s[t]=r;this.updateRange(e)},t.prototype.eraseLeft=function(t,e){var s=this.lines[this.ybase+e],r=[this.curAttr," "];for(t++;t--;)s[t]=r;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)}}}},{}],20:[function(t,e){"use strict";function s(){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),s.bind(this)()},t.prototype.maxRange=function(){this.refreshStart=0,this.refreshEnd=this.rows-1}}},{}],19:[function(t,e){"use strict";e.exports=function(t){t.prototype.blankLine=function(t){for(var e=t?this.curAttr:this.defAttr,s=[e," "],r=[],i=0;this.cols>i;i++)r[i]=s;return r}}},{}],21:[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 s=this.termName||t.termName;return 0===(s+"").indexOf(e)}}},{}],22:[function(t,e){"use strict";e.exports=function(t){t.prototype.insertChars=function(t){var e,s,r,i;for(e=t[0],1>e&&(e=1),s=this.y+this.ybase,r=this.x,i=[this.curAttr," "];e--&&this.cols>r;)this.lines[s].splice(r++,0,i),this.lines[s].pop()},t.prototype.insertLines=function(t){var e,s,r;for(e=t[0],1>e&&(e=1),s=this.y+this.ybase,r=this.rows-1-this.scrollBottom,r=this.rows-1+this.ybase-r+1;e--;)this.lines.splice(s,0,this.blankLine(!0)),this.lines.splice(r,1);this.updateRange(this.y),this.updateRange(this.scrollBottom)},t.prototype.deleteLines=function(t){var e,s,r;for(e=t[0],1>e&&(e=1),s=this.y+this.ybase,r=this.rows-1-this.scrollBottom,r=this.rows-1+this.ybase-r;e--;)this.lines.splice(r+1,0,this.blankLine(!0)),this.lines.splice(s,1);this.updateRange(this.y),this.updateRange(this.scrollBottom)},t.prototype.deleteChars=function(t){var e,s,r;for(e=t[0],1>e&&(e=1),s=this.y+this.ybase,r=[this.curAttr," "];e--;)this.lines[s].splice(this.x,1),this.lines[s].push(r)},t.prototype.eraseChars=function(t){var e,s,r,i;for(e=t[0],1>e&&(e=1),s=this.y+this.ybase,r=this.x,i=[this.curAttr," "];e--&&this.cols>r;)this.lines[s][r++]=i}}},{}],23:[function(t,e){"use strict";e.exports=function(t){t.prototype.charAttributes=function(t){for(var e,s,r,i=t.length,n=0;i>n;n++)if(r=t[n],r>=30&&37>=r)this.curAttr=-261633&this.curAttr|r-30<<9;else if(r>=40&&47>=r)this.curAttr=-512&this.curAttr|r-40;else if(r>=90&&97>=r)r+=8,this.curAttr=-261633&this.curAttr|r-90<<9;else if(r>=100&&107>=r)r+=8,this.curAttr=-512&this.curAttr|r-100;else if(0===r)this.curAttr=this.defAttr;else if(1===r)this.curAttr=this.curAttr|1<<18;else if(4===r)this.curAttr=this.curAttr|2<<18;else if(7===r||27===r){if(7===r){if(4&this.curAttr>>18)continue;this.curAttr=this.curAttr|4<<18}else if(27===r){if(4&~(this.curAttr>>18))continue;this.curAttr=-1048577&this.curAttr}e=511&this.curAttr,s=511&this.curAttr>>9,this.curAttr=-262144&this.curAttr|(e<<9|s)}else if(22===r)this.curAttr=-262145&this.curAttr;else if(24===r)this.curAttr=-524289&this.curAttr;else if(39===r)this.curAttr=-261633&this.curAttr,this.curAttr=this.curAttr|(511&this.defAttr>>9)<<9;else if(49===r)this.curAttr=-512&this.curAttr,this.curAttr=this.curAttr|511&this.defAttr;else if(38===r){if(5!==t[n+1])continue;n+=2,r=255&t[n],this.curAttr=-261633&this.curAttr|r<<9}else if(48===r){if(5!==t[n+1])continue;n+=2,r=255&t[n],this.curAttr=-512&this.curAttr|r}}}},{}],24:[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)}}},{}],25:[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,s;e=t[0]-1,s=t.length>=2?t[1]-1:0,0>e?e=0:e>=this.rows&&(e=this.rows-1),0>s?s=0:s>=this.cols&&(s=this.cols-1),this.x=s,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()}}},{}],26:[function(t,e){"use strict";e.exports=function(t){t.prototype.repeatPrecedingCharacter=function(t){for(var e=t[0]||1,s=this.lines[this.ybase+this.y],r=s[this.x-1]||[this.defAttr," "];e--;)s[this.x++]=r}}},{}],27:[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={})}}},{}],28:[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]}}},{}],29:[function(t,e){var s=e.exports={};s.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 s=[];return window.addEventListener("message",function(t){if(t.source===window&&"process-tick"===t.data&&(t.stopPropagation(),s.length>0)){var e=s.shift();e()}},!0),function(t){s.push(t),window.postMessage("process-tick","*")}}return function(t){setTimeout(t,0)}}(),s.title="browser",s.browser=!0,s.env={},s.argv=[],s.binding=function(){throw Error("process.binding is not supported")},s.cwd=function(){return"/"},s.chdir=function(){throw Error("process.chdir is not supported")}},{}],2:[function(t,e,s){(function(r){function i(t,e,s){function i(){for(;h.length&&!l.paused;){var t=h.shift();if(null===t)return l.emit("end");l.emit("data",t)}}function a(){l.writable=!1,e.call(l),!l.readable&&l.autoDestroy&&l.destroy()}t=t||function(t){this.queue(t)},e=e||function(){this.queue(null)};var o=!1,c=!1,h=[],u=!1,l=new n;return l.readable=l.writable=!0,l.paused=!1,l.autoDestroy=!(s&&s.autoDestroy===!1),l.write=function(e){return t.call(this,e),!l.paused},l.queue=l.push=function(t){return u?l:(null==t&&(u=!0),h.push(t),i(),l)},l.on("end",function(){l.readable=!1,!l.writable&&l.autoDestroy&&r.nextTick(function(){l.destroy()})}),l.end=function(t){return o?void 0:(o=!0,arguments.length&&l.write(t),a(),l)},l.destroy=function(){return c?void 0:(c=!0,o=!0,h.length=0,l.writable=l.readable=!1,l.emit("close"),l)},l.pause=function(){return l.paused?void 0:(l.paused=!0,l)},l.resume=function(){return l.paused&&(l.paused=!1,l.emit("resume")),i(),l.paused||l.emit("drain"),l},l}var n=t("stream");s=e.exports=i,i.through=i})(t("__browserify_process"))},{stream:30,__browserify_process:29}],30:[function(t,e){function s(){r.EventEmitter.call(this)}var r=t("events"),i=t("util");i.inherits(s,r.EventEmitter),e.exports=s,s.Stream=s,s.prototype.pipe=function(t,e){function s(e){t.writable&&!1===t.write(e)&&c.pause&&c.pause()}function r(){c.readable&&c.resume&&c.resume()}function i(){h||(h=!0,t._pipeCount--,o(),t._pipeCount>0||t.end())}function n(){h||(h=!0,t._pipeCount--,o(),t._pipeCount>0||t.destroy())}function a(t){if(o(),0===this.listeners("error").length)throw t}function o(){c.removeListener("data",s),t.removeListener("drain",r),c.removeListener("end",i),c.removeListener("close",n),c.removeListener("error",a),t.removeListener("error",a),c.removeListener("end",o),c.removeListener("close",o),t.removeListener("end",o),t.removeListener("close",o)}var c=this;c.on("data",s),t.on("drain",r),t._isStdio||e&&e.end===!1||(t._pipeCount=t._pipeCount||0,t._pipeCount++,c.on("end",i),c.on("close",n));var h=!1;return c.on("error",a),t.on("error",a),c.on("end",o),c.on("close",o),t.on("end",o),t.on("close",o),t.emit("pipe",c),t}},{events:31,util:32}],13:[function(t,e){"use strict";function s(t){return t.replace(/([^\r])\n/g,"$1\r\n")}function r(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=s(e),e=r(e);var n,a,o=e.length,c=0;for(this.refreshStart=this.y,this.refreshEnd=this.y,this.ybase!==this.ydisp&&(this.ydisp=this.ybase,this.maxRange());o>c;c++)switch(a=e[c],this.state){case i.normal:switch(a){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:a>=" "&&(this.charset&&this.charset[a]&&(a=this.charset[a]),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,a]),this.x++,this.updateRange(this.y))}break;case i.escaped:switch(a){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,c++;break;case"(":case")":case"*":case"+":case"-":case".":switch(a){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,c--;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,c++;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.",a)}break;case i.charset:switch(a){case"0":n=t.charsets.SCLD;break;case"A":n=t.charsets.UK;break;case"B":n=t.charsets.US;break;case"4":n=t.charsets.Dutch;break;case"C":case"5":n=t.charsets.Finnish;break;case"R":n=t.charsets.French;break;case"Q":n=t.charsets.FrenchCanadian;break;case"K":n=t.charsets.German;break;case"Y":n=t.charsets.Italian;break;case"E":case"6":n=t.charsets.NorwegianDanish;
break;case"Z":n=t.charsets.Spanish;break;case"H":case"7":n=t.charsets.Swedish;break;case"=":n=t.charsets.Swiss;break;case"/":n=t.charsets.ISOLatin,c++;break;default:n=t.charsets.US}this.setgCharset(this.gcharset,n),this.gcharset=null,this.state=i.normal;break;case i.osc:if(""===a||""===a){switch(""===a&&c++,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+=a:a>="0"&&"9">=a?this.currentParam=10*this.currentParam+a.charCodeAt(0)-48:";"===a&&(this.params.push(this.currentParam),this.currentParam="");break;case i.csi:if("?"===a||">"===a||"!"===a){this.prefix=a;break}if(a>="0"&&"9">=a){this.currentParam=10*this.currentParam+a.charCodeAt(0)-48;break}if("$"===a||'"'===a||" "===a||"'"===a){this.postfix=a;break}if(this.params.push(this.currentParam),this.currentParam=0,";"===a)break;switch(this.state=i.normal,a){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.",a)}this.prefix="",this.postfix="";break;case i.dcs:if(""===a||""===a){switch(""===a&&c++,this.prefix){case"":break;case"$q":var h=this.currentParam;switch(h){case'"q':h='0"q';break;case'"p':h='61"p';break;case"r":h=""+(this.scrollTop+1)+";"+(this.scrollBottom+1)+"r";break;case"m":h="0m";break;default:this.error("Unknown DCS Pt: %s.",h),h=""}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+=a:this.prefix||"$"===a||"+"===a?2===this.prefix.length?this.currentParam=a:this.prefix+=a:this.currentParam=a;break;case i.ignore:""===a||""===a?(""===a&&c++,this.stateData="",this.state=i.normal):(this.stateData||(this.stateData=""),this.stateData+=a)}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":7}],3:[function(t,e){"use strict";var s=t("../states");e.exports=function(t){t.prototype.index=function(){this.y++,this.y>this.scrollBottom&&(this.y--,this.scroll()),this.state=s.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=s.normal}}},{"../states":7}],5:[function(t,e){"use strict";var s=t("../states");e.exports=function(t){t.prototype.tabSet=function(){this.tabs[this.x]=!0,this.state=s.normal}}},{"../states":7}],31:[function(t,e,s){(function(t){function e(t,e){if(t.indexOf)return t.indexOf(e);for(var s=0;t.length>s;s++)if(e===t[s])return s;return-1}t.EventEmitter||(t.EventEmitter=function(){});var r=s.EventEmitter=t.EventEmitter,i="function"==typeof Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)},n=10;r.prototype.setMaxListeners=function(t){this._events||(this._events={}),this._events.maxListeners=t},r.prototype.emit=function(t){if("error"===t&&(!this._events||!this._events.error||i(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 s=Array.prototype.slice.call(arguments,1);e.apply(this,s)}return!0}if(i(e)){for(var s=Array.prototype.slice.call(arguments,1),r=e.slice(),n=0,a=r.length;a>n;n++)r[n].apply(this,s);return!0}return!1},r.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(i(this._events[t])){if(!this._events[t].warned){var s;s=void 0!==this._events.maxListeners?this._events.maxListeners:n,s&&s>0&&this._events[t].length>s&&(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},r.prototype.on=r.prototype.addListener,r.prototype.once=function(t,e){var s=this;return s.on(t,function r(){s.removeListener(t,r),e.apply(this,arguments)}),this},r.prototype.removeListener=function(t,s){if("function"!=typeof s)throw Error("removeListener only takes instances of Function");if(!this._events||!this._events[t])return this;var r=this._events[t];if(i(r)){var n=e(r,s);if(0>n)return this;r.splice(n,1),0==r.length&&delete this._events[t]}else this._events[t]===s&&delete this._events[t];return this},r.prototype.removeAllListeners=function(t){return 0===arguments.length?(this._events={},this):(t&&this._events&&this._events[t]&&(this._events[t]=null),this)},r.prototype.listeners=function(t){return this._events||(this._events={}),this._events[t]||(this._events[t]=[]),i(this._events[t])||(this._events[t]=[this._events[t]]),this._events[t]}})(t("__browserify_process"))},{__browserify_process:29}],32:[function(t,e,s){function r(t){return t instanceof Array||Array.isArray(t)||t&&t!==Object.prototype&&r(t.__proto__)}function i(t){return t instanceof RegExp||"object"==typeof t&&"[object RegExp]"===Object.prototype.toString.call(t)}function n(t){if(t instanceof Date)return!0;if("object"!=typeof t)return!1;var e=Date.prototype&&o(Date.prototype),s=t.__proto__&&o(t.__proto__);return JSON.stringify(s)===JSON.stringify(e)}t("events"),s.isArray=r,s.isDate=function(t){return"[object Date]"===Object.prototype.toString.call(t)},s.isRegExp=function(t){return"[object RegExp]"===Object.prototype.toString.call(t)},s.print=function(){},s.puts=function(){},s.debug=function(){},s.inspect=function(t,e,c,h){function u(t,c){if(t&&"function"==typeof t.inspect&&t!==s&&(!t.constructor||t.constructor.prototype!==t))return t.inspect(c);switch(typeof t){case"undefined":return b("undefined","undefined");case"string":var h="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return b(h,"string");case"number":return b(""+t,"number");case"boolean":return b(""+t,"boolean")}if(null===t)return b("null","null");var p=a(t),f=e?o(t):p;if("function"==typeof t&&0===f.length){if(i(t))return b(""+t,"regexp");var m=t.name?": "+t.name:"";return b("[Function"+m+"]","special")}if(n(t)&&0===f.length)return b(t.toUTCString(),"date");var d,y,v;if(r(t)?(y="Array",v=["[","]"]):(y="Object",v=["{","}"]),"function"==typeof t){var g=t.name?": "+t.name:"";d=i(t)?" "+t:" [Function"+g+"]"}else d="";if(n(t)&&(d=" "+t.toUTCString()),0===f.length)return v[0]+d+v[1];if(0>c)return i(t)?b(""+t,"regexp"):b("[Object]","special");l.push(t);var x=f.map(function(e){var s,i;if(t.__lookupGetter__&&(t.__lookupGetter__(e)?i=t.__lookupSetter__(e)?b("[Getter/Setter]","special"):b("[Getter]","special"):t.__lookupSetter__(e)&&(i=b("[Setter]","special"))),0>p.indexOf(e)&&(s="["+e+"]"),i||(0>l.indexOf(t[e])?(i=null===c?u(t[e]):u(t[e],c-1),i.indexOf("\n")>-1&&(i=r(t)?i.split("\n").map(function(t){return" "+t}).join("\n").substr(2):"\n"+i.split("\n").map(function(t){return" "+t}).join("\n"))):i=b("[Circular]","special")),s===void 0){if("Array"===y&&e.match(/^\d+$/))return i;s=JSON.stringify(""+e),s.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(s=s.substr(1,s.length-2),s=b(s,"name")):(s=s.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),s=b(s,"string"))}return s+": "+i});l.pop();var w=0,k=x.reduce(function(t,e){return w++,e.indexOf("\n")>=0&&w++,t+e.length+1},0);return x=k>50?v[0]+(""===d?"":d+"\n ")+" "+x.join(",\n ")+" "+v[1]:v[0]+d+" "+x.join(", ")+" "+v[1]}var l=[],b=function(t,e){var s={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},r={special:"cyan",number:"blue","boolean":"yellow",undefined:"grey","null":"bold",string:"green",date:"magenta",regexp:"red"}[e];return r?"["+s[r][0]+"m"+t+"["+s[r][1]+"m":t};return h||(b=function(t){return t}),u(t,c===void 0?2:c)},s.log=function(){},s.pump=null;var a=Object.keys||function(t){var e=[];for(var s in t)e.push(s);return e},o=Object.getOwnPropertyNames||function(t){var e=[];for(var s in t)Object.hasOwnProperty.call(t,s)&&e.push(s);return e},c=Object.create||function(t,e){var s;if(null===t)s={__proto__:null};else{if("object"!=typeof t)throw new TypeError("typeof prototype["+typeof t+"] != 'object'");var r=function(){};r.prototype=t,s=new r,s.__proto__=t}return e!==void 0&&Object.defineProperties&&Object.defineProperties(s,e),s};s.inherits=function(t,e){t.super_=e,t.prototype=c(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})};var h=/%[sdj%]/g;s.format=function(t){if("string"!=typeof t){for(var e=[],r=0;arguments.length>r;r++)e.push(s.inspect(arguments[r]));return e.join(" ")}for(var r=1,i=arguments,n=i.length,a=(t+"").replace(h,function(t){if("%%"===t)return"%";if(r>=n)return t;switch(t){case"%s":return i[r++]+"";case"%d":return Number(i[r++]);case"%j":return JSON.stringify(i[r++]);default:return t}}),o=i[r];n>r;o=i[++r])a+=null===o||"object"!=typeof o?" "+o:" "+s.inspect(o);return a}},{events:31}]},{},[]);var term=require("hypernal")();term.appendTo(document.body);var termEl=term.term.element;termEl.style.font="13px Monaco, mono",termEl.style.height="100%",termEl.style.padding="5px",termEl.style.overflow="auto",termEl.style["white-space"]="pre",term.write(data());
<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