text: /*! fact - v0.1.0 - 2012-09-14
  * https://github.com/rwldrn/fact
  * Copyright (c) 2012 Rick Waldron; Licensed MIT */
  (function(a,b){function f(){var a=e.get(this);a||(a={_events:{maxListeners:d}}),e.set(this,a)}function g(a){var b=e.get(this);a&&(a.delimiter&&(b.delimiter=a.delimiter),a.wildcard&&(b.wildcard=a.wildcard),b.wildcard&&(b.listenerTree=new Object)),e.set(this,b)}function h(a){f.call(this),g.call(this,a)}function i(a,b,c,d){if(!c)return[];var e=[],f,g,h,j,k,l,m,n=b.length,o=b[d],p=b[d+1];if(d===n&&c._listeners){if(typeof c._listeners=="function")return a&&a.push(c._listeners),[c];for(f=0,g=c._listeners.length;f<g;f++)a&&a.push(c._listeners[f]);return[c]}if(o==="*"||o==="**"||c[o]){if(o==="*"){for(h in c)h!=="_listeners"&&c.hasOwnProperty(h)&&(e=e.concat(i(a,b,c[h],d+1)));return e}if(o==="**"){m=d+1===n||d+2===n&&p==="*",m&&c._listeners&&(e=e.concat(i(a,b,c,n)));for(h in c)h!=="_listeners"&&c.hasOwnProperty(h)&&(h==="*"||h==="**"?(c[h]._listeners&&!m&&(e=e.concat(i(a,b,c[h],n))),e=e.concat(i(a,b,c[h],d))):h===p?e=e.concat(i(a,b,c[h],d+2)):e=e.concat(i(a,b,c[h],d)));return e}e=e.concat(i(a,b,c[o],d+1))}j=c["*"],j&&i(a,b,j,d+1),k=c["**"];if(k)if(d<n){k._listeners&&i(a,b,k,n);for(h in k)h!=="_listeners"&&k.hasOwnProperty(h)&&(h===p?i(a,b,k[h],d+2):h===o?i(a,b,k[h],d+1):(l={},l[h]=k[h],i(a,b,{"**":l},d+1)))}else k._listeners?i(a,b,k,n):k["*"]&&k["*"]._listeners&&i(a,b,k["*"],n);return e}function j(a,b){var f=e.get(this);a=typeof a=="string"?a.split(this.delimiter):a.slice();for(var g=0,h=a.length;g+1<h;g++)if(a[g]==="**"&&a[g+1]==="**")return;var i=this.listenerTree,j=a.shift();while(j){i[j]||(i[j]=new Object),i=i[j];if(a.length===0){if(!i._listeners)i._listeners=b;else if(typeof i._listeners=="function")i._listeners=[i._listeners,b];else if(c(i._listeners)){i._listeners.push(b);if(!i._listeners.warned){var k=d;typeof e.get(this)._events.maxListeners!="undefined"&&(k=e.get(this)._events.maxListeners),k>0&&i._listeners.length>k&&(i._listeners.warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",i._listeners.length),console.trace())}}return!0}j=a.shift()}return!0}var c=Array.isArray?Array.isArray:function(a){return Object.prototype.toString.call(a)==="[object Array]"},d=10,e=new WeakMap;h.prototype.delimiter=".",h.prototype.setMaxListeners=function(a){var b=e.get(this);b._events.maxListeners=a,e.set(this,b)},h.prototype.event="",h.prototype.once=function(a,b){return this.many(a,1,b),this},h.prototype.many=function(a,b,c){function e(){--b===0&&d.off(a,e),c.apply(this,arguments)}var d=this;if(typeof c!="function")throw new Error("many only accepts instances of Function");return e._origin=c,this.on(a,e),d},h.prototype.emit=function(){f.call(this);var a=arguments[0],b=e.get(this);if(a==="newListener"&&!b._events.newListener)return!1;if(b._all){var c=arguments.length,d=new Array(c-1);for(var g=1;g<c;g++)d[g-1]=arguments[g];for(g=0,c=b._all.length;g<c;g++)b._all[g].apply(this,d)}if(a==="error"&&!b._all&&!b._events.error&&(!b.wildcard||!b.listenerTree.error))throw arguments[1]instanceof Error?arguments[1]:new Error("Uncaught, unspecified 'error' event.");var h;if(b.wildcard){h=[];var j=typeof a=="string"?a.split(b.delimiter):a.slice();i.call(this,h,j,this.listenerTree,0)}else h=b._events[a];if(typeof h=="function"){if(arguments.length===1)h.call(this);else if(arguments.length>1)switch(arguments.length){case 2:h.call(this,arguments[1]);break;case 3:h.call(this,arguments[1],arguments[2]);break;default:var c=arguments.length,d=new Array(c-1);for(var g=1;g<c;g++)d[g-1]=arguments[g];h.apply(this,d)}return!0}if(h){var c=arguments.length,d=new Array(c-1);for(var g=1;g<c;g++)d[g-1]=arguments[g];var k=h.slice();for(var g=0,c=k.length;g<c;g++)k[g].apply(this,d);return k.length>0||this._all}return b._all},h.prototype.on=function(a,b){if(typeof a=="function")return this.onAny(a),this;if(typeof b!="function")throw new Error("on only accepts instances of Function");f.call(this);var g=e.get(this);this.emit("newListener",a,b);if(g.wildcard)return j.call(this,a,b),this;if(!g._events[a])g._events[a]=b;else if(typeof g._events[a]=="function")g._events[a]=[g._events[a],b];else if(c(g._events[a])){g._events[a].push(b);if(!g._events[a].warned){var h=d;typeof g._events.maxListeners!="undefined"&&(h=g._events.maxListeners),h>0&&g._events[a].length>h&&(g._events[a].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",g._events[a].length),console.trace())}}return e.set(this,g),this},h.prototype.onAny=function(a){var b=e.get(this);b._all||(b._all=[]);if(typeof a!="function")throw new Error("onAny only accepts instances of Function");return b._all.push(a),e.set(this,b),this},h.prototype.addListener=h.prototype.on,h.prototype.off=function(a,b){if(typeof b!="function")throw new Error("removeListener only takes instances of Function");var d,f=[],g=e.get(this);if(g.wildcard){var h=typeof a=="string"?a.split(g.delimiter):a.slice();f=i.call(this,null,h,g.listenerTree,0)}else{if(!g._events[a])return this;d=g._events[a],f.push({_listeners:d})}for(var j=0;j<f.length;j++){var k=f[j];d=k._listeners;if(c(d)){var l=-1;for(var m=0,n=d.length;m<n;m++)if(d[m]===b||d[m].listener&&d[m].listener===b||d[m]._origin&&d[m]._origin===b){l=m;break}if(l<0)return this;g.wildcard?k._listeners.splice(l,1):g._events[a].splice(l,1),d.length===0&&(g.wildcard?delete k._listeners:delete g._events[a])}else if(d===b||d.listener&&d.listener===b||d._origin&&d._origin===b)g.wildcard?delete k._listeners:delete this._events[a]}return e.set(this,g),this},h.prototype.offAny=function(a){var b=0,c=0,d,f=e.get(this);if(a&&f._all&&f._all.length>0){d=f._all;for(b=0,c=d.length;b<c;b++)if(a===d[b])return d.splice(b,1),this}else f._all=[];return e.set(this,f),this},h.prototype.removeListener=h.prototype.off,h.prototype.removeAllListeners=function(a){var b=e.get(this);if(arguments.length===0)return f.call(this),this;if(b.wildcard){var c=typeof a=="string"?a.split(b.delimiter):a.slice(),d=i.call(this,null,c,b.listenerTree,0);for(var g=0;g<d.length;g++){var h=d[g];h._listeners=null}}else{if(!b._events[a])return this;b._events[a]=null}return e.set(this,b),this},h.prototype.listeners=function(a){if(p.wildcard){var b=[],d=typeof a=="string"?a.split(p.delimiter):a.slice();return i.call(this,b,d,p.listenerTree,0),b}return p._events||f.call(this),p._events[a]||(p._events[a]=[]),c(p._events[a])||(p._events[a]=[p._events[a]]),p._events[a]},h.prototype.listenersAny=function(){var a=e.get(this);return a._all?a._all:[]},typeof define=="function"&&define.amd?define(function(){return h}):a.EventEmitter2=h})(typeof process!="undefined"&&typeof process.title!="undefined"&&typeof exports!="undefined"?exports:window),function(a){function c(a){a.forEach(function(a){var b=!0;a.oldValue&&a.oldValue===a.object[a.name]&&(b=!1),b&&(this.emit(a.type,a),this.emit("change",a))},this)}function d(a){function d(d){var e;e={},b.assign(a,d),Object.keys(a).forEach(function(b){typeof a[b]=="function"?e[b]={get:a[b]}:this[b]=a[b]},this),Object.defineProperties(this,e),Object.observe(this,c.bind(this))}return d.prototype=Object.create(EventEmitter2.prototype),d.prototype.constructor=d,d}var b={put:function(a){a=Object(a),Object.getOwnPropertyNames(a).forEach(function(b){this[b]=a[b]},this)},assign:function(a,c){return b.put.call(a,c)}};a.Fact=d}(this);