diff --git a/benchmark/waltzDb/benchmark.js b/benchmark/waltzDb/benchmark.js
index d3de114..47e2f14 100644
--- a/benchmark/waltzDb/benchmark.js
+++ b/benchmark/waltzDb/benchmark.js
@@ -3,7 +3,7 @@ var data = require("./data"),
nools = require("../../index");
var flow = nools.compile(__dirname + "/waltzDb.nools");
-var items = data.load(flow).waltzdb4;
+var items = data.load(flow).waltzdb8;
var session = flow.getSession.apply(flow, items);
session.assert(new (flow.getDefined("stage"))({value: "DUPLICATE"}));
var start = new Date();
diff --git a/docs/History.html b/docs/History.html
index 099d248..96c4221 100644
--- a/docs/History.html
+++ b/docs/History.html
@@ -178,6 +178,12 @@
+
0.1.13
+
+- Fixed issue #68 where
matchUntilHalt
uses a lot of CPU
+- Fixed issue #45, now compiled rules support
or
constraint with more than 2 inner constraints.
+- Added new feature to address #76, now you can use
deleteFlows
to dispose all flows, or use hasFlow
to check if a flow is already registred with nools
.
+
0.1.12
- Fixed issue in node v0.6 where path.sep is not found.
diff --git a/docs/index.html b/docs/index.html
index b696f46..1531906 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -195,6 +195,8 @@ Usage
- Firing
- Disposing
- Removing A Flow
+- Removing All Flows
+- Checking If A Flow Exists
- Agenda Group
var myFlow = nools.flow("flow");
+
+nools.deleteFlows(); //returns nools for chaining
+
+nools.getFlow("flow"); //undefined
+
+Checking If A Flow Exists
+To check if a flow currently is registering with nools
use the hasFlow
function;
+var myFlow = nools.flow("flow");
+
+nools.hasFlow("flow"); //true
Agenda Groups
Agenda groups allow for logical groups of rules within a flow.
diff --git a/docs/nools.js b/docs/nools.js
index cc1654d..0598343 100644
--- a/docs/nools.js
+++ b/docs/nools.js
@@ -1,10 +1,10 @@
-/*! nools - v0.1.12 - 2013-09-05
+/*! nools - v0.1.13 - 2013-09-24
* http://c2fo.github.com/nools
* Copyright (c) 2013 Doug Martin (http://c2fo.com); Licensed */
-!function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);throw new Error("Cannot find module '"+g+"'")}var j=c[g]={exports:{}};b[g][0].call(j.exports,function(a){var c=b[g][1][a];return e(c?c:a)},j,j.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;gf&&j>f&&f++;);c=g[f]-h[f],c||(c=i-j)}return c||(c=a.recency-b.recency),c>0?1:-1},j=e({instance:{constructor:function(){this.memory={},this.memoryValues=new g},clear:function(){this.memoryValues.clear(),this.memory={},this.memory.length=this.memoryValues.length=0},get:function(a){var b=this.memory[a.id];return b?b.data:[]},remove:function(a){for(var b,c,e,f,g=a.match.facts,h=g.length,i=this.memoryValues,j=this.memory,k=-1;++k-1;)c=h[i],f.remove(c),e.remove(c),g.remove(c);h.length=0},retract:function(a,b){var c=this.rules[a.name],d=c.tree,e=c.factTable,f=this.getAgendaGroup(a.rule.agendaGroup);d.traverse(d.__root,k,function(a){b(a)&&(e.remove(a),f.remove(a),d.remove(a))})},insert:function(a,b){var c=this.rules[a.name],d=a.rule,e=d.agendaGroup;c.tree.insert(b),this.getAgendaGroup(e).insert(b),e&&d.autoFocus&&this.setFocus(e),c.factTable.insert(b)},dispose:function(){for(var a in this.agendaGroups)this.agendaGroups[a].clear();var b=this.rules;for(a in b)a in b&&(b[a].tree.clear(),b[a].factTable.clear());this.rules={}}}})},{"./extended":10,events:44}],4:[function(require,module,exports){"use strict";var extd=require("../extended"),forEach=extd.forEach,isString=extd.isString;exports.modifiers=["assert","modify","retract","emit","halt","focus"];var createFunction=function(body,defined,scope,scopeNames,definedNames){var declares=[];forEach(definedNames,function(a){-1!==body.indexOf(a)&&declares.push("var "+a+"= defined."+a+";")}),forEach(scopeNames,function(a){-1!==body.indexOf(a)&&declares.push("var "+a+"= scope."+a+";")}),body=["((function(){",declares.join(""),"\n return ",body,"\n})())"].join("");try{return eval(body)}catch(e){throw new Error("Invalid action : "+body+"\n"+e.message)}},createDefined=function(){var a=function(a){a=isString(a)?new Function("return "+a+";")():a;var b=a.hasOwnProperty("constructor")&&"function"==typeof a.constructor?a.constructor:function(b){b=b||{};for(var c in b)c in a&&(this[c]=b[c])},c=b.prototype;for(var d in a)c[d]=a[d];return b};return function(b){return a(b.properties)}}();exports.createFunction=createFunction,exports.createDefined=createDefined},{"../extended":10}],5:[function(a,b,c){var d=a("__browserify_Buffer").Buffer,e=a("../extended"),f=a("../parser"),g=a("../constraintMatcher.js"),h=e.indexOf,i=e.forEach,j=e.removeDuplicates,k=e.map,l=e.hash,m=l.keys,n=e.merge,o=a("../rule"),p=a("./common"),q=p.createDefined,r=p.createFunction,s=function(a,b,c,d){var f=[];i(b,function(b){-1!==a.indexOf(b)&&f.push("var "+b+"= facts."+b+";")}),e(c).keys().forEach(function(b){-1!==a.indexOf(b)&&f.push("var "+b+"= defined."+b+";")}),e(d).keys().forEach(function(b){-1!==a.indexOf(b)&&f.push("var "+b+"= scope."+b+";")});var g=["facts","flow"];/next\(.*\)/.test(a)&&g.push("next"),a="with(flow){"+f.join("")+a+"}";try{return new Function("defined, scope","return "+new Function(g.join(","),a).toString())(c,d)}catch(h){throw new Error("Invalid action : "+a+"\n"+h.message)}},t=function(){var a=function(a,b,c,d,j){var k=[],l=a[0],m=a[1],n=a[2],o=a[3];if(e.isHash(n)&&(o=n,n=null),!l||!(l=d[l]))throw new Error("Invalid class "+a[0]+" for rule "+j);if(k.push(l),k.push(m,n,o),c.push(k),b.push(m),n&&i(g.getIdentifiers(f.parseConstraint(n)),function(a){b.push(a)}),e.isObject(o))for(var p in o){var q=o[p];-1===h(b,q)&&b.push(q)}};return function(b,c,d){var f=b.name;if(e.isEmpty(b))throw new Error("Rule is empty");var g=b.options||{};g.scope=d;var h=b.constraints||[],k=h.length;k||(h=["true"]);var l=b.action;if(e.isUndefined(l))throw new Error("No action was defined for rule "+f);var m=[],n=[];return e(h).forEach(function(b){if(b.length){var d=b[0];if("not"===d){var e=[];b.shift(),a(b,n,e,c,f);var g=e[0];g.unshift(d),m.push(g)}else if("or"===d){var h=[d];b.shift(),i(b,function(b){a(b,n,h,c,f)}),m.push(h)}else a(b,n,m,c,f),n=j(n)}}),o.createRule(f,g,m,s(l,n,c,d))}}();c.parse=function(a,b){return f.parseRuleSet(a,b)},c.compile=function(a,b,c,f){e.isFunction(b)?(c=b,b={}):(b=b||{},c=null);var g=a.name||b.name;if(!g)throw new Error("Name must be present in JSON or options");var h=new f(g),j=n({Array:Array,String:String,Number:Number,Boolean:Boolean,RegExp:RegExp,Date:Date,Object:Object},b.define||{});"undefined"!=typeof d&&(j.Buffer=d);var l=n({console:console},b.scope);i(a.define,function(a){j[a.name]=q(a)}),e(j).forEach(function(a,b){h.addDefined(b,a)});var o=e(a.scope).pluck("name").union(e(l).keys().value()).value(),p=k(m(j),function(a){return a});i(a.scope,function(a){l[a.name]=r(a.body,j,l,o,p)});var s=a.rules;return s.length&&i(s,function(a){h.__rules=h.__rules.concat(t(a,j,l))}),c&&c.call(h,h),h},c.transpile=a("./transpile").transpile},{"../constraintMatcher.js":8,"../extended":10,"../parser":28,"../rule":33,"./common":4,"./transpile":6,__browserify_Buffer:47}],6:[function(a,b,c){function d(a){a=l(a)?new Function("return "+a+";")():a;var b,c=["(function(){"];a.hasOwnProperty("constructor")&&"function"==typeof a.constructor?c.push("var Defined = "+a.constructor.toString()+";"):c.push("var Defined = function(opts){ for(var i in opts){if(opts.hasOwnProperty(i)){this[i] = opts[i];}}};"),c.push("var proto = Defined.prototype;");for(var d in a)a.hasOwnProperty(d)&&(b=a[d],c.push("proto."+d+" = "+(h.isFunction(b)?b.toString():h.format("%j",b))+";"));return c.push("return Defined;"),c.push("}())"),c.join("")}function e(a,b,c,d){var e=[];i(b,function(b){-1!==a.indexOf(b)&&e.push("var "+b+"= facts."+b+";")}),h(c).keys().forEach(function(b){-1!==a.indexOf(b)&&e.push("var "+b+"= defined."+b+";")}),h(d).keys().forEach(function(b){-1!==a.indexOf(b)&&e.push("var "+b+"= scope."+b+";")});var f=["facts","flow"];/next\(.*\)/.test(a)&&f.push("next"),a=e.join("")+a;try{return["function(",f.join(","),"){with(flow){",a,"}}"].join("")}catch(g){throw new Error("Invalid action : "+a+"\n"+g.message)}}function f(a,b){a=a.slice(0);var c=[];if("or"===a[0])return c.push('["'+a.shift()+'"'),c.push(h.map(a,function(a){return f(a,b)}).join(",")+"]"),c;if("not"===a[0]&&c.push('"',a.shift(),'", '),b.push(a[1]),c.push(a[0],', "'+a[1].replace(/"/g,'\\"')+'"'),a.splice(0,2),a.length){var d=a.shift();h.isString(d)?(c.push(',"'+d.replace(/"/g,'\\"'),'"'),i(m.getIdentifiers(n.parseConstraint(d)),function(a){b.push(a)})):(c.push(',"true"'),a.unshift(d))}if(a.length){var e=a.shift();h(e).values().forEach(function(a){-1===j(b,a)&&b.push(a)}),c.push(","+h.format("%j",[e]))}return"["+c.join("")+"]"}var g=a("__browserify_Buffer").Buffer,h=a("../extended"),i=h.forEach,j=h.indexOf,k=h.merge,l=h.isString,m=a("../constraintMatcher"),n=a("../parser");c.transpile=function(a,b){b=b||{};var c=[];c.push("(function(){"),c.push("return function(options){"),c.push("options = options || {};"),c.push("var bind = function(scope, fn){return function(){return fn.apply(scope, arguments);};}, defined = options.defined || {}, scope = options.scope || {};");var i=k({Array:Array,String:String,Number:Number,Boolean:Boolean,RegExp:RegExp,Date:Date,Object:Object},b.define||{});"undefined"!=typeof g&&(i.Buffer=g);var j=k({console:console},b.scope);return c.push(["return nools.flow('",b.name,"', function(){"].join("")),c.push(h(a.define||[]).map(function(a){var b=a.name;return a[b]={},["var",b,"= defined."+b,"= this.addDefined('"+b+"',",d(a.properties)+");"].join(" ")}).value().join("\n")),c.push(h(a.scope||[]).map(function(a){var b=a.name;return j[b]={},["var",b,"= scope."+b,"= ",a.body,";"].join(" ")}).value().join("\n")),c.push("scope.console = console;\n"),c.push(h(a.rules||[]).map(function(a){var b=[],c=["this.rule('",a.name.replace(/'/g,"\\'"),"'"],d=h.merge(a.options||{},{scope:"scope"});return c.push(",",h.format("%j",[d]).replace(/(:"scope")/,":scope")),a.constraints&&!h.isEmpty(a.constraints)&&(c.push(", ["),c.push(h(a.constraints).map(function(a){return f(a,b)}).value().join(",")),c.push("]")),c.push(",",e(a.action,b,i,j)),c.push(");"),c.join("")}).value().join("")),c.push("});"),c.push("};"),c.push("}());"),c.join("")}},{"../constraintMatcher":8,"../extended":10,"../parser":28,__browserify_Buffer:47}],7:[function(a,b,c){"use strict";var d,e=a("./extended"),f=e.merge,g=e.instanceOf,h=e.filter,i=e.declare,j=i({instance:{constructor:function(b,c){d||(d=a("./constraintMatcher")),this.type=b,this.constraint=c},assert:function(){throw new Error("not implemented")},equal:function(a){return g(a,this._static)&&this.get("alias")===a.get("alias")&&e.deepEqual(this.constraint,a.constraint)},getters:{variables:function(){return[this.get("alias")]}}}});j.extend({instance:{constructor:function(a){this._super(["object",a])},assert:function(a){return a instanceof this.constraint||a.constructor===this.constraint},equal:function(a){return g(a,this._static)&&this.constraint===a.constraint}}}).as(c,"ObjectConstraint"),j.extend({instance:{constructor:function(a,b){this._super(["equality",a]),b=b||{},this.pattern=b.pattern,this._matcher=d.getMatcher(a,b.scope||{})},assert:function(a){return this._matcher(a)}}}).as(c,"EqualityConstraint"),j.extend({instance:{constructor:function(){this._super(["equality",[!0]])},equal:function(a){return g(a,this._static)&&this.get("alias")===a.get("alias")},assert:function(){return!0}}}).as(c,"TrueConstraint"),j.extend({instance:{constructor:function(a,b){this.cache={},this._super(["reference",a]),b=b||{},this.values=[],this.pattern=b.pattern,this._options=b,this._matcher=d.getMatcher(a,b.scope||{})},assert:function(a){try{return this._matcher(a)}catch(b){throw new Error("Error with evaluating pattern "+this.pattern+" "+b.message)}},merge:function(a){var b=this;return a instanceof this._static&&(b=new this._static([this.constraint,a.constraint,"and"],f({},this._options,this._options)),b._alias=this._alias||a._alias,b.vars=this.vars.concat(a.vars)),b},equal:function(a){return g(a,this._static)&&e.deepEqual(this.constraint,a.constraint)},getters:{variables:function(){return this.vars},alias:function(){return this._alias}},setters:{alias:function(a){this._alias=a,this.vars=h(d.getIdentifiers(this.constraint),function(b){return b!==a})}}}}).as(c,"ReferenceConstraint"),j.extend({instance:{constructor:function(a){this._super(["hash",a])},equal:function(a){return e.instanceOf(a,this._static)&&this.get("alias")===a.get("alias")&&e.deepEqual(this.constraint,a.constraint)},assert:function(){return!0},getters:{variables:function(){return this.constraint}}}}).as(c,"HashConstraint")},{"./constraintMatcher":8,"./extended":10}],8:[function(a,b,c){"use strict";var d=a("./extended"),e=d.isArray,f=d.forEach,g=d.some,h=d.map,i=d.indexOf,j=d.isNumber,k=d.removeDuplicates,l=a("./constraint"),m={indexOf:d.indexOf,now:function(){return new Date},Date:function(a,b,c,d,e,f,g){var h=new Date;return j(a)&&h.setYear(a),j(b)&&h.setMonth(b),j(c)&&h.setDate(c),j(d)&&h.setHours(d),j(e)&&h.setMinutes(e),j(f)&&h.setSeconds(f),j(g)&&h.setMilliseconds(g),h},lengthOf:function(a,b){return a.length===b},isTrue:function(a){return a===!0},isFalse:function(a){return a===!1},isNotNull:function(a){return null!==a},dateCmp:function(a,b){return d.compare(a,b)}};f(["years","days","months","hours","minutes","seconds"],function(a){m[a+"FromNow"]=d[a+"FromNow"],m[a+"Ago"]=d[a+"Ago"]}),f(["isArray","isNumber","isHash","isObject","isDate","isBoolean","isString","isRegExp","isNull","isEmpty","isUndefined","isDefined","isUndefinedOrNull","isPromiseLike","isFunction","deepEqual"],function(a){var b=d[a];m[a]=function(){return b.apply(d,arguments)}});var n={equal:function(a,b){var c=!1;return a===b?c=!0:a[2]===b[2]&&(c=-1!==i(["string","number","boolean","regexp","identifier","null"],a[2])?a[0]===b[0]:"unary"===a[2]||"logicalNot"===a[2]?this.equal(a[0],b[0]):this.equal(a[0],b[0])&&this.equal(a[1],b[1])),c},getIdentifiers:function(a){var b=[],c=a[2];if("identifier"===c)return[a[0]];if("function"===c)b=b.concat(this.getIdentifiers(a[0])).concat(this.getIdentifiers(a[1]));else if("string"!==c&&"number"!==c&&"boolean"!==c&&"regexp"!==c&&"unary"!==c&&"unary"!==c)if("prop"===c){if(b=b.concat(this.getIdentifiers(a[0])),a[1])for(var d=a[1];e(d);){if("function"===d[2]){b=b.concat(this.getIdentifiers(d[1]));break}d=d[1]}}else a[0]&&(b=b.concat(this.getIdentifiers(a[0]))),a[1]&&(b=b.concat(this.getIdentifiers(a[1])));return k(b)},toConstraints:function(a,b){var c=[],d=b.alias,e=b.scope||{},f=a[2];return"and"===f?c=c.concat(this.toConstraints(a[0],b)).concat(this.toConstraints(a[1],b)):("composite"===f||"or"===f||"lt"===f||"gt"===f||"lte"===f||"gte"===f||"like"===f||"notLike"===f||"eq"===f||"neq"===f||"in"===f||"notIn"===f||"prop"===f||"propLookup"===f||"function"===f||"logicalNot"===f)&&(g(this.getIdentifiers(a),function(a){return!(a===d||a in m||a in e)})?c.push(new l.ReferenceConstraint(a,b)):c.push(new l.EqualityConstraint(a,b))),c},parse:function(a){return this[a[2]](a[0],a[1])},composite:function(a){return this.parse(a)},and:function(a,b){return["(",this.parse(a),"&&",this.parse(b),")"].join(" ")},or:function(a,b){return["(",this.parse(a),"||",this.parse(b),")"].join(" ")},prop:function(a,b){return"function"===b[2]?[this.parse(a),this.parse(b)].join("."):[this.parse(a),"['",this.parse(b),"']"].join("")},propLookup:function(a,b){return"function"===b[2]?[this.parse(a),this.parse(b)].join("."):[this.parse(a),"[",this.parse(b),"]"].join("")},unary:function(a){return-1*this.parse(a)},plus:function(a,b){return[this.parse(a),"+",this.parse(b)].join(" ")},minus:function(a,b){return[this.parse(a),"-",this.parse(b)].join(" ")},mult:function(a,b){return[this.parse(a),"*",this.parse(b)].join(" ")},div:function(a,b){return[this.parse(a),"/",this.parse(b)].join(" ")},mod:function(a,b){return[this.parse(a),"%",this.parse(b)].join(" ")},lt:function(a,b){return[this.parse(a),"<",this.parse(b)].join(" ")},gt:function(a,b){return[this.parse(a),">",this.parse(b)].join(" ")},lte:function(a,b){return[this.parse(a),"<=",this.parse(b)].join(" ")},gte:function(a,b){return[this.parse(a),">=",this.parse(b)].join(" ")},like:function(a,b){return[this.parse(b),".test(",this.parse(a),")"].join("")},notLike:function(a,b){return["!",this.parse(b),".test(",this.parse(a),")"].join("")},eq:function(a,b){return[this.parse(a),"===",this.parse(b)].join(" ")},neq:function(a,b){return[this.parse(a),"!==",this.parse(b)].join(" ")},"in":function(a,b){return["(indexOf(",this.parse(b),",",this.parse(a),")) != -1"].join("")},notIn:function(a,b){return["(indexOf(",this.parse(b),",",this.parse(a),")) == -1"].join("")},arguments:function(a,b){var c=[];return a&&c.push(this.parse(a)),b&&c.push(this.parse(b)),c.join(",")},array:function(a){var b=[];return a?(b=this.parse(a),e(b)?b:["[",b,"]"].join("")):["[",b.join(","),"]"].join("")},"function":function(a,b){var c=this.parse(b);return[this.parse(a),"(",c,")"].join("")},string:function(a){return"'"+a+"'"},number:function(a){return a},"boolean":function(a){return a},regexp:function(a){return a},identifier:function(a){return a},"null":function(){return"null"},logicalNot:function(a){return["!(",this.parse(a),")"].join("")}},o=c.toJs=function(a,b){var c=n.parse(a);b=b||{};var d=n.getIdentifiers(a),e="var indexOf = definedFuncs.indexOf;"+h(d,function(a){var c=["var ",a," = "];return m.hasOwnProperty(a)?c.push("definedFuncs['",a,"']"):b.hasOwnProperty(a)?c.push("scope['",a,"']"):c.push("'",a,"' in fact ? fact['",a,"'] : hash['",a,"']"),c.push(";"),c.join("")}).join("")+" return !!("+c+");",f=new Function("fact, hash, definedFuncs, scope",e);return function(a,c){return f(a,c,m,b)}};c.getMatcher=function(a,b){return o(a,b)},c.toConstraints=function(a,b){return n.toConstraints(a,b)},c.equal=function(a,b){return n.equal(a,b)},c.getIdentifiers=function(a){return n.getIdentifiers(a)}},{"./constraint":7,"./extended":10}],9:[function(a,b){"use strict";var c=a("./extended"),d=c.declare,e=c.merge,f=c.union,g=Array.prototype.slice,h=d({instance:{constructor:function(a){this.isMatch=!0,a instanceof this._static?(this.isMatch=a.isMatch,this.facts=g.call(a.facts),this.factIds=g.call(a.factIds),this.hashCode=this.factIds.join(":"),this.factHash=e({},a.factHash),this.recency=g.call(a.recency)):a?(this.facts=[a],this.factIds=[a.id],this.recency=[a.recency],this.hashCode=a.id+"",this.factHash=a.factHash||{}):(this.facts=[],this.factIds=[],this.factHash={},this.hashCode="")},merge:function(a){var b=new this._static;return b.isMatch=a.isMatch,b.facts=this.facts.concat(a.facts),b.factIds=this.factIds.concat(a.factIds),b.hashCode=b.factIds.join(":"),b.factHash=e({},this.factHash,a.factHash),b.recency=f(this.recency,a.recency),b}}}),i=d({instance:{match:null,factHash:null,fact:null,hashCode:null,paths:null,constructor:function(a,b,c){this.fact=a,this.paths=b||null;var d=this.match=c||new h(a);this.factHash=d.factHash,this.hashCode=d.hashCode,this.factIds=d.factIds},set:function(a,b){return this.factHash[a]=b,this},isMatch:function(a){return this.match.isMatch=a,this},clone:function(a,b,c){return new i(a||this.fact,b||this.path,c||this.match)}}}).as(b)},{"./extended":10}],10:[function(a,b){b.exports=a("extended")().register(a("array-extended")).register(a("date-extended")).register(a("object-extended")).register(a("string-extended")).register(a("promise-extended")).register(a("function-extended")).register(a("is-extended")).register("HashTable",a("ht")).register("declare",a("declare.js")).register(a("leafy")).register("LinkedList",a("./linkedList"))},{"./linkedList":12,"array-extended":36,"date-extended":37,"declare.js":39,extended:40,"function-extended":43,ht:49,"is-extended":50,leafy:51,"object-extended":52,"promise-extended":53,"string-extended":54}],11:[function(a,b){"use strict";function c(a){return/\.nools$/.test(a)}function d(a){var b;return b=c(a)?r.parse(f.readFileSync(a,"utf8"),a):r.parse(a)}var e=a("./extended"),f=a("fs"),g=a("path"),h=e.bind,i=e.forEach,j=e.declare,k=e.Promise,l=a("./nodes"),m=a("events").EventEmitter,n=a("./rule"),o=a("./workingMemory"),p=o.WorkingMemory,q=a("./pattern").InitialFact,r=a("./compile"),s=a("./nextTick"),t=a("./agenda"),u={},v=j(m,{instance:{name:null,constructor:function(a){this.env=null,this.name=a,this.__rules={},this.__wmAltered=!1,this.workingMemory=new p,this.agenda=new t(this),this.agenda.on("fire",h(this,"emit","fire")),this.agenda.on("focused",h(this,"emit","focused")),this.rootNode=new l.RootNode(this.workingMemory,this.agenda)},focus:function(a){return this.agenda.setFocus(a),this},halt:function(){return this.__halted=!0,this},dispose:function(){this.workingMemory.dispose(),this.agenda.dispose(),this.rootNode.dispose()},assert:function(a){return this.__wmAltered=!0,this.rootNode.assertFact(this.workingMemory.assertFact(a)),this.emit("assert",a),a},retract:function(a){return this.__wmAltered=!0,this.rootNode.retractFact(this.workingMemory.retractFact(a)),this.emit("retract",a),a},modify:function(a,b){return this.__wmAltered=!0,this.rootNode.retractFact(this.workingMemory.retractFact(a)),"function"==typeof b&&b.call(a,a),this.emit("modify",a),this.rootNode.assertFact(this.workingMemory.assertFact(a)),a},print:function(){this.rootNode.print()},containsRule:function(a){return this.rootNode.containsRule(a)},rule:function(a){this.rootNode.assertRule(a)},__loop:function(a,b){var c=new k,d=this.rootNode;return d?(d.resetCounter(),function e(){s(function(){a(c,e)})}()):c.callback(),c.classic(b),c},__callNext:function(){var a=this.rootNode,b=this.agenda.fireNext();if(e.isPromiseLike(b)){var c=this;return b.addCallback(function(){c.__wmAltered&&(a.incrementCounter(),c.__wmAltered=!1)})}return this.__wmAltered&&(a.incrementCounter(),this.__wmAltered=!1),b},matchUntilHalt:function(a){this.__halted=!1;var b=this;return this.__loop(function(a,c){if(b.__halted)a.callback();else{var d=b.__callNext();e.isBoolean(d)?c():d.addCallback(c).addErrback(a.errback)}},a)},match:function(a){var b=this;return this.__loop(function(a,c){var d=b.__callNext();e.isBoolean(d)?d?c():a.callback():d.addCallback(function(b){return b?c():a.callback()}).addErrback(a.errback)},a)}}}),w={},x=j({instance:{constructor:function(a,b){if(this.name=a,this.cb=b,this.__rules=[],this.__defined={},b&&b.call(this,this),w.hasOwnProperty(a))throw new Error("Flow with "+a+" already defined");w[a]=this},getDefined:function(a){var b=this.__defined[a.toLowerCase()];if(!b)throw new Error(a+" flow class is not defined");return b},addDefined:function(a,b){return this.__defined[a.toLowerCase()]=b,b},rule:function(){return this.__rules=this.__rules.concat(n.createRule.apply(n,arguments)),this},getSession:function(){var a=new v(this.name);i(this.__rules,function(b){a.rule(b)}),a.assert(new q);for(var b=0,c=arguments.length;c>b;b++)a.assert(arguments[b]);return a},containsRule:function(a){return e.some(this.__rules,function(b){return b.name===a})}}}).as(u,"Flow");u.getFlow=function(a){return w[a]},u.deleteFlow=function(a){return e.instanceOf(a,x)&&(a=a.name),delete w[a],u},u.flow=function(a,b){return new x(a,b)},u.compile=function(a,b,f){if(e.isFunction(b)?(f=b,b={}):(b=b||{},f=null),e.isString(a)&&(b.name=b.name||(c(a)?g.basename(a,g.extname(a)):null),a=d(a)),!b.name)throw new Error("Name required when compiling nools source");return r.compile(a,b,f,x)},u.transpile=function(a,b){return b=b||{},e.isString(a)&&(b.name=b.name||(c(a)?g.basename(a,g.extname(a)):null),a=d(a)),r.transpile(a,b)},u.parse=d,b.exports=u},{"./agenda":3,"./compile":5,"./extended":10,"./nextTick":13,"./nodes":17,"./pattern":32,"./rule":33,"./workingMemory":34,events:44,fs:45,path:46}],12:[function(a,b){var c=a("declare.js");c({instance:{constructor:function(){this.head=null,this.tail=null,this.length=null},push:function(a){var b=this.tail,c=this.head,d={data:a,prev:b,next:null};return b&&(this.tail.next=d),this.tail=d,c||(this.head=d),this.length++,d},remove:function(a){a.prev?a.prev.next=a.next:this.head=a.next,a.next?a.next.prev=a.prev:this.tail=a.prev,a.data=a.prev=a.next=null,this.length--},forEach:function(a){for(var b={next:this.head};b=b.next;)a(b.data)},clear:function(){this.head=this.tail=null,this.length=0}}}).as(b)},{"declare.js":39}],13:[function(a,b){var c,d=a("__browserify_process"),e=a("./extended");if("function"==typeof setImmediate)c="undefined"!=typeof window?e.bind(window,setImmediate):setImmediate;else if("undefined"!=typeof d)c=d.nextTick;else if("undefined"!=typeof MessageChannel){var f=new MessageChannel,g={},h=g;f.port1.onmessage=function(){g=g.next;var a=g.task;delete g.task,a()},c=function(a){h=h.next={task:a},f.port2.postMessage(0)}}else c=function(a){setTimeout(a,0)};b.exports=c},{"./extended":10,__browserify_process:48}],14:[function(a,b){var c=a("./alphaNode");c.extend({instance:{constructor:function(){this._super(arguments),this.alias=this.constraint.get("alias")},toString:function(){return"AliasNode"+this.__count},assert:function(a){return this.__propagate("assert",a.set(this.alias,a.fact.object))},retract:function(a){this.propagateRetract(a.fact)},equal:function(a){return a instanceof this._static&&this.alias===a.alias}}}).as(b)},{"./alphaNode":15}],15:[function(a,b){"use strict";var c=a("./node");c.extend({instance:{constructor:function(a){this._super([]),this.constraint=a},toString:function(){return"AlphaNode "+this.__count},equal:function(a){return this.constraint.equal(a.constraint)}}}).as(b)},{"./node":21}],16:[function(a,b){var c=a("./alphaNode");c.extend({instance:{constructor:function(){this._super(arguments)},assert:function(a){this.constraint.assert(a.factHash)&&this.__propagate("assert",a)},toString:function(){return"EqualityNode"+this.__count}}}).as(b)},{"./alphaNode":15}],17:[function(a,b,c){"use strict";var d=a("../extended"),e=d.forEach,f=d.some,g=d.declare,h=a("../pattern.js"),i=h.ObjectPattern,j=h.NotPattern,k=h.CompositePattern,l=h.InitialFactPattern,m=a("../constraint"),n=m.HashConstraint,o=m.ReferenceConstraint,p=a("./aliasNode"),q=a("./equalityNode"),r=a("./joinNode"),s=a("./notNode"),t=a("./leftAdapterNode"),u=a("./rightAdapterNode"),v=a("./typeNode"),w=a("./terminalNode"),x=a("./propertyNode");g({instance:{constructor:function(a,b){this.terminalNodes=[],this.joinNodes=[],this.nodes=[],this.constraints=[],this.typeNodes=[],this.__ruleCount=0,this.bucket={counter:0,recency:0},this.agendaTree=b},assertRule:function(a){var b=new w(this.bucket,this.__ruleCount++,a,this.agendaTree);this.__addToNetwork(a,a.pattern,b),this.__mergeJoinNodes(),this.terminalNodes.push(b)},resetCounter:function(){this.bucket.counter=0},incrementCounter:function(){this.bucket.counter++},assertFact:function(a){for(var b=this.typeNodes,c=b.length-1;c>=0;c--)b[c].assert(a)},retractFact:function(a){for(var b=this.typeNodes,c=b.length-1;c>=0;c--)b[c].retract(a)},containsRule:function(a){return f(this.terminalNodes,function(b){return b.rule.name===a})},dispose:function(){for(var a=this.typeNodes,b=a.length-1;b>=0;b--)a[b].dispose()},__mergeJoinNodes:function(){for(var a=this.joinNodes,b=0;b=0;c--){var d=b[c];if(a.equal(d))return d}return b.push(a),a},__createTypeNode:function(a,b){for(var c=new v(b.get("constraints")[0]),d=this.typeNodes,e=d.length-1;e>=0;e--){var f=d[e];if(c.equal(f))return f}return d.push(c),c},__createEqualityNode:function(a,b){return this.__checkEqual(new q(b)).addRule(a)},__createPropertyNode:function(a,b){return this.__checkEqual(new x(b)).addRule(a)},__createAliasNode:function(a,b){return this.__checkEqual(new p(b)).addRule(a)},__createAdapterNode:function(a,b){return("left"===b?new t:new u).addRule(a)},__createJoinNode:function(a,b,c,d){var e;b.rightPattern instanceof j?e=new s:(e=new r,this.joinNodes.push(e));var f=e;if(c instanceof r){var g=this.__createAdapterNode(a,d);f.addOutNode(g,b),f=g}return f.addOutNode(c,b),e.addRule(a)},__addToNetwork:function(a,b,c,d){if(b instanceof i){if(b instanceof j&&(!d||"left"===d))return this.__createBetaNode(a,new k(new l,b),c,d);this.__createAlphaNode(a,b,c,d)}else b instanceof k&&this.__createBetaNode(a,b,c,d)},__createBetaNode:function(a,b,c,d){var e=this.__createJoinNode(a,b,c,d);return this.__addToNetwork(a,b.rightPattern,e,"right"),this.__addToNetwork(a,b.leftPattern,e,"left"),c.addParentNode(e),e},__createAlphaNode:function(a,b,c,d){var e=b.get("constraints"),f=this.__createTypeNode(a,b),g=this.__createAliasNode(a,b);f.addOutNode(g,b),g.addParentNode(f);for(var h=g,i=e.length-1;i>0;i--){var j,k=e[i];if(k instanceof n)j=this.__createPropertyNode(a,k);else{if(k instanceof o){c.constraint.addConstraint(k);continue}j=this.__createEqualityNode(a,k)}h.addOutNode(j,b),j.addParentNode(h),h=j}if(c instanceof r){var l=this.__createAdapterNode(a,d);l.addParentNode(h),h.addOutNode(l,b),h=l}return c.addParentNode(h),h.addOutNode(c,b),f},print:function(){e(this.terminalNodes,function(a){a.print(" ")})}}}).as(c,"RootNode")},{"../constraint":7,"../extended":10,"../pattern.js":32,"./aliasNode":14,"./equalityNode":16,"./joinNode":18,"./leftAdapterNode":20,"./notNode":22,"./propertyNode":23,"./rightAdapterNode":24,"./terminalNode":25,"./typeNode":26}],18:[function(a,b){var c=a("../extended"),d=c.hash.values,e=c.indexOf,f=a("./node"),g=a("./joinReferenceNode");f.extend({instance:{constructor:function(){this._super([]),this.constraint=new g,this.leftMemory={},this.rightMemory={},this.leftTuples=[],this.rightTuples=[]},dispose:function(){this.leftMemory={},this.rightMemory={}},disposeLeft:function(a){this.leftMemory={},this.propagateDispose(a)},disposeRight:function(a){this.rightMemory={},this.propagateDispose(a)},hashCode:function(){return"JoinNode "+this.__count},toString:function(){return"JoinNode "+this.__count},retractResolve:function(a){for(var b=d(this.leftMemory),c=b.length,f=this.leftTuples;--c>-1;)for(var g,h=b[c],i=h.length;--i>-1;)if(g=h[i],this.resolve(g.match,a)){f.splice(e(f,g),1),h.splice(i,1);break}this._propagateRetractResolve(a)},retractLeft:function(a){var b,c,d=this.leftMemory[a.id],f=this.leftTuples;if(d){for(b=-1,c=d.length;++be;e++)this.addOutNode(d,c[e]);a.nodes.remove(d)},this);for(var b=a.parentNodes,c=0,d=a.parentNodes.l;d>c;c++){var e=b[c];this.addParentNode(e),e.nodes.remove(a)}return this},resolve:function(a,b){return a.hashCode===b.hashCode},print:function(a){console.log(a+this.toString()),d(this.parentNodes,function(b){b.print(" "+a)})},addOutNode:function(a,b){this.nodes.contains(a)||this.nodes.put(a,[]),this.nodes.get(a).push(b),this.__entrySet=this.nodes.entrySet()},addParentNode:function(a){-1===e(this.parentNodes,a)&&this.parentNodes.push(a)},shareable:function(){return!1},__propagate:function(a,b,c){c=c||this.nodes;for(var d,e,g,h,j=this.__entrySet,k=j.length;--k>-1;)d=j[k],e=d.key,g=d.value,b.paths?(h=f(g,b.paths)).length&&e[a](new i(b.fact,h,b.match)):e[a](b)},dispose:function(a){this.propagateDispose(a)},retract:function(a){this.propagateRetract(a)},propagateDispose:function(a,b){b=b||this.nodes;for(var c=this.__entrySet,d=c.length-1;d>=0;d--){var e=c[d],f=e.key;f.dispose(a)}},propagateAssert:function(a,b){this.__propagate("assert",a,b||this.nodes)},propagateRetract:function(a,b){this.__propagate("retract",a,b||this.nodes)},assert:function(a){this.propagateAssert(a)},propagateModify:function(a,b){this.__propagate("modify",a,b||this.nodes)}}}).as(b)},{"../context":9,"../extended":10}],22:[function(a,b){var c=a("./joinNode"),d=a("../context"),e=a("../extended"),f=e.indexOf;c.extend({instance:{constructor:function(){this._super(arguments),this.leftTupleMemory={},this.allTuples={}},toString:function(){return"NotNode "+this.__count},retractRight:function(a){var b=this.rightMemory,c=b[a.id],e=this.constraint;if(delete b[a.id],c){var g=f(this.rightTuples,c);this.rightTuples.splice(g,1);for(var h,i,j,k=c.blocking,l=this.rightTuples,m=l.length;h=k.pop();){for(h.blocker=null,e.setLeftContext(h),j=g;m>j;j++)if(i=l[j],e.setRightContext(i),e.isMatch()){h.blocker=i,i.blocking.push(h),this.__addToLeftTupleMemory(h);break}h.blocker||(this.__removeFromLeftTupleMemory(h),this.__addToLeftMemory(h).propagateAssert(new d(h.fact,null,h.match)))}e.clearContexts()}},retractLeft:function(a){for(var b,c,d,e=a.id,g=this.allTuples[a.id]||[];g.length;)b=g.pop(),-1!==f(b.factIds,e)&&(this.__removeFromAllTupleMemory(b),this.__removeFromLeftMemory(b),this.__removeFromLeftTupleMemory(b),(d=b.blocker)&&(c=d.blocking,c.splice(f(c,b),1),b.blocker=null));delete this.leftMemory[e],delete this.leftTupleMemory[e],this.propagateRetract(a)},assertLeft:function(a){var b,c=this.rightTuples,e=this.constraint,f=-1,g=c.length;if(0!==g)for(e.setLeftContext(a);++f-1;)b=c[d],e.setLeftContext(b).isMatch()&&(this._propagateRetractResolve(b.match),this.__removeFromLeftMemory(b),b.blocker=a,a.blocking.push(b),this.__addToLeftTupleMemory(b));e.clearContexts()},__removeFromLeftMemory:function(a){for(var b,c=this.leftMemory[a.fact.id]||[],d=this.leftTuples,e=0,g=d.length;g>e;e++)if(b=d[e],b===a){d.splice(e,1),c.splice(f(c,b),1);break}return this},__removeFromLeftTupleMemory:function(a){for(var b,c=this.leftTupleMemory[a.fact.id]||[],d=0,e=c.length;e>d;d++)if(b=c[d],b===a){c.splice(d,1);break}return this},__addToAllTupleMemory:function(a){for(var b,c,d=a.factIds,e=-1,g=d.length,h=this.allTuples;++eg;g++)b=e[g],c.set(b[1],f[b[0]]);this.__propagate("assert",c)},toString:function(){return"PropertyNode"+this.__count}}}).as(b)},{"../context":9,"../extended":10,"./alphaNode":15}],24:[function(a,b){var c=a("./node");c.extend({instance:{retractResolve:function(a){this.__propagate("retractResolve",a)},dispose:function(a){this.propagateDispose(a)},propagateAssert:function(a){this.__propagate("assertRight",a)},propagateRetract:function(a){this.__propagate("retractRight",a)},propagateResolve:function(a){this.__propagate("retractResolve",a)},modify:function(a){this.__propagate("modifyRight",a)},toString:function(){return"RightAdapterNode "+this.__count}}}).as(b)},{"./node":21}],25:[function(a,b){var c=a("./node"),d=a("../extended"),e=d.bind,f=d.removeDuplicates;c.extend({instance:{constructor:function(a,b,c,d){this._super([]),this.resolve=e(this,this.resolve),this.rule=c,this.index=b,this.name=this.rule.name,this.agenda=d,this.bucket=a,d.register(this)},__assertModify:function(a){var b=a.match;if(b.recency.sort(function(a,b){return a-b}).reverse(),b.facts=f(b.facts),b.isMatch){var c=this.rule,d=this.bucket;this.agenda.insert(this,{rule:c,index:this.index,name:c.name,recency:d.recency++,match:b,counter:d.counter})}},assert:function(a){this.__assertModify(a)},modify:function(a){this.__assertModify(a)},retract:function(a){this.agenda.removeByFact(this,a)},retractRight:function(a){this.agenda.removeByFact(this,a)},retractLeft:function(a){this.agenda.removeByFact(this,a)},assertLeft:function(a){this.__assertModify(a)},assertRight:function(a){this.__assertModify(a)},retractResolve:function(a){var b=this.resolve;this.agenda.retract(this,function(c){return b(c.match,a)})},toString:function(){return"TerminalNode "+this.rule.name}}}).as(b)},{"../extended":10,"./node":21}],26:[function(a,b){var c=a("./alphaNode"),d=a("../context");c.extend({instance:{assert:function(a){this.constraint.assert(a.object)&&this.__propagate("assert",a)},retract:function(a){this.constraint.assert(a.object)&&this.propagateRetract(a)},toString:function(){return"TypeNode"+this.__count},dispose:function(){for(var a=this.__entrySet,b=a.length-1;b>=0;b--){var c=a[b],d=c.key,e=c.value;d.dispose({paths:e})}},__propagate:function(a,b){for(var c=this.__entrySet,e=c.length-1;e>=0;e--){var f=c[e],g=f.key,h=f.value;g[a](new d(b,h))}}}}).as(b)},{"../context":9,"./alphaNode":15}],27:[function(a,b,c){var d=a("__browserify_process"),e=function(){function a(){this.yy={}}var b={trace:function(){},yy:{},symbols_:{error:2,expressions:3,EXPRESSION:4,EOF:5,UNARY_EXPRESSION:6,LITERAL_EXPRESSION:7,"-":8,"!":9,MULTIPLICATIVE_EXPRESSION:10,"*":11,"/":12,"%":13,ADDITIVE_EXPRESSION:14,"+":15,EXPONENT_EXPRESSION:16,"^":17,RELATIONAL_EXPRESSION:18,"<":19,">":20,"<=":21,">=":22,EQUALITY_EXPRESSION:23,"==":24,"!=":25,"=~":26,"!=~":27,IN_EXPRESSION:28,"in":29,ARRAY_EXPRESSION:30,notIn:31,OBJECT_EXPRESSION:32,AND_EXPRESSION:33,"&&":34,OR_EXPRESSION:35,"||":36,ARGUMENT_LIST:37,",":38,IDENTIFIER_EXPRESSION:39,IDENTIFIER:40,".":41,"[":42,STRING_EXPRESSION:43,"]":44,"(":45,")":46,STRING:47,NUMBER_EXPRESSION:48,NUMBER:49,REGEXP_EXPRESSION:50,REGEXP:51,BOOLEAN_EXPRESSION:52,BOOLEAN:53,NULL_EXPRESSION:54,NULL:55,$accept:0,$end:1},terminals_:{2:"error",5:"EOF",8:"-",9:"!",11:"*",12:"/",13:"%",15:"+",17:"^",19:"<",20:">",21:"<=",22:">=",24:"==",25:"!=",26:"=~",27:"!=~",29:"in",31:"notIn",34:"&&",36:"||",38:",",40:"IDENTIFIER",41:".",42:"[",44:"]",45:"(",46:")",47:"STRING",49:"NUMBER",51:"REGEXP",53:"BOOLEAN",55:"NULL"},productions_:[0,[3,2],[6,1],[6,2],[6,2],[10,1],[10,3],[10,3],[10,3],[14,1],[14,3],[14,3],[16,1],[16,3],[18,1],[18,3],[18,3],[18,3],[18,3],[23,1],[23,3],[23,3],[23,3],[23,3],[28,1],[28,3],[28,3],[28,3],[28,3],[33,1],[33,3],[35,1],[35,3],[37,1],[37,3],[39,1],[32,1],[32,3],[32,4],[32,4],[32,3],[32,4],[43,1],[48,1],[50,1],[52,1],[54,1],[30,2],[30,3],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,3],[4,1]],performAction:function(a,b,c,d,e,f){var g=f.length-1;switch(e){case 1:return f[g-1];case 3:this.$=[f[g],null,"unary"];break;case 4:this.$=[f[g],null,"logicalNot"];break;case 6:this.$=[f[g-2],f[g],"mult"];break;case 7:this.$=[f[g-2],f[g],"div"];break;case 8:this.$=[f[g-2],f[g],"mod"];break;case 10:this.$=[f[g-2],f[g],"plus"];break;case 11:this.$=[f[g-2],f[g],"minus"];break;case 13:this.$=[f[g-2],f[g],"pow"];break;case 15:this.$=[f[g-2],f[g],"lt"];break;case 16:this.$=[f[g-2],f[g],"gt"];break;case 17:this.$=[f[g-2],f[g],"lte"];break;case 18:this.$=[f[g-2],f[g],"gte"];break;case 20:this.$=[f[g-2],f[g],"eq"];break;case 21:this.$=[f[g-2],f[g],"neq"];break;case 22:this.$=[f[g-2],f[g],"like"];break;case 23:this.$=[f[g-2],f[g],"notLike"];break;case 25:this.$=[f[g-2],f[g],"in"];break;case 26:this.$=[f[g-2],f[g],"notIn"];break;case 27:this.$=[f[g-2],f[g],"in"];break;case 28:this.$=[f[g-2],f[g],"notIn"];break;case 30:this.$=[f[g-2],f[g],"and"];break;case 32:this.$=[f[g-2],f[g],"or"];break;case 34:this.$=[f[g-2],f[g],"arguments"];break;case 35:this.$=[String(a),null,"identifier"];break;case 37:this.$=[f[g-2],f[g],"prop"];break;case 38:this.$=[f[g-3],f[g-1],"propLookup"];break;case 39:this.$=[f[g-3],f[g-1],"propLookup"];break;case 40:this.$=[f[g-2],[null,null,"arguments"],"function"];break;case 41:this.$=[f[g-3],f[g-1],"function"];break;case 42:this.$=[String(a.replace(/^['|"]|['|"]$/g,"")),null,"string"];break;case 43:this.$=[Number(a),null,"number"];break;case 44:this.$=[a,null,"regexp"];break;case 45:this.$=["true"==a.replace(/^\s+/,""),null,"boolean"];break;case 46:this.$=[null,null,"null"];break;case 47:this.$=[null,null,"array"];break;case 48:this.$=[f[g-1],null,"array"];break;case 56:this.$=[f[g-1],null,"composite"]}},table:[{3:1,4:2,6:28,7:7,8:[1,29],9:[1,30],10:27,14:25,16:17,18:8,23:6,28:5,30:15,32:14,33:4,35:3,39:23,40:[1,26],42:[1,24],43:9,45:[1,16],47:[1,18],48:10,49:[1,19],50:11,51:[1,20],52:12,53:[1,21],54:13,55:[1,22]},{1:[3]},{5:[1,31]},{5:[2,57],36:[1,32],46:[2,57]},{5:[2,31],34:[1,33],36:[2,31],46:[2,31]},{5:[2,29],34:[2,29],36:[2,29],46:[2,29]},{5:[2,24],24:[1,34],25:[1,35],26:[1,36],27:[1,37],34:[2,24],36:[2,24],46:[2,24]},{5:[2,2],8:[2,2],11:[2,2],12:[2,2],13:[2,2],15:[2,2],17:[2,2],19:[2,2],20:[2,2],21:[2,2],22:[2,2],24:[2,2],25:[2,2],26:[2,2],27:[2,2],29:[1,38],31:[1,39],34:[2,2],36:[2,2],46:[2,2]},{5:[2,19],19:[1,40],20:[1,41],21:[1,42],22:[1,43],24:[2,19],25:[2,19],26:[2,19],27:[2,19],34:[2,19],36:[2,19],46:[2,19]},{5:[2,49],8:[2,49],11:[2,49],12:[2,49],13:[2,49],15:[2,49],17:[2,49],19:[2,49],20:[2,49],21:[2,49],22:[2,49],24:[2,49],25:[2,49],26:[2,49],27:[2,49],29:[2,49],31:[2,49],34:[2,49],36:[2,49],38:[2,49],44:[2,49],46:[2,49]},{5:[2,50],8:[2,50],11:[2,50],12:[2,50],13:[2,50],15:[2,50],17:[2,50],19:[2,50],20:[2,50],21:[2,50],22:[2,50],24:[2,50],25:[2,50],26:[2,50],27:[2,50],29:[2,50],31:[2,50],34:[2,50],36:[2,50],38:[2,50],44:[2,50],46:[2,50]},{5:[2,51],8:[2,51],11:[2,51],12:[2,51],13:[2,51],15:[2,51],17:[2,51],19:[2,51],20:[2,51],21:[2,51],22:[2,51],24:[2,51],25:[2,51],26:[2,51],27:[2,51],29:[2,51],31:[2,51],34:[2,51],36:[2,51],38:[2,51],44:[2,51],46:[2,51]},{5:[2,52],8:[2,52],11:[2,52],12:[2,52],13:[2,52],15:[2,52],17:[2,52],19:[2,52],20:[2,52],21:[2,52],22:[2,52],24:[2,52],25:[2,52],26:[2,52],27:[2,52],29:[2,52],31:[2,52],34:[2,52],36:[2,52],38:[2,52],44:[2,52],46:[2,52]},{5:[2,53],8:[2,53],11:[2,53],12:[2,53],13:[2,53],15:[2,53],17:[2,53],19:[2,53],20:[2,53],21:[2,53],22:[2,53],24:[2,53],25:[2,53],26:[2,53],27:[2,53],29:[2,53],31:[2,53],34:[2,53],36:[2,53],38:[2,53],44:[2,53],46:[2,53]},{5:[2,54],8:[2,54],11:[2,54],12:[2,54],13:[2,54],15:[2,54],17:[2,54],19:[2,54],20:[2,54],21:[2,54],22:[2,54],24:[2,54],25:[2,54],26:[2,54],27:[2,54],29:[2,54],31:[2,54],34:[2,54],36:[2,54],38:[2,54],41:[1,44],42:[1,45],44:[2,54],45:[1,46],46:[2,54]},{5:[2,55],8:[2,55],11:[2,55],12:[2,55],13:[2,55],15:[2,55],17:[2,55],19:[2,55],20:[2,55],21:[2,55],22:[2,55],24:[2,55],25:[2,55],26:[2,55],27:[2,55],29:[2,55],31:[2,55],34:[2,55],36:[2,55],38:[2,55],44:[2,55],46:[2,55]},{4:47,6:28,7:7,8:[1,29],9:[1,30],10:27,14:25,16:17,18:8,23:6,28:5,30:15,32:14,33:4,35:3,39:23,40:[1,26],42:[1,24],43:9,45:[1,16],47:[1,18],48:10,49:[1,19],50:11,51:[1,20],52:12,53:[1,21],54:13,55:[1,22]},{5:[2,14],17:[1,48],19:[2,14],20:[2,14],21:[2,14],22:[2,14],24:[2,14],25:[2,14],26:[2,14],27:[2,14],34:[2,14],36:[2,14],46:[2,14]},{5:[2,42],8:[2,42],11:[2,42],12:[2,42],13:[2,42],15:[2,42],17:[2,42],19:[2,42],20:[2,42],21:[2,42],22:[2,42],24:[2,42],25:[2,42],26:[2,42],27:[2,42],29:[2,42],31:[2,42],34:[2,42],36:[2,42],38:[2,42],44:[2,42],46:[2,42]},{5:[2,43],8:[2,43],11:[2,43],12:[2,43],13:[2,43],15:[2,43],17:[2,43],19:[2,43],20:[2,43],21:[2,43],22:[2,43],24:[2,43],25:[2,43],26:[2,43],27:[2,43],29:[2,43],31:[2,43],34:[2,43],36:[2,43],38:[2,43],44:[2,43],46:[2,43]},{5:[2,44],8:[2,44],11:[2,44],12:[2,44],13:[2,44],15:[2,44],17:[2,44],19:[2,44],20:[2,44],21:[2,44],22:[2,44],24:[2,44],25:[2,44],26:[2,44],27:[2,44],29:[2,44],31:[2,44],34:[2,44],36:[2,44],38:[2,44],44:[2,44],46:[2,44]},{5:[2,45],8:[2,45],11:[2,45],12:[2,45],13:[2,45],15:[2,45],17:[2,45],19:[2,45],20:[2,45],21:[2,45],22:[2,45],24:[2,45],25:[2,45],26:[2,45],27:[2,45],29:[2,45],31:[2,45],34:[2,45],36:[2,45],38:[2,45],44:[2,45],46:[2,45]},{5:[2,46],8:[2,46],11:[2,46],12:[2,46],13:[2,46],15:[2,46],17:[2,46],19:[2,46],20:[2,46],21:[2,46],22:[2,46],24:[2,46],25:[2,46],26:[2,46],27:[2,46],29:[2,46],31:[2,46],34:[2,46],36:[2,46],38:[2,46],44:[2,46],46:[2,46]},{5:[2,36],8:[2,36],11:[2,36],12:[2,36],13:[2,36],15:[2,36],17:[2,36],19:[2,36],20:[2,36],21:[2,36],22:[2,36],24:[2,36],25:[2,36],26:[2,36],27:[2,36],29:[2,36],31:[2,36],34:[2,36],36:[2,36],38:[2,36],41:[2,36],42:[2,36],44:[2,36],45:[2,36],46:[2,36]},{7:51,30:15,32:14,37:50,39:23,40:[1,26],42:[1,24],43:9,44:[1,49],45:[1,16],47:[1,18],48:10,49:[1,19],50:11,51:[1,20],52:12,53:[1,21],54:13,55:[1,22]},{5:[2,12],8:[1,53],15:[1,52],17:[2,12],19:[2,12],20:[2,12],21:[2,12],22:[2,12],24:[2,12],25:[2,12],26:[2,12],27:[2,12],34:[2,12],36:[2,12],46:[2,12]},{5:[2,35],8:[2,35],11:[2,35],12:[2,35],13:[2,35],15:[2,35],17:[2,35],19:[2,35],20:[2,35],21:[2,35],22:[2,35],24:[2,35],25:[2,35],26:[2,35],27:[2,35],29:[2,35],31:[2,35],34:[2,35],36:[2,35],38:[2,35],41:[2,35],42:[2,35],44:[2,35],45:[2,35],46:[2,35]},{5:[2,9],8:[2,9],11:[1,54],12:[1,55],13:[1,56],15:[2,9],17:[2,9],19:[2,9],20:[2,9],21:[2,9],22:[2,9],24:[2,9],25:[2,9],26:[2,9],27:[2,9],34:[2,9],36:[2,9],46:[2,9]},{5:[2,5],8:[2,5],11:[2,5],12:[2,5],13:[2,5],15:[2,5],17:[2,5],19:[2,5],20:[2,5],21:[2,5],22:[2,5],24:[2,5],25:[2,5],26:[2,5],27:[2,5],34:[2,5],36:[2,5],46:[2,5]},{6:57,7:58,8:[1,29],9:[1,30],30:15,32:14,39:23,40:[1,26],42:[1,24],43:9,45:[1,16],47:[1,18],48:10,49:[1,19],50:11,51:[1,20],52:12,53:[1,21],54:13,55:[1,22]},{6:59,7:58,8:[1,29],9:[1,30],30:15,32:14,39:23,40:[1,26],42:[1,24],43:9,45:[1,16],47:[1,18],48:10,49:[1,19],50:11,51:[1,20],52:12,53:[1,21],54:13,55:[1,22]},{1:[2,1]},{6:28,7:7,8:[1,29],9:[1,30],10:27,14:25,16:17,18:8,23:6,28:5,30:15,32:14,33:60,39:23,40:[1,26],42:[1,24],43:9,45:[1,16],47:[1,18],48:10,49:[1,19],50:11,51:[1,20],52:12,53:[1,21],54:13,55:[1,22]},{6:28,7:7,8:[1,29],9:[1,30],10:27,14:25,16:17,18:8,23:6,28:61,30:15,32:14,39:23,40:[1,26],42:[1,24],43:9,45:[1,16],47:[1,18],48:10,49:[1,19],50:11,51:[1,20],52:12,53:[1,21],54:13,55:[1,22]},{6:28,7:58,8:[1,29],9:[1,30],10:27,14:25,16:17,18:62,30:15,32:14,39:23,40:[1,26],42:[1,24],43:9,45:[1,16],47:[1,18],48:10,49:[1,19],50:11,51:[1,20],52:12,53:[1,21],54:13,55:[1,22]},{6:28,7:58,8:[1,29],9:[1,30],10:27,14:25,16:17,18:63,30:15,32:14,39:23,40:[1,26],42:[1,24],43:9,45:[1,16],47:[1,18],48:10,49:[1,19],50:11,51:[1,20],52:12,53:[1,21],54:13,55:[1,22]},{6:28,7:58,8:[1,29],9:[1,30],10:27,14:25,16:17,18:64,30:15,32:14,39:23,40:[1,26],42:[1,24],43:9,45:[1,16],47:[1,18],48:10,49:[1,19],50:11,51:[1,20],52:12,53:[1,21],54:13,55:[1,22]},{6:28,7:58,8:[1,29],9:[1,30],10:27,14:25,16:17,18:65,30:15,32:14,39:23,40:[1,26],42:[1,24],43:9,45:[1,16],47:[1,18],48:10,49:[1,19],50:11,51:[1,20],52:12,53:[1,21],54:13,55:[1,22]},{30:66,32:67,39:23,40:[1,26],42:[1,24]},{30:68,32:69,39:23,40:[1,26],42:[1,24]},{6:28,7:58,8:[1,29],9:[1,30],10:27,14:25,16:70,30:15,32:14,39:23,40:[1,26],42:[1,24],43:9,45:[1,16],47:[1,18],48:10,49:[1,19],50:11,51:[1,20],52:12,53:[1,21],54:13,55:[1,22]},{6:28,7:58,8:[1,29],9:[1,30],10:27,14:25,16:71,30:15,32:14,39:23,40:[1,26],42:[1,24],43:9,45:[1,16],47:[1,18],48:10,49:[1,19],50:11,51:[1,20],52:12,53:[1,21],54:13,55:[1,22]},{6:28,7:58,8:[1,29],9:[1,30],10:27,14:25,16:72,30:15,32:14,39:23,40:[1,26],42:[1,24],43:9,45:[1,16],47:[1,18],48:10,49:[1,19],50:11,51:[1,20],52:12,53:[1,21],54:13,55:[1,22]},{6:28,7:58,8:[1,29],9:[1,30],10:27,14:25,16:73,30:15,32:14,39:23,40:[1,26],42:[1,24],43:9,45:[1,16],47:[1,18],48:10,49:[1,19],50:11,51:[1,20],52:12,53:[1,21],54:13,55:[1,22]},{39:74,40:[1,26]},{32:76,39:23,40:[1,26],43:75,47:[1,18]},{7:51,30:15,32:14,37:78,39:23,40:[1,26],42:[1,24],43:9,45:[1,16],46:[1,77],47:[1,18],48:10,49:[1,19],50:11,51:[1,20],52:12,53:[1,21],54:13,55:[1,22]},{46:[1,79]},{6:28,7:58,8:[1,29],9:[1,30],10:27,14:80,30:15,32:14,39:23,40:[1,26],42:[1,24],43:9,45:[1,16],47:[1,18],48:10,49:[1,19],50:11,51:[1,20],52:12,53:[1,21],54:13,55:[1,22]},{5:[2,47],8:[2,47],11:[2,47],12:[2,47],13:[2,47],15:[2,47],17:[2,47],19:[2,47],20:[2,47],21:[2,47],22:[2,47],24:[2,47],25:[2,47],26:[2,47],27:[2,47],29:[2,47],31:[2,47],34:[2,47],36:[2,47],38:[2,47],44:[2,47],46:[2,47]},{38:[1,82],44:[1,81]},{38:[2,33],44:[2,33],46:[2,33]},{6:28,7:58,8:[1,29],9:[1,30],10:83,30:15,32:14,39:23,40:[1,26],42:[1,24],43:9,45:[1,16],47:[1,18],48:10,49:[1,19],50:11,51:[1,20],52:12,53:[1,21],54:13,55:[1,22]},{6:28,7:58,8:[1,29],9:[1,30],10:84,30:15,32:14,39:23,40:[1,26],42:[1,24],43:9,45:[1,16],47:[1,18],48:10,49:[1,19],50:11,51:[1,20],52:12,53:[1,21],54:13,55:[1,22]},{6:85,7:58,8:[1,29],9:[1,30],30:15,32:14,39:23,40:[1,26],42:[1,24],43:9,45:[1,16],47:[1,18],48:10,49:[1,19],50:11,51:[1,20],52:12,53:[1,21],54:13,55:[1,22]},{6:86,7:58,8:[1,29],9:[1,30],30:15,32:14,39:23,40:[1,26],42:[1,24],43:9,45:[1,16],47:[1,18],48:10,49:[1,19],50:11,51:[1,20],52:12,53:[1,21],54:13,55:[1,22]},{6:87,7:58,8:[1,29],9:[1,30],30:15,32:14,39:23,40:[1,26],42:[1,24],43:9,45:[1,16],47:[1,18],48:10,49:[1,19],50:11,51:[1,20],52:12,53:[1,21],54:13,55:[1,22]},{5:[2,3],8:[2,3],11:[2,3],12:[2,3],13:[2,3],15:[2,3],17:[2,3],19:[2,3],20:[2,3],21:[2,3],22:[2,3],24:[2,3],25:[2,3],26:[2,3],27:[2,3],34:[2,3],36:[2,3],46:[2,3]},{5:[2,2],8:[2,2],11:[2,2],12:[2,2],13:[2,2],15:[2,2],17:[2,2],19:[2,2],20:[2,2],21:[2,2],22:[2,2],24:[2,2],25:[2,2],26:[2,2],27:[2,2],34:[2,2],36:[2,2],46:[2,2]},{5:[2,4],8:[2,4],11:[2,4],12:[2,4],13:[2,4],15:[2,4],17:[2,4],19:[2,4],20:[2,4],21:[2,4],22:[2,4],24:[2,4],25:[2,4],26:[2,4],27:[2,4],34:[2,4],36:[2,4],46:[2,4]},{5:[2,32],34:[1,33],36:[2,32],46:[2,32]},{5:[2,30],34:[2,30],36:[2,30],46:[2,30]},{5:[2,20],19:[1,40],20:[1,41],21:[1,42],22:[1,43],24:[2,20],25:[2,20],26:[2,20],27:[2,20],34:[2,20],36:[2,20],46:[2,20]},{5:[2,21],19:[1,40],20:[1,41],21:[1,42],22:[1,43],24:[2,21],25:[2,21],26:[2,21],27:[2,21],34:[2,21],36:[2,21],46:[2,21]},{5:[2,22],19:[1,40],20:[1,41],21:[1,42],22:[1,43],24:[2,22],25:[2,22],26:[2,22],27:[2,22],34:[2,22],36:[2,22],46:[2,22]},{5:[2,23],19:[1,40],20:[1,41],21:[1,42],22:[1,43],24:[2,23],25:[2,23],26:[2,23],27:[2,23],34:[2,23],36:[2,23],46:[2,23]},{5:[2,25],34:[2,25],36:[2,25],46:[2,25]},{5:[2,27],34:[2,27],36:[2,27],41:[1,44],42:[1,45],45:[1,46],46:[2,27]},{5:[2,26],34:[2,26],36:[2,26],46:[2,26]},{5:[2,28],34:[2,28],36:[2,28],41:[1,44],42:[1,45],45:[1,46],46:[2,28]},{5:[2,15],17:[1,48],19:[2,15],20:[2,15],21:[2,15],22:[2,15],24:[2,15],25:[2,15],26:[2,15],27:[2,15],34:[2,15],36:[2,15],46:[2,15]},{5:[2,16],17:[1,48],19:[2,16],20:[2,16],21:[2,16],22:[2,16],24:[2,16],25:[2,16],26:[2,16],27:[2,16],34:[2,16],36:[2,16],46:[2,16]},{5:[2,17],17:[1,48],19:[2,17],20:[2,17],21:[2,17],22:[2,17],24:[2,17],25:[2,17],26:[2,17],27:[2,17],34:[2,17],36:[2,17],46:[2,17]},{5:[2,18],17:[1,48],19:[2,18],20:[2,18],21:[2,18],22:[2,18],24:[2,18],25:[2,18],26:[2,18],27:[2,18],34:[2,18],36:[2,18],46:[2,18]},{5:[2,37],8:[2,37],11:[2,37],12:[2,37],13:[2,37],15:[2,37],17:[2,37],19:[2,37],20:[2,37],21:[2,37],22:[2,37],24:[2,37],25:[2,37],26:[2,37],27:[2,37],29:[2,37],31:[2,37],34:[2,37],36:[2,37],38:[2,37],41:[2,37],42:[2,37],44:[2,37],45:[2,37],46:[2,37]},{44:[1,88]},{41:[1,44],42:[1,45],44:[1,89],45:[1,46]},{5:[2,40],8:[2,40],11:[2,40],12:[2,40],13:[2,40],15:[2,40],17:[2,40],19:[2,40],20:[2,40],21:[2,40],22:[2,40],24:[2,40],25:[2,40],26:[2,40],27:[2,40],29:[2,40],31:[2,40],34:[2,40],36:[2,40],38:[2,40],41:[2,40],42:[2,40],44:[2,40],45:[2,40],46:[2,40]},{38:[1,82],46:[1,90]},{5:[2,56],8:[2,56],11:[2,56],12:[2,56],13:[2,56],15:[2,56],17:[2,56],19:[2,56],20:[2,56],21:[2,56],22:[2,56],24:[2,56],25:[2,56],26:[2,56],27:[2,56],29:[2,56],31:[2,56],34:[2,56],36:[2,56],38:[2,56],44:[2,56],46:[2,56]},{5:[2,13],8:[1,53],15:[1,52],17:[2,13],19:[2,13],20:[2,13],21:[2,13],22:[2,13],24:[2,13],25:[2,13],26:[2,13],27:[2,13],34:[2,13],36:[2,13],46:[2,13]},{5:[2,48],8:[2,48],11:[2,48],12:[2,48],13:[2,48],15:[2,48],17:[2,48],19:[2,48],20:[2,48],21:[2,48],22:[2,48],24:[2,48],25:[2,48],26:[2,48],27:[2,48],29:[2,48],31:[2,48],34:[2,48],36:[2,48],38:[2,48],44:[2,48],46:[2,48]},{7:91,30:15,32:14,39:23,40:[1,26],42:[1,24],43:9,45:[1,16],47:[1,18],48:10,49:[1,19],50:11,51:[1,20],52:12,53:[1,21],54:13,55:[1,22]},{5:[2,10],8:[2,10],11:[1,54],12:[1,55],13:[1,56],15:[2,10],17:[2,10],19:[2,10],20:[2,10],21:[2,10],22:[2,10],24:[2,10],25:[2,10],26:[2,10],27:[2,10],34:[2,10],36:[2,10],46:[2,10]},{5:[2,11],8:[2,11],11:[1,54],12:[1,55],13:[1,56],15:[2,11],17:[2,11],19:[2,11],20:[2,11],21:[2,11],22:[2,11],24:[2,11],25:[2,11],26:[2,11],27:[2,11],34:[2,11],36:[2,11],46:[2,11]},{5:[2,6],8:[2,6],11:[2,6],12:[2,6],13:[2,6],15:[2,6],17:[2,6],19:[2,6],20:[2,6],21:[2,6],22:[2,6],24:[2,6],25:[2,6],26:[2,6],27:[2,6],34:[2,6],36:[2,6],46:[2,6]},{5:[2,7],8:[2,7],11:[2,7],12:[2,7],13:[2,7],15:[2,7],17:[2,7],19:[2,7],20:[2,7],21:[2,7],22:[2,7],24:[2,7],25:[2,7],26:[2,7],27:[2,7],34:[2,7],36:[2,7],46:[2,7]},{5:[2,8],8:[2,8],11:[2,8],12:[2,8],13:[2,8],15:[2,8],17:[2,8],19:[2,8],20:[2,8],21:[2,8],22:[2,8],24:[2,8],25:[2,8],26:[2,8],27:[2,8],34:[2,8],36:[2,8],46:[2,8]},{5:[2,38],8:[2,38],11:[2,38],12:[2,38],13:[2,38],15:[2,38],17:[2,38],19:[2,38],20:[2,38],21:[2,38],22:[2,38],24:[2,38],25:[2,38],26:[2,38],27:[2,38],29:[2,38],31:[2,38],34:[2,38],36:[2,38],38:[2,38],41:[2,38],42:[2,38],44:[2,38],45:[2,38],46:[2,38]},{5:[2,39],8:[2,39],11:[2,39],12:[2,39],13:[2,39],15:[2,39],17:[2,39],19:[2,39],20:[2,39],21:[2,39],22:[2,39],24:[2,39],25:[2,39],26:[2,39],27:[2,39],29:[2,39],31:[2,39],34:[2,39],36:[2,39],38:[2,39],41:[2,39],42:[2,39],44:[2,39],45:[2,39],46:[2,39]},{5:[2,41],8:[2,41],11:[2,41],12:[2,41],13:[2,41],15:[2,41],17:[2,41],19:[2,41],20:[2,41],21:[2,41],22:[2,41],24:[2,41],25:[2,41],26:[2,41],27:[2,41],29:[2,41],31:[2,41],34:[2,41],36:[2,41],38:[2,41],41:[2,41],42:[2,41],44:[2,41],45:[2,41],46:[2,41]},{38:[2,34],44:[2,34],46:[2,34]}],defaultActions:{31:[2,1]},parseError:function(a,b){if(!b.recoverable)throw new Error(a);this.trace(a)},parse:function(a){function b(){var a;return a=c.lexer.lex()||m,"number"!=typeof a&&(a=c.symbols_[a]||a),a}var c=this,d=[0],e=[null],f=[],g=this.table,h="",i=0,j=0,k=0,l=2,m=1;this.lexer.setInput(a),this.lexer.yy=this.yy,this.yy.lexer=this.lexer,this.yy.parser=this,"undefined"==typeof this.lexer.yylloc&&(this.lexer.yylloc={});var n=this.lexer.yylloc;f.push(n);var o=this.lexer.options&&this.lexer.options.ranges;this.parseError="function"==typeof this.yy.parseError?this.yy.parseError:Object.getPrototypeOf(this).parseError;for(var p,q,r,s,t,u,v,w,x,y={};;){if(r=d[d.length-1],this.defaultActions[r]?s=this.defaultActions[r]:((null===p||"undefined"==typeof p)&&(p=b()),s=g[r]&&g[r][p]),"undefined"==typeof s||!s.length||!s[0]){var z="";x=[];for(u in g[r])this.terminals_[u]&&u>l&&x.push("'"+this.terminals_[u]+"'");z=this.lexer.showPosition?"Parse error on line "+(i+1)+":\n"+this.lexer.showPosition()+"\nExpecting "+x.join(", ")+", got '"+(this.terminals_[p]||p)+"'":"Parse error on line "+(i+1)+": Unexpected "+(p==m?"end of input":"'"+(this.terminals_[p]||p)+"'"),this.parseError(z,{text:this.lexer.match,token:this.terminals_[p]||p,line:this.lexer.yylineno,loc:n,expected:x})}if(s[0]instanceof Array&&s.length>1)throw new Error("Parse Error: multiple actions possible at state: "+r+", token: "+p);switch(s[0]){case 1:d.push(p),e.push(this.lexer.yytext),f.push(this.lexer.yylloc),d.push(s[1]),p=null,q?(p=q,q=null):(j=this.lexer.yyleng,h=this.lexer.yytext,i=this.lexer.yylineno,n=this.lexer.yylloc,k>0&&k--);break;case 2:if(v=this.productions_[s[1]][1],y.$=e[e.length-v],y._$={first_line:f[f.length-(v||1)].first_line,last_line:f[f.length-1].last_line,first_column:f[f.length-(v||1)].first_column,last_column:f[f.length-1].last_column},o&&(y._$.range=[f[f.length-(v||1)].range[0],f[f.length-1].range[1]]),t=this.performAction.call(y,h,j,i,this.yy,s[1],e,f),"undefined"!=typeof t)return t;v&&(d=d.slice(0,2*-1*v),e=e.slice(0,-1*v),f=f.slice(0,-1*v)),d.push(this.productions_[s[1]][0]),e.push(y.$),f.push(y._$),w=g[d[d.length-2]][d[d.length-1]],d.push(w);break;case 3:return!0}}return!0}},c=function(){var a={EOF:1,parseError:function(a,b){if(!this.yy.parser)throw new Error(a);this.yy.parser.parseError(a,b)},setInput:function(a){return this._input=a,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var a=this._input[0];this.yytext+=a,this.yyleng++,this.offset++,this.match+=a,this.matched+=a;var b=a.match(/(?:\r\n?|\n).*/g);return b?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),a},unput:function(a){var b=a.length,c=a.split(/(?:\r\n?|\n)/g);this._input=a+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-b-1),this.offset-=b;var d=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),c.length-1&&(this.yylineno-=c.length-1);var e=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:c?(c.length===d.length?this.yylloc.first_column:0)+d[d.length-c.length].length-c[0].length:this.yylloc.first_column-b},this.options.ranges&&(this.yylloc.range=[e[0],e[0]+this.yyleng-b]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},less:function(a){this.unput(this.match.slice(a))},pastInput:function(){var a=this.matched.substr(0,this.matched.length-this.match.length);return(a.length>20?"...":"")+a.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var a=this.match;return a.length<20&&(a+=this._input.substr(0,20-a.length)),(a.substr(0,20)+(a.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var a=this.pastInput(),b=new Array(a.length+1).join("-");return a+this.upcomingInput()+"\n"+b+"^"},test_match:function(a,b){var c,d,e;if(this.options.backtrack_lexer&&(e={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(e.yylloc.range=this.yylloc.range.slice(0))),d=a[0].match(/(?:\r\n?|\n).*/g),d&&(this.yylineno+=d.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:d?d[d.length-1].length-d[d.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+a[0].length},this.yytext+=a[0],this.match+=a[0],this.matches=a,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(a[0].length),this.matched+=a[0],c=this.performAction.call(this,this.yy,this,b,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),c)return c;if(this._backtrack){for(var f in e)this[f]=e[f];return!1}return!1},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0);var a,b,c,d;this._more||(this.yytext="",this.match="");for(var e=this._currentRules(),f=0;fb[0].length)){if(b=c,d=f,this.options.backtrack_lexer){if(a=this.test_match(c,e[f]),a!==!1)return a;if(this._backtrack){b=!1;continue}return!1}if(!this.options.flex)break}return b?(a=this.test_match(b,e[d]),a!==!1?a:!1):""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})
-},lex:function(){var a=this.next();return a?a:this.lex()},begin:function(a){this.conditionStack.push(a)},popState:function(){var a=this.conditionStack.length-1;return a>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(a){return a=this.conditionStack.length-1-Math.abs(a||0),a>=0?this.conditionStack[a]:"INITIAL"},pushState:function(a){this.begin(a)},stateStackSize:function(){return this.conditionStack.length},options:{},performAction:function(a,b,c,d){switch(c){case 0:return 29;case 1:return 31;case 2:return"from";case 3:return 24;case 4:return 25;case 5:return 21;case 6:return 19;case 7:return 22;case 8:return 20;case 9:return 26;case 10:return 27;case 11:return 34;case 12:return 36;case 13:return 55;case 14:return 53;case 15:break;case 16:return 49;case 17:return 47;case 18:return 47;case 19:return 40;case 20:return 51;case 21:return 41;case 22:return 11;case 23:return 12;case 24:return 13;case 25:return 38;case 26:return 8;case 27:return 26;case 28:return 27;case 29:return 24;case 30:return 24;case 31:return 25;case 32:return 25;case 33:return 21;case 34:return 22;case 35:return 20;case 36:return 19;case 37:return 34;case 38:return 36;case 39:return 15;case 40:return 17;case 41:return 45;case 42:return 44;case 43:return 42;case 44:return 46;case 45:return 9;case 46:return 5}},rules:[/^(?:\s+in\b)/,/^(?:\s+notIn\b)/,/^(?:\s+from\b)/,/^(?:\s+(eq|EQ)\b)/,/^(?:\s+(neq|NEQ)\b)/,/^(?:\s+(lte|LTE)\b)/,/^(?:\s+(lt|LT)\b)/,/^(?:\s+(gte|GTE)\b)/,/^(?:\s+(gt|GT)\b)/,/^(?:\s+(like|LIKE)\b)/,/^(?:\s+(notLike|NOT_LIKE)\b)/,/^(?:\s+(and|AND)\b)/,/^(?:\s+(or|OR)\b)/,/^(?:\s+null\b)/,/^(?:\s+(true|false)\b)/,/^(?:\s+)/,/^(?:-?[0-9]+(?:\.[0-9]+)?\b)/,/^(?:'[^']*')/,/^(?:"[^"]*")/,/^(?:([a-zA-Z_$][0-9a-zA-Z_$]*))/,/^(?:^\/((?![\s=])[^[\/\n\\]*(?:(?:\\[\s\S]|\[[^\]\n\\]*(?:\\[\s\S][^\]\n\\]*)*])[^[\/\n\\]*)*\/[imgy]{0,4})(?!\w))/,/^(?:\.)/,/^(?:\*)/,/^(?:\/)/,/^(?:\%)/,/^(?:,)/,/^(?:-)/,/^(?:=~)/,/^(?:!=~)/,/^(?:==)/,/^(?:===)/,/^(?:!=)/,/^(?:!==)/,/^(?:<=)/,/^(?:>=)/,/^(?:>)/,/^(?:<)/,/^(?:&&)/,/^(?:\|\|)/,/^(?:\+)/,/^(?:\^)/,/^(?:\()/,/^(?:\])/,/^(?:\[)/,/^(?:\))/,/^(?:!)/,/^(?:$)/],conditions:{INITIAL:{rules:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46],inclusive:!0}}};return a}();return b.lexer=c,a.prototype=b,b.Parser=a,new a}();"undefined"!=typeof a&&"undefined"!=typeof c&&(c.parser=e,c.Parser=e.Parser,c.parse=function(){return e.parse.apply(e,arguments)},c.main=function(b){b[1]||(console.log("Usage: "+b[0]+" FILE"),d.exit(1));var e=a("fs").readFileSync(a("path").normalize(b[1]),"utf8");return c.parser.parse(e)},"undefined"!=typeof b&&a.main===b&&c.main(d.argv.slice(1)))},{__browserify_process:48,fs:45,path:46}],28:[function(a,b,c){!function(){"use strict";var b=a("./constraint/parser"),d=a("./nools/nool.parser");c.parseConstraint=function(a){try{return b.parse(a)}catch(c){throw new Error("Invalid expression '"+a+"'")}},c.parseRuleSet=function(a,b){return d.parse(a,b)}}()},{"./constraint/parser":27,"./nools/nool.parser":29}],29:[function(a,b,c){"use strict";var d=a("./tokens.js"),e=a("../../extended"),f=e.hash.keys,g=a("./util.js"),h=function(a,b,c){var d=a;a=a.replace(/\/\/(.*)[\n|\r|\r\n]/g,"").replace(/\n|\r|\r\n/g," ");for(var e,i=new RegExp("^("+f(b).join("|")+")");a&&-1!==(e=g.findNextTokenIndex(a));){a=a.substr(e);var j=a.match(i);if(null===j)throw new Error("Error parsing "+a);if(j=j[1],!(j in b))throw new Error("Unknown token"+j);try{a=b[j](a,c,h).replace(/^\s*|\s*$/g,"")}catch(k){throw new Error("Invalid "+j+" definition \n"+k.message+"; \nstarting at : "+d)}}};c.parse=function(a,b){var c={define:[],rules:[],scope:[],loaded:[],file:b};return h(a,d,c),c}},{"../../extended":10,"./tokens.js":30,"./util.js":31}],30:[function(require,module,exports){var process=require("__browserify_process"),utils=require("./util.js"),fs=require("fs"),indexOf=require("../../extended").indexOf,isWhiteSpace=function(a){return 0===a.replace(/[\s|\n|\r|\t]/g,"").length},ruleTokens={salience:function(){var a=/^(salience|priority)\s*:\s*(-?\d+)\s*[,;]?/;return function(b,c){if(a.test(b)){var d=b.match(a),e=parseInt(d[2],10);if(isNaN(e))throw new Error("Invalid salience/priority "+d[2]);return c.options.priority=e,b.replace(d[0],"")}throw new Error("invalid format")}}(),agendaGroup:function(){var a=/^(agenda-group|agendaGroup)\s*:\s*([a-zA-Z_$][0-9a-zA-Z_$]*|"[^"]*"|'[^']*')\s*[,;]?/;return function(b,c){if(a.test(b)){var d=b.match(a),e=d[2];if(!e)throw new Error("Invalid agenda-group "+d[2]);return c.options.agendaGroup=e.replace(/^["']|["']$/g,""),b.replace(d[0],"")}throw new Error("invalid format")}}(),autoFocus:function(){var a=/^(auto-focus|autoFocus)\s*:\s*(true|false)\s*[,;]?/;return function(b,c){if(a.test(b)){var d=b.match(a),e=d[2];if(!e)throw new Error("Invalid auto-focus "+d[2]);return c.options.autoFocus="true"===e?!0:!1,b.replace(d[0],"")}throw new Error("invalid format")}}(),"agenda-group":function(){return this.agendaGroup.apply(this,arguments)},"auto-focus":function(){return this.autoFocus.apply(this,arguments)},priority:function(){return this.salience.apply(this,arguments)},when:function(){var ruleRegExp=/^(\$?\w+) *: *(\w+)(.*)/,joinFunc=function(a,b){return"; "+b},constraintRegExp=/(\{ *(?:["']?\$?\w+["']?\s*:\s*["']?\$?\w+["']? *(?:, *["']?\$?\w+["']?\s*:\s*["']?\$?\w+["']?)*)+ *\})/,predicateExp=/^(\w+) *\((.*)\)$/m,parseRules=function(str){for(var rules=[],ruleLines=str.split(";"),l=ruleLines.length,ruleLine,i=0;l>i&&(ruleLine=ruleLines[i].replace(/^\s*|\s*$/g,"").replace(/\n/g,""));i++)if(!isWhiteSpace(ruleLine)){var rule=[];if(predicateExp.test(ruleLine)){var m=ruleLine.match(predicateExp),pred=m[1].replace(/^\s*|\s*$/g,"");if(rule.push(pred),ruleLine=m[2].replace(/^\s*|\s*$/g,""),"or"===pred){rule=rule.concat(parseRules(ruleLine.replace(/,\s*(\$?\w+\s*:)/,joinFunc))),rules.push(rule);continue}}var parts=ruleLine.match(ruleRegExp);if(!parts||!parts.length)throw new Error("Invalid constraint "+ruleLine);rule.push(parts[2],parts[1]);var constraints=parts[3].replace(/^\s*|\s*$/g,""),hashParts=constraints.match(constraintRegExp);if(hashParts){var hash=hashParts[1],constraint=constraints.replace(hash,"");constraint&&rule.push(constraint.replace(/^\s*|\s*$/g,"")),hash&&rule.push(eval("("+hash.replace(/(\$?\w+)\s*:\s*(\$?\w+)/g,'"$1" : "$2"')+")"))}else constraints&&!isWhiteSpace(constraints)&&rule.push(constraints);rules.push(rule)}return rules};return function(a,b){var c=a.replace(/^when\s*/,"").replace(/^\s*|\s*$/g,"");if("{"===utils.findNextToken(c)){var d=utils.getTokensBetween(c,"{","}",!0).join("");return c=c.replace(d,""),b.constraints=parseRules(d.replace(/^\{\s*|\}\s*$/g,"")),c}throw new Error("unexpected token : expected : '{' found : '"+utils.findNextToken(c)+"'")}}(),then:function(){return function(a,b){if(b.action)throw new Error("action already defined for rule"+b.name);var c=a.replace(/^then\s*/,"").replace(/^\s*|\s*$/g,"");if("{"===utils.findNextToken(c)){var d=utils.getTokensBetween(c,"{","}",!0).join("");if(c=c.replace(d,""),b.action||(b.action=d.replace(/^\{\s*|\}\s*$/g,"")),!isWhiteSpace(c))throw new Error("Error parsing then block "+a);return c}throw new Error("unexpected token : expected : '{' found : '"+utils.findNextToken(c)+"'")}}()},topLevelTokens={"/":function(a){return a.match(/^\/\*/)?a.replace(/\/\*.*?\*\//,""):a},define:function(a,b){var c=a.replace(/^define\s*/,""),d=c.match(/^([a-zA-Z_$][0-9a-zA-Z_$]*)/);if(d){if(c=c.replace(d[0],"").replace(/^\s*|\s*$/g,""),"{"===utils.findNextToken(c)){d=d[1];var e=utils.getTokensBetween(c,"{","}",!0).join("");return c=c.replace(e,""),b.define.push({name:d,properties:"("+e+")"}),c}throw new Error("unexpected token : expected : '{' found : '"+utils.findNextToken(c)+"'")}throw new Error("missing name")},"import":function(a,b,c){if("undefined"!=typeof window)throw new Error("import cannot be used in a browser");var d=a.replace(/^import\s*/,"");if("("===utils.findNextToken(d)){var e=utils.getParamList(d);if(d=d.replace(e,"").replace(/^\s*|\s*$/g,""),";"===utils.findNextToken(d)&&(d=d.replace(/\s*;/,"")),e=e.replace(/[\(|\)]/g,"").split(","),1===e.length){if(e=utils.resolve(b.file||process.cwd(),e[0].replace(/["|']/g,"")),-1===indexOf(b.loaded,e)){var f=b.file;b.file=e,c(fs.readFileSync(e,"utf8"),topLevelTokens,b),b.loaded.push(e),b.file=f}return d}throw new Error("import accepts a single file")}throw new Error("unexpected token : expected : '(' found : '"+utils.findNextToken(d)+"'")},global:function(a,b){var c=a.replace(/^global\s*/,""),d=c.match(/^([a-zA-Z_$][0-9a-zA-Z_$]*\s*)/);if(d){if(c=c.replace(d[0],"").replace(/^\s*|\s*$/g,""),"="===utils.findNextToken(c)){d=d[1].replace(/^\s+|\s+$/g,"");var e=utils.getTokensBetween(c,"=",";",!0).join(""),f=e.substring(1,e.length-1);if(f=f.replace(/^\s+|\s+$/g,""),/^require\(/.test(f)){var g=utils.getParamList(f.replace("require")).replace(/[\(|\)]/g,"").split(",");1===g.length&&(g=g[0].replace(/["|']/g,""),f=["require('",utils.resolve(b.file||process.cwd(),g),"')"].join(""))}return b.scope.push({name:d,body:f}),c=c.replace(e,"")}throw new Error("unexpected token : expected : '=' found : '"+utils.findNextToken(c)+"'")}throw new Error("missing name")},"function":function(a,b){var c=a.replace(/^function\s*/,""),d=c.match(/^([a-zA-Z_$][0-9a-zA-Z_$]*)\s*/);if(d){if(c=c.replace(d[0],""),"("===utils.findNextToken(c)){d=d[1];var e=utils.getParamList(c);if(c=c.replace(e,"").replace(/^\s*|\s*$/g,""),"{"===utils.findNextToken(c)){var f=utils.getTokensBetween(c,"{","}",!0).join("");return c=c.replace(f,""),b.scope.push({name:d,body:"function"+e+f}),c}throw new Error("unexpected token : expected : '{' found : '"+utils.findNextToken(c)+"'")}throw new Error("unexpected token : expected : '(' found : '"+utils.findNextToken(c)+"'")}throw new Error("missing name")},rule:function(a,b,c){var d=a.replace(/^rule\s*/,""),e=d.match(/^([a-zA-Z_$][0-9a-zA-Z_$]*|"[^"]*"|'[^']*')/);if(e){if(d=d.replace(e[0],"").replace(/^\s*|\s*$/g,""),"{"===utils.findNextToken(d)){e=e[1].replace(/^["']|["']$/g,"");var f={name:e,options:{},constraints:null,action:null},g=utils.getTokensBetween(d,"{","}",!0).join("");return d=d.replace(g,""),c(g.replace(/^\{\s*|\}\s*$/g,""),ruleTokens,f),b.rules.push(f),d}throw new Error("unexpected token : expected : '{' found : '"+utils.findNextToken(d)+"'")}throw new Error("missing name")}};module.exports=topLevelTokens},{"../../extended":10,"./util.js":31,__browserify_process:48,fs:45}],31:[function(a,b,c){var d=a("__browserify_process"),e=a("path"),f=/[\s|\n|\r|\t]/,g=e.sep||("win32"===d.platform?"\\":"/"),h={"{":"}","}":"{","(":")",")":"(","[":"]"},i=c.getTokensBetween=function(a,b,c,d){var e=0,f=[];b||(b=h[c],e=1),c||(c=h[b]),a=Object(a);for(var g,i=!1,j=0,k=!1;g=a.charAt(j++);)if(g===b)e++,i?f.push(g):(i=!0,d&&f.push(g));else if(g===c&&j){if(e--,0===e){d&&f.push(g),k=!0;break}f.push(g)}else i&&f.push(g);if(!k)throw new Error("Unable to match "+b+" in "+a);return f};c.getParamList=function(a){return i(a,"(",")",!0).join("")},c.resolve=function(a,b){return""!==e.extname(a)&&(a=e.dirname(a)),1===b.split(g).length?b:e.resolve(a,b)};var j=c.findNextTokenIndex=function(a,b,c){b=b||0,c=c||a.length;var d=-1,e=a.length;for((!c||c>e)&&(c=e);c>b;b++){var g=a.charAt(b);if(!f.test(g)){d=b;break}}return d};c.findNextToken=function(a,b,c){return a.charAt(j(a,b,c))}},{__browserify_process:48,path:46}],32:[function(a,b,c){!function(){"use strict";var b=a("./extended"),d=b.merge,e=b.forEach,f=b.declare,g=a("./constraintMatcher"),h=a("./constraint"),i=f({}),j=i.extend({instance:{constructor:function(a,c,f,i,j){j=j||{},this.type=a,this.alias=c,this.conditions=f,this.pattern=j.pattern,this.constraints=[new h.ObjectConstraint(a)];var k=g.toConstraints(f,d({alias:c},j));if(k.length)this.constraints=this.constraints.concat(k);else{var l=new h.TrueConstraint;this.constraints.push(l)}if(i&&!b.isEmpty(i)){var m=new h.HashConstraint(i);this.constraints.push(m)}e(this.constraints,function(a){a.set("alias",c)})},hasConstraint:function(a){return b.some(this.constraints,function(b){return b instanceof a})},hashCode:function(){return[this.type,this.alias,b.format("%j",this.conditions)].join(":")},toString:function(){return b.format("%j",this.constraints)}}}).as(c,"ObjectPattern");j.extend().as(c,"NotPattern"),i.extend({instance:{constructor:function(a,b){this.leftPattern=a,this.rightPattern=b},hashCode:function(){return[this.leftPattern.hashCode(),this.rightPattern.hashCode()].join(":")},getters:{constraints:function(){return this.leftPattern.constraints.concat(this.rightPattern.constraints)}}}}).as(c,"CompositePattern");var k=f({}).as(c,"InitialFact");j.extend({instance:{constructor:function(){this._super([k,"i",[],{}])},assert:function(){return!0}}}).as(c,"InitialFactPattern")}()},{"./constraint":7,"./constraintMatcher":8,"./extended":10}],33:[function(a,b,c){"use strict";function d(a,b,c,d){e.isArray(b)?(d=c,c=b):b=b||{};var g=e.every(c,function(a){return f(a)});g&&1===c.length&&(c=c[0],g=!1);var h=[],i=b.scope||{};if(c.scope=i,g){for(var j,k=function(a,b){n[b]?e(n).forEach(function(b){b.push(a)}):(n[b]=0===b?[]:n[b-1].slice(),0!==b&&n[b].pop(),n[b].push(a))},l=c.length,n=[],o=0;l>o;o++)j=c[o],j.scope=i,e.forEach(p(j),k);h=e.map(n,function(c){for(var e=null,f=0;f>>0;if(0===d)return-1;var e=d;arguments.length>2&&(e=Number(arguments[2]),e!==e?e=0:0!==e&&e!==1/0&&e!==-(1/0)&&(e=(e>0||-1)*P(Q(e))));for(var f=e>=0?R(e,d-1):d-Q(e);f>=0;f--)if(f in c&&c[f]===b)return f;return-1}function i(a,b,c){if(a&&X&&X===a.filter)return a.filter(b,c);if(!N(a)||"function"!=typeof b)throw new TypeError;for(var d=Object(a),e=d.length>>>0,f=[],g=0;e>g;g++)if(g in d){var h=d[g];b.call(c,h,g,d)&&f.push(h)}return f}function j(a,b,c){if(!N(a)||"function"!=typeof b)throw new TypeError;if(a&&T&&T===a.forEach)return a.forEach(b,c),a;for(var d=0,e=a.length;e>d;++d)b.call(c||a,a[d],d,a);return a}function k(a,b,c){if(a&&Y&&Y===a.every)return a.every(b,c);if(!N(a)||"function"!=typeof b)throw new TypeError;for(var d=Object(a),e=d.length>>>0,f=0;e>f;f++)if(f in d&&!b.call(c,d[f],f,d))return!1;return!0}function l(a,b,c){if(a&&Z&&Z===a.some)return a.some(b,c);if(!N(a)||"function"!=typeof b)throw new TypeError;for(var d=Object(a),e=d.length>>>0,f=0;e>f;f++)if(f in d&&b.call(c,d[f],f,d))return!0;return!1}function m(a,b,c){if(a&&U&&U===a.map)return a.map(b,c);if(!N(a)||"function"!=typeof b)throw new TypeError;for(var d=Object(a),e=d.length>>>0,f=[],g=0;e>g;g++)g in d&&f.push(b.call(c,d[g],g,d));return f}function n(a,b,c){var d=arguments.length>2;if(a&&V&&V===a.reduce)return d?a.reduce(b,c):a.reduce(b);if(!N(a)||"function"!=typeof b)throw new TypeError;var e=0,f=a.length>>0;if(arguments.length<3){if(0===f)throw new TypeError("Array length is 0 and no second argument");c=a[0],e=1}else c=arguments[2];for(;f>e;)e in a&&(c=b.call(void 0,c,a[e],e,a)),++e;return c}function o(a,b,c){var d=arguments.length>2;if(a&&W&&W===a.reduceRight)return d?a.reduceRight(b,c):a.reduceRight(b);if(!N(a)||"function"!=typeof b)throw new TypeError;var e=Object(a),f=e.length>>>0;if(0===f&&2===arguments.length)throw new TypeError;var g=f-1;if(arguments.length>=3)c=arguments[2];else for(;;)if(g in a){c=a[g--];break}for(;g>=0;)g in e&&(c=b.call(void 0,c,e[g],g,e)),g--;return c}function p(a){var c=[];if(null!==a){var d=$(arguments);if(1===d.length)if(N(a))c=a;else if(b.isHash(a))for(var e in a)a.hasOwnProperty(e)&&c.push([e,a[e]]);else c.push(a);else j(d,function(a){c=c.concat(p(a))})}return c}function q(a){return a=a||[],a.length?n(a,function(a,b){return a+b}):0}function r(a){if(a=a||[],a.length){var c=q(a);if(b.isNumber(c))return c/a.length;throw new Error("Cannot average an array of non numbers.")}return 0}function s(a,b){return _(a,b)}function t(a,b){return _(a,b)[0]}function u(a,b){return _(a,b)[a.length-1]}function v(a){var b=a,c=J($(arguments,1));return N(a)&&(b=i(a,function(a){return-1===g(c,a)})),b}function w(a){var b,c=[],d=-1,e=0;if(a)for(b=a.length;++d0?(c.push(c.shift()),b--):(c.unshift(c.pop()),b++),y(c,b)):c}function z(a,b){var c=[];if(N(a)){var d=a.slice(0);"number"!=typeof b&&(b=a.length),b?b<=a.length&&(c=n(a,function(a,c,f){var g;return g=b>1?e(c,y(d,f).slice(1),b):[[c]],a.concat(g)},[])):c=[[]]}return c}function A(){var a=[],c=$(arguments);if(c.length>1){var d=c.shift();N(d)&&(a=n(d,function(a,d,e){for(var f=[d],g=0;gd;d++)c.push(a[b[d]]||null);return c}function D(){var a=[],b=$(arguments);if(b.length>1){for(var c=0,d=b.length;d>c;c++)a=a.concat(b[c]);a=w(a)}return a}function E(){var a,b,c=[],d=-1;if(a=arguments.length>1?$(arguments):arguments[0],N(a))for(c=a[0],d=0,b=a.length;++d1?c:p(a),n(b,function(a,b){return a.concat(b)},[])}function K(a,b){b=b.split(".");var c=a.slice(0);return j(b,function(a){var b=a.match(/(\w+)\(\)$/);c=m(c,function(c){return b?c[b[1]]():c[a]})}),c}function L(a,b,c){return c=$(arguments,2),m(a,function(a){var d=M(b)?a[b]:b;return d.apply(a,c)})}var M=b.isString,N=Array.isArray||b.isArray,O=b.isDate,P=Math.floor,Q=Math.abs,R=(Math.max,Math.min),S=Array.prototype,T=(S.indexOf,S.forEach),U=S.map,V=S.reduce,W=S.reduceRight,X=S.filter,Y=S.every,Z=S.some,$=c.argsToArray,_=function(){var a=function(a,b){return k(a,b)},b=function(a,b){return a-b},c=function(a,b){return a.getTime()-b.getTime()};return function(d,e){var f=[];return N(d)&&(f=d.slice(),e?"function"==typeof e?f.sort(e):f.sort(function(a,b){var c=a[e],d=b[e];return M(c)&&M(d)?c>d?1:d>c?-1:0:O(c)&&O(d)?c.getTime()-d.getTime():c-d}):a(f,M)?f.sort():a(f,O)?f.sort(c):f.sort(b)),f}}(),ab={toArray:p,sum:q,avg:r,sort:s,min:t,max:u,difference:v,removeDuplicates:w,unique:x,rotate:y,permutations:z,zip:A,transpose:B,valuesAt:C,union:D,intersect:E,powerSet:F,cartesian:G,compact:H,multiply:I,flatten:J,pluck:K,invoke:L,forEach:j,map:m,filter:i,reduce:n,reduceRight:o,some:l,every:k,indexOf:g,lastIndexOf:h};return a.define(N,ab).expose(ab)}"undefined"!=typeof c?"undefined"!=typeof b&&b.exports&&(b.exports=d(a("extended"),a("is-extended"),a("arguments-extended"))):"function"==typeof define&&define.amd?define(["extended","is-extended","arguments-extended"],function(a,b,c){return d(a,b,c)}):this.arrayExtended=d(this.extended,this.isExtended,this.argumentsExtended)}.call(this)},{"arguments-extended":35,extended:40,"is-extended":50}],37:[function(a,b,c){!function(){"use strict";function d(a,b,c){function d(a,b,c,d){a=""+a,c=c||" ";for(var e=a.length;b>e;)d?a+=c:a=c+a,e++;return a}function e(a,c,d){var f=a;if(b.isString(f)){if(a.length>c)if(d){var g=a.length;f=a.substring(g-c,g)}else f=a.substring(0,c)}else f=e(""+f,c);return f}function f(a,c,d){if(!b.isArray(a)||"function"!=typeof c)throw new TypeError;for(var e=Object(a),f=e.length>>>0,g=0;f>g;g++)if(g in e&&!c.call(d,e[g],g,e))return!1;return!0}function g(a,b){return A.difference(new Date(a.getFullYear(),0,1,a.getHours()),a,null,b)+1}function h(a,b,c){b=b||0;var d=a[c?"getUTCFullYear":"getFullYear"](),e=new Date(d,0,1).getDay(),f=(e-b+7)%7,h=o((g(a)+f-1)/7);return e===b&&h++,h}function i(a){var b=a.toString(),c="",d=b.indexOf("(");return d>-1&&(c=b.substring(++d,b.indexOf(")"))),c}function j(a,b){return a.replace(/([a-z])\1*/gi,function(a){var c,d=a.charAt(0),e=a.length,f="0?",g="0{0,2}";if("y"===d)c="\\d{2,4}";else if("M"===d)c=e>2?"\\S+?":"1[0-2]|"+f+"[1-9]";else if("D"===d)c="[12][0-9][0-9]|3[0-5][0-9]|36[0-6]|"+g+"[1-9][0-9]|"+f+"[1-9]";else if("d"===d)c="3[01]|[12]\\d|"+f+"[1-9]";else if("w"===d)c="[1-4][0-9]|5[0-3]|"+f+"[1-9]";else if("E"===d)c="\\S+";else if("h"===d)c="1[0-2]|"+f+"[1-9]";else if("K"===d)c="1[01]|"+f+"\\d";else if("H"===d)c="1\\d|2[0-3]|"+f+"\\d";else if("k"===d)c="1\\d|2[0-4]|"+f+"[1-9]";else if("m"===d||"s"===d)c="[0-5]\\d";else if("S"===d)c="\\d{"+e+"}";else if("a"===d){var h="AM",i="PM";c=h+"|"+i,h!==h.toLowerCase()&&(c+="|"+h.toLowerCase()),i!==i.toLowerCase()&&(c+="|"+i.toLowerCase()),c=c.replace(/\./g,"\\.")}else c="v"===d||"z"===d||"Z"===d||"G"===d||"q"===d||"Q"===d?".*":" "===d?"\\s*":d+"*";return b&&b.push(a),"("+c+")"}).replace(/[\xa0 ]/g,"[\\s\\xa0]")}function k(a){B[a+"sFromNow"]=function(b){return A.add(new Date,a,b)},B[a+"sAgo"]=function(b){return A.add(new Date,a,-b)}}for(var l=function(){function a(a,b,c){return a=a.replace(/s$/,""),e.hasOwnProperty(a)?e[a](b,c):[c,"UTC"+a.charAt(0).toUpperCase()+a.substring(1)+"s",!1]}function b(a,b,c,e){return a=a.replace(/s$/,""),d(f[a](b,c,e))}var c=Math.floor,d=Math.round,e={day:function(a,b){return[b,"Date",!1]},weekday:function(a,b){var c,d,e=b%5,f=a.getDay(),g=0;e?(c=e,d=parseInt(b/5,10)):(c=b>0?5:-5,d=b>0?(b-5)/5:(b+5)/5),6===f&&b>0?g=1:0===f&&0>b&&(g=-1);var h=f+c;return(0===h||6===h)&&(g=b>0?2:-2),[7*d+c+g,"Date",!1]},year:function(a,b){return[b,"FullYear",!0]},week:function(a,b){return[7*b,"Date",!1]},quarter:function(a,b){return[3*b,"Month",!0]},month:function(a,b){return[b,"Month",!0]}},f={quarter:function(a,b,d){var e=b.getFullYear()-a.getFullYear(),f=a[d?"getUTCMonth":"getMonth"](),g=b[d?"getUTCMonth":"getMonth"](),h=c(f/3)+1,i=c(g/3)+1;return i+=4*e,i-h},weekday:function(a,c,d){var e,f=b("day",a,c,d),g=f%7;if(0===g)f=5*b("week",a,c,d);else{var h=0,i=a[d?"getUTCDay":"getDay"](),j=c[d?"getUTCDay":"getDay"]();e=parseInt(f/7,10);var k=new Date(+a);k.setDate(k[d?"getUTCDate":"getDate"]()+7*e);var l=k[d?"getUTCDay":"getDay"]();f>0?6===i||6===j?h=-1:0===i?h=0:(0===j||l+g>5)&&(h=-2):0>f&&(6===i?h=0:0===i||0===j?h=1:(6===j||0>l+g)&&(h=2)),f+=h,f-=2*e}return f},year:function(a,b){return b.getFullYear()-a.getFullYear()},month:function(a,b,c){var d=a[c?"getUTCMonth":"getMonth"](),e=b[c?"getUTCMonth":"getMonth"]();return e-d+12*(b.getFullYear()-a.getFullYear())},week:function(a,c,e){return d(b("day",a,c,e)/7)},day:function(a,b){return 1.1574074074074074e-8*(b.getTime()-a.getTime())},hour:function(a,b){return 2.7777777777777776e-7*(b.getTime()-a.getTime())},minute:function(a,b){return 16666666666666667e-21*(b.getTime()-a.getTime())},second:function(a,b){return.001*(b.getTime()-a.getTime())},millisecond:function(a,b){return b.getTime()-a.getTime()}};return{addTransform:a,differenceTransform:b}}(),m=l.addTransform,n=l.differenceTransform,o=Math.floor,p=Math.round,q=Math.min,r=Math.pow,s=Math.ceil,t=Math.abs,u=["January","February","March","April","May","June","July","August","September","October","November","December"],v=["Jan.","Feb.","Mar.","Apr.","May.","Jun.","Jul.","Aug.","Sep.","Oct.","Nov.","Dec."],w=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],x=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],y=["Before Christ","Anno Domini"],z=["BC","AD"],A={getDaysInMonth:function(a){var b=a.getMonth(),c=[31,28,31,30,31,30,31,31,30,31,30,31];return 1===b&&A.isLeapYear(a)?29:c[b]},isLeapYear:function(a,b){var c=a[b?"getUTCFullYear":"getFullYear"]();return 0===c%400||0===c%4&&0!==c%100},isWeekend:function(a,b){var c=(a||new Date)[b?"getUTCDay":"getDay"]();return 0===c||6===c},getTimezoneName:i,compare:function(a,b,c){return a=new Date(+a),b=new Date(+(b||new Date)),"date"===c?(a.setHours(0,0,0,0),b.setHours(0,0,0,0)):"time"===c&&(a.setFullYear(0,0,0),b.setFullYear(0,0,0)),a>b?1:b>a?-1:0},add:function(a,b,c){var d=m(b,a,c||0);c=d[0];var e=d[1],f=new Date(+a),g=d[2];return e&&f["set"+e](f["get"+e]()+c),g&&f.getDate()E?z:y)[0>f?0:1];else if("y"===D)B=f,E>1&&(2===E?B=e(""+B,2,!0):C=!0);else if("Q"===D.toUpperCase())B=s((j+1)/3),C=!0;else if("M"===D)3>E?(B=j+1,C=!0):B=(3===E?v:u)[j];else if("w"===D)B=h(a,0,c),C=!0;else if("D"===D)B=g(a,c),C=!0;else if("E"===D)3>E?(B=k+1,C=!0):B=(-3===E?x:w)[k];else if("a"===D)B=12>m?"AM":"PM";else if("h"===D)B=m%12||12,C=!0;else if("K"===D)B=m%12,C=!0;else if("k"===D)B=m||24,C=!0;else if("S"===D)B=p(A*r(10,E-3)),C=!0;else if("z"===D||"v"===D||"Z"===D){if(B=i(a),"z"!==D&&"v"!==D||B||(E=4),!B||"Z"===D){var F=a.getTimezoneOffset(),G=[F>=0?"-":"+",d(o(t(F)/60),2,"0"),d(t(F)%60,2,"0")];4===E&&(G.splice(0,0,"GMT"),G.splice(3,0,":")),B=G.join("")}}else B=b;else B=""+n,C=!0;else B=""+m,C=!0;return C&&(B=d(B,E,"0")),B})}},B={},C=["year","month","day","hour","minute","second"],D=0,E=C.length;E>D;D++)k(C[D]);var F={parseDate:function(a,b){if(!b)throw new Error("format required when calling dateExtender.parse");var d=[],e=j(b,d),g=new RegExp("^"+e+"$","i"),h=g.exec(a);if(!h)return null;var i=[1970,0,1,0,0,0,0],k="",l=f(h,function(a,b){if(b){var e=d[b-1],f=e.length,g=e.charAt(0);if("y"===g)if(100>a){a=parseInt(a,10);var h=""+(new Date).getFullYear(),j=100*h.substring(0,2),l=q(h.substring(2,4)+20,99);i[0]=l>a?j+a:j-100+a}else i[0]=a;else if("M"===g){if(f>2){var m,n,o=u;3===f&&(o=v),a=a.replace(".","").toLowerCase();var p=!1;for(m=0,n=o.length;n>m&&!p;m++){var r=o[m].replace(".","").toLocaleLowerCase();r===a&&(a=m,p=!0)}if(!p)return!1}else a--;i[1]=a}else if("E"===g||"e"===g){var s=w;3===f&&(s=x),a=a.toLowerCase(),s=c.map(s,function(a){return a.toLowerCase()});var t=c.indexOf(s,a);if(-1===t){if(a=parseInt(a,10),isNaN(a)||a>s.length)return!1}else a=t}else if("D"===g||"d"===g)"D"===g&&(i[1]=0),i[2]=a;else if("a"===g){var y="am",z="pm",A=/\./g;a=a.replace(A,"").toLowerCase(),k=a===z?"p":a===y?"a":""}else"k"===g||"h"===g||"H"===g||"K"===g?("k"===g&&24===+a&&(a=0),i[3]=a):"m"===g?i[4]=a:"s"===g?i[5]=a:"S"===g&&(i[6]=a)}return!0});if(l){var m=+i[3];"p"===k&&12>m?i[3]=m+12:"a"===k&&12===m&&(i[3]=0);var n=new Date(i[0],i[1],i[2],i[3],i[4],i[5],i[6]),o=-1!==c.indexOf(d,"d"),p=-1!==c.indexOf(d,"M"),r=i[1],s=i[2],t=n.getMonth(),y=n.getDate();return p&&t>r||o&&y>s?null:n}return null}},G=a.define(b.isDate,A).define(b.isString,F).define(b.isNumber,B);for(D in A)A.hasOwnProperty(D)&&(G[D]=A[D]);for(D in F)F.hasOwnProperty(D)&&(G[D]=F[D]);for(D in B)B.hasOwnProperty(D)&&(G[D]=B[D]);return G}"undefined"!=typeof c?"undefined"!=typeof b&&b.exports&&(b.exports=d(a("extended"),a("is-extended"),a("array-extended"))):"function"==typeof define&&define.amd?define(["extended","is-extended","array-extended"],function(a,b,c){return d(a,b,c)}):this.dateExtended=d(this.extended,this.isExtended,this.arrayExtended)}.call(this)},{"array-extended":36,extended:40,"is-extended":50}],38:[function(a,b,c){!function(){function a(){function a(a,b){return b=b||0,x.call(a,b)}function b(a){return"[object Array]"===Object.prototype.toString.call(a)}function c(a){var b;return null!==a&&a!==b&&"object"==typeof a}function d(a){var b=c(a);return b&&a.constructor===Object}function e(a,b){if(a&&a.length)for(var c=0,d=a.length;d>c;c++)if(a[c]===b)return c;return-1}function f(a,b,c){var d,f;for(d in b)b.hasOwnProperty(d)&&-1===e(c,d)&&(f=b[d],d in a&&a[d]===f||(a[d]=f));return a}function g(a){var c=this.__meta,d=c.supers,e=d.length,f=c.superMeta,g=f.pos;if(e>g){a=a?B(a)||b(a)?a:[a]:[];var h,i=f.name,j=f.f;do if(h=d[g][i],"function"==typeof h&&(h=h._f||h)!==j)return f.pos=1+g,h.apply(this,a);
-while(e>++g)}return null}function h(){var a=this.__meta,b=a.supers,c=b.length,d=a.superMeta,e=d.pos;if(c>e){var f,g=d.name,h=d.f;do if(f=b[e][g],"function"==typeof f&&(f=f._f||f)!==h)return d.pos=1+e,f.bind(this);while(c>++e)}return null}function i(a){var b=this.__getters__;return b.hasOwnProperty(a)?b[a].apply(this):this[a]}function j(b,c){var e=this.__setters__;if(!d(b))return e.hasOwnProperty(b)?e[b].apply(this,a(arguments,1)):this[b]=c;for(var f in b){var g=b[f];e.hasOwnProperty(f)?e[b].call(this,g):this[f]=g}}function k(){var a=this.__meta||{},b=a.supers,c=b.length,d=a.superMeta,e=d.pos;if(c>e){var f,g=d.name,h=d.f;do if(f=b[e][g],"function"==typeof f&&(f=f._f||f)!==h)return d.pos=1+e,f.apply(this,arguments);while(c>++e)}return null}function l(a,b){if(a.toString().match(A)){var c=function(){var c,d=this.__meta||{},e=d.superMeta;switch(d.superMeta={f:a,pos:0,name:b},arguments.length){case 0:c=a.call(this);break;case 1:c=a.call(this,arguments[0]);break;case 2:c=a.call(this,arguments[0],arguments[1]);break;case 3:c=a.call(this,arguments[0],arguments[1],arguments[2]);break;default:c=a.apply(this,arguments)}return d.superMeta=e,c};return c._f=a,c}return a._f=a,a}function m(a,b){var c=b.setters||{},d=a.__setters__,e=a.__getters__;for(var f in c)d.hasOwnProperty(f)||(d[f]=c[f]);c=b.getters||{};for(f in c)e.hasOwnProperty(f)||(e[f]=c[f]);for(var g in b)if("getters"!==g&&"setters"!==g){var h=b[g];"function"==typeof h?a.hasOwnProperty(g)||(a[g]=l(k,g)):a[g]=h}}function n(){for(var b=a(arguments),c=b.length,d=this.prototype,e=d.__meta,f=this.__meta,g=d.__meta.bases,h=g.slice(),i=f.supers||[],j=e.supers||[],k=0;c>k;k++){var l=b[k],n=l.prototype,p=n.__meta,q=l.__meta;!p&&(p=n.__meta={proto:n||{}}),!q&&(q=l.__meta={proto:l.__proto__||{}}),m(d,p.proto||{}),m(this,q.proto||{}),o(l.prototype,j,g),o(l,i,h)}return this}function o(a,b,c){var d=a.__meta;!d&&(d=a.__meta={});var f=a.__meta.unique;if(!f&&(d.unique="declare"+ ++y),-1===e(c,f)){c.push(f);for(var g=a.__meta.supers||[],h=g.length-1||0;h>=0;)o(g[h--],b,c);b.unshift(a)}}function p(a,b){var c=b.setters,d=a.__setters__,e=a.__getters__;if(c)for(var f in c)d[f]=c[f];if(c=b.getters||{})for(f in c)e[f]=c[f];for(f in b)if("getters"!=f&&"setters"!=f){var g=b[f];if("function"==typeof g){var h=g.__meta||{};a[f]=h.isConstructor?g:l(g,f)}else a[f]=g}}function q(a,b){return a&&b?a[b]=this:a.exports=a=this,this}function r(a){return u(this,a)}function s(a){z.prototype=a.prototype;var b=new z;return z.prototype=null,b}function t(a,c,e){var i={},j=[],m="declare"+ ++y,q=[],r=[],t=[],u=[],v={supers:t,unique:m,bases:q,superMeta:{f:null,pos:0,name:null}},x={supers:u,unique:m,bases:r,isConstructor:!0,superMeta:{f:null,pos:0,name:null}};if(d(c)&&!e&&(e=c,c=w),"function"==typeof c||b(c)?(j=b(c)?c:[c],c=j.shift(),a.__meta=x,i=s(c),i.__meta=v,i.__getters__=f({},i.__getters__||{}),i.__setters__=f({},i.__setters__||{}),a.__getters__=f({},a.__getters__||{}),a.__setters__=f({},a.__setters__||{}),o(c.prototype,t,q),o(c,u,r)):(a.__meta=x,i.__meta=v,i.__getters__=i.__getters__||{},i.__setters__=i.__setters__||{},a.__getters__=a.__getters__||{},a.__setters__=a.__setters__||{}),a.prototype=i,e){var z=v.proto=e.instance||{},A=x.proto=e.static||{};A.init=A.init||k,p(i,z),p(a,A),i.constructor=z.hasOwnProperty("constructor")?l(z.constructor,"constructor"):z.constructor=l(k,"constructor")}else v.proto={},x.proto={},a.init=l(k,"init"),i.constructor=l(k,"constructor");j.length&&n.apply(a,j),c&&f(a,f(f({},c),a)),i._super=a._super=g,i._getSuper=a._getSuper=h,i._static=a}function u(a,b){function c(){switch(arguments.length){case 0:this.constructor.call(this);break;case 1:this.constructor.call(this,arguments[0]);break;case 2:this.constructor.call(this,arguments[0],arguments[1]);break;case 3:this.constructor.call(this,arguments[0],arguments[1],arguments[2]);break;default:this.constructor.apply(this,arguments)}}return t(c,a,b),c.init()||c}function v(a,b){function c(){return d||(this.constructor.apply(this,arguments),d=this),d}var d;return t(c,a,b),c.init()||c}var w,x=Array.prototype.slice,y=0,z=new Function,A=/(super)/g,B=function(a){return"[object Arguments]"===Object.prototype.toString.call(a)};return B(arguments)||(B=function(a){return!(!a||!a.hasOwnProperty("callee"))}),w=u({instance:{get:i,set:j},"static":{get:i,set:j,mixin:n,extend:r,as:q}}),u.singleton=v,u}"undefined"!=typeof c?"undefined"!=typeof b&&b.exports&&(b.exports=a()):"function"==typeof define&&define.amd?define(a):this.declare=a()}()},{}],39:[function(a,b){b.exports=a("./declare.js")},{"./declare.js":38}],40:[function(a,b,c){!function(){"use strict";function d(a){function b(){var b=a.define();return b.expose({register:function(a,c){c||(c=a,a=null);var d=typeof c;if(a)b[a]=c;else if(c&&"function"===d)b.extend(c);else{if("object"!==d)throw new TypeError("extended.register must be called with an extender function");b.expose(c)}return b},define:function(){return a.define.apply(a,arguments)}}),b}function c(){return b()}return function(){function a(a,b){var c,d;for(c in b)b.hasOwnProperty(c)&&(d=b[c],c in a&&a[c]===d||(a[c]=d));return a}return function(b){b||(b={});for(var c=1,d=arguments.length;d>c;c++)a(b,arguments[c]);return b}}(),c.define=function(){return a.define.apply(a,arguments)},c}"undefined"!=typeof c?"undefined"!=typeof b&&b.exports&&(b.exports=d(a("extender"))):"function"==typeof define&&define.amd?define(["extender"],function(a){return d(a)}):this.extended=d(this.extender)}.call(this)},{extender:42}],41:[function(a,b,c){!function(){function d(a){function b(a,b){if(a&&a.length)for(var c=0,d=a.length;d>c;c++)if(a[c]===b)return c;return-1}function c(a){return"[object Array]"===Object.prototype.toString.call(a)}function d(b){function c(a,b,c){if("function"!=typeof c)throw new TypeError("when extending type you must provide a function");var d;d="constructor"===b?function(){this._super(arguments),c.apply(this,arguments)}:function(){var a=f.call(arguments);a.unshift(this._value);var b=c.apply(this,a);return b!==e?this.__extender__(b):this},a[b]=d}function d(a,b,c){if("function"!=typeof c)throw new TypeError("when extending type you must provide a function");var d;d="constructor"===b?function(){this._super(arguments),c.apply(this,arguments)}:function(){var a=f.call(arguments);return a.unshift(this._value),c.apply(this,a)},a[b]=d}function h(a,b,e){for(var f in b)b.hasOwnProperty(f)&&("getters"!==f&&"setters"!==f?"noWrap"===f?h(a,b[f],!0):e?d(a,f,b[f]):c(a,f,b[f]):a[f]=b[f])}function i(a){var b,c,d=a;if(!(a instanceof m)){var e=m;for(b=0,c=n.length;c>b;b++){var f=n[b];f[0](a)&&(e=e.extend({instance:f[1]}))}d=new e(a),d.__extender__=i}return d}function j(){return!0}function k(a,b){if(arguments.length){"object"==typeof a&&(b=a,a=j),b=b||{};var d={};h(d,b),d.hasOwnProperty("constructor")||(b.hasOwnProperty("constructor")?c(d,"constructor",b.constructor):d.constructor=function(){this._super(arguments)}),n.push([a,d])}return i}function l(a){return a&&a.hasOwnProperty("__defined__")&&(i.__defined__=n=n.concat(a.__defined__)),g(i,a,["define","extend","expose","__defined__"]),i}b=b||[];var m=a({instance:{constructor:function(a){this._value=a},value:function(){return this._value},eq:function(a){return this.__extender__(this._value===a)},neq:function(a){return this.__extender__(this._value!==a)},print:function(){return console.log(this._value),this}}}),n=[];return i.define=k,i.extend=l,i.expose=function(){for(var a,b=0,c=arguments.length;c>b;b++)a=arguments[b],"object"==typeof a&&g(i,a,["define","extend","expose","__defined__"]);return i},i.__defined__=n,i}var e,f=Array.prototype.slice,g=function(){function a(a,c,d){var e,f;for(e in c)c.hasOwnProperty(e)&&-1===b(d,e)&&(f=c[e],e in a&&a[e]===f||(a[e]=f));return a}return function(b){b||(b={});var d=arguments.length,e=arguments[arguments.length-1];c(e)?d--:e=[];for(var f=1;d>f;f++)a(b,arguments[f],e);return b}}();return{define:function(){return d().define.apply(d,arguments)},extend:function(a){return d().define().extend(a)}}}"undefined"!=typeof c?"undefined"!=typeof b&&b.exports&&(b.exports=d(a("declare.js"))):"function"==typeof define&&define.amd?define(["declare"],function(a){return d(a)}):this.extender=d(this.declare)}.call(this)},{"declare.js":39}],42:[function(a,b){b.exports=a("./extender.js")},{"./extender.js":41}],43:[function(a,b,c){!function(){"use strict";function d(a,b,c){function d(a,b,c){if(c=o(arguments,2),m(b)&&!(b in a))throw new Error(b+" property not defined in scope");if(!m(b)&&!n(b))throw new Error(b+" is not a function");return m(b)?function(){var d=a[b];if(n(d)){var e=c.concat(o(arguments));return d.apply(a,e)}return d}:c.length?function(){var d=c.concat(o(arguments));return b.apply(a,d)}:function(){return b.apply(a,arguments)}}function e(a,b){if(b=o(arguments,1),!m(a)&&!n(a))throw new Error(a+" must be the name of a property or function to execute");return m(a)?function(){var c=o(arguments),d=c.shift(),e=d[a];return n(e)?(c=b.concat(c),e.apply(d,c)):e}:function(){var c=o(arguments),d=c.shift();return c=b.concat(c),a.apply(d,c)}}function f(a,b,c){if(c=o(arguments,2),m(b)&&!(b in a))throw new Error(b+" property not defined in scope");if(!m(b)&&!n(b))throw new Error(b+" is not a function");return m(b)?function(){var d=a[b];return n(d)?d.apply(a,c):d}:function(){return b.apply(a,c)}}function g(a){var b=o(arguments,1);if(!l(a)&&!n(a))throw new TypeError("scope must be an object");if(1===b.length&&k(b[0])&&(b=b[0]),!b.length){b=[];for(var c in a)a.hasOwnProperty(c)&&n(a[c])&&b.push(c)}for(var e=0,f=b.length;f>e;e++)a[b[e]]=d(a,a[b[e]]);return a}function h(a,b){if(b=o(arguments,1),!m(a)&&!n(a))throw new Error(a+" must be the name of a property or function to execute");return m(a)?function(){var c=this[a];if(n(c)){var d=b.concat(o(arguments));return c.apply(this,d)}return c}:function(){var c=b.concat(o(arguments));return a.apply(this,c)}}function i(a,b){return function(){var c=o(arguments);return b?a.apply(this,arguments):function(){return a.apply(this,c.concat(o(arguments)))}}}function j(a,b,c){var e;if(e=c?d(c,b):b,a)for(var f=a-1,g=f;g>=0;g--)e=i(e,g===f);return e}var k=b.isArray,l=b.isObject,m=b.isString,n=b.isFunction,o=c.argsToArray;return a.define(l,{bind:d,bindAll:g,bindIgnore:f,curry:function(a,b,c){return j(b,c,a)}}).define(n,{bind:function(a,b){return d.apply(this,[b,a].concat(o(arguments,2)))},bindIgnore:function(a,b){return f.apply(this,[b,a].concat(o(arguments,2)))},partial:h,applyFirst:e,curry:function(a,b,c){return j(b,a,c)},noWrap:{f:function(){return this.value()}}}).define(m,{bind:function(a,b){return d(b,a)},bindIgnore:function(a,b){return f(b,a)},partial:h,applyFirst:e,curry:function(a,b,c){return j(b,a,c)}}).expose({bind:d,bindAll:g,bindIgnore:f,partial:h,applyFirst:e,curry:j})}"undefined"!=typeof c?"undefined"!=typeof b&&b.exports&&(b.exports=d(a("extended"),a("is-extended"),a("arguments-extended"))):"function"==typeof define&&define.amd?define(["extended","is-extended","arguments-extended"],function(a,b,c){return d(a,b,c)}):this.functionExtended=d(this.extended,this.isExtended,this.argumentsExtended)}.call(this)},{"arguments-extended":35,extended:40,"is-extended":50}],44:[function(a,b,c){function d(a,b){if(a.indexOf)return a.indexOf(b);for(var c=0;ce;e++)d[e].apply(this,c);return!0}return!1},f.prototype.addListener=function(a,b){if("function"!=typeof b)throw new Error("addListener only takes instances of Function");if(this._events||(this._events={}),this.emit("newListener",a,b),this._events[a])if(g(this._events[a])){if(!this._events[a].warned){var c;c=void 0!==this._events.maxListeners?this._events.maxListeners:h,c&&c>0&&this._events[a].length>c&&(this._events[a].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[a].length),console.trace())}this._events[a].push(b)}else this._events[a]=[this._events[a],b];else this._events[a]=b;return this},f.prototype.on=f.prototype.addListener,f.prototype.once=function(a,b){var c=this;return c.on(a,function d(){c.removeListener(a,d),b.apply(this,arguments)}),this},f.prototype.removeListener=function(a,b){if("function"!=typeof b)throw new Error("removeListener only takes instances of Function");if(!this._events||!this._events[a])return this;var c=this._events[a];if(g(c)){var e=d(c,b);if(0>e)return this;c.splice(e,1),0==c.length&&delete this._events[a]}else this._events[a]===b&&delete this._events[a];return this},f.prototype.removeAllListeners=function(a){return 0===arguments.length?(this._events={},this):(a&&this._events&&this._events[a]&&(this._events[a]=null),this)},f.prototype.listeners=function(a){return this._events||(this._events={}),this._events[a]||(this._events[a]=[]),g(this._events[a])||(this._events[a]=[this._events[a]]),this._events[a]},f.listenerCount=function(a,b){var c;return c=a._events&&a._events[b]?"function"==typeof a._events[b]?1:a._events[b].length:0}},{__browserify_process:48}],45:[function(){},{}],46:[function(a,b,c){function d(a,b){for(var c=[],d=0;d=0;d--){var e=a[d];"."==e?a.splice(d,1):".."===e?(a.splice(d,1),c++):c&&(a.splice(d,1),c--)}if(b)for(;c--;c)a.unshift("..");return a}var f=a("__browserify_process"),g=/^(.+\/(?!$)|\/)?((?:.+?)?(\.[^.]*)?)$/;c.resolve=function(){for(var a="",b=!1,c=arguments.length;c>=-1&&!b;c--){var g=c>=0?arguments[c]:f.cwd();"string"==typeof g&&g&&(a=g+"/"+a,b="/"===g.charAt(0))}return a=e(d(a.split("/"),function(a){return!!a}),!b).join("/"),(b?"/":"")+a||"."},c.normalize=function(a){var b="/"===a.charAt(0),c="/"===a.slice(-1);return a=e(d(a.split("/"),function(a){return!!a}),!b).join("/"),a||b||(a="."),a&&c&&(a+="/"),(b?"/":"")+a},c.join=function(){var a=Array.prototype.slice.call(arguments,0);return c.normalize(d(a,function(a){return a&&"string"==typeof a}).join("/"))},c.dirname=function(a){var b=g.exec(a)[1]||"",c=!1;return b?1===b.length||c&&b.length<=3&&":"===b.charAt(1)?b:b.substring(0,b.length-1):"."},c.basename=function(a,b){var c=g.exec(a)[2]||"";return b&&c.substr(-1*b.length)===b&&(c=c.substr(0,c.length-b.length)),c},c.extname=function(a){return g.exec(a)[3]||""},c.relative=function(a,b){function d(a){for(var b=0;b=0&&""===a[c];c--);return b>c?[]:a.slice(b,c-b+1)}a=c.resolve(a).substr(1),b=c.resolve(b).substr(1);for(var e=d(a.split("/")),f=d(b.split("/")),g=Math.min(e.length,f.length),h=g,i=0;g>i;i++)if(e[i]!==f[i]){h=i;break}for(var j=[],i=h;i=0;e--)if(f[e]!=g[e])return!1;for(e=f.length-1;e>=0;e--)if(d=f[e],!h(a[d],b[d]))return!1;return!0}function l(a,b){return a&&b?b instanceof RegExp?b.test(a):a instanceof b?!0:b.call({},a)===!0?!0:!1:!1}function m(a,b,c,d){var e;"string"==typeof c&&(d=c,c=null);try{b()}catch(g){e=g}if(d=(c&&c.name?" ("+c.name+").":".")+(d?" "+d:"."),a&&!e&&f("Missing expected exception"+d),!a&&l(e,c)&&f("Got unwanted exception"+d),a&&e&&c&&!l(e,c)||!a&&e)throw e}var n=a("util"),o=a("buffer").Buffer,p=Array.prototype.slice,q=b.exports=g;q.AssertionError=function(a){this.name="AssertionError",this.message=a.message,this.actual=a.actual,this.expected=a.expected,this.operator=a.operator;var b=a.stackStartFunction||f;Error.captureStackTrace&&Error.captureStackTrace(this,b)},n.inherits(q.AssertionError,Error),q.AssertionError.prototype.toString=function(){return this.message?[this.name+":",this.message].join(" "):[this.name+":",e(JSON.stringify(this.actual,d),128),this.operator,e(JSON.stringify(this.expected,d),128)].join(" ")},q.AssertionError.__proto__=Error.prototype,q.fail=f,q.ok=g,q.equal=function(a,b,c){a!=b&&f(a,b,c,"==",q.equal)},q.notEqual=function(a,b,c){a==b&&f(a,b,c,"!=",q.notEqual)},q.deepEqual=function(a,b,c){h(a,b)||f(a,b,c,"deepEqual",q.deepEqual)},q.notDeepEqual=function(a,b,c){h(a,b)&&f(a,b,c,"notDeepEqual",q.notDeepEqual)},q.strictEqual=function(a,b,c){a!==b&&f(a,b,c,"===",q.strictEqual)},q.notStrictEqual=function(a,b,c){a===b&&f(a,b,c,"!==",q.notStrictEqual)},q.throws=function(){m.apply(this,[!0].concat(p.call(arguments)))},q.doesNotThrow=function(){m.apply(this,[!1].concat(p.call(arguments)))},q.ifError=function(a){if(a)throw a}},{util:2,buffer:3}],2:[function(a,b,c){function d(a){return a instanceof Array||Array.isArray(a)||a&&a!==Object.prototype&&d(a.__proto__)}function e(a){return a instanceof RegExp||"object"==typeof a&&"[object RegExp]"===Object.prototype.toString.call(a)}function f(a){if(a instanceof Date)return!0;if("object"!=typeof a)return!1;var b=Date.prototype&&h(Date.prototype),c=a.__proto__&&h(a.__proto__);return JSON.stringify(c)===JSON.stringify(b)}a("events"),c.isArray=d,c.isDate=function(a){return"[object Date]"===Object.prototype.toString.call(a)},c.isRegExp=function(a){return"[object RegExp]"===Object.prototype.toString.call(a)},c.print=function(){},c.puts=function(){},c.debug=function(){},c.inspect=function(a,b,i,j){function k(a,i){if(a&&"function"==typeof a.inspect&&a!==c&&(!a.constructor||a.constructor.prototype!==a))return a.inspect(i);switch(typeof a){case"undefined":return m("undefined","undefined");case"string":var j="'"+JSON.stringify(a).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return m(j,"string");case"number":return m(""+a,"number");case"boolean":return m(""+a,"boolean")}if(null===a)return m("null","null");var n=g(a),o=b?h(a):n;if("function"==typeof a&&0===o.length){if(e(a))return m(""+a,"regexp");var p=a.name?": "+a.name:"";return m("[Function"+p+"]","special")}if(f(a)&&0===o.length)return m(a.toUTCString(),"date");var q,r,s;if(d(a)?(r="Array",s=["[","]"]):(r="Object",s=["{","}"]),"function"==typeof a){var t=a.name?": "+a.name:"";q=e(a)?" "+a:" [Function"+t+"]"}else q="";if(f(a)&&(q=" "+a.toUTCString()),0===o.length)return s[0]+q+s[1];if(0>i)return e(a)?m(""+a,"regexp"):m("[Object]","special");l.push(a);var u=o.map(function(b){var c,e;if(a.__lookupGetter__&&(a.__lookupGetter__(b)?e=a.__lookupSetter__(b)?m("[Getter/Setter]","special"):m("[Getter]","special"):a.__lookupSetter__(b)&&(e=m("[Setter]","special"))),n.indexOf(b)<0&&(c="["+b+"]"),e||(l.indexOf(a[b])<0?(e=null===i?k(a[b]):k(a[b],i-1),e.indexOf("\n")>-1&&(e=d(a)?e.split("\n").map(function(a){return" "+a}).join("\n").substr(2):"\n"+e.split("\n").map(function(a){return" "+a}).join("\n"))):e=m("[Circular]","special")),"undefined"==typeof c){if("Array"===r&&b.match(/^\d+$/))return e;c=JSON.stringify(""+b),c.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(c=c.substr(1,c.length-2),c=m(c,"name")):(c=c.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),c=m(c,"string"))}return c+": "+e});l.pop();var v=0,w=u.reduce(function(a,b){return v++,b.indexOf("\n")>=0&&v++,a+b.length+1},0);return u=w>50?s[0]+(""===q?"":q+"\n ")+" "+u.join(",\n ")+" "+s[1]:s[0]+q+" "+u.join(", ")+" "+s[1]}var l=[],m=function(a,b){var c={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]},d={special:"cyan",number:"blue","boolean":"yellow",undefined:"grey","null":"bold",string:"green",date:"magenta",regexp:"red"}[b];return d?"["+c[d][0]+"m"+a+"["+c[d][1]+"m":a};return j||(m=function(a){return a}),k(a,"undefined"==typeof i?2:i)},c.log=function(){},c.pump=null;var g=Object.keys||function(a){var b=[];for(var c in a)b.push(c);return b},h=Object.getOwnPropertyNames||function(a){var b=[];for(var c in a)Object.hasOwnProperty.call(a,c)&&b.push(c);return b},i=Object.create||function(a,b){var c;if(null===a)c={__proto__:null};else{if("object"!=typeof a)throw new TypeError("typeof prototype["+typeof a+"] != 'object'");var d=function(){};d.prototype=a,c=new d,c.__proto__=a}return"undefined"!=typeof b&&Object.defineProperties&&Object.defineProperties(c,b),c};c.inherits=function(a,b){a.super_=b,a.prototype=i(b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}})};var j=/%[sdj%]/g;c.format=function(a){if("string"!=typeof a){for(var b=[],d=0;d=f)return a;switch(a){case"%s":return String(e[d++]);case"%d":return Number(e[d++]);case"%j":return JSON.stringify(e[d++]);default:return a}}),h=e[d];f>d;h=e[++d])g+=null===h||"object"!=typeof h?" "+h:" "+c.inspect(h);return g}},{events:4}],5:[function(a,b,c){c.readIEEE754=function(a,b,c,d,e){var f,g,h=8*e-d-1,i=(1<>1,k=-7,l=c?0:e-1,m=c?1:-1,n=a[b+l];for(l+=m,f=n&(1<<-k)-1,n>>=-k,k+=h;k>0;f=256*f+a[b+l],l+=m,k-=8);for(g=f&(1<<-k)-1,f>>=-k,k+=d;k>0;g=256*g+a[b+l],l+=m,k-=8);if(0===f)f=1-j;else{if(f===i)return g?0/0:1/0*(n?-1:1);g+=Math.pow(2,d),f-=j}return(n?-1:1)*g*Math.pow(2,f-d)},c.writeIEEE754=function(a,b,c,d,e,f){var g,h,i,j=8*f-e-1,k=(1<>1,m=23===e?Math.pow(2,-24)-Math.pow(2,-77):0,n=d?f-1:0,o=d?-1:1,p=0>b||0===b&&0>1/b?1:0;for(b=Math.abs(b),isNaN(b)||1/0===b?(h=isNaN(b)?1:0,g=k):(g=Math.floor(Math.log(b)/Math.LN2),b*(i=Math.pow(2,-g))<1&&(g--,i*=2),b+=g+l>=1?m/i:m*Math.pow(2,1-l),b*i>=2&&(g++,i/=2),g+l>=k?(h=0,g=k):g+l>=1?(h=(b*i-1)*Math.pow(2,e),g+=l):(h=b*Math.pow(2,l-1)*Math.pow(2,e),g=0));e>=8;a[c+n]=255&h,n+=o,h/=256,e-=8);for(g=g<0;a[c+n]=255&g,n+=o,g/=256,j-=8);a[c+n-o]|=128*p}},{}],6:[function(a,b){var c=b.exports={};c.nextTick=function(){var a="undefined"!=typeof window&&window.setImmediate,b="undefined"!=typeof window&&window.postMessage&&window.addEventListener;if(a)return function(a){return window.setImmediate(a)};if(b){var c=[];return window.addEventListener("message",function(a){if(a.source===window&&"process-tick"===a.data&&(a.stopPropagation(),c.length>0)){var b=c.shift();b()}},!0),function(a){c.push(a),window.postMessage("process-tick","*")}}return function(a){setTimeout(a,0)}}(),c.title="browser",c.browser=!0,c.env={},c.argv=[],c.binding=function(){throw new Error("process.binding is not supported")},c.cwd=function(){return"/"},c.chdir=function(){throw new Error("process.chdir is not supported")}},{}],4:[function(a,b,c){!function(a){function b(a,b){if(a.indexOf)return a.indexOf(b);for(var c=0;cf;f++)d[f].apply(this,c);return!0}return!1},d.prototype.addListener=function(a,b){if("function"!=typeof b)throw new Error("addListener only takes instances of Function");if(this._events||(this._events={}),this.emit("newListener",a,b),this._events[a])if(e(this._events[a])){if(!this._events[a].warned){var c;c=void 0!==this._events.maxListeners?this._events.maxListeners:f,c&&c>0&&this._events[a].length>c&&(this._events[a].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[a].length),console.trace())}this._events[a].push(b)}else this._events[a]=[this._events[a],b];else this._events[a]=b;return this},d.prototype.on=d.prototype.addListener,d.prototype.once=function(a,b){var c=this;return c.on(a,function d(){c.removeListener(a,d),b.apply(this,arguments)}),this},d.prototype.removeListener=function(a,c){if("function"!=typeof c)throw new Error("removeListener only takes instances of Function");if(!this._events||!this._events[a])return this;var d=this._events[a];if(e(d)){var f=b(d,c);if(0>f)return this;d.splice(f,1),0==d.length&&delete this._events[a]}else this._events[a]===c&&delete this._events[a];return this},d.prototype.removeAllListeners=function(a){return 0===arguments.length?(this._events={},this):(a&&this._events&&this._events[a]&&(this._events[a]=null),this)},d.prototype.listeners=function(a){return this._events||(this._events={}),this._events[a]||(this._events[a]=[]),e(this._events[a])||(this._events[a]=[this._events[a]]),this._events[a]}}(a("__browserify_process"))},{__browserify_process:6}],"buffer-browserify":[function(a,b){b.exports=a("q9TxCC")},{}],q9TxCC:[function(a,b,c){function d(a){this.length=a}function e(a){return 16>a?"0"+a.toString(16):a.toString(16)}function f(a){for(var b=[],c=0;ce&&!(e+c>=b.length||e>=a.length);)b[e+c]=a[e],e++;return e}function j(a){try{return decodeURIComponent(a)}catch(b){return String.fromCharCode(65533)}}function k(a){return a=~~Math.ceil(+a),0>a?0:a}function l(a,b,c){if(!(this instanceof l))return new l(a,b,c);var e;if("number"==typeof c)this.length=k(b),this.parent=a,this.offset=c;else{switch(e=typeof a){case"number":this.length=k(a);break;case"string":this.length=l.byteLength(a,b);break;case"object":this.length=k(a.length);break;default:throw new Error("First argument needs to be a number, array or string.")}if(this.length>l.poolSize?(this.parent=new d(this.length),this.offset=0):((!E||E.length-E.used=a.length?0:(c?(e=a.parent[a.offset+b]<<8,b+1=a.length?0:(c?(b+1>>0):(b+2>>0)),e)}function q(a,b,c,d){var e,f;return d||(D.ok("boolean"==typeof c,"missing or invalid endian"),D.ok(void 0!==b&&null!==b,"missing offset"),D.ok(b+1=0,"specified a negative value for writing an unsigned value"),D.ok(b>=a,"value is larger than maximum value for type"),D.ok(Math.floor(a)===a,"value has a fractional component")}function v(a,b,c,d,e){e||(D.ok(void 0!==b&&null!==b,"missing value"),D.ok("boolean"==typeof d,"missing or invalid endian"),D.ok(void 0!==c&&null!==c,"missing offset"),D.ok(c+1>>8*(d?1-f:f)}function w(a,b,c,d,e){e||(D.ok(void 0!==b&&null!==b,"missing value"),D.ok("boolean"==typeof d,"missing or invalid endian"),D.ok(void 0!==c&&null!==c,"missing offset"),D.ok(c+3>>8*(d?3-f:f)}function x(a,b,c){D.ok("number"==typeof a,"cannot write a non-number as a number"),D.ok(b>=a,"value larger than maximum allowed value"),D.ok(a>=c,"value smaller than minimum allowed value"),D.ok(Math.floor(a)===a,"value has a fractional component")}function y(a,b,c){D.ok("number"==typeof a,"cannot write a non-number as a number"),D.ok(b>=a,"value larger than maximum allowed value"),D.ok(a>=c,"value smaller than minimum allowed value")
-}function z(a,b,c,d,e){e||(D.ok(void 0!==b&&null!==b,"missing value"),D.ok("boolean"==typeof d,"missing or invalid endian"),D.ok(void 0!==c&&null!==c,"missing offset"),D.ok(c+1=0?v(a,b,c,d,e):v(a,65535+b+1,c,d,e)}function A(a,b,c,d,e){e||(D.ok(void 0!==b&&null!==b,"missing value"),D.ok("boolean"==typeof d,"missing or invalid endian"),D.ok(void 0!==c&&null!==c,"missing offset"),D.ok(c+3=0?w(a,b,c,d,e):w(a,4294967295+b+1,c,d,e)}function B(b,c,d,e,f){f||(D.ok(void 0!==c&&null!==c,"missing value"),D.ok("boolean"==typeof e,"missing or invalid endian"),D.ok(void 0!==d&&null!==d,"missing offset"),D.ok(d+3d;d++)if(a[d]=e(this[d]),d==c.INSPECT_MAX_BYTES){a[d+1]="...";break}return""},d.prototype.hexSlice=function(a,b){var c=this.length;(!a||0>a)&&(a=0),(!b||0>b||b>c)&&(b=c);for(var d="",f=a;b>f;f++)d+=e(this[f]);return d},d.prototype.toString=function(a,b,c){if(a=String(a||"utf8").toLowerCase(),b=+b||0,"undefined"==typeof c&&(c=this.length),+c==b)return"";switch(a){case"hex":return this.hexSlice(b,c);case"utf8":case"utf-8":return this.utf8Slice(b,c);case"ascii":return this.asciiSlice(b,c);case"binary":return this.binarySlice(b,c);case"base64":return this.base64Slice(b,c);case"ucs2":case"ucs-2":return this.ucs2Slice(b,c);default:throw new Error("Unknown encoding")}},d.prototype.hexWrite=function(a,b,c){b=+b||0;var e=this.length-b;c?(c=+c,c>e&&(c=e)):c=e;var f=a.length;if(f%2)throw new Error("Invalid hex string");c>f/2&&(c=f/2);for(var g=0;c>g;g++){var h=parseInt(a.substr(2*g,2),16);if(isNaN(h))throw new Error("Invalid hex string");this[b+g]=h}return d._charsWritten=2*g,g},d.prototype.write=function(a,b,c,d){if(isFinite(b))isFinite(c)||(d=c,c=void 0);else{var e=d;d=b,b=c,c=e}b=+b||0;var f=this.length-b;switch(c?(c=+c,c>f&&(c=f)):c=f,d=String(d||"utf8").toLowerCase()){case"hex":return this.hexWrite(a,b,c);case"utf8":case"utf-8":return this.utf8Write(a,b,c);case"ascii":return this.asciiWrite(a,b,c);case"binary":return this.binaryWrite(a,b,c);case"base64":return this.base64Write(a,b,c);case"ucs2":case"ucs-2":return this.ucs2Write(a,b,c);default:throw new Error("Unknown encoding")}},d.prototype.slice=function(a,b){if(void 0===b&&(b=this.length),b>this.length)throw new Error("oob");if(a>b)throw new Error("oob");return new l(this,b-a,+a)},d.prototype.copy=function(a,b,c,d){for(var e=[],f=c;d>f;f++)D.ok("undefined"!=typeof this[f],"copying undefined buffer bytes!"),e.push(this[f]);for(var f=b;fthis.length)throw new Error("oob");if(b>c)throw new Error("oob");for(var d=b;c>d;d++)this[d]=a},c.SlowBuffer=d,c.Buffer=l,l.poolSize=8192;var E;l.isBuffer=function(a){return a instanceof l||a instanceof d},l.concat=function(a,b){if(!Array.isArray(a))throw new Error("Usage: Buffer.concat(list, [totalLength])\n list should be an Array.");if(0===a.length)return new l(0);if(1===a.length)return a[0];if("number"!=typeof b){b=0;for(var c=0;cd;d++)if(a[d]=e(this.parent[d+this.offset]),d==c.INSPECT_MAX_BYTES){a[d+1]="...";break}return""},l.prototype.get=function(a){if(0>a||a>=this.length)throw new Error("oob");return this.parent[this.offset+a]},l.prototype.set=function(a,b){if(0>a||a>=this.length)throw new Error("oob");return this.parent[this.offset+a]=b},l.prototype.write=function(a,b,c,e){if(isFinite(b))isFinite(c)||(e=c,c=void 0);else{var f=e;e=b,b=c,c=f}b=+b||0;var g=this.length-b;c?(c=+c,c>g&&(c=g)):c=g,e=String(e||"utf8").toLowerCase();var h;switch(e){case"hex":h=this.parent.hexWrite(a,this.offset+b,c);break;case"utf8":case"utf-8":h=this.parent.utf8Write(a,this.offset+b,c);break;case"ascii":h=this.parent.asciiWrite(a,this.offset+b,c);break;case"binary":h=this.parent.binaryWrite(a,this.offset+b,c);break;case"base64":h=this.parent.base64Write(a,this.offset+b,c);break;case"ucs2":case"ucs-2":h=this.parent.ucs2Write(a,this.offset+b,c);break;default:throw new Error("Unknown encoding")}return l._charsWritten=d._charsWritten,h},l.prototype.toString=function(a,b,c){switch(a=String(a||"utf8").toLowerCase(),"undefined"==typeof b||0>b?b=0:b>this.length&&(b=this.length),"undefined"==typeof c||c>this.length?c=this.length:0>c&&(c=0),b+=this.offset,c+=this.offset,a){case"hex":return this.parent.hexSlice(b,c);case"utf8":case"utf-8":return this.parent.utf8Slice(b,c);case"ascii":return this.parent.asciiSlice(b,c);case"binary":return this.parent.binarySlice(b,c);case"base64":return this.parent.base64Slice(b,c);case"ucs2":case"ucs-2":return this.parent.ucs2Slice(b,c);default:throw new Error("Unknown encoding")}},l.byteLength=d.byteLength,l.prototype.fill=function(a,b,c){if(a||(a=0),b||(b=0),c||(c=this.length),"string"==typeof a&&(a=a.charCodeAt(0)),"number"!=typeof a||isNaN(a))throw new Error("value is not a number");if(b>c)throw new Error("end < start");if(c===b)return 0;if(0==this.length)return 0;if(0>b||b>=this.length)throw new Error("start out of bounds");if(0>c||c>this.length)throw new Error("end out of bounds");return this.parent.fill(a,b+this.offset,c+this.offset)},l.prototype.copy=function(a,b,c,d){var e=this;if(c||(c=0),d||(d=this.length),b||(b=0),c>d)throw new Error("sourceEnd < sourceStart");if(d===c)return 0;if(0==a.length||0==e.length)return 0;if(0>b||b>=a.length)throw new Error("targetStart out of bounds");if(0>c||c>=e.length)throw new Error("sourceStart out of bounds");if(0>d||d>e.length)throw new Error("sourceEnd out of bounds");return d>this.length&&(d=this.length),a.length-bthis.length)throw new Error("oob");if(a>b)throw new Error("oob");return new l(this.parent,b-a,+a+this.offset)},l.prototype.utf8Slice=function(a,b){return this.toString("utf8",a,b)},l.prototype.binarySlice=function(a,b){return this.toString("binary",a,b)},l.prototype.asciiSlice=function(a,b){return this.toString("ascii",a,b)},l.prototype.utf8Write=function(a,b){return this.write(a,b,"utf8")},l.prototype.binaryWrite=function(a,b){return this.write(a,b,"binary")},l.prototype.asciiWrite=function(a,b){return this.write(a,b,"ascii")},l.prototype.readUInt8=function(a,b){var c=this;return b||(D.ok(void 0!==a&&null!==a,"missing offset"),D.ok(a=c.length?void 0:c.parent[c.offset+a]},l.prototype.readUInt16LE=function(a,b){return o(this,a,!1,b)},l.prototype.readUInt16BE=function(a,b){return o(this,a,!0,b)},l.prototype.readUInt32LE=function(a,b){return p(this,a,!1,b)},l.prototype.readUInt32BE=function(a,b){return p(this,a,!0,b)},l.prototype.readInt8=function(a,b){var c,d=this;return b||(D.ok(void 0!==a&&null!==a,"missing offset"),D.ok(a=d.length?void 0:(c=128&d.parent[d.offset+a],c?-1*(255-d.parent[d.offset+a]+1):d.parent[d.offset+a])},l.prototype.readInt16LE=function(a,b){return q(this,a,!1,b)},l.prototype.readInt16BE=function(a,b){return q(this,a,!0,b)},l.prototype.readInt32LE=function(a,b){return r(this,a,!1,b)},l.prototype.readInt32BE=function(a,b){return r(this,a,!0,b)},l.prototype.readFloatLE=function(a,b){return s(this,a,!1,b)},l.prototype.readFloatBE=function(a,b){return s(this,a,!0,b)},l.prototype.readDoubleLE=function(a,b){return t(this,a,!1,b)},l.prototype.readDoubleBE=function(a,b){return t(this,a,!0,b)},l.prototype.writeUInt8=function(a,b,c){var d=this;c||(D.ok(void 0!==a&&null!==a,"missing value"),D.ok(void 0!==b&&null!==b,"missing offset"),D.ok(b=0?d.writeUInt8(a,b,c):d.writeUInt8(255+a+1,b,c)},l.prototype.writeInt16LE=function(a,b,c){z(this,a,b,!1,c)},l.prototype.writeInt16BE=function(a,b,c){z(this,a,b,!0,c)},l.prototype.writeInt32LE=function(a,b,c){A(this,a,b,!1,c)},l.prototype.writeInt32BE=function(a,b,c){A(this,a,b,!0,c)},l.prototype.writeFloatLE=function(a,b,c){B(this,a,b,!1,c)},l.prototype.writeFloatBE=function(a,b,c){B(this,a,b,!0,c)},l.prototype.writeDoubleLE=function(a,b,c){C(this,a,b,!1,c)},l.prototype.writeDoubleBE=function(a,b,c){C(this,a,b,!0,c)},d.prototype.readUInt8=l.prototype.readUInt8,d.prototype.readUInt16LE=l.prototype.readUInt16LE,d.prototype.readUInt16BE=l.prototype.readUInt16BE,d.prototype.readUInt32LE=l.prototype.readUInt32LE,d.prototype.readUInt32BE=l.prototype.readUInt32BE,d.prototype.readInt8=l.prototype.readInt8,d.prototype.readInt16LE=l.prototype.readInt16LE,d.prototype.readInt16BE=l.prototype.readInt16BE,d.prototype.readInt32LE=l.prototype.readInt32LE,d.prototype.readInt32BE=l.prototype.readInt32BE,d.prototype.readFloatLE=l.prototype.readFloatLE,d.prototype.readFloatBE=l.prototype.readFloatBE,d.prototype.readDoubleLE=l.prototype.readDoubleLE,d.prototype.readDoubleBE=l.prototype.readDoubleBE,d.prototype.writeUInt8=l.prototype.writeUInt8,d.prototype.writeUInt16LE=l.prototype.writeUInt16LE,d.prototype.writeUInt16BE=l.prototype.writeUInt16BE,d.prototype.writeUInt32LE=l.prototype.writeUInt32LE,d.prototype.writeUInt32BE=l.prototype.writeUInt32BE,d.prototype.writeInt8=l.prototype.writeInt8,d.prototype.writeInt16LE=l.prototype.writeInt16LE,d.prototype.writeInt16BE=l.prototype.writeInt16BE,d.prototype.writeInt32LE=l.prototype.writeInt32LE,d.prototype.writeInt32BE=l.prototype.writeInt32BE,d.prototype.writeFloatLE=l.prototype.writeFloatLE,d.prototype.writeFloatBE=l.prototype.writeFloatBE,d.prototype.writeDoubleLE=l.prototype.writeDoubleLE,d.prototype.writeDoubleBE=l.prototype.writeDoubleBE},{assert:1,"./buffer_ieee754":5,"base64-js":7}],7:[function(a,b){!function(){"use strict";function a(a){var b,c,e,f,g,h;if(a.length%4>0)throw"Invalid string. Length must be a multiple of 4";for(g=a.indexOf("="),g=g>0?a.length-g:0,h=[],e=g>0?a.length-4:a.length,b=0,c=0;e>b;b+=4,c+=3)f=d.indexOf(a[b])<<18|d.indexOf(a[b+1])<<12|d.indexOf(a[b+2])<<6|d.indexOf(a[b+3]),h.push((16711680&f)>>16),h.push((65280&f)>>8),h.push(255&f);return 2===g?(f=d.indexOf(a[b])<<2|d.indexOf(a[b+1])>>4,h.push(255&f)):1===g&&(f=d.indexOf(a[b])<<10|d.indexOf(a[b+1])<<4|d.indexOf(a[b+2])>>2,h.push(255&f>>8),h.push(255&f)),h}function c(a){function b(a){return d[63&a>>18]+d[63&a>>12]+d[63&a>>6]+d[63&a]}var c,e,f,g=a.length%3,h="";for(c=0,f=a.length-g;f>c;c+=3)e=(a[c]<<16)+(a[c+1]<<8)+a[c+2],h+=b(e);switch(g){case 1:e=a[a.length-1],h+=d[e>>2],h+=d[63&e<<4],h+="==";break;case 2:e=(a[a.length-2]<<8)+a[a.length-1],h+=d[e>>10],h+=d[63&e>>4],h+=d[63&e<<2],h+="="}return h}var d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";b.exports.toByteArray=a,b.exports.fromByteArray=c}()},{}],8:[function(a,b,c){c.readIEEE754=function(a,b,c,d,e){var f,g,h=8*e-d-1,i=(1<>1,k=-7,l=c?0:e-1,m=c?1:-1,n=a[b+l];for(l+=m,f=n&(1<<-k)-1,n>>=-k,k+=h;k>0;f=256*f+a[b+l],l+=m,k-=8);for(g=f&(1<<-k)-1,f>>=-k,k+=d;k>0;g=256*g+a[b+l],l+=m,k-=8);if(0===f)f=1-j;else{if(f===i)return g?0/0:1/0*(n?-1:1);g+=Math.pow(2,d),f-=j}return(n?-1:1)*g*Math.pow(2,f-d)},c.writeIEEE754=function(a,b,c,d,e,f){var g,h,i,j=8*f-e-1,k=(1<>1,m=23===e?Math.pow(2,-24)-Math.pow(2,-77):0,n=d?f-1:0,o=d?-1:1,p=0>b||0===b&&0>1/b?1:0;for(b=Math.abs(b),isNaN(b)||1/0===b?(h=isNaN(b)?1:0,g=k):(g=Math.floor(Math.log(b)/Math.LN2),b*(i=Math.pow(2,-g))<1&&(g--,i*=2),b+=g+l>=1?m/i:m*Math.pow(2,1-l),b*i>=2&&(g++,i/=2),g+l>=k?(h=0,g=k):g+l>=1?(h=(b*i-1)*Math.pow(2,e),g+=l):(h=b*Math.pow(2,l-1)*Math.pow(2,e),g=0));e>=8;a[c+n]=255&h,n+=o,h/=256,e-=8);for(g=g<0;a[c+n]=255&g,n+=o,g/=256,j-=8);a[c+n-o]|=128*p}},{}],3:[function(a,b,c){function d(a){this.length=a}function e(a){return 16>a?"0"+a.toString(16):a.toString(16)}function f(a){for(var b=[],c=0;ce&&!(e+c>=b.length||e>=a.length);)b[e+c]=a[e],e++;return e}function j(a){try{return decodeURIComponent(a)}catch(b){return String.fromCharCode(65533)}}function k(a){return a=~~Math.ceil(+a),0>a?0:a}function l(a,b,c){if(!(this instanceof l))return new l(a,b,c);var e;if("number"==typeof c)this.length=k(b),this.parent=a,this.offset=c;else{switch(e=typeof a){case"number":this.length=k(a);break;case"string":this.length=l.byteLength(a,b);break;case"object":this.length=k(a.length);break;default:throw new Error("First argument needs to be a number, array or string.")}if(this.length>l.poolSize?(this.parent=new d(this.length),this.offset=0):((!E||E.length-E.used>>0):(e=a.parent[a.offset+b+2]<<16,e|=a.parent[a.offset+b+1]<<8,e|=a.parent[a.offset+b],e+=a.parent[a.offset+b+3]<<24>>>0),e}function q(a,b,c,d){var e,f;return d||(D.ok("boolean"==typeof c,"missing or invalid endian"),D.ok(void 0!==b&&null!==b,"missing offset"),D.ok(b+1=0,"specified a negative value for writing an unsigned value"),D.ok(b>=a,"value is larger than maximum value for type"),D.ok(Math.floor(a)===a,"value has a fractional component")}function v(a,b,c,d,e){e||(D.ok(void 0!==b&&null!==b,"missing value"),D.ok("boolean"==typeof d,"missing or invalid endian"),D.ok(void 0!==c&&null!==c,"missing offset"),D.ok(c+1>>8,a.parent[a.offset+c+1]=255&b):(a.parent[a.offset+c+1]=(65280&b)>>>8,a.parent[a.offset+c]=255&b)}function w(a,b,c,d,e){e||(D.ok(void 0!==b&&null!==b,"missing value"),D.ok("boolean"==typeof d,"missing or invalid endian"),D.ok(void 0!==c&&null!==c,"missing offset"),D.ok(c+3>>24,a.parent[a.offset+c+1]=255&b>>>16,a.parent[a.offset+c+2]=255&b>>>8,a.parent[a.offset+c+3]=255&b):(a.parent[a.offset+c+3]=255&b>>>24,a.parent[a.offset+c+2]=255&b>>>16,a.parent[a.offset+c+1]=255&b>>>8,a.parent[a.offset+c]=255&b)}function x(a,b,c){D.ok("number"==typeof a,"cannot write a non-number as a number"),D.ok(b>=a,"value larger than maximum allowed value"),D.ok(a>=c,"value smaller than minimum allowed value"),D.ok(Math.floor(a)===a,"value has a fractional component")}function y(a,b,c){D.ok("number"==typeof a,"cannot write a non-number as a number"),D.ok(b>=a,"value larger than maximum allowed value"),D.ok(a>=c,"value smaller than minimum allowed value")}function z(a,b,c,d,e){e||(D.ok(void 0!==b&&null!==b,"missing value"),D.ok("boolean"==typeof d,"missing or invalid endian"),D.ok(void 0!==c&&null!==c,"missing offset"),D.ok(c+1=0?v(a,b,c,d,e):v(a,65535+b+1,c,d,e)}function A(a,b,c,d,e){e||(D.ok(void 0!==b&&null!==b,"missing value"),D.ok("boolean"==typeof d,"missing or invalid endian"),D.ok(void 0!==c&&null!==c,"missing offset"),D.ok(c+3=0?w(a,b,c,d,e):w(a,4294967295+b+1,c,d,e)}function B(b,c,d,e,f){f||(D.ok(void 0!==c&&null!==c,"missing value"),D.ok("boolean"==typeof e,"missing or invalid endian"),D.ok(void 0!==d&&null!==d,"missing offset"),D.ok(d+3d;d++)if(a[d]=e(this[d]),d==c.INSPECT_MAX_BYTES){a[d+1]="...";break}return""},d.prototype.hexSlice=function(a,b){var c=this.length;(!a||0>a)&&(a=0),(!b||0>b||b>c)&&(b=c);for(var d="",f=a;b>f;f++)d+=e(this[f]);return d},d.prototype.toString=function(a,b,c){if(a=String(a||"utf8").toLowerCase(),b=+b||0,"undefined"==typeof c&&(c=this.length),+c==b)return"";switch(a){case"hex":return this.hexSlice(b,c);case"utf8":case"utf-8":return this.utf8Slice(b,c);case"ascii":return this.asciiSlice(b,c);case"binary":return this.binarySlice(b,c);case"base64":return this.base64Slice(b,c);case"ucs2":case"ucs-2":return this.ucs2Slice(b,c);default:throw new Error("Unknown encoding")}},d.prototype.hexWrite=function(a,b,c){b=+b||0;var e=this.length-b;c?(c=+c,c>e&&(c=e)):c=e;var f=a.length;if(f%2)throw new Error("Invalid hex string");c>f/2&&(c=f/2);for(var g=0;c>g;g++){var h=parseInt(a.substr(2*g,2),16);if(isNaN(h))throw new Error("Invalid hex string");this[b+g]=h}return d._charsWritten=2*g,g},d.prototype.write=function(a,b,c,d){if(isFinite(b))isFinite(c)||(d=c,c=void 0);else{var e=d;d=b,b=c,c=e}b=+b||0;var f=this.length-b;switch(c?(c=+c,c>f&&(c=f)):c=f,d=String(d||"utf8").toLowerCase()){case"hex":return this.hexWrite(a,b,c);case"utf8":case"utf-8":return this.utf8Write(a,b,c);case"ascii":return this.asciiWrite(a,b,c);case"binary":return this.binaryWrite(a,b,c);case"base64":return this.base64Write(a,b,c);case"ucs2":case"ucs-2":return this.ucs2Write(a,b,c);default:throw new Error("Unknown encoding")}},d.prototype.slice=function(a,b){if(void 0===b&&(b=this.length),b>this.length)throw new Error("oob");if(a>b)throw new Error("oob");return new l(this,b-a,+a)},d.prototype.copy=function(a,b,c,d){for(var e=[],f=c;d>f;f++)D.ok("undefined"!=typeof this[f],"copying undefined buffer bytes!"),e.push(this[f]);for(var f=b;fd;d++)if(a[d]=e(this.parent[d+this.offset]),d==c.INSPECT_MAX_BYTES){a[d+1]="...";break}return""},l.prototype.get=function(a){if(0>a||a>=this.length)throw new Error("oob");return this.parent[this.offset+a]},l.prototype.set=function(a,b){if(0>a||a>=this.length)throw new Error("oob");return this.parent[this.offset+a]=b},l.prototype.write=function(a,b,c,e){if(isFinite(b))isFinite(c)||(e=c,c=void 0);else{var f=e;e=b,b=c,c=f}b=+b||0;var g=this.length-b;c?(c=+c,c>g&&(c=g)):c=g,e=String(e||"utf8").toLowerCase();var h;switch(e){case"hex":h=this.parent.hexWrite(a,this.offset+b,c);break;case"utf8":case"utf-8":h=this.parent.utf8Write(a,this.offset+b,c);break;case"ascii":h=this.parent.asciiWrite(a,this.offset+b,c);break;case"binary":h=this.parent.binaryWrite(a,this.offset+b,c);break;case"base64":h=this.parent.base64Write(a,this.offset+b,c);break;case"ucs2":case"ucs-2":h=this.parent.ucs2Write(a,this.offset+b,c);break;default:throw new Error("Unknown encoding")}return l._charsWritten=d._charsWritten,h},l.prototype.toString=function(a,b,c){switch(a=String(a||"utf8").toLowerCase(),"undefined"==typeof b||0>b?b=0:b>this.length&&(b=this.length),"undefined"==typeof c||c>this.length?c=this.length:0>c&&(c=0),b+=this.offset,c+=this.offset,a){case"hex":return this.parent.hexSlice(b,c);case"utf8":case"utf-8":return this.parent.utf8Slice(b,c);case"ascii":return this.parent.asciiSlice(b,c);case"binary":return this.parent.binarySlice(b,c);case"base64":return this.parent.base64Slice(b,c);case"ucs2":case"ucs-2":return this.parent.ucs2Slice(b,c);default:throw new Error("Unknown encoding")}},l.byteLength=d.byteLength,l.prototype.fill=function(a,b,c){if(a||(a=0),b||(b=0),c||(c=this.length),"string"==typeof a&&(a=a.charCodeAt(0)),"number"!=typeof a||isNaN(a))throw new Error("value is not a number");if(b>c)throw new Error("end < start");if(c===b)return 0;if(0==this.length)return 0;if(0>b||b>=this.length)throw new Error("start out of bounds");if(0>c||c>this.length)throw new Error("end out of bounds");return this.parent.fill(a,b+this.offset,c+this.offset)},l.prototype.copy=function(a,b,c,d){var e=this;if(c||(c=0),d||(d=this.length),b||(b=0),c>d)throw new Error("sourceEnd < sourceStart");if(d===c)return 0;if(0==a.length||0==e.length)return 0;if(0>b||b>=a.length)throw new Error("targetStart out of bounds");if(0>c||c>=e.length)throw new Error("sourceStart out of bounds");if(0>d||d>e.length)throw new Error("sourceEnd out of bounds");return d>this.length&&(d=this.length),a.length-bthis.length)throw new Error("oob");if(a>b)throw new Error("oob");return new l(this.parent,b-a,+a+this.offset)},l.prototype.utf8Slice=function(a,b){return this.toString("utf8",a,b)},l.prototype.binarySlice=function(a,b){return this.toString("binary",a,b)},l.prototype.asciiSlice=function(a,b){return this.toString("ascii",a,b)},l.prototype.utf8Write=function(a,b){return this.write(a,b,"utf8")},l.prototype.binaryWrite=function(a,b){return this.write(a,b,"binary")},l.prototype.asciiWrite=function(a,b){return this.write(a,b,"ascii")},l.prototype.readUInt8=function(a,b){var c=this;return b||(D.ok(void 0!==a&&null!==a,"missing offset"),D.ok(a=0?d.writeUInt8(a,b,c):d.writeUInt8(255+a+1,b,c)},l.prototype.writeInt16LE=function(a,b,c){z(this,a,b,!1,c)},l.prototype.writeInt16BE=function(a,b,c){z(this,a,b,!0,c)},l.prototype.writeInt32LE=function(a,b,c){A(this,a,b,!1,c)},l.prototype.writeInt32BE=function(a,b,c){A(this,a,b,!0,c)},l.prototype.writeFloatLE=function(a,b,c){B(this,a,b,!1,c)},l.prototype.writeFloatBE=function(a,b,c){B(this,a,b,!0,c)},l.prototype.writeDoubleLE=function(a,b,c){C(this,a,b,!1,c)},l.prototype.writeDoubleBE=function(a,b,c){C(this,a,b,!0,c)},d.prototype.readUInt8=l.prototype.readUInt8,d.prototype.readUInt16LE=l.prototype.readUInt16LE,d.prototype.readUInt16BE=l.prototype.readUInt16BE,d.prototype.readUInt32LE=l.prototype.readUInt32LE,d.prototype.readUInt32BE=l.prototype.readUInt32BE,d.prototype.readInt8=l.prototype.readInt8,d.prototype.readInt16LE=l.prototype.readInt16LE,d.prototype.readInt16BE=l.prototype.readInt16BE,d.prototype.readInt32LE=l.prototype.readInt32LE,d.prototype.readInt32BE=l.prototype.readInt32BE,d.prototype.readFloatLE=l.prototype.readFloatLE,d.prototype.readFloatBE=l.prototype.readFloatBE,d.prototype.readDoubleLE=l.prototype.readDoubleLE,d.prototype.readDoubleBE=l.prototype.readDoubleBE,d.prototype.writeUInt8=l.prototype.writeUInt8,d.prototype.writeUInt16LE=l.prototype.writeUInt16LE,d.prototype.writeUInt16BE=l.prototype.writeUInt16BE,d.prototype.writeUInt32LE=l.prototype.writeUInt32LE,d.prototype.writeUInt32BE=l.prototype.writeUInt32BE,d.prototype.writeInt8=l.prototype.writeInt8,d.prototype.writeInt16LE=l.prototype.writeInt16LE,d.prototype.writeInt16BE=l.prototype.writeInt16BE,d.prototype.writeInt32LE=l.prototype.writeInt32LE,d.prototype.writeInt32BE=l.prototype.writeInt32BE,d.prototype.writeFloatLE=l.prototype.writeFloatLE,d.prototype.writeFloatBE=l.prototype.writeFloatBE,d.prototype.writeDoubleLE=l.prototype.writeDoubleLE,d.prototype.writeDoubleBE=l.prototype.writeDoubleBE},{assert:1,"./buffer_ieee754":8,"base64-js":9}],9:[function(a,b){!function(){"use strict";function a(a){var b,c,e,f,g,h;if(a.length%4>0)throw"Invalid string. Length must be a multiple of 4";for(g=a.indexOf("="),g=g>0?a.length-g:0,h=[],e=g>0?a.length-4:a.length,b=0,c=0;e>b;b+=4,c+=3)f=d.indexOf(a[b])<<18|d.indexOf(a[b+1])<<12|d.indexOf(a[b+2])<<6|d.indexOf(a[b+3]),h.push((16711680&f)>>16),h.push((65280&f)>>8),h.push(255&f);return 2===g?(f=d.indexOf(a[b])<<2|d.indexOf(a[b+1])>>4,h.push(255&f)):1===g&&(f=d.indexOf(a[b])<<10|d.indexOf(a[b+1])<<4|d.indexOf(a[b+2])>>2,h.push(255&f>>8),h.push(255&f)),h}function c(a){function b(a){return d[63&a>>18]+d[63&a>>12]+d[63&a>>6]+d[63&a]}var c,e,f,g=a.length%3,h="";for(c=0,f=a.length-g;f>c;c+=3)e=(a[c]<<16)+(a[c+1]<<8)+a[c+2],h+=b(e);switch(g){case 1:e=a[a.length-1],h+=d[e>>2],h+=d[63&e<<4],h+="==";break;case 2:e=(a[a.length-2]<<8)+a[a.length-1],h+=d[e>>10],h+=d[63&e>>4],h+=d[63&e<<2],h+="="}return h}var d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";b.exports.toByteArray=a,b.exports.fromByteArray=c}()},{}]},{},[]),b.exports=a("buffer-browserify")},{}],48:[function(a,b){var c=b.exports={};c.nextTick=function(){var a="undefined"!=typeof window&&window.setImmediate,b="undefined"!=typeof window&&window.postMessage&&window.addEventListener;if(a)return function(a){return window.setImmediate(a)};if(b){var c=[];return window.addEventListener("message",function(a){if(a.source===window&&"process-tick"===a.data&&(a.stopPropagation(),c.length>0)){var b=c.shift();b()}},!0),function(a){c.push(a),window.postMessage("process-tick","*")}}return function(a){setTimeout(a,0)}}(),c.title="browser",c.browser=!0,c.env={},c.argv=[],c.binding=function(){throw new Error("process.binding is not supported")},c.cwd=function(){return"/"
-},c.chdir=function(){throw new Error("process.chdir is not supported")}},{}],49:[function(a,b,c){!function(){"use strict";function d(a){var b=function(a){return"string"==typeof a?a:"object"==typeof a?a.hashCode?a.hashCode():""+a:""+a},c=a.declare({instance:{constructor:function(){this.__entries=[],this.__keys=[],this.__values=[]},pushValue:function(a,b){return this.__keys.push(a),this.__values.push(b),this.__entries.push({key:a,value:b}),b},remove:function(a){for(var b,c=null,d=this.__entries,e=this.__keys,f=this.__values,g=d.length-1;g>=0;g--)if((b=d[g])&&b.key===a)return d.splice(g,1),e.splice(g,1),f.splice(g,1),b.value;return c},set:function(a,b){for(var c=null,d=this.__entries,e=this.__values,f=d.length-1;f>=0;f--){var g=d[f];if(g&&a===g.key){e[f]=b,g.value=b,c=b;break}}return c||d.push({key:a,value:b}),c},find:function(a){for(var b,c=null,d=this.__entries,e=d.length-1;e>=0;e--)if(b=d[e],b&&a===b.key){c=b.value;break}return c},getEntrySet:function(){return this.__entries},getKeys:function(){return this.__keys},getValues:function(){return this.__values}}});return a.declare({instance:{constructor:function(){this.__map={}},entrySet:function(){var a=[],b=this.__map;for(var c in b)b.hasOwnProperty(c)&&(a=a.concat(b[c].getEntrySet()));return a},put:function(a,d){var e=b(a),f=null;return(f=this.__map[e])||(f=this.__map[e]=new c),f.pushValue(a,d),d},remove:function(a){var c=b(a),d=null,e=this.__map[c];return e&&(d=e.remove(a)),d},get:function(a){var c,d=b(a),e=null;return(c=this.__map[d])&&(e=c.find(a)),e},set:function(a,d){var e=b(a),f=null,g=null,h=this.__map;return f=(g=h[e])?g.set(a,d):(h[e]=new c).pushValue(a,d)},contains:function(a){var c=b(a),d=!1,e=null;return(e=this.__map[c])&&(d=!!e.find(a)),d},concat:function(a){if(a instanceof this._static){for(var b=new this._static,c=a.entrySet().concat(this.entrySet()),d=c.length-1;d>=0;d--){var e=c[d];b.put(e.key,e.value)}return b}throw new TypeError("When joining hashtables the joining arg must be a HashTable")},filter:function(b,c){var d=this.entrySet(),e=new this._static;d=a.filter(d,b,c);for(var f=d.length-1;f>=0;f--){var g=d[f];e.put(g.key,g.value)}return e},forEach:function(b,c){var d=this.entrySet();a.forEach(d,b,c)},every:function(b,c){var d=this.entrySet();return a.every(d,b,c)},map:function(b,c){var d=this.entrySet();return a.map(d,b,c)},some:function(b,c){var d=this.entrySet();return a.some(d,b,c)},reduce:function(b,c){var d=this.entrySet();return a.reduce(d,b,c)},reduceRight:function(b,c){var d=this.entrySet();return a.reduceRight(d,b,c)},clear:function(){this.__map={}},keys:function(){var a=[],b=this.__map;for(var c in b)a=a.concat(b[c].getKeys());return a},values:function(){var a=[],b=this.__map;for(var c in b)a=a.concat(b[c].getValues());return a},isEmpty:function(){return 0===this.keys().length}}})}"undefined"!=typeof c?"undefined"!=typeof b&&b.exports&&(b.exports=d(a("extended")().register("declare",a("declare.js")).register(a("is-extended")).register(a("array-extended")))):"function"==typeof define?define(["extended","declare","is-extended","array-extended"],function(a,b,c,e){return d(a().register("declare",b).register(c).register(e))}):this.Ht=d(this.extended().register("declare",this.declare).register(this.isExtended).register(this.arrayExtended))}.call(this)},{"array-extended":36,"declare.js":39,extended:40,"is-extended":50}],50:[function(a,b,c){var d=a("__browserify_Buffer").Buffer;!function(){"use strict";function e(a){function b(a,b){var c=-1,d=0,e=a.length,f=[];for(b=b||0,c+=b;++c=0;f--)if(g[f]!==h[f])return!1;for(f=g.length-1;f>=0;f--)if(d=g[f],!e(a[d],b[d]))return!1}catch(i){return!1}return!0}function g(a){return null!==a&&"object"==typeof a}function h(a){var b=g(a);return b&&a.constructor===Object&&!a.nodeType&&!a.setInterval}function i(a){return W(a)?0===a.length:g(a)?0===c(a).length:r(a)||X(a)?0===a.length:!0}function j(a){return a===!0||a===!1||"[object Boolean]"===U.call(a)}function k(a){return"undefined"==typeof a}function l(a){return!k(a)}function m(a){return k(a)||n(a)}function n(a){return null===a}function o(a,b){return V(b)?a instanceof b:!1}function p(a){return"[object RegExp]"===U.call(a)}function q(a){return"[object Date]"===U.call(a)}function r(a){return"[object String]"===U.call(a)}function s(a){return"[object Number]"===U.call(a)}function t(a){return a===!0}function u(a){return a===!1}function v(a){return!n(a)}function w(a,b){return a==b}function x(a,b){return a!=b}function y(a,b){return a===b}function z(a,b){return a!==b}function A(a,b){if(X(b)&&Array.prototype.indexOf||r(b))return b.indexOf(a)>-1;if(X(b))for(var c=0,d=b.length;d>c;c++)if(w(a,b[c]))return!0;return!1}function B(a,b){return!A(a,b)}function C(a,b){return b>a}function D(a,b){return b>=a}function E(a,b){return a>b}function F(a,b){return a>=b}function G(a,b){return r(b)?null!==(""+a).match(b):p(b)?b.test(a):!1}function H(a,b){return!G(a,b)}function I(a,b){return A(b,a)}function J(a,b){return!A(b,a)}function K(a,b,c){return X(a)&&a.length>c?w(a[c],b):!1}function L(a,b,c){return X(a)?!w(a[c],b):!1}function M(a,b){return T.call(a,b)}function N(a,b){return!M(a,b)}function O(a,b){return M(a,"length")?a.length===b:!1}function P(a,b){return M(a,"length")?a.length!==b:!1}function Q(a){Z[a]=function(){this._testers.push(Y[a])}}function R(a){$[a]=function(){var c,d=b(arguments,1),e=Y[a],f=!0;if(d.length<=e.length-1)throw new TypeError("A handler must be defined when calling using switch");if(c=d.pop(),j(c)&&(f=c,c=d.pop()),!V(c))throw new TypeError("handler must be defined");this._cases.push(function(a){return e.apply(Y,a.concat(d))?[f,c.apply(this,a)]:[!1]})}}var S=Array.prototype.slice,T=Object.prototype.hasOwnProperty,U=Object.prototype.toString,V=function(a){return"[object Function]"===U.call(a)};"undefined"==typeof window||V(window.alert)||function(a){V=function(b){return"[object Function]"===U.call(b)||b===a}}(window.alert);var W=function(a){return"[object Arguments]"===U.call(a)};W(arguments)||(W=function(a){return!(!a||!T.call(a,"callee"))});var X=Array.isArray||function(a){return"[object Array]"===U.call(a)},Y={isFunction:V,isObject:g,isEmpty:i,isHash:h,isNumber:s,isString:r,isDate:q,isArray:X,isBoolean:j,isUndefined:k,isDefined:l,isUndefinedOrNull:m,isNull:n,isArguments:W,instanceOf:o,isRegExp:p,deepEqual:e,isTrue:t,isFalse:u,isNotNull:v,isEq:w,isNeq:x,isSeq:y,isSneq:z,isIn:A,isNotIn:B,isLt:C,isLte:D,isGt:E,isGte:F,isLike:G,isNotLike:H,contains:I,notContains:J,has:M,notHas:N,isLength:O,isNotLength:P,containsAt:K,notContainsAt:L},Z={constructor:function(){this._testers=[]},noWrap:{tester:function(){var a=this._testers;return function(b){for(var c=!1,d=0,e=a.length;e>d&&!c;d++)c=a[d](b);return c}}}},$={constructor:function(){this._cases=[],this.__default=null},def:function(a,b){this.__default=b},noWrap:{switcher:function(){var a=this._cases,c=this.__default;return function(){for(var d,e=!1,f=b(arguments),g=0,h=a.length;h>g&&!e;g++)if(d=a[g](f),d.length>1&&(d[1]||d[0]))return d[1];return!e&&c?c.apply(this,f):void 0}}}};for(var _ in Y)T.call(Y,_)&&(R(_),Q(_));var ab=a.define(Y).expose(Y);return ab.tester=a.define(Z),ab.switcher=a.define($),ab}"undefined"!=typeof c?"undefined"!=typeof b&&b.exports&&(b.exports=e(a("extended"))):"function"==typeof define&&define.amd?define(["extended"],function(a){return e(a)}):this.isExtended=e(this.extended)}.call(this)},{__browserify_Buffer:47,extended:40}],51:[function(a,b,c){!function(){"use strict";function d(a){function b(a,b){var c=0;return a>b?1:b>a?-1:b?c:1}var c=a.multiply,d=a.declare({instance:{__printNode:function(b,d){var e=[];a.isUndefinedOrNull(b)?(e.push(c(" ",d)),e.push("~"),console.log(e.join(""))):(this.__printNode(b.right,d+1),e.push(c(" ",d)),e.push(b.data+"\n"),console.log(e.join("")),this.__printNode(b.left,d+1))},constructor:function(a){a=a||{},this.compare=a.compare||b,this.__root=null},insert:function(){throw new Error("Not Implemented")},remove:function(){throw new Error("Not Implemented")},clear:function(){this.__root=null},isEmpty:function(){return!this.__root},traverseWithCondition:function(a,b,c){var e=!0;return a&&(b=b||d.PRE_ORDER,b===d.PRE_ORDER?(e=c(a.data),e&&(e=this.traverseWithCondition(a.left,b,c),e&&(e=this.traverseWithCondition(a.right,b,c)))):b===d.IN_ORDER?(e=this.traverseWithCondition(a.left,b,c),e&&(e=c(a.data),e&&(e=this.traverseWithCondition(a.right,b,c)))):b===d.POST_ORDER?(e=this.traverseWithCondition(a.left,b,c),e&&(e&&(e=this.traverseWithCondition(a.right,b,c)),e&&(e=c(a.data)))):b===d.REVERSE_ORDER&&(e=this.traverseWithCondition(a.right,b,c),e&&(e=c(a.data),e&&(e=this.traverseWithCondition(a.left,b,c))))),e},traverse:function(a,b,c){a&&(b=b||d.PRE_ORDER,b===d.PRE_ORDER?(c(a.data),this.traverse(a.left,b,c),this.traverse(a.right,b,c)):b===d.IN_ORDER?(this.traverse(a.left,b,c),c(a.data),this.traverse(a.right,b,c)):b===d.POST_ORDER?(this.traverse(a.left,b,c),this.traverse(a.right,b,c),c(a.data)):b===d.REVERSE_ORDER&&(this.traverse(a.right,b,c),c(a.data),this.traverse(a.left,b,c)))},forEach:function(a,b,c){if("function"!=typeof a)throw new TypeError;c=c||d.IN_ORDER,b=b||this,this.traverse(this.__root,c,function(c){a.call(b,c,this)})},map:function(a,b,c){if("function"!=typeof a)throw new TypeError;c=c||d.IN_ORDER,b=b||this;var e=new this._static;return this.traverse(this.__root,c,function(c){e.insert(a.call(b,c,this))}),e},filter:function(a,b,c){if("function"!=typeof a)throw new TypeError;c=c||d.IN_ORDER,b=b||this;var e=new this._static;return this.traverse(this.__root,c,function(c){a.call(b,c,this)&&e.insert(c)}),e},reduce:function(b,c,d){var e=this.toArray(d),f=[e,b];return a.isUndefinedOrNull(c)||f.push(c),a.reduce.apply(a,f)},reduceRight:function(b,c,d){var e=this.toArray(d),f=[e,b];return a.isUndefinedOrNull(c)||f.push(c),a.reduceRight.apply(a,f)},every:function(a,b,c){if("function"!=typeof a)throw new TypeError;c=c||d.IN_ORDER,b=b||this;var e=!1;return this.traverseWithCondition(this.__root,c,function(c){return e=a.call(b,c,this)}),e},some:function(a,b,c){if("function"!=typeof a)throw new TypeError;c=c||d.IN_ORDER,b=b||this;var e;return this.traverseWithCondition(this.__root,c,function(c){return e=a.call(b,c,this),!e}),e},toArray:function(a){a=a||d.IN_ORDER;var b=[];return this.traverse(this.__root,a,function(a){b.push(a)}),b},contains:function(a){for(var b=!1,c=this.__root;null!==c;){var d=this.compare(a,c.data);d?c=c[-1===d?"left":"right"]:(b=!0,c=null)}return b},find:function(a){for(var b,c=this.__root;c;){var d=this.compare(a,c.data);if(!d){b=c.data;break}c=c[-1===d?"left":"right"]}return b},findLessThan:function(a,b){var c=[],e=this.compare;return this.traverseWithCondition(this.__root,d.IN_ORDER,function(d){var f=e(a,d);return!b&&0===f||1===f?(c.push(d),!0):!1}),c},findGreaterThan:function(a,b){var c=[],e=this.compare;return this.traverse(this.__root,d.REVERSE_ORDER,function(d){var f=e(a,d);return!b&&0===f||-1===f?(c.push(d),!0):!1}),c},print:function(){this.__printNode(this.__root,0)}},"static":{PRE_ORDER:"pre_order",IN_ORDER:"in_order",POST_ORDER:"post_order",REVERSE_ORDER:"reverse_order"}}),e=function(){var a=Math.abs,b=function(a){return{data:a,balance:0,left:null,right:null}},e=function(a,b,c){var d=a[c];return a[c]=d[b],d[b]=a,d},f=function(a,b,c){return a[c]=e(a[c],c,b),e(a,b,c)},g=function(a,b,c){var d="left"===b?"right":"left",e=a[b],f=e[d];0===f.balance?a.balance=e.balance=0:f.balance===c?(a.balance=-c,e.balance=0):(a.balance=0,e.balance=c),f.balance=0},h=function(a,b){var c="left"===b?"right":"left",d=a[b],h="left"===b?-1:1;return d.balance===h?(a.balance=d.balance=0,a=e(a,c,b)):(g(a,b,h),a=f(a,c,b)),a},i=function(a,b,c){var d="left"===b?"right":"left",h=a[d],i="left"===b?-1:1;return h.balance===-i?(a.balance=h.balance=0,a=e(a,b,d)):h.balance===i?(g(a,d,-i),a=f(a,b,d)):(a.balance=-i,h.balance=i,a=e(a,b,d),c.done=!0),a},j=function(c,d,e,f){if(null===c||void 0===c)c=b(d);else{var g=-1===f(d,c.data)?"left":"right";c[g]=j(c[g],d,e,f),e.done||(c.balance+="left"===g?-1:1,0===c.balance?e.done=!0:a(c.balance)>1&&(c=h(c,g),e.done=!0))}return c},k=function(b,c,d,e){var f,g,h,j;if(b){if(g=e(c,b.data),0===g){var l=b.left,m=b.right;if(!l||!m)return f=l?"left":"right",h=b[f];for(var n=l;null!==(m=n.right);)n=m;b.data=n.data,c=n.data}if(f=-1===e(b.data,c)?"right":"left",b[f]=k(b[f],c,d,e),!d.done){j=b.balance+="left"===f?1:-1;var o=a(j);1===o?d.done=!0:o>1&&(b=i(b,f,d))}}return b};return d.extend({instance:{insert:function(a){var b={done:!1};this.__root=j(this.__root,a,b,this.compare)},remove:function(a){this.__root=k(this.__root,a,{done:!1},this.compare)},__printNode:function(a,b){var d=[];a?(this.__printNode(a.right,b+1),d.push(c(" ",b)),d.push(a.data+":"+a.balance+"\n"),console.log(d.join("")),this.__printNode(a.left,b+1)):(d.push(c(" ",b)),d.push("~"),console.log(d.join("")))}}})}(),f=function(){function a(a,b){return{data:a,level:b,left:g,right:g}}function b(a){if(0!==a.level&&a.left.level===a.level){var b=a.left;a.left=b.right,b.right=a,a=b}return a}function e(a){if(0!==a.level&&a.right.right.level===a.level){var b=a.right;a.right=b.left,b.left=a,a=b,a.level++}return a}function f(c,d,h){if(c===g)c=a(d,1);else{var i=-1===h(d,c.data)?"left":"right";c[i]=f(c[i],d,h),c=b(c),c=e(c)}return c}var g={level:0,data:null},h=function(a,c,d){var f,i;if(a!==g){var j=d(c,a.data);if(0===j)if(f=a.left,i=a.right,f!==g&&i!==g){for(var k=f;k.right!==g;)k=k.right;a.data=k.data,a.left=h(f,k.data,d)}else a=a[f===g?"right":"left"];else{var l=-1===j?"left":"right";a[l]=h(a[l],c,d)}}if(a!==g){var m=a.level,n=a.left.level,o=a.right.level;(m-1>n||m-1>o)&&(o>--a.level&&(a.right.level=a.level),a=b(a),a=e(a))}return a};return d.extend({instance:{isEmpty:function(){return this.__root===g||this._super(arguments)},insert:function(a){this.__root||(this.__root=g),this.__root=f(this.__root,a,this.compare)},remove:function(a){this.__root=h(this.__root,a,this.compare)},traverseWithCondition:function(a){var b=!0;return a!==g?this._super(arguments):b},traverse:function(a){a!==g&&this._super(arguments)},contains:function(){return this.__root!==g?this._super(arguments):!1},__printNode:function(a,b){var d=[];a&&a.data?(this.__printNode(a.right,b+1),d.push(c(" ",b)),d.push(a.data+":"+a.level+"\n"),console.log(d.join("")),this.__printNode(a.left,b+1)):(d.push(c(" ",b)),d.push("~"),console.log(d.join("")))}}})}(),g=d.extend({instance:{insert:function(a){if(!this.__root)return this.__root={data:a,parent:null,left:null,right:null};for(var b=this.compare,c=this.__root;null!==c;){var d=b(a,c.data);if(!d)return;var e=-1===d?"left":"right",f=c[e];if(!f)return c[e]={data:a,parent:c,left:null,right:null};c=f}},remove:function(a){if(null!==this.__root){for(var b,c={right:this.__root},d=c,e=null,f="right";null!==d[f];){b=d,d=d[f];var g=this.compare(a,d.data);g||(e=d),f=-1===g?"left":"right"}null!==e&&(e.data=d.data,b[b.right===d?"right":"left"]=d[null===d.left?"right":"left"]),this.__root=c.right}}}}),h=function(){var a="RED",b="BLACK",e=function(a){return null!==a&&a.red},f=function(a){return{data:a,red:!0,left:null,right:null}},g=function(a,b,c){if(!a)return f(b);var d=c(b,a.data);if(d){var j=-1===d?"left":"right",k="left"===j?"right":"left";a[j]=g(a[j],b,c);var l=a[j];if(e(l)){var m=a[k];e(m)?(a.red=!0,l.red=!1,m.red=!1):e(l[j])?a=h(a,k):e(l[k])&&(a=i(a,k))}}return a},h=function(a,b){var c="left"===b?"right":"left",d=a[c];return a[c]=d[b],d[b]=a,a.red=!0,d.red=!1,d},i=function(a,b){var c="left"===b?"right":"left";return a[c]=h(a[c],c),h(a,b)},j=function(a,b,c,d){if(a){var f;if(0===d(b,a.data)){if(!a.left||!a.right){var g=a[a.left?"left":"right"];return e(a)?c.done=!0:e(g)&&(g.red=!1,c.done=!0),g}for(var h,i=a.right;null!==i.left;)h=i,i=i.left;h&&(h.left=null),a.data=i.data,b=i.data}f=-1===d(b,a.data)?"left":"right",a[f]=j(a[f],b,c,d),c.done||(a=k(a,f,c))}else c.done=!0;return a},k=function(a,b,c){var d="left"===b?"right":"left",f=a,g=f[d];if(e(g)&&(a=h(a,b),g=f[d]),null!==g)if(e(g.left)||e(g.right)){var j=f.red,k=a===f;f=(e(g[d])?h:i)(f,b),f.red=j,f.left.red=f.right.red=0,k?a=f:a[b]=f,c.done=!0}else e(f)&&(c.done=!0),f.red=0,g.red=1;return a};return d.extend({instance:{insert:function(a){this.__root=g(this.__root,a,this.compare),this.__root.red=!1},remove:function(a){var b={done:!1},c=j(this.__root,a,b,this.compare);return null!==c&&(c.red=0),this.__root=c,a},__printNode:function(d,e){var f=[];d?(this.__printNode(d.right,e+1),f.push(c(" ",e)),f.push((d.red?a:b)+":"+d.data+"\n"),console.log(f.join("")),this.__printNode(d.left,e+1)):(f.push(c(" ",e)),f.push("~"),console.log(f.join("")))}}})}();return{Tree:d,AVLTree:e,AnderssonTree:f,BinaryTree:g,RedBlackTree:h,IN_ORDER:d.IN_ORDER,PRE_ORDER:d.PRE_ORDER,POST_ORDER:d.POST_ORDER,REVERSE_ORDER:d.REVERSE_ORDER}}"undefined"!=typeof c?"undefined"!=typeof b&&b.exports&&(b.exports=d(a("extended")().register("declare",a("declare.js")).register(a("is-extended")).register(a("array-extended")).register(a("string-extended")))):"function"==typeof define?define(["extended","declare.js","is-extended","array-extended","string-extended"],function(a,b,c,e,f){return d(a().register("declare",b).register(c).register(e).register(f))}):this.leafy=d(this.extended().register("declare",this.declare).register(this.isExtended).register(this.arrayExtended).register(this.stringExtended))}.call(this)},{"array-extended":36,"declare.js":39,extended:40,"is-extended":50,"string-extended":54}],52:[function(a,b,c){!function(){"use strict";function d(a,b,c){function d(a,b){var c,d;for(c in b)t.call(b,c)&&(d=b[c],c in a&&a[c]===d||(a[c]=d));return a}function e(a,b){var c,d,f;for(c in b)t.call(b,c)&&(d=b[c],f=a[c],p(f,d)||(a[c]=r(f)&&r(d)?e(f,d):r(d)?e({},d):d));return a}function f(a){a||(a={});for(var b=1,c=arguments.length;c>b;b++)d(a,arguments[b]);return a}function g(a){a||(a={});for(var b=1,c=arguments.length;c>b;b++)e(a,arguments[b]);return a}function h(a,b){var c=a.prototype||a;return f(c,b),a}function i(a,b,c){if(!r(a)||!u(b))throw new TypeError;for(var d,e=l(a),f=0,g=e.length;g>f;++f)d=e[f],b.call(c||a,a[d],d,a);return a}function j(a,b,c){if(!r(a)||!u(b))throw new TypeError;for(var d,e,f=l(a),g={},h=0,i=f.length;i>h;++h)d=f[h],e=a[d],b.call(c||a,e,d,a)&&(g[d]=e);return g}function k(a){if(!r(a))throw new TypeError;for(var b=l(a),c=[],d=0,e=b.length;e>d;++d)c.push(a[b[d]]);return c}function l(a){if(!r(a))throw new TypeError;var b=[];for(var c in a)t.call(a,c)&&b.push(c);return b}function m(a){if(!r(a))throw new TypeError;for(var b,c=l(a),d={},e=0,f=c.length;f>e;++e)b=c[e],d[a[b]]=b;return d}function n(a){if(!r(a))throw new TypeError;for(var b,c=l(a),d=[],e=0,f=c.length;f>e;++e)b=c[e],d.push([b,a[b]]);return d}function o(a,b){if(!r(a))throw new TypeError;q(b)&&(b=[b]);for(var c,d=s(l(a),b),e={},f=0,g=d.length;g>f;++f)c=d[f],e[c]=a[c];return e}var p=b.deepEqual,q=b.isString,r=b.isHash,s=c.difference,t=Object.prototype.hasOwnProperty,u=b.isFunction,v={forEach:i,filter:j,invert:m,values:k,toArray:n,keys:l,omit:o},w={extend:h,merge:f,deepMerge:g,omit:o},x=a.define(b.isObject,w).define(r,v).define(b.isFunction,{extend:h}).expose({hash:v}).expose(w),y=x.extend;return x.extend=function(){return 1===arguments.length?y.extend.apply(x,arguments):(h.apply(null,arguments),void 0)},x}"undefined"!=typeof c?"undefined"!=typeof b&&b.exports&&(b.exports=d(a("extended"),a("is-extended"),a("array-extended"))):"function"==typeof define&&define.amd?define(["extended","is-extended","array-extended"],function(a,b,c){return d(a,b,c)}):this.objectExtended=d(this.extended,this.isExtended,this.arrayExtended)}.call(this)},{"array-extended":36,extended:40,"is-extended":50}],53:[function(a,b,c){var d=a("__browserify_process");!function(){"use strict";function e(a,b,c,e,f,g){function h(a,b){return function(){try{l(a.apply(null,arguments)).addCallback(b).addErrback(b)}catch(c){b.errback(c)}}}function i(a,b,c){var d=(new G).callback();return v(a,function(a){d=d.then(c?a:B(null,a)),c||(d=d.then(function(a){return b.push(a),b}))}),d}function j(a){return!w(a)&&y(a.then)}function k(a){var b=new G;return a.then(A(b,"callback"),A(b,"errback")),b.promise()}function l(a){var b;return a=C(arguments),a.length?1===a.length?(a=a.pop(),j(a)?a.addCallback&&a.addErrback?(b=new G,a.addCallback(b.callback),a.addErrback(b.errback)):b=k(a):b=x(a)&&c.every(a,j)?new H(a,!0).promise():(new G).callback(a)):b=new H(c.map(a,function(a){return l(a)}),!0).promise():b=(new G).callback(a).promise(),b}function m(a,b){return function(){var c=new G,d=C(arguments);return d.push(c.resolve),a.apply(b||this,d),c.promise()}}function n(a){if(x(a))return i(a,[],!1);throw new Error("When calling promise.serial the first argument must be an array")}function o(a){if(x(a))return i(a,[],!0);throw new Error("When calling promise.serial the first argument must be an array")}function p(a,b){a=C(arguments);var c=!1;b=a.pop();var d=l(a);return function(){return c?l(b.apply(this,arguments)):(a=arguments,d.then(A(this,function(){return c=!0,b.apply(this,a)})))}}function q(){return new G}function r(a){return new H(a,!0).promise()}function s(a){return q().errback(a)}function t(a){return q().callback(a)}var u,v=c.forEach,w=e.isUndefinedOrNull,x=e.isArray,y=e.isFunction,z=e.isBoolean,A=f.bind,B=f.bindIgnore,C=g.argsToArray;if("function"==typeof setImmediate)u="undefined"!=typeof window?setImmediate.bind(window):setImmediate;else if("undefined"!=typeof d)u=function(a){d.nextTick(a)};else if("undefined"!=typeof MessageChannel){var D=new MessageChannel,E={},F=E;D.port1.onmessage=function(){E=E.next;var a=E.task;delete E.task,a()},u=function(a){F=F.next={task:a},D.port2.postMessage(0)}}else u=function(a){setTimeout(a,0)};var G=a({instance:{__fired:!1,__results:null,__error:null,__errorCbs:null,__cbs:null,constructor:function(){this.__errorCbs=[],this.__cbs=[],f.bindAll(this,["callback","errback","resolve","classic","__resolve","addCallback","addErrback"])},__resolve:function(){if(!this.__fired){this.__fired=!0;var a,b=this.__error?this.__errorCbs:this.__cbs,c=b.length,d=this.__error||this.__results;for(a=0;c>a;a++)this.__callNextTick(b[a],d)}},__callNextTick:function(a,b){u(function(){a.apply(this,b)})},addCallback:function(a){return a&&(j(a)&&a.callback&&(a=a.callback),this.__fired&&this.__results?this.__callNextTick(a,this.__results):this.__cbs.push(a)),this},addErrback:function(a){return a&&(j(a)&&a.errback&&(a=a.errback),this.__fired&&this.__error?this.__callNextTick(a,this.__error):this.__errorCbs.push(a)),this},callback:function(){return this.__fired||(this.__results=arguments,this.__resolve()),this.promise()},errback:function(){return this.__fired||(this.__error=arguments,this.__resolve()),this.promise()},resolve:function(a){return a?this.errback(a):this.callback.apply(this,C(arguments,1)),this},classic:function(a){return"function"==typeof a&&(this.addErrback(function(b){a(b)}),this.addCallback(function(){a.apply(this,[null].concat(C(arguments)))})),this},then:function(a,b){var c=new G,d=c;return y(b)&&(d=h(b,c)),this.addErrback(d),y(a)?this.addCallback(h(a,c)):this.addCallback(c),c.promise()},both:function(a){return this.then(a,a)},promise:function(){var a={then:A(this,"then"),both:A(this,"both"),promise:function(){return a}};return v(["addCallback","addErrback","classic"],function(b){a[b]=A(this,function(){return this[b].apply(this,arguments),a})},this),a}}}),H=G.extend({instance:{__results:null,__errors:null,__promiseLength:0,__defLength:0,__firedLength:0,normalizeResults:!1,constructor:function(a,b){this.__errors=[],this.__results=[],this.normalizeResults=z(b)?b:!1,this._super(arguments),a&&a.length?(this.__defLength=a.length,v(a,this.__addPromise,this)):this.__resolve()},__addPromise:function(a,b){a.then(A(this,function(){var a=C(arguments);a.unshift(b),this.callback.apply(this,a)}),A(this,function(){var a=C(arguments);a.unshift(b),this.errback.apply(this,a)}))},__resolve:function(){if(!this.__fired){this.__fired=!0;var a,b=this.__errors.length?this.__errorCbs:this.__cbs,c=b.length,d=this.__errors.length?this.__errors:this.__results;for(a=0;c>a;a++)this.__callNextTick(b[a],d)}},__callNextTick:function(a,b){u(function(){a.apply(null,[b])})},addCallback:function(a){return a&&(j(a)&&a.callback&&(a=A(a,"callback")),this.__fired&&!this.__errors.length?this.__callNextTick(a,this.__results):this.__cbs.push(a)),this},addErrback:function(a){return a&&(j(a)&&a.errback&&(a=A(a,"errback")),this.__fired&&this.__errors.length?this.__callNextTick(a,this.__errors):this.__errorCbs.push(a)),this},callback:function(a){if(this.__fired)throw new Error("Already fired!");var b=C(arguments);return this.normalizeResults&&(b=b.slice(1),b=1===b.length?b.pop():b),this.__results[a]=b,this.__firedLength++,this.__firedLength===this.__defLength&&this.__resolve(),this.promise()},errback:function(a){if(this.__fired)throw new Error("Already fired!");var b=C(arguments);return this.normalizeResults&&(b=b.slice(1),b=1===b.length?b.pop():b),this.__errors[a]=b,this.__firedLength++,this.__firedLength===this.__defLength&&this.__resolve(),this.promise()}}});return b.define({isPromiseLike:j}).expose({isPromiseLike:j,when:l,wrap:m,wait:p,serial:n,chain:o,Promise:G,PromiseList:H,promise:q,defer:q,deferredList:r,reject:s,resolve:t})}"undefined"!=typeof c?"undefined"!=typeof b&&b.exports&&(b.exports=e(a("declare.js"),a("extended"),a("array-extended"),a("is-extended"),a("function-extended"),a("arguments-extended"))):"function"==typeof define&&define.amd?define(["declare","extended","array-extended","is-extended","function-extended","arguments-extended"],function(a,b,c,d,f,g){return e(a,b,c,d,f,g)}):this.promiseExtended=e(this.declare,this.extended,this.arrayExtended,this.isExtended,this.functionExtended,this.argumentsExtended)}.call(this)},{__browserify_process:48,"arguments-extended":35,"array-extended":36,"declare.js":39,extended:40,"function-extended":43,"is-extended":50}],54:[function(a,b,c){!function(){"use strict";function d(a,b,c,d){function e(a,b){var c=a;if(x.test(b)){var d=b.match(x),e=d[1],f=d[3],g=d[4];g&&(g=parseInt(g,10),c=c.length0?"+":"")+d),k&&(k=parseInt(k,10),d=d.lengthe;)d?a+=c:a=c+a,e++;return a}function i(a,c,d){var e=a;if(b.isString(e)){if(a.length>c)if(d){var f=a.length;e=a.substring(f-c,f)}else e=a.substring(0,c)}else e=i(""+e,c);return e}function j(a,d){if(d instanceof Array){var h=0,i=d.length;return a.replace(v,function(a,b,j){var k,l;if(!(i>h))return a;if(k=d[h++],"%s"===a||"%d"===a||"%D"===a)l=k+"";else if("%Z"===a)l=k.toUTCString();else if("%j"===a)try{l=s(k)}catch(m){throw new Error("stringExtended.format : Unable to parse json from ",k)}else switch(b=b.replace(/^\[|\]$/g,""),j){case"s":l=e(k,b);break;case"d":l=f(k,b);break;case"j":l=g(k,b);break;case"D":l=c.format(k,b);break;case"Z":l=c.format(k,b,!0)}return l})}if(t(d))return a.replace(w,function(a,h,i){if(i=d[i],!b.isUndefined(i)){if(!h)return""+i;if(b.isString(i))return e(i,h);if(b.isNumber(i))return f(i,h);if(b.isDate(i))return c.format(i,h);if(b.isObject(i))return g(i,h)}return a});var k=u.call(arguments).slice(1);return j(a,k)}function k(a,b){var c=[];return a&&(a.indexOf(b)>0?c=a.replace(/\s+/g,"").split(b):c.push(a)),c}function l(a,b){var c=[];if(b)for(var d=0;b>d;d++)c.push(a);return c.join("")}function m(a,c){var d,e,f;if(c)if(b.isArray(a))for(d=[],e=0,f=a.length;f>e;e++)d.push(m(a[e],c));else if(c instanceof Array)for(d=a,e=0,f=c.length;f>e;e++)d=m(d,c[e]);else c in z&&(d="["+z[c]+"m"+a+"[0m");return d}function n(a,b){return a.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g,function(a){return b&&-1!==d.indexOf(b,a)?a:"\\"+a})}function o(a){return a.replace(/^\s*|\s*$/g,"")}function p(a){return a.replace(/^\s*/,"")}function q(a){return a.replace(/\s*$/,"")}function r(a){return 0===a.length}var s;"undefined"==typeof JSON?function(){function a(a){return 10>a?"0"+a:a}function c(c){return b.isDate(c)?isFinite(c.valueOf())?c.getUTCFullYear()+"-"+a(c.getUTCMonth()+1)+"-"+a(c.getUTCDate())+"T"+a(c.getUTCHours())+":"+a(c.getUTCMinutes())+":"+a(c.getUTCSeconds())+"Z":null:i(c)?c.valueOf():c}function d(a){return j.lastIndex=0,j.test(a)?'"'+a.replace(j,function(a){var b=k[a];return"string"==typeof b?b:"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+a+'"'}function e(a,b){var i,j,k,l,m,n=f,o=b[a];switch(o&&(o=c(o)),"function"==typeof h&&(o=h.call(b,a,o)),typeof o){case"string":return d(o);case"number":return isFinite(o)?String(o):"null";case"boolean":case"null":return String(o);case"object":if(!o)return"null";if(f+=g,m=[],"[object Array]"===Object.prototype.toString.apply(o)){for(l=o.length,i=0;l>i;i+=1)m[i]=e(i,o)||"null";return k=0===m.length?"[]":f?"[\n"+f+m.join(",\n"+f)+"\n"+n+"]":"["+m.join(",")+"]",f=n,k}if(h&&"object"==typeof h)for(l=h.length,i=0;l>i;i+=1)"string"==typeof h[i]&&(j=h[i],k=e(j,o),k&&m.push(d(j)+(f?": ":":")+k));else for(j in o)Object.prototype.hasOwnProperty.call(o,j)&&(k=e(j,o),k&&m.push(d(j)+(f?": ":":")+k));return k=0===m.length?"{}":f?"{\n"+f+m.join(",\n"+f)+"\n"+n+"}":"{"+m.join(",")+"}",f=n,k}}var f,g,h,i=b.tester().isString().isNumber().isBoolean().tester(),j=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,k={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"};s=function(a,b,c){var d;if(f="",g="","number"==typeof c)for(d=0;c>d;d+=1)g+=" ";else"string"==typeof c&&(g=c);if(h=b,b&&"function"!=typeof b&&("object"!=typeof b||"number"!=typeof b.length))throw new Error("JSON.stringify");return e("",{"":a})}}():s=JSON.stringify;var t=b.isHash,u=Array.prototype.slice,v=/%((?:-?\+?.?\d*)?|(?:\[[^\[|\]]*\]))?([sjdDZ])/g,w=/\{(?:\[([^\[|\]]*)\])?(\w+)\}/g,x=/(-?)(\+?)([A-Z|a-z|\W]?)([1-9][0-9]*)?$/,y=/([1-9][0-9]*)$/g,z={bold:1,bright:1,italic:3,underline:4,blink:5,inverse:7,crossedOut:9,red:31,green:32,yellow:33,blue:34,magenta:35,cyan:36,white:37,redBackground:41,greenBackground:42,yellowBackground:43,blueBackground:44,magentaBackground:45,cyanBackground:46,whiteBackground:47,encircled:52,overlined:53,grey:90,black:90},A={SMILEY:"☺",SOLID_SMILEY:"☻",HEART:"♥",DIAMOND:"♦",CLOVE:"♣",SPADE:"♠",DOT:"•",SQUARE_CIRCLE:"◘",CIRCLE:"○",FILLED_SQUARE_CIRCLE:"◙",MALE:"♂",FEMALE:"♀",EIGHT_NOTE:"♪",DOUBLE_EIGHTH_NOTE:"♫",SUN:"☼",PLAY:"►",REWIND:"◄",UP_DOWN:"↕",PILCROW:"¶",SECTION:"§",THICK_MINUS:"▬",SMALL_UP_DOWN:"↨",UP_ARROW:"↑",DOWN_ARROW:"↓",RIGHT_ARROW:"→",LEFT_ARROW:"←",RIGHT_ANGLE:"∟",LEFT_RIGHT_ARROW:"↔",TRIANGLE:"▲",DOWN_TRIANGLE:"▼",HOUSE:"⌂",C_CEDILLA:"Ç",U_UMLAUT:"ü",E_ACCENT:"é",A_LOWER_CIRCUMFLEX:"â",A_LOWER_UMLAUT:"ä",A_LOWER_GRAVE_ACCENT:"à",A_LOWER_CIRCLE_OVER:"å",C_LOWER_CIRCUMFLEX:"ç",E_LOWER_CIRCUMFLEX:"ê",E_LOWER_UMLAUT:"ë",E_LOWER_GRAVE_ACCENT:"è",I_LOWER_UMLAUT:"ï",I_LOWER_CIRCUMFLEX:"î",I_LOWER_GRAVE_ACCENT:"ì",A_UPPER_UMLAUT:"Ä",A_UPPER_CIRCLE:"Å",E_UPPER_ACCENT:"É",A_E_LOWER:"æ",A_E_UPPER:"Æ",O_LOWER_CIRCUMFLEX:"ô",O_LOWER_UMLAUT:"ö",O_LOWER_GRAVE_ACCENT:"ò",U_LOWER_CIRCUMFLEX:"û",U_LOWER_GRAVE_ACCENT:"ù",Y_LOWER_UMLAUT:"ÿ",O_UPPER_UMLAUT:"Ö",U_UPPER_UMLAUT:"Ü",CENTS:"¢",POUND:"£",YEN:"¥",CURRENCY:"¤",PTS:"₧",FUNCTION:"ƒ",A_LOWER_ACCENT:"á",I_LOWER_ACCENT:"í",O_LOWER_ACCENT:"ó",U_LOWER_ACCENT:"ú",N_LOWER_TILDE:"ñ",N_UPPER_TILDE:"Ñ",A_SUPER:"ª",O_SUPER:"º",UPSIDEDOWN_QUESTION:"¿",SIDEWAYS_L:"⌐",NEGATION:"¬",ONE_HALF:"½",ONE_FOURTH:"¼",UPSIDEDOWN_EXCLAMATION:"¡",DOUBLE_LEFT:"«",DOUBLE_RIGHT:"»",LIGHT_SHADED_BOX:"░",MEDIUM_SHADED_BOX:"▒",DARK_SHADED_BOX:"▓",VERTICAL_LINE:"│",MAZE__SINGLE_RIGHT_T:"┤",MAZE_SINGLE_RIGHT_TOP:"┐",MAZE_SINGLE_RIGHT_BOTTOM_SMALL:"┘",MAZE_SINGLE_LEFT_TOP_SMALL:"┌",MAZE_SINGLE_LEFT_BOTTOM_SMALL:"└",MAZE_SINGLE_LEFT_T:"├",MAZE_SINGLE_BOTTOM_T:"┴",MAZE_SINGLE_TOP_T:"┬",MAZE_SINGLE_CENTER:"┼",MAZE_SINGLE_HORIZONTAL_LINE:"─",MAZE_SINGLE_RIGHT_DOUBLECENTER_T:"╡",MAZE_SINGLE_RIGHT_DOUBLE_BL:"╛",MAZE_SINGLE_RIGHT_DOUBLE_T:"╢",MAZE_SINGLE_RIGHT_DOUBLEBOTTOM_TOP:"╖",MAZE_SINGLE_RIGHT_DOUBLELEFT_TOP:"╕",MAZE_SINGLE_LEFT_DOUBLE_T:"╞",MAZE_SINGLE_BOTTOM_DOUBLE_T:"╧",MAZE_SINGLE_TOP_DOUBLE_T:"╤",MAZE_SINGLE_TOP_DOUBLECENTER_T:"╥",MAZE_SINGLE_BOTTOM_DOUBLECENTER_T:"╨",MAZE_SINGLE_LEFT_DOUBLERIGHT_BOTTOM:"╘",MAZE_SINGLE_LEFT_DOUBLERIGHT_TOP:"╒",MAZE_SINGLE_LEFT_DOUBLEBOTTOM_TOP:"╓",MAZE_SINGLE_LEFT_DOUBLETOP_BOTTOM:"╙",MAZE_SINGLE_LEFT_TOP:"Γ",MAZE_SINGLE_RIGHT_BOTTOM:"╜",MAZE_SINGLE_LEFT_CENTER:"╟",MAZE_SINGLE_DOUBLECENTER_CENTER:"╫",MAZE_SINGLE_DOUBLECROSS_CENTER:"╪",MAZE_DOUBLE_LEFT_CENTER:"╣",MAZE_DOUBLE_VERTICAL:"║",MAZE_DOUBLE_RIGHT_TOP:"╗",MAZE_DOUBLE_RIGHT_BOTTOM:"╝",MAZE_DOUBLE_LEFT_BOTTOM:"╚",MAZE_DOUBLE_LEFT_TOP:"╔",MAZE_DOUBLE_BOTTOM_T:"╩",MAZE_DOUBLE_TOP_T:"╦",MAZE_DOUBLE_LEFT_T:"╠",MAZE_DOUBLE_HORIZONTAL:"═",MAZE_DOUBLE_CROSS:"╬",SOLID_RECTANGLE:"█",THICK_LEFT_VERTICAL:"▌",THICK_RIGHT_VERTICAL:"▐",SOLID_SMALL_RECTANGLE_BOTTOM:"▄",SOLID_SMALL_RECTANGLE_TOP:"▀",PHI_UPPER:"Φ",INFINITY:"∞",INTERSECTION:"∩",DEFINITION:"≡",PLUS_MINUS:"±",GT_EQ:"≥",LT_EQ:"≤",THEREFORE:"⌠",SINCE:"∵",DOESNOT_EXIST:"∄",EXISTS:"∃",FOR_ALL:"∀",EXCLUSIVE_OR:"⊕",BECAUSE:"⌡",DIVIDE:"÷",APPROX:"≈",DEGREE:"°",BOLD_DOT:"∙",DOT_SMALL:"·",CHECK:"√",ITALIC_X:"✗",SUPER_N:"ⁿ",SQUARED:"²",CUBED:"³",SOLID_BOX:"■",PERMILE:"‰",REGISTERED_TM:"®",COPYRIGHT:"©",TRADEMARK:"™",BETA:"β",GAMMA:"γ",ZETA:"ζ",ETA:"η",IOTA:"ι",KAPPA:"κ",LAMBDA:"λ",NU:"ν",XI:"ξ",OMICRON:"ο",RHO:"ρ",UPSILON:"υ",CHI_LOWER:"φ",CHI_UPPER:"χ",PSI:"ψ",ALPHA:"α",ESZETT:"ß",PI:"π",SIGMA_UPPER:"Σ",SIGMA_LOWER:"σ",MU:"µ",TAU:"τ",THETA:"Θ",OMEGA:"Ω",DELTA:"δ",PHI_LOWER:"φ",EPSILON:"ε"},B={toArray:k,pad:h,truncate:i,multiply:l,format:j,style:m,escape:n,trim:o,trimLeft:p,trimRight:q,isEmpty:r};
-return a.define(b.isString,B).define(b.isArray,{style:m}).expose(B).expose({characters:A})}"undefined"!=typeof c?"undefined"!=typeof b&&b.exports&&(b.exports=d(a("extended"),a("is-extended"),a("date-extended"),a("array-extended"))):"function"==typeof define&&define.amd?define(["extended","is-extended","date-extended","array-extended"],function(a,b,c,e){return d(a,b,c,e)}):this.stringExtended=d(this.extended,this.isExtended,this.dateExtended,this.arrayExtended)}.call(this)},{"array-extended":36,"date-extended":37,extended:40,"is-extended":50}]},{},[1]);
\ No newline at end of file
+!function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);throw new Error("Cannot find module '"+g+"'")}var j=c[g]={exports:{}};b[g][0].call(j.exports,function(a){var c=b[g][1][a];return e(c?c:a)},j,j.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;gf&&j>f&&f++;);c=g[f]-h[f],c||(c=i-j)}return c||(c=a.recency-b.recency),c>0?1:-1},j=e({instance:{constructor:function(){this.memory={},this.memoryValues=new g},clear:function(){this.memoryValues.clear(),this.memory={},this.memory.length=this.memoryValues.length=0},get:function(a){var b=this.memory[a.id];return b?b.data:[]},remove:function(a){for(var b,c,e,f,g=a.match.facts,h=g.length,i=this.memoryValues,j=this.memory,k=-1;++k-1;)c=h[i],f.remove(c),e.remove(c),g.remove(c);h.length=0},retract:function(a,b){var c=this.rules[a.name],d=c.tree,e=c.factTable,f=this.getAgendaGroup(a.rule.agendaGroup);d.traverse(d.__root,k,function(a){b(a)&&(e.remove(a),f.remove(a),d.remove(a))})},insert:function(a,b){var c=this.rules[a.name],d=a.rule,e=d.agendaGroup;c.tree.insert(b),this.getAgendaGroup(e).insert(b),e&&d.autoFocus&&this.setFocus(e),c.factTable.insert(b)},dispose:function(){for(var a in this.agendaGroups)this.agendaGroups[a].clear();var b=this.rules;for(a in b)a in b&&(b[a].tree.clear(),b[a].factTable.clear());this.rules={}}}})},{"./extended":11,events:47}],4:[function(require,module,exports){"use strict";var extd=require("../extended"),forEach=extd.forEach,isString=extd.isString;exports.modifiers=["assert","modify","retract","emit","halt","focus"];var createFunction=function(body,defined,scope,scopeNames,definedNames){var declares=[];forEach(definedNames,function(a){-1!==body.indexOf(a)&&declares.push("var "+a+"= defined."+a+";")}),forEach(scopeNames,function(a){-1!==body.indexOf(a)&&declares.push("var "+a+"= scope."+a+";")}),body=["((function(){",declares.join(""),"\n return ",body,"\n})())"].join("");try{return eval(body)}catch(e){throw new Error("Invalid action : "+body+"\n"+e.message)}},createDefined=function(){var a=function(a){a=isString(a)?new Function("return "+a+";")():a;var b=a.hasOwnProperty("constructor")&&"function"==typeof a.constructor?a.constructor:function(b){b=b||{};for(var c in b)c in a&&(this[c]=b[c])},c=b.prototype;for(var d in a)c[d]=a[d];return b};return function(b){return a(b.properties)}}();exports.createFunction=createFunction,exports.createDefined=createDefined},{"../extended":11}],5:[function(a,b,c){var d=a("__browserify_Buffer").Buffer,e=a("../extended"),f=a("../parser"),g=a("../constraintMatcher.js"),h=e.indexOf,i=e.forEach,j=e.removeDuplicates,k=e.map,l=e.hash,m=l.keys,n=e.merge,o=a("../rule"),p=a("./common"),q=p.createDefined,r=p.createFunction,s=function(a,b,c,d){var f=[];i(b,function(b){-1!==a.indexOf(b)&&f.push("var "+b+"= facts."+b+";")}),e(c).keys().forEach(function(b){-1!==a.indexOf(b)&&f.push("var "+b+"= defined."+b+";")}),e(d).keys().forEach(function(b){-1!==a.indexOf(b)&&f.push("var "+b+"= scope."+b+";")});var g=["facts","flow"];/next\(.*\)/.test(a)&&g.push("next"),a="with(flow){"+f.join("")+a+"}";try{return new Function("defined, scope","return "+new Function(g.join(","),a).toString())(c,d)}catch(h){throw new Error("Invalid action : "+a+"\n"+h.message)}},t=function(){var a=function(a,b,c,d,j){var k=[],l=a[0],m=a[1],n=a[2],o=a[3];if(e.isHash(n)&&(o=n,n=null),!l||!(l=d[l]))throw new Error("Invalid class "+a[0]+" for rule "+j);if(k.push(l),k.push(m,n,o),c.push(k),b.push(m),n&&i(g.getIdentifiers(f.parseConstraint(n)),function(a){b.push(a)}),e.isObject(o))for(var p in o){var q=o[p];-1===h(b,q)&&b.push(q)}};return function(b,c,d){var f=b.name;if(e.isEmpty(b))throw new Error("Rule is empty");var g=b.options||{};g.scope=d;var h=b.constraints||[],k=h.length;k||(h=["true"]);var l=b.action;if(e.isUndefined(l))throw new Error("No action was defined for rule "+f);var m=[],n=[];return e(h).forEach(function(b){if(b.length){var d=b[0];if("not"===d){var e=[];b.shift(),a(b,n,e,c,f);var g=e[0];g.unshift(d),m.push(g)}else if("or"===d){var h=[d];b.shift(),i(b,function(b){a(b,n,h,c,f)}),m.push(h)}else a(b,n,m,c,f),n=j(n)}}),o.createRule(f,g,m,s(l,n,c,d))}}();c.parse=function(a,b){return f.parseRuleSet(a,b)},c.compile=function(a,b,c,f){e.isFunction(b)?(c=b,b={}):(b=b||{},c=null);var g=a.name||b.name;if(!g)throw new Error("Name must be present in JSON or options");var h=new f(g),j=n({Array:Array,String:String,Number:Number,Boolean:Boolean,RegExp:RegExp,Date:Date,Object:Object},b.define||{});"undefined"!=typeof d&&(j.Buffer=d);var l=n({console:console},b.scope);i(a.define,function(a){j[a.name]=q(a)}),e(j).forEach(function(a,b){h.addDefined(b,a)});var o=e(a.scope).pluck("name").union(e(l).keys().value()).value(),p=k(m(j),function(a){return a});i(a.scope,function(a){l[a.name]=r(a.body,j,l,o,p)});var s=a.rules;return s.length&&i(s,function(a){h.__rules=h.__rules.concat(t(a,j,l))}),c&&c.call(h,h),h},c.transpile=a("./transpile").transpile},{"../constraintMatcher.js":8,"../extended":11,"../parser":31,"../rule":36,"./common":4,"./transpile":6,__browserify_Buffer:50}],6:[function(a,b,c){function d(a){a=l(a)?new Function("return "+a+";")():a;var b,c=["(function(){"];a.hasOwnProperty("constructor")&&"function"==typeof a.constructor?c.push("var Defined = "+a.constructor.toString()+";"):c.push("var Defined = function(opts){ for(var i in opts){if(opts.hasOwnProperty(i)){this[i] = opts[i];}}};"),c.push("var proto = Defined.prototype;");for(var d in a)a.hasOwnProperty(d)&&(b=a[d],c.push("proto."+d+" = "+(h.isFunction(b)?b.toString():h.format("%j",b))+";"));return c.push("return Defined;"),c.push("}())"),c.join("")}function e(a,b,c,d){var e=[];i(b,function(b){-1!==a.indexOf(b)&&e.push("var "+b+"= facts."+b+";")}),h(c).keys().forEach(function(b){-1!==a.indexOf(b)&&e.push("var "+b+"= defined."+b+";")}),h(d).keys().forEach(function(b){-1!==a.indexOf(b)&&e.push("var "+b+"= scope."+b+";")});var f=["facts","flow"];/next\(.*\)/.test(a)&&f.push("next"),a=e.join("")+a;try{return["function(",f.join(","),"){with(flow){",a,"}}"].join("")}catch(g){throw new Error("Invalid action : "+a+"\n"+g.message)}}function f(a,b){a=a.slice(0);var c=[];if("or"===a[0])return c.push('["'+a.shift()+'"'),c.push(h.map(a,function(a){return f(a,b)}).join(",")+"]"),c;if("not"===a[0]&&c.push('"',a.shift(),'", '),b.push(a[1]),c.push(a[0],', "'+a[1].replace(/"/g,'\\"')+'"'),a.splice(0,2),a.length){var d=a.shift();h.isString(d)?(c.push(',"'+d.replace(/"/g,'\\"'),'"'),i(m.getIdentifiers(n.parseConstraint(d)),function(a){b.push(a)})):(c.push(',"true"'),a.unshift(d))}if(a.length){var e=a.shift();h(e).values().forEach(function(a){-1===j(b,a)&&b.push(a)}),c.push(","+h.format("%j",[e]))}return"["+c.join("")+"]"}var g=a("__browserify_Buffer").Buffer,h=a("../extended"),i=h.forEach,j=h.indexOf,k=h.merge,l=h.isString,m=a("../constraintMatcher"),n=a("../parser");c.transpile=function(a,b){b=b||{};var c=[];c.push("(function(){"),c.push("return function(options){"),c.push("options = options || {};"),c.push("var bind = function(scope, fn){return function(){return fn.apply(scope, arguments);};}, defined = options.defined || {}, scope = options.scope || {};");var i=k({Array:Array,String:String,Number:Number,Boolean:Boolean,RegExp:RegExp,Date:Date,Object:Object},b.define||{});"undefined"!=typeof g&&(i.Buffer=g);var j=k({console:console},b.scope);return c.push(["return nools.flow('",b.name,"', function(){"].join("")),c.push(h(a.define||[]).map(function(a){var b=a.name;return a[b]={},["var",b,"= defined."+b,"= this.addDefined('"+b+"',",d(a.properties)+");"].join(" ")}).value().join("\n")),c.push(h(a.scope||[]).map(function(a){var b=a.name;return j[b]={},["var",b,"= scope."+b,"= ",a.body,";"].join(" ")}).value().join("\n")),c.push("scope.console = console;\n"),c.push(h(a.rules||[]).map(function(a){var b=[],c=["this.rule('",a.name.replace(/'/g,"\\'"),"'"],d=h.merge(a.options||{},{scope:"scope"});return c.push(",",h.format("%j",[d]).replace(/(:"scope")/,":scope")),a.constraints&&!h.isEmpty(a.constraints)&&(c.push(", ["),c.push(h(a.constraints).map(function(a){return f(a,b)}).value().join(",")),c.push("]")),c.push(",",e(a.action,b,i,j)),c.push(");"),c.join("")}).value().join("")),c.push("});"),c.push("};"),c.push("}());"),c.join("")}},{"../constraintMatcher":8,"../extended":11,"../parser":31,__browserify_Buffer:50}],7:[function(a,b,c){"use strict";var d,e=a("./extended"),f=e.merge,g=e.instanceOf,h=e.filter,i=e.declare,j=i({instance:{constructor:function(b,c){d||(d=a("./constraintMatcher")),this.type=b,this.constraint=c},assert:function(){throw new Error("not implemented")},equal:function(a){return g(a,this._static)&&this.get("alias")===a.get("alias")&&e.deepEqual(this.constraint,a.constraint)},getters:{variables:function(){return[this.get("alias")]}}}});j.extend({instance:{constructor:function(a){this._super(["object",a])},assert:function(a){return a instanceof this.constraint||a.constructor===this.constraint},equal:function(a){return g(a,this._static)&&this.constraint===a.constraint}}}).as(c,"ObjectConstraint"),j.extend({instance:{constructor:function(a,b){this._super(["equality",a]),b=b||{},this.pattern=b.pattern,this._matcher=d.getMatcher(a,b.scope||{})},assert:function(a){return this._matcher(a)}}}).as(c,"EqualityConstraint"),j.extend({instance:{constructor:function(){this._super(["equality",[!0]])},equal:function(a){return g(a,this._static)&&this.get("alias")===a.get("alias")},assert:function(){return!0}}}).as(c,"TrueConstraint"),j.extend({instance:{constructor:function(a,b){this.cache={},this._super(["reference",a]),b=b||{},this.values=[],this.pattern=b.pattern,this._options=b,this._matcher=d.getMatcher(a,b.scope||{})},assert:function(a){try{return this._matcher(a)}catch(b){throw new Error("Error with evaluating pattern "+this.pattern+" "+b.message)}},merge:function(a){var b=this;return a instanceof this._static&&(b=new this._static([this.constraint,a.constraint,"and"],f({},this._options,this._options)),b._alias=this._alias||a._alias,b.vars=this.vars.concat(a.vars)),b},equal:function(a){return g(a,this._static)&&e.deepEqual(this.constraint,a.constraint)},getters:{variables:function(){return this.vars},alias:function(){return this._alias}},setters:{alias:function(a){this._alias=a,this.vars=h(d.getIdentifiers(this.constraint),function(b){return b!==a})}}}}).as(c,"ReferenceConstraint"),j.extend({instance:{constructor:function(a){this._super(["hash",a])},equal:function(a){return e.instanceOf(a,this._static)&&this.get("alias")===a.get("alias")&&e.deepEqual(this.constraint,a.constraint)},assert:function(){return!0},getters:{variables:function(){return this.constraint}}}}).as(c,"HashConstraint")},{"./constraintMatcher":8,"./extended":11}],8:[function(a,b,c){"use strict";var d=a("./extended"),e=d.isArray,f=d.forEach,g=d.some,h=d.map,i=d.indexOf,j=d.isNumber,k=d.removeDuplicates,l=a("./constraint"),m={indexOf:d.indexOf,now:function(){return new Date},Date:function(a,b,c,d,e,f,g){var h=new Date;return j(a)&&h.setYear(a),j(b)&&h.setMonth(b),j(c)&&h.setDate(c),j(d)&&h.setHours(d),j(e)&&h.setMinutes(e),j(f)&&h.setSeconds(f),j(g)&&h.setMilliseconds(g),h},lengthOf:function(a,b){return a.length===b},isTrue:function(a){return a===!0},isFalse:function(a){return a===!1},isNotNull:function(a){return null!==a},dateCmp:function(a,b){return d.compare(a,b)}};f(["years","days","months","hours","minutes","seconds"],function(a){m[a+"FromNow"]=d[a+"FromNow"],m[a+"Ago"]=d[a+"Ago"]}),f(["isArray","isNumber","isHash","isObject","isDate","isBoolean","isString","isRegExp","isNull","isEmpty","isUndefined","isDefined","isUndefinedOrNull","isPromiseLike","isFunction","deepEqual"],function(a){var b=d[a];m[a]=function(){return b.apply(d,arguments)}});var n={equal:function(a,b){var c=!1;return a===b?c=!0:a[2]===b[2]&&(c=-1!==i(["string","number","boolean","regexp","identifier","null"],a[2])?a[0]===b[0]:"unary"===a[2]||"logicalNot"===a[2]?this.equal(a[0],b[0]):this.equal(a[0],b[0])&&this.equal(a[1],b[1])),c},getIdentifiers:function(a){var b=[],c=a[2];if("identifier"===c)return[a[0]];if("function"===c)b=b.concat(this.getIdentifiers(a[0])).concat(this.getIdentifiers(a[1]));else if("string"!==c&&"number"!==c&&"boolean"!==c&&"regexp"!==c&&"unary"!==c&&"unary"!==c)if("prop"===c){if(b=b.concat(this.getIdentifiers(a[0])),a[1])for(var d=a[1];e(d);){if("function"===d[2]){b=b.concat(this.getIdentifiers(d[1]));break}d=d[1]}}else a[0]&&(b=b.concat(this.getIdentifiers(a[0]))),a[1]&&(b=b.concat(this.getIdentifiers(a[1])));return k(b)},toConstraints:function(a,b){var c=[],d=b.alias,e=b.scope||{},f=a[2];return"and"===f?c=c.concat(this.toConstraints(a[0],b)).concat(this.toConstraints(a[1],b)):("composite"===f||"or"===f||"lt"===f||"gt"===f||"lte"===f||"gte"===f||"like"===f||"notLike"===f||"eq"===f||"neq"===f||"in"===f||"notIn"===f||"prop"===f||"propLookup"===f||"function"===f||"logicalNot"===f)&&(g(this.getIdentifiers(a),function(a){return!(a===d||a in m||a in e)})?c.push(new l.ReferenceConstraint(a,b)):c.push(new l.EqualityConstraint(a,b))),c},parse:function(a){return this[a[2]](a[0],a[1])},composite:function(a){return this.parse(a)},and:function(a,b){return["(",this.parse(a),"&&",this.parse(b),")"].join(" ")},or:function(a,b){return["(",this.parse(a),"||",this.parse(b),")"].join(" ")},prop:function(a,b){return"function"===b[2]?[this.parse(a),this.parse(b)].join("."):[this.parse(a),"['",this.parse(b),"']"].join("")},propLookup:function(a,b){return"function"===b[2]?[this.parse(a),this.parse(b)].join("."):[this.parse(a),"[",this.parse(b),"]"].join("")},unary:function(a){return-1*this.parse(a)},plus:function(a,b){return[this.parse(a),"+",this.parse(b)].join(" ")},minus:function(a,b){return[this.parse(a),"-",this.parse(b)].join(" ")},mult:function(a,b){return[this.parse(a),"*",this.parse(b)].join(" ")},div:function(a,b){return[this.parse(a),"/",this.parse(b)].join(" ")},mod:function(a,b){return[this.parse(a),"%",this.parse(b)].join(" ")},lt:function(a,b){return[this.parse(a),"<",this.parse(b)].join(" ")},gt:function(a,b){return[this.parse(a),">",this.parse(b)].join(" ")},lte:function(a,b){return[this.parse(a),"<=",this.parse(b)].join(" ")},gte:function(a,b){return[this.parse(a),">=",this.parse(b)].join(" ")},like:function(a,b){return[this.parse(b),".test(",this.parse(a),")"].join("")},notLike:function(a,b){return["!",this.parse(b),".test(",this.parse(a),")"].join("")},eq:function(a,b){return[this.parse(a),"===",this.parse(b)].join(" ")},neq:function(a,b){return[this.parse(a),"!==",this.parse(b)].join(" ")},"in":function(a,b){return["(indexOf(",this.parse(b),",",this.parse(a),")) != -1"].join("")},notIn:function(a,b){return["(indexOf(",this.parse(b),",",this.parse(a),")) == -1"].join("")},arguments:function(a,b){var c=[];return a&&c.push(this.parse(a)),b&&c.push(this.parse(b)),c.join(",")},array:function(a){var b=[];return a?(b=this.parse(a),e(b)?b:["[",b,"]"].join("")):["[",b.join(","),"]"].join("")},"function":function(a,b){var c=this.parse(b);return[this.parse(a),"(",c,")"].join("")},string:function(a){return"'"+a+"'"},number:function(a){return a},"boolean":function(a){return a},regexp:function(a){return a},identifier:function(a){return a},"null":function(){return"null"},logicalNot:function(a){return["!(",this.parse(a),")"].join("")}},o=c.toJs=function(a,b){var c=n.parse(a);b=b||{};var d=n.getIdentifiers(a),e="var indexOf = definedFuncs.indexOf;"+h(d,function(a){var c=["var ",a," = "];return m.hasOwnProperty(a)?c.push("definedFuncs['",a,"']"):b.hasOwnProperty(a)?c.push("scope['",a,"']"):c.push("'",a,"' in fact ? fact['",a,"'] : hash['",a,"']"),c.push(";"),c.join("")}).join("")+" return !!("+c+");",f=new Function("fact, hash, definedFuncs, scope",e);return function(a,c){return f(a,c,m,b)}};c.getMatcher=function(a,b){return o(a,b)},c.toConstraints=function(a,b){return n.toConstraints(a,b)},c.equal=function(a,b){return n.equal(a,b)},c.getIdentifiers=function(a){return n.getIdentifiers(a)}},{"./constraint":7,"./extended":11}],9:[function(a,b){"use strict";var c=a("./extended"),d=c.declare,e=c.merge,f=c.union,g=Array.prototype.slice,h=d({instance:{constructor:function(a){this.isMatch=!0,a instanceof this._static?(this.isMatch=a.isMatch,this.facts=g.call(a.facts),this.factIds=g.call(a.factIds),this.hashCode=this.factIds.join(":"),this.factHash=e({},a.factHash),this.recency=g.call(a.recency)):a?(this.facts=[a],this.factIds=[a.id],this.recency=[a.recency],this.hashCode=a.id+"",this.factHash=a.factHash||{}):(this.facts=[],this.factIds=[],this.factHash={},this.hashCode="")},merge:function(a){var b=new this._static;return b.isMatch=a.isMatch,b.facts=this.facts.concat(a.facts),b.factIds=this.factIds.concat(a.factIds),b.hashCode=b.factIds.join(":"),b.factHash=e({},this.factHash,a.factHash),b.recency=f(this.recency,a.recency),b}}}),i=d({instance:{match:null,factHash:null,fact:null,hashCode:null,paths:null,constructor:function(a,b,c){this.fact=a,this.paths=b||null;var d=this.match=c||new h(a);this.factHash=d.factHash,this.hashCode=d.hashCode,this.factIds=d.factIds},set:function(a,b){return this.factHash[a]=b,this},isMatch:function(a){return this.match.isMatch=a,this},clone:function(a,b,c){return new i(a||this.fact,b||this.path,c||this.match)}}}).as(b)},{"./extended":11}],10:[function(a,b){var c=a("./extended"),d=c.Promise,e=a("./nextTick"),f=c.isPromiseLike;d.extend({instance:{looping:!1,constructor:function(a,b){this._super([]),this.flow=a,this.agenda=a.agenda,this.rootNode=a.rootNode,this.matchUntilHalt=!!b,c.bindAll(this,["onAlter","callNext"])},halt:function(){this.__halted=!0,this.looping||this.callback()},onAlter:function(){this.flowAltered=!0,this.looping||!this.matchUntilHalt||this.__halted||this.callNext()},setup:function(){var a=this.flow;this.rootNode.resetCounter(),a.on("assert",this.onAlter),a.on("modify",this.onAlter),a.on("retract",this.onAlter)},tearDown:function(){var a=this.flow;a.removeListener("assert",this.onAlter),a.removeListener("modify",this.onAlter),a.removeListener("retract",this.onAlter)},__handleAsyncNext:function(a){var b=this;return a.addCallback(function(){b.looping=!1,b.flowAltered?(b.rootNode.incrementCounter(),b.flowAltered=!1,b.__halted?b.callback():b.callNext()):(!b.matchUntilHalt||b.__halted)&&b.callback(),b=null}).addErrback(this.errback)},__handleSyncNext:function(a){return this.looping=!1,this.flowAltered&&(this.rootNode.incrementCounter(),this.flowAltered=!1),a&&!this.__halted?e(this.callNext):(!this.matchUntilHalt||this.__halted)&&this.callback(),a},callback:function(){this.tearDown(),this._super(arguments)},callNext:function(){this.looping=!0;var a=this.agenda.fireNext();return f(a)?this.__handleAsyncNext(a):this.__handleSyncNext(a)},execute:function(){return this.setup(),this.callNext(),this}}}).as(b)},{"./extended":11,"./nextTick":16}],11:[function(a,b){b.exports=a("extended")().register(a("array-extended")).register(a("date-extended")).register(a("object-extended")).register(a("string-extended")).register(a("promise-extended")).register(a("function-extended")).register(a("is-extended")).register("HashTable",a("ht")).register("declare",a("declare.js")).register(a("leafy")).register("LinkedList",a("./linkedList"))},{"./linkedList":15,"array-extended":39,"date-extended":40,"declare.js":42,extended:43,"function-extended":46,ht:52,"is-extended":53,leafy:54,"object-extended":55,"promise-extended":56,"string-extended":57}],12:[function(a,b){"use strict";var c=a("./extended"),d=c.bind,e=c.declare,f=a("./nodes"),g=a("events").EventEmitter,h=a("./workingMemory"),i=h.WorkingMemory,j=a("./executionStrategy"),k=a("./agenda");b.exports=e(g,{instance:{name:null,executionStrategy:null,constructor:function(a){this.env=null,this.name=a,this.__rules={},this.workingMemory=new i,this.agenda=new k(this),this.agenda.on("fire",d(this,"emit","fire")),this.agenda.on("focused",d(this,"emit","focused")),this.rootNode=new f.RootNode(this.workingMemory,this.agenda)},focus:function(a){return this.agenda.setFocus(a),this},halt:function(){var a=this.executionStrategy;return a.matchUntilHalt&&a.halt(),this},dispose:function(){this.workingMemory.dispose(),this.agenda.dispose(),this.rootNode.dispose()},assert:function(a){return this.rootNode.assertFact(this.workingMemory.assertFact(a)),this.emit("assert",a),a},retract:function(a){return this.rootNode.retractFact(this.workingMemory.retractFact(a)),this.emit("retract",a),a},modify:function(a,b){return this.rootNode.retractFact(this.workingMemory.retractFact(a)),"function"==typeof b&&b.call(a,a),this.emit("modify",a),this.rootNode.assertFact(this.workingMemory.assertFact(a)),a},print:function(){this.rootNode.print()},containsRule:function(a){return this.rootNode.containsRule(a)},rule:function(a){this.rootNode.assertRule(a)},matchUntilHalt:function(a){return(this.executionStrategy=new j(this,!0)).execute().classic(a).promise()},match:function(a){return(this.executionStrategy=new j(this)).execute().classic(a).promise()}}})},{"./agenda":3,"./executionStrategy":10,"./extended":11,"./nodes":20,"./workingMemory":37,events:47}],13:[function(a,b){"use strict";var c=a("./extended"),d=c.instanceOf,e=c.forEach,f=c.declare,g=a("./pattern").InitialFact,h=a("./rule"),i=a("./flow"),j={},k=f({instance:{constructor:function(a,b){if(this.name=a,this.cb=b,this.__rules=[],this.__defined={},b&&b.call(this,this),j.hasOwnProperty(a))throw new Error("Flow with "+a+" already defined");j[a]=this},getDefined:function(a){var b=this.__defined[a.toLowerCase()];if(!b)throw new Error(a+" flow class is not defined");return b},addDefined:function(a,b){return this.__defined[a.toLowerCase()]=b,b},rule:function(){return this.__rules=this.__rules.concat(h.createRule.apply(h,arguments)),this},getSession:function(){var a=new i(this.name);e(this.__rules,function(b){a.rule(b)}),a.assert(new g);for(var b=0,c=arguments.length;c>b;b++)a.assert(arguments[b]);return a},containsRule:function(a){return c.some(this.__rules,function(b){return b.name===a})}},"static":{getFlow:function(a){return j[a]},hasFlow:function(a){return c.has(j,a)},deleteFlow:function(a){return d(a,k)&&(a=a.name),delete j[a],k},deleteFlows:function(){for(var a in j)a in j&&delete j[a];return k},create:function(a,b){return new k(a,b)}}}).as(b)},{"./extended":11,"./flow":12,"./pattern":35,"./rule":36}],14:[function(a,b,c){"use strict";function d(a){return/\.nools$/.test(a)}function e(a){var b;return b=d(a)?i.parse(g.readFileSync(a,"utf8"),a):i.parse(a)}var f=a("./extended"),g=a("fs"),h=a("path"),i=a("./compile"),j=a("./flowContainer");c.Flow=j,c.getFlow=j.getFlow,c.hasFlow=j.hasFlow,c.deleteFlow=function(a){return j.deleteFlow(a),this},c.deleteFlows=function(){return j.deleteFlows(),this},c.flow=j.create,c.compile=function(a,b,c){if(f.isFunction(b)?(c=b,b={}):(b=b||{},c=null),f.isString(a)&&(b.name=b.name||(d(a)?h.basename(a,h.extname(a)):null),a=e(a)),!b.name)throw new Error("Name required when compiling nools source");return i.compile(a,b,c,j)},c.transpile=function(a,b){return b=b||{},f.isString(a)&&(b.name=b.name||(d(a)?h.basename(a,h.extname(a)):null),a=e(a)),i.transpile(a,b)},c.parse=e},{"./compile":5,"./extended":11,"./flowContainer":13,fs:48,path:49}],15:[function(a,b){var c=a("declare.js");c({instance:{constructor:function(){this.head=null,this.tail=null,this.length=null},push:function(a){var b=this.tail,c=this.head,d={data:a,prev:b,next:null};return b&&(this.tail.next=d),this.tail=d,c||(this.head=d),this.length++,d},remove:function(a){a.prev?a.prev.next=a.next:this.head=a.next,a.next?a.next.prev=a.prev:this.tail=a.prev,a.data=a.prev=a.next=null,this.length--},forEach:function(a){for(var b={next:this.head};b=b.next;)a(b.data)},clear:function(){this.head=this.tail=null,this.length=0}}}).as(b)},{"declare.js":42}],16:[function(a,b){var c,d=a("__browserify_process"),e=a("./extended");if("function"==typeof setImmediate)c="undefined"!=typeof window?e.bind(window,setImmediate):setImmediate;else if("undefined"!=typeof d)c=d.nextTick;else if("undefined"!=typeof MessageChannel){var f=new MessageChannel,g={},h=g;f.port1.onmessage=function(){g=g.next;var a=g.task;delete g.task,a()},c=function(a){h=h.next={task:a},f.port2.postMessage(0)}}else c=function(a){setTimeout(a,0)};b.exports=c},{"./extended":11,__browserify_process:51}],17:[function(a,b){var c=a("./alphaNode");c.extend({instance:{constructor:function(){this._super(arguments),this.alias=this.constraint.get("alias")},toString:function(){return"AliasNode"+this.__count},assert:function(a){return this.__propagate("assert",a.set(this.alias,a.fact.object))},retract:function(a){this.propagateRetract(a.fact)},equal:function(a){return a instanceof this._static&&this.alias===a.alias}}}).as(b)},{"./alphaNode":18}],18:[function(a,b){"use strict";var c=a("./node");c.extend({instance:{constructor:function(a){this._super([]),this.constraint=a},toString:function(){return"AlphaNode "+this.__count},equal:function(a){return this.constraint.equal(a.constraint)}}}).as(b)},{"./node":24}],19:[function(a,b){var c=a("./alphaNode");c.extend({instance:{constructor:function(){this._super(arguments)},assert:function(a){this.constraint.assert(a.factHash)&&this.__propagate("assert",a)},toString:function(){return"EqualityNode"+this.__count}}}).as(b)},{"./alphaNode":18}],20:[function(a,b,c){"use strict";var d=a("../extended"),e=d.forEach,f=d.some,g=d.declare,h=a("../pattern.js"),i=h.ObjectPattern,j=h.NotPattern,k=h.CompositePattern,l=h.InitialFactPattern,m=a("../constraint"),n=m.HashConstraint,o=m.ReferenceConstraint,p=a("./aliasNode"),q=a("./equalityNode"),r=a("./joinNode"),s=a("./notNode"),t=a("./leftAdapterNode"),u=a("./rightAdapterNode"),v=a("./typeNode"),w=a("./terminalNode"),x=a("./propertyNode");g({instance:{constructor:function(a,b){this.terminalNodes=[],this.joinNodes=[],this.nodes=[],this.constraints=[],this.typeNodes=[],this.__ruleCount=0,this.bucket={counter:0,recency:0},this.agendaTree=b},assertRule:function(a){var b=new w(this.bucket,this.__ruleCount++,a,this.agendaTree);this.__addToNetwork(a,a.pattern,b),this.__mergeJoinNodes(),this.terminalNodes.push(b)},resetCounter:function(){this.bucket.counter=0},incrementCounter:function(){this.bucket.counter++},assertFact:function(a){for(var b=this.typeNodes,c=b.length-1;c>=0;c--)b[c].assert(a)},retractFact:function(a){for(var b=this.typeNodes,c=b.length-1;c>=0;c--)b[c].retract(a)},containsRule:function(a){return f(this.terminalNodes,function(b){return b.rule.name===a})},dispose:function(){for(var a=this.typeNodes,b=a.length-1;b>=0;b--)a[b].dispose()},__mergeJoinNodes:function(){for(var a=this.joinNodes,b=0;b=0;c--){var d=b[c];if(a.equal(d))return d}return b.push(a),a},__createTypeNode:function(a,b){for(var c=new v(b.get("constraints")[0]),d=this.typeNodes,e=d.length-1;e>=0;e--){var f=d[e];if(c.equal(f))return f}return d.push(c),c},__createEqualityNode:function(a,b){return this.__checkEqual(new q(b)).addRule(a)},__createPropertyNode:function(a,b){return this.__checkEqual(new x(b)).addRule(a)},__createAliasNode:function(a,b){return this.__checkEqual(new p(b)).addRule(a)},__createAdapterNode:function(a,b){return("left"===b?new t:new u).addRule(a)},__createJoinNode:function(a,b,c,d){var e;b.rightPattern instanceof j?e=new s:(e=new r,this.joinNodes.push(e));var f=e;if(c instanceof r){var g=this.__createAdapterNode(a,d);f.addOutNode(g,b),f=g}return f.addOutNode(c,b),e.addRule(a)},__addToNetwork:function(a,b,c,d){if(b instanceof i){if(b instanceof j&&(!d||"left"===d))return this.__createBetaNode(a,new k(new l,b),c,d);this.__createAlphaNode(a,b,c,d)}else b instanceof k&&this.__createBetaNode(a,b,c,d)},__createBetaNode:function(a,b,c,d){var e=this.__createJoinNode(a,b,c,d);return this.__addToNetwork(a,b.rightPattern,e,"right"),this.__addToNetwork(a,b.leftPattern,e,"left"),c.addParentNode(e),e},__createAlphaNode:function(a,b,c,d){var e=b.get("constraints"),f=this.__createTypeNode(a,b),g=this.__createAliasNode(a,b);f.addOutNode(g,b),g.addParentNode(f);for(var h=g,i=e.length-1;i>0;i--){var j,k=e[i];if(k instanceof n)j=this.__createPropertyNode(a,k);else{if(k instanceof o){c.constraint.addConstraint(k);continue}j=this.__createEqualityNode(a,k)}h.addOutNode(j,b),j.addParentNode(h),h=j}if(c instanceof r){var l=this.__createAdapterNode(a,d);l.addParentNode(h),h.addOutNode(l,b),h=l}return c.addParentNode(h),h.addOutNode(c,b),f},print:function(){e(this.terminalNodes,function(a){a.print(" ")})}}}).as(c,"RootNode")},{"../constraint":7,"../extended":11,"../pattern.js":35,"./aliasNode":17,"./equalityNode":19,"./joinNode":21,"./leftAdapterNode":23,"./notNode":25,"./propertyNode":26,"./rightAdapterNode":27,"./terminalNode":28,"./typeNode":29}],21:[function(a,b){var c=a("../extended"),d=c.hash.values,e=c.indexOf,f=a("./node"),g=a("./joinReferenceNode");f.extend({instance:{constructor:function(){this._super([]),this.constraint=new g,this.leftMemory={},this.rightMemory={},this.leftTuples=[],this.rightTuples=[]},dispose:function(){this.leftMemory={},this.rightMemory={}},disposeLeft:function(a){this.leftMemory={},this.propagateDispose(a)},disposeRight:function(a){this.rightMemory={},this.propagateDispose(a)},hashCode:function(){return"JoinNode "+this.__count},toString:function(){return"JoinNode "+this.__count},retractResolve:function(a){for(var b=d(this.leftMemory),c=b.length,f=this.leftTuples;--c>-1;)for(var g,h=b[c],i=h.length;--i>-1;)if(g=h[i],this.resolve(g.match,a)){f.splice(e(f,g),1),h.splice(i,1);
+break}this._propagateRetractResolve(a)},retractLeft:function(a){var b,c,d=this.leftMemory[a.id],f=this.leftTuples;if(d){for(b=-1,c=d.length;++be;e++)this.addOutNode(d,c[e]);a.nodes.remove(d)},this);for(var b=a.parentNodes,c=0,d=a.parentNodes.l;d>c;c++){var e=b[c];this.addParentNode(e),e.nodes.remove(a)}return this},resolve:function(a,b){return a.hashCode===b.hashCode},print:function(a){console.log(a+this.toString()),d(this.parentNodes,function(b){b.print(" "+a)})},addOutNode:function(a,b){this.nodes.contains(a)||this.nodes.put(a,[]),this.nodes.get(a).push(b),this.__entrySet=this.nodes.entrySet()},addParentNode:function(a){-1===e(this.parentNodes,a)&&this.parentNodes.push(a)},shareable:function(){return!1},__propagate:function(a,b,c){c=c||this.nodes;for(var d,e,g,h,j=this.__entrySet,k=j.length;--k>-1;)d=j[k],e=d.key,g=d.value,b.paths?(h=f(g,b.paths)).length&&e[a](new i(b.fact,h,b.match)):e[a](b)},dispose:function(a){this.propagateDispose(a)},retract:function(a){this.propagateRetract(a)},propagateDispose:function(a,b){b=b||this.nodes;for(var c=this.__entrySet,d=c.length-1;d>=0;d--){var e=c[d],f=e.key;f.dispose(a)}},propagateAssert:function(a,b){this.__propagate("assert",a,b||this.nodes)},propagateRetract:function(a,b){this.__propagate("retract",a,b||this.nodes)},assert:function(a){this.propagateAssert(a)},propagateModify:function(a,b){this.__propagate("modify",a,b||this.nodes)}}}).as(b)},{"../context":9,"../extended":11}],25:[function(a,b){var c=a("./joinNode"),d=a("../context"),e=a("../extended"),f=e.indexOf;c.extend({instance:{constructor:function(){this._super(arguments),this.leftTupleMemory={},this.allTuples={}},toString:function(){return"NotNode "+this.__count},retractRight:function(a){var b=this.rightMemory,c=b[a.id],e=this.constraint;if(delete b[a.id],c){var g=f(this.rightTuples,c);this.rightTuples.splice(g,1);for(var h,i,j,k=c.blocking,l=this.rightTuples,m=l.length;h=k.pop();){for(h.blocker=null,e.setLeftContext(h),j=g;m>j;j++)if(i=l[j],e.setRightContext(i),e.isMatch()){h.blocker=i,i.blocking.push(h),this.__addToLeftTupleMemory(h);break}h.blocker||(this.__removeFromLeftTupleMemory(h),this.__addToLeftMemory(h).propagateAssert(new d(h.fact,null,h.match)))}e.clearContexts()}},retractLeft:function(a){for(var b,c,d,e=a.id,g=this.allTuples[a.id]||[];g.length;)b=g.pop(),-1!==f(b.factIds,e)&&(this.__removeFromAllTupleMemory(b),this.__removeFromLeftMemory(b),this.__removeFromLeftTupleMemory(b),(d=b.blocker)&&(c=d.blocking,c.splice(f(c,b),1),b.blocker=null));delete this.leftMemory[e],delete this.leftTupleMemory[e],this.propagateRetract(a)},assertLeft:function(a){var b,c=this.rightTuples,e=this.constraint,f=-1,g=c.length;if(0!==g)for(e.setLeftContext(a);++f-1;)b=c[d],e.setLeftContext(b).isMatch()&&(this._propagateRetractResolve(b.match),this.__removeFromLeftMemory(b),b.blocker=a,a.blocking.push(b),this.__addToLeftTupleMemory(b));e.clearContexts()},__removeFromLeftMemory:function(a){for(var b,c=this.leftMemory[a.fact.id]||[],d=this.leftTuples,e=0,g=d.length;g>e;e++)if(b=d[e],b===a){d.splice(e,1),c.splice(f(c,b),1);break}return this},__removeFromLeftTupleMemory:function(a){for(var b,c=this.leftTupleMemory[a.fact.id]||[],d=0,e=c.length;e>d;d++)if(b=c[d],b===a){c.splice(d,1);break}return this},__addToAllTupleMemory:function(a){for(var b,c,d=a.factIds,e=-1,g=d.length,h=this.allTuples;++eg;g++)b=e[g],c.set(b[1],f[b[0]]);this.__propagate("assert",c)},toString:function(){return"PropertyNode"+this.__count}}}).as(b)},{"../context":9,"../extended":11,"./alphaNode":18}],27:[function(a,b){var c=a("./node");c.extend({instance:{retractResolve:function(a){this.__propagate("retractResolve",a)},dispose:function(a){this.propagateDispose(a)},propagateAssert:function(a){this.__propagate("assertRight",a)},propagateRetract:function(a){this.__propagate("retractRight",a)},propagateResolve:function(a){this.__propagate("retractResolve",a)},modify:function(a){this.__propagate("modifyRight",a)},toString:function(){return"RightAdapterNode "+this.__count}}}).as(b)},{"./node":24}],28:[function(a,b){var c=a("./node"),d=a("../extended"),e=d.bind,f=d.removeDuplicates;c.extend({instance:{constructor:function(a,b,c,d){this._super([]),this.resolve=e(this,this.resolve),this.rule=c,this.index=b,this.name=this.rule.name,this.agenda=d,this.bucket=a,d.register(this)},__assertModify:function(a){var b=a.match;if(b.recency.sort(function(a,b){return a-b}).reverse(),b.facts=f(b.facts),b.isMatch){var c=this.rule,d=this.bucket;this.agenda.insert(this,{rule:c,index:this.index,name:c.name,recency:d.recency++,match:b,counter:d.counter})}},assert:function(a){this.__assertModify(a)},modify:function(a){this.__assertModify(a)},retract:function(a){this.agenda.removeByFact(this,a)},retractRight:function(a){this.agenda.removeByFact(this,a)},retractLeft:function(a){this.agenda.removeByFact(this,a)},assertLeft:function(a){this.__assertModify(a)},assertRight:function(a){this.__assertModify(a)},retractResolve:function(a){var b=this.resolve;this.agenda.retract(this,function(c){return b(c.match,a)})},toString:function(){return"TerminalNode "+this.rule.name}}}).as(b)},{"../extended":11,"./node":24}],29:[function(a,b){var c=a("./alphaNode"),d=a("../context");c.extend({instance:{assert:function(a){this.constraint.assert(a.object)&&this.__propagate("assert",a)},retract:function(a){this.constraint.assert(a.object)&&this.propagateRetract(a)},toString:function(){return"TypeNode"+this.__count},dispose:function(){for(var a=this.__entrySet,b=a.length-1;b>=0;b--){var c=a[b],d=c.key,e=c.value;d.dispose({paths:e})}},__propagate:function(a,b){for(var c=this.__entrySet,e=c.length-1;e>=0;e--){var f=c[e],g=f.key,h=f.value;g[a](new d(b,h))}}}}).as(b)},{"../context":9,"./alphaNode":18}],30:[function(a,b,c){var d=a("__browserify_process"),e=function(){function a(){this.yy={}}var b={trace:function(){},yy:{},symbols_:{error:2,expressions:3,EXPRESSION:4,EOF:5,UNARY_EXPRESSION:6,LITERAL_EXPRESSION:7,"-":8,"!":9,MULTIPLICATIVE_EXPRESSION:10,"*":11,"/":12,"%":13,ADDITIVE_EXPRESSION:14,"+":15,EXPONENT_EXPRESSION:16,"^":17,RELATIONAL_EXPRESSION:18,"<":19,">":20,"<=":21,">=":22,EQUALITY_EXPRESSION:23,"==":24,"!=":25,"=~":26,"!=~":27,IN_EXPRESSION:28,"in":29,ARRAY_EXPRESSION:30,notIn:31,OBJECT_EXPRESSION:32,AND_EXPRESSION:33,"&&":34,OR_EXPRESSION:35,"||":36,ARGUMENT_LIST:37,",":38,IDENTIFIER_EXPRESSION:39,IDENTIFIER:40,".":41,"[":42,STRING_EXPRESSION:43,"]":44,"(":45,")":46,STRING:47,NUMBER_EXPRESSION:48,NUMBER:49,REGEXP_EXPRESSION:50,REGEXP:51,BOOLEAN_EXPRESSION:52,BOOLEAN:53,NULL_EXPRESSION:54,NULL:55,$accept:0,$end:1},terminals_:{2:"error",5:"EOF",8:"-",9:"!",11:"*",12:"/",13:"%",15:"+",17:"^",19:"<",20:">",21:"<=",22:">=",24:"==",25:"!=",26:"=~",27:"!=~",29:"in",31:"notIn",34:"&&",36:"||",38:",",40:"IDENTIFIER",41:".",42:"[",44:"]",45:"(",46:")",47:"STRING",49:"NUMBER",51:"REGEXP",53:"BOOLEAN",55:"NULL"},productions_:[0,[3,2],[6,1],[6,2],[6,2],[10,1],[10,3],[10,3],[10,3],[14,1],[14,3],[14,3],[16,1],[16,3],[18,1],[18,3],[18,3],[18,3],[18,3],[23,1],[23,3],[23,3],[23,3],[23,3],[28,1],[28,3],[28,3],[28,3],[28,3],[33,1],[33,3],[35,1],[35,3],[37,1],[37,3],[39,1],[32,1],[32,3],[32,4],[32,4],[32,3],[32,4],[43,1],[48,1],[50,1],[52,1],[54,1],[30,2],[30,3],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,3],[4,1]],performAction:function(a,b,c,d,e,f){var g=f.length-1;switch(e){case 1:return f[g-1];case 3:this.$=[f[g],null,"unary"];break;case 4:this.$=[f[g],null,"logicalNot"];break;case 6:this.$=[f[g-2],f[g],"mult"];break;case 7:this.$=[f[g-2],f[g],"div"];break;case 8:this.$=[f[g-2],f[g],"mod"];break;case 10:this.$=[f[g-2],f[g],"plus"];break;case 11:this.$=[f[g-2],f[g],"minus"];break;case 13:this.$=[f[g-2],f[g],"pow"];break;case 15:this.$=[f[g-2],f[g],"lt"];break;case 16:this.$=[f[g-2],f[g],"gt"];break;case 17:this.$=[f[g-2],f[g],"lte"];break;case 18:this.$=[f[g-2],f[g],"gte"];break;case 20:this.$=[f[g-2],f[g],"eq"];break;case 21:this.$=[f[g-2],f[g],"neq"];break;case 22:this.$=[f[g-2],f[g],"like"];break;case 23:this.$=[f[g-2],f[g],"notLike"];break;case 25:this.$=[f[g-2],f[g],"in"];break;case 26:this.$=[f[g-2],f[g],"notIn"];break;case 27:this.$=[f[g-2],f[g],"in"];break;case 28:this.$=[f[g-2],f[g],"notIn"];break;case 30:this.$=[f[g-2],f[g],"and"];break;case 32:this.$=[f[g-2],f[g],"or"];break;case 34:this.$=[f[g-2],f[g],"arguments"];break;case 35:this.$=[String(a),null,"identifier"];break;case 37:this.$=[f[g-2],f[g],"prop"];break;case 38:this.$=[f[g-3],f[g-1],"propLookup"];break;case 39:this.$=[f[g-3],f[g-1],"propLookup"];break;case 40:this.$=[f[g-2],[null,null,"arguments"],"function"];break;case 41:this.$=[f[g-3],f[g-1],"function"];break;case 42:this.$=[String(a.replace(/^['|"]|['|"]$/g,"")),null,"string"];break;case 43:this.$=[Number(a),null,"number"];break;case 44:this.$=[a,null,"regexp"];break;case 45:this.$=["true"==a.replace(/^\s+/,""),null,"boolean"];break;case 46:this.$=[null,null,"null"];break;case 47:this.$=[null,null,"array"];break;case 48:this.$=[f[g-1],null,"array"];break;case 56:this.$=[f[g-1],null,"composite"]}},table:[{3:1,4:2,6:28,7:7,8:[1,29],9:[1,30],10:27,14:25,16:17,18:8,23:6,28:5,30:15,32:14,33:4,35:3,39:23,40:[1,26],42:[1,24],43:9,45:[1,16],47:[1,18],48:10,49:[1,19],50:11,51:[1,20],52:12,53:[1,21],54:13,55:[1,22]},{1:[3]},{5:[1,31]},{5:[2,57],36:[1,32],46:[2,57]},{5:[2,31],34:[1,33],36:[2,31],46:[2,31]},{5:[2,29],34:[2,29],36:[2,29],46:[2,29]},{5:[2,24],24:[1,34],25:[1,35],26:[1,36],27:[1,37],34:[2,24],36:[2,24],46:[2,24]},{5:[2,2],8:[2,2],11:[2,2],12:[2,2],13:[2,2],15:[2,2],17:[2,2],19:[2,2],20:[2,2],21:[2,2],22:[2,2],24:[2,2],25:[2,2],26:[2,2],27:[2,2],29:[1,38],31:[1,39],34:[2,2],36:[2,2],46:[2,2]},{5:[2,19],19:[1,40],20:[1,41],21:[1,42],22:[1,43],24:[2,19],25:[2,19],26:[2,19],27:[2,19],34:[2,19],36:[2,19],46:[2,19]},{5:[2,49],8:[2,49],11:[2,49],12:[2,49],13:[2,49],15:[2,49],17:[2,49],19:[2,49],20:[2,49],21:[2,49],22:[2,49],24:[2,49],25:[2,49],26:[2,49],27:[2,49],29:[2,49],31:[2,49],34:[2,49],36:[2,49],38:[2,49],44:[2,49],46:[2,49]},{5:[2,50],8:[2,50],11:[2,50],12:[2,50],13:[2,50],15:[2,50],17:[2,50],19:[2,50],20:[2,50],21:[2,50],22:[2,50],24:[2,50],25:[2,50],26:[2,50],27:[2,50],29:[2,50],31:[2,50],34:[2,50],36:[2,50],38:[2,50],44:[2,50],46:[2,50]},{5:[2,51],8:[2,51],11:[2,51],12:[2,51],13:[2,51],15:[2,51],17:[2,51],19:[2,51],20:[2,51],21:[2,51],22:[2,51],24:[2,51],25:[2,51],26:[2,51],27:[2,51],29:[2,51],31:[2,51],34:[2,51],36:[2,51],38:[2,51],44:[2,51],46:[2,51]},{5:[2,52],8:[2,52],11:[2,52],12:[2,52],13:[2,52],15:[2,52],17:[2,52],19:[2,52],20:[2,52],21:[2,52],22:[2,52],24:[2,52],25:[2,52],26:[2,52],27:[2,52],29:[2,52],31:[2,52],34:[2,52],36:[2,52],38:[2,52],44:[2,52],46:[2,52]},{5:[2,53],8:[2,53],11:[2,53],12:[2,53],13:[2,53],15:[2,53],17:[2,53],19:[2,53],20:[2,53],21:[2,53],22:[2,53],24:[2,53],25:[2,53],26:[2,53],27:[2,53],29:[2,53],31:[2,53],34:[2,53],36:[2,53],38:[2,53],44:[2,53],46:[2,53]},{5:[2,54],8:[2,54],11:[2,54],12:[2,54],13:[2,54],15:[2,54],17:[2,54],19:[2,54],20:[2,54],21:[2,54],22:[2,54],24:[2,54],25:[2,54],26:[2,54],27:[2,54],29:[2,54],31:[2,54],34:[2,54],36:[2,54],38:[2,54],41:[1,44],42:[1,45],44:[2,54],45:[1,46],46:[2,54]},{5:[2,55],8:[2,55],11:[2,55],12:[2,55],13:[2,55],15:[2,55],17:[2,55],19:[2,55],20:[2,55],21:[2,55],22:[2,55],24:[2,55],25:[2,55],26:[2,55],27:[2,55],29:[2,55],31:[2,55],34:[2,55],36:[2,55],38:[2,55],44:[2,55],46:[2,55]},{4:47,6:28,7:7,8:[1,29],9:[1,30],10:27,14:25,16:17,18:8,23:6,28:5,30:15,32:14,33:4,35:3,39:23,40:[1,26],42:[1,24],43:9,45:[1,16],47:[1,18],48:10,49:[1,19],50:11,51:[1,20],52:12,53:[1,21],54:13,55:[1,22]},{5:[2,14],17:[1,48],19:[2,14],20:[2,14],21:[2,14],22:[2,14],24:[2,14],25:[2,14],26:[2,14],27:[2,14],34:[2,14],36:[2,14],46:[2,14]},{5:[2,42],8:[2,42],11:[2,42],12:[2,42],13:[2,42],15:[2,42],17:[2,42],19:[2,42],20:[2,42],21:[2,42],22:[2,42],24:[2,42],25:[2,42],26:[2,42],27:[2,42],29:[2,42],31:[2,42],34:[2,42],36:[2,42],38:[2,42],44:[2,42],46:[2,42]},{5:[2,43],8:[2,43],11:[2,43],12:[2,43],13:[2,43],15:[2,43],17:[2,43],19:[2,43],20:[2,43],21:[2,43],22:[2,43],24:[2,43],25:[2,43],26:[2,43],27:[2,43],29:[2,43],31:[2,43],34:[2,43],36:[2,43],38:[2,43],44:[2,43],46:[2,43]},{5:[2,44],8:[2,44],11:[2,44],12:[2,44],13:[2,44],15:[2,44],17:[2,44],19:[2,44],20:[2,44],21:[2,44],22:[2,44],24:[2,44],25:[2,44],26:[2,44],27:[2,44],29:[2,44],31:[2,44],34:[2,44],36:[2,44],38:[2,44],44:[2,44],46:[2,44]},{5:[2,45],8:[2,45],11:[2,45],12:[2,45],13:[2,45],15:[2,45],17:[2,45],19:[2,45],20:[2,45],21:[2,45],22:[2,45],24:[2,45],25:[2,45],26:[2,45],27:[2,45],29:[2,45],31:[2,45],34:[2,45],36:[2,45],38:[2,45],44:[2,45],46:[2,45]},{5:[2,46],8:[2,46],11:[2,46],12:[2,46],13:[2,46],15:[2,46],17:[2,46],19:[2,46],20:[2,46],21:[2,46],22:[2,46],24:[2,46],25:[2,46],26:[2,46],27:[2,46],29:[2,46],31:[2,46],34:[2,46],36:[2,46],38:[2,46],44:[2,46],46:[2,46]},{5:[2,36],8:[2,36],11:[2,36],12:[2,36],13:[2,36],15:[2,36],17:[2,36],19:[2,36],20:[2,36],21:[2,36],22:[2,36],24:[2,36],25:[2,36],26:[2,36],27:[2,36],29:[2,36],31:[2,36],34:[2,36],36:[2,36],38:[2,36],41:[2,36],42:[2,36],44:[2,36],45:[2,36],46:[2,36]},{7:51,30:15,32:14,37:50,39:23,40:[1,26],42:[1,24],43:9,44:[1,49],45:[1,16],47:[1,18],48:10,49:[1,19],50:11,51:[1,20],52:12,53:[1,21],54:13,55:[1,22]},{5:[2,12],8:[1,53],15:[1,52],17:[2,12],19:[2,12],20:[2,12],21:[2,12],22:[2,12],24:[2,12],25:[2,12],26:[2,12],27:[2,12],34:[2,12],36:[2,12],46:[2,12]},{5:[2,35],8:[2,35],11:[2,35],12:[2,35],13:[2,35],15:[2,35],17:[2,35],19:[2,35],20:[2,35],21:[2,35],22:[2,35],24:[2,35],25:[2,35],26:[2,35],27:[2,35],29:[2,35],31:[2,35],34:[2,35],36:[2,35],38:[2,35],41:[2,35],42:[2,35],44:[2,35],45:[2,35],46:[2,35]},{5:[2,9],8:[2,9],11:[1,54],12:[1,55],13:[1,56],15:[2,9],17:[2,9],19:[2,9],20:[2,9],21:[2,9],22:[2,9],24:[2,9],25:[2,9],26:[2,9],27:[2,9],34:[2,9],36:[2,9],46:[2,9]},{5:[2,5],8:[2,5],11:[2,5],12:[2,5],13:[2,5],15:[2,5],17:[2,5],19:[2,5],20:[2,5],21:[2,5],22:[2,5],24:[2,5],25:[2,5],26:[2,5],27:[2,5],34:[2,5],36:[2,5],46:[2,5]},{6:57,7:58,8:[1,29],9:[1,30],30:15,32:14,39:23,40:[1,26],42:[1,24],43:9,45:[1,16],47:[1,18],48:10,49:[1,19],50:11,51:[1,20],52:12,53:[1,21],54:13,55:[1,22]},{6:59,7:58,8:[1,29],9:[1,30],30:15,32:14,39:23,40:[1,26],42:[1,24],43:9,45:[1,16],47:[1,18],48:10,49:[1,19],50:11,51:[1,20],52:12,53:[1,21],54:13,55:[1,22]},{1:[2,1]},{6:28,7:7,8:[1,29],9:[1,30],10:27,14:25,16:17,18:8,23:6,28:5,30:15,32:14,33:60,39:23,40:[1,26],42:[1,24],43:9,45:[1,16],47:[1,18],48:10,49:[1,19],50:11,51:[1,20],52:12,53:[1,21],54:13,55:[1,22]},{6:28,7:7,8:[1,29],9:[1,30],10:27,14:25,16:17,18:8,23:6,28:61,30:15,32:14,39:23,40:[1,26],42:[1,24],43:9,45:[1,16],47:[1,18],48:10,49:[1,19],50:11,51:[1,20],52:12,53:[1,21],54:13,55:[1,22]},{6:28,7:58,8:[1,29],9:[1,30],10:27,14:25,16:17,18:62,30:15,32:14,39:23,40:[1,26],42:[1,24],43:9,45:[1,16],47:[1,18],48:10,49:[1,19],50:11,51:[1,20],52:12,53:[1,21],54:13,55:[1,22]},{6:28,7:58,8:[1,29],9:[1,30],10:27,14:25,16:17,18:63,30:15,32:14,39:23,40:[1,26],42:[1,24],43:9,45:[1,16],47:[1,18],48:10,49:[1,19],50:11,51:[1,20],52:12,53:[1,21],54:13,55:[1,22]},{6:28,7:58,8:[1,29],9:[1,30],10:27,14:25,16:17,18:64,30:15,32:14,39:23,40:[1,26],42:[1,24],43:9,45:[1,16],47:[1,18],48:10,49:[1,19],50:11,51:[1,20],52:12,53:[1,21],54:13,55:[1,22]},{6:28,7:58,8:[1,29],9:[1,30],10:27,14:25,16:17,18:65,30:15,32:14,39:23,40:[1,26],42:[1,24],43:9,45:[1,16],47:[1,18],48:10,49:[1,19],50:11,51:[1,20],52:12,53:[1,21],54:13,55:[1,22]},{30:66,32:67,39:23,40:[1,26],42:[1,24]},{30:68,32:69,39:23,40:[1,26],42:[1,24]},{6:28,7:58,8:[1,29],9:[1,30],10:27,14:25,16:70,30:15,32:14,39:23,40:[1,26],42:[1,24],43:9,45:[1,16],47:[1,18],48:10,49:[1,19],50:11,51:[1,20],52:12,53:[1,21],54:13,55:[1,22]},{6:28,7:58,8:[1,29],9:[1,30],10:27,14:25,16:71,30:15,32:14,39:23,40:[1,26],42:[1,24],43:9,45:[1,16],47:[1,18],48:10,49:[1,19],50:11,51:[1,20],52:12,53:[1,21],54:13,55:[1,22]},{6:28,7:58,8:[1,29],9:[1,30],10:27,14:25,16:72,30:15,32:14,39:23,40:[1,26],42:[1,24],43:9,45:[1,16],47:[1,18],48:10,49:[1,19],50:11,51:[1,20],52:12,53:[1,21],54:13,55:[1,22]},{6:28,7:58,8:[1,29],9:[1,30],10:27,14:25,16:73,30:15,32:14,39:23,40:[1,26],42:[1,24],43:9,45:[1,16],47:[1,18],48:10,49:[1,19],50:11,51:[1,20],52:12,53:[1,21],54:13,55:[1,22]},{39:74,40:[1,26]},{32:76,39:23,40:[1,26],43:75,47:[1,18]},{7:51,30:15,32:14,37:78,39:23,40:[1,26],42:[1,24],43:9,45:[1,16],46:[1,77],47:[1,18],48:10,49:[1,19],50:11,51:[1,20],52:12,53:[1,21],54:13,55:[1,22]},{46:[1,79]},{6:28,7:58,8:[1,29],9:[1,30],10:27,14:80,30:15,32:14,39:23,40:[1,26],42:[1,24],43:9,45:[1,16],47:[1,18],48:10,49:[1,19],50:11,51:[1,20],52:12,53:[1,21],54:13,55:[1,22]},{5:[2,47],8:[2,47],11:[2,47],12:[2,47],13:[2,47],15:[2,47],17:[2,47],19:[2,47],20:[2,47],21:[2,47],22:[2,47],24:[2,47],25:[2,47],26:[2,47],27:[2,47],29:[2,47],31:[2,47],34:[2,47],36:[2,47],38:[2,47],44:[2,47],46:[2,47]},{38:[1,82],44:[1,81]},{38:[2,33],44:[2,33],46:[2,33]},{6:28,7:58,8:[1,29],9:[1,30],10:83,30:15,32:14,39:23,40:[1,26],42:[1,24],43:9,45:[1,16],47:[1,18],48:10,49:[1,19],50:11,51:[1,20],52:12,53:[1,21],54:13,55:[1,22]},{6:28,7:58,8:[1,29],9:[1,30],10:84,30:15,32:14,39:23,40:[1,26],42:[1,24],43:9,45:[1,16],47:[1,18],48:10,49:[1,19],50:11,51:[1,20],52:12,53:[1,21],54:13,55:[1,22]},{6:85,7:58,8:[1,29],9:[1,30],30:15,32:14,39:23,40:[1,26],42:[1,24],43:9,45:[1,16],47:[1,18],48:10,49:[1,19],50:11,51:[1,20],52:12,53:[1,21],54:13,55:[1,22]},{6:86,7:58,8:[1,29],9:[1,30],30:15,32:14,39:23,40:[1,26],42:[1,24],43:9,45:[1,16],47:[1,18],48:10,49:[1,19],50:11,51:[1,20],52:12,53:[1,21],54:13,55:[1,22]},{6:87,7:58,8:[1,29],9:[1,30],30:15,32:14,39:23,40:[1,26],42:[1,24],43:9,45:[1,16],47:[1,18],48:10,49:[1,19],50:11,51:[1,20],52:12,53:[1,21],54:13,55:[1,22]},{5:[2,3],8:[2,3],11:[2,3],12:[2,3],13:[2,3],15:[2,3],17:[2,3],19:[2,3],20:[2,3],21:[2,3],22:[2,3],24:[2,3],25:[2,3],26:[2,3],27:[2,3],34:[2,3],36:[2,3],46:[2,3]},{5:[2,2],8:[2,2],11:[2,2],12:[2,2],13:[2,2],15:[2,2],17:[2,2],19:[2,2],20:[2,2],21:[2,2],22:[2,2],24:[2,2],25:[2,2],26:[2,2],27:[2,2],34:[2,2],36:[2,2],46:[2,2]},{5:[2,4],8:[2,4],11:[2,4],12:[2,4],13:[2,4],15:[2,4],17:[2,4],19:[2,4],20:[2,4],21:[2,4],22:[2,4],24:[2,4],25:[2,4],26:[2,4],27:[2,4],34:[2,4],36:[2,4],46:[2,4]},{5:[2,32],34:[1,33],36:[2,32],46:[2,32]},{5:[2,30],34:[2,30],36:[2,30],46:[2,30]},{5:[2,20],19:[1,40],20:[1,41],21:[1,42],22:[1,43],24:[2,20],25:[2,20],26:[2,20],27:[2,20],34:[2,20],36:[2,20],46:[2,20]},{5:[2,21],19:[1,40],20:[1,41],21:[1,42],22:[1,43],24:[2,21],25:[2,21],26:[2,21],27:[2,21],34:[2,21],36:[2,21],46:[2,21]},{5:[2,22],19:[1,40],20:[1,41],21:[1,42],22:[1,43],24:[2,22],25:[2,22],26:[2,22],27:[2,22],34:[2,22],36:[2,22],46:[2,22]},{5:[2,23],19:[1,40],20:[1,41],21:[1,42],22:[1,43],24:[2,23],25:[2,23],26:[2,23],27:[2,23],34:[2,23],36:[2,23],46:[2,23]},{5:[2,25],34:[2,25],36:[2,25],46:[2,25]},{5:[2,27],34:[2,27],36:[2,27],41:[1,44],42:[1,45],45:[1,46],46:[2,27]},{5:[2,26],34:[2,26],36:[2,26],46:[2,26]},{5:[2,28],34:[2,28],36:[2,28],41:[1,44],42:[1,45],45:[1,46],46:[2,28]},{5:[2,15],17:[1,48],19:[2,15],20:[2,15],21:[2,15],22:[2,15],24:[2,15],25:[2,15],26:[2,15],27:[2,15],34:[2,15],36:[2,15],46:[2,15]},{5:[2,16],17:[1,48],19:[2,16],20:[2,16],21:[2,16],22:[2,16],24:[2,16],25:[2,16],26:[2,16],27:[2,16],34:[2,16],36:[2,16],46:[2,16]},{5:[2,17],17:[1,48],19:[2,17],20:[2,17],21:[2,17],22:[2,17],24:[2,17],25:[2,17],26:[2,17],27:[2,17],34:[2,17],36:[2,17],46:[2,17]},{5:[2,18],17:[1,48],19:[2,18],20:[2,18],21:[2,18],22:[2,18],24:[2,18],25:[2,18],26:[2,18],27:[2,18],34:[2,18],36:[2,18],46:[2,18]},{5:[2,37],8:[2,37],11:[2,37],12:[2,37],13:[2,37],15:[2,37],17:[2,37],19:[2,37],20:[2,37],21:[2,37],22:[2,37],24:[2,37],25:[2,37],26:[2,37],27:[2,37],29:[2,37],31:[2,37],34:[2,37],36:[2,37],38:[2,37],41:[2,37],42:[2,37],44:[2,37],45:[2,37],46:[2,37]},{44:[1,88]},{41:[1,44],42:[1,45],44:[1,89],45:[1,46]},{5:[2,40],8:[2,40],11:[2,40],12:[2,40],13:[2,40],15:[2,40],17:[2,40],19:[2,40],20:[2,40],21:[2,40],22:[2,40],24:[2,40],25:[2,40],26:[2,40],27:[2,40],29:[2,40],31:[2,40],34:[2,40],36:[2,40],38:[2,40],41:[2,40],42:[2,40],44:[2,40],45:[2,40],46:[2,40]},{38:[1,82],46:[1,90]},{5:[2,56],8:[2,56],11:[2,56],12:[2,56],13:[2,56],15:[2,56],17:[2,56],19:[2,56],20:[2,56],21:[2,56],22:[2,56],24:[2,56],25:[2,56],26:[2,56],27:[2,56],29:[2,56],31:[2,56],34:[2,56],36:[2,56],38:[2,56],44:[2,56],46:[2,56]},{5:[2,13],8:[1,53],15:[1,52],17:[2,13],19:[2,13],20:[2,13],21:[2,13],22:[2,13],24:[2,13],25:[2,13],26:[2,13],27:[2,13],34:[2,13],36:[2,13],46:[2,13]},{5:[2,48],8:[2,48],11:[2,48],12:[2,48],13:[2,48],15:[2,48],17:[2,48],19:[2,48],20:[2,48],21:[2,48],22:[2,48],24:[2,48],25:[2,48],26:[2,48],27:[2,48],29:[2,48],31:[2,48],34:[2,48],36:[2,48],38:[2,48],44:[2,48],46:[2,48]},{7:91,30:15,32:14,39:23,40:[1,26],42:[1,24],43:9,45:[1,16],47:[1,18],48:10,49:[1,19],50:11,51:[1,20],52:12,53:[1,21],54:13,55:[1,22]},{5:[2,10],8:[2,10],11:[1,54],12:[1,55],13:[1,56],15:[2,10],17:[2,10],19:[2,10],20:[2,10],21:[2,10],22:[2,10],24:[2,10],25:[2,10],26:[2,10],27:[2,10],34:[2,10],36:[2,10],46:[2,10]},{5:[2,11],8:[2,11],11:[1,54],12:[1,55],13:[1,56],15:[2,11],17:[2,11],19:[2,11],20:[2,11],21:[2,11],22:[2,11],24:[2,11],25:[2,11],26:[2,11],27:[2,11],34:[2,11],36:[2,11],46:[2,11]},{5:[2,6],8:[2,6],11:[2,6],12:[2,6],13:[2,6],15:[2,6],17:[2,6],19:[2,6],20:[2,6],21:[2,6],22:[2,6],24:[2,6],25:[2,6],26:[2,6],27:[2,6],34:[2,6],36:[2,6],46:[2,6]},{5:[2,7],8:[2,7],11:[2,7],12:[2,7],13:[2,7],15:[2,7],17:[2,7],19:[2,7],20:[2,7],21:[2,7],22:[2,7],24:[2,7],25:[2,7],26:[2,7],27:[2,7],34:[2,7],36:[2,7],46:[2,7]},{5:[2,8],8:[2,8],11:[2,8],12:[2,8],13:[2,8],15:[2,8],17:[2,8],19:[2,8],20:[2,8],21:[2,8],22:[2,8],24:[2,8],25:[2,8],26:[2,8],27:[2,8],34:[2,8],36:[2,8],46:[2,8]},{5:[2,38],8:[2,38],11:[2,38],12:[2,38],13:[2,38],15:[2,38],17:[2,38],19:[2,38],20:[2,38],21:[2,38],22:[2,38],24:[2,38],25:[2,38],26:[2,38],27:[2,38],29:[2,38],31:[2,38],34:[2,38],36:[2,38],38:[2,38],41:[2,38],42:[2,38],44:[2,38],45:[2,38],46:[2,38]},{5:[2,39],8:[2,39],11:[2,39],12:[2,39],13:[2,39],15:[2,39],17:[2,39],19:[2,39],20:[2,39],21:[2,39],22:[2,39],24:[2,39],25:[2,39],26:[2,39],27:[2,39],29:[2,39],31:[2,39],34:[2,39],36:[2,39],38:[2,39],41:[2,39],42:[2,39],44:[2,39],45:[2,39],46:[2,39]},{5:[2,41],8:[2,41],11:[2,41],12:[2,41],13:[2,41],15:[2,41],17:[2,41],19:[2,41],20:[2,41],21:[2,41],22:[2,41],24:[2,41],25:[2,41],26:[2,41],27:[2,41],29:[2,41],31:[2,41],34:[2,41],36:[2,41],38:[2,41],41:[2,41],42:[2,41],44:[2,41],45:[2,41],46:[2,41]},{38:[2,34],44:[2,34],46:[2,34]}],defaultActions:{31:[2,1]},parseError:function(a,b){if(!b.recoverable)throw new Error(a);this.trace(a)},parse:function(a){function b(){var a;return a=c.lexer.lex()||m,"number"!=typeof a&&(a=c.symbols_[a]||a),a}var c=this,d=[0],e=[null],f=[],g=this.table,h="",i=0,j=0,k=0,l=2,m=1;this.lexer.setInput(a),this.lexer.yy=this.yy,this.yy.lexer=this.lexer,this.yy.parser=this,"undefined"==typeof this.lexer.yylloc&&(this.lexer.yylloc={});var n=this.lexer.yylloc;f.push(n);var o=this.lexer.options&&this.lexer.options.ranges;this.parseError="function"==typeof this.yy.parseError?this.yy.parseError:Object.getPrototypeOf(this).parseError;for(var p,q,r,s,t,u,v,w,x,y={};;){if(r=d[d.length-1],this.defaultActions[r]?s=this.defaultActions[r]:((null===p||"undefined"==typeof p)&&(p=b()),s=g[r]&&g[r][p]),"undefined"==typeof s||!s.length||!s[0]){var z="";x=[];for(u in g[r])this.terminals_[u]&&u>l&&x.push("'"+this.terminals_[u]+"'");z=this.lexer.showPosition?"Parse error on line "+(i+1)+":\n"+this.lexer.showPosition()+"\nExpecting "+x.join(", ")+", got '"+(this.terminals_[p]||p)+"'":"Parse error on line "+(i+1)+": Unexpected "+(p==m?"end of input":"'"+(this.terminals_[p]||p)+"'"),this.parseError(z,{text:this.lexer.match,token:this.terminals_[p]||p,line:this.lexer.yylineno,loc:n,expected:x})}if(s[0]instanceof Array&&s.length>1)throw new Error("Parse Error: multiple actions possible at state: "+r+", token: "+p);switch(s[0]){case 1:d.push(p),e.push(this.lexer.yytext),f.push(this.lexer.yylloc),d.push(s[1]),p=null,q?(p=q,q=null):(j=this.lexer.yyleng,h=this.lexer.yytext,i=this.lexer.yylineno,n=this.lexer.yylloc,k>0&&k--);break;case 2:if(v=this.productions_[s[1]][1],y.$=e[e.length-v],y._$={first_line:f[f.length-(v||1)].first_line,last_line:f[f.length-1].last_line,first_column:f[f.length-(v||1)].first_column,last_column:f[f.length-1].last_column},o&&(y._$.range=[f[f.length-(v||1)].range[0],f[f.length-1].range[1]]),t=this.performAction.call(y,h,j,i,this.yy,s[1],e,f),"undefined"!=typeof t)return t;v&&(d=d.slice(0,2*-1*v),e=e.slice(0,-1*v),f=f.slice(0,-1*v)),d.push(this.productions_[s[1]][0]),e.push(y.$),f.push(y._$),w=g[d[d.length-2]][d[d.length-1]],d.push(w);break;case 3:return!0}}return!0}},c=function(){var a={EOF:1,parseError:function(a,b){if(!this.yy.parser)throw new Error(a);this.yy.parser.parseError(a,b)},setInput:function(a){return this._input=a,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var a=this._input[0];this.yytext+=a,this.yyleng++,this.offset++,this.match+=a,this.matched+=a;var b=a.match(/(?:\r\n?|\n).*/g);return b?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),a},unput:function(a){var b=a.length,c=a.split(/(?:\r\n?|\n)/g);this._input=a+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-b-1),this.offset-=b;var d=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),c.length-1&&(this.yylineno-=c.length-1);var e=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:c?(c.length===d.length?this.yylloc.first_column:0)+d[d.length-c.length].length-c[0].length:this.yylloc.first_column-b},this.options.ranges&&(this.yylloc.range=[e[0],e[0]+this.yyleng-b]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},less:function(a){this.unput(this.match.slice(a))},pastInput:function(){var a=this.matched.substr(0,this.matched.length-this.match.length);return(a.length>20?"...":"")+a.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var a=this.match;return a.length<20&&(a+=this._input.substr(0,20-a.length)),(a.substr(0,20)+(a.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var a=this.pastInput(),b=new Array(a.length+1).join("-");return a+this.upcomingInput()+"\n"+b+"^"},test_match:function(a,b){var c,d,e;if(this.options.backtrack_lexer&&(e={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(e.yylloc.range=this.yylloc.range.slice(0))),d=a[0].match(/(?:\r\n?|\n).*/g),d&&(this.yylineno+=d.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:d?d[d.length-1].length-d[d.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+a[0].length},this.yytext+=a[0],this.match+=a[0],this.matches=a,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(a[0].length),this.matched+=a[0],c=this.performAction.call(this,this.yy,this,b,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),c)return c;
+if(this._backtrack){for(var f in e)this[f]=e[f];return!1}return!1},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0);var a,b,c,d;this._more||(this.yytext="",this.match="");for(var e=this._currentRules(),f=0;fb[0].length)){if(b=c,d=f,this.options.backtrack_lexer){if(a=this.test_match(c,e[f]),a!==!1)return a;if(this._backtrack){b=!1;continue}return!1}if(!this.options.flex)break}return b?(a=this.test_match(b,e[d]),a!==!1?a:!1):""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var a=this.next();return a?a:this.lex()},begin:function(a){this.conditionStack.push(a)},popState:function(){var a=this.conditionStack.length-1;return a>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(a){return a=this.conditionStack.length-1-Math.abs(a||0),a>=0?this.conditionStack[a]:"INITIAL"},pushState:function(a){this.begin(a)},stateStackSize:function(){return this.conditionStack.length},options:{},performAction:function(a,b,c,d){switch(c){case 0:return 29;case 1:return 31;case 2:return"from";case 3:return 24;case 4:return 25;case 5:return 21;case 6:return 19;case 7:return 22;case 8:return 20;case 9:return 26;case 10:return 27;case 11:return 34;case 12:return 36;case 13:return 55;case 14:return 53;case 15:break;case 16:return 49;case 17:return 47;case 18:return 47;case 19:return 40;case 20:return 51;case 21:return 41;case 22:return 11;case 23:return 12;case 24:return 13;case 25:return 38;case 26:return 8;case 27:return 26;case 28:return 27;case 29:return 24;case 30:return 24;case 31:return 25;case 32:return 25;case 33:return 21;case 34:return 22;case 35:return 20;case 36:return 19;case 37:return 34;case 38:return 36;case 39:return 15;case 40:return 17;case 41:return 45;case 42:return 44;case 43:return 42;case 44:return 46;case 45:return 9;case 46:return 5}},rules:[/^(?:\s+in\b)/,/^(?:\s+notIn\b)/,/^(?:\s+from\b)/,/^(?:\s+(eq|EQ)\b)/,/^(?:\s+(neq|NEQ)\b)/,/^(?:\s+(lte|LTE)\b)/,/^(?:\s+(lt|LT)\b)/,/^(?:\s+(gte|GTE)\b)/,/^(?:\s+(gt|GT)\b)/,/^(?:\s+(like|LIKE)\b)/,/^(?:\s+(notLike|NOT_LIKE)\b)/,/^(?:\s+(and|AND)\b)/,/^(?:\s+(or|OR)\b)/,/^(?:\s+null\b)/,/^(?:\s+(true|false)\b)/,/^(?:\s+)/,/^(?:-?[0-9]+(?:\.[0-9]+)?\b)/,/^(?:'[^']*')/,/^(?:"[^"]*")/,/^(?:([a-zA-Z_$][0-9a-zA-Z_$]*))/,/^(?:^\/((?![\s=])[^[\/\n\\]*(?:(?:\\[\s\S]|\[[^\]\n\\]*(?:\\[\s\S][^\]\n\\]*)*])[^[\/\n\\]*)*\/[imgy]{0,4})(?!\w))/,/^(?:\.)/,/^(?:\*)/,/^(?:\/)/,/^(?:\%)/,/^(?:,)/,/^(?:-)/,/^(?:=~)/,/^(?:!=~)/,/^(?:==)/,/^(?:===)/,/^(?:!=)/,/^(?:!==)/,/^(?:<=)/,/^(?:>=)/,/^(?:>)/,/^(?:<)/,/^(?:&&)/,/^(?:\|\|)/,/^(?:\+)/,/^(?:\^)/,/^(?:\()/,/^(?:\])/,/^(?:\[)/,/^(?:\))/,/^(?:!)/,/^(?:$)/],conditions:{INITIAL:{rules:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46],inclusive:!0}}};return a}();return b.lexer=c,a.prototype=b,b.Parser=a,new a}();"undefined"!=typeof a&&"undefined"!=typeof c&&(c.parser=e,c.Parser=e.Parser,c.parse=function(){return e.parse.apply(e,arguments)},c.main=function(b){b[1]||(console.log("Usage: "+b[0]+" FILE"),d.exit(1));var e=a("fs").readFileSync(a("path").normalize(b[1]),"utf8");return c.parser.parse(e)},"undefined"!=typeof b&&a.main===b&&c.main(d.argv.slice(1)))},{__browserify_process:51,fs:48,path:49}],31:[function(a,b,c){!function(){"use strict";var b=a("./constraint/parser"),d=a("./nools/nool.parser");c.parseConstraint=function(a){try{return b.parse(a)}catch(c){throw new Error("Invalid expression '"+a+"'")}},c.parseRuleSet=function(a,b){return d.parse(a,b)}}()},{"./constraint/parser":30,"./nools/nool.parser":32}],32:[function(a,b,c){"use strict";var d=a("./tokens.js"),e=a("../../extended"),f=e.hash.keys,g=a("./util.js"),h=function(a,b,c){var d=a;a=a.replace(/\/\/(.*)[\n|\r|\r\n]/g,"").replace(/\n|\r|\r\n/g," ");for(var e,i=new RegExp("^("+f(b).join("|")+")");a&&-1!==(e=g.findNextTokenIndex(a));){a=a.substr(e);var j=a.match(i);if(null===j)throw new Error("Error parsing "+a);if(j=j[1],!(j in b))throw new Error("Unknown token"+j);try{a=b[j](a,c,h).replace(/^\s*|\s*$/g,"")}catch(k){throw new Error("Invalid "+j+" definition \n"+k.message+"; \nstarting at : "+d)}}};c.parse=function(a,b){var c={define:[],rules:[],scope:[],loaded:[],file:b};return h(a,d,c),c}},{"../../extended":11,"./tokens.js":33,"./util.js":34}],33:[function(require,module,exports){var process=require("__browserify_process"),utils=require("./util.js"),fs=require("fs"),indexOf=require("../../extended").indexOf,isWhiteSpace=function(a){return 0===a.replace(/[\s|\n|\r|\t]/g,"").length},ruleTokens={salience:function(){var a=/^(salience|priority)\s*:\s*(-?\d+)\s*[,;]?/;return function(b,c){if(a.test(b)){var d=b.match(a),e=parseInt(d[2],10);if(isNaN(e))throw new Error("Invalid salience/priority "+d[2]);return c.options.priority=e,b.replace(d[0],"")}throw new Error("invalid format")}}(),agendaGroup:function(){var a=/^(agenda-group|agendaGroup)\s*:\s*([a-zA-Z_$][0-9a-zA-Z_$]*|"[^"]*"|'[^']*')\s*[,;]?/;return function(b,c){if(a.test(b)){var d=b.match(a),e=d[2];if(!e)throw new Error("Invalid agenda-group "+d[2]);return c.options.agendaGroup=e.replace(/^["']|["']$/g,""),b.replace(d[0],"")}throw new Error("invalid format")}}(),autoFocus:function(){var a=/^(auto-focus|autoFocus)\s*:\s*(true|false)\s*[,;]?/;return function(b,c){if(a.test(b)){var d=b.match(a),e=d[2];if(!e)throw new Error("Invalid auto-focus "+d[2]);return c.options.autoFocus="true"===e?!0:!1,b.replace(d[0],"")}throw new Error("invalid format")}}(),"agenda-group":function(){return this.agendaGroup.apply(this,arguments)},"auto-focus":function(){return this.autoFocus.apply(this,arguments)},priority:function(){return this.salience.apply(this,arguments)},when:function(){var ruleRegExp=/^(\$?\w+) *: *(\w+)(.*)/,joinFunc=function(a,b){return"; "+b},constraintRegExp=/(\{ *(?:["']?\$?\w+["']?\s*:\s*["']?\$?\w+["']? *(?:, *["']?\$?\w+["']?\s*:\s*["']?\$?\w+["']?)*)+ *\})/,predicateExp=/^(\w+) *\((.*)\)$/m,parseRules=function(str){for(var rules=[],ruleLines=str.split(";"),l=ruleLines.length,ruleLine,i=0;l>i&&(ruleLine=ruleLines[i].replace(/^\s*|\s*$/g,"").replace(/\n/g,""));i++)if(!isWhiteSpace(ruleLine)){var rule=[];if(predicateExp.test(ruleLine)){var m=ruleLine.match(predicateExp),pred=m[1].replace(/^\s*|\s*$/g,"");if(rule.push(pred),ruleLine=m[2].replace(/^\s*|\s*$/g,""),"or"===pred){rule=rule.concat(parseRules(ruleLine.replace(/,\s*(\$?\w+\s*:)/g,joinFunc))),rules.push(rule);continue}}var parts=ruleLine.match(ruleRegExp);if(!parts||!parts.length)throw new Error("Invalid constraint "+ruleLine);rule.push(parts[2],parts[1]);var constraints=parts[3].replace(/^\s*|\s*$/g,""),hashParts=constraints.match(constraintRegExp);if(hashParts){var hash=hashParts[1],constraint=constraints.replace(hash,"");constraint&&rule.push(constraint.replace(/^\s*|\s*$/g,"")),hash&&rule.push(eval("("+hash.replace(/(\$?\w+)\s*:\s*(\$?\w+)/g,'"$1" : "$2"')+")"))}else constraints&&!isWhiteSpace(constraints)&&rule.push(constraints);rules.push(rule)}return rules};return function(a,b){var c=a.replace(/^when\s*/,"").replace(/^\s*|\s*$/g,"");if("{"===utils.findNextToken(c)){var d=utils.getTokensBetween(c,"{","}",!0).join("");return c=c.replace(d,""),b.constraints=parseRules(d.replace(/^\{\s*|\}\s*$/g,"")),c}throw new Error("unexpected token : expected : '{' found : '"+utils.findNextToken(c)+"'")}}(),then:function(){return function(a,b){if(b.action)throw new Error("action already defined for rule"+b.name);var c=a.replace(/^then\s*/,"").replace(/^\s*|\s*$/g,"");if("{"===utils.findNextToken(c)){var d=utils.getTokensBetween(c,"{","}",!0).join("");if(c=c.replace(d,""),b.action||(b.action=d.replace(/^\{\s*|\}\s*$/g,"")),!isWhiteSpace(c))throw new Error("Error parsing then block "+a);return c}throw new Error("unexpected token : expected : '{' found : '"+utils.findNextToken(c)+"'")}}()},topLevelTokens={"/":function(a){return a.match(/^\/\*/)?a.replace(/\/\*.*?\*\//,""):a},define:function(a,b){var c=a.replace(/^define\s*/,""),d=c.match(/^([a-zA-Z_$][0-9a-zA-Z_$]*)/);if(d){if(c=c.replace(d[0],"").replace(/^\s*|\s*$/g,""),"{"===utils.findNextToken(c)){d=d[1];var e=utils.getTokensBetween(c,"{","}",!0).join("");return c=c.replace(e,""),b.define.push({name:d,properties:"("+e+")"}),c}throw new Error("unexpected token : expected : '{' found : '"+utils.findNextToken(c)+"'")}throw new Error("missing name")},"import":function(a,b,c){if("undefined"!=typeof window)throw new Error("import cannot be used in a browser");var d=a.replace(/^import\s*/,"");if("("===utils.findNextToken(d)){var e=utils.getParamList(d);if(d=d.replace(e,"").replace(/^\s*|\s*$/g,""),";"===utils.findNextToken(d)&&(d=d.replace(/\s*;/,"")),e=e.replace(/[\(|\)]/g,"").split(","),1===e.length){if(e=utils.resolve(b.file||process.cwd(),e[0].replace(/["|']/g,"")),-1===indexOf(b.loaded,e)){var f=b.file;b.file=e,c(fs.readFileSync(e,"utf8"),topLevelTokens,b),b.loaded.push(e),b.file=f}return d}throw new Error("import accepts a single file")}throw new Error("unexpected token : expected : '(' found : '"+utils.findNextToken(d)+"'")},global:function(a,b){var c=a.replace(/^global\s*/,""),d=c.match(/^([a-zA-Z_$][0-9a-zA-Z_$]*\s*)/);if(d){if(c=c.replace(d[0],"").replace(/^\s*|\s*$/g,""),"="===utils.findNextToken(c)){d=d[1].replace(/^\s+|\s+$/g,"");var e=utils.getTokensBetween(c,"=",";",!0).join(""),f=e.substring(1,e.length-1);if(f=f.replace(/^\s+|\s+$/g,""),/^require\(/.test(f)){var g=utils.getParamList(f.replace("require")).replace(/[\(|\)]/g,"").split(",");1===g.length&&(g=g[0].replace(/["|']/g,""),f=["require('",utils.resolve(b.file||process.cwd(),g),"')"].join(""))}return b.scope.push({name:d,body:f}),c=c.replace(e,"")}throw new Error("unexpected token : expected : '=' found : '"+utils.findNextToken(c)+"'")}throw new Error("missing name")},"function":function(a,b){var c=a.replace(/^function\s*/,""),d=c.match(/^([a-zA-Z_$][0-9a-zA-Z_$]*)\s*/);if(d){if(c=c.replace(d[0],""),"("===utils.findNextToken(c)){d=d[1];var e=utils.getParamList(c);if(c=c.replace(e,"").replace(/^\s*|\s*$/g,""),"{"===utils.findNextToken(c)){var f=utils.getTokensBetween(c,"{","}",!0).join("");return c=c.replace(f,""),b.scope.push({name:d,body:"function"+e+f}),c}throw new Error("unexpected token : expected : '{' found : '"+utils.findNextToken(c)+"'")}throw new Error("unexpected token : expected : '(' found : '"+utils.findNextToken(c)+"'")}throw new Error("missing name")},rule:function(a,b,c){var d=a.replace(/^rule\s*/,""),e=d.match(/^([a-zA-Z_$][0-9a-zA-Z_$]*|"[^"]*"|'[^']*')/);if(e){if(d=d.replace(e[0],"").replace(/^\s*|\s*$/g,""),"{"===utils.findNextToken(d)){e=e[1].replace(/^["']|["']$/g,"");var f={name:e,options:{},constraints:null,action:null},g=utils.getTokensBetween(d,"{","}",!0).join("");return d=d.replace(g,""),c(g.replace(/^\{\s*|\}\s*$/g,""),ruleTokens,f),b.rules.push(f),d}throw new Error("unexpected token : expected : '{' found : '"+utils.findNextToken(d)+"'")}throw new Error("missing name")}};module.exports=topLevelTokens},{"../../extended":11,"./util.js":34,__browserify_process:51,fs:48}],34:[function(a,b,c){var d=a("__browserify_process"),e=a("path"),f=/[\s|\n|\r|\t]/,g=e.sep||("win32"===d.platform?"\\":"/"),h={"{":"}","}":"{","(":")",")":"(","[":"]"},i=c.getTokensBetween=function(a,b,c,d){var e=0,f=[];b||(b=h[c],e=1),c||(c=h[b]),a=Object(a);for(var g,i=!1,j=0,k=!1;g=a.charAt(j++);)if(g===b)e++,i?f.push(g):(i=!0,d&&f.push(g));else if(g===c&&j){if(e--,0===e){d&&f.push(g),k=!0;break}f.push(g)}else i&&f.push(g);if(!k)throw new Error("Unable to match "+b+" in "+a);return f};c.getParamList=function(a){return i(a,"(",")",!0).join("")},c.resolve=function(a,b){return""!==e.extname(a)&&(a=e.dirname(a)),1===b.split(g).length?b:e.resolve(a,b)};var j=c.findNextTokenIndex=function(a,b,c){b=b||0,c=c||a.length;var d=-1,e=a.length;for((!c||c>e)&&(c=e);c>b;b++){var g=a.charAt(b);if(!f.test(g)){d=b;break}}return d};c.findNextToken=function(a,b,c){return a.charAt(j(a,b,c))}},{__browserify_process:51,path:49}],35:[function(a,b,c){!function(){"use strict";var b=a("./extended"),d=b.merge,e=b.forEach,f=b.declare,g=a("./constraintMatcher"),h=a("./constraint"),i=f({}),j=i.extend({instance:{constructor:function(a,c,f,i,j){j=j||{},this.type=a,this.alias=c,this.conditions=f,this.pattern=j.pattern,this.constraints=[new h.ObjectConstraint(a)];var k=g.toConstraints(f,d({alias:c},j));if(k.length)this.constraints=this.constraints.concat(k);else{var l=new h.TrueConstraint;this.constraints.push(l)}if(i&&!b.isEmpty(i)){var m=new h.HashConstraint(i);this.constraints.push(m)}e(this.constraints,function(a){a.set("alias",c)})},hasConstraint:function(a){return b.some(this.constraints,function(b){return b instanceof a})},hashCode:function(){return[this.type,this.alias,b.format("%j",this.conditions)].join(":")},toString:function(){return b.format("%j",this.constraints)}}}).as(c,"ObjectPattern");j.extend().as(c,"NotPattern"),i.extend({instance:{constructor:function(a,b){this.leftPattern=a,this.rightPattern=b},hashCode:function(){return[this.leftPattern.hashCode(),this.rightPattern.hashCode()].join(":")},getters:{constraints:function(){return this.leftPattern.constraints.concat(this.rightPattern.constraints)}}}}).as(c,"CompositePattern");var k=f({}).as(c,"InitialFact");j.extend({instance:{constructor:function(){this._super([k,"i",[],{}])},assert:function(){return!0}}}).as(c,"InitialFactPattern")}()},{"./constraint":7,"./constraintMatcher":8,"./extended":11}],36:[function(a,b,c){"use strict";function d(a,b,c,d){e.isArray(b)?(d=c,c=b):b=b||{};var g=e.every(c,function(a){return f(a)});g&&1===c.length&&(c=c[0],g=!1);var h=[],i=b.scope||{};if(c.scope=i,g){for(var j,k=function(a,b){n[b]?e(n).forEach(function(b){b.push(a)}):(n[b]=0===b?[]:n[b-1].slice(),0!==b&&n[b].pop(),n[b].push(a))},l=c.length,n=[],o=0;l>o;o++)j=c[o],j.scope=i,e.forEach(p(j),k);h=e.map(n,function(c){for(var e=null,f=0;f>>0;if(0===d)return-1;var e=d;arguments.length>2&&(e=Number(arguments[2]),e!==e?e=0:0!==e&&e!==1/0&&e!==-(1/0)&&(e=(e>0||-1)*P(Q(e))));for(var f=e>=0?R(e,d-1):d-Q(e);f>=0;f--)if(f in c&&c[f]===b)return f;return-1}function i(a,b,c){if(a&&X&&X===a.filter)return a.filter(b,c);if(!N(a)||"function"!=typeof b)throw new TypeError;for(var d=Object(a),e=d.length>>>0,f=[],g=0;e>g;g++)if(g in d){var h=d[g];b.call(c,h,g,d)&&f.push(h)}return f}function j(a,b,c){if(!N(a)||"function"!=typeof b)throw new TypeError;if(a&&T&&T===a.forEach)return a.forEach(b,c),a;for(var d=0,e=a.length;e>d;++d)b.call(c||a,a[d],d,a);return a}function k(a,b,c){if(a&&Y&&Y===a.every)return a.every(b,c);if(!N(a)||"function"!=typeof b)throw new TypeError;for(var d=Object(a),e=d.length>>>0,f=0;e>f;f++)if(f in d&&!b.call(c,d[f],f,d))return!1;return!0}function l(a,b,c){if(a&&Z&&Z===a.some)return a.some(b,c);if(!N(a)||"function"!=typeof b)throw new TypeError;for(var d=Object(a),e=d.length>>>0,f=0;e>f;f++)if(f in d&&b.call(c,d[f],f,d))return!0;return!1}function m(a,b,c){if(a&&U&&U===a.map)return a.map(b,c);if(!N(a)||"function"!=typeof b)throw new TypeError;for(var d=Object(a),e=d.length>>>0,f=[],g=0;e>g;g++)g in d&&f.push(b.call(c,d[g],g,d));return f}function n(a,b,c){var d=arguments.length>2;if(a&&V&&V===a.reduce)return d?a.reduce(b,c):a.reduce(b);if(!N(a)||"function"!=typeof b)throw new TypeError;var e=0,f=a.length>>0;if(arguments.length<3){if(0===f)throw new TypeError("Array length is 0 and no second argument");c=a[0],e=1}else c=arguments[2];for(;f>e;)e in a&&(c=b.call(void 0,c,a[e],e,a)),++e;return c}function o(a,b,c){var d=arguments.length>2;if(a&&W&&W===a.reduceRight)return d?a.reduceRight(b,c):a.reduceRight(b);if(!N(a)||"function"!=typeof b)throw new TypeError;var e=Object(a),f=e.length>>>0;if(0===f&&2===arguments.length)throw new TypeError;var g=f-1;if(arguments.length>=3)c=arguments[2];else for(;;)if(g in a){c=a[g--];break}for(;g>=0;)g in e&&(c=b.call(void 0,c,e[g],g,e)),g--;return c}function p(a){var c=[];if(null!==a){var d=$(arguments);if(1===d.length)if(N(a))c=a;else if(b.isHash(a))for(var e in a)a.hasOwnProperty(e)&&c.push([e,a[e]]);else c.push(a);else j(d,function(a){c=c.concat(p(a))})}return c}function q(a){return a=a||[],a.length?n(a,function(a,b){return a+b}):0}function r(a){if(a=a||[],a.length){var c=q(a);if(b.isNumber(c))return c/a.length;throw new Error("Cannot average an array of non numbers.")}return 0}function s(a,b){return _(a,b)}function t(a,b){return _(a,b)[0]}function u(a,b){return _(a,b)[a.length-1]}function v(a){var b=a,c=J($(arguments,1));return N(a)&&(b=i(a,function(a){return-1===g(c,a)})),b}function w(a){var b,c=[],d=-1,e=0;if(a)for(b=a.length;++d0?(c.push(c.shift()),b--):(c.unshift(c.pop()),b++),y(c,b)):c}function z(a,b){var c=[];if(N(a)){var d=a.slice(0);"number"!=typeof b&&(b=a.length),b?b<=a.length&&(c=n(a,function(a,c,f){var g;return g=b>1?e(c,y(d,f).slice(1),b):[[c]],a.concat(g)},[])):c=[[]]}return c}function A(){var a=[],c=$(arguments);if(c.length>1){var d=c.shift();N(d)&&(a=n(d,function(a,d,e){for(var f=[d],g=0;gd;d++)c.push(a[b[d]]||null);return c}function D(){var a=[],b=$(arguments);if(b.length>1){for(var c=0,d=b.length;d>c;c++)a=a.concat(b[c]);a=w(a)}return a}function E(){var a,b,c=[],d=-1;if(a=arguments.length>1?$(arguments):arguments[0],N(a))for(c=a[0],d=0,b=a.length;++d1?c:p(a),n(b,function(a,b){return a.concat(b)},[])}function K(a,b){b=b.split(".");var c=a.slice(0);return j(b,function(a){var b=a.match(/(\w+)\(\)$/);c=m(c,function(c){return b?c[b[1]]():c[a]})}),c}function L(a,b,c){return c=$(arguments,2),m(a,function(a){var d=M(b)?a[b]:b;return d.apply(a,c)})}var M=b.isString,N=Array.isArray||b.isArray,O=b.isDate,P=Math.floor,Q=Math.abs,R=(Math.max,Math.min),S=Array.prototype,T=(S.indexOf,S.forEach),U=S.map,V=S.reduce,W=S.reduceRight,X=S.filter,Y=S.every,Z=S.some,$=c.argsToArray,_=function(){var a=function(a,b){return k(a,b)},b=function(a,b){return a-b},c=function(a,b){return a.getTime()-b.getTime()};return function(d,e){var f=[];return N(d)&&(f=d.slice(),e?"function"==typeof e?f.sort(e):f.sort(function(a,b){var c=a[e],d=b[e];return M(c)&&M(d)?c>d?1:d>c?-1:0:O(c)&&O(d)?c.getTime()-d.getTime():c-d}):a(f,M)?f.sort():a(f,O)?f.sort(c):f.sort(b)),f}}(),ab={toArray:p,sum:q,avg:r,sort:s,min:t,max:u,difference:v,removeDuplicates:w,unique:x,rotate:y,permutations:z,zip:A,transpose:B,valuesAt:C,union:D,intersect:E,powerSet:F,cartesian:G,compact:H,multiply:I,flatten:J,pluck:K,invoke:L,forEach:j,map:m,filter:i,reduce:n,reduceRight:o,some:l,every:k,indexOf:g,lastIndexOf:h};return a.define(N,ab).expose(ab)}"undefined"!=typeof c?"undefined"!=typeof b&&b.exports&&(b.exports=d(a("extended"),a("is-extended"),a("arguments-extended"))):"function"==typeof define&&define.amd?define(["extended","is-extended","arguments-extended"],function(a,b,c){return d(a,b,c)}):this.arrayExtended=d(this.extended,this.isExtended,this.argumentsExtended)}.call(this)},{"arguments-extended":38,extended:43,"is-extended":53}],40:[function(a,b,c){!function(){"use strict";function d(a,b,c){function d(a,b,c,d){a=""+a,c=c||" ";for(var e=a.length;b>e;)d?a+=c:a=c+a,e++;return a}function e(a,c,d){var f=a;if(b.isString(f)){if(a.length>c)if(d){var g=a.length;f=a.substring(g-c,g)}else f=a.substring(0,c)}else f=e(""+f,c);return f}function f(a,c,d){if(!b.isArray(a)||"function"!=typeof c)throw new TypeError;for(var e=Object(a),f=e.length>>>0,g=0;f>g;g++)if(g in e&&!c.call(d,e[g],g,e))return!1;return!0}function g(a,b){return A.difference(new Date(a.getFullYear(),0,1,a.getHours()),a,null,b)+1}function h(a,b,c){b=b||0;var d=a[c?"getUTCFullYear":"getFullYear"](),e=new Date(d,0,1).getDay(),f=(e-b+7)%7,h=o((g(a)+f-1)/7);return e===b&&h++,h}function i(a){var b=a.toString(),c="",d=b.indexOf("(");return d>-1&&(c=b.substring(++d,b.indexOf(")"))),c}function j(a,b){return a.replace(/([a-z])\1*/gi,function(a){var c,d=a.charAt(0),e=a.length,f="0?",g="0{0,2}";if("y"===d)c="\\d{2,4}";else if("M"===d)c=e>2?"\\S+?":"1[0-2]|"+f+"[1-9]";else if("D"===d)c="[12][0-9][0-9]|3[0-5][0-9]|36[0-6]|"+g+"[1-9][0-9]|"+f+"[1-9]";else if("d"===d)c="3[01]|[12]\\d|"+f+"[1-9]";else if("w"===d)c="[1-4][0-9]|5[0-3]|"+f+"[1-9]";else if("E"===d)c="\\S+";else if("h"===d)c="1[0-2]|"+f+"[1-9]";else if("K"===d)c="1[01]|"+f+"\\d";else if("H"===d)c="1\\d|2[0-3]|"+f+"\\d";else if("k"===d)c="1\\d|2[0-4]|"+f+"[1-9]";else if("m"===d||"s"===d)c="[0-5]\\d";else if("S"===d)c="\\d{"+e+"}";else if("a"===d){var h="AM",i="PM";c=h+"|"+i,h!==h.toLowerCase()&&(c+="|"+h.toLowerCase()),i!==i.toLowerCase()&&(c+="|"+i.toLowerCase()),c=c.replace(/\./g,"\\.")}else c="v"===d||"z"===d||"Z"===d||"G"===d||"q"===d||"Q"===d?".*":" "===d?"\\s*":d+"*";return b&&b.push(a),"("+c+")"}).replace(/[\xa0 ]/g,"[\\s\\xa0]")}function k(a){B[a+"sFromNow"]=function(b){return A.add(new Date,a,b)},B[a+"sAgo"]=function(b){return A.add(new Date,a,-b)}}for(var l=function(){function a(a,b,c){return a=a.replace(/s$/,""),e.hasOwnProperty(a)?e[a](b,c):[c,"UTC"+a.charAt(0).toUpperCase()+a.substring(1)+"s",!1]}function b(a,b,c,e){return a=a.replace(/s$/,""),d(f[a](b,c,e))}var c=Math.floor,d=Math.round,e={day:function(a,b){return[b,"Date",!1]},weekday:function(a,b){var c,d,e=b%5,f=a.getDay(),g=0;e?(c=e,d=parseInt(b/5,10)):(c=b>0?5:-5,d=b>0?(b-5)/5:(b+5)/5),6===f&&b>0?g=1:0===f&&0>b&&(g=-1);var h=f+c;return(0===h||6===h)&&(g=b>0?2:-2),[7*d+c+g,"Date",!1]},year:function(a,b){return[b,"FullYear",!0]},week:function(a,b){return[7*b,"Date",!1]},quarter:function(a,b){return[3*b,"Month",!0]},month:function(a,b){return[b,"Month",!0]}},f={quarter:function(a,b,d){var e=b.getFullYear()-a.getFullYear(),f=a[d?"getUTCMonth":"getMonth"](),g=b[d?"getUTCMonth":"getMonth"](),h=c(f/3)+1,i=c(g/3)+1;return i+=4*e,i-h},weekday:function(a,c,d){var e,f=b("day",a,c,d),g=f%7;if(0===g)f=5*b("week",a,c,d);else{var h=0,i=a[d?"getUTCDay":"getDay"](),j=c[d?"getUTCDay":"getDay"]();e=parseInt(f/7,10);var k=new Date(+a);k.setDate(k[d?"getUTCDate":"getDate"]()+7*e);var l=k[d?"getUTCDay":"getDay"]();f>0?6===i||6===j?h=-1:0===i?h=0:(0===j||l+g>5)&&(h=-2):0>f&&(6===i?h=0:0===i||0===j?h=1:(6===j||0>l+g)&&(h=2)),f+=h,f-=2*e}return f},year:function(a,b){return b.getFullYear()-a.getFullYear()},month:function(a,b,c){var d=a[c?"getUTCMonth":"getMonth"](),e=b[c?"getUTCMonth":"getMonth"]();return e-d+12*(b.getFullYear()-a.getFullYear())},week:function(a,c,e){return d(b("day",a,c,e)/7)},day:function(a,b){return 1.1574074074074074e-8*(b.getTime()-a.getTime())},hour:function(a,b){return 2.7777777777777776e-7*(b.getTime()-a.getTime())},minute:function(a,b){return 16666666666666667e-21*(b.getTime()-a.getTime())},second:function(a,b){return.001*(b.getTime()-a.getTime())},millisecond:function(a,b){return b.getTime()-a.getTime()}};return{addTransform:a,differenceTransform:b}}(),m=l.addTransform,n=l.differenceTransform,o=Math.floor,p=Math.round,q=Math.min,r=Math.pow,s=Math.ceil,t=Math.abs,u=["January","February","March","April","May","June","July","August","September","October","November","December"],v=["Jan.","Feb.","Mar.","Apr.","May.","Jun.","Jul.","Aug.","Sep.","Oct.","Nov.","Dec."],w=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],x=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],y=["Before Christ","Anno Domini"],z=["BC","AD"],A={getDaysInMonth:function(a){var b=a.getMonth(),c=[31,28,31,30,31,30,31,31,30,31,30,31];return 1===b&&A.isLeapYear(a)?29:c[b]},isLeapYear:function(a,b){var c=a[b?"getUTCFullYear":"getFullYear"]();return 0===c%400||0===c%4&&0!==c%100},isWeekend:function(a,b){var c=(a||new Date)[b?"getUTCDay":"getDay"]();return 0===c||6===c},getTimezoneName:i,compare:function(a,b,c){return a=new Date(+a),b=new Date(+(b||new Date)),"date"===c?(a.setHours(0,0,0,0),b.setHours(0,0,0,0)):"time"===c&&(a.setFullYear(0,0,0),b.setFullYear(0,0,0)),a>b?1:b>a?-1:0},add:function(a,b,c){var d=m(b,a,c||0);c=d[0];var e=d[1],f=new Date(+a),g=d[2];return e&&f["set"+e](f["get"+e]()+c),g&&f.getDate()E?z:y)[0>f?0:1];else if("y"===D)B=f,E>1&&(2===E?B=e(""+B,2,!0):C=!0);else if("Q"===D.toUpperCase())B=s((j+1)/3),C=!0;else if("M"===D)3>E?(B=j+1,C=!0):B=(3===E?v:u)[j];else if("w"===D)B=h(a,0,c),C=!0;else if("D"===D)B=g(a,c),C=!0;else if("E"===D)3>E?(B=k+1,C=!0):B=(-3===E?x:w)[k];else if("a"===D)B=12>m?"AM":"PM";else if("h"===D)B=m%12||12,C=!0;else if("K"===D)B=m%12,C=!0;else if("k"===D)B=m||24,C=!0;else if("S"===D)B=p(A*r(10,E-3)),C=!0;else if("z"===D||"v"===D||"Z"===D){if(B=i(a),"z"!==D&&"v"!==D||B||(E=4),!B||"Z"===D){var F=a.getTimezoneOffset(),G=[F>=0?"-":"+",d(o(t(F)/60),2,"0"),d(t(F)%60,2,"0")];4===E&&(G.splice(0,0,"GMT"),G.splice(3,0,":")),B=G.join("")}}else B=b;else B=""+n,C=!0;else B=""+m,C=!0;return C&&(B=d(B,E,"0")),B})}},B={},C=["year","month","day","hour","minute","second"],D=0,E=C.length;E>D;D++)k(C[D]);var F={parseDate:function(a,b){if(!b)throw new Error("format required when calling dateExtender.parse");var d=[],e=j(b,d),g=new RegExp("^"+e+"$","i"),h=g.exec(a);if(!h)return null;var i=[1970,0,1,0,0,0,0],k="",l=f(h,function(a,b){if(b){var e=d[b-1],f=e.length,g=e.charAt(0);if("y"===g)if(100>a){a=parseInt(a,10);var h=""+(new Date).getFullYear(),j=100*h.substring(0,2),l=q(h.substring(2,4)+20,99);i[0]=l>a?j+a:j-100+a}else i[0]=a;else if("M"===g){if(f>2){var m,n,o=u;3===f&&(o=v),a=a.replace(".","").toLowerCase();var p=!1;for(m=0,n=o.length;n>m&&!p;m++){var r=o[m].replace(".","").toLocaleLowerCase();r===a&&(a=m,p=!0)}if(!p)return!1}else a--;i[1]=a}else if("E"===g||"e"===g){var s=w;3===f&&(s=x),a=a.toLowerCase(),s=c.map(s,function(a){return a.toLowerCase()});var t=c.indexOf(s,a);if(-1===t){if(a=parseInt(a,10),isNaN(a)||a>s.length)return!1}else a=t}else if("D"===g||"d"===g)"D"===g&&(i[1]=0),i[2]=a;else if("a"===g){var y="am",z="pm",A=/\./g;a=a.replace(A,"").toLowerCase(),k=a===z?"p":a===y?"a":""}else"k"===g||"h"===g||"H"===g||"K"===g?("k"===g&&24===+a&&(a=0),i[3]=a):"m"===g?i[4]=a:"s"===g?i[5]=a:"S"===g&&(i[6]=a)}return!0});if(l){var m=+i[3];"p"===k&&12>m?i[3]=m+12:"a"===k&&12===m&&(i[3]=0);var n=new Date(i[0],i[1],i[2],i[3],i[4],i[5],i[6]),o=-1!==c.indexOf(d,"d"),p=-1!==c.indexOf(d,"M"),r=i[1],s=i[2],t=n.getMonth(),y=n.getDate();return p&&t>r||o&&y>s?null:n}return null}},G=a.define(b.isDate,A).define(b.isString,F).define(b.isNumber,B);for(D in A)A.hasOwnProperty(D)&&(G[D]=A[D]);for(D in F)F.hasOwnProperty(D)&&(G[D]=F[D]);for(D in B)B.hasOwnProperty(D)&&(G[D]=B[D]);return G}"undefined"!=typeof c?"undefined"!=typeof b&&b.exports&&(b.exports=d(a("extended"),a("is-extended"),a("array-extended"))):"function"==typeof define&&define.amd?define(["extended","is-extended","array-extended"],function(a,b,c){return d(a,b,c)}):this.dateExtended=d(this.extended,this.isExtended,this.arrayExtended)}.call(this)},{"array-extended":39,extended:43,"is-extended":53}],41:[function(a,b,c){!function(){function a(){function a(a,b){return b=b||0,x.call(a,b)
+}function b(a){return"[object Array]"===Object.prototype.toString.call(a)}function c(a){var b;return null!==a&&a!==b&&"object"==typeof a}function d(a){var b=c(a);return b&&a.constructor===Object}function e(a,b){if(a&&a.length)for(var c=0,d=a.length;d>c;c++)if(a[c]===b)return c;return-1}function f(a,b,c){var d,f;for(d in b)b.hasOwnProperty(d)&&-1===e(c,d)&&(f=b[d],d in a&&a[d]===f||(a[d]=f));return a}function g(a){var c=this.__meta,d=c.supers,e=d.length,f=c.superMeta,g=f.pos;if(e>g){a=a?B(a)||b(a)?a:[a]:[];var h,i=f.name,j=f.f;do if(h=d[g][i],"function"==typeof h&&(h=h._f||h)!==j)return f.pos=1+g,h.apply(this,a);while(e>++g)}return null}function h(){var a=this.__meta,b=a.supers,c=b.length,d=a.superMeta,e=d.pos;if(c>e){var f,g=d.name,h=d.f;do if(f=b[e][g],"function"==typeof f&&(f=f._f||f)!==h)return d.pos=1+e,f.bind(this);while(c>++e)}return null}function i(a){var b=this.__getters__;return b.hasOwnProperty(a)?b[a].apply(this):this[a]}function j(b,c){var e=this.__setters__;if(!d(b))return e.hasOwnProperty(b)?e[b].apply(this,a(arguments,1)):this[b]=c;for(var f in b){var g=b[f];e.hasOwnProperty(f)?e[b].call(this,g):this[f]=g}}function k(){var a=this.__meta||{},b=a.supers,c=b.length,d=a.superMeta,e=d.pos;if(c>e){var f,g=d.name,h=d.f;do if(f=b[e][g],"function"==typeof f&&(f=f._f||f)!==h)return d.pos=1+e,f.apply(this,arguments);while(c>++e)}return null}function l(a,b){if(a.toString().match(A)){var c=function(){var c,d=this.__meta||{},e=d.superMeta;switch(d.superMeta={f:a,pos:0,name:b},arguments.length){case 0:c=a.call(this);break;case 1:c=a.call(this,arguments[0]);break;case 2:c=a.call(this,arguments[0],arguments[1]);break;case 3:c=a.call(this,arguments[0],arguments[1],arguments[2]);break;default:c=a.apply(this,arguments)}return d.superMeta=e,c};return c._f=a,c}return a._f=a,a}function m(a,b){var c=b.setters||{},d=a.__setters__,e=a.__getters__;for(var f in c)d.hasOwnProperty(f)||(d[f]=c[f]);c=b.getters||{};for(f in c)e.hasOwnProperty(f)||(e[f]=c[f]);for(var g in b)if("getters"!==g&&"setters"!==g){var h=b[g];"function"==typeof h?a.hasOwnProperty(g)||(a[g]=l(k,g)):a[g]=h}}function n(){for(var b=a(arguments),c=b.length,d=this.prototype,e=d.__meta,f=this.__meta,g=d.__meta.bases,h=g.slice(),i=f.supers||[],j=e.supers||[],k=0;c>k;k++){var l=b[k],n=l.prototype,p=n.__meta,q=l.__meta;!p&&(p=n.__meta={proto:n||{}}),!q&&(q=l.__meta={proto:l.__proto__||{}}),m(d,p.proto||{}),m(this,q.proto||{}),o(l.prototype,j,g),o(l,i,h)}return this}function o(a,b,c){var d=a.__meta;!d&&(d=a.__meta={});var f=a.__meta.unique;if(!f&&(d.unique="declare"+ ++y),-1===e(c,f)){c.push(f);for(var g=a.__meta.supers||[],h=g.length-1||0;h>=0;)o(g[h--],b,c);b.unshift(a)}}function p(a,b){var c=b.setters,d=a.__setters__,e=a.__getters__;if(c)for(var f in c)d[f]=c[f];if(c=b.getters||{})for(f in c)e[f]=c[f];for(f in b)if("getters"!=f&&"setters"!=f){var g=b[f];if("function"==typeof g){var h=g.__meta||{};a[f]=h.isConstructor?g:l(g,f)}else a[f]=g}}function q(a,b){return a&&b?a[b]=this:a.exports=a=this,this}function r(a){return u(this,a)}function s(a){z.prototype=a.prototype;var b=new z;return z.prototype=null,b}function t(a,c,e){var i={},j=[],m="declare"+ ++y,q=[],r=[],t=[],u=[],v={supers:t,unique:m,bases:q,superMeta:{f:null,pos:0,name:null}},x={supers:u,unique:m,bases:r,isConstructor:!0,superMeta:{f:null,pos:0,name:null}};if(d(c)&&!e&&(e=c,c=w),"function"==typeof c||b(c)?(j=b(c)?c:[c],c=j.shift(),a.__meta=x,i=s(c),i.__meta=v,i.__getters__=f({},i.__getters__||{}),i.__setters__=f({},i.__setters__||{}),a.__getters__=f({},a.__getters__||{}),a.__setters__=f({},a.__setters__||{}),o(c.prototype,t,q),o(c,u,r)):(a.__meta=x,i.__meta=v,i.__getters__=i.__getters__||{},i.__setters__=i.__setters__||{},a.__getters__=a.__getters__||{},a.__setters__=a.__setters__||{}),a.prototype=i,e){var z=v.proto=e.instance||{},A=x.proto=e.static||{};A.init=A.init||k,p(i,z),p(a,A),i.constructor=z.hasOwnProperty("constructor")?l(z.constructor,"constructor"):z.constructor=l(k,"constructor")}else v.proto={},x.proto={},a.init=l(k,"init"),i.constructor=l(k,"constructor");j.length&&n.apply(a,j),c&&f(a,f(f({},c),a)),i._super=a._super=g,i._getSuper=a._getSuper=h,i._static=a}function u(a,b){function c(){switch(arguments.length){case 0:this.constructor.call(this);break;case 1:this.constructor.call(this,arguments[0]);break;case 2:this.constructor.call(this,arguments[0],arguments[1]);break;case 3:this.constructor.call(this,arguments[0],arguments[1],arguments[2]);break;default:this.constructor.apply(this,arguments)}}return t(c,a,b),c.init()||c}function v(a,b){function c(){return d||(this.constructor.apply(this,arguments),d=this),d}var d;return t(c,a,b),c.init()||c}var w,x=Array.prototype.slice,y=0,z=new Function,A=/(super)/g,B=function(a){return"[object Arguments]"===Object.prototype.toString.call(a)};return B(arguments)||(B=function(a){return!(!a||!a.hasOwnProperty("callee"))}),w=u({instance:{get:i,set:j},"static":{get:i,set:j,mixin:n,extend:r,as:q}}),u.singleton=v,u}"undefined"!=typeof c?"undefined"!=typeof b&&b.exports&&(b.exports=a()):"function"==typeof define&&define.amd?define(a):this.declare=a()}()},{}],42:[function(a,b){b.exports=a("./declare.js")},{"./declare.js":41}],43:[function(a,b,c){!function(){"use strict";function d(a){function b(){var b=a.define();return b.expose({register:function(a,c){c||(c=a,a=null);var d=typeof c;if(a)b[a]=c;else if(c&&"function"===d)b.extend(c);else{if("object"!==d)throw new TypeError("extended.register must be called with an extender function");b.expose(c)}return b},define:function(){return a.define.apply(a,arguments)}}),b}function c(){return b()}return function(){function a(a,b){var c,d;for(c in b)b.hasOwnProperty(c)&&(d=b[c],c in a&&a[c]===d||(a[c]=d));return a}return function(b){b||(b={});for(var c=1,d=arguments.length;d>c;c++)a(b,arguments[c]);return b}}(),c.define=function(){return a.define.apply(a,arguments)},c}"undefined"!=typeof c?"undefined"!=typeof b&&b.exports&&(b.exports=d(a("extender"))):"function"==typeof define&&define.amd?define(["extender"],function(a){return d(a)}):this.extended=d(this.extender)}.call(this)},{extender:45}],44:[function(a,b,c){!function(){function d(a){function b(a,b){if(a&&a.length)for(var c=0,d=a.length;d>c;c++)if(a[c]===b)return c;return-1}function c(a){return"[object Array]"===Object.prototype.toString.call(a)}function d(b){function c(a,b,c){if("function"!=typeof c)throw new TypeError("when extending type you must provide a function");var d;d="constructor"===b?function(){this._super(arguments),c.apply(this,arguments)}:function(){var a=f.call(arguments);a.unshift(this._value);var b=c.apply(this,a);return b!==e?this.__extender__(b):this},a[b]=d}function d(a,b,c){if("function"!=typeof c)throw new TypeError("when extending type you must provide a function");var d;d="constructor"===b?function(){this._super(arguments),c.apply(this,arguments)}:function(){var a=f.call(arguments);return a.unshift(this._value),c.apply(this,a)},a[b]=d}function h(a,b,e){for(var f in b)b.hasOwnProperty(f)&&("getters"!==f&&"setters"!==f?"noWrap"===f?h(a,b[f],!0):e?d(a,f,b[f]):c(a,f,b[f]):a[f]=b[f])}function i(a){var b,c,d=a;if(!(a instanceof m)){var e=m;for(b=0,c=n.length;c>b;b++){var f=n[b];f[0](a)&&(e=e.extend({instance:f[1]}))}d=new e(a),d.__extender__=i}return d}function j(){return!0}function k(a,b){if(arguments.length){"object"==typeof a&&(b=a,a=j),b=b||{};var d={};h(d,b),d.hasOwnProperty("constructor")||(b.hasOwnProperty("constructor")?c(d,"constructor",b.constructor):d.constructor=function(){this._super(arguments)}),n.push([a,d])}return i}function l(a){return a&&a.hasOwnProperty("__defined__")&&(i.__defined__=n=n.concat(a.__defined__)),g(i,a,["define","extend","expose","__defined__"]),i}b=b||[];var m=a({instance:{constructor:function(a){this._value=a},value:function(){return this._value},eq:function(a){return this.__extender__(this._value===a)},neq:function(a){return this.__extender__(this._value!==a)},print:function(){return console.log(this._value),this}}}),n=[];return i.define=k,i.extend=l,i.expose=function(){for(var a,b=0,c=arguments.length;c>b;b++)a=arguments[b],"object"==typeof a&&g(i,a,["define","extend","expose","__defined__"]);return i},i.__defined__=n,i}var e,f=Array.prototype.slice,g=function(){function a(a,c,d){var e,f;for(e in c)c.hasOwnProperty(e)&&-1===b(d,e)&&(f=c[e],e in a&&a[e]===f||(a[e]=f));return a}return function(b){b||(b={});var d=arguments.length,e=arguments[arguments.length-1];c(e)?d--:e=[];for(var f=1;d>f;f++)a(b,arguments[f],e);return b}}();return{define:function(){return d().define.apply(d,arguments)},extend:function(a){return d().define().extend(a)}}}"undefined"!=typeof c?"undefined"!=typeof b&&b.exports&&(b.exports=d(a("declare.js"))):"function"==typeof define&&define.amd?define(["declare"],function(a){return d(a)}):this.extender=d(this.declare)}.call(this)},{"declare.js":42}],45:[function(a,b){b.exports=a("./extender.js")},{"./extender.js":44}],46:[function(a,b,c){!function(){"use strict";function d(a,b,c){function d(a,b,c){if(c=o(arguments,2),m(b)&&!(b in a))throw new Error(b+" property not defined in scope");if(!m(b)&&!n(b))throw new Error(b+" is not a function");return m(b)?function(){var d=a[b];if(n(d)){var e=c.concat(o(arguments));return d.apply(a,e)}return d}:c.length?function(){var d=c.concat(o(arguments));return b.apply(a,d)}:function(){return b.apply(a,arguments)}}function e(a,b){if(b=o(arguments,1),!m(a)&&!n(a))throw new Error(a+" must be the name of a property or function to execute");return m(a)?function(){var c=o(arguments),d=c.shift(),e=d[a];return n(e)?(c=b.concat(c),e.apply(d,c)):e}:function(){var c=o(arguments),d=c.shift();return c=b.concat(c),a.apply(d,c)}}function f(a,b,c){if(c=o(arguments,2),m(b)&&!(b in a))throw new Error(b+" property not defined in scope");if(!m(b)&&!n(b))throw new Error(b+" is not a function");return m(b)?function(){var d=a[b];return n(d)?d.apply(a,c):d}:function(){return b.apply(a,c)}}function g(a){var b=o(arguments,1);if(!l(a)&&!n(a))throw new TypeError("scope must be an object");if(1===b.length&&k(b[0])&&(b=b[0]),!b.length){b=[];for(var c in a)a.hasOwnProperty(c)&&n(a[c])&&b.push(c)}for(var e=0,f=b.length;f>e;e++)a[b[e]]=d(a,a[b[e]]);return a}function h(a,b){if(b=o(arguments,1),!m(a)&&!n(a))throw new Error(a+" must be the name of a property or function to execute");return m(a)?function(){var c=this[a];if(n(c)){var d=b.concat(o(arguments));return c.apply(this,d)}return c}:function(){var c=b.concat(o(arguments));return a.apply(this,c)}}function i(a,b){return function(){var c=o(arguments);return b?a.apply(this,arguments):function(){return a.apply(this,c.concat(o(arguments)))}}}function j(a,b,c){var e;if(e=c?d(c,b):b,a)for(var f=a-1,g=f;g>=0;g--)e=i(e,g===f);return e}var k=b.isArray,l=b.isObject,m=b.isString,n=b.isFunction,o=c.argsToArray;return a.define(l,{bind:d,bindAll:g,bindIgnore:f,curry:function(a,b,c){return j(b,c,a)}}).define(n,{bind:function(a,b){return d.apply(this,[b,a].concat(o(arguments,2)))},bindIgnore:function(a,b){return f.apply(this,[b,a].concat(o(arguments,2)))},partial:h,applyFirst:e,curry:function(a,b,c){return j(b,a,c)},noWrap:{f:function(){return this.value()}}}).define(m,{bind:function(a,b){return d(b,a)},bindIgnore:function(a,b){return f(b,a)},partial:h,applyFirst:e,curry:function(a,b,c){return j(b,a,c)}}).expose({bind:d,bindAll:g,bindIgnore:f,partial:h,applyFirst:e,curry:j})}"undefined"!=typeof c?"undefined"!=typeof b&&b.exports&&(b.exports=d(a("extended"),a("is-extended"),a("arguments-extended"))):"function"==typeof define&&define.amd?define(["extended","is-extended","arguments-extended"],function(a,b,c){return d(a,b,c)}):this.functionExtended=d(this.extended,this.isExtended,this.argumentsExtended)}.call(this)},{"arguments-extended":38,extended:43,"is-extended":53}],47:[function(a,b,c){function d(a,b){if(a.indexOf)return a.indexOf(b);for(var c=0;ce;e++)d[e].apply(this,c);return!0}return!1},f.prototype.addListener=function(a,b){if("function"!=typeof b)throw new Error("addListener only takes instances of Function");if(this._events||(this._events={}),this.emit("newListener",a,b),this._events[a])if(g(this._events[a])){if(!this._events[a].warned){var c;c=void 0!==this._events.maxListeners?this._events.maxListeners:h,c&&c>0&&this._events[a].length>c&&(this._events[a].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[a].length),console.trace())}this._events[a].push(b)}else this._events[a]=[this._events[a],b];else this._events[a]=b;return this},f.prototype.on=f.prototype.addListener,f.prototype.once=function(a,b){var c=this;return c.on(a,function d(){c.removeListener(a,d),b.apply(this,arguments)}),this},f.prototype.removeListener=function(a,b){if("function"!=typeof b)throw new Error("removeListener only takes instances of Function");if(!this._events||!this._events[a])return this;var c=this._events[a];if(g(c)){var e=d(c,b);if(0>e)return this;c.splice(e,1),0==c.length&&delete this._events[a]}else this._events[a]===b&&delete this._events[a];return this},f.prototype.removeAllListeners=function(a){return 0===arguments.length?(this._events={},this):(a&&this._events&&this._events[a]&&(this._events[a]=null),this)},f.prototype.listeners=function(a){return this._events||(this._events={}),this._events[a]||(this._events[a]=[]),g(this._events[a])||(this._events[a]=[this._events[a]]),this._events[a]},f.listenerCount=function(a,b){var c;return c=a._events&&a._events[b]?"function"==typeof a._events[b]?1:a._events[b].length:0}},{__browserify_process:51}],48:[function(){},{}],49:[function(a,b,c){function d(a,b){for(var c=[],d=0;d=0;d--){var e=a[d];"."==e?a.splice(d,1):".."===e?(a.splice(d,1),c++):c&&(a.splice(d,1),c--)}if(b)for(;c--;c)a.unshift("..");return a}var f=a("__browserify_process"),g=/^(.+\/(?!$)|\/)?((?:.+?)?(\.[^.]*)?)$/;c.resolve=function(){for(var a="",b=!1,c=arguments.length;c>=-1&&!b;c--){var g=c>=0?arguments[c]:f.cwd();"string"==typeof g&&g&&(a=g+"/"+a,b="/"===g.charAt(0))}return a=e(d(a.split("/"),function(a){return!!a}),!b).join("/"),(b?"/":"")+a||"."},c.normalize=function(a){var b="/"===a.charAt(0),c="/"===a.slice(-1);return a=e(d(a.split("/"),function(a){return!!a}),!b).join("/"),a||b||(a="."),a&&c&&(a+="/"),(b?"/":"")+a},c.join=function(){var a=Array.prototype.slice.call(arguments,0);return c.normalize(d(a,function(a){return a&&"string"==typeof a}).join("/"))},c.dirname=function(a){var b=g.exec(a)[1]||"",c=!1;return b?1===b.length||c&&b.length<=3&&":"===b.charAt(1)?b:b.substring(0,b.length-1):"."},c.basename=function(a,b){var c=g.exec(a)[2]||"";return b&&c.substr(-1*b.length)===b&&(c=c.substr(0,c.length-b.length)),c},c.extname=function(a){return g.exec(a)[3]||""},c.relative=function(a,b){function d(a){for(var b=0;b=0&&""===a[c];c--);return b>c?[]:a.slice(b,c-b+1)}a=c.resolve(a).substr(1),b=c.resolve(b).substr(1);for(var e=d(a.split("/")),f=d(b.split("/")),g=Math.min(e.length,f.length),h=g,i=0;g>i;i++)if(e[i]!==f[i]){h=i;break}for(var j=[],i=h;i=0;e--)if(f[e]!=g[e])return!1;for(e=f.length-1;e>=0;e--)if(d=f[e],!h(a[d],b[d]))return!1;return!0}function l(a,b){return a&&b?b instanceof RegExp?b.test(a):a instanceof b?!0:b.call({},a)===!0?!0:!1:!1}function m(a,b,c,d){var e;"string"==typeof c&&(d=c,c=null);try{b()}catch(g){e=g}if(d=(c&&c.name?" ("+c.name+").":".")+(d?" "+d:"."),a&&!e&&f("Missing expected exception"+d),!a&&l(e,c)&&f("Got unwanted exception"+d),a&&e&&c&&!l(e,c)||!a&&e)throw e}var n=a("util"),o=a("buffer").Buffer,p=Array.prototype.slice,q=b.exports=g;q.AssertionError=function(a){this.name="AssertionError",this.message=a.message,this.actual=a.actual,this.expected=a.expected,this.operator=a.operator;var b=a.stackStartFunction||f;Error.captureStackTrace&&Error.captureStackTrace(this,b)},n.inherits(q.AssertionError,Error),q.AssertionError.prototype.toString=function(){return this.message?[this.name+":",this.message].join(" "):[this.name+":",e(JSON.stringify(this.actual,d),128),this.operator,e(JSON.stringify(this.expected,d),128)].join(" ")},q.AssertionError.__proto__=Error.prototype,q.fail=f,q.ok=g,q.equal=function(a,b,c){a!=b&&f(a,b,c,"==",q.equal)},q.notEqual=function(a,b,c){a==b&&f(a,b,c,"!=",q.notEqual)},q.deepEqual=function(a,b,c){h(a,b)||f(a,b,c,"deepEqual",q.deepEqual)},q.notDeepEqual=function(a,b,c){h(a,b)&&f(a,b,c,"notDeepEqual",q.notDeepEqual)},q.strictEqual=function(a,b,c){a!==b&&f(a,b,c,"===",q.strictEqual)},q.notStrictEqual=function(a,b,c){a===b&&f(a,b,c,"!==",q.notStrictEqual)},q.throws=function(){m.apply(this,[!0].concat(p.call(arguments)))},q.doesNotThrow=function(){m.apply(this,[!1].concat(p.call(arguments)))},q.ifError=function(a){if(a)throw a}},{util:2,buffer:3}],2:[function(a,b,c){function d(a){return a instanceof Array||Array.isArray(a)||a&&a!==Object.prototype&&d(a.__proto__)}function e(a){return a instanceof RegExp||"object"==typeof a&&"[object RegExp]"===Object.prototype.toString.call(a)}function f(a){if(a instanceof Date)return!0;if("object"!=typeof a)return!1;var b=Date.prototype&&h(Date.prototype),c=a.__proto__&&h(a.__proto__);return JSON.stringify(c)===JSON.stringify(b)}a("events"),c.isArray=d,c.isDate=function(a){return"[object Date]"===Object.prototype.toString.call(a)},c.isRegExp=function(a){return"[object RegExp]"===Object.prototype.toString.call(a)},c.print=function(){},c.puts=function(){},c.debug=function(){},c.inspect=function(a,b,i,j){function k(a,i){if(a&&"function"==typeof a.inspect&&a!==c&&(!a.constructor||a.constructor.prototype!==a))return a.inspect(i);switch(typeof a){case"undefined":return m("undefined","undefined");case"string":var j="'"+JSON.stringify(a).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return m(j,"string");case"number":return m(""+a,"number");case"boolean":return m(""+a,"boolean")}if(null===a)return m("null","null");var n=g(a),o=b?h(a):n;if("function"==typeof a&&0===o.length){if(e(a))return m(""+a,"regexp");var p=a.name?": "+a.name:"";return m("[Function"+p+"]","special")}if(f(a)&&0===o.length)return m(a.toUTCString(),"date");var q,r,s;if(d(a)?(r="Array",s=["[","]"]):(r="Object",s=["{","}"]),"function"==typeof a){var t=a.name?": "+a.name:"";q=e(a)?" "+a:" [Function"+t+"]"}else q="";if(f(a)&&(q=" "+a.toUTCString()),0===o.length)return s[0]+q+s[1];if(0>i)return e(a)?m(""+a,"regexp"):m("[Object]","special");l.push(a);var u=o.map(function(b){var c,e;if(a.__lookupGetter__&&(a.__lookupGetter__(b)?e=a.__lookupSetter__(b)?m("[Getter/Setter]","special"):m("[Getter]","special"):a.__lookupSetter__(b)&&(e=m("[Setter]","special"))),n.indexOf(b)<0&&(c="["+b+"]"),e||(l.indexOf(a[b])<0?(e=null===i?k(a[b]):k(a[b],i-1),e.indexOf("\n")>-1&&(e=d(a)?e.split("\n").map(function(a){return" "+a}).join("\n").substr(2):"\n"+e.split("\n").map(function(a){return" "+a}).join("\n"))):e=m("[Circular]","special")),"undefined"==typeof c){if("Array"===r&&b.match(/^\d+$/))return e;c=JSON.stringify(""+b),c.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(c=c.substr(1,c.length-2),c=m(c,"name")):(c=c.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),c=m(c,"string"))}return c+": "+e});l.pop();var v=0,w=u.reduce(function(a,b){return v++,b.indexOf("\n")>=0&&v++,a+b.length+1},0);return u=w>50?s[0]+(""===q?"":q+"\n ")+" "+u.join(",\n ")+" "+s[1]:s[0]+q+" "+u.join(", ")+" "+s[1]}var l=[],m=function(a,b){var c={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]},d={special:"cyan",number:"blue","boolean":"yellow",undefined:"grey","null":"bold",string:"green",date:"magenta",regexp:"red"}[b];return d?"["+c[d][0]+"m"+a+"["+c[d][1]+"m":a};return j||(m=function(a){return a}),k(a,"undefined"==typeof i?2:i)},c.log=function(){},c.pump=null;var g=Object.keys||function(a){var b=[];for(var c in a)b.push(c);return b},h=Object.getOwnPropertyNames||function(a){var b=[];for(var c in a)Object.hasOwnProperty.call(a,c)&&b.push(c);return b},i=Object.create||function(a,b){var c;if(null===a)c={__proto__:null};else{if("object"!=typeof a)throw new TypeError("typeof prototype["+typeof a+"] != 'object'");var d=function(){};d.prototype=a,c=new d,c.__proto__=a}return"undefined"!=typeof b&&Object.defineProperties&&Object.defineProperties(c,b),c};c.inherits=function(a,b){a.super_=b,a.prototype=i(b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}})};var j=/%[sdj%]/g;c.format=function(a){if("string"!=typeof a){for(var b=[],d=0;d=f)return a;switch(a){case"%s":return String(e[d++]);case"%d":return Number(e[d++]);case"%j":return JSON.stringify(e[d++]);default:return a}}),h=e[d];f>d;h=e[++d])g+=null===h||"object"!=typeof h?" "+h:" "+c.inspect(h);return g}},{events:4}],5:[function(a,b,c){c.readIEEE754=function(a,b,c,d,e){var f,g,h=8*e-d-1,i=(1<>1,k=-7,l=c?0:e-1,m=c?1:-1,n=a[b+l];for(l+=m,f=n&(1<<-k)-1,n>>=-k,k+=h;k>0;f=256*f+a[b+l],l+=m,k-=8);for(g=f&(1<<-k)-1,f>>=-k,k+=d;k>0;g=256*g+a[b+l],l+=m,k-=8);if(0===f)f=1-j;else{if(f===i)return g?0/0:1/0*(n?-1:1);g+=Math.pow(2,d),f-=j}return(n?-1:1)*g*Math.pow(2,f-d)},c.writeIEEE754=function(a,b,c,d,e,f){var g,h,i,j=8*f-e-1,k=(1<>1,m=23===e?Math.pow(2,-24)-Math.pow(2,-77):0,n=d?f-1:0,o=d?-1:1,p=0>b||0===b&&0>1/b?1:0;for(b=Math.abs(b),isNaN(b)||1/0===b?(h=isNaN(b)?1:0,g=k):(g=Math.floor(Math.log(b)/Math.LN2),b*(i=Math.pow(2,-g))<1&&(g--,i*=2),b+=g+l>=1?m/i:m*Math.pow(2,1-l),b*i>=2&&(g++,i/=2),g+l>=k?(h=0,g=k):g+l>=1?(h=(b*i-1)*Math.pow(2,e),g+=l):(h=b*Math.pow(2,l-1)*Math.pow(2,e),g=0));e>=8;a[c+n]=255&h,n+=o,h/=256,e-=8);for(g=g<0;a[c+n]=255&g,n+=o,g/=256,j-=8);a[c+n-o]|=128*p}},{}],6:[function(a,b){var c=b.exports={};c.nextTick=function(){var a="undefined"!=typeof window&&window.setImmediate,b="undefined"!=typeof window&&window.postMessage&&window.addEventListener;if(a)return function(a){return window.setImmediate(a)};if(b){var c=[];return window.addEventListener("message",function(a){if(a.source===window&&"process-tick"===a.data&&(a.stopPropagation(),c.length>0)){var b=c.shift();b()}},!0),function(a){c.push(a),window.postMessage("process-tick","*")}}return function(a){setTimeout(a,0)}}(),c.title="browser",c.browser=!0,c.env={},c.argv=[],c.binding=function(){throw new Error("process.binding is not supported")},c.cwd=function(){return"/"},c.chdir=function(){throw new Error("process.chdir is not supported")}},{}],4:[function(a,b,c){!function(a){function b(a,b){if(a.indexOf)return a.indexOf(b);for(var c=0;cf;f++)d[f].apply(this,c);return!0}return!1},d.prototype.addListener=function(a,b){if("function"!=typeof b)throw new Error("addListener only takes instances of Function");if(this._events||(this._events={}),this.emit("newListener",a,b),this._events[a])if(e(this._events[a])){if(!this._events[a].warned){var c;c=void 0!==this._events.maxListeners?this._events.maxListeners:f,c&&c>0&&this._events[a].length>c&&(this._events[a].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[a].length),console.trace())}this._events[a].push(b)}else this._events[a]=[this._events[a],b];else this._events[a]=b;return this},d.prototype.on=d.prototype.addListener,d.prototype.once=function(a,b){var c=this;return c.on(a,function d(){c.removeListener(a,d),b.apply(this,arguments)}),this},d.prototype.removeListener=function(a,c){if("function"!=typeof c)throw new Error("removeListener only takes instances of Function");if(!this._events||!this._events[a])return this;var d=this._events[a];if(e(d)){var f=b(d,c);if(0>f)return this;d.splice(f,1),0==d.length&&delete this._events[a]}else this._events[a]===c&&delete this._events[a];return this},d.prototype.removeAllListeners=function(a){return 0===arguments.length?(this._events={},this):(a&&this._events&&this._events[a]&&(this._events[a]=null),this)},d.prototype.listeners=function(a){return this._events||(this._events={}),this._events[a]||(this._events[a]=[]),e(this._events[a])||(this._events[a]=[this._events[a]]),this._events[a]}}(a("__browserify_process"))},{__browserify_process:6}],"buffer-browserify":[function(a,b){b.exports=a("q9TxCC")},{}],q9TxCC:[function(a,b,c){function d(a){this.length=a}function e(a){return 16>a?"0"+a.toString(16):a.toString(16)}function f(a){for(var b=[],c=0;ce&&!(e+c>=b.length||e>=a.length);)b[e+c]=a[e],e++;return e}function j(a){try{return decodeURIComponent(a)}catch(b){return String.fromCharCode(65533)}}function k(a){return a=~~Math.ceil(+a),0>a?0:a}function l(a,b,c){if(!(this instanceof l))return new l(a,b,c);var e;if("number"==typeof c)this.length=k(b),this.parent=a,this.offset=c;else{switch(e=typeof a){case"number":this.length=k(a);break;case"string":this.length=l.byteLength(a,b);break;case"object":this.length=k(a.length);break;default:throw new Error("First argument needs to be a number, array or string.")}if(this.length>l.poolSize?(this.parent=new d(this.length),this.offset=0):((!E||E.length-E.used=a.length?0:(c?(e=a.parent[a.offset+b]<<8,b+1=a.length?0:(c?(b+1>>0):(b+2>>0)),e)}function q(a,b,c,d){var e,f;return d||(D.ok("boolean"==typeof c,"missing or invalid endian"),D.ok(void 0!==b&&null!==b,"missing offset"),D.ok(b+1=0,"specified a negative value for writing an unsigned value"),D.ok(b>=a,"value is larger than maximum value for type"),D.ok(Math.floor(a)===a,"value has a fractional component")}function v(a,b,c,d,e){e||(D.ok(void 0!==b&&null!==b,"missing value"),D.ok("boolean"==typeof d,"missing or invalid endian"),D.ok(void 0!==c&&null!==c,"missing offset"),D.ok(c+1>>8*(d?1-f:f)}function w(a,b,c,d,e){e||(D.ok(void 0!==b&&null!==b,"missing value"),D.ok("boolean"==typeof d,"missing or invalid endian"),D.ok(void 0!==c&&null!==c,"missing offset"),D.ok(c+3>>8*(d?3-f:f)}function x(a,b,c){D.ok("number"==typeof a,"cannot write a non-number as a number"),D.ok(b>=a,"value larger than maximum allowed value"),D.ok(a>=c,"value smaller than minimum allowed value"),D.ok(Math.floor(a)===a,"value has a fractional component")}function y(a,b,c){D.ok("number"==typeof a,"cannot write a non-number as a number"),D.ok(b>=a,"value larger than maximum allowed value"),D.ok(a>=c,"value smaller than minimum allowed value")}function z(a,b,c,d,e){e||(D.ok(void 0!==b&&null!==b,"missing value"),D.ok("boolean"==typeof d,"missing or invalid endian"),D.ok(void 0!==c&&null!==c,"missing offset"),D.ok(c+1=0?v(a,b,c,d,e):v(a,65535+b+1,c,d,e)}function A(a,b,c,d,e){e||(D.ok(void 0!==b&&null!==b,"missing value"),D.ok("boolean"==typeof d,"missing or invalid endian"),D.ok(void 0!==c&&null!==c,"missing offset"),D.ok(c+3=0?w(a,b,c,d,e):w(a,4294967295+b+1,c,d,e)}function B(b,c,d,e,f){f||(D.ok(void 0!==c&&null!==c,"missing value"),D.ok("boolean"==typeof e,"missing or invalid endian"),D.ok(void 0!==d&&null!==d,"missing offset"),D.ok(d+3d;d++)if(a[d]=e(this[d]),d==c.INSPECT_MAX_BYTES){a[d+1]="...";break}return""},d.prototype.hexSlice=function(a,b){var c=this.length;(!a||0>a)&&(a=0),(!b||0>b||b>c)&&(b=c);for(var d="",f=a;b>f;f++)d+=e(this[f]);return d},d.prototype.toString=function(a,b,c){if(a=String(a||"utf8").toLowerCase(),b=+b||0,"undefined"==typeof c&&(c=this.length),+c==b)return"";switch(a){case"hex":return this.hexSlice(b,c);case"utf8":case"utf-8":return this.utf8Slice(b,c);case"ascii":return this.asciiSlice(b,c);case"binary":return this.binarySlice(b,c);case"base64":return this.base64Slice(b,c);case"ucs2":case"ucs-2":return this.ucs2Slice(b,c);default:throw new Error("Unknown encoding")}},d.prototype.hexWrite=function(a,b,c){b=+b||0;var e=this.length-b;c?(c=+c,c>e&&(c=e)):c=e;var f=a.length;if(f%2)throw new Error("Invalid hex string");c>f/2&&(c=f/2);for(var g=0;c>g;g++){var h=parseInt(a.substr(2*g,2),16);if(isNaN(h))throw new Error("Invalid hex string");this[b+g]=h}return d._charsWritten=2*g,g},d.prototype.write=function(a,b,c,d){if(isFinite(b))isFinite(c)||(d=c,c=void 0);else{var e=d;d=b,b=c,c=e}b=+b||0;var f=this.length-b;switch(c?(c=+c,c>f&&(c=f)):c=f,d=String(d||"utf8").toLowerCase()){case"hex":return this.hexWrite(a,b,c);case"utf8":case"utf-8":return this.utf8Write(a,b,c);case"ascii":return this.asciiWrite(a,b,c);case"binary":return this.binaryWrite(a,b,c);case"base64":return this.base64Write(a,b,c);case"ucs2":case"ucs-2":return this.ucs2Write(a,b,c);default:throw new Error("Unknown encoding")}},d.prototype.slice=function(a,b){if(void 0===b&&(b=this.length),b>this.length)throw new Error("oob");if(a>b)throw new Error("oob");return new l(this,b-a,+a)},d.prototype.copy=function(a,b,c,d){for(var e=[],f=c;d>f;f++)D.ok("undefined"!=typeof this[f],"copying undefined buffer bytes!"),e.push(this[f]);for(var f=b;fthis.length)throw new Error("oob");if(b>c)throw new Error("oob");for(var d=b;c>d;d++)this[d]=a},c.SlowBuffer=d,c.Buffer=l,l.poolSize=8192;var E;l.isBuffer=function(a){return a instanceof l||a instanceof d},l.concat=function(a,b){if(!Array.isArray(a))throw new Error("Usage: Buffer.concat(list, [totalLength])\n list should be an Array.");if(0===a.length)return new l(0);if(1===a.length)return a[0];if("number"!=typeof b){b=0;for(var c=0;cd;d++)if(a[d]=e(this.parent[d+this.offset]),d==c.INSPECT_MAX_BYTES){a[d+1]="...";break}return""},l.prototype.get=function(a){if(0>a||a>=this.length)throw new Error("oob");return this.parent[this.offset+a]},l.prototype.set=function(a,b){if(0>a||a>=this.length)throw new Error("oob");return this.parent[this.offset+a]=b},l.prototype.write=function(a,b,c,e){if(isFinite(b))isFinite(c)||(e=c,c=void 0);else{var f=e;e=b,b=c,c=f}b=+b||0;var g=this.length-b;c?(c=+c,c>g&&(c=g)):c=g,e=String(e||"utf8").toLowerCase();var h;switch(e){case"hex":h=this.parent.hexWrite(a,this.offset+b,c);break;case"utf8":case"utf-8":h=this.parent.utf8Write(a,this.offset+b,c);break;case"ascii":h=this.parent.asciiWrite(a,this.offset+b,c);break;case"binary":h=this.parent.binaryWrite(a,this.offset+b,c);break;case"base64":h=this.parent.base64Write(a,this.offset+b,c);break;case"ucs2":case"ucs-2":h=this.parent.ucs2Write(a,this.offset+b,c);break;default:throw new Error("Unknown encoding")}return l._charsWritten=d._charsWritten,h},l.prototype.toString=function(a,b,c){switch(a=String(a||"utf8").toLowerCase(),"undefined"==typeof b||0>b?b=0:b>this.length&&(b=this.length),"undefined"==typeof c||c>this.length?c=this.length:0>c&&(c=0),b+=this.offset,c+=this.offset,a){case"hex":return this.parent.hexSlice(b,c);case"utf8":case"utf-8":return this.parent.utf8Slice(b,c);case"ascii":return this.parent.asciiSlice(b,c);case"binary":return this.parent.binarySlice(b,c);case"base64":return this.parent.base64Slice(b,c);case"ucs2":case"ucs-2":return this.parent.ucs2Slice(b,c);default:throw new Error("Unknown encoding")}},l.byteLength=d.byteLength,l.prototype.fill=function(a,b,c){if(a||(a=0),b||(b=0),c||(c=this.length),"string"==typeof a&&(a=a.charCodeAt(0)),"number"!=typeof a||isNaN(a))throw new Error("value is not a number");if(b>c)throw new Error("end < start");if(c===b)return 0;if(0==this.length)return 0;if(0>b||b>=this.length)throw new Error("start out of bounds");if(0>c||c>this.length)throw new Error("end out of bounds");return this.parent.fill(a,b+this.offset,c+this.offset)},l.prototype.copy=function(a,b,c,d){var e=this;if(c||(c=0),d||(d=this.length),b||(b=0),c>d)throw new Error("sourceEnd < sourceStart");if(d===c)return 0;if(0==a.length||0==e.length)return 0;if(0>b||b>=a.length)throw new Error("targetStart out of bounds");if(0>c||c>=e.length)throw new Error("sourceStart out of bounds");if(0>d||d>e.length)throw new Error("sourceEnd out of bounds");return d>this.length&&(d=this.length),a.length-bthis.length)throw new Error("oob");if(a>b)throw new Error("oob");return new l(this.parent,b-a,+a+this.offset)},l.prototype.utf8Slice=function(a,b){return this.toString("utf8",a,b)},l.prototype.binarySlice=function(a,b){return this.toString("binary",a,b)},l.prototype.asciiSlice=function(a,b){return this.toString("ascii",a,b)},l.prototype.utf8Write=function(a,b){return this.write(a,b,"utf8")},l.prototype.binaryWrite=function(a,b){return this.write(a,b,"binary")},l.prototype.asciiWrite=function(a,b){return this.write(a,b,"ascii")},l.prototype.readUInt8=function(a,b){var c=this;return b||(D.ok(void 0!==a&&null!==a,"missing offset"),D.ok(a=c.length?void 0:c.parent[c.offset+a]},l.prototype.readUInt16LE=function(a,b){return o(this,a,!1,b)},l.prototype.readUInt16BE=function(a,b){return o(this,a,!0,b)},l.prototype.readUInt32LE=function(a,b){return p(this,a,!1,b)},l.prototype.readUInt32BE=function(a,b){return p(this,a,!0,b)},l.prototype.readInt8=function(a,b){var c,d=this;return b||(D.ok(void 0!==a&&null!==a,"missing offset"),D.ok(a=d.length?void 0:(c=128&d.parent[d.offset+a],c?-1*(255-d.parent[d.offset+a]+1):d.parent[d.offset+a])},l.prototype.readInt16LE=function(a,b){return q(this,a,!1,b)},l.prototype.readInt16BE=function(a,b){return q(this,a,!0,b)},l.prototype.readInt32LE=function(a,b){return r(this,a,!1,b)},l.prototype.readInt32BE=function(a,b){return r(this,a,!0,b)},l.prototype.readFloatLE=function(a,b){return s(this,a,!1,b)},l.prototype.readFloatBE=function(a,b){return s(this,a,!0,b)},l.prototype.readDoubleLE=function(a,b){return t(this,a,!1,b)},l.prototype.readDoubleBE=function(a,b){return t(this,a,!0,b)},l.prototype.writeUInt8=function(a,b,c){var d=this;c||(D.ok(void 0!==a&&null!==a,"missing value"),D.ok(void 0!==b&&null!==b,"missing offset"),D.ok(b=0?d.writeUInt8(a,b,c):d.writeUInt8(255+a+1,b,c)},l.prototype.writeInt16LE=function(a,b,c){z(this,a,b,!1,c)},l.prototype.writeInt16BE=function(a,b,c){z(this,a,b,!0,c)},l.prototype.writeInt32LE=function(a,b,c){A(this,a,b,!1,c)},l.prototype.writeInt32BE=function(a,b,c){A(this,a,b,!0,c)},l.prototype.writeFloatLE=function(a,b,c){B(this,a,b,!1,c)},l.prototype.writeFloatBE=function(a,b,c){B(this,a,b,!0,c)},l.prototype.writeDoubleLE=function(a,b,c){C(this,a,b,!1,c)},l.prototype.writeDoubleBE=function(a,b,c){C(this,a,b,!0,c)},d.prototype.readUInt8=l.prototype.readUInt8,d.prototype.readUInt16LE=l.prototype.readUInt16LE,d.prototype.readUInt16BE=l.prototype.readUInt16BE,d.prototype.readUInt32LE=l.prototype.readUInt32LE,d.prototype.readUInt32BE=l.prototype.readUInt32BE,d.prototype.readInt8=l.prototype.readInt8,d.prototype.readInt16LE=l.prototype.readInt16LE,d.prototype.readInt16BE=l.prototype.readInt16BE,d.prototype.readInt32LE=l.prototype.readInt32LE,d.prototype.readInt32BE=l.prototype.readInt32BE,d.prototype.readFloatLE=l.prototype.readFloatLE,d.prototype.readFloatBE=l.prototype.readFloatBE,d.prototype.readDoubleLE=l.prototype.readDoubleLE,d.prototype.readDoubleBE=l.prototype.readDoubleBE,d.prototype.writeUInt8=l.prototype.writeUInt8,d.prototype.writeUInt16LE=l.prototype.writeUInt16LE,d.prototype.writeUInt16BE=l.prototype.writeUInt16BE,d.prototype.writeUInt32LE=l.prototype.writeUInt32LE,d.prototype.writeUInt32BE=l.prototype.writeUInt32BE,d.prototype.writeInt8=l.prototype.writeInt8,d.prototype.writeInt16LE=l.prototype.writeInt16LE,d.prototype.writeInt16BE=l.prototype.writeInt16BE,d.prototype.writeInt32LE=l.prototype.writeInt32LE,d.prototype.writeInt32BE=l.prototype.writeInt32BE,d.prototype.writeFloatLE=l.prototype.writeFloatLE,d.prototype.writeFloatBE=l.prototype.writeFloatBE,d.prototype.writeDoubleLE=l.prototype.writeDoubleLE,d.prototype.writeDoubleBE=l.prototype.writeDoubleBE},{assert:1,"./buffer_ieee754":5,"base64-js":7}],7:[function(a,b){!function(){"use strict";function a(a){var b,c,e,f,g,h;if(a.length%4>0)throw"Invalid string. Length must be a multiple of 4";for(g=a.indexOf("="),g=g>0?a.length-g:0,h=[],e=g>0?a.length-4:a.length,b=0,c=0;e>b;b+=4,c+=3)f=d.indexOf(a[b])<<18|d.indexOf(a[b+1])<<12|d.indexOf(a[b+2])<<6|d.indexOf(a[b+3]),h.push((16711680&f)>>16),h.push((65280&f)>>8),h.push(255&f);return 2===g?(f=d.indexOf(a[b])<<2|d.indexOf(a[b+1])>>4,h.push(255&f)):1===g&&(f=d.indexOf(a[b])<<10|d.indexOf(a[b+1])<<4|d.indexOf(a[b+2])>>2,h.push(255&f>>8),h.push(255&f)),h}function c(a){function b(a){return d[63&a>>18]+d[63&a>>12]+d[63&a>>6]+d[63&a]}var c,e,f,g=a.length%3,h="";for(c=0,f=a.length-g;f>c;c+=3)e=(a[c]<<16)+(a[c+1]<<8)+a[c+2],h+=b(e);switch(g){case 1:e=a[a.length-1],h+=d[e>>2],h+=d[63&e<<4],h+="==";break;case 2:e=(a[a.length-2]<<8)+a[a.length-1],h+=d[e>>10],h+=d[63&e>>4],h+=d[63&e<<2],h+="="}return h}var d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";b.exports.toByteArray=a,b.exports.fromByteArray=c}()},{}],8:[function(a,b,c){c.readIEEE754=function(a,b,c,d,e){var f,g,h=8*e-d-1,i=(1<>1,k=-7,l=c?0:e-1,m=c?1:-1,n=a[b+l];for(l+=m,f=n&(1<<-k)-1,n>>=-k,k+=h;k>0;f=256*f+a[b+l],l+=m,k-=8);for(g=f&(1<<-k)-1,f>>=-k,k+=d;k>0;g=256*g+a[b+l],l+=m,k-=8);if(0===f)f=1-j;else{if(f===i)return g?0/0:1/0*(n?-1:1);g+=Math.pow(2,d),f-=j}return(n?-1:1)*g*Math.pow(2,f-d)},c.writeIEEE754=function(a,b,c,d,e,f){var g,h,i,j=8*f-e-1,k=(1<>1,m=23===e?Math.pow(2,-24)-Math.pow(2,-77):0,n=d?f-1:0,o=d?-1:1,p=0>b||0===b&&0>1/b?1:0;for(b=Math.abs(b),isNaN(b)||1/0===b?(h=isNaN(b)?1:0,g=k):(g=Math.floor(Math.log(b)/Math.LN2),b*(i=Math.pow(2,-g))<1&&(g--,i*=2),b+=g+l>=1?m/i:m*Math.pow(2,1-l),b*i>=2&&(g++,i/=2),g+l>=k?(h=0,g=k):g+l>=1?(h=(b*i-1)*Math.pow(2,e),g+=l):(h=b*Math.pow(2,l-1)*Math.pow(2,e),g=0));e>=8;a[c+n]=255&h,n+=o,h/=256,e-=8);for(g=g<0;a[c+n]=255&g,n+=o,g/=256,j-=8);a[c+n-o]|=128*p}},{}],3:[function(a,b,c){function d(a){this.length=a}function e(a){return 16>a?"0"+a.toString(16):a.toString(16)}function f(a){for(var b=[],c=0;ce&&!(e+c>=b.length||e>=a.length);)b[e+c]=a[e],e++;return e}function j(a){try{return decodeURIComponent(a)}catch(b){return String.fromCharCode(65533)}}function k(a){return a=~~Math.ceil(+a),0>a?0:a}function l(a,b,c){if(!(this instanceof l))return new l(a,b,c);var e;if("number"==typeof c)this.length=k(b),this.parent=a,this.offset=c;else{switch(e=typeof a){case"number":this.length=k(a);break;case"string":this.length=l.byteLength(a,b);break;case"object":this.length=k(a.length);break;default:throw new Error("First argument needs to be a number, array or string.")}if(this.length>l.poolSize?(this.parent=new d(this.length),this.offset=0):((!E||E.length-E.used>>0):(e=a.parent[a.offset+b+2]<<16,e|=a.parent[a.offset+b+1]<<8,e|=a.parent[a.offset+b],e+=a.parent[a.offset+b+3]<<24>>>0),e}function q(a,b,c,d){var e,f;return d||(D.ok("boolean"==typeof c,"missing or invalid endian"),D.ok(void 0!==b&&null!==b,"missing offset"),D.ok(b+1=0,"specified a negative value for writing an unsigned value"),D.ok(b>=a,"value is larger than maximum value for type"),D.ok(Math.floor(a)===a,"value has a fractional component")}function v(a,b,c,d,e){e||(D.ok(void 0!==b&&null!==b,"missing value"),D.ok("boolean"==typeof d,"missing or invalid endian"),D.ok(void 0!==c&&null!==c,"missing offset"),D.ok(c+1>>8,a.parent[a.offset+c+1]=255&b):(a.parent[a.offset+c+1]=(65280&b)>>>8,a.parent[a.offset+c]=255&b)}function w(a,b,c,d,e){e||(D.ok(void 0!==b&&null!==b,"missing value"),D.ok("boolean"==typeof d,"missing or invalid endian"),D.ok(void 0!==c&&null!==c,"missing offset"),D.ok(c+3>>24,a.parent[a.offset+c+1]=255&b>>>16,a.parent[a.offset+c+2]=255&b>>>8,a.parent[a.offset+c+3]=255&b):(a.parent[a.offset+c+3]=255&b>>>24,a.parent[a.offset+c+2]=255&b>>>16,a.parent[a.offset+c+1]=255&b>>>8,a.parent[a.offset+c]=255&b)}function x(a,b,c){D.ok("number"==typeof a,"cannot write a non-number as a number"),D.ok(b>=a,"value larger than maximum allowed value"),D.ok(a>=c,"value smaller than minimum allowed value"),D.ok(Math.floor(a)===a,"value has a fractional component")}function y(a,b,c){D.ok("number"==typeof a,"cannot write a non-number as a number"),D.ok(b>=a,"value larger than maximum allowed value"),D.ok(a>=c,"value smaller than minimum allowed value")}function z(a,b,c,d,e){e||(D.ok(void 0!==b&&null!==b,"missing value"),D.ok("boolean"==typeof d,"missing or invalid endian"),D.ok(void 0!==c&&null!==c,"missing offset"),D.ok(c+1=0?v(a,b,c,d,e):v(a,65535+b+1,c,d,e)}function A(a,b,c,d,e){e||(D.ok(void 0!==b&&null!==b,"missing value"),D.ok("boolean"==typeof d,"missing or invalid endian"),D.ok(void 0!==c&&null!==c,"missing offset"),D.ok(c+3=0?w(a,b,c,d,e):w(a,4294967295+b+1,c,d,e)}function B(b,c,d,e,f){f||(D.ok(void 0!==c&&null!==c,"missing value"),D.ok("boolean"==typeof e,"missing or invalid endian"),D.ok(void 0!==d&&null!==d,"missing offset"),D.ok(d+3d;d++)if(a[d]=e(this[d]),d==c.INSPECT_MAX_BYTES){a[d+1]="...";break}return""},d.prototype.hexSlice=function(a,b){var c=this.length;(!a||0>a)&&(a=0),(!b||0>b||b>c)&&(b=c);for(var d="",f=a;b>f;f++)d+=e(this[f]);return d},d.prototype.toString=function(a,b,c){if(a=String(a||"utf8").toLowerCase(),b=+b||0,"undefined"==typeof c&&(c=this.length),+c==b)return"";switch(a){case"hex":return this.hexSlice(b,c);case"utf8":case"utf-8":return this.utf8Slice(b,c);case"ascii":return this.asciiSlice(b,c);case"binary":return this.binarySlice(b,c);case"base64":return this.base64Slice(b,c);case"ucs2":case"ucs-2":return this.ucs2Slice(b,c);default:throw new Error("Unknown encoding")}},d.prototype.hexWrite=function(a,b,c){b=+b||0;var e=this.length-b;c?(c=+c,c>e&&(c=e)):c=e;var f=a.length;if(f%2)throw new Error("Invalid hex string");c>f/2&&(c=f/2);for(var g=0;c>g;g++){var h=parseInt(a.substr(2*g,2),16);if(isNaN(h))throw new Error("Invalid hex string");this[b+g]=h}return d._charsWritten=2*g,g},d.prototype.write=function(a,b,c,d){if(isFinite(b))isFinite(c)||(d=c,c=void 0);else{var e=d;d=b,b=c,c=e}b=+b||0;var f=this.length-b;switch(c?(c=+c,c>f&&(c=f)):c=f,d=String(d||"utf8").toLowerCase()){case"hex":return this.hexWrite(a,b,c);case"utf8":case"utf-8":return this.utf8Write(a,b,c);case"ascii":return this.asciiWrite(a,b,c);case"binary":return this.binaryWrite(a,b,c);case"base64":return this.base64Write(a,b,c);case"ucs2":case"ucs-2":return this.ucs2Write(a,b,c);default:throw new Error("Unknown encoding")}},d.prototype.slice=function(a,b){if(void 0===b&&(b=this.length),b>this.length)throw new Error("oob");if(a>b)throw new Error("oob");return new l(this,b-a,+a)},d.prototype.copy=function(a,b,c,d){for(var e=[],f=c;d>f;f++)D.ok("undefined"!=typeof this[f],"copying undefined buffer bytes!"),e.push(this[f]);for(var f=b;fd;d++)if(a[d]=e(this.parent[d+this.offset]),d==c.INSPECT_MAX_BYTES){a[d+1]="...";break}return""},l.prototype.get=function(a){if(0>a||a>=this.length)throw new Error("oob");return this.parent[this.offset+a]},l.prototype.set=function(a,b){if(0>a||a>=this.length)throw new Error("oob");return this.parent[this.offset+a]=b},l.prototype.write=function(a,b,c,e){if(isFinite(b))isFinite(c)||(e=c,c=void 0);else{var f=e;e=b,b=c,c=f}b=+b||0;var g=this.length-b;c?(c=+c,c>g&&(c=g)):c=g,e=String(e||"utf8").toLowerCase();var h;switch(e){case"hex":h=this.parent.hexWrite(a,this.offset+b,c);break;case"utf8":case"utf-8":h=this.parent.utf8Write(a,this.offset+b,c);break;case"ascii":h=this.parent.asciiWrite(a,this.offset+b,c);break;case"binary":h=this.parent.binaryWrite(a,this.offset+b,c);break;case"base64":h=this.parent.base64Write(a,this.offset+b,c);break;case"ucs2":case"ucs-2":h=this.parent.ucs2Write(a,this.offset+b,c);break;default:throw new Error("Unknown encoding")}return l._charsWritten=d._charsWritten,h},l.prototype.toString=function(a,b,c){switch(a=String(a||"utf8").toLowerCase(),"undefined"==typeof b||0>b?b=0:b>this.length&&(b=this.length),"undefined"==typeof c||c>this.length?c=this.length:0>c&&(c=0),b+=this.offset,c+=this.offset,a){case"hex":return this.parent.hexSlice(b,c);case"utf8":case"utf-8":return this.parent.utf8Slice(b,c);case"ascii":return this.parent.asciiSlice(b,c);case"binary":return this.parent.binarySlice(b,c);case"base64":return this.parent.base64Slice(b,c);case"ucs2":case"ucs-2":return this.parent.ucs2Slice(b,c);default:throw new Error("Unknown encoding")}},l.byteLength=d.byteLength,l.prototype.fill=function(a,b,c){if(a||(a=0),b||(b=0),c||(c=this.length),"string"==typeof a&&(a=a.charCodeAt(0)),"number"!=typeof a||isNaN(a))throw new Error("value is not a number");if(b>c)throw new Error("end < start");if(c===b)return 0;if(0==this.length)return 0;if(0>b||b>=this.length)throw new Error("start out of bounds");if(0>c||c>this.length)throw new Error("end out of bounds");return this.parent.fill(a,b+this.offset,c+this.offset)},l.prototype.copy=function(a,b,c,d){var e=this;if(c||(c=0),d||(d=this.length),b||(b=0),c>d)throw new Error("sourceEnd < sourceStart");if(d===c)return 0;if(0==a.length||0==e.length)return 0;if(0>b||b>=a.length)throw new Error("targetStart out of bounds");if(0>c||c>=e.length)throw new Error("sourceStart out of bounds");if(0>d||d>e.length)throw new Error("sourceEnd out of bounds");return d>this.length&&(d=this.length),a.length-bthis.length)throw new Error("oob");if(a>b)throw new Error("oob");return new l(this.parent,b-a,+a+this.offset)},l.prototype.utf8Slice=function(a,b){return this.toString("utf8",a,b)},l.prototype.binarySlice=function(a,b){return this.toString("binary",a,b)},l.prototype.asciiSlice=function(a,b){return this.toString("ascii",a,b)},l.prototype.utf8Write=function(a,b){return this.write(a,b,"utf8")},l.prototype.binaryWrite=function(a,b){return this.write(a,b,"binary")},l.prototype.asciiWrite=function(a,b){return this.write(a,b,"ascii")},l.prototype.readUInt8=function(a,b){var c=this;return b||(D.ok(void 0!==a&&null!==a,"missing offset"),D.ok(a=0?d.writeUInt8(a,b,c):d.writeUInt8(255+a+1,b,c)},l.prototype.writeInt16LE=function(a,b,c){z(this,a,b,!1,c)},l.prototype.writeInt16BE=function(a,b,c){z(this,a,b,!0,c)},l.prototype.writeInt32LE=function(a,b,c){A(this,a,b,!1,c)},l.prototype.writeInt32BE=function(a,b,c){A(this,a,b,!0,c)},l.prototype.writeFloatLE=function(a,b,c){B(this,a,b,!1,c)},l.prototype.writeFloatBE=function(a,b,c){B(this,a,b,!0,c)},l.prototype.writeDoubleLE=function(a,b,c){C(this,a,b,!1,c)},l.prototype.writeDoubleBE=function(a,b,c){C(this,a,b,!0,c)},d.prototype.readUInt8=l.prototype.readUInt8,d.prototype.readUInt16LE=l.prototype.readUInt16LE,d.prototype.readUInt16BE=l.prototype.readUInt16BE,d.prototype.readUInt32LE=l.prototype.readUInt32LE,d.prototype.readUInt32BE=l.prototype.readUInt32BE,d.prototype.readInt8=l.prototype.readInt8,d.prototype.readInt16LE=l.prototype.readInt16LE,d.prototype.readInt16BE=l.prototype.readInt16BE,d.prototype.readInt32LE=l.prototype.readInt32LE,d.prototype.readInt32BE=l.prototype.readInt32BE,d.prototype.readFloatLE=l.prototype.readFloatLE,d.prototype.readFloatBE=l.prototype.readFloatBE,d.prototype.readDoubleLE=l.prototype.readDoubleLE,d.prototype.readDoubleBE=l.prototype.readDoubleBE,d.prototype.writeUInt8=l.prototype.writeUInt8,d.prototype.writeUInt16LE=l.prototype.writeUInt16LE,d.prototype.writeUInt16BE=l.prototype.writeUInt16BE,d.prototype.writeUInt32LE=l.prototype.writeUInt32LE,d.prototype.writeUInt32BE=l.prototype.writeUInt32BE,d.prototype.writeInt8=l.prototype.writeInt8,d.prototype.writeInt16LE=l.prototype.writeInt16LE,d.prototype.writeInt16BE=l.prototype.writeInt16BE,d.prototype.writeInt32LE=l.prototype.writeInt32LE,d.prototype.writeInt32BE=l.prototype.writeInt32BE,d.prototype.writeFloatLE=l.prototype.writeFloatLE,d.prototype.writeFloatBE=l.prototype.writeFloatBE,d.prototype.writeDoubleLE=l.prototype.writeDoubleLE,d.prototype.writeDoubleBE=l.prototype.writeDoubleBE},{assert:1,"./buffer_ieee754":8,"base64-js":9}],9:[function(a,b){!function(){"use strict";function a(a){var b,c,e,f,g,h;if(a.length%4>0)throw"Invalid string. Length must be a multiple of 4";for(g=a.indexOf("="),g=g>0?a.length-g:0,h=[],e=g>0?a.length-4:a.length,b=0,c=0;e>b;b+=4,c+=3)f=d.indexOf(a[b])<<18|d.indexOf(a[b+1])<<12|d.indexOf(a[b+2])<<6|d.indexOf(a[b+3]),h.push((16711680&f)>>16),h.push((65280&f)>>8),h.push(255&f);return 2===g?(f=d.indexOf(a[b])<<2|d.indexOf(a[b+1])>>4,h.push(255&f)):1===g&&(f=d.indexOf(a[b])<<10|d.indexOf(a[b+1])<<4|d.indexOf(a[b+2])>>2,h.push(255&f>>8),h.push(255&f)),h}function c(a){function b(a){return d[63&a>>18]+d[63&a>>12]+d[63&a>>6]+d[63&a]}var c,e,f,g=a.length%3,h="";for(c=0,f=a.length-g;f>c;c+=3)e=(a[c]<<16)+(a[c+1]<<8)+a[c+2],h+=b(e);switch(g){case 1:e=a[a.length-1],h+=d[e>>2],h+=d[63&e<<4],h+="==";break;case 2:e=(a[a.length-2]<<8)+a[a.length-1],h+=d[e>>10],h+=d[63&e>>4],h+=d[63&e<<2],h+="="}return h}var d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";b.exports.toByteArray=a,b.exports.fromByteArray=c}()},{}]},{},[]),b.exports=a("buffer-browserify")},{}],51:[function(a,b){var c=b.exports={};c.nextTick=function(){var a="undefined"!=typeof window&&window.setImmediate,b="undefined"!=typeof window&&window.postMessage&&window.addEventListener;
+if(a)return function(a){return window.setImmediate(a)};if(b){var c=[];return window.addEventListener("message",function(a){if(a.source===window&&"process-tick"===a.data&&(a.stopPropagation(),c.length>0)){var b=c.shift();b()}},!0),function(a){c.push(a),window.postMessage("process-tick","*")}}return function(a){setTimeout(a,0)}}(),c.title="browser",c.browser=!0,c.env={},c.argv=[],c.binding=function(){throw new Error("process.binding is not supported")},c.cwd=function(){return"/"},c.chdir=function(){throw new Error("process.chdir is not supported")}},{}],52:[function(a,b,c){!function(){"use strict";function d(a){var b=function(a){return"string"==typeof a?a:"object"==typeof a?a.hashCode?a.hashCode():""+a:""+a},c=a.declare({instance:{constructor:function(){this.__entries=[],this.__keys=[],this.__values=[]},pushValue:function(a,b){return this.__keys.push(a),this.__values.push(b),this.__entries.push({key:a,value:b}),b},remove:function(a){for(var b,c=null,d=this.__entries,e=this.__keys,f=this.__values,g=d.length-1;g>=0;g--)if((b=d[g])&&b.key===a)return d.splice(g,1),e.splice(g,1),f.splice(g,1),b.value;return c},set:function(a,b){for(var c=null,d=this.__entries,e=this.__values,f=d.length-1;f>=0;f--){var g=d[f];if(g&&a===g.key){e[f]=b,g.value=b,c=b;break}}return c||d.push({key:a,value:b}),c},find:function(a){for(var b,c=null,d=this.__entries,e=d.length-1;e>=0;e--)if(b=d[e],b&&a===b.key){c=b.value;break}return c},getEntrySet:function(){return this.__entries},getKeys:function(){return this.__keys},getValues:function(){return this.__values}}});return a.declare({instance:{constructor:function(){this.__map={}},entrySet:function(){var a=[],b=this.__map;for(var c in b)b.hasOwnProperty(c)&&(a=a.concat(b[c].getEntrySet()));return a},put:function(a,d){var e=b(a),f=null;return(f=this.__map[e])||(f=this.__map[e]=new c),f.pushValue(a,d),d},remove:function(a){var c=b(a),d=null,e=this.__map[c];return e&&(d=e.remove(a)),d},get:function(a){var c,d=b(a),e=null;return(c=this.__map[d])&&(e=c.find(a)),e},set:function(a,d){var e=b(a),f=null,g=null,h=this.__map;return f=(g=h[e])?g.set(a,d):(h[e]=new c).pushValue(a,d)},contains:function(a){var c=b(a),d=!1,e=null;return(e=this.__map[c])&&(d=!!e.find(a)),d},concat:function(a){if(a instanceof this._static){for(var b=new this._static,c=a.entrySet().concat(this.entrySet()),d=c.length-1;d>=0;d--){var e=c[d];b.put(e.key,e.value)}return b}throw new TypeError("When joining hashtables the joining arg must be a HashTable")},filter:function(b,c){var d=this.entrySet(),e=new this._static;d=a.filter(d,b,c);for(var f=d.length-1;f>=0;f--){var g=d[f];e.put(g.key,g.value)}return e},forEach:function(b,c){var d=this.entrySet();a.forEach(d,b,c)},every:function(b,c){var d=this.entrySet();return a.every(d,b,c)},map:function(b,c){var d=this.entrySet();return a.map(d,b,c)},some:function(b,c){var d=this.entrySet();return a.some(d,b,c)},reduce:function(b,c){var d=this.entrySet();return a.reduce(d,b,c)},reduceRight:function(b,c){var d=this.entrySet();return a.reduceRight(d,b,c)},clear:function(){this.__map={}},keys:function(){var a=[],b=this.__map;for(var c in b)a=a.concat(b[c].getKeys());return a},values:function(){var a=[],b=this.__map;for(var c in b)a=a.concat(b[c].getValues());return a},isEmpty:function(){return 0===this.keys().length}}})}"undefined"!=typeof c?"undefined"!=typeof b&&b.exports&&(b.exports=d(a("extended")().register("declare",a("declare.js")).register(a("is-extended")).register(a("array-extended")))):"function"==typeof define?define(["extended","declare","is-extended","array-extended"],function(a,b,c,e){return d(a().register("declare",b).register(c).register(e))}):this.Ht=d(this.extended().register("declare",this.declare).register(this.isExtended).register(this.arrayExtended))}.call(this)},{"array-extended":39,"declare.js":42,extended:43,"is-extended":53}],53:[function(a,b,c){var d=a("__browserify_Buffer").Buffer;!function(){"use strict";function e(a){function b(a,b){var c=-1,d=0,e=a.length,f=[];for(b=b||0,c+=b;++c=0;f--)if(g[f]!==h[f])return!1;for(f=g.length-1;f>=0;f--)if(d=g[f],!e(a[d],b[d]))return!1}catch(i){return!1}return!0}function g(a){return null!==a&&"object"==typeof a}function h(a){var b=g(a);return b&&a.constructor===Object&&!a.nodeType&&!a.setInterval}function i(a){return W(a)?0===a.length:g(a)?0===c(a).length:r(a)||X(a)?0===a.length:!0}function j(a){return a===!0||a===!1||"[object Boolean]"===U.call(a)}function k(a){return"undefined"==typeof a}function l(a){return!k(a)}function m(a){return k(a)||n(a)}function n(a){return null===a}function o(a,b){return V(b)?a instanceof b:!1}function p(a){return"[object RegExp]"===U.call(a)}function q(a){return"[object Date]"===U.call(a)}function r(a){return"[object String]"===U.call(a)}function s(a){return"[object Number]"===U.call(a)}function t(a){return a===!0}function u(a){return a===!1}function v(a){return!n(a)}function w(a,b){return a==b}function x(a,b){return a!=b}function y(a,b){return a===b}function z(a,b){return a!==b}function A(a,b){if(X(b)&&Array.prototype.indexOf||r(b))return b.indexOf(a)>-1;if(X(b))for(var c=0,d=b.length;d>c;c++)if(w(a,b[c]))return!0;return!1}function B(a,b){return!A(a,b)}function C(a,b){return b>a}function D(a,b){return b>=a}function E(a,b){return a>b}function F(a,b){return a>=b}function G(a,b){return r(b)?null!==(""+a).match(b):p(b)?b.test(a):!1}function H(a,b){return!G(a,b)}function I(a,b){return A(b,a)}function J(a,b){return!A(b,a)}function K(a,b,c){return X(a)&&a.length>c?w(a[c],b):!1}function L(a,b,c){return X(a)?!w(a[c],b):!1}function M(a,b){return T.call(a,b)}function N(a,b){return!M(a,b)}function O(a,b){return M(a,"length")?a.length===b:!1}function P(a,b){return M(a,"length")?a.length!==b:!1}function Q(a){Z[a]=function(){this._testers.push(Y[a])}}function R(a){$[a]=function(){var c,d=b(arguments,1),e=Y[a],f=!0;if(d.length<=e.length-1)throw new TypeError("A handler must be defined when calling using switch");if(c=d.pop(),j(c)&&(f=c,c=d.pop()),!V(c))throw new TypeError("handler must be defined");this._cases.push(function(a){return e.apply(Y,a.concat(d))?[f,c.apply(this,a)]:[!1]})}}var S=Array.prototype.slice,T=Object.prototype.hasOwnProperty,U=Object.prototype.toString,V=function(a){return"[object Function]"===U.call(a)};"undefined"==typeof window||V(window.alert)||function(a){V=function(b){return"[object Function]"===U.call(b)||b===a}}(window.alert);var W=function(a){return"[object Arguments]"===U.call(a)};W(arguments)||(W=function(a){return!(!a||!T.call(a,"callee"))});var X=Array.isArray||function(a){return"[object Array]"===U.call(a)},Y={isFunction:V,isObject:g,isEmpty:i,isHash:h,isNumber:s,isString:r,isDate:q,isArray:X,isBoolean:j,isUndefined:k,isDefined:l,isUndefinedOrNull:m,isNull:n,isArguments:W,instanceOf:o,isRegExp:p,deepEqual:e,isTrue:t,isFalse:u,isNotNull:v,isEq:w,isNeq:x,isSeq:y,isSneq:z,isIn:A,isNotIn:B,isLt:C,isLte:D,isGt:E,isGte:F,isLike:G,isNotLike:H,contains:I,notContains:J,has:M,notHas:N,isLength:O,isNotLength:P,containsAt:K,notContainsAt:L},Z={constructor:function(){this._testers=[]},noWrap:{tester:function(){var a=this._testers;return function(b){for(var c=!1,d=0,e=a.length;e>d&&!c;d++)c=a[d](b);return c}}}},$={constructor:function(){this._cases=[],this.__default=null},def:function(a,b){this.__default=b},noWrap:{switcher:function(){var a=this._cases,c=this.__default;return function(){for(var d,e=!1,f=b(arguments),g=0,h=a.length;h>g&&!e;g++)if(d=a[g](f),d.length>1&&(d[1]||d[0]))return d[1];return!e&&c?c.apply(this,f):void 0}}}};for(var _ in Y)T.call(Y,_)&&(R(_),Q(_));var ab=a.define(Y).expose(Y);return ab.tester=a.define(Z),ab.switcher=a.define($),ab}"undefined"!=typeof c?"undefined"!=typeof b&&b.exports&&(b.exports=e(a("extended"))):"function"==typeof define&&define.amd?define(["extended"],function(a){return e(a)}):this.isExtended=e(this.extended)}.call(this)},{__browserify_Buffer:50,extended:43}],54:[function(a,b,c){!function(){"use strict";function d(a){function b(a,b){var c=0;return a>b?1:b>a?-1:b?c:1}var c=a.multiply,d=a.declare({instance:{__printNode:function(b,d){var e=[];a.isUndefinedOrNull(b)?(e.push(c(" ",d)),e.push("~"),console.log(e.join(""))):(this.__printNode(b.right,d+1),e.push(c(" ",d)),e.push(b.data+"\n"),console.log(e.join("")),this.__printNode(b.left,d+1))},constructor:function(a){a=a||{},this.compare=a.compare||b,this.__root=null},insert:function(){throw new Error("Not Implemented")},remove:function(){throw new Error("Not Implemented")},clear:function(){this.__root=null},isEmpty:function(){return!this.__root},traverseWithCondition:function(a,b,c){var e=!0;return a&&(b=b||d.PRE_ORDER,b===d.PRE_ORDER?(e=c(a.data),e&&(e=this.traverseWithCondition(a.left,b,c),e&&(e=this.traverseWithCondition(a.right,b,c)))):b===d.IN_ORDER?(e=this.traverseWithCondition(a.left,b,c),e&&(e=c(a.data),e&&(e=this.traverseWithCondition(a.right,b,c)))):b===d.POST_ORDER?(e=this.traverseWithCondition(a.left,b,c),e&&(e&&(e=this.traverseWithCondition(a.right,b,c)),e&&(e=c(a.data)))):b===d.REVERSE_ORDER&&(e=this.traverseWithCondition(a.right,b,c),e&&(e=c(a.data),e&&(e=this.traverseWithCondition(a.left,b,c))))),e},traverse:function(a,b,c){a&&(b=b||d.PRE_ORDER,b===d.PRE_ORDER?(c(a.data),this.traverse(a.left,b,c),this.traverse(a.right,b,c)):b===d.IN_ORDER?(this.traverse(a.left,b,c),c(a.data),this.traverse(a.right,b,c)):b===d.POST_ORDER?(this.traverse(a.left,b,c),this.traverse(a.right,b,c),c(a.data)):b===d.REVERSE_ORDER&&(this.traverse(a.right,b,c),c(a.data),this.traverse(a.left,b,c)))},forEach:function(a,b,c){if("function"!=typeof a)throw new TypeError;c=c||d.IN_ORDER,b=b||this,this.traverse(this.__root,c,function(c){a.call(b,c,this)})},map:function(a,b,c){if("function"!=typeof a)throw new TypeError;c=c||d.IN_ORDER,b=b||this;var e=new this._static;return this.traverse(this.__root,c,function(c){e.insert(a.call(b,c,this))}),e},filter:function(a,b,c){if("function"!=typeof a)throw new TypeError;c=c||d.IN_ORDER,b=b||this;var e=new this._static;return this.traverse(this.__root,c,function(c){a.call(b,c,this)&&e.insert(c)}),e},reduce:function(b,c,d){var e=this.toArray(d),f=[e,b];return a.isUndefinedOrNull(c)||f.push(c),a.reduce.apply(a,f)},reduceRight:function(b,c,d){var e=this.toArray(d),f=[e,b];return a.isUndefinedOrNull(c)||f.push(c),a.reduceRight.apply(a,f)},every:function(a,b,c){if("function"!=typeof a)throw new TypeError;c=c||d.IN_ORDER,b=b||this;var e=!1;return this.traverseWithCondition(this.__root,c,function(c){return e=a.call(b,c,this)}),e},some:function(a,b,c){if("function"!=typeof a)throw new TypeError;c=c||d.IN_ORDER,b=b||this;var e;return this.traverseWithCondition(this.__root,c,function(c){return e=a.call(b,c,this),!e}),e},toArray:function(a){a=a||d.IN_ORDER;var b=[];return this.traverse(this.__root,a,function(a){b.push(a)}),b},contains:function(a){for(var b=!1,c=this.__root;null!==c;){var d=this.compare(a,c.data);d?c=c[-1===d?"left":"right"]:(b=!0,c=null)}return b},find:function(a){for(var b,c=this.__root;c;){var d=this.compare(a,c.data);if(!d){b=c.data;break}c=c[-1===d?"left":"right"]}return b},findLessThan:function(a,b){var c=[],e=this.compare;return this.traverseWithCondition(this.__root,d.IN_ORDER,function(d){var f=e(a,d);return!b&&0===f||1===f?(c.push(d),!0):!1}),c},findGreaterThan:function(a,b){var c=[],e=this.compare;return this.traverse(this.__root,d.REVERSE_ORDER,function(d){var f=e(a,d);return!b&&0===f||-1===f?(c.push(d),!0):!1}),c},print:function(){this.__printNode(this.__root,0)}},"static":{PRE_ORDER:"pre_order",IN_ORDER:"in_order",POST_ORDER:"post_order",REVERSE_ORDER:"reverse_order"}}),e=function(){var a=Math.abs,b=function(a){return{data:a,balance:0,left:null,right:null}},e=function(a,b,c){var d=a[c];return a[c]=d[b],d[b]=a,d},f=function(a,b,c){return a[c]=e(a[c],c,b),e(a,b,c)},g=function(a,b,c){var d="left"===b?"right":"left",e=a[b],f=e[d];0===f.balance?a.balance=e.balance=0:f.balance===c?(a.balance=-c,e.balance=0):(a.balance=0,e.balance=c),f.balance=0},h=function(a,b){var c="left"===b?"right":"left",d=a[b],h="left"===b?-1:1;return d.balance===h?(a.balance=d.balance=0,a=e(a,c,b)):(g(a,b,h),a=f(a,c,b)),a},i=function(a,b,c){var d="left"===b?"right":"left",h=a[d],i="left"===b?-1:1;return h.balance===-i?(a.balance=h.balance=0,a=e(a,b,d)):h.balance===i?(g(a,d,-i),a=f(a,b,d)):(a.balance=-i,h.balance=i,a=e(a,b,d),c.done=!0),a},j=function(c,d,e,f){if(null===c||void 0===c)c=b(d);else{var g=-1===f(d,c.data)?"left":"right";c[g]=j(c[g],d,e,f),e.done||(c.balance+="left"===g?-1:1,0===c.balance?e.done=!0:a(c.balance)>1&&(c=h(c,g),e.done=!0))}return c},k=function(b,c,d,e){var f,g,h,j;if(b){if(g=e(c,b.data),0===g){var l=b.left,m=b.right;if(!l||!m)return f=l?"left":"right",h=b[f];for(var n=l;null!==(m=n.right);)n=m;b.data=n.data,c=n.data}if(f=-1===e(b.data,c)?"right":"left",b[f]=k(b[f],c,d,e),!d.done){j=b.balance+="left"===f?1:-1;var o=a(j);1===o?d.done=!0:o>1&&(b=i(b,f,d))}}return b};return d.extend({instance:{insert:function(a){var b={done:!1};this.__root=j(this.__root,a,b,this.compare)},remove:function(a){this.__root=k(this.__root,a,{done:!1},this.compare)},__printNode:function(a,b){var d=[];a?(this.__printNode(a.right,b+1),d.push(c(" ",b)),d.push(a.data+":"+a.balance+"\n"),console.log(d.join("")),this.__printNode(a.left,b+1)):(d.push(c(" ",b)),d.push("~"),console.log(d.join("")))}}})}(),f=function(){function a(a,b){return{data:a,level:b,left:g,right:g}}function b(a){if(0!==a.level&&a.left.level===a.level){var b=a.left;a.left=b.right,b.right=a,a=b}return a}function e(a){if(0!==a.level&&a.right.right.level===a.level){var b=a.right;a.right=b.left,b.left=a,a=b,a.level++}return a}function f(c,d,h){if(c===g)c=a(d,1);else{var i=-1===h(d,c.data)?"left":"right";c[i]=f(c[i],d,h),c=b(c),c=e(c)}return c}var g={level:0,data:null},h=function(a,c,d){var f,i;if(a!==g){var j=d(c,a.data);if(0===j)if(f=a.left,i=a.right,f!==g&&i!==g){for(var k=f;k.right!==g;)k=k.right;a.data=k.data,a.left=h(f,k.data,d)}else a=a[f===g?"right":"left"];else{var l=-1===j?"left":"right";a[l]=h(a[l],c,d)}}if(a!==g){var m=a.level,n=a.left.level,o=a.right.level;(m-1>n||m-1>o)&&(o>--a.level&&(a.right.level=a.level),a=b(a),a=e(a))}return a};return d.extend({instance:{isEmpty:function(){return this.__root===g||this._super(arguments)},insert:function(a){this.__root||(this.__root=g),this.__root=f(this.__root,a,this.compare)},remove:function(a){this.__root=h(this.__root,a,this.compare)},traverseWithCondition:function(a){var b=!0;return a!==g?this._super(arguments):b},traverse:function(a){a!==g&&this._super(arguments)},contains:function(){return this.__root!==g?this._super(arguments):!1},__printNode:function(a,b){var d=[];a&&a.data?(this.__printNode(a.right,b+1),d.push(c(" ",b)),d.push(a.data+":"+a.level+"\n"),console.log(d.join("")),this.__printNode(a.left,b+1)):(d.push(c(" ",b)),d.push("~"),console.log(d.join("")))}}})}(),g=d.extend({instance:{insert:function(a){if(!this.__root)return this.__root={data:a,parent:null,left:null,right:null};for(var b=this.compare,c=this.__root;null!==c;){var d=b(a,c.data);if(!d)return;var e=-1===d?"left":"right",f=c[e];if(!f)return c[e]={data:a,parent:c,left:null,right:null};c=f}},remove:function(a){if(null!==this.__root){for(var b,c={right:this.__root},d=c,e=null,f="right";null!==d[f];){b=d,d=d[f];var g=this.compare(a,d.data);g||(e=d),f=-1===g?"left":"right"}null!==e&&(e.data=d.data,b[b.right===d?"right":"left"]=d[null===d.left?"right":"left"]),this.__root=c.right}}}}),h=function(){var a="RED",b="BLACK",e=function(a){return null!==a&&a.red},f=function(a){return{data:a,red:!0,left:null,right:null}},g=function(a,b,c){if(!a)return f(b);var d=c(b,a.data);if(d){var j=-1===d?"left":"right",k="left"===j?"right":"left";a[j]=g(a[j],b,c);var l=a[j];if(e(l)){var m=a[k];e(m)?(a.red=!0,l.red=!1,m.red=!1):e(l[j])?a=h(a,k):e(l[k])&&(a=i(a,k))}}return a},h=function(a,b){var c="left"===b?"right":"left",d=a[c];return a[c]=d[b],d[b]=a,a.red=!0,d.red=!1,d},i=function(a,b){var c="left"===b?"right":"left";return a[c]=h(a[c],c),h(a,b)},j=function(a,b,c,d){if(a){var f;if(0===d(b,a.data)){if(!a.left||!a.right){var g=a[a.left?"left":"right"];return e(a)?c.done=!0:e(g)&&(g.red=!1,c.done=!0),g}for(var h,i=a.right;null!==i.left;)h=i,i=i.left;h&&(h.left=null),a.data=i.data,b=i.data}f=-1===d(b,a.data)?"left":"right",a[f]=j(a[f],b,c,d),c.done||(a=k(a,f,c))}else c.done=!0;return a},k=function(a,b,c){var d="left"===b?"right":"left",f=a,g=f[d];if(e(g)&&(a=h(a,b),g=f[d]),null!==g)if(e(g.left)||e(g.right)){var j=f.red,k=a===f;f=(e(g[d])?h:i)(f,b),f.red=j,f.left.red=f.right.red=0,k?a=f:a[b]=f,c.done=!0}else e(f)&&(c.done=!0),f.red=0,g.red=1;return a};return d.extend({instance:{insert:function(a){this.__root=g(this.__root,a,this.compare),this.__root.red=!1},remove:function(a){var b={done:!1},c=j(this.__root,a,b,this.compare);return null!==c&&(c.red=0),this.__root=c,a},__printNode:function(d,e){var f=[];d?(this.__printNode(d.right,e+1),f.push(c(" ",e)),f.push((d.red?a:b)+":"+d.data+"\n"),console.log(f.join("")),this.__printNode(d.left,e+1)):(f.push(c(" ",e)),f.push("~"),console.log(f.join("")))}}})}();return{Tree:d,AVLTree:e,AnderssonTree:f,BinaryTree:g,RedBlackTree:h,IN_ORDER:d.IN_ORDER,PRE_ORDER:d.PRE_ORDER,POST_ORDER:d.POST_ORDER,REVERSE_ORDER:d.REVERSE_ORDER}}"undefined"!=typeof c?"undefined"!=typeof b&&b.exports&&(b.exports=d(a("extended")().register("declare",a("declare.js")).register(a("is-extended")).register(a("array-extended")).register(a("string-extended")))):"function"==typeof define?define(["extended","declare.js","is-extended","array-extended","string-extended"],function(a,b,c,e,f){return d(a().register("declare",b).register(c).register(e).register(f))}):this.leafy=d(this.extended().register("declare",this.declare).register(this.isExtended).register(this.arrayExtended).register(this.stringExtended))}.call(this)},{"array-extended":39,"declare.js":42,extended:43,"is-extended":53,"string-extended":57}],55:[function(a,b,c){!function(){"use strict";function d(a,b,c){function d(a,b){var c,d;for(c in b)t.call(b,c)&&(d=b[c],c in a&&a[c]===d||(a[c]=d));return a}function e(a,b){var c,d,f;for(c in b)t.call(b,c)&&(d=b[c],f=a[c],p(f,d)||(a[c]=r(f)&&r(d)?e(f,d):r(d)?e({},d):d));return a}function f(a){a||(a={});for(var b=1,c=arguments.length;c>b;b++)d(a,arguments[b]);return a}function g(a){a||(a={});for(var b=1,c=arguments.length;c>b;b++)e(a,arguments[b]);return a}function h(a,b){var c=a.prototype||a;return f(c,b),a}function i(a,b,c){if(!r(a)||!u(b))throw new TypeError;for(var d,e=l(a),f=0,g=e.length;g>f;++f)d=e[f],b.call(c||a,a[d],d,a);return a}function j(a,b,c){if(!r(a)||!u(b))throw new TypeError;for(var d,e,f=l(a),g={},h=0,i=f.length;i>h;++h)d=f[h],e=a[d],b.call(c||a,e,d,a)&&(g[d]=e);return g}function k(a){if(!r(a))throw new TypeError;for(var b=l(a),c=[],d=0,e=b.length;e>d;++d)c.push(a[b[d]]);return c}function l(a){if(!r(a))throw new TypeError;var b=[];for(var c in a)t.call(a,c)&&b.push(c);return b}function m(a){if(!r(a))throw new TypeError;for(var b,c=l(a),d={},e=0,f=c.length;f>e;++e)b=c[e],d[a[b]]=b;return d}function n(a){if(!r(a))throw new TypeError;for(var b,c=l(a),d=[],e=0,f=c.length;f>e;++e)b=c[e],d.push([b,a[b]]);return d}function o(a,b){if(!r(a))throw new TypeError;q(b)&&(b=[b]);for(var c,d=s(l(a),b),e={},f=0,g=d.length;g>f;++f)c=d[f],e[c]=a[c];return e}var p=b.deepEqual,q=b.isString,r=b.isHash,s=c.difference,t=Object.prototype.hasOwnProperty,u=b.isFunction,v={forEach:i,filter:j,invert:m,values:k,toArray:n,keys:l,omit:o},w={extend:h,merge:f,deepMerge:g,omit:o},x=a.define(b.isObject,w).define(r,v).define(b.isFunction,{extend:h}).expose({hash:v}).expose(w),y=x.extend;return x.extend=function(){return 1===arguments.length?y.extend.apply(x,arguments):(h.apply(null,arguments),void 0)},x}"undefined"!=typeof c?"undefined"!=typeof b&&b.exports&&(b.exports=d(a("extended"),a("is-extended"),a("array-extended"))):"function"==typeof define&&define.amd?define(["extended","is-extended","array-extended"],function(a,b,c){return d(a,b,c)}):this.objectExtended=d(this.extended,this.isExtended,this.arrayExtended)}.call(this)},{"array-extended":39,extended:43,"is-extended":53}],56:[function(a,b,c){var d=a("__browserify_process");!function(){"use strict";function e(a,b,c,e,f,g){function h(a,b){return function(){try{l(a.apply(null,arguments)).addCallback(b).addErrback(b)}catch(c){b.errback(c)}}}function i(a,b,c){var d=(new G).callback();return v(a,function(a){d=d.then(c?a:B(null,a)),c||(d=d.then(function(a){return b.push(a),b}))}),d}function j(a){return!w(a)&&y(a.then)}function k(a){var b=new G;return a.then(A(b,"callback"),A(b,"errback")),b.promise()}function l(a){var b;return a=C(arguments),a.length?1===a.length?(a=a.pop(),j(a)?a.addCallback&&a.addErrback?(b=new G,a.addCallback(b.callback),a.addErrback(b.errback)):b=k(a):b=x(a)&&c.every(a,j)?new H(a,!0).promise():(new G).callback(a)):b=new H(c.map(a,function(a){return l(a)}),!0).promise():b=(new G).callback(a).promise(),b}function m(a,b){return function(){var c=new G,d=C(arguments);return d.push(c.resolve),a.apply(b||this,d),c.promise()}}function n(a){if(x(a))return i(a,[],!1);throw new Error("When calling promise.serial the first argument must be an array")}function o(a){if(x(a))return i(a,[],!0);throw new Error("When calling promise.serial the first argument must be an array")}function p(a,b){a=C(arguments);var c=!1;b=a.pop();var d=l(a);return function(){return c?l(b.apply(this,arguments)):(a=arguments,d.then(A(this,function(){return c=!0,b.apply(this,a)})))}}function q(){return new G}function r(a){return new H(a,!0).promise()}function s(a){return q().errback(a)}function t(a){return q().callback(a)}var u,v=c.forEach,w=e.isUndefinedOrNull,x=e.isArray,y=e.isFunction,z=e.isBoolean,A=f.bind,B=f.bindIgnore,C=g.argsToArray;if("function"==typeof setImmediate)u="undefined"!=typeof window?setImmediate.bind(window):setImmediate;else if("undefined"!=typeof d)u=function(a){d.nextTick(a)};else if("undefined"!=typeof MessageChannel){var D=new MessageChannel,E={},F=E;D.port1.onmessage=function(){E=E.next;var a=E.task;delete E.task,a()},u=function(a){F=F.next={task:a},D.port2.postMessage(0)}}else u=function(a){setTimeout(a,0)};var G=a({instance:{__fired:!1,__results:null,__error:null,__errorCbs:null,__cbs:null,constructor:function(){this.__errorCbs=[],this.__cbs=[],f.bindAll(this,["callback","errback","resolve","classic","__resolve","addCallback","addErrback"])},__resolve:function(){if(!this.__fired){this.__fired=!0;var a,b=this.__error?this.__errorCbs:this.__cbs,c=b.length,d=this.__error||this.__results;for(a=0;c>a;a++)this.__callNextTick(b[a],d)}},__callNextTick:function(a,b){u(function(){a.apply(this,b)})},addCallback:function(a){return a&&(j(a)&&a.callback&&(a=a.callback),this.__fired&&this.__results?this.__callNextTick(a,this.__results):this.__cbs.push(a)),this},addErrback:function(a){return a&&(j(a)&&a.errback&&(a=a.errback),this.__fired&&this.__error?this.__callNextTick(a,this.__error):this.__errorCbs.push(a)),this},callback:function(){return this.__fired||(this.__results=arguments,this.__resolve()),this.promise()},errback:function(){return this.__fired||(this.__error=arguments,this.__resolve()),this.promise()},resolve:function(a){return a?this.errback(a):this.callback.apply(this,C(arguments,1)),this},classic:function(a){return"function"==typeof a&&(this.addErrback(function(b){a(b)}),this.addCallback(function(){a.apply(this,[null].concat(C(arguments)))})),this},then:function(a,b){var c=new G,d=c;return y(b)&&(d=h(b,c)),this.addErrback(d),y(a)?this.addCallback(h(a,c)):this.addCallback(c),c.promise()},both:function(a){return this.then(a,a)},promise:function(){var a={then:A(this,"then"),both:A(this,"both"),promise:function(){return a}};return v(["addCallback","addErrback","classic"],function(b){a[b]=A(this,function(){return this[b].apply(this,arguments),a})},this),a}}}),H=G.extend({instance:{__results:null,__errors:null,__promiseLength:0,__defLength:0,__firedLength:0,normalizeResults:!1,constructor:function(a,b){this.__errors=[],this.__results=[],this.normalizeResults=z(b)?b:!1,this._super(arguments),a&&a.length?(this.__defLength=a.length,v(a,this.__addPromise,this)):this.__resolve()},__addPromise:function(a,b){a.then(A(this,function(){var a=C(arguments);a.unshift(b),this.callback.apply(this,a)}),A(this,function(){var a=C(arguments);a.unshift(b),this.errback.apply(this,a)}))},__resolve:function(){if(!this.__fired){this.__fired=!0;var a,b=this.__errors.length?this.__errorCbs:this.__cbs,c=b.length,d=this.__errors.length?this.__errors:this.__results;for(a=0;c>a;a++)this.__callNextTick(b[a],d)}},__callNextTick:function(a,b){u(function(){a.apply(null,[b])})},addCallback:function(a){return a&&(j(a)&&a.callback&&(a=A(a,"callback")),this.__fired&&!this.__errors.length?this.__callNextTick(a,this.__results):this.__cbs.push(a)),this},addErrback:function(a){return a&&(j(a)&&a.errback&&(a=A(a,"errback")),this.__fired&&this.__errors.length?this.__callNextTick(a,this.__errors):this.__errorCbs.push(a)),this},callback:function(a){if(this.__fired)throw new Error("Already fired!");var b=C(arguments);return this.normalizeResults&&(b=b.slice(1),b=1===b.length?b.pop():b),this.__results[a]=b,this.__firedLength++,this.__firedLength===this.__defLength&&this.__resolve(),this.promise()},errback:function(a){if(this.__fired)throw new Error("Already fired!");var b=C(arguments);return this.normalizeResults&&(b=b.slice(1),b=1===b.length?b.pop():b),this.__errors[a]=b,this.__firedLength++,this.__firedLength===this.__defLength&&this.__resolve(),this.promise()}}});return b.define({isPromiseLike:j}).expose({isPromiseLike:j,when:l,wrap:m,wait:p,serial:n,chain:o,Promise:G,PromiseList:H,promise:q,defer:q,deferredList:r,reject:s,resolve:t})}"undefined"!=typeof c?"undefined"!=typeof b&&b.exports&&(b.exports=e(a("declare.js"),a("extended"),a("array-extended"),a("is-extended"),a("function-extended"),a("arguments-extended"))):"function"==typeof define&&define.amd?define(["declare","extended","array-extended","is-extended","function-extended","arguments-extended"],function(a,b,c,d,f,g){return e(a,b,c,d,f,g)}):this.promiseExtended=e(this.declare,this.extended,this.arrayExtended,this.isExtended,this.functionExtended,this.argumentsExtended)}.call(this)},{__browserify_process:51,"arguments-extended":38,"array-extended":39,"declare.js":42,extended:43,"function-extended":46,"is-extended":53}],57:[function(a,b,c){!function(){"use strict";function d(a,b,c,d){function e(a,b){var c=a;if(x.test(b)){var d=b.match(x),e=d[1],f=d[3],g=d[4];g&&(g=parseInt(g,10),c=c.length0?"+":"")+d),k&&(k=parseInt(k,10),d=d.lengthe;)d?a+=c:a=c+a,e++;return a}function i(a,c,d){var e=a;if(b.isString(e)){if(a.length>c)if(d){var f=a.length;e=a.substring(f-c,f)}else e=a.substring(0,c)}else e=i(""+e,c);return e}function j(a,d){if(d instanceof Array){var h=0,i=d.length;return a.replace(v,function(a,b,j){var k,l;if(!(i>h))return a;if(k=d[h++],"%s"===a||"%d"===a||"%D"===a)l=k+"";else if("%Z"===a)l=k.toUTCString();else if("%j"===a)try{l=s(k)}catch(m){throw new Error("stringExtended.format : Unable to parse json from ",k)}else switch(b=b.replace(/^\[|\]$/g,""),j){case"s":l=e(k,b);break;case"d":l=f(k,b);break;case"j":l=g(k,b);break;case"D":l=c.format(k,b);break;case"Z":l=c.format(k,b,!0)}return l})}if(t(d))return a.replace(w,function(a,h,i){if(i=d[i],!b.isUndefined(i)){if(!h)return""+i;if(b.isString(i))return e(i,h);if(b.isNumber(i))return f(i,h);if(b.isDate(i))return c.format(i,h);if(b.isObject(i))return g(i,h)}return a});var k=u.call(arguments).slice(1);return j(a,k)}function k(a,b){var c=[];return a&&(a.indexOf(b)>0?c=a.replace(/\s+/g,"").split(b):c.push(a)),c}function l(a,b){var c=[];if(b)for(var d=0;b>d;d++)c.push(a);return c.join("")}function m(a,c){var d,e,f;if(c)if(b.isArray(a))for(d=[],e=0,f=a.length;f>e;e++)d.push(m(a[e],c));else if(c instanceof Array)for(d=a,e=0,f=c.length;f>e;e++)d=m(d,c[e]);else c in z&&(d="["+z[c]+"m"+a+"[0m");return d}function n(a,b){return a.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g,function(a){return b&&-1!==d.indexOf(b,a)?a:"\\"+a})}function o(a){return a.replace(/^\s*|\s*$/g,"")}function p(a){return a.replace(/^\s*/,"")}function q(a){return a.replace(/\s*$/,"")}function r(a){return 0===a.length}var s;"undefined"==typeof JSON?function(){function a(a){return 10>a?"0"+a:a}function c(c){return b.isDate(c)?isFinite(c.valueOf())?c.getUTCFullYear()+"-"+a(c.getUTCMonth()+1)+"-"+a(c.getUTCDate())+"T"+a(c.getUTCHours())+":"+a(c.getUTCMinutes())+":"+a(c.getUTCSeconds())+"Z":null:i(c)?c.valueOf():c}function d(a){return j.lastIndex=0,j.test(a)?'"'+a.replace(j,function(a){var b=k[a];return"string"==typeof b?b:"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+a+'"'}function e(a,b){var i,j,k,l,m,n=f,o=b[a];switch(o&&(o=c(o)),"function"==typeof h&&(o=h.call(b,a,o)),typeof o){case"string":return d(o);case"number":return isFinite(o)?String(o):"null";case"boolean":case"null":return String(o);case"object":if(!o)return"null";if(f+=g,m=[],"[object Array]"===Object.prototype.toString.apply(o)){for(l=o.length,i=0;l>i;i+=1)m[i]=e(i,o)||"null";return k=0===m.length?"[]":f?"[\n"+f+m.join(",\n"+f)+"\n"+n+"]":"["+m.join(",")+"]",f=n,k}if(h&&"object"==typeof h)for(l=h.length,i=0;l>i;i+=1)"string"==typeof h[i]&&(j=h[i],k=e(j,o),k&&m.push(d(j)+(f?": ":":")+k));else for(j in o)Object.prototype.hasOwnProperty.call(o,j)&&(k=e(j,o),k&&m.push(d(j)+(f?": ":":")+k));return k=0===m.length?"{}":f?"{\n"+f+m.join(",\n"+f)+"\n"+n+"}":"{"+m.join(",")+"}",f=n,k}}var f,g,h,i=b.tester().isString().isNumber().isBoolean().tester(),j=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,k={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"};s=function(a,b,c){var d;if(f="",g="","number"==typeof c)for(d=0;c>d;d+=1)g+=" ";else"string"==typeof c&&(g=c);if(h=b,b&&"function"!=typeof b&&("object"!=typeof b||"number"!=typeof b.length))throw new Error("JSON.stringify");return e("",{"":a})}}():s=JSON.stringify;var t=b.isHash,u=Array.prototype.slice,v=/%((?:-?\+?.?\d*)?|(?:\[[^\[|\]]*\]))?([sjdDZ])/g,w=/\{(?:\[([^\[|\]]*)\])?(\w+)\}/g,x=/(-?)(\+?)([A-Z|a-z|\W]?)([1-9][0-9]*)?$/,y=/([1-9][0-9]*)$/g,z={bold:1,bright:1,italic:3,underline:4,blink:5,inverse:7,crossedOut:9,red:31,green:32,yellow:33,blue:34,magenta:35,cyan:36,white:37,redBackground:41,greenBackground:42,yellowBackground:43,blueBackground:44,magentaBackground:45,cyanBackground:46,whiteBackground:47,encircled:52,overlined:53,grey:90,black:90},A={SMILEY:"☺",SOLID_SMILEY:"☻",HEART:"♥",DIAMOND:"♦",CLOVE:"♣",SPADE:"♠",DOT:"•",SQUARE_CIRCLE:"◘",CIRCLE:"○",FILLED_SQUARE_CIRCLE:"◙",MALE:"♂",FEMALE:"♀",EIGHT_NOTE:"♪",DOUBLE_EIGHTH_NOTE:"♫",SUN:"☼",PLAY:"►",REWIND:"◄",UP_DOWN:"↕",PILCROW:"¶",SECTION:"§",THICK_MINUS:"▬",SMALL_UP_DOWN:"↨",UP_ARROW:"↑",DOWN_ARROW:"↓",RIGHT_ARROW:"→",LEFT_ARROW:"←",RIGHT_ANGLE:"∟",LEFT_RIGHT_ARROW:"↔",TRIANGLE:"▲",DOWN_TRIANGLE:"▼",HOUSE:"⌂",C_CEDILLA:"Ç",U_UMLAUT:"ü",E_ACCENT:"é",A_LOWER_CIRCUMFLEX:"â",A_LOWER_UMLAUT:"ä",A_LOWER_GRAVE_ACCENT:"à",A_LOWER_CIRCLE_OVER:"å",C_LOWER_CIRCUMFLEX:"ç",E_LOWER_CIRCUMFLEX:"ê",E_LOWER_UMLAUT:"ë",E_LOWER_GRAVE_ACCENT:"è",I_LOWER_UMLAUT:"ï",I_LOWER_CIRCUMFLEX:"î",I_LOWER_GRAVE_ACCENT:"ì",A_UPPER_UMLAUT:"Ä",A_UPPER_CIRCLE:"Å",E_UPPER_ACCENT:"É",A_E_LOWER:"æ",A_E_UPPER:"Æ",O_LOWER_CIRCUMFLEX:"ô",O_LOWER_UMLAUT:"ö",O_LOWER_GRAVE_ACCENT:"ò",U_LOWER_CIRCUMFLEX:"û",U_LOWER_GRAVE_ACCENT:"ù",Y_LOWER_UMLAUT:"ÿ",O_UPPER_UMLAUT:"Ö",U_UPPER_UMLAUT:"Ü",CENTS:"¢",POUND:"£",YEN:"¥",CURRENCY:"¤",PTS:"₧",FUNCTION:"ƒ",A_LOWER_ACCENT:"á",I_LOWER_ACCENT:"í",O_LOWER_ACCENT:"ó",U_LOWER_ACCENT:"ú",N_LOWER_TILDE:"ñ",N_UPPER_TILDE:"Ñ",A_SUPER:"ª",O_SUPER:"º",UPSIDEDOWN_QUESTION:"¿",SIDEWAYS_L:"⌐",NEGATION:"¬",ONE_HALF:"½",ONE_FOURTH:"¼",UPSIDEDOWN_EXCLAMATION:"¡",DOUBLE_LEFT:"«",DOUBLE_RIGHT:"»",LIGHT_SHADED_BOX:"░",MEDIUM_SHADED_BOX:"▒",DARK_SHADED_BOX:"▓",VERTICAL_LINE:"│",MAZE__SINGLE_RIGHT_T:"┤",MAZE_SINGLE_RIGHT_TOP:"┐",MAZE_SINGLE_RIGHT_BOTTOM_SMALL:"┘",MAZE_SINGLE_LEFT_TOP_SMALL:"┌",MAZE_SINGLE_LEFT_BOTTOM_SMALL:"└",MAZE_SINGLE_LEFT_T:"├",MAZE_SINGLE_BOTTOM_T:"┴",MAZE_SINGLE_TOP_T:"┬",MAZE_SINGLE_CENTER:"┼",MAZE_SINGLE_HORIZONTAL_LINE:"─",MAZE_SINGLE_RIGHT_DOUBLECENTER_T:"╡",MAZE_SINGLE_RIGHT_DOUBLE_BL:"╛",MAZE_SINGLE_RIGHT_DOUBLE_T:"╢",MAZE_SINGLE_RIGHT_DOUBLEBOTTOM_TOP:"╖",MAZE_SINGLE_RIGHT_DOUBLELEFT_TOP:"╕",MAZE_SINGLE_LEFT_DOUBLE_T:"╞",MAZE_SINGLE_BOTTOM_DOUBLE_T:"╧",MAZE_SINGLE_TOP_DOUBLE_T:"╤",MAZE_SINGLE_TOP_DOUBLECENTER_T:"╥",MAZE_SINGLE_BOTTOM_DOUBLECENTER_T:"╨",MAZE_SINGLE_LEFT_DOUBLERIGHT_BOTTOM:"╘",MAZE_SINGLE_LEFT_DOUBLERIGHT_TOP:"╒",MAZE_SINGLE_LEFT_DOUBLEBOTTOM_TOP:"╓",MAZE_SINGLE_LEFT_DOUBLETOP_BOTTOM:"╙",MAZE_SINGLE_LEFT_TOP:"Γ",MAZE_SINGLE_RIGHT_BOTTOM:"╜",MAZE_SINGLE_LEFT_CENTER:"╟",MAZE_SINGLE_DOUBLECENTER_CENTER:"╫",MAZE_SINGLE_DOUBLECROSS_CENTER:"╪",MAZE_DOUBLE_LEFT_CENTER:"╣",MAZE_DOUBLE_VERTICAL:"║",MAZE_DOUBLE_RIGHT_TOP:"╗",MAZE_DOUBLE_RIGHT_BOTTOM:"╝",MAZE_DOUBLE_LEFT_BOTTOM:"╚",MAZE_DOUBLE_LEFT_TOP:"╔",MAZE_DOUBLE_BOTTOM_T:"╩",MAZE_DOUBLE_TOP_T:"╦",MAZE_DOUBLE_LEFT_T:"╠",MAZE_DOUBLE_HORIZONTAL:"═",MAZE_DOUBLE_CROSS:"╬",SOLID_RECTANGLE:"█",THICK_LEFT_VERTICAL:"▌",THICK_RIGHT_VERTICAL:"▐",SOLID_SMALL_RECTANGLE_BOTTOM:"▄",SOLID_SMALL_RECTANGLE_TOP:"▀",PHI_UPPER:"Φ",INFINITY:"∞",INTERSECTION:"∩",DEFINITION:"≡",PLUS_MINUS:"±",GT_EQ:"≥",LT_EQ:"≤",THEREFORE:"⌠",SINCE:"∵",DOESNOT_EXIST:"∄",EXISTS:"∃",FOR_ALL:"∀",EXCLUSIVE_OR:"⊕",BECAUSE:"⌡",DIVIDE:"÷",APPROX:"≈",DEGREE:"°",BOLD_DOT:"∙",DOT_SMALL:"·",CHECK:"√",ITALIC_X:"✗",SUPER_N:"ⁿ",SQUARED:"²",CUBED:"³",SOLID_BOX:"■",PERMILE:"‰",REGISTERED_TM:"®",COPYRIGHT:"©",TRADEMARK:"™",BETA:"β",GAMMA:"γ",ZETA:"ζ",ETA:"η",IOTA:"ι",KAPPA:"κ",LAMBDA:"λ",NU:"ν",XI:"ξ",OMICRON:"ο",RHO:"ρ",UPSILON:"υ",CHI_LOWER:"φ",CHI_UPPER:"χ",PSI:"ψ",ALPHA:"α",ESZETT:"ß",PI:"π",SIGMA_UPPER:"Σ",SIGMA_LOWER:"σ",MU:"µ",TAU:"τ",THETA:"Θ",OMEGA:"Ω",DELTA:"δ",PHI_LOWER:"φ",EPSILON:"ε"},B={toArray:k,pad:h,truncate:i,multiply:l,format:j,style:m,escape:n,trim:o,trimLeft:p,trimRight:q,isEmpty:r};
+return a.define(b.isString,B).define(b.isArray,{style:m}).expose(B).expose({characters:A})}"undefined"!=typeof c?"undefined"!=typeof b&&b.exports&&(b.exports=d(a("extended"),a("is-extended"),a("date-extended"),a("array-extended"))):"function"==typeof define&&define.amd?define(["extended","is-extended","date-extended","array-extended"],function(a,b,c,e){return d(a,b,c,e)}):this.stringExtended=d(this.extended,this.isExtended,this.dateExtended,this.arrayExtended)}.call(this)},{"array-extended":39,"date-extended":40,extended:43,"is-extended":53}]},{},[1]);
\ No newline at end of file
diff --git a/examples/counter/counter.nools b/examples/counter/counter.nools
index e3933c3..c0f71ad 100644
--- a/examples/counter/counter.nools
+++ b/examples/counter/counter.nools
@@ -31,7 +31,7 @@ rule count {
$ctr: Counter $ctr.count % 1000 == 0 {count: $count}
}
then{
- console.log("Imma countin...");
+ console.log("Imma countin... %d", $count);
modify($ctr, function(){this.count = $count + 1;});
}
}
diff --git a/history.md b/history.md
index 56e70f9..fa9731e 100644
--- a/history.md
+++ b/history.md
@@ -1,3 +1,8 @@
+#0.1.13
+* Fixed issue [#68](https://github.com/C2FO/nools/issues/68) where `matchUntilHalt` uses a lot of CPU
+* Fixed issue [#45](https://github.com/C2FO/nools/issues/45), now compiled rules support `or` constraint with more than 2 inner constraints.
+* Added new feature to address [#76](https://github.com/C2FO/nools/issues/76), now you can use `deleteFlows` to dispose all flows, or use `hasFlow` to check if a flow is already registred with `nools`.
+
# 0.1.12
* Fixed issue in node v0.6 where path.sep is not found.
diff --git a/lib/executionStrategy.js b/lib/executionStrategy.js
new file mode 100644
index 0000000..8b893b4
--- /dev/null
+++ b/lib/executionStrategy.js
@@ -0,0 +1,100 @@
+var extd = require("./extended"),
+ Promise = extd.Promise,
+ nextTick = require("./nextTick"),
+ isPromiseLike = extd.isPromiseLike;
+
+Promise.extend({
+ instance: {
+
+ looping: false,
+
+ constructor: function (flow, matchUntilHalt) {
+ this._super([]);
+ this.flow = flow;
+ this.agenda = flow.agenda;
+ this.rootNode = flow.rootNode;
+ this.matchUntilHalt = !!(matchUntilHalt);
+ extd.bindAll(this, ["onAlter", "callNext"]);
+ },
+
+ halt: function () {
+ this.__halted = true;
+ if (!this.looping) {
+ this.callback();
+ }
+ },
+
+ onAlter: function () {
+ this.flowAltered = true;
+ if (!this.looping && this.matchUntilHalt && !this.__halted) {
+ this.callNext();
+ }
+ },
+
+ setup: function () {
+ var flow = this.flow;
+ this.rootNode.resetCounter();
+ flow.on("assert", this.onAlter);
+ flow.on("modify", this.onAlter);
+ flow.on("retract", this.onAlter);
+ },
+
+ tearDown: function () {
+ var flow = this.flow;
+ flow.removeListener("assert", this.onAlter);
+ flow.removeListener("modify", this.onAlter);
+ flow.removeListener("retract", this.onAlter);
+ },
+
+ __handleAsyncNext: function (next) {
+ var self = this;
+ return next.addCallback(function () {
+ self.looping = false;
+ if (self.flowAltered) {
+ self.rootNode.incrementCounter();
+ self.flowAltered = false;
+ if (!self.__halted) {
+ self.callNext();
+ } else {
+ self.callback();
+ }
+ } else if (!self.matchUntilHalt || self.__halted) {
+ self.callback();
+ }
+ self = null;
+ }).addErrback(this.errback);
+ },
+
+ __handleSyncNext: function (next) {
+ this.looping = false;
+ if (this.flowAltered) {
+ this.rootNode.incrementCounter();
+ this.flowAltered = false;
+ }
+ if (next && !this.__halted) {
+ nextTick(this.callNext);
+ } else if (!this.matchUntilHalt || this.__halted) {
+ this.callback();
+ }
+ return next;
+ },
+
+ callback: function () {
+ this.tearDown();
+ this._super(arguments);
+ },
+
+
+ callNext: function () {
+ this.looping = true;
+ var next = this.agenda.fireNext();
+ return isPromiseLike(next) ? this.__handleAsyncNext(next) : this.__handleSyncNext(next);
+ },
+
+ execute: function () {
+ this.setup();
+ this.callNext();
+ return this;
+ }
+ }
+}).as(module);
\ No newline at end of file
diff --git a/lib/flow.js b/lib/flow.js
new file mode 100644
index 0000000..eaafd8a
--- /dev/null
+++ b/lib/flow.js
@@ -0,0 +1,98 @@
+"use strict";
+var extd = require("./extended"),
+ bind = extd.bind,
+ declare = extd.declare,
+ nodes = require("./nodes"),
+ EventEmitter = require("events").EventEmitter,
+ wm = require("./workingMemory"),
+ WorkingMemory = wm.WorkingMemory,
+ ExecutionStragegy = require("./executionStrategy"),
+ AgendaTree = require("./agenda");
+
+module.exports = declare(EventEmitter, {
+
+ instance: {
+
+ name: null,
+
+ executionStrategy: null,
+
+ constructor: function (name) {
+ this.env = null;
+ this.name = name;
+ this.__rules = {};
+ this.workingMemory = new WorkingMemory();
+ this.agenda = new AgendaTree(this);
+ this.agenda.on("fire", bind(this, "emit", "fire"));
+ this.agenda.on("focused", bind(this, "emit", "focused"));
+ this.rootNode = new nodes.RootNode(this.workingMemory, this.agenda);
+ },
+
+ focus: function (focused) {
+ this.agenda.setFocus(focused);
+ return this;
+ },
+
+ halt: function () {
+ var strategy = this.executionStrategy;
+ if (strategy.matchUntilHalt) {
+ strategy.halt();
+ }
+ return this;
+ },
+
+ dispose: function () {
+ this.workingMemory.dispose();
+ this.agenda.dispose();
+ this.rootNode.dispose();
+ },
+
+ assert: function (fact) {
+ this.rootNode.assertFact(this.workingMemory.assertFact(fact));
+ this.emit("assert", fact);
+ return fact;
+ },
+
+ // This method is called to remove an existing fact from working memory
+ retract: function (fact) {
+ //fact = this.workingMemory.getFact(fact);
+ this.rootNode.retractFact(this.workingMemory.retractFact(fact));
+ this.emit("retract", fact);
+ return fact;
+ },
+
+ // This method is called to alter an existing fact. It is essentially a
+ // retract followed by an assert.
+ modify: function (fact, cb) {
+ //fact = this.workingMemory.getFact(fact);
+ this.rootNode.retractFact(this.workingMemory.retractFact(fact));
+ if ("function" === typeof cb) {
+ cb.call(fact, fact);
+ }
+ this.emit("modify", fact);
+ this.rootNode.assertFact(this.workingMemory.assertFact(fact));
+ return fact;
+ },
+
+ print: function () {
+ this.rootNode.print();
+ },
+
+ containsRule: function (name) {
+ return this.rootNode.containsRule(name);
+ },
+
+ rule: function (rule) {
+ this.rootNode.assertRule(rule);
+ },
+
+ matchUntilHalt: function (cb) {
+ return (this.executionStrategy = new ExecutionStragegy(this, true)).execute().classic(cb).promise();
+ },
+
+ match: function (cb) {
+ return (this.executionStrategy = new ExecutionStragegy(this)).execute().classic(cb).promise();
+ }
+
+ }
+});
\ No newline at end of file
diff --git a/lib/flowContainer.js b/lib/flowContainer.js
new file mode 100644
index 0000000..7402a21
--- /dev/null
+++ b/lib/flowContainer.js
@@ -0,0 +1,100 @@
+"use strict";
+var extd = require("./extended"),
+ instanceOf = extd.instanceOf,
+ forEach = extd.forEach,
+ declare = extd.declare,
+ InitialFact = require("./pattern").InitialFact,
+ rule = require("./rule"),
+ Flow = require("./flow");
+
+var flows = {};
+var FlowContainer = declare({
+
+ instance: {
+
+ constructor: function (name, cb) {
+ this.name = name;
+ this.cb = cb;
+ this.__rules = [];
+ this.__defined = {};
+ if (cb) {
+ cb.call(this, this);
+ }
+ if (!flows.hasOwnProperty(name)) {
+ flows[name] = this;
+ } else {
+ throw new Error("Flow with " + name + " already defined");
+ }
+ },
+
+ getDefined: function (name) {
+ var ret = this.__defined[name.toLowerCase()];
+ if (!ret) {
+ throw new Error(name + " flow class is not defined");
+ }
+ return ret;
+ },
+
+ addDefined: function (name, cls) {
+ //normalize
+ this.__defined[name.toLowerCase()] = cls;
+ return cls;
+ },
+
+ rule: function () {
+ this.__rules = this.__rules.concat(rule.createRule.apply(rule, arguments));
+ return this;
+ },
+
+ getSession: function () {
+ var flow = new Flow(this.name);
+ forEach(this.__rules, function (rule) {
+ flow.rule(rule);
+ });
+ flow.assert(new InitialFact());
+ for (var i = 0, l = arguments.length; i < l; i++) {
+ flow.assert(arguments[i]);
+ }
+ return flow;
+ },
+
+ containsRule: function (name) {
+ return extd.some(this.__rules, function (rule) {
+ return rule.name === name;
+ });
+ }
+
+ },
+
+ "static": {
+ getFlow: function (name) {
+ return flows[name];
+ },
+
+ hasFlow: function (name) {
+ return extd.has(flows, name);
+ },
+
+ deleteFlow: function (name) {
+ if (instanceOf(name, FlowContainer)) {
+ name = name.name;
+ }
+ delete flows[name];
+ return FlowContainer;
+ },
+
+ deleteFlows: function () {
+ for (var name in flows) {
+ if (name in flows) {
+ delete flows[name];
+ }
+ }
+ return FlowContainer;
+ },
+
+ create: function (name, cb) {
+ return new FlowContainer(name, cb);
+ }
+ }
+
+}).as(module);
\ No newline at end of file
diff --git a/lib/index.js b/lib/index.js
index 91749c6..02d1c6c 100644
--- a/lib/index.js
+++ b/lib/index.js
@@ -7,237 +7,12 @@
* @header [../readme.md]
*/
-
-
-
"use strict";
var extd = require("./extended"),
fs = require("fs"),
path = require("path"),
- bind = extd.bind,
- forEach = extd.forEach,
- declare = extd.declare,
- Promise = extd.Promise,
- nodes = require("./nodes"),
- EventEmitter = require("events").EventEmitter,
- rule = require("./rule"),
- wm = require("./workingMemory"),
- WorkingMemory = wm.WorkingMemory,
- InitialFact = require("./pattern").InitialFact,
compile = require("./compile"),
- nextTick = require("./nextTick"),
- AgendaTree = require("./agenda");
-
-var nools = {};
-
-
-var Flow = declare(EventEmitter, {
-
- instance: {
-
- name: null,
-
- constructor: function (name) {
- this.env = null;
- this.name = name;
- this.__rules = {};
- this.__wmAltered = false;
- this.workingMemory = new WorkingMemory();
- this.agenda = new AgendaTree(this);
- this.agenda.on("fire", bind(this, "emit", "fire"));
- this.agenda.on("focused", bind(this, "emit", "focused"));
- this.rootNode = new nodes.RootNode(this.workingMemory, this.agenda);
- },
-
- focus: function (focused) {
- this.agenda.setFocus(focused);
- return this;
- },
-
- halt: function () {
- this.__halted = true;
- return this;
- },
-
- dispose: function () {
- this.workingMemory.dispose();
- this.agenda.dispose();
- this.rootNode.dispose();
- },
-
- assert: function (fact) {
- this.__wmAltered = true;
- this.rootNode.assertFact(this.workingMemory.assertFact(fact));
- this.emit("assert", fact);
- return fact;
- },
-
- // This method is called to remove an existing fact from working memory
- retract: function (fact) {
- //fact = this.workingMemory.getFact(fact);
- this.__wmAltered = true;
- this.rootNode.retractFact(this.workingMemory.retractFact(fact));
- this.emit("retract", fact);
- return fact;
- },
-
- // This method is called to alter an existing fact. It is essentially a
- // retract followed by an assert.
- modify: function (fact, cb) {
- //fact = this.workingMemory.getFact(fact);
- this.__wmAltered = true;
- this.rootNode.retractFact(this.workingMemory.retractFact(fact));
- if ("function" === typeof cb) {
- cb.call(fact, fact);
- }
- this.emit("modify", fact);
- this.rootNode.assertFact(this.workingMemory.assertFact(fact));
- return fact;
- },
-
- print: function () {
- this.rootNode.print();
- },
-
- containsRule: function (name) {
- return this.rootNode.containsRule(name);
- },
-
- rule: function (rule) {
- this.rootNode.assertRule(rule);
- },
-
- __loop: function (looper, cb) {
- var ret = new Promise(), rootNode = this.rootNode;
- if (rootNode) {
- rootNode.resetCounter();
- (function fire() {
- nextTick(function () {
- looper(ret, fire);
- });
- })();
- } else {
- ret.callback();
- }
- ret.classic(cb);
- return ret;
- },
-
- __callNext: function () {
- var rootNode = this.rootNode;
- var next = this.agenda.fireNext();
- if (extd.isPromiseLike(next)) {
- var self = this;
- return next.addCallback(function () {
- if (self.__wmAltered) {
- rootNode.incrementCounter();
- self.__wmAltered = false;
- }
- });
- } else {
- if (this.__wmAltered) {
- rootNode.incrementCounter();
- this.__wmAltered = false;
- }
- return next;
- }
- },
-
-
- matchUntilHalt: function (cb) {
- this.__halted = false;
- var self = this;
- return this.__loop(function (ret, fire) {
- if (!self.__halted) {
- var next = self.__callNext();
- if (extd.isBoolean(next)) {
- fire();
- } else {
- next.addCallback(fire).addErrback(ret.errback);
- }
- } else {
- ret.callback();
- }
- }, cb);
- },
-
- match: function (cb) {
- var self = this;
- return this.__loop(function (ret, fire) {
- var next = self.__callNext();
- if (extd.isBoolean(next)) {
- next ? fire() : ret.callback();
- } else {
- next.addCallback(function (fired) {
- return fired ? fire() : ret.callback();
- }).addErrback(ret.errback);
- }
- }, cb);
- }
-
- }
-});
-
-var flows = {};
-var FlowContainer = declare({
-
- instance: {
-
- constructor: function (name, cb) {
- this.name = name;
- this.cb = cb;
- this.__rules = [];
- this.__defined = {};
- if (cb) {
- cb.call(this, this);
- }
- if (!flows.hasOwnProperty(name)) {
- flows[name] = this;
- } else {
- throw new Error("Flow with " + name + " already defined");
- }
- },
-
- getDefined: function (name) {
- var ret = this.__defined[name.toLowerCase()];
- if (!ret) {
- throw new Error(name + " flow class is not defined");
- }
- return ret;
- },
-
- addDefined: function (name, cls) {
- //normalize
- this.__defined[name.toLowerCase()] = cls;
- return cls;
- },
-
- rule: function () {
- this.__rules = this.__rules.concat(rule.createRule.apply(rule, arguments));
- return this;
- },
-
- getSession: function () {
- var flow = new Flow(this.name);
- forEach(this.__rules, function (rule) {
- flow.rule(rule);
- });
- flow.assert(new InitialFact());
- for (var i = 0, l = arguments.length; i < l; i++) {
- flow.assert(arguments[i]);
- }
- return flow;
- },
-
- containsRule: function (name) {
- return extd.some(this.__rules, function (rule) {
- return rule.name === name;
- });
- }
-
- }
-
-}).as(nools, "Flow");
+ FlowContainer = require("./flowContainer");
function isNoolsFile(file) {
return (/\.nools$/).test(file);
@@ -253,24 +28,24 @@ function parse(source) {
return ret;
}
-nools.getFlow = function (name) {
- return flows[name];
-};
+exports.Flow = FlowContainer;
-nools.deleteFlow = function (name) {
- if (extd.instanceOf(name, FlowContainer)) {
- name = name.name;
- }
- delete flows[name];
- return nools;
-};
+exports.getFlow = FlowContainer.getFlow;
+exports.hasFlow = FlowContainer.hasFlow;
+exports.deleteFlow = function (name) {
+ FlowContainer.deleteFlow(name);
+ return this;
+};
-nools.flow = function (name, cb) {
- return new FlowContainer(name, cb);
+exports.deleteFlows = function () {
+ FlowContainer.deleteFlows();
+ return this;
};
-nools.compile = function (file, options, cb) {
+exports.flow = FlowContainer.create;
+
+exports.compile = function (file, options, cb) {
if (extd.isFunction(options)) {
cb = options;
options = {};
@@ -288,7 +63,7 @@ nools.compile = function (file, options, cb) {
return compile.compile(file, options, cb, FlowContainer);
};
-nools.transpile = function (file, options) {
+exports.transpile = function (file, options) {
options = options || {};
if (extd.isString(file)) {
options.name = options.name || (isNoolsFile(file) ? path.basename(file, path.extname(file)) : null);
@@ -297,6 +72,4 @@ nools.transpile = function (file, options) {
return compile.transpile(file, options);
};
-nools.parse = parse;
-
-module.exports = nools;
\ No newline at end of file
+exports.parse = parse;
\ No newline at end of file
diff --git a/lib/parser/nools/tokens.js b/lib/parser/nools/tokens.js
index 76ad139..c1cc91e 100644
--- a/lib/parser/nools/tokens.js
+++ b/lib/parser/nools/tokens.js
@@ -97,7 +97,7 @@ var ruleTokens = {
rule.push(pred);
ruleLine = m[2].replace(/^\s*|\s*$/g, "");
if (pred === "or") {
- rule = rule.concat(parseRules(ruleLine.replace(/,\s*(\$?\w+\s*:)/, joinFunc)));
+ rule = rule.concat(parseRules(ruleLine.replace(/,\s*(\$?\w+\s*:)/g, joinFunc)));
rules.push(rule);
continue;
}
diff --git a/nools.js b/nools.js
index 44a6d0a..893d3c9 100644
--- a/nools.js
+++ b/nools.js
@@ -25,7 +25,7 @@
},{"../":2}],2:[function(require,module,exports){
module.exports = exports = require("./lib");
-},{"./lib":11}],3:[function(require,module,exports){
+},{"./lib":14}],3:[function(require,module,exports){
"use strict";
var extd = require("./extended"),
indexOf = extd.indexOf,
@@ -278,7 +278,7 @@ module.exports = declare(EventEmitter, {
}
});
-},{"./extended":10,"events":44}],4:[function(require,module,exports){
+},{"./extended":11,"events":47}],4:[function(require,module,exports){
/*jshint evil:true*/
"use strict";
var extd = require("../extended"),
@@ -335,7 +335,7 @@ var createDefined = (function () {
exports.createFunction = createFunction;
exports.createDefined = createDefined;
-},{"../extended":10}],5:[function(require,module,exports){
+},{"../extended":11}],5:[function(require,module,exports){
var Buffer=require("__browserify_Buffer").Buffer;/*jshint evil:true*/
"use strict";
var extd = require("../extended"),
@@ -526,7 +526,7 @@ exports.transpile = require("./transpile").transpile;
-},{"../constraintMatcher.js":8,"../extended":10,"../parser":28,"../rule":33,"./common":4,"./transpile":6,"__browserify_Buffer":47}],6:[function(require,module,exports){
+},{"../constraintMatcher.js":8,"../extended":11,"../parser":31,"../rule":36,"./common":4,"./transpile":6,"__browserify_Buffer":50}],6:[function(require,module,exports){
var Buffer=require("__browserify_Buffer").Buffer;var extd = require("../extended"),
forEach = extd.forEach,
indexOf = extd.indexOf,
@@ -678,7 +678,7 @@ exports.transpile = function (flowObj, options) {
-},{"../constraintMatcher":8,"../extended":10,"../parser":28,"__browserify_Buffer":47}],7:[function(require,module,exports){
+},{"../constraintMatcher":8,"../extended":11,"../parser":31,"__browserify_Buffer":50}],7:[function(require,module,exports){
"use strict";
var extd = require("./extended"),
@@ -852,7 +852,7 @@ Constraint.extend({
-},{"./constraintMatcher":8,"./extended":10}],8:[function(require,module,exports){
+},{"./constraintMatcher":8,"./extended":11}],8:[function(require,module,exports){
"use strict";
var extd = require("./extended"),
@@ -1225,7 +1225,7 @@ exports.getIdentifiers = function (constraint) {
-},{"./constraint":7,"./extended":10}],9:[function(require,module,exports){
+},{"./constraint":7,"./extended":11}],9:[function(require,module,exports){
"use strict";
var extd = require("./extended"),
declare = extd.declare,
@@ -1306,7 +1306,108 @@ var Context = declare({
-},{"./extended":10}],10:[function(require,module,exports){
+},{"./extended":11}],10:[function(require,module,exports){
+var extd = require("./extended"),
+ Promise = extd.Promise,
+ nextTick = require("./nextTick"),
+ isPromiseLike = extd.isPromiseLike;
+
+Promise.extend({
+ instance: {
+
+ looping: false,
+
+ constructor: function (flow, matchUntilHalt) {
+ this._super([]);
+ this.flow = flow;
+ this.agenda = flow.agenda;
+ this.rootNode = flow.rootNode;
+ this.matchUntilHalt = !!(matchUntilHalt);
+ extd.bindAll(this, ["onAlter", "callNext"]);
+ },
+
+ halt: function () {
+ this.__halted = true;
+ if (!this.looping) {
+ this.callback();
+ }
+ },
+
+ onAlter: function () {
+ this.flowAltered = true;
+ if (!this.looping && this.matchUntilHalt && !this.__halted) {
+ this.callNext();
+ }
+ },
+
+ setup: function () {
+ var flow = this.flow;
+ this.rootNode.resetCounter();
+ flow.on("assert", this.onAlter);
+ flow.on("modify", this.onAlter);
+ flow.on("retract", this.onAlter);
+ },
+
+ tearDown: function () {
+ var flow = this.flow;
+ flow.removeListener("assert", this.onAlter);
+ flow.removeListener("modify", this.onAlter);
+ flow.removeListener("retract", this.onAlter);
+ },
+
+ __handleAsyncNext: function (next) {
+ var self = this;
+ return next.addCallback(function () {
+ self.looping = false;
+ if (self.flowAltered) {
+ self.rootNode.incrementCounter();
+ self.flowAltered = false;
+ if (!self.__halted) {
+ self.callNext();
+ } else {
+ self.callback();
+ }
+ } else if (!self.matchUntilHalt || self.__halted) {
+ self.callback();
+ }
+ self = null;
+ }).addErrback(this.errback);
+ },
+
+ __handleSyncNext: function (next) {
+ this.looping = false;
+ if (this.flowAltered) {
+ this.rootNode.incrementCounter();
+ this.flowAltered = false;
+ }
+ if (next && !this.__halted) {
+ nextTick(this.callNext);
+ } else if (!this.matchUntilHalt || this.__halted) {
+ this.callback();
+ }
+ return next;
+ },
+
+ callback: function () {
+ this.tearDown();
+ this._super(arguments);
+ },
+
+
+ callNext: function () {
+ this.looping = true;
+ var next = this.agenda.fireNext();
+ return isPromiseLike(next) ? this.__handleAsyncNext(next) : this.__handleSyncNext(next);
+ },
+
+ execute: function () {
+ this.setup();
+ this.callNext();
+ return this;
+ }
+ }
+}).as(module);
+},{"./extended":11,"./nextTick":16}],11:[function(require,module,exports){
module.exports = require("extended")()
.register(require("array-extended"))
.register(require("date-extended"))
@@ -1321,51 +1422,30 @@ module.exports = require("extended")()
.register("LinkedList", require("./linkedList"));
-},{"./linkedList":12,"array-extended":36,"date-extended":37,"declare.js":39,"extended":40,"function-extended":43,"ht":49,"is-extended":50,"leafy":51,"object-extended":52,"promise-extended":53,"string-extended":54}],11:[function(require,module,exports){
-/**
- *
- * @projectName nools
- * @github https://github.com/C2FO/nools
- * @includeDoc [Examples] ../docs-md/examples.md
- * @includeDoc [Change Log] ../History.md
- * @header [../readme.md]
- */
-
-
-
-
+},{"./linkedList":15,"array-extended":39,"date-extended":40,"declare.js":42,"extended":43,"function-extended":46,"ht":52,"is-extended":53,"leafy":54,"object-extended":55,"promise-extended":56,"string-extended":57}],12:[function(require,module,exports){
"use strict";
var extd = require("./extended"),
- fs = require("fs"),
- path = require("path"),
bind = extd.bind,
- forEach = extd.forEach,
declare = extd.declare,
- Promise = extd.Promise,
nodes = require("./nodes"),
EventEmitter = require("events").EventEmitter,
- rule = require("./rule"),
wm = require("./workingMemory"),
WorkingMemory = wm.WorkingMemory,
- InitialFact = require("./pattern").InitialFact,
- compile = require("./compile"),
- nextTick = require("./nextTick"),
+ ExecutionStragegy = require("./executionStrategy"),
AgendaTree = require("./agenda");
-var nools = {};
-
-
-var Flow = declare(EventEmitter, {
+module.exports = declare(EventEmitter, {
instance: {
name: null,
+ executionStrategy: null,
+
constructor: function (name) {
this.env = null;
this.name = name;
this.__rules = {};
- this.__wmAltered = false;
this.workingMemory = new WorkingMemory();
this.agenda = new AgendaTree(this);
this.agenda.on("fire", bind(this, "emit", "fire"));
@@ -1379,7 +1459,10 @@ var Flow = declare(EventEmitter, {
},
halt: function () {
- this.__halted = true;
+ var strategy = this.executionStrategy;
+ if (strategy.matchUntilHalt) {
+ strategy.halt();
+ }
return this;
},
@@ -1390,7 +1473,6 @@ var Flow = declare(EventEmitter, {
},
assert: function (fact) {
- this.__wmAltered = true;
this.rootNode.assertFact(this.workingMemory.assertFact(fact));
this.emit("assert", fact);
return fact;
@@ -1399,7 +1481,6 @@ var Flow = declare(EventEmitter, {
// This method is called to remove an existing fact from working memory
retract: function (fact) {
//fact = this.workingMemory.getFact(fact);
- this.__wmAltered = true;
this.rootNode.retractFact(this.workingMemory.retractFact(fact));
this.emit("retract", fact);
return fact;
@@ -1409,7 +1490,6 @@ var Flow = declare(EventEmitter, {
// retract followed by an assert.
modify: function (fact, cb) {
//fact = this.workingMemory.getFact(fact);
- this.__wmAltered = true;
this.rootNode.retractFact(this.workingMemory.retractFact(fact));
if ("function" === typeof cb) {
cb.call(fact, fact);
@@ -1431,76 +1511,25 @@ var Flow = declare(EventEmitter, {
this.rootNode.assertRule(rule);
},
- __loop: function (looper, cb) {
- var ret = new Promise(), rootNode = this.rootNode;
- if (rootNode) {
- rootNode.resetCounter();
- (function fire() {
- nextTick(function () {
- looper(ret, fire);
- });
- })();
- } else {
- ret.callback();
- }
- ret.classic(cb);
- return ret;
- },
-
- __callNext: function () {
- var rootNode = this.rootNode;
- var next = this.agenda.fireNext();
- if (extd.isPromiseLike(next)) {
- var self = this;
- return next.addCallback(function () {
- if (self.__wmAltered) {
- rootNode.incrementCounter();
- self.__wmAltered = false;
- }
- });
- } else {
- if (this.__wmAltered) {
- rootNode.incrementCounter();
- this.__wmAltered = false;
- }
- return next;
- }
- },
-
-
matchUntilHalt: function (cb) {
- this.__halted = false;
- var self = this;
- return this.__loop(function (ret, fire) {
- if (!self.__halted) {
- var next = self.__callNext();
- if (extd.isBoolean(next)) {
- fire();
- } else {
- next.addCallback(fire).addErrback(ret.errback);
- }
- } else {
- ret.callback();
- }
- }, cb);
+ return (this.executionStrategy = new ExecutionStragegy(this, true)).execute().classic(cb).promise();
},
match: function (cb) {
- var self = this;
- return this.__loop(function (ret, fire) {
- var next = self.__callNext();
- if (extd.isBoolean(next)) {
- next ? fire() : ret.callback();
- } else {
- next.addCallback(function (fired) {
- return fired ? fire() : ret.callback();
- }).addErrback(ret.errback);
- }
- }, cb);
+ return (this.executionStrategy = new ExecutionStragegy(this)).execute().classic(cb).promise();
}
}
});
+},{"./agenda":3,"./executionStrategy":10,"./extended":11,"./nodes":20,"./workingMemory":37,"events":47}],13:[function(require,module,exports){
+"use strict";
+var extd = require("./extended"),
+ instanceOf = extd.instanceOf,
+ forEach = extd.forEach,
+ declare = extd.declare,
+ InitialFact = require("./pattern").InitialFact,
+ rule = require("./rule"),
+ Flow = require("./flow");
var flows = {};
var FlowContainer = declare({
@@ -1559,9 +1588,56 @@ var FlowContainer = declare({
});
}
+ },
+
+ "static": {
+ getFlow: function (name) {
+ return flows[name];
+ },
+
+ hasFlow: function (name) {
+ return extd.has(flows, name);
+ },
+
+ deleteFlow: function (name) {
+ if (instanceOf(name, FlowContainer)) {
+ name = name.name;
+ }
+ delete flows[name];
+ return FlowContainer;
+ },
+
+ deleteFlows: function () {
+ for (var name in flows) {
+ if (name in flows) {
+ delete flows[name];
+ }
+ }
+ return FlowContainer;
+ },
+
+ create: function (name, cb) {
+ return new FlowContainer(name, cb);
+ }
}
-}).as(nools, "Flow");
+}).as(module);
+},{"./extended":11,"./flow":12,"./pattern":35,"./rule":36}],14:[function(require,module,exports){
+/**
+ *
+ * @projectName nools
+ * @github https://github.com/C2FO/nools
+ * @includeDoc [Examples] ../docs-md/examples.md
+ * @includeDoc [Change Log] ../History.md
+ * @header [../readme.md]
+ */
+
+"use strict";
+var extd = require("./extended"),
+ fs = require("fs"),
+ path = require("path"),
+ compile = require("./compile"),
+ FlowContainer = require("./flowContainer");
function isNoolsFile(file) {
return (/\.nools$/).test(file);
@@ -1577,24 +1653,24 @@ function parse(source) {
return ret;
}
-nools.getFlow = function (name) {
- return flows[name];
-};
+exports.Flow = FlowContainer;
-nools.deleteFlow = function (name) {
- if (extd.instanceOf(name, FlowContainer)) {
- name = name.name;
- }
- delete flows[name];
- return nools;
-};
+exports.getFlow = FlowContainer.getFlow;
+exports.hasFlow = FlowContainer.hasFlow;
+exports.deleteFlow = function (name) {
+ FlowContainer.deleteFlow(name);
+ return this;
+};
-nools.flow = function (name, cb) {
- return new FlowContainer(name, cb);
+exports.deleteFlows = function () {
+ FlowContainer.deleteFlows();
+ return this;
};
-nools.compile = function (file, options, cb) {
+exports.flow = FlowContainer.create;
+
+exports.compile = function (file, options, cb) {
if (extd.isFunction(options)) {
cb = options;
options = {};
@@ -1612,7 +1688,7 @@ nools.compile = function (file, options, cb) {
return compile.compile(file, options, cb, FlowContainer);
};
-nools.transpile = function (file, options) {
+exports.transpile = function (file, options) {
options = options || {};
if (extd.isString(file)) {
options.name = options.name || (isNoolsFile(file) ? path.basename(file, path.extname(file)) : null);
@@ -1621,10 +1697,8 @@ nools.transpile = function (file, options) {
return compile.transpile(file, options);
};
-nools.parse = parse;
-
-module.exports = nools;
-},{"./agenda":3,"./compile":5,"./extended":10,"./nextTick":13,"./nodes":17,"./pattern":32,"./rule":33,"./workingMemory":34,"events":44,"fs":45,"path":46}],12:[function(require,module,exports){
+exports.parse = parse;
+},{"./compile":5,"./extended":11,"./flowContainer":13,"fs":48,"path":49}],15:[function(require,module,exports){
var declare = require("declare.js");
declare({
@@ -1679,7 +1753,7 @@ declare({
}).as(module);
-},{"declare.js":39}],13:[function(require,module,exports){
+},{"declare.js":42}],16:[function(require,module,exports){
var process=require("__browserify_process");/*global setImmediate, window, MessageChannel*/
var extd = require("./extended");
var nextTick;
@@ -1717,7 +1791,7 @@ if (typeof setImmediate === "function") {
}
module.exports = nextTick;
-},{"./extended":10,"__browserify_process":48}],14:[function(require,module,exports){
+},{"./extended":11,"__browserify_process":51}],17:[function(require,module,exports){
var AlphaNode = require("./alphaNode");
AlphaNode.extend({
@@ -1745,7 +1819,7 @@ AlphaNode.extend({
}
}
}).as(module);
-},{"./alphaNode":15}],15:[function(require,module,exports){
+},{"./alphaNode":18}],18:[function(require,module,exports){
"use strict";
var Node = require("./node");
@@ -1765,7 +1839,7 @@ Node.extend({
}
}
}).as(module);
-},{"./node":21}],16:[function(require,module,exports){
+},{"./node":24}],19:[function(require,module,exports){
var AlphaNode = require("./alphaNode");
AlphaNode.extend({
@@ -1786,7 +1860,7 @@ AlphaNode.extend({
}
}
}).as(module);
-},{"./alphaNode":15}],17:[function(require,module,exports){
+},{"./alphaNode":18}],20:[function(require,module,exports){
"use strict";
var extd = require("../extended"),
forEach = extd.forEach,
@@ -2005,7 +2079,7 @@ declare({
-},{"../constraint":7,"../extended":10,"../pattern.js":32,"./aliasNode":14,"./equalityNode":16,"./joinNode":18,"./leftAdapterNode":20,"./notNode":22,"./propertyNode":23,"./rightAdapterNode":24,"./terminalNode":25,"./typeNode":26}],18:[function(require,module,exports){
+},{"../constraint":7,"../extended":11,"../pattern.js":35,"./aliasNode":17,"./equalityNode":19,"./joinNode":21,"./leftAdapterNode":23,"./notNode":25,"./propertyNode":26,"./rightAdapterNode":27,"./terminalNode":28,"./typeNode":29}],21:[function(require,module,exports){
var extd = require("../extended"),
values = extd.hash.values,
indexOf = extd.indexOf,
@@ -2145,7 +2219,7 @@ Node.extend({
}
}).as(module);
-},{"../extended":10,"./joinReferenceNode":19,"./node":21}],19:[function(require,module,exports){
+},{"../extended":11,"./joinReferenceNode":22,"./node":24}],22:[function(require,module,exports){
var Node = require("./node");
Node.extend({
@@ -2243,7 +2317,7 @@ Node.extend({
}
}).as(module);
-},{"./node":21}],20:[function(require,module,exports){
+},{"./node":24}],23:[function(require,module,exports){
var Node = require("./node");
Node.extend({
@@ -2278,7 +2352,7 @@ Node.extend({
}
}).as(module);
-},{"./node":21}],21:[function(require,module,exports){
+},{"./node":24}],24:[function(require,module,exports){
var extd = require("../extended"),
forEach = extd.forEach,
indexOf = extd.indexOf,
@@ -2404,7 +2478,7 @@ declare({
}).as(module);
-},{"../context":9,"../extended":10}],22:[function(require,module,exports){
+},{"../context":9,"../extended":11}],25:[function(require,module,exports){
var JoinNode = require("./joinNode"),
Context = require("../context"),
extd = require("../extended"),
@@ -2589,7 +2663,7 @@ JoinNode.extend({
}
}
}).as(module);
-},{"../context":9,"../extended":10,"./joinNode":18}],23:[function(require,module,exports){
+},{"../context":9,"../extended":11,"./joinNode":21}],26:[function(require,module,exports){
var AlphaNode = require("./alphaNode"),
Context = require("../context"),
extd = require("../extended");
@@ -2624,7 +2698,7 @@ AlphaNode.extend({
-},{"../context":9,"../extended":10,"./alphaNode":15}],24:[function(require,module,exports){
+},{"../context":9,"../extended":11,"./alphaNode":18}],27:[function(require,module,exports){
var Node = require("./node");
Node.extend({
@@ -2659,7 +2733,7 @@ Node.extend({
}
}
}).as(module);
-},{"./node":21}],25:[function(require,module,exports){
+},{"./node":24}],28:[function(require,module,exports){
var Node = require("./node"),
extd = require("../extended"),
bind = extd.bind,
@@ -2738,7 +2812,7 @@ Node.extend({
}
}
}).as(module);
-},{"../extended":10,"./node":21}],26:[function(require,module,exports){
+},{"../extended":11,"./node":24}],29:[function(require,module,exports){
var AlphaNode = require("./alphaNode"),
Context = require("../context");
@@ -2778,7 +2852,7 @@ AlphaNode.extend({
}
}
}).as(module);
-},{"../context":9,"./alphaNode":15}],27:[function(require,module,exports){
+},{"../context":9,"./alphaNode":18}],30:[function(require,module,exports){
var process=require("__browserify_process");/* parser generated by jison 0.4.6 */
/*
Returns a Parser object of the following structure:
@@ -3525,7 +3599,7 @@ if (typeof module !== 'undefined' && require.main === module) {
exports.main(process.argv.slice(1));
}
}
-},{"__browserify_process":48,"fs":45,"path":46}],28:[function(require,module,exports){
+},{"__browserify_process":51,"fs":48,"path":49}],31:[function(require,module,exports){
(function () {
"use strict";
var constraintParser = require("./constraint/parser"),
@@ -3543,7 +3617,7 @@ if (typeof module !== 'undefined' && require.main === module) {
return noolParser.parse(source, file);
};
})();
-},{"./constraint/parser":27,"./nools/nool.parser":29}],29:[function(require,module,exports){
+},{"./constraint/parser":30,"./nools/nool.parser":32}],32:[function(require,module,exports){
"use strict";
var tokens = require("./tokens.js"),
@@ -3583,7 +3657,7 @@ exports.parse = function (src, file) {
};
-},{"../../extended":10,"./tokens.js":30,"./util.js":31}],30:[function(require,module,exports){
+},{"../../extended":11,"./tokens.js":33,"./util.js":34}],33:[function(require,module,exports){
var process=require("__browserify_process");"use strict";
var utils = require("./util.js"),
@@ -3683,7 +3757,7 @@ var ruleTokens = {
rule.push(pred);
ruleLine = m[2].replace(/^\s*|\s*$/g, "");
if (pred === "or") {
- rule = rule.concat(parseRules(ruleLine.replace(/,\s*(\$?\w+\s*:)/, joinFunc)));
+ rule = rule.concat(parseRules(ruleLine.replace(/,\s*(\$?\w+\s*:)/g, joinFunc)));
rules.push(rule);
continue;
}
@@ -3894,7 +3968,7 @@ var topLevelTokens = {
module.exports = topLevelTokens;
-},{"../../extended":10,"./util.js":31,"__browserify_process":48,"fs":45}],31:[function(require,module,exports){
+},{"../../extended":11,"./util.js":34,"__browserify_process":51,"fs":48}],34:[function(require,module,exports){
var process=require("__browserify_process");"use strict";
var path = require("path");
@@ -3986,7 +4060,7 @@ var findNextTokenIndex = exports.findNextTokenIndex = function (str, startIndex,
exports.findNextToken = function (str, startIndex, endIndex) {
return str.charAt(findNextTokenIndex(str, startIndex, endIndex));
};
-},{"__browserify_process":48,"path":46}],32:[function(require,module,exports){
+},{"__browserify_process":51,"path":49}],35:[function(require,module,exports){
(function () {
"use strict";
var extd = require("./extended"),
@@ -4081,7 +4155,7 @@ exports.findNextToken = function (str, startIndex, endIndex) {
})();
-},{"./constraint":7,"./constraintMatcher":8,"./extended":10}],33:[function(require,module,exports){
+},{"./constraint":7,"./constraintMatcher":8,"./extended":11}],36:[function(require,module,exports){
"use strict";
var extd = require("./extended"),
isArray = extd.isArray,
@@ -4268,7 +4342,7 @@ exports.createRule = createRule;
-},{"./extended":10,"./parser":28,"./pattern":32}],34:[function(require,module,exports){
+},{"./extended":11,"./parser":31,"./pattern":35}],37:[function(require,module,exports){
"use strict";
var declare = require("declare.js");
@@ -4334,7 +4408,7 @@ declare({
}).as(exports, "WorkingMemory");
-},{"declare.js":39}],35:[function(require,module,exports){
+},{"declare.js":42}],38:[function(require,module,exports){
(function () {
"use strict";
@@ -4379,7 +4453,7 @@ declare({
}).call(this);
-},{"extended":40,"is-extended":50}],36:[function(require,module,exports){
+},{"extended":43,"is-extended":53}],39:[function(require,module,exports){
(function () {
"use strict";
/*global define*/
@@ -5049,7 +5123,7 @@ declare({
-},{"arguments-extended":35,"extended":40,"is-extended":50}],37:[function(require,module,exports){
+},{"arguments-extended":38,"extended":43,"is-extended":53}],40:[function(require,module,exports){
(function () {
"use strict";
@@ -5997,7 +6071,7 @@ declare({
-},{"array-extended":36,"extended":40,"is-extended":50}],38:[function(require,module,exports){
+},{"array-extended":39,"extended":43,"is-extended":53}],41:[function(require,module,exports){
(function () {
/**
@@ -6924,9 +6998,9 @@ declare({
-},{}],39:[function(require,module,exports){
+},{}],42:[function(require,module,exports){
module.exports = require("./declare.js");
-},{"./declare.js":38}],40:[function(require,module,exports){
+},{"./declare.js":41}],43:[function(require,module,exports){
(function () {
"use strict";
/*global extender is, dateExtended*/
@@ -7025,7 +7099,7 @@ module.exports = require("./declare.js");
-},{"extender":42}],41:[function(require,module,exports){
+},{"extender":45}],44:[function(require,module,exports){
(function () {
/*jshint strict:false*/
@@ -7566,9 +7640,9 @@ module.exports = require("./declare.js");
}
}).call(this);
-},{"declare.js":39}],42:[function(require,module,exports){
+},{"declare.js":42}],45:[function(require,module,exports){
module.exports = require("./extender.js");
-},{"./extender.js":41}],43:[function(require,module,exports){
+},{"./extender.js":44}],46:[function(require,module,exports){
(function () {
"use strict";
@@ -7807,7 +7881,7 @@ module.exports = require("./extender.js");
-},{"arguments-extended":35,"extended":40,"is-extended":50}],44:[function(require,module,exports){
+},{"arguments-extended":38,"extended":43,"is-extended":53}],47:[function(require,module,exports){
var process=require("__browserify_process");if (!process.EventEmitter) process.EventEmitter = function () {};
var EventEmitter = exports.EventEmitter = process.EventEmitter;
@@ -8003,10 +8077,10 @@ EventEmitter.listenerCount = function(emitter, type) {
return ret;
};
-},{"__browserify_process":48}],45:[function(require,module,exports){
+},{"__browserify_process":51}],48:[function(require,module,exports){
// nothing to see here... no file methods for the browser
-},{}],46:[function(require,module,exports){
+},{}],49:[function(require,module,exports){
var process=require("__browserify_process");function filter (xs, fn) {
var res = [];
for (var i = 0; i < xs.length; i++) {
@@ -8185,7 +8259,7 @@ exports.relative = function(from, to) {
exports.sep = '/';
-},{"__browserify_process":48}],47:[function(require,module,exports){
+},{"__browserify_process":51}],50:[function(require,module,exports){
require=(function(e,t,n,r){function i(r){if(!n[r]){if(!t[r]){if(e)return e(r);throw new Error("Cannot find module '"+r+"'")}var s=n[r]={exports:{}};t[r][0](function(e){var n=t[r][1][e];return i(n?n:e)},s,s.exports)}return n[r].exports}for(var s=0;sf&&j>f&&f++;);c=g[f]-h[f],c||(c=i-j)}return c||(c=a.recency-b.recency),c>0?1:-1},j=e({instance:{constructor:function(){this.memory={},this.memoryValues=new g},clear:function(){this.memoryValues.clear(),this.memory={},this.memory.length=this.memoryValues.length=0},get:function(a){var b=this.memory[a.id];return b?b.data:[]},remove:function(a){for(var b,c,e,f,g=a.match.facts,h=g.length,i=this.memoryValues,j=this.memory,k=-1;++k-1;)c=h[i],f.remove(c),e.remove(c),g.remove(c);h.length=0},retract:function(a,b){var c=this.rules[a.name],d=c.tree,e=c.factTable,f=this.getAgendaGroup(a.rule.agendaGroup);d.traverse(d.__root,k,function(a){b(a)&&(e.remove(a),f.remove(a),d.remove(a))})},insert:function(a,b){var c=this.rules[a.name],d=a.rule,e=d.agendaGroup;c.tree.insert(b),this.getAgendaGroup(e).insert(b),e&&d.autoFocus&&this.setFocus(e),c.factTable.insert(b)},dispose:function(){for(var a in this.agendaGroups)this.agendaGroups[a].clear();var b=this.rules;for(a in b)a in b&&(b[a].tree.clear(),b[a].factTable.clear());this.rules={}}}})},{"./extended":10,events:44}],4:[function(require,module,exports){"use strict";var extd=require("../extended"),forEach=extd.forEach,isString=extd.isString;exports.modifiers=["assert","modify","retract","emit","halt","focus"];var createFunction=function(body,defined,scope,scopeNames,definedNames){var declares=[];forEach(definedNames,function(a){-1!==body.indexOf(a)&&declares.push("var "+a+"= defined."+a+";")}),forEach(scopeNames,function(a){-1!==body.indexOf(a)&&declares.push("var "+a+"= scope."+a+";")}),body=["((function(){",declares.join(""),"\n return ",body,"\n})())"].join("");try{return eval(body)}catch(e){throw new Error("Invalid action : "+body+"\n"+e.message)}},createDefined=function(){var a=function(a){a=isString(a)?new Function("return "+a+";")():a;var b=a.hasOwnProperty("constructor")&&"function"==typeof a.constructor?a.constructor:function(b){b=b||{};for(var c in b)c in a&&(this[c]=b[c])},c=b.prototype;for(var d in a)c[d]=a[d];return b};return function(b){return a(b.properties)}}();exports.createFunction=createFunction,exports.createDefined=createDefined},{"../extended":10}],5:[function(a,b,c){var d=a("__browserify_Buffer").Buffer,e=a("../extended"),f=a("../parser"),g=a("../constraintMatcher.js"),h=e.indexOf,i=e.forEach,j=e.removeDuplicates,k=e.map,l=e.hash,m=l.keys,n=e.merge,o=a("../rule"),p=a("./common"),q=p.createDefined,r=p.createFunction,s=function(a,b,c,d){var f=[];i(b,function(b){-1!==a.indexOf(b)&&f.push("var "+b+"= facts."+b+";")}),e(c).keys().forEach(function(b){-1!==a.indexOf(b)&&f.push("var "+b+"= defined."+b+";")}),e(d).keys().forEach(function(b){-1!==a.indexOf(b)&&f.push("var "+b+"= scope."+b+";")});var g=["facts","flow"];/next\(.*\)/.test(a)&&g.push("next"),a="with(flow){"+f.join("")+a+"}";try{return new Function("defined, scope","return "+new Function(g.join(","),a).toString())(c,d)}catch(h){throw new Error("Invalid action : "+a+"\n"+h.message)}},t=function(){var a=function(a,b,c,d,j){var k=[],l=a[0],m=a[1],n=a[2],o=a[3];if(e.isHash(n)&&(o=n,n=null),!l||!(l=d[l]))throw new Error("Invalid class "+a[0]+" for rule "+j);if(k.push(l),k.push(m,n,o),c.push(k),b.push(m),n&&i(g.getIdentifiers(f.parseConstraint(n)),function(a){b.push(a)}),e.isObject(o))for(var p in o){var q=o[p];-1===h(b,q)&&b.push(q)}};return function(b,c,d){var f=b.name;if(e.isEmpty(b))throw new Error("Rule is empty");var g=b.options||{};g.scope=d;var h=b.constraints||[],k=h.length;k||(h=["true"]);var l=b.action;if(e.isUndefined(l))throw new Error("No action was defined for rule "+f);var m=[],n=[];return e(h).forEach(function(b){if(b.length){var d=b[0];if("not"===d){var e=[];b.shift(),a(b,n,e,c,f);var g=e[0];g.unshift(d),m.push(g)}else if("or"===d){var h=[d];b.shift(),i(b,function(b){a(b,n,h,c,f)}),m.push(h)}else a(b,n,m,c,f),n=j(n)}}),o.createRule(f,g,m,s(l,n,c,d))}}();c.parse=function(a,b){return f.parseRuleSet(a,b)},c.compile=function(a,b,c,f){e.isFunction(b)?(c=b,b={}):(b=b||{},c=null);var g=a.name||b.name;if(!g)throw new Error("Name must be present in JSON or options");var h=new f(g),j=n({Array:Array,String:String,Number:Number,Boolean:Boolean,RegExp:RegExp,Date:Date,Object:Object},b.define||{});"undefined"!=typeof d&&(j.Buffer=d);var l=n({console:console},b.scope);i(a.define,function(a){j[a.name]=q(a)}),e(j).forEach(function(a,b){h.addDefined(b,a)});var o=e(a.scope).pluck("name").union(e(l).keys().value()).value(),p=k(m(j),function(a){return a});i(a.scope,function(a){l[a.name]=r(a.body,j,l,o,p)});var s=a.rules;return s.length&&i(s,function(a){h.__rules=h.__rules.concat(t(a,j,l))}),c&&c.call(h,h),h},c.transpile=a("./transpile").transpile},{"../constraintMatcher.js":8,"../extended":10,"../parser":28,"../rule":33,"./common":4,"./transpile":6,__browserify_Buffer:47}],6:[function(a,b,c){function d(a){a=l(a)?new Function("return "+a+";")():a;var b,c=["(function(){"];a.hasOwnProperty("constructor")&&"function"==typeof a.constructor?c.push("var Defined = "+a.constructor.toString()+";"):c.push("var Defined = function(opts){ for(var i in opts){if(opts.hasOwnProperty(i)){this[i] = opts[i];}}};"),c.push("var proto = Defined.prototype;");for(var d in a)a.hasOwnProperty(d)&&(b=a[d],c.push("proto."+d+" = "+(h.isFunction(b)?b.toString():h.format("%j",b))+";"));return c.push("return Defined;"),c.push("}())"),c.join("")}function e(a,b,c,d){var e=[];i(b,function(b){-1!==a.indexOf(b)&&e.push("var "+b+"= facts."+b+";")}),h(c).keys().forEach(function(b){-1!==a.indexOf(b)&&e.push("var "+b+"= defined."+b+";")}),h(d).keys().forEach(function(b){-1!==a.indexOf(b)&&e.push("var "+b+"= scope."+b+";")});var f=["facts","flow"];/next\(.*\)/.test(a)&&f.push("next"),a=e.join("")+a;try{return["function(",f.join(","),"){with(flow){",a,"}}"].join("")}catch(g){throw new Error("Invalid action : "+a+"\n"+g.message)}}function f(a,b){a=a.slice(0);var c=[];if("or"===a[0])return c.push('["'+a.shift()+'"'),c.push(h.map(a,function(a){return f(a,b)}).join(",")+"]"),c;if("not"===a[0]&&c.push('"',a.shift(),'", '),b.push(a[1]),c.push(a[0],', "'+a[1].replace(/"/g,'\\"')+'"'),a.splice(0,2),a.length){var d=a.shift();h.isString(d)?(c.push(',"'+d.replace(/"/g,'\\"'),'"'),i(m.getIdentifiers(n.parseConstraint(d)),function(a){b.push(a)})):(c.push(',"true"'),a.unshift(d))}if(a.length){var e=a.shift();h(e).values().forEach(function(a){-1===j(b,a)&&b.push(a)}),c.push(","+h.format("%j",[e]))}return"["+c.join("")+"]"}var g=a("__browserify_Buffer").Buffer,h=a("../extended"),i=h.forEach,j=h.indexOf,k=h.merge,l=h.isString,m=a("../constraintMatcher"),n=a("../parser");c.transpile=function(a,b){b=b||{};var c=[];c.push("(function(){"),c.push("return function(options){"),c.push("options = options || {};"),c.push("var bind = function(scope, fn){return function(){return fn.apply(scope, arguments);};}, defined = options.defined || {}, scope = options.scope || {};");var i=k({Array:Array,String:String,Number:Number,Boolean:Boolean,RegExp:RegExp,Date:Date,Object:Object},b.define||{});"undefined"!=typeof g&&(i.Buffer=g);var j=k({console:console},b.scope);return c.push(["return nools.flow('",b.name,"', function(){"].join("")),c.push(h(a.define||[]).map(function(a){var b=a.name;return a[b]={},["var",b,"= defined."+b,"= this.addDefined('"+b+"',",d(a.properties)+");"].join(" ")}).value().join("\n")),c.push(h(a.scope||[]).map(function(a){var b=a.name;return j[b]={},["var",b,"= scope."+b,"= ",a.body,";"].join(" ")}).value().join("\n")),c.push("scope.console = console;\n"),c.push(h(a.rules||[]).map(function(a){var b=[],c=["this.rule('",a.name.replace(/'/g,"\\'"),"'"],d=h.merge(a.options||{},{scope:"scope"});return c.push(",",h.format("%j",[d]).replace(/(:"scope")/,":scope")),a.constraints&&!h.isEmpty(a.constraints)&&(c.push(", ["),c.push(h(a.constraints).map(function(a){return f(a,b)}).value().join(",")),c.push("]")),c.push(",",e(a.action,b,i,j)),c.push(");"),c.join("")}).value().join("")),c.push("});"),c.push("};"),c.push("}());"),c.join("")}},{"../constraintMatcher":8,"../extended":10,"../parser":28,__browserify_Buffer:47}],7:[function(a,b,c){"use strict";var d,e=a("./extended"),f=e.merge,g=e.instanceOf,h=e.filter,i=e.declare,j=i({instance:{constructor:function(b,c){d||(d=a("./constraintMatcher")),this.type=b,this.constraint=c},assert:function(){throw new Error("not implemented")},equal:function(a){return g(a,this._static)&&this.get("alias")===a.get("alias")&&e.deepEqual(this.constraint,a.constraint)},getters:{variables:function(){return[this.get("alias")]}}}});j.extend({instance:{constructor:function(a){this._super(["object",a])},assert:function(a){return a instanceof this.constraint||a.constructor===this.constraint},equal:function(a){return g(a,this._static)&&this.constraint===a.constraint}}}).as(c,"ObjectConstraint"),j.extend({instance:{constructor:function(a,b){this._super(["equality",a]),b=b||{},this.pattern=b.pattern,this._matcher=d.getMatcher(a,b.scope||{})},assert:function(a){return this._matcher(a)}}}).as(c,"EqualityConstraint"),j.extend({instance:{constructor:function(){this._super(["equality",[!0]])},equal:function(a){return g(a,this._static)&&this.get("alias")===a.get("alias")},assert:function(){return!0}}}).as(c,"TrueConstraint"),j.extend({instance:{constructor:function(a,b){this.cache={},this._super(["reference",a]),b=b||{},this.values=[],this.pattern=b.pattern,this._options=b,this._matcher=d.getMatcher(a,b.scope||{})},assert:function(a){try{return this._matcher(a)}catch(b){throw new Error("Error with evaluating pattern "+this.pattern+" "+b.message)}},merge:function(a){var b=this;return a instanceof this._static&&(b=new this._static([this.constraint,a.constraint,"and"],f({},this._options,this._options)),b._alias=this._alias||a._alias,b.vars=this.vars.concat(a.vars)),b},equal:function(a){return g(a,this._static)&&e.deepEqual(this.constraint,a.constraint)},getters:{variables:function(){return this.vars},alias:function(){return this._alias}},setters:{alias:function(a){this._alias=a,this.vars=h(d.getIdentifiers(this.constraint),function(b){return b!==a})}}}}).as(c,"ReferenceConstraint"),j.extend({instance:{constructor:function(a){this._super(["hash",a])},equal:function(a){return e.instanceOf(a,this._static)&&this.get("alias")===a.get("alias")&&e.deepEqual(this.constraint,a.constraint)},assert:function(){return!0},getters:{variables:function(){return this.constraint}}}}).as(c,"HashConstraint")},{"./constraintMatcher":8,"./extended":10}],8:[function(a,b,c){"use strict";var d=a("./extended"),e=d.isArray,f=d.forEach,g=d.some,h=d.map,i=d.indexOf,j=d.isNumber,k=d.removeDuplicates,l=a("./constraint"),m={indexOf:d.indexOf,now:function(){return new Date},Date:function(a,b,c,d,e,f,g){var h=new Date;return j(a)&&h.setYear(a),j(b)&&h.setMonth(b),j(c)&&h.setDate(c),j(d)&&h.setHours(d),j(e)&&h.setMinutes(e),j(f)&&h.setSeconds(f),j(g)&&h.setMilliseconds(g),h},lengthOf:function(a,b){return a.length===b},isTrue:function(a){return a===!0},isFalse:function(a){return a===!1},isNotNull:function(a){return null!==a},dateCmp:function(a,b){return d.compare(a,b)}};f(["years","days","months","hours","minutes","seconds"],function(a){m[a+"FromNow"]=d[a+"FromNow"],m[a+"Ago"]=d[a+"Ago"]}),f(["isArray","isNumber","isHash","isObject","isDate","isBoolean","isString","isRegExp","isNull","isEmpty","isUndefined","isDefined","isUndefinedOrNull","isPromiseLike","isFunction","deepEqual"],function(a){var b=d[a];m[a]=function(){return b.apply(d,arguments)}});var n={equal:function(a,b){var c=!1;return a===b?c=!0:a[2]===b[2]&&(c=-1!==i(["string","number","boolean","regexp","identifier","null"],a[2])?a[0]===b[0]:"unary"===a[2]||"logicalNot"===a[2]?this.equal(a[0],b[0]):this.equal(a[0],b[0])&&this.equal(a[1],b[1])),c},getIdentifiers:function(a){var b=[],c=a[2];if("identifier"===c)return[a[0]];if("function"===c)b=b.concat(this.getIdentifiers(a[0])).concat(this.getIdentifiers(a[1]));else if("string"!==c&&"number"!==c&&"boolean"!==c&&"regexp"!==c&&"unary"!==c&&"unary"!==c)if("prop"===c){if(b=b.concat(this.getIdentifiers(a[0])),a[1])for(var d=a[1];e(d);){if("function"===d[2]){b=b.concat(this.getIdentifiers(d[1]));break}d=d[1]}}else a[0]&&(b=b.concat(this.getIdentifiers(a[0]))),a[1]&&(b=b.concat(this.getIdentifiers(a[1])));return k(b)},toConstraints:function(a,b){var c=[],d=b.alias,e=b.scope||{},f=a[2];return"and"===f?c=c.concat(this.toConstraints(a[0],b)).concat(this.toConstraints(a[1],b)):("composite"===f||"or"===f||"lt"===f||"gt"===f||"lte"===f||"gte"===f||"like"===f||"notLike"===f||"eq"===f||"neq"===f||"in"===f||"notIn"===f||"prop"===f||"propLookup"===f||"function"===f||"logicalNot"===f)&&(g(this.getIdentifiers(a),function(a){return!(a===d||a in m||a in e)})?c.push(new l.ReferenceConstraint(a,b)):c.push(new l.EqualityConstraint(a,b))),c},parse:function(a){return this[a[2]](a[0],a[1])},composite:function(a){return this.parse(a)},and:function(a,b){return["(",this.parse(a),"&&",this.parse(b),")"].join(" ")},or:function(a,b){return["(",this.parse(a),"||",this.parse(b),")"].join(" ")},prop:function(a,b){return"function"===b[2]?[this.parse(a),this.parse(b)].join("."):[this.parse(a),"['",this.parse(b),"']"].join("")},propLookup:function(a,b){return"function"===b[2]?[this.parse(a),this.parse(b)].join("."):[this.parse(a),"[",this.parse(b),"]"].join("")},unary:function(a){return-1*this.parse(a)},plus:function(a,b){return[this.parse(a),"+",this.parse(b)].join(" ")},minus:function(a,b){return[this.parse(a),"-",this.parse(b)].join(" ")},mult:function(a,b){return[this.parse(a),"*",this.parse(b)].join(" ")},div:function(a,b){return[this.parse(a),"/",this.parse(b)].join(" ")},mod:function(a,b){return[this.parse(a),"%",this.parse(b)].join(" ")},lt:function(a,b){return[this.parse(a),"<",this.parse(b)].join(" ")},gt:function(a,b){return[this.parse(a),">",this.parse(b)].join(" ")},lte:function(a,b){return[this.parse(a),"<=",this.parse(b)].join(" ")},gte:function(a,b){return[this.parse(a),">=",this.parse(b)].join(" ")},like:function(a,b){return[this.parse(b),".test(",this.parse(a),")"].join("")},notLike:function(a,b){return["!",this.parse(b),".test(",this.parse(a),")"].join("")},eq:function(a,b){return[this.parse(a),"===",this.parse(b)].join(" ")},neq:function(a,b){return[this.parse(a),"!==",this.parse(b)].join(" ")},"in":function(a,b){return["(indexOf(",this.parse(b),",",this.parse(a),")) != -1"].join("")},notIn:function(a,b){return["(indexOf(",this.parse(b),",",this.parse(a),")) == -1"].join("")},arguments:function(a,b){var c=[];return a&&c.push(this.parse(a)),b&&c.push(this.parse(b)),c.join(",")},array:function(a){var b=[];return a?(b=this.parse(a),e(b)?b:["[",b,"]"].join("")):["[",b.join(","),"]"].join("")},"function":function(a,b){var c=this.parse(b);return[this.parse(a),"(",c,")"].join("")},string:function(a){return"'"+a+"'"},number:function(a){return a},"boolean":function(a){return a},regexp:function(a){return a},identifier:function(a){return a},"null":function(){return"null"},logicalNot:function(a){return["!(",this.parse(a),")"].join("")}},o=c.toJs=function(a,b){var c=n.parse(a);b=b||{};var d=n.getIdentifiers(a),e="var indexOf = definedFuncs.indexOf;"+h(d,function(a){var c=["var ",a," = "];return m.hasOwnProperty(a)?c.push("definedFuncs['",a,"']"):b.hasOwnProperty(a)?c.push("scope['",a,"']"):c.push("'",a,"' in fact ? fact['",a,"'] : hash['",a,"']"),c.push(";"),c.join("")}).join("")+" return !!("+c+");",f=new Function("fact, hash, definedFuncs, scope",e);return function(a,c){return f(a,c,m,b)}};c.getMatcher=function(a,b){return o(a,b)},c.toConstraints=function(a,b){return n.toConstraints(a,b)},c.equal=function(a,b){return n.equal(a,b)},c.getIdentifiers=function(a){return n.getIdentifiers(a)}},{"./constraint":7,"./extended":10}],9:[function(a,b){"use strict";var c=a("./extended"),d=c.declare,e=c.merge,f=c.union,g=Array.prototype.slice,h=d({instance:{constructor:function(a){this.isMatch=!0,a instanceof this._static?(this.isMatch=a.isMatch,this.facts=g.call(a.facts),this.factIds=g.call(a.factIds),this.hashCode=this.factIds.join(":"),this.factHash=e({},a.factHash),this.recency=g.call(a.recency)):a?(this.facts=[a],this.factIds=[a.id],this.recency=[a.recency],this.hashCode=a.id+"",this.factHash=a.factHash||{}):(this.facts=[],this.factIds=[],this.factHash={},this.hashCode="")},merge:function(a){var b=new this._static;return b.isMatch=a.isMatch,b.facts=this.facts.concat(a.facts),b.factIds=this.factIds.concat(a.factIds),b.hashCode=b.factIds.join(":"),b.factHash=e({},this.factHash,a.factHash),b.recency=f(this.recency,a.recency),b}}}),i=d({instance:{match:null,factHash:null,fact:null,hashCode:null,paths:null,constructor:function(a,b,c){this.fact=a,this.paths=b||null;var d=this.match=c||new h(a);this.factHash=d.factHash,this.hashCode=d.hashCode,this.factIds=d.factIds},set:function(a,b){return this.factHash[a]=b,this},isMatch:function(a){return this.match.isMatch=a,this},clone:function(a,b,c){return new i(a||this.fact,b||this.path,c||this.match)}}}).as(b)},{"./extended":10}],10:[function(a,b){b.exports=a("extended")().register(a("array-extended")).register(a("date-extended")).register(a("object-extended")).register(a("string-extended")).register(a("promise-extended")).register(a("function-extended")).register(a("is-extended")).register("HashTable",a("ht")).register("declare",a("declare.js")).register(a("leafy")).register("LinkedList",a("./linkedList"))},{"./linkedList":12,"array-extended":36,"date-extended":37,"declare.js":39,extended:40,"function-extended":43,ht:49,"is-extended":50,leafy:51,"object-extended":52,"promise-extended":53,"string-extended":54}],11:[function(a,b){"use strict";function c(a){return/\.nools$/.test(a)}function d(a){var b;return b=c(a)?r.parse(f.readFileSync(a,"utf8"),a):r.parse(a)}var e=a("./extended"),f=a("fs"),g=a("path"),h=e.bind,i=e.forEach,j=e.declare,k=e.Promise,l=a("./nodes"),m=a("events").EventEmitter,n=a("./rule"),o=a("./workingMemory"),p=o.WorkingMemory,q=a("./pattern").InitialFact,r=a("./compile"),s=a("./nextTick"),t=a("./agenda"),u={},v=j(m,{instance:{name:null,constructor:function(a){this.env=null,this.name=a,this.__rules={},this.__wmAltered=!1,this.workingMemory=new p,this.agenda=new t(this),this.agenda.on("fire",h(this,"emit","fire")),this.agenda.on("focused",h(this,"emit","focused")),this.rootNode=new l.RootNode(this.workingMemory,this.agenda)},focus:function(a){return this.agenda.setFocus(a),this},halt:function(){return this.__halted=!0,this},dispose:function(){this.workingMemory.dispose(),this.agenda.dispose(),this.rootNode.dispose()},assert:function(a){return this.__wmAltered=!0,this.rootNode.assertFact(this.workingMemory.assertFact(a)),this.emit("assert",a),a},retract:function(a){return this.__wmAltered=!0,this.rootNode.retractFact(this.workingMemory.retractFact(a)),this.emit("retract",a),a},modify:function(a,b){return this.__wmAltered=!0,this.rootNode.retractFact(this.workingMemory.retractFact(a)),"function"==typeof b&&b.call(a,a),this.emit("modify",a),this.rootNode.assertFact(this.workingMemory.assertFact(a)),a},print:function(){this.rootNode.print()},containsRule:function(a){return this.rootNode.containsRule(a)},rule:function(a){this.rootNode.assertRule(a)},__loop:function(a,b){var c=new k,d=this.rootNode;return d?(d.resetCounter(),function e(){s(function(){a(c,e)})}()):c.callback(),c.classic(b),c},__callNext:function(){var a=this.rootNode,b=this.agenda.fireNext();if(e.isPromiseLike(b)){var c=this;return b.addCallback(function(){c.__wmAltered&&(a.incrementCounter(),c.__wmAltered=!1)})}return this.__wmAltered&&(a.incrementCounter(),this.__wmAltered=!1),b},matchUntilHalt:function(a){this.__halted=!1;var b=this;return this.__loop(function(a,c){if(b.__halted)a.callback();else{var d=b.__callNext();e.isBoolean(d)?c():d.addCallback(c).addErrback(a.errback)}},a)},match:function(a){var b=this;return this.__loop(function(a,c){var d=b.__callNext();e.isBoolean(d)?d?c():a.callback():d.addCallback(function(b){return b?c():a.callback()}).addErrback(a.errback)},a)}}}),w={},x=j({instance:{constructor:function(a,b){if(this.name=a,this.cb=b,this.__rules=[],this.__defined={},b&&b.call(this,this),w.hasOwnProperty(a))throw new Error("Flow with "+a+" already defined");w[a]=this},getDefined:function(a){var b=this.__defined[a.toLowerCase()];if(!b)throw new Error(a+" flow class is not defined");return b},addDefined:function(a,b){return this.__defined[a.toLowerCase()]=b,b},rule:function(){return this.__rules=this.__rules.concat(n.createRule.apply(n,arguments)),this},getSession:function(){var a=new v(this.name);i(this.__rules,function(b){a.rule(b)}),a.assert(new q);for(var b=0,c=arguments.length;c>b;b++)a.assert(arguments[b]);return a},containsRule:function(a){return e.some(this.__rules,function(b){return b.name===a})}}}).as(u,"Flow");u.getFlow=function(a){return w[a]},u.deleteFlow=function(a){return e.instanceOf(a,x)&&(a=a.name),delete w[a],u},u.flow=function(a,b){return new x(a,b)},u.compile=function(a,b,f){if(e.isFunction(b)?(f=b,b={}):(b=b||{},f=null),e.isString(a)&&(b.name=b.name||(c(a)?g.basename(a,g.extname(a)):null),a=d(a)),!b.name)throw new Error("Name required when compiling nools source");return r.compile(a,b,f,x)},u.transpile=function(a,b){return b=b||{},e.isString(a)&&(b.name=b.name||(c(a)?g.basename(a,g.extname(a)):null),a=d(a)),r.transpile(a,b)},u.parse=d,b.exports=u},{"./agenda":3,"./compile":5,"./extended":10,"./nextTick":13,"./nodes":17,"./pattern":32,"./rule":33,"./workingMemory":34,events:44,fs:45,path:46}],12:[function(a,b){var c=a("declare.js");c({instance:{constructor:function(){this.head=null,this.tail=null,this.length=null},push:function(a){var b=this.tail,c=this.head,d={data:a,prev:b,next:null};return b&&(this.tail.next=d),this.tail=d,c||(this.head=d),this.length++,d},remove:function(a){a.prev?a.prev.next=a.next:this.head=a.next,a.next?a.next.prev=a.prev:this.tail=a.prev,a.data=a.prev=a.next=null,this.length--},forEach:function(a){for(var b={next:this.head};b=b.next;)a(b.data)},clear:function(){this.head=this.tail=null,this.length=0}}}).as(b)},{"declare.js":39}],13:[function(a,b){var c,d=a("__browserify_process"),e=a("./extended");if("function"==typeof setImmediate)c="undefined"!=typeof window?e.bind(window,setImmediate):setImmediate;else if("undefined"!=typeof d)c=d.nextTick;else if("undefined"!=typeof MessageChannel){var f=new MessageChannel,g={},h=g;f.port1.onmessage=function(){g=g.next;var a=g.task;delete g.task,a()},c=function(a){h=h.next={task:a},f.port2.postMessage(0)}}else c=function(a){setTimeout(a,0)};b.exports=c},{"./extended":10,__browserify_process:48}],14:[function(a,b){var c=a("./alphaNode");c.extend({instance:{constructor:function(){this._super(arguments),this.alias=this.constraint.get("alias")},toString:function(){return"AliasNode"+this.__count},assert:function(a){return this.__propagate("assert",a.set(this.alias,a.fact.object))},retract:function(a){this.propagateRetract(a.fact)},equal:function(a){return a instanceof this._static&&this.alias===a.alias}}}).as(b)},{"./alphaNode":15}],15:[function(a,b){"use strict";var c=a("./node");c.extend({instance:{constructor:function(a){this._super([]),this.constraint=a},toString:function(){return"AlphaNode "+this.__count},equal:function(a){return this.constraint.equal(a.constraint)}}}).as(b)},{"./node":21}],16:[function(a,b){var c=a("./alphaNode");c.extend({instance:{constructor:function(){this._super(arguments)},assert:function(a){this.constraint.assert(a.factHash)&&this.__propagate("assert",a)},toString:function(){return"EqualityNode"+this.__count}}}).as(b)},{"./alphaNode":15}],17:[function(a,b,c){"use strict";var d=a("../extended"),e=d.forEach,f=d.some,g=d.declare,h=a("../pattern.js"),i=h.ObjectPattern,j=h.NotPattern,k=h.CompositePattern,l=h.InitialFactPattern,m=a("../constraint"),n=m.HashConstraint,o=m.ReferenceConstraint,p=a("./aliasNode"),q=a("./equalityNode"),r=a("./joinNode"),s=a("./notNode"),t=a("./leftAdapterNode"),u=a("./rightAdapterNode"),v=a("./typeNode"),w=a("./terminalNode"),x=a("./propertyNode");g({instance:{constructor:function(a,b){this.terminalNodes=[],this.joinNodes=[],this.nodes=[],this.constraints=[],this.typeNodes=[],this.__ruleCount=0,this.bucket={counter:0,recency:0},this.agendaTree=b},assertRule:function(a){var b=new w(this.bucket,this.__ruleCount++,a,this.agendaTree);this.__addToNetwork(a,a.pattern,b),this.__mergeJoinNodes(),this.terminalNodes.push(b)},resetCounter:function(){this.bucket.counter=0},incrementCounter:function(){this.bucket.counter++},assertFact:function(a){for(var b=this.typeNodes,c=b.length-1;c>=0;c--)b[c].assert(a)},retractFact:function(a){for(var b=this.typeNodes,c=b.length-1;c>=0;c--)b[c].retract(a)},containsRule:function(a){return f(this.terminalNodes,function(b){return b.rule.name===a})},dispose:function(){for(var a=this.typeNodes,b=a.length-1;b>=0;b--)a[b].dispose()},__mergeJoinNodes:function(){for(var a=this.joinNodes,b=0;b=0;c--){var d=b[c];if(a.equal(d))return d}return b.push(a),a},__createTypeNode:function(a,b){for(var c=new v(b.get("constraints")[0]),d=this.typeNodes,e=d.length-1;e>=0;e--){var f=d[e];if(c.equal(f))return f}return d.push(c),c},__createEqualityNode:function(a,b){return this.__checkEqual(new q(b)).addRule(a)},__createPropertyNode:function(a,b){return this.__checkEqual(new x(b)).addRule(a)},__createAliasNode:function(a,b){return this.__checkEqual(new p(b)).addRule(a)},__createAdapterNode:function(a,b){return("left"===b?new t:new u).addRule(a)},__createJoinNode:function(a,b,c,d){var e;b.rightPattern instanceof j?e=new s:(e=new r,this.joinNodes.push(e));var f=e;if(c instanceof r){var g=this.__createAdapterNode(a,d);f.addOutNode(g,b),f=g}return f.addOutNode(c,b),e.addRule(a)},__addToNetwork:function(a,b,c,d){if(b instanceof i){if(b instanceof j&&(!d||"left"===d))return this.__createBetaNode(a,new k(new l,b),c,d);this.__createAlphaNode(a,b,c,d)}else b instanceof k&&this.__createBetaNode(a,b,c,d)},__createBetaNode:function(a,b,c,d){var e=this.__createJoinNode(a,b,c,d);return this.__addToNetwork(a,b.rightPattern,e,"right"),this.__addToNetwork(a,b.leftPattern,e,"left"),c.addParentNode(e),e},__createAlphaNode:function(a,b,c,d){var e=b.get("constraints"),f=this.__createTypeNode(a,b),g=this.__createAliasNode(a,b);f.addOutNode(g,b),g.addParentNode(f);for(var h=g,i=e.length-1;i>0;i--){var j,k=e[i];if(k instanceof n)j=this.__createPropertyNode(a,k);else{if(k instanceof o){c.constraint.addConstraint(k);continue}j=this.__createEqualityNode(a,k)}h.addOutNode(j,b),j.addParentNode(h),h=j}if(c instanceof r){var l=this.__createAdapterNode(a,d);l.addParentNode(h),h.addOutNode(l,b),h=l}return c.addParentNode(h),h.addOutNode(c,b),f},print:function(){e(this.terminalNodes,function(a){a.print(" ")})}}}).as(c,"RootNode")},{"../constraint":7,"../extended":10,"../pattern.js":32,"./aliasNode":14,"./equalityNode":16,"./joinNode":18,"./leftAdapterNode":20,"./notNode":22,"./propertyNode":23,"./rightAdapterNode":24,"./terminalNode":25,"./typeNode":26}],18:[function(a,b){var c=a("../extended"),d=c.hash.values,e=c.indexOf,f=a("./node"),g=a("./joinReferenceNode");f.extend({instance:{constructor:function(){this._super([]),this.constraint=new g,this.leftMemory={},this.rightMemory={},this.leftTuples=[],this.rightTuples=[]},dispose:function(){this.leftMemory={},this.rightMemory={}},disposeLeft:function(a){this.leftMemory={},this.propagateDispose(a)},disposeRight:function(a){this.rightMemory={},this.propagateDispose(a)},hashCode:function(){return"JoinNode "+this.__count},toString:function(){return"JoinNode "+this.__count},retractResolve:function(a){for(var b=d(this.leftMemory),c=b.length,f=this.leftTuples;--c>-1;)for(var g,h=b[c],i=h.length;--i>-1;)if(g=h[i],this.resolve(g.match,a)){f.splice(e(f,g),1),h.splice(i,1);break}this._propagateRetractResolve(a)},retractLeft:function(a){var b,c,d=this.leftMemory[a.id],f=this.leftTuples;if(d){for(b=-1,c=d.length;++be;e++)this.addOutNode(d,c[e]);a.nodes.remove(d)},this);for(var b=a.parentNodes,c=0,d=a.parentNodes.l;d>c;c++){var e=b[c];this.addParentNode(e),e.nodes.remove(a)}return this},resolve:function(a,b){return a.hashCode===b.hashCode},print:function(a){console.log(a+this.toString()),d(this.parentNodes,function(b){b.print(" "+a)})},addOutNode:function(a,b){this.nodes.contains(a)||this.nodes.put(a,[]),this.nodes.get(a).push(b),this.__entrySet=this.nodes.entrySet()},addParentNode:function(a){-1===e(this.parentNodes,a)&&this.parentNodes.push(a)},shareable:function(){return!1},__propagate:function(a,b,c){c=c||this.nodes;for(var d,e,g,h,j=this.__entrySet,k=j.length;--k>-1;)d=j[k],e=d.key,g=d.value,b.paths?(h=f(g,b.paths)).length&&e[a](new i(b.fact,h,b.match)):e[a](b)},dispose:function(a){this.propagateDispose(a)},retract:function(a){this.propagateRetract(a)},propagateDispose:function(a,b){b=b||this.nodes;for(var c=this.__entrySet,d=c.length-1;d>=0;d--){var e=c[d],f=e.key;f.dispose(a)}},propagateAssert:function(a,b){this.__propagate("assert",a,b||this.nodes)},propagateRetract:function(a,b){this.__propagate("retract",a,b||this.nodes)},assert:function(a){this.propagateAssert(a)},propagateModify:function(a,b){this.__propagate("modify",a,b||this.nodes)}}}).as(b)},{"../context":9,"../extended":10}],22:[function(a,b){var c=a("./joinNode"),d=a("../context"),e=a("../extended"),f=e.indexOf;c.extend({instance:{constructor:function(){this._super(arguments),this.leftTupleMemory={},this.allTuples={}},toString:function(){return"NotNode "+this.__count},retractRight:function(a){var b=this.rightMemory,c=b[a.id],e=this.constraint;if(delete b[a.id],c){var g=f(this.rightTuples,c);this.rightTuples.splice(g,1);for(var h,i,j,k=c.blocking,l=this.rightTuples,m=l.length;h=k.pop();){for(h.blocker=null,e.setLeftContext(h),j=g;m>j;j++)if(i=l[j],e.setRightContext(i),e.isMatch()){h.blocker=i,i.blocking.push(h),this.__addToLeftTupleMemory(h);break}h.blocker||(this.__removeFromLeftTupleMemory(h),this.__addToLeftMemory(h).propagateAssert(new d(h.fact,null,h.match)))}e.clearContexts()}},retractLeft:function(a){for(var b,c,d,e=a.id,g=this.allTuples[a.id]||[];g.length;)b=g.pop(),-1!==f(b.factIds,e)&&(this.__removeFromAllTupleMemory(b),this.__removeFromLeftMemory(b),this.__removeFromLeftTupleMemory(b),(d=b.blocker)&&(c=d.blocking,c.splice(f(c,b),1),b.blocker=null));delete this.leftMemory[e],delete this.leftTupleMemory[e],this.propagateRetract(a)},assertLeft:function(a){var b,c=this.rightTuples,e=this.constraint,f=-1,g=c.length;if(0!==g)for(e.setLeftContext(a);++f-1;)b=c[d],e.setLeftContext(b).isMatch()&&(this._propagateRetractResolve(b.match),this.__removeFromLeftMemory(b),b.blocker=a,a.blocking.push(b),this.__addToLeftTupleMemory(b));e.clearContexts()},__removeFromLeftMemory:function(a){for(var b,c=this.leftMemory[a.fact.id]||[],d=this.leftTuples,e=0,g=d.length;g>e;e++)if(b=d[e],b===a){d.splice(e,1),c.splice(f(c,b),1);break}return this},__removeFromLeftTupleMemory:function(a){for(var b,c=this.leftTupleMemory[a.fact.id]||[],d=0,e=c.length;e>d;d++)if(b=c[d],b===a){c.splice(d,1);break}return this},__addToAllTupleMemory:function(a){for(var b,c,d=a.factIds,e=-1,g=d.length,h=this.allTuples;++eg;g++)b=e[g],c.set(b[1],f[b[0]]);this.__propagate("assert",c)},toString:function(){return"PropertyNode"+this.__count}}}).as(b)},{"../context":9,"../extended":10,"./alphaNode":15}],24:[function(a,b){var c=a("./node");c.extend({instance:{retractResolve:function(a){this.__propagate("retractResolve",a)},dispose:function(a){this.propagateDispose(a)},propagateAssert:function(a){this.__propagate("assertRight",a)},propagateRetract:function(a){this.__propagate("retractRight",a)},propagateResolve:function(a){this.__propagate("retractResolve",a)},modify:function(a){this.__propagate("modifyRight",a)},toString:function(){return"RightAdapterNode "+this.__count}}}).as(b)},{"./node":21}],25:[function(a,b){var c=a("./node"),d=a("../extended"),e=d.bind,f=d.removeDuplicates;c.extend({instance:{constructor:function(a,b,c,d){this._super([]),this.resolve=e(this,this.resolve),this.rule=c,this.index=b,this.name=this.rule.name,this.agenda=d,this.bucket=a,d.register(this)},__assertModify:function(a){var b=a.match;if(b.recency.sort(function(a,b){return a-b}).reverse(),b.facts=f(b.facts),b.isMatch){var c=this.rule,d=this.bucket;this.agenda.insert(this,{rule:c,index:this.index,name:c.name,recency:d.recency++,match:b,counter:d.counter})}},assert:function(a){this.__assertModify(a)},modify:function(a){this.__assertModify(a)},retract:function(a){this.agenda.removeByFact(this,a)},retractRight:function(a){this.agenda.removeByFact(this,a)},retractLeft:function(a){this.agenda.removeByFact(this,a)},assertLeft:function(a){this.__assertModify(a)},assertRight:function(a){this.__assertModify(a)},retractResolve:function(a){var b=this.resolve;this.agenda.retract(this,function(c){return b(c.match,a)})},toString:function(){return"TerminalNode "+this.rule.name}}}).as(b)},{"../extended":10,"./node":21}],26:[function(a,b){var c=a("./alphaNode"),d=a("../context");c.extend({instance:{assert:function(a){this.constraint.assert(a.object)&&this.__propagate("assert",a)},retract:function(a){this.constraint.assert(a.object)&&this.propagateRetract(a)},toString:function(){return"TypeNode"+this.__count},dispose:function(){for(var a=this.__entrySet,b=a.length-1;b>=0;b--){var c=a[b],d=c.key,e=c.value;d.dispose({paths:e})}},__propagate:function(a,b){for(var c=this.__entrySet,e=c.length-1;e>=0;e--){var f=c[e],g=f.key,h=f.value;g[a](new d(b,h))}}}}).as(b)},{"../context":9,"./alphaNode":15}],27:[function(a,b,c){var d=a("__browserify_process"),e=function(){function a(){this.yy={}}var b={trace:function(){},yy:{},symbols_:{error:2,expressions:3,EXPRESSION:4,EOF:5,UNARY_EXPRESSION:6,LITERAL_EXPRESSION:7,"-":8,"!":9,MULTIPLICATIVE_EXPRESSION:10,"*":11,"/":12,"%":13,ADDITIVE_EXPRESSION:14,"+":15,EXPONENT_EXPRESSION:16,"^":17,RELATIONAL_EXPRESSION:18,"<":19,">":20,"<=":21,">=":22,EQUALITY_EXPRESSION:23,"==":24,"!=":25,"=~":26,"!=~":27,IN_EXPRESSION:28,"in":29,ARRAY_EXPRESSION:30,notIn:31,OBJECT_EXPRESSION:32,AND_EXPRESSION:33,"&&":34,OR_EXPRESSION:35,"||":36,ARGUMENT_LIST:37,",":38,IDENTIFIER_EXPRESSION:39,IDENTIFIER:40,".":41,"[":42,STRING_EXPRESSION:43,"]":44,"(":45,")":46,STRING:47,NUMBER_EXPRESSION:48,NUMBER:49,REGEXP_EXPRESSION:50,REGEXP:51,BOOLEAN_EXPRESSION:52,BOOLEAN:53,NULL_EXPRESSION:54,NULL:55,$accept:0,$end:1},terminals_:{2:"error",5:"EOF",8:"-",9:"!",11:"*",12:"/",13:"%",15:"+",17:"^",19:"<",20:">",21:"<=",22:">=",24:"==",25:"!=",26:"=~",27:"!=~",29:"in",31:"notIn",34:"&&",36:"||",38:",",40:"IDENTIFIER",41:".",42:"[",44:"]",45:"(",46:")",47:"STRING",49:"NUMBER",51:"REGEXP",53:"BOOLEAN",55:"NULL"},productions_:[0,[3,2],[6,1],[6,2],[6,2],[10,1],[10,3],[10,3],[10,3],[14,1],[14,3],[14,3],[16,1],[16,3],[18,1],[18,3],[18,3],[18,3],[18,3],[23,1],[23,3],[23,3],[23,3],[23,3],[28,1],[28,3],[28,3],[28,3],[28,3],[33,1],[33,3],[35,1],[35,3],[37,1],[37,3],[39,1],[32,1],[32,3],[32,4],[32,4],[32,3],[32,4],[43,1],[48,1],[50,1],[52,1],[54,1],[30,2],[30,3],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,3],[4,1]],performAction:function(a,b,c,d,e,f){var g=f.length-1;switch(e){case 1:return f[g-1];case 3:this.$=[f[g],null,"unary"];break;case 4:this.$=[f[g],null,"logicalNot"];break;case 6:this.$=[f[g-2],f[g],"mult"];break;case 7:this.$=[f[g-2],f[g],"div"];break;case 8:this.$=[f[g-2],f[g],"mod"];break;case 10:this.$=[f[g-2],f[g],"plus"];break;case 11:this.$=[f[g-2],f[g],"minus"];break;case 13:this.$=[f[g-2],f[g],"pow"];break;case 15:this.$=[f[g-2],f[g],"lt"];break;case 16:this.$=[f[g-2],f[g],"gt"];break;case 17:this.$=[f[g-2],f[g],"lte"];break;case 18:this.$=[f[g-2],f[g],"gte"];break;case 20:this.$=[f[g-2],f[g],"eq"];break;case 21:this.$=[f[g-2],f[g],"neq"];break;case 22:this.$=[f[g-2],f[g],"like"];break;case 23:this.$=[f[g-2],f[g],"notLike"];break;case 25:this.$=[f[g-2],f[g],"in"];break;case 26:this.$=[f[g-2],f[g],"notIn"];break;case 27:this.$=[f[g-2],f[g],"in"];break;case 28:this.$=[f[g-2],f[g],"notIn"];break;case 30:this.$=[f[g-2],f[g],"and"];break;case 32:this.$=[f[g-2],f[g],"or"];break;case 34:this.$=[f[g-2],f[g],"arguments"];break;case 35:this.$=[String(a),null,"identifier"];break;case 37:this.$=[f[g-2],f[g],"prop"];break;case 38:this.$=[f[g-3],f[g-1],"propLookup"];break;case 39:this.$=[f[g-3],f[g-1],"propLookup"];break;case 40:this.$=[f[g-2],[null,null,"arguments"],"function"];break;case 41:this.$=[f[g-3],f[g-1],"function"];break;case 42:this.$=[String(a.replace(/^['|"]|['|"]$/g,"")),null,"string"];break;case 43:this.$=[Number(a),null,"number"];break;case 44:this.$=[a,null,"regexp"];break;case 45:this.$=["true"==a.replace(/^\s+/,""),null,"boolean"];break;case 46:this.$=[null,null,"null"];break;case 47:this.$=[null,null,"array"];break;case 48:this.$=[f[g-1],null,"array"];break;case 56:this.$=[f[g-1],null,"composite"]}},table:[{3:1,4:2,6:28,7:7,8:[1,29],9:[1,30],10:27,14:25,16:17,18:8,23:6,28:5,30:15,32:14,33:4,35:3,39:23,40:[1,26],42:[1,24],43:9,45:[1,16],47:[1,18],48:10,49:[1,19],50:11,51:[1,20],52:12,53:[1,21],54:13,55:[1,22]},{1:[3]},{5:[1,31]},{5:[2,57],36:[1,32],46:[2,57]},{5:[2,31],34:[1,33],36:[2,31],46:[2,31]},{5:[2,29],34:[2,29],36:[2,29],46:[2,29]},{5:[2,24],24:[1,34],25:[1,35],26:[1,36],27:[1,37],34:[2,24],36:[2,24],46:[2,24]},{5:[2,2],8:[2,2],11:[2,2],12:[2,2],13:[2,2],15:[2,2],17:[2,2],19:[2,2],20:[2,2],21:[2,2],22:[2,2],24:[2,2],25:[2,2],26:[2,2],27:[2,2],29:[1,38],31:[1,39],34:[2,2],36:[2,2],46:[2,2]},{5:[2,19],19:[1,40],20:[1,41],21:[1,42],22:[1,43],24:[2,19],25:[2,19],26:[2,19],27:[2,19],34:[2,19],36:[2,19],46:[2,19]},{5:[2,49],8:[2,49],11:[2,49],12:[2,49],13:[2,49],15:[2,49],17:[2,49],19:[2,49],20:[2,49],21:[2,49],22:[2,49],24:[2,49],25:[2,49],26:[2,49],27:[2,49],29:[2,49],31:[2,49],34:[2,49],36:[2,49],38:[2,49],44:[2,49],46:[2,49]},{5:[2,50],8:[2,50],11:[2,50],12:[2,50],13:[2,50],15:[2,50],17:[2,50],19:[2,50],20:[2,50],21:[2,50],22:[2,50],24:[2,50],25:[2,50],26:[2,50],27:[2,50],29:[2,50],31:[2,50],34:[2,50],36:[2,50],38:[2,50],44:[2,50],46:[2,50]},{5:[2,51],8:[2,51],11:[2,51],12:[2,51],13:[2,51],15:[2,51],17:[2,51],19:[2,51],20:[2,51],21:[2,51],22:[2,51],24:[2,51],25:[2,51],26:[2,51],27:[2,51],29:[2,51],31:[2,51],34:[2,51],36:[2,51],38:[2,51],44:[2,51],46:[2,51]},{5:[2,52],8:[2,52],11:[2,52],12:[2,52],13:[2,52],15:[2,52],17:[2,52],19:[2,52],20:[2,52],21:[2,52],22:[2,52],24:[2,52],25:[2,52],26:[2,52],27:[2,52],29:[2,52],31:[2,52],34:[2,52],36:[2,52],38:[2,52],44:[2,52],46:[2,52]},{5:[2,53],8:[2,53],11:[2,53],12:[2,53],13:[2,53],15:[2,53],17:[2,53],19:[2,53],20:[2,53],21:[2,53],22:[2,53],24:[2,53],25:[2,53],26:[2,53],27:[2,53],29:[2,53],31:[2,53],34:[2,53],36:[2,53],38:[2,53],44:[2,53],46:[2,53]},{5:[2,54],8:[2,54],11:[2,54],12:[2,54],13:[2,54],15:[2,54],17:[2,54],19:[2,54],20:[2,54],21:[2,54],22:[2,54],24:[2,54],25:[2,54],26:[2,54],27:[2,54],29:[2,54],31:[2,54],34:[2,54],36:[2,54],38:[2,54],41:[1,44],42:[1,45],44:[2,54],45:[1,46],46:[2,54]},{5:[2,55],8:[2,55],11:[2,55],12:[2,55],13:[2,55],15:[2,55],17:[2,55],19:[2,55],20:[2,55],21:[2,55],22:[2,55],24:[2,55],25:[2,55],26:[2,55],27:[2,55],29:[2,55],31:[2,55],34:[2,55],36:[2,55],38:[2,55],44:[2,55],46:[2,55]},{4:47,6:28,7:7,8:[1,29],9:[1,30],10:27,14:25,16:17,18:8,23:6,28:5,30:15,32:14,33:4,35:3,39:23,40:[1,26],42:[1,24],43:9,45:[1,16],47:[1,18],48:10,49:[1,19],50:11,51:[1,20],52:12,53:[1,21],54:13,55:[1,22]},{5:[2,14],17:[1,48],19:[2,14],20:[2,14],21:[2,14],22:[2,14],24:[2,14],25:[2,14],26:[2,14],27:[2,14],34:[2,14],36:[2,14],46:[2,14]},{5:[2,42],8:[2,42],11:[2,42],12:[2,42],13:[2,42],15:[2,42],17:[2,42],19:[2,42],20:[2,42],21:[2,42],22:[2,42],24:[2,42],25:[2,42],26:[2,42],27:[2,42],29:[2,42],31:[2,42],34:[2,42],36:[2,42],38:[2,42],44:[2,42],46:[2,42]},{5:[2,43],8:[2,43],11:[2,43],12:[2,43],13:[2,43],15:[2,43],17:[2,43],19:[2,43],20:[2,43],21:[2,43],22:[2,43],24:[2,43],25:[2,43],26:[2,43],27:[2,43],29:[2,43],31:[2,43],34:[2,43],36:[2,43],38:[2,43],44:[2,43],46:[2,43]},{5:[2,44],8:[2,44],11:[2,44],12:[2,44],13:[2,44],15:[2,44],17:[2,44],19:[2,44],20:[2,44],21:[2,44],22:[2,44],24:[2,44],25:[2,44],26:[2,44],27:[2,44],29:[2,44],31:[2,44],34:[2,44],36:[2,44],38:[2,44],44:[2,44],46:[2,44]},{5:[2,45],8:[2,45],11:[2,45],12:[2,45],13:[2,45],15:[2,45],17:[2,45],19:[2,45],20:[2,45],21:[2,45],22:[2,45],24:[2,45],25:[2,45],26:[2,45],27:[2,45],29:[2,45],31:[2,45],34:[2,45],36:[2,45],38:[2,45],44:[2,45],46:[2,45]},{5:[2,46],8:[2,46],11:[2,46],12:[2,46],13:[2,46],15:[2,46],17:[2,46],19:[2,46],20:[2,46],21:[2,46],22:[2,46],24:[2,46],25:[2,46],26:[2,46],27:[2,46],29:[2,46],31:[2,46],34:[2,46],36:[2,46],38:[2,46],44:[2,46],46:[2,46]},{5:[2,36],8:[2,36],11:[2,36],12:[2,36],13:[2,36],15:[2,36],17:[2,36],19:[2,36],20:[2,36],21:[2,36],22:[2,36],24:[2,36],25:[2,36],26:[2,36],27:[2,36],29:[2,36],31:[2,36],34:[2,36],36:[2,36],38:[2,36],41:[2,36],42:[2,36],44:[2,36],45:[2,36],46:[2,36]},{7:51,30:15,32:14,37:50,39:23,40:[1,26],42:[1,24],43:9,44:[1,49],45:[1,16],47:[1,18],48:10,49:[1,19],50:11,51:[1,20],52:12,53:[1,21],54:13,55:[1,22]},{5:[2,12],8:[1,53],15:[1,52],17:[2,12],19:[2,12],20:[2,12],21:[2,12],22:[2,12],24:[2,12],25:[2,12],26:[2,12],27:[2,12],34:[2,12],36:[2,12],46:[2,12]},{5:[2,35],8:[2,35],11:[2,35],12:[2,35],13:[2,35],15:[2,35],17:[2,35],19:[2,35],20:[2,35],21:[2,35],22:[2,35],24:[2,35],25:[2,35],26:[2,35],27:[2,35],29:[2,35],31:[2,35],34:[2,35],36:[2,35],38:[2,35],41:[2,35],42:[2,35],44:[2,35],45:[2,35],46:[2,35]},{5:[2,9],8:[2,9],11:[1,54],12:[1,55],13:[1,56],15:[2,9],17:[2,9],19:[2,9],20:[2,9],21:[2,9],22:[2,9],24:[2,9],25:[2,9],26:[2,9],27:[2,9],34:[2,9],36:[2,9],46:[2,9]},{5:[2,5],8:[2,5],11:[2,5],12:[2,5],13:[2,5],15:[2,5],17:[2,5],19:[2,5],20:[2,5],21:[2,5],22:[2,5],24:[2,5],25:[2,5],26:[2,5],27:[2,5],34:[2,5],36:[2,5],46:[2,5]},{6:57,7:58,8:[1,29],9:[1,30],30:15,32:14,39:23,40:[1,26],42:[1,24],43:9,45:[1,16],47:[1,18],48:10,49:[1,19],50:11,51:[1,20],52:12,53:[1,21],54:13,55:[1,22]},{6:59,7:58,8:[1,29],9:[1,30],30:15,32:14,39:23,40:[1,26],42:[1,24],43:9,45:[1,16],47:[1,18],48:10,49:[1,19],50:11,51:[1,20],52:12,53:[1,21],54:13,55:[1,22]},{1:[2,1]},{6:28,7:7,8:[1,29],9:[1,30],10:27,14:25,16:17,18:8,23:6,28:5,30:15,32:14,33:60,39:23,40:[1,26],42:[1,24],43:9,45:[1,16],47:[1,18],48:10,49:[1,19],50:11,51:[1,20],52:12,53:[1,21],54:13,55:[1,22]},{6:28,7:7,8:[1,29],9:[1,30],10:27,14:25,16:17,18:8,23:6,28:61,30:15,32:14,39:23,40:[1,26],42:[1,24],43:9,45:[1,16],47:[1,18],48:10,49:[1,19],50:11,51:[1,20],52:12,53:[1,21],54:13,55:[1,22]},{6:28,7:58,8:[1,29],9:[1,30],10:27,14:25,16:17,18:62,30:15,32:14,39:23,40:[1,26],42:[1,24],43:9,45:[1,16],47:[1,18],48:10,49:[1,19],50:11,51:[1,20],52:12,53:[1,21],54:13,55:[1,22]},{6:28,7:58,8:[1,29],9:[1,30],10:27,14:25,16:17,18:63,30:15,32:14,39:23,40:[1,26],42:[1,24],43:9,45:[1,16],47:[1,18],48:10,49:[1,19],50:11,51:[1,20],52:12,53:[1,21],54:13,55:[1,22]},{6:28,7:58,8:[1,29],9:[1,30],10:27,14:25,16:17,18:64,30:15,32:14,39:23,40:[1,26],42:[1,24],43:9,45:[1,16],47:[1,18],48:10,49:[1,19],50:11,51:[1,20],52:12,53:[1,21],54:13,55:[1,22]},{6:28,7:58,8:[1,29],9:[1,30],10:27,14:25,16:17,18:65,30:15,32:14,39:23,40:[1,26],42:[1,24],43:9,45:[1,16],47:[1,18],48:10,49:[1,19],50:11,51:[1,20],52:12,53:[1,21],54:13,55:[1,22]},{30:66,32:67,39:23,40:[1,26],42:[1,24]},{30:68,32:69,39:23,40:[1,26],42:[1,24]},{6:28,7:58,8:[1,29],9:[1,30],10:27,14:25,16:70,30:15,32:14,39:23,40:[1,26],42:[1,24],43:9,45:[1,16],47:[1,18],48:10,49:[1,19],50:11,51:[1,20],52:12,53:[1,21],54:13,55:[1,22]},{6:28,7:58,8:[1,29],9:[1,30],10:27,14:25,16:71,30:15,32:14,39:23,40:[1,26],42:[1,24],43:9,45:[1,16],47:[1,18],48:10,49:[1,19],50:11,51:[1,20],52:12,53:[1,21],54:13,55:[1,22]},{6:28,7:58,8:[1,29],9:[1,30],10:27,14:25,16:72,30:15,32:14,39:23,40:[1,26],42:[1,24],43:9,45:[1,16],47:[1,18],48:10,49:[1,19],50:11,51:[1,20],52:12,53:[1,21],54:13,55:[1,22]},{6:28,7:58,8:[1,29],9:[1,30],10:27,14:25,16:73,30:15,32:14,39:23,40:[1,26],42:[1,24],43:9,45:[1,16],47:[1,18],48:10,49:[1,19],50:11,51:[1,20],52:12,53:[1,21],54:13,55:[1,22]},{39:74,40:[1,26]},{32:76,39:23,40:[1,26],43:75,47:[1,18]},{7:51,30:15,32:14,37:78,39:23,40:[1,26],42:[1,24],43:9,45:[1,16],46:[1,77],47:[1,18],48:10,49:[1,19],50:11,51:[1,20],52:12,53:[1,21],54:13,55:[1,22]},{46:[1,79]},{6:28,7:58,8:[1,29],9:[1,30],10:27,14:80,30:15,32:14,39:23,40:[1,26],42:[1,24],43:9,45:[1,16],47:[1,18],48:10,49:[1,19],50:11,51:[1,20],52:12,53:[1,21],54:13,55:[1,22]},{5:[2,47],8:[2,47],11:[2,47],12:[2,47],13:[2,47],15:[2,47],17:[2,47],19:[2,47],20:[2,47],21:[2,47],22:[2,47],24:[2,47],25:[2,47],26:[2,47],27:[2,47],29:[2,47],31:[2,47],34:[2,47],36:[2,47],38:[2,47],44:[2,47],46:[2,47]},{38:[1,82],44:[1,81]},{38:[2,33],44:[2,33],46:[2,33]},{6:28,7:58,8:[1,29],9:[1,30],10:83,30:15,32:14,39:23,40:[1,26],42:[1,24],43:9,45:[1,16],47:[1,18],48:10,49:[1,19],50:11,51:[1,20],52:12,53:[1,21],54:13,55:[1,22]},{6:28,7:58,8:[1,29],9:[1,30],10:84,30:15,32:14,39:23,40:[1,26],42:[1,24],43:9,45:[1,16],47:[1,18],48:10,49:[1,19],50:11,51:[1,20],52:12,53:[1,21],54:13,55:[1,22]},{6:85,7:58,8:[1,29],9:[1,30],30:15,32:14,39:23,40:[1,26],42:[1,24],43:9,45:[1,16],47:[1,18],48:10,49:[1,19],50:11,51:[1,20],52:12,53:[1,21],54:13,55:[1,22]},{6:86,7:58,8:[1,29],9:[1,30],30:15,32:14,39:23,40:[1,26],42:[1,24],43:9,45:[1,16],47:[1,18],48:10,49:[1,19],50:11,51:[1,20],52:12,53:[1,21],54:13,55:[1,22]},{6:87,7:58,8:[1,29],9:[1,30],30:15,32:14,39:23,40:[1,26],42:[1,24],43:9,45:[1,16],47:[1,18],48:10,49:[1,19],50:11,51:[1,20],52:12,53:[1,21],54:13,55:[1,22]},{5:[2,3],8:[2,3],11:[2,3],12:[2,3],13:[2,3],15:[2,3],17:[2,3],19:[2,3],20:[2,3],21:[2,3],22:[2,3],24:[2,3],25:[2,3],26:[2,3],27:[2,3],34:[2,3],36:[2,3],46:[2,3]},{5:[2,2],8:[2,2],11:[2,2],12:[2,2],13:[2,2],15:[2,2],17:[2,2],19:[2,2],20:[2,2],21:[2,2],22:[2,2],24:[2,2],25:[2,2],26:[2,2],27:[2,2],34:[2,2],36:[2,2],46:[2,2]},{5:[2,4],8:[2,4],11:[2,4],12:[2,4],13:[2,4],15:[2,4],17:[2,4],19:[2,4],20:[2,4],21:[2,4],22:[2,4],24:[2,4],25:[2,4],26:[2,4],27:[2,4],34:[2,4],36:[2,4],46:[2,4]},{5:[2,32],34:[1,33],36:[2,32],46:[2,32]},{5:[2,30],34:[2,30],36:[2,30],46:[2,30]},{5:[2,20],19:[1,40],20:[1,41],21:[1,42],22:[1,43],24:[2,20],25:[2,20],26:[2,20],27:[2,20],34:[2,20],36:[2,20],46:[2,20]},{5:[2,21],19:[1,40],20:[1,41],21:[1,42],22:[1,43],24:[2,21],25:[2,21],26:[2,21],27:[2,21],34:[2,21],36:[2,21],46:[2,21]},{5:[2,22],19:[1,40],20:[1,41],21:[1,42],22:[1,43],24:[2,22],25:[2,22],26:[2,22],27:[2,22],34:[2,22],36:[2,22],46:[2,22]},{5:[2,23],19:[1,40],20:[1,41],21:[1,42],22:[1,43],24:[2,23],25:[2,23],26:[2,23],27:[2,23],34:[2,23],36:[2,23],46:[2,23]},{5:[2,25],34:[2,25],36:[2,25],46:[2,25]},{5:[2,27],34:[2,27],36:[2,27],41:[1,44],42:[1,45],45:[1,46],46:[2,27]},{5:[2,26],34:[2,26],36:[2,26],46:[2,26]},{5:[2,28],34:[2,28],36:[2,28],41:[1,44],42:[1,45],45:[1,46],46:[2,28]},{5:[2,15],17:[1,48],19:[2,15],20:[2,15],21:[2,15],22:[2,15],24:[2,15],25:[2,15],26:[2,15],27:[2,15],34:[2,15],36:[2,15],46:[2,15]},{5:[2,16],17:[1,48],19:[2,16],20:[2,16],21:[2,16],22:[2,16],24:[2,16],25:[2,16],26:[2,16],27:[2,16],34:[2,16],36:[2,16],46:[2,16]},{5:[2,17],17:[1,48],19:[2,17],20:[2,17],21:[2,17],22:[2,17],24:[2,17],25:[2,17],26:[2,17],27:[2,17],34:[2,17],36:[2,17],46:[2,17]},{5:[2,18],17:[1,48],19:[2,18],20:[2,18],21:[2,18],22:[2,18],24:[2,18],25:[2,18],26:[2,18],27:[2,18],34:[2,18],36:[2,18],46:[2,18]},{5:[2,37],8:[2,37],11:[2,37],12:[2,37],13:[2,37],15:[2,37],17:[2,37],19:[2,37],20:[2,37],21:[2,37],22:[2,37],24:[2,37],25:[2,37],26:[2,37],27:[2,37],29:[2,37],31:[2,37],34:[2,37],36:[2,37],38:[2,37],41:[2,37],42:[2,37],44:[2,37],45:[2,37],46:[2,37]},{44:[1,88]},{41:[1,44],42:[1,45],44:[1,89],45:[1,46]},{5:[2,40],8:[2,40],11:[2,40],12:[2,40],13:[2,40],15:[2,40],17:[2,40],19:[2,40],20:[2,40],21:[2,40],22:[2,40],24:[2,40],25:[2,40],26:[2,40],27:[2,40],29:[2,40],31:[2,40],34:[2,40],36:[2,40],38:[2,40],41:[2,40],42:[2,40],44:[2,40],45:[2,40],46:[2,40]},{38:[1,82],46:[1,90]},{5:[2,56],8:[2,56],11:[2,56],12:[2,56],13:[2,56],15:[2,56],17:[2,56],19:[2,56],20:[2,56],21:[2,56],22:[2,56],24:[2,56],25:[2,56],26:[2,56],27:[2,56],29:[2,56],31:[2,56],34:[2,56],36:[2,56],38:[2,56],44:[2,56],46:[2,56]},{5:[2,13],8:[1,53],15:[1,52],17:[2,13],19:[2,13],20:[2,13],21:[2,13],22:[2,13],24:[2,13],25:[2,13],26:[2,13],27:[2,13],34:[2,13],36:[2,13],46:[2,13]},{5:[2,48],8:[2,48],11:[2,48],12:[2,48],13:[2,48],15:[2,48],17:[2,48],19:[2,48],20:[2,48],21:[2,48],22:[2,48],24:[2,48],25:[2,48],26:[2,48],27:[2,48],29:[2,48],31:[2,48],34:[2,48],36:[2,48],38:[2,48],44:[2,48],46:[2,48]},{7:91,30:15,32:14,39:23,40:[1,26],42:[1,24],43:9,45:[1,16],47:[1,18],48:10,49:[1,19],50:11,51:[1,20],52:12,53:[1,21],54:13,55:[1,22]},{5:[2,10],8:[2,10],11:[1,54],12:[1,55],13:[1,56],15:[2,10],17:[2,10],19:[2,10],20:[2,10],21:[2,10],22:[2,10],24:[2,10],25:[2,10],26:[2,10],27:[2,10],34:[2,10],36:[2,10],46:[2,10]},{5:[2,11],8:[2,11],11:[1,54],12:[1,55],13:[1,56],15:[2,11],17:[2,11],19:[2,11],20:[2,11],21:[2,11],22:[2,11],24:[2,11],25:[2,11],26:[2,11],27:[2,11],34:[2,11],36:[2,11],46:[2,11]},{5:[2,6],8:[2,6],11:[2,6],12:[2,6],13:[2,6],15:[2,6],17:[2,6],19:[2,6],20:[2,6],21:[2,6],22:[2,6],24:[2,6],25:[2,6],26:[2,6],27:[2,6],34:[2,6],36:[2,6],46:[2,6]},{5:[2,7],8:[2,7],11:[2,7],12:[2,7],13:[2,7],15:[2,7],17:[2,7],19:[2,7],20:[2,7],21:[2,7],22:[2,7],24:[2,7],25:[2,7],26:[2,7],27:[2,7],34:[2,7],36:[2,7],46:[2,7]},{5:[2,8],8:[2,8],11:[2,8],12:[2,8],13:[2,8],15:[2,8],17:[2,8],19:[2,8],20:[2,8],21:[2,8],22:[2,8],24:[2,8],25:[2,8],26:[2,8],27:[2,8],34:[2,8],36:[2,8],46:[2,8]},{5:[2,38],8:[2,38],11:[2,38],12:[2,38],13:[2,38],15:[2,38],17:[2,38],19:[2,38],20:[2,38],21:[2,38],22:[2,38],24:[2,38],25:[2,38],26:[2,38],27:[2,38],29:[2,38],31:[2,38],34:[2,38],36:[2,38],38:[2,38],41:[2,38],42:[2,38],44:[2,38],45:[2,38],46:[2,38]},{5:[2,39],8:[2,39],11:[2,39],12:[2,39],13:[2,39],15:[2,39],17:[2,39],19:[2,39],20:[2,39],21:[2,39],22:[2,39],24:[2,39],25:[2,39],26:[2,39],27:[2,39],29:[2,39],31:[2,39],34:[2,39],36:[2,39],38:[2,39],41:[2,39],42:[2,39],44:[2,39],45:[2,39],46:[2,39]},{5:[2,41],8:[2,41],11:[2,41],12:[2,41],13:[2,41],15:[2,41],17:[2,41],19:[2,41],20:[2,41],21:[2,41],22:[2,41],24:[2,41],25:[2,41],26:[2,41],27:[2,41],29:[2,41],31:[2,41],34:[2,41],36:[2,41],38:[2,41],41:[2,41],42:[2,41],44:[2,41],45:[2,41],46:[2,41]},{38:[2,34],44:[2,34],46:[2,34]}],defaultActions:{31:[2,1]},parseError:function(a,b){if(!b.recoverable)throw new Error(a);this.trace(a)},parse:function(a){function b(){var a;return a=c.lexer.lex()||m,"number"!=typeof a&&(a=c.symbols_[a]||a),a}var c=this,d=[0],e=[null],f=[],g=this.table,h="",i=0,j=0,k=0,l=2,m=1;this.lexer.setInput(a),this.lexer.yy=this.yy,this.yy.lexer=this.lexer,this.yy.parser=this,"undefined"==typeof this.lexer.yylloc&&(this.lexer.yylloc={});var n=this.lexer.yylloc;f.push(n);var o=this.lexer.options&&this.lexer.options.ranges;this.parseError="function"==typeof this.yy.parseError?this.yy.parseError:Object.getPrototypeOf(this).parseError;for(var p,q,r,s,t,u,v,w,x,y={};;){if(r=d[d.length-1],this.defaultActions[r]?s=this.defaultActions[r]:((null===p||"undefined"==typeof p)&&(p=b()),s=g[r]&&g[r][p]),"undefined"==typeof s||!s.length||!s[0]){var z="";x=[];for(u in g[r])this.terminals_[u]&&u>l&&x.push("'"+this.terminals_[u]+"'");z=this.lexer.showPosition?"Parse error on line "+(i+1)+":\n"+this.lexer.showPosition()+"\nExpecting "+x.join(", ")+", got '"+(this.terminals_[p]||p)+"'":"Parse error on line "+(i+1)+": Unexpected "+(p==m?"end of input":"'"+(this.terminals_[p]||p)+"'"),this.parseError(z,{text:this.lexer.match,token:this.terminals_[p]||p,line:this.lexer.yylineno,loc:n,expected:x})}if(s[0]instanceof Array&&s.length>1)throw new Error("Parse Error: multiple actions possible at state: "+r+", token: "+p);switch(s[0]){case 1:d.push(p),e.push(this.lexer.yytext),f.push(this.lexer.yylloc),d.push(s[1]),p=null,q?(p=q,q=null):(j=this.lexer.yyleng,h=this.lexer.yytext,i=this.lexer.yylineno,n=this.lexer.yylloc,k>0&&k--);break;case 2:if(v=this.productions_[s[1]][1],y.$=e[e.length-v],y._$={first_line:f[f.length-(v||1)].first_line,last_line:f[f.length-1].last_line,first_column:f[f.length-(v||1)].first_column,last_column:f[f.length-1].last_column},o&&(y._$.range=[f[f.length-(v||1)].range[0],f[f.length-1].range[1]]),t=this.performAction.call(y,h,j,i,this.yy,s[1],e,f),"undefined"!=typeof t)return t;v&&(d=d.slice(0,2*-1*v),e=e.slice(0,-1*v),f=f.slice(0,-1*v)),d.push(this.productions_[s[1]][0]),e.push(y.$),f.push(y._$),w=g[d[d.length-2]][d[d.length-1]],d.push(w);break;case 3:return!0}}return!0}},c=function(){var a={EOF:1,parseError:function(a,b){if(!this.yy.parser)throw new Error(a);this.yy.parser.parseError(a,b)},setInput:function(a){return this._input=a,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var a=this._input[0];this.yytext+=a,this.yyleng++,this.offset++,this.match+=a,this.matched+=a;var b=a.match(/(?:\r\n?|\n).*/g);return b?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),a},unput:function(a){var b=a.length,c=a.split(/(?:\r\n?|\n)/g);this._input=a+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-b-1),this.offset-=b;var d=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),c.length-1&&(this.yylineno-=c.length-1);var e=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:c?(c.length===d.length?this.yylloc.first_column:0)+d[d.length-c.length].length-c[0].length:this.yylloc.first_column-b},this.options.ranges&&(this.yylloc.range=[e[0],e[0]+this.yyleng-b]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},less:function(a){this.unput(this.match.slice(a))},pastInput:function(){var a=this.matched.substr(0,this.matched.length-this.match.length);return(a.length>20?"...":"")+a.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var a=this.match;return a.length<20&&(a+=this._input.substr(0,20-a.length)),(a.substr(0,20)+(a.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var a=this.pastInput(),b=new Array(a.length+1).join("-");return a+this.upcomingInput()+"\n"+b+"^"},test_match:function(a,b){var c,d,e;if(this.options.backtrack_lexer&&(e={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(e.yylloc.range=this.yylloc.range.slice(0))),d=a[0].match(/(?:\r\n?|\n).*/g),d&&(this.yylineno+=d.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:d?d[d.length-1].length-d[d.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+a[0].length},this.yytext+=a[0],this.match+=a[0],this.matches=a,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(a[0].length),this.matched+=a[0],c=this.performAction.call(this,this.yy,this,b,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),c)return c;if(this._backtrack){for(var f in e)this[f]=e[f];return!1}return!1},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0);var a,b,c,d;this._more||(this.yytext="",this.match="");for(var e=this._currentRules(),f=0;fb[0].length)){if(b=c,d=f,this.options.backtrack_lexer){if(a=this.test_match(c,e[f]),a!==!1)return a;if(this._backtrack){b=!1;continue}return!1}if(!this.options.flex)break}return b?(a=this.test_match(b,e[d]),a!==!1?a:!1):""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})
-},lex:function(){var a=this.next();return a?a:this.lex()},begin:function(a){this.conditionStack.push(a)},popState:function(){var a=this.conditionStack.length-1;return a>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(a){return a=this.conditionStack.length-1-Math.abs(a||0),a>=0?this.conditionStack[a]:"INITIAL"},pushState:function(a){this.begin(a)},stateStackSize:function(){return this.conditionStack.length},options:{},performAction:function(a,b,c,d){switch(c){case 0:return 29;case 1:return 31;case 2:return"from";case 3:return 24;case 4:return 25;case 5:return 21;case 6:return 19;case 7:return 22;case 8:return 20;case 9:return 26;case 10:return 27;case 11:return 34;case 12:return 36;case 13:return 55;case 14:return 53;case 15:break;case 16:return 49;case 17:return 47;case 18:return 47;case 19:return 40;case 20:return 51;case 21:return 41;case 22:return 11;case 23:return 12;case 24:return 13;case 25:return 38;case 26:return 8;case 27:return 26;case 28:return 27;case 29:return 24;case 30:return 24;case 31:return 25;case 32:return 25;case 33:return 21;case 34:return 22;case 35:return 20;case 36:return 19;case 37:return 34;case 38:return 36;case 39:return 15;case 40:return 17;case 41:return 45;case 42:return 44;case 43:return 42;case 44:return 46;case 45:return 9;case 46:return 5}},rules:[/^(?:\s+in\b)/,/^(?:\s+notIn\b)/,/^(?:\s+from\b)/,/^(?:\s+(eq|EQ)\b)/,/^(?:\s+(neq|NEQ)\b)/,/^(?:\s+(lte|LTE)\b)/,/^(?:\s+(lt|LT)\b)/,/^(?:\s+(gte|GTE)\b)/,/^(?:\s+(gt|GT)\b)/,/^(?:\s+(like|LIKE)\b)/,/^(?:\s+(notLike|NOT_LIKE)\b)/,/^(?:\s+(and|AND)\b)/,/^(?:\s+(or|OR)\b)/,/^(?:\s+null\b)/,/^(?:\s+(true|false)\b)/,/^(?:\s+)/,/^(?:-?[0-9]+(?:\.[0-9]+)?\b)/,/^(?:'[^']*')/,/^(?:"[^"]*")/,/^(?:([a-zA-Z_$][0-9a-zA-Z_$]*))/,/^(?:^\/((?![\s=])[^[\/\n\\]*(?:(?:\\[\s\S]|\[[^\]\n\\]*(?:\\[\s\S][^\]\n\\]*)*])[^[\/\n\\]*)*\/[imgy]{0,4})(?!\w))/,/^(?:\.)/,/^(?:\*)/,/^(?:\/)/,/^(?:\%)/,/^(?:,)/,/^(?:-)/,/^(?:=~)/,/^(?:!=~)/,/^(?:==)/,/^(?:===)/,/^(?:!=)/,/^(?:!==)/,/^(?:<=)/,/^(?:>=)/,/^(?:>)/,/^(?:<)/,/^(?:&&)/,/^(?:\|\|)/,/^(?:\+)/,/^(?:\^)/,/^(?:\()/,/^(?:\])/,/^(?:\[)/,/^(?:\))/,/^(?:!)/,/^(?:$)/],conditions:{INITIAL:{rules:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46],inclusive:!0}}};return a}();return b.lexer=c,a.prototype=b,b.Parser=a,new a}();"undefined"!=typeof a&&"undefined"!=typeof c&&(c.parser=e,c.Parser=e.Parser,c.parse=function(){return e.parse.apply(e,arguments)},c.main=function(b){b[1]||(console.log("Usage: "+b[0]+" FILE"),d.exit(1));var e=a("fs").readFileSync(a("path").normalize(b[1]),"utf8");return c.parser.parse(e)},"undefined"!=typeof b&&a.main===b&&c.main(d.argv.slice(1)))},{__browserify_process:48,fs:45,path:46}],28:[function(a,b,c){!function(){"use strict";var b=a("./constraint/parser"),d=a("./nools/nool.parser");c.parseConstraint=function(a){try{return b.parse(a)}catch(c){throw new Error("Invalid expression '"+a+"'")}},c.parseRuleSet=function(a,b){return d.parse(a,b)}}()},{"./constraint/parser":27,"./nools/nool.parser":29}],29:[function(a,b,c){"use strict";var d=a("./tokens.js"),e=a("../../extended"),f=e.hash.keys,g=a("./util.js"),h=function(a,b,c){var d=a;a=a.replace(/\/\/(.*)[\n|\r|\r\n]/g,"").replace(/\n|\r|\r\n/g," ");for(var e,i=new RegExp("^("+f(b).join("|")+")");a&&-1!==(e=g.findNextTokenIndex(a));){a=a.substr(e);var j=a.match(i);if(null===j)throw new Error("Error parsing "+a);if(j=j[1],!(j in b))throw new Error("Unknown token"+j);try{a=b[j](a,c,h).replace(/^\s*|\s*$/g,"")}catch(k){throw new Error("Invalid "+j+" definition \n"+k.message+"; \nstarting at : "+d)}}};c.parse=function(a,b){var c={define:[],rules:[],scope:[],loaded:[],file:b};return h(a,d,c),c}},{"../../extended":10,"./tokens.js":30,"./util.js":31}],30:[function(require,module,exports){var process=require("__browserify_process"),utils=require("./util.js"),fs=require("fs"),indexOf=require("../../extended").indexOf,isWhiteSpace=function(a){return 0===a.replace(/[\s|\n|\r|\t]/g,"").length},ruleTokens={salience:function(){var a=/^(salience|priority)\s*:\s*(-?\d+)\s*[,;]?/;return function(b,c){if(a.test(b)){var d=b.match(a),e=parseInt(d[2],10);if(isNaN(e))throw new Error("Invalid salience/priority "+d[2]);return c.options.priority=e,b.replace(d[0],"")}throw new Error("invalid format")}}(),agendaGroup:function(){var a=/^(agenda-group|agendaGroup)\s*:\s*([a-zA-Z_$][0-9a-zA-Z_$]*|"[^"]*"|'[^']*')\s*[,;]?/;return function(b,c){if(a.test(b)){var d=b.match(a),e=d[2];if(!e)throw new Error("Invalid agenda-group "+d[2]);return c.options.agendaGroup=e.replace(/^["']|["']$/g,""),b.replace(d[0],"")}throw new Error("invalid format")}}(),autoFocus:function(){var a=/^(auto-focus|autoFocus)\s*:\s*(true|false)\s*[,;]?/;return function(b,c){if(a.test(b)){var d=b.match(a),e=d[2];if(!e)throw new Error("Invalid auto-focus "+d[2]);return c.options.autoFocus="true"===e?!0:!1,b.replace(d[0],"")}throw new Error("invalid format")}}(),"agenda-group":function(){return this.agendaGroup.apply(this,arguments)},"auto-focus":function(){return this.autoFocus.apply(this,arguments)},priority:function(){return this.salience.apply(this,arguments)},when:function(){var ruleRegExp=/^(\$?\w+) *: *(\w+)(.*)/,joinFunc=function(a,b){return"; "+b},constraintRegExp=/(\{ *(?:["']?\$?\w+["']?\s*:\s*["']?\$?\w+["']? *(?:, *["']?\$?\w+["']?\s*:\s*["']?\$?\w+["']?)*)+ *\})/,predicateExp=/^(\w+) *\((.*)\)$/m,parseRules=function(str){for(var rules=[],ruleLines=str.split(";"),l=ruleLines.length,ruleLine,i=0;l>i&&(ruleLine=ruleLines[i].replace(/^\s*|\s*$/g,"").replace(/\n/g,""));i++)if(!isWhiteSpace(ruleLine)){var rule=[];if(predicateExp.test(ruleLine)){var m=ruleLine.match(predicateExp),pred=m[1].replace(/^\s*|\s*$/g,"");if(rule.push(pred),ruleLine=m[2].replace(/^\s*|\s*$/g,""),"or"===pred){rule=rule.concat(parseRules(ruleLine.replace(/,\s*(\$?\w+\s*:)/,joinFunc))),rules.push(rule);continue}}var parts=ruleLine.match(ruleRegExp);if(!parts||!parts.length)throw new Error("Invalid constraint "+ruleLine);rule.push(parts[2],parts[1]);var constraints=parts[3].replace(/^\s*|\s*$/g,""),hashParts=constraints.match(constraintRegExp);if(hashParts){var hash=hashParts[1],constraint=constraints.replace(hash,"");constraint&&rule.push(constraint.replace(/^\s*|\s*$/g,"")),hash&&rule.push(eval("("+hash.replace(/(\$?\w+)\s*:\s*(\$?\w+)/g,'"$1" : "$2"')+")"))}else constraints&&!isWhiteSpace(constraints)&&rule.push(constraints);rules.push(rule)}return rules};return function(a,b){var c=a.replace(/^when\s*/,"").replace(/^\s*|\s*$/g,"");if("{"===utils.findNextToken(c)){var d=utils.getTokensBetween(c,"{","}",!0).join("");return c=c.replace(d,""),b.constraints=parseRules(d.replace(/^\{\s*|\}\s*$/g,"")),c}throw new Error("unexpected token : expected : '{' found : '"+utils.findNextToken(c)+"'")}}(),then:function(){return function(a,b){if(b.action)throw new Error("action already defined for rule"+b.name);var c=a.replace(/^then\s*/,"").replace(/^\s*|\s*$/g,"");if("{"===utils.findNextToken(c)){var d=utils.getTokensBetween(c,"{","}",!0).join("");if(c=c.replace(d,""),b.action||(b.action=d.replace(/^\{\s*|\}\s*$/g,"")),!isWhiteSpace(c))throw new Error("Error parsing then block "+a);return c}throw new Error("unexpected token : expected : '{' found : '"+utils.findNextToken(c)+"'")}}()},topLevelTokens={"/":function(a){return a.match(/^\/\*/)?a.replace(/\/\*.*?\*\//,""):a},define:function(a,b){var c=a.replace(/^define\s*/,""),d=c.match(/^([a-zA-Z_$][0-9a-zA-Z_$]*)/);if(d){if(c=c.replace(d[0],"").replace(/^\s*|\s*$/g,""),"{"===utils.findNextToken(c)){d=d[1];var e=utils.getTokensBetween(c,"{","}",!0).join("");return c=c.replace(e,""),b.define.push({name:d,properties:"("+e+")"}),c}throw new Error("unexpected token : expected : '{' found : '"+utils.findNextToken(c)+"'")}throw new Error("missing name")},"import":function(a,b,c){if("undefined"!=typeof window)throw new Error("import cannot be used in a browser");var d=a.replace(/^import\s*/,"");if("("===utils.findNextToken(d)){var e=utils.getParamList(d);if(d=d.replace(e,"").replace(/^\s*|\s*$/g,""),";"===utils.findNextToken(d)&&(d=d.replace(/\s*;/,"")),e=e.replace(/[\(|\)]/g,"").split(","),1===e.length){if(e=utils.resolve(b.file||process.cwd(),e[0].replace(/["|']/g,"")),-1===indexOf(b.loaded,e)){var f=b.file;b.file=e,c(fs.readFileSync(e,"utf8"),topLevelTokens,b),b.loaded.push(e),b.file=f}return d}throw new Error("import accepts a single file")}throw new Error("unexpected token : expected : '(' found : '"+utils.findNextToken(d)+"'")},global:function(a,b){var c=a.replace(/^global\s*/,""),d=c.match(/^([a-zA-Z_$][0-9a-zA-Z_$]*\s*)/);if(d){if(c=c.replace(d[0],"").replace(/^\s*|\s*$/g,""),"="===utils.findNextToken(c)){d=d[1].replace(/^\s+|\s+$/g,"");var e=utils.getTokensBetween(c,"=",";",!0).join(""),f=e.substring(1,e.length-1);if(f=f.replace(/^\s+|\s+$/g,""),/^require\(/.test(f)){var g=utils.getParamList(f.replace("require")).replace(/[\(|\)]/g,"").split(",");1===g.length&&(g=g[0].replace(/["|']/g,""),f=["require('",utils.resolve(b.file||process.cwd(),g),"')"].join(""))}return b.scope.push({name:d,body:f}),c=c.replace(e,"")}throw new Error("unexpected token : expected : '=' found : '"+utils.findNextToken(c)+"'")}throw new Error("missing name")},"function":function(a,b){var c=a.replace(/^function\s*/,""),d=c.match(/^([a-zA-Z_$][0-9a-zA-Z_$]*)\s*/);if(d){if(c=c.replace(d[0],""),"("===utils.findNextToken(c)){d=d[1];var e=utils.getParamList(c);if(c=c.replace(e,"").replace(/^\s*|\s*$/g,""),"{"===utils.findNextToken(c)){var f=utils.getTokensBetween(c,"{","}",!0).join("");return c=c.replace(f,""),b.scope.push({name:d,body:"function"+e+f}),c}throw new Error("unexpected token : expected : '{' found : '"+utils.findNextToken(c)+"'")}throw new Error("unexpected token : expected : '(' found : '"+utils.findNextToken(c)+"'")}throw new Error("missing name")},rule:function(a,b,c){var d=a.replace(/^rule\s*/,""),e=d.match(/^([a-zA-Z_$][0-9a-zA-Z_$]*|"[^"]*"|'[^']*')/);if(e){if(d=d.replace(e[0],"").replace(/^\s*|\s*$/g,""),"{"===utils.findNextToken(d)){e=e[1].replace(/^["']|["']$/g,"");var f={name:e,options:{},constraints:null,action:null},g=utils.getTokensBetween(d,"{","}",!0).join("");return d=d.replace(g,""),c(g.replace(/^\{\s*|\}\s*$/g,""),ruleTokens,f),b.rules.push(f),d}throw new Error("unexpected token : expected : '{' found : '"+utils.findNextToken(d)+"'")}throw new Error("missing name")}};module.exports=topLevelTokens},{"../../extended":10,"./util.js":31,__browserify_process:48,fs:45}],31:[function(a,b,c){var d=a("__browserify_process"),e=a("path"),f=/[\s|\n|\r|\t]/,g=e.sep||("win32"===d.platform?"\\":"/"),h={"{":"}","}":"{","(":")",")":"(","[":"]"},i=c.getTokensBetween=function(a,b,c,d){var e=0,f=[];b||(b=h[c],e=1),c||(c=h[b]),a=Object(a);for(var g,i=!1,j=0,k=!1;g=a.charAt(j++);)if(g===b)e++,i?f.push(g):(i=!0,d&&f.push(g));else if(g===c&&j){if(e--,0===e){d&&f.push(g),k=!0;break}f.push(g)}else i&&f.push(g);if(!k)throw new Error("Unable to match "+b+" in "+a);return f};c.getParamList=function(a){return i(a,"(",")",!0).join("")},c.resolve=function(a,b){return""!==e.extname(a)&&(a=e.dirname(a)),1===b.split(g).length?b:e.resolve(a,b)};var j=c.findNextTokenIndex=function(a,b,c){b=b||0,c=c||a.length;var d=-1,e=a.length;for((!c||c>e)&&(c=e);c>b;b++){var g=a.charAt(b);if(!f.test(g)){d=b;break}}return d};c.findNextToken=function(a,b,c){return a.charAt(j(a,b,c))}},{__browserify_process:48,path:46}],32:[function(a,b,c){!function(){"use strict";var b=a("./extended"),d=b.merge,e=b.forEach,f=b.declare,g=a("./constraintMatcher"),h=a("./constraint"),i=f({}),j=i.extend({instance:{constructor:function(a,c,f,i,j){j=j||{},this.type=a,this.alias=c,this.conditions=f,this.pattern=j.pattern,this.constraints=[new h.ObjectConstraint(a)];var k=g.toConstraints(f,d({alias:c},j));if(k.length)this.constraints=this.constraints.concat(k);else{var l=new h.TrueConstraint;this.constraints.push(l)}if(i&&!b.isEmpty(i)){var m=new h.HashConstraint(i);this.constraints.push(m)}e(this.constraints,function(a){a.set("alias",c)})},hasConstraint:function(a){return b.some(this.constraints,function(b){return b instanceof a})},hashCode:function(){return[this.type,this.alias,b.format("%j",this.conditions)].join(":")},toString:function(){return b.format("%j",this.constraints)}}}).as(c,"ObjectPattern");j.extend().as(c,"NotPattern"),i.extend({instance:{constructor:function(a,b){this.leftPattern=a,this.rightPattern=b},hashCode:function(){return[this.leftPattern.hashCode(),this.rightPattern.hashCode()].join(":")},getters:{constraints:function(){return this.leftPattern.constraints.concat(this.rightPattern.constraints)}}}}).as(c,"CompositePattern");var k=f({}).as(c,"InitialFact");j.extend({instance:{constructor:function(){this._super([k,"i",[],{}])},assert:function(){return!0}}}).as(c,"InitialFactPattern")}()},{"./constraint":7,"./constraintMatcher":8,"./extended":10}],33:[function(a,b,c){"use strict";function d(a,b,c,d){e.isArray(b)?(d=c,c=b):b=b||{};var g=e.every(c,function(a){return f(a)});g&&1===c.length&&(c=c[0],g=!1);var h=[],i=b.scope||{};if(c.scope=i,g){for(var j,k=function(a,b){n[b]?e(n).forEach(function(b){b.push(a)}):(n[b]=0===b?[]:n[b-1].slice(),0!==b&&n[b].pop(),n[b].push(a))},l=c.length,n=[],o=0;l>o;o++)j=c[o],j.scope=i,e.forEach(p(j),k);h=e.map(n,function(c){for(var e=null,f=0;f>>0;if(0===d)return-1;var e=d;arguments.length>2&&(e=Number(arguments[2]),e!==e?e=0:0!==e&&e!==1/0&&e!==-(1/0)&&(e=(e>0||-1)*P(Q(e))));for(var f=e>=0?R(e,d-1):d-Q(e);f>=0;f--)if(f in c&&c[f]===b)return f;return-1}function i(a,b,c){if(a&&X&&X===a.filter)return a.filter(b,c);if(!N(a)||"function"!=typeof b)throw new TypeError;for(var d=Object(a),e=d.length>>>0,f=[],g=0;e>g;g++)if(g in d){var h=d[g];b.call(c,h,g,d)&&f.push(h)}return f}function j(a,b,c){if(!N(a)||"function"!=typeof b)throw new TypeError;if(a&&T&&T===a.forEach)return a.forEach(b,c),a;for(var d=0,e=a.length;e>d;++d)b.call(c||a,a[d],d,a);return a}function k(a,b,c){if(a&&Y&&Y===a.every)return a.every(b,c);if(!N(a)||"function"!=typeof b)throw new TypeError;for(var d=Object(a),e=d.length>>>0,f=0;e>f;f++)if(f in d&&!b.call(c,d[f],f,d))return!1;return!0}function l(a,b,c){if(a&&Z&&Z===a.some)return a.some(b,c);if(!N(a)||"function"!=typeof b)throw new TypeError;for(var d=Object(a),e=d.length>>>0,f=0;e>f;f++)if(f in d&&b.call(c,d[f],f,d))return!0;return!1}function m(a,b,c){if(a&&U&&U===a.map)return a.map(b,c);if(!N(a)||"function"!=typeof b)throw new TypeError;for(var d=Object(a),e=d.length>>>0,f=[],g=0;e>g;g++)g in d&&f.push(b.call(c,d[g],g,d));return f}function n(a,b,c){var d=arguments.length>2;if(a&&V&&V===a.reduce)return d?a.reduce(b,c):a.reduce(b);if(!N(a)||"function"!=typeof b)throw new TypeError;var e=0,f=a.length>>0;if(arguments.length<3){if(0===f)throw new TypeError("Array length is 0 and no second argument");c=a[0],e=1}else c=arguments[2];for(;f>e;)e in a&&(c=b.call(void 0,c,a[e],e,a)),++e;return c}function o(a,b,c){var d=arguments.length>2;if(a&&W&&W===a.reduceRight)return d?a.reduceRight(b,c):a.reduceRight(b);if(!N(a)||"function"!=typeof b)throw new TypeError;var e=Object(a),f=e.length>>>0;if(0===f&&2===arguments.length)throw new TypeError;var g=f-1;if(arguments.length>=3)c=arguments[2];else for(;;)if(g in a){c=a[g--];break}for(;g>=0;)g in e&&(c=b.call(void 0,c,e[g],g,e)),g--;return c}function p(a){var c=[];if(null!==a){var d=$(arguments);if(1===d.length)if(N(a))c=a;else if(b.isHash(a))for(var e in a)a.hasOwnProperty(e)&&c.push([e,a[e]]);else c.push(a);else j(d,function(a){c=c.concat(p(a))})}return c}function q(a){return a=a||[],a.length?n(a,function(a,b){return a+b}):0}function r(a){if(a=a||[],a.length){var c=q(a);if(b.isNumber(c))return c/a.length;throw new Error("Cannot average an array of non numbers.")}return 0}function s(a,b){return _(a,b)}function t(a,b){return _(a,b)[0]}function u(a,b){return _(a,b)[a.length-1]}function v(a){var b=a,c=J($(arguments,1));return N(a)&&(b=i(a,function(a){return-1===g(c,a)})),b}function w(a){var b,c=[],d=-1,e=0;if(a)for(b=a.length;++d0?(c.push(c.shift()),b--):(c.unshift(c.pop()),b++),y(c,b)):c}function z(a,b){var c=[];if(N(a)){var d=a.slice(0);"number"!=typeof b&&(b=a.length),b?b<=a.length&&(c=n(a,function(a,c,f){var g;return g=b>1?e(c,y(d,f).slice(1),b):[[c]],a.concat(g)},[])):c=[[]]}return c}function A(){var a=[],c=$(arguments);if(c.length>1){var d=c.shift();N(d)&&(a=n(d,function(a,d,e){for(var f=[d],g=0;gd;d++)c.push(a[b[d]]||null);return c}function D(){var a=[],b=$(arguments);if(b.length>1){for(var c=0,d=b.length;d>c;c++)a=a.concat(b[c]);a=w(a)}return a}function E(){var a,b,c=[],d=-1;if(a=arguments.length>1?$(arguments):arguments[0],N(a))for(c=a[0],d=0,b=a.length;++d1?c:p(a),n(b,function(a,b){return a.concat(b)},[])}function K(a,b){b=b.split(".");var c=a.slice(0);return j(b,function(a){var b=a.match(/(\w+)\(\)$/);c=m(c,function(c){return b?c[b[1]]():c[a]})}),c}function L(a,b,c){return c=$(arguments,2),m(a,function(a){var d=M(b)?a[b]:b;return d.apply(a,c)})}var M=b.isString,N=Array.isArray||b.isArray,O=b.isDate,P=Math.floor,Q=Math.abs,R=(Math.max,Math.min),S=Array.prototype,T=(S.indexOf,S.forEach),U=S.map,V=S.reduce,W=S.reduceRight,X=S.filter,Y=S.every,Z=S.some,$=c.argsToArray,_=function(){var a=function(a,b){return k(a,b)},b=function(a,b){return a-b},c=function(a,b){return a.getTime()-b.getTime()};return function(d,e){var f=[];return N(d)&&(f=d.slice(),e?"function"==typeof e?f.sort(e):f.sort(function(a,b){var c=a[e],d=b[e];return M(c)&&M(d)?c>d?1:d>c?-1:0:O(c)&&O(d)?c.getTime()-d.getTime():c-d}):a(f,M)?f.sort():a(f,O)?f.sort(c):f.sort(b)),f}}(),ab={toArray:p,sum:q,avg:r,sort:s,min:t,max:u,difference:v,removeDuplicates:w,unique:x,rotate:y,permutations:z,zip:A,transpose:B,valuesAt:C,union:D,intersect:E,powerSet:F,cartesian:G,compact:H,multiply:I,flatten:J,pluck:K,invoke:L,forEach:j,map:m,filter:i,reduce:n,reduceRight:o,some:l,every:k,indexOf:g,lastIndexOf:h};return a.define(N,ab).expose(ab)}"undefined"!=typeof c?"undefined"!=typeof b&&b.exports&&(b.exports=d(a("extended"),a("is-extended"),a("arguments-extended"))):"function"==typeof define&&define.amd?define(["extended","is-extended","arguments-extended"],function(a,b,c){return d(a,b,c)}):this.arrayExtended=d(this.extended,this.isExtended,this.argumentsExtended)}.call(this)},{"arguments-extended":35,extended:40,"is-extended":50}],37:[function(a,b,c){!function(){"use strict";function d(a,b,c){function d(a,b,c,d){a=""+a,c=c||" ";for(var e=a.length;b>e;)d?a+=c:a=c+a,e++;return a}function e(a,c,d){var f=a;if(b.isString(f)){if(a.length>c)if(d){var g=a.length;f=a.substring(g-c,g)}else f=a.substring(0,c)}else f=e(""+f,c);return f}function f(a,c,d){if(!b.isArray(a)||"function"!=typeof c)throw new TypeError;for(var e=Object(a),f=e.length>>>0,g=0;f>g;g++)if(g in e&&!c.call(d,e[g],g,e))return!1;return!0}function g(a,b){return A.difference(new Date(a.getFullYear(),0,1,a.getHours()),a,null,b)+1}function h(a,b,c){b=b||0;var d=a[c?"getUTCFullYear":"getFullYear"](),e=new Date(d,0,1).getDay(),f=(e-b+7)%7,h=o((g(a)+f-1)/7);return e===b&&h++,h}function i(a){var b=a.toString(),c="",d=b.indexOf("(");return d>-1&&(c=b.substring(++d,b.indexOf(")"))),c}function j(a,b){return a.replace(/([a-z])\1*/gi,function(a){var c,d=a.charAt(0),e=a.length,f="0?",g="0{0,2}";if("y"===d)c="\\d{2,4}";else if("M"===d)c=e>2?"\\S+?":"1[0-2]|"+f+"[1-9]";else if("D"===d)c="[12][0-9][0-9]|3[0-5][0-9]|36[0-6]|"+g+"[1-9][0-9]|"+f+"[1-9]";else if("d"===d)c="3[01]|[12]\\d|"+f+"[1-9]";else if("w"===d)c="[1-4][0-9]|5[0-3]|"+f+"[1-9]";else if("E"===d)c="\\S+";else if("h"===d)c="1[0-2]|"+f+"[1-9]";else if("K"===d)c="1[01]|"+f+"\\d";else if("H"===d)c="1\\d|2[0-3]|"+f+"\\d";else if("k"===d)c="1\\d|2[0-4]|"+f+"[1-9]";else if("m"===d||"s"===d)c="[0-5]\\d";else if("S"===d)c="\\d{"+e+"}";else if("a"===d){var h="AM",i="PM";c=h+"|"+i,h!==h.toLowerCase()&&(c+="|"+h.toLowerCase()),i!==i.toLowerCase()&&(c+="|"+i.toLowerCase()),c=c.replace(/\./g,"\\.")}else c="v"===d||"z"===d||"Z"===d||"G"===d||"q"===d||"Q"===d?".*":" "===d?"\\s*":d+"*";return b&&b.push(a),"("+c+")"}).replace(/[\xa0 ]/g,"[\\s\\xa0]")}function k(a){B[a+"sFromNow"]=function(b){return A.add(new Date,a,b)},B[a+"sAgo"]=function(b){return A.add(new Date,a,-b)}}for(var l=function(){function a(a,b,c){return a=a.replace(/s$/,""),e.hasOwnProperty(a)?e[a](b,c):[c,"UTC"+a.charAt(0).toUpperCase()+a.substring(1)+"s",!1]}function b(a,b,c,e){return a=a.replace(/s$/,""),d(f[a](b,c,e))}var c=Math.floor,d=Math.round,e={day:function(a,b){return[b,"Date",!1]},weekday:function(a,b){var c,d,e=b%5,f=a.getDay(),g=0;e?(c=e,d=parseInt(b/5,10)):(c=b>0?5:-5,d=b>0?(b-5)/5:(b+5)/5),6===f&&b>0?g=1:0===f&&0>b&&(g=-1);var h=f+c;return(0===h||6===h)&&(g=b>0?2:-2),[7*d+c+g,"Date",!1]},year:function(a,b){return[b,"FullYear",!0]},week:function(a,b){return[7*b,"Date",!1]},quarter:function(a,b){return[3*b,"Month",!0]},month:function(a,b){return[b,"Month",!0]}},f={quarter:function(a,b,d){var e=b.getFullYear()-a.getFullYear(),f=a[d?"getUTCMonth":"getMonth"](),g=b[d?"getUTCMonth":"getMonth"](),h=c(f/3)+1,i=c(g/3)+1;return i+=4*e,i-h},weekday:function(a,c,d){var e,f=b("day",a,c,d),g=f%7;if(0===g)f=5*b("week",a,c,d);else{var h=0,i=a[d?"getUTCDay":"getDay"](),j=c[d?"getUTCDay":"getDay"]();e=parseInt(f/7,10);var k=new Date(+a);k.setDate(k[d?"getUTCDate":"getDate"]()+7*e);var l=k[d?"getUTCDay":"getDay"]();f>0?6===i||6===j?h=-1:0===i?h=0:(0===j||l+g>5)&&(h=-2):0>f&&(6===i?h=0:0===i||0===j?h=1:(6===j||0>l+g)&&(h=2)),f+=h,f-=2*e}return f},year:function(a,b){return b.getFullYear()-a.getFullYear()},month:function(a,b,c){var d=a[c?"getUTCMonth":"getMonth"](),e=b[c?"getUTCMonth":"getMonth"]();return e-d+12*(b.getFullYear()-a.getFullYear())},week:function(a,c,e){return d(b("day",a,c,e)/7)},day:function(a,b){return 1.1574074074074074e-8*(b.getTime()-a.getTime())},hour:function(a,b){return 2.7777777777777776e-7*(b.getTime()-a.getTime())},minute:function(a,b){return 16666666666666667e-21*(b.getTime()-a.getTime())},second:function(a,b){return.001*(b.getTime()-a.getTime())},millisecond:function(a,b){return b.getTime()-a.getTime()}};return{addTransform:a,differenceTransform:b}}(),m=l.addTransform,n=l.differenceTransform,o=Math.floor,p=Math.round,q=Math.min,r=Math.pow,s=Math.ceil,t=Math.abs,u=["January","February","March","April","May","June","July","August","September","October","November","December"],v=["Jan.","Feb.","Mar.","Apr.","May.","Jun.","Jul.","Aug.","Sep.","Oct.","Nov.","Dec."],w=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],x=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],y=["Before Christ","Anno Domini"],z=["BC","AD"],A={getDaysInMonth:function(a){var b=a.getMonth(),c=[31,28,31,30,31,30,31,31,30,31,30,31];return 1===b&&A.isLeapYear(a)?29:c[b]},isLeapYear:function(a,b){var c=a[b?"getUTCFullYear":"getFullYear"]();return 0===c%400||0===c%4&&0!==c%100},isWeekend:function(a,b){var c=(a||new Date)[b?"getUTCDay":"getDay"]();return 0===c||6===c},getTimezoneName:i,compare:function(a,b,c){return a=new Date(+a),b=new Date(+(b||new Date)),"date"===c?(a.setHours(0,0,0,0),b.setHours(0,0,0,0)):"time"===c&&(a.setFullYear(0,0,0),b.setFullYear(0,0,0)),a>b?1:b>a?-1:0},add:function(a,b,c){var d=m(b,a,c||0);c=d[0];var e=d[1],f=new Date(+a),g=d[2];return e&&f["set"+e](f["get"+e]()+c),g&&f.getDate()E?z:y)[0>f?0:1];else if("y"===D)B=f,E>1&&(2===E?B=e(""+B,2,!0):C=!0);else if("Q"===D.toUpperCase())B=s((j+1)/3),C=!0;else if("M"===D)3>E?(B=j+1,C=!0):B=(3===E?v:u)[j];else if("w"===D)B=h(a,0,c),C=!0;else if("D"===D)B=g(a,c),C=!0;else if("E"===D)3>E?(B=k+1,C=!0):B=(-3===E?x:w)[k];else if("a"===D)B=12>m?"AM":"PM";else if("h"===D)B=m%12||12,C=!0;else if("K"===D)B=m%12,C=!0;else if("k"===D)B=m||24,C=!0;else if("S"===D)B=p(A*r(10,E-3)),C=!0;else if("z"===D||"v"===D||"Z"===D){if(B=i(a),"z"!==D&&"v"!==D||B||(E=4),!B||"Z"===D){var F=a.getTimezoneOffset(),G=[F>=0?"-":"+",d(o(t(F)/60),2,"0"),d(t(F)%60,2,"0")];4===E&&(G.splice(0,0,"GMT"),G.splice(3,0,":")),B=G.join("")}}else B=b;else B=""+n,C=!0;else B=""+m,C=!0;return C&&(B=d(B,E,"0")),B})}},B={},C=["year","month","day","hour","minute","second"],D=0,E=C.length;E>D;D++)k(C[D]);var F={parseDate:function(a,b){if(!b)throw new Error("format required when calling dateExtender.parse");var d=[],e=j(b,d),g=new RegExp("^"+e+"$","i"),h=g.exec(a);if(!h)return null;var i=[1970,0,1,0,0,0,0],k="",l=f(h,function(a,b){if(b){var e=d[b-1],f=e.length,g=e.charAt(0);if("y"===g)if(100>a){a=parseInt(a,10);var h=""+(new Date).getFullYear(),j=100*h.substring(0,2),l=q(h.substring(2,4)+20,99);i[0]=l>a?j+a:j-100+a}else i[0]=a;else if("M"===g){if(f>2){var m,n,o=u;3===f&&(o=v),a=a.replace(".","").toLowerCase();var p=!1;for(m=0,n=o.length;n>m&&!p;m++){var r=o[m].replace(".","").toLocaleLowerCase();r===a&&(a=m,p=!0)}if(!p)return!1}else a--;i[1]=a}else if("E"===g||"e"===g){var s=w;3===f&&(s=x),a=a.toLowerCase(),s=c.map(s,function(a){return a.toLowerCase()});var t=c.indexOf(s,a);if(-1===t){if(a=parseInt(a,10),isNaN(a)||a>s.length)return!1}else a=t}else if("D"===g||"d"===g)"D"===g&&(i[1]=0),i[2]=a;else if("a"===g){var y="am",z="pm",A=/\./g;a=a.replace(A,"").toLowerCase(),k=a===z?"p":a===y?"a":""}else"k"===g||"h"===g||"H"===g||"K"===g?("k"===g&&24===+a&&(a=0),i[3]=a):"m"===g?i[4]=a:"s"===g?i[5]=a:"S"===g&&(i[6]=a)}return!0});if(l){var m=+i[3];"p"===k&&12>m?i[3]=m+12:"a"===k&&12===m&&(i[3]=0);var n=new Date(i[0],i[1],i[2],i[3],i[4],i[5],i[6]),o=-1!==c.indexOf(d,"d"),p=-1!==c.indexOf(d,"M"),r=i[1],s=i[2],t=n.getMonth(),y=n.getDate();return p&&t>r||o&&y>s?null:n}return null}},G=a.define(b.isDate,A).define(b.isString,F).define(b.isNumber,B);for(D in A)A.hasOwnProperty(D)&&(G[D]=A[D]);for(D in F)F.hasOwnProperty(D)&&(G[D]=F[D]);for(D in B)B.hasOwnProperty(D)&&(G[D]=B[D]);return G}"undefined"!=typeof c?"undefined"!=typeof b&&b.exports&&(b.exports=d(a("extended"),a("is-extended"),a("array-extended"))):"function"==typeof define&&define.amd?define(["extended","is-extended","array-extended"],function(a,b,c){return d(a,b,c)}):this.dateExtended=d(this.extended,this.isExtended,this.arrayExtended)}.call(this)},{"array-extended":36,extended:40,"is-extended":50}],38:[function(a,b,c){!function(){function a(){function a(a,b){return b=b||0,x.call(a,b)}function b(a){return"[object Array]"===Object.prototype.toString.call(a)}function c(a){var b;return null!==a&&a!==b&&"object"==typeof a}function d(a){var b=c(a);return b&&a.constructor===Object}function e(a,b){if(a&&a.length)for(var c=0,d=a.length;d>c;c++)if(a[c]===b)return c;return-1}function f(a,b,c){var d,f;for(d in b)b.hasOwnProperty(d)&&-1===e(c,d)&&(f=b[d],d in a&&a[d]===f||(a[d]=f));return a}function g(a){var c=this.__meta,d=c.supers,e=d.length,f=c.superMeta,g=f.pos;if(e>g){a=a?B(a)||b(a)?a:[a]:[];var h,i=f.name,j=f.f;do if(h=d[g][i],"function"==typeof h&&(h=h._f||h)!==j)return f.pos=1+g,h.apply(this,a);
-while(e>++g)}return null}function h(){var a=this.__meta,b=a.supers,c=b.length,d=a.superMeta,e=d.pos;if(c>e){var f,g=d.name,h=d.f;do if(f=b[e][g],"function"==typeof f&&(f=f._f||f)!==h)return d.pos=1+e,f.bind(this);while(c>++e)}return null}function i(a){var b=this.__getters__;return b.hasOwnProperty(a)?b[a].apply(this):this[a]}function j(b,c){var e=this.__setters__;if(!d(b))return e.hasOwnProperty(b)?e[b].apply(this,a(arguments,1)):this[b]=c;for(var f in b){var g=b[f];e.hasOwnProperty(f)?e[b].call(this,g):this[f]=g}}function k(){var a=this.__meta||{},b=a.supers,c=b.length,d=a.superMeta,e=d.pos;if(c>e){var f,g=d.name,h=d.f;do if(f=b[e][g],"function"==typeof f&&(f=f._f||f)!==h)return d.pos=1+e,f.apply(this,arguments);while(c>++e)}return null}function l(a,b){if(a.toString().match(A)){var c=function(){var c,d=this.__meta||{},e=d.superMeta;switch(d.superMeta={f:a,pos:0,name:b},arguments.length){case 0:c=a.call(this);break;case 1:c=a.call(this,arguments[0]);break;case 2:c=a.call(this,arguments[0],arguments[1]);break;case 3:c=a.call(this,arguments[0],arguments[1],arguments[2]);break;default:c=a.apply(this,arguments)}return d.superMeta=e,c};return c._f=a,c}return a._f=a,a}function m(a,b){var c=b.setters||{},d=a.__setters__,e=a.__getters__;for(var f in c)d.hasOwnProperty(f)||(d[f]=c[f]);c=b.getters||{};for(f in c)e.hasOwnProperty(f)||(e[f]=c[f]);for(var g in b)if("getters"!==g&&"setters"!==g){var h=b[g];"function"==typeof h?a.hasOwnProperty(g)||(a[g]=l(k,g)):a[g]=h}}function n(){for(var b=a(arguments),c=b.length,d=this.prototype,e=d.__meta,f=this.__meta,g=d.__meta.bases,h=g.slice(),i=f.supers||[],j=e.supers||[],k=0;c>k;k++){var l=b[k],n=l.prototype,p=n.__meta,q=l.__meta;!p&&(p=n.__meta={proto:n||{}}),!q&&(q=l.__meta={proto:l.__proto__||{}}),m(d,p.proto||{}),m(this,q.proto||{}),o(l.prototype,j,g),o(l,i,h)}return this}function o(a,b,c){var d=a.__meta;!d&&(d=a.__meta={});var f=a.__meta.unique;if(!f&&(d.unique="declare"+ ++y),-1===e(c,f)){c.push(f);for(var g=a.__meta.supers||[],h=g.length-1||0;h>=0;)o(g[h--],b,c);b.unshift(a)}}function p(a,b){var c=b.setters,d=a.__setters__,e=a.__getters__;if(c)for(var f in c)d[f]=c[f];if(c=b.getters||{})for(f in c)e[f]=c[f];for(f in b)if("getters"!=f&&"setters"!=f){var g=b[f];if("function"==typeof g){var h=g.__meta||{};a[f]=h.isConstructor?g:l(g,f)}else a[f]=g}}function q(a,b){return a&&b?a[b]=this:a.exports=a=this,this}function r(a){return u(this,a)}function s(a){z.prototype=a.prototype;var b=new z;return z.prototype=null,b}function t(a,c,e){var i={},j=[],m="declare"+ ++y,q=[],r=[],t=[],u=[],v={supers:t,unique:m,bases:q,superMeta:{f:null,pos:0,name:null}},x={supers:u,unique:m,bases:r,isConstructor:!0,superMeta:{f:null,pos:0,name:null}};if(d(c)&&!e&&(e=c,c=w),"function"==typeof c||b(c)?(j=b(c)?c:[c],c=j.shift(),a.__meta=x,i=s(c),i.__meta=v,i.__getters__=f({},i.__getters__||{}),i.__setters__=f({},i.__setters__||{}),a.__getters__=f({},a.__getters__||{}),a.__setters__=f({},a.__setters__||{}),o(c.prototype,t,q),o(c,u,r)):(a.__meta=x,i.__meta=v,i.__getters__=i.__getters__||{},i.__setters__=i.__setters__||{},a.__getters__=a.__getters__||{},a.__setters__=a.__setters__||{}),a.prototype=i,e){var z=v.proto=e.instance||{},A=x.proto=e.static||{};A.init=A.init||k,p(i,z),p(a,A),i.constructor=z.hasOwnProperty("constructor")?l(z.constructor,"constructor"):z.constructor=l(k,"constructor")}else v.proto={},x.proto={},a.init=l(k,"init"),i.constructor=l(k,"constructor");j.length&&n.apply(a,j),c&&f(a,f(f({},c),a)),i._super=a._super=g,i._getSuper=a._getSuper=h,i._static=a}function u(a,b){function c(){switch(arguments.length){case 0:this.constructor.call(this);break;case 1:this.constructor.call(this,arguments[0]);break;case 2:this.constructor.call(this,arguments[0],arguments[1]);break;case 3:this.constructor.call(this,arguments[0],arguments[1],arguments[2]);break;default:this.constructor.apply(this,arguments)}}return t(c,a,b),c.init()||c}function v(a,b){function c(){return d||(this.constructor.apply(this,arguments),d=this),d}var d;return t(c,a,b),c.init()||c}var w,x=Array.prototype.slice,y=0,z=new Function,A=/(super)/g,B=function(a){return"[object Arguments]"===Object.prototype.toString.call(a)};return B(arguments)||(B=function(a){return!(!a||!a.hasOwnProperty("callee"))}),w=u({instance:{get:i,set:j},"static":{get:i,set:j,mixin:n,extend:r,as:q}}),u.singleton=v,u}"undefined"!=typeof c?"undefined"!=typeof b&&b.exports&&(b.exports=a()):"function"==typeof define&&define.amd?define(a):this.declare=a()}()},{}],39:[function(a,b){b.exports=a("./declare.js")},{"./declare.js":38}],40:[function(a,b,c){!function(){"use strict";function d(a){function b(){var b=a.define();return b.expose({register:function(a,c){c||(c=a,a=null);var d=typeof c;if(a)b[a]=c;else if(c&&"function"===d)b.extend(c);else{if("object"!==d)throw new TypeError("extended.register must be called with an extender function");b.expose(c)}return b},define:function(){return a.define.apply(a,arguments)}}),b}function c(){return b()}return function(){function a(a,b){var c,d;for(c in b)b.hasOwnProperty(c)&&(d=b[c],c in a&&a[c]===d||(a[c]=d));return a}return function(b){b||(b={});for(var c=1,d=arguments.length;d>c;c++)a(b,arguments[c]);return b}}(),c.define=function(){return a.define.apply(a,arguments)},c}"undefined"!=typeof c?"undefined"!=typeof b&&b.exports&&(b.exports=d(a("extender"))):"function"==typeof define&&define.amd?define(["extender"],function(a){return d(a)}):this.extended=d(this.extender)}.call(this)},{extender:42}],41:[function(a,b,c){!function(){function d(a){function b(a,b){if(a&&a.length)for(var c=0,d=a.length;d>c;c++)if(a[c]===b)return c;return-1}function c(a){return"[object Array]"===Object.prototype.toString.call(a)}function d(b){function c(a,b,c){if("function"!=typeof c)throw new TypeError("when extending type you must provide a function");var d;d="constructor"===b?function(){this._super(arguments),c.apply(this,arguments)}:function(){var a=f.call(arguments);a.unshift(this._value);var b=c.apply(this,a);return b!==e?this.__extender__(b):this},a[b]=d}function d(a,b,c){if("function"!=typeof c)throw new TypeError("when extending type you must provide a function");var d;d="constructor"===b?function(){this._super(arguments),c.apply(this,arguments)}:function(){var a=f.call(arguments);return a.unshift(this._value),c.apply(this,a)},a[b]=d}function h(a,b,e){for(var f in b)b.hasOwnProperty(f)&&("getters"!==f&&"setters"!==f?"noWrap"===f?h(a,b[f],!0):e?d(a,f,b[f]):c(a,f,b[f]):a[f]=b[f])}function i(a){var b,c,d=a;if(!(a instanceof m)){var e=m;for(b=0,c=n.length;c>b;b++){var f=n[b];f[0](a)&&(e=e.extend({instance:f[1]}))}d=new e(a),d.__extender__=i}return d}function j(){return!0}function k(a,b){if(arguments.length){"object"==typeof a&&(b=a,a=j),b=b||{};var d={};h(d,b),d.hasOwnProperty("constructor")||(b.hasOwnProperty("constructor")?c(d,"constructor",b.constructor):d.constructor=function(){this._super(arguments)}),n.push([a,d])}return i}function l(a){return a&&a.hasOwnProperty("__defined__")&&(i.__defined__=n=n.concat(a.__defined__)),g(i,a,["define","extend","expose","__defined__"]),i}b=b||[];var m=a({instance:{constructor:function(a){this._value=a},value:function(){return this._value},eq:function(a){return this.__extender__(this._value===a)},neq:function(a){return this.__extender__(this._value!==a)},print:function(){return console.log(this._value),this}}}),n=[];return i.define=k,i.extend=l,i.expose=function(){for(var a,b=0,c=arguments.length;c>b;b++)a=arguments[b],"object"==typeof a&&g(i,a,["define","extend","expose","__defined__"]);return i},i.__defined__=n,i}var e,f=Array.prototype.slice,g=function(){function a(a,c,d){var e,f;for(e in c)c.hasOwnProperty(e)&&-1===b(d,e)&&(f=c[e],e in a&&a[e]===f||(a[e]=f));return a}return function(b){b||(b={});var d=arguments.length,e=arguments[arguments.length-1];c(e)?d--:e=[];for(var f=1;d>f;f++)a(b,arguments[f],e);return b}}();return{define:function(){return d().define.apply(d,arguments)},extend:function(a){return d().define().extend(a)}}}"undefined"!=typeof c?"undefined"!=typeof b&&b.exports&&(b.exports=d(a("declare.js"))):"function"==typeof define&&define.amd?define(["declare"],function(a){return d(a)}):this.extender=d(this.declare)}.call(this)},{"declare.js":39}],42:[function(a,b){b.exports=a("./extender.js")},{"./extender.js":41}],43:[function(a,b,c){!function(){"use strict";function d(a,b,c){function d(a,b,c){if(c=o(arguments,2),m(b)&&!(b in a))throw new Error(b+" property not defined in scope");if(!m(b)&&!n(b))throw new Error(b+" is not a function");return m(b)?function(){var d=a[b];if(n(d)){var e=c.concat(o(arguments));return d.apply(a,e)}return d}:c.length?function(){var d=c.concat(o(arguments));return b.apply(a,d)}:function(){return b.apply(a,arguments)}}function e(a,b){if(b=o(arguments,1),!m(a)&&!n(a))throw new Error(a+" must be the name of a property or function to execute");return m(a)?function(){var c=o(arguments),d=c.shift(),e=d[a];return n(e)?(c=b.concat(c),e.apply(d,c)):e}:function(){var c=o(arguments),d=c.shift();return c=b.concat(c),a.apply(d,c)}}function f(a,b,c){if(c=o(arguments,2),m(b)&&!(b in a))throw new Error(b+" property not defined in scope");if(!m(b)&&!n(b))throw new Error(b+" is not a function");return m(b)?function(){var d=a[b];return n(d)?d.apply(a,c):d}:function(){return b.apply(a,c)}}function g(a){var b=o(arguments,1);if(!l(a)&&!n(a))throw new TypeError("scope must be an object");if(1===b.length&&k(b[0])&&(b=b[0]),!b.length){b=[];for(var c in a)a.hasOwnProperty(c)&&n(a[c])&&b.push(c)}for(var e=0,f=b.length;f>e;e++)a[b[e]]=d(a,a[b[e]]);return a}function h(a,b){if(b=o(arguments,1),!m(a)&&!n(a))throw new Error(a+" must be the name of a property or function to execute");return m(a)?function(){var c=this[a];if(n(c)){var d=b.concat(o(arguments));return c.apply(this,d)}return c}:function(){var c=b.concat(o(arguments));return a.apply(this,c)}}function i(a,b){return function(){var c=o(arguments);return b?a.apply(this,arguments):function(){return a.apply(this,c.concat(o(arguments)))}}}function j(a,b,c){var e;if(e=c?d(c,b):b,a)for(var f=a-1,g=f;g>=0;g--)e=i(e,g===f);return e}var k=b.isArray,l=b.isObject,m=b.isString,n=b.isFunction,o=c.argsToArray;return a.define(l,{bind:d,bindAll:g,bindIgnore:f,curry:function(a,b,c){return j(b,c,a)}}).define(n,{bind:function(a,b){return d.apply(this,[b,a].concat(o(arguments,2)))},bindIgnore:function(a,b){return f.apply(this,[b,a].concat(o(arguments,2)))},partial:h,applyFirst:e,curry:function(a,b,c){return j(b,a,c)},noWrap:{f:function(){return this.value()}}}).define(m,{bind:function(a,b){return d(b,a)},bindIgnore:function(a,b){return f(b,a)},partial:h,applyFirst:e,curry:function(a,b,c){return j(b,a,c)}}).expose({bind:d,bindAll:g,bindIgnore:f,partial:h,applyFirst:e,curry:j})}"undefined"!=typeof c?"undefined"!=typeof b&&b.exports&&(b.exports=d(a("extended"),a("is-extended"),a("arguments-extended"))):"function"==typeof define&&define.amd?define(["extended","is-extended","arguments-extended"],function(a,b,c){return d(a,b,c)}):this.functionExtended=d(this.extended,this.isExtended,this.argumentsExtended)}.call(this)},{"arguments-extended":35,extended:40,"is-extended":50}],44:[function(a,b,c){function d(a,b){if(a.indexOf)return a.indexOf(b);for(var c=0;ce;e++)d[e].apply(this,c);return!0}return!1},f.prototype.addListener=function(a,b){if("function"!=typeof b)throw new Error("addListener only takes instances of Function");if(this._events||(this._events={}),this.emit("newListener",a,b),this._events[a])if(g(this._events[a])){if(!this._events[a].warned){var c;c=void 0!==this._events.maxListeners?this._events.maxListeners:h,c&&c>0&&this._events[a].length>c&&(this._events[a].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[a].length),console.trace())}this._events[a].push(b)}else this._events[a]=[this._events[a],b];else this._events[a]=b;return this},f.prototype.on=f.prototype.addListener,f.prototype.once=function(a,b){var c=this;return c.on(a,function d(){c.removeListener(a,d),b.apply(this,arguments)}),this},f.prototype.removeListener=function(a,b){if("function"!=typeof b)throw new Error("removeListener only takes instances of Function");if(!this._events||!this._events[a])return this;var c=this._events[a];if(g(c)){var e=d(c,b);if(0>e)return this;c.splice(e,1),0==c.length&&delete this._events[a]}else this._events[a]===b&&delete this._events[a];return this},f.prototype.removeAllListeners=function(a){return 0===arguments.length?(this._events={},this):(a&&this._events&&this._events[a]&&(this._events[a]=null),this)},f.prototype.listeners=function(a){return this._events||(this._events={}),this._events[a]||(this._events[a]=[]),g(this._events[a])||(this._events[a]=[this._events[a]]),this._events[a]},f.listenerCount=function(a,b){var c;return c=a._events&&a._events[b]?"function"==typeof a._events[b]?1:a._events[b].length:0}},{__browserify_process:48}],45:[function(){},{}],46:[function(a,b,c){function d(a,b){for(var c=[],d=0;d=0;d--){var e=a[d];"."==e?a.splice(d,1):".."===e?(a.splice(d,1),c++):c&&(a.splice(d,1),c--)}if(b)for(;c--;c)a.unshift("..");return a}var f=a("__browserify_process"),g=/^(.+\/(?!$)|\/)?((?:.+?)?(\.[^.]*)?)$/;c.resolve=function(){for(var a="",b=!1,c=arguments.length;c>=-1&&!b;c--){var g=c>=0?arguments[c]:f.cwd();"string"==typeof g&&g&&(a=g+"/"+a,b="/"===g.charAt(0))}return a=e(d(a.split("/"),function(a){return!!a}),!b).join("/"),(b?"/":"")+a||"."},c.normalize=function(a){var b="/"===a.charAt(0),c="/"===a.slice(-1);return a=e(d(a.split("/"),function(a){return!!a}),!b).join("/"),a||b||(a="."),a&&c&&(a+="/"),(b?"/":"")+a},c.join=function(){var a=Array.prototype.slice.call(arguments,0);return c.normalize(d(a,function(a){return a&&"string"==typeof a}).join("/"))},c.dirname=function(a){var b=g.exec(a)[1]||"",c=!1;return b?1===b.length||c&&b.length<=3&&":"===b.charAt(1)?b:b.substring(0,b.length-1):"."},c.basename=function(a,b){var c=g.exec(a)[2]||"";return b&&c.substr(-1*b.length)===b&&(c=c.substr(0,c.length-b.length)),c},c.extname=function(a){return g.exec(a)[3]||""},c.relative=function(a,b){function d(a){for(var b=0;b=0&&""===a[c];c--);return b>c?[]:a.slice(b,c-b+1)}a=c.resolve(a).substr(1),b=c.resolve(b).substr(1);for(var e=d(a.split("/")),f=d(b.split("/")),g=Math.min(e.length,f.length),h=g,i=0;g>i;i++)if(e[i]!==f[i]){h=i;break}for(var j=[],i=h;i=0;e--)if(f[e]!=g[e])return!1;for(e=f.length-1;e>=0;e--)if(d=f[e],!h(a[d],b[d]))return!1;return!0}function l(a,b){return a&&b?b instanceof RegExp?b.test(a):a instanceof b?!0:b.call({},a)===!0?!0:!1:!1}function m(a,b,c,d){var e;"string"==typeof c&&(d=c,c=null);try{b()}catch(g){e=g}if(d=(c&&c.name?" ("+c.name+").":".")+(d?" "+d:"."),a&&!e&&f("Missing expected exception"+d),!a&&l(e,c)&&f("Got unwanted exception"+d),a&&e&&c&&!l(e,c)||!a&&e)throw e}var n=a("util"),o=a("buffer").Buffer,p=Array.prototype.slice,q=b.exports=g;q.AssertionError=function(a){this.name="AssertionError",this.message=a.message,this.actual=a.actual,this.expected=a.expected,this.operator=a.operator;var b=a.stackStartFunction||f;Error.captureStackTrace&&Error.captureStackTrace(this,b)},n.inherits(q.AssertionError,Error),q.AssertionError.prototype.toString=function(){return this.message?[this.name+":",this.message].join(" "):[this.name+":",e(JSON.stringify(this.actual,d),128),this.operator,e(JSON.stringify(this.expected,d),128)].join(" ")},q.AssertionError.__proto__=Error.prototype,q.fail=f,q.ok=g,q.equal=function(a,b,c){a!=b&&f(a,b,c,"==",q.equal)},q.notEqual=function(a,b,c){a==b&&f(a,b,c,"!=",q.notEqual)},q.deepEqual=function(a,b,c){h(a,b)||f(a,b,c,"deepEqual",q.deepEqual)},q.notDeepEqual=function(a,b,c){h(a,b)&&f(a,b,c,"notDeepEqual",q.notDeepEqual)},q.strictEqual=function(a,b,c){a!==b&&f(a,b,c,"===",q.strictEqual)},q.notStrictEqual=function(a,b,c){a===b&&f(a,b,c,"!==",q.notStrictEqual)},q.throws=function(){m.apply(this,[!0].concat(p.call(arguments)))},q.doesNotThrow=function(){m.apply(this,[!1].concat(p.call(arguments)))},q.ifError=function(a){if(a)throw a}},{util:2,buffer:3}],2:[function(a,b,c){function d(a){return a instanceof Array||Array.isArray(a)||a&&a!==Object.prototype&&d(a.__proto__)}function e(a){return a instanceof RegExp||"object"==typeof a&&"[object RegExp]"===Object.prototype.toString.call(a)}function f(a){if(a instanceof Date)return!0;if("object"!=typeof a)return!1;var b=Date.prototype&&h(Date.prototype),c=a.__proto__&&h(a.__proto__);return JSON.stringify(c)===JSON.stringify(b)}a("events"),c.isArray=d,c.isDate=function(a){return"[object Date]"===Object.prototype.toString.call(a)},c.isRegExp=function(a){return"[object RegExp]"===Object.prototype.toString.call(a)},c.print=function(){},c.puts=function(){},c.debug=function(){},c.inspect=function(a,b,i,j){function k(a,i){if(a&&"function"==typeof a.inspect&&a!==c&&(!a.constructor||a.constructor.prototype!==a))return a.inspect(i);switch(typeof a){case"undefined":return m("undefined","undefined");case"string":var j="'"+JSON.stringify(a).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return m(j,"string");case"number":return m(""+a,"number");case"boolean":return m(""+a,"boolean")}if(null===a)return m("null","null");var n=g(a),o=b?h(a):n;if("function"==typeof a&&0===o.length){if(e(a))return m(""+a,"regexp");var p=a.name?": "+a.name:"";return m("[Function"+p+"]","special")}if(f(a)&&0===o.length)return m(a.toUTCString(),"date");var q,r,s;if(d(a)?(r="Array",s=["[","]"]):(r="Object",s=["{","}"]),"function"==typeof a){var t=a.name?": "+a.name:"";q=e(a)?" "+a:" [Function"+t+"]"}else q="";if(f(a)&&(q=" "+a.toUTCString()),0===o.length)return s[0]+q+s[1];if(0>i)return e(a)?m(""+a,"regexp"):m("[Object]","special");l.push(a);var u=o.map(function(b){var c,e;if(a.__lookupGetter__&&(a.__lookupGetter__(b)?e=a.__lookupSetter__(b)?m("[Getter/Setter]","special"):m("[Getter]","special"):a.__lookupSetter__(b)&&(e=m("[Setter]","special"))),n.indexOf(b)<0&&(c="["+b+"]"),e||(l.indexOf(a[b])<0?(e=null===i?k(a[b]):k(a[b],i-1),e.indexOf("\n")>-1&&(e=d(a)?e.split("\n").map(function(a){return" "+a}).join("\n").substr(2):"\n"+e.split("\n").map(function(a){return" "+a}).join("\n"))):e=m("[Circular]","special")),"undefined"==typeof c){if("Array"===r&&b.match(/^\d+$/))return e;c=JSON.stringify(""+b),c.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(c=c.substr(1,c.length-2),c=m(c,"name")):(c=c.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),c=m(c,"string"))}return c+": "+e});l.pop();var v=0,w=u.reduce(function(a,b){return v++,b.indexOf("\n")>=0&&v++,a+b.length+1},0);return u=w>50?s[0]+(""===q?"":q+"\n ")+" "+u.join(",\n ")+" "+s[1]:s[0]+q+" "+u.join(", ")+" "+s[1]}var l=[],m=function(a,b){var c={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]},d={special:"cyan",number:"blue","boolean":"yellow",undefined:"grey","null":"bold",string:"green",date:"magenta",regexp:"red"}[b];return d?"["+c[d][0]+"m"+a+"["+c[d][1]+"m":a};return j||(m=function(a){return a}),k(a,"undefined"==typeof i?2:i)},c.log=function(){},c.pump=null;var g=Object.keys||function(a){var b=[];for(var c in a)b.push(c);return b},h=Object.getOwnPropertyNames||function(a){var b=[];for(var c in a)Object.hasOwnProperty.call(a,c)&&b.push(c);return b},i=Object.create||function(a,b){var c;if(null===a)c={__proto__:null};else{if("object"!=typeof a)throw new TypeError("typeof prototype["+typeof a+"] != 'object'");var d=function(){};d.prototype=a,c=new d,c.__proto__=a}return"undefined"!=typeof b&&Object.defineProperties&&Object.defineProperties(c,b),c};c.inherits=function(a,b){a.super_=b,a.prototype=i(b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}})};var j=/%[sdj%]/g;c.format=function(a){if("string"!=typeof a){for(var b=[],d=0;d=f)return a;switch(a){case"%s":return String(e[d++]);case"%d":return Number(e[d++]);case"%j":return JSON.stringify(e[d++]);default:return a}}),h=e[d];f>d;h=e[++d])g+=null===h||"object"!=typeof h?" "+h:" "+c.inspect(h);return g}},{events:4}],5:[function(a,b,c){c.readIEEE754=function(a,b,c,d,e){var f,g,h=8*e-d-1,i=(1<>1,k=-7,l=c?0:e-1,m=c?1:-1,n=a[b+l];for(l+=m,f=n&(1<<-k)-1,n>>=-k,k+=h;k>0;f=256*f+a[b+l],l+=m,k-=8);for(g=f&(1<<-k)-1,f>>=-k,k+=d;k>0;g=256*g+a[b+l],l+=m,k-=8);if(0===f)f=1-j;else{if(f===i)return g?0/0:1/0*(n?-1:1);g+=Math.pow(2,d),f-=j}return(n?-1:1)*g*Math.pow(2,f-d)},c.writeIEEE754=function(a,b,c,d,e,f){var g,h,i,j=8*f-e-1,k=(1<>1,m=23===e?Math.pow(2,-24)-Math.pow(2,-77):0,n=d?f-1:0,o=d?-1:1,p=0>b||0===b&&0>1/b?1:0;for(b=Math.abs(b),isNaN(b)||1/0===b?(h=isNaN(b)?1:0,g=k):(g=Math.floor(Math.log(b)/Math.LN2),b*(i=Math.pow(2,-g))<1&&(g--,i*=2),b+=g+l>=1?m/i:m*Math.pow(2,1-l),b*i>=2&&(g++,i/=2),g+l>=k?(h=0,g=k):g+l>=1?(h=(b*i-1)*Math.pow(2,e),g+=l):(h=b*Math.pow(2,l-1)*Math.pow(2,e),g=0));e>=8;a[c+n]=255&h,n+=o,h/=256,e-=8);for(g=g<0;a[c+n]=255&g,n+=o,g/=256,j-=8);a[c+n-o]|=128*p}},{}],6:[function(a,b){var c=b.exports={};c.nextTick=function(){var a="undefined"!=typeof window&&window.setImmediate,b="undefined"!=typeof window&&window.postMessage&&window.addEventListener;if(a)return function(a){return window.setImmediate(a)};if(b){var c=[];return window.addEventListener("message",function(a){if(a.source===window&&"process-tick"===a.data&&(a.stopPropagation(),c.length>0)){var b=c.shift();b()}},!0),function(a){c.push(a),window.postMessage("process-tick","*")}}return function(a){setTimeout(a,0)}}(),c.title="browser",c.browser=!0,c.env={},c.argv=[],c.binding=function(){throw new Error("process.binding is not supported")},c.cwd=function(){return"/"},c.chdir=function(){throw new Error("process.chdir is not supported")}},{}],4:[function(a,b,c){!function(a){function b(a,b){if(a.indexOf)return a.indexOf(b);for(var c=0;cf;f++)d[f].apply(this,c);return!0}return!1},d.prototype.addListener=function(a,b){if("function"!=typeof b)throw new Error("addListener only takes instances of Function");if(this._events||(this._events={}),this.emit("newListener",a,b),this._events[a])if(e(this._events[a])){if(!this._events[a].warned){var c;c=void 0!==this._events.maxListeners?this._events.maxListeners:f,c&&c>0&&this._events[a].length>c&&(this._events[a].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[a].length),console.trace())}this._events[a].push(b)}else this._events[a]=[this._events[a],b];else this._events[a]=b;return this},d.prototype.on=d.prototype.addListener,d.prototype.once=function(a,b){var c=this;return c.on(a,function d(){c.removeListener(a,d),b.apply(this,arguments)}),this},d.prototype.removeListener=function(a,c){if("function"!=typeof c)throw new Error("removeListener only takes instances of Function");if(!this._events||!this._events[a])return this;var d=this._events[a];if(e(d)){var f=b(d,c);if(0>f)return this;d.splice(f,1),0==d.length&&delete this._events[a]}else this._events[a]===c&&delete this._events[a];return this},d.prototype.removeAllListeners=function(a){return 0===arguments.length?(this._events={},this):(a&&this._events&&this._events[a]&&(this._events[a]=null),this)},d.prototype.listeners=function(a){return this._events||(this._events={}),this._events[a]||(this._events[a]=[]),e(this._events[a])||(this._events[a]=[this._events[a]]),this._events[a]}}(a("__browserify_process"))},{__browserify_process:6}],"buffer-browserify":[function(a,b){b.exports=a("q9TxCC")},{}],q9TxCC:[function(a,b,c){function d(a){this.length=a}function e(a){return 16>a?"0"+a.toString(16):a.toString(16)}function f(a){for(var b=[],c=0;ce&&!(e+c>=b.length||e>=a.length);)b[e+c]=a[e],e++;return e}function j(a){try{return decodeURIComponent(a)}catch(b){return String.fromCharCode(65533)}}function k(a){return a=~~Math.ceil(+a),0>a?0:a}function l(a,b,c){if(!(this instanceof l))return new l(a,b,c);var e;if("number"==typeof c)this.length=k(b),this.parent=a,this.offset=c;else{switch(e=typeof a){case"number":this.length=k(a);break;case"string":this.length=l.byteLength(a,b);break;case"object":this.length=k(a.length);break;default:throw new Error("First argument needs to be a number, array or string.")}if(this.length>l.poolSize?(this.parent=new d(this.length),this.offset=0):((!E||E.length-E.used=a.length?0:(c?(e=a.parent[a.offset+b]<<8,b+1=a.length?0:(c?(b+1>>0):(b+2>>0)),e)}function q(a,b,c,d){var e,f;return d||(D.ok("boolean"==typeof c,"missing or invalid endian"),D.ok(void 0!==b&&null!==b,"missing offset"),D.ok(b+1=0,"specified a negative value for writing an unsigned value"),D.ok(b>=a,"value is larger than maximum value for type"),D.ok(Math.floor(a)===a,"value has a fractional component")}function v(a,b,c,d,e){e||(D.ok(void 0!==b&&null!==b,"missing value"),D.ok("boolean"==typeof d,"missing or invalid endian"),D.ok(void 0!==c&&null!==c,"missing offset"),D.ok(c+1>>8*(d?1-f:f)}function w(a,b,c,d,e){e||(D.ok(void 0!==b&&null!==b,"missing value"),D.ok("boolean"==typeof d,"missing or invalid endian"),D.ok(void 0!==c&&null!==c,"missing offset"),D.ok(c+3>>8*(d?3-f:f)}function x(a,b,c){D.ok("number"==typeof a,"cannot write a non-number as a number"),D.ok(b>=a,"value larger than maximum allowed value"),D.ok(a>=c,"value smaller than minimum allowed value"),D.ok(Math.floor(a)===a,"value has a fractional component")}function y(a,b,c){D.ok("number"==typeof a,"cannot write a non-number as a number"),D.ok(b>=a,"value larger than maximum allowed value"),D.ok(a>=c,"value smaller than minimum allowed value")
-}function z(a,b,c,d,e){e||(D.ok(void 0!==b&&null!==b,"missing value"),D.ok("boolean"==typeof d,"missing or invalid endian"),D.ok(void 0!==c&&null!==c,"missing offset"),D.ok(c+1=0?v(a,b,c,d,e):v(a,65535+b+1,c,d,e)}function A(a,b,c,d,e){e||(D.ok(void 0!==b&&null!==b,"missing value"),D.ok("boolean"==typeof d,"missing or invalid endian"),D.ok(void 0!==c&&null!==c,"missing offset"),D.ok(c+3=0?w(a,b,c,d,e):w(a,4294967295+b+1,c,d,e)}function B(b,c,d,e,f){f||(D.ok(void 0!==c&&null!==c,"missing value"),D.ok("boolean"==typeof e,"missing or invalid endian"),D.ok(void 0!==d&&null!==d,"missing offset"),D.ok(d+3d;d++)if(a[d]=e(this[d]),d==c.INSPECT_MAX_BYTES){a[d+1]="...";break}return""},d.prototype.hexSlice=function(a,b){var c=this.length;(!a||0>a)&&(a=0),(!b||0>b||b>c)&&(b=c);for(var d="",f=a;b>f;f++)d+=e(this[f]);return d},d.prototype.toString=function(a,b,c){if(a=String(a||"utf8").toLowerCase(),b=+b||0,"undefined"==typeof c&&(c=this.length),+c==b)return"";switch(a){case"hex":return this.hexSlice(b,c);case"utf8":case"utf-8":return this.utf8Slice(b,c);case"ascii":return this.asciiSlice(b,c);case"binary":return this.binarySlice(b,c);case"base64":return this.base64Slice(b,c);case"ucs2":case"ucs-2":return this.ucs2Slice(b,c);default:throw new Error("Unknown encoding")}},d.prototype.hexWrite=function(a,b,c){b=+b||0;var e=this.length-b;c?(c=+c,c>e&&(c=e)):c=e;var f=a.length;if(f%2)throw new Error("Invalid hex string");c>f/2&&(c=f/2);for(var g=0;c>g;g++){var h=parseInt(a.substr(2*g,2),16);if(isNaN(h))throw new Error("Invalid hex string");this[b+g]=h}return d._charsWritten=2*g,g},d.prototype.write=function(a,b,c,d){if(isFinite(b))isFinite(c)||(d=c,c=void 0);else{var e=d;d=b,b=c,c=e}b=+b||0;var f=this.length-b;switch(c?(c=+c,c>f&&(c=f)):c=f,d=String(d||"utf8").toLowerCase()){case"hex":return this.hexWrite(a,b,c);case"utf8":case"utf-8":return this.utf8Write(a,b,c);case"ascii":return this.asciiWrite(a,b,c);case"binary":return this.binaryWrite(a,b,c);case"base64":return this.base64Write(a,b,c);case"ucs2":case"ucs-2":return this.ucs2Write(a,b,c);default:throw new Error("Unknown encoding")}},d.prototype.slice=function(a,b){if(void 0===b&&(b=this.length),b>this.length)throw new Error("oob");if(a>b)throw new Error("oob");return new l(this,b-a,+a)},d.prototype.copy=function(a,b,c,d){for(var e=[],f=c;d>f;f++)D.ok("undefined"!=typeof this[f],"copying undefined buffer bytes!"),e.push(this[f]);for(var f=b;fthis.length)throw new Error("oob");if(b>c)throw new Error("oob");for(var d=b;c>d;d++)this[d]=a},c.SlowBuffer=d,c.Buffer=l,l.poolSize=8192;var E;l.isBuffer=function(a){return a instanceof l||a instanceof d},l.concat=function(a,b){if(!Array.isArray(a))throw new Error("Usage: Buffer.concat(list, [totalLength])\n list should be an Array.");if(0===a.length)return new l(0);if(1===a.length)return a[0];if("number"!=typeof b){b=0;for(var c=0;cd;d++)if(a[d]=e(this.parent[d+this.offset]),d==c.INSPECT_MAX_BYTES){a[d+1]="...";break}return""},l.prototype.get=function(a){if(0>a||a>=this.length)throw new Error("oob");return this.parent[this.offset+a]},l.prototype.set=function(a,b){if(0>a||a>=this.length)throw new Error("oob");return this.parent[this.offset+a]=b},l.prototype.write=function(a,b,c,e){if(isFinite(b))isFinite(c)||(e=c,c=void 0);else{var f=e;e=b,b=c,c=f}b=+b||0;var g=this.length-b;c?(c=+c,c>g&&(c=g)):c=g,e=String(e||"utf8").toLowerCase();var h;switch(e){case"hex":h=this.parent.hexWrite(a,this.offset+b,c);break;case"utf8":case"utf-8":h=this.parent.utf8Write(a,this.offset+b,c);break;case"ascii":h=this.parent.asciiWrite(a,this.offset+b,c);break;case"binary":h=this.parent.binaryWrite(a,this.offset+b,c);break;case"base64":h=this.parent.base64Write(a,this.offset+b,c);break;case"ucs2":case"ucs-2":h=this.parent.ucs2Write(a,this.offset+b,c);break;default:throw new Error("Unknown encoding")}return l._charsWritten=d._charsWritten,h},l.prototype.toString=function(a,b,c){switch(a=String(a||"utf8").toLowerCase(),"undefined"==typeof b||0>b?b=0:b>this.length&&(b=this.length),"undefined"==typeof c||c>this.length?c=this.length:0>c&&(c=0),b+=this.offset,c+=this.offset,a){case"hex":return this.parent.hexSlice(b,c);case"utf8":case"utf-8":return this.parent.utf8Slice(b,c);case"ascii":return this.parent.asciiSlice(b,c);case"binary":return this.parent.binarySlice(b,c);case"base64":return this.parent.base64Slice(b,c);case"ucs2":case"ucs-2":return this.parent.ucs2Slice(b,c);default:throw new Error("Unknown encoding")}},l.byteLength=d.byteLength,l.prototype.fill=function(a,b,c){if(a||(a=0),b||(b=0),c||(c=this.length),"string"==typeof a&&(a=a.charCodeAt(0)),"number"!=typeof a||isNaN(a))throw new Error("value is not a number");if(b>c)throw new Error("end < start");if(c===b)return 0;if(0==this.length)return 0;if(0>b||b>=this.length)throw new Error("start out of bounds");if(0>c||c>this.length)throw new Error("end out of bounds");return this.parent.fill(a,b+this.offset,c+this.offset)},l.prototype.copy=function(a,b,c,d){var e=this;if(c||(c=0),d||(d=this.length),b||(b=0),c>d)throw new Error("sourceEnd < sourceStart");if(d===c)return 0;if(0==a.length||0==e.length)return 0;if(0>b||b>=a.length)throw new Error("targetStart out of bounds");if(0>c||c>=e.length)throw new Error("sourceStart out of bounds");if(0>d||d>e.length)throw new Error("sourceEnd out of bounds");return d>this.length&&(d=this.length),a.length-bthis.length)throw new Error("oob");if(a>b)throw new Error("oob");return new l(this.parent,b-a,+a+this.offset)},l.prototype.utf8Slice=function(a,b){return this.toString("utf8",a,b)},l.prototype.binarySlice=function(a,b){return this.toString("binary",a,b)},l.prototype.asciiSlice=function(a,b){return this.toString("ascii",a,b)},l.prototype.utf8Write=function(a,b){return this.write(a,b,"utf8")},l.prototype.binaryWrite=function(a,b){return this.write(a,b,"binary")},l.prototype.asciiWrite=function(a,b){return this.write(a,b,"ascii")},l.prototype.readUInt8=function(a,b){var c=this;return b||(D.ok(void 0!==a&&null!==a,"missing offset"),D.ok(a=c.length?void 0:c.parent[c.offset+a]},l.prototype.readUInt16LE=function(a,b){return o(this,a,!1,b)},l.prototype.readUInt16BE=function(a,b){return o(this,a,!0,b)},l.prototype.readUInt32LE=function(a,b){return p(this,a,!1,b)},l.prototype.readUInt32BE=function(a,b){return p(this,a,!0,b)},l.prototype.readInt8=function(a,b){var c,d=this;return b||(D.ok(void 0!==a&&null!==a,"missing offset"),D.ok(a=d.length?void 0:(c=128&d.parent[d.offset+a],c?-1*(255-d.parent[d.offset+a]+1):d.parent[d.offset+a])},l.prototype.readInt16LE=function(a,b){return q(this,a,!1,b)},l.prototype.readInt16BE=function(a,b){return q(this,a,!0,b)},l.prototype.readInt32LE=function(a,b){return r(this,a,!1,b)},l.prototype.readInt32BE=function(a,b){return r(this,a,!0,b)},l.prototype.readFloatLE=function(a,b){return s(this,a,!1,b)},l.prototype.readFloatBE=function(a,b){return s(this,a,!0,b)},l.prototype.readDoubleLE=function(a,b){return t(this,a,!1,b)},l.prototype.readDoubleBE=function(a,b){return t(this,a,!0,b)},l.prototype.writeUInt8=function(a,b,c){var d=this;c||(D.ok(void 0!==a&&null!==a,"missing value"),D.ok(void 0!==b&&null!==b,"missing offset"),D.ok(b=0?d.writeUInt8(a,b,c):d.writeUInt8(255+a+1,b,c)},l.prototype.writeInt16LE=function(a,b,c){z(this,a,b,!1,c)},l.prototype.writeInt16BE=function(a,b,c){z(this,a,b,!0,c)},l.prototype.writeInt32LE=function(a,b,c){A(this,a,b,!1,c)},l.prototype.writeInt32BE=function(a,b,c){A(this,a,b,!0,c)},l.prototype.writeFloatLE=function(a,b,c){B(this,a,b,!1,c)},l.prototype.writeFloatBE=function(a,b,c){B(this,a,b,!0,c)},l.prototype.writeDoubleLE=function(a,b,c){C(this,a,b,!1,c)},l.prototype.writeDoubleBE=function(a,b,c){C(this,a,b,!0,c)},d.prototype.readUInt8=l.prototype.readUInt8,d.prototype.readUInt16LE=l.prototype.readUInt16LE,d.prototype.readUInt16BE=l.prototype.readUInt16BE,d.prototype.readUInt32LE=l.prototype.readUInt32LE,d.prototype.readUInt32BE=l.prototype.readUInt32BE,d.prototype.readInt8=l.prototype.readInt8,d.prototype.readInt16LE=l.prototype.readInt16LE,d.prototype.readInt16BE=l.prototype.readInt16BE,d.prototype.readInt32LE=l.prototype.readInt32LE,d.prototype.readInt32BE=l.prototype.readInt32BE,d.prototype.readFloatLE=l.prototype.readFloatLE,d.prototype.readFloatBE=l.prototype.readFloatBE,d.prototype.readDoubleLE=l.prototype.readDoubleLE,d.prototype.readDoubleBE=l.prototype.readDoubleBE,d.prototype.writeUInt8=l.prototype.writeUInt8,d.prototype.writeUInt16LE=l.prototype.writeUInt16LE,d.prototype.writeUInt16BE=l.prototype.writeUInt16BE,d.prototype.writeUInt32LE=l.prototype.writeUInt32LE,d.prototype.writeUInt32BE=l.prototype.writeUInt32BE,d.prototype.writeInt8=l.prototype.writeInt8,d.prototype.writeInt16LE=l.prototype.writeInt16LE,d.prototype.writeInt16BE=l.prototype.writeInt16BE,d.prototype.writeInt32LE=l.prototype.writeInt32LE,d.prototype.writeInt32BE=l.prototype.writeInt32BE,d.prototype.writeFloatLE=l.prototype.writeFloatLE,d.prototype.writeFloatBE=l.prototype.writeFloatBE,d.prototype.writeDoubleLE=l.prototype.writeDoubleLE,d.prototype.writeDoubleBE=l.prototype.writeDoubleBE},{assert:1,"./buffer_ieee754":5,"base64-js":7}],7:[function(a,b){!function(){"use strict";function a(a){var b,c,e,f,g,h;if(a.length%4>0)throw"Invalid string. Length must be a multiple of 4";for(g=a.indexOf("="),g=g>0?a.length-g:0,h=[],e=g>0?a.length-4:a.length,b=0,c=0;e>b;b+=4,c+=3)f=d.indexOf(a[b])<<18|d.indexOf(a[b+1])<<12|d.indexOf(a[b+2])<<6|d.indexOf(a[b+3]),h.push((16711680&f)>>16),h.push((65280&f)>>8),h.push(255&f);return 2===g?(f=d.indexOf(a[b])<<2|d.indexOf(a[b+1])>>4,h.push(255&f)):1===g&&(f=d.indexOf(a[b])<<10|d.indexOf(a[b+1])<<4|d.indexOf(a[b+2])>>2,h.push(255&f>>8),h.push(255&f)),h}function c(a){function b(a){return d[63&a>>18]+d[63&a>>12]+d[63&a>>6]+d[63&a]}var c,e,f,g=a.length%3,h="";for(c=0,f=a.length-g;f>c;c+=3)e=(a[c]<<16)+(a[c+1]<<8)+a[c+2],h+=b(e);switch(g){case 1:e=a[a.length-1],h+=d[e>>2],h+=d[63&e<<4],h+="==";break;case 2:e=(a[a.length-2]<<8)+a[a.length-1],h+=d[e>>10],h+=d[63&e>>4],h+=d[63&e<<2],h+="="}return h}var d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";b.exports.toByteArray=a,b.exports.fromByteArray=c}()},{}],8:[function(a,b,c){c.readIEEE754=function(a,b,c,d,e){var f,g,h=8*e-d-1,i=(1<>1,k=-7,l=c?0:e-1,m=c?1:-1,n=a[b+l];for(l+=m,f=n&(1<<-k)-1,n>>=-k,k+=h;k>0;f=256*f+a[b+l],l+=m,k-=8);for(g=f&(1<<-k)-1,f>>=-k,k+=d;k>0;g=256*g+a[b+l],l+=m,k-=8);if(0===f)f=1-j;else{if(f===i)return g?0/0:1/0*(n?-1:1);g+=Math.pow(2,d),f-=j}return(n?-1:1)*g*Math.pow(2,f-d)},c.writeIEEE754=function(a,b,c,d,e,f){var g,h,i,j=8*f-e-1,k=(1<>1,m=23===e?Math.pow(2,-24)-Math.pow(2,-77):0,n=d?f-1:0,o=d?-1:1,p=0>b||0===b&&0>1/b?1:0;for(b=Math.abs(b),isNaN(b)||1/0===b?(h=isNaN(b)?1:0,g=k):(g=Math.floor(Math.log(b)/Math.LN2),b*(i=Math.pow(2,-g))<1&&(g--,i*=2),b+=g+l>=1?m/i:m*Math.pow(2,1-l),b*i>=2&&(g++,i/=2),g+l>=k?(h=0,g=k):g+l>=1?(h=(b*i-1)*Math.pow(2,e),g+=l):(h=b*Math.pow(2,l-1)*Math.pow(2,e),g=0));e>=8;a[c+n]=255&h,n+=o,h/=256,e-=8);for(g=g<0;a[c+n]=255&g,n+=o,g/=256,j-=8);a[c+n-o]|=128*p}},{}],3:[function(a,b,c){function d(a){this.length=a}function e(a){return 16>a?"0"+a.toString(16):a.toString(16)}function f(a){for(var b=[],c=0;ce&&!(e+c>=b.length||e>=a.length);)b[e+c]=a[e],e++;return e}function j(a){try{return decodeURIComponent(a)}catch(b){return String.fromCharCode(65533)}}function k(a){return a=~~Math.ceil(+a),0>a?0:a}function l(a,b,c){if(!(this instanceof l))return new l(a,b,c);var e;if("number"==typeof c)this.length=k(b),this.parent=a,this.offset=c;else{switch(e=typeof a){case"number":this.length=k(a);break;case"string":this.length=l.byteLength(a,b);break;case"object":this.length=k(a.length);break;default:throw new Error("First argument needs to be a number, array or string.")}if(this.length>l.poolSize?(this.parent=new d(this.length),this.offset=0):((!E||E.length-E.used>>0):(e=a.parent[a.offset+b+2]<<16,e|=a.parent[a.offset+b+1]<<8,e|=a.parent[a.offset+b],e+=a.parent[a.offset+b+3]<<24>>>0),e}function q(a,b,c,d){var e,f;return d||(D.ok("boolean"==typeof c,"missing or invalid endian"),D.ok(void 0!==b&&null!==b,"missing offset"),D.ok(b+1=0,"specified a negative value for writing an unsigned value"),D.ok(b>=a,"value is larger than maximum value for type"),D.ok(Math.floor(a)===a,"value has a fractional component")}function v(a,b,c,d,e){e||(D.ok(void 0!==b&&null!==b,"missing value"),D.ok("boolean"==typeof d,"missing or invalid endian"),D.ok(void 0!==c&&null!==c,"missing offset"),D.ok(c+1>>8,a.parent[a.offset+c+1]=255&b):(a.parent[a.offset+c+1]=(65280&b)>>>8,a.parent[a.offset+c]=255&b)}function w(a,b,c,d,e){e||(D.ok(void 0!==b&&null!==b,"missing value"),D.ok("boolean"==typeof d,"missing or invalid endian"),D.ok(void 0!==c&&null!==c,"missing offset"),D.ok(c+3>>24,a.parent[a.offset+c+1]=255&b>>>16,a.parent[a.offset+c+2]=255&b>>>8,a.parent[a.offset+c+3]=255&b):(a.parent[a.offset+c+3]=255&b>>>24,a.parent[a.offset+c+2]=255&b>>>16,a.parent[a.offset+c+1]=255&b>>>8,a.parent[a.offset+c]=255&b)}function x(a,b,c){D.ok("number"==typeof a,"cannot write a non-number as a number"),D.ok(b>=a,"value larger than maximum allowed value"),D.ok(a>=c,"value smaller than minimum allowed value"),D.ok(Math.floor(a)===a,"value has a fractional component")}function y(a,b,c){D.ok("number"==typeof a,"cannot write a non-number as a number"),D.ok(b>=a,"value larger than maximum allowed value"),D.ok(a>=c,"value smaller than minimum allowed value")}function z(a,b,c,d,e){e||(D.ok(void 0!==b&&null!==b,"missing value"),D.ok("boolean"==typeof d,"missing or invalid endian"),D.ok(void 0!==c&&null!==c,"missing offset"),D.ok(c+1=0?v(a,b,c,d,e):v(a,65535+b+1,c,d,e)}function A(a,b,c,d,e){e||(D.ok(void 0!==b&&null!==b,"missing value"),D.ok("boolean"==typeof d,"missing or invalid endian"),D.ok(void 0!==c&&null!==c,"missing offset"),D.ok(c+3=0?w(a,b,c,d,e):w(a,4294967295+b+1,c,d,e)}function B(b,c,d,e,f){f||(D.ok(void 0!==c&&null!==c,"missing value"),D.ok("boolean"==typeof e,"missing or invalid endian"),D.ok(void 0!==d&&null!==d,"missing offset"),D.ok(d+3d;d++)if(a[d]=e(this[d]),d==c.INSPECT_MAX_BYTES){a[d+1]="...";break}return""},d.prototype.hexSlice=function(a,b){var c=this.length;(!a||0>a)&&(a=0),(!b||0>b||b>c)&&(b=c);for(var d="",f=a;b>f;f++)d+=e(this[f]);return d},d.prototype.toString=function(a,b,c){if(a=String(a||"utf8").toLowerCase(),b=+b||0,"undefined"==typeof c&&(c=this.length),+c==b)return"";switch(a){case"hex":return this.hexSlice(b,c);case"utf8":case"utf-8":return this.utf8Slice(b,c);case"ascii":return this.asciiSlice(b,c);case"binary":return this.binarySlice(b,c);case"base64":return this.base64Slice(b,c);case"ucs2":case"ucs-2":return this.ucs2Slice(b,c);default:throw new Error("Unknown encoding")}},d.prototype.hexWrite=function(a,b,c){b=+b||0;var e=this.length-b;c?(c=+c,c>e&&(c=e)):c=e;var f=a.length;if(f%2)throw new Error("Invalid hex string");c>f/2&&(c=f/2);for(var g=0;c>g;g++){var h=parseInt(a.substr(2*g,2),16);if(isNaN(h))throw new Error("Invalid hex string");this[b+g]=h}return d._charsWritten=2*g,g},d.prototype.write=function(a,b,c,d){if(isFinite(b))isFinite(c)||(d=c,c=void 0);else{var e=d;d=b,b=c,c=e}b=+b||0;var f=this.length-b;switch(c?(c=+c,c>f&&(c=f)):c=f,d=String(d||"utf8").toLowerCase()){case"hex":return this.hexWrite(a,b,c);case"utf8":case"utf-8":return this.utf8Write(a,b,c);case"ascii":return this.asciiWrite(a,b,c);case"binary":return this.binaryWrite(a,b,c);case"base64":return this.base64Write(a,b,c);case"ucs2":case"ucs-2":return this.ucs2Write(a,b,c);default:throw new Error("Unknown encoding")}},d.prototype.slice=function(a,b){if(void 0===b&&(b=this.length),b>this.length)throw new Error("oob");if(a>b)throw new Error("oob");return new l(this,b-a,+a)},d.prototype.copy=function(a,b,c,d){for(var e=[],f=c;d>f;f++)D.ok("undefined"!=typeof this[f],"copying undefined buffer bytes!"),e.push(this[f]);for(var f=b;fd;d++)if(a[d]=e(this.parent[d+this.offset]),d==c.INSPECT_MAX_BYTES){a[d+1]="...";break}return""},l.prototype.get=function(a){if(0>a||a>=this.length)throw new Error("oob");return this.parent[this.offset+a]},l.prototype.set=function(a,b){if(0>a||a>=this.length)throw new Error("oob");return this.parent[this.offset+a]=b},l.prototype.write=function(a,b,c,e){if(isFinite(b))isFinite(c)||(e=c,c=void 0);else{var f=e;e=b,b=c,c=f}b=+b||0;var g=this.length-b;c?(c=+c,c>g&&(c=g)):c=g,e=String(e||"utf8").toLowerCase();var h;switch(e){case"hex":h=this.parent.hexWrite(a,this.offset+b,c);break;case"utf8":case"utf-8":h=this.parent.utf8Write(a,this.offset+b,c);break;case"ascii":h=this.parent.asciiWrite(a,this.offset+b,c);break;case"binary":h=this.parent.binaryWrite(a,this.offset+b,c);break;case"base64":h=this.parent.base64Write(a,this.offset+b,c);break;case"ucs2":case"ucs-2":h=this.parent.ucs2Write(a,this.offset+b,c);break;default:throw new Error("Unknown encoding")}return l._charsWritten=d._charsWritten,h},l.prototype.toString=function(a,b,c){switch(a=String(a||"utf8").toLowerCase(),"undefined"==typeof b||0>b?b=0:b>this.length&&(b=this.length),"undefined"==typeof c||c>this.length?c=this.length:0>c&&(c=0),b+=this.offset,c+=this.offset,a){case"hex":return this.parent.hexSlice(b,c);case"utf8":case"utf-8":return this.parent.utf8Slice(b,c);case"ascii":return this.parent.asciiSlice(b,c);case"binary":return this.parent.binarySlice(b,c);case"base64":return this.parent.base64Slice(b,c);case"ucs2":case"ucs-2":return this.parent.ucs2Slice(b,c);default:throw new Error("Unknown encoding")}},l.byteLength=d.byteLength,l.prototype.fill=function(a,b,c){if(a||(a=0),b||(b=0),c||(c=this.length),"string"==typeof a&&(a=a.charCodeAt(0)),"number"!=typeof a||isNaN(a))throw new Error("value is not a number");if(b>c)throw new Error("end < start");if(c===b)return 0;if(0==this.length)return 0;if(0>b||b>=this.length)throw new Error("start out of bounds");if(0>c||c>this.length)throw new Error("end out of bounds");return this.parent.fill(a,b+this.offset,c+this.offset)},l.prototype.copy=function(a,b,c,d){var e=this;if(c||(c=0),d||(d=this.length),b||(b=0),c>d)throw new Error("sourceEnd < sourceStart");if(d===c)return 0;if(0==a.length||0==e.length)return 0;if(0>b||b>=a.length)throw new Error("targetStart out of bounds");if(0>c||c>=e.length)throw new Error("sourceStart out of bounds");if(0>d||d>e.length)throw new Error("sourceEnd out of bounds");return d>this.length&&(d=this.length),a.length-bthis.length)throw new Error("oob");if(a>b)throw new Error("oob");return new l(this.parent,b-a,+a+this.offset)},l.prototype.utf8Slice=function(a,b){return this.toString("utf8",a,b)},l.prototype.binarySlice=function(a,b){return this.toString("binary",a,b)},l.prototype.asciiSlice=function(a,b){return this.toString("ascii",a,b)},l.prototype.utf8Write=function(a,b){return this.write(a,b,"utf8")},l.prototype.binaryWrite=function(a,b){return this.write(a,b,"binary")},l.prototype.asciiWrite=function(a,b){return this.write(a,b,"ascii")},l.prototype.readUInt8=function(a,b){var c=this;return b||(D.ok(void 0!==a&&null!==a,"missing offset"),D.ok(a=0?d.writeUInt8(a,b,c):d.writeUInt8(255+a+1,b,c)},l.prototype.writeInt16LE=function(a,b,c){z(this,a,b,!1,c)},l.prototype.writeInt16BE=function(a,b,c){z(this,a,b,!0,c)},l.prototype.writeInt32LE=function(a,b,c){A(this,a,b,!1,c)},l.prototype.writeInt32BE=function(a,b,c){A(this,a,b,!0,c)},l.prototype.writeFloatLE=function(a,b,c){B(this,a,b,!1,c)},l.prototype.writeFloatBE=function(a,b,c){B(this,a,b,!0,c)},l.prototype.writeDoubleLE=function(a,b,c){C(this,a,b,!1,c)},l.prototype.writeDoubleBE=function(a,b,c){C(this,a,b,!0,c)},d.prototype.readUInt8=l.prototype.readUInt8,d.prototype.readUInt16LE=l.prototype.readUInt16LE,d.prototype.readUInt16BE=l.prototype.readUInt16BE,d.prototype.readUInt32LE=l.prototype.readUInt32LE,d.prototype.readUInt32BE=l.prototype.readUInt32BE,d.prototype.readInt8=l.prototype.readInt8,d.prototype.readInt16LE=l.prototype.readInt16LE,d.prototype.readInt16BE=l.prototype.readInt16BE,d.prototype.readInt32LE=l.prototype.readInt32LE,d.prototype.readInt32BE=l.prototype.readInt32BE,d.prototype.readFloatLE=l.prototype.readFloatLE,d.prototype.readFloatBE=l.prototype.readFloatBE,d.prototype.readDoubleLE=l.prototype.readDoubleLE,d.prototype.readDoubleBE=l.prototype.readDoubleBE,d.prototype.writeUInt8=l.prototype.writeUInt8,d.prototype.writeUInt16LE=l.prototype.writeUInt16LE,d.prototype.writeUInt16BE=l.prototype.writeUInt16BE,d.prototype.writeUInt32LE=l.prototype.writeUInt32LE,d.prototype.writeUInt32BE=l.prototype.writeUInt32BE,d.prototype.writeInt8=l.prototype.writeInt8,d.prototype.writeInt16LE=l.prototype.writeInt16LE,d.prototype.writeInt16BE=l.prototype.writeInt16BE,d.prototype.writeInt32LE=l.prototype.writeInt32LE,d.prototype.writeInt32BE=l.prototype.writeInt32BE,d.prototype.writeFloatLE=l.prototype.writeFloatLE,d.prototype.writeFloatBE=l.prototype.writeFloatBE,d.prototype.writeDoubleLE=l.prototype.writeDoubleLE,d.prototype.writeDoubleBE=l.prototype.writeDoubleBE},{assert:1,"./buffer_ieee754":8,"base64-js":9}],9:[function(a,b){!function(){"use strict";function a(a){var b,c,e,f,g,h;if(a.length%4>0)throw"Invalid string. Length must be a multiple of 4";for(g=a.indexOf("="),g=g>0?a.length-g:0,h=[],e=g>0?a.length-4:a.length,b=0,c=0;e>b;b+=4,c+=3)f=d.indexOf(a[b])<<18|d.indexOf(a[b+1])<<12|d.indexOf(a[b+2])<<6|d.indexOf(a[b+3]),h.push((16711680&f)>>16),h.push((65280&f)>>8),h.push(255&f);return 2===g?(f=d.indexOf(a[b])<<2|d.indexOf(a[b+1])>>4,h.push(255&f)):1===g&&(f=d.indexOf(a[b])<<10|d.indexOf(a[b+1])<<4|d.indexOf(a[b+2])>>2,h.push(255&f>>8),h.push(255&f)),h}function c(a){function b(a){return d[63&a>>18]+d[63&a>>12]+d[63&a>>6]+d[63&a]}var c,e,f,g=a.length%3,h="";for(c=0,f=a.length-g;f>c;c+=3)e=(a[c]<<16)+(a[c+1]<<8)+a[c+2],h+=b(e);switch(g){case 1:e=a[a.length-1],h+=d[e>>2],h+=d[63&e<<4],h+="==";break;case 2:e=(a[a.length-2]<<8)+a[a.length-1],h+=d[e>>10],h+=d[63&e>>4],h+=d[63&e<<2],h+="="}return h}var d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";b.exports.toByteArray=a,b.exports.fromByteArray=c}()},{}]},{},[]),b.exports=a("buffer-browserify")},{}],48:[function(a,b){var c=b.exports={};c.nextTick=function(){var a="undefined"!=typeof window&&window.setImmediate,b="undefined"!=typeof window&&window.postMessage&&window.addEventListener;if(a)return function(a){return window.setImmediate(a)};if(b){var c=[];return window.addEventListener("message",function(a){if(a.source===window&&"process-tick"===a.data&&(a.stopPropagation(),c.length>0)){var b=c.shift();b()}},!0),function(a){c.push(a),window.postMessage("process-tick","*")}}return function(a){setTimeout(a,0)}}(),c.title="browser",c.browser=!0,c.env={},c.argv=[],c.binding=function(){throw new Error("process.binding is not supported")},c.cwd=function(){return"/"
-},c.chdir=function(){throw new Error("process.chdir is not supported")}},{}],49:[function(a,b,c){!function(){"use strict";function d(a){var b=function(a){return"string"==typeof a?a:"object"==typeof a?a.hashCode?a.hashCode():""+a:""+a},c=a.declare({instance:{constructor:function(){this.__entries=[],this.__keys=[],this.__values=[]},pushValue:function(a,b){return this.__keys.push(a),this.__values.push(b),this.__entries.push({key:a,value:b}),b},remove:function(a){for(var b,c=null,d=this.__entries,e=this.__keys,f=this.__values,g=d.length-1;g>=0;g--)if((b=d[g])&&b.key===a)return d.splice(g,1),e.splice(g,1),f.splice(g,1),b.value;return c},set:function(a,b){for(var c=null,d=this.__entries,e=this.__values,f=d.length-1;f>=0;f--){var g=d[f];if(g&&a===g.key){e[f]=b,g.value=b,c=b;break}}return c||d.push({key:a,value:b}),c},find:function(a){for(var b,c=null,d=this.__entries,e=d.length-1;e>=0;e--)if(b=d[e],b&&a===b.key){c=b.value;break}return c},getEntrySet:function(){return this.__entries},getKeys:function(){return this.__keys},getValues:function(){return this.__values}}});return a.declare({instance:{constructor:function(){this.__map={}},entrySet:function(){var a=[],b=this.__map;for(var c in b)b.hasOwnProperty(c)&&(a=a.concat(b[c].getEntrySet()));return a},put:function(a,d){var e=b(a),f=null;return(f=this.__map[e])||(f=this.__map[e]=new c),f.pushValue(a,d),d},remove:function(a){var c=b(a),d=null,e=this.__map[c];return e&&(d=e.remove(a)),d},get:function(a){var c,d=b(a),e=null;return(c=this.__map[d])&&(e=c.find(a)),e},set:function(a,d){var e=b(a),f=null,g=null,h=this.__map;return f=(g=h[e])?g.set(a,d):(h[e]=new c).pushValue(a,d)},contains:function(a){var c=b(a),d=!1,e=null;return(e=this.__map[c])&&(d=!!e.find(a)),d},concat:function(a){if(a instanceof this._static){for(var b=new this._static,c=a.entrySet().concat(this.entrySet()),d=c.length-1;d>=0;d--){var e=c[d];b.put(e.key,e.value)}return b}throw new TypeError("When joining hashtables the joining arg must be a HashTable")},filter:function(b,c){var d=this.entrySet(),e=new this._static;d=a.filter(d,b,c);for(var f=d.length-1;f>=0;f--){var g=d[f];e.put(g.key,g.value)}return e},forEach:function(b,c){var d=this.entrySet();a.forEach(d,b,c)},every:function(b,c){var d=this.entrySet();return a.every(d,b,c)},map:function(b,c){var d=this.entrySet();return a.map(d,b,c)},some:function(b,c){var d=this.entrySet();return a.some(d,b,c)},reduce:function(b,c){var d=this.entrySet();return a.reduce(d,b,c)},reduceRight:function(b,c){var d=this.entrySet();return a.reduceRight(d,b,c)},clear:function(){this.__map={}},keys:function(){var a=[],b=this.__map;for(var c in b)a=a.concat(b[c].getKeys());return a},values:function(){var a=[],b=this.__map;for(var c in b)a=a.concat(b[c].getValues());return a},isEmpty:function(){return 0===this.keys().length}}})}"undefined"!=typeof c?"undefined"!=typeof b&&b.exports&&(b.exports=d(a("extended")().register("declare",a("declare.js")).register(a("is-extended")).register(a("array-extended")))):"function"==typeof define?define(["extended","declare","is-extended","array-extended"],function(a,b,c,e){return d(a().register("declare",b).register(c).register(e))}):this.Ht=d(this.extended().register("declare",this.declare).register(this.isExtended).register(this.arrayExtended))}.call(this)},{"array-extended":36,"declare.js":39,extended:40,"is-extended":50}],50:[function(a,b,c){var d=a("__browserify_Buffer").Buffer;!function(){"use strict";function e(a){function b(a,b){var c=-1,d=0,e=a.length,f=[];for(b=b||0,c+=b;++c=0;f--)if(g[f]!==h[f])return!1;for(f=g.length-1;f>=0;f--)if(d=g[f],!e(a[d],b[d]))return!1}catch(i){return!1}return!0}function g(a){return null!==a&&"object"==typeof a}function h(a){var b=g(a);return b&&a.constructor===Object&&!a.nodeType&&!a.setInterval}function i(a){return W(a)?0===a.length:g(a)?0===c(a).length:r(a)||X(a)?0===a.length:!0}function j(a){return a===!0||a===!1||"[object Boolean]"===U.call(a)}function k(a){return"undefined"==typeof a}function l(a){return!k(a)}function m(a){return k(a)||n(a)}function n(a){return null===a}function o(a,b){return V(b)?a instanceof b:!1}function p(a){return"[object RegExp]"===U.call(a)}function q(a){return"[object Date]"===U.call(a)}function r(a){return"[object String]"===U.call(a)}function s(a){return"[object Number]"===U.call(a)}function t(a){return a===!0}function u(a){return a===!1}function v(a){return!n(a)}function w(a,b){return a==b}function x(a,b){return a!=b}function y(a,b){return a===b}function z(a,b){return a!==b}function A(a,b){if(X(b)&&Array.prototype.indexOf||r(b))return b.indexOf(a)>-1;if(X(b))for(var c=0,d=b.length;d>c;c++)if(w(a,b[c]))return!0;return!1}function B(a,b){return!A(a,b)}function C(a,b){return b>a}function D(a,b){return b>=a}function E(a,b){return a>b}function F(a,b){return a>=b}function G(a,b){return r(b)?null!==(""+a).match(b):p(b)?b.test(a):!1}function H(a,b){return!G(a,b)}function I(a,b){return A(b,a)}function J(a,b){return!A(b,a)}function K(a,b,c){return X(a)&&a.length>c?w(a[c],b):!1}function L(a,b,c){return X(a)?!w(a[c],b):!1}function M(a,b){return T.call(a,b)}function N(a,b){return!M(a,b)}function O(a,b){return M(a,"length")?a.length===b:!1}function P(a,b){return M(a,"length")?a.length!==b:!1}function Q(a){Z[a]=function(){this._testers.push(Y[a])}}function R(a){$[a]=function(){var c,d=b(arguments,1),e=Y[a],f=!0;if(d.length<=e.length-1)throw new TypeError("A handler must be defined when calling using switch");if(c=d.pop(),j(c)&&(f=c,c=d.pop()),!V(c))throw new TypeError("handler must be defined");this._cases.push(function(a){return e.apply(Y,a.concat(d))?[f,c.apply(this,a)]:[!1]})}}var S=Array.prototype.slice,T=Object.prototype.hasOwnProperty,U=Object.prototype.toString,V=function(a){return"[object Function]"===U.call(a)};"undefined"==typeof window||V(window.alert)||function(a){V=function(b){return"[object Function]"===U.call(b)||b===a}}(window.alert);var W=function(a){return"[object Arguments]"===U.call(a)};W(arguments)||(W=function(a){return!(!a||!T.call(a,"callee"))});var X=Array.isArray||function(a){return"[object Array]"===U.call(a)},Y={isFunction:V,isObject:g,isEmpty:i,isHash:h,isNumber:s,isString:r,isDate:q,isArray:X,isBoolean:j,isUndefined:k,isDefined:l,isUndefinedOrNull:m,isNull:n,isArguments:W,instanceOf:o,isRegExp:p,deepEqual:e,isTrue:t,isFalse:u,isNotNull:v,isEq:w,isNeq:x,isSeq:y,isSneq:z,isIn:A,isNotIn:B,isLt:C,isLte:D,isGt:E,isGte:F,isLike:G,isNotLike:H,contains:I,notContains:J,has:M,notHas:N,isLength:O,isNotLength:P,containsAt:K,notContainsAt:L},Z={constructor:function(){this._testers=[]},noWrap:{tester:function(){var a=this._testers;return function(b){for(var c=!1,d=0,e=a.length;e>d&&!c;d++)c=a[d](b);return c}}}},$={constructor:function(){this._cases=[],this.__default=null},def:function(a,b){this.__default=b},noWrap:{switcher:function(){var a=this._cases,c=this.__default;return function(){for(var d,e=!1,f=b(arguments),g=0,h=a.length;h>g&&!e;g++)if(d=a[g](f),d.length>1&&(d[1]||d[0]))return d[1];return!e&&c?c.apply(this,f):void 0}}}};for(var _ in Y)T.call(Y,_)&&(R(_),Q(_));var ab=a.define(Y).expose(Y);return ab.tester=a.define(Z),ab.switcher=a.define($),ab}"undefined"!=typeof c?"undefined"!=typeof b&&b.exports&&(b.exports=e(a("extended"))):"function"==typeof define&&define.amd?define(["extended"],function(a){return e(a)}):this.isExtended=e(this.extended)}.call(this)},{__browserify_Buffer:47,extended:40}],51:[function(a,b,c){!function(){"use strict";function d(a){function b(a,b){var c=0;return a>b?1:b>a?-1:b?c:1}var c=a.multiply,d=a.declare({instance:{__printNode:function(b,d){var e=[];a.isUndefinedOrNull(b)?(e.push(c(" ",d)),e.push("~"),console.log(e.join(""))):(this.__printNode(b.right,d+1),e.push(c(" ",d)),e.push(b.data+"\n"),console.log(e.join("")),this.__printNode(b.left,d+1))},constructor:function(a){a=a||{},this.compare=a.compare||b,this.__root=null},insert:function(){throw new Error("Not Implemented")},remove:function(){throw new Error("Not Implemented")},clear:function(){this.__root=null},isEmpty:function(){return!this.__root},traverseWithCondition:function(a,b,c){var e=!0;return a&&(b=b||d.PRE_ORDER,b===d.PRE_ORDER?(e=c(a.data),e&&(e=this.traverseWithCondition(a.left,b,c),e&&(e=this.traverseWithCondition(a.right,b,c)))):b===d.IN_ORDER?(e=this.traverseWithCondition(a.left,b,c),e&&(e=c(a.data),e&&(e=this.traverseWithCondition(a.right,b,c)))):b===d.POST_ORDER?(e=this.traverseWithCondition(a.left,b,c),e&&(e&&(e=this.traverseWithCondition(a.right,b,c)),e&&(e=c(a.data)))):b===d.REVERSE_ORDER&&(e=this.traverseWithCondition(a.right,b,c),e&&(e=c(a.data),e&&(e=this.traverseWithCondition(a.left,b,c))))),e},traverse:function(a,b,c){a&&(b=b||d.PRE_ORDER,b===d.PRE_ORDER?(c(a.data),this.traverse(a.left,b,c),this.traverse(a.right,b,c)):b===d.IN_ORDER?(this.traverse(a.left,b,c),c(a.data),this.traverse(a.right,b,c)):b===d.POST_ORDER?(this.traverse(a.left,b,c),this.traverse(a.right,b,c),c(a.data)):b===d.REVERSE_ORDER&&(this.traverse(a.right,b,c),c(a.data),this.traverse(a.left,b,c)))},forEach:function(a,b,c){if("function"!=typeof a)throw new TypeError;c=c||d.IN_ORDER,b=b||this,this.traverse(this.__root,c,function(c){a.call(b,c,this)})},map:function(a,b,c){if("function"!=typeof a)throw new TypeError;c=c||d.IN_ORDER,b=b||this;var e=new this._static;return this.traverse(this.__root,c,function(c){e.insert(a.call(b,c,this))}),e},filter:function(a,b,c){if("function"!=typeof a)throw new TypeError;c=c||d.IN_ORDER,b=b||this;var e=new this._static;return this.traverse(this.__root,c,function(c){a.call(b,c,this)&&e.insert(c)}),e},reduce:function(b,c,d){var e=this.toArray(d),f=[e,b];return a.isUndefinedOrNull(c)||f.push(c),a.reduce.apply(a,f)},reduceRight:function(b,c,d){var e=this.toArray(d),f=[e,b];return a.isUndefinedOrNull(c)||f.push(c),a.reduceRight.apply(a,f)},every:function(a,b,c){if("function"!=typeof a)throw new TypeError;c=c||d.IN_ORDER,b=b||this;var e=!1;return this.traverseWithCondition(this.__root,c,function(c){return e=a.call(b,c,this)}),e},some:function(a,b,c){if("function"!=typeof a)throw new TypeError;c=c||d.IN_ORDER,b=b||this;var e;return this.traverseWithCondition(this.__root,c,function(c){return e=a.call(b,c,this),!e}),e},toArray:function(a){a=a||d.IN_ORDER;var b=[];return this.traverse(this.__root,a,function(a){b.push(a)}),b},contains:function(a){for(var b=!1,c=this.__root;null!==c;){var d=this.compare(a,c.data);d?c=c[-1===d?"left":"right"]:(b=!0,c=null)}return b},find:function(a){for(var b,c=this.__root;c;){var d=this.compare(a,c.data);if(!d){b=c.data;break}c=c[-1===d?"left":"right"]}return b},findLessThan:function(a,b){var c=[],e=this.compare;return this.traverseWithCondition(this.__root,d.IN_ORDER,function(d){var f=e(a,d);return!b&&0===f||1===f?(c.push(d),!0):!1}),c},findGreaterThan:function(a,b){var c=[],e=this.compare;return this.traverse(this.__root,d.REVERSE_ORDER,function(d){var f=e(a,d);return!b&&0===f||-1===f?(c.push(d),!0):!1}),c},print:function(){this.__printNode(this.__root,0)}},"static":{PRE_ORDER:"pre_order",IN_ORDER:"in_order",POST_ORDER:"post_order",REVERSE_ORDER:"reverse_order"}}),e=function(){var a=Math.abs,b=function(a){return{data:a,balance:0,left:null,right:null}},e=function(a,b,c){var d=a[c];return a[c]=d[b],d[b]=a,d},f=function(a,b,c){return a[c]=e(a[c],c,b),e(a,b,c)},g=function(a,b,c){var d="left"===b?"right":"left",e=a[b],f=e[d];0===f.balance?a.balance=e.balance=0:f.balance===c?(a.balance=-c,e.balance=0):(a.balance=0,e.balance=c),f.balance=0},h=function(a,b){var c="left"===b?"right":"left",d=a[b],h="left"===b?-1:1;return d.balance===h?(a.balance=d.balance=0,a=e(a,c,b)):(g(a,b,h),a=f(a,c,b)),a},i=function(a,b,c){var d="left"===b?"right":"left",h=a[d],i="left"===b?-1:1;return h.balance===-i?(a.balance=h.balance=0,a=e(a,b,d)):h.balance===i?(g(a,d,-i),a=f(a,b,d)):(a.balance=-i,h.balance=i,a=e(a,b,d),c.done=!0),a},j=function(c,d,e,f){if(null===c||void 0===c)c=b(d);else{var g=-1===f(d,c.data)?"left":"right";c[g]=j(c[g],d,e,f),e.done||(c.balance+="left"===g?-1:1,0===c.balance?e.done=!0:a(c.balance)>1&&(c=h(c,g),e.done=!0))}return c},k=function(b,c,d,e){var f,g,h,j;if(b){if(g=e(c,b.data),0===g){var l=b.left,m=b.right;if(!l||!m)return f=l?"left":"right",h=b[f];for(var n=l;null!==(m=n.right);)n=m;b.data=n.data,c=n.data}if(f=-1===e(b.data,c)?"right":"left",b[f]=k(b[f],c,d,e),!d.done){j=b.balance+="left"===f?1:-1;var o=a(j);1===o?d.done=!0:o>1&&(b=i(b,f,d))}}return b};return d.extend({instance:{insert:function(a){var b={done:!1};this.__root=j(this.__root,a,b,this.compare)},remove:function(a){this.__root=k(this.__root,a,{done:!1},this.compare)},__printNode:function(a,b){var d=[];a?(this.__printNode(a.right,b+1),d.push(c(" ",b)),d.push(a.data+":"+a.balance+"\n"),console.log(d.join("")),this.__printNode(a.left,b+1)):(d.push(c(" ",b)),d.push("~"),console.log(d.join("")))}}})}(),f=function(){function a(a,b){return{data:a,level:b,left:g,right:g}}function b(a){if(0!==a.level&&a.left.level===a.level){var b=a.left;a.left=b.right,b.right=a,a=b}return a}function e(a){if(0!==a.level&&a.right.right.level===a.level){var b=a.right;a.right=b.left,b.left=a,a=b,a.level++}return a}function f(c,d,h){if(c===g)c=a(d,1);else{var i=-1===h(d,c.data)?"left":"right";c[i]=f(c[i],d,h),c=b(c),c=e(c)}return c}var g={level:0,data:null},h=function(a,c,d){var f,i;if(a!==g){var j=d(c,a.data);if(0===j)if(f=a.left,i=a.right,f!==g&&i!==g){for(var k=f;k.right!==g;)k=k.right;a.data=k.data,a.left=h(f,k.data,d)}else a=a[f===g?"right":"left"];else{var l=-1===j?"left":"right";a[l]=h(a[l],c,d)}}if(a!==g){var m=a.level,n=a.left.level,o=a.right.level;(m-1>n||m-1>o)&&(o>--a.level&&(a.right.level=a.level),a=b(a),a=e(a))}return a};return d.extend({instance:{isEmpty:function(){return this.__root===g||this._super(arguments)},insert:function(a){this.__root||(this.__root=g),this.__root=f(this.__root,a,this.compare)},remove:function(a){this.__root=h(this.__root,a,this.compare)},traverseWithCondition:function(a){var b=!0;return a!==g?this._super(arguments):b},traverse:function(a){a!==g&&this._super(arguments)},contains:function(){return this.__root!==g?this._super(arguments):!1},__printNode:function(a,b){var d=[];a&&a.data?(this.__printNode(a.right,b+1),d.push(c(" ",b)),d.push(a.data+":"+a.level+"\n"),console.log(d.join("")),this.__printNode(a.left,b+1)):(d.push(c(" ",b)),d.push("~"),console.log(d.join("")))}}})}(),g=d.extend({instance:{insert:function(a){if(!this.__root)return this.__root={data:a,parent:null,left:null,right:null};for(var b=this.compare,c=this.__root;null!==c;){var d=b(a,c.data);if(!d)return;var e=-1===d?"left":"right",f=c[e];if(!f)return c[e]={data:a,parent:c,left:null,right:null};c=f}},remove:function(a){if(null!==this.__root){for(var b,c={right:this.__root},d=c,e=null,f="right";null!==d[f];){b=d,d=d[f];var g=this.compare(a,d.data);g||(e=d),f=-1===g?"left":"right"}null!==e&&(e.data=d.data,b[b.right===d?"right":"left"]=d[null===d.left?"right":"left"]),this.__root=c.right}}}}),h=function(){var a="RED",b="BLACK",e=function(a){return null!==a&&a.red},f=function(a){return{data:a,red:!0,left:null,right:null}},g=function(a,b,c){if(!a)return f(b);var d=c(b,a.data);if(d){var j=-1===d?"left":"right",k="left"===j?"right":"left";a[j]=g(a[j],b,c);var l=a[j];if(e(l)){var m=a[k];e(m)?(a.red=!0,l.red=!1,m.red=!1):e(l[j])?a=h(a,k):e(l[k])&&(a=i(a,k))}}return a},h=function(a,b){var c="left"===b?"right":"left",d=a[c];return a[c]=d[b],d[b]=a,a.red=!0,d.red=!1,d},i=function(a,b){var c="left"===b?"right":"left";return a[c]=h(a[c],c),h(a,b)},j=function(a,b,c,d){if(a){var f;if(0===d(b,a.data)){if(!a.left||!a.right){var g=a[a.left?"left":"right"];return e(a)?c.done=!0:e(g)&&(g.red=!1,c.done=!0),g}for(var h,i=a.right;null!==i.left;)h=i,i=i.left;h&&(h.left=null),a.data=i.data,b=i.data}f=-1===d(b,a.data)?"left":"right",a[f]=j(a[f],b,c,d),c.done||(a=k(a,f,c))}else c.done=!0;return a},k=function(a,b,c){var d="left"===b?"right":"left",f=a,g=f[d];if(e(g)&&(a=h(a,b),g=f[d]),null!==g)if(e(g.left)||e(g.right)){var j=f.red,k=a===f;f=(e(g[d])?h:i)(f,b),f.red=j,f.left.red=f.right.red=0,k?a=f:a[b]=f,c.done=!0}else e(f)&&(c.done=!0),f.red=0,g.red=1;return a};return d.extend({instance:{insert:function(a){this.__root=g(this.__root,a,this.compare),this.__root.red=!1},remove:function(a){var b={done:!1},c=j(this.__root,a,b,this.compare);return null!==c&&(c.red=0),this.__root=c,a},__printNode:function(d,e){var f=[];d?(this.__printNode(d.right,e+1),f.push(c(" ",e)),f.push((d.red?a:b)+":"+d.data+"\n"),console.log(f.join("")),this.__printNode(d.left,e+1)):(f.push(c(" ",e)),f.push("~"),console.log(f.join("")))}}})}();return{Tree:d,AVLTree:e,AnderssonTree:f,BinaryTree:g,RedBlackTree:h,IN_ORDER:d.IN_ORDER,PRE_ORDER:d.PRE_ORDER,POST_ORDER:d.POST_ORDER,REVERSE_ORDER:d.REVERSE_ORDER}}"undefined"!=typeof c?"undefined"!=typeof b&&b.exports&&(b.exports=d(a("extended")().register("declare",a("declare.js")).register(a("is-extended")).register(a("array-extended")).register(a("string-extended")))):"function"==typeof define?define(["extended","declare.js","is-extended","array-extended","string-extended"],function(a,b,c,e,f){return d(a().register("declare",b).register(c).register(e).register(f))}):this.leafy=d(this.extended().register("declare",this.declare).register(this.isExtended).register(this.arrayExtended).register(this.stringExtended))}.call(this)},{"array-extended":36,"declare.js":39,extended:40,"is-extended":50,"string-extended":54}],52:[function(a,b,c){!function(){"use strict";function d(a,b,c){function d(a,b){var c,d;for(c in b)t.call(b,c)&&(d=b[c],c in a&&a[c]===d||(a[c]=d));return a}function e(a,b){var c,d,f;for(c in b)t.call(b,c)&&(d=b[c],f=a[c],p(f,d)||(a[c]=r(f)&&r(d)?e(f,d):r(d)?e({},d):d));return a}function f(a){a||(a={});for(var b=1,c=arguments.length;c>b;b++)d(a,arguments[b]);return a}function g(a){a||(a={});for(var b=1,c=arguments.length;c>b;b++)e(a,arguments[b]);return a}function h(a,b){var c=a.prototype||a;return f(c,b),a}function i(a,b,c){if(!r(a)||!u(b))throw new TypeError;for(var d,e=l(a),f=0,g=e.length;g>f;++f)d=e[f],b.call(c||a,a[d],d,a);return a}function j(a,b,c){if(!r(a)||!u(b))throw new TypeError;for(var d,e,f=l(a),g={},h=0,i=f.length;i>h;++h)d=f[h],e=a[d],b.call(c||a,e,d,a)&&(g[d]=e);return g}function k(a){if(!r(a))throw new TypeError;for(var b=l(a),c=[],d=0,e=b.length;e>d;++d)c.push(a[b[d]]);return c}function l(a){if(!r(a))throw new TypeError;var b=[];for(var c in a)t.call(a,c)&&b.push(c);return b}function m(a){if(!r(a))throw new TypeError;for(var b,c=l(a),d={},e=0,f=c.length;f>e;++e)b=c[e],d[a[b]]=b;return d}function n(a){if(!r(a))throw new TypeError;for(var b,c=l(a),d=[],e=0,f=c.length;f>e;++e)b=c[e],d.push([b,a[b]]);return d}function o(a,b){if(!r(a))throw new TypeError;q(b)&&(b=[b]);for(var c,d=s(l(a),b),e={},f=0,g=d.length;g>f;++f)c=d[f],e[c]=a[c];return e}var p=b.deepEqual,q=b.isString,r=b.isHash,s=c.difference,t=Object.prototype.hasOwnProperty,u=b.isFunction,v={forEach:i,filter:j,invert:m,values:k,toArray:n,keys:l,omit:o},w={extend:h,merge:f,deepMerge:g,omit:o},x=a.define(b.isObject,w).define(r,v).define(b.isFunction,{extend:h}).expose({hash:v}).expose(w),y=x.extend;return x.extend=function(){return 1===arguments.length?y.extend.apply(x,arguments):(h.apply(null,arguments),void 0)},x}"undefined"!=typeof c?"undefined"!=typeof b&&b.exports&&(b.exports=d(a("extended"),a("is-extended"),a("array-extended"))):"function"==typeof define&&define.amd?define(["extended","is-extended","array-extended"],function(a,b,c){return d(a,b,c)}):this.objectExtended=d(this.extended,this.isExtended,this.arrayExtended)}.call(this)},{"array-extended":36,extended:40,"is-extended":50}],53:[function(a,b,c){var d=a("__browserify_process");!function(){"use strict";function e(a,b,c,e,f,g){function h(a,b){return function(){try{l(a.apply(null,arguments)).addCallback(b).addErrback(b)}catch(c){b.errback(c)}}}function i(a,b,c){var d=(new G).callback();return v(a,function(a){d=d.then(c?a:B(null,a)),c||(d=d.then(function(a){return b.push(a),b}))}),d}function j(a){return!w(a)&&y(a.then)}function k(a){var b=new G;return a.then(A(b,"callback"),A(b,"errback")),b.promise()}function l(a){var b;return a=C(arguments),a.length?1===a.length?(a=a.pop(),j(a)?a.addCallback&&a.addErrback?(b=new G,a.addCallback(b.callback),a.addErrback(b.errback)):b=k(a):b=x(a)&&c.every(a,j)?new H(a,!0).promise():(new G).callback(a)):b=new H(c.map(a,function(a){return l(a)}),!0).promise():b=(new G).callback(a).promise(),b}function m(a,b){return function(){var c=new G,d=C(arguments);return d.push(c.resolve),a.apply(b||this,d),c.promise()}}function n(a){if(x(a))return i(a,[],!1);throw new Error("When calling promise.serial the first argument must be an array")}function o(a){if(x(a))return i(a,[],!0);throw new Error("When calling promise.serial the first argument must be an array")}function p(a,b){a=C(arguments);var c=!1;b=a.pop();var d=l(a);return function(){return c?l(b.apply(this,arguments)):(a=arguments,d.then(A(this,function(){return c=!0,b.apply(this,a)})))}}function q(){return new G}function r(a){return new H(a,!0).promise()}function s(a){return q().errback(a)}function t(a){return q().callback(a)}var u,v=c.forEach,w=e.isUndefinedOrNull,x=e.isArray,y=e.isFunction,z=e.isBoolean,A=f.bind,B=f.bindIgnore,C=g.argsToArray;if("function"==typeof setImmediate)u="undefined"!=typeof window?setImmediate.bind(window):setImmediate;else if("undefined"!=typeof d)u=function(a){d.nextTick(a)};else if("undefined"!=typeof MessageChannel){var D=new MessageChannel,E={},F=E;D.port1.onmessage=function(){E=E.next;var a=E.task;delete E.task,a()},u=function(a){F=F.next={task:a},D.port2.postMessage(0)}}else u=function(a){setTimeout(a,0)};var G=a({instance:{__fired:!1,__results:null,__error:null,__errorCbs:null,__cbs:null,constructor:function(){this.__errorCbs=[],this.__cbs=[],f.bindAll(this,["callback","errback","resolve","classic","__resolve","addCallback","addErrback"])},__resolve:function(){if(!this.__fired){this.__fired=!0;var a,b=this.__error?this.__errorCbs:this.__cbs,c=b.length,d=this.__error||this.__results;for(a=0;c>a;a++)this.__callNextTick(b[a],d)}},__callNextTick:function(a,b){u(function(){a.apply(this,b)})},addCallback:function(a){return a&&(j(a)&&a.callback&&(a=a.callback),this.__fired&&this.__results?this.__callNextTick(a,this.__results):this.__cbs.push(a)),this},addErrback:function(a){return a&&(j(a)&&a.errback&&(a=a.errback),this.__fired&&this.__error?this.__callNextTick(a,this.__error):this.__errorCbs.push(a)),this},callback:function(){return this.__fired||(this.__results=arguments,this.__resolve()),this.promise()},errback:function(){return this.__fired||(this.__error=arguments,this.__resolve()),this.promise()},resolve:function(a){return a?this.errback(a):this.callback.apply(this,C(arguments,1)),this},classic:function(a){return"function"==typeof a&&(this.addErrback(function(b){a(b)}),this.addCallback(function(){a.apply(this,[null].concat(C(arguments)))})),this},then:function(a,b){var c=new G,d=c;return y(b)&&(d=h(b,c)),this.addErrback(d),y(a)?this.addCallback(h(a,c)):this.addCallback(c),c.promise()},both:function(a){return this.then(a,a)},promise:function(){var a={then:A(this,"then"),both:A(this,"both"),promise:function(){return a}};return v(["addCallback","addErrback","classic"],function(b){a[b]=A(this,function(){return this[b].apply(this,arguments),a})},this),a}}}),H=G.extend({instance:{__results:null,__errors:null,__promiseLength:0,__defLength:0,__firedLength:0,normalizeResults:!1,constructor:function(a,b){this.__errors=[],this.__results=[],this.normalizeResults=z(b)?b:!1,this._super(arguments),a&&a.length?(this.__defLength=a.length,v(a,this.__addPromise,this)):this.__resolve()},__addPromise:function(a,b){a.then(A(this,function(){var a=C(arguments);a.unshift(b),this.callback.apply(this,a)}),A(this,function(){var a=C(arguments);a.unshift(b),this.errback.apply(this,a)}))},__resolve:function(){if(!this.__fired){this.__fired=!0;var a,b=this.__errors.length?this.__errorCbs:this.__cbs,c=b.length,d=this.__errors.length?this.__errors:this.__results;for(a=0;c>a;a++)this.__callNextTick(b[a],d)}},__callNextTick:function(a,b){u(function(){a.apply(null,[b])})},addCallback:function(a){return a&&(j(a)&&a.callback&&(a=A(a,"callback")),this.__fired&&!this.__errors.length?this.__callNextTick(a,this.__results):this.__cbs.push(a)),this},addErrback:function(a){return a&&(j(a)&&a.errback&&(a=A(a,"errback")),this.__fired&&this.__errors.length?this.__callNextTick(a,this.__errors):this.__errorCbs.push(a)),this},callback:function(a){if(this.__fired)throw new Error("Already fired!");var b=C(arguments);return this.normalizeResults&&(b=b.slice(1),b=1===b.length?b.pop():b),this.__results[a]=b,this.__firedLength++,this.__firedLength===this.__defLength&&this.__resolve(),this.promise()},errback:function(a){if(this.__fired)throw new Error("Already fired!");var b=C(arguments);return this.normalizeResults&&(b=b.slice(1),b=1===b.length?b.pop():b),this.__errors[a]=b,this.__firedLength++,this.__firedLength===this.__defLength&&this.__resolve(),this.promise()}}});return b.define({isPromiseLike:j}).expose({isPromiseLike:j,when:l,wrap:m,wait:p,serial:n,chain:o,Promise:G,PromiseList:H,promise:q,defer:q,deferredList:r,reject:s,resolve:t})}"undefined"!=typeof c?"undefined"!=typeof b&&b.exports&&(b.exports=e(a("declare.js"),a("extended"),a("array-extended"),a("is-extended"),a("function-extended"),a("arguments-extended"))):"function"==typeof define&&define.amd?define(["declare","extended","array-extended","is-extended","function-extended","arguments-extended"],function(a,b,c,d,f,g){return e(a,b,c,d,f,g)}):this.promiseExtended=e(this.declare,this.extended,this.arrayExtended,this.isExtended,this.functionExtended,this.argumentsExtended)}.call(this)},{__browserify_process:48,"arguments-extended":35,"array-extended":36,"declare.js":39,extended:40,"function-extended":43,"is-extended":50}],54:[function(a,b,c){!function(){"use strict";function d(a,b,c,d){function e(a,b){var c=a;if(x.test(b)){var d=b.match(x),e=d[1],f=d[3],g=d[4];g&&(g=parseInt(g,10),c=c.length0?"+":"")+d),k&&(k=parseInt(k,10),d=d.lengthe;)d?a+=c:a=c+a,e++;return a}function i(a,c,d){var e=a;if(b.isString(e)){if(a.length>c)if(d){var f=a.length;e=a.substring(f-c,f)}else e=a.substring(0,c)}else e=i(""+e,c);return e}function j(a,d){if(d instanceof Array){var h=0,i=d.length;return a.replace(v,function(a,b,j){var k,l;if(!(i>h))return a;if(k=d[h++],"%s"===a||"%d"===a||"%D"===a)l=k+"";else if("%Z"===a)l=k.toUTCString();else if("%j"===a)try{l=s(k)}catch(m){throw new Error("stringExtended.format : Unable to parse json from ",k)}else switch(b=b.replace(/^\[|\]$/g,""),j){case"s":l=e(k,b);break;case"d":l=f(k,b);break;case"j":l=g(k,b);break;case"D":l=c.format(k,b);break;case"Z":l=c.format(k,b,!0)}return l})}if(t(d))return a.replace(w,function(a,h,i){if(i=d[i],!b.isUndefined(i)){if(!h)return""+i;if(b.isString(i))return e(i,h);if(b.isNumber(i))return f(i,h);if(b.isDate(i))return c.format(i,h);if(b.isObject(i))return g(i,h)}return a});var k=u.call(arguments).slice(1);return j(a,k)}function k(a,b){var c=[];return a&&(a.indexOf(b)>0?c=a.replace(/\s+/g,"").split(b):c.push(a)),c}function l(a,b){var c=[];if(b)for(var d=0;b>d;d++)c.push(a);return c.join("")}function m(a,c){var d,e,f;if(c)if(b.isArray(a))for(d=[],e=0,f=a.length;f>e;e++)d.push(m(a[e],c));else if(c instanceof Array)for(d=a,e=0,f=c.length;f>e;e++)d=m(d,c[e]);else c in z&&(d="["+z[c]+"m"+a+"[0m");return d}function n(a,b){return a.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g,function(a){return b&&-1!==d.indexOf(b,a)?a:"\\"+a})}function o(a){return a.replace(/^\s*|\s*$/g,"")}function p(a){return a.replace(/^\s*/,"")}function q(a){return a.replace(/\s*$/,"")}function r(a){return 0===a.length}var s;"undefined"==typeof JSON?function(){function a(a){return 10>a?"0"+a:a}function c(c){return b.isDate(c)?isFinite(c.valueOf())?c.getUTCFullYear()+"-"+a(c.getUTCMonth()+1)+"-"+a(c.getUTCDate())+"T"+a(c.getUTCHours())+":"+a(c.getUTCMinutes())+":"+a(c.getUTCSeconds())+"Z":null:i(c)?c.valueOf():c}function d(a){return j.lastIndex=0,j.test(a)?'"'+a.replace(j,function(a){var b=k[a];return"string"==typeof b?b:"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+a+'"'}function e(a,b){var i,j,k,l,m,n=f,o=b[a];switch(o&&(o=c(o)),"function"==typeof h&&(o=h.call(b,a,o)),typeof o){case"string":return d(o);case"number":return isFinite(o)?String(o):"null";case"boolean":case"null":return String(o);case"object":if(!o)return"null";if(f+=g,m=[],"[object Array]"===Object.prototype.toString.apply(o)){for(l=o.length,i=0;l>i;i+=1)m[i]=e(i,o)||"null";return k=0===m.length?"[]":f?"[\n"+f+m.join(",\n"+f)+"\n"+n+"]":"["+m.join(",")+"]",f=n,k}if(h&&"object"==typeof h)for(l=h.length,i=0;l>i;i+=1)"string"==typeof h[i]&&(j=h[i],k=e(j,o),k&&m.push(d(j)+(f?": ":":")+k));else for(j in o)Object.prototype.hasOwnProperty.call(o,j)&&(k=e(j,o),k&&m.push(d(j)+(f?": ":":")+k));return k=0===m.length?"{}":f?"{\n"+f+m.join(",\n"+f)+"\n"+n+"}":"{"+m.join(",")+"}",f=n,k}}var f,g,h,i=b.tester().isString().isNumber().isBoolean().tester(),j=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,k={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"};s=function(a,b,c){var d;if(f="",g="","number"==typeof c)for(d=0;c>d;d+=1)g+=" ";else"string"==typeof c&&(g=c);if(h=b,b&&"function"!=typeof b&&("object"!=typeof b||"number"!=typeof b.length))throw new Error("JSON.stringify");return e("",{"":a})}}():s=JSON.stringify;var t=b.isHash,u=Array.prototype.slice,v=/%((?:-?\+?.?\d*)?|(?:\[[^\[|\]]*\]))?([sjdDZ])/g,w=/\{(?:\[([^\[|\]]*)\])?(\w+)\}/g,x=/(-?)(\+?)([A-Z|a-z|\W]?)([1-9][0-9]*)?$/,y=/([1-9][0-9]*)$/g,z={bold:1,bright:1,italic:3,underline:4,blink:5,inverse:7,crossedOut:9,red:31,green:32,yellow:33,blue:34,magenta:35,cyan:36,white:37,redBackground:41,greenBackground:42,yellowBackground:43,blueBackground:44,magentaBackground:45,cyanBackground:46,whiteBackground:47,encircled:52,overlined:53,grey:90,black:90},A={SMILEY:"☺",SOLID_SMILEY:"☻",HEART:"♥",DIAMOND:"♦",CLOVE:"♣",SPADE:"♠",DOT:"•",SQUARE_CIRCLE:"◘",CIRCLE:"○",FILLED_SQUARE_CIRCLE:"◙",MALE:"♂",FEMALE:"♀",EIGHT_NOTE:"♪",DOUBLE_EIGHTH_NOTE:"♫",SUN:"☼",PLAY:"►",REWIND:"◄",UP_DOWN:"↕",PILCROW:"¶",SECTION:"§",THICK_MINUS:"▬",SMALL_UP_DOWN:"↨",UP_ARROW:"↑",DOWN_ARROW:"↓",RIGHT_ARROW:"→",LEFT_ARROW:"←",RIGHT_ANGLE:"∟",LEFT_RIGHT_ARROW:"↔",TRIANGLE:"▲",DOWN_TRIANGLE:"▼",HOUSE:"⌂",C_CEDILLA:"Ç",U_UMLAUT:"ü",E_ACCENT:"é",A_LOWER_CIRCUMFLEX:"â",A_LOWER_UMLAUT:"ä",A_LOWER_GRAVE_ACCENT:"à",A_LOWER_CIRCLE_OVER:"å",C_LOWER_CIRCUMFLEX:"ç",E_LOWER_CIRCUMFLEX:"ê",E_LOWER_UMLAUT:"ë",E_LOWER_GRAVE_ACCENT:"è",I_LOWER_UMLAUT:"ï",I_LOWER_CIRCUMFLEX:"î",I_LOWER_GRAVE_ACCENT:"ì",A_UPPER_UMLAUT:"Ä",A_UPPER_CIRCLE:"Å",E_UPPER_ACCENT:"É",A_E_LOWER:"æ",A_E_UPPER:"Æ",O_LOWER_CIRCUMFLEX:"ô",O_LOWER_UMLAUT:"ö",O_LOWER_GRAVE_ACCENT:"ò",U_LOWER_CIRCUMFLEX:"û",U_LOWER_GRAVE_ACCENT:"ù",Y_LOWER_UMLAUT:"ÿ",O_UPPER_UMLAUT:"Ö",U_UPPER_UMLAUT:"Ü",CENTS:"¢",POUND:"£",YEN:"¥",CURRENCY:"¤",PTS:"₧",FUNCTION:"ƒ",A_LOWER_ACCENT:"á",I_LOWER_ACCENT:"í",O_LOWER_ACCENT:"ó",U_LOWER_ACCENT:"ú",N_LOWER_TILDE:"ñ",N_UPPER_TILDE:"Ñ",A_SUPER:"ª",O_SUPER:"º",UPSIDEDOWN_QUESTION:"¿",SIDEWAYS_L:"⌐",NEGATION:"¬",ONE_HALF:"½",ONE_FOURTH:"¼",UPSIDEDOWN_EXCLAMATION:"¡",DOUBLE_LEFT:"«",DOUBLE_RIGHT:"»",LIGHT_SHADED_BOX:"░",MEDIUM_SHADED_BOX:"▒",DARK_SHADED_BOX:"▓",VERTICAL_LINE:"│",MAZE__SINGLE_RIGHT_T:"┤",MAZE_SINGLE_RIGHT_TOP:"┐",MAZE_SINGLE_RIGHT_BOTTOM_SMALL:"┘",MAZE_SINGLE_LEFT_TOP_SMALL:"┌",MAZE_SINGLE_LEFT_BOTTOM_SMALL:"└",MAZE_SINGLE_LEFT_T:"├",MAZE_SINGLE_BOTTOM_T:"┴",MAZE_SINGLE_TOP_T:"┬",MAZE_SINGLE_CENTER:"┼",MAZE_SINGLE_HORIZONTAL_LINE:"─",MAZE_SINGLE_RIGHT_DOUBLECENTER_T:"╡",MAZE_SINGLE_RIGHT_DOUBLE_BL:"╛",MAZE_SINGLE_RIGHT_DOUBLE_T:"╢",MAZE_SINGLE_RIGHT_DOUBLEBOTTOM_TOP:"╖",MAZE_SINGLE_RIGHT_DOUBLELEFT_TOP:"╕",MAZE_SINGLE_LEFT_DOUBLE_T:"╞",MAZE_SINGLE_BOTTOM_DOUBLE_T:"╧",MAZE_SINGLE_TOP_DOUBLE_T:"╤",MAZE_SINGLE_TOP_DOUBLECENTER_T:"╥",MAZE_SINGLE_BOTTOM_DOUBLECENTER_T:"╨",MAZE_SINGLE_LEFT_DOUBLERIGHT_BOTTOM:"╘",MAZE_SINGLE_LEFT_DOUBLERIGHT_TOP:"╒",MAZE_SINGLE_LEFT_DOUBLEBOTTOM_TOP:"╓",MAZE_SINGLE_LEFT_DOUBLETOP_BOTTOM:"╙",MAZE_SINGLE_LEFT_TOP:"Γ",MAZE_SINGLE_RIGHT_BOTTOM:"╜",MAZE_SINGLE_LEFT_CENTER:"╟",MAZE_SINGLE_DOUBLECENTER_CENTER:"╫",MAZE_SINGLE_DOUBLECROSS_CENTER:"╪",MAZE_DOUBLE_LEFT_CENTER:"╣",MAZE_DOUBLE_VERTICAL:"║",MAZE_DOUBLE_RIGHT_TOP:"╗",MAZE_DOUBLE_RIGHT_BOTTOM:"╝",MAZE_DOUBLE_LEFT_BOTTOM:"╚",MAZE_DOUBLE_LEFT_TOP:"╔",MAZE_DOUBLE_BOTTOM_T:"╩",MAZE_DOUBLE_TOP_T:"╦",MAZE_DOUBLE_LEFT_T:"╠",MAZE_DOUBLE_HORIZONTAL:"═",MAZE_DOUBLE_CROSS:"╬",SOLID_RECTANGLE:"█",THICK_LEFT_VERTICAL:"▌",THICK_RIGHT_VERTICAL:"▐",SOLID_SMALL_RECTANGLE_BOTTOM:"▄",SOLID_SMALL_RECTANGLE_TOP:"▀",PHI_UPPER:"Φ",INFINITY:"∞",INTERSECTION:"∩",DEFINITION:"≡",PLUS_MINUS:"±",GT_EQ:"≥",LT_EQ:"≤",THEREFORE:"⌠",SINCE:"∵",DOESNOT_EXIST:"∄",EXISTS:"∃",FOR_ALL:"∀",EXCLUSIVE_OR:"⊕",BECAUSE:"⌡",DIVIDE:"÷",APPROX:"≈",DEGREE:"°",BOLD_DOT:"∙",DOT_SMALL:"·",CHECK:"√",ITALIC_X:"✗",SUPER_N:"ⁿ",SQUARED:"²",CUBED:"³",SOLID_BOX:"■",PERMILE:"‰",REGISTERED_TM:"®",COPYRIGHT:"©",TRADEMARK:"™",BETA:"β",GAMMA:"γ",ZETA:"ζ",ETA:"η",IOTA:"ι",KAPPA:"κ",LAMBDA:"λ",NU:"ν",XI:"ξ",OMICRON:"ο",RHO:"ρ",UPSILON:"υ",CHI_LOWER:"φ",CHI_UPPER:"χ",PSI:"ψ",ALPHA:"α",ESZETT:"ß",PI:"π",SIGMA_UPPER:"Σ",SIGMA_LOWER:"σ",MU:"µ",TAU:"τ",THETA:"Θ",OMEGA:"Ω",DELTA:"δ",PHI_LOWER:"φ",EPSILON:"ε"},B={toArray:k,pad:h,truncate:i,multiply:l,format:j,style:m,escape:n,trim:o,trimLeft:p,trimRight:q,isEmpty:r};
-return a.define(b.isString,B).define(b.isArray,{style:m}).expose(B).expose({characters:A})}"undefined"!=typeof c?"undefined"!=typeof b&&b.exports&&(b.exports=d(a("extended"),a("is-extended"),a("date-extended"),a("array-extended"))):"function"==typeof define&&define.amd?define(["extended","is-extended","date-extended","array-extended"],function(a,b,c,e){return d(a,b,c,e)}):this.stringExtended=d(this.extended,this.isExtended,this.dateExtended,this.arrayExtended)}.call(this)},{"array-extended":36,"date-extended":37,extended:40,"is-extended":50}]},{},[1]);
\ No newline at end of file
+!function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);throw new Error("Cannot find module '"+g+"'")}var j=c[g]={exports:{}};b[g][0].call(j.exports,function(a){var c=b[g][1][a];return e(c?c:a)},j,j.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;gf&&j>f&&f++;);c=g[f]-h[f],c||(c=i-j)}return c||(c=a.recency-b.recency),c>0?1:-1},j=e({instance:{constructor:function(){this.memory={},this.memoryValues=new g},clear:function(){this.memoryValues.clear(),this.memory={},this.memory.length=this.memoryValues.length=0},get:function(a){var b=this.memory[a.id];return b?b.data:[]},remove:function(a){for(var b,c,e,f,g=a.match.facts,h=g.length,i=this.memoryValues,j=this.memory,k=-1;++k-1;)c=h[i],f.remove(c),e.remove(c),g.remove(c);h.length=0},retract:function(a,b){var c=this.rules[a.name],d=c.tree,e=c.factTable,f=this.getAgendaGroup(a.rule.agendaGroup);d.traverse(d.__root,k,function(a){b(a)&&(e.remove(a),f.remove(a),d.remove(a))})},insert:function(a,b){var c=this.rules[a.name],d=a.rule,e=d.agendaGroup;c.tree.insert(b),this.getAgendaGroup(e).insert(b),e&&d.autoFocus&&this.setFocus(e),c.factTable.insert(b)},dispose:function(){for(var a in this.agendaGroups)this.agendaGroups[a].clear();var b=this.rules;for(a in b)a in b&&(b[a].tree.clear(),b[a].factTable.clear());this.rules={}}}})},{"./extended":11,events:47}],4:[function(require,module,exports){"use strict";var extd=require("../extended"),forEach=extd.forEach,isString=extd.isString;exports.modifiers=["assert","modify","retract","emit","halt","focus"];var createFunction=function(body,defined,scope,scopeNames,definedNames){var declares=[];forEach(definedNames,function(a){-1!==body.indexOf(a)&&declares.push("var "+a+"= defined."+a+";")}),forEach(scopeNames,function(a){-1!==body.indexOf(a)&&declares.push("var "+a+"= scope."+a+";")}),body=["((function(){",declares.join(""),"\n return ",body,"\n})())"].join("");try{return eval(body)}catch(e){throw new Error("Invalid action : "+body+"\n"+e.message)}},createDefined=function(){var a=function(a){a=isString(a)?new Function("return "+a+";")():a;var b=a.hasOwnProperty("constructor")&&"function"==typeof a.constructor?a.constructor:function(b){b=b||{};for(var c in b)c in a&&(this[c]=b[c])},c=b.prototype;for(var d in a)c[d]=a[d];return b};return function(b){return a(b.properties)}}();exports.createFunction=createFunction,exports.createDefined=createDefined},{"../extended":11}],5:[function(a,b,c){var d=a("__browserify_Buffer").Buffer,e=a("../extended"),f=a("../parser"),g=a("../constraintMatcher.js"),h=e.indexOf,i=e.forEach,j=e.removeDuplicates,k=e.map,l=e.hash,m=l.keys,n=e.merge,o=a("../rule"),p=a("./common"),q=p.createDefined,r=p.createFunction,s=function(a,b,c,d){var f=[];i(b,function(b){-1!==a.indexOf(b)&&f.push("var "+b+"= facts."+b+";")}),e(c).keys().forEach(function(b){-1!==a.indexOf(b)&&f.push("var "+b+"= defined."+b+";")}),e(d).keys().forEach(function(b){-1!==a.indexOf(b)&&f.push("var "+b+"= scope."+b+";")});var g=["facts","flow"];/next\(.*\)/.test(a)&&g.push("next"),a="with(flow){"+f.join("")+a+"}";try{return new Function("defined, scope","return "+new Function(g.join(","),a).toString())(c,d)}catch(h){throw new Error("Invalid action : "+a+"\n"+h.message)}},t=function(){var a=function(a,b,c,d,j){var k=[],l=a[0],m=a[1],n=a[2],o=a[3];if(e.isHash(n)&&(o=n,n=null),!l||!(l=d[l]))throw new Error("Invalid class "+a[0]+" for rule "+j);if(k.push(l),k.push(m,n,o),c.push(k),b.push(m),n&&i(g.getIdentifiers(f.parseConstraint(n)),function(a){b.push(a)}),e.isObject(o))for(var p in o){var q=o[p];-1===h(b,q)&&b.push(q)}};return function(b,c,d){var f=b.name;if(e.isEmpty(b))throw new Error("Rule is empty");var g=b.options||{};g.scope=d;var h=b.constraints||[],k=h.length;k||(h=["true"]);var l=b.action;if(e.isUndefined(l))throw new Error("No action was defined for rule "+f);var m=[],n=[];return e(h).forEach(function(b){if(b.length){var d=b[0];if("not"===d){var e=[];b.shift(),a(b,n,e,c,f);var g=e[0];g.unshift(d),m.push(g)}else if("or"===d){var h=[d];b.shift(),i(b,function(b){a(b,n,h,c,f)}),m.push(h)}else a(b,n,m,c,f),n=j(n)}}),o.createRule(f,g,m,s(l,n,c,d))}}();c.parse=function(a,b){return f.parseRuleSet(a,b)},c.compile=function(a,b,c,f){e.isFunction(b)?(c=b,b={}):(b=b||{},c=null);var g=a.name||b.name;if(!g)throw new Error("Name must be present in JSON or options");var h=new f(g),j=n({Array:Array,String:String,Number:Number,Boolean:Boolean,RegExp:RegExp,Date:Date,Object:Object},b.define||{});"undefined"!=typeof d&&(j.Buffer=d);var l=n({console:console},b.scope);i(a.define,function(a){j[a.name]=q(a)}),e(j).forEach(function(a,b){h.addDefined(b,a)});var o=e(a.scope).pluck("name").union(e(l).keys().value()).value(),p=k(m(j),function(a){return a});i(a.scope,function(a){l[a.name]=r(a.body,j,l,o,p)});var s=a.rules;return s.length&&i(s,function(a){h.__rules=h.__rules.concat(t(a,j,l))}),c&&c.call(h,h),h},c.transpile=a("./transpile").transpile},{"../constraintMatcher.js":8,"../extended":11,"../parser":31,"../rule":36,"./common":4,"./transpile":6,__browserify_Buffer:50}],6:[function(a,b,c){function d(a){a=l(a)?new Function("return "+a+";")():a;var b,c=["(function(){"];a.hasOwnProperty("constructor")&&"function"==typeof a.constructor?c.push("var Defined = "+a.constructor.toString()+";"):c.push("var Defined = function(opts){ for(var i in opts){if(opts.hasOwnProperty(i)){this[i] = opts[i];}}};"),c.push("var proto = Defined.prototype;");for(var d in a)a.hasOwnProperty(d)&&(b=a[d],c.push("proto."+d+" = "+(h.isFunction(b)?b.toString():h.format("%j",b))+";"));return c.push("return Defined;"),c.push("}())"),c.join("")}function e(a,b,c,d){var e=[];i(b,function(b){-1!==a.indexOf(b)&&e.push("var "+b+"= facts."+b+";")}),h(c).keys().forEach(function(b){-1!==a.indexOf(b)&&e.push("var "+b+"= defined."+b+";")}),h(d).keys().forEach(function(b){-1!==a.indexOf(b)&&e.push("var "+b+"= scope."+b+";")});var f=["facts","flow"];/next\(.*\)/.test(a)&&f.push("next"),a=e.join("")+a;try{return["function(",f.join(","),"){with(flow){",a,"}}"].join("")}catch(g){throw new Error("Invalid action : "+a+"\n"+g.message)}}function f(a,b){a=a.slice(0);var c=[];if("or"===a[0])return c.push('["'+a.shift()+'"'),c.push(h.map(a,function(a){return f(a,b)}).join(",")+"]"),c;if("not"===a[0]&&c.push('"',a.shift(),'", '),b.push(a[1]),c.push(a[0],', "'+a[1].replace(/"/g,'\\"')+'"'),a.splice(0,2),a.length){var d=a.shift();h.isString(d)?(c.push(',"'+d.replace(/"/g,'\\"'),'"'),i(m.getIdentifiers(n.parseConstraint(d)),function(a){b.push(a)})):(c.push(',"true"'),a.unshift(d))}if(a.length){var e=a.shift();h(e).values().forEach(function(a){-1===j(b,a)&&b.push(a)}),c.push(","+h.format("%j",[e]))}return"["+c.join("")+"]"}var g=a("__browserify_Buffer").Buffer,h=a("../extended"),i=h.forEach,j=h.indexOf,k=h.merge,l=h.isString,m=a("../constraintMatcher"),n=a("../parser");c.transpile=function(a,b){b=b||{};var c=[];c.push("(function(){"),c.push("return function(options){"),c.push("options = options || {};"),c.push("var bind = function(scope, fn){return function(){return fn.apply(scope, arguments);};}, defined = options.defined || {}, scope = options.scope || {};");var i=k({Array:Array,String:String,Number:Number,Boolean:Boolean,RegExp:RegExp,Date:Date,Object:Object},b.define||{});"undefined"!=typeof g&&(i.Buffer=g);var j=k({console:console},b.scope);return c.push(["return nools.flow('",b.name,"', function(){"].join("")),c.push(h(a.define||[]).map(function(a){var b=a.name;return a[b]={},["var",b,"= defined."+b,"= this.addDefined('"+b+"',",d(a.properties)+");"].join(" ")}).value().join("\n")),c.push(h(a.scope||[]).map(function(a){var b=a.name;return j[b]={},["var",b,"= scope."+b,"= ",a.body,";"].join(" ")}).value().join("\n")),c.push("scope.console = console;\n"),c.push(h(a.rules||[]).map(function(a){var b=[],c=["this.rule('",a.name.replace(/'/g,"\\'"),"'"],d=h.merge(a.options||{},{scope:"scope"});return c.push(",",h.format("%j",[d]).replace(/(:"scope")/,":scope")),a.constraints&&!h.isEmpty(a.constraints)&&(c.push(", ["),c.push(h(a.constraints).map(function(a){return f(a,b)}).value().join(",")),c.push("]")),c.push(",",e(a.action,b,i,j)),c.push(");"),c.join("")}).value().join("")),c.push("});"),c.push("};"),c.push("}());"),c.join("")}},{"../constraintMatcher":8,"../extended":11,"../parser":31,__browserify_Buffer:50}],7:[function(a,b,c){"use strict";var d,e=a("./extended"),f=e.merge,g=e.instanceOf,h=e.filter,i=e.declare,j=i({instance:{constructor:function(b,c){d||(d=a("./constraintMatcher")),this.type=b,this.constraint=c},assert:function(){throw new Error("not implemented")},equal:function(a){return g(a,this._static)&&this.get("alias")===a.get("alias")&&e.deepEqual(this.constraint,a.constraint)},getters:{variables:function(){return[this.get("alias")]}}}});j.extend({instance:{constructor:function(a){this._super(["object",a])},assert:function(a){return a instanceof this.constraint||a.constructor===this.constraint},equal:function(a){return g(a,this._static)&&this.constraint===a.constraint}}}).as(c,"ObjectConstraint"),j.extend({instance:{constructor:function(a,b){this._super(["equality",a]),b=b||{},this.pattern=b.pattern,this._matcher=d.getMatcher(a,b.scope||{})},assert:function(a){return this._matcher(a)}}}).as(c,"EqualityConstraint"),j.extend({instance:{constructor:function(){this._super(["equality",[!0]])},equal:function(a){return g(a,this._static)&&this.get("alias")===a.get("alias")},assert:function(){return!0}}}).as(c,"TrueConstraint"),j.extend({instance:{constructor:function(a,b){this.cache={},this._super(["reference",a]),b=b||{},this.values=[],this.pattern=b.pattern,this._options=b,this._matcher=d.getMatcher(a,b.scope||{})},assert:function(a){try{return this._matcher(a)}catch(b){throw new Error("Error with evaluating pattern "+this.pattern+" "+b.message)}},merge:function(a){var b=this;return a instanceof this._static&&(b=new this._static([this.constraint,a.constraint,"and"],f({},this._options,this._options)),b._alias=this._alias||a._alias,b.vars=this.vars.concat(a.vars)),b},equal:function(a){return g(a,this._static)&&e.deepEqual(this.constraint,a.constraint)},getters:{variables:function(){return this.vars},alias:function(){return this._alias}},setters:{alias:function(a){this._alias=a,this.vars=h(d.getIdentifiers(this.constraint),function(b){return b!==a})}}}}).as(c,"ReferenceConstraint"),j.extend({instance:{constructor:function(a){this._super(["hash",a])},equal:function(a){return e.instanceOf(a,this._static)&&this.get("alias")===a.get("alias")&&e.deepEqual(this.constraint,a.constraint)},assert:function(){return!0},getters:{variables:function(){return this.constraint}}}}).as(c,"HashConstraint")},{"./constraintMatcher":8,"./extended":11}],8:[function(a,b,c){"use strict";var d=a("./extended"),e=d.isArray,f=d.forEach,g=d.some,h=d.map,i=d.indexOf,j=d.isNumber,k=d.removeDuplicates,l=a("./constraint"),m={indexOf:d.indexOf,now:function(){return new Date},Date:function(a,b,c,d,e,f,g){var h=new Date;return j(a)&&h.setYear(a),j(b)&&h.setMonth(b),j(c)&&h.setDate(c),j(d)&&h.setHours(d),j(e)&&h.setMinutes(e),j(f)&&h.setSeconds(f),j(g)&&h.setMilliseconds(g),h},lengthOf:function(a,b){return a.length===b},isTrue:function(a){return a===!0},isFalse:function(a){return a===!1},isNotNull:function(a){return null!==a},dateCmp:function(a,b){return d.compare(a,b)}};f(["years","days","months","hours","minutes","seconds"],function(a){m[a+"FromNow"]=d[a+"FromNow"],m[a+"Ago"]=d[a+"Ago"]}),f(["isArray","isNumber","isHash","isObject","isDate","isBoolean","isString","isRegExp","isNull","isEmpty","isUndefined","isDefined","isUndefinedOrNull","isPromiseLike","isFunction","deepEqual"],function(a){var b=d[a];m[a]=function(){return b.apply(d,arguments)}});var n={equal:function(a,b){var c=!1;return a===b?c=!0:a[2]===b[2]&&(c=-1!==i(["string","number","boolean","regexp","identifier","null"],a[2])?a[0]===b[0]:"unary"===a[2]||"logicalNot"===a[2]?this.equal(a[0],b[0]):this.equal(a[0],b[0])&&this.equal(a[1],b[1])),c},getIdentifiers:function(a){var b=[],c=a[2];if("identifier"===c)return[a[0]];if("function"===c)b=b.concat(this.getIdentifiers(a[0])).concat(this.getIdentifiers(a[1]));else if("string"!==c&&"number"!==c&&"boolean"!==c&&"regexp"!==c&&"unary"!==c&&"unary"!==c)if("prop"===c){if(b=b.concat(this.getIdentifiers(a[0])),a[1])for(var d=a[1];e(d);){if("function"===d[2]){b=b.concat(this.getIdentifiers(d[1]));break}d=d[1]}}else a[0]&&(b=b.concat(this.getIdentifiers(a[0]))),a[1]&&(b=b.concat(this.getIdentifiers(a[1])));return k(b)},toConstraints:function(a,b){var c=[],d=b.alias,e=b.scope||{},f=a[2];return"and"===f?c=c.concat(this.toConstraints(a[0],b)).concat(this.toConstraints(a[1],b)):("composite"===f||"or"===f||"lt"===f||"gt"===f||"lte"===f||"gte"===f||"like"===f||"notLike"===f||"eq"===f||"neq"===f||"in"===f||"notIn"===f||"prop"===f||"propLookup"===f||"function"===f||"logicalNot"===f)&&(g(this.getIdentifiers(a),function(a){return!(a===d||a in m||a in e)})?c.push(new l.ReferenceConstraint(a,b)):c.push(new l.EqualityConstraint(a,b))),c},parse:function(a){return this[a[2]](a[0],a[1])},composite:function(a){return this.parse(a)},and:function(a,b){return["(",this.parse(a),"&&",this.parse(b),")"].join(" ")},or:function(a,b){return["(",this.parse(a),"||",this.parse(b),")"].join(" ")},prop:function(a,b){return"function"===b[2]?[this.parse(a),this.parse(b)].join("."):[this.parse(a),"['",this.parse(b),"']"].join("")},propLookup:function(a,b){return"function"===b[2]?[this.parse(a),this.parse(b)].join("."):[this.parse(a),"[",this.parse(b),"]"].join("")},unary:function(a){return-1*this.parse(a)},plus:function(a,b){return[this.parse(a),"+",this.parse(b)].join(" ")},minus:function(a,b){return[this.parse(a),"-",this.parse(b)].join(" ")},mult:function(a,b){return[this.parse(a),"*",this.parse(b)].join(" ")},div:function(a,b){return[this.parse(a),"/",this.parse(b)].join(" ")},mod:function(a,b){return[this.parse(a),"%",this.parse(b)].join(" ")},lt:function(a,b){return[this.parse(a),"<",this.parse(b)].join(" ")},gt:function(a,b){return[this.parse(a),">",this.parse(b)].join(" ")},lte:function(a,b){return[this.parse(a),"<=",this.parse(b)].join(" ")},gte:function(a,b){return[this.parse(a),">=",this.parse(b)].join(" ")},like:function(a,b){return[this.parse(b),".test(",this.parse(a),")"].join("")},notLike:function(a,b){return["!",this.parse(b),".test(",this.parse(a),")"].join("")},eq:function(a,b){return[this.parse(a),"===",this.parse(b)].join(" ")},neq:function(a,b){return[this.parse(a),"!==",this.parse(b)].join(" ")},"in":function(a,b){return["(indexOf(",this.parse(b),",",this.parse(a),")) != -1"].join("")},notIn:function(a,b){return["(indexOf(",this.parse(b),",",this.parse(a),")) == -1"].join("")},arguments:function(a,b){var c=[];return a&&c.push(this.parse(a)),b&&c.push(this.parse(b)),c.join(",")},array:function(a){var b=[];return a?(b=this.parse(a),e(b)?b:["[",b,"]"].join("")):["[",b.join(","),"]"].join("")},"function":function(a,b){var c=this.parse(b);return[this.parse(a),"(",c,")"].join("")},string:function(a){return"'"+a+"'"},number:function(a){return a},"boolean":function(a){return a},regexp:function(a){return a},identifier:function(a){return a},"null":function(){return"null"},logicalNot:function(a){return["!(",this.parse(a),")"].join("")}},o=c.toJs=function(a,b){var c=n.parse(a);b=b||{};var d=n.getIdentifiers(a),e="var indexOf = definedFuncs.indexOf;"+h(d,function(a){var c=["var ",a," = "];return m.hasOwnProperty(a)?c.push("definedFuncs['",a,"']"):b.hasOwnProperty(a)?c.push("scope['",a,"']"):c.push("'",a,"' in fact ? fact['",a,"'] : hash['",a,"']"),c.push(";"),c.join("")}).join("")+" return !!("+c+");",f=new Function("fact, hash, definedFuncs, scope",e);return function(a,c){return f(a,c,m,b)}};c.getMatcher=function(a,b){return o(a,b)},c.toConstraints=function(a,b){return n.toConstraints(a,b)},c.equal=function(a,b){return n.equal(a,b)},c.getIdentifiers=function(a){return n.getIdentifiers(a)}},{"./constraint":7,"./extended":11}],9:[function(a,b){"use strict";var c=a("./extended"),d=c.declare,e=c.merge,f=c.union,g=Array.prototype.slice,h=d({instance:{constructor:function(a){this.isMatch=!0,a instanceof this._static?(this.isMatch=a.isMatch,this.facts=g.call(a.facts),this.factIds=g.call(a.factIds),this.hashCode=this.factIds.join(":"),this.factHash=e({},a.factHash),this.recency=g.call(a.recency)):a?(this.facts=[a],this.factIds=[a.id],this.recency=[a.recency],this.hashCode=a.id+"",this.factHash=a.factHash||{}):(this.facts=[],this.factIds=[],this.factHash={},this.hashCode="")},merge:function(a){var b=new this._static;return b.isMatch=a.isMatch,b.facts=this.facts.concat(a.facts),b.factIds=this.factIds.concat(a.factIds),b.hashCode=b.factIds.join(":"),b.factHash=e({},this.factHash,a.factHash),b.recency=f(this.recency,a.recency),b}}}),i=d({instance:{match:null,factHash:null,fact:null,hashCode:null,paths:null,constructor:function(a,b,c){this.fact=a,this.paths=b||null;var d=this.match=c||new h(a);this.factHash=d.factHash,this.hashCode=d.hashCode,this.factIds=d.factIds},set:function(a,b){return this.factHash[a]=b,this},isMatch:function(a){return this.match.isMatch=a,this},clone:function(a,b,c){return new i(a||this.fact,b||this.path,c||this.match)}}}).as(b)},{"./extended":11}],10:[function(a,b){var c=a("./extended"),d=c.Promise,e=a("./nextTick"),f=c.isPromiseLike;d.extend({instance:{looping:!1,constructor:function(a,b){this._super([]),this.flow=a,this.agenda=a.agenda,this.rootNode=a.rootNode,this.matchUntilHalt=!!b,c.bindAll(this,["onAlter","callNext"])},halt:function(){this.__halted=!0,this.looping||this.callback()},onAlter:function(){this.flowAltered=!0,this.looping||!this.matchUntilHalt||this.__halted||this.callNext()},setup:function(){var a=this.flow;this.rootNode.resetCounter(),a.on("assert",this.onAlter),a.on("modify",this.onAlter),a.on("retract",this.onAlter)},tearDown:function(){var a=this.flow;a.removeListener("assert",this.onAlter),a.removeListener("modify",this.onAlter),a.removeListener("retract",this.onAlter)},__handleAsyncNext:function(a){var b=this;return a.addCallback(function(){b.looping=!1,b.flowAltered?(b.rootNode.incrementCounter(),b.flowAltered=!1,b.__halted?b.callback():b.callNext()):(!b.matchUntilHalt||b.__halted)&&b.callback(),b=null}).addErrback(this.errback)},__handleSyncNext:function(a){return this.looping=!1,this.flowAltered&&(this.rootNode.incrementCounter(),this.flowAltered=!1),a&&!this.__halted?e(this.callNext):(!this.matchUntilHalt||this.__halted)&&this.callback(),a},callback:function(){this.tearDown(),this._super(arguments)},callNext:function(){this.looping=!0;var a=this.agenda.fireNext();return f(a)?this.__handleAsyncNext(a):this.__handleSyncNext(a)},execute:function(){return this.setup(),this.callNext(),this}}}).as(b)},{"./extended":11,"./nextTick":16}],11:[function(a,b){b.exports=a("extended")().register(a("array-extended")).register(a("date-extended")).register(a("object-extended")).register(a("string-extended")).register(a("promise-extended")).register(a("function-extended")).register(a("is-extended")).register("HashTable",a("ht")).register("declare",a("declare.js")).register(a("leafy")).register("LinkedList",a("./linkedList"))},{"./linkedList":15,"array-extended":39,"date-extended":40,"declare.js":42,extended:43,"function-extended":46,ht:52,"is-extended":53,leafy:54,"object-extended":55,"promise-extended":56,"string-extended":57}],12:[function(a,b){"use strict";var c=a("./extended"),d=c.bind,e=c.declare,f=a("./nodes"),g=a("events").EventEmitter,h=a("./workingMemory"),i=h.WorkingMemory,j=a("./executionStrategy"),k=a("./agenda");b.exports=e(g,{instance:{name:null,executionStrategy:null,constructor:function(a){this.env=null,this.name=a,this.__rules={},this.workingMemory=new i,this.agenda=new k(this),this.agenda.on("fire",d(this,"emit","fire")),this.agenda.on("focused",d(this,"emit","focused")),this.rootNode=new f.RootNode(this.workingMemory,this.agenda)},focus:function(a){return this.agenda.setFocus(a),this},halt:function(){var a=this.executionStrategy;return a.matchUntilHalt&&a.halt(),this},dispose:function(){this.workingMemory.dispose(),this.agenda.dispose(),this.rootNode.dispose()},assert:function(a){return this.rootNode.assertFact(this.workingMemory.assertFact(a)),this.emit("assert",a),a},retract:function(a){return this.rootNode.retractFact(this.workingMemory.retractFact(a)),this.emit("retract",a),a},modify:function(a,b){return this.rootNode.retractFact(this.workingMemory.retractFact(a)),"function"==typeof b&&b.call(a,a),this.emit("modify",a),this.rootNode.assertFact(this.workingMemory.assertFact(a)),a},print:function(){this.rootNode.print()},containsRule:function(a){return this.rootNode.containsRule(a)},rule:function(a){this.rootNode.assertRule(a)},matchUntilHalt:function(a){return(this.executionStrategy=new j(this,!0)).execute().classic(a).promise()},match:function(a){return(this.executionStrategy=new j(this)).execute().classic(a).promise()}}})},{"./agenda":3,"./executionStrategy":10,"./extended":11,"./nodes":20,"./workingMemory":37,events:47}],13:[function(a,b){"use strict";var c=a("./extended"),d=c.instanceOf,e=c.forEach,f=c.declare,g=a("./pattern").InitialFact,h=a("./rule"),i=a("./flow"),j={},k=f({instance:{constructor:function(a,b){if(this.name=a,this.cb=b,this.__rules=[],this.__defined={},b&&b.call(this,this),j.hasOwnProperty(a))throw new Error("Flow with "+a+" already defined");j[a]=this},getDefined:function(a){var b=this.__defined[a.toLowerCase()];if(!b)throw new Error(a+" flow class is not defined");return b},addDefined:function(a,b){return this.__defined[a.toLowerCase()]=b,b},rule:function(){return this.__rules=this.__rules.concat(h.createRule.apply(h,arguments)),this},getSession:function(){var a=new i(this.name);e(this.__rules,function(b){a.rule(b)}),a.assert(new g);for(var b=0,c=arguments.length;c>b;b++)a.assert(arguments[b]);return a},containsRule:function(a){return c.some(this.__rules,function(b){return b.name===a})}},"static":{getFlow:function(a){return j[a]},hasFlow:function(a){return c.has(j,a)},deleteFlow:function(a){return d(a,k)&&(a=a.name),delete j[a],k},deleteFlows:function(){for(var a in j)a in j&&delete j[a];return k},create:function(a,b){return new k(a,b)}}}).as(b)},{"./extended":11,"./flow":12,"./pattern":35,"./rule":36}],14:[function(a,b,c){"use strict";function d(a){return/\.nools$/.test(a)}function e(a){var b;return b=d(a)?i.parse(g.readFileSync(a,"utf8"),a):i.parse(a)}var f=a("./extended"),g=a("fs"),h=a("path"),i=a("./compile"),j=a("./flowContainer");c.Flow=j,c.getFlow=j.getFlow,c.hasFlow=j.hasFlow,c.deleteFlow=function(a){return j.deleteFlow(a),this},c.deleteFlows=function(){return j.deleteFlows(),this},c.flow=j.create,c.compile=function(a,b,c){if(f.isFunction(b)?(c=b,b={}):(b=b||{},c=null),f.isString(a)&&(b.name=b.name||(d(a)?h.basename(a,h.extname(a)):null),a=e(a)),!b.name)throw new Error("Name required when compiling nools source");return i.compile(a,b,c,j)},c.transpile=function(a,b){return b=b||{},f.isString(a)&&(b.name=b.name||(d(a)?h.basename(a,h.extname(a)):null),a=e(a)),i.transpile(a,b)},c.parse=e},{"./compile":5,"./extended":11,"./flowContainer":13,fs:48,path:49}],15:[function(a,b){var c=a("declare.js");c({instance:{constructor:function(){this.head=null,this.tail=null,this.length=null},push:function(a){var b=this.tail,c=this.head,d={data:a,prev:b,next:null};return b&&(this.tail.next=d),this.tail=d,c||(this.head=d),this.length++,d},remove:function(a){a.prev?a.prev.next=a.next:this.head=a.next,a.next?a.next.prev=a.prev:this.tail=a.prev,a.data=a.prev=a.next=null,this.length--},forEach:function(a){for(var b={next:this.head};b=b.next;)a(b.data)},clear:function(){this.head=this.tail=null,this.length=0}}}).as(b)},{"declare.js":42}],16:[function(a,b){var c,d=a("__browserify_process"),e=a("./extended");if("function"==typeof setImmediate)c="undefined"!=typeof window?e.bind(window,setImmediate):setImmediate;else if("undefined"!=typeof d)c=d.nextTick;else if("undefined"!=typeof MessageChannel){var f=new MessageChannel,g={},h=g;f.port1.onmessage=function(){g=g.next;var a=g.task;delete g.task,a()},c=function(a){h=h.next={task:a},f.port2.postMessage(0)}}else c=function(a){setTimeout(a,0)};b.exports=c},{"./extended":11,__browserify_process:51}],17:[function(a,b){var c=a("./alphaNode");c.extend({instance:{constructor:function(){this._super(arguments),this.alias=this.constraint.get("alias")},toString:function(){return"AliasNode"+this.__count},assert:function(a){return this.__propagate("assert",a.set(this.alias,a.fact.object))},retract:function(a){this.propagateRetract(a.fact)},equal:function(a){return a instanceof this._static&&this.alias===a.alias}}}).as(b)},{"./alphaNode":18}],18:[function(a,b){"use strict";var c=a("./node");c.extend({instance:{constructor:function(a){this._super([]),this.constraint=a},toString:function(){return"AlphaNode "+this.__count},equal:function(a){return this.constraint.equal(a.constraint)}}}).as(b)},{"./node":24}],19:[function(a,b){var c=a("./alphaNode");c.extend({instance:{constructor:function(){this._super(arguments)},assert:function(a){this.constraint.assert(a.factHash)&&this.__propagate("assert",a)},toString:function(){return"EqualityNode"+this.__count}}}).as(b)},{"./alphaNode":18}],20:[function(a,b,c){"use strict";var d=a("../extended"),e=d.forEach,f=d.some,g=d.declare,h=a("../pattern.js"),i=h.ObjectPattern,j=h.NotPattern,k=h.CompositePattern,l=h.InitialFactPattern,m=a("../constraint"),n=m.HashConstraint,o=m.ReferenceConstraint,p=a("./aliasNode"),q=a("./equalityNode"),r=a("./joinNode"),s=a("./notNode"),t=a("./leftAdapterNode"),u=a("./rightAdapterNode"),v=a("./typeNode"),w=a("./terminalNode"),x=a("./propertyNode");g({instance:{constructor:function(a,b){this.terminalNodes=[],this.joinNodes=[],this.nodes=[],this.constraints=[],this.typeNodes=[],this.__ruleCount=0,this.bucket={counter:0,recency:0},this.agendaTree=b},assertRule:function(a){var b=new w(this.bucket,this.__ruleCount++,a,this.agendaTree);this.__addToNetwork(a,a.pattern,b),this.__mergeJoinNodes(),this.terminalNodes.push(b)},resetCounter:function(){this.bucket.counter=0},incrementCounter:function(){this.bucket.counter++},assertFact:function(a){for(var b=this.typeNodes,c=b.length-1;c>=0;c--)b[c].assert(a)},retractFact:function(a){for(var b=this.typeNodes,c=b.length-1;c>=0;c--)b[c].retract(a)},containsRule:function(a){return f(this.terminalNodes,function(b){return b.rule.name===a})},dispose:function(){for(var a=this.typeNodes,b=a.length-1;b>=0;b--)a[b].dispose()},__mergeJoinNodes:function(){for(var a=this.joinNodes,b=0;b=0;c--){var d=b[c];if(a.equal(d))return d}return b.push(a),a},__createTypeNode:function(a,b){for(var c=new v(b.get("constraints")[0]),d=this.typeNodes,e=d.length-1;e>=0;e--){var f=d[e];if(c.equal(f))return f}return d.push(c),c},__createEqualityNode:function(a,b){return this.__checkEqual(new q(b)).addRule(a)},__createPropertyNode:function(a,b){return this.__checkEqual(new x(b)).addRule(a)},__createAliasNode:function(a,b){return this.__checkEqual(new p(b)).addRule(a)},__createAdapterNode:function(a,b){return("left"===b?new t:new u).addRule(a)},__createJoinNode:function(a,b,c,d){var e;b.rightPattern instanceof j?e=new s:(e=new r,this.joinNodes.push(e));var f=e;if(c instanceof r){var g=this.__createAdapterNode(a,d);f.addOutNode(g,b),f=g}return f.addOutNode(c,b),e.addRule(a)},__addToNetwork:function(a,b,c,d){if(b instanceof i){if(b instanceof j&&(!d||"left"===d))return this.__createBetaNode(a,new k(new l,b),c,d);this.__createAlphaNode(a,b,c,d)}else b instanceof k&&this.__createBetaNode(a,b,c,d)},__createBetaNode:function(a,b,c,d){var e=this.__createJoinNode(a,b,c,d);return this.__addToNetwork(a,b.rightPattern,e,"right"),this.__addToNetwork(a,b.leftPattern,e,"left"),c.addParentNode(e),e},__createAlphaNode:function(a,b,c,d){var e=b.get("constraints"),f=this.__createTypeNode(a,b),g=this.__createAliasNode(a,b);f.addOutNode(g,b),g.addParentNode(f);for(var h=g,i=e.length-1;i>0;i--){var j,k=e[i];if(k instanceof n)j=this.__createPropertyNode(a,k);else{if(k instanceof o){c.constraint.addConstraint(k);continue}j=this.__createEqualityNode(a,k)}h.addOutNode(j,b),j.addParentNode(h),h=j}if(c instanceof r){var l=this.__createAdapterNode(a,d);l.addParentNode(h),h.addOutNode(l,b),h=l}return c.addParentNode(h),h.addOutNode(c,b),f},print:function(){e(this.terminalNodes,function(a){a.print(" ")})}}}).as(c,"RootNode")},{"../constraint":7,"../extended":11,"../pattern.js":35,"./aliasNode":17,"./equalityNode":19,"./joinNode":21,"./leftAdapterNode":23,"./notNode":25,"./propertyNode":26,"./rightAdapterNode":27,"./terminalNode":28,"./typeNode":29}],21:[function(a,b){var c=a("../extended"),d=c.hash.values,e=c.indexOf,f=a("./node"),g=a("./joinReferenceNode");f.extend({instance:{constructor:function(){this._super([]),this.constraint=new g,this.leftMemory={},this.rightMemory={},this.leftTuples=[],this.rightTuples=[]},dispose:function(){this.leftMemory={},this.rightMemory={}},disposeLeft:function(a){this.leftMemory={},this.propagateDispose(a)},disposeRight:function(a){this.rightMemory={},this.propagateDispose(a)},hashCode:function(){return"JoinNode "+this.__count},toString:function(){return"JoinNode "+this.__count},retractResolve:function(a){for(var b=d(this.leftMemory),c=b.length,f=this.leftTuples;--c>-1;)for(var g,h=b[c],i=h.length;--i>-1;)if(g=h[i],this.resolve(g.match,a)){f.splice(e(f,g),1),h.splice(i,1);
+break}this._propagateRetractResolve(a)},retractLeft:function(a){var b,c,d=this.leftMemory[a.id],f=this.leftTuples;if(d){for(b=-1,c=d.length;++be;e++)this.addOutNode(d,c[e]);a.nodes.remove(d)},this);for(var b=a.parentNodes,c=0,d=a.parentNodes.l;d>c;c++){var e=b[c];this.addParentNode(e),e.nodes.remove(a)}return this},resolve:function(a,b){return a.hashCode===b.hashCode},print:function(a){console.log(a+this.toString()),d(this.parentNodes,function(b){b.print(" "+a)})},addOutNode:function(a,b){this.nodes.contains(a)||this.nodes.put(a,[]),this.nodes.get(a).push(b),this.__entrySet=this.nodes.entrySet()},addParentNode:function(a){-1===e(this.parentNodes,a)&&this.parentNodes.push(a)},shareable:function(){return!1},__propagate:function(a,b,c){c=c||this.nodes;for(var d,e,g,h,j=this.__entrySet,k=j.length;--k>-1;)d=j[k],e=d.key,g=d.value,b.paths?(h=f(g,b.paths)).length&&e[a](new i(b.fact,h,b.match)):e[a](b)},dispose:function(a){this.propagateDispose(a)},retract:function(a){this.propagateRetract(a)},propagateDispose:function(a,b){b=b||this.nodes;for(var c=this.__entrySet,d=c.length-1;d>=0;d--){var e=c[d],f=e.key;f.dispose(a)}},propagateAssert:function(a,b){this.__propagate("assert",a,b||this.nodes)},propagateRetract:function(a,b){this.__propagate("retract",a,b||this.nodes)},assert:function(a){this.propagateAssert(a)},propagateModify:function(a,b){this.__propagate("modify",a,b||this.nodes)}}}).as(b)},{"../context":9,"../extended":11}],25:[function(a,b){var c=a("./joinNode"),d=a("../context"),e=a("../extended"),f=e.indexOf;c.extend({instance:{constructor:function(){this._super(arguments),this.leftTupleMemory={},this.allTuples={}},toString:function(){return"NotNode "+this.__count},retractRight:function(a){var b=this.rightMemory,c=b[a.id],e=this.constraint;if(delete b[a.id],c){var g=f(this.rightTuples,c);this.rightTuples.splice(g,1);for(var h,i,j,k=c.blocking,l=this.rightTuples,m=l.length;h=k.pop();){for(h.blocker=null,e.setLeftContext(h),j=g;m>j;j++)if(i=l[j],e.setRightContext(i),e.isMatch()){h.blocker=i,i.blocking.push(h),this.__addToLeftTupleMemory(h);break}h.blocker||(this.__removeFromLeftTupleMemory(h),this.__addToLeftMemory(h).propagateAssert(new d(h.fact,null,h.match)))}e.clearContexts()}},retractLeft:function(a){for(var b,c,d,e=a.id,g=this.allTuples[a.id]||[];g.length;)b=g.pop(),-1!==f(b.factIds,e)&&(this.__removeFromAllTupleMemory(b),this.__removeFromLeftMemory(b),this.__removeFromLeftTupleMemory(b),(d=b.blocker)&&(c=d.blocking,c.splice(f(c,b),1),b.blocker=null));delete this.leftMemory[e],delete this.leftTupleMemory[e],this.propagateRetract(a)},assertLeft:function(a){var b,c=this.rightTuples,e=this.constraint,f=-1,g=c.length;if(0!==g)for(e.setLeftContext(a);++f-1;)b=c[d],e.setLeftContext(b).isMatch()&&(this._propagateRetractResolve(b.match),this.__removeFromLeftMemory(b),b.blocker=a,a.blocking.push(b),this.__addToLeftTupleMemory(b));e.clearContexts()},__removeFromLeftMemory:function(a){for(var b,c=this.leftMemory[a.fact.id]||[],d=this.leftTuples,e=0,g=d.length;g>e;e++)if(b=d[e],b===a){d.splice(e,1),c.splice(f(c,b),1);break}return this},__removeFromLeftTupleMemory:function(a){for(var b,c=this.leftTupleMemory[a.fact.id]||[],d=0,e=c.length;e>d;d++)if(b=c[d],b===a){c.splice(d,1);break}return this},__addToAllTupleMemory:function(a){for(var b,c,d=a.factIds,e=-1,g=d.length,h=this.allTuples;++eg;g++)b=e[g],c.set(b[1],f[b[0]]);this.__propagate("assert",c)},toString:function(){return"PropertyNode"+this.__count}}}).as(b)},{"../context":9,"../extended":11,"./alphaNode":18}],27:[function(a,b){var c=a("./node");c.extend({instance:{retractResolve:function(a){this.__propagate("retractResolve",a)},dispose:function(a){this.propagateDispose(a)},propagateAssert:function(a){this.__propagate("assertRight",a)},propagateRetract:function(a){this.__propagate("retractRight",a)},propagateResolve:function(a){this.__propagate("retractResolve",a)},modify:function(a){this.__propagate("modifyRight",a)},toString:function(){return"RightAdapterNode "+this.__count}}}).as(b)},{"./node":24}],28:[function(a,b){var c=a("./node"),d=a("../extended"),e=d.bind,f=d.removeDuplicates;c.extend({instance:{constructor:function(a,b,c,d){this._super([]),this.resolve=e(this,this.resolve),this.rule=c,this.index=b,this.name=this.rule.name,this.agenda=d,this.bucket=a,d.register(this)},__assertModify:function(a){var b=a.match;if(b.recency.sort(function(a,b){return a-b}).reverse(),b.facts=f(b.facts),b.isMatch){var c=this.rule,d=this.bucket;this.agenda.insert(this,{rule:c,index:this.index,name:c.name,recency:d.recency++,match:b,counter:d.counter})}},assert:function(a){this.__assertModify(a)},modify:function(a){this.__assertModify(a)},retract:function(a){this.agenda.removeByFact(this,a)},retractRight:function(a){this.agenda.removeByFact(this,a)},retractLeft:function(a){this.agenda.removeByFact(this,a)},assertLeft:function(a){this.__assertModify(a)},assertRight:function(a){this.__assertModify(a)},retractResolve:function(a){var b=this.resolve;this.agenda.retract(this,function(c){return b(c.match,a)})},toString:function(){return"TerminalNode "+this.rule.name}}}).as(b)},{"../extended":11,"./node":24}],29:[function(a,b){var c=a("./alphaNode"),d=a("../context");c.extend({instance:{assert:function(a){this.constraint.assert(a.object)&&this.__propagate("assert",a)},retract:function(a){this.constraint.assert(a.object)&&this.propagateRetract(a)},toString:function(){return"TypeNode"+this.__count},dispose:function(){for(var a=this.__entrySet,b=a.length-1;b>=0;b--){var c=a[b],d=c.key,e=c.value;d.dispose({paths:e})}},__propagate:function(a,b){for(var c=this.__entrySet,e=c.length-1;e>=0;e--){var f=c[e],g=f.key,h=f.value;g[a](new d(b,h))}}}}).as(b)},{"../context":9,"./alphaNode":18}],30:[function(a,b,c){var d=a("__browserify_process"),e=function(){function a(){this.yy={}}var b={trace:function(){},yy:{},symbols_:{error:2,expressions:3,EXPRESSION:4,EOF:5,UNARY_EXPRESSION:6,LITERAL_EXPRESSION:7,"-":8,"!":9,MULTIPLICATIVE_EXPRESSION:10,"*":11,"/":12,"%":13,ADDITIVE_EXPRESSION:14,"+":15,EXPONENT_EXPRESSION:16,"^":17,RELATIONAL_EXPRESSION:18,"<":19,">":20,"<=":21,">=":22,EQUALITY_EXPRESSION:23,"==":24,"!=":25,"=~":26,"!=~":27,IN_EXPRESSION:28,"in":29,ARRAY_EXPRESSION:30,notIn:31,OBJECT_EXPRESSION:32,AND_EXPRESSION:33,"&&":34,OR_EXPRESSION:35,"||":36,ARGUMENT_LIST:37,",":38,IDENTIFIER_EXPRESSION:39,IDENTIFIER:40,".":41,"[":42,STRING_EXPRESSION:43,"]":44,"(":45,")":46,STRING:47,NUMBER_EXPRESSION:48,NUMBER:49,REGEXP_EXPRESSION:50,REGEXP:51,BOOLEAN_EXPRESSION:52,BOOLEAN:53,NULL_EXPRESSION:54,NULL:55,$accept:0,$end:1},terminals_:{2:"error",5:"EOF",8:"-",9:"!",11:"*",12:"/",13:"%",15:"+",17:"^",19:"<",20:">",21:"<=",22:">=",24:"==",25:"!=",26:"=~",27:"!=~",29:"in",31:"notIn",34:"&&",36:"||",38:",",40:"IDENTIFIER",41:".",42:"[",44:"]",45:"(",46:")",47:"STRING",49:"NUMBER",51:"REGEXP",53:"BOOLEAN",55:"NULL"},productions_:[0,[3,2],[6,1],[6,2],[6,2],[10,1],[10,3],[10,3],[10,3],[14,1],[14,3],[14,3],[16,1],[16,3],[18,1],[18,3],[18,3],[18,3],[18,3],[23,1],[23,3],[23,3],[23,3],[23,3],[28,1],[28,3],[28,3],[28,3],[28,3],[33,1],[33,3],[35,1],[35,3],[37,1],[37,3],[39,1],[32,1],[32,3],[32,4],[32,4],[32,3],[32,4],[43,1],[48,1],[50,1],[52,1],[54,1],[30,2],[30,3],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,3],[4,1]],performAction:function(a,b,c,d,e,f){var g=f.length-1;switch(e){case 1:return f[g-1];case 3:this.$=[f[g],null,"unary"];break;case 4:this.$=[f[g],null,"logicalNot"];break;case 6:this.$=[f[g-2],f[g],"mult"];break;case 7:this.$=[f[g-2],f[g],"div"];break;case 8:this.$=[f[g-2],f[g],"mod"];break;case 10:this.$=[f[g-2],f[g],"plus"];break;case 11:this.$=[f[g-2],f[g],"minus"];break;case 13:this.$=[f[g-2],f[g],"pow"];break;case 15:this.$=[f[g-2],f[g],"lt"];break;case 16:this.$=[f[g-2],f[g],"gt"];break;case 17:this.$=[f[g-2],f[g],"lte"];break;case 18:this.$=[f[g-2],f[g],"gte"];break;case 20:this.$=[f[g-2],f[g],"eq"];break;case 21:this.$=[f[g-2],f[g],"neq"];break;case 22:this.$=[f[g-2],f[g],"like"];break;case 23:this.$=[f[g-2],f[g],"notLike"];break;case 25:this.$=[f[g-2],f[g],"in"];break;case 26:this.$=[f[g-2],f[g],"notIn"];break;case 27:this.$=[f[g-2],f[g],"in"];break;case 28:this.$=[f[g-2],f[g],"notIn"];break;case 30:this.$=[f[g-2],f[g],"and"];break;case 32:this.$=[f[g-2],f[g],"or"];break;case 34:this.$=[f[g-2],f[g],"arguments"];break;case 35:this.$=[String(a),null,"identifier"];break;case 37:this.$=[f[g-2],f[g],"prop"];break;case 38:this.$=[f[g-3],f[g-1],"propLookup"];break;case 39:this.$=[f[g-3],f[g-1],"propLookup"];break;case 40:this.$=[f[g-2],[null,null,"arguments"],"function"];break;case 41:this.$=[f[g-3],f[g-1],"function"];break;case 42:this.$=[String(a.replace(/^['|"]|['|"]$/g,"")),null,"string"];break;case 43:this.$=[Number(a),null,"number"];break;case 44:this.$=[a,null,"regexp"];break;case 45:this.$=["true"==a.replace(/^\s+/,""),null,"boolean"];break;case 46:this.$=[null,null,"null"];break;case 47:this.$=[null,null,"array"];break;case 48:this.$=[f[g-1],null,"array"];break;case 56:this.$=[f[g-1],null,"composite"]}},table:[{3:1,4:2,6:28,7:7,8:[1,29],9:[1,30],10:27,14:25,16:17,18:8,23:6,28:5,30:15,32:14,33:4,35:3,39:23,40:[1,26],42:[1,24],43:9,45:[1,16],47:[1,18],48:10,49:[1,19],50:11,51:[1,20],52:12,53:[1,21],54:13,55:[1,22]},{1:[3]},{5:[1,31]},{5:[2,57],36:[1,32],46:[2,57]},{5:[2,31],34:[1,33],36:[2,31],46:[2,31]},{5:[2,29],34:[2,29],36:[2,29],46:[2,29]},{5:[2,24],24:[1,34],25:[1,35],26:[1,36],27:[1,37],34:[2,24],36:[2,24],46:[2,24]},{5:[2,2],8:[2,2],11:[2,2],12:[2,2],13:[2,2],15:[2,2],17:[2,2],19:[2,2],20:[2,2],21:[2,2],22:[2,2],24:[2,2],25:[2,2],26:[2,2],27:[2,2],29:[1,38],31:[1,39],34:[2,2],36:[2,2],46:[2,2]},{5:[2,19],19:[1,40],20:[1,41],21:[1,42],22:[1,43],24:[2,19],25:[2,19],26:[2,19],27:[2,19],34:[2,19],36:[2,19],46:[2,19]},{5:[2,49],8:[2,49],11:[2,49],12:[2,49],13:[2,49],15:[2,49],17:[2,49],19:[2,49],20:[2,49],21:[2,49],22:[2,49],24:[2,49],25:[2,49],26:[2,49],27:[2,49],29:[2,49],31:[2,49],34:[2,49],36:[2,49],38:[2,49],44:[2,49],46:[2,49]},{5:[2,50],8:[2,50],11:[2,50],12:[2,50],13:[2,50],15:[2,50],17:[2,50],19:[2,50],20:[2,50],21:[2,50],22:[2,50],24:[2,50],25:[2,50],26:[2,50],27:[2,50],29:[2,50],31:[2,50],34:[2,50],36:[2,50],38:[2,50],44:[2,50],46:[2,50]},{5:[2,51],8:[2,51],11:[2,51],12:[2,51],13:[2,51],15:[2,51],17:[2,51],19:[2,51],20:[2,51],21:[2,51],22:[2,51],24:[2,51],25:[2,51],26:[2,51],27:[2,51],29:[2,51],31:[2,51],34:[2,51],36:[2,51],38:[2,51],44:[2,51],46:[2,51]},{5:[2,52],8:[2,52],11:[2,52],12:[2,52],13:[2,52],15:[2,52],17:[2,52],19:[2,52],20:[2,52],21:[2,52],22:[2,52],24:[2,52],25:[2,52],26:[2,52],27:[2,52],29:[2,52],31:[2,52],34:[2,52],36:[2,52],38:[2,52],44:[2,52],46:[2,52]},{5:[2,53],8:[2,53],11:[2,53],12:[2,53],13:[2,53],15:[2,53],17:[2,53],19:[2,53],20:[2,53],21:[2,53],22:[2,53],24:[2,53],25:[2,53],26:[2,53],27:[2,53],29:[2,53],31:[2,53],34:[2,53],36:[2,53],38:[2,53],44:[2,53],46:[2,53]},{5:[2,54],8:[2,54],11:[2,54],12:[2,54],13:[2,54],15:[2,54],17:[2,54],19:[2,54],20:[2,54],21:[2,54],22:[2,54],24:[2,54],25:[2,54],26:[2,54],27:[2,54],29:[2,54],31:[2,54],34:[2,54],36:[2,54],38:[2,54],41:[1,44],42:[1,45],44:[2,54],45:[1,46],46:[2,54]},{5:[2,55],8:[2,55],11:[2,55],12:[2,55],13:[2,55],15:[2,55],17:[2,55],19:[2,55],20:[2,55],21:[2,55],22:[2,55],24:[2,55],25:[2,55],26:[2,55],27:[2,55],29:[2,55],31:[2,55],34:[2,55],36:[2,55],38:[2,55],44:[2,55],46:[2,55]},{4:47,6:28,7:7,8:[1,29],9:[1,30],10:27,14:25,16:17,18:8,23:6,28:5,30:15,32:14,33:4,35:3,39:23,40:[1,26],42:[1,24],43:9,45:[1,16],47:[1,18],48:10,49:[1,19],50:11,51:[1,20],52:12,53:[1,21],54:13,55:[1,22]},{5:[2,14],17:[1,48],19:[2,14],20:[2,14],21:[2,14],22:[2,14],24:[2,14],25:[2,14],26:[2,14],27:[2,14],34:[2,14],36:[2,14],46:[2,14]},{5:[2,42],8:[2,42],11:[2,42],12:[2,42],13:[2,42],15:[2,42],17:[2,42],19:[2,42],20:[2,42],21:[2,42],22:[2,42],24:[2,42],25:[2,42],26:[2,42],27:[2,42],29:[2,42],31:[2,42],34:[2,42],36:[2,42],38:[2,42],44:[2,42],46:[2,42]},{5:[2,43],8:[2,43],11:[2,43],12:[2,43],13:[2,43],15:[2,43],17:[2,43],19:[2,43],20:[2,43],21:[2,43],22:[2,43],24:[2,43],25:[2,43],26:[2,43],27:[2,43],29:[2,43],31:[2,43],34:[2,43],36:[2,43],38:[2,43],44:[2,43],46:[2,43]},{5:[2,44],8:[2,44],11:[2,44],12:[2,44],13:[2,44],15:[2,44],17:[2,44],19:[2,44],20:[2,44],21:[2,44],22:[2,44],24:[2,44],25:[2,44],26:[2,44],27:[2,44],29:[2,44],31:[2,44],34:[2,44],36:[2,44],38:[2,44],44:[2,44],46:[2,44]},{5:[2,45],8:[2,45],11:[2,45],12:[2,45],13:[2,45],15:[2,45],17:[2,45],19:[2,45],20:[2,45],21:[2,45],22:[2,45],24:[2,45],25:[2,45],26:[2,45],27:[2,45],29:[2,45],31:[2,45],34:[2,45],36:[2,45],38:[2,45],44:[2,45],46:[2,45]},{5:[2,46],8:[2,46],11:[2,46],12:[2,46],13:[2,46],15:[2,46],17:[2,46],19:[2,46],20:[2,46],21:[2,46],22:[2,46],24:[2,46],25:[2,46],26:[2,46],27:[2,46],29:[2,46],31:[2,46],34:[2,46],36:[2,46],38:[2,46],44:[2,46],46:[2,46]},{5:[2,36],8:[2,36],11:[2,36],12:[2,36],13:[2,36],15:[2,36],17:[2,36],19:[2,36],20:[2,36],21:[2,36],22:[2,36],24:[2,36],25:[2,36],26:[2,36],27:[2,36],29:[2,36],31:[2,36],34:[2,36],36:[2,36],38:[2,36],41:[2,36],42:[2,36],44:[2,36],45:[2,36],46:[2,36]},{7:51,30:15,32:14,37:50,39:23,40:[1,26],42:[1,24],43:9,44:[1,49],45:[1,16],47:[1,18],48:10,49:[1,19],50:11,51:[1,20],52:12,53:[1,21],54:13,55:[1,22]},{5:[2,12],8:[1,53],15:[1,52],17:[2,12],19:[2,12],20:[2,12],21:[2,12],22:[2,12],24:[2,12],25:[2,12],26:[2,12],27:[2,12],34:[2,12],36:[2,12],46:[2,12]},{5:[2,35],8:[2,35],11:[2,35],12:[2,35],13:[2,35],15:[2,35],17:[2,35],19:[2,35],20:[2,35],21:[2,35],22:[2,35],24:[2,35],25:[2,35],26:[2,35],27:[2,35],29:[2,35],31:[2,35],34:[2,35],36:[2,35],38:[2,35],41:[2,35],42:[2,35],44:[2,35],45:[2,35],46:[2,35]},{5:[2,9],8:[2,9],11:[1,54],12:[1,55],13:[1,56],15:[2,9],17:[2,9],19:[2,9],20:[2,9],21:[2,9],22:[2,9],24:[2,9],25:[2,9],26:[2,9],27:[2,9],34:[2,9],36:[2,9],46:[2,9]},{5:[2,5],8:[2,5],11:[2,5],12:[2,5],13:[2,5],15:[2,5],17:[2,5],19:[2,5],20:[2,5],21:[2,5],22:[2,5],24:[2,5],25:[2,5],26:[2,5],27:[2,5],34:[2,5],36:[2,5],46:[2,5]},{6:57,7:58,8:[1,29],9:[1,30],30:15,32:14,39:23,40:[1,26],42:[1,24],43:9,45:[1,16],47:[1,18],48:10,49:[1,19],50:11,51:[1,20],52:12,53:[1,21],54:13,55:[1,22]},{6:59,7:58,8:[1,29],9:[1,30],30:15,32:14,39:23,40:[1,26],42:[1,24],43:9,45:[1,16],47:[1,18],48:10,49:[1,19],50:11,51:[1,20],52:12,53:[1,21],54:13,55:[1,22]},{1:[2,1]},{6:28,7:7,8:[1,29],9:[1,30],10:27,14:25,16:17,18:8,23:6,28:5,30:15,32:14,33:60,39:23,40:[1,26],42:[1,24],43:9,45:[1,16],47:[1,18],48:10,49:[1,19],50:11,51:[1,20],52:12,53:[1,21],54:13,55:[1,22]},{6:28,7:7,8:[1,29],9:[1,30],10:27,14:25,16:17,18:8,23:6,28:61,30:15,32:14,39:23,40:[1,26],42:[1,24],43:9,45:[1,16],47:[1,18],48:10,49:[1,19],50:11,51:[1,20],52:12,53:[1,21],54:13,55:[1,22]},{6:28,7:58,8:[1,29],9:[1,30],10:27,14:25,16:17,18:62,30:15,32:14,39:23,40:[1,26],42:[1,24],43:9,45:[1,16],47:[1,18],48:10,49:[1,19],50:11,51:[1,20],52:12,53:[1,21],54:13,55:[1,22]},{6:28,7:58,8:[1,29],9:[1,30],10:27,14:25,16:17,18:63,30:15,32:14,39:23,40:[1,26],42:[1,24],43:9,45:[1,16],47:[1,18],48:10,49:[1,19],50:11,51:[1,20],52:12,53:[1,21],54:13,55:[1,22]},{6:28,7:58,8:[1,29],9:[1,30],10:27,14:25,16:17,18:64,30:15,32:14,39:23,40:[1,26],42:[1,24],43:9,45:[1,16],47:[1,18],48:10,49:[1,19],50:11,51:[1,20],52:12,53:[1,21],54:13,55:[1,22]},{6:28,7:58,8:[1,29],9:[1,30],10:27,14:25,16:17,18:65,30:15,32:14,39:23,40:[1,26],42:[1,24],43:9,45:[1,16],47:[1,18],48:10,49:[1,19],50:11,51:[1,20],52:12,53:[1,21],54:13,55:[1,22]},{30:66,32:67,39:23,40:[1,26],42:[1,24]},{30:68,32:69,39:23,40:[1,26],42:[1,24]},{6:28,7:58,8:[1,29],9:[1,30],10:27,14:25,16:70,30:15,32:14,39:23,40:[1,26],42:[1,24],43:9,45:[1,16],47:[1,18],48:10,49:[1,19],50:11,51:[1,20],52:12,53:[1,21],54:13,55:[1,22]},{6:28,7:58,8:[1,29],9:[1,30],10:27,14:25,16:71,30:15,32:14,39:23,40:[1,26],42:[1,24],43:9,45:[1,16],47:[1,18],48:10,49:[1,19],50:11,51:[1,20],52:12,53:[1,21],54:13,55:[1,22]},{6:28,7:58,8:[1,29],9:[1,30],10:27,14:25,16:72,30:15,32:14,39:23,40:[1,26],42:[1,24],43:9,45:[1,16],47:[1,18],48:10,49:[1,19],50:11,51:[1,20],52:12,53:[1,21],54:13,55:[1,22]},{6:28,7:58,8:[1,29],9:[1,30],10:27,14:25,16:73,30:15,32:14,39:23,40:[1,26],42:[1,24],43:9,45:[1,16],47:[1,18],48:10,49:[1,19],50:11,51:[1,20],52:12,53:[1,21],54:13,55:[1,22]},{39:74,40:[1,26]},{32:76,39:23,40:[1,26],43:75,47:[1,18]},{7:51,30:15,32:14,37:78,39:23,40:[1,26],42:[1,24],43:9,45:[1,16],46:[1,77],47:[1,18],48:10,49:[1,19],50:11,51:[1,20],52:12,53:[1,21],54:13,55:[1,22]},{46:[1,79]},{6:28,7:58,8:[1,29],9:[1,30],10:27,14:80,30:15,32:14,39:23,40:[1,26],42:[1,24],43:9,45:[1,16],47:[1,18],48:10,49:[1,19],50:11,51:[1,20],52:12,53:[1,21],54:13,55:[1,22]},{5:[2,47],8:[2,47],11:[2,47],12:[2,47],13:[2,47],15:[2,47],17:[2,47],19:[2,47],20:[2,47],21:[2,47],22:[2,47],24:[2,47],25:[2,47],26:[2,47],27:[2,47],29:[2,47],31:[2,47],34:[2,47],36:[2,47],38:[2,47],44:[2,47],46:[2,47]},{38:[1,82],44:[1,81]},{38:[2,33],44:[2,33],46:[2,33]},{6:28,7:58,8:[1,29],9:[1,30],10:83,30:15,32:14,39:23,40:[1,26],42:[1,24],43:9,45:[1,16],47:[1,18],48:10,49:[1,19],50:11,51:[1,20],52:12,53:[1,21],54:13,55:[1,22]},{6:28,7:58,8:[1,29],9:[1,30],10:84,30:15,32:14,39:23,40:[1,26],42:[1,24],43:9,45:[1,16],47:[1,18],48:10,49:[1,19],50:11,51:[1,20],52:12,53:[1,21],54:13,55:[1,22]},{6:85,7:58,8:[1,29],9:[1,30],30:15,32:14,39:23,40:[1,26],42:[1,24],43:9,45:[1,16],47:[1,18],48:10,49:[1,19],50:11,51:[1,20],52:12,53:[1,21],54:13,55:[1,22]},{6:86,7:58,8:[1,29],9:[1,30],30:15,32:14,39:23,40:[1,26],42:[1,24],43:9,45:[1,16],47:[1,18],48:10,49:[1,19],50:11,51:[1,20],52:12,53:[1,21],54:13,55:[1,22]},{6:87,7:58,8:[1,29],9:[1,30],30:15,32:14,39:23,40:[1,26],42:[1,24],43:9,45:[1,16],47:[1,18],48:10,49:[1,19],50:11,51:[1,20],52:12,53:[1,21],54:13,55:[1,22]},{5:[2,3],8:[2,3],11:[2,3],12:[2,3],13:[2,3],15:[2,3],17:[2,3],19:[2,3],20:[2,3],21:[2,3],22:[2,3],24:[2,3],25:[2,3],26:[2,3],27:[2,3],34:[2,3],36:[2,3],46:[2,3]},{5:[2,2],8:[2,2],11:[2,2],12:[2,2],13:[2,2],15:[2,2],17:[2,2],19:[2,2],20:[2,2],21:[2,2],22:[2,2],24:[2,2],25:[2,2],26:[2,2],27:[2,2],34:[2,2],36:[2,2],46:[2,2]},{5:[2,4],8:[2,4],11:[2,4],12:[2,4],13:[2,4],15:[2,4],17:[2,4],19:[2,4],20:[2,4],21:[2,4],22:[2,4],24:[2,4],25:[2,4],26:[2,4],27:[2,4],34:[2,4],36:[2,4],46:[2,4]},{5:[2,32],34:[1,33],36:[2,32],46:[2,32]},{5:[2,30],34:[2,30],36:[2,30],46:[2,30]},{5:[2,20],19:[1,40],20:[1,41],21:[1,42],22:[1,43],24:[2,20],25:[2,20],26:[2,20],27:[2,20],34:[2,20],36:[2,20],46:[2,20]},{5:[2,21],19:[1,40],20:[1,41],21:[1,42],22:[1,43],24:[2,21],25:[2,21],26:[2,21],27:[2,21],34:[2,21],36:[2,21],46:[2,21]},{5:[2,22],19:[1,40],20:[1,41],21:[1,42],22:[1,43],24:[2,22],25:[2,22],26:[2,22],27:[2,22],34:[2,22],36:[2,22],46:[2,22]},{5:[2,23],19:[1,40],20:[1,41],21:[1,42],22:[1,43],24:[2,23],25:[2,23],26:[2,23],27:[2,23],34:[2,23],36:[2,23],46:[2,23]},{5:[2,25],34:[2,25],36:[2,25],46:[2,25]},{5:[2,27],34:[2,27],36:[2,27],41:[1,44],42:[1,45],45:[1,46],46:[2,27]},{5:[2,26],34:[2,26],36:[2,26],46:[2,26]},{5:[2,28],34:[2,28],36:[2,28],41:[1,44],42:[1,45],45:[1,46],46:[2,28]},{5:[2,15],17:[1,48],19:[2,15],20:[2,15],21:[2,15],22:[2,15],24:[2,15],25:[2,15],26:[2,15],27:[2,15],34:[2,15],36:[2,15],46:[2,15]},{5:[2,16],17:[1,48],19:[2,16],20:[2,16],21:[2,16],22:[2,16],24:[2,16],25:[2,16],26:[2,16],27:[2,16],34:[2,16],36:[2,16],46:[2,16]},{5:[2,17],17:[1,48],19:[2,17],20:[2,17],21:[2,17],22:[2,17],24:[2,17],25:[2,17],26:[2,17],27:[2,17],34:[2,17],36:[2,17],46:[2,17]},{5:[2,18],17:[1,48],19:[2,18],20:[2,18],21:[2,18],22:[2,18],24:[2,18],25:[2,18],26:[2,18],27:[2,18],34:[2,18],36:[2,18],46:[2,18]},{5:[2,37],8:[2,37],11:[2,37],12:[2,37],13:[2,37],15:[2,37],17:[2,37],19:[2,37],20:[2,37],21:[2,37],22:[2,37],24:[2,37],25:[2,37],26:[2,37],27:[2,37],29:[2,37],31:[2,37],34:[2,37],36:[2,37],38:[2,37],41:[2,37],42:[2,37],44:[2,37],45:[2,37],46:[2,37]},{44:[1,88]},{41:[1,44],42:[1,45],44:[1,89],45:[1,46]},{5:[2,40],8:[2,40],11:[2,40],12:[2,40],13:[2,40],15:[2,40],17:[2,40],19:[2,40],20:[2,40],21:[2,40],22:[2,40],24:[2,40],25:[2,40],26:[2,40],27:[2,40],29:[2,40],31:[2,40],34:[2,40],36:[2,40],38:[2,40],41:[2,40],42:[2,40],44:[2,40],45:[2,40],46:[2,40]},{38:[1,82],46:[1,90]},{5:[2,56],8:[2,56],11:[2,56],12:[2,56],13:[2,56],15:[2,56],17:[2,56],19:[2,56],20:[2,56],21:[2,56],22:[2,56],24:[2,56],25:[2,56],26:[2,56],27:[2,56],29:[2,56],31:[2,56],34:[2,56],36:[2,56],38:[2,56],44:[2,56],46:[2,56]},{5:[2,13],8:[1,53],15:[1,52],17:[2,13],19:[2,13],20:[2,13],21:[2,13],22:[2,13],24:[2,13],25:[2,13],26:[2,13],27:[2,13],34:[2,13],36:[2,13],46:[2,13]},{5:[2,48],8:[2,48],11:[2,48],12:[2,48],13:[2,48],15:[2,48],17:[2,48],19:[2,48],20:[2,48],21:[2,48],22:[2,48],24:[2,48],25:[2,48],26:[2,48],27:[2,48],29:[2,48],31:[2,48],34:[2,48],36:[2,48],38:[2,48],44:[2,48],46:[2,48]},{7:91,30:15,32:14,39:23,40:[1,26],42:[1,24],43:9,45:[1,16],47:[1,18],48:10,49:[1,19],50:11,51:[1,20],52:12,53:[1,21],54:13,55:[1,22]},{5:[2,10],8:[2,10],11:[1,54],12:[1,55],13:[1,56],15:[2,10],17:[2,10],19:[2,10],20:[2,10],21:[2,10],22:[2,10],24:[2,10],25:[2,10],26:[2,10],27:[2,10],34:[2,10],36:[2,10],46:[2,10]},{5:[2,11],8:[2,11],11:[1,54],12:[1,55],13:[1,56],15:[2,11],17:[2,11],19:[2,11],20:[2,11],21:[2,11],22:[2,11],24:[2,11],25:[2,11],26:[2,11],27:[2,11],34:[2,11],36:[2,11],46:[2,11]},{5:[2,6],8:[2,6],11:[2,6],12:[2,6],13:[2,6],15:[2,6],17:[2,6],19:[2,6],20:[2,6],21:[2,6],22:[2,6],24:[2,6],25:[2,6],26:[2,6],27:[2,6],34:[2,6],36:[2,6],46:[2,6]},{5:[2,7],8:[2,7],11:[2,7],12:[2,7],13:[2,7],15:[2,7],17:[2,7],19:[2,7],20:[2,7],21:[2,7],22:[2,7],24:[2,7],25:[2,7],26:[2,7],27:[2,7],34:[2,7],36:[2,7],46:[2,7]},{5:[2,8],8:[2,8],11:[2,8],12:[2,8],13:[2,8],15:[2,8],17:[2,8],19:[2,8],20:[2,8],21:[2,8],22:[2,8],24:[2,8],25:[2,8],26:[2,8],27:[2,8],34:[2,8],36:[2,8],46:[2,8]},{5:[2,38],8:[2,38],11:[2,38],12:[2,38],13:[2,38],15:[2,38],17:[2,38],19:[2,38],20:[2,38],21:[2,38],22:[2,38],24:[2,38],25:[2,38],26:[2,38],27:[2,38],29:[2,38],31:[2,38],34:[2,38],36:[2,38],38:[2,38],41:[2,38],42:[2,38],44:[2,38],45:[2,38],46:[2,38]},{5:[2,39],8:[2,39],11:[2,39],12:[2,39],13:[2,39],15:[2,39],17:[2,39],19:[2,39],20:[2,39],21:[2,39],22:[2,39],24:[2,39],25:[2,39],26:[2,39],27:[2,39],29:[2,39],31:[2,39],34:[2,39],36:[2,39],38:[2,39],41:[2,39],42:[2,39],44:[2,39],45:[2,39],46:[2,39]},{5:[2,41],8:[2,41],11:[2,41],12:[2,41],13:[2,41],15:[2,41],17:[2,41],19:[2,41],20:[2,41],21:[2,41],22:[2,41],24:[2,41],25:[2,41],26:[2,41],27:[2,41],29:[2,41],31:[2,41],34:[2,41],36:[2,41],38:[2,41],41:[2,41],42:[2,41],44:[2,41],45:[2,41],46:[2,41]},{38:[2,34],44:[2,34],46:[2,34]}],defaultActions:{31:[2,1]},parseError:function(a,b){if(!b.recoverable)throw new Error(a);this.trace(a)},parse:function(a){function b(){var a;return a=c.lexer.lex()||m,"number"!=typeof a&&(a=c.symbols_[a]||a),a}var c=this,d=[0],e=[null],f=[],g=this.table,h="",i=0,j=0,k=0,l=2,m=1;this.lexer.setInput(a),this.lexer.yy=this.yy,this.yy.lexer=this.lexer,this.yy.parser=this,"undefined"==typeof this.lexer.yylloc&&(this.lexer.yylloc={});var n=this.lexer.yylloc;f.push(n);var o=this.lexer.options&&this.lexer.options.ranges;this.parseError="function"==typeof this.yy.parseError?this.yy.parseError:Object.getPrototypeOf(this).parseError;for(var p,q,r,s,t,u,v,w,x,y={};;){if(r=d[d.length-1],this.defaultActions[r]?s=this.defaultActions[r]:((null===p||"undefined"==typeof p)&&(p=b()),s=g[r]&&g[r][p]),"undefined"==typeof s||!s.length||!s[0]){var z="";x=[];for(u in g[r])this.terminals_[u]&&u>l&&x.push("'"+this.terminals_[u]+"'");z=this.lexer.showPosition?"Parse error on line "+(i+1)+":\n"+this.lexer.showPosition()+"\nExpecting "+x.join(", ")+", got '"+(this.terminals_[p]||p)+"'":"Parse error on line "+(i+1)+": Unexpected "+(p==m?"end of input":"'"+(this.terminals_[p]||p)+"'"),this.parseError(z,{text:this.lexer.match,token:this.terminals_[p]||p,line:this.lexer.yylineno,loc:n,expected:x})}if(s[0]instanceof Array&&s.length>1)throw new Error("Parse Error: multiple actions possible at state: "+r+", token: "+p);switch(s[0]){case 1:d.push(p),e.push(this.lexer.yytext),f.push(this.lexer.yylloc),d.push(s[1]),p=null,q?(p=q,q=null):(j=this.lexer.yyleng,h=this.lexer.yytext,i=this.lexer.yylineno,n=this.lexer.yylloc,k>0&&k--);break;case 2:if(v=this.productions_[s[1]][1],y.$=e[e.length-v],y._$={first_line:f[f.length-(v||1)].first_line,last_line:f[f.length-1].last_line,first_column:f[f.length-(v||1)].first_column,last_column:f[f.length-1].last_column},o&&(y._$.range=[f[f.length-(v||1)].range[0],f[f.length-1].range[1]]),t=this.performAction.call(y,h,j,i,this.yy,s[1],e,f),"undefined"!=typeof t)return t;v&&(d=d.slice(0,2*-1*v),e=e.slice(0,-1*v),f=f.slice(0,-1*v)),d.push(this.productions_[s[1]][0]),e.push(y.$),f.push(y._$),w=g[d[d.length-2]][d[d.length-1]],d.push(w);break;case 3:return!0}}return!0}},c=function(){var a={EOF:1,parseError:function(a,b){if(!this.yy.parser)throw new Error(a);this.yy.parser.parseError(a,b)},setInput:function(a){return this._input=a,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var a=this._input[0];this.yytext+=a,this.yyleng++,this.offset++,this.match+=a,this.matched+=a;var b=a.match(/(?:\r\n?|\n).*/g);return b?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),a},unput:function(a){var b=a.length,c=a.split(/(?:\r\n?|\n)/g);this._input=a+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-b-1),this.offset-=b;var d=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),c.length-1&&(this.yylineno-=c.length-1);var e=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:c?(c.length===d.length?this.yylloc.first_column:0)+d[d.length-c.length].length-c[0].length:this.yylloc.first_column-b},this.options.ranges&&(this.yylloc.range=[e[0],e[0]+this.yyleng-b]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},less:function(a){this.unput(this.match.slice(a))},pastInput:function(){var a=this.matched.substr(0,this.matched.length-this.match.length);return(a.length>20?"...":"")+a.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var a=this.match;return a.length<20&&(a+=this._input.substr(0,20-a.length)),(a.substr(0,20)+(a.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var a=this.pastInput(),b=new Array(a.length+1).join("-");return a+this.upcomingInput()+"\n"+b+"^"},test_match:function(a,b){var c,d,e;if(this.options.backtrack_lexer&&(e={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(e.yylloc.range=this.yylloc.range.slice(0))),d=a[0].match(/(?:\r\n?|\n).*/g),d&&(this.yylineno+=d.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:d?d[d.length-1].length-d[d.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+a[0].length},this.yytext+=a[0],this.match+=a[0],this.matches=a,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(a[0].length),this.matched+=a[0],c=this.performAction.call(this,this.yy,this,b,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),c)return c;
+if(this._backtrack){for(var f in e)this[f]=e[f];return!1}return!1},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0);var a,b,c,d;this._more||(this.yytext="",this.match="");for(var e=this._currentRules(),f=0;fb[0].length)){if(b=c,d=f,this.options.backtrack_lexer){if(a=this.test_match(c,e[f]),a!==!1)return a;if(this._backtrack){b=!1;continue}return!1}if(!this.options.flex)break}return b?(a=this.test_match(b,e[d]),a!==!1?a:!1):""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var a=this.next();return a?a:this.lex()},begin:function(a){this.conditionStack.push(a)},popState:function(){var a=this.conditionStack.length-1;return a>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(a){return a=this.conditionStack.length-1-Math.abs(a||0),a>=0?this.conditionStack[a]:"INITIAL"},pushState:function(a){this.begin(a)},stateStackSize:function(){return this.conditionStack.length},options:{},performAction:function(a,b,c,d){switch(c){case 0:return 29;case 1:return 31;case 2:return"from";case 3:return 24;case 4:return 25;case 5:return 21;case 6:return 19;case 7:return 22;case 8:return 20;case 9:return 26;case 10:return 27;case 11:return 34;case 12:return 36;case 13:return 55;case 14:return 53;case 15:break;case 16:return 49;case 17:return 47;case 18:return 47;case 19:return 40;case 20:return 51;case 21:return 41;case 22:return 11;case 23:return 12;case 24:return 13;case 25:return 38;case 26:return 8;case 27:return 26;case 28:return 27;case 29:return 24;case 30:return 24;case 31:return 25;case 32:return 25;case 33:return 21;case 34:return 22;case 35:return 20;case 36:return 19;case 37:return 34;case 38:return 36;case 39:return 15;case 40:return 17;case 41:return 45;case 42:return 44;case 43:return 42;case 44:return 46;case 45:return 9;case 46:return 5}},rules:[/^(?:\s+in\b)/,/^(?:\s+notIn\b)/,/^(?:\s+from\b)/,/^(?:\s+(eq|EQ)\b)/,/^(?:\s+(neq|NEQ)\b)/,/^(?:\s+(lte|LTE)\b)/,/^(?:\s+(lt|LT)\b)/,/^(?:\s+(gte|GTE)\b)/,/^(?:\s+(gt|GT)\b)/,/^(?:\s+(like|LIKE)\b)/,/^(?:\s+(notLike|NOT_LIKE)\b)/,/^(?:\s+(and|AND)\b)/,/^(?:\s+(or|OR)\b)/,/^(?:\s+null\b)/,/^(?:\s+(true|false)\b)/,/^(?:\s+)/,/^(?:-?[0-9]+(?:\.[0-9]+)?\b)/,/^(?:'[^']*')/,/^(?:"[^"]*")/,/^(?:([a-zA-Z_$][0-9a-zA-Z_$]*))/,/^(?:^\/((?![\s=])[^[\/\n\\]*(?:(?:\\[\s\S]|\[[^\]\n\\]*(?:\\[\s\S][^\]\n\\]*)*])[^[\/\n\\]*)*\/[imgy]{0,4})(?!\w))/,/^(?:\.)/,/^(?:\*)/,/^(?:\/)/,/^(?:\%)/,/^(?:,)/,/^(?:-)/,/^(?:=~)/,/^(?:!=~)/,/^(?:==)/,/^(?:===)/,/^(?:!=)/,/^(?:!==)/,/^(?:<=)/,/^(?:>=)/,/^(?:>)/,/^(?:<)/,/^(?:&&)/,/^(?:\|\|)/,/^(?:\+)/,/^(?:\^)/,/^(?:\()/,/^(?:\])/,/^(?:\[)/,/^(?:\))/,/^(?:!)/,/^(?:$)/],conditions:{INITIAL:{rules:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46],inclusive:!0}}};return a}();return b.lexer=c,a.prototype=b,b.Parser=a,new a}();"undefined"!=typeof a&&"undefined"!=typeof c&&(c.parser=e,c.Parser=e.Parser,c.parse=function(){return e.parse.apply(e,arguments)},c.main=function(b){b[1]||(console.log("Usage: "+b[0]+" FILE"),d.exit(1));var e=a("fs").readFileSync(a("path").normalize(b[1]),"utf8");return c.parser.parse(e)},"undefined"!=typeof b&&a.main===b&&c.main(d.argv.slice(1)))},{__browserify_process:51,fs:48,path:49}],31:[function(a,b,c){!function(){"use strict";var b=a("./constraint/parser"),d=a("./nools/nool.parser");c.parseConstraint=function(a){try{return b.parse(a)}catch(c){throw new Error("Invalid expression '"+a+"'")}},c.parseRuleSet=function(a,b){return d.parse(a,b)}}()},{"./constraint/parser":30,"./nools/nool.parser":32}],32:[function(a,b,c){"use strict";var d=a("./tokens.js"),e=a("../../extended"),f=e.hash.keys,g=a("./util.js"),h=function(a,b,c){var d=a;a=a.replace(/\/\/(.*)[\n|\r|\r\n]/g,"").replace(/\n|\r|\r\n/g," ");for(var e,i=new RegExp("^("+f(b).join("|")+")");a&&-1!==(e=g.findNextTokenIndex(a));){a=a.substr(e);var j=a.match(i);if(null===j)throw new Error("Error parsing "+a);if(j=j[1],!(j in b))throw new Error("Unknown token"+j);try{a=b[j](a,c,h).replace(/^\s*|\s*$/g,"")}catch(k){throw new Error("Invalid "+j+" definition \n"+k.message+"; \nstarting at : "+d)}}};c.parse=function(a,b){var c={define:[],rules:[],scope:[],loaded:[],file:b};return h(a,d,c),c}},{"../../extended":11,"./tokens.js":33,"./util.js":34}],33:[function(require,module,exports){var process=require("__browserify_process"),utils=require("./util.js"),fs=require("fs"),indexOf=require("../../extended").indexOf,isWhiteSpace=function(a){return 0===a.replace(/[\s|\n|\r|\t]/g,"").length},ruleTokens={salience:function(){var a=/^(salience|priority)\s*:\s*(-?\d+)\s*[,;]?/;return function(b,c){if(a.test(b)){var d=b.match(a),e=parseInt(d[2],10);if(isNaN(e))throw new Error("Invalid salience/priority "+d[2]);return c.options.priority=e,b.replace(d[0],"")}throw new Error("invalid format")}}(),agendaGroup:function(){var a=/^(agenda-group|agendaGroup)\s*:\s*([a-zA-Z_$][0-9a-zA-Z_$]*|"[^"]*"|'[^']*')\s*[,;]?/;return function(b,c){if(a.test(b)){var d=b.match(a),e=d[2];if(!e)throw new Error("Invalid agenda-group "+d[2]);return c.options.agendaGroup=e.replace(/^["']|["']$/g,""),b.replace(d[0],"")}throw new Error("invalid format")}}(),autoFocus:function(){var a=/^(auto-focus|autoFocus)\s*:\s*(true|false)\s*[,;]?/;return function(b,c){if(a.test(b)){var d=b.match(a),e=d[2];if(!e)throw new Error("Invalid auto-focus "+d[2]);return c.options.autoFocus="true"===e?!0:!1,b.replace(d[0],"")}throw new Error("invalid format")}}(),"agenda-group":function(){return this.agendaGroup.apply(this,arguments)},"auto-focus":function(){return this.autoFocus.apply(this,arguments)},priority:function(){return this.salience.apply(this,arguments)},when:function(){var ruleRegExp=/^(\$?\w+) *: *(\w+)(.*)/,joinFunc=function(a,b){return"; "+b},constraintRegExp=/(\{ *(?:["']?\$?\w+["']?\s*:\s*["']?\$?\w+["']? *(?:, *["']?\$?\w+["']?\s*:\s*["']?\$?\w+["']?)*)+ *\})/,predicateExp=/^(\w+) *\((.*)\)$/m,parseRules=function(str){for(var rules=[],ruleLines=str.split(";"),l=ruleLines.length,ruleLine,i=0;l>i&&(ruleLine=ruleLines[i].replace(/^\s*|\s*$/g,"").replace(/\n/g,""));i++)if(!isWhiteSpace(ruleLine)){var rule=[];if(predicateExp.test(ruleLine)){var m=ruleLine.match(predicateExp),pred=m[1].replace(/^\s*|\s*$/g,"");if(rule.push(pred),ruleLine=m[2].replace(/^\s*|\s*$/g,""),"or"===pred){rule=rule.concat(parseRules(ruleLine.replace(/,\s*(\$?\w+\s*:)/g,joinFunc))),rules.push(rule);continue}}var parts=ruleLine.match(ruleRegExp);if(!parts||!parts.length)throw new Error("Invalid constraint "+ruleLine);rule.push(parts[2],parts[1]);var constraints=parts[3].replace(/^\s*|\s*$/g,""),hashParts=constraints.match(constraintRegExp);if(hashParts){var hash=hashParts[1],constraint=constraints.replace(hash,"");constraint&&rule.push(constraint.replace(/^\s*|\s*$/g,"")),hash&&rule.push(eval("("+hash.replace(/(\$?\w+)\s*:\s*(\$?\w+)/g,'"$1" : "$2"')+")"))}else constraints&&!isWhiteSpace(constraints)&&rule.push(constraints);rules.push(rule)}return rules};return function(a,b){var c=a.replace(/^when\s*/,"").replace(/^\s*|\s*$/g,"");if("{"===utils.findNextToken(c)){var d=utils.getTokensBetween(c,"{","}",!0).join("");return c=c.replace(d,""),b.constraints=parseRules(d.replace(/^\{\s*|\}\s*$/g,"")),c}throw new Error("unexpected token : expected : '{' found : '"+utils.findNextToken(c)+"'")}}(),then:function(){return function(a,b){if(b.action)throw new Error("action already defined for rule"+b.name);var c=a.replace(/^then\s*/,"").replace(/^\s*|\s*$/g,"");if("{"===utils.findNextToken(c)){var d=utils.getTokensBetween(c,"{","}",!0).join("");if(c=c.replace(d,""),b.action||(b.action=d.replace(/^\{\s*|\}\s*$/g,"")),!isWhiteSpace(c))throw new Error("Error parsing then block "+a);return c}throw new Error("unexpected token : expected : '{' found : '"+utils.findNextToken(c)+"'")}}()},topLevelTokens={"/":function(a){return a.match(/^\/\*/)?a.replace(/\/\*.*?\*\//,""):a},define:function(a,b){var c=a.replace(/^define\s*/,""),d=c.match(/^([a-zA-Z_$][0-9a-zA-Z_$]*)/);if(d){if(c=c.replace(d[0],"").replace(/^\s*|\s*$/g,""),"{"===utils.findNextToken(c)){d=d[1];var e=utils.getTokensBetween(c,"{","}",!0).join("");return c=c.replace(e,""),b.define.push({name:d,properties:"("+e+")"}),c}throw new Error("unexpected token : expected : '{' found : '"+utils.findNextToken(c)+"'")}throw new Error("missing name")},"import":function(a,b,c){if("undefined"!=typeof window)throw new Error("import cannot be used in a browser");var d=a.replace(/^import\s*/,"");if("("===utils.findNextToken(d)){var e=utils.getParamList(d);if(d=d.replace(e,"").replace(/^\s*|\s*$/g,""),";"===utils.findNextToken(d)&&(d=d.replace(/\s*;/,"")),e=e.replace(/[\(|\)]/g,"").split(","),1===e.length){if(e=utils.resolve(b.file||process.cwd(),e[0].replace(/["|']/g,"")),-1===indexOf(b.loaded,e)){var f=b.file;b.file=e,c(fs.readFileSync(e,"utf8"),topLevelTokens,b),b.loaded.push(e),b.file=f}return d}throw new Error("import accepts a single file")}throw new Error("unexpected token : expected : '(' found : '"+utils.findNextToken(d)+"'")},global:function(a,b){var c=a.replace(/^global\s*/,""),d=c.match(/^([a-zA-Z_$][0-9a-zA-Z_$]*\s*)/);if(d){if(c=c.replace(d[0],"").replace(/^\s*|\s*$/g,""),"="===utils.findNextToken(c)){d=d[1].replace(/^\s+|\s+$/g,"");var e=utils.getTokensBetween(c,"=",";",!0).join(""),f=e.substring(1,e.length-1);if(f=f.replace(/^\s+|\s+$/g,""),/^require\(/.test(f)){var g=utils.getParamList(f.replace("require")).replace(/[\(|\)]/g,"").split(",");1===g.length&&(g=g[0].replace(/["|']/g,""),f=["require('",utils.resolve(b.file||process.cwd(),g),"')"].join(""))}return b.scope.push({name:d,body:f}),c=c.replace(e,"")}throw new Error("unexpected token : expected : '=' found : '"+utils.findNextToken(c)+"'")}throw new Error("missing name")},"function":function(a,b){var c=a.replace(/^function\s*/,""),d=c.match(/^([a-zA-Z_$][0-9a-zA-Z_$]*)\s*/);if(d){if(c=c.replace(d[0],""),"("===utils.findNextToken(c)){d=d[1];var e=utils.getParamList(c);if(c=c.replace(e,"").replace(/^\s*|\s*$/g,""),"{"===utils.findNextToken(c)){var f=utils.getTokensBetween(c,"{","}",!0).join("");return c=c.replace(f,""),b.scope.push({name:d,body:"function"+e+f}),c}throw new Error("unexpected token : expected : '{' found : '"+utils.findNextToken(c)+"'")}throw new Error("unexpected token : expected : '(' found : '"+utils.findNextToken(c)+"'")}throw new Error("missing name")},rule:function(a,b,c){var d=a.replace(/^rule\s*/,""),e=d.match(/^([a-zA-Z_$][0-9a-zA-Z_$]*|"[^"]*"|'[^']*')/);if(e){if(d=d.replace(e[0],"").replace(/^\s*|\s*$/g,""),"{"===utils.findNextToken(d)){e=e[1].replace(/^["']|["']$/g,"");var f={name:e,options:{},constraints:null,action:null},g=utils.getTokensBetween(d,"{","}",!0).join("");return d=d.replace(g,""),c(g.replace(/^\{\s*|\}\s*$/g,""),ruleTokens,f),b.rules.push(f),d}throw new Error("unexpected token : expected : '{' found : '"+utils.findNextToken(d)+"'")}throw new Error("missing name")}};module.exports=topLevelTokens},{"../../extended":11,"./util.js":34,__browserify_process:51,fs:48}],34:[function(a,b,c){var d=a("__browserify_process"),e=a("path"),f=/[\s|\n|\r|\t]/,g=e.sep||("win32"===d.platform?"\\":"/"),h={"{":"}","}":"{","(":")",")":"(","[":"]"},i=c.getTokensBetween=function(a,b,c,d){var e=0,f=[];b||(b=h[c],e=1),c||(c=h[b]),a=Object(a);for(var g,i=!1,j=0,k=!1;g=a.charAt(j++);)if(g===b)e++,i?f.push(g):(i=!0,d&&f.push(g));else if(g===c&&j){if(e--,0===e){d&&f.push(g),k=!0;break}f.push(g)}else i&&f.push(g);if(!k)throw new Error("Unable to match "+b+" in "+a);return f};c.getParamList=function(a){return i(a,"(",")",!0).join("")},c.resolve=function(a,b){return""!==e.extname(a)&&(a=e.dirname(a)),1===b.split(g).length?b:e.resolve(a,b)};var j=c.findNextTokenIndex=function(a,b,c){b=b||0,c=c||a.length;var d=-1,e=a.length;for((!c||c>e)&&(c=e);c>b;b++){var g=a.charAt(b);if(!f.test(g)){d=b;break}}return d};c.findNextToken=function(a,b,c){return a.charAt(j(a,b,c))}},{__browserify_process:51,path:49}],35:[function(a,b,c){!function(){"use strict";var b=a("./extended"),d=b.merge,e=b.forEach,f=b.declare,g=a("./constraintMatcher"),h=a("./constraint"),i=f({}),j=i.extend({instance:{constructor:function(a,c,f,i,j){j=j||{},this.type=a,this.alias=c,this.conditions=f,this.pattern=j.pattern,this.constraints=[new h.ObjectConstraint(a)];var k=g.toConstraints(f,d({alias:c},j));if(k.length)this.constraints=this.constraints.concat(k);else{var l=new h.TrueConstraint;this.constraints.push(l)}if(i&&!b.isEmpty(i)){var m=new h.HashConstraint(i);this.constraints.push(m)}e(this.constraints,function(a){a.set("alias",c)})},hasConstraint:function(a){return b.some(this.constraints,function(b){return b instanceof a})},hashCode:function(){return[this.type,this.alias,b.format("%j",this.conditions)].join(":")},toString:function(){return b.format("%j",this.constraints)}}}).as(c,"ObjectPattern");j.extend().as(c,"NotPattern"),i.extend({instance:{constructor:function(a,b){this.leftPattern=a,this.rightPattern=b},hashCode:function(){return[this.leftPattern.hashCode(),this.rightPattern.hashCode()].join(":")},getters:{constraints:function(){return this.leftPattern.constraints.concat(this.rightPattern.constraints)}}}}).as(c,"CompositePattern");var k=f({}).as(c,"InitialFact");j.extend({instance:{constructor:function(){this._super([k,"i",[],{}])},assert:function(){return!0}}}).as(c,"InitialFactPattern")}()},{"./constraint":7,"./constraintMatcher":8,"./extended":11}],36:[function(a,b,c){"use strict";function d(a,b,c,d){e.isArray(b)?(d=c,c=b):b=b||{};var g=e.every(c,function(a){return f(a)});g&&1===c.length&&(c=c[0],g=!1);var h=[],i=b.scope||{};if(c.scope=i,g){for(var j,k=function(a,b){n[b]?e(n).forEach(function(b){b.push(a)}):(n[b]=0===b?[]:n[b-1].slice(),0!==b&&n[b].pop(),n[b].push(a))},l=c.length,n=[],o=0;l>o;o++)j=c[o],j.scope=i,e.forEach(p(j),k);h=e.map(n,function(c){for(var e=null,f=0;f>>0;if(0===d)return-1;var e=d;arguments.length>2&&(e=Number(arguments[2]),e!==e?e=0:0!==e&&e!==1/0&&e!==-(1/0)&&(e=(e>0||-1)*P(Q(e))));for(var f=e>=0?R(e,d-1):d-Q(e);f>=0;f--)if(f in c&&c[f]===b)return f;return-1}function i(a,b,c){if(a&&X&&X===a.filter)return a.filter(b,c);if(!N(a)||"function"!=typeof b)throw new TypeError;for(var d=Object(a),e=d.length>>>0,f=[],g=0;e>g;g++)if(g in d){var h=d[g];b.call(c,h,g,d)&&f.push(h)}return f}function j(a,b,c){if(!N(a)||"function"!=typeof b)throw new TypeError;if(a&&T&&T===a.forEach)return a.forEach(b,c),a;for(var d=0,e=a.length;e>d;++d)b.call(c||a,a[d],d,a);return a}function k(a,b,c){if(a&&Y&&Y===a.every)return a.every(b,c);if(!N(a)||"function"!=typeof b)throw new TypeError;for(var d=Object(a),e=d.length>>>0,f=0;e>f;f++)if(f in d&&!b.call(c,d[f],f,d))return!1;return!0}function l(a,b,c){if(a&&Z&&Z===a.some)return a.some(b,c);if(!N(a)||"function"!=typeof b)throw new TypeError;for(var d=Object(a),e=d.length>>>0,f=0;e>f;f++)if(f in d&&b.call(c,d[f],f,d))return!0;return!1}function m(a,b,c){if(a&&U&&U===a.map)return a.map(b,c);if(!N(a)||"function"!=typeof b)throw new TypeError;for(var d=Object(a),e=d.length>>>0,f=[],g=0;e>g;g++)g in d&&f.push(b.call(c,d[g],g,d));return f}function n(a,b,c){var d=arguments.length>2;if(a&&V&&V===a.reduce)return d?a.reduce(b,c):a.reduce(b);if(!N(a)||"function"!=typeof b)throw new TypeError;var e=0,f=a.length>>0;if(arguments.length<3){if(0===f)throw new TypeError("Array length is 0 and no second argument");c=a[0],e=1}else c=arguments[2];for(;f>e;)e in a&&(c=b.call(void 0,c,a[e],e,a)),++e;return c}function o(a,b,c){var d=arguments.length>2;if(a&&W&&W===a.reduceRight)return d?a.reduceRight(b,c):a.reduceRight(b);if(!N(a)||"function"!=typeof b)throw new TypeError;var e=Object(a),f=e.length>>>0;if(0===f&&2===arguments.length)throw new TypeError;var g=f-1;if(arguments.length>=3)c=arguments[2];else for(;;)if(g in a){c=a[g--];break}for(;g>=0;)g in e&&(c=b.call(void 0,c,e[g],g,e)),g--;return c}function p(a){var c=[];if(null!==a){var d=$(arguments);if(1===d.length)if(N(a))c=a;else if(b.isHash(a))for(var e in a)a.hasOwnProperty(e)&&c.push([e,a[e]]);else c.push(a);else j(d,function(a){c=c.concat(p(a))})}return c}function q(a){return a=a||[],a.length?n(a,function(a,b){return a+b}):0}function r(a){if(a=a||[],a.length){var c=q(a);if(b.isNumber(c))return c/a.length;throw new Error("Cannot average an array of non numbers.")}return 0}function s(a,b){return _(a,b)}function t(a,b){return _(a,b)[0]}function u(a,b){return _(a,b)[a.length-1]}function v(a){var b=a,c=J($(arguments,1));return N(a)&&(b=i(a,function(a){return-1===g(c,a)})),b}function w(a){var b,c=[],d=-1,e=0;if(a)for(b=a.length;++d0?(c.push(c.shift()),b--):(c.unshift(c.pop()),b++),y(c,b)):c}function z(a,b){var c=[];if(N(a)){var d=a.slice(0);"number"!=typeof b&&(b=a.length),b?b<=a.length&&(c=n(a,function(a,c,f){var g;return g=b>1?e(c,y(d,f).slice(1),b):[[c]],a.concat(g)},[])):c=[[]]}return c}function A(){var a=[],c=$(arguments);if(c.length>1){var d=c.shift();N(d)&&(a=n(d,function(a,d,e){for(var f=[d],g=0;gd;d++)c.push(a[b[d]]||null);return c}function D(){var a=[],b=$(arguments);if(b.length>1){for(var c=0,d=b.length;d>c;c++)a=a.concat(b[c]);a=w(a)}return a}function E(){var a,b,c=[],d=-1;if(a=arguments.length>1?$(arguments):arguments[0],N(a))for(c=a[0],d=0,b=a.length;++d1?c:p(a),n(b,function(a,b){return a.concat(b)},[])}function K(a,b){b=b.split(".");var c=a.slice(0);return j(b,function(a){var b=a.match(/(\w+)\(\)$/);c=m(c,function(c){return b?c[b[1]]():c[a]})}),c}function L(a,b,c){return c=$(arguments,2),m(a,function(a){var d=M(b)?a[b]:b;return d.apply(a,c)})}var M=b.isString,N=Array.isArray||b.isArray,O=b.isDate,P=Math.floor,Q=Math.abs,R=(Math.max,Math.min),S=Array.prototype,T=(S.indexOf,S.forEach),U=S.map,V=S.reduce,W=S.reduceRight,X=S.filter,Y=S.every,Z=S.some,$=c.argsToArray,_=function(){var a=function(a,b){return k(a,b)},b=function(a,b){return a-b},c=function(a,b){return a.getTime()-b.getTime()};return function(d,e){var f=[];return N(d)&&(f=d.slice(),e?"function"==typeof e?f.sort(e):f.sort(function(a,b){var c=a[e],d=b[e];return M(c)&&M(d)?c>d?1:d>c?-1:0:O(c)&&O(d)?c.getTime()-d.getTime():c-d}):a(f,M)?f.sort():a(f,O)?f.sort(c):f.sort(b)),f}}(),ab={toArray:p,sum:q,avg:r,sort:s,min:t,max:u,difference:v,removeDuplicates:w,unique:x,rotate:y,permutations:z,zip:A,transpose:B,valuesAt:C,union:D,intersect:E,powerSet:F,cartesian:G,compact:H,multiply:I,flatten:J,pluck:K,invoke:L,forEach:j,map:m,filter:i,reduce:n,reduceRight:o,some:l,every:k,indexOf:g,lastIndexOf:h};return a.define(N,ab).expose(ab)}"undefined"!=typeof c?"undefined"!=typeof b&&b.exports&&(b.exports=d(a("extended"),a("is-extended"),a("arguments-extended"))):"function"==typeof define&&define.amd?define(["extended","is-extended","arguments-extended"],function(a,b,c){return d(a,b,c)}):this.arrayExtended=d(this.extended,this.isExtended,this.argumentsExtended)}.call(this)},{"arguments-extended":38,extended:43,"is-extended":53}],40:[function(a,b,c){!function(){"use strict";function d(a,b,c){function d(a,b,c,d){a=""+a,c=c||" ";for(var e=a.length;b>e;)d?a+=c:a=c+a,e++;return a}function e(a,c,d){var f=a;if(b.isString(f)){if(a.length>c)if(d){var g=a.length;f=a.substring(g-c,g)}else f=a.substring(0,c)}else f=e(""+f,c);return f}function f(a,c,d){if(!b.isArray(a)||"function"!=typeof c)throw new TypeError;for(var e=Object(a),f=e.length>>>0,g=0;f>g;g++)if(g in e&&!c.call(d,e[g],g,e))return!1;return!0}function g(a,b){return A.difference(new Date(a.getFullYear(),0,1,a.getHours()),a,null,b)+1}function h(a,b,c){b=b||0;var d=a[c?"getUTCFullYear":"getFullYear"](),e=new Date(d,0,1).getDay(),f=(e-b+7)%7,h=o((g(a)+f-1)/7);return e===b&&h++,h}function i(a){var b=a.toString(),c="",d=b.indexOf("(");return d>-1&&(c=b.substring(++d,b.indexOf(")"))),c}function j(a,b){return a.replace(/([a-z])\1*/gi,function(a){var c,d=a.charAt(0),e=a.length,f="0?",g="0{0,2}";if("y"===d)c="\\d{2,4}";else if("M"===d)c=e>2?"\\S+?":"1[0-2]|"+f+"[1-9]";else if("D"===d)c="[12][0-9][0-9]|3[0-5][0-9]|36[0-6]|"+g+"[1-9][0-9]|"+f+"[1-9]";else if("d"===d)c="3[01]|[12]\\d|"+f+"[1-9]";else if("w"===d)c="[1-4][0-9]|5[0-3]|"+f+"[1-9]";else if("E"===d)c="\\S+";else if("h"===d)c="1[0-2]|"+f+"[1-9]";else if("K"===d)c="1[01]|"+f+"\\d";else if("H"===d)c="1\\d|2[0-3]|"+f+"\\d";else if("k"===d)c="1\\d|2[0-4]|"+f+"[1-9]";else if("m"===d||"s"===d)c="[0-5]\\d";else if("S"===d)c="\\d{"+e+"}";else if("a"===d){var h="AM",i="PM";c=h+"|"+i,h!==h.toLowerCase()&&(c+="|"+h.toLowerCase()),i!==i.toLowerCase()&&(c+="|"+i.toLowerCase()),c=c.replace(/\./g,"\\.")}else c="v"===d||"z"===d||"Z"===d||"G"===d||"q"===d||"Q"===d?".*":" "===d?"\\s*":d+"*";return b&&b.push(a),"("+c+")"}).replace(/[\xa0 ]/g,"[\\s\\xa0]")}function k(a){B[a+"sFromNow"]=function(b){return A.add(new Date,a,b)},B[a+"sAgo"]=function(b){return A.add(new Date,a,-b)}}for(var l=function(){function a(a,b,c){return a=a.replace(/s$/,""),e.hasOwnProperty(a)?e[a](b,c):[c,"UTC"+a.charAt(0).toUpperCase()+a.substring(1)+"s",!1]}function b(a,b,c,e){return a=a.replace(/s$/,""),d(f[a](b,c,e))}var c=Math.floor,d=Math.round,e={day:function(a,b){return[b,"Date",!1]},weekday:function(a,b){var c,d,e=b%5,f=a.getDay(),g=0;e?(c=e,d=parseInt(b/5,10)):(c=b>0?5:-5,d=b>0?(b-5)/5:(b+5)/5),6===f&&b>0?g=1:0===f&&0>b&&(g=-1);var h=f+c;return(0===h||6===h)&&(g=b>0?2:-2),[7*d+c+g,"Date",!1]},year:function(a,b){return[b,"FullYear",!0]},week:function(a,b){return[7*b,"Date",!1]},quarter:function(a,b){return[3*b,"Month",!0]},month:function(a,b){return[b,"Month",!0]}},f={quarter:function(a,b,d){var e=b.getFullYear()-a.getFullYear(),f=a[d?"getUTCMonth":"getMonth"](),g=b[d?"getUTCMonth":"getMonth"](),h=c(f/3)+1,i=c(g/3)+1;return i+=4*e,i-h},weekday:function(a,c,d){var e,f=b("day",a,c,d),g=f%7;if(0===g)f=5*b("week",a,c,d);else{var h=0,i=a[d?"getUTCDay":"getDay"](),j=c[d?"getUTCDay":"getDay"]();e=parseInt(f/7,10);var k=new Date(+a);k.setDate(k[d?"getUTCDate":"getDate"]()+7*e);var l=k[d?"getUTCDay":"getDay"]();f>0?6===i||6===j?h=-1:0===i?h=0:(0===j||l+g>5)&&(h=-2):0>f&&(6===i?h=0:0===i||0===j?h=1:(6===j||0>l+g)&&(h=2)),f+=h,f-=2*e}return f},year:function(a,b){return b.getFullYear()-a.getFullYear()},month:function(a,b,c){var d=a[c?"getUTCMonth":"getMonth"](),e=b[c?"getUTCMonth":"getMonth"]();return e-d+12*(b.getFullYear()-a.getFullYear())},week:function(a,c,e){return d(b("day",a,c,e)/7)},day:function(a,b){return 1.1574074074074074e-8*(b.getTime()-a.getTime())},hour:function(a,b){return 2.7777777777777776e-7*(b.getTime()-a.getTime())},minute:function(a,b){return 16666666666666667e-21*(b.getTime()-a.getTime())},second:function(a,b){return.001*(b.getTime()-a.getTime())},millisecond:function(a,b){return b.getTime()-a.getTime()}};return{addTransform:a,differenceTransform:b}}(),m=l.addTransform,n=l.differenceTransform,o=Math.floor,p=Math.round,q=Math.min,r=Math.pow,s=Math.ceil,t=Math.abs,u=["January","February","March","April","May","June","July","August","September","October","November","December"],v=["Jan.","Feb.","Mar.","Apr.","May.","Jun.","Jul.","Aug.","Sep.","Oct.","Nov.","Dec."],w=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],x=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],y=["Before Christ","Anno Domini"],z=["BC","AD"],A={getDaysInMonth:function(a){var b=a.getMonth(),c=[31,28,31,30,31,30,31,31,30,31,30,31];return 1===b&&A.isLeapYear(a)?29:c[b]},isLeapYear:function(a,b){var c=a[b?"getUTCFullYear":"getFullYear"]();return 0===c%400||0===c%4&&0!==c%100},isWeekend:function(a,b){var c=(a||new Date)[b?"getUTCDay":"getDay"]();return 0===c||6===c},getTimezoneName:i,compare:function(a,b,c){return a=new Date(+a),b=new Date(+(b||new Date)),"date"===c?(a.setHours(0,0,0,0),b.setHours(0,0,0,0)):"time"===c&&(a.setFullYear(0,0,0),b.setFullYear(0,0,0)),a>b?1:b>a?-1:0},add:function(a,b,c){var d=m(b,a,c||0);c=d[0];var e=d[1],f=new Date(+a),g=d[2];return e&&f["set"+e](f["get"+e]()+c),g&&f.getDate()E?z:y)[0>f?0:1];else if("y"===D)B=f,E>1&&(2===E?B=e(""+B,2,!0):C=!0);else if("Q"===D.toUpperCase())B=s((j+1)/3),C=!0;else if("M"===D)3>E?(B=j+1,C=!0):B=(3===E?v:u)[j];else if("w"===D)B=h(a,0,c),C=!0;else if("D"===D)B=g(a,c),C=!0;else if("E"===D)3>E?(B=k+1,C=!0):B=(-3===E?x:w)[k];else if("a"===D)B=12>m?"AM":"PM";else if("h"===D)B=m%12||12,C=!0;else if("K"===D)B=m%12,C=!0;else if("k"===D)B=m||24,C=!0;else if("S"===D)B=p(A*r(10,E-3)),C=!0;else if("z"===D||"v"===D||"Z"===D){if(B=i(a),"z"!==D&&"v"!==D||B||(E=4),!B||"Z"===D){var F=a.getTimezoneOffset(),G=[F>=0?"-":"+",d(o(t(F)/60),2,"0"),d(t(F)%60,2,"0")];4===E&&(G.splice(0,0,"GMT"),G.splice(3,0,":")),B=G.join("")}}else B=b;else B=""+n,C=!0;else B=""+m,C=!0;return C&&(B=d(B,E,"0")),B})}},B={},C=["year","month","day","hour","minute","second"],D=0,E=C.length;E>D;D++)k(C[D]);var F={parseDate:function(a,b){if(!b)throw new Error("format required when calling dateExtender.parse");var d=[],e=j(b,d),g=new RegExp("^"+e+"$","i"),h=g.exec(a);if(!h)return null;var i=[1970,0,1,0,0,0,0],k="",l=f(h,function(a,b){if(b){var e=d[b-1],f=e.length,g=e.charAt(0);if("y"===g)if(100>a){a=parseInt(a,10);var h=""+(new Date).getFullYear(),j=100*h.substring(0,2),l=q(h.substring(2,4)+20,99);i[0]=l>a?j+a:j-100+a}else i[0]=a;else if("M"===g){if(f>2){var m,n,o=u;3===f&&(o=v),a=a.replace(".","").toLowerCase();var p=!1;for(m=0,n=o.length;n>m&&!p;m++){var r=o[m].replace(".","").toLocaleLowerCase();r===a&&(a=m,p=!0)}if(!p)return!1}else a--;i[1]=a}else if("E"===g||"e"===g){var s=w;3===f&&(s=x),a=a.toLowerCase(),s=c.map(s,function(a){return a.toLowerCase()});var t=c.indexOf(s,a);if(-1===t){if(a=parseInt(a,10),isNaN(a)||a>s.length)return!1}else a=t}else if("D"===g||"d"===g)"D"===g&&(i[1]=0),i[2]=a;else if("a"===g){var y="am",z="pm",A=/\./g;a=a.replace(A,"").toLowerCase(),k=a===z?"p":a===y?"a":""}else"k"===g||"h"===g||"H"===g||"K"===g?("k"===g&&24===+a&&(a=0),i[3]=a):"m"===g?i[4]=a:"s"===g?i[5]=a:"S"===g&&(i[6]=a)}return!0});if(l){var m=+i[3];"p"===k&&12>m?i[3]=m+12:"a"===k&&12===m&&(i[3]=0);var n=new Date(i[0],i[1],i[2],i[3],i[4],i[5],i[6]),o=-1!==c.indexOf(d,"d"),p=-1!==c.indexOf(d,"M"),r=i[1],s=i[2],t=n.getMonth(),y=n.getDate();return p&&t>r||o&&y>s?null:n}return null}},G=a.define(b.isDate,A).define(b.isString,F).define(b.isNumber,B);for(D in A)A.hasOwnProperty(D)&&(G[D]=A[D]);for(D in F)F.hasOwnProperty(D)&&(G[D]=F[D]);for(D in B)B.hasOwnProperty(D)&&(G[D]=B[D]);return G}"undefined"!=typeof c?"undefined"!=typeof b&&b.exports&&(b.exports=d(a("extended"),a("is-extended"),a("array-extended"))):"function"==typeof define&&define.amd?define(["extended","is-extended","array-extended"],function(a,b,c){return d(a,b,c)}):this.dateExtended=d(this.extended,this.isExtended,this.arrayExtended)}.call(this)},{"array-extended":39,extended:43,"is-extended":53}],41:[function(a,b,c){!function(){function a(){function a(a,b){return b=b||0,x.call(a,b)
+}function b(a){return"[object Array]"===Object.prototype.toString.call(a)}function c(a){var b;return null!==a&&a!==b&&"object"==typeof a}function d(a){var b=c(a);return b&&a.constructor===Object}function e(a,b){if(a&&a.length)for(var c=0,d=a.length;d>c;c++)if(a[c]===b)return c;return-1}function f(a,b,c){var d,f;for(d in b)b.hasOwnProperty(d)&&-1===e(c,d)&&(f=b[d],d in a&&a[d]===f||(a[d]=f));return a}function g(a){var c=this.__meta,d=c.supers,e=d.length,f=c.superMeta,g=f.pos;if(e>g){a=a?B(a)||b(a)?a:[a]:[];var h,i=f.name,j=f.f;do if(h=d[g][i],"function"==typeof h&&(h=h._f||h)!==j)return f.pos=1+g,h.apply(this,a);while(e>++g)}return null}function h(){var a=this.__meta,b=a.supers,c=b.length,d=a.superMeta,e=d.pos;if(c>e){var f,g=d.name,h=d.f;do if(f=b[e][g],"function"==typeof f&&(f=f._f||f)!==h)return d.pos=1+e,f.bind(this);while(c>++e)}return null}function i(a){var b=this.__getters__;return b.hasOwnProperty(a)?b[a].apply(this):this[a]}function j(b,c){var e=this.__setters__;if(!d(b))return e.hasOwnProperty(b)?e[b].apply(this,a(arguments,1)):this[b]=c;for(var f in b){var g=b[f];e.hasOwnProperty(f)?e[b].call(this,g):this[f]=g}}function k(){var a=this.__meta||{},b=a.supers,c=b.length,d=a.superMeta,e=d.pos;if(c>e){var f,g=d.name,h=d.f;do if(f=b[e][g],"function"==typeof f&&(f=f._f||f)!==h)return d.pos=1+e,f.apply(this,arguments);while(c>++e)}return null}function l(a,b){if(a.toString().match(A)){var c=function(){var c,d=this.__meta||{},e=d.superMeta;switch(d.superMeta={f:a,pos:0,name:b},arguments.length){case 0:c=a.call(this);break;case 1:c=a.call(this,arguments[0]);break;case 2:c=a.call(this,arguments[0],arguments[1]);break;case 3:c=a.call(this,arguments[0],arguments[1],arguments[2]);break;default:c=a.apply(this,arguments)}return d.superMeta=e,c};return c._f=a,c}return a._f=a,a}function m(a,b){var c=b.setters||{},d=a.__setters__,e=a.__getters__;for(var f in c)d.hasOwnProperty(f)||(d[f]=c[f]);c=b.getters||{};for(f in c)e.hasOwnProperty(f)||(e[f]=c[f]);for(var g in b)if("getters"!==g&&"setters"!==g){var h=b[g];"function"==typeof h?a.hasOwnProperty(g)||(a[g]=l(k,g)):a[g]=h}}function n(){for(var b=a(arguments),c=b.length,d=this.prototype,e=d.__meta,f=this.__meta,g=d.__meta.bases,h=g.slice(),i=f.supers||[],j=e.supers||[],k=0;c>k;k++){var l=b[k],n=l.prototype,p=n.__meta,q=l.__meta;!p&&(p=n.__meta={proto:n||{}}),!q&&(q=l.__meta={proto:l.__proto__||{}}),m(d,p.proto||{}),m(this,q.proto||{}),o(l.prototype,j,g),o(l,i,h)}return this}function o(a,b,c){var d=a.__meta;!d&&(d=a.__meta={});var f=a.__meta.unique;if(!f&&(d.unique="declare"+ ++y),-1===e(c,f)){c.push(f);for(var g=a.__meta.supers||[],h=g.length-1||0;h>=0;)o(g[h--],b,c);b.unshift(a)}}function p(a,b){var c=b.setters,d=a.__setters__,e=a.__getters__;if(c)for(var f in c)d[f]=c[f];if(c=b.getters||{})for(f in c)e[f]=c[f];for(f in b)if("getters"!=f&&"setters"!=f){var g=b[f];if("function"==typeof g){var h=g.__meta||{};a[f]=h.isConstructor?g:l(g,f)}else a[f]=g}}function q(a,b){return a&&b?a[b]=this:a.exports=a=this,this}function r(a){return u(this,a)}function s(a){z.prototype=a.prototype;var b=new z;return z.prototype=null,b}function t(a,c,e){var i={},j=[],m="declare"+ ++y,q=[],r=[],t=[],u=[],v={supers:t,unique:m,bases:q,superMeta:{f:null,pos:0,name:null}},x={supers:u,unique:m,bases:r,isConstructor:!0,superMeta:{f:null,pos:0,name:null}};if(d(c)&&!e&&(e=c,c=w),"function"==typeof c||b(c)?(j=b(c)?c:[c],c=j.shift(),a.__meta=x,i=s(c),i.__meta=v,i.__getters__=f({},i.__getters__||{}),i.__setters__=f({},i.__setters__||{}),a.__getters__=f({},a.__getters__||{}),a.__setters__=f({},a.__setters__||{}),o(c.prototype,t,q),o(c,u,r)):(a.__meta=x,i.__meta=v,i.__getters__=i.__getters__||{},i.__setters__=i.__setters__||{},a.__getters__=a.__getters__||{},a.__setters__=a.__setters__||{}),a.prototype=i,e){var z=v.proto=e.instance||{},A=x.proto=e.static||{};A.init=A.init||k,p(i,z),p(a,A),i.constructor=z.hasOwnProperty("constructor")?l(z.constructor,"constructor"):z.constructor=l(k,"constructor")}else v.proto={},x.proto={},a.init=l(k,"init"),i.constructor=l(k,"constructor");j.length&&n.apply(a,j),c&&f(a,f(f({},c),a)),i._super=a._super=g,i._getSuper=a._getSuper=h,i._static=a}function u(a,b){function c(){switch(arguments.length){case 0:this.constructor.call(this);break;case 1:this.constructor.call(this,arguments[0]);break;case 2:this.constructor.call(this,arguments[0],arguments[1]);break;case 3:this.constructor.call(this,arguments[0],arguments[1],arguments[2]);break;default:this.constructor.apply(this,arguments)}}return t(c,a,b),c.init()||c}function v(a,b){function c(){return d||(this.constructor.apply(this,arguments),d=this),d}var d;return t(c,a,b),c.init()||c}var w,x=Array.prototype.slice,y=0,z=new Function,A=/(super)/g,B=function(a){return"[object Arguments]"===Object.prototype.toString.call(a)};return B(arguments)||(B=function(a){return!(!a||!a.hasOwnProperty("callee"))}),w=u({instance:{get:i,set:j},"static":{get:i,set:j,mixin:n,extend:r,as:q}}),u.singleton=v,u}"undefined"!=typeof c?"undefined"!=typeof b&&b.exports&&(b.exports=a()):"function"==typeof define&&define.amd?define(a):this.declare=a()}()},{}],42:[function(a,b){b.exports=a("./declare.js")},{"./declare.js":41}],43:[function(a,b,c){!function(){"use strict";function d(a){function b(){var b=a.define();return b.expose({register:function(a,c){c||(c=a,a=null);var d=typeof c;if(a)b[a]=c;else if(c&&"function"===d)b.extend(c);else{if("object"!==d)throw new TypeError("extended.register must be called with an extender function");b.expose(c)}return b},define:function(){return a.define.apply(a,arguments)}}),b}function c(){return b()}return function(){function a(a,b){var c,d;for(c in b)b.hasOwnProperty(c)&&(d=b[c],c in a&&a[c]===d||(a[c]=d));return a}return function(b){b||(b={});for(var c=1,d=arguments.length;d>c;c++)a(b,arguments[c]);return b}}(),c.define=function(){return a.define.apply(a,arguments)},c}"undefined"!=typeof c?"undefined"!=typeof b&&b.exports&&(b.exports=d(a("extender"))):"function"==typeof define&&define.amd?define(["extender"],function(a){return d(a)}):this.extended=d(this.extender)}.call(this)},{extender:45}],44:[function(a,b,c){!function(){function d(a){function b(a,b){if(a&&a.length)for(var c=0,d=a.length;d>c;c++)if(a[c]===b)return c;return-1}function c(a){return"[object Array]"===Object.prototype.toString.call(a)}function d(b){function c(a,b,c){if("function"!=typeof c)throw new TypeError("when extending type you must provide a function");var d;d="constructor"===b?function(){this._super(arguments),c.apply(this,arguments)}:function(){var a=f.call(arguments);a.unshift(this._value);var b=c.apply(this,a);return b!==e?this.__extender__(b):this},a[b]=d}function d(a,b,c){if("function"!=typeof c)throw new TypeError("when extending type you must provide a function");var d;d="constructor"===b?function(){this._super(arguments),c.apply(this,arguments)}:function(){var a=f.call(arguments);return a.unshift(this._value),c.apply(this,a)},a[b]=d}function h(a,b,e){for(var f in b)b.hasOwnProperty(f)&&("getters"!==f&&"setters"!==f?"noWrap"===f?h(a,b[f],!0):e?d(a,f,b[f]):c(a,f,b[f]):a[f]=b[f])}function i(a){var b,c,d=a;if(!(a instanceof m)){var e=m;for(b=0,c=n.length;c>b;b++){var f=n[b];f[0](a)&&(e=e.extend({instance:f[1]}))}d=new e(a),d.__extender__=i}return d}function j(){return!0}function k(a,b){if(arguments.length){"object"==typeof a&&(b=a,a=j),b=b||{};var d={};h(d,b),d.hasOwnProperty("constructor")||(b.hasOwnProperty("constructor")?c(d,"constructor",b.constructor):d.constructor=function(){this._super(arguments)}),n.push([a,d])}return i}function l(a){return a&&a.hasOwnProperty("__defined__")&&(i.__defined__=n=n.concat(a.__defined__)),g(i,a,["define","extend","expose","__defined__"]),i}b=b||[];var m=a({instance:{constructor:function(a){this._value=a},value:function(){return this._value},eq:function(a){return this.__extender__(this._value===a)},neq:function(a){return this.__extender__(this._value!==a)},print:function(){return console.log(this._value),this}}}),n=[];return i.define=k,i.extend=l,i.expose=function(){for(var a,b=0,c=arguments.length;c>b;b++)a=arguments[b],"object"==typeof a&&g(i,a,["define","extend","expose","__defined__"]);return i},i.__defined__=n,i}var e,f=Array.prototype.slice,g=function(){function a(a,c,d){var e,f;for(e in c)c.hasOwnProperty(e)&&-1===b(d,e)&&(f=c[e],e in a&&a[e]===f||(a[e]=f));return a}return function(b){b||(b={});var d=arguments.length,e=arguments[arguments.length-1];c(e)?d--:e=[];for(var f=1;d>f;f++)a(b,arguments[f],e);return b}}();return{define:function(){return d().define.apply(d,arguments)},extend:function(a){return d().define().extend(a)}}}"undefined"!=typeof c?"undefined"!=typeof b&&b.exports&&(b.exports=d(a("declare.js"))):"function"==typeof define&&define.amd?define(["declare"],function(a){return d(a)}):this.extender=d(this.declare)}.call(this)},{"declare.js":42}],45:[function(a,b){b.exports=a("./extender.js")},{"./extender.js":44}],46:[function(a,b,c){!function(){"use strict";function d(a,b,c){function d(a,b,c){if(c=o(arguments,2),m(b)&&!(b in a))throw new Error(b+" property not defined in scope");if(!m(b)&&!n(b))throw new Error(b+" is not a function");return m(b)?function(){var d=a[b];if(n(d)){var e=c.concat(o(arguments));return d.apply(a,e)}return d}:c.length?function(){var d=c.concat(o(arguments));return b.apply(a,d)}:function(){return b.apply(a,arguments)}}function e(a,b){if(b=o(arguments,1),!m(a)&&!n(a))throw new Error(a+" must be the name of a property or function to execute");return m(a)?function(){var c=o(arguments),d=c.shift(),e=d[a];return n(e)?(c=b.concat(c),e.apply(d,c)):e}:function(){var c=o(arguments),d=c.shift();return c=b.concat(c),a.apply(d,c)}}function f(a,b,c){if(c=o(arguments,2),m(b)&&!(b in a))throw new Error(b+" property not defined in scope");if(!m(b)&&!n(b))throw new Error(b+" is not a function");return m(b)?function(){var d=a[b];return n(d)?d.apply(a,c):d}:function(){return b.apply(a,c)}}function g(a){var b=o(arguments,1);if(!l(a)&&!n(a))throw new TypeError("scope must be an object");if(1===b.length&&k(b[0])&&(b=b[0]),!b.length){b=[];for(var c in a)a.hasOwnProperty(c)&&n(a[c])&&b.push(c)}for(var e=0,f=b.length;f>e;e++)a[b[e]]=d(a,a[b[e]]);return a}function h(a,b){if(b=o(arguments,1),!m(a)&&!n(a))throw new Error(a+" must be the name of a property or function to execute");return m(a)?function(){var c=this[a];if(n(c)){var d=b.concat(o(arguments));return c.apply(this,d)}return c}:function(){var c=b.concat(o(arguments));return a.apply(this,c)}}function i(a,b){return function(){var c=o(arguments);return b?a.apply(this,arguments):function(){return a.apply(this,c.concat(o(arguments)))}}}function j(a,b,c){var e;if(e=c?d(c,b):b,a)for(var f=a-1,g=f;g>=0;g--)e=i(e,g===f);return e}var k=b.isArray,l=b.isObject,m=b.isString,n=b.isFunction,o=c.argsToArray;return a.define(l,{bind:d,bindAll:g,bindIgnore:f,curry:function(a,b,c){return j(b,c,a)}}).define(n,{bind:function(a,b){return d.apply(this,[b,a].concat(o(arguments,2)))},bindIgnore:function(a,b){return f.apply(this,[b,a].concat(o(arguments,2)))},partial:h,applyFirst:e,curry:function(a,b,c){return j(b,a,c)},noWrap:{f:function(){return this.value()}}}).define(m,{bind:function(a,b){return d(b,a)},bindIgnore:function(a,b){return f(b,a)},partial:h,applyFirst:e,curry:function(a,b,c){return j(b,a,c)}}).expose({bind:d,bindAll:g,bindIgnore:f,partial:h,applyFirst:e,curry:j})}"undefined"!=typeof c?"undefined"!=typeof b&&b.exports&&(b.exports=d(a("extended"),a("is-extended"),a("arguments-extended"))):"function"==typeof define&&define.amd?define(["extended","is-extended","arguments-extended"],function(a,b,c){return d(a,b,c)}):this.functionExtended=d(this.extended,this.isExtended,this.argumentsExtended)}.call(this)},{"arguments-extended":38,extended:43,"is-extended":53}],47:[function(a,b,c){function d(a,b){if(a.indexOf)return a.indexOf(b);for(var c=0;ce;e++)d[e].apply(this,c);return!0}return!1},f.prototype.addListener=function(a,b){if("function"!=typeof b)throw new Error("addListener only takes instances of Function");if(this._events||(this._events={}),this.emit("newListener",a,b),this._events[a])if(g(this._events[a])){if(!this._events[a].warned){var c;c=void 0!==this._events.maxListeners?this._events.maxListeners:h,c&&c>0&&this._events[a].length>c&&(this._events[a].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[a].length),console.trace())}this._events[a].push(b)}else this._events[a]=[this._events[a],b];else this._events[a]=b;return this},f.prototype.on=f.prototype.addListener,f.prototype.once=function(a,b){var c=this;return c.on(a,function d(){c.removeListener(a,d),b.apply(this,arguments)}),this},f.prototype.removeListener=function(a,b){if("function"!=typeof b)throw new Error("removeListener only takes instances of Function");if(!this._events||!this._events[a])return this;var c=this._events[a];if(g(c)){var e=d(c,b);if(0>e)return this;c.splice(e,1),0==c.length&&delete this._events[a]}else this._events[a]===b&&delete this._events[a];return this},f.prototype.removeAllListeners=function(a){return 0===arguments.length?(this._events={},this):(a&&this._events&&this._events[a]&&(this._events[a]=null),this)},f.prototype.listeners=function(a){return this._events||(this._events={}),this._events[a]||(this._events[a]=[]),g(this._events[a])||(this._events[a]=[this._events[a]]),this._events[a]},f.listenerCount=function(a,b){var c;return c=a._events&&a._events[b]?"function"==typeof a._events[b]?1:a._events[b].length:0}},{__browserify_process:51}],48:[function(){},{}],49:[function(a,b,c){function d(a,b){for(var c=[],d=0;d=0;d--){var e=a[d];"."==e?a.splice(d,1):".."===e?(a.splice(d,1),c++):c&&(a.splice(d,1),c--)}if(b)for(;c--;c)a.unshift("..");return a}var f=a("__browserify_process"),g=/^(.+\/(?!$)|\/)?((?:.+?)?(\.[^.]*)?)$/;c.resolve=function(){for(var a="",b=!1,c=arguments.length;c>=-1&&!b;c--){var g=c>=0?arguments[c]:f.cwd();"string"==typeof g&&g&&(a=g+"/"+a,b="/"===g.charAt(0))}return a=e(d(a.split("/"),function(a){return!!a}),!b).join("/"),(b?"/":"")+a||"."},c.normalize=function(a){var b="/"===a.charAt(0),c="/"===a.slice(-1);return a=e(d(a.split("/"),function(a){return!!a}),!b).join("/"),a||b||(a="."),a&&c&&(a+="/"),(b?"/":"")+a},c.join=function(){var a=Array.prototype.slice.call(arguments,0);return c.normalize(d(a,function(a){return a&&"string"==typeof a}).join("/"))},c.dirname=function(a){var b=g.exec(a)[1]||"",c=!1;return b?1===b.length||c&&b.length<=3&&":"===b.charAt(1)?b:b.substring(0,b.length-1):"."},c.basename=function(a,b){var c=g.exec(a)[2]||"";return b&&c.substr(-1*b.length)===b&&(c=c.substr(0,c.length-b.length)),c},c.extname=function(a){return g.exec(a)[3]||""},c.relative=function(a,b){function d(a){for(var b=0;b=0&&""===a[c];c--);return b>c?[]:a.slice(b,c-b+1)}a=c.resolve(a).substr(1),b=c.resolve(b).substr(1);for(var e=d(a.split("/")),f=d(b.split("/")),g=Math.min(e.length,f.length),h=g,i=0;g>i;i++)if(e[i]!==f[i]){h=i;break}for(var j=[],i=h;i=0;e--)if(f[e]!=g[e])return!1;for(e=f.length-1;e>=0;e--)if(d=f[e],!h(a[d],b[d]))return!1;return!0}function l(a,b){return a&&b?b instanceof RegExp?b.test(a):a instanceof b?!0:b.call({},a)===!0?!0:!1:!1}function m(a,b,c,d){var e;"string"==typeof c&&(d=c,c=null);try{b()}catch(g){e=g}if(d=(c&&c.name?" ("+c.name+").":".")+(d?" "+d:"."),a&&!e&&f("Missing expected exception"+d),!a&&l(e,c)&&f("Got unwanted exception"+d),a&&e&&c&&!l(e,c)||!a&&e)throw e}var n=a("util"),o=a("buffer").Buffer,p=Array.prototype.slice,q=b.exports=g;q.AssertionError=function(a){this.name="AssertionError",this.message=a.message,this.actual=a.actual,this.expected=a.expected,this.operator=a.operator;var b=a.stackStartFunction||f;Error.captureStackTrace&&Error.captureStackTrace(this,b)},n.inherits(q.AssertionError,Error),q.AssertionError.prototype.toString=function(){return this.message?[this.name+":",this.message].join(" "):[this.name+":",e(JSON.stringify(this.actual,d),128),this.operator,e(JSON.stringify(this.expected,d),128)].join(" ")},q.AssertionError.__proto__=Error.prototype,q.fail=f,q.ok=g,q.equal=function(a,b,c){a!=b&&f(a,b,c,"==",q.equal)},q.notEqual=function(a,b,c){a==b&&f(a,b,c,"!=",q.notEqual)},q.deepEqual=function(a,b,c){h(a,b)||f(a,b,c,"deepEqual",q.deepEqual)},q.notDeepEqual=function(a,b,c){h(a,b)&&f(a,b,c,"notDeepEqual",q.notDeepEqual)},q.strictEqual=function(a,b,c){a!==b&&f(a,b,c,"===",q.strictEqual)},q.notStrictEqual=function(a,b,c){a===b&&f(a,b,c,"!==",q.notStrictEqual)},q.throws=function(){m.apply(this,[!0].concat(p.call(arguments)))},q.doesNotThrow=function(){m.apply(this,[!1].concat(p.call(arguments)))},q.ifError=function(a){if(a)throw a}},{util:2,buffer:3}],2:[function(a,b,c){function d(a){return a instanceof Array||Array.isArray(a)||a&&a!==Object.prototype&&d(a.__proto__)}function e(a){return a instanceof RegExp||"object"==typeof a&&"[object RegExp]"===Object.prototype.toString.call(a)}function f(a){if(a instanceof Date)return!0;if("object"!=typeof a)return!1;var b=Date.prototype&&h(Date.prototype),c=a.__proto__&&h(a.__proto__);return JSON.stringify(c)===JSON.stringify(b)}a("events"),c.isArray=d,c.isDate=function(a){return"[object Date]"===Object.prototype.toString.call(a)},c.isRegExp=function(a){return"[object RegExp]"===Object.prototype.toString.call(a)},c.print=function(){},c.puts=function(){},c.debug=function(){},c.inspect=function(a,b,i,j){function k(a,i){if(a&&"function"==typeof a.inspect&&a!==c&&(!a.constructor||a.constructor.prototype!==a))return a.inspect(i);switch(typeof a){case"undefined":return m("undefined","undefined");case"string":var j="'"+JSON.stringify(a).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return m(j,"string");case"number":return m(""+a,"number");case"boolean":return m(""+a,"boolean")}if(null===a)return m("null","null");var n=g(a),o=b?h(a):n;if("function"==typeof a&&0===o.length){if(e(a))return m(""+a,"regexp");var p=a.name?": "+a.name:"";return m("[Function"+p+"]","special")}if(f(a)&&0===o.length)return m(a.toUTCString(),"date");var q,r,s;if(d(a)?(r="Array",s=["[","]"]):(r="Object",s=["{","}"]),"function"==typeof a){var t=a.name?": "+a.name:"";q=e(a)?" "+a:" [Function"+t+"]"}else q="";if(f(a)&&(q=" "+a.toUTCString()),0===o.length)return s[0]+q+s[1];if(0>i)return e(a)?m(""+a,"regexp"):m("[Object]","special");l.push(a);var u=o.map(function(b){var c,e;if(a.__lookupGetter__&&(a.__lookupGetter__(b)?e=a.__lookupSetter__(b)?m("[Getter/Setter]","special"):m("[Getter]","special"):a.__lookupSetter__(b)&&(e=m("[Setter]","special"))),n.indexOf(b)<0&&(c="["+b+"]"),e||(l.indexOf(a[b])<0?(e=null===i?k(a[b]):k(a[b],i-1),e.indexOf("\n")>-1&&(e=d(a)?e.split("\n").map(function(a){return" "+a}).join("\n").substr(2):"\n"+e.split("\n").map(function(a){return" "+a}).join("\n"))):e=m("[Circular]","special")),"undefined"==typeof c){if("Array"===r&&b.match(/^\d+$/))return e;c=JSON.stringify(""+b),c.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(c=c.substr(1,c.length-2),c=m(c,"name")):(c=c.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),c=m(c,"string"))}return c+": "+e});l.pop();var v=0,w=u.reduce(function(a,b){return v++,b.indexOf("\n")>=0&&v++,a+b.length+1},0);return u=w>50?s[0]+(""===q?"":q+"\n ")+" "+u.join(",\n ")+" "+s[1]:s[0]+q+" "+u.join(", ")+" "+s[1]}var l=[],m=function(a,b){var c={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]},d={special:"cyan",number:"blue","boolean":"yellow",undefined:"grey","null":"bold",string:"green",date:"magenta",regexp:"red"}[b];return d?"["+c[d][0]+"m"+a+"["+c[d][1]+"m":a};return j||(m=function(a){return a}),k(a,"undefined"==typeof i?2:i)},c.log=function(){},c.pump=null;var g=Object.keys||function(a){var b=[];for(var c in a)b.push(c);return b},h=Object.getOwnPropertyNames||function(a){var b=[];for(var c in a)Object.hasOwnProperty.call(a,c)&&b.push(c);return b},i=Object.create||function(a,b){var c;if(null===a)c={__proto__:null};else{if("object"!=typeof a)throw new TypeError("typeof prototype["+typeof a+"] != 'object'");var d=function(){};d.prototype=a,c=new d,c.__proto__=a}return"undefined"!=typeof b&&Object.defineProperties&&Object.defineProperties(c,b),c};c.inherits=function(a,b){a.super_=b,a.prototype=i(b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}})};var j=/%[sdj%]/g;c.format=function(a){if("string"!=typeof a){for(var b=[],d=0;d=f)return a;switch(a){case"%s":return String(e[d++]);case"%d":return Number(e[d++]);case"%j":return JSON.stringify(e[d++]);default:return a}}),h=e[d];f>d;h=e[++d])g+=null===h||"object"!=typeof h?" "+h:" "+c.inspect(h);return g}},{events:4}],5:[function(a,b,c){c.readIEEE754=function(a,b,c,d,e){var f,g,h=8*e-d-1,i=(1<>1,k=-7,l=c?0:e-1,m=c?1:-1,n=a[b+l];for(l+=m,f=n&(1<<-k)-1,n>>=-k,k+=h;k>0;f=256*f+a[b+l],l+=m,k-=8);for(g=f&(1<<-k)-1,f>>=-k,k+=d;k>0;g=256*g+a[b+l],l+=m,k-=8);if(0===f)f=1-j;else{if(f===i)return g?0/0:1/0*(n?-1:1);g+=Math.pow(2,d),f-=j}return(n?-1:1)*g*Math.pow(2,f-d)},c.writeIEEE754=function(a,b,c,d,e,f){var g,h,i,j=8*f-e-1,k=(1<>1,m=23===e?Math.pow(2,-24)-Math.pow(2,-77):0,n=d?f-1:0,o=d?-1:1,p=0>b||0===b&&0>1/b?1:0;for(b=Math.abs(b),isNaN(b)||1/0===b?(h=isNaN(b)?1:0,g=k):(g=Math.floor(Math.log(b)/Math.LN2),b*(i=Math.pow(2,-g))<1&&(g--,i*=2),b+=g+l>=1?m/i:m*Math.pow(2,1-l),b*i>=2&&(g++,i/=2),g+l>=k?(h=0,g=k):g+l>=1?(h=(b*i-1)*Math.pow(2,e),g+=l):(h=b*Math.pow(2,l-1)*Math.pow(2,e),g=0));e>=8;a[c+n]=255&h,n+=o,h/=256,e-=8);for(g=g<0;a[c+n]=255&g,n+=o,g/=256,j-=8);a[c+n-o]|=128*p}},{}],6:[function(a,b){var c=b.exports={};c.nextTick=function(){var a="undefined"!=typeof window&&window.setImmediate,b="undefined"!=typeof window&&window.postMessage&&window.addEventListener;if(a)return function(a){return window.setImmediate(a)};if(b){var c=[];return window.addEventListener("message",function(a){if(a.source===window&&"process-tick"===a.data&&(a.stopPropagation(),c.length>0)){var b=c.shift();b()}},!0),function(a){c.push(a),window.postMessage("process-tick","*")}}return function(a){setTimeout(a,0)}}(),c.title="browser",c.browser=!0,c.env={},c.argv=[],c.binding=function(){throw new Error("process.binding is not supported")},c.cwd=function(){return"/"},c.chdir=function(){throw new Error("process.chdir is not supported")}},{}],4:[function(a,b,c){!function(a){function b(a,b){if(a.indexOf)return a.indexOf(b);for(var c=0;cf;f++)d[f].apply(this,c);return!0}return!1},d.prototype.addListener=function(a,b){if("function"!=typeof b)throw new Error("addListener only takes instances of Function");if(this._events||(this._events={}),this.emit("newListener",a,b),this._events[a])if(e(this._events[a])){if(!this._events[a].warned){var c;c=void 0!==this._events.maxListeners?this._events.maxListeners:f,c&&c>0&&this._events[a].length>c&&(this._events[a].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[a].length),console.trace())}this._events[a].push(b)}else this._events[a]=[this._events[a],b];else this._events[a]=b;return this},d.prototype.on=d.prototype.addListener,d.prototype.once=function(a,b){var c=this;return c.on(a,function d(){c.removeListener(a,d),b.apply(this,arguments)}),this},d.prototype.removeListener=function(a,c){if("function"!=typeof c)throw new Error("removeListener only takes instances of Function");if(!this._events||!this._events[a])return this;var d=this._events[a];if(e(d)){var f=b(d,c);if(0>f)return this;d.splice(f,1),0==d.length&&delete this._events[a]}else this._events[a]===c&&delete this._events[a];return this},d.prototype.removeAllListeners=function(a){return 0===arguments.length?(this._events={},this):(a&&this._events&&this._events[a]&&(this._events[a]=null),this)},d.prototype.listeners=function(a){return this._events||(this._events={}),this._events[a]||(this._events[a]=[]),e(this._events[a])||(this._events[a]=[this._events[a]]),this._events[a]}}(a("__browserify_process"))},{__browserify_process:6}],"buffer-browserify":[function(a,b){b.exports=a("q9TxCC")},{}],q9TxCC:[function(a,b,c){function d(a){this.length=a}function e(a){return 16>a?"0"+a.toString(16):a.toString(16)}function f(a){for(var b=[],c=0;ce&&!(e+c>=b.length||e>=a.length);)b[e+c]=a[e],e++;return e}function j(a){try{return decodeURIComponent(a)}catch(b){return String.fromCharCode(65533)}}function k(a){return a=~~Math.ceil(+a),0>a?0:a}function l(a,b,c){if(!(this instanceof l))return new l(a,b,c);var e;if("number"==typeof c)this.length=k(b),this.parent=a,this.offset=c;else{switch(e=typeof a){case"number":this.length=k(a);break;case"string":this.length=l.byteLength(a,b);break;case"object":this.length=k(a.length);break;default:throw new Error("First argument needs to be a number, array or string.")}if(this.length>l.poolSize?(this.parent=new d(this.length),this.offset=0):((!E||E.length-E.used=a.length?0:(c?(e=a.parent[a.offset+b]<<8,b+1=a.length?0:(c?(b+1>>0):(b+2>>0)),e)}function q(a,b,c,d){var e,f;return d||(D.ok("boolean"==typeof c,"missing or invalid endian"),D.ok(void 0!==b&&null!==b,"missing offset"),D.ok(b+1=0,"specified a negative value for writing an unsigned value"),D.ok(b>=a,"value is larger than maximum value for type"),D.ok(Math.floor(a)===a,"value has a fractional component")}function v(a,b,c,d,e){e||(D.ok(void 0!==b&&null!==b,"missing value"),D.ok("boolean"==typeof d,"missing or invalid endian"),D.ok(void 0!==c&&null!==c,"missing offset"),D.ok(c+1>>8*(d?1-f:f)}function w(a,b,c,d,e){e||(D.ok(void 0!==b&&null!==b,"missing value"),D.ok("boolean"==typeof d,"missing or invalid endian"),D.ok(void 0!==c&&null!==c,"missing offset"),D.ok(c+3>>8*(d?3-f:f)}function x(a,b,c){D.ok("number"==typeof a,"cannot write a non-number as a number"),D.ok(b>=a,"value larger than maximum allowed value"),D.ok(a>=c,"value smaller than minimum allowed value"),D.ok(Math.floor(a)===a,"value has a fractional component")}function y(a,b,c){D.ok("number"==typeof a,"cannot write a non-number as a number"),D.ok(b>=a,"value larger than maximum allowed value"),D.ok(a>=c,"value smaller than minimum allowed value")}function z(a,b,c,d,e){e||(D.ok(void 0!==b&&null!==b,"missing value"),D.ok("boolean"==typeof d,"missing or invalid endian"),D.ok(void 0!==c&&null!==c,"missing offset"),D.ok(c+1=0?v(a,b,c,d,e):v(a,65535+b+1,c,d,e)}function A(a,b,c,d,e){e||(D.ok(void 0!==b&&null!==b,"missing value"),D.ok("boolean"==typeof d,"missing or invalid endian"),D.ok(void 0!==c&&null!==c,"missing offset"),D.ok(c+3=0?w(a,b,c,d,e):w(a,4294967295+b+1,c,d,e)}function B(b,c,d,e,f){f||(D.ok(void 0!==c&&null!==c,"missing value"),D.ok("boolean"==typeof e,"missing or invalid endian"),D.ok(void 0!==d&&null!==d,"missing offset"),D.ok(d+3d;d++)if(a[d]=e(this[d]),d==c.INSPECT_MAX_BYTES){a[d+1]="...";break}return""},d.prototype.hexSlice=function(a,b){var c=this.length;(!a||0>a)&&(a=0),(!b||0>b||b>c)&&(b=c);for(var d="",f=a;b>f;f++)d+=e(this[f]);return d},d.prototype.toString=function(a,b,c){if(a=String(a||"utf8").toLowerCase(),b=+b||0,"undefined"==typeof c&&(c=this.length),+c==b)return"";switch(a){case"hex":return this.hexSlice(b,c);case"utf8":case"utf-8":return this.utf8Slice(b,c);case"ascii":return this.asciiSlice(b,c);case"binary":return this.binarySlice(b,c);case"base64":return this.base64Slice(b,c);case"ucs2":case"ucs-2":return this.ucs2Slice(b,c);default:throw new Error("Unknown encoding")}},d.prototype.hexWrite=function(a,b,c){b=+b||0;var e=this.length-b;c?(c=+c,c>e&&(c=e)):c=e;var f=a.length;if(f%2)throw new Error("Invalid hex string");c>f/2&&(c=f/2);for(var g=0;c>g;g++){var h=parseInt(a.substr(2*g,2),16);if(isNaN(h))throw new Error("Invalid hex string");this[b+g]=h}return d._charsWritten=2*g,g},d.prototype.write=function(a,b,c,d){if(isFinite(b))isFinite(c)||(d=c,c=void 0);else{var e=d;d=b,b=c,c=e}b=+b||0;var f=this.length-b;switch(c?(c=+c,c>f&&(c=f)):c=f,d=String(d||"utf8").toLowerCase()){case"hex":return this.hexWrite(a,b,c);case"utf8":case"utf-8":return this.utf8Write(a,b,c);case"ascii":return this.asciiWrite(a,b,c);case"binary":return this.binaryWrite(a,b,c);case"base64":return this.base64Write(a,b,c);case"ucs2":case"ucs-2":return this.ucs2Write(a,b,c);default:throw new Error("Unknown encoding")}},d.prototype.slice=function(a,b){if(void 0===b&&(b=this.length),b>this.length)throw new Error("oob");if(a>b)throw new Error("oob");return new l(this,b-a,+a)},d.prototype.copy=function(a,b,c,d){for(var e=[],f=c;d>f;f++)D.ok("undefined"!=typeof this[f],"copying undefined buffer bytes!"),e.push(this[f]);for(var f=b;fthis.length)throw new Error("oob");if(b>c)throw new Error("oob");for(var d=b;c>d;d++)this[d]=a},c.SlowBuffer=d,c.Buffer=l,l.poolSize=8192;var E;l.isBuffer=function(a){return a instanceof l||a instanceof d},l.concat=function(a,b){if(!Array.isArray(a))throw new Error("Usage: Buffer.concat(list, [totalLength])\n list should be an Array.");if(0===a.length)return new l(0);if(1===a.length)return a[0];if("number"!=typeof b){b=0;for(var c=0;cd;d++)if(a[d]=e(this.parent[d+this.offset]),d==c.INSPECT_MAX_BYTES){a[d+1]="...";break}return""},l.prototype.get=function(a){if(0>a||a>=this.length)throw new Error("oob");return this.parent[this.offset+a]},l.prototype.set=function(a,b){if(0>a||a>=this.length)throw new Error("oob");return this.parent[this.offset+a]=b},l.prototype.write=function(a,b,c,e){if(isFinite(b))isFinite(c)||(e=c,c=void 0);else{var f=e;e=b,b=c,c=f}b=+b||0;var g=this.length-b;c?(c=+c,c>g&&(c=g)):c=g,e=String(e||"utf8").toLowerCase();var h;switch(e){case"hex":h=this.parent.hexWrite(a,this.offset+b,c);break;case"utf8":case"utf-8":h=this.parent.utf8Write(a,this.offset+b,c);break;case"ascii":h=this.parent.asciiWrite(a,this.offset+b,c);break;case"binary":h=this.parent.binaryWrite(a,this.offset+b,c);break;case"base64":h=this.parent.base64Write(a,this.offset+b,c);break;case"ucs2":case"ucs-2":h=this.parent.ucs2Write(a,this.offset+b,c);break;default:throw new Error("Unknown encoding")}return l._charsWritten=d._charsWritten,h},l.prototype.toString=function(a,b,c){switch(a=String(a||"utf8").toLowerCase(),"undefined"==typeof b||0>b?b=0:b>this.length&&(b=this.length),"undefined"==typeof c||c>this.length?c=this.length:0>c&&(c=0),b+=this.offset,c+=this.offset,a){case"hex":return this.parent.hexSlice(b,c);case"utf8":case"utf-8":return this.parent.utf8Slice(b,c);case"ascii":return this.parent.asciiSlice(b,c);case"binary":return this.parent.binarySlice(b,c);case"base64":return this.parent.base64Slice(b,c);case"ucs2":case"ucs-2":return this.parent.ucs2Slice(b,c);default:throw new Error("Unknown encoding")}},l.byteLength=d.byteLength,l.prototype.fill=function(a,b,c){if(a||(a=0),b||(b=0),c||(c=this.length),"string"==typeof a&&(a=a.charCodeAt(0)),"number"!=typeof a||isNaN(a))throw new Error("value is not a number");if(b>c)throw new Error("end < start");if(c===b)return 0;if(0==this.length)return 0;if(0>b||b>=this.length)throw new Error("start out of bounds");if(0>c||c>this.length)throw new Error("end out of bounds");return this.parent.fill(a,b+this.offset,c+this.offset)},l.prototype.copy=function(a,b,c,d){var e=this;if(c||(c=0),d||(d=this.length),b||(b=0),c>d)throw new Error("sourceEnd < sourceStart");if(d===c)return 0;if(0==a.length||0==e.length)return 0;if(0>b||b>=a.length)throw new Error("targetStart out of bounds");if(0>c||c>=e.length)throw new Error("sourceStart out of bounds");if(0>d||d>e.length)throw new Error("sourceEnd out of bounds");return d>this.length&&(d=this.length),a.length-bthis.length)throw new Error("oob");if(a>b)throw new Error("oob");return new l(this.parent,b-a,+a+this.offset)},l.prototype.utf8Slice=function(a,b){return this.toString("utf8",a,b)},l.prototype.binarySlice=function(a,b){return this.toString("binary",a,b)},l.prototype.asciiSlice=function(a,b){return this.toString("ascii",a,b)},l.prototype.utf8Write=function(a,b){return this.write(a,b,"utf8")},l.prototype.binaryWrite=function(a,b){return this.write(a,b,"binary")},l.prototype.asciiWrite=function(a,b){return this.write(a,b,"ascii")},l.prototype.readUInt8=function(a,b){var c=this;return b||(D.ok(void 0!==a&&null!==a,"missing offset"),D.ok(a=c.length?void 0:c.parent[c.offset+a]},l.prototype.readUInt16LE=function(a,b){return o(this,a,!1,b)},l.prototype.readUInt16BE=function(a,b){return o(this,a,!0,b)},l.prototype.readUInt32LE=function(a,b){return p(this,a,!1,b)},l.prototype.readUInt32BE=function(a,b){return p(this,a,!0,b)},l.prototype.readInt8=function(a,b){var c,d=this;return b||(D.ok(void 0!==a&&null!==a,"missing offset"),D.ok(a=d.length?void 0:(c=128&d.parent[d.offset+a],c?-1*(255-d.parent[d.offset+a]+1):d.parent[d.offset+a])},l.prototype.readInt16LE=function(a,b){return q(this,a,!1,b)},l.prototype.readInt16BE=function(a,b){return q(this,a,!0,b)},l.prototype.readInt32LE=function(a,b){return r(this,a,!1,b)},l.prototype.readInt32BE=function(a,b){return r(this,a,!0,b)},l.prototype.readFloatLE=function(a,b){return s(this,a,!1,b)},l.prototype.readFloatBE=function(a,b){return s(this,a,!0,b)},l.prototype.readDoubleLE=function(a,b){return t(this,a,!1,b)},l.prototype.readDoubleBE=function(a,b){return t(this,a,!0,b)},l.prototype.writeUInt8=function(a,b,c){var d=this;c||(D.ok(void 0!==a&&null!==a,"missing value"),D.ok(void 0!==b&&null!==b,"missing offset"),D.ok(b=0?d.writeUInt8(a,b,c):d.writeUInt8(255+a+1,b,c)},l.prototype.writeInt16LE=function(a,b,c){z(this,a,b,!1,c)},l.prototype.writeInt16BE=function(a,b,c){z(this,a,b,!0,c)},l.prototype.writeInt32LE=function(a,b,c){A(this,a,b,!1,c)},l.prototype.writeInt32BE=function(a,b,c){A(this,a,b,!0,c)},l.prototype.writeFloatLE=function(a,b,c){B(this,a,b,!1,c)},l.prototype.writeFloatBE=function(a,b,c){B(this,a,b,!0,c)},l.prototype.writeDoubleLE=function(a,b,c){C(this,a,b,!1,c)},l.prototype.writeDoubleBE=function(a,b,c){C(this,a,b,!0,c)},d.prototype.readUInt8=l.prototype.readUInt8,d.prototype.readUInt16LE=l.prototype.readUInt16LE,d.prototype.readUInt16BE=l.prototype.readUInt16BE,d.prototype.readUInt32LE=l.prototype.readUInt32LE,d.prototype.readUInt32BE=l.prototype.readUInt32BE,d.prototype.readInt8=l.prototype.readInt8,d.prototype.readInt16LE=l.prototype.readInt16LE,d.prototype.readInt16BE=l.prototype.readInt16BE,d.prototype.readInt32LE=l.prototype.readInt32LE,d.prototype.readInt32BE=l.prototype.readInt32BE,d.prototype.readFloatLE=l.prototype.readFloatLE,d.prototype.readFloatBE=l.prototype.readFloatBE,d.prototype.readDoubleLE=l.prototype.readDoubleLE,d.prototype.readDoubleBE=l.prototype.readDoubleBE,d.prototype.writeUInt8=l.prototype.writeUInt8,d.prototype.writeUInt16LE=l.prototype.writeUInt16LE,d.prototype.writeUInt16BE=l.prototype.writeUInt16BE,d.prototype.writeUInt32LE=l.prototype.writeUInt32LE,d.prototype.writeUInt32BE=l.prototype.writeUInt32BE,d.prototype.writeInt8=l.prototype.writeInt8,d.prototype.writeInt16LE=l.prototype.writeInt16LE,d.prototype.writeInt16BE=l.prototype.writeInt16BE,d.prototype.writeInt32LE=l.prototype.writeInt32LE,d.prototype.writeInt32BE=l.prototype.writeInt32BE,d.prototype.writeFloatLE=l.prototype.writeFloatLE,d.prototype.writeFloatBE=l.prototype.writeFloatBE,d.prototype.writeDoubleLE=l.prototype.writeDoubleLE,d.prototype.writeDoubleBE=l.prototype.writeDoubleBE},{assert:1,"./buffer_ieee754":5,"base64-js":7}],7:[function(a,b){!function(){"use strict";function a(a){var b,c,e,f,g,h;if(a.length%4>0)throw"Invalid string. Length must be a multiple of 4";for(g=a.indexOf("="),g=g>0?a.length-g:0,h=[],e=g>0?a.length-4:a.length,b=0,c=0;e>b;b+=4,c+=3)f=d.indexOf(a[b])<<18|d.indexOf(a[b+1])<<12|d.indexOf(a[b+2])<<6|d.indexOf(a[b+3]),h.push((16711680&f)>>16),h.push((65280&f)>>8),h.push(255&f);return 2===g?(f=d.indexOf(a[b])<<2|d.indexOf(a[b+1])>>4,h.push(255&f)):1===g&&(f=d.indexOf(a[b])<<10|d.indexOf(a[b+1])<<4|d.indexOf(a[b+2])>>2,h.push(255&f>>8),h.push(255&f)),h}function c(a){function b(a){return d[63&a>>18]+d[63&a>>12]+d[63&a>>6]+d[63&a]}var c,e,f,g=a.length%3,h="";for(c=0,f=a.length-g;f>c;c+=3)e=(a[c]<<16)+(a[c+1]<<8)+a[c+2],h+=b(e);switch(g){case 1:e=a[a.length-1],h+=d[e>>2],h+=d[63&e<<4],h+="==";break;case 2:e=(a[a.length-2]<<8)+a[a.length-1],h+=d[e>>10],h+=d[63&e>>4],h+=d[63&e<<2],h+="="}return h}var d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";b.exports.toByteArray=a,b.exports.fromByteArray=c}()},{}],8:[function(a,b,c){c.readIEEE754=function(a,b,c,d,e){var f,g,h=8*e-d-1,i=(1<>1,k=-7,l=c?0:e-1,m=c?1:-1,n=a[b+l];for(l+=m,f=n&(1<<-k)-1,n>>=-k,k+=h;k>0;f=256*f+a[b+l],l+=m,k-=8);for(g=f&(1<<-k)-1,f>>=-k,k+=d;k>0;g=256*g+a[b+l],l+=m,k-=8);if(0===f)f=1-j;else{if(f===i)return g?0/0:1/0*(n?-1:1);g+=Math.pow(2,d),f-=j}return(n?-1:1)*g*Math.pow(2,f-d)},c.writeIEEE754=function(a,b,c,d,e,f){var g,h,i,j=8*f-e-1,k=(1<>1,m=23===e?Math.pow(2,-24)-Math.pow(2,-77):0,n=d?f-1:0,o=d?-1:1,p=0>b||0===b&&0>1/b?1:0;for(b=Math.abs(b),isNaN(b)||1/0===b?(h=isNaN(b)?1:0,g=k):(g=Math.floor(Math.log(b)/Math.LN2),b*(i=Math.pow(2,-g))<1&&(g--,i*=2),b+=g+l>=1?m/i:m*Math.pow(2,1-l),b*i>=2&&(g++,i/=2),g+l>=k?(h=0,g=k):g+l>=1?(h=(b*i-1)*Math.pow(2,e),g+=l):(h=b*Math.pow(2,l-1)*Math.pow(2,e),g=0));e>=8;a[c+n]=255&h,n+=o,h/=256,e-=8);for(g=g<0;a[c+n]=255&g,n+=o,g/=256,j-=8);a[c+n-o]|=128*p}},{}],3:[function(a,b,c){function d(a){this.length=a}function e(a){return 16>a?"0"+a.toString(16):a.toString(16)}function f(a){for(var b=[],c=0;ce&&!(e+c>=b.length||e>=a.length);)b[e+c]=a[e],e++;return e}function j(a){try{return decodeURIComponent(a)}catch(b){return String.fromCharCode(65533)}}function k(a){return a=~~Math.ceil(+a),0>a?0:a}function l(a,b,c){if(!(this instanceof l))return new l(a,b,c);var e;if("number"==typeof c)this.length=k(b),this.parent=a,this.offset=c;else{switch(e=typeof a){case"number":this.length=k(a);break;case"string":this.length=l.byteLength(a,b);break;case"object":this.length=k(a.length);break;default:throw new Error("First argument needs to be a number, array or string.")}if(this.length>l.poolSize?(this.parent=new d(this.length),this.offset=0):((!E||E.length-E.used>>0):(e=a.parent[a.offset+b+2]<<16,e|=a.parent[a.offset+b+1]<<8,e|=a.parent[a.offset+b],e+=a.parent[a.offset+b+3]<<24>>>0),e}function q(a,b,c,d){var e,f;return d||(D.ok("boolean"==typeof c,"missing or invalid endian"),D.ok(void 0!==b&&null!==b,"missing offset"),D.ok(b+1=0,"specified a negative value for writing an unsigned value"),D.ok(b>=a,"value is larger than maximum value for type"),D.ok(Math.floor(a)===a,"value has a fractional component")}function v(a,b,c,d,e){e||(D.ok(void 0!==b&&null!==b,"missing value"),D.ok("boolean"==typeof d,"missing or invalid endian"),D.ok(void 0!==c&&null!==c,"missing offset"),D.ok(c+1>>8,a.parent[a.offset+c+1]=255&b):(a.parent[a.offset+c+1]=(65280&b)>>>8,a.parent[a.offset+c]=255&b)}function w(a,b,c,d,e){e||(D.ok(void 0!==b&&null!==b,"missing value"),D.ok("boolean"==typeof d,"missing or invalid endian"),D.ok(void 0!==c&&null!==c,"missing offset"),D.ok(c+3>>24,a.parent[a.offset+c+1]=255&b>>>16,a.parent[a.offset+c+2]=255&b>>>8,a.parent[a.offset+c+3]=255&b):(a.parent[a.offset+c+3]=255&b>>>24,a.parent[a.offset+c+2]=255&b>>>16,a.parent[a.offset+c+1]=255&b>>>8,a.parent[a.offset+c]=255&b)}function x(a,b,c){D.ok("number"==typeof a,"cannot write a non-number as a number"),D.ok(b>=a,"value larger than maximum allowed value"),D.ok(a>=c,"value smaller than minimum allowed value"),D.ok(Math.floor(a)===a,"value has a fractional component")}function y(a,b,c){D.ok("number"==typeof a,"cannot write a non-number as a number"),D.ok(b>=a,"value larger than maximum allowed value"),D.ok(a>=c,"value smaller than minimum allowed value")}function z(a,b,c,d,e){e||(D.ok(void 0!==b&&null!==b,"missing value"),D.ok("boolean"==typeof d,"missing or invalid endian"),D.ok(void 0!==c&&null!==c,"missing offset"),D.ok(c+1=0?v(a,b,c,d,e):v(a,65535+b+1,c,d,e)}function A(a,b,c,d,e){e||(D.ok(void 0!==b&&null!==b,"missing value"),D.ok("boolean"==typeof d,"missing or invalid endian"),D.ok(void 0!==c&&null!==c,"missing offset"),D.ok(c+3=0?w(a,b,c,d,e):w(a,4294967295+b+1,c,d,e)}function B(b,c,d,e,f){f||(D.ok(void 0!==c&&null!==c,"missing value"),D.ok("boolean"==typeof e,"missing or invalid endian"),D.ok(void 0!==d&&null!==d,"missing offset"),D.ok(d+3d;d++)if(a[d]=e(this[d]),d==c.INSPECT_MAX_BYTES){a[d+1]="...";break}return""},d.prototype.hexSlice=function(a,b){var c=this.length;(!a||0>a)&&(a=0),(!b||0>b||b>c)&&(b=c);for(var d="",f=a;b>f;f++)d+=e(this[f]);return d},d.prototype.toString=function(a,b,c){if(a=String(a||"utf8").toLowerCase(),b=+b||0,"undefined"==typeof c&&(c=this.length),+c==b)return"";switch(a){case"hex":return this.hexSlice(b,c);case"utf8":case"utf-8":return this.utf8Slice(b,c);case"ascii":return this.asciiSlice(b,c);case"binary":return this.binarySlice(b,c);case"base64":return this.base64Slice(b,c);case"ucs2":case"ucs-2":return this.ucs2Slice(b,c);default:throw new Error("Unknown encoding")}},d.prototype.hexWrite=function(a,b,c){b=+b||0;var e=this.length-b;c?(c=+c,c>e&&(c=e)):c=e;var f=a.length;if(f%2)throw new Error("Invalid hex string");c>f/2&&(c=f/2);for(var g=0;c>g;g++){var h=parseInt(a.substr(2*g,2),16);if(isNaN(h))throw new Error("Invalid hex string");this[b+g]=h}return d._charsWritten=2*g,g},d.prototype.write=function(a,b,c,d){if(isFinite(b))isFinite(c)||(d=c,c=void 0);else{var e=d;d=b,b=c,c=e}b=+b||0;var f=this.length-b;switch(c?(c=+c,c>f&&(c=f)):c=f,d=String(d||"utf8").toLowerCase()){case"hex":return this.hexWrite(a,b,c);case"utf8":case"utf-8":return this.utf8Write(a,b,c);case"ascii":return this.asciiWrite(a,b,c);case"binary":return this.binaryWrite(a,b,c);case"base64":return this.base64Write(a,b,c);case"ucs2":case"ucs-2":return this.ucs2Write(a,b,c);default:throw new Error("Unknown encoding")}},d.prototype.slice=function(a,b){if(void 0===b&&(b=this.length),b>this.length)throw new Error("oob");if(a>b)throw new Error("oob");return new l(this,b-a,+a)},d.prototype.copy=function(a,b,c,d){for(var e=[],f=c;d>f;f++)D.ok("undefined"!=typeof this[f],"copying undefined buffer bytes!"),e.push(this[f]);for(var f=b;fd;d++)if(a[d]=e(this.parent[d+this.offset]),d==c.INSPECT_MAX_BYTES){a[d+1]="...";break}return""},l.prototype.get=function(a){if(0>a||a>=this.length)throw new Error("oob");return this.parent[this.offset+a]},l.prototype.set=function(a,b){if(0>a||a>=this.length)throw new Error("oob");return this.parent[this.offset+a]=b},l.prototype.write=function(a,b,c,e){if(isFinite(b))isFinite(c)||(e=c,c=void 0);else{var f=e;e=b,b=c,c=f}b=+b||0;var g=this.length-b;c?(c=+c,c>g&&(c=g)):c=g,e=String(e||"utf8").toLowerCase();var h;switch(e){case"hex":h=this.parent.hexWrite(a,this.offset+b,c);break;case"utf8":case"utf-8":h=this.parent.utf8Write(a,this.offset+b,c);break;case"ascii":h=this.parent.asciiWrite(a,this.offset+b,c);break;case"binary":h=this.parent.binaryWrite(a,this.offset+b,c);break;case"base64":h=this.parent.base64Write(a,this.offset+b,c);break;case"ucs2":case"ucs-2":h=this.parent.ucs2Write(a,this.offset+b,c);break;default:throw new Error("Unknown encoding")}return l._charsWritten=d._charsWritten,h},l.prototype.toString=function(a,b,c){switch(a=String(a||"utf8").toLowerCase(),"undefined"==typeof b||0>b?b=0:b>this.length&&(b=this.length),"undefined"==typeof c||c>this.length?c=this.length:0>c&&(c=0),b+=this.offset,c+=this.offset,a){case"hex":return this.parent.hexSlice(b,c);case"utf8":case"utf-8":return this.parent.utf8Slice(b,c);case"ascii":return this.parent.asciiSlice(b,c);case"binary":return this.parent.binarySlice(b,c);case"base64":return this.parent.base64Slice(b,c);case"ucs2":case"ucs-2":return this.parent.ucs2Slice(b,c);default:throw new Error("Unknown encoding")}},l.byteLength=d.byteLength,l.prototype.fill=function(a,b,c){if(a||(a=0),b||(b=0),c||(c=this.length),"string"==typeof a&&(a=a.charCodeAt(0)),"number"!=typeof a||isNaN(a))throw new Error("value is not a number");if(b>c)throw new Error("end < start");if(c===b)return 0;if(0==this.length)return 0;if(0>b||b>=this.length)throw new Error("start out of bounds");if(0>c||c>this.length)throw new Error("end out of bounds");return this.parent.fill(a,b+this.offset,c+this.offset)},l.prototype.copy=function(a,b,c,d){var e=this;if(c||(c=0),d||(d=this.length),b||(b=0),c>d)throw new Error("sourceEnd < sourceStart");if(d===c)return 0;if(0==a.length||0==e.length)return 0;if(0>b||b>=a.length)throw new Error("targetStart out of bounds");if(0>c||c>=e.length)throw new Error("sourceStart out of bounds");if(0>d||d>e.length)throw new Error("sourceEnd out of bounds");return d>this.length&&(d=this.length),a.length-bthis.length)throw new Error("oob");if(a>b)throw new Error("oob");return new l(this.parent,b-a,+a+this.offset)},l.prototype.utf8Slice=function(a,b){return this.toString("utf8",a,b)},l.prototype.binarySlice=function(a,b){return this.toString("binary",a,b)},l.prototype.asciiSlice=function(a,b){return this.toString("ascii",a,b)},l.prototype.utf8Write=function(a,b){return this.write(a,b,"utf8")},l.prototype.binaryWrite=function(a,b){return this.write(a,b,"binary")},l.prototype.asciiWrite=function(a,b){return this.write(a,b,"ascii")},l.prototype.readUInt8=function(a,b){var c=this;return b||(D.ok(void 0!==a&&null!==a,"missing offset"),D.ok(a=0?d.writeUInt8(a,b,c):d.writeUInt8(255+a+1,b,c)},l.prototype.writeInt16LE=function(a,b,c){z(this,a,b,!1,c)},l.prototype.writeInt16BE=function(a,b,c){z(this,a,b,!0,c)},l.prototype.writeInt32LE=function(a,b,c){A(this,a,b,!1,c)},l.prototype.writeInt32BE=function(a,b,c){A(this,a,b,!0,c)},l.prototype.writeFloatLE=function(a,b,c){B(this,a,b,!1,c)},l.prototype.writeFloatBE=function(a,b,c){B(this,a,b,!0,c)},l.prototype.writeDoubleLE=function(a,b,c){C(this,a,b,!1,c)},l.prototype.writeDoubleBE=function(a,b,c){C(this,a,b,!0,c)},d.prototype.readUInt8=l.prototype.readUInt8,d.prototype.readUInt16LE=l.prototype.readUInt16LE,d.prototype.readUInt16BE=l.prototype.readUInt16BE,d.prototype.readUInt32LE=l.prototype.readUInt32LE,d.prototype.readUInt32BE=l.prototype.readUInt32BE,d.prototype.readInt8=l.prototype.readInt8,d.prototype.readInt16LE=l.prototype.readInt16LE,d.prototype.readInt16BE=l.prototype.readInt16BE,d.prototype.readInt32LE=l.prototype.readInt32LE,d.prototype.readInt32BE=l.prototype.readInt32BE,d.prototype.readFloatLE=l.prototype.readFloatLE,d.prototype.readFloatBE=l.prototype.readFloatBE,d.prototype.readDoubleLE=l.prototype.readDoubleLE,d.prototype.readDoubleBE=l.prototype.readDoubleBE,d.prototype.writeUInt8=l.prototype.writeUInt8,d.prototype.writeUInt16LE=l.prototype.writeUInt16LE,d.prototype.writeUInt16BE=l.prototype.writeUInt16BE,d.prototype.writeUInt32LE=l.prototype.writeUInt32LE,d.prototype.writeUInt32BE=l.prototype.writeUInt32BE,d.prototype.writeInt8=l.prototype.writeInt8,d.prototype.writeInt16LE=l.prototype.writeInt16LE,d.prototype.writeInt16BE=l.prototype.writeInt16BE,d.prototype.writeInt32LE=l.prototype.writeInt32LE,d.prototype.writeInt32BE=l.prototype.writeInt32BE,d.prototype.writeFloatLE=l.prototype.writeFloatLE,d.prototype.writeFloatBE=l.prototype.writeFloatBE,d.prototype.writeDoubleLE=l.prototype.writeDoubleLE,d.prototype.writeDoubleBE=l.prototype.writeDoubleBE},{assert:1,"./buffer_ieee754":8,"base64-js":9}],9:[function(a,b){!function(){"use strict";function a(a){var b,c,e,f,g,h;if(a.length%4>0)throw"Invalid string. Length must be a multiple of 4";for(g=a.indexOf("="),g=g>0?a.length-g:0,h=[],e=g>0?a.length-4:a.length,b=0,c=0;e>b;b+=4,c+=3)f=d.indexOf(a[b])<<18|d.indexOf(a[b+1])<<12|d.indexOf(a[b+2])<<6|d.indexOf(a[b+3]),h.push((16711680&f)>>16),h.push((65280&f)>>8),h.push(255&f);return 2===g?(f=d.indexOf(a[b])<<2|d.indexOf(a[b+1])>>4,h.push(255&f)):1===g&&(f=d.indexOf(a[b])<<10|d.indexOf(a[b+1])<<4|d.indexOf(a[b+2])>>2,h.push(255&f>>8),h.push(255&f)),h}function c(a){function b(a){return d[63&a>>18]+d[63&a>>12]+d[63&a>>6]+d[63&a]}var c,e,f,g=a.length%3,h="";for(c=0,f=a.length-g;f>c;c+=3)e=(a[c]<<16)+(a[c+1]<<8)+a[c+2],h+=b(e);switch(g){case 1:e=a[a.length-1],h+=d[e>>2],h+=d[63&e<<4],h+="==";break;case 2:e=(a[a.length-2]<<8)+a[a.length-1],h+=d[e>>10],h+=d[63&e>>4],h+=d[63&e<<2],h+="="}return h}var d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";b.exports.toByteArray=a,b.exports.fromByteArray=c}()},{}]},{},[]),b.exports=a("buffer-browserify")},{}],51:[function(a,b){var c=b.exports={};c.nextTick=function(){var a="undefined"!=typeof window&&window.setImmediate,b="undefined"!=typeof window&&window.postMessage&&window.addEventListener;
+if(a)return function(a){return window.setImmediate(a)};if(b){var c=[];return window.addEventListener("message",function(a){if(a.source===window&&"process-tick"===a.data&&(a.stopPropagation(),c.length>0)){var b=c.shift();b()}},!0),function(a){c.push(a),window.postMessage("process-tick","*")}}return function(a){setTimeout(a,0)}}(),c.title="browser",c.browser=!0,c.env={},c.argv=[],c.binding=function(){throw new Error("process.binding is not supported")},c.cwd=function(){return"/"},c.chdir=function(){throw new Error("process.chdir is not supported")}},{}],52:[function(a,b,c){!function(){"use strict";function d(a){var b=function(a){return"string"==typeof a?a:"object"==typeof a?a.hashCode?a.hashCode():""+a:""+a},c=a.declare({instance:{constructor:function(){this.__entries=[],this.__keys=[],this.__values=[]},pushValue:function(a,b){return this.__keys.push(a),this.__values.push(b),this.__entries.push({key:a,value:b}),b},remove:function(a){for(var b,c=null,d=this.__entries,e=this.__keys,f=this.__values,g=d.length-1;g>=0;g--)if((b=d[g])&&b.key===a)return d.splice(g,1),e.splice(g,1),f.splice(g,1),b.value;return c},set:function(a,b){for(var c=null,d=this.__entries,e=this.__values,f=d.length-1;f>=0;f--){var g=d[f];if(g&&a===g.key){e[f]=b,g.value=b,c=b;break}}return c||d.push({key:a,value:b}),c},find:function(a){for(var b,c=null,d=this.__entries,e=d.length-1;e>=0;e--)if(b=d[e],b&&a===b.key){c=b.value;break}return c},getEntrySet:function(){return this.__entries},getKeys:function(){return this.__keys},getValues:function(){return this.__values}}});return a.declare({instance:{constructor:function(){this.__map={}},entrySet:function(){var a=[],b=this.__map;for(var c in b)b.hasOwnProperty(c)&&(a=a.concat(b[c].getEntrySet()));return a},put:function(a,d){var e=b(a),f=null;return(f=this.__map[e])||(f=this.__map[e]=new c),f.pushValue(a,d),d},remove:function(a){var c=b(a),d=null,e=this.__map[c];return e&&(d=e.remove(a)),d},get:function(a){var c,d=b(a),e=null;return(c=this.__map[d])&&(e=c.find(a)),e},set:function(a,d){var e=b(a),f=null,g=null,h=this.__map;return f=(g=h[e])?g.set(a,d):(h[e]=new c).pushValue(a,d)},contains:function(a){var c=b(a),d=!1,e=null;return(e=this.__map[c])&&(d=!!e.find(a)),d},concat:function(a){if(a instanceof this._static){for(var b=new this._static,c=a.entrySet().concat(this.entrySet()),d=c.length-1;d>=0;d--){var e=c[d];b.put(e.key,e.value)}return b}throw new TypeError("When joining hashtables the joining arg must be a HashTable")},filter:function(b,c){var d=this.entrySet(),e=new this._static;d=a.filter(d,b,c);for(var f=d.length-1;f>=0;f--){var g=d[f];e.put(g.key,g.value)}return e},forEach:function(b,c){var d=this.entrySet();a.forEach(d,b,c)},every:function(b,c){var d=this.entrySet();return a.every(d,b,c)},map:function(b,c){var d=this.entrySet();return a.map(d,b,c)},some:function(b,c){var d=this.entrySet();return a.some(d,b,c)},reduce:function(b,c){var d=this.entrySet();return a.reduce(d,b,c)},reduceRight:function(b,c){var d=this.entrySet();return a.reduceRight(d,b,c)},clear:function(){this.__map={}},keys:function(){var a=[],b=this.__map;for(var c in b)a=a.concat(b[c].getKeys());return a},values:function(){var a=[],b=this.__map;for(var c in b)a=a.concat(b[c].getValues());return a},isEmpty:function(){return 0===this.keys().length}}})}"undefined"!=typeof c?"undefined"!=typeof b&&b.exports&&(b.exports=d(a("extended")().register("declare",a("declare.js")).register(a("is-extended")).register(a("array-extended")))):"function"==typeof define?define(["extended","declare","is-extended","array-extended"],function(a,b,c,e){return d(a().register("declare",b).register(c).register(e))}):this.Ht=d(this.extended().register("declare",this.declare).register(this.isExtended).register(this.arrayExtended))}.call(this)},{"array-extended":39,"declare.js":42,extended:43,"is-extended":53}],53:[function(a,b,c){var d=a("__browserify_Buffer").Buffer;!function(){"use strict";function e(a){function b(a,b){var c=-1,d=0,e=a.length,f=[];for(b=b||0,c+=b;++c=0;f--)if(g[f]!==h[f])return!1;for(f=g.length-1;f>=0;f--)if(d=g[f],!e(a[d],b[d]))return!1}catch(i){return!1}return!0}function g(a){return null!==a&&"object"==typeof a}function h(a){var b=g(a);return b&&a.constructor===Object&&!a.nodeType&&!a.setInterval}function i(a){return W(a)?0===a.length:g(a)?0===c(a).length:r(a)||X(a)?0===a.length:!0}function j(a){return a===!0||a===!1||"[object Boolean]"===U.call(a)}function k(a){return"undefined"==typeof a}function l(a){return!k(a)}function m(a){return k(a)||n(a)}function n(a){return null===a}function o(a,b){return V(b)?a instanceof b:!1}function p(a){return"[object RegExp]"===U.call(a)}function q(a){return"[object Date]"===U.call(a)}function r(a){return"[object String]"===U.call(a)}function s(a){return"[object Number]"===U.call(a)}function t(a){return a===!0}function u(a){return a===!1}function v(a){return!n(a)}function w(a,b){return a==b}function x(a,b){return a!=b}function y(a,b){return a===b}function z(a,b){return a!==b}function A(a,b){if(X(b)&&Array.prototype.indexOf||r(b))return b.indexOf(a)>-1;if(X(b))for(var c=0,d=b.length;d>c;c++)if(w(a,b[c]))return!0;return!1}function B(a,b){return!A(a,b)}function C(a,b){return b>a}function D(a,b){return b>=a}function E(a,b){return a>b}function F(a,b){return a>=b}function G(a,b){return r(b)?null!==(""+a).match(b):p(b)?b.test(a):!1}function H(a,b){return!G(a,b)}function I(a,b){return A(b,a)}function J(a,b){return!A(b,a)}function K(a,b,c){return X(a)&&a.length>c?w(a[c],b):!1}function L(a,b,c){return X(a)?!w(a[c],b):!1}function M(a,b){return T.call(a,b)}function N(a,b){return!M(a,b)}function O(a,b){return M(a,"length")?a.length===b:!1}function P(a,b){return M(a,"length")?a.length!==b:!1}function Q(a){Z[a]=function(){this._testers.push(Y[a])}}function R(a){$[a]=function(){var c,d=b(arguments,1),e=Y[a],f=!0;if(d.length<=e.length-1)throw new TypeError("A handler must be defined when calling using switch");if(c=d.pop(),j(c)&&(f=c,c=d.pop()),!V(c))throw new TypeError("handler must be defined");this._cases.push(function(a){return e.apply(Y,a.concat(d))?[f,c.apply(this,a)]:[!1]})}}var S=Array.prototype.slice,T=Object.prototype.hasOwnProperty,U=Object.prototype.toString,V=function(a){return"[object Function]"===U.call(a)};"undefined"==typeof window||V(window.alert)||function(a){V=function(b){return"[object Function]"===U.call(b)||b===a}}(window.alert);var W=function(a){return"[object Arguments]"===U.call(a)};W(arguments)||(W=function(a){return!(!a||!T.call(a,"callee"))});var X=Array.isArray||function(a){return"[object Array]"===U.call(a)},Y={isFunction:V,isObject:g,isEmpty:i,isHash:h,isNumber:s,isString:r,isDate:q,isArray:X,isBoolean:j,isUndefined:k,isDefined:l,isUndefinedOrNull:m,isNull:n,isArguments:W,instanceOf:o,isRegExp:p,deepEqual:e,isTrue:t,isFalse:u,isNotNull:v,isEq:w,isNeq:x,isSeq:y,isSneq:z,isIn:A,isNotIn:B,isLt:C,isLte:D,isGt:E,isGte:F,isLike:G,isNotLike:H,contains:I,notContains:J,has:M,notHas:N,isLength:O,isNotLength:P,containsAt:K,notContainsAt:L},Z={constructor:function(){this._testers=[]},noWrap:{tester:function(){var a=this._testers;return function(b){for(var c=!1,d=0,e=a.length;e>d&&!c;d++)c=a[d](b);return c}}}},$={constructor:function(){this._cases=[],this.__default=null},def:function(a,b){this.__default=b},noWrap:{switcher:function(){var a=this._cases,c=this.__default;return function(){for(var d,e=!1,f=b(arguments),g=0,h=a.length;h>g&&!e;g++)if(d=a[g](f),d.length>1&&(d[1]||d[0]))return d[1];return!e&&c?c.apply(this,f):void 0}}}};for(var _ in Y)T.call(Y,_)&&(R(_),Q(_));var ab=a.define(Y).expose(Y);return ab.tester=a.define(Z),ab.switcher=a.define($),ab}"undefined"!=typeof c?"undefined"!=typeof b&&b.exports&&(b.exports=e(a("extended"))):"function"==typeof define&&define.amd?define(["extended"],function(a){return e(a)}):this.isExtended=e(this.extended)}.call(this)},{__browserify_Buffer:50,extended:43}],54:[function(a,b,c){!function(){"use strict";function d(a){function b(a,b){var c=0;return a>b?1:b>a?-1:b?c:1}var c=a.multiply,d=a.declare({instance:{__printNode:function(b,d){var e=[];a.isUndefinedOrNull(b)?(e.push(c(" ",d)),e.push("~"),console.log(e.join(""))):(this.__printNode(b.right,d+1),e.push(c(" ",d)),e.push(b.data+"\n"),console.log(e.join("")),this.__printNode(b.left,d+1))},constructor:function(a){a=a||{},this.compare=a.compare||b,this.__root=null},insert:function(){throw new Error("Not Implemented")},remove:function(){throw new Error("Not Implemented")},clear:function(){this.__root=null},isEmpty:function(){return!this.__root},traverseWithCondition:function(a,b,c){var e=!0;return a&&(b=b||d.PRE_ORDER,b===d.PRE_ORDER?(e=c(a.data),e&&(e=this.traverseWithCondition(a.left,b,c),e&&(e=this.traverseWithCondition(a.right,b,c)))):b===d.IN_ORDER?(e=this.traverseWithCondition(a.left,b,c),e&&(e=c(a.data),e&&(e=this.traverseWithCondition(a.right,b,c)))):b===d.POST_ORDER?(e=this.traverseWithCondition(a.left,b,c),e&&(e&&(e=this.traverseWithCondition(a.right,b,c)),e&&(e=c(a.data)))):b===d.REVERSE_ORDER&&(e=this.traverseWithCondition(a.right,b,c),e&&(e=c(a.data),e&&(e=this.traverseWithCondition(a.left,b,c))))),e},traverse:function(a,b,c){a&&(b=b||d.PRE_ORDER,b===d.PRE_ORDER?(c(a.data),this.traverse(a.left,b,c),this.traverse(a.right,b,c)):b===d.IN_ORDER?(this.traverse(a.left,b,c),c(a.data),this.traverse(a.right,b,c)):b===d.POST_ORDER?(this.traverse(a.left,b,c),this.traverse(a.right,b,c),c(a.data)):b===d.REVERSE_ORDER&&(this.traverse(a.right,b,c),c(a.data),this.traverse(a.left,b,c)))},forEach:function(a,b,c){if("function"!=typeof a)throw new TypeError;c=c||d.IN_ORDER,b=b||this,this.traverse(this.__root,c,function(c){a.call(b,c,this)})},map:function(a,b,c){if("function"!=typeof a)throw new TypeError;c=c||d.IN_ORDER,b=b||this;var e=new this._static;return this.traverse(this.__root,c,function(c){e.insert(a.call(b,c,this))}),e},filter:function(a,b,c){if("function"!=typeof a)throw new TypeError;c=c||d.IN_ORDER,b=b||this;var e=new this._static;return this.traverse(this.__root,c,function(c){a.call(b,c,this)&&e.insert(c)}),e},reduce:function(b,c,d){var e=this.toArray(d),f=[e,b];return a.isUndefinedOrNull(c)||f.push(c),a.reduce.apply(a,f)},reduceRight:function(b,c,d){var e=this.toArray(d),f=[e,b];return a.isUndefinedOrNull(c)||f.push(c),a.reduceRight.apply(a,f)},every:function(a,b,c){if("function"!=typeof a)throw new TypeError;c=c||d.IN_ORDER,b=b||this;var e=!1;return this.traverseWithCondition(this.__root,c,function(c){return e=a.call(b,c,this)}),e},some:function(a,b,c){if("function"!=typeof a)throw new TypeError;c=c||d.IN_ORDER,b=b||this;var e;return this.traverseWithCondition(this.__root,c,function(c){return e=a.call(b,c,this),!e}),e},toArray:function(a){a=a||d.IN_ORDER;var b=[];return this.traverse(this.__root,a,function(a){b.push(a)}),b},contains:function(a){for(var b=!1,c=this.__root;null!==c;){var d=this.compare(a,c.data);d?c=c[-1===d?"left":"right"]:(b=!0,c=null)}return b},find:function(a){for(var b,c=this.__root;c;){var d=this.compare(a,c.data);if(!d){b=c.data;break}c=c[-1===d?"left":"right"]}return b},findLessThan:function(a,b){var c=[],e=this.compare;return this.traverseWithCondition(this.__root,d.IN_ORDER,function(d){var f=e(a,d);return!b&&0===f||1===f?(c.push(d),!0):!1}),c},findGreaterThan:function(a,b){var c=[],e=this.compare;return this.traverse(this.__root,d.REVERSE_ORDER,function(d){var f=e(a,d);return!b&&0===f||-1===f?(c.push(d),!0):!1}),c},print:function(){this.__printNode(this.__root,0)}},"static":{PRE_ORDER:"pre_order",IN_ORDER:"in_order",POST_ORDER:"post_order",REVERSE_ORDER:"reverse_order"}}),e=function(){var a=Math.abs,b=function(a){return{data:a,balance:0,left:null,right:null}},e=function(a,b,c){var d=a[c];return a[c]=d[b],d[b]=a,d},f=function(a,b,c){return a[c]=e(a[c],c,b),e(a,b,c)},g=function(a,b,c){var d="left"===b?"right":"left",e=a[b],f=e[d];0===f.balance?a.balance=e.balance=0:f.balance===c?(a.balance=-c,e.balance=0):(a.balance=0,e.balance=c),f.balance=0},h=function(a,b){var c="left"===b?"right":"left",d=a[b],h="left"===b?-1:1;return d.balance===h?(a.balance=d.balance=0,a=e(a,c,b)):(g(a,b,h),a=f(a,c,b)),a},i=function(a,b,c){var d="left"===b?"right":"left",h=a[d],i="left"===b?-1:1;return h.balance===-i?(a.balance=h.balance=0,a=e(a,b,d)):h.balance===i?(g(a,d,-i),a=f(a,b,d)):(a.balance=-i,h.balance=i,a=e(a,b,d),c.done=!0),a},j=function(c,d,e,f){if(null===c||void 0===c)c=b(d);else{var g=-1===f(d,c.data)?"left":"right";c[g]=j(c[g],d,e,f),e.done||(c.balance+="left"===g?-1:1,0===c.balance?e.done=!0:a(c.balance)>1&&(c=h(c,g),e.done=!0))}return c},k=function(b,c,d,e){var f,g,h,j;if(b){if(g=e(c,b.data),0===g){var l=b.left,m=b.right;if(!l||!m)return f=l?"left":"right",h=b[f];for(var n=l;null!==(m=n.right);)n=m;b.data=n.data,c=n.data}if(f=-1===e(b.data,c)?"right":"left",b[f]=k(b[f],c,d,e),!d.done){j=b.balance+="left"===f?1:-1;var o=a(j);1===o?d.done=!0:o>1&&(b=i(b,f,d))}}return b};return d.extend({instance:{insert:function(a){var b={done:!1};this.__root=j(this.__root,a,b,this.compare)},remove:function(a){this.__root=k(this.__root,a,{done:!1},this.compare)},__printNode:function(a,b){var d=[];a?(this.__printNode(a.right,b+1),d.push(c(" ",b)),d.push(a.data+":"+a.balance+"\n"),console.log(d.join("")),this.__printNode(a.left,b+1)):(d.push(c(" ",b)),d.push("~"),console.log(d.join("")))}}})}(),f=function(){function a(a,b){return{data:a,level:b,left:g,right:g}}function b(a){if(0!==a.level&&a.left.level===a.level){var b=a.left;a.left=b.right,b.right=a,a=b}return a}function e(a){if(0!==a.level&&a.right.right.level===a.level){var b=a.right;a.right=b.left,b.left=a,a=b,a.level++}return a}function f(c,d,h){if(c===g)c=a(d,1);else{var i=-1===h(d,c.data)?"left":"right";c[i]=f(c[i],d,h),c=b(c),c=e(c)}return c}var g={level:0,data:null},h=function(a,c,d){var f,i;if(a!==g){var j=d(c,a.data);if(0===j)if(f=a.left,i=a.right,f!==g&&i!==g){for(var k=f;k.right!==g;)k=k.right;a.data=k.data,a.left=h(f,k.data,d)}else a=a[f===g?"right":"left"];else{var l=-1===j?"left":"right";a[l]=h(a[l],c,d)}}if(a!==g){var m=a.level,n=a.left.level,o=a.right.level;(m-1>n||m-1>o)&&(o>--a.level&&(a.right.level=a.level),a=b(a),a=e(a))}return a};return d.extend({instance:{isEmpty:function(){return this.__root===g||this._super(arguments)},insert:function(a){this.__root||(this.__root=g),this.__root=f(this.__root,a,this.compare)},remove:function(a){this.__root=h(this.__root,a,this.compare)},traverseWithCondition:function(a){var b=!0;return a!==g?this._super(arguments):b},traverse:function(a){a!==g&&this._super(arguments)},contains:function(){return this.__root!==g?this._super(arguments):!1},__printNode:function(a,b){var d=[];a&&a.data?(this.__printNode(a.right,b+1),d.push(c(" ",b)),d.push(a.data+":"+a.level+"\n"),console.log(d.join("")),this.__printNode(a.left,b+1)):(d.push(c(" ",b)),d.push("~"),console.log(d.join("")))}}})}(),g=d.extend({instance:{insert:function(a){if(!this.__root)return this.__root={data:a,parent:null,left:null,right:null};for(var b=this.compare,c=this.__root;null!==c;){var d=b(a,c.data);if(!d)return;var e=-1===d?"left":"right",f=c[e];if(!f)return c[e]={data:a,parent:c,left:null,right:null};c=f}},remove:function(a){if(null!==this.__root){for(var b,c={right:this.__root},d=c,e=null,f="right";null!==d[f];){b=d,d=d[f];var g=this.compare(a,d.data);g||(e=d),f=-1===g?"left":"right"}null!==e&&(e.data=d.data,b[b.right===d?"right":"left"]=d[null===d.left?"right":"left"]),this.__root=c.right}}}}),h=function(){var a="RED",b="BLACK",e=function(a){return null!==a&&a.red},f=function(a){return{data:a,red:!0,left:null,right:null}},g=function(a,b,c){if(!a)return f(b);var d=c(b,a.data);if(d){var j=-1===d?"left":"right",k="left"===j?"right":"left";a[j]=g(a[j],b,c);var l=a[j];if(e(l)){var m=a[k];e(m)?(a.red=!0,l.red=!1,m.red=!1):e(l[j])?a=h(a,k):e(l[k])&&(a=i(a,k))}}return a},h=function(a,b){var c="left"===b?"right":"left",d=a[c];return a[c]=d[b],d[b]=a,a.red=!0,d.red=!1,d},i=function(a,b){var c="left"===b?"right":"left";return a[c]=h(a[c],c),h(a,b)},j=function(a,b,c,d){if(a){var f;if(0===d(b,a.data)){if(!a.left||!a.right){var g=a[a.left?"left":"right"];return e(a)?c.done=!0:e(g)&&(g.red=!1,c.done=!0),g}for(var h,i=a.right;null!==i.left;)h=i,i=i.left;h&&(h.left=null),a.data=i.data,b=i.data}f=-1===d(b,a.data)?"left":"right",a[f]=j(a[f],b,c,d),c.done||(a=k(a,f,c))}else c.done=!0;return a},k=function(a,b,c){var d="left"===b?"right":"left",f=a,g=f[d];if(e(g)&&(a=h(a,b),g=f[d]),null!==g)if(e(g.left)||e(g.right)){var j=f.red,k=a===f;f=(e(g[d])?h:i)(f,b),f.red=j,f.left.red=f.right.red=0,k?a=f:a[b]=f,c.done=!0}else e(f)&&(c.done=!0),f.red=0,g.red=1;return a};return d.extend({instance:{insert:function(a){this.__root=g(this.__root,a,this.compare),this.__root.red=!1},remove:function(a){var b={done:!1},c=j(this.__root,a,b,this.compare);return null!==c&&(c.red=0),this.__root=c,a},__printNode:function(d,e){var f=[];d?(this.__printNode(d.right,e+1),f.push(c(" ",e)),f.push((d.red?a:b)+":"+d.data+"\n"),console.log(f.join("")),this.__printNode(d.left,e+1)):(f.push(c(" ",e)),f.push("~"),console.log(f.join("")))}}})}();return{Tree:d,AVLTree:e,AnderssonTree:f,BinaryTree:g,RedBlackTree:h,IN_ORDER:d.IN_ORDER,PRE_ORDER:d.PRE_ORDER,POST_ORDER:d.POST_ORDER,REVERSE_ORDER:d.REVERSE_ORDER}}"undefined"!=typeof c?"undefined"!=typeof b&&b.exports&&(b.exports=d(a("extended")().register("declare",a("declare.js")).register(a("is-extended")).register(a("array-extended")).register(a("string-extended")))):"function"==typeof define?define(["extended","declare.js","is-extended","array-extended","string-extended"],function(a,b,c,e,f){return d(a().register("declare",b).register(c).register(e).register(f))}):this.leafy=d(this.extended().register("declare",this.declare).register(this.isExtended).register(this.arrayExtended).register(this.stringExtended))}.call(this)},{"array-extended":39,"declare.js":42,extended:43,"is-extended":53,"string-extended":57}],55:[function(a,b,c){!function(){"use strict";function d(a,b,c){function d(a,b){var c,d;for(c in b)t.call(b,c)&&(d=b[c],c in a&&a[c]===d||(a[c]=d));return a}function e(a,b){var c,d,f;for(c in b)t.call(b,c)&&(d=b[c],f=a[c],p(f,d)||(a[c]=r(f)&&r(d)?e(f,d):r(d)?e({},d):d));return a}function f(a){a||(a={});for(var b=1,c=arguments.length;c>b;b++)d(a,arguments[b]);return a}function g(a){a||(a={});for(var b=1,c=arguments.length;c>b;b++)e(a,arguments[b]);return a}function h(a,b){var c=a.prototype||a;return f(c,b),a}function i(a,b,c){if(!r(a)||!u(b))throw new TypeError;for(var d,e=l(a),f=0,g=e.length;g>f;++f)d=e[f],b.call(c||a,a[d],d,a);return a}function j(a,b,c){if(!r(a)||!u(b))throw new TypeError;for(var d,e,f=l(a),g={},h=0,i=f.length;i>h;++h)d=f[h],e=a[d],b.call(c||a,e,d,a)&&(g[d]=e);return g}function k(a){if(!r(a))throw new TypeError;for(var b=l(a),c=[],d=0,e=b.length;e>d;++d)c.push(a[b[d]]);return c}function l(a){if(!r(a))throw new TypeError;var b=[];for(var c in a)t.call(a,c)&&b.push(c);return b}function m(a){if(!r(a))throw new TypeError;for(var b,c=l(a),d={},e=0,f=c.length;f>e;++e)b=c[e],d[a[b]]=b;return d}function n(a){if(!r(a))throw new TypeError;for(var b,c=l(a),d=[],e=0,f=c.length;f>e;++e)b=c[e],d.push([b,a[b]]);return d}function o(a,b){if(!r(a))throw new TypeError;q(b)&&(b=[b]);for(var c,d=s(l(a),b),e={},f=0,g=d.length;g>f;++f)c=d[f],e[c]=a[c];return e}var p=b.deepEqual,q=b.isString,r=b.isHash,s=c.difference,t=Object.prototype.hasOwnProperty,u=b.isFunction,v={forEach:i,filter:j,invert:m,values:k,toArray:n,keys:l,omit:o},w={extend:h,merge:f,deepMerge:g,omit:o},x=a.define(b.isObject,w).define(r,v).define(b.isFunction,{extend:h}).expose({hash:v}).expose(w),y=x.extend;return x.extend=function(){return 1===arguments.length?y.extend.apply(x,arguments):(h.apply(null,arguments),void 0)},x}"undefined"!=typeof c?"undefined"!=typeof b&&b.exports&&(b.exports=d(a("extended"),a("is-extended"),a("array-extended"))):"function"==typeof define&&define.amd?define(["extended","is-extended","array-extended"],function(a,b,c){return d(a,b,c)}):this.objectExtended=d(this.extended,this.isExtended,this.arrayExtended)}.call(this)},{"array-extended":39,extended:43,"is-extended":53}],56:[function(a,b,c){var d=a("__browserify_process");!function(){"use strict";function e(a,b,c,e,f,g){function h(a,b){return function(){try{l(a.apply(null,arguments)).addCallback(b).addErrback(b)}catch(c){b.errback(c)}}}function i(a,b,c){var d=(new G).callback();return v(a,function(a){d=d.then(c?a:B(null,a)),c||(d=d.then(function(a){return b.push(a),b}))}),d}function j(a){return!w(a)&&y(a.then)}function k(a){var b=new G;return a.then(A(b,"callback"),A(b,"errback")),b.promise()}function l(a){var b;return a=C(arguments),a.length?1===a.length?(a=a.pop(),j(a)?a.addCallback&&a.addErrback?(b=new G,a.addCallback(b.callback),a.addErrback(b.errback)):b=k(a):b=x(a)&&c.every(a,j)?new H(a,!0).promise():(new G).callback(a)):b=new H(c.map(a,function(a){return l(a)}),!0).promise():b=(new G).callback(a).promise(),b}function m(a,b){return function(){var c=new G,d=C(arguments);return d.push(c.resolve),a.apply(b||this,d),c.promise()}}function n(a){if(x(a))return i(a,[],!1);throw new Error("When calling promise.serial the first argument must be an array")}function o(a){if(x(a))return i(a,[],!0);throw new Error("When calling promise.serial the first argument must be an array")}function p(a,b){a=C(arguments);var c=!1;b=a.pop();var d=l(a);return function(){return c?l(b.apply(this,arguments)):(a=arguments,d.then(A(this,function(){return c=!0,b.apply(this,a)})))}}function q(){return new G}function r(a){return new H(a,!0).promise()}function s(a){return q().errback(a)}function t(a){return q().callback(a)}var u,v=c.forEach,w=e.isUndefinedOrNull,x=e.isArray,y=e.isFunction,z=e.isBoolean,A=f.bind,B=f.bindIgnore,C=g.argsToArray;if("function"==typeof setImmediate)u="undefined"!=typeof window?setImmediate.bind(window):setImmediate;else if("undefined"!=typeof d)u=function(a){d.nextTick(a)};else if("undefined"!=typeof MessageChannel){var D=new MessageChannel,E={},F=E;D.port1.onmessage=function(){E=E.next;var a=E.task;delete E.task,a()},u=function(a){F=F.next={task:a},D.port2.postMessage(0)}}else u=function(a){setTimeout(a,0)};var G=a({instance:{__fired:!1,__results:null,__error:null,__errorCbs:null,__cbs:null,constructor:function(){this.__errorCbs=[],this.__cbs=[],f.bindAll(this,["callback","errback","resolve","classic","__resolve","addCallback","addErrback"])},__resolve:function(){if(!this.__fired){this.__fired=!0;var a,b=this.__error?this.__errorCbs:this.__cbs,c=b.length,d=this.__error||this.__results;for(a=0;c>a;a++)this.__callNextTick(b[a],d)}},__callNextTick:function(a,b){u(function(){a.apply(this,b)})},addCallback:function(a){return a&&(j(a)&&a.callback&&(a=a.callback),this.__fired&&this.__results?this.__callNextTick(a,this.__results):this.__cbs.push(a)),this},addErrback:function(a){return a&&(j(a)&&a.errback&&(a=a.errback),this.__fired&&this.__error?this.__callNextTick(a,this.__error):this.__errorCbs.push(a)),this},callback:function(){return this.__fired||(this.__results=arguments,this.__resolve()),this.promise()},errback:function(){return this.__fired||(this.__error=arguments,this.__resolve()),this.promise()},resolve:function(a){return a?this.errback(a):this.callback.apply(this,C(arguments,1)),this},classic:function(a){return"function"==typeof a&&(this.addErrback(function(b){a(b)}),this.addCallback(function(){a.apply(this,[null].concat(C(arguments)))})),this},then:function(a,b){var c=new G,d=c;return y(b)&&(d=h(b,c)),this.addErrback(d),y(a)?this.addCallback(h(a,c)):this.addCallback(c),c.promise()},both:function(a){return this.then(a,a)},promise:function(){var a={then:A(this,"then"),both:A(this,"both"),promise:function(){return a}};return v(["addCallback","addErrback","classic"],function(b){a[b]=A(this,function(){return this[b].apply(this,arguments),a})},this),a}}}),H=G.extend({instance:{__results:null,__errors:null,__promiseLength:0,__defLength:0,__firedLength:0,normalizeResults:!1,constructor:function(a,b){this.__errors=[],this.__results=[],this.normalizeResults=z(b)?b:!1,this._super(arguments),a&&a.length?(this.__defLength=a.length,v(a,this.__addPromise,this)):this.__resolve()},__addPromise:function(a,b){a.then(A(this,function(){var a=C(arguments);a.unshift(b),this.callback.apply(this,a)}),A(this,function(){var a=C(arguments);a.unshift(b),this.errback.apply(this,a)}))},__resolve:function(){if(!this.__fired){this.__fired=!0;var a,b=this.__errors.length?this.__errorCbs:this.__cbs,c=b.length,d=this.__errors.length?this.__errors:this.__results;for(a=0;c>a;a++)this.__callNextTick(b[a],d)}},__callNextTick:function(a,b){u(function(){a.apply(null,[b])})},addCallback:function(a){return a&&(j(a)&&a.callback&&(a=A(a,"callback")),this.__fired&&!this.__errors.length?this.__callNextTick(a,this.__results):this.__cbs.push(a)),this},addErrback:function(a){return a&&(j(a)&&a.errback&&(a=A(a,"errback")),this.__fired&&this.__errors.length?this.__callNextTick(a,this.__errors):this.__errorCbs.push(a)),this},callback:function(a){if(this.__fired)throw new Error("Already fired!");var b=C(arguments);return this.normalizeResults&&(b=b.slice(1),b=1===b.length?b.pop():b),this.__results[a]=b,this.__firedLength++,this.__firedLength===this.__defLength&&this.__resolve(),this.promise()},errback:function(a){if(this.__fired)throw new Error("Already fired!");var b=C(arguments);return this.normalizeResults&&(b=b.slice(1),b=1===b.length?b.pop():b),this.__errors[a]=b,this.__firedLength++,this.__firedLength===this.__defLength&&this.__resolve(),this.promise()}}});return b.define({isPromiseLike:j}).expose({isPromiseLike:j,when:l,wrap:m,wait:p,serial:n,chain:o,Promise:G,PromiseList:H,promise:q,defer:q,deferredList:r,reject:s,resolve:t})}"undefined"!=typeof c?"undefined"!=typeof b&&b.exports&&(b.exports=e(a("declare.js"),a("extended"),a("array-extended"),a("is-extended"),a("function-extended"),a("arguments-extended"))):"function"==typeof define&&define.amd?define(["declare","extended","array-extended","is-extended","function-extended","arguments-extended"],function(a,b,c,d,f,g){return e(a,b,c,d,f,g)}):this.promiseExtended=e(this.declare,this.extended,this.arrayExtended,this.isExtended,this.functionExtended,this.argumentsExtended)}.call(this)},{__browserify_process:51,"arguments-extended":38,"array-extended":39,"declare.js":42,extended:43,"function-extended":46,"is-extended":53}],57:[function(a,b,c){!function(){"use strict";function d(a,b,c,d){function e(a,b){var c=a;if(x.test(b)){var d=b.match(x),e=d[1],f=d[3],g=d[4];g&&(g=parseInt(g,10),c=c.length0?"+":"")+d),k&&(k=parseInt(k,10),d=d.lengthe;)d?a+=c:a=c+a,e++;return a}function i(a,c,d){var e=a;if(b.isString(e)){if(a.length>c)if(d){var f=a.length;e=a.substring(f-c,f)}else e=a.substring(0,c)}else e=i(""+e,c);return e}function j(a,d){if(d instanceof Array){var h=0,i=d.length;return a.replace(v,function(a,b,j){var k,l;if(!(i>h))return a;if(k=d[h++],"%s"===a||"%d"===a||"%D"===a)l=k+"";else if("%Z"===a)l=k.toUTCString();else if("%j"===a)try{l=s(k)}catch(m){throw new Error("stringExtended.format : Unable to parse json from ",k)}else switch(b=b.replace(/^\[|\]$/g,""),j){case"s":l=e(k,b);break;case"d":l=f(k,b);break;case"j":l=g(k,b);break;case"D":l=c.format(k,b);break;case"Z":l=c.format(k,b,!0)}return l})}if(t(d))return a.replace(w,function(a,h,i){if(i=d[i],!b.isUndefined(i)){if(!h)return""+i;if(b.isString(i))return e(i,h);if(b.isNumber(i))return f(i,h);if(b.isDate(i))return c.format(i,h);if(b.isObject(i))return g(i,h)}return a});var k=u.call(arguments).slice(1);return j(a,k)}function k(a,b){var c=[];return a&&(a.indexOf(b)>0?c=a.replace(/\s+/g,"").split(b):c.push(a)),c}function l(a,b){var c=[];if(b)for(var d=0;b>d;d++)c.push(a);return c.join("")}function m(a,c){var d,e,f;if(c)if(b.isArray(a))for(d=[],e=0,f=a.length;f>e;e++)d.push(m(a[e],c));else if(c instanceof Array)for(d=a,e=0,f=c.length;f>e;e++)d=m(d,c[e]);else c in z&&(d="["+z[c]+"m"+a+"[0m");return d}function n(a,b){return a.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g,function(a){return b&&-1!==d.indexOf(b,a)?a:"\\"+a})}function o(a){return a.replace(/^\s*|\s*$/g,"")}function p(a){return a.replace(/^\s*/,"")}function q(a){return a.replace(/\s*$/,"")}function r(a){return 0===a.length}var s;"undefined"==typeof JSON?function(){function a(a){return 10>a?"0"+a:a}function c(c){return b.isDate(c)?isFinite(c.valueOf())?c.getUTCFullYear()+"-"+a(c.getUTCMonth()+1)+"-"+a(c.getUTCDate())+"T"+a(c.getUTCHours())+":"+a(c.getUTCMinutes())+":"+a(c.getUTCSeconds())+"Z":null:i(c)?c.valueOf():c}function d(a){return j.lastIndex=0,j.test(a)?'"'+a.replace(j,function(a){var b=k[a];return"string"==typeof b?b:"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+a+'"'}function e(a,b){var i,j,k,l,m,n=f,o=b[a];switch(o&&(o=c(o)),"function"==typeof h&&(o=h.call(b,a,o)),typeof o){case"string":return d(o);case"number":return isFinite(o)?String(o):"null";case"boolean":case"null":return String(o);case"object":if(!o)return"null";if(f+=g,m=[],"[object Array]"===Object.prototype.toString.apply(o)){for(l=o.length,i=0;l>i;i+=1)m[i]=e(i,o)||"null";return k=0===m.length?"[]":f?"[\n"+f+m.join(",\n"+f)+"\n"+n+"]":"["+m.join(",")+"]",f=n,k}if(h&&"object"==typeof h)for(l=h.length,i=0;l>i;i+=1)"string"==typeof h[i]&&(j=h[i],k=e(j,o),k&&m.push(d(j)+(f?": ":":")+k));else for(j in o)Object.prototype.hasOwnProperty.call(o,j)&&(k=e(j,o),k&&m.push(d(j)+(f?": ":":")+k));return k=0===m.length?"{}":f?"{\n"+f+m.join(",\n"+f)+"\n"+n+"}":"{"+m.join(",")+"}",f=n,k}}var f,g,h,i=b.tester().isString().isNumber().isBoolean().tester(),j=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,k={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"};s=function(a,b,c){var d;if(f="",g="","number"==typeof c)for(d=0;c>d;d+=1)g+=" ";else"string"==typeof c&&(g=c);if(h=b,b&&"function"!=typeof b&&("object"!=typeof b||"number"!=typeof b.length))throw new Error("JSON.stringify");return e("",{"":a})}}():s=JSON.stringify;var t=b.isHash,u=Array.prototype.slice,v=/%((?:-?\+?.?\d*)?|(?:\[[^\[|\]]*\]))?([sjdDZ])/g,w=/\{(?:\[([^\[|\]]*)\])?(\w+)\}/g,x=/(-?)(\+?)([A-Z|a-z|\W]?)([1-9][0-9]*)?$/,y=/([1-9][0-9]*)$/g,z={bold:1,bright:1,italic:3,underline:4,blink:5,inverse:7,crossedOut:9,red:31,green:32,yellow:33,blue:34,magenta:35,cyan:36,white:37,redBackground:41,greenBackground:42,yellowBackground:43,blueBackground:44,magentaBackground:45,cyanBackground:46,whiteBackground:47,encircled:52,overlined:53,grey:90,black:90},A={SMILEY:"☺",SOLID_SMILEY:"☻",HEART:"♥",DIAMOND:"♦",CLOVE:"♣",SPADE:"♠",DOT:"•",SQUARE_CIRCLE:"◘",CIRCLE:"○",FILLED_SQUARE_CIRCLE:"◙",MALE:"♂",FEMALE:"♀",EIGHT_NOTE:"♪",DOUBLE_EIGHTH_NOTE:"♫",SUN:"☼",PLAY:"►",REWIND:"◄",UP_DOWN:"↕",PILCROW:"¶",SECTION:"§",THICK_MINUS:"▬",SMALL_UP_DOWN:"↨",UP_ARROW:"↑",DOWN_ARROW:"↓",RIGHT_ARROW:"→",LEFT_ARROW:"←",RIGHT_ANGLE:"∟",LEFT_RIGHT_ARROW:"↔",TRIANGLE:"▲",DOWN_TRIANGLE:"▼",HOUSE:"⌂",C_CEDILLA:"Ç",U_UMLAUT:"ü",E_ACCENT:"é",A_LOWER_CIRCUMFLEX:"â",A_LOWER_UMLAUT:"ä",A_LOWER_GRAVE_ACCENT:"à",A_LOWER_CIRCLE_OVER:"å",C_LOWER_CIRCUMFLEX:"ç",E_LOWER_CIRCUMFLEX:"ê",E_LOWER_UMLAUT:"ë",E_LOWER_GRAVE_ACCENT:"è",I_LOWER_UMLAUT:"ï",I_LOWER_CIRCUMFLEX:"î",I_LOWER_GRAVE_ACCENT:"ì",A_UPPER_UMLAUT:"Ä",A_UPPER_CIRCLE:"Å",E_UPPER_ACCENT:"É",A_E_LOWER:"æ",A_E_UPPER:"Æ",O_LOWER_CIRCUMFLEX:"ô",O_LOWER_UMLAUT:"ö",O_LOWER_GRAVE_ACCENT:"ò",U_LOWER_CIRCUMFLEX:"û",U_LOWER_GRAVE_ACCENT:"ù",Y_LOWER_UMLAUT:"ÿ",O_UPPER_UMLAUT:"Ö",U_UPPER_UMLAUT:"Ü",CENTS:"¢",POUND:"£",YEN:"¥",CURRENCY:"¤",PTS:"₧",FUNCTION:"ƒ",A_LOWER_ACCENT:"á",I_LOWER_ACCENT:"í",O_LOWER_ACCENT:"ó",U_LOWER_ACCENT:"ú",N_LOWER_TILDE:"ñ",N_UPPER_TILDE:"Ñ",A_SUPER:"ª",O_SUPER:"º",UPSIDEDOWN_QUESTION:"¿",SIDEWAYS_L:"⌐",NEGATION:"¬",ONE_HALF:"½",ONE_FOURTH:"¼",UPSIDEDOWN_EXCLAMATION:"¡",DOUBLE_LEFT:"«",DOUBLE_RIGHT:"»",LIGHT_SHADED_BOX:"░",MEDIUM_SHADED_BOX:"▒",DARK_SHADED_BOX:"▓",VERTICAL_LINE:"│",MAZE__SINGLE_RIGHT_T:"┤",MAZE_SINGLE_RIGHT_TOP:"┐",MAZE_SINGLE_RIGHT_BOTTOM_SMALL:"┘",MAZE_SINGLE_LEFT_TOP_SMALL:"┌",MAZE_SINGLE_LEFT_BOTTOM_SMALL:"└",MAZE_SINGLE_LEFT_T:"├",MAZE_SINGLE_BOTTOM_T:"┴",MAZE_SINGLE_TOP_T:"┬",MAZE_SINGLE_CENTER:"┼",MAZE_SINGLE_HORIZONTAL_LINE:"─",MAZE_SINGLE_RIGHT_DOUBLECENTER_T:"╡",MAZE_SINGLE_RIGHT_DOUBLE_BL:"╛",MAZE_SINGLE_RIGHT_DOUBLE_T:"╢",MAZE_SINGLE_RIGHT_DOUBLEBOTTOM_TOP:"╖",MAZE_SINGLE_RIGHT_DOUBLELEFT_TOP:"╕",MAZE_SINGLE_LEFT_DOUBLE_T:"╞",MAZE_SINGLE_BOTTOM_DOUBLE_T:"╧",MAZE_SINGLE_TOP_DOUBLE_T:"╤",MAZE_SINGLE_TOP_DOUBLECENTER_T:"╥",MAZE_SINGLE_BOTTOM_DOUBLECENTER_T:"╨",MAZE_SINGLE_LEFT_DOUBLERIGHT_BOTTOM:"╘",MAZE_SINGLE_LEFT_DOUBLERIGHT_TOP:"╒",MAZE_SINGLE_LEFT_DOUBLEBOTTOM_TOP:"╓",MAZE_SINGLE_LEFT_DOUBLETOP_BOTTOM:"╙",MAZE_SINGLE_LEFT_TOP:"Γ",MAZE_SINGLE_RIGHT_BOTTOM:"╜",MAZE_SINGLE_LEFT_CENTER:"╟",MAZE_SINGLE_DOUBLECENTER_CENTER:"╫",MAZE_SINGLE_DOUBLECROSS_CENTER:"╪",MAZE_DOUBLE_LEFT_CENTER:"╣",MAZE_DOUBLE_VERTICAL:"║",MAZE_DOUBLE_RIGHT_TOP:"╗",MAZE_DOUBLE_RIGHT_BOTTOM:"╝",MAZE_DOUBLE_LEFT_BOTTOM:"╚",MAZE_DOUBLE_LEFT_TOP:"╔",MAZE_DOUBLE_BOTTOM_T:"╩",MAZE_DOUBLE_TOP_T:"╦",MAZE_DOUBLE_LEFT_T:"╠",MAZE_DOUBLE_HORIZONTAL:"═",MAZE_DOUBLE_CROSS:"╬",SOLID_RECTANGLE:"█",THICK_LEFT_VERTICAL:"▌",THICK_RIGHT_VERTICAL:"▐",SOLID_SMALL_RECTANGLE_BOTTOM:"▄",SOLID_SMALL_RECTANGLE_TOP:"▀",PHI_UPPER:"Φ",INFINITY:"∞",INTERSECTION:"∩",DEFINITION:"≡",PLUS_MINUS:"±",GT_EQ:"≥",LT_EQ:"≤",THEREFORE:"⌠",SINCE:"∵",DOESNOT_EXIST:"∄",EXISTS:"∃",FOR_ALL:"∀",EXCLUSIVE_OR:"⊕",BECAUSE:"⌡",DIVIDE:"÷",APPROX:"≈",DEGREE:"°",BOLD_DOT:"∙",DOT_SMALL:"·",CHECK:"√",ITALIC_X:"✗",SUPER_N:"ⁿ",SQUARED:"²",CUBED:"³",SOLID_BOX:"■",PERMILE:"‰",REGISTERED_TM:"®",COPYRIGHT:"©",TRADEMARK:"™",BETA:"β",GAMMA:"γ",ZETA:"ζ",ETA:"η",IOTA:"ι",KAPPA:"κ",LAMBDA:"λ",NU:"ν",XI:"ξ",OMICRON:"ο",RHO:"ρ",UPSILON:"υ",CHI_LOWER:"φ",CHI_UPPER:"χ",PSI:"ψ",ALPHA:"α",ESZETT:"ß",PI:"π",SIGMA_UPPER:"Σ",SIGMA_LOWER:"σ",MU:"µ",TAU:"τ",THETA:"Θ",OMEGA:"Ω",DELTA:"δ",PHI_LOWER:"φ",EPSILON:"ε"},B={toArray:k,pad:h,truncate:i,multiply:l,format:j,style:m,escape:n,trim:o,trimLeft:p,trimRight:q,isEmpty:r};
+return a.define(b.isString,B).define(b.isArray,{style:m}).expose(B).expose({characters:A})}"undefined"!=typeof c?"undefined"!=typeof b&&b.exports&&(b.exports=d(a("extended"),a("is-extended"),a("date-extended"),a("array-extended"))):"function"==typeof define&&define.amd?define(["extended","is-extended","date-extended","array-extended"],function(a,b,c,e){return d(a,b,c,e)}):this.stringExtended=d(this.extended,this.isExtended,this.dateExtended,this.arrayExtended)}.call(this)},{"array-extended":39,"date-extended":40,extended:43,"is-extended":53}]},{},[1]);
\ No newline at end of file
diff --git a/package.json b/package.json
index d633713..291a0c2 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
"name": "nools",
"description": "A rules engine for node",
- "version": "0.1.12",
+ "version": "0.1.13",
"bin": {
"nools": "./bin/nools"
},
diff --git a/readme.md b/readme.md
index 41646ce..fd1ae67 100644
--- a/readme.md
+++ b/readme.md
@@ -23,6 +23,8 @@ Or [download the source](https://raw.github.com/C2FO/nools/master/nools.js) ([mi
* [Firing](#firing)
* [Disposing](#disposing)
* [Removing A Flow](#removing-flow)
+ * [Removing All Flows](#removing-flows)
+ * [Checking If A Flow Exists](#checking-for-flow)
* [Agenda Group](#agenda-groups)
* [Focus](#agenda-groups-focus)
* [Auto Focus](#agenda-groups-auto-focus)
@@ -439,6 +441,33 @@ nools.deleteFlow(myFlow); //returns nools for chaining
nools.getFlow("flow"); //undefined
```
+
+# Removing All Flows
+
+To remove all flow from `nools` use the `deleteFlows` function.
+
+```javascript
+var myFlow = nools.flow("flow");
+
+nools.deleteFlows(); //returns nools for chaining
+
+nools.getFlow("flow"); //undefined
+
+```
+
+
+
+# Checking If A Flow Exists
+
+To check if a flow currently is registering with `nools` use the `hasFlow` function;
+
+```javascript
+var myFlow = nools.flow("flow");
+
+nools.hasFlow("flow"); //true
+
+```
+
## Agenda Groups
diff --git a/test/flow.dsl.test.js b/test/flow.dsl.test.js
index cb467d8..a82601c 100644
--- a/test/flow.dsl.test.js
+++ b/test/flow.dsl.test.js
@@ -53,7 +53,6 @@ it.describe("Flow dsl", function (it) {
});
});
-
});
it.describe("scoped functions", function (it) {
diff --git a/test/flow.test.js b/test/flow.test.js
index 32c5973..65cd5f3 100644
--- a/test/flow.test.js
+++ b/test/flow.test.js
@@ -5,7 +5,7 @@ var it = require("it"),
nools = require("../index");
it.describe("nools", function (it) {
- it.describe("#flow", function (it) {
+ it.describe(".flow", function (it) {
it.should("create a flow", function () {
var flow = nools.flow("nools flow");
assert.isNotNull(flow);
@@ -15,7 +15,7 @@ it.describe("nools", function (it) {
});
});
- it.describe("#deleteFlow", function (it) {
+ it.describe(".deleteFlow", function (it) {
it.should("delete a flow by name", function () {
var flow = nools.flow("delete nools flow");
assert.isNotNull(flow);
@@ -40,6 +40,32 @@ it.describe("nools", function (it) {
});
});
+
+ it.describe(".hasFlow", function (it) {
+
+ it.should("return true if the flow exists", function () {
+ var name = "has flow",
+ flow = nools.flow(name);
+ assert.isTrue(nools.hasFlow(name));
+ });
+
+ it.should("return false if the flow does not exists", function () {
+ assert.isFalse(nools.hasFlow(new Date().toString()));
+ });
+ });
+
+ it.describe(".deleteFlows", function (it) {
+
+ it.should("deleteAllFlows", function () {
+ var name = "delete nools flows";
+ nools.flow(name);
+ assert.isTrue(nools.hasFlow(name));
+ debugger;
+ assert.equal(nools.deleteFlows(), nools);
+ assert.isFalse(nools.hasFlow(name));
+ });
+
+ });
});
it.describe("Flow", function (it) {
@@ -217,35 +243,120 @@ it.describe("Flow", function (it) {
this.called = 0;
}, called = new Count();
- var flow = nools.flow("hello world flow 3", function (flow) {
- flow.rule("hello rule", [
- ["or",
- [String, "s", "s == 'hello'"],
- [String, "s", "s == 'world'"]
- ],
- [Count, "called", null]
- ], function (facts) {
- facts.called.called++;
+ it.describe("or rule with two conditions of the same type", function (it) {
+ var flow;
+ it.beforeAll(function () {
+ flow = nools.flow("or condition", function (flow) {
+ flow.rule("hello rule", [
+ ["or",
+ [String, "s", "s == 'hello'"],
+ [String, "s", "s == 'world'"]
+ ],
+ [Count, "called", null]
+ ], function (facts) {
+ facts.called.called++;
+ });
+ });
});
- });
- it.should("call when a string equals 'hello'", function () {
- return flow.getSession("world", called).match().then(function () {
- assert.equal(called.called, 1);
+ it.should("should match if one constraints matches", function () {
+ return flow.getSession("world", called).match().then(function () {
+ assert.equal(called.called, 1);
+ called.called = 0;
+ return flow.getSession("hello", called).match().then(function () {
+ assert.equal(called.called, 1);
+ });
+ });
+ });
+
+ it.should("not call when a a constraint does not match", function () {
+ called.called = 0;
+ return flow.getSession("hello", "world", "test", called).match().then(function () {
+ assert.equal(called.called, 2);
+ });
});
});
- it.should("call when a string equals 'world'", function () {
- called = new Count();
- return flow.getSession("hello", called).match().then(function () {
- assert.equal(called.called, 1);
+ it.describe("or rule with three conditions", function (it) {
+ var flow;
+
+ it.beforeAll(function () {
+ flow = nools.flow("or condition three constraints", function (flow) {
+ flow.rule("hello rule", [
+ ["or",
+ [String, "s", "s == 'hello'"],
+ [String, "s", "s == 'world'"],
+ [String, "s", "s == 'hello world'"]
+ ],
+ [Count, "called", null]
+ ], function (facts) {
+ facts.called.called++;
+ });
+ });
});
+
+ it.should("should match if one constraints matches", function () {
+ called.called = 0;
+ return flow.getSession("world", called).match().then(function () {
+ assert.equal(called.called, 1);
+ called.called = 0;
+ return flow.getSession("hello", called).match().then(function () {
+ assert.equal(called.called, 1);
+ called.called = 0;
+ return flow.getSession("hello world", called).match().then(function () {
+ assert.equal(called.called, 1);
+ });
+ });
+ });
+ });
+
+ it.should("not call when none constraints match", function () {
+ called.called = 0;
+ return flow.getSession("hello", "world", "hello world", "test", called).match().then(function () {
+ assert.equal(called.called, 3);
+ });
+ });
+
});
- it.should(" not call when a string that does equal 'hello' or 'world", function () {
- called = new Count();
- return flow.getSession("hello", "world", "test", called).match().then(function () {
- assert.equal(called.called, 2);
+ it.describe("or rule with different types", function (it) {
+ var flow;
+
+ it.beforeAll(function () {
+ flow = nools.flow("or condition different types", function (flow) {
+ flow.rule("hello rule", [
+ ["or",
+ [String, "s", "s == 'hello'"],
+ [String, "s", "s == 'world'"],
+ [Number, "n", "n == 1"]
+ ],
+ [Count, "called", null]
+ ], function (facts) {
+ facts.called.called++;
+ });
+ });
+ });
+
+ it.should("should match if one constraints matches", function () {
+ called.called = 0;
+ return flow.getSession("world", called).match().then(function () {
+ assert.equal(called.called, 1);
+ called.called = 0;
+ return flow.getSession("hello", called).match().then(function () {
+ assert.equal(called.called, 1);
+ called.called = 0;
+ return flow.getSession(1, called).match().then(function () {
+ assert.equal(called.called, 1);
+ });
+ });
+ });
+ });
+
+ it.should("not call when none constraints match", function () {
+ called.called = 0;
+ return flow.getSession("hello", "world", 1, "test", called).match().then(function () {
+ assert.equal(called.called, 3);
+ });
});
});
@@ -630,7 +741,7 @@ it.describe("Flow", function (it) {
} else {
session.assert(new Message("hello"));
}
- }, 10);
+ }, 50);
session.assert(called);
return session.matchUntilHalt().then(function (err) {
assert.isUndefinedOrNull(err);
diff --git a/test/noolsParser.test.js b/test/noolsParser.test.js
index f3ee89a..774c66f 100644
--- a/test/noolsParser.test.js
+++ b/test/noolsParser.test.js
@@ -459,6 +459,28 @@ it.describe("nools dsl parser", function (it) {
"loaded": [],
"file": undefined
});
+ parsed = noolsParser.parse("rule TestRule { when {or($c : Clazz $c.name eq 'test1', $c : Clazz $c.name eq 'test2', $c : Clazz $c.name eq 'test3')} then {console.log($test);}}");
+ assert.deepEqual(parsed, {
+ "define": [],
+ "rules": [
+ {
+ "name": "TestRule",
+ "options": {},
+ "constraints": [
+ [
+ "or",
+ ["Clazz", "$c", "$c.name eq 'test1'"],
+ ["Clazz", "$c", "$c.name eq 'test2'"],
+ ["Clazz", "$c", "$c.name eq 'test3'"]
+ ]
+ ],
+ "action": "console.log($test);"
+ }
+ ],
+ "scope": [],
+ "loaded": [],
+ "file": undefined
+ });
});
it.should("parse when clause with hash and constraints in any order", function () {