Advertisement
Guest User

Velocidade Digitacao

a guest
Mar 28th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 68.30 KB | None | 0 0
  1. <html>
  2. <head>
  3. <title>IDProject</title>
  4. </head>
  5. <body>
  6. <br>
  7. <center>
  8. Please. TYPE: <b>"i am testing this"</b> and then, you press "Finish".<br><br>
  9. <input style="width:50%" type="text" id="text"></input>
  10. <button onclick="getResult()">Finish</button>
  11. </center>
  12. <script>/*
  13. Copyright (c) 2010 Heather Arthur
  14.  
  15. Permission is hereby granted, free of charge, to any person obtaining
  16. a copy of this software and associated documentation files (the
  17. "Software"), to deal in the Software without restriction, including
  18. without limitation the rights to use, copy, modify, merge, publish,
  19. distribute, sublicense, and/or sell copies of the Software, and to
  20. permit persons to whom the Software is furnished to do so, subject to
  21. the following conditions:
  22.  
  23. The above copyright notice and this permission notice shall be
  24. included in all copies or substantial portions of the Software.
  25.  
  26. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  27. EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  28. MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  29. NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  30. LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  31. OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  32. WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  33.  
  34. */!function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);throw new Error("Cannot find module '"+g+"'")}var j=c[g]={exports:{}};b[g][0].call(j.exports,function(a){var c=b[g][1][a];return e(c?c:a)},j,j.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(a){brain=a("./lib/brain")},{"./lib/brain":2}],2:[function(a,b,c){c.NeuralNetwork=a("./neuralnetwork").NeuralNetwork,c.crossValidate=a("./cross-validate")},{"./cross-validate":3,"./neuralnetwork":5}],3:[function(a,b){function c(a,b,c,e,f){var g=new a(b),h=Date.now(),i=g.train(e,c),j=Date.now(),k=g.test(f),l=Date.now(),m=d(k).extend({trainTime:j-h,testTime:l-j,iterations:i.iterations,trainError:i.error,learningRate:g.learningRate,hidden:g.hiddenSizes,network:g.toJSON()});return m}var d=a("underscore")._;b.exports=function(a,b,e,f,g){g=g||4;var h=b.length/g;b=d(b).sortBy(function(){return Math.random()});var i={error:0,trainTime:0,testTime:0,iterations:0,trainError:0},j={truePos:0,trueNeg:0,falsePos:0,falseNeg:0,total:0},k=[],l=d.range(g).map(function(g){var l=d(b).clone(),m=l.splice(g*h,h),n=l,o=c(a,e,f,n,m);return d(i).each(function(a,b){i[b]=a+o[b]}),d(j).each(function(a,b){j[b]=a+o[b]}),k.push(o.misclasses),o});return d(i).each(function(a,b){i[b]=a/g}),j.precision=j.truePos/(j.truePos+j.falsePos),j.recall=j.truePos/(j.truePos+j.falseNeg),j.accuracy=(j.trueNeg+j.truePos)/j.total,j.testSize=h,j.trainSize=b.length-h,{avgs:i,stats:j,sets:l,misclasses:d(k).flatten()}}},{underscore:20}],4:[function(a,b){function c(a){var b=h(a).reduce(function(a,b){return h(a).extend(b)},{});return d(b)}function d(a){var b={},c=0;for(var d in a)b[d]=c++;return b}function e(a,b){var c=[];for(var d in a)c[a[d]]=b[d]||0;return c}function f(a,b){var c={};for(var d in a)c[d]=b[a[d]];return c}function g(a){for(var b={},c=0,d=a.length;d-->0;)b[a[d]]=c++;return b}var h=a("underscore");b.exports={buildLookup:c,lookupFromHash:d,toArray:e,toHash:f,lookupFromArray:g}},{underscore:20}],5:[function(a,b,c){function d(){return.4*Math.random()-.2}function e(a){for(var b=new Array(a),c=0;a>c;c++)b[c]=0;return b}function f(a){for(var b=new Array(a),c=0;a>c;c++)b[c]=d();return b}function g(a){for(var b=0,c=0;c<a.length;c++)b+=Math.pow(a[c],2);return b/a.length}function h(a){if(k.call(this,{objectMode:!0}),a=a||{},!a.neuralNetwork)throw new Error("no neural network specified");return this.neuralNetwork=a.neuralNetwork,this.dataFormatDetermined=!1,this.inputKeys=[],this.outputKeys=[],this.i=0,this.iterations=a.iterations||2e4,this.errorThresh=a.errorThresh||.005,this.log=a.log||!1,this.logPeriod=a.logPeriod||10,this.callback=a.callback,this.callbackPeriod=a.callbackPeriod||10,this.floodCallback=a.floodCallback,this.doneTrainingCallback=a.doneTrainingCallback,this.size=0,this.count=0,this.sum=0,this.on("finish",this.finishStreamIteration),this}var i=a("underscore"),j=a("./lookup"),k=a("stream").Writable,l=a("inherits"),m=function(a){a=a||{},this.learningRate=a.learningRate||.3,this.momentum=a.momentum||.1,this.hiddenSizes=a.hiddenLayers,this.binaryThresh=a.binaryThresh||.5};m.prototype={initialize:function(a){this.sizes=a,this.outputLayer=this.sizes.length-1,this.biases=[],this.weights=[],this.outputs=[],this.deltas=[],this.changes=[],this.errors=[];for(var b=0;b<=this.outputLayer;b++){var c=this.sizes[b];if(this.deltas[b]=e(c),this.errors[b]=e(c),this.outputs[b]=e(c),b>0){this.biases[b]=f(c),this.weights[b]=new Array(c),this.changes[b]=new Array(c);for(var d=0;c>d;d++){var g=this.sizes[b-1];this.weights[b][d]=f(g),this.changes[b][d]=e(g)}}}},run:function(a){this.inputLookup&&(a=j.toArray(this.inputLookup,a));var b=this.runInput(a);return this.outputLookup&&(b=j.toHash(this.outputLookup,b)),b},runInput:function(a){this.outputs[0]=a;for(var b=1;b<=this.outputLayer;b++){for(var c=0;c<this.sizes[b];c++){for(var d=this.weights[b][c],e=this.biases[b][c],f=0;f<d.length;f++)e+=d[f]*a[f];this.outputs[b][c]=1/(1+Math.exp(-e))}var g=a=this.outputs[b]}return g},train:function(a,b){a=this.formatData(a),b=b||{};var c=b.iterations||2e4,d=b.errorThresh||.005,e=b.log||!1,f=b.logPeriod||10,g=b.callback,h=b.callbackPeriod||10,j=a[0].input.length,k=a[0].output.length,l=this.hiddenSizes;l||(l=[Math.max(3,Math.floor(j/2))]);var m=i([j,l,k]).flatten();this.initialize(m);for(var n=1,o=0;c>o&&n>d;o++){for(var p=0,q=0;q<a.length;q++){var r=this.trainPattern(a[q].input,a[q].output);p+=r}n=p/a.length,e&&o%f==0&&console.log("iterations:",o,"training error:",n),g&&o%h==0&&g({error:n,iterations:o})}return{error:n,iterations:o}},trainPattern:function(a,b){this.runInput(a),this.calculateDeltas(b),this.adjustWeights();var c=g(this.errors[this.outputLayer]);return c},calculateDeltas:function(a){for(var b=this.outputLayer;b>=0;b--)for(var c=0;c<this.sizes[b];c++){var d=this.outputs[b][c],e=0;if(b==this.outputLayer)e=a[c]-d;else for(var f=this.deltas[b+1],g=0;g<f.length;g++)e+=f[g]*this.weights[b+1][g][c];this.errors[b][c]=e,this.deltas[b][c]=e*d*(1-d)}},adjustWeights:function(){for(var a=1;a<=this.outputLayer;a++)for(var b=this.outputs[a-1],c=0;c<this.sizes[a];c++){for(var d=this.deltas[a][c],e=0;e<b.length;e++){var f=this.changes[a][c][e];f=this.learningRate*d*b[e]+this.momentum*f,this.changes[a][c][e]=f,this.weights[a][c][e]+=f}this.biases[a][c]+=this.learningRate*d}},formatData:function(a){if(!i.isArray(a)){var b=[];b.push(a),a=b}var c=a[0].input;return i(c).isArray()||c instanceof Float64Array||(this.inputLookup||(this.inputLookup=j.buildLookup(i(a).pluck("input"))),a=a.map(function(a){var b=j.toArray(this.inputLookup,a.input);return i(i(a).clone()).extend({input:b})},this)),i(a[0].output).isArray()||(this.outputLookup||(this.outputLookup=j.buildLookup(i(a).pluck("output"))),a=a.map(function(a){var b=j.toArray(this.outputLookup,a.output);return i(i(a).clone()).extend({output:b})},this)),a},test:function(a){a=this.formatData(a);for(var b=1==a[0].output.length,c=0,d=0,e=0,f=0,h=[],j=0,k=0;k<a.length;k++){var l,m,n=this.runInput(a[k].input),o=a[k].output;if(b?(l=n[0]>this.binaryThresh?1:0,m=o[0]):(l=n.indexOf(i(n).max()),m=o.indexOf(i(o).max())),l!=m){var p=a[k];i(p).extend({actual:l,expected:m}),h.push(p)}b&&(0==l&&0==m?f++:1==l&&1==m?e++:0==l&&1==m?d++:1==l&&0==m&&c++);var q=n.map(function(a,b){return o[b]-a});j+=g(q)}var r=j/a.length,s={error:r,misclasses:h};return b&&i(s).extend({trueNeg:f,truePos:e,falseNeg:d,falsePos:c,total:a.length,precision:e/(e+c),recall:e/(e+d),accuracy:(f+e)/a.length}),s},toJSON:function(){for(var a=[],b=0;b<=this.outputLayer;b++){a[b]={};var c;c=0==b&&this.inputLookup?i(this.inputLookup).keys():b==this.outputLayer&&this.outputLookup?i(this.outputLookup).keys():i.range(0,this.sizes[b]);for(var d=0;d<c.length;d++){var e=c[d];if(a[b][e]={},b>0){a[b][e].bias=this.biases[b][d],a[b][e].weights={};for(var f in a[b-1]){var g=f;1==b&&this.inputLookup&&(g=this.inputLookup[f]),a[b][e].weights[f]=this.weights[b][d][g]}}}}return{layers:a,outputLookup:!!this.outputLookup,inputLookup:!!this.inputLookup}},fromJSON:function(a){var b=a.layers.length;this.outputLayer=b-1,this.sizes=new Array(b),this.weights=new Array(b),this.biases=new Array(b),this.outputs=new Array(b);for(var c=0;c<=this.outputLayer;c++){var d=a.layers[c];0!=c||d[0]&&!a.inputLookup?c!=this.outputLayer||d[0]&&!a.outputLookup||(this.outputLookup=j.lookupFromHash(d)):this.inputLookup=j.lookupFromHash(d);var e=i(d).keys();this.sizes[c]=e.length,this.weights[c]=[],this.biases[c]=[],this.outputs[c]=[];for(var f in e){var g=e[f];this.biases[c][f]=d[g].bias,this.weights[c][f]=i(d[g].weights).toArray()}}return this},toFunction:function(){var a=this.toJSON();return new Function("input"," var net = "+JSON.stringify(a)+";\n\n for (var i = 1; i < net.layers.length; i++) {\n var layer = net.layers[i];\n var output = {};\n \n for (var id in layer) {\n var node = layer[id];\n var sum = node.bias;\n \n for (var iid in node.weights) {\n sum += node.weights[iid] * input[iid];\n }\n output[id] = (1 / (1 + Math.exp(-sum)));\n }\n input = output;\n }\n return output;")},createTrainStream:function(a){return a=a||{},a.neuralNetwork=this,this.trainStream=new h(a),this.trainStream}},c.NeuralNetwork=m,l(h,k),h.prototype._write=function(a,b,c){if(!a)return this.emit("finish"),c();if(!this.dataFormatDetermined)return this.size++,this.inputKeys=i.union(this.inputKeys,i.keys(a.input)),this.outputKeys=i.union(this.outputKeys,i.keys(a.output)),this.firstDatum=this.firstDatum||a,c();this.count++;var d=this.neuralNetwork.formatData(a);this.trainDatum(d[0]),c()},h.prototype.trainDatum=function(a){var b=this.neuralNetwork.trainPattern(a.input,a.output);this.sum+=b},h.prototype.finishStreamIteration=function(){if(this.dataFormatDetermined&&this.size!==this.count&&console.log("This iteration's data length was different from the first."),!this.dataFormatDetermined){this.neuralNetwork.inputLookup=j.lookupFromArray(this.inputKeys),this.neuralNetwork.outputLookup=j.lookupFromArray(this.outputKeys);var a=this.neuralNetwork.formatData(this.firstDatum),b=a[0].input.length,c=a[0].output.length,d=this.hiddenSizes;d||(d=[Math.max(3,Math.floor(b/2))]);var e=i([b,d,c]).flatten();return this.dataFormatDetermined=!0,this.neuralNetwork.initialize(e),void("function"==typeof this.floodCallback&&this.floodCallback())}var f=this.sum/this.size;if(this.log&&this.i%this.logPeriod==0&&console.log("iterations:",this.i,"training error:",f),this.callback&&this.i%this.callbackPeriod==0&&this.callback({error:f,iterations:this.i}),this.sum=0,this.count=0,this.i++,this.i<this.iterations&&f>this.errorThresh){if("function"==typeof this.floodCallback)return this.floodCallback()}else if("function"==typeof this.doneTrainingCallback)return this.doneTrainingCallback({error:f,iterations:this.i})}},{"./lookup":4,inherits:19,stream:12,underscore:20}],6:[function(a,b,c){function d(a,b,c){if(!(this instanceof d))return new d(a,b,c);var e=typeof a;if("base64"===b&&"string"===e)for(a=C(a);a.length%4!==0;)a+="=";var f;if("number"===e)f=F(a);else if("string"===e)f=d.byteLength(a,b);else{if("object"!==e)throw new Error("First argument needs to be a number, array or string.");f=F(a.length)}var g;d._useTypedArrays?g=D(new Uint8Array(f)):(g=this,g.length=f,g._isBuffer=!0);var h;if(d._useTypedArrays&&"function"==typeof Uint8Array&&a instanceof Uint8Array)g._set(a);else if(H(a))for(h=0;f>h;h++)g[h]=d.isBuffer(a)?a.readUInt8(h):a[h];else if("string"===e)g.write(a,0,b);else if("number"===e&&!d._useTypedArrays&&!c)for(h=0;f>h;h++)g[h]=0;return g}function e(a,b,c,e){c=Number(c)||0;var f=a.length-c;e?(e=Number(e),e>f&&(e=f)):e=f;var g=b.length;S(g%2===0,"Invalid hex string"),e>g/2&&(e=g/2);for(var h=0;e>h;h++){var i=parseInt(b.substr(2*h,2),16);S(!isNaN(i),"Invalid hex string"),a[c+h]=i}return d._charsWritten=2*h,h}function f(a,b,c,e){var f=d._charsWritten=N(J(b),a,c,e);return f}function g(a,b,c,e){var f=d._charsWritten=N(K(b),a,c,e);return f}function h(a,b,c,d){return g(a,b,c,d)}function i(a,b,c,e){var f=d._charsWritten=N(M(b),a,c,e);return f}function j(a,b,c,e){var f=d._charsWritten=N(L(b),a,c,e);return f}function k(a,b,c){return T.fromByteArray(0===b&&c===a.length?a:a.slice(b,c))}function l(a,b,c){var d="",e="";c=Math.min(a.length,c);for(var f=b;c>f;f++)a[f]<=127?(d+=O(e)+String.fromCharCode(a[f]),e=""):e+="%"+a[f].toString(16);return d+O(e)}function m(a,b,c){var d="";c=Math.min(a.length,c);for(var e=b;c>e;e++)d+=String.fromCharCode(a[e]);return d}function n(a,b,c){return m(a,b,c)}function o(a,b,c){var d=a.length;(!b||0>b)&&(b=0),(!c||0>c||c>d)&&(c=d);for(var e="",f=b;c>f;f++)e+=I(a[f]);return e}function p(a,b,c){for(var d=a.slice(b,c),e="",f=0;f<d.length;f+=2)e+=String.fromCharCode(d[f]+256*d[f+1]);return e}function q(a,b,c,d){d||(S("boolean"==typeof c,"missing or invalid endian"),S(void 0!==b&&null!==b,"missing offset"),S(b+1<a.length,"Trying to read beyond buffer length"));var e=a.length;if(!(b>=e)){var f;return c?(f=a[b],e>b+1&&(f|=a[b+1]<<8)):(f=a[b]<<8,e>b+1&&(f|=a[b+1])),f}}function r(a,b,c,d){d||(S("boolean"==typeof c,"missing or invalid endian"),S(void 0!==b&&null!==b,"missing offset"),S(b+3<a.length,"Trying to read beyond buffer length"));var e=a.length;if(!(b>=e)){var f;return c?(e>b+2&&(f=a[b+2]<<16),e>b+1&&(f|=a[b+1]<<8),f|=a[b],e>b+3&&(f+=a[b+3]<<24>>>0)):(e>b+1&&(f=a[b+1]<<16),e>b+2&&(f|=a[b+2]<<8),e>b+3&&(f|=a[b+3]),f+=a[b]<<24>>>0),f}}function s(a,b,c,d){d||(S("boolean"==typeof c,"missing or invalid endian"),S(void 0!==b&&null!==b,"missing offset"),S(b+1<a.length,"Trying to read beyond buffer length"));var e=a.length;if(!(b>=e)){var f=q(a,b,c,!0),g=32768&f;return g?-1*(65535-f+1):f}}function t(a,b,c,d){d||(S("boolean"==typeof c,"missing or invalid endian"),S(void 0!==b&&null!==b,"missing offset"),S(b+3<a.length,"Trying to read beyond buffer length"));var e=a.length;if(!(b>=e)){var f=r(a,b,c,!0),g=2147483648&f;return g?-1*(4294967295-f+1):f}}function u(a,b,c,d){return d||(S("boolean"==typeof c,"missing or invalid endian"),S(b+3<a.length,"Trying to read beyond buffer length")),U.read(a,b,c,23,4)}function v(a,b,c,d){return d||(S("boolean"==typeof c,"missing or invalid endian"),S(b+7<a.length,"Trying to read beyond buffer length")),U.read(a,b,c,52,8)}function w(a,b,c,d,e){e||(S(void 0!==b&&null!==b,"missing value"),S("boolean"==typeof d,"missing or invalid endian"),S(void 0!==c&&null!==c,"missing offset"),S(c+1<a.length,"trying to write beyond buffer length"),P(b,65535));var f=a.length;if(!(c>=f))for(var g=0,h=Math.min(f-c,2);h>g;g++)a[c+g]=(b&255<<8*(d?g:1-g))>>>8*(d?g:1-g)}function x(a,b,c,d,e){e||(S(void 0!==b&&null!==b,"missing value"),S("boolean"==typeof d,"missing or invalid endian"),S(void 0!==c&&null!==c,"missing offset"),S(c+3<a.length,"trying to write beyond buffer length"),P(b,4294967295));var f=a.length;if(!(c>=f))for(var g=0,h=Math.min(f-c,4);h>g;g++)a[c+g]=b>>>8*(d?g:3-g)&255}function y(a,b,c,d,e){e||(S(void 0!==b&&null!==b,"missing value"),S("boolean"==typeof d,"missing or invalid endian"),S(void 0!==c&&null!==c,"missing offset"),S(c+1<a.length,"Trying to write beyond buffer length"),Q(b,32767,-32768));var f=a.length;c>=f||(b>=0?w(a,b,c,d,e):w(a,65535+b+1,c,d,e))}function z(a,b,c,d,e){e||(S(void 0!==b&&null!==b,"missing value"),S("boolean"==typeof d,"missing or invalid endian"),S(void 0!==c&&null!==c,"missing offset"),S(c+3<a.length,"Trying to write beyond buffer length"),Q(b,2147483647,-2147483648));var f=a.length;c>=f||(b>=0?x(a,b,c,d,e):x(a,4294967295+b+1,c,d,e))}function A(a,b,c,d,e){e||(S(void 0!==b&&null!==b,"missing value"),S("boolean"==typeof d,"missing or invalid endian"),S(void 0!==c&&null!==c,"missing offset"),S(c+3<a.length,"Trying to write beyond buffer length"),R(b,3.4028234663852886e38,-3.4028234663852886e38));var f=a.length;c>=f||U.write(a,b,c,d,23,4)}function B(a,b,c,d,e){e||(S(void 0!==b&&null!==b,"missing value"),S("boolean"==typeof d,"missing or invalid endian"),S(void 0!==c&&null!==c,"missing offset"),S(c+7<a.length,"Trying to write beyond buffer length"),R(b,1.7976931348623157e308,-1.7976931348623157e308));var f=a.length;c>=f||U.write(a,b,c,d,52,8)}function C(a){return a.trim?a.trim():a.replace(/^\s+|\s+$/g,"")}function D(a){return a._isBuffer=!0,a._get=a.get,a._set=a.set,a.get=V.get,a.set=V.set,a.write=V.write,a.toString=V.toString,a.toLocaleString=V.toString,a.toJSON=V.toJSON,a.copy=V.copy,a.slice=V.slice,a.readUInt8=V.readUInt8,a.readUInt16LE=V.readUInt16LE,a.readUInt16BE=V.readUInt16BE,a.readUInt32LE=V.readUInt32LE,a.readUInt32BE=V.readUInt32BE,a.readInt8=V.readInt8,a.readInt16LE=V.readInt16LE,a.readInt16BE=V.readInt16BE,a.readInt32LE=V.readInt32LE,a.readInt32BE=V.readInt32BE,a.readFloatLE=V.readFloatLE,a.readFloatBE=V.readFloatBE,a.readDoubleLE=V.readDoubleLE,a.readDoubleBE=V.readDoubleBE,a.writeUInt8=V.writeUInt8,a.writeUInt16LE=V.writeUInt16LE,a.writeUInt16BE=V.writeUInt16BE,a.writeUInt32LE=V.writeUInt32LE,a.writeUInt32BE=V.writeUInt32BE,a.writeInt8=V.writeInt8,a.writeInt16LE=V.writeInt16LE,a.writeInt16BE=V.writeInt16BE,a.writeInt32LE=V.writeInt32LE,a.writeInt32BE=V.writeInt32BE,a.writeFloatLE=V.writeFloatLE,a.writeFloatBE=V.writeFloatBE,a.writeDoubleLE=V.writeDoubleLE,a.writeDoubleBE=V.writeDoubleBE,a.fill=V.fill,a.inspect=V.inspect,a.toArrayBuffer=V.toArrayBuffer,a}function E(a,b,c){return"number"!=typeof a?c:(a=~~a,a>=b?b:a>=0?a:(a+=b,a>=0?a:0))}function F(a){return a=~~Math.ceil(+a),0>a?0:a}function G(a){return(Array.isArray||function(a){return"[object Array]"===Object.prototype.toString.call(a)})(a)}function H(a){return G(a)||d.isBuffer(a)||a&&"object"==typeof a&&"number"==typeof a.length}function I(a){return 16>a?"0"+a.toString(16):a.toString(16)}function J(a){for(var b=[],c=0;c<a.length;c++){var d=a.charCodeAt(c);if(127>=d)b.push(a.charCodeAt(c));else{var e=c;d>=55296&&57343>=d&&c++;for(var f=encodeURIComponent(a.slice(e,c+1)).substr(1).split("%"),g=0;g<f.length;g++)b.push(parseInt(f[g],16))}}return b}function K(a){for(var b=[],c=0;c<a.length;c++)b.push(255&a.charCodeAt(c));return b}function L(a){for(var b,c,d,e=[],f=0;f<a.length;f++)b=a.charCodeAt(f),c=b>>8,d=b%256,e.push(d),e.push(c);return e}function M(a){return T.toByteArray(a)}function N(a,b,c,d){for(var e=0;d>e&&!(e+c>=b.length||e>=a.length);e++)b[e+c]=a[e];return e}function O(a){try{return decodeURIComponent(a)}catch(b){return String.fromCharCode(65533)}}function P(a,b){S("number"==typeof a,"cannot write a non-number as a number"),S(a>=0,"specified a negative value for writing an unsigned value"),S(b>=a,"value is larger than maximum value for type"),S(Math.floor(a)===a,"value has a fractional component")}function Q(a,b,c){S("number"==typeof a,"cannot write a non-number as a number"),S(b>=a,"value larger than maximum allowed value"),S(a>=c,"value smaller than minimum allowed value"),S(Math.floor(a)===a,"value has a fractional component")}function R(a,b,c){S("number"==typeof a,"cannot write a non-number as a number"),S(b>=a,"value larger than maximum allowed value"),S(a>=c,"value smaller than minimum allowed value")}function S(a,b){if(!a)throw new Error(b||"Failed assertion")}var T=a("base64-js"),U=a("ieee754");c.Buffer=d,c.SlowBuffer=d,c.INSPECT_MAX_BYTES=50,d.poolSize=8192,d._useTypedArrays=function(){if("function"!=typeof Uint8Array||"function"!=typeof ArrayBuffer)return!1;try{var a=new Uint8Array(0);return a.foo=function(){return 42},42===a.foo()&&"function"==typeof a.subarray}catch(b){return!1}}(),d.isEncoding=function(a){switch(String(a).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"raw":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},d.isBuffer=function(a){return!(null===a||void 0===a||!a._isBuffer)},d.byteLength=function(a,b){var c;switch(a+="",b||"utf8"){case"hex":c=a.length/2;break;case"utf8":case"utf-8":c=J(a).length;break;case"ascii":case"binary":case"raw":c=a.length;break;case"base64":c=M(a).length;break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":c=2*a.length;break;default:throw new Error("Unknown encoding")}return c},d.concat=function(a,b){if(S(G(a),"Usage: Buffer.concat(list, [totalLength])\nlist should be an Array."),0===a.length)return new d(0);if(1===a.length)return a[0];var c;if("number"!=typeof b)for(b=0,c=0;c<a.length;c++)b+=a[c].length;var e=new d(b),f=0;for(c=0;c<a.length;c++){var g=a[c];g.copy(e,f),f+=g.length}return e},d.prototype.write=function(a,b,c,d){if(isFinite(b))isFinite(c)||(d=c,c=void 0);else{var k=d;d=b,b=c,c=k}b=Number(b)||0;var l=this.length-b;c?(c=Number(c),c>l&&(c=l)):c=l,d=String(d||"utf8").toLowerCase();var m;switch(d){case"hex":m=e(this,a,b,c);break;case"utf8":case"utf-8":m=f(this,a,b,c);break;case"ascii":m=g(this,a,b,c);break;case"binary":m=h(this,a,b,c);break;case"base64":m=i(this,a,b,c);break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":m=j(this,a,b,c);break;default:throw new Error("Unknown encoding")}return m},d.prototype.toString=function(a,b,c){var d=this;if(a=String(a||"utf8").toLowerCase(),b=Number(b)||0,c=void 0!==c?Number(c):c=d.length,c===b)return"";var e;switch(a){case"hex":e=o(d,b,c);break;case"utf8":case"utf-8":e=l(d,b,c);break;case"ascii":e=m(d,b,c);break;case"binary":e=n(d,b,c);break;case"base64":e=k(d,b,c);break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":e=p(d,b,c);break;default:throw new Error("Unknown encoding")}return e},d.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},d.prototype.copy=function(a,b,c,d){var e=this;if(c||(c=0),d||0===d||(d=this.length),b||(b=0),d!==c&&0!==a.length&&0!==e.length){S(d>=c,"sourceEnd < sourceStart"),S(b>=0&&b<a.length,"targetStart out of bounds"),S(c>=0&&c<e.length,"sourceStart out of bounds"),S(d>=0&&d<=e.length,"sourceEnd out of bounds"),d>this.length&&(d=this.length),a.length-b<d-c&&(d=a.length-b+c);for(var f=0;d-c>f;f++)a[f+b]=this[f+c]}},d.prototype.slice=function(a,b){var c=this.length;if(a=E(a,c,0),b=E(b,c,c),d._useTypedArrays)return D(this.subarray(a,b));for(var e=b-a,f=new d(e,void 0,!0),g=0;e>g;g++)f[g]=this[g+a];return f},d.prototype.get=function(a){return console.log(".get() is deprecated. Access using array indexes instead."),this.readUInt8(a)},d.prototype.set=function(a,b){return console.log(".set() is deprecated. Access using array indexes instead."),this.writeUInt8(a,b)},d.prototype.readUInt8=function(a,b){return b||(S(void 0!==a&&null!==a,"missing offset"),S(a<this.length,"Trying to read beyond buffer length")),a>=this.length?void 0:this[a]},d.prototype.readUInt16LE=function(a,b){return q(this,a,!0,b)},d.prototype.readUInt16BE=function(a,b){return q(this,a,!1,b)},d.prototype.readUInt32LE=function(a,b){return r(this,a,!0,b)},d.prototype.readUInt32BE=function(a,b){return r(this,a,!1,b)},d.prototype.readInt8=function(a,b){if(b||(S(void 0!==a&&null!==a,"missing offset"),S(a<this.length,"Trying to read beyond buffer length")),!(a>=this.length)){var c=128&this[a];return c?-1*(255-this[a]+1):this[a]}},d.prototype.readInt16LE=function(a,b){return s(this,a,!0,b)},d.prototype.readInt16BE=function(a,b){return s(this,a,!1,b)},d.prototype.readInt32LE=function(a,b){return t(this,a,!0,b)},d.prototype.readInt32BE=function(a,b){return t(this,a,!1,b)},d.prototype.readFloatLE=function(a,b){return u(this,a,!0,b)},d.prototype.readFloatBE=function(a,b){return u(this,a,!1,b)},d.prototype.readDoubleLE=function(a,b){return v(this,a,!0,b)},d.prototype.readDoubleBE=function(a,b){return v(this,a,!1,b)},d.prototype.writeUInt8=function(a,b,c){c||(S(void 0!==a&&null!==a,"missing value"),S(void 0!==b&&null!==b,"missing offset"),S(b<this.length,"trying to write beyond buffer length"),P(a,255)),b>=this.length||(this[b]=a)},d.prototype.writeUInt16LE=function(a,b,c){w(this,a,b,!0,c)},d.prototype.writeUInt16BE=function(a,b,c){w(this,a,b,!1,c)},d.prototype.writeUInt32LE=function(a,b,c){x(this,a,b,!0,c)},d.prototype.writeUInt32BE=function(a,b,c){x(this,a,b,!1,c)},d.prototype.writeInt8=function(a,b,c){c||(S(void 0!==a&&null!==a,"missing value"),S(void 0!==b&&null!==b,"missing offset"),S(b<this.length,"Trying to write beyond buffer length"),Q(a,127,-128)),b>=this.length||(a>=0?this.writeUInt8(a,b,c):this.writeUInt8(255+a+1,b,c))},d.prototype.writeInt16LE=function(a,b,c){y(this,a,b,!0,c)},d.prototype.writeInt16BE=function(a,b,c){y(this,a,b,!1,c)},d.prototype.writeInt32LE=function(a,b,c){z(this,a,b,!0,c)},d.prototype.writeInt32BE=function(a,b,c){z(this,a,b,!1,c)},d.prototype.writeFloatLE=function(a,b,c){A(this,a,b,!0,c)},d.prototype.writeFloatBE=function(a,b,c){A(this,a,b,!1,c)},d.prototype.writeDoubleLE=function(a,b,c){B(this,a,b,!0,c)},d.prototype.writeDoubleBE=function(a,b,c){B(this,a,b,!1,c)},d.prototype.fill=function(a,b,c){if(a||(a=0),b||(b=0),c||(c=this.length),"string"==typeof a&&(a=a.charCodeAt(0)),S("number"==typeof a&&!isNaN(a),"value is not a number"),S(c>=b,"end < start"),c!==b&&0!==this.length){S(b>=0&&b<this.length,"start out of bounds"),S(c>=0&&c<=this.length,"end out of bounds");for(var d=b;c>d;d++)this[d]=a}},d.prototype.inspect=function(){for(var a=[],b=this.length,d=0;b>d;d++)if(a[d]=I(this[d]),d===c.INSPECT_MAX_BYTES){a[d+1]="...";break}return"<Buffer "+a.join(" ")+">"},d.prototype.toArrayBuffer=function(){if("function"==typeof Uint8Array){if(d._useTypedArrays)return new d(this).buffer;for(var a=new Uint8Array(this.length),b=0,c=a.length;c>b;b+=1)a[b]=this[b];return a.buffer}throw new Error("Buffer.toArrayBuffer not supported in this browser")};var V=d.prototype},{"base64-js":7,ieee754:8}],7:[function(a,b){var c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";!function(){"use strict";function a(a){var b=a.charCodeAt(0);return b===g?62:b===h?63:i>b?-1:i+10>b?b-i+26+26:k+26>b?b-k:j+26>b?b-j+26:void 0}function d(b){function c(a){j[l++]=a}var d,e,g,h,i,j;if(b.length%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var k=b.length;i="="===b.charAt(k-2)?2:"="===b.charAt(k-1)?1:0,j=new f(3*b.length/4-i),g=i>0?b.length-4:b.length;var l=0;for(d=0,e=0;g>d;d+=4,e+=3)h=a(b.charAt(d))<<18|a(b.charAt(d+1))<<12|a(b.charAt(d+2))<<6|a(b.charAt(d+3)),c((16711680&h)>>16),c((65280&h)>>8),c(255&h);return 2===i?(h=a(b.charAt(d))<<2|a(b.charAt(d+1))>>4,c(255&h)):1===i&&(h=a(b.charAt(d))<<10|a(b.charAt(d+1))<<4|a(b.charAt(d+2))>>2,c(h>>8&255),c(255&h)),j}function e(a){function b(a){return c.charAt(a)}function d(a){return b(a>>18&63)+b(a>>12&63)+b(a>>6&63)+b(63&a)}var e,f,g,h=a.length%3,i="";for(e=0,g=a.length-h;g>e;e+=3)f=(a[e]<<16)+(a[e+1]<<8)+a[e+2],i+=d(f);switch(h){case 1:f=a[a.length-1],i+=b(f>>2),i+=b(f<<4&63),i+="==";break;case 2:f=(a[a.length-2]<<8)+a[a.length-1],i+=b(f>>10),i+=b(f>>4&63),i+=b(f<<2&63),i+="="}return i}var f="undefined"!=typeof Uint8Array?Uint8Array:Array,g=("0".charCodeAt(0),"+".charCodeAt(0)),h="/".charCodeAt(0),i="0".charCodeAt(0),j="a".charCodeAt(0),k="A".charCodeAt(0);b.exports.toByteArray=d,b.exports.fromByteArray=e}()},{}],8:[function(a,b,c){c.read=function(a,b,c,d,e){var f,g,h=8*e-d-1,i=(1<<h)-1,j=i>>1,k=-7,l=c?e-1:0,m=c?-1:1,n=a[b+l];for(l+=m,f=n&(1<<-k)-1,n>>=-k,k+=h;k>0;f=256*f+a[b+l],l+=m,k-=8);for(g=f&(1<<-k)-1,f>>=-k,k+=d;k>0;g=256*g+a[b+l],l+=m,k-=8);if(0===f)f=1-j;else{if(f===i)return g?0/0:1/0*(n?-1:1);g+=Math.pow(2,d),f-=j}return(n?-1:1)*g*Math.pow(2,f-d)},c.write=function(a,b,c,d,e,f){var g,h,i,j=8*f-e-1,k=(1<<j)-1,l=k>>1,m=23===e?Math.pow(2,-24)-Math.pow(2,-77):0,n=d?0:f-1,o=d?1:-1,p=0>b||0===b&&0>1/b?1:0;for(b=Math.abs(b),isNaN(b)||1/0===b?(h=isNaN(b)?1:0,g=k):(g=Math.floor(Math.log(b)/Math.LN2),b*(i=Math.pow(2,-g))<1&&(g--,i*=2),b+=g+l>=1?m/i:m*Math.pow(2,1-l),b*i>=2&&(g++,i/=2),g+l>=k?(h=0,g=k):g+l>=1?(h=(b*i-1)*Math.pow(2,e),g+=l):(h=b*Math.pow(2,l-1)*Math.pow(2,e),g=0));e>=8;a[c+n]=255&h,n+=o,h/=256,e-=8);for(g=g<<e|h,j+=e;j>0;a[c+n]=255&g,n+=o,g/=256,j-=8);a[c+n-o]|=128*p}},{}],9:[function(a,b){function c(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function d(a){return"function"==typeof a}function e(a){return"number"==typeof a}function f(a){return"object"==typeof a&&null!==a}function g(a){return void 0===a}b.exports=c,c.EventEmitter=c,c.prototype._events=void 0,c.prototype._maxListeners=void 0,c.defaultMaxListeners=10,c.prototype.setMaxListeners=function(a){if(!e(a)||0>a||isNaN(a))throw TypeError("n must be a positive number");return this._maxListeners=a,this},c.prototype.emit=function(a){var b,c,e,h,i,j;if(this._events||(this._events={}),"error"===a&&(!this._events.error||f(this._events.error)&&!this._events.error.length))throw b=arguments[1],b instanceof Error?b:TypeError('Uncaught, unspecified "error" event.');if(c=this._events[a],g(c))return!1;if(d(c))switch(arguments.length){case 1:c.call(this);break;case 2:c.call(this,arguments[1]);break;case 3:c.call(this,arguments[1],arguments[2]);break;default:for(e=arguments.length,h=new Array(e-1),i=1;e>i;i++)h[i-1]=arguments[i];c.apply(this,h)}else if(f(c)){for(e=arguments.length,h=new Array(e-1),i=1;e>i;i++)h[i-1]=arguments[i];for(j=c.slice(),e=j.length,i=0;e>i;i++)j[i].apply(this,h)}return!0},c.prototype.addListener=function(a,b){var e;if(!d(b))throw TypeError("listener must be a function");if(this._events||(this._events={}),this._events.newListener&&this.emit("newListener",a,d(b.listener)?b.listener:b),this._events[a]?f(this._events[a])?this._events[a].push(b):this._events[a]=[this._events[a],b]:this._events[a]=b,f(this._events[a])&&!this._events[a].warned){var e;e=g(this._maxListeners)?c.defaultMaxListeners:this._maxListeners,e&&e>0&&this._events[a].length>e&&(this._events[a].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[a].length),console.trace())}return this},c.prototype.on=c.prototype.addListener,c.prototype.once=function(a,b){function c(){this.removeListener(a,c),e||(e=!0,b.apply(this,arguments))}if(!d(b))throw TypeError("listener must be a function");var e=!1;return c.listener=b,this.on(a,c),this},c.prototype.removeListener=function(a,b){var c,e,g,h;if(!d(b))throw TypeError("listener must be a function");if(!this._events||!this._events[a])return this;if(c=this._events[a],g=c.length,e=-1,c===b||d(c.listener)&&c.listener===b)delete this._events[a],this._events.removeListener&&this.emit("removeListener",a,b);else if(f(c)){for(h=g;h-->0;)if(c[h]===b||c[h].listener&&c[h].listener===b){e=h;break}if(0>e)return this;1===c.length?(c.length=0,delete this._events[a]):c.splice(e,1),this._events.removeListener&&this.emit("removeListener",a,b)}return this},c.prototype.removeAllListeners=function(a){var b,c;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[a]&&delete this._events[a],this;if(0===arguments.length){for(b in this._events)"removeListener"!==b&&this.removeAllListeners(b);return this.removeAllListeners("removeListener"),this._events={},this}if(c=this._events[a],d(c))this.removeListener(a,c);else for(;c.length;)this.removeListener(a,c[c.length-1]);return delete this._events[a],this},c.prototype.listeners=function(a){var b;return b=this._events&&this._events[a]?d(this._events[a])?[this._events[a]]:this._events[a].slice():[]},c.listenerCount=function(a,b){var c;return c=a._events&&a._events[b]?d(a._events[b])?1:a._events[b].length:0}},{}],10:[function(a,b){var c=b.exports={};c.nextTick=function(){var a="undefined"!=typeof window&&window.setImmediate,b="undefined"!=typeof window&&window.postMessage&&window.addEventListener;if(a)return function(a){return window.setImmediate(a)};if(b){var c=[];return window.addEventListener("message",function(a){var b=a.source;if((b===window||null===b)&&"process-tick"===a.data&&(a.stopPropagation(),c.length>0)){var d=c.shift();d()}},!0),function(a){c.push(a),window.postMessage("process-tick","*")}}return function(a){setTimeout(a,0)}}(),c.title="browser",c.browser=!0,c.env={},c.argv=[],c.binding=function(){throw new Error("process.binding is not supported")},c.cwd=function(){return"/"},c.chdir=function(){throw new Error("process.chdir is not supported")}},{}],11:[function(a,b){function c(a){return this instanceof c?(g.call(this,a),h.call(this,a),a&&a.readable===!1&&(this.readable=!1),a&&a.writable===!1&&(this.writable=!1),this.allowHalfOpen=!0,a&&a.allowHalfOpen===!1&&(this.allowHalfOpen=!1),void this.once("end",d)):new c(a)}function d(){if(!this.allowHalfOpen&&!this._writableState.ended){var a=this;f(function(){a.end()})}}b.exports=c;var e=a("inherits"),f=a("process/browser.js").nextTick,g=a("./readable.js"),h=a("./writable.js");e(c,g),c.prototype.write=h.prototype.write,c.prototype.end=h.prototype.end,c.prototype._write=h.prototype._write},{"./readable.js":15,"./writable.js":17,inherits:19,"process/browser.js":13}],12:[function(a,b){function c(){d.call(this)}b.exports=c;var d=a("events").EventEmitter,e=a("inherits");e(c,d),c.Readable=a("./readable.js"),c.Writable=a("./writable.js"),c.Duplex=a("./duplex.js"),c.Transform=a("./transform.js"),c.PassThrough=a("./passthrough.js"),c.Stream=c,c.prototype.pipe=function(a,b){function c(b){a.writable&&!1===a.write(b)&&j.pause&&j.pause()
  35. }function e(){j.readable&&j.resume&&j.resume()}function f(){k||(k=!0,a.end())}function g(){k||(k=!0,"function"==typeof a.destroy&&a.destroy())}function h(a){if(i(),0===d.listenerCount(this,"error"))throw a}function i(){j.removeListener("data",c),a.removeListener("drain",e),j.removeListener("end",f),j.removeListener("close",g),j.removeListener("error",h),a.removeListener("error",h),j.removeListener("end",i),j.removeListener("close",i),a.removeListener("close",i)}var j=this;j.on("data",c),a.on("drain",e),a._isStdio||b&&b.end===!1||(j.on("end",f),j.on("close",g));var k=!1;return j.on("error",h),a.on("error",h),j.on("end",i),j.on("close",i),a.on("close",i),a.emit("pipe",j),a}},{"./duplex.js":11,"./passthrough.js":14,"./readable.js":15,"./transform.js":16,"./writable.js":17,events:9,inherits:19}],13:[function(a,b){b.exports=a(10)},{}],14:[function(a,b){function c(a){return this instanceof c?void d.call(this,a):new c(a)}b.exports=c;var d=a("./transform.js"),e=a("inherits");e(c,d),c.prototype._transform=function(a,b,c){c(null,a)}},{"./transform.js":16,inherits:19}],15:[function(a,b){(function(c){function d(b){b=b||{};var c=b.highWaterMark;this.highWaterMark=c||0===c?c: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=!!b.objectMode,this.defaultEncoding=b.defaultEncoding||"utf8",this.ranOut=!1,this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,b.encoding&&(x||(x=a("string_decoder").StringDecoder),this.decoder=new x(b.encoding),this.encoding=b.encoding)}function e(a){return this instanceof e?(this._readableState=new d(a,this),this.readable=!0,void z.call(this)):new e(a)}function f(a,b,c,d,e){var f=j(b,c);if(f)a.emit("error",f);else if(null===c||void 0===c)b.reading=!1,b.ended||k(a,b);else if(b.objectMode||c&&c.length>0)if(b.ended&&!e){var h=new Error("stream.push() after EOF");a.emit("error",h)}else if(b.endEmitted&&e){var h=new Error("stream.unshift() after end event");a.emit("error",h)}else!b.decoder||e||d||(c=b.decoder.write(c)),b.length+=b.objectMode?1:c.length,e?b.buffer.unshift(c):(b.reading=!1,b.buffer.push(c)),b.needReadable&&l(a),n(a,b);else e||(b.reading=!1);return g(b)}function g(a){return!a.ended&&(a.needReadable||a.length<a.highWaterMark||0===a.length)}function h(a){if(a>=D)a=D;else{a--;for(var b=1;32>b;b<<=1)a|=a>>b;a++}return a}function i(a,b){return 0===b.length&&b.ended?0:b.objectMode?0===a?0:1:isNaN(a)||null===a?b.flowing&&b.buffer.length?b.buffer[0].length:b.length:0>=a?0:(a>b.highWaterMark&&(b.highWaterMark=h(a)),a>b.length?b.ended?b.length:(b.needReadable=!0,0):a)}function j(a,b){var c=null;return A.isBuffer(b)||"string"==typeof b||null===b||void 0===b||a.objectMode||c||(c=new TypeError("Invalid non-string/buffer chunk")),c}function k(a,b){if(b.decoder&&!b.ended){var c=b.decoder.end();c&&c.length&&(b.buffer.push(c),b.length+=b.objectMode?1:c.length)}b.ended=!0,b.length>0?l(a):u(a)}function l(a){var b=a._readableState;b.needReadable=!1,b.emittedReadable||(b.emittedReadable=!0,b.sync?B(function(){m(a)}):m(a))}function m(a){a.emit("readable")}function n(a,b){b.readingMore||(b.readingMore=!0,B(function(){o(a,b)}))}function o(a,b){for(var c=b.length;!b.reading&&!b.flowing&&!b.ended&&b.length<b.highWaterMark&&(a.read(0),c!==b.length);)c=b.length;b.readingMore=!1}function p(a){return function(){var b=a._readableState;b.awaitDrain--,0===b.awaitDrain&&q(a)}}function q(a){function b(a){var b=a.write(c);!1===b&&d.awaitDrain++}var c,d=a._readableState;for(d.awaitDrain=0;d.pipesCount&&null!==(c=a.read());)if(1===d.pipesCount?b(d.pipes,0,null):v(d.pipes,b),a.emit("data",c),d.awaitDrain>0)return;return 0===d.pipesCount?(d.flowing=!1,void(y.listenerCount(a,"data")>0&&s(a))):void(d.ranOut=!0)}function r(){this._readableState.ranOut&&(this._readableState.ranOut=!1,q(this))}function s(a,b){var c=a._readableState;if(c.flowing)throw new Error("Cannot switch to old mode now.");var d=b||!1,e=!1;a.readable=!0,a.pipe=z.prototype.pipe,a.on=a.addListener=z.prototype.on,a.on("readable",function(){e=!0;for(var b;!d&&null!==(b=a.read());)a.emit("data",b);null===b&&(e=!1,a._readableState.needReadable=!0)}),a.pause=function(){d=!0,this.emit("pause")},a.resume=function(){d=!1,e?B(function(){a.emit("readable")}):this.read(0),this.emit("resume")},a.emit("readable")}function t(a,b){var c,d=b.buffer,e=b.length,f=!!b.decoder,g=!!b.objectMode;if(0===d.length)return null;if(0===e)c=null;else if(g)c=d.shift();else if(!a||a>=e)c=f?d.join(""):A.concat(d,e),d.length=0;else if(a<d[0].length){var h=d[0];c=h.slice(0,a),d[0]=h.slice(a)}else if(a===d[0].length)c=d.shift();else{c=f?"":new A(a);for(var i=0,j=0,k=d.length;k>j&&a>i;j++){var h=d[0],l=Math.min(a-i,h.length);f?c+=h.slice(0,l):h.copy(c,i,0,l),l<h.length?d[0]=h.slice(l):d.shift(),i+=l}}return c}function u(a){var b=a._readableState;if(b.length>0)throw new Error("endReadable called on non-empty stream");!b.endEmitted&&b.calledRead&&(b.ended=!0,B(function(){b.endEmitted||0!==b.length||(b.endEmitted=!0,a.readable=!1,a.emit("end"))}))}function v(a,b){for(var c=0,d=a.length;d>c;c++)b(a[c],c)}function w(a,b){for(var c=0,d=a.length;d>c;c++)if(a[c]===b)return c;return-1}b.exports=e,e.ReadableState=d;var x,y=a("events").EventEmitter,z=a("./index.js"),A=a("buffer").Buffer,B=a("process/browser.js").nextTick,C=a("inherits");C(e,z),e.prototype.push=function(a,b){var c=this._readableState;return"string"!=typeof a||c.objectMode||(b=b||c.defaultEncoding,b!==c.encoding&&(a=new A(a,b),b="")),f(this,c,a,b,!1)},e.prototype.unshift=function(a){var b=this._readableState;return f(this,b,a,"",!0)},e.prototype.setEncoding=function(b){x||(x=a("string_decoder").StringDecoder),this._readableState.decoder=new x(b),this._readableState.encoding=b};var D=8388608;e.prototype.read=function(a){var b=this._readableState;b.calledRead=!0;var c=a;if(("number"!=typeof a||a>0)&&(b.emittedReadable=!1),0===a&&b.needReadable&&(b.length>=b.highWaterMark||b.ended))return l(this),null;if(a=i(a,b),0===a&&b.ended)return 0===b.length&&u(this),null;var d=b.needReadable;b.length-a<=b.highWaterMark&&(d=!0),(b.ended||b.reading)&&(d=!1),d&&(b.reading=!0,b.sync=!0,0===b.length&&(b.needReadable=!0),this._read(b.highWaterMark),b.sync=!1),d&&!b.reading&&(a=i(c,b));var e;return e=a>0?t(a,b):null,null===e&&(b.needReadable=!0,a=0),b.length-=a,0!==b.length||b.ended||(b.needReadable=!0),b.ended&&!b.endEmitted&&0===b.length&&u(this),e},e.prototype._read=function(){this.emit("error",new Error("not implemented"))},e.prototype.pipe=function(a,b){function d(a){a===k&&f()}function e(){a.end()}function f(){a.removeListener("close",h),a.removeListener("finish",i),a.removeListener("drain",o),a.removeListener("error",g),a.removeListener("unpipe",d),k.removeListener("end",e),k.removeListener("end",f),(!a._writableState||a._writableState.needDrain)&&o()}function g(b){j(),0===s&&0===y.listenerCount(a,"error")&&a.emit("error",b)}function h(){a.removeListener("finish",i),j()}function i(){a.removeListener("close",h),j()}function j(){k.unpipe(a)}var k=this,l=this._readableState;switch(l.pipesCount){case 0:l.pipes=a;break;case 1:l.pipes=[l.pipes,a];break;default:l.pipes.push(a)}l.pipesCount+=1;var m=(!b||b.end!==!1)&&a!==c.stdout&&a!==c.stderr,n=m?e:f;l.endEmitted?B(n):k.once("end",n),a.on("unpipe",d);var o=p(k);a.on("drain",o);var s=y.listenerCount(a,"error");return a.once("error",g),a.once("close",h),a.once("finish",i),a.emit("pipe",k),l.flowing||(this.on("readable",r),l.flowing=!0,B(function(){q(k)})),a},e.prototype.unpipe=function(a){var b=this._readableState;if(0===b.pipesCount)return this;if(1===b.pipesCount)return a&&a!==b.pipes?this:(a||(a=b.pipes),b.pipes=null,b.pipesCount=0,this.removeListener("readable",r),b.flowing=!1,a&&a.emit("unpipe",this),this);if(!a){var c=b.pipes,d=b.pipesCount;b.pipes=null,b.pipesCount=0,this.removeListener("readable",r),b.flowing=!1;for(var e=0;d>e;e++)c[e].emit("unpipe",this);return this}var e=w(b.pipes,a);return-1===e?this:(b.pipes.splice(e,1),b.pipesCount-=1,1===b.pipesCount&&(b.pipes=b.pipes[0]),a.emit("unpipe",this),this)},e.prototype.on=function(a,b){var c=z.prototype.on.call(this,a,b);if("data"!==a||this._readableState.flowing||s(this),"readable"===a&&this.readable){var d=this._readableState;d.readableListening||(d.readableListening=!0,d.emittedReadable=!1,d.needReadable=!0,d.reading?d.length&&l(this,d):this.read(0))}return c},e.prototype.addListener=e.prototype.on,e.prototype.resume=function(){s(this),this.read(0),this.emit("resume")},e.prototype.pause=function(){s(this,!0),this.emit("pause")},e.prototype.wrap=function(a){var b=this._readableState,c=!1,d=this;a.on("end",function(){if(b.decoder&&!b.ended){var a=b.decoder.end();a&&a.length&&d.push(a)}d.push(null)}),a.on("data",function(e){if(b.decoder&&(e=b.decoder.write(e)),e&&(b.objectMode||e.length)){var f=d.push(e);f||(c=!0,a.pause())}});for(var e in a)"function"==typeof a[e]&&"undefined"==typeof this[e]&&(this[e]=function(b){return function(){return a[b].apply(a,arguments)}}(e));var f=["error","close","destroy","pause","resume"];return v(f,function(b){a.on(b,function(a){return d.emit.apply(d,b,a)})}),d._read=function(){c&&(c=!1,a.resume())},d},e._fromList=t}).call(this,a("/Users/harth/repos/brain/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"))},{"./index.js":12,"/Users/harth/repos/brain/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":10,buffer:6,events:9,inherits:19,"process/browser.js":13,string_decoder:18}],16:[function(a,b){function c(a,b){this.afterTransform=function(a,c){return d(b,a,c)},this.needTransform=!1,this.transforming=!1,this.writecb=null,this.writechunk=null}function d(a,b,c){var d=a._transformState;d.transforming=!1;var e=d.writecb;if(!e)return a.emit("error",new Error("no writecb in Transform class"));d.writechunk=null,d.writecb=null,null!==c&&void 0!==c&&a.push(c),e&&e(b);var f=a._readableState;f.reading=!1,(f.needReadable||f.length<f.highWaterMark)&&a._read(f.highWaterMark)}function e(a){if(!(this instanceof e))return new e(a);g.call(this,a);var b=(this._transformState=new c(a,this),this);this._readableState.needReadable=!0,this._readableState.sync=!1,this.once("finish",function(){"function"==typeof this._flush?this._flush(function(a){f(b,a)}):f(b)})}function f(a,b){if(b)return a.emit("error",b);var c=a._writableState,d=(a._readableState,a._transformState);if(c.length)throw new Error("calling transform done when ws.length != 0");if(d.transforming)throw new Error("calling transform done when still transforming");return a.push(null)}b.exports=e;var g=a("./duplex.js"),h=a("inherits");h(e,g),e.prototype.push=function(a,b){return this._transformState.needTransform=!1,g.prototype.push.call(this,a,b)},e.prototype._transform=function(){throw new Error("not implemented")},e.prototype._write=function(a,b,c){var d=this._transformState;if(d.writecb=c,d.writechunk=a,d.writeencoding=b,!d.transforming){var e=this._readableState;(d.needTransform||e.needReadable||e.length<e.highWaterMark)&&this._read(e.highWaterMark)}},e.prototype._read=function(){var a=this._transformState;a.writechunk&&a.writecb&&!a.transforming?(a.transforming=!0,this._transform(a.writechunk,a.writeencoding,a.afterTransform)):a.needTransform=!0}},{"./duplex.js":11,inherits:19}],17:[function(a,b){function c(a,b,c){this.chunk=a,this.encoding=b,this.callback=c}function d(a,b){a=a||{};var c=a.highWaterMark;this.highWaterMark=c||0===c?c:16384,this.objectMode=!!a.objectMode,this.highWaterMark=~~this.highWaterMark,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1;var d=a.decodeStrings===!1;this.decodeStrings=!d,this.defaultEncoding=a.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(a){m(b,a)},this.writecb=null,this.writelen=0,this.buffer=[]}function e(a){return this instanceof e||this instanceof w.Duplex?(this._writableState=new d(a,this),this.writable=!0,void w.call(this)):new e(a)}function f(a,b,c){var d=new Error("write after end");a.emit("error",d),x(function(){c(d)})}function g(a,b,c,d){var e=!0;if(!y.isBuffer(c)&&"string"!=typeof c&&null!==c&&void 0!==c&&!b.objectMode){var f=new TypeError("Invalid non-string/buffer chunk");a.emit("error",f),x(function(){d(f)}),e=!1}return e}function h(a,b,c){return a.objectMode||a.decodeStrings===!1||"string"!=typeof b||(b=new y(b,c)),b}function i(a,b,d,e,f){d=h(b,d,e);var g=b.objectMode?1:d.length;b.length+=g;var i=b.length<b.highWaterMark;return b.needDrain=!i,b.writing?b.buffer.push(new c(d,e,f)):j(a,b,g,d,e,f),i}function j(a,b,c,d,e,f){b.writelen=c,b.writecb=f,b.writing=!0,b.sync=!0,a._write(d,e,b.onwrite),b.sync=!1}function k(a,b,c,d,e){c?x(function(){e(d)}):e(d),a.emit("error",d)}function l(a){a.writing=!1,a.writecb=null,a.length-=a.writelen,a.writelen=0}function m(a,b){var c=a._writableState,d=c.sync,e=c.writecb;if(l(c),b)k(a,c,d,b,e);else{var f=q(a,c);f||c.bufferProcessing||!c.buffer.length||p(a,c),d?x(function(){n(a,c,f,e)}):n(a,c,f,e)}}function n(a,b,c,d){c||o(a,b),d(),c&&r(a,b)}function o(a,b){0===b.length&&b.needDrain&&(b.needDrain=!1,a.emit("drain"))}function p(a,b){b.bufferProcessing=!0;for(var c=0;c<b.buffer.length;c++){var d=b.buffer[c],e=d.chunk,f=d.encoding,g=d.callback,h=b.objectMode?1:e.length;if(j(a,b,h,e,f,g),b.writing){c++;break}}b.bufferProcessing=!1,c<b.buffer.length?b.buffer=b.buffer.slice(c):b.buffer.length=0}function q(a,b){return b.ending&&0===b.length&&!b.finished&&!b.writing}function r(a,b){var c=q(a,b);return c&&(b.finished=!0,a.emit("finish")),c}function s(a,b,c){b.ending=!0,r(a,b),c&&(b.finished?x(c):a.once("finish",c)),b.ended=!0}b.exports=e,e.WritableState=d;var t="undefined"!=typeof Uint8Array?function(a){return a instanceof Uint8Array}:function(a){return a&&a.constructor&&"Uint8Array"===a.constructor.name},u="undefined"!=typeof ArrayBuffer?function(a){return a instanceof ArrayBuffer}:function(a){return a&&a.constructor&&"ArrayBuffer"===a.constructor.name},v=a("inherits"),w=a("./index.js"),x=a("process/browser.js").nextTick,y=a("buffer").Buffer;v(e,w),e.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe. Not readable."))},e.prototype.write=function(a,b,c){var d=this._writableState,e=!1;return"function"==typeof b&&(c=b,b=null),!y.isBuffer(a)&&t(a)&&(a=new y(a)),u(a)&&"undefined"!=typeof Uint8Array&&(a=new y(new Uint8Array(a))),y.isBuffer(a)?b="buffer":b||(b=d.defaultEncoding),"function"!=typeof c&&(c=function(){}),d.ended?f(this,d,c):g(this,d,a,c)&&(e=i(this,d,a,b,c)),e},e.prototype._write=function(a,b,c){c(new Error("not implemented"))},e.prototype.end=function(a,b,c){var d=this._writableState;"function"==typeof a?(c=a,a=null,b=null):"function"==typeof b&&(c=b,b=null),"undefined"!=typeof a&&null!==a&&this.write(a,b),d.ending||d.finished||s(this,d,c)}},{"./index.js":12,buffer:6,inherits:19,"process/browser.js":13}],18:[function(a,b,c){function d(a){if(a&&!h.isEncoding(a))throw new Error("Unknown encoding: "+a)}function e(a){return a.toString(this.encoding)}function f(a){var b=this.charReceived=a.length%2;return this.charLength=b?2:0,b}function g(a){var b=this.charReceived=a.length%3;return this.charLength=b?3:0,b}var h=a("buffer").Buffer,i=c.StringDecoder=function(a){switch(this.encoding=(a||"utf8").toLowerCase().replace(/[-_]/,""),d(a),this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2,this.detectIncompleteChar=f;break;case"base64":this.surrogateSize=3,this.detectIncompleteChar=g;break;default:return void(this.write=e)}this.charBuffer=new h(6),this.charReceived=0,this.charLength=0};i.prototype.write=function(a){for(var b="",c=0;this.charLength;){var d=a.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:a.length;if(a.copy(this.charBuffer,this.charReceived,c,d),this.charReceived+=d-c,c=d,this.charReceived<this.charLength)return"";b=this.charBuffer.slice(0,this.charLength).toString(this.encoding);var e=b.charCodeAt(b.length-1);if(!(e>=55296&&56319>=e)){if(this.charReceived=this.charLength=0,d==a.length)return b;a=a.slice(d,a.length);break}this.charLength+=this.surrogateSize,b=""}var f=this.detectIncompleteChar(a),g=a.length;this.charLength&&(a.copy(this.charBuffer,0,a.length-f,g),this.charReceived=f,g-=f),b+=a.toString(this.encoding,0,g);var g=b.length-1,e=b.charCodeAt(g);if(e>=55296&&56319>=e){var h=this.surrogateSize;return this.charLength+=h,this.charReceived+=h,this.charBuffer.copy(this.charBuffer,h,0,h),this.charBuffer.write(b.charAt(b.length-1),this.encoding),b.substring(0,g)}return b},i.prototype.detectIncompleteChar=function(a){for(var b=a.length>=3?3:a.length;b>0;b--){var c=a[a.length-b];if(1==b&&c>>5==6){this.charLength=2;break}if(2>=b&&c>>4==14){this.charLength=3;break}if(3>=b&&c>>3==30){this.charLength=4;break}}return b},i.prototype.end=function(a){var b="";if(a&&a.length&&(b=this.write(a)),this.charReceived){var c=this.charReceived,d=this.charBuffer,e=this.encoding;b+=d.slice(0,c).toString(e)}return b}},{buffer:6}],19:[function(a,b){b.exports="function"==typeof Object.create?function(a,b){a.super_=b,a.prototype=Object.create(b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}})}:function(a,b){a.super_=b;var c=function(){};c.prototype=b.prototype,a.prototype=new c,a.prototype.constructor=a}},{}],20:[function(a,b,c){(function(){var a=this,d=a._,e={},f=Array.prototype,g=Object.prototype,h=Function.prototype,i=f.push,j=f.slice,k=f.concat,l=g.toString,m=g.hasOwnProperty,n=f.forEach,o=f.map,p=f.reduce,q=f.reduceRight,r=f.filter,s=f.every,t=f.some,u=f.indexOf,v=f.lastIndexOf,w=Array.isArray,x=Object.keys,y=h.bind,z=function(a){return a instanceof z?a:this instanceof z?void(this._wrapped=a):new z(a)};"undefined"!=typeof c?("undefined"!=typeof b&&b.exports&&(c=b.exports=z),c._=z):a._=z,z.VERSION="1.6.0";var A=z.each=z.forEach=function(a,b,c){if(null==a)return a;if(n&&a.forEach===n)a.forEach(b,c);else if(a.length===+a.length){for(var d=0,f=a.length;f>d;d++)if(b.call(c,a[d],d,a)===e)return}else for(var g=z.keys(a),d=0,f=g.length;f>d;d++)if(b.call(c,a[g[d]],g[d],a)===e)return;return a};z.map=z.collect=function(a,b,c){var d=[];return null==a?d:o&&a.map===o?a.map(b,c):(A(a,function(a,e,f){d.push(b.call(c,a,e,f))}),d)};var B="Reduce of empty array with no initial value";z.reduce=z.foldl=z.inject=function(a,b,c,d){var e=arguments.length>2;if(null==a&&(a=[]),p&&a.reduce===p)return d&&(b=z.bind(b,d)),e?a.reduce(b,c):a.reduce(b);if(A(a,function(a,f,g){e?c=b.call(d,c,a,f,g):(c=a,e=!0)}),!e)throw new TypeError(B);return c},z.reduceRight=z.foldr=function(a,b,c,d){var e=arguments.length>2;if(null==a&&(a=[]),q&&a.reduceRight===q)return d&&(b=z.bind(b,d)),e?a.reduceRight(b,c):a.reduceRight(b);var f=a.length;if(f!==+f){var g=z.keys(a);f=g.length}if(A(a,function(h,i,j){i=g?g[--f]:--f,e?c=b.call(d,c,a[i],i,j):(c=a[i],e=!0)}),!e)throw new TypeError(B);return c},z.find=z.detect=function(a,b,c){var d;return C(a,function(a,e,f){return b.call(c,a,e,f)?(d=a,!0):void 0}),d},z.filter=z.select=function(a,b,c){var d=[];return null==a?d:r&&a.filter===r?a.filter(b,c):(A(a,function(a,e,f){b.call(c,a,e,f)&&d.push(a)}),d)},z.reject=function(a,b,c){return z.filter(a,function(a,d,e){return!b.call(c,a,d,e)},c)},z.every=z.all=function(a,b,c){b||(b=z.identity);var d=!0;return null==a?d:s&&a.every===s?a.every(b,c):(A(a,function(a,f,g){return(d=d&&b.call(c,a,f,g))?void 0:e}),!!d)};var C=z.some=z.any=function(a,b,c){b||(b=z.identity);var d=!1;return null==a?d:t&&a.some===t?a.some(b,c):(A(a,function(a,f,g){return d||(d=b.call(c,a,f,g))?e:void 0}),!!d)};z.contains=z.include=function(a,b){return null==a?!1:u&&a.indexOf===u?-1!=a.indexOf(b):C(a,function(a){return a===b})},z.invoke=function(a,b){var c=j.call(arguments,2),d=z.isFunction(b);return z.map(a,function(a){return(d?b:a[b]).apply(a,c)})},z.pluck=function(a,b){return z.map(a,z.property(b))},z.where=function(a,b){return z.filter(a,z.matches(b))},z.findWhere=function(a,b){return z.find(a,z.matches(b))},z.max=function(a,b,c){if(!b&&z.isArray(a)&&a[0]===+a[0]&&a.length<65535)return Math.max.apply(Math,a);var d=-1/0,e=-1/0;return A(a,function(a,f,g){var h=b?b.call(c,a,f,g):a;h>e&&(d=a,e=h)}),d},z.min=function(a,b,c){if(!b&&z.isArray(a)&&a[0]===+a[0]&&a.length<65535)return Math.min.apply(Math,a);var d=1/0,e=1/0;return A(a,function(a,f,g){var h=b?b.call(c,a,f,g):a;e>h&&(d=a,e=h)}),d},z.shuffle=function(a){var b,c=0,d=[];return A(a,function(a){b=z.random(c++),d[c-1]=d[b],d[b]=a}),d},z.sample=function(a,b,c){return null==b||c?(a.length!==+a.length&&(a=z.values(a)),a[z.random(a.length-1)]):z.shuffle(a).slice(0,Math.max(0,b))};var D=function(a){return null==a?z.identity:z.isFunction(a)?a:z.property(a)};z.sortBy=function(a,b,c){return b=D(b),z.pluck(z.map(a,function(a,d,e){return{value:a,index:d,criteria:b.call(c,a,d,e)}}).sort(function(a,b){var c=a.criteria,d=b.criteria;if(c!==d){if(c>d||void 0===c)return 1;if(d>c||void 0===d)return-1}return a.index-b.index}),"value")};var E=function(a){return function(b,c,d){var e={};return c=D(c),A(b,function(f,g){var h=c.call(d,f,g,b);a(e,h,f)}),e}};z.groupBy=E(function(a,b,c){z.has(a,b)?a[b].push(c):a[b]=[c]}),z.indexBy=E(function(a,b,c){a[b]=c}),z.countBy=E(function(a,b){z.has(a,b)?a[b]++:a[b]=1}),z.sortedIndex=function(a,b,c,d){c=D(c);for(var e=c.call(d,b),f=0,g=a.length;g>f;){var h=f+g>>>1;c.call(d,a[h])<e?f=h+1:g=h}return f},z.toArray=function(a){return a?z.isArray(a)?j.call(a):a.length===+a.length?z.map(a,z.identity):z.values(a):[]},z.size=function(a){return null==a?0:a.length===+a.length?a.length:z.keys(a).length},z.first=z.head=z.take=function(a,b,c){return null==a?void 0:null==b||c?a[0]:0>b?[]:j.call(a,0,b)},z.initial=function(a,b,c){return j.call(a,0,a.length-(null==b||c?1:b))},z.last=function(a,b,c){return null==a?void 0:null==b||c?a[a.length-1]:j.call(a,Math.max(a.length-b,0))},z.rest=z.tail=z.drop=function(a,b,c){return j.call(a,null==b||c?1:b)},z.compact=function(a){return z.filter(a,z.identity)};var F=function(a,b,c){return b&&z.every(a,z.isArray)?k.apply(c,a):(A(a,function(a){z.isArray(a)||z.isArguments(a)?b?i.apply(c,a):F(a,b,c):c.push(a)}),c)};z.flatten=function(a,b){return F(a,b,[])},z.without=function(a){return z.difference(a,j.call(arguments,1))},z.partition=function(a,b){var c=[],d=[];return A(a,function(a){(b(a)?c:d).push(a)}),[c,d]},z.uniq=z.unique=function(a,b,c,d){z.isFunction(b)&&(d=c,c=b,b=!1);var e=c?z.map(a,c,d):a,f=[],g=[];return A(e,function(c,d){(b?d&&g[g.length-1]===c:z.contains(g,c))||(g.push(c),f.push(a[d]))}),f},z.union=function(){return z.uniq(z.flatten(arguments,!0))},z.intersection=function(a){var b=j.call(arguments,1);return z.filter(z.uniq(a),function(a){return z.every(b,function(b){return z.contains(b,a)})})},z.difference=function(a){var b=k.apply(f,j.call(arguments,1));return z.filter(a,function(a){return!z.contains(b,a)})},z.zip=function(){for(var a=z.max(z.pluck(arguments,"length").concat(0)),b=new Array(a),c=0;a>c;c++)b[c]=z.pluck(arguments,""+c);return b},z.object=function(a,b){if(null==a)return{};for(var c={},d=0,e=a.length;e>d;d++)b?c[a[d]]=b[d]:c[a[d][0]]=a[d][1];return c},z.indexOf=function(a,b,c){if(null==a)return-1;var d=0,e=a.length;if(c){if("number"!=typeof c)return d=z.sortedIndex(a,b),a[d]===b?d:-1;d=0>c?Math.max(0,e+c):c}if(u&&a.indexOf===u)return a.indexOf(b,c);for(;e>d;d++)if(a[d]===b)return d;return-1},z.lastIndexOf=function(a,b,c){if(null==a)return-1;var d=null!=c;if(v&&a.lastIndexOf===v)return d?a.lastIndexOf(b,c):a.lastIndexOf(b);for(var e=d?c:a.length;e--;)if(a[e]===b)return e;return-1},z.range=function(a,b,c){arguments.length<=1&&(b=a||0,a=0),c=arguments[2]||1;for(var d=Math.max(Math.ceil((b-a)/c),0),e=0,f=new Array(d);d>e;)f[e++]=a,a+=c;return f};var G=function(){};z.bind=function(a,b){var c,d;if(y&&a.bind===y)return y.apply(a,j.call(arguments,1));if(!z.isFunction(a))throw new TypeError;return c=j.call(arguments,2),d=function(){if(!(this instanceof d))return a.apply(b,c.concat(j.call(arguments)));G.prototype=a.prototype;var e=new G;G.prototype=null;var f=a.apply(e,c.concat(j.call(arguments)));return Object(f)===f?f:e}},z.partial=function(a){var b=j.call(arguments,1);return function(){for(var c=0,d=b.slice(),e=0,f=d.length;f>e;e++)d[e]===z&&(d[e]=arguments[c++]);for(;c<arguments.length;)d.push(arguments[c++]);return a.apply(this,d)}},z.bindAll=function(a){var b=j.call(arguments,1);if(0===b.length)throw new Error("bindAll must be passed function names");return A(b,function(b){a[b]=z.bind(a[b],a)}),a},z.memoize=function(a,b){var c={};return b||(b=z.identity),function(){var d=b.apply(this,arguments);return z.has(c,d)?c[d]:c[d]=a.apply(this,arguments)}},z.delay=function(a,b){var c=j.call(arguments,2);return setTimeout(function(){return a.apply(null,c)},b)},z.defer=function(a){return z.delay.apply(z,[a,1].concat(j.call(arguments,1)))},z.throttle=function(a,b,c){var d,e,f,g=null,h=0;c||(c={});var i=function(){h=c.leading===!1?0:z.now(),g=null,f=a.apply(d,e),d=e=null};return function(){var j=z.now();h||c.leading!==!1||(h=j);var k=b-(j-h);return d=this,e=arguments,0>=k?(clearTimeout(g),g=null,h=j,f=a.apply(d,e),d=e=null):g||c.trailing===!1||(g=setTimeout(i,k)),f}},z.debounce=function(a,b,c){var d,e,f,g,h,i=function(){var j=z.now()-g;b>j?d=setTimeout(i,b-j):(d=null,c||(h=a.apply(f,e),f=e=null))};return function(){f=this,e=arguments,g=z.now();var j=c&&!d;return d||(d=setTimeout(i,b)),j&&(h=a.apply(f,e),f=e=null),h}},z.once=function(a){var b,c=!1;return function(){return c?b:(c=!0,b=a.apply(this,arguments),a=null,b)}},z.wrap=function(a,b){return z.partial(b,a)},z.compose=function(){var a=arguments;return function(){for(var b=arguments,c=a.length-1;c>=0;c--)b=[a[c].apply(this,b)];return b[0]}},z.after=function(a,b){return function(){return--a<1?b.apply(this,arguments):void 0}},z.keys=function(a){if(!z.isObject(a))return[];if(x)return x(a);var b=[];for(var c in a)z.has(a,c)&&b.push(c);return b},z.values=function(a){for(var b=z.keys(a),c=b.length,d=new Array(c),e=0;c>e;e++)d[e]=a[b[e]];return d},z.pairs=function(a){for(var b=z.keys(a),c=b.length,d=new Array(c),e=0;c>e;e++)d[e]=[b[e],a[b[e]]];return d},z.invert=function(a){for(var b={},c=z.keys(a),d=0,e=c.length;e>d;d++)b[a[c[d]]]=c[d];return b},z.functions=z.methods=function(a){var b=[];for(var c in a)z.isFunction(a[c])&&b.push(c);return b.sort()},z.extend=function(a){return A(j.call(arguments,1),function(b){if(b)for(var c in b)a[c]=b[c]}),a},z.pick=function(a){var b={},c=k.apply(f,j.call(arguments,1));return A(c,function(c){c in a&&(b[c]=a[c])}),b},z.omit=function(a){var b={},c=k.apply(f,j.call(arguments,1));for(var d in a)z.contains(c,d)||(b[d]=a[d]);return b},z.defaults=function(a){return A(j.call(arguments,1),function(b){if(b)for(var c in b)void 0===a[c]&&(a[c]=b[c])}),a},z.clone=function(a){return z.isObject(a)?z.isArray(a)?a.slice():z.extend({},a):a},z.tap=function(a,b){return b(a),a};var H=function(a,b,c,d){if(a===b)return 0!==a||1/a==1/b;if(null==a||null==b)return a===b;a instanceof z&&(a=a._wrapped),b instanceof z&&(b=b._wrapped);var e=l.call(a);if(e!=l.call(b))return!1;switch(e){case"[object String]":return a==String(b);case"[object Number]":return a!=+a?b!=+b:0==a?1/a==1/b:a==+b;case"[object Date]":case"[object Boolean]":return+a==+b;case"[object RegExp]":return a.source==b.source&&a.global==b.global&&a.multiline==b.multiline&&a.ignoreCase==b.ignoreCase}if("object"!=typeof a||"object"!=typeof b)return!1;for(var f=c.length;f--;)if(c[f]==a)return d[f]==b;var g=a.constructor,h=b.constructor;if(g!==h&&!(z.isFunction(g)&&g instanceof g&&z.isFunction(h)&&h instanceof h)&&"constructor"in a&&"constructor"in b)return!1;c.push(a),d.push(b);var i=0,j=!0;if("[object Array]"==e){if(i=a.length,j=i==b.length)for(;i--&&(j=H(a[i],b[i],c,d)););}else{for(var k in a)if(z.has(a,k)&&(i++,!(j=z.has(b,k)&&H(a[k],b[k],c,d))))break;if(j){for(k in b)if(z.has(b,k)&&!i--)break;j=!i}}return c.pop(),d.pop(),j};z.isEqual=function(a,b){return H(a,b,[],[])},z.isEmpty=function(a){if(null==a)return!0;if(z.isArray(a)||z.isString(a))return 0===a.length;for(var b in a)if(z.has(a,b))return!1;return!0},z.isElement=function(a){return!(!a||1!==a.nodeType)},z.isArray=w||function(a){return"[object Array]"==l.call(a)},z.isObject=function(a){return a===Object(a)},A(["Arguments","Function","String","Number","Date","RegExp"],function(a){z["is"+a]=function(b){return l.call(b)=="[object "+a+"]"}}),z.isArguments(arguments)||(z.isArguments=function(a){return!(!a||!z.has(a,"callee"))}),"function"!=typeof/./&&(z.isFunction=function(a){return"function"==typeof a}),z.isFinite=function(a){return isFinite(a)&&!isNaN(parseFloat(a))},z.isNaN=function(a){return z.isNumber(a)&&a!=+a},z.isBoolean=function(a){return a===!0||a===!1||"[object Boolean]"==l.call(a)},z.isNull=function(a){return null===a},z.isUndefined=function(a){return void 0===a},z.has=function(a,b){return m.call(a,b)},z.noConflict=function(){return a._=d,this},z.identity=function(a){return a},z.constant=function(a){return function(){return a}},z.property=function(a){return function(b){return b[a]}},z.matches=function(a){return function(b){if(b===a)return!0;for(var c in a)if(a[c]!==b[c])return!1;return!0}},z.times=function(a,b,c){for(var d=Array(Math.max(0,a)),e=0;a>e;e++)d[e]=b.call(c,e);return d},z.random=function(a,b){return null==b&&(b=a,a=0),a+Math.floor(Math.random()*(b-a+1))},z.now=Date.now||function(){return(new Date).getTime()};var I={escape:{"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;"}};I.unescape=z.invert(I.escape);var J={escape:new RegExp("["+z.keys(I.escape).join("")+"]","g"),unescape:new RegExp("("+z.keys(I.unescape).join("|")+")","g")};z.each(["escape","unescape"],function(a){z[a]=function(b){return null==b?"":(""+b).replace(J[a],function(b){return I[a][b]})}}),z.result=function(a,b){if(null==a)return void 0;var c=a[b];return z.isFunction(c)?c.call(a):c},z.mixin=function(a){A(z.functions(a),function(b){var c=z[b]=a[b];z.prototype[b]=function(){var a=[this._wrapped];return i.apply(a,arguments),O.call(this,c.apply(z,a))}})};var K=0;z.uniqueId=function(a){var b=++K+"";return a?a+b:b},z.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var L=/(.)^/,M={"'":"'","\\":"\\","\r":"r","\n":"n"," ":"t","\u2028":"u2028","\u2029":"u2029"},N=/\\|'|\r|\n|\t|\u2028|\u2029/g;z.template=function(a,b,c){var d;c=z.defaults({},c,z.templateSettings);var e=new RegExp([(c.escape||L).source,(c.interpolate||L).source,(c.evaluate||L).source].join("|")+"|$","g"),f=0,g="__p+='";a.replace(e,function(b,c,d,e,h){return g+=a.slice(f,h).replace(N,function(a){return"\\"+M[a]}),c&&(g+="'+\n((__t=("+c+"))==null?'':_.escape(__t))+\n'"),d&&(g+="'+\n((__t=("+d+"))==null?'':__t)+\n'"),e&&(g+="';\n"+e+"\n__p+='"),f=h+b.length,b}),g+="';\n",c.variable||(g="with(obj||{}){\n"+g+"}\n"),g="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+g+"return __p;\n";try{d=new Function(c.variable||"obj","_",g)}catch(h){throw h.source=g,h}if(b)return d(b,z);var i=function(a){return d.call(this,a,z)};return i.source="function("+(c.variable||"obj")+"){\n"+g+"}",i},z.chain=function(a){return z(a).chain()};var O=function(a){return this._chain?z(a).chain():a};z.mixin(z),A(["pop","push","reverse","shift","sort","splice","unshift"],function(a){var b=f[a];z.prototype[a]=function(){var c=this._wrapped;return b.apply(c,arguments),"shift"!=a&&"splice"!=a||0!==c.length||delete c[0],O.call(this,c)}}),A(["concat","join","slice"],function(a){var b=f[a];z.prototype[a]=function(){return O.call(this,b.apply(this._wrapped,arguments))}}),z.extend(z.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}}),"function"==typeof define&&define.amd&&define("underscore",[],function(){return z})}).call(this)},{}]},{},[1]);</script>
  36.  
  37.  
  38. <script>
  39. var timeArray = [];
  40. var inptArray = [];
  41. var i = 0;
  42. var target = "";
  43. var working = true;
  44. var count = false;
  45. var oldLength = 0;
  46. document.getElementById("text").select();
  47.  
  48. var neural = new brain.NeuralNetwork();
  49. neural.train([
  50.  
  51. //Meu padrão de digitação
  52. {input:{velocidadeDeDigitacaoEmSegundos: 0.208}, output: {souEu: 1}},
  53. {input:{velocidadeDeDigitacaoEmSegundos: 0.222}, output: {souEu: 1}},
  54. {input:{velocidadeDeDigitacaoEmSegundos: 0.228}, output: {souEu: 1}},
  55. {input:{velocidadeDeDigitacaoEmSegundos: 0.197}, output: {souEu: 1}},
  56. {input:{velocidadeDeDigitacaoEmSegundos: 0.093}, output: {souEu: 1}},
  57. {input:{velocidadeDeDigitacaoEmSegundos: 0.120}, output: {souEu: 1}},
  58. {input:{velocidadeDeDigitacaoEmSegundos: 0.09}, output: {souEu: 1}},
  59. {input:{velocidadeDeDigitacaoEmSegundos: 0.091}, output: {souEu: 1}},
  60.  
  61. //Pessoas que digitao relativamente devagar
  62. {input:{velocidadeDeDigitacaoEmSegundos: 0.378}, output: {naoSouEu: 1}},
  63. {input:{velocidadeDeDigitacaoEmSegundos: 0.300}, output: {naoSouEu: 1}},
  64. {input:{velocidadeDeDigitacaoEmSegundos: 0.280}, output: {naoSouEu: 1}},
  65. {input:{velocidadeDeDigitacaoEmSegundos: 0.320}, output: {naoSouEu: 1}},
  66. //Um amigo meu que tem quase o mesmo padrão de digitação que o eu
  67. {input:{velocidadeDeDigitacaoEmSegundos: 0.197}, output: {naoSouEu: 1}},
  68. {input:{velocidadeDeDigitacaoEmSegundos: 0.130}, output: {naoSouEu: 1}},
  69. {input:{velocidadeDeDigitacaoEmSegundos: 0.230}, output: {naoSouEu: 1}},
  70. {input:{velocidadeDeDigitacaoEmSegundos: 0.263}, output: {naoSouEu: 1}}
  71.  
  72. ]);
  73.  
  74. update();
  75.  
  76. function update(){
  77. if(working == true){
  78. i += 10;
  79. target = document.getElementById("text").value;
  80. if(target.length > oldLength){
  81. inptArray.push(target.slice(-1));
  82. count = true;
  83. }else if(target.length < oldLength){
  84. inptArray.push("backspace");
  85. count = true;
  86. }
  87. if(count == true){
  88. timeArray.push(i);
  89. i = 0;
  90. count = false;
  91. }
  92. oldLength = target.length;
  93. }
  94. setTimeout(function(){update();},10);
  95. }
  96.  
  97. function getResult(){
  98. var charAdd = inptArray.length;
  99. var timeAdd = 0;
  100. working = false;
  101.  
  102. var i = 0;
  103. while(i < timeArray.length){
  104. if(i == 0){
  105. timeArray[i] = i;
  106. }
  107. timeAdd += timeArray[i];
  108. document.write("Character: " + inptArray[i] + " | Time: " + timeArray[i] / 1000 + "s<br>");
  109. i += 1;
  110. }
  111.  
  112. var result = neural.run({velocidadeDeDigitacaoEmSegundos: (timeAdd / 1000 / charAdd).toFixed(3)});
  113.  
  114. if(result.souEu >= 0.75){
  115. document.write("<br><h1>Sou eu</h1>");
  116. }else{
  117. document.write("<br><h1>Não sou eu</h1>");
  118. }
  119.  
  120. console.log(result.souEu);
  121.  
  122. document.write("<h1>Results</h1>");
  123.  
  124. document.write("<br><h2>Average results</h2>");
  125. document.write(timeAdd / charAdd + " milliseconds/char<br>");
  126. document.write("<b>OR</b><br>");
  127. document.write(timeAdd / 1000 / charAdd + " seconds/char<br>");
  128.  
  129.  
  130.  
  131. }
  132. </script>
  133. </body>
  134. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement