Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@kirbysayshi
Created January 23, 2014 05:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kirbysayshi/8573607 to your computer and use it in GitHub Desktop.
Save kirbysayshi/8573607 to your computer and use it in GitHub Desktop.
requirebin sketch
require('tap-browser-color')();
var test = require('tape');
test('rAF Timestamp?', function(t) {
t.plan(1);
// Schedule this test to run hopefully once things are loaded
setTimeout(function() {
requestAnimationFrame(function(ts) {
var now = performance.now();
console.log('ts', ts, 'now', now);
var diff = now - ts;
t.ok(diff >= 0 && diff <= 1, 'ts should be ~now, difference was ' + diff);
t.end();
});
}, 500)
});
test('rAF background', function(t) {
t.plan(1);
console.log('PUT TAB IN BACKGROUND FOR THIS NEXT TEST TO PASS');
setTimeout(function() {
var start = performance.now();
requestAnimationFrame(function(ts) {
var now = performance.now();
var diff = now - start;
console.log('ts', ts, 'now', now, 'start', start);
t.ok(diff > 16, 'background tab should have delay greater than 16ms, was ' + diff);
t.end();
});
}, 3000)
});
require=function e(t,n,r){function i(s,a){if(!n[s]){if(!t[s]){var u="function"==typeof require&&require;if(!a&&u)return u(s,!0);if(o)return o(s,!0);throw Error("Cannot find module '"+s+"'")}var f=n[s]={exports:{}};t[s][0].call(f.exports,function(e){var n=t[s][1][e];return i(n?n:e)},f,f.exports,e,t,n,r)}return n[s].exports}for(var o="function"==typeof require&&require,s=0;r.length>s;s++)i(r[s]);return i}({GEX8S3:[function(e,t,n){function r(e){e||(e={});var t=i({autoclose:s(e.autoclose,!1)}),n=t.createStream(),r=n.pipe(a());l&&r.on("error",function(){t._exitCode=1});var u=!1;if(n.on("end",function(){u=!0}),e.exit===!1)return t;if(!l||!c)return t;var f;return o.on("uncaughtException",function(e){if(!e||"EPIPE"!==e.code||"EPIPE"!==e.errno||"write"!==e.syscall)throw f=e,e}),o.on("exit",function(e){if(!f){if(!u)for(var n=0;t._tests.length>n;n++){var r=t._tests[n];r._exit()}t.close(),o.exit(e||t._exitCode)}}),t}function i(e){e||(e={});var t=f();e.autoclose!==!1&&t.once("done",function(){t.close()});var n=function(e,r,i){var o=new u(e,r,i);return n._tests.push(o),function s(e){e.on("test",function(e){s(e)}),e.on("result",function(e){e.ok||(n._exitCode=1)})}(o),t.push(o),o};n._tests=[],n.createStream=function(){return t.createStream()};var r=!1;return n.only=function(e){if(r)throw Error("there can only be one only test");return t.only(e),r=!0,n.apply(null,arguments)},n._exitCode=0,n.close=function(){t.close()},n}var o=e("__browserify_process"),s=e("defined"),a=e("./lib/default_stream"),u=e("./lib/test"),f=e("./lib/results"),l=o!==void 0&&o&&"function"==typeof o.on,c=o!==void 0&&o&&"function"==typeof o.exit;"undefined"!=typeof setImmediate?setImmediate:o.nextTick,n=t.exports=function(){var e,t=function(){return e||(e=r({autoclose:!l})),e.apply(this,arguments)};return t.only=function(){return e||(e=r({autoclose:!l})),e.only.apply(this,arguments)},t}(),n.createHarness=i,n.Test=u,n.test=n},{"./lib/default_stream":3,"./lib/results":4,"./lib/test":5,__browserify_process:18,defined:9}],tape:[function(e,t){t.exports=e("GEX8S3")},{}],3:[function(e,t){var n=e("through");t.exports=function(){function e(e){for(var n=0;e.length>n;n++){var i="string"==typeof e?e.charAt(n):String.fromCharCode(e[n]);"\n"===i?t():r+=i}}function t(){try{console.log(r)}catch(e){i.emit("error",e)}r=""}var r="",i=n(e,t);return i}},{through:15}],4:[function(e,t){function n(){return this instanceof n?(this.count=0,this.fail=0,this.pass=0,this._stream=l(),this.tests=[],void 0):new n}function r(e,t){var n="";if(n+=(e.ok?"ok ":"not ok ")+t,n+=e.name?" "+(""+e.name).replace(/\s+/g," "):"",e.skip?n+=" # SKIP":e.todo&&(n+=" # TODO"),n+="\n",e.ok)return n;var r=" ",o=r+" ";n+=r+"---\n",n+=o+"operator: "+e.operator+"\n";var s=f.stringify(e.expected,i())||"",a=f.stringify(e.actual,i())||"";if(Math.max(s.length,a.length)>65?(n+=o+"expected:\n"+o+" "+s+"\n",n+=o+"actual:\n"+o+" "+a+"\n"):(n+=o+"expected: "+s+"\n",n+=o+"actual: "+a+"\n"),e.at&&(n+=o+"at: "+e.at+"\n"),"error"===e.operator&&e.actual&&e.actual.stack){var u=(e.actual.stack+"").split("\n");n+=o+"stack:\n",n+=o+" "+u[0]+"\n";for(var l=1;u.length>l;l++)n+=o+u[l]+"\n"}return n+=r+"...\n"}function i(){var e=[];return function(t,n){var r=n;if("object"==typeof n&&n){for(var i=!1,o=0;e.length>o;o++)if(e[o]===n){i=!0;break}i?r="[Circular]":e.push(n)}return r}}function o(e){if(!e._only)return e.tests.shift();do{var t=e.tests.shift();if(!t)return null;if(e._only===t.name)return t}while(0!==e.tests.length)}var s=e("__browserify_process");e("stream");var a=e("events").EventEmitter,u=e("inherits"),f="object"==typeof JSON?JSON:e("jsonify"),l=e("through"),c=e("resumer"),h="undefined"!=typeof setImmediate?setImmediate:s.nextTick;t.exports=n,u(n,a),n.prototype.createStream=function(){var e=this,t=c();return t.queue("TAP version 13\n"),h(function(){var t=o(e);t?t.run():e.emit("done")}),e._stream.pipe(t),t},n.prototype.push=function(e){var t=this;t.tests.push(e),t._watch(e),e.once("end",function(){var e=o(t);e?e.run():t.emit("done")})},n.prototype.only=function(e){this._only&&(self.count++,self.fail++,write("not ok "+self.count+" already called .only()\n")),this._only=e},n.prototype._watch=function(e){var t=this,n=function(e){t._stream.queue(e)};e.once("prerun",function(){n("# "+e.name+"\n")}),e.on("result",function(e){return"string"==typeof e?(n("# "+e+"\n"),void 0):(n(r(e,t.count+1)),t.count++,e.ok?t.pass++:t.fail++,void 0)}),e.on("test",function(e){t._watch(e)})},n.prototype.close=function(){var e=this;e.closed&&e._stream.emit("error",Error("ALREADY CLOSED")),e.closed=!0;var t=function(t){e._stream.queue(t)};t("\n1.."+e.count+"\n"),t("# tests "+e.count+"\n"),t("# pass "+e.pass+"\n"),e.fail?t("# fail "+e.fail+"\n"):t("\n# ok\n"),e._stream.queue(null)}},{__browserify_process:18,events:16,inherits:10,jsonify:11,resumer:14,stream:23,through:15}],5:[function(e,t){function n(){for(var e,t="(anonymous)",n={},r=0;arguments.length>r;r++)switch(typeof arguments[r]){case"string":t=arguments[r];break;case"object":n=arguments[r]||n;break;case"function":e=arguments[r]}this.readable=!0,this.name=t||"(anonymous)",this.assertCount=0,this.pendingCount=0,this._skip=n.skip||!1,this._plan=void 0,this._cb=e,this._progeny=[],this._ok=!0}var r=e("__browserify_process"),i="/lib";e("stream");var o=e("deep-equal"),s=e("defined"),a=e("path"),u=e("util").inherits,f=e("events").EventEmitter;t.exports=n;var l="undefined"!=typeof setImmediate?setImmediate:r.nextTick;u(n,f),n.prototype.run=function(){if(this._skip)return this.end();this.emit("prerun");try{this._cb(this)}catch(e){return this.error(e),this.end(),void 0}this.emit("run")},n.prototype.test=function(e,t,r){var i=this,o=new n(e,t,r);this._progeny.push(o),this.pendingCount++,this.emit("test",o),o.on("prerun",function(){i.assertCount++}),i._pendingAsserts()||l(function(){i.end()}),l(function(){i._plan||i.pendingCount!=i._progeny.length||i.end()})},n.prototype.comment=function(e){this.emit("result",e.trim().replace(/^#\s*/,""))},n.prototype.plan=function(e){this._plan=e,this.emit("plan",e)},n.prototype.end=function(){var e=this;if(this._progeny.length){var t=this._progeny.shift();return t.on("end",function(){e.end()}),t.run(),void 0}this.ended||this.emit("end");var n=this._pendingAsserts();!this._planError&&void 0!==this._plan&&n&&(this._planError=!0,this.fail("plan != count",{expected:this._plan,actual:this.assertCount})),this.ended=!0},n.prototype._exit=function(){void 0===this._plan||this._planError||this.assertCount===this._plan?this.ended||this.fail("test exited without ending",{exiting:!0}):(this._planError=!0,this.fail("plan != count",{expected:this._plan,actual:this.assertCount,exiting:!0}))},n.prototype._pendingAsserts=function(){return void 0===this._plan?1:this._plan-(this._progeny.length+this.assertCount)},n.prototype._assert=function(e,t){var n=this,r=t.extra||{},o={id:n.assertCount++,ok:Boolean(e),skip:s(r.skip,t.skip),name:s(r.message,t.message,"(unnamed assert)"),operator:s(r.operator,t.operator),actual:s(r.actual,t.actual),expected:s(r.expected,t.expected)};this._ok=Boolean(this._ok&&e),e||(o.error=s(r.error,t.error,Error(o.name)));for(var u=Error("exception"),f=(u.stack||"").split("\n"),c=a.dirname(i)+"/",h=0;f.length>h;h++){var p=/^\s*\bat\s+(.+)/.exec(f[h]);if(p){var d=p[1].split(/\s+/),g=/(\/[^:\s]+:(\d+)(?::(\d+))?)/.exec(d[1]);if((g||(g=/(\/[^:\s]+:(\d+)(?::(\d+))?)/.exec(d[3])))&&g[1].slice(0,c.length)!==c){o.functionName=d[0],o.file=g[1],o.line=Number(g[2]),g[3]&&(o.column=g[3]),o.at=p[1];break}}}n.emit("result",o);var y=n._pendingAsserts();y||(r.exiting?n.end():l(function(){n.end()})),!n._planError&&0>y&&(n._planError=!0,n.fail("plan != count",{expected:n._plan,actual:n._plan-y}))},n.prototype.fail=function(e,t){this._assert(!1,{message:e,operator:"fail",extra:t})},n.prototype.pass=function(e,t){this._assert(!0,{message:e,operator:"pass",extra:t})},n.prototype.skip=function(e,t){this._assert(!0,{message:e,operator:"skip",skip:!0,extra:t})},n.prototype.ok=n.prototype["true"]=n.prototype.assert=function(e,t,n){this._assert(e,{message:t,operator:"ok",expected:!0,actual:e,extra:n})},n.prototype.notOk=n.prototype["false"]=n.prototype.notok=function(e,t,n){this._assert(!e,{message:t,operator:"notOk",expected:!1,actual:e,extra:n})},n.prototype.error=n.prototype.ifError=n.prototype.ifErr=n.prototype.iferror=function(e,t,n){this._assert(!e,{message:s(t,e+""),operator:"error",actual:e,extra:n})},n.prototype.equal=n.prototype.equals=n.prototype.isEqual=n.prototype.is=n.prototype.strictEqual=n.prototype.strictEquals=function(e,t,n,r){this._assert(e===t,{message:s(n,"should be equal"),operator:"equal",actual:e,expected:t,extra:r})},n.prototype.notEqual=n.prototype.notEquals=n.prototype.notStrictEqual=n.prototype.notStrictEquals=n.prototype.isNotEqual=n.prototype.isNot=n.prototype.not=n.prototype.doesNotEqual=n.prototype.isInequal=function(e,t,n,r){this._assert(e!==t,{message:s(n,"should not be equal"),operator:"notEqual",actual:e,notExpected:t,extra:r})},n.prototype.deepEqual=n.prototype.deepEquals=n.prototype.isEquivalent=n.prototype.same=function(e,t,n,r){this._assert(o(e,t,{strict:!0}),{message:s(n,"should be equivalent"),operator:"deepEqual",actual:e,expected:t,extra:r})},n.prototype.deepLooseEqual=n.prototype.looseEqual=n.prototype.looseEquals=function(e,t,n,r){this._assert(o(e,t),{message:s(n,"should be equivalent"),operator:"deepLooseEqual",actual:e,expected:t,extra:r})},n.prototype.notDeepEqual=n.prototype.notEquivalent=n.prototype.notDeeply=n.prototype.notSame=n.prototype.isNotDeepEqual=n.prototype.isNotDeeply=n.prototype.isNotEquivalent=n.prototype.isInequivalent=function(e,t,n,r){this._assert(!o(e,t,{strict:!0}),{message:s(n,"should not be equivalent"),operator:"notDeepEqual",actual:e,notExpected:t,extra:r})},n.prototype.notDeepLooseEqual=n.prototype.notLooseEqual=n.prototype.notLooseEquals=function(e,t,n,r){this._assert(o(e,t),{message:s(n,"should be equivalent"),operator:"notDeepLooseEqual",actual:e,expected:t,extra:r})},n.prototype["throws"]=function(e,t,n,r){"string"==typeof t&&(n=t,t=void 0);var i=void 0;try{e()}catch(o){i={error:o};var a=o.message;delete o.message,o.message=a}var u=i;t instanceof RegExp&&(u=t.test(i&&i.error),t+=""),this._assert(u,{message:s(n,"should throw"),operator:"throws",actual:i&&i.error,expected:t,error:!u&&i&&i.error,extra:r})},n.prototype.doesNotThrow=function(e,t,n,r){"string"==typeof t&&(n=t,t=void 0);var i=void 0;try{e()}catch(o){i={error:o}}this._assert(!i,{message:s(n,"should throw"),operator:"throws",actual:i&&i.error,expected:t,error:i&&i.error,extra:r})}},{__browserify_process:18,"deep-equal":6,defined:9,events:16,path:21,stream:23,util:31}],6:[function(e,t){function n(e){return null===e||void 0===e}function r(e,t,r){if(n(e)||n(t))return!1;if(e.prototype!==t.prototype)return!1;if(s(e))return s(t)?(e=i.call(e),t=i.call(t),a(e,t,r)):!1;try{var u,f,l=o(e),c=o(t)}catch(h){return!1}if(l.length!=c.length)return!1;for(l.sort(),c.sort(),f=l.length-1;f>=0;f--)if(l[f]!=c[f])return!1;for(f=l.length-1;f>=0;f--)if(u=l[f],!a(e[u],t[u],r))return!1;return!0}var i=Array.prototype.slice,o=e("./lib/keys.js"),s=e("./lib/is_arguments.js"),a=t.exports=function(e,t,n){return n||(n={}),e===t?!0:e instanceof Date&&t instanceof Date?e.getTime()===t.getTime():"object"!=typeof e&&"object"!=typeof t?n.strict?e===t:e==t:r(e,t,n)}},{"./lib/is_arguments.js":7,"./lib/keys.js":8}],7:[function(e,t,n){function r(e){return"[object Arguments]"==Object.prototype.toString.call(e)}function i(e){return e&&"object"==typeof e&&"number"==typeof e.length&&Object.prototype.hasOwnProperty.call(e,"callee")&&!Object.prototype.propertyIsEnumerable.call(e,"callee")||!1}var o="[object Arguments]"==function(){return Object.prototype.toString.call(arguments)}();n=t.exports=o?r:i,n.supported=r,n.unsupported=i},{}],8:[function(e,t,n){function r(e){var t=[];for(var n in e)t.push(n);return t}n=t.exports="function"==typeof Object.keys?Object.keys:r,n.shim=r},{}],9:[function(e,t){t.exports=function(){for(var e=0;arguments.length>e;e++)if(void 0!==arguments[e])return arguments[e]}},{}],10:[function(e,t){t.exports="function"==typeof Object.create?function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:function(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}},{}],11:[function(e,t,n){n.parse=e("./lib/parse"),n.stringify=e("./lib/stringify")},{"./lib/parse":12,"./lib/stringify":13}],12:[function(e,t){var n,r,i,o,s={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:"\n",r:"\r",t:" "},a=function(e){throw{name:"SyntaxError",message:e,at:n,text:i}},u=function(e){return e&&e!==r&&a("Expected '"+e+"' instead of '"+r+"'"),r=i.charAt(n),n+=1,r},f=function(){var e,t="";for("-"===r&&(t="-",u("-"));r>="0"&&"9">=r;)t+=r,u();if("."===r)for(t+=".";u()&&r>="0"&&"9">=r;)t+=r;if("e"===r||"E"===r)for(t+=r,u(),("-"===r||"+"===r)&&(t+=r,u());r>="0"&&"9">=r;)t+=r,u();return e=+t,isFinite(e)?e:(a("Bad number"),void 0)},l=function(){var e,t,n,i="";if('"'===r)for(;u();){if('"'===r)return u(),i;if("\\"===r)if(u(),"u"===r){for(n=0,t=0;4>t&&(e=parseInt(u(),16),isFinite(e));t+=1)n=16*n+e;i+=String.fromCharCode(n)}else{if("string"!=typeof s[r])break;i+=s[r]}else i+=r}a("Bad string")},c=function(){for(;r&&" ">=r;)u()},h=function(){switch(r){case"t":return u("t"),u("r"),u("u"),u("e"),!0;case"f":return u("f"),u("a"),u("l"),u("s"),u("e"),!1;case"n":return u("n"),u("u"),u("l"),u("l"),null}a("Unexpected '"+r+"'")},p=function(){var e=[];if("["===r){if(u("["),c(),"]"===r)return u("]"),e;for(;r;){if(e.push(o()),c(),"]"===r)return u("]"),e;u(","),c()}}a("Bad array")},d=function(){var e,t={};if("{"===r){if(u("{"),c(),"}"===r)return u("}"),t;for(;r;){if(e=l(),c(),u(":"),Object.hasOwnProperty.call(t,e)&&a('Duplicate key "'+e+'"'),t[e]=o(),c(),"}"===r)return u("}"),t;u(","),c()}}a("Bad object")};o=function(){switch(c(),r){case"{":return d();case"[":return p();case'"':return l();case"-":return f();default:return r>="0"&&"9">=r?f():h()}},t.exports=function(e,t){var s;return i=e,n=0,r=" ",s=o(),c(),r&&a("Syntax error"),"function"==typeof t?function u(e,n){var r,i,o=e[n];if(o&&"object"==typeof o)for(r in o)Object.prototype.hasOwnProperty.call(o,r)&&(i=u(o,r),void 0!==i?o[r]=i:delete o[r]);return t.call(e,n,o)}({"":s},""):s}},{}],13:[function(e,t){function n(e){return a.lastIndex=0,a.test(e)?'"'+e.replace(a,function(e){var t=u[e];return"string"==typeof t?t:"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+e+'"'}function r(e,t){var a,u,f,l,c,h=i,p=t[e];switch(p&&"object"==typeof p&&"function"==typeof p.toJSON&&(p=p.toJSON(e)),"function"==typeof s&&(p=s.call(t,e,p)),typeof p){case"string":return n(p);case"number":return isFinite(p)?p+"":"null";case"boolean":case"null":return p+"";case"object":if(!p)return"null";if(i+=o,c=[],"[object Array]"===Object.prototype.toString.apply(p)){for(l=p.length,a=0;l>a;a+=1)c[a]=r(a,p)||"null";return f=0===c.length?"[]":i?"[\n"+i+c.join(",\n"+i)+"\n"+h+"]":"["+c.join(",")+"]",i=h,f}if(s&&"object"==typeof s)for(l=s.length,a=0;l>a;a+=1)u=s[a],"string"==typeof u&&(f=r(u,p),f&&c.push(n(u)+(i?": ":":")+f));else for(u in p)Object.prototype.hasOwnProperty.call(p,u)&&(f=r(u,p),f&&c.push(n(u)+(i?": ":":")+f));return f=0===c.length?"{}":i?"{\n"+i+c.join(",\n"+i)+"\n"+h+"}":"{"+c.join(",")+"}",i=h,f}}var i,o,s,a=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,u={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"};t.exports=function(e,t,n){var a;if(i="",o="","number"==typeof n)for(a=0;n>a;a+=1)o+=" ";else"string"==typeof n&&(o=n);if(s=t,t&&"function"!=typeof t&&("object"!=typeof t||"number"!=typeof t.length))throw Error("JSON.stringify");return r("",{"":e})}},{}],14:[function(e,t){var n=e("__browserify_process"),r=e("through"),i="undefined"!=typeof setImmediate?setImmediate:n.nextTick;t.exports=function(e,t){var n=r(e,t);n.pause();var o=n.resume,s=n.pause,a=!1;return n.pause=function(){return a=!0,s.apply(this,arguments)},n.resume=function(){return a=!1,o.apply(this,arguments)},i(function(){a||n.resume()}),n}},{__browserify_process:18,through:15}],15:[function(e,t,n){function r(e,t,n){function r(){for(;f.length&&!c.paused;){var e=f.shift();if(null===e)return c.emit("end");c.emit("data",e)}}function s(){c.writable=!1,t.call(c),!c.readable&&c.autoDestroy&&c.destroy()}e=e||function(e){this.queue(e)},t=t||function(){this.queue(null)};var a=!1,u=!1,f=[],l=!1,c=new o;return c.readable=c.writable=!0,c.paused=!1,c.autoDestroy=!(n&&n.autoDestroy===!1),c.write=function(t){return e.call(this,t),!c.paused},c.queue=c.push=function(e){return l?c:(null==e&&(l=!0),f.push(e),r(),c)},c.on("end",function(){c.readable=!1,!c.writable&&c.autoDestroy&&i.nextTick(function(){c.destroy()})}),c.end=function(e){return a?void 0:(a=!0,arguments.length&&c.write(e),s(),c)},c.destroy=function(){return u?void 0:(u=!0,a=!0,f.length=0,c.writable=c.readable=!1,c.emit("close"),c)},c.pause=function(){return c.paused?void 0:(c.paused=!0,c)},c.resume=function(){return c.paused&&(c.paused=!1,c.emit("resume")),r(),c.paused||c.emit("drain"),c},c}var i=e("__browserify_process"),o=e("stream");n=t.exports=r,r.through=r},{__browserify_process:18,stream:23}],16:[function(e,t,n){var r=e("__browserify_process");r.EventEmitter||(r.EventEmitter=function(){});var i=n.EventEmitter=r.EventEmitter,o="function"==typeof Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},s=10;i.prototype.setMaxListeners=function(e){this._events||(this._events={}),this._events.maxListeners=e},i.prototype.emit=function(e){if("error"===e&&(!this._events||!this._events.error||o(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 t=this._events[e];if(!t)return!1;if("function"==typeof t){switch(arguments.length){case 1:t.call(this);break;case 2:t.call(this,arguments[1]);break;case 3:t.call(this,arguments[1],arguments[2]);break;default:var n=Array.prototype.slice.call(arguments,1);t.apply(this,n)}return!0}if(o(t)){for(var n=Array.prototype.slice.call(arguments,1),r=t.slice(),i=0,s=r.length;s>i;i++)r[i].apply(this,n);return!0}return!1},i.prototype.addListener=function(e,t){if("function"!=typeof t)throw Error("addListener only takes instances of Function");if(this._events||(this._events={}),this.emit("newListener",e,t),this._events[e])if(o(this._events[e])){if(!this._events[e].warned){var n;n=void 0!==this._events.maxListeners?this._events.maxListeners:s,n&&n>0&&this._events[e].length>n&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),console.trace())}this._events[e].push(t)}else this._events[e]=[this._events[e],t];else this._events[e]=t;return this},i.prototype.on=i.prototype.addListener,i.prototype.once=function(e,t){var n=this;return n.on(e,function r(){n.removeListener(e,r),t.apply(this,arguments)}),this},i.prototype.removeListener=function(e,t){if("function"!=typeof t)throw Error("removeListener only takes instances of Function");if(!this._events||!this._events[e])return this;var n=this._events[e];if(o(n)){var r=n.indexOf(t);if(0>r)return this;n.splice(r,1),0==n.length&&delete this._events[e]}else this._events[e]===t&&delete this._events[e];return this},i.prototype.removeAllListeners=function(e){return e&&this._events&&this._events[e]&&(this._events[e]=null),this},i.prototype.listeners=function(e){return this._events||(this._events={}),this._events[e]||(this._events[e]=[]),o(this._events[e])||(this._events[e]=[this._events[e]]),this._events[e]}},{__browserify_process:18}],17:[function(e,t){t.exports=e(10)},{}],18:[function(e,t){var n=t.exports={};n.nextTick=function(){var e="undefined"!=typeof window&&window.setImmediate,t="undefined"!=typeof window&&window.postMessage&&window.addEventListener;if(e)return function(e){return window.setImmediate(e)};if(t){var n=[];return window.addEventListener("message",function(e){if(e.source===window&&"process-tick"===e.data&&(e.stopPropagation(),n.length>0)){var t=n.shift();t()}},!0),function(e){n.push(e),window.postMessage("process-tick","*")}}return function(e){setTimeout(e,0)}}(),n.title="browser",n.browser=!0,n.env={},n.argv=[],n.binding=function(){throw Error("process.binding is not supported")},n.cwd=function(){return"/"},n.chdir=function(){throw Error("process.chdir is not supported")}},{}],19:[function(e,t,n){function r(e,t){var n=typeof e;if("base64"===t&&"string"===n)for(e=ut(e);0!==e.length%4;)e+="=";var i;if("number"===n)i=pt(e);else if("string"===n)i=r.byteLength(e,t);else{if("object"!==n)throw Error("First argument needs to be a number, array or string.");i=pt(e.length)}var o=ct(new Uint8Array(i));if(r.isBuffer(e))o.set(e);else if(dt(e))for(var s=0;i>s;s++)o[s]=r.isBuffer(e)?e.readUInt8(s):e[s];else"string"===n&&o.write(e,0,t);return o}function i(e,t,n,i){n=Number(n)||0;var o=e.length-n;i?(i=Number(i),i>o&&(i=o)):i=o;var s=t.length;if(0!==s%2)throw Error("Invalid hex string");i>s/2&&(i=s/2);for(var a=0;i>a;a++){var u=parseInt(t.substr(2*a,2),16);if(isNaN(u))throw Error("Invalid hex string");e[n+a]=u}return r._charsWritten=2*a,a}function o(e,t,n,i){return r._charsWritten=bt(yt(t),e,n,i)}function s(e,t,n,i){return r._charsWritten=bt(vt(t),e,n,i)}function a(e,t,n,r){return s(e,t,n,r)}function u(e,t,n,i){return r._charsWritten=bt(mt(t),e,n,i)}function f(e,t,n,r){if(isFinite(t))isFinite(n)||(r=n,n=void 0);else{var f=r;r=t,t=n,n=f}t=Number(t)||0;var l=this.length-t;switch(n?(n=Number(n),n>l&&(n=l)):n=l,r=((r||"utf8")+"").toLowerCase()){case"hex":return i(this,e,t,n);case"utf8":case"utf-8":return o(this,e,t,n);case"ascii":return s(this,e,t,n);case"binary":return a(this,e,t,n);case"base64":return u(this,e,t,n);default:throw Error("Unknown encoding")}}function l(e,t,n){var r=this instanceof lt?this._proxy:this;if(e=((e||"utf8")+"").toLowerCase(),t=Number(t)||0,n=void 0!==n?Number(n):n=r.length,n===t)return"";switch(e){case"hex":return v(r,t,n);case"utf8":case"utf-8":return d(r,t,n);case"ascii":return g(r,t,n);case"binary":return y(r,t,n);case"base64":return p(r,t,n);default:throw Error("Unknown encoding")}}function c(){return{type:"Buffer",data:Array.prototype.slice.call(this,0)}}function h(e,t,n,r){var i=this;if(n||(n=0),r||0===r||(r=this.length),t||(t=0),r!==n&&0!==e.length&&0!==i.length){if(n>r)throw Error("sourceEnd < sourceStart");if(0>t||t>=e.length)throw Error("targetStart out of bounds");if(0>n||n>=i.length)throw Error("sourceStart out of bounds");if(0>r||r>i.length)throw Error("sourceEnd out of bounds");r>this.length&&(r=this.length),r-n>e.length-t&&(r=e.length-t+n);for(var o=0;r-n>o;o++)e[o+t]=this[o+n]}}function p(t,n,r){var i=t.slice(n,r);return e("base64-js").fromByteArray(i)}function d(e,t,n){for(var r=e.slice(t,n),i="",o="",s=0;r.length>s;)127>=r[s]?(i+=wt(o)+String.fromCharCode(r[s]),o=""):o+="%"+r[s].toString(16),s++;return i+wt(o)}function g(e,t,n){for(var r=e.slice(t,n),i="",o=0;r.length>o;o++)i+=String.fromCharCode(r[o]);return i}function y(e,t,n){return g(e,t,n)}function v(e,t,n){var r=e.length;(!t||0>t)&&(t=0),(!n||0>n||n>r)&&(n=r);for(var i="",o=t;n>o;o++)i+=gt(e[o]);return i}function m(e,t){var n=this.length;return e=ht(e,n,0),t=ht(t,n,n),ct(this.subarray(e,t))}function b(e,t){var n=this;return t||(St(void 0!==e&&null!==e,"missing offset"),St(n.length>e,"Trying to read beyond buffer length")),e>=n.length?void 0:n[e]}function w(e,t,n,r){r||(St("boolean"==typeof n,"missing or invalid endian"),St(void 0!==t&&null!==t,"missing offset"),St(e.length>t+1,"Trying to read beyond buffer length"));var i=e.length;if(!(t>=i)){if(t+1===i){var o=new DataView(new ArrayBuffer(2));return o.setUint8(0,e[i-1]),o.getUint16(0,n)}return e._dataview.getUint16(t,n)}}function _(e,t){return w(this,e,!0,t)}function E(e,t){return w(this,e,!1,t)}function x(e,t,n,r){r||(St("boolean"==typeof n,"missing or invalid endian"),St(void 0!==t&&null!==t,"missing offset"),St(e.length>t+3,"Trying to read beyond buffer length"));var i=e.length;if(!(t>=i)){if(t+3>=i){for(var o=new DataView(new ArrayBuffer(4)),s=0;i>s+t;s++)o.setUint8(s,e[s+t]);return o.getUint32(0,n)}return e._dataview.getUint32(t,n)}}function S(e,t){return x(this,e,!0,t)}function k(e,t){return x(this,e,!1,t)}function I(e,t){var n=this;return t||(St(void 0!==e&&null!==e,"missing offset"),St(n.length>e,"Trying to read beyond buffer length")),e>=n.length?void 0:n._dataview.getInt8(e)}function j(e,t,n,r){r||(St("boolean"==typeof n,"missing or invalid endian"),St(void 0!==t&&null!==t,"missing offset"),St(e.length>t+1,"Trying to read beyond buffer length"));var i=e.length;if(!(t>=i)){if(t+1===i){var o=new DataView(new ArrayBuffer(2));return o.setUint8(0,e[i-1]),o.getInt16(0,n)}return e._dataview.getInt16(t,n)}}function L(e,t){return j(this,e,!0,t)}function A(e,t){return j(this,e,!1,t)}function C(e,t,n,r){r||(St("boolean"==typeof n,"missing or invalid endian"),St(void 0!==t&&null!==t,"missing offset"),St(e.length>t+3,"Trying to read beyond buffer length"));var i=e.length;if(!(t>=i)){if(t+3>=i){for(var o=new DataView(new ArrayBuffer(4)),s=0;i>s+t;s++)o.setUint8(s,e[s+t]);return o.getInt32(0,n)}return e._dataview.getInt32(t,n)}}function B(e,t){return C(this,e,!0,t)}function O(e,t){return C(this,e,!1,t)}function T(e,t,n,r){return r||(St("boolean"==typeof n,"missing or invalid endian"),St(e.length>t+3,"Trying to read beyond buffer length")),e._dataview.getFloat32(t,n)}function M(e,t){return T(this,e,!0,t)}function D(e,t){return T(this,e,!1,t)}function U(e,t,n,r){return r||(St("boolean"==typeof n,"missing or invalid endian"),St(e.length>t+7,"Trying to read beyond buffer length")),e._dataview.getFloat64(t,n)}function q(e,t){return U(this,e,!0,t)}function R(e,t){return U(this,e,!1,t)}function N(e,t,n){var r=this;n||(St(void 0!==e&&null!==e,"missing value"),St(void 0!==t&&null!==t,"missing offset"),St(r.length>t,"trying to write beyond buffer length"),_t(e,255)),t>=r.length||(r[t]=e)}function F(e,t,n,r,i){i||(St(void 0!==t&&null!==t,"missing value"),St("boolean"==typeof r,"missing or invalid endian"),St(void 0!==n&&null!==n,"missing offset"),St(e.length>n+1,"trying to write beyond buffer length"),_t(t,65535));var o=e.length;if(!(n>=o))if(n+1===o){var s=new DataView(new ArrayBuffer(2));s.setUint16(0,t,r),e[n]=s.getUint8(0)}else e._dataview.setUint16(n,t,r)}function P(e,t,n){F(this,e,t,!0,n)}function z(e,t,n){F(this,e,t,!1,n)}function W(e,t,n,r,i){i||(St(void 0!==t&&null!==t,"missing value"),St("boolean"==typeof r,"missing or invalid endian"),St(void 0!==n&&null!==n,"missing offset"),St(e.length>n+3,"trying to write beyond buffer length"),_t(t,4294967295));var o=e.length;if(!(n>=o))if(n+3>=o){var s=new DataView(new ArrayBuffer(4));s.setUint32(0,t,r);for(var a=0;o>a+n;a++)e[a+n]=s.getUint8(a)}else e._dataview.setUint32(n,t,r)}function H(e,t,n){W(this,e,t,!0,n)}function J(e,t,n){W(this,e,t,!1,n)}function G(e,t,n){var r=this;n||(St(void 0!==e&&null!==e,"missing value"),St(void 0!==t&&null!==t,"missing offset"),St(r.length>t,"Trying to write beyond buffer length"),Et(e,127,-128)),t>=r.length||r._dataview.setInt8(t,e)}function V(e,t,n,r,i){i||(St(void 0!==t&&null!==t,"missing value"),St("boolean"==typeof r,"missing or invalid endian"),St(void 0!==n&&null!==n,"missing offset"),St(e.length>n+1,"Trying to write beyond buffer length"),Et(t,32767,-32768));var o=e.length;if(!(n>=o))if(n+1===o){var s=new DataView(new ArrayBuffer(2));s.setInt16(0,t,r),e[n]=s.getUint8(0)}else e._dataview.setInt16(n,t,r)}function $(e,t,n){V(this,e,t,!0,n)}function X(e,t,n){V(this,e,t,!1,n)}function Y(e,t,n,r,i){i||(St(void 0!==t&&null!==t,"missing value"),St("boolean"==typeof r,"missing or invalid endian"),St(void 0!==n&&null!==n,"missing offset"),St(e.length>n+3,"Trying to write beyond buffer length"),Et(t,2147483647,-2147483648));var o=e.length;if(!(n>=o))if(n+3>=o){var s=new DataView(new ArrayBuffer(4));s.setInt32(0,t,r);for(var a=0;o>a+n;a++)e[a+n]=s.getUint8(a)}else e._dataview.setInt32(n,t,r)}function K(e,t,n){Y(this,e,t,!0,n)}function Z(e,t,n){Y(this,e,t,!1,n)}function Q(e,t,n,r,i){i||(St(void 0!==t&&null!==t,"missing value"),St("boolean"==typeof r,"missing or invalid endian"),St(void 0!==n&&null!==n,"missing offset"),St(e.length>n+3,"Trying to write beyond buffer length"),xt(t,3.4028234663852886e38,-3.4028234663852886e38));var o=e.length;if(!(n>=o))if(n+3>=o){var s=new DataView(new ArrayBuffer(4));s.setFloat32(0,t,r);for(var a=0;o>a+n;a++)e[a+n]=s.getUint8(a)}else e._dataview.setFloat32(n,t,r)}function et(e,t,n){Q(this,e,t,!0,n)}function tt(e,t,n){Q(this,e,t,!1,n)}function nt(e,t,n,r,i){i||(St(void 0!==t&&null!==t,"missing value"),St("boolean"==typeof r,"missing or invalid endian"),St(void 0!==n&&null!==n,"missing offset"),St(e.length>n+7,"Trying to write beyond buffer length"),xt(t,1.7976931348623157e308,-1.7976931348623157e308));var o=e.length;if(!(n>=o))if(n+7>=o){var s=new DataView(new ArrayBuffer(8));s.setFloat64(0,t,r);for(var a=0;o>a+n;a++)e[a+n]=s.getUint8(a)}else e._dataview.setFloat64(n,t,r)}function rt(e,t,n){nt(this,e,t,!0,n)}function it(e,t,n){nt(this,e,t,!1,n)}function ot(e,t,n){if(e||(e=0),t||(t=0),n||(n=this.length),"string"==typeof e&&(e=e.charCodeAt(0)),"number"!=typeof e||isNaN(e))throw Error("value is not a number");if(t>n)throw Error("end < start");if(n!==t&&0!==this.length){if(0>t||t>=this.length)throw Error("start out of bounds");if(0>n||n>this.length)throw Error("end out of bounds");for(var r=t;n>r;r++)this[r]=e}}function st(){for(var e=[],t=this.length,r=0;t>r;r++)if(e[r]=gt(this[r]),r===n.INSPECT_MAX_BYTES){e[r+1]="...";break}return"<Buffer "+e.join(" ")+">"}function at(){return new r(this).buffer}function ut(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function ft(){var e=new Uint8Array(0);e.foo=function(){return 42};try{return 42===e.foo()}catch(t){return!1}}function lt(e){this._arr=e,0!==e.byteLength&&(this._dataview=new DataView(e.buffer,e.byteOffset,e.byteLength))}function ct(e){if(void 0===kt&&(kt=ft()),kt)return e.write=f,e.toString=l,e.toLocaleString=l,e.toJSON=c,e.copy=h,e.slice=m,e.readUInt8=b,e.readUInt16LE=_,e.readUInt16BE=E,e.readUInt32LE=S,e.readUInt32BE=k,e.readInt8=I,e.readInt16LE=L,e.readInt16BE=A,e.readInt32LE=B,e.readInt32BE=O,e.readFloatLE=M,e.readFloatBE=D,e.readDoubleLE=q,e.readDoubleBE=R,e.writeUInt8=N,e.writeUInt16LE=P,e.writeUInt16BE=z,e.writeUInt32LE=H,e.writeUInt32BE=J,e.writeInt8=G,e.writeInt16LE=$,e.writeInt16BE=X,e.writeInt32LE=K,e.writeInt32BE=Z,e.writeFloatLE=et,e.writeFloatBE=tt,e.writeDoubleLE=rt,e.writeDoubleBE=it,e.fill=ot,e.inspect=st,e.toArrayBuffer=at,e._isBuffer=!0,0!==e.byteLength&&(e._dataview=new DataView(e.buffer,e.byteOffset,e.byteLength)),e;var t=new lt(e),n=new Proxy(t,It);return t._proxy=n,n}function ht(e,t,n){return"number"!=typeof e?n:(e=~~e,e>=t?t:e>=0?e:(e+=t,e>=0?e:0))}function pt(e){return e=~~Math.ceil(+e),0>e?0:e}function dt(e){return Array.isArray(e)||r.isBuffer(e)||e&&"object"==typeof e&&"number"==typeof e.length}function gt(e){return 16>e?"0"+e.toString(16):e.toString(16)}function yt(e){for(var t=[],n=0;e.length>n;n++)if(127>=e.charCodeAt(n))t.push(e.charCodeAt(n));else for(var r=encodeURIComponent(e.charAt(n)).substr(1).split("%"),i=0;r.length>i;i++)t.push(parseInt(r[i],16));return t}function vt(e){for(var t=[],n=0;e.length>n;n++)t.push(255&e.charCodeAt(n));return t}function mt(t){return e("base64-js").toByteArray(t)}function bt(e,t,n,r){for(var i=0;r>i&&!(i+n>=t.length||i>=e.length);)t[i+n]=e[i],i++;return i}function wt(e){try{return decodeURIComponent(e)}catch(t){return String.fromCharCode(65533)}}function _t(e,t){St("number"==typeof e,"cannot write a non-number as a number"),St(e>=0,"specified a negative value for writing an unsigned value"),St(t>=e,"value is larger than maximum value for type"),St(Math.floor(e)===e,"value has a fractional component")}function Et(e,t,n){St("number"==typeof e,"cannot write a non-number as a number"),St(t>=e,"value larger than maximum allowed value"),St(e>=n,"value smaller than minimum allowed value"),St(Math.floor(e)===e,"value has a fractional component")
}function xt(e,t,n){St("number"==typeof e,"cannot write a non-number as a number"),St(t>=e,"value larger than maximum allowed value"),St(e>=n,"value smaller than minimum allowed value")}function St(e,t){if(!e)throw Error(t||"Failed assertion")}n.Buffer=r,n.SlowBuffer=r,n.INSPECT_MAX_BYTES=50,r.poolSize=8192;var kt;r.isEncoding=function(e){switch((e+"").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}},r.isBuffer=function(e){return e&&e._isBuffer},r.byteLength=function(e,t){switch(t||"utf8"){case"hex":return e.length/2;case"utf8":case"utf-8":return yt(e).length;case"ascii":case"binary":return e.length;case"base64":return mt(e).length;default:throw Error("Unknown encoding")}},r.concat=function(e,t){if(!Array.isArray(e))throw Error("Usage: Buffer.concat(list, [totalLength])\nlist should be an Array.");var n,i;if(0===e.length)return new r(0);if(1===e.length)return e[0];if("number"!=typeof t)for(t=0,n=0;e.length>n;n++)i=e[n],t+=i.length;var o=new r(t),s=0;for(n=0;e.length>n;n++)i=e[n],i.copy(o,s),s+=i.length;return o},lt.prototype.write=f,lt.prototype.toString=l,lt.prototype.toLocaleString=l,lt.prototype.toJSON=c,lt.prototype.copy=h,lt.prototype.slice=m,lt.prototype.readUInt8=b,lt.prototype.readUInt16LE=_,lt.prototype.readUInt16BE=E,lt.prototype.readUInt32LE=S,lt.prototype.readUInt32BE=k,lt.prototype.readInt8=I,lt.prototype.readInt16LE=L,lt.prototype.readInt16BE=A,lt.prototype.readInt32LE=B,lt.prototype.readInt32BE=O,lt.prototype.readFloatLE=M,lt.prototype.readFloatBE=D,lt.prototype.readDoubleLE=q,lt.prototype.readDoubleBE=R,lt.prototype.writeUInt8=N,lt.prototype.writeUInt16LE=P,lt.prototype.writeUInt16BE=z,lt.prototype.writeUInt32LE=H,lt.prototype.writeUInt32BE=J,lt.prototype.writeInt8=G,lt.prototype.writeInt16LE=$,lt.prototype.writeInt16BE=X,lt.prototype.writeInt32LE=K,lt.prototype.writeInt32BE=Z,lt.prototype.writeFloatLE=et,lt.prototype.writeFloatBE=tt,lt.prototype.writeDoubleLE=rt,lt.prototype.writeDoubleBE=it,lt.prototype.fill=ot,lt.prototype.inspect=st,lt.prototype.toArrayBuffer=at,lt.prototype._isBuffer=!0,lt.prototype.subarray=function(){return this._arr.subarray.apply(this._arr,arguments)},lt.prototype.set=function(){return this._arr.set.apply(this._arr,arguments)};var It={get:function(e,t){return t in e?e[t]:e._arr[t]},set:function(e,t,n){e._arr[t]=n}}},{"base64-js":20}],20:[function(e,t){(function(){"use strict";function e(e){var t,n,i,o,s,a;if(e.length%4>0)throw"Invalid string. Length must be a multiple of 4";for(s=e.indexOf("="),s=s>0?e.length-s:0,a=[],i=s>0?e.length-4:e.length,t=0,n=0;i>t;t+=4,n+=3)o=r.indexOf(e[t])<<18|r.indexOf(e[t+1])<<12|r.indexOf(e[t+2])<<6|r.indexOf(e[t+3]),a.push((16711680&o)>>16),a.push((65280&o)>>8),a.push(255&o);return 2===s?(o=r.indexOf(e[t])<<2|r.indexOf(e[t+1])>>4,a.push(255&o)):1===s&&(o=r.indexOf(e[t])<<10|r.indexOf(e[t+1])<<4|r.indexOf(e[t+2])>>2,a.push(255&o>>8),a.push(255&o)),a}function n(e){function t(e){return r[63&e>>18]+r[63&e>>12]+r[63&e>>6]+r[63&e]}var n,i,o,s=e.length%3,a="";for(n=0,o=e.length-s;o>n;n+=3)i=(e[n]<<16)+(e[n+1]<<8)+e[n+2],a+=t(i);switch(s){case 1:i=e[e.length-1],a+=r[i>>2],a+=r[63&i<<4],a+="==";break;case 2:i=(e[e.length-2]<<8)+e[e.length-1],a+=r[i>>10],a+=r[63&i>>4],a+=r[63&i<<2],a+="="}return a}var r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";t.exports.toByteArray=e,t.exports.fromByteArray=n})()},{}],21:[function(e,t,n){function r(e,t){for(var n=0,r=e.length-1;r>=0;r--){var i=e[r];"."===i?e.splice(r,1):".."===i?(e.splice(r,1),n++):n&&(e.splice(r,1),n--)}if(t)for(;n--;n)e.unshift("..");return e}function i(e,t){if(e.filter)return e.filter(t);for(var n=[],r=0;e.length>r;r++)t(e[r],r,e)&&n.push(e[r]);return n}var o=e("__browserify_process"),s=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/,a=function(e){return s.exec(e).slice(1)};n.resolve=function(){for(var e="",t=!1,n=arguments.length-1;n>=-1&&!t;n--){var s=n>=0?arguments[n]:o.cwd();if("string"!=typeof s)throw new TypeError("Arguments to path.resolve must be strings");s&&(e=s+"/"+e,t="/"===s.charAt(0))}return e=r(i(e.split("/"),function(e){return!!e}),!t).join("/"),(t?"/":"")+e||"."},n.normalize=function(e){var t=n.isAbsolute(e),o="/"===u(e,-1);return e=r(i(e.split("/"),function(e){return!!e}),!t).join("/"),e||t||(e="."),e&&o&&(e+="/"),(t?"/":"")+e},n.isAbsolute=function(e){return"/"===e.charAt(0)},n.join=function(){var e=Array.prototype.slice.call(arguments,0);return n.normalize(i(e,function(e){if("string"!=typeof e)throw new TypeError("Arguments to path.join must be strings");return e}).join("/"))},n.relative=function(e,t){function r(e){for(var t=0;e.length>t&&""===e[t];t++);for(var n=e.length-1;n>=0&&""===e[n];n--);return t>n?[]:e.slice(t,n-t+1)}e=n.resolve(e).substr(1),t=n.resolve(t).substr(1);for(var i=r(e.split("/")),o=r(t.split("/")),s=Math.min(i.length,o.length),a=s,u=0;s>u;u++)if(i[u]!==o[u]){a=u;break}for(var f=[],u=a;i.length>u;u++)f.push("..");return f=f.concat(o.slice(a)),f.join("/")},n.sep="/",n.delimiter=":",n.dirname=function(e){var t=a(e),n=t[0],r=t[1];return n||r?(r&&(r=r.substr(0,r.length-1)),n+r):"."},n.basename=function(e,t){var n=a(e)[2];return t&&n.substr(-1*t.length)===t&&(n=n.substr(0,n.length-t.length)),n},n.extname=function(e){return a(e)[3]};var u="b"==="ab".substr(-1)?function(e,t,n){return e.substr(t,n)}:function(e,t,n){return 0>t&&(t=e.length+t),e.substr(t,n)}},{__browserify_process:18}],22:[function(e,t){function n(e){return this instanceof n?(s.call(this,e),a.call(this,e),e&&e.readable===!1&&(this.readable=!1),e&&e.writable===!1&&(this.writable=!1),this.allowHalfOpen=!0,e&&e.allowHalfOpen===!1&&(this.allowHalfOpen=!1),this.once("end",r),void 0):new n(e)}function r(){if(!this.allowHalfOpen&&!this._writableState.ended){var e=this;o(function(){e.end()})}}t.exports=n;var i=e("inherits"),o=e("setimmediate"),s=e("./readable.js"),a=e("./writable.js");i(n,s),n.prototype.pipe=a.prototype.pipe,n.prototype.write=a.prototype.write,n.prototype.end=a.prototype.end,n.prototype._write=a.prototype._write},{"./readable.js":26,"./writable.js":28,inherits:17,setimmediate:24}],23:[function(e,t){function n(){r.call(this)}t.exports=n;var r=e("events").EventEmitter,i=e("inherits");i(n,r),n.Readable=e("./readable.js"),n.Writable=e("./writable.js"),n.Duplex=e("./duplex.js"),n.Transform=e("./transform.js"),n.PassThrough=e("./passthrough.js"),n.Stream=n,n.prototype.pipe=function(e,t){function n(t){e.writable&&!1===e.write(t)&&f.pause&&f.pause()}function i(){f.readable&&f.resume&&f.resume()}function o(){l||(l=!0,e.end())}function s(){l||(l=!0,"function"==typeof e.destroy&&e.destroy())}function a(e){if(u(),0===r.listenerCount(this,"error"))throw e}function u(){f.removeListener("data",n),e.removeListener("drain",i),f.removeListener("end",o),f.removeListener("close",s),f.removeListener("error",a),e.removeListener("error",a),f.removeListener("end",u),f.removeListener("close",u),e.removeListener("close",u)}var f=this;f.on("data",n),e.on("drain",i),e._isStdio||t&&t.end===!1||(f.on("end",o),f.on("close",s));var l=!1;return f.on("error",a),e.on("error",a),f.on("end",u),f.on("close",u),e.on("close",u),e.emit("pipe",f),e}},{"./duplex.js":22,"./passthrough.js":25,"./readable.js":26,"./transform.js":27,"./writable.js":28,events:16,inherits:17}],24:[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 e=!0,t=global.onmessage;return global.onmessage=function(){e=!1},global.postMessage("","*"),global.onmessage=t,e}function canUseReadyStateChange(){return"document"in global&&"onreadystatechange"in global.document.createElement("script")}function installNextTickImplementation(e){e.setImmediate=function(){var e=tasks.addFromSetImmediateArguments(arguments);return process.nextTick(function(){tasks.runIfPresent(e)}),e}}function installMessageChannelImplementation(e){var t=new global.MessageChannel;t.port1.onmessage=function(e){var t=e.data;tasks.runIfPresent(t)},e.setImmediate=function(){var e=tasks.addFromSetImmediateArguments(arguments);return t.port2.postMessage(e),e}}function installPostMessageImplementation(e){function t(e,t){return"string"==typeof e&&e.substring(0,t.length)===t}function n(e){if(e.source===global&&t(e.data,r)){var n=e.data.substring(r.length);tasks.runIfPresent(n)}}var r="com.bn.NobleJS.setImmediate"+Math.random();global.addEventListener?global.addEventListener("message",n,!1):global.attachEvent("onmessage",n),e.setImmediate=function(){var e=tasks.addFromSetImmediateArguments(arguments);return global.postMessage(r+e,"*"),e}}function installReadyStateChangeImplementation(e){e.setImmediate=function(){var e=tasks.addFromSetImmediateArguments(arguments),t=global.document.createElement("script");return t.onreadystatechange=function(){tasks.runIfPresent(e),t.onreadystatechange=null,t.parentNode.removeChild(t),t=null},global.document.documentElement.appendChild(t),e}}function installSetTimeoutImplementation(e){e.setImmediate=function(){var e=tasks.addFromSetImmediateArguments(arguments);return global.setTimeout(function(){tasks.runIfPresent(e)},0),e}}var tasks=function(){function Task(e,t){this.handler=e,this.args=t}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(e){var t=e[0],n=Array.prototype.slice.call(e,1),r=new Task(t,n),i=nextHandle++;return tasksByHandle[i]=r,i},runIfPresent:function(e){if(currentlyRunningATask)global.setTimeout(function(){tasks.runIfPresent(e)},0);else{var t=tasksByHandle[e];if(t){currentlyRunningATask=!0;try{t.run()}finally{delete tasksByHandle[e],currentlyRunningATask=!1}}}},remove:function(e){delete tasksByHandle[e]}}}();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:18}],25:[function(e,t){function n(e){return this instanceof n?(r.call(this,e),void 0):new n(e)}t.exports=n;var r=e("./transform.js"),i=e("inherits");i(n,r),n.prototype._transform=function(e,t,n){n(null,e)}},{"./transform.js":27,inherits:17}],26:[function(e,t){function n(t){t=t||{};var n=t.highWaterMark;this.highWaterMark=n||0===n?n: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=!!t.objectMode,this.defaultEncoding=t.defaultEncoding||"utf8",this.ranOut=!1,this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(x||(x=e("string_decoder").StringDecoder),this.decoder=new x(t.encoding),this.encoding=t.encoding)}function r(e){return this instanceof r?(this._readableState=new n(e,this),this.readable=!0,k.call(this),void 0):new r(e)}function i(e,t,n,r,i){var s=u(t,n);if(s)e.emit("error",s);else if(null===n||void 0===n)t.reading=!1,t.ended||f(e,t);else if(t.objectMode||n&&n.length>0)if(t.ended&&!i){var a=Error("stream.push() after EOF");e.emit("error",a)}else if(t.endEmitted&&i){var a=Error("stream.unshift() after end event");e.emit("error",a)}else!t.decoder||i||r||(n=t.decoder.write(n)),t.length+=t.objectMode?1:n.length,i?t.buffer.unshift(n):(t.reading=!1,t.buffer.push(n)),t.needReadable&&l(e),h(e,t);else i||(t.reading=!1);return o(t)}function o(e){return!e.ended&&(e.needReadable||e.length<e.highWaterMark||0===e.length)}function s(e){if(e>=A)e=A;else{e--;for(var t=1;32>t;t<<=1)e|=e>>t;e++}return e}function a(e,t){return 0===t.length&&t.ended?0:t.objectMode?0===e?0:1:isNaN(e)||null===e?t.flowing&&t.buffer.length?t.buffer[0].length:t.length:0>=e?0:(e>t.highWaterMark&&(t.highWaterMark=s(e)),e>t.length?t.ended?t.length:(t.needReadable=!0,0):e)}function u(e,t){var n=null;return I.isBuffer(t)||"string"==typeof t||null===t||void 0===t||e.objectMode||n||(n=new TypeError("Invalid non-string/buffer chunk")),n}function f(e,t){if(t.decoder&&!t.ended){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,t.length>0?l(e):b(e)}function l(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,t.sync?j(function(){c(e)}):c(e))}function c(e){e.emit("readable")}function h(e,t){t.readingMore||(t.readingMore=!0,j(function(){p(e,t)}))}function p(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length<t.highWaterMark&&(e.read(0),n!==t.length);)n=t.length;t.readingMore=!1}function d(e){return function(){var t=e._readableState;t.awaitDrain--,0===t.awaitDrain&&g(e)}}function g(e){function t(e){var t=e.write(n);!1===t&&r.awaitDrain++}var n,r=e._readableState;for(r.awaitDrain=0;r.pipesCount&&null!==(n=e.read());)if(1===r.pipesCount?t(r.pipes,0,null):w(r.pipes,t),e.emit("data",n),r.awaitDrain>0)return;return 0===r.pipesCount?(r.flowing=!1,S.listenerCount(e,"data")>0&&v(e),void 0):(r.ranOut=!0,void 0)}function y(){this._readableState.ranOut&&(this._readableState.ranOut=!1,g(this))}function v(e,t){var n=e._readableState;if(n.flowing)throw Error("Cannot switch to old mode now.");var r=t||!1,i=!1;e.readable=!0,e.pipe=k.prototype.pipe,e.on=e.addListener=k.prototype.on,e.on("readable",function(){i=!0;for(var t;!r&&null!==(t=e.read());)e.emit("data",t);null===t&&(i=!1,e._readableState.needReadable=!0)}),e.pause=function(){r=!0,this.emit("pause")},e.resume=function(){r=!1,i?j(function(){e.emit("readable")}):this.read(0),this.emit("resume")},e.emit("readable")}function m(e,t){var n,r=t.buffer,i=t.length,o=!!t.decoder,s=!!t.objectMode;if(0===r.length)return null;if(0===i)n=null;else if(s)n=r.shift();else if(!e||e>=i)n=o?r.join(""):I.concat(r,i),r.length=0;else if(r[0].length>e){var a=r[0];n=a.slice(0,e),r[0]=a.slice(e)}else if(e===r[0].length)n=r.shift();else{n=o?"":new I(e);for(var u=0,f=0,l=r.length;l>f&&e>u;f++){var a=r[0],c=Math.min(e-u,a.length);o?n+=a.slice(0,c):a.copy(n,u,0,c),a.length>c?r[0]=a.slice(c):r.shift(),u+=c}}return n}function b(e){var t=e._readableState;if(t.length>0)throw Error("endReadable called on non-empty stream");!t.endEmitted&&t.calledRead&&(t.ended=!0,j(function(){t.endEmitted||0!==t.length||(t.endEmitted=!0,e.readable=!1,e.emit("end"))}))}function w(e,t){for(var n=0,r=e.length;r>n;n++)t(e[n],n)}function _(e,t){for(var n=0,r=e.length;r>n;n++)if(e[n]===t)return n;return-1}var E=e("__browserify_process");t.exports=r,r.ReadableState=n;var x,S=e("events").EventEmitter,k=e("./index.js"),I=e("buffer").Buffer,j=e("setimmediate"),L=e("inherits");L(r,k),r.prototype.push=function(e,t){var n=this._readableState;return"string"!=typeof e||n.objectMode||(t=t||n.defaultEncoding,t!==n.encoding&&(e=new I(e,t),t="")),i(this,n,e,t,!1)},r.prototype.unshift=function(e){var t=this._readableState;return i(this,t,e,"",!0)},r.prototype.setEncoding=function(t){x||(x=e("string_decoder").StringDecoder),this._readableState.decoder=new x(t),this._readableState.encoding=t};var A=8388608;r.prototype.read=function(e){var t=this._readableState;t.calledRead=!0;var n=e;if(("number"!=typeof e||e>0)&&(t.emittedReadable=!1),0===e&&t.needReadable&&(t.length>=t.highWaterMark||t.ended))return l(this),null;if(e=a(e,t),0===e&&t.ended)return 0===t.length&&b(this),null;var r=t.needReadable;t.length-e<=t.highWaterMark&&(r=!0),(t.ended||t.reading)&&(r=!1),r&&(t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1),r&&!t.reading&&(e=a(n,t));var i;return i=e>0?m(e,t):null,null===i&&(t.needReadable=!0,e=0),t.length-=e,0!==t.length||t.ended||(t.needReadable=!0),t.ended&&!t.endEmitted&&0===t.length&&b(this),i},r.prototype._read=function(){this.emit("error",Error("not implemented"))},r.prototype.pipe=function(e,t){function n(e){e===f&&i()}function r(){e.end()}function i(){e.removeListener("close",s),e.removeListener("finish",a),e.removeListener("drain",p),e.removeListener("error",o),e.removeListener("unpipe",n),f.removeListener("end",r),f.removeListener("end",i),(!e._writableState||e._writableState.needDrain)&&p()}function o(t){u(),0===v&&0===S.listenerCount(e,"error")&&e.emit("error",t)}function s(){e.removeListener("finish",a),u()}function a(){e.removeListener("close",s),u()}function u(){f.unpipe(e)}var f=this,l=this._readableState;switch(l.pipesCount){case 0:l.pipes=e;break;case 1:l.pipes=[l.pipes,e];break;default:l.pipes.push(e)}l.pipesCount+=1;var c=(!t||t.end!==!1)&&e!==E.stdout&&e!==E.stderr,h=c?r:i;l.endEmitted?j(h):f.once("end",h),e.on("unpipe",n);var p=d(f);e.on("drain",p);var v=S.listenerCount(e,"error");return e.once("error",o),e.once("close",s),e.once("finish",a),e.emit("pipe",f),l.flowing||(this.on("readable",y),l.flowing=!0,j(function(){g(f)})),e},r.prototype.unpipe=function(e){var t=this._readableState;if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,this.removeListener("readable",y),t.flowing=!1,e&&e.emit("unpipe",this),this);if(!e){var n=t.pipes,r=t.pipesCount;t.pipes=null,t.pipesCount=0,this.removeListener("readable",y),t.flowing=!1;for(var i=0;r>i;i++)n[i].emit("unpipe",this);return this}var i=_(t.pipes,e);return-1===i?this:(t.pipes.splice(i,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this),this)},r.prototype.on=function(e,t){var n=k.prototype.on.call(this,e,t);if("data"!==e||this._readableState.flowing||v(this),"readable"===e&&this.readable){var r=this._readableState;r.readableListening||(r.readableListening=!0,r.emittedReadable=!1,r.needReadable=!0,r.reading?r.length&&l(this,r):this.read(0))}return n},r.prototype.addListener=r.prototype.on,r.prototype.resume=function(){v(this),this.read(0),this.emit("resume")},r.prototype.pause=function(){v(this,!0),this.emit("pause")},r.prototype.wrap=function(e){var t=this._readableState,n=!1,r=this;e.on("end",function(){if(t.decoder&&!t.ended){var e=t.decoder.end();e&&e.length&&r.push(e)}r.push(null)}),e.on("data",function(i){if(t.decoder&&(i=t.decoder.write(i)),i&&(t.objectMode||i.length)){var o=r.push(i);o||(n=!0,e.pause())}});for(var i in e)"function"==typeof e[i]&&this[i]===void 0&&(this[i]=function(t){return function(){return e[t].apply(e,arguments)}}(i));var o=["error","close","destroy","pause","resume"];return w(o,function(t){e.on(t,function(e){return r.emit.apply(r,t,e)})}),r._read=function(){n&&(n=!1,e.resume())},r},r._fromList=m},{"./index.js":23,__browserify_process:18,buffer:19,events:16,inherits:17,setimmediate:24,string_decoder:29}],27:[function(e,t){function n(e,t){this.afterTransform=function(e,n){return r(t,e,n)},this.needTransform=!1,this.transforming=!1,this.writecb=null,this.writechunk=null}function r(e,t,n){var r=e._transformState;r.transforming=!1;var i=r.writecb;if(!i)return e.emit("error",Error("no writecb in Transform class"));r.writechunk=null,r.writecb=null,null!==n&&void 0!==n&&e.push(n),i&&i(t);var o=e._readableState;o.reading=!1,(o.needReadable||o.length<o.highWaterMark)&&e._read(o.highWaterMark)}function i(e){if(!(this instanceof i))return new i(e);s.call(this,e),this._transformState=new n(e,this);var t=this;this._readableState.needReadable=!0,this._readableState.sync=!1,this.once("finish",function(){"function"==typeof this._flush?this._flush(function(e){o(t,e)}):o(t)})}function o(e,t){if(t)return e.emit("error",t);var n=e._writableState;e._readableState;var r=e._transformState;if(n.length)throw Error("calling transform done when ws.length != 0");if(r.transforming)throw Error("calling transform done when still transforming");return e.push(null)}t.exports=i;var s=e("./duplex.js"),a=e("inherits");a(i,s),i.prototype.push=function(e,t){return this._transformState.needTransform=!1,s.prototype.push.call(this,e,t)},i.prototype._transform=function(){throw Error("not implemented")},i.prototype._write=function(e,t,n){var r=this._transformState;if(r.writecb=n,r.writechunk=e,r.writeencoding=t,!r.transforming){var i=this._readableState;(r.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},i.prototype._read=function(){var e=this._transformState;e.writechunk&&e.writecb&&!e.transforming?(e.transforming=!0,this._transform(e.writechunk,e.writeencoding,e.afterTransform)):e.needTransform=!0}},{"./duplex.js":22,inherits:17}],28:[function(e,t){function n(e,t,n){this.chunk=e,this.encoding=t,this.callback=n}function r(e,t){e=e||{};var n=e.highWaterMark;this.highWaterMark=n||0===n?n:16384,this.objectMode=!!e.objectMode,this.highWaterMark=~~this.highWaterMark,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1;var r=e.decodeStrings===!1;this.decodeStrings=!r,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){h(t,e)},this.writecb=null,this.writelen=0,this.buffer=[]}function i(e){return this instanceof i||this instanceof w.Duplex?(this._writableState=new r(e,this),this.writable=!0,w.call(this),void 0):new i(e)}function o(e,t,n){var r=Error("write after end");e.emit("error",r),_(function(){n(r)})}function s(e,t,n,r){var i=!0;if(!E.isBuffer(n)&&"string"!=typeof n&&null!==n&&void 0!==n&&!t.objectMode){var o=new TypeError("Invalid non-string/buffer chunk");e.emit("error",o),_(function(){r(o)}),i=!1}return i}function a(e,t,n){return e.objectMode||e.decodeStrings===!1||"string"!=typeof t||(t=new E(t,n)),t}function u(e,t,r,i,o){r=a(t,r,i);var s=t.objectMode?1:r.length;t.length+=s;var u=t.length<t.highWaterMark;return t.needDrain=!u,t.writing?t.buffer.push(new n(r,i,o)):f(e,t,s,r,i,o),u}function f(e,t,n,r,i,o){t.writelen=n,t.writecb=o,t.writing=!0,t.sync=!0,e._write(r,i,t.onwrite),t.sync=!1}function l(e,t,n,r,i){n?_(function(){i(r)}):i(r),e.emit("error",r)}function c(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}function h(e,t){var n=e._writableState,r=n.sync,i=n.writecb;if(c(n),t)l(e,n,r,t,i);else{var o=y(e,n);o||n.bufferProcessing||!n.buffer.length||g(e,n),r?_(function(){p(e,n,o,i)}):p(e,n,o,i)}}function p(e,t,n,r){n||d(e,t),r(),n&&v(e,t)}function d(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}function g(e,t){t.bufferProcessing=!0;for(var n=0;t.buffer.length>n;n++){var r=t.buffer[n],i=r.chunk,o=r.encoding,s=r.callback,a=t.objectMode?1:i.length;if(f(e,t,a,i,o,s),t.writing){n++;break}}t.bufferProcessing=!1,t.buffer.length>n?t.buffer=t.buffer.slice(n):t.buffer.length=0}function y(e,t){return t.ending&&0===t.length&&!t.finished&&!t.writing}function v(e,t){var n=y(e,t);return n&&(t.finished=!0,e.emit("finish")),n}function m(e,t,n){t.ending=!0,v(e,t),n&&(t.finished?_(n):e.once("finish",n)),t.ended=!0}t.exports=i,i.WritableState=r;var b=e("inherits"),w=e("./index.js"),_=e("setimmediate"),E=e("buffer").Buffer;b(i,w),i.prototype.pipe=function(){this.emit("error",Error("Cannot pipe. Not readable."))},i.prototype.write=function(e,t,n){var r=this._writableState,i=!1;return"function"==typeof t&&(n=t,t=null),E.isBuffer(e)?t="buffer":t||(t=r.defaultEncoding),"function"!=typeof n&&(n=function(){}),r.ended?o(this,r,n):s(this,r,e,n)&&(i=u(this,r,e,t,n)),i},i.prototype._write=function(e,t,n){n(Error("not implemented"))},i.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),e!==void 0&&null!==e&&this.write(e,t),r.ending||r.finished||m(this,r,n)}},{"./index.js":23,buffer:19,inherits:17,setimmediate:24}],29:[function(e,t,n){function r(e){if(e&&!a.isEncoding(e))throw Error("Unknown encoding: "+e)}function i(e){return e.toString(this.encoding)}function o(e){var t=this.charReceived=e.length%2;return this.charLength=t?2:0,t}function s(e){var t=this.charReceived=e.length%3;return this.charLength=t?3:0,t}var a=e("buffer").Buffer,u=n.StringDecoder=function(e){switch(this.encoding=(e||"utf8").toLowerCase().replace(/[-_]/,""),r(e),this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2,this.detectIncompleteChar=o;break;case"base64":this.surrogateSize=3,this.detectIncompleteChar=s;break;default:return this.write=i,void 0}this.charBuffer=new a(6),this.charReceived=0,this.charLength=0};u.prototype.write=function(e){for(var t="",n=0;this.charLength;){var r=e.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:e.length;if(e.copy(this.charBuffer,this.charReceived,n,r),this.charReceived+=r-n,n=r,this.charReceived<this.charLength)return"";t=this.charBuffer.slice(0,this.charLength).toString(this.encoding);var i=t.charCodeAt(t.length-1);if(!(i>=55296&&56319>=i)){if(this.charReceived=this.charLength=0,r==e.length)return t;e=e.slice(r,e.length);break}this.charLength+=this.surrogateSize,t=""}var o=this.detectIncompleteChar(e),s=e.length;this.charLength&&(e.copy(this.charBuffer,0,e.length-o,s),this.charReceived=o,s-=o),t+=e.toString(this.encoding,0,s);var s=t.length-1,i=t.charCodeAt(s);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(t.charAt(t.length-1),this.encoding),t.substring(0,s)}return t},u.prototype.detectIncompleteChar=function(e){for(var t=e.length>=3?3:e.length;t>0;t--){var n=e[e.length-t];if(1==t&&6==n>>5){this.charLength=2;break}if(2>=t&&14==n>>4){this.charLength=3;break}if(3>=t&&30==n>>3){this.charLength=4;break}}return t},u.prototype.end=function(e){var t="";if(e&&e.length&&(t=this.write(e)),this.charReceived){var n=this.charReceived,r=this.charBuffer,i=this.encoding;t+=r.slice(0,n).toString(i)}return t}},{buffer:19}],30:[function(e,t){t.exports=function(e){return e&&"object"==typeof e&&"function"==typeof e.copy&&"function"==typeof e.fill&&"function"==typeof e.binarySlice}},{}],31:[function(e,t,n){function r(e,t){var r={seen:[],stylize:o};return arguments.length>=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),d(t)?r.showHidden=t:t&&n._extend(r,t),w(r.showHidden)&&(r.showHidden=!1),w(r.depth)&&(r.depth=2),w(r.colors)&&(r.colors=!1),w(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=i),a(r,e,r.depth)}function i(e,t){var n=r.styles[t];return n?"["+r.colors[n][0]+"m"+e+"["+r.colors[n][1]+"m":e}function o(e){return e}function s(e){var t={};return e.forEach(function(e){t[e]=!0}),t}function a(e,t,r){if(e.customInspect&&t&&k(t.inspect)&&t.inspect!==n.inspect&&(!t.constructor||t.constructor.prototype!==t)){var i=t.inspect(r,e);return m(i)||(i=a(e,i,r)),i}var o=u(e,t);if(o)return o;var d=Object.keys(t),g=s(d);if(e.showHidden&&(d=Object.getOwnPropertyNames(t)),0===d.length){if(k(t)){var y=t.name?": "+t.name:"";return e.stylize("[Function"+y+"]","special")}if(_(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");if(x(t))return e.stylize(Date.prototype.toString.call(t),"date");if(S(t))return f(t)}var v="",b=!1,w=["{","}"];if(p(t)&&(b=!0,w=["[","]"]),k(t)){var E=t.name?": "+t.name:"";v=" [Function"+E+"]"}if(_(t)&&(v=" "+RegExp.prototype.toString.call(t)),x(t)&&(v=" "+Date.prototype.toUTCString.call(t)),S(t)&&(v=" "+f(t)),0===d.length&&(!b||0==t.length))return w[0]+v+w[1];if(0>r)return _(t)?e.stylize(RegExp.prototype.toString.call(t),"regexp"):e.stylize("[Object]","special");e.seen.push(t);var I;return I=b?l(e,t,r,g,d):d.map(function(n){return c(e,t,r,g,n,b)}),e.seen.pop(),h(I,v,w)}function u(e,t){if(w(t))return e.stylize("undefined","undefined");if(m(t)){var n="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(n,"string")}return v(t)?e.stylize(""+t,"number"):d(t)?e.stylize(""+t,"boolean"):g(t)?e.stylize("null","null"):void 0}function f(e){return"["+Error.prototype.toString.call(e)+"]"}function l(e,t,n,r,i){for(var o=[],s=0,a=t.length;a>s;++s)C(t,s+"")?o.push(c(e,t,n,r,s+"",!0)):o.push("");return i.forEach(function(i){i.match(/^\d+$/)||o.push(c(e,t,n,r,i,!0))}),o}function c(e,t,n,r,i,o){var s,u,f;if(f=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]},f.get?u=f.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):f.set&&(u=e.stylize("[Setter]","special")),C(r,i)||(s="["+i+"]"),u||(0>e.seen.indexOf(f.value)?(u=g(n)?a(e,f.value,null):a(e,f.value,n-1),u.indexOf("\n")>-1&&(u=o?u.split("\n").map(function(e){return" "+e}).join("\n").substr(2):"\n"+u.split("\n").map(function(e){return" "+e}).join("\n"))):u=e.stylize("[Circular]","special")),w(s)){if(o&&i.match(/^\d+$/))return u;s=JSON.stringify(""+i),s.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(s=s.substr(1,s.length-2),s=e.stylize(s,"name")):(s=s.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),s=e.stylize(s,"string"))}return s+": "+u}function h(e,t,n){var r=0,i=e.reduce(function(e,t){return r++,t.indexOf("\n")>=0&&r++,e+t.replace(/\u001b\[\d\d?m/g,"").length+1},0);return i>60?n[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+n[1]:n[0]+t+" "+e.join(", ")+" "+n[1]}function p(e){return Array.isArray(e)}function d(e){return"boolean"==typeof e}function g(e){return null===e}function y(e){return null==e}function v(e){return"number"==typeof e}function m(e){return"string"==typeof e}function b(e){return"symbol"==typeof e}function w(e){return void 0===e}function _(e){return E(e)&&"[object RegExp]"===j(e)}function E(e){return"object"==typeof e&&null!==e}function x(e){return E(e)&&"[object Date]"===j(e)}function S(e){return E(e)&&("[object Error]"===j(e)||e instanceof Error)}function k(e){return"function"==typeof e}function I(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||e===void 0}function j(e){return Object.prototype.toString.call(e)}function L(e){return 10>e?"0"+e.toString(10):e.toString(10)}function A(){var e=new Date,t=[L(e.getHours()),L(e.getMinutes()),L(e.getSeconds())].join(":");return[e.getDate(),U[e.getMonth()],t].join(" ")}function C(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var B=e("__browserify_process"),O="undefined"!=typeof self?self:"undefined"!=typeof window?window:{},T=/%[sdj%]/g;n.format=function(e){if(!m(e)){for(var t=[],n=0;arguments.length>n;n++)t.push(r(arguments[n]));return t.join(" ")}for(var n=1,i=arguments,o=i.length,s=(e+"").replace(T,function(e){if("%%"===e)return"%";if(n>=o)return e;switch(e){case"%s":return i[n++]+"";case"%d":return Number(i[n++]);case"%j":try{return JSON.stringify(i[n++])}catch(t){return"[Circular]"}default:return e}}),a=i[n];o>n;a=i[++n])s+=g(a)||!E(a)?" "+a:" "+r(a);return s},n.deprecate=function(e,t){function r(){if(!i){if(B.throwDeprecation)throw Error(t);B.traceDeprecation?console.trace(t):console.error(t),i=!0}return e.apply(this,arguments)}if(w(O.process))return function(){return n.deprecate(e,t).apply(this,arguments)};if(B.noDeprecation===!0)return e;var i=!1;return r};var M,D={};n.debuglog=function(e){if(w(M)&&(M=B.env.NODE_DEBUG||""),e=e.toUpperCase(),!D[e])if(RegExp("\\b"+e+"\\b","i").test(M)){var t=B.pid;D[e]=function(){var r=n.format.apply(n,arguments);console.error("%s %d: %s",e,t,r)}}else D[e]=function(){};return D[e]},n.inspect=r,r.colors={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.styles={special:"cyan",number:"yellow","boolean":"yellow",undefined:"grey","null":"bold",string:"green",date:"magenta",regexp:"red"},n.isArray=p,n.isBoolean=d,n.isNull=g,n.isNullOrUndefined=y,n.isNumber=v,n.isString=m,n.isSymbol=b,n.isUndefined=w,n.isRegExp=_,n.isObject=E,n.isDate=x,n.isError=S,n.isFunction=k,n.isPrimitive=I,n.isBuffer=e("./support/isBuffer");
var U=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];n.log=function(){console.log("%s - %s",A(),n.format.apply(n,arguments))},n.inherits=e("inherits"),n._extend=function(e,t){if(!t||!E(t))return e;for(var n=Object.keys(t),r=n.length;r--;)e[n[r]]=t[n[r]];return e}},{"./support/isBuffer":30,__browserify_process:18,inherits:17}]},{},[]),require=function e(t,n,r){function i(s,a){if(!n[s]){if(!t[s]){var u="function"==typeof require&&require;if(!a&&u)return u(s,!0);if(o)return o(s,!0);throw Error("Cannot find module '"+s+"'")}var f=n[s]={exports:{}};t[s][0].call(f.exports,function(e){var n=t[s][1][e];return i(n?n:e)},f,f.exports,e,t,n,r)}return n[s].exports}for(var o="function"==typeof require&&require,s=0;r.length>s;s++)i(r[s]);return i}({E3lvym:[function(e,t){function n(e){return 0===e.indexOf("ok")?(s+=1,void 0):0===e.indexOf("not ok")?(o+=1,void 0):void 0}function r(){var e=document.body.style;e.backgroundColor=o>0?i.FAILING:s>0&&0===o?i.PASSING:i.PENDING}t.exports=function(){var e=console.log,t=document.body.appendChild(document.createElement("pre"));return console.log=function(i){n(i),r(),e.apply(console,arguments),t.innerHTML+=i+"\n"},function(){console.log=e}};var i=t.exports.colors={PENDING:"#FCD62A",FAILING:"#F28E82",PASSING:"#8ECA6C"},o=0,s=0},{}],"tap-browser-color":[function(e,t){t.exports=e("E3lvym")},{}]},{},[]),require("tap-browser-color")();var test=require("tape");test("rAF Timestamp?",function(e){e.plan(1),setTimeout(function(){requestAnimationFrame(function(t){var n=performance.now();console.log("ts",t,"now",n);var r=n-t;e.ok(r>=0&&1>=r,"ts should be ~now, difference was "+r),e.end()})},500)}),test("rAF background",function(e){e.plan(1),console.log("PUT TAB IN BACKGROUND FOR THIS NEXT TEST TO PASS"),setTimeout(function(){var t=performance.now();requestAnimationFrame(function(n){var r=performance.now(),i=r-t;console.log("ts",n,"now",r,"start",t),e.ok(i>16,"background tab should have delay greater than 16ms, was "+i),e.end()})},3e3)});
<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