--- /dev/null
+var require = function (file, cwd) {
+ var resolved = require.resolve(file, cwd || '/');
+ var mod = require.modules[resolved];
+ if (!mod) throw new Error(
+ 'Failed to resolve module ' + file + ', tried ' + resolved
+ );
+ var res = mod._cached ? mod._cached : mod();
+ return res;
+}
+
+require.paths = [];
+require.modules = {};
+require.extensions = [".js",".coffee"];
+
+require._core = {
+ 'assert': true,
+ 'events': true,
+ 'fs': true,
+ 'path': true,
+ 'vm': true
+};
+
+require.resolve = (function () {
+ return function (x, cwd) {
+ if (!cwd) cwd = '/';
+
+ if (require._core[x]) return x;
+ var path = require.modules.path();
+ var y = cwd || '.';
+
+ if (x.match(/^(?:\.\.?\/|\/)/)) {
+ var m = loadAsFileSync(path.resolve(y, x))
+ || loadAsDirectorySync(path.resolve(y, x));
+ if (m) return m;
+ }
+
+ var n = loadNodeModulesSync(x, y);
+ if (n) return n;
+
+ throw new Error("Cannot find module '" + x + "'");
+
+ function loadAsFileSync (x) {
+ if (require.modules[x]) {
+ return x;
+ }
+
+ for (var i = 0; i < require.extensions.length; i++) {
+ var ext = require.extensions[i];
+ if (require.modules[x + ext]) return x + ext;
+ }
+ }
+
+ function loadAsDirectorySync (x) {
+ x = x.replace(/\/+$/, '');
+ var pkgfile = x + '/package.json';
+ if (require.modules[pkgfile]) {
+ var pkg = require.modules[pkgfile]();
+ var b = pkg.browserify;
+ if (typeof b === 'object' && b.main) {
+ var m = loadAsFileSync(path.resolve(x, b.main));
+ if (m) return m;
+ }
+ else if (typeof b === 'string') {
+ var m = loadAsFileSync(path.resolve(x, b));
+ if (m) return m;
+ }
+ else if (pkg.main) {
+ var m = loadAsFileSync(path.resolve(x, pkg.main));
+ if (m) return m;
+ }
+ }
+
+ return loadAsFileSync(x + '/index');
+ }
+
+ function loadNodeModulesSync (x, start) {
+ var dirs = nodeModulesPathsSync(start);
+ for (var i = 0; i < dirs.length; i++) {
+ var dir = dirs[i];
+ var m = loadAsFileSync(dir + '/' + x);
+ if (m) return m;
+ var n = loadAsDirectorySync(dir + '/' + x);
+ if (n) return n;
+ }
+
+ var m = loadAsFileSync(x);
+ if (m) return m;
+ }
+
+ function nodeModulesPathsSync (start) {
+ var parts;
+ if (start === '/') parts = [ '' ];
+ else parts = path.normalize(start).split('/');
+
+ var dirs = [];
+ for (var i = parts.length - 1; i >= 0; i--) {
+ if (parts[i] === 'node_modules') continue;
+ var dir = parts.slice(0, i + 1).join('/') + '/node_modules';
+ dirs.push(dir);
+ }
+
+ return dirs;
+ }
+ };
+})();
+
+require.alias = function (from, to) {
+ var path = require.modules.path();
+ var res = null;
+ try {
+ res = require.resolve(from + '/package.json', '/');
+ }
+ catch (err) {
+ res = require.resolve(from, '/');
+ }
+ var basedir = path.dirname(res);
+
+ var keys = (Object.keys || function (obj) {
+ var res = [];
+ for (var key in obj) res.push(key)
+ return res;
+ })(require.modules);
+
+ for (var i = 0; i < keys.length; i++) {
+ var key = keys[i];
+ if (key.slice(0, basedir.length + 1) === basedir + '/') {
+ var f = key.slice(basedir.length);
+ require.modules[to + f] = require.modules[basedir + f];
+ }
+ else if (key === basedir) {
+ require.modules[to] = require.modules[basedir];
+ }
+ }
+};
+
+require.define = function (filename, fn) {
+ var dirname = require._core[filename]
+ ? ''
+ : require.modules.path().dirname(filename)
+ ;
+
+ var require_ = function (file) {
+ return require(file, dirname)
+ };
+ require_.resolve = function (name) {
+ return require.resolve(name, dirname);
+ };
+ require_.modules = require.modules;
+ require_.define = require.define;
+ var module_ = { exports : {} };
+
+ require.modules[filename] = function () {
+ require.modules[filename]._cached = module_.exports;
+ fn.call(
+ module_.exports,
+ require_,
+ module_,
+ module_.exports,
+ dirname,
+ filename
+ );
+ require.modules[filename]._cached = module_.exports;
+ return module_.exports;
+ };
+};
+
+if (typeof process === 'undefined') process = {};
+
+if (!process.nextTick) process.nextTick = (function () {
+ var queue = [];
+ var canPost = typeof window !== 'undefined'
+ && window.postMessage && window.addEventListener
+ ;
+
+ if (canPost) {
+ window.addEventListener('message', function (ev) {
+ if (ev.source === window && ev.data === 'browserify-tick') {
+ ev.stopPropagation();
+ if (queue.length > 0) {
+ var fn = queue.shift();
+ fn();
+ }
+ }
+ }, true);
+ }
+
+ return function (fn) {
+ if (canPost) {
+ queue.push(fn);
+ window.postMessage('browserify-tick', '*');
+ }
+ else setTimeout(fn, 0);
+ };
+})();
+
+if (!process.title) process.title = 'browser';
+
+if (!process.binding) process.binding = function (name) {
+ if (name === 'evals') return require('vm')
+ else throw new Error('No such module')
+};
+
+if (!process.cwd) process.cwd = function () { return '.' };
+
+require.define("path", function (require, module, exports, __dirname, __filename) {
+function filter (xs, fn) {
+ var res = [];
+ for (var i = 0; i < xs.length; i++) {
+ if (fn(xs[i], i, xs)) res.push(xs[i]);
+ }
+ return res;
+}
+
+// resolves . and .. elements in a path array with directory names there
+// must be no slashes, empty elements, or device names (c:\) in the array
+// (so also no leading and trailing slashes - it does not distinguish
+// relative and absolute paths)
+function normalizeArray(parts, allowAboveRoot) {
+ // if the path tries to go above the root, `up` ends up > 0
+ var up = 0;
+ for (var i = parts.length; i >= 0; i--) {
+ var last = parts[i];
+ if (last == '.') {
+ parts.splice(i, 1);
+ } else if (last === '..') {
+ parts.splice(i, 1);
+ up++;
+ } else if (up) {
+ parts.splice(i, 1);
+ up--;
+ }
+ }
+
+ // if the path is allowed to go above the root, restore leading ..s
+ if (allowAboveRoot) {
+ for (; up--; up) {
+ parts.unshift('..');
+ }
+ }
+
+ return parts;
+}
+
+// Regex to split a filename into [*, dir, basename, ext]
+// posix version
+var splitPathRe = /^(.+\/(?!$)|\/)?((?:.+?)?(\.[^.]*)?)$/;
+
+// path.resolve([from ...], to)
+// posix version
+exports.resolve = function() {
+var resolvedPath = '',
+ resolvedAbsolute = false;
+
+for (var i = arguments.length; i >= -1 && !resolvedAbsolute; i--) {
+ var path = (i >= 0)
+ ? arguments[i]
+ : process.cwd();
+
+ // Skip empty and invalid entries
+ if (typeof path !== 'string' || !path) {
+ continue;
+ }
+
+ resolvedPath = path + '/' + resolvedPath;
+ resolvedAbsolute = path.charAt(0) === '/';
+}
+
+// At this point the path should be resolved to a full absolute path, but
+// handle relative paths to be safe (might happen when process.cwd() fails)
+
+// Normalize the path
+resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) {
+ return !!p;
+ }), !resolvedAbsolute).join('/');
+
+ return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.';
+};
+
+// path.normalize(path)
+// posix version
+exports.normalize = function(path) {
+var isAbsolute = path.charAt(0) === '/',
+ trailingSlash = path.slice(-1) === '/';
+
+// Normalize the path
+path = normalizeArray(filter(path.split('/'), function(p) {
+ return !!p;
+ }), !isAbsolute).join('/');
+
+ if (!path && !isAbsolute) {
+ path = '.';
+ }
+ if (path && trailingSlash) {
+ path += '/';
+ }
+
+ return (isAbsolute ? '/' : '') + path;
+};
+
+
+// posix version
+exports.join = function() {
+ var paths = Array.prototype.slice.call(arguments, 0);
+ return exports.normalize(filter(paths, function(p, index) {
+ return p && typeof p === 'string';
+ }).join('/'));
+};
+
+
+exports.dirname = function(path) {
+ var dir = splitPathRe.exec(path)[1] || '';
+ var isWindows = false;
+ if (!dir) {
+ // No dirname
+ return '.';
+ } else if (dir.length === 1 ||
+ (isWindows && dir.length <= 3 && dir.charAt(1) === ':')) {
+ // It is just a slash or a drive letter with a slash
+ return dir;
+ } else {
+ // It is a full dirname, strip trailing slash
+ return dir.substring(0, dir.length - 1);
+ }
+};
+
+
+exports.basename = function(path, ext) {
+ var f = splitPathRe.exec(path)[2] || '';
+ // TODO: make this comparison case-insensitive on windows?
+ if (ext && f.substr(-1 * ext.length) === ext) {
+ f = f.substr(0, f.length - ext.length);
+ }
+ return f;
+};
+
+
+exports.extname = function(path) {
+ return splitPathRe.exec(path)[3] || '';
+};
+
+});
+
+require.define("/node_modules/seq/package.json", function (require, module, exports, __dirname, __filename) {
+module.exports = {"main":"./index.js"}
+});
+
+require.define("/node_modules/seq/index.js", function (require, module, exports, __dirname, __filename) {
+var EventEmitter = require('events').EventEmitter;
+var Hash = require('hashish');
+var Chainsaw = require('chainsaw');
+
+var slice = [].slice;
+
+module.exports = Seq;
+function Seq (xs) {
+ if (xs && !Array.isArray(xs) || arguments.length > 1) {
+ throw new Error('Optional argument to Seq() is exactly one Array');
+ }
+
+ var ch = Chainsaw(function (saw) {
+ builder.call(this, saw, xs || []);
+ });
+
+ process.nextTick(function () {
+ ch['catch'](function (err) {
+ console.error(err.stack ? err.stack : err)
+ });
+ });
+ return ch;
+}
+
+Seq.ap = Seq; // for compatability with versions <0.3
+
+function builder (saw, xs) {
+ var context = {
+ dead : false,
+ vars : {},
+ args : {},
+ stack : xs,
+ error : null
+ };
+ context.stack_ = context.stack;
+
+ function die(){
+ context.dead = true;
+ saw.step = saw.actions.length+1;
+ }
+ context.die = die;
+
+ function action (step, key, start, finish){
+ var cb = function (err) {
+ var args = slice.call(arguments, 1);
+ if (context.dead) {
+ saw.step = saw.actions.length+1;
+ } else if (err) {
+ context.error = { message : err, key : key };
+ saw.jump(lastPar);
+ saw.down('catch');
+ finish();
+ } else {
+ if (typeof key == 'number') {
+ context.stack_[key] = args[0];
+ context.args[key] = args;
+ } else {
+ context.stack_.push.apply(context.stack_, args);
+ if (key !== undefined) {
+ context.vars[key] = args[0];
+ context.args[key] = args;
+ }
+ }
+ if (finish) finish(args, key);
+ }
+ };
+ Hash(context).forEach(function (v,k) { cb[k] = v });
+
+ cb.into = function (k) {
+ key = k;
+ return cb;
+ };
+
+ cb.next = function (err, xs) {
+ context.stack_.push.apply(context.stack_, xs);
+ cb.apply(cb, [err].concat(context.stack));
+ };
+
+ cb.pass = function (err) {
+ cb.apply(cb, [err].concat(context.stack));
+ };
+
+ cb.ok = cb.bind(cb, null);
+
+ cb.die = function (){
+ die();
+ return cb;
+ };
+
+ start.apply(cb, context.stack);
+ }
+
+ var running = 0;
+ var errors = 0;
+
+ this.seq = function (key, cb) {
+ var bound = slice.call(arguments, 2);
+
+ if (typeof key === 'function') {
+ if (arguments.length > 1) bound.unshift(cb);
+ cb = key;
+ key = undefined;
+ }
+
+ if (context.error) saw.next()
+ else if (running === 0) {
+ action(saw.step, key,
+ function () {
+ context.stack_ = [];
+ var args = slice.call(arguments);
+ args.unshift.apply(args, bound.map(function (arg) {
+ return arg === Seq ? this : arg
+ }, this));
+
+ cb.apply(this, args);
+ }, function () {
+ context.stack = context.stack_;
+ saw.next()
+ }
+ );
+ }
+ };
+
+ var lastPar = null;
+ this.par = function (key, cb) {
+ lastPar = saw.step;
+
+ if (running == 0) {
+ // empty the active stack for the first par() in a chain
+ context.stack_ = [];
+ }
+
+ var bound = slice.call(arguments, 2);
+ if (typeof key === 'function') {
+ if (arguments.length > 1) bound.unshift(cb);
+ cb = key;
+ key = context.stack_.length;
+ context.stack_.push(null);
+ }
+ var cb_ = function () {
+ var args = slice.call(arguments);
+ args.unshift.apply(args, bound.map(function (arg) {
+ return arg === Seq ? this : arg
+ }, this));
+
+ cb.apply(this, args);
+ };
+
+ running ++;
+
+ var step = saw.step;
+ process.nextTick(function () {
+ action(step, key, cb_, function (args) {
+ if (!args) errors ++;
+
+ running --;
+ if (running == 0) {
+ context.stack = context.stack_.slice();
+ saw.step = lastPar;
+ if (errors > 0) saw.down('catch');
+ errors = 0;
+ saw.next();
+ }
+ });
+ });
+ saw.next();
+ };
+
+ [ 'seq', 'par' ].forEach(function (name) {
+ this[name + '_'] = function (key) {
+ var args = slice.call(arguments);
+
+ var cb = typeof key === 'function'
+ ? args[0] : args[1];
+
+ var fn = function () {
+ var argv = slice.call(arguments);
+ argv.unshift(this);
+ cb.apply(this, argv);
+ };
+
+ if (typeof key === 'function') {
+ args[0] = fn;
+ }
+ else {
+ args[1] = fn;
+ }
+
+ this[name].apply(this, args);
+ };
+ }, this);
+
+ this['catch'] = function (cb) {
+ if (context.error) {
+ cb.call(context, context.error.message, context.error.key);
+ context.error = null;
+ }
+ saw.next();
+ };
+
+ this.forEach = function (limit, cb) {
+ if (cb === undefined) { cb = limit; limit = null; }
+
+ this.seq(function (){
+ if (context.stack.length === 0)
+ return this(null);
+
+ var xs = context.stack.slice()
+ , len = xs.length
+ , active = 0
+ , finished = 0
+ , queue = []
+ , visitor
+ ;
+
+ context.stack_ = xs.slice();
+
+ if (!limit || limit <= 0)
+ visitor = function (x, i){
+ action(saw.step, i, function (){
+ cb.call(this, x, i);
+ if (i === len - 1)
+ saw.next();
+ });
+ }
+ else
+ visitor = function eachCall(x, i){
+ if (active >= limit)
+ return queue.push(eachCall.bind(this, x, i));
+
+ active++;
+ action(saw.step, i,
+ function (){ cb.call(this, x, i); },
+ function (){
+ active--;
+ finished++;
+ if (queue.length > 0)
+ queue.shift()();
+ else if (i === len - 1)
+ saw.next();
+ }
+ );
+ };
+
+ xs.forEach(visitor);
+ });
+ };
+
+ this.seqEach = function (cb) {
+ this.seq(function () {
+ context.stack_ = context.stack.slice();
+ var xs = context.stack.slice();
+ if (xs.length === 0) this(null);
+ else (function next (i) {
+ action(
+ saw.step, i,
+ function () { cb.call(this, xs[i], i) },
+ function (args) {
+ if (!args || i === xs.length - 1) saw.next();
+ else next(i + 1);
+ }
+ );
+ }).bind(this)(0);
+ });
+ };
+
+ this.parEach = function (limit, cb) {
+ var xs = context.stack.slice();
+ if (cb === undefined) { cb = limit; limit = xs.length }
+ context.stack_ = [];
+
+ var active = 0;
+ var finished = 0;
+ var queue = [];
+
+ if (xs.length === 0) saw.next()
+ else xs.forEach(function call (x, i) {
+ if (active >= limit) {
+ queue.push(call.bind(this, x, i));
+ }
+ else {
+ active ++;
+ action(saw.step, i,
+ function () {
+ cb.call(this, x, i);
+ },
+ function () {
+ active --;
+ finished ++;
+ if (queue.length > 0) queue.shift()();
+ else if (finished === xs.length) {
+ saw.next();
+ }
+ }
+ );
+ }
+ });
+ };
+
+ this.parMap = function (limit, cb) {
+ var res = [];
+ var len = context.stack.length;
+ if (cb === undefined) { cb = limit; limit = len }
+ var res = [];
+
+ Seq()
+ .extend(context.stack)
+ .parEach(limit, function (x, i) {
+ var self = this;
+
+ var next = function () {
+ res[i] = arguments[1];
+ self.apply(self, arguments);
+ };
+
+ next.stack = self.stack;
+ next.stack_ = self.stack_;
+ next.vars = self.vars;
+ next.args = self.args;
+ next.error = self.error;
+
+ next.into = function (key) {
+ return function () {
+ res[key] = arguments[1];
+ self.apply(self, arguments);
+ };
+ };
+
+ next.ok = function () {
+ var args = slice.call(arguments);
+ args.unshift(null);
+ return next.apply(next, args);
+ };
+
+ cb.apply(next, arguments);
+ })
+ .seq(function () {
+ context.stack = res;
+ saw.next();
+ })
+ ;
+ };
+
+ this.seqMap = function (cb) {
+ var res = [];
+ var lastIdx = context.stack.length - 1;
+
+ this.seqEach(function (x, i) {
+ var self = this;
+
+ var next = function () {
+ res[i] = arguments[1];
+ if (i === lastIdx)
+ context.stack = res;
+ self.apply(self, arguments);
+ };
+
+ next.stack = self.stack;
+ next.stack_ = self.stack_;
+ next.vars = self.vars;
+ next.args = self.args;
+ next.error = self.error;
+
+ next.into = function (key) {
+ return function () {
+ res[key] = arguments[1];
+ if (i === lastIdx)
+ context.stack = res;
+ self.apply(self, arguments);
+ };
+ };
+
+ next.ok = function () {
+ var args = slice.call(arguments);
+ args.unshift(null);
+ return next.apply(next, args);
+ };
+
+ cb.apply(next, arguments);
+ });
+ };
+
+ /**
+ * Consumes any errors that occur in `cb`. Calls to `this.into(i)` will place
+ * that value, if accepted by the filter, at the index in the results as
+ * if it were the i-th index before filtering. (This means it will never
+ * override another value, and will only actually appear at i if the filter
+ * accepts all values before i.)
+ */
+ this.parFilter = function (limit, cb) {
+ var res = [];
+ var len = context.stack.length;
+ if (cb === undefined) { cb = limit; limit = len }
+ var res = [];
+
+ Seq()
+ .extend(context.stack)
+ .parEach(limit, function (x, i) {
+ var self = this;
+
+ var next = function (err, ok) {
+ if (!err && ok)
+ res.push([i, x]);
+ arguments[0] = null; // discard errors
+ self.apply(self, arguments);
+ };
+
+ next.stack = self.stack;
+ next.stack_ = self.stack_;
+ next.vars = self.vars;
+ next.args = self.args;
+ next.error = self.error;
+
+ next.into = function (key) {
+ return function (err, ok) {
+ if (!err && ok)
+ res.push([key, x]);
+ arguments[0] = null; // discard errors
+ self.apply(self, arguments);
+ };
+ };
+
+ next.ok = function () {
+ var args = slice.call(arguments);
+ args.unshift(null);
+ return next.apply(next, args);
+ };
+
+ cb.apply(next, arguments);
+ })
+ .seq(function () {
+ context.stack = res.sort().map(function(pair){ return pair[1]; });
+ saw.next();
+ })
+ ;
+ };
+
+ /**
+ * Consumes any errors that occur in `cb`. Calls to `this.into(i)` will place
+ * that value, if accepted by the filter, at the index in the results as
+ * if it were the i-th index before filtering. (This means it will never
+ * override another value, and will only actually appear at i if the filter
+ * accepts all values before i.)
+ */
+ this.seqFilter = function (cb) {
+ var res = [];
+ var lastIdx = context.stack.length - 1;
+
+ this.seqEach(function (x, i) {
+ var self = this;
+
+ var next = function (err, ok) {
+ if (!err && ok)
+ res.push([i, x]);
+ if (i === lastIdx)
+ context.stack = res.sort().map(function(pair){ return pair[1]; });
+ arguments[0] = null; // discard errors
+ self.apply(self, arguments);
+ };
+
+ next.stack = self.stack;
+ next.stack_ = self.stack_;
+ next.vars = self.vars;
+ next.args = self.args;
+ next.error = self.error;
+
+ next.into = function (key) {
+ return function (err, ok) {
+ if (!err && ok)
+ res.push([key, x]);
+ if (i === lastIdx)
+ context.stack = res.sort().map(function(pair){ return pair[1]; });
+ arguments[0] = null; // discard errors
+ self.apply(self, arguments);
+ };
+ };
+
+ next.ok = function () {
+ var args = slice.call(arguments);
+ args.unshift(null);
+ return next.apply(next, args);
+ };
+
+ cb.apply(next, arguments);
+ });
+ };
+
+ [ 'forEach', 'Each', 'Map', 'Filter' ]
+ .forEach(function (name){
+ var isForEach = !!(name === 'forEach')
+ , method ;
+
+ // the seq functions are straight-forward, other than skipping forEach
+ if (!isForEach) {
+ method = 'seq'+name;
+ this[method+'_'] = function (cb) {
+ this[method].call(this, function () {
+ var args = slice.call(arguments);
+ args.unshift(this);
+ cb.apply(this, args);
+ });
+ };
+ }
+
+ // ...but par functions (anything that takes limit+callback) needs special care
+ method = (isForEach ? name : 'par'+name);
+ this[method+'_'] = function (limit, cb) {
+ if (!cb) { cb = limit; limit = undefined; }
+ this[method].call(this, limit, function (){
+ var args = slice.call(arguments);
+ args.unshift(this);
+ cb.apply(this, args);
+ });
+ };
+ }, this)
+ ;
+
+ ['push','pop','shift','unshift','splice','reverse']
+ .forEach(function (name) {
+ this[name] = function () {
+ context.stack[name].apply(
+ context.stack,
+ slice.call(arguments)
+ );
+ saw.next();
+ return this;
+ };
+ }, this)
+ ;
+
+ [ 'map', 'filter', 'reduce' ]
+ .forEach(function (name) {
+ this[name] = function () {
+ var res = context.stack[name].apply(
+ context.stack,
+ slice.call(arguments)
+ );
+ // stack must be an array, or bad things happen
+ context.stack = (Array.isArray(res) ? res : [res]);
+ saw.next();
+ return this;
+ };
+ }, this)
+ ;
+
+ this.extend = function (xs) {
+ if (!Array.isArray(xs)) {
+ throw new Error('argument to .extend() is not an Array');
+ }
+ context.stack.push.apply(context.stack, xs);
+ saw.next();
+ };
+
+ this.flatten = function (pancake) {
+ var xs = [];
+ // should we fully flatten this array? (default: true)
+ if (pancake === undefined) { pancake = true; }
+ context.stack.forEach(function f (x) {
+ if (Array.isArray(x) && pancake) x.forEach(f);
+ else if (Array.isArray(x)) xs = xs.concat(x);
+ else xs.push(x);
+ });
+ context.stack = xs;
+ saw.next();
+ };
+
+ this.unflatten = function () {
+ context.stack = [context.stack];
+ saw.next();
+ };
+
+ this.empty = function () {
+ context.stack = [];
+ saw.next();
+ };
+
+ this.set = function (stack) {
+ context.stack = stack;
+ saw.next();
+ };
+
+ this['do'] = function (cb) {
+ saw.nest(cb, context);
+ };
+
+}
+
+});
+
+require.define("events", function (require, module, exports, __dirname, __filename) {
+if (!process.EventEmitter) process.EventEmitter = function () {};
+
+var EventEmitter = exports.EventEmitter = process.EventEmitter;
+var isArray = typeof Array.isArray === 'function'
+ ? Array.isArray
+ : function (xs) {
+ return Object.toString.call(xs) === '[object Array]'
+ }
+;
+
+// By default EventEmitters will print a warning if more than
+// 10 listeners are added to it. This is a useful default which
+// helps finding memory leaks.
+//
+// Obviously not all Emitters should be limited to 10. This function allows
+// that to be increased. Set to zero for unlimited.
+var defaultMaxListeners = 10;
+EventEmitter.prototype.setMaxListeners = function(n) {
+ if (!this._events) this._events = {};
+ this._events.maxListeners = n;
+};
+
+
+EventEmitter.prototype.emit = function(type) {
+ // If there is no 'error' event listener then throw.
+ if (type === 'error') {
+ if (!this._events || !this._events.error ||
+ (isArray(this._events.error) && !this._events.error.length))
+ {
+ if (arguments[1] instanceof Error) {
+ throw arguments[1]; // Unhandled 'error' event
+ } else {
+ throw new Error("Uncaught, unspecified 'error' event.");
+ }
+ return false;
+ }
+ }
+
+ if (!this._events) return false;
+ var handler = this._events[type];
+ if (!handler) return false;
+
+ if (typeof handler == 'function') {
+ switch (arguments.length) {
+ // fast cases
+ case 1:
+ handler.call(this);
+ break;
+ case 2:
+ handler.call(this, arguments[1]);
+ break;
+ case 3:
+ handler.call(this, arguments[1], arguments[2]);
+ break;
+ // slower
+ default:
+ var args = Array.prototype.slice.call(arguments, 1);
+ handler.apply(this, args);
+ }
+ return true;
+
+ } else if (isArray(handler)) {
+ var args = Array.prototype.slice.call(arguments, 1);
+
+ var listeners = handler.slice();
+ for (var i = 0, l = listeners.length; i < l; i++) {
+ listeners[i].apply(this, args);
+ }
+ return true;
+
+ } else {
+ return false;
+ }
+};
+
+// EventEmitter is defined in src/node_events.cc
+// EventEmitter.prototype.emit() is also defined there.
+EventEmitter.prototype.addListener = function(type, listener) {
+ if ('function' !== typeof listener) {
+ throw new Error('addListener only takes instances of Function');
+ }
+
+ if (!this._events) this._events = {};
+
+ // To avoid recursion in the case that type == "newListeners"! Before
+ // adding it to the listeners, first emit "newListeners".
+ this.emit('newListener', type, listener);
+
+ if (!this._events[type]) {
+ // Optimize the case of one listener. Don't need the extra array object.
+ this._events[type] = listener;
+ } else if (isArray(this._events[type])) {
+
+ // Check for listener leak
+ if (!this._events[type].warned) {
+ var m;
+ if (this._events.maxListeners !== undefined) {
+ m = this._events.maxListeners;
+ } else {
+ m = defaultMaxListeners;
+ }
+
+ if (m && m > 0 && this._events[type].length > m) {
+ this._events[type].warned = true;
+ console.error('(node) warning: possible EventEmitter memory ' +
+ 'leak detected. %d listeners added. ' +
+ 'Use emitter.setMaxListeners() to increase limit.',
+ this._events[type].length);
+ console.trace();
+ }
+ }
+
+ // If we've already got an array, just append.
+ this._events[type].push(listener);
+ } else {
+ // Adding the second element, need to change to array.
+ this._events[type] = [this._events[type], listener];
+ }
+
+ return this;
+};
+
+EventEmitter.prototype.on = EventEmitter.prototype.addListener;
+
+EventEmitter.prototype.once = function(type, listener) {
+ var self = this;
+ self.on(type, function g() {
+ self.removeListener(type, g);
+ listener.apply(this, arguments);
+ });
+
+ return this;
+};
+
+EventEmitter.prototype.removeListener = function(type, listener) {
+ if ('function' !== typeof listener) {
+ throw new Error('removeListener only takes instances of Function');
+ }
+
+ // does not use listeners(), so no side effect of creating _events[type]
+ if (!this._events || !this._events[type]) return this;
+
+ var list = this._events[type];
+
+ if (isArray(list)) {
+ var i = list.indexOf(listener);
+ if (i < 0) return this;
+ list.splice(i, 1);
+ if (list.length == 0)
+ delete this._events[type];
+ } else if (this._events[type] === listener) {
+ delete this._events[type];
+ }
+
+ return this;
+};
+
+EventEmitter.prototype.removeAllListeners = function(type) {
+ // does not use listeners(), so no side effect of creating _events[type]
+ if (type && this._events && this._events[type]) this._events[type] = null;
+ return this;
+};
+
+EventEmitter.prototype.listeners = function(type) {
+ if (!this._events) this._events = {};
+ if (!this._events[type]) this._events[type] = [];
+ if (!isArray(this._events[type])) {
+ this._events[type] = [this._events[type]];
+ }
+ return this._events[type];
+};
+
+});
+
+require.define("/node_modules/seq/node_modules/hashish/package.json", function (require, module, exports, __dirname, __filename) {
+module.exports = {"main":"./index.js"}
+});
+
+require.define("/node_modules/seq/node_modules/hashish/index.js", function (require, module, exports, __dirname, __filename) {
+module.exports = Hash;
+var Traverse = require('traverse');
+
+function Hash (hash, xs) {
+ if (Array.isArray(hash) && Array.isArray(xs)) {
+ var to = Math.min(hash.length, xs.length);
+ var acc = {};
+ for (var i = 0; i < to; i++) {
+ acc[hash[i]] = xs[i];
+ }
+ return Hash(acc);
+ }
+
+ if (hash === undefined) return Hash({});
+
+ var self = {
+ map : function (f) {
+ var acc = { __proto__ : hash.__proto__ };
+ Object.keys(hash).forEach(function (key) {
+ acc[key] = f.call(self, hash[key], key);
+ });
+ return Hash(acc);
+ },
+ forEach : function (f) {
+ Object.keys(hash).forEach(function (key) {
+ f.call(self, hash[key], key);
+ });
+ return self;
+ },
+ filter : function (f) {
+ var acc = { __proto__ : hash.__proto__ };
+ Object.keys(hash).forEach(function (key) {
+ if (f.call(self, hash[key], key)) {
+ acc[key] = hash[key];
+ }
+ });
+ return Hash(acc);
+ },
+ detect : function (f) {
+ for (var key in hash) {
+ if (f.call(self, hash[key], key)) {
+ return hash[key];
+ }
+ }
+ return undefined;
+ },
+ reduce : function (f, acc) {
+ var keys = Object.keys(hash);
+ if (acc === undefined) acc = keys.shift();
+ keys.forEach(function (key) {
+ acc = f.call(self, acc, hash[key], key);
+ });
+ return acc;
+ },
+ some : function (f) {
+ for (var key in hash) {
+ if (f.call(self, hash[key], key)) return true;
+ }
+ return false;
+ },
+ update : function (obj) {
+ if (arguments.length > 1) {
+ self.updateAll([].slice.call(arguments));
+ }
+ else {
+ Object.keys(obj).forEach(function (key) {
+ hash[key] = obj[key];
+ });
+ }
+ return self;
+ },
+ updateAll : function (xs) {
+ xs.filter(Boolean).forEach(function (x) {
+ self.update(x);
+ });
+ return self;
+ },
+ merge : function (obj) {
+ if (arguments.length > 1) {
+ return self.copy.updateAll([].slice.call(arguments));
+ }
+ else {
+ return self.copy.update(obj);
+ }
+ },
+ mergeAll : function (xs) {
+ return self.copy.updateAll(xs);
+ },
+ has : function (key) { // only operates on enumerables
+ return Array.isArray(key)
+ ? key.every(function (k) { return self.has(k) })
+ : self.keys.indexOf(key.toString()) >= 0;
+ },
+ valuesAt : function (keys) {
+ return Array.isArray(keys)
+ ? keys.map(function (key) { return hash[key] })
+ : hash[keys]
+ ;
+ },
+ tap : function (f) {
+ f.call(self, hash);
+ return self;
+ },
+ extract : function (keys) {
+ var acc = {};
+ keys.forEach(function (key) {
+ acc[key] = hash[key];
+ });
+ return Hash(acc);
+ },
+ exclude : function (keys) {
+ return self.filter(function (_, key) {
+ return keys.indexOf(key) < 0
+ });
+ },
+ end : hash,
+ items : hash
+ };
+
+ var props = {
+ keys : function () { return Object.keys(hash) },
+ values : function () {
+ return Object.keys(hash).map(function (key) { return hash[key] });
+ },
+ compact : function () {
+ return self.filter(function (x) { return x !== undefined });
+ },
+ clone : function () { return Hash(Hash.clone(hash)) },
+ copy : function () { return Hash(Hash.copy(hash)) },
+ length : function () { return Object.keys(hash).length },
+ size : function () { return self.length }
+ };
+
+ if (Object.defineProperty) {
+ // es5-shim has an Object.defineProperty but it throws for getters
+ try {
+ for (var key in props) {
+ Object.defineProperty(self, key, { get : props[key] });
+ }
+ }
+ catch (err) {
+ for (var key in props) {
+ if (key !== 'clone' && key !== 'copy' && key !== 'compact') {
+ // ^ those keys use Hash() so can't call them without
+ // a stack overflow
+ self[key] = props[key]();
+ }
+ }
+ }
+ }
+ else if (self.__defineGetter__) {
+ for (var key in props) {
+ self.__defineGetter__(key, props[key]);
+ }
+ }
+ else {
+ // non-lazy version for browsers that suck >_<
+ for (var key in props) {
+ self[key] = props[key]();
+ }
+ }
+
+ return self;
+};
+
+// deep copy
+Hash.clone = function (ref) {
+ return Traverse.clone(ref);
+};
+
+// shallow copy
+Hash.copy = function (ref) {
+ var hash = { __proto__ : ref.__proto__ };
+ Object.keys(ref).forEach(function (key) {
+ hash[key] = ref[key];
+ });
+ return hash;
+};
+
+Hash.map = function (ref, f) {
+ return Hash(ref).map(f).items;
+};
+
+Hash.forEach = function (ref, f) {
+ Hash(ref).forEach(f);
+};
+
+Hash.filter = function (ref, f) {
+ return Hash(ref).filter(f).items;
+};
+
+Hash.detect = function (ref, f) {
+ return Hash(ref).detect(f);
+};
+
+Hash.reduce = function (ref, f, acc) {
+ return Hash(ref).reduce(f, acc);
+};
+
+Hash.some = function (ref, f) {
+ return Hash(ref).some(f);
+};
+
+Hash.update = function (a /*, b, c, ... */) {
+ var args = Array.prototype.slice.call(arguments, 1);
+ var hash = Hash(a);
+ return hash.update.apply(hash, args).items;
+};
+
+Hash.merge = function (a /*, b, c, ... */) {
+ var args = Array.prototype.slice.call(arguments, 1);
+ var hash = Hash(a);
+ return hash.merge.apply(hash, args).items;
+};
+
+Hash.has = function (ref, key) {
+ return Hash(ref).has(key);
+};
+
+Hash.valuesAt = function (ref, keys) {
+ return Hash(ref).valuesAt(keys);
+};
+
+Hash.tap = function (ref, f) {
+ return Hash(ref).tap(f).items;
+};
+
+Hash.extract = function (ref, keys) {
+ return Hash(ref).extract(keys).items;
+};
+
+Hash.exclude = function (ref, keys) {
+ return Hash(ref).exclude(keys).items;
+};
+
+Hash.concat = function (xs) {
+ var hash = Hash({});
+ xs.forEach(function (x) { hash.update(x) });
+ return hash.items;
+};
+
+Hash.zip = function (xs, ys) {
+ return Hash(xs, ys).items;
+};
+
+// .length is already defined for function prototypes
+Hash.size = function (ref) {
+ return Hash(ref).size;
+};
+
+Hash.compact = function (ref) {
+ return Hash(ref).compact.items;
+};
+
+});
+
+require.define("/node_modules/seq/node_modules/hashish/node_modules/traverse/package.json", function (require, module, exports, __dirname, __filename) {
+module.exports = {"main":"./index"}
+});
+
+require.define("/node_modules/seq/node_modules/hashish/node_modules/traverse/index.js", function (require, module, exports, __dirname, __filename) {
+module.exports = Traverse;
+function Traverse (obj) {
+ if (!(this instanceof Traverse)) return new Traverse(obj);
+ this.value = obj;
+}
+
+Traverse.prototype.get = function (ps) {
+ var node = this.value;
+ for (var i = 0; i < ps.length; i ++) {
+ var key = ps[i];
+ if (!Object.hasOwnProperty.call(node, key)) {
+ node = undefined;
+ break;
+ }
+ node = node[key];
+ }
+ return node;
+};
+
+Traverse.prototype.set = function (ps, value) {
+ var node = this.value;
+ for (var i = 0; i < ps.length - 1; i ++) {
+ var key = ps[i];
+ if (!Object.hasOwnProperty.call(node, key)) node[key] = {};
+ node = node[key];
+ }
+ node[ps[i]] = value;
+ return value;
+};
+
+Traverse.prototype.map = function (cb) {
+ return walk(this.value, cb, true);
+};
+
+Traverse.prototype.forEach = function (cb) {
+ this.value = walk(this.value, cb, false);
+ return this.value;
+};
+
+Traverse.prototype.reduce = function (cb, init) {
+ var skip = arguments.length === 1;
+ var acc = skip ? this.value : init;
+ this.forEach(function (x) {
+ if (!this.isRoot || !skip) {
+ acc = cb.call(this, acc, x);
+ }
+ });
+ return acc;
+};
+
+Traverse.prototype.paths = function () {
+ var acc = [];
+ this.forEach(function (x) {
+ acc.push(this.path);
+ });
+ return acc;
+};
+
+Traverse.prototype.nodes = function () {
+ var acc = [];
+ this.forEach(function (x) {
+ acc.push(this.node);
+ });
+ return acc;
+};
+
+Traverse.prototype.clone = function () {
+ var parents = [], nodes = [];
+
+ return (function clone (src) {
+ for (var i = 0; i < parents.length; i++) {
+ if (parents[i] === src) {
+ return nodes[i];
+ }
+ }
+
+ if (typeof src === 'object' && src !== null) {
+ var dst = copy(src);
+
+ parents.push(src);
+ nodes.push(dst);
+
+ forEach(Object_keys(src), function (key) {
+ dst[key] = clone(src[key]);
+ });
+
+ parents.pop();
+ nodes.pop();
+ return dst;
+ }
+ else {
+ return src;
+ }
+ })(this.value);
+};
+
+function walk (root, cb, immutable) {
+ var path = [];
+ var parents = [];
+ var alive = true;
+
+ return (function walker (node_) {
+ var node = immutable ? copy(node_) : node_;
+ var modifiers = {};
+
+ var keepGoing = true;
+
+ var state = {
+ node : node,
+ node_ : node_,
+ path : [].concat(path),
+ parent : parents[parents.length - 1],
+ parents : parents,
+ key : path.slice(-1)[0],
+ isRoot : path.length === 0,
+ level : path.length,
+ circular : null,
+ update : function (x, stopHere) {
+ if (!state.isRoot) {
+ state.parent.node[state.key] = x;
+ }
+ state.node = x;
+ if (stopHere) keepGoing = false;
+ },
+ 'delete' : function (stopHere) {
+ delete state.parent.node[state.key];
+ if (stopHere) keepGoing = false;
+ },
+ remove : function (stopHere) {
+ if (Array_isArray(state.parent.node)) {
+ state.parent.node.splice(state.key, 1);
+ }
+ else {
+ delete state.parent.node[state.key];
+ }
+ if (stopHere) keepGoing = false;
+ },
+ keys : null,
+ before : function (f) { modifiers.before = f },
+ after : function (f) { modifiers.after = f },
+ pre : function (f) { modifiers.pre = f },
+ post : function (f) { modifiers.post = f },
+ stop : function () { alive = false },
+ block : function () { keepGoing = false }
+ };
+
+ if (!alive) return state;
+
+ if (typeof node === 'object' && node !== null) {
+ state.keys = Object_keys(node);
+
+ state.isLeaf = state.keys.length == 0;
+
+ for (var i = 0; i < parents.length; i++) {
+ if (parents[i].node_ === node_) {
+ state.circular = parents[i];
+ break;
+ }
+ }
+ }
+ else {
+ state.isLeaf = true;
+ }
+
+ state.notLeaf = !state.isLeaf;
+ state.notRoot = !state.isRoot;
+
+ // use return values to update if defined
+ var ret = cb.call(state, state.node);
+ if (ret !== undefined && state.update) state.update(ret);
+
+ if (modifiers.before) modifiers.before.call(state, state.node);
+
+ if (!keepGoing) return state;
+
+ if (typeof state.node == 'object'
+ && state.node !== null && !state.circular) {
+ parents.push(state);
+
+ forEach(state.keys, function (key, i) {
+ path.push(key);
+
+ if (modifiers.pre) modifiers.pre.call(state, state.node[key], key);
+
+ var child = walker(state.node[key]);
+ if (immutable && Object.hasOwnProperty.call(state.node, key)) {
+ state.node[key] = child.node;
+ }
+
+ child.isLast = i == state.keys.length - 1;
+ child.isFirst = i == 0;
+
+ if (modifiers.post) modifiers.post.call(state, child);
+
+ path.pop();
+ });
+ parents.pop();
+ }
+
+ if (modifiers.after) modifiers.after.call(state, state.node);
+
+ return state;
+ })(root).node;
+}
+
+function copy (src) {
+ if (typeof src === 'object' && src !== null) {
+ var dst;
+
+ if (Array_isArray(src)) {
+ dst = [];
+ }
+ else if (src instanceof Date) {
+ dst = new Date(src);
+ }
+ else if (src instanceof Boolean) {
+ dst = new Boolean(src);
+ }
+ else if (src instanceof Number) {
+ dst = new Number(src);
+ }
+ else if (src instanceof String) {
+ dst = new String(src);
+ }
+ else if (Object.create && Object.getPrototypeOf) {
+ dst = Object.create(Object.getPrototypeOf(src));
+ }
+ else if (src.__proto__ || src.constructor.prototype) {
+ var proto = src.__proto__ || src.constructor.prototype || {};
+ var T = function () {};
+ T.prototype = proto;
+ dst = new T;
+ if (!dst.__proto__) dst.__proto__ = proto;
+ }
+
+ forEach(Object_keys(src), function (key) {
+ dst[key] = src[key];
+ });
+ return dst;
+ }
+ else return src;
+}
+
+var Object_keys = Object.keys || function keys (obj) {
+ var res = [];
+ for (var key in obj) res.push(key)
+ return res;
+};
+
+var Array_isArray = Array.isArray || function isArray (xs) {
+ return Object.prototype.toString.call(xs) === '[object Array]';
+};
+
+var forEach = function (xs, fn) {
+ if (xs.forEach) return xs.forEach(fn)
+ else for (var i = 0; i < xs.length; i++) {
+ fn(xs[i], i, xs);
+ }
+};
+
+forEach(Object_keys(Traverse.prototype), function (key) {
+ Traverse[key] = function (obj) {
+ var args = [].slice.call(arguments, 1);
+ var t = Traverse(obj);
+ return t[key].apply(t, args);
+ };
+});
+
+});
+
+require.define("/node_modules/seq/node_modules/chainsaw/package.json", function (require, module, exports, __dirname, __filename) {
+module.exports = {"main":"./index.js"}
+});
+
+require.define("/node_modules/seq/node_modules/chainsaw/index.js", function (require, module, exports, __dirname, __filename) {
+var Traverse = require('traverse');
+var EventEmitter = require('events').EventEmitter;
+
+module.exports = Chainsaw;
+function Chainsaw (builder) {
+ var saw = Chainsaw.saw(builder, {});
+ var r = builder.call(saw.handlers, saw);
+ if (r !== undefined) saw.handlers = r;
+ return saw.chain();
+};
+
+Chainsaw.saw = function (builder, handlers) {
+ var saw = new EventEmitter;
+ saw.handlers = handlers;
+ saw.actions = [];
+ saw.step = 0;
+
+ saw.chain = function () {
+ var ch = Traverse(saw.handlers).map(function (node) {
+ if (this.isRoot) return node;
+ var ps = this.path;
+
+ if (typeof node === 'function') {
+ this.update(function () {
+ saw.actions.push({
+ path : ps,
+ args : [].slice.call(arguments)
+ });
+ return ch;
+ });
+ }
+ });
+
+ process.nextTick(function () {
+ saw.emit('begin');
+ saw.next();
+ });
+
+ return ch;
+ };
+
+ saw.next = function () {
+ var action = saw.actions[saw.step];
+ saw.step ++;
+
+ if (!action) {
+ saw.emit('end');
+ }
+ else if (!action.trap) {
+ var node = saw.handlers;
+ action.path.forEach(function (key) { node = node[key] });
+ node.apply(saw.handlers, action.args);
+ }
+ };
+
+ saw.nest = function (cb) {
+ var args = [].slice.call(arguments, 1);
+ var autonext = true;
+
+ if (typeof cb === 'boolean') {
+ var autonext = cb;
+ cb = args.shift();
+ }
+
+ var s = Chainsaw.saw(builder, {});
+ var r = builder.call(s.handlers, s);
+
+ if (r !== undefined) s.handlers = r;
+ cb.apply(s.chain(), args);
+ if (autonext !== false) s.on('end', saw.next);
+ };
+
+ saw.trap = function (name, cb) {
+ var ps = Array.isArray(name) ? name : [name];
+ saw.actions.push({
+ path : ps,
+ step : saw.step,
+ cb : cb,
+ trap : true
+ });
+ };
+
+ saw.down = function (name) {
+ var ps = (Array.isArray(name) ? name : [name]).join('/');
+ var i = saw.actions.slice(saw.step).map(function (x) {
+ if (x.trap && x.step <= saw.step) return false;
+ return x.path.join('/') == ps;
+ }).indexOf(true);
+
+ if (i >= 0) saw.step += i;
+ else saw.step = saw.actions.length;
+
+ var act = saw.actions[saw.step - 1];
+ if (act && act.trap) {
+ // It's a trap!
+ saw.step = act.step;
+ act.cb();
+ }
+ else saw.next();
+ };
+
+ saw.jump = function (step) {
+ saw.step = step;
+ saw.next();
+ };
+
+ return saw;
+};
+
+});
+
+require.define("/node_modules/seq/node_modules/chainsaw/node_modules/traverse/package.json", function (require, module, exports, __dirname, __filename) {
+module.exports = {"main":"./index"}
+});
+
+require.define("/node_modules/seq/node_modules/chainsaw/node_modules/traverse/index.js", function (require, module, exports, __dirname, __filename) {
+module.exports = Traverse;
+function Traverse (obj) {
+ if (!(this instanceof Traverse)) return new Traverse(obj);
+ this.value = obj;
+}
+
+Traverse.prototype.get = function (ps) {
+ var node = this.value;
+ for (var i = 0; i < ps.length; i ++) {
+ var key = ps[i];
+ if (!Object.hasOwnProperty.call(node, key)) {
+ node = undefined;
+ break;
+ }
+ node = node[key];
+ }
+ return node;
+};
+
+Traverse.prototype.set = function (ps, value) {
+ var node = this.value;
+ for (var i = 0; i < ps.length - 1; i ++) {
+ var key = ps[i];
+ if (!Object.hasOwnProperty.call(node, key)) node[key] = {};
+ node = node[key];
+ }
+ node[ps[i]] = value;
+ return value;
+};
+
+Traverse.prototype.map = function (cb) {
+ return walk(this.value, cb, true);
+};
+
+Traverse.prototype.forEach = function (cb) {
+ this.value = walk(this.value, cb, false);
+ return this.value;
+};
+
+Traverse.prototype.reduce = function (cb, init) {
+ var skip = arguments.length === 1;
+ var acc = skip ? this.value : init;
+ this.forEach(function (x) {
+ if (!this.isRoot || !skip) {
+ acc = cb.call(this, acc, x);
+ }
+ });
+ return acc;
+};
+
+Traverse.prototype.deepEqual = function (obj) {
+ if (arguments.length !== 1) {
+ throw new Error(
+ 'deepEqual requires exactly one object to compare against'
+ );
+ }
+
+ var equal = true;
+ var node = obj;
+
+ this.forEach(function (y) {
+ var notEqual = (function () {
+ equal = false;
+ //this.stop();
+ return undefined;
+ }).bind(this);
+
+ //if (node === undefined || node === null) return notEqual();
+
+ if (!this.isRoot) {
+ /*
+ if (!Object.hasOwnProperty.call(node, this.key)) {
+ return notEqual();
+ }
+ */
+ if (typeof node !== 'object') return notEqual();
+ node = node[this.key];
+ }
+
+ var x = node;
+
+ this.post(function () {
+ node = x;
+ });
+
+ var toS = function (o) {
+ return Object.prototype.toString.call(o);
+ };
+
+ if (this.circular) {
+ if (Traverse(obj).get(this.circular.path) !== x) notEqual();
+ }
+ else if (typeof x !== typeof y) {
+ notEqual();
+ }
+ else if (x === null || y === null || x === undefined || y === undefined) {
+ if (x !== y) notEqual();
+ }
+ else if (x.__proto__ !== y.__proto__) {
+ notEqual();
+ }
+ else if (x === y) {
+ // nop
+ }
+ else if (typeof x === 'function') {
+ if (x instanceof RegExp) {
+ // both regexps on account of the __proto__ check
+ if (x.toString() != y.toString()) notEqual();
+ }
+ else if (x !== y) notEqual();
+ }
+ else if (typeof x === 'object') {
+ if (toS(y) === '[object Arguments]'
+ || toS(x) === '[object Arguments]') {
+ if (toS(x) !== toS(y)) {
+ notEqual();
+ }
+ }
+ else if (x instanceof Date || y instanceof Date) {
+ if (!(x instanceof Date) || !(y instanceof Date)
+ || x.getTime() !== y.getTime()) {
+ notEqual();
+ }
+ }
+ else {
+ var kx = Object.keys(x);
+ var ky = Object.keys(y);
+ if (kx.length !== ky.length) return notEqual();
+ for (var i = 0; i < kx.length; i++) {
+ var k = kx[i];
+ if (!Object.hasOwnProperty.call(y, k)) {
+ notEqual();
+ }
+ }
+ }
+ }
+ });
+
+ return equal;
+};
+
+Traverse.prototype.paths = function () {
+ var acc = [];
+ this.forEach(function (x) {
+ acc.push(this.path);
+ });
+ return acc;
+};
+
+Traverse.prototype.nodes = function () {
+ var acc = [];
+ this.forEach(function (x) {
+ acc.push(this.node);
+ });
+ return acc;
+};
+
+Traverse.prototype.clone = function () {
+ var parents = [], nodes = [];
+
+ return (function clone (src) {
+ for (var i = 0; i < parents.length; i++) {
+ if (parents[i] === src) {
+ return nodes[i];
+ }
+ }
+
+ if (typeof src === 'object' && src !== null) {
+ var dst = copy(src);
+
+ parents.push(src);
+ nodes.push(dst);
+
+ Object.keys(src).forEach(function (key) {
+ dst[key] = clone(src[key]);
+ });
+
+ parents.pop();
+ nodes.pop();
+ return dst;
+ }
+ else {
+ return src;
+ }
+ })(this.value);
+};
+
+function walk (root, cb, immutable) {
+ var path = [];
+ var parents = [];
+ var alive = true;
+
+ return (function walker (node_) {
+ var node = immutable ? copy(node_) : node_;
+ var modifiers = {};
+
+ var state = {
+ node : node,
+ node_ : node_,
+ path : [].concat(path),
+ parent : parents.slice(-1)[0],
+ key : path.slice(-1)[0],
+ isRoot : path.length === 0,
+ level : path.length,
+ circular : null,
+ update : function (x) {
+ if (!state.isRoot) {
+ state.parent.node[state.key] = x;
+ }
+ state.node = x;
+ },
+ 'delete' : function () {
+ delete state.parent.node[state.key];
+ },
+ remove : function () {
+ if (Array.isArray(state.parent.node)) {
+ state.parent.node.splice(state.key, 1);
+ }
+ else {
+ delete state.parent.node[state.key];
+ }
+ },
+ before : function (f) { modifiers.before = f },
+ after : function (f) { modifiers.after = f },
+ pre : function (f) { modifiers.pre = f },
+ post : function (f) { modifiers.post = f },
+ stop : function () { alive = false }
+ };
+
+ if (!alive) return state;
+
+ if (typeof node === 'object' && node !== null) {
+ state.isLeaf = Object.keys(node).length == 0;
+
+ for (var i = 0; i < parents.length; i++) {
+ if (parents[i].node_ === node_) {
+ state.circular = parents[i];
+ break;
+ }
+ }
+ }
+ else {
+ state.isLeaf = true;
+ }
+
+ state.notLeaf = !state.isLeaf;
+ state.notRoot = !state.isRoot;
+
+ // use return values to update if defined
+ var ret = cb.call(state, state.node);
+ if (ret !== undefined && state.update) state.update(ret);
+ if (modifiers.before) modifiers.before.call(state, state.node);
+
+ if (typeof state.node == 'object'
+ && state.node !== null && !state.circular) {
+ parents.push(state);
+
+ var keys = Object.keys(state.node);
+ keys.forEach(function (key, i) {
+ path.push(key);
+
+ if (modifiers.pre) modifiers.pre.call(state, state.node[key], key);
+
+ var child = walker(state.node[key]);
+ if (immutable && Object.hasOwnProperty.call(state.node, key)) {
+ state.node[key] = child.node;
+ }
+
+ child.isLast = i == keys.length - 1;
+ child.isFirst = i == 0;
+
+ if (modifiers.post) modifiers.post.call(state, child);
+
+ path.pop();
+ });
+ parents.pop();
+ }
+
+ if (modifiers.after) modifiers.after.call(state, state.node);
+
+ return state;
+ })(root).node;
+}
+
+Object.keys(Traverse.prototype).forEach(function (key) {
+ Traverse[key] = function (obj) {
+ var args = [].slice.call(arguments, 1);
+ var t = Traverse(obj);
+ return t[key].apply(t, args);
+ };
+});
+
+function copy (src) {
+ if (typeof src === 'object' && src !== null) {
+ var dst;
+
+ if (Array.isArray(src)) {
+ dst = [];
+ }
+ else if (src instanceof Date) {
+ dst = new Date(src);
+ }
+ else if (src instanceof Boolean) {
+ dst = new Boolean(src);
+ }
+ else if (src instanceof Number) {
+ dst = new Number(src);
+ }
+ else if (src instanceof String) {
+ dst = new String(src);
+ }
+ else {
+ dst = Object.create(Object.getPrototypeOf(src));
+ }
+
+ Object.keys(src).forEach(function (key) {
+ dst[key] = src[key];
+ });
+ return dst;
+ }
+ else return src;
+}
+
+});
+
+require.define("/node_modules/d3/package.json", function (require, module, exports, __dirname, __filename) {
+module.exports = {"main":"index.js","browserify":"index-browserify.js"}
+});
+
+require.define("/node_modules/d3/index-browserify.js", function (require, module, exports, __dirname, __filename) {
+require("./d3.v2");
+module.exports = d3;
+});
+
+require.define("/node_modules/d3/d3.v2.js", function (require, module, exports, __dirname, __filename) {
+(function(){if (!Date.now) Date.now = function() {
+ return +new Date;
+};
+try {
+ document.createElement("div").style.setProperty("opacity", 0, "");
+} catch (error) {
+ var d3_style_prototype = CSSStyleDeclaration.prototype,
+ d3_style_setProperty = d3_style_prototype.setProperty;
+ d3_style_prototype.setProperty = function(name, value, priority) {
+ d3_style_setProperty.call(this, name, value + "", priority);
+ };
+}
+d3 = {version: "2.9.6"}; // semver
+function d3_class(ctor, properties) {
+ try {
+ for (var key in properties) {
+ Object.defineProperty(ctor.prototype, key, {
+ value: properties[key],
+ enumerable: false
+ });
+ }
+ } catch (e) {
+ ctor.prototype = properties;
+ }
+}
+var d3_array = d3_arraySlice; // conversion for NodeLists
+
+function d3_arrayCopy(pseudoarray) {
+ var i = -1, n = pseudoarray.length, array = [];
+ while (++i < n) array.push(pseudoarray[i]);
+ return array;
+}
+
+function d3_arraySlice(pseudoarray) {
+ return Array.prototype.slice.call(pseudoarray);
+}
+
+try {
+ d3_array(document.documentElement.childNodes)[0].nodeType;
+} catch(e) {
+ d3_array = d3_arrayCopy;
+}
+
+var d3_arraySubclass = [].__proto__?
+
+// Until ECMAScript supports array subclassing, prototype injection works well.
+function(array, prototype) {
+ array.__proto__ = prototype;
+}:
+
+// And if your browser doesn't support __proto__, we'll use direct extension.
+function(array, prototype) {
+ for (var property in prototype) array[property] = prototype[property];
+};
+d3.map = function(object) {
+ var map = new d3_Map;
+ for (var key in object) map.set(key, object[key]);
+ return map;
+};
+
+function d3_Map() {}
+
+d3_class(d3_Map, {
+ has: function(key) {
+ return d3_map_prefix + key in this;
+ },
+ get: function(key) {
+ return this[d3_map_prefix + key];
+ },
+ set: function(key, value) {
+ return this[d3_map_prefix + key] = value;
+ },
+ remove: function(key) {
+ key = d3_map_prefix + key;
+ return key in this && delete this[key];
+ },
+ keys: function() {
+ var keys = [];
+ this.forEach(function(key) { keys.push(key); });
+ return keys;
+ },
+ values: function() {
+ var values = [];
+ this.forEach(function(key, value) { values.push(value); });
+ return values;
+ },
+ entries: function() {
+ var entries = [];
+ this.forEach(function(key, value) { entries.push({key: key, value: value}); });
+ return entries;
+ },
+ forEach: function(f) {
+ for (var key in this) {
+ if (key.charCodeAt(0) === d3_map_prefixCode) {
+ f.call(this, key.substring(1), this[key]);
+ }
+ }
+ }
+});
+
+var d3_map_prefix = "\0", // prevent collision with built-ins
+ d3_map_prefixCode = d3_map_prefix.charCodeAt(0);
+function d3_identity(d) {
+ return d;
+}
+function d3_this() {
+ return this;
+}
+function d3_true() {
+ return true;
+}
+function d3_functor(v) {
+ return typeof v === "function" ? v : function() { return v; };
+}
+
+d3.functor = d3_functor;
+// Copies a variable number of methods from source to target.
+d3.rebind = function(target, source) {
+ var i = 1, n = arguments.length, method;
+ while (++i < n) target[method = arguments[i]] = d3_rebind(target, source, source[method]);
+ return target;
+};
+
+// Method is assumed to be a standard D3 getter-setter:
+// If passed with no arguments, gets the value.
+// If passed with arguments, sets the value and returns the target.
+function d3_rebind(target, source, method) {
+ return function() {
+ var value = method.apply(source, arguments);
+ return arguments.length ? target : value;
+ };
+}
+d3.ascending = function(a, b) {
+ return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;
+};
+d3.descending = function(a, b) {
+ return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN;
+};
+d3.mean = function(array, f) {
+ var n = array.length,
+ a,
+ m = 0,
+ i = -1,
+ j = 0;
+ if (arguments.length === 1) {
+ while (++i < n) if (d3_number(a = array[i])) m += (a - m) / ++j;
+ } else {
+ while (++i < n) if (d3_number(a = f.call(array, array[i], i))) m += (a - m) / ++j;
+ }
+ return j ? m : undefined;
+};
+d3.median = function(array, f) {
+ if (arguments.length > 1) array = array.map(f);
+ array = array.filter(d3_number);
+ return array.length ? d3.quantile(array.sort(d3.ascending), .5) : undefined;
+};
+d3.min = function(array, f) {
+ var i = -1,
+ n = array.length,
+ a,
+ b;
+ if (arguments.length === 1) {
+ while (++i < n && ((a = array[i]) == null || a != a)) a = undefined;
+ while (++i < n) if ((b = array[i]) != null && a > b) a = b;
+ } else {
+ while (++i < n && ((a = f.call(array, array[i], i)) == null || a != a)) a = undefined;
+ while (++i < n) if ((b = f.call(array, array[i], i)) != null && a > b) a = b;
+ }
+ return a;
+};
+d3.max = function(array, f) {
+ var i = -1,
+ n = array.length,
+ a,
+ b;
+ if (arguments.length === 1) {
+ while (++i < n && ((a = array[i]) == null || a != a)) a = undefined;
+ while (++i < n) if ((b = array[i]) != null && b > a) a = b;
+ } else {
+ while (++i < n && ((a = f.call(array, array[i], i)) == null || a != a)) a = undefined;
+ while (++i < n) if ((b = f.call(array, array[i], i)) != null && b > a) a = b;
+ }
+ return a;
+};
+d3.extent = function(array, f) {
+ var i = -1,
+ n = array.length,
+ a,
+ b,
+ c;
+ if (arguments.length === 1) {
+ while (++i < n && ((a = c = array[i]) == null || a != a)) a = c = undefined;
+ while (++i < n) if ((b = array[i]) != null) {
+ if (a > b) a = b;
+ if (c < b) c = b;
+ }
+ } else {
+ while (++i < n && ((a = c = f.call(array, array[i], i)) == null || a != a)) a = undefined;
+ while (++i < n) if ((b = f.call(array, array[i], i)) != null) {
+ if (a > b) a = b;
+ if (c < b) c = b;
+ }
+ }
+ return [a, c];
+};
+d3.random = {
+ normal: function(mean, deviation) {
+ if (arguments.length < 2) deviation = 1;
+ if (arguments.length < 1) mean = 0;
+ return function() {
+ var x, y, r;
+ do {
+ x = Math.random() * 2 - 1;
+ y = Math.random() * 2 - 1;
+ r = x * x + y * y;
+ } while (!r || r > 1);
+ return mean + deviation * x * Math.sqrt(-2 * Math.log(r) / r);
+ };
+ }
+};
+function d3_number(x) {
+ return x != null && !isNaN(x);
+}
+d3.sum = function(array, f) {
+ var s = 0,
+ n = array.length,
+ a,
+ i = -1;
+
+ if (arguments.length === 1) {
+ while (++i < n) if (!isNaN(a = +array[i])) s += a;
+ } else {
+ while (++i < n) if (!isNaN(a = +f.call(array, array[i], i))) s += a;
+ }
+
+ return s;
+};
+// R-7 per <http://en.wikipedia.org/wiki/Quantile>
+d3.quantile = function(values, p) {
+ var H = (values.length - 1) * p + 1,
+ h = Math.floor(H),
+ v = values[h - 1],
+ e = H - h;
+ return e ? v + e * (values[h] - v) : v;
+};
+d3.transpose = function(matrix) {
+ return d3.zip.apply(d3, matrix);
+};
+d3.zip = function() {
+ if (!(n = arguments.length)) return [];
+ for (var i = -1, m = d3.min(arguments, d3_zipLength), zips = new Array(m); ++i < m;) {
+ for (var j = -1, n, zip = zips[i] = new Array(n); ++j < n;) {
+ zip[j] = arguments[j][i];
+ }
+ }
+ return zips;
+};
+
+function d3_zipLength(d) {
+ return d.length;
+}
+d3.bisector = function(f) {
+ return {
+ left: function(a, x, lo, hi) {
+ if (arguments.length < 3) lo = 0;
+ if (arguments.length < 4) hi = a.length;
+ while (lo < hi) {
+ var mid = lo + hi >> 1;
+ if (f.call(a, a[mid], mid) < x) lo = mid + 1;
+ else hi = mid;
+ }
+ return lo;
+ },
+ right: function(a, x, lo, hi) {
+ if (arguments.length < 3) lo = 0;
+ if (arguments.length < 4) hi = a.length;
+ while (lo < hi) {
+ var mid = lo + hi >> 1;
+ if (x < f.call(a, a[mid], mid)) hi = mid;
+ else lo = mid + 1;
+ }
+ return lo;
+ }
+ };
+};
+
+var d3_bisector = d3.bisector(function(d) { return d; });
+d3.bisectLeft = d3_bisector.left;
+d3.bisect = d3.bisectRight = d3_bisector.right;
+d3.first = function(array, f) {
+ var i = 0,
+ n = array.length,
+ a = array[0],
+ b;
+ if (arguments.length === 1) f = d3.ascending;
+ while (++i < n) {
+ if (f.call(array, a, b = array[i]) > 0) {
+ a = b;
+ }
+ }
+ return a;
+};
+d3.last = function(array, f) {
+ var i = 0,
+ n = array.length,
+ a = array[0],
+ b;
+ if (arguments.length === 1) f = d3.ascending;
+ while (++i < n) {
+ if (f.call(array, a, b = array[i]) <= 0) {
+ a = b;
+ }
+ }
+ return a;
+};
+d3.nest = function() {
+ var nest = {},
+ keys = [],
+ sortKeys = [],
+ sortValues,
+