diff --git a/docs/History.html b/docs/History.html
index 96c4221..bc09f06 100644
--- a/docs/History.html
+++ b/docs/History.html
@@ -178,6 +178,10 @@
+
0.1.14
+
+- Fixed issue with async actions and early match termination.
+
0.1.13
- Fixed issue #68 where
matchUntilHalt
uses a lot of CPU
diff --git a/docs/nools.js b/docs/nools.js
index 0598343..945c126 100644
--- a/docs/nools.js
+++ b/docs/nools.js
@@ -1,8 +1,8 @@
-/*! nools - v0.1.13 - 2013-09-24
+/*! nools - v0.1.14 - 2013-10-02
* 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":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;
+!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,c=b.agenda;return a.addCallback(function(){b.looping=!1,c.isEmpty()?(!b.matchUntilHalt||b.__halted)&&b.callback():(b.flowAltered&&(b.rootNode.incrementCounter(),b.flowAltered=!1),b.__halted?b.callback():b.callNext()),b=null}).addErrback(this.errback)},__handleSyncNext:function(a){return this.looping=!1,this.agenda.isEmpty()||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;
diff --git a/history.md b/history.md
index fa9731e..e2244aa 100644
--- a/history.md
+++ b/history.md
@@ -1,3 +1,7 @@
+#0.1.14
+* Fixed issue with async actions and early match termination.
+
+
#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.
diff --git a/lib/executionStrategy.js b/lib/executionStrategy.js
index 8b893b4..12c0f8b 100644
--- a/lib/executionStrategy.js
+++ b/lib/executionStrategy.js
@@ -47,12 +47,14 @@ Promise.extend({
},
__handleAsyncNext: function (next) {
- var self = this;
+ var self = this, agenda = self.agenda;
return next.addCallback(function () {
self.looping = false;
- if (self.flowAltered) {
- self.rootNode.incrementCounter();
- self.flowAltered = false;
+ if (!agenda.isEmpty()) {
+ if (self.flowAltered) {
+ self.rootNode.incrementCounter();
+ self.flowAltered = false;
+ }
if (!self.__halted) {
self.callNext();
} else {
@@ -67,9 +69,11 @@ Promise.extend({
__handleSyncNext: function (next) {
this.looping = false;
- if (this.flowAltered) {
- this.rootNode.incrementCounter();
- this.flowAltered = false;
+ if (!this.agenda.isEmpty()) {
+ if (this.flowAltered) {
+ this.rootNode.incrementCounter();
+ this.flowAltered = false;
+ }
}
if (next && !this.__halted) {
nextTick(this.callNext);
@@ -88,7 +92,7 @@ Promise.extend({
callNext: function () {
this.looping = true;
var next = this.agenda.fireNext();
- return isPromiseLike(next) ? this.__handleAsyncNext(next) : this.__handleSyncNext(next);
+ return isPromiseLike(next) ? this.__handleAsyncNext(next): this.__handleSyncNext(next);
},
execute: function () {
diff --git a/nools.js b/nools.js
index 893d3c9..110d6c6 100644
--- a/nools.js
+++ b/nools.js
@@ -1356,12 +1356,14 @@ Promise.extend({
},
__handleAsyncNext: function (next) {
- var self = this;
+ var self = this, agenda = self.agenda;
return next.addCallback(function () {
self.looping = false;
- if (self.flowAltered) {
- self.rootNode.incrementCounter();
- self.flowAltered = false;
+ if (!agenda.isEmpty()) {
+ if (self.flowAltered) {
+ self.rootNode.incrementCounter();
+ self.flowAltered = false;
+ }
if (!self.__halted) {
self.callNext();
} else {
@@ -1376,9 +1378,11 @@ Promise.extend({
__handleSyncNext: function (next) {
this.looping = false;
- if (this.flowAltered) {
- this.rootNode.incrementCounter();
- this.flowAltered = false;
+ if (!this.agenda.isEmpty()) {
+ if (this.flowAltered) {
+ this.rootNode.incrementCounter();
+ this.flowAltered = false;
+ }
}
if (next && !this.__halted) {
nextTick(this.callNext);
@@ -1397,7 +1401,7 @@ Promise.extend({
callNext: function () {
this.looping = true;
var next = this.agenda.fireNext();
- return isPromiseLike(next) ? this.__handleAsyncNext(next) : this.__handleSyncNext(next);
+ return isPromiseLike(next) ? this.__handleAsyncNext(next): this.__handleSyncNext(next);
},
execute: function () {
diff --git a/nools.min.js b/nools.min.js
index 0598343..945c126 100644
--- a/nools.min.js
+++ b/nools.min.js
@@ -1,8 +1,8 @@
-/*! nools - v0.1.13 - 2013-09-24
+/*! nools - v0.1.14 - 2013-10-02
* 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":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;
+!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,c=b.agenda;return a.addCallback(function(){b.looping=!1,c.isEmpty()?(!b.matchUntilHalt||b.__halted)&&b.callback():(b.flowAltered&&(b.rootNode.incrementCounter(),b.flowAltered=!1),b.__halted?b.callback():b.callNext()),b=null}).addErrback(this.errback)},__handleSyncNext:function(a){return this.looping=!1,this.agenda.isEmpty()||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;
diff --git a/package.json b/package.json
index 291a0c2..07b7425 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
"name": "nools",
"description": "A rules engine for node",
- "version": "0.1.13",
+ "version": "0.1.14",
"bin": {
"nools": "./bin/nools"
},
diff --git a/test/flow.test.js b/test/flow.test.js
index 65cd5f3..b0e2ecb 100644
--- a/test/flow.test.js
+++ b/test/flow.test.js
@@ -60,7 +60,6 @@ it.describe("nools", function (it) {
var name = "delete nools flows";
nools.flow(name);
assert.isTrue(nools.hasFlow(name));
- debugger;
assert.equal(nools.deleteFlows(), nools);
assert.isFalse(nools.hasFlow(name));
});
@@ -690,6 +689,48 @@ it.describe("Flow", function (it) {
});
});
+ it.describe("async actions", function (it) {
+
+ var flow;
+
+ it.timeout(2000);
+
+ function Message(m) {
+ this.message = m;
+ }
+
+
+ it.beforeAll(function () {
+ flow = nools.flow("async flow", function () {
+ this.rule("Hello", [Message, "m", "m.message == 'hello'"], function (facts, engine, next) {
+ setTimeout(function () {
+ next();
+ }, 500);
+ });
+
+ this.rule("Goodbye", [Message, "m", "m.message == 'hello goodbye'"], function (facts, engine, next) {
+ setTimeout(function () {
+ next();
+ }, 500);
+ });
+
+ });
+ });
+
+ it.should("fire all rules", function () {
+ var fired = [];
+ var session = flow.getSession(new Message("hello"), new Message("hello goodbye"))
+ .on("fire", function (name) {
+ debugger;
+ fired.push(name);
+ });
+ return session.match().then(function () {
+ assert.deepEqual(fired, ["Goodbye", "Hello"]);
+ })
+ });
+
+ });
+
it.describe("#matchUntilHalt", function (it) {
function Message(m) {
this.message = m;