Skip to content

Instantly share code, notes, and snippets.

@kirbysayshi
Created April 15, 2014 20:13
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/10768013 to your computer and use it in GitHub Desktop.
Save kirbysayshi/10768013 to your computer and use it in GitHub Desktop.
requirebin sketch
var test = require('tape');
var tbc = require('tap-browser-color')();
var EE = require('events');
/** Module begins here **/
/**
* Given an event emitter, such as a live('spotify:application'),
* listen for 'update' events that contain `arguments` in the emitted
* object. If those arguments match a route, call the route action.
* Routes can contain named placeholders, prefixed with `@`, which is
* mostly for readability.
*
* Routes can also be added/chained:
* var args = spargs(opt_routes)
* .route('user:@username', action)
* .route('user:@username:stuff', action)
*
* Routes can be handled by calling the `handle` function and passing
* in an object containing an `arguments` property.
*/
function spargs(opt_routes) {
var allRoutes = parseRoutes(opt_routes || {});
function onAppUpdate(props) {
if ('arguments' in props) {
match(allRoutes, props.arguments);
}
}
return {
route: function route(pathname, callback) {
allRoutes.push(parseRoute(pathname, callback));
return route;
},
handle: onAppUpdate
}
}
function parseRoute(pathname, callback) {
var parsed = {
original: pathname,
regex: null,
action: callback
}
var regexParts = pathname.split(':').map(function(segment) {
if (segment[0] === '@') {
return '([^:]+)';
} else {
return segment;
}
})
regexParts[0] = '^' + regexParts[0];
regexParts[regexParts.length-1] = regexParts[regexParts.length-1] + '$';
parsed.regex = new RegExp(regexParts.join(':'));
return parsed;
}
function parseRoutes(routes) {
var all = Object.keys(routes).map(function(pathname) {
return parseRoute(pathname, routes[pathname]);
});
return all;
}
function match(routes, args) {
var result = null;
var route;
for(var i = 0; i < routes.length; i++) {
route = routes[i];
result = route.regex.exec(args.join(':'));
if (result) {
route.action.apply(null, args);
return;
}
}
}
//module.exports = spargs;
//module.exports.parseRoutes = parseRoutes;
/** Module ends here **/
test('parseRoutes', function(t) {
var all = parseRoutes({
'user:@username': function(type, username) {},
'': function() {}
});
t.equal(all.length, 2, 'routes parse');
t.equal(all[0].regex.source, '^user:([^:]+)$', 'regex');
t.end();
})
test('match', function(t) {
t.plan(4);
var all = parseRoutes({
'user:@username': function(type, username) {
t.equal(type, 'user');
t.equal(username, 'crono');
},
'': function() {
t.ok(!arguments[0], 'default route has falsish args');
}
});
match(all, ['user', 'crono']);
match(all, ['']);
match(all, []);
t.end();
})
test('app', function(t) {
t.plan(3);
var args = spargs({
'user:@username': function(type, username) {
t.equal(username, 'crono');
},
'': function() {
t.pass('default route called');
}
})
var app = new EE();
app.on('update', args.handle);
args.route('user:@username:stuff', function(type, username, stuff) {
t.ok(stuff, 'stuff');
});
app.emit('update', { arguments: ['user', 'crono'] });
app.emit('update', { arguments: ['user', 'crono', 'stuff'] });
app.emit('update', { arguments: ['user'] });
app.emit('update', { arguments: [] });
t.end();
});
test('app without default', function(t) {
t.plan(1);
var args = spargs({
'user:@username': function(type, username) {
t.ok(username, 'username is crono');
}
})
var app = new EE();
app.on('update', args.handle);
app.emit('update', { arguments: ['user', 'crono'] });
app.emit('update', { arguments: ['user'] });
app.emit('update', { arguments: [] });
t.end();
});
test('app without routes', function(t) {
spargs()
t.end();
});
function spargs(e){function t(e){"arguments"in e&&match(n,e.arguments)}var n=parseRoutes(e||{});return{route:function r(e,t){return n.push(parseRoute(e,t)),r},handle:t}}function parseRoute(e,t){var n={original:e,regex:null,action:t},r=e.split(":").map(function(e){return"@"===e[0]?"([^:]+)":e});return r[0]="^"+r[0],r[r.length-1]=r[r.length-1]+"$",n.regex=RegExp(r.join(":")),n}function parseRoutes(e){var t=Object.keys(e).map(function(t){return parseRoute(t,e[t])});return t}function match(e,t){for(var n,r=null,i=0;e.length>i;i++)if(n=e[i],r=n.regex.exec(t.join(":")))return n.action.apply(null,t),void 0}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 l=n[s]={exports:{}};t[s][0].call(l.exports,function(e){var n=t[s][1][e];return i(n?n:e)},l,l.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}({1:[function(e,t,n){function r(e,t,n){if(!(this instanceof r))return new r(e,t,n);var i=typeof e;if("base64"===t&&"string"===i)for(e=A(e);0!==e.length%4;)e+="=";var o;if("number"===i)o=M(e);else if("string"===i)o=r.byteLength(e,t);else{if("object"!==i)throw Error("First argument needs to be a number, array or string.");o=M(e.length)}var s;r._useTypedArrays?s=I(new Uint8Array(o)):(s=this,s.length=o,s._isBuffer=!0);var a;if(r._useTypedArrays&&"function"==typeof Uint8Array&&e instanceof Uint8Array)s._set(e);else if(q(e))for(a=0;o>a;a++)s[a]=r.isBuffer(e)?e.readUInt8(a):e[a];else if("string"===i)s.write(e,0,t);else if("number"===i&&!r._useTypedArrays&&!n)for(a=0;o>a;a++)s[a]=0;return s}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;H(0===s%2,"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);H(!isNaN(u),"Invalid hex string"),e[n+a]=u}return r._charsWritten=2*a,a}function o(e,t,n,i){var o=r._charsWritten=R(U(t),e,n,i);return o}function s(e,t,n,i){var o=r._charsWritten=R(D(t),e,n,i);return o}function a(e,t,n,r){return s(e,t,n,r)}function u(e,t,n,i){var o=r._charsWritten=R(N(t),e,n,i);return o}function l(e,t,n,i){var o=r._charsWritten=R(O(t),e,n,i);return o}function f(e,t,n){return 0===t&&n===e.length?$.fromByteArray(e):$.fromByteArray(e.slice(t,n))}function c(e,t,n){var r="",i="";n=Math.min(e.length,n);for(var o=t;n>o;o++)127>=e[o]?(r+=z(i)+String.fromCharCode(e[o]),i=""):i+="%"+e[o].toString(16);return r+z(i)}function h(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;n>i;i++)r+=String.fromCharCode(e[i]);return r}function p(e,t,n){return h(e,t,n)}function d(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+=T(e[o]);return i}function g(e,t,n){for(var r=e.slice(t,n),i="",o=0;r.length>o;o+=2)i+=String.fromCharCode(r[o]+256*r[o+1]);return i}function m(e,t,n,r){r||(H("boolean"==typeof n,"missing or invalid endian"),H(void 0!==t&&null!==t,"missing offset"),H(e.length>t+1,"Trying to read beyond buffer length"));var i=e.length;if(!(t>=i)){var o;return n?(o=e[t],i>t+1&&(o|=e[t+1]<<8)):(o=e[t]<<8,i>t+1&&(o|=e[t+1])),o}}function v(e,t,n,r){r||(H("boolean"==typeof n,"missing or invalid endian"),H(void 0!==t&&null!==t,"missing offset"),H(e.length>t+3,"Trying to read beyond buffer length"));var i=e.length;if(!(t>=i)){var o;return n?(i>t+2&&(o=e[t+2]<<16),i>t+1&&(o|=e[t+1]<<8),o|=e[t],i>t+3&&(o+=e[t+3]<<24>>>0)):(i>t+1&&(o=e[t+1]<<16),i>t+2&&(o|=e[t+2]<<8),i>t+3&&(o|=e[t+3]),o+=e[t]<<24>>>0),o}}function y(e,t,n,r){r||(H("boolean"==typeof n,"missing or invalid endian"),H(void 0!==t&&null!==t,"missing offset"),H(e.length>t+1,"Trying to read beyond buffer length"));var i=e.length;if(!(t>=i)){var o=m(e,t,n,!0),s=32768&o;return s?-1*(65535-o+1):o}}function b(e,t,n,r){r||(H("boolean"==typeof n,"missing or invalid endian"),H(void 0!==t&&null!==t,"missing offset"),H(e.length>t+3,"Trying to read beyond buffer length"));var i=e.length;if(!(t>=i)){var o=v(e,t,n,!0),s=2147483648&o;return s?-1*(4294967295-o+1):o}}function w(e,t,n,r){return r||(H("boolean"==typeof n,"missing or invalid endian"),H(e.length>t+3,"Trying to read beyond buffer length")),G.read(e,t,n,23,4)}function _(e,t,n,r){return r||(H("boolean"==typeof n,"missing or invalid endian"),H(e.length>t+7,"Trying to read beyond buffer length")),G.read(e,t,n,52,8)}function E(e,t,n,r,i){i||(H(void 0!==t&&null!==t,"missing value"),H("boolean"==typeof r,"missing or invalid endian"),H(void 0!==n&&null!==n,"missing offset"),H(e.length>n+1,"trying to write beyond buffer length"),P(t,65535));var o=e.length;if(!(n>=o))for(var s=0,a=Math.min(o-n,2);a>s;s++)e[n+s]=(t&255<<8*(r?s:1-s))>>>8*(r?s:1-s)}function x(e,t,n,r,i){i||(H(void 0!==t&&null!==t,"missing value"),H("boolean"==typeof r,"missing or invalid endian"),H(void 0!==n&&null!==n,"missing offset"),H(e.length>n+3,"trying to write beyond buffer length"),P(t,4294967295));var o=e.length;if(!(n>=o))for(var s=0,a=Math.min(o-n,4);a>s;s++)e[n+s]=255&t>>>8*(r?s:3-s)}function L(e,t,n,r,i){i||(H(void 0!==t&&null!==t,"missing value"),H("boolean"==typeof r,"missing or invalid endian"),H(void 0!==n&&null!==n,"missing offset"),H(e.length>n+1,"Trying to write beyond buffer length"),W(t,32767,-32768));var o=e.length;n>=o||(t>=0?E(e,t,n,r,i):E(e,65535+t+1,n,r,i))}function j(e,t,n,r,i){i||(H(void 0!==t&&null!==t,"missing value"),H("boolean"==typeof r,"missing or invalid endian"),H(void 0!==n&&null!==n,"missing offset"),H(e.length>n+3,"Trying to write beyond buffer length"),W(t,2147483647,-2147483648));var o=e.length;n>=o||(t>=0?x(e,t,n,r,i):x(e,4294967295+t+1,n,r,i))}function k(e,t,n,r,i){i||(H(void 0!==t&&null!==t,"missing value"),H("boolean"==typeof r,"missing or invalid endian"),H(void 0!==n&&null!==n,"missing offset"),H(e.length>n+3,"Trying to write beyond buffer length"),F(t,3.4028234663852886e38,-3.4028234663852886e38));var o=e.length;n>=o||G.write(e,t,n,r,23,4)}function S(e,t,n,r,i){i||(H(void 0!==t&&null!==t,"missing value"),H("boolean"==typeof r,"missing or invalid endian"),H(void 0!==n&&null!==n,"missing offset"),H(e.length>n+7,"Trying to write beyond buffer length"),F(t,1.7976931348623157e308,-1.7976931348623157e308));var o=e.length;n>=o||G.write(e,t,n,r,52,8)}function A(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function I(e){return e._isBuffer=!0,e._get=e.get,e._set=e.set,e.get=J.get,e.set=J.set,e.write=J.write,e.toString=J.toString,e.toLocaleString=J.toString,e.toJSON=J.toJSON,e.copy=J.copy,e.slice=J.slice,e.readUInt8=J.readUInt8,e.readUInt16LE=J.readUInt16LE,e.readUInt16BE=J.readUInt16BE,e.readUInt32LE=J.readUInt32LE,e.readUInt32BE=J.readUInt32BE,e.readInt8=J.readInt8,e.readInt16LE=J.readInt16LE,e.readInt16BE=J.readInt16BE,e.readInt32LE=J.readInt32LE,e.readInt32BE=J.readInt32BE,e.readFloatLE=J.readFloatLE,e.readFloatBE=J.readFloatBE,e.readDoubleLE=J.readDoubleLE,e.readDoubleBE=J.readDoubleBE,e.writeUInt8=J.writeUInt8,e.writeUInt16LE=J.writeUInt16LE,e.writeUInt16BE=J.writeUInt16BE,e.writeUInt32LE=J.writeUInt32LE,e.writeUInt32BE=J.writeUInt32BE,e.writeInt8=J.writeInt8,e.writeInt16LE=J.writeInt16LE,e.writeInt16BE=J.writeInt16BE,e.writeInt32LE=J.writeInt32LE,e.writeInt32BE=J.writeInt32BE,e.writeFloatLE=J.writeFloatLE,e.writeFloatBE=J.writeFloatBE,e.writeDoubleLE=J.writeDoubleLE,e.writeDoubleBE=J.writeDoubleBE,e.fill=J.fill,e.inspect=J.inspect,e.toArrayBuffer=J.toArrayBuffer,e}function C(e,t,n){return"number"!=typeof e?n:(e=~~e,e>=t?t:e>=0?e:(e+=t,e>=0?e:0))}function M(e){return e=~~Math.ceil(+e),0>e?0:e}function B(e){return(Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)})(e)}function q(e){return B(e)||r.isBuffer(e)||e&&"object"==typeof e&&"number"==typeof e.length}function T(e){return 16>e?"0"+e.toString(16):e.toString(16)}function U(e){for(var t=[],n=0;e.length>n;n++){var r=e.charCodeAt(n);if(127>=r)t.push(e.charCodeAt(n));else{var i=n;r>=55296&&57343>=r&&n++;for(var o=encodeURIComponent(e.slice(i,n+1)).substr(1).split("%"),s=0;o.length>s;s++)t.push(parseInt(o[s],16))}}return t}function D(e){for(var t=[],n=0;e.length>n;n++)t.push(255&e.charCodeAt(n));return t}function O(e){for(var t,n,r,i=[],o=0;e.length>o;o++)t=e.charCodeAt(o),n=t>>8,r=t%256,i.push(r),i.push(n);return i}function N(e){return $.toByteArray(e)}function R(e,t,n,r){for(var i=0;r>i&&!(i+n>=t.length||i>=e.length);i++)t[i+n]=e[i];return i}function z(e){try{return decodeURIComponent(e)}catch(t){return String.fromCharCode(65533)}}function P(e,t){H("number"==typeof e,"cannot write a non-number as a number"),H(e>=0,"specified a negative value for writing an unsigned value"),H(t>=e,"value is larger than maximum value for type"),H(Math.floor(e)===e,"value has a fractional component")}function W(e,t,n){H("number"==typeof e,"cannot write a non-number as a number"),H(t>=e,"value larger than maximum allowed value"),H(e>=n,"value smaller than minimum allowed value"),H(Math.floor(e)===e,"value has a fractional component")}function F(e,t,n){H("number"==typeof e,"cannot write a non-number as a number"),H(t>=e,"value larger than maximum allowed value"),H(e>=n,"value smaller than minimum allowed value")}function H(e,t){if(!e)throw Error(t||"Failed assertion")}var $=e("base64-js"),G=e("ieee754");n.Buffer=r,n.SlowBuffer=r,n.INSPECT_MAX_BYTES=50,r.poolSize=8192,r._useTypedArrays=function(){if("undefined"==typeof Uint8Array||"undefined"==typeof ArrayBuffer)return!1;try{var e=new Uint8Array(0);return e.foo=function(){return 42},42===e.foo()&&"function"==typeof e.subarray}catch(t){return!1}}(),r.isEncoding=function(e){switch((e+"").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}},r.isBuffer=function(e){return!(null===e||void 0===e||!e._isBuffer)},r.byteLength=function(e,t){var n;switch(e+="",t||"utf8"){case"hex":n=e.length/2;break;case"utf8":case"utf-8":n=U(e).length;break;case"ascii":case"binary":case"raw":n=e.length;break;case"base64":n=N(e).length;break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":n=2*e.length;break;default:throw Error("Unknown encoding")}return n},r.concat=function(e,t){if(H(B(e),"Usage: Buffer.concat(list, [totalLength])\nlist should be an Array."),0===e.length)return new r(0);if(1===e.length)return e[0];var n;if("number"!=typeof t)for(t=0,n=0;e.length>n;n++)t+=e[n].length;var i=new r(t),o=0;for(n=0;e.length>n;n++){var s=e[n];s.copy(i,o),o+=s.length}return i},r.prototype.write=function(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 c=this.length-t;n?(n=Number(n),n>c&&(n=c)):n=c,r=((r||"utf8")+"").toLowerCase();var h;switch(r){case"hex":h=i(this,e,t,n);break;case"utf8":case"utf-8":h=o(this,e,t,n);break;case"ascii":h=s(this,e,t,n);break;case"binary":h=a(this,e,t,n);break;case"base64":h=u(this,e,t,n);break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":h=l(this,e,t,n);break;default:throw Error("Unknown encoding")}return h},r.prototype.toString=function(e,t,n){var r=this;if(e=((e||"utf8")+"").toLowerCase(),t=Number(t)||0,n=void 0!==n?Number(n):n=r.length,n===t)return"";var i;switch(e){case"hex":i=d(r,t,n);break;case"utf8":case"utf-8":i=c(r,t,n);break;case"ascii":i=h(r,t,n);break;case"binary":i=p(r,t,n);break;case"base64":i=f(r,t,n);break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":i=g(r,t,n);break;default:throw Error("Unknown encoding")}return i},r.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},r.prototype.copy=function(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){H(r>=n,"sourceEnd < sourceStart"),H(t>=0&&e.length>t,"targetStart out of bounds"),H(n>=0&&i.length>n,"sourceStart out of bounds"),H(r>=0&&i.length>=r,"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]}},r.prototype.slice=function(e,t){var n=this.length;if(e=C(e,n,0),t=C(t,n,n),r._useTypedArrays)return I(this.subarray(e,t));for(var i=t-e,o=new r(i,void 0,!0),s=0;i>s;s++)o[s]=this[s+e];return o},r.prototype.get=function(e){return console.log(".get() is deprecated. Access using array indexes instead."),this.readUInt8(e)},r.prototype.set=function(e,t){return console.log(".set() is deprecated. Access using array indexes instead."),this.writeUInt8(e,t)},r.prototype.readUInt8=function(e,t){return t||(H(void 0!==e&&null!==e,"missing offset"),H(this.length>e,"Trying to read beyond buffer length")),e>=this.length?void 0:this[e]},r.prototype.readUInt16LE=function(e,t){return m(this,e,!0,t)},r.prototype.readUInt16BE=function(e,t){return m(this,e,!1,t)},r.prototype.readUInt32LE=function(e,t){return v(this,e,!0,t)},r.prototype.readUInt32BE=function(e,t){return v(this,e,!1,t)},r.prototype.readInt8=function(e,t){if(t||(H(void 0!==e&&null!==e,"missing offset"),H(this.length>e,"Trying to read beyond buffer length")),!(e>=this.length)){var n=128&this[e];return n?-1*(255-this[e]+1):this[e]}},r.prototype.readInt16LE=function(e,t){return y(this,e,!0,t)},r.prototype.readInt16BE=function(e,t){return y(this,e,!1,t)},r.prototype.readInt32LE=function(e,t){return b(this,e,!0,t)},r.prototype.readInt32BE=function(e,t){return b(this,e,!1,t)},r.prototype.readFloatLE=function(e,t){return w(this,e,!0,t)},r.prototype.readFloatBE=function(e,t){return w(this,e,!1,t)},r.prototype.readDoubleLE=function(e,t){return _(this,e,!0,t)},r.prototype.readDoubleBE=function(e,t){return _(this,e,!1,t)},r.prototype.writeUInt8=function(e,t,n){n||(H(void 0!==e&&null!==e,"missing value"),H(void 0!==t&&null!==t,"missing offset"),H(this.length>t,"trying to write beyond buffer length"),P(e,255)),t>=this.length||(this[t]=e)},r.prototype.writeUInt16LE=function(e,t,n){E(this,e,t,!0,n)},r.prototype.writeUInt16BE=function(e,t,n){E(this,e,t,!1,n)},r.prototype.writeUInt32LE=function(e,t,n){x(this,e,t,!0,n)},r.prototype.writeUInt32BE=function(e,t,n){x(this,e,t,!1,n)},r.prototype.writeInt8=function(e,t,n){n||(H(void 0!==e&&null!==e,"missing value"),H(void 0!==t&&null!==t,"missing offset"),H(this.length>t,"Trying to write beyond buffer length"),W(e,127,-128)),t>=this.length||(e>=0?this.writeUInt8(e,t,n):this.writeUInt8(255+e+1,t,n))},r.prototype.writeInt16LE=function(e,t,n){L(this,e,t,!0,n)},r.prototype.writeInt16BE=function(e,t,n){L(this,e,t,!1,n)},r.prototype.writeInt32LE=function(e,t,n){j(this,e,t,!0,n)},r.prototype.writeInt32BE=function(e,t,n){j(this,e,t,!1,n)},r.prototype.writeFloatLE=function(e,t,n){k(this,e,t,!0,n)},r.prototype.writeFloatBE=function(e,t,n){k(this,e,t,!1,n)},r.prototype.writeDoubleLE=function(e,t,n){S(this,e,t,!0,n)},r.prototype.writeDoubleBE=function(e,t,n){S(this,e,t,!1,n)},r.prototype.fill=function(e,t,n){if(e||(e=0),t||(t=0),n||(n=this.length),"string"==typeof e&&(e=e.charCodeAt(0)),H("number"==typeof e&&!isNaN(e),"value is not a number"),H(n>=t,"end < start"),n!==t&&0!==this.length){H(t>=0&&this.length>t,"start out of bounds"),H(n>=0&&this.length>=n,"end out of bounds");for(var r=t;n>r;r++)this[r]=e}},r.prototype.inspect=function(){for(var e=[],t=this.length,r=0;t>r;r++)if(e[r]=T(this[r]),r===n.INSPECT_MAX_BYTES){e[r+1]="...";break}return"<Buffer "+e.join(" ")+">"},r.prototype.toArrayBuffer=function(){if("function"==typeof Uint8Array){if(r._useTypedArrays)return new r(this).buffer;for(var e=new Uint8Array(this.length),t=0,n=e.length;n>t;t+=1)e[t]=this[t];return e.buffer}throw Error("Buffer.toArrayBuffer not supported in this browser")};var J=r.prototype},{"base64-js":2,ieee754:3}],2:[function(e,t){var n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";(function(){"use strict";function e(e){var t=e.charCodeAt(0);return t===s?62:t===a?63:u>t?-1:u+10>t?t-u+26+26:f+26>t?t-f:l+26>t?t-l+26:void 0}function r(t){function n(e){l[c++]=e}var r,i,s,a,u,l;if(t.length%4>0)throw Error("Invalid string. Length must be a multiple of 4");var f=t.length;u="="===t.charAt(f-2)?2:"="===t.charAt(f-1)?1:0,l=new o(3*t.length/4-u),s=u>0?t.length-4:t.length;var c=0;for(r=0,i=0;s>r;r+=4,i+=3)a=e(t.charAt(r))<<18|e(t.charAt(r+1))<<12|e(t.charAt(r+2))<<6|e(t.charAt(r+3)),n((16711680&a)>>16),n((65280&a)>>8),n(255&a);return 2===u?(a=e(t.charAt(r))<<2|e(t.charAt(r+1))>>4,n(255&a)):1===u&&(a=e(t.charAt(r))<<10|e(t.charAt(r+1))<<4|e(t.charAt(r+2))>>2,n(255&a>>8),n(255&a)),l}function i(e){function t(e){return n.charAt(e)}function r(e){return t(63&e>>18)+t(63&e>>12)+t(63&e>>6)+t(63&e)}var i,o,s,a=e.length%3,u="";for(i=0,s=e.length-a;s>i;i+=3)o=(e[i]<<16)+(e[i+1]<<8)+e[i+2],u+=r(o);switch(a){case 1:o=e[e.length-1],u+=t(o>>2),u+=t(63&o<<4),u+="==";break;case 2:o=(e[e.length-2]<<8)+e[e.length-1],u+=t(o>>10),u+=t(63&o>>4),u+=t(63&o<<2),u+="="}return u}var o="undefined"!=typeof Uint8Array?Uint8Array:Array;"0".charCodeAt(0);var s="+".charCodeAt(0),a="/".charCodeAt(0),u="0".charCodeAt(0),l="a".charCodeAt(0),f="A".charCodeAt(0);t.exports.toByteArray=r,t.exports.fromByteArray=i})()},{}],3:[function(e,t,n){n.read=function(e,t,n,r,i){var o,s,a=8*i-r-1,u=(1<<a)-1,l=u>>1,f=-7,c=n?i-1:0,h=n?-1:1,p=e[t+c];for(c+=h,o=p&(1<<-f)-1,p>>=-f,f+=a;f>0;o=256*o+e[t+c],c+=h,f-=8);for(s=o&(1<<-f)-1,o>>=-f,f+=r;f>0;s=256*s+e[t+c],c+=h,f-=8);if(0===o)o=1-l;else{if(o===u)return s?0/0:1/0*(p?-1:1);s+=Math.pow(2,r),o-=l}return(p?-1:1)*s*Math.pow(2,o-r)},n.write=function(e,t,n,r,i,o){var s,a,u,l=8*o-i-1,f=(1<<l)-1,c=f>>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:o-1,d=r?1:-1,g=0>t||0===t&&0>1/t?1:0;for(t=Math.abs(t),isNaN(t)||1/0===t?(a=isNaN(t)?1:0,s=f):(s=Math.floor(Math.log(t)/Math.LN2),1>t*(u=Math.pow(2,-s))&&(s--,u*=2),t+=s+c>=1?h/u:h*Math.pow(2,1-c),t*u>=2&&(s++,u/=2),s+c>=f?(a=0,s=f):s+c>=1?(a=(t*u-1)*Math.pow(2,i),s+=c):(a=t*Math.pow(2,c-1)*Math.pow(2,i),s=0));i>=8;e[n+p]=255&a,p+=d,a/=256,i-=8);for(s=s<<i|a,l+=i;l>0;e[n+p]=255&s,p+=d,s/=256,l-=8);e[n+p-d]|=128*g}},{}],4:[function(e,t){function n(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function r(e){return"function"==typeof e}function i(e){return"number"==typeof e}function o(e){return"object"==typeof e&&null!==e}function s(e){return void 0===e}t.exports=n,n.EventEmitter=n,n.prototype._events=void 0,n.prototype._maxListeners=void 0,n.defaultMaxListeners=10,n.prototype.setMaxListeners=function(e){if(!i(e)||0>e||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},n.prototype.emit=function(e){var t,n,i,a,u,l;if(this._events||(this._events={}),"error"===e&&(!this._events.error||o(this._events.error)&&!this._events.error.length))throw t=arguments[1],t instanceof Error?t:TypeError('Uncaught, unspecified "error" event.');if(n=this._events[e],s(n))return!1;if(r(n))switch(arguments.length){case 1:n.call(this);break;case 2:n.call(this,arguments[1]);break;case 3:n.call(this,arguments[1],arguments[2]);break;default:for(i=arguments.length,a=Array(i-1),u=1;i>u;u++)a[u-1]=arguments[u];n.apply(this,a)}else if(o(n)){for(i=arguments.length,a=Array(i-1),u=1;i>u;u++)a[u-1]=arguments[u];for(l=n.slice(),i=l.length,u=0;i>u;u++)l[u].apply(this,a)}return!0},n.prototype.addListener=function(e,t){var i;if(!r(t))throw TypeError("listener must be a function");if(this._events||(this._events={}),this._events.newListener&&this.emit("newListener",e,r(t.listener)?t.listener:t),this._events[e]?o(this._events[e])?this._events[e].push(t):this._events[e]=[this._events[e],t]:this._events[e]=t,o(this._events[e])&&!this._events[e].warned){var i;i=s(this._maxListeners)?n.defaultMaxListeners:this._maxListeners,i&&i>0&&this._events[e].length>i&&(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())}return this},n.prototype.on=n.prototype.addListener,n.prototype.once=function(e,t){function n(){this.removeListener(e,n),i||(i=!0,t.apply(this,arguments))}if(!r(t))throw TypeError("listener must be a function");var i=!1;return n.listener=t,this.on(e,n),this},n.prototype.removeListener=function(e,t){var n,i,s,a;if(!r(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(n=this._events[e],s=n.length,i=-1,n===t||r(n.listener)&&n.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(o(n)){for(a=s;a-->0;)if(n[a]===t||n[a].listener&&n[a].listener===t){i=a;break}if(0>i)return this;1===n.length?(n.length=0,delete this._events[e]):n.splice(i,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},n.prototype.removeAllListeners=function(e){var t,n;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(n=this._events[e],r(n))this.removeListener(e,n);else for(;n.length;)this.removeListener(e,n[n.length-1]);return delete this._events[e],this},n.prototype.listeners=function(e){var t;return t=this._events&&this._events[e]?r(this._events[e])?[this._events[e]]:this._events[e].slice():[]},n.listenerCount=function(e,t){var n;return n=e._events&&e._events[t]?r(e._events[t])?1:e._events[t].length:0}},{}],5:[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}},{}],6:[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){var t=e.source;if((t===window||null===t)&&"process-tick"===e.data&&(e.stopPropagation(),n.length>0)){var r=n.shift();r()}},!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")}},{}],7:[function(e,t,n){(function(e){function t(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 r(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 i=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/,o=function(e){return i.exec(e).slice(1)};n.resolve=function(){for(var n="",i=!1,o=arguments.length-1;o>=-1&&!i;o--){var s=o>=0?arguments[o]:e.cwd();if("string"!=typeof s)throw new TypeError("Arguments to path.resolve must be strings");s&&(n=s+"/"+n,i="/"===s.charAt(0))}return n=t(r(n.split("/"),function(e){return!!e}),!i).join("/"),(i?"/":"")+n||"."},n.normalize=function(e){var i=n.isAbsolute(e),o="/"===s(e,-1);return e=t(r(e.split("/"),function(e){return!!e}),!i).join("/"),e||i||(e="."),e&&o&&(e+="/"),(i?"/":"")+e},n.isAbsolute=function(e){return"/"===e.charAt(0)},n.join=function(){var e=Array.prototype.slice.call(arguments,0);return n.normalize(r(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 l=[],u=a;i.length>u;u++)l.push("..");return l=l.concat(o.slice(a)),l.join("/")},n.sep="/",n.delimiter=":",n.dirname=function(e){var t=o(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=o(e)[2];return t&&n.substr(-1*t.length)===t&&(n=n.substr(0,n.length-t.length)),n},n.extname=function(e){return o(e)[3]};var s="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)}}).call(this,e("/home/admin/browserify-cdn/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"))},{"/home/admin/browserify-cdn/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":6}],8:[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("process/browser.js").nextTick,s=e("./readable.js"),a=e("./writable.js");i(n,s),n.prototype.write=a.prototype.write,n.prototype.end=a.prototype.end,n.prototype._write=a.prototype._write},{"./readable.js":12,"./writable.js":14,inherits:5,"process/browser.js":10}],9:[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)&&l.pause&&l.pause()}function i(){l.readable&&l.resume&&l.resume()}function o(){f||(f=!0,e.end())}function s(){f||(f=!0,"function"==typeof e.destroy&&e.destroy())}function a(e){if(u(),0===r.listenerCount(this,"error"))throw e}function u(){l.removeListener("data",n),e.removeListener("drain",i),l.removeListener("end",o),l.removeListener("close",s),l.removeListener("error",a),e.removeListener("error",a),l.removeListener("end",u),l.removeListener("close",u),e.removeListener("close",u)}var l=this;l.on("data",n),e.on("drain",i),e._isStdio||t&&t.end===!1||(l.on("end",o),l.on("close",s));var f=!1;return l.on("error",a),e.on("error",a),l.on("end",u),l.on("close",u),e.on("close",u),e.emit("pipe",l),e}},{"./duplex.js":8,"./passthrough.js":11,"./readable.js":12,"./transform.js":13,"./writable.js":14,events:4,inherits:5}],10:[function(e,t){t.exports=e(6)},{}],11:[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":13,inherits:5}],12:[function(e,t){(function(n){function r(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 i(e){return this instanceof i?(this._readableState=new r(e,this),this.readable=!0,j.call(this),void 0):new i(e)}function o(e,t,n,r,i){var o=l(t,n);if(o)e.emit("error",o);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&&c(e),p(e,t);else i||(t.reading=!1);return s(t)}function s(e){return!e.ended&&(e.needReadable||e.length<e.highWaterMark||0===e.length)}function a(e){if(e>=I)e=I;else{e--;for(var t=1;32>t;t<<=1)e|=e>>t;e++}return e}function u(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=a(e)),e>t.length?t.ended?t.length:(t.needReadable=!0,0):e)}function l(e,t){var n=null;return k.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?c(e):w(e)}function c(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,t.sync?S(function(){h(e)}):h(e))}function h(e){e.emit("readable")}function p(e,t){t.readingMore||(t.readingMore=!0,S(function(){d(e,t)}))}function d(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 g(e){return function(){var t=e._readableState;t.awaitDrain--,0===t.awaitDrain&&m(e)}}function m(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):_(r.pipes,t),e.emit("data",n),r.awaitDrain>0)return;return 0===r.pipesCount?(r.flowing=!1,L.listenerCount(e,"data")>0&&y(e),void 0):(r.ranOut=!0,void 0)}function v(){this._readableState.ranOut&&(this._readableState.ranOut=!1,m(this))}function y(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=j.prototype.pipe,e.on=e.addListener=j.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?S(function(){e.emit("readable")}):this.read(0),this.emit("resume")},e.emit("readable")}function b(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(""):k.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 k(e);for(var u=0,l=0,f=r.length;f>l&&e>u;l++){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 w(e){var t=e._readableState;if(t.length>0)throw Error("endReadable called on non-empty stream");!t.endEmitted&&t.calledRead&&(t.ended=!0,S(function(){t.endEmitted||0!==t.length||(t.endEmitted=!0,e.readable=!1,e.emit("end"))}))}function _(e,t){for(var n=0,r=e.length;r>n;n++)t(e[n],n)}function E(e,t){for(var n=0,r=e.length;r>n;n++)if(e[n]===t)return n;return-1}t.exports=i,i.ReadableState=r;var x,L=e("events").EventEmitter,j=e("./index.js"),k=e("buffer").Buffer,S=e("process/browser.js").nextTick,A=e("inherits");A(i,j),i.prototype.push=function(e,t){var n=this._readableState;return"string"!=typeof e||n.objectMode||(t=t||n.defaultEncoding,t!==n.encoding&&(e=new k(e,t),t="")),o(this,n,e,t,!1)},i.prototype.unshift=function(e){var t=this._readableState;return o(this,t,e,"",!0)},i.prototype.setEncoding=function(t){x||(x=e("string_decoder").StringDecoder),this._readableState.decoder=new x(t),this._readableState.encoding=t};var I=8388608;i.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 c(this),null;if(e=u(e,t),0===e&&t.ended)return 0===t.length&&w(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=u(n,t));
var i;return i=e>0?b(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&&w(this),i},i.prototype._read=function(){this.emit("error",Error("not implemented"))},i.prototype.pipe=function(e,t){function r(e){e===f&&o()}function i(){e.end()}function o(){e.removeListener("close",a),e.removeListener("finish",u),e.removeListener("drain",d),e.removeListener("error",s),e.removeListener("unpipe",r),f.removeListener("end",i),f.removeListener("end",o),(!e._writableState||e._writableState.needDrain)&&d()}function s(t){l(),0===y&&0===L.listenerCount(e,"error")&&e.emit("error",t)}function a(){e.removeListener("finish",u),l()}function u(){e.removeListener("close",a),l()}function l(){f.unpipe(e)}var f=this,c=this._readableState;switch(c.pipesCount){case 0:c.pipes=e;break;case 1:c.pipes=[c.pipes,e];break;default:c.pipes.push(e)}c.pipesCount+=1;var h=(!t||t.end!==!1)&&e!==n.stdout&&e!==n.stderr,p=h?i:o;c.endEmitted?S(p):f.once("end",p),e.on("unpipe",r);var d=g(f);e.on("drain",d);var y=L.listenerCount(e,"error");return e.once("error",s),e.once("close",a),e.once("finish",u),e.emit("pipe",f),c.flowing||(this.on("readable",v),c.flowing=!0,S(function(){m(f)})),e},i.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",v),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",v),t.flowing=!1;for(var i=0;r>i;i++)n[i].emit("unpipe",this);return this}var i=E(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)},i.prototype.on=function(e,t){var n=j.prototype.on.call(this,e,t);if("data"!==e||this._readableState.flowing||y(this),"readable"===e&&this.readable){var r=this._readableState;r.readableListening||(r.readableListening=!0,r.emittedReadable=!1,r.needReadable=!0,r.reading?r.length&&c(this,r):this.read(0))}return n},i.prototype.addListener=i.prototype.on,i.prototype.resume=function(){y(this),this.read(0),this.emit("resume")},i.prototype.pause=function(){y(this,!0),this.emit("pause")},i.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 _(o,function(t){e.on(t,function(e){return r.emit.apply(r,t,e)})}),r._read=function(){n&&(n=!1,e.resume())},r},i._fromList=b}).call(this,e("/home/admin/browserify-cdn/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"))},{"./index.js":9,"/home/admin/browserify-cdn/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":6,buffer:1,events:4,inherits:5,"process/browser.js":10,string_decoder:15}],13:[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":8,inherits:5}],14:[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 E.Duplex?(this._writableState=new r(e,this),this.writable=!0,E.call(this),void 0):new i(e)}function o(e,t,n){var r=Error("write after end");e.emit("error",r),x(function(){n(r)})}function s(e,t,n,r){var i=!0;if(!L.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),x(function(){r(o)}),i=!1}return i}function a(e,t,n){return e.objectMode||e.decodeStrings===!1||"string"!=typeof t||(t=new L(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)):l(e,t,s,r,i,o),u}function l(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 f(e,t,n,r,i){n?x(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)f(e,n,r,t,i);else{var o=m(e,n);o||n.bufferProcessing||!n.buffer.length||g(e,n),r?x(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(l(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 m(e,t){return t.ending&&0===t.length&&!t.finished&&!t.writing}function v(e,t){var n=m(e,t);return n&&(t.finished=!0,e.emit("finish")),n}function y(e,t,n){t.ending=!0,v(e,t),n&&(t.finished?x(n):e.once("finish",n)),t.ended=!0}t.exports=i,i.WritableState=r;var b="undefined"!=typeof Uint8Array?function(e){return e instanceof Uint8Array}:function(e){return e&&e.constructor&&"Uint8Array"===e.constructor.name},w="undefined"!=typeof ArrayBuffer?function(e){return e instanceof ArrayBuffer}:function(e){return e&&e.constructor&&"ArrayBuffer"===e.constructor.name},_=e("inherits"),E=e("./index.js"),x=e("process/browser.js").nextTick,L=e("buffer").Buffer;_(i,E),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),!L.isBuffer(e)&&b(e)&&(e=new L(e)),w(e)&&"undefined"!=typeof Uint8Array&&(e=new L(new Uint8Array(e))),L.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||y(this,r,n)}},{"./index.js":9,buffer:1,inherits:5,"process/browser.js":10}],15:[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:1}],16:[function(e,t){t.exports=function(e){return e&&"object"==typeof e&&"function"==typeof e.copy&&"function"==typeof e.fill&&"function"==typeof e.readUInt8}},{}],17:[function(e,t,n){(function(t,r){function i(e,t){var r={seen:[],stylize:s};return arguments.length>=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),g(t)?r.showHidden=t:t&&n._extend(r,t),_(r.showHidden)&&(r.showHidden=!1),_(r.depth)&&(r.depth=2),_(r.colors)&&(r.colors=!1),_(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=o),u(r,e,r.depth)}function o(e,t){var n=i.styles[t];return n?"["+i.colors[n][0]+"m"+e+"["+i.colors[n][1]+"m":e}function s(e){return e}function a(e){var t={};return e.forEach(function(e){t[e]=!0}),t}function u(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 b(i)||(i=u(e,i,r)),i}var o=l(e,t);if(o)return o;var s=Object.keys(t),g=a(s);if(e.showHidden&&(s=Object.getOwnPropertyNames(t)),j(t)&&(s.indexOf("message")>=0||s.indexOf("description")>=0))return f(t);if(0===s.length){if(k(t)){var m=t.name?": "+t.name:"";return e.stylize("[Function"+m+"]","special")}if(E(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");if(L(t))return e.stylize(Date.prototype.toString.call(t),"date");if(j(t))return f(t)}var v="",y=!1,w=["{","}"];if(d(t)&&(y=!0,w=["[","]"]),k(t)){var _=t.name?": "+t.name:"";v=" [Function"+_+"]"}if(E(t)&&(v=" "+RegExp.prototype.toString.call(t)),L(t)&&(v=" "+Date.prototype.toUTCString.call(t)),j(t)&&(v=" "+f(t)),0===s.length&&(!y||0==t.length))return w[0]+v+w[1];if(0>r)return E(t)?e.stylize(RegExp.prototype.toString.call(t),"regexp"):e.stylize("[Object]","special");e.seen.push(t);var x;return x=y?c(e,t,r,g,s):s.map(function(n){return h(e,t,r,g,n,y)}),e.seen.pop(),p(x,v,w)}function l(e,t){if(_(t))return e.stylize("undefined","undefined");if(b(t)){var n="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(n,"string")}return y(t)?e.stylize(""+t,"number"):g(t)?e.stylize(""+t,"boolean"):m(t)?e.stylize("null","null"):void 0}function f(e){return"["+Error.prototype.toString.call(e)+"]"}function c(e,t,n,r,i){for(var o=[],s=0,a=t.length;a>s;++s)M(t,s+"")?o.push(h(e,t,n,r,s+"",!0)):o.push("");return i.forEach(function(i){i.match(/^\d+$/)||o.push(h(e,t,n,r,i,!0))}),o}function h(e,t,n,r,i,o){var s,a,l;if(l=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]},l.get?a=l.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):l.set&&(a=e.stylize("[Setter]","special")),M(r,i)||(s="["+i+"]"),a||(0>e.seen.indexOf(l.value)?(a=m(n)?u(e,l.value,null):u(e,l.value,n-1),a.indexOf("\n")>-1&&(a=o?a.split("\n").map(function(e){return" "+e}).join("\n").substr(2):"\n"+a.split("\n").map(function(e){return" "+e}).join("\n"))):a=e.stylize("[Circular]","special")),_(s)){if(o&&i.match(/^\d+$/))return a;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+": "+a}function p(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 d(e){return Array.isArray(e)}function g(e){return"boolean"==typeof e}function m(e){return null===e}function v(e){return null==e}function y(e){return"number"==typeof e}function b(e){return"string"==typeof e}function w(e){return"symbol"==typeof e}function _(e){return void 0===e}function E(e){return x(e)&&"[object RegExp]"===A(e)}function x(e){return"object"==typeof e&&null!==e}function L(e){return x(e)&&"[object Date]"===A(e)}function j(e){return x(e)&&("[object Error]"===A(e)||e instanceof Error)}function k(e){return"function"==typeof e}function S(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||e===void 0}function A(e){return Object.prototype.toString.call(e)}function I(e){return 10>e?"0"+e.toString(10):e.toString(10)}function C(){var e=new Date,t=[I(e.getHours()),I(e.getMinutes()),I(e.getSeconds())].join(":");return[e.getDate(),U[e.getMonth()],t].join(" ")}function M(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var B=/%[sdj%]/g;n.format=function(e){if(!b(e)){for(var t=[],n=0;arguments.length>n;n++)t.push(i(arguments[n]));return t.join(" ")}for(var n=1,r=arguments,o=r.length,s=(e+"").replace(B,function(e){if("%%"===e)return"%";if(n>=o)return e;switch(e){case"%s":return r[n++]+"";case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch(t){return"[Circular]"}default:return e}}),a=r[n];o>n;a=r[++n])s+=m(a)||!x(a)?" "+a:" "+i(a);return s},n.deprecate=function(e,i){function o(){if(!s){if(t.throwDeprecation)throw Error(i);t.traceDeprecation?console.trace(i):console.error(i),s=!0}return e.apply(this,arguments)}if(_(r.process))return function(){return n.deprecate(e,i).apply(this,arguments)};if(t.noDeprecation===!0)return e;var s=!1;return o};var q,T={};n.debuglog=function(e){if(_(q)&&(q=t.env.NODE_DEBUG||""),e=e.toUpperCase(),!T[e])if(RegExp("\\b"+e+"\\b","i").test(q)){var r=t.pid;T[e]=function(){var t=n.format.apply(n,arguments);console.error("%s %d: %s",e,r,t)}}else T[e]=function(){};return T[e]},n.inspect=i,i.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]},i.styles={special:"cyan",number:"yellow","boolean":"yellow",undefined:"grey","null":"bold",string:"green",date:"magenta",regexp:"red"},n.isArray=d,n.isBoolean=g,n.isNull=m,n.isNullOrUndefined=v,n.isNumber=y,n.isString=b,n.isSymbol=w,n.isUndefined=_,n.isRegExp=E,n.isObject=x,n.isDate=L,n.isError=j,n.isFunction=k,n.isPrimitive=S,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",C(),n.format.apply(n,arguments))},n.inherits=e("inherits"),n._extend=function(e,t){if(!t||!x(t))return e;for(var n=Object.keys(t),r=n.length;r--;)e[n[r]]=t[n[r]];return e}}).call(this,e("/home/admin/browserify-cdn/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./support/isBuffer":16,"/home/admin/browserify-cdn/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":6,inherits:5}],tape:[function(e,t){t.exports=e("ttTIws")},{}],ttTIws:[function(e,t,n){(function(r){function i(e){e||(e={});var t=o({autoclose:s(e.autoclose,!1)}),n=t.createStream({objectMode:e.objectMode}),i=n.pipe(e.stream||a());c&&i.on("error",function(){t._exitCode=1});var u=!1;if(n.on("end",function(){u=!0}),e.exit===!1)return t;if(!c||!h)return t;var l;return r.on("uncaughtException",function(e){if(!e||"EPIPE"!==e.code||"EPIPE"!==e.errno||"write"!==e.syscall)throw l=e,e}),r.on("exit",function(e){if(!l){if(!u)for(var n=t._results._only,i=0;t._tests.length>i;i++){var o=t._tests[i];n&&o.name!==n||o._exit()}t.close(),r.exit(e||t._exitCode)}}),t}function o(e){e||(e={});var t=l();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._results=t,n._tests=[],n.createStream=function(e){return t.createStream(e)};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 s=e("defined"),a=e("./lib/default_stream"),u=e("./lib/test"),l=e("./lib/results"),f=e("through"),c=r!==void 0&&r&&"function"==typeof r.on,h=r!==void 0&&r&&"function"==typeof r.exit;"undefined"!=typeof setImmediate?setImmediate:r.nextTick,n=t.exports=function(){function e(e){return e||(e={}),e.autoclose=!c,t||(t=i(e)),t}var t,n=function(){return e().apply(this,arguments)};return n.only=function(){return e().only.apply(this,arguments)},n.createStream=function(n){if(n||(n={}),!t){var r=f();return e({stream:r,objectMode:n.objectMode}),r}return t.createStream(n)},n}(),n.createHarness=o,n.Test=u,n.test=n}).call(this,e("/home/admin/browserify-cdn/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"))},{"./lib/default_stream":20,"./lib/results":21,"./lib/test":22,"/home/admin/browserify-cdn/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":6,defined:26,through:30}],20:[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:30}],21:[function(e,t){(function(n){function r(){return this instanceof r?(this.count=0,this.fail=0,this.pass=0,this._stream=l(),this.tests=[],void 0):new r}function i(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=" ",i=r+" ";if(n+=r+"---\n",n+=i+"operator: "+e.operator+"\n",s(e,"expected")||s(e,"actual")){var o=c(e.expected),a=c(e.actual);Math.max(o.length,a.length)>65?(n+=i+"expected:\n"+i+" "+o+"\n",n+=i+"actual:\n"+i+" "+a+"\n"):(n+=i+"expected: "+o+"\n",n+=i+"actual: "+a+"\n")}if(e.at&&(n+=i+"at: "+e.at+"\n"),"error"===e.operator&&e.actual&&e.actual.stack){var u=(e.actual.stack+"").split("\n");n+=i+"stack:\n",n+=i+" "+u[0]+"\n";for(var l=1;u.length>l;l++)n+=i+u[l]+"\n"}return n+=r+"...\n"}function o(e){if(!e._only)return e.tests.shift();do{var t=e.tests.shift();if(t&&e._only===t.name)return t}while(0!==e.tests.length)}function s(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var a=e("events").EventEmitter,u=e("inherits"),l=e("through"),f=e("resumer"),c=e("object-inspect"),h="undefined"!=typeof setImmediate?setImmediate:n.nextTick;t.exports=r,u(r,a),r.prototype.createStream=function(e){e||(e={});var t,n=this,r=0;return e.objectMode?(t=l(),n.on("_push",function i(e,n){n||(n={});var o=r++;e.once("prerun",function(){var r={type:"test",name:e.name,id:o};n.parent&&(r.parent=n.parent),t.queue(r)}),e.on("test",function(e){i(e,{parent:o})}),e.on("result",function(e){e.test=o,e.type="assert",t.queue(e)}),e.on("end",function(){t.queue({type:"end",test:o})})}),n.on("done",function(){t.queue(null)})):(t=f(),t.queue("TAP version 13\n"),n._stream.pipe(t)),h(function s(){for(var e;e=o(n);)if(e.run(),!e.ended)return e.once("end",function(){h(s)});n.emit("done")}),t},r.prototype.push=function(e){var t=this;t.tests.push(e),t._watch(e),t.emit("_push",e)},r.prototype.only=function(e){this._only&&(self.count++,self.fail++,write("not ok "+self.count+" already called .only()\n")),this._only=e},r.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(i(e,t.count+1)),t.count++,e.ok?t.pass++:t.fail++,void 0)}),e.on("test",function(e){t._watch(e)})},r.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)}}).call(this,e("/home/admin/browserify-cdn/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"))},{"/home/admin/browserify-cdn/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":6,events:4,inherits:27,"object-inspect":28,resumer:29,through:30}],22:[function(e,t){(function(n,r){function i(){for(var e,t=this,n="(anonymous)",r={},o=0;arguments.length>o;o++)switch(typeof arguments[o]){case"string":n=arguments[o];break;case"object":r=arguments[o]||r;break;case"function":e=arguments[o]}this.readable=!0,this.name=n||"(anonymous)",this.assertCount=0,this.pendingCount=0,this._skip=r.skip||!1,this._plan=void 0,this._cb=e,this._progeny=[],this._ok=!0,this.end=function(){return i.prototype.end.apply(t,arguments)}}function o(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e("stream");var s=e("deep-equal"),a=e("defined"),u=e("path"),l=e("util").inherits,f=e("events").EventEmitter;t.exports=i;var c="undefined"!=typeof setImmediate?setImmediate:n.nextTick;l(i,f),i.prototype.run=function(){if(!this._cb||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")},i.prototype.test=function(e,t,n){var r=this,o=new i(e,t,n);this._progeny.push(o),this.pendingCount++,this.emit("test",o),o.on("prerun",function(){r.assertCount++}),r._pendingAsserts()||c(function(){r._end()}),c(function(){r._plan||r.pendingCount!=r._progeny.length||r._end()})},i.prototype.comment=function(e){this.emit("result",e.trim().replace(/^#\s*/,""))},i.prototype.plan=function(e){this._plan=e,this.emit("plan",e)},i.prototype.end=function(e){arguments.length>=1&&this.ifError(e),this.calledEnd&&this.fail(".end() called twice"),this.calledEnd=!0,this._end()},i.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},i.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}))},i.prototype._pendingAsserts=function(){return void 0===this._plan?1:this._plan-(this._progeny.length+this.assertCount)},i.prototype._assert=function(e,t){var n=this,i=t.extra||{},s={id:n.assertCount++,ok:Boolean(e),skip:a(i.skip,t.skip),name:a(i.message,t.message,"(unnamed assert)"),operator:a(i.operator,t.operator)};(o(t,"actual")||o(i,"actual"))&&(s.actual=a(i.actual,t.actual)),(o(t,"expected")||o(i,"expected"))&&(s.expected=a(i.expected,t.expected)),this._ok=Boolean(this._ok&&e),e||(s.error=a(i.error,t.error,Error(s.name)));for(var l=Error("exception"),f=(l.stack||"").split("\n"),h=u.dirname(r)+"/",p=0;f.length>p;p++){var d=/^\s*\bat\s+(.+)/.exec(f[p]);if(d){var g=d[1].split(/\s+/),m=/(\/[^:\s]+:(\d+)(?::(\d+))?)/.exec(g[1]);if((m||(m=/(\/[^:\s]+:(\d+)(?::(\d+))?)/.exec(g[3])))&&m[1].slice(0,h.length)!==h){s.functionName=g[0],s.file=m[1],s.line=Number(m[2]),m[3]&&(s.column=m[3]),s.at=d[1];break}}}n.emit("result",s);var v=n._pendingAsserts();v||(i.exiting?n._end():c(function(){n._end()})),!n._planError&&0>v&&(n._planError=!0,n.fail("plan != count",{expected:n._plan,actual:n._plan-v}))},i.prototype.fail=function(e,t){this._assert(!1,{message:e,operator:"fail",extra:t})},i.prototype.pass=function(e,t){this._assert(!0,{message:e,operator:"pass",extra:t})},i.prototype.skip=function(e,t){this._assert(!0,{message:e,operator:"skip",skip:!0,extra:t})},i.prototype.ok=i.prototype["true"]=i.prototype.assert=function(e,t,n){this._assert(e,{message:t,operator:"ok",expected:!0,actual:e,extra:n})},i.prototype.notOk=i.prototype["false"]=i.prototype.notok=function(e,t,n){this._assert(!e,{message:t,operator:"notOk",expected:!1,actual:e,extra:n})},i.prototype.error=i.prototype.ifError=i.prototype.ifErr=i.prototype.iferror=function(e,t,n){this._assert(!e,{message:a(t,e+""),operator:"error",actual:e,extra:n})},i.prototype.equal=i.prototype.equals=i.prototype.isEqual=i.prototype.is=i.prototype.strictEqual=i.prototype.strictEquals=function(e,t,n,r){this._assert(e===t,{message:a(n,"should be equal"),operator:"equal",actual:e,expected:t,extra:r})},i.prototype.notEqual=i.prototype.notEquals=i.prototype.notStrictEqual=i.prototype.notStrictEquals=i.prototype.isNotEqual=i.prototype.isNot=i.prototype.not=i.prototype.doesNotEqual=i.prototype.isInequal=function(e,t,n,r){this._assert(e!==t,{message:a(n,"should not be equal"),operator:"notEqual",actual:e,notExpected:t,extra:r})},i.prototype.deepEqual=i.prototype.deepEquals=i.prototype.isEquivalent=i.prototype.same=function(e,t,n,r){this._assert(s(e,t,{strict:!0}),{message:a(n,"should be equivalent"),operator:"deepEqual",actual:e,expected:t,extra:r})},i.prototype.deepLooseEqual=i.prototype.looseEqual=i.prototype.looseEquals=function(e,t,n,r){this._assert(s(e,t),{message:a(n,"should be equivalent"),operator:"deepLooseEqual",actual:e,expected:t,extra:r})},i.prototype.notDeepEqual=i.prototype.notEquivalent=i.prototype.notDeeply=i.prototype.notSame=i.prototype.isNotDeepEqual=i.prototype.isNotDeeply=i.prototype.isNotEquivalent=i.prototype.isInequivalent=function(e,t,n,r){this._assert(!s(e,t,{strict:!0}),{message:a(n,"should not be equivalent"),operator:"notDeepEqual",actual:e,notExpected:t,extra:r})},i.prototype.notDeepLooseEqual=i.prototype.notLooseEqual=i.prototype.notLooseEquals=function(e,t,n,r){this._assert(s(e,t),{message:a(n,"should be equivalent"),operator:"notDeepLooseEqual",actual:e,expected:t,extra:r})},i.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 s=o.message;delete o.message,o.message=s}var u=i;t instanceof RegExp&&(u=t.test(i&&i.error),t+=""),this._assert(u,{message:a(n,"should throw"),operator:"throws",actual:i&&i.error,expected:t,error:!u&&i&&i.error,extra:r})},i.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:a(n,"should not throw"),operator:"throws",actual:i&&i.error,expected:t,error:i&&i.error,extra:r})}}).call(this,e("/home/admin/browserify-cdn/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"),"/lib")},{"/home/admin/browserify-cdn/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":6,"deep-equal":23,defined:26,events:4,path:7,stream:9,util:17}],23:[function(e,t){function n(e){return null===e||void 0===e}function r(e){return e&&"object"==typeof e&&"number"==typeof e.length?"function"!=typeof e.copy||"function"!=typeof e.slice?!1:e.length>0&&"number"!=typeof e[0]?!1:!0:!1}function i(e,t,i){var l,f;if(n(e)||n(t))return!1;if(e.prototype!==t.prototype)return!1;if(a(e))return a(t)?(e=o.call(e),t=o.call(t),u(e,t,i)):!1;if(r(e)){if(!r(t))return!1;if(e.length!==t.length)return!1;for(l=0;e.length>l;l++)if(e[l]!==t[l])return!1;return!0}try{var c=s(e),h=s(t)}catch(p){return!1}if(c.length!=h.length)return!1;for(c.sort(),h.sort(),l=c.length-1;l>=0;l--)if(c[l]!=h[l])return!1;for(l=c.length-1;l>=0;l--)if(f=c[l],!u(e[f],t[f],i))return!1;return!0}var o=Array.prototype.slice,s=e("./lib/keys.js"),a=e("./lib/is_arguments.js"),u=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:i(e,t,n)}},{"./lib/is_arguments.js":24,"./lib/keys.js":25}],24:[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},{}],25:[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},{}],26:[function(e,t){t.exports=function(){for(var e=0;arguments.length>e;e++)if(void 0!==arguments[e])return arguments[e]}},{}],27:[function(e,t){t.exports=e(5)},{}],28:[function(e,t){function n(e){return(e+"").replace(/"/g,"&quot;")}function r(e){return"[object Array]"==={}.toString.call(e)}function i(e){return"[object Date]"==={}.toString.call(e)}function o(e){return"[object RegExp]"==={}.toString.call(e)}function s(e,t){return{}.hasOwnProperty?{}.hasOwnProperty.call(e,t):t in e}function a(e){if(e.name)return e.name;var t=(""+e).match(/^function\s*([\w$]+)/);return t?t[1]:void 0}function u(e,t){if(e.indexOf)return e.indexOf(t);for(var n=0,r=e.length;r>n;n++)if(e[n]===t)return n;return-1}function l(e){return e&&"object"==typeof e?"undefined"!=typeof HTMLElement?e instanceof HTMLElement:"string"==typeof e.nodeName&&"function"==typeof e.getAttribute:!1}t.exports=function f(e,t,c,h){function p(e,n){return n&&(h=h.slice(),h.push(n)),f(e,t,c+1,h)}t||(t={});var d=void 0===t.depth?5:t.depth;if(void 0===c&&(c=0),c>d&&d>0)return"...";if(void 0===h)h=[];else if(u(h,e)>=0)return"[Circular]";if("string"==typeof e)return"'"+e.replace(/(['\\])/g,"\\$1")+"'";if("function"==typeof e){var g=a(e);return"[Function"+(g?": "+g:"")+"]"}if(null===e)return"null";if(l(e)){for(var m="<"+(e.nodeName+"").toLowerCase(),v=e.attributes||[],y=0;v.length>y;y++)m+=" "+v[y].name+'="'+n(v[y].value)+'"';
return m+=">",e.childNodes&&e.childNodes.length&&(m+="..."),m+="</"+(e.tagName+"").toLowerCase()+">"}if(r(e)){if(0===e.length)return"[]";for(var b=Array(e.length),y=0;e.length>y;y++)b[y]=s(e,y)?p(e[y],e):"";return"[ "+b.join(", ")+" ]"}if("object"==typeof e&&"function"==typeof e.inspect)return e.inspect();if("object"!=typeof e||i(e)||o(e))return e+"";var b=[],w=[];for(var _ in e)s(e,_)&&w.push(_);w.sort();for(var y=0;w.length>y;y++){var _=w[y];/[^\w$]/.test(_)?b.push(p(_)+": "+p(e[_],e)):b.push(_+": "+p(e[_],e))}return 0===b.length?"{}":"{ "+b.join(", ")+" }"}},{}],29:[function(e,t){(function(n){var 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}}).call(this,e("/home/admin/browserify-cdn/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"))},{"/home/admin/browserify-cdn/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":6,through:30}],30:[function(e,t,n){(function(r){function i(e,t,n){function i(){for(;l.length&&!c.paused;){var e=l.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,l=[],f=!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 f?c:(null==e&&(f=!0),l.push(e),i(),c)},c.on("end",function(){c.readable=!1,!c.writable&&c.autoDestroy&&r.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,l.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")),i(),c.paused||c.emit("drain"),c},c}var o=e("stream");n=t.exports=i,i.through=i}).call(this,e("/home/admin/browserify-cdn/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"))},{"/home/admin/browserify-cdn/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":6,stream:9}]},{},[]),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 l=n[s]={exports:{}};t[s][0].call(l.exports,function(e){var n=t[s][1][e];return i(n?n:e)},l,l.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}({oAq0Vd:[function(e,t){function n(e){return"string"!=typeof e&&(e+=""),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 r(),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("oAq0Vd")},{}]},{},[]),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 l=n[s]={exports:{}};t[s][0].call(l.exports,function(e){var n=t[s][1][e];return i(n?n:e)},l,l.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}({Sk64m6:[function(e,t){function n(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function r(e){return"function"==typeof e}function i(e){return"number"==typeof e}function o(e){return"object"==typeof e&&null!==e}function s(e){return void 0===e}t.exports=n,n.EventEmitter=n,n.prototype._events=void 0,n.prototype._maxListeners=void 0,n.defaultMaxListeners=10,n.prototype.setMaxListeners=function(e){if(!i(e)||0>e||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},n.prototype.emit=function(e){var t,n,i,a,u,l;if(this._events||(this._events={}),"error"===e&&(!this._events.error||o(this._events.error)&&!this._events.error.length))throw t=arguments[1],t instanceof Error?t:TypeError('Uncaught, unspecified "error" event.');if(n=this._events[e],s(n))return!1;if(r(n))switch(arguments.length){case 1:n.call(this);break;case 2:n.call(this,arguments[1]);break;case 3:n.call(this,arguments[1],arguments[2]);break;default:for(i=arguments.length,a=Array(i-1),u=1;i>u;u++)a[u-1]=arguments[u];n.apply(this,a)}else if(o(n)){for(i=arguments.length,a=Array(i-1),u=1;i>u;u++)a[u-1]=arguments[u];for(l=n.slice(),i=l.length,u=0;i>u;u++)l[u].apply(this,a)}return!0},n.prototype.addListener=function(e,t){var i;if(!r(t))throw TypeError("listener must be a function");if(this._events||(this._events={}),this._events.newListener&&this.emit("newListener",e,r(t.listener)?t.listener:t),this._events[e]?o(this._events[e])?this._events[e].push(t):this._events[e]=[this._events[e],t]:this._events[e]=t,o(this._events[e])&&!this._events[e].warned){var i;i=s(this._maxListeners)?n.defaultMaxListeners:this._maxListeners,i&&i>0&&this._events[e].length>i&&(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())}return this},n.prototype.on=n.prototype.addListener,n.prototype.once=function(e,t){function n(){this.removeListener(e,n),i||(i=!0,t.apply(this,arguments))}if(!r(t))throw TypeError("listener must be a function");var i=!1;return n.listener=t,this.on(e,n),this},n.prototype.removeListener=function(e,t){var n,i,s,a;if(!r(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(n=this._events[e],s=n.length,i=-1,n===t||r(n.listener)&&n.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(o(n)){for(a=s;a-->0;)if(n[a]===t||n[a].listener&&n[a].listener===t){i=a;break}if(0>i)return this;1===n.length?(n.length=0,delete this._events[e]):n.splice(i,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},n.prototype.removeAllListeners=function(e){var t,n;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(n=this._events[e],r(n))this.removeListener(e,n);else for(;n.length;)this.removeListener(e,n[n.length-1]);return delete this._events[e],this},n.prototype.listeners=function(e){var t;return t=this._events&&this._events[e]?r(this._events[e])?[this._events[e]]:this._events[e].slice():[]},n.listenerCount=function(e,t){var n;return n=e._events&&e._events[t]?r(e._events[t])?1:e._events[t].length:0}},{}],events:[function(e,t){t.exports=e("Sk64m6")},{}]},{},[]);var test=require("tape"),tbc=require("tap-browser-color")(),EE=require("events");test("parseRoutes",function(e){var t=parseRoutes({"user:@username":function(){},"":function(){}});e.equal(t.length,2,"routes parse"),e.equal(t[0].regex.source,"^user:([^:]+)$","regex"),e.end()}),test("match",function(e){e.plan(4);var t=parseRoutes({"user:@username":function(t,n){e.equal(t,"user"),e.equal(n,"crono")},"":function(){e.ok(!arguments[0],"default route has falsish args")}});match(t,["user","crono"]),match(t,[""]),match(t,[]),e.end()}),test("app",function(e){e.plan(3);var t=spargs({"user:@username":function(t,n){e.equal(n,"crono")},"":function(){e.pass("default route called")}}),n=new EE;n.on("update",t.handle),t.route("user:@username:stuff",function(t,n,r){e.ok(r,"stuff")}),n.emit("update",{arguments:["user","crono"]}),n.emit("update",{arguments:["user","crono","stuff"]}),n.emit("update",{arguments:["user"]}),n.emit("update",{arguments:[]}),e.end()}),test("app without default",function(e){e.plan(1);var t=spargs({"user:@username":function(t,n){e.ok(n,"username is crono")}}),n=new EE;n.on("update",t.handle),n.emit("update",{arguments:["user","crono"]}),n.emit("update",{arguments:["user"]}),n.emit("update",{arguments:[]}),e.end()}),test("app without routes",function(e){spargs(),e.end()});
{
"name": "requirebin-sketch",
"version": "1.0.0",
"dependencies": {
"tape": "2.10.2",
"tap-browser-color": "0.1.2"
}
}
<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