-"undefined"!=typeof require&&require("neon"),Class("Serpentity")({prototype:{systems:null,entities:null,_nodeCollections:null,_nodeCollectionKeys:null,init:function(e){var t;e=e||{},this.systems=[],this.entities=[],this._nodeCollections=[],this._nodeCollectionKeys=[];for(t in e)e.hasOwnProperty(t)&&(this[t]=e[t])},addSystem:function(e,t){var i,s;return this.systems.indexOf(e)>=0?!1:(e.priority=t,s=!1,i=0,this.systems.some(function(t,n){return i=n,t.priority>=e.priority?(s=!0,!0):void 0}),s||(i+=1),this.systems.splice(i,0,e),e.added(this),!0)},removeSystem:function(e){var t;return t=this.systems.indexOf(e),t>=0?(this.systems[t].removed(this),this.systems.splice(t,1),!0):!1},addEntity:function(e){return this.entities.indexOf(e)>=0?!1:(this.entities.push(e),this._nodeCollections.forEach(function(t){t.add(e)}),!0)},removeEntity:function(e){var t;return t=this.entities.indexOf(e),t>=0?(this._nodeCollections.forEach(function(t){t.remove(e)}),this.entities.splice(t,1),!0):!1},getNodes:function(e){var t,i;return t=this._nodeCollectionKeys.indexOf(e),t>=0?this._nodeCollections[t].nodes:(i=new Serpentity.NodeCollection({type:e}),this._nodeCollectionKeys.push(e),this._nodeCollections.push(i),this.entities.forEach(function(e){i.add(e)}),i.nodes)},update:function(e){this.systems.forEach(function(t){t.update(e)})}}}),"undefined"!=typeof require&&(require("./component.js"),require("./entity.js"),require("./node.js"),require("./node_collection.js"),require("./system.js"));
-Class(Serpentity,"Entity")({prototype:{_components:null,_componentKeys:null,init:function(n){var t;this._componentKeys=[],this._components=[];for(t in n)n.hasOwnProperty(t)&&(this[t]=n[t])},addComponent:function(n){return this._componentKeys.indexOf(n.constructor)>=0?!1:(this._componentKeys.push(n.constructor),this._components.push(n),!0)},hasComponent:function(n){return this._componentKeys.indexOf(n)>=0?!0:!1},getComponent:function(n){var t;return t=this._componentKeys.indexOf(n),t>=0?this._components[t]:void 0}}});
-Class(Serpentity,"Node")({matches:function(t){var s,r,n;n=this.types;for(s in this.types)if(this.types.hasOwnProperty(s)&&(r=!1,t.hasComponent(n[s])&&(r=!0),!r))return!1;return!0},prototype:{types:null,init:function(){var t;this.types={};for(t in this.constructor)this.constructor.hasOwnProperty(t)&&(this.types[t]=this.constructor[t])}}});
-Class(Serpentity,"NodeCollection")({prototype:{type:null,nodes:null,init:function(t){var n;t=t||{},this.nodes=[];for(n in t)t.hasOwnProperty(n)&&(this[n]=t[n])},add:function(t){var n,e,i;if(this.type.matches(t)&&!this._entityExists(t)){n=new this.type({}),n.entity=t,e=this.type.types;for(i in e)e.hasOwnProperty(i)&&(n[i]=t.getComponent(e[i]));return this.nodes.push(n),!0}return!1},remove:function(t){var n;return n=-1,this.nodes.forEach(function(e,i){e.entity===t&&(n=i)}),n>=0?(this.nodes.splice(n,1),!0):!1},_entityExists:function(t){var n;return n=!1,this.nodes.forEach(function(e){e.entity===t&&(n=!0)}),n}}});
-Class(Serpentity,"Component")({prototype:{init:function(t){var n;t=t||{};for(n in t)t.hasOwnProperty(n)&&(this[n]=t[n])}}});
-Class(Serpentity,"System")({prototype:{added:function(){},removed:function(){},update:function(){}}});
\ No newline at end of file
+"use strict";function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var _createClass=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),Serpentity=function(){function e(t){_classCallCheck(this,e),this.systems=[],this.entities=[],this._nodeCollections=[],this._nodeCollectionKeys=[],Object.assign(this,t||{})}return _createClass(e,[{key:"addSystem",value:function(e,t){var n=void 0,o=void 0;return this.systems.indexOf(e)>=0?!1:(e.priority=t,o=!1,n=0,this.systems.some(function(t,i){return n=i,t.priority>=e.priority?(o=!0,!0):void 0}),o||(n+=1),this.systems.splice(n,0,e),e.added(this),!0)}},{key:"removeSystem",value:function(e){var t=void 0;return t=this.systems.indexOf(e),t>=0?(this.systems[t].removed(this),this.systems.splice(t,1),!0):!1}},{key:"addEntity",value:function(e){return this.entities.indexOf(e)>=0?!1:(this.entities.push(e),this._nodeCollections.forEach(function(t){t.add(e)}),!0)}},{key:"removeEntity",value:function(e){var t=void 0;return t=this.entities.indexOf(e),t>=0?(this._nodeCollections.forEach(function(t){t.remove(e)}),this.entities.splice(t,1),!0):!1}},{key:"getNodes",value:function(t){var n=void 0,o=void 0;return n=this._nodeCollectionKeys.indexOf(t),n>=0?this._nodeCollections[n].nodes:(o=new e.NodeCollection({type:t}),this._nodeCollectionKeys.push(t),this._nodeCollections.push(o),this.entities.forEach(function(e){o.add(e)}),o.nodes)}},{key:"update",value:function(e){this.systems.forEach(function(t){t.update(e)})}}]),e}();"undefined"!=typeof module&&(void 0).module!==module&&(Serpentity.Component=require("./serpentity/component.js"),Serpentity.Entity=require("./serpentity/entity.js"),Serpentity.Node=require("./serpentity/node.js"),Serpentity.NodeCollection=require("./serpentity/node_collection.js"),Serpentity.System=require("./serpentity/system.js"),module.exports=Serpentity);var _createClass=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),Entity=function(){function e(t){_classCallCheck(this,e),this._componentKeys=[],this._components=[],Object.assign(this,t||{})}return _createClass(e,[{key:"addComponent",value:function(e){return this._componentKeys.indexOf(e.constructor)>=0?!1:(this._componentKeys.push(e.constructor),this._components.push(e),!0)}},{key:"hasComponent",value:function(e){return!!(this._componentKeys.indexOf(e)>=0)}},{key:"getComponent",value:function(e){var t=this._componentKeys.indexOf(e);return t>=0?this._components[t]:void 0}}]),e}();"undefined"!=typeof module&&(void 0).module!==module?module.exports=Entity:Serpentity.Entity=Entity;var _createClass=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),Node=function(){function e(t){_classCallCheck(this,e),this.types={},Object.assign(this,t||{})}return _createClass(e,null,[{key:"matches",value:function(e){var t=this.types;for(var n in t)if(t.hasOwnProperty(n)){var o=!1,i=t[n];if(e.hasComponent(i)&&(o=!0),!o)return!1}return!0}}]),e}();"undefined"!=typeof module&&(void 0).module!==module?module.exports=Node:Serpentity.Node=Node;var _createClass=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),NodeCollection=function(){function e(t){_classCallCheck(this,e),this.nodes=[],this.type=null,Object.assign(this,t||{})}return _createClass(e,[{key:"add",value:function(e){if(this.type.matches(e)&&!this._entityExists(e)){var t=new this.type({}),n=this.type.types;t.entity=e;for(var o in n)n.hasOwnProperty(o)&&(t[o]=e.getComponent(n[o]));return this.nodes.push(t),!0}return!1}},{key:"remove",value:function(e){var t=-1;return this.nodes.forEach(function(n,o){n.entity===e&&(t=o)}),t>=0?(this.nodes.splice(t,1),!0):!1}},{key:"_entityExists",value:function(e){var t=!1,n=!0,o=!1,i=void 0;try{for(var s,r=this.nodes[Symbol.iterator]();!(n=(s=r.next()).done);n=!0){var a=s.value;a.entity===e&&(t=!0)}}catch(l){o=!0,i=l}finally{try{!n&&r["return"]&&r["return"]()}finally{if(o)throw i}}return t}}]),e}();"undefined"!=typeof module&&(void 0).module!==module?module.exports=NodeCollection:Serpentity.NodeCollection=NodeCollection;var Component=function e(t){_classCallCheck(this,e),Object.assign(this,t||{})};"undefined"!=typeof module&&(void 0).module!==module?module.exports=Component:Serpentity.Component=Component;var _createClass=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),System=function(){function e(){_classCallCheck(this,e)}return _createClass(e,[{key:"added",value:function(){}},{key:"removed",value:function(){}},{key:"update",value:function(){}}]),e}();"undefined"!=typeof module&&(void 0).module!==module?module.exports=System:Serpentity.System=System;
\ No newline at end of file