define("componentmodelImpl", ["componentmodelComponentApi", "clientkernelLoaderApi", "componentmodelAssemblyApi", "clientkernelEventbusApi", "clientkernelModulesApi"],
    function(componentmodelComponentApi, clientkernelLoaderApi, componentmodelAssemblyApi, clientkernelEventbusApi, clientkernelModulesApi) {
        "use strict";

        function $iterator(o) {
            if (o instanceof Array) return function() {
                return {
                    cur: 0,
                    arr: o,
                    hasNext: function() {
                        return this.cur < this.arr.length;
                    },
                    next: function() {
                        return this.arr[this.cur++];
                    }
                };
            };
            return typeof(o.iterator) == 'function' ? $bind(o, o.iterator) : o.iterator;
        };;
        var $fid = 0;

        function $bind(o, m) {
            if (m == null) return null;
            if (m.__id__ == null) m.__id__ = $fid++;
            var f;
            if (o.hx__closures__ == null) o.hx__closures__ = {};
            else f = o.hx__closures__[m.__id__];
            if (f == null) {
                f = function() {
                    return f.method.apply(f.scope, arguments);
                };
                f.scope = o;
                f.method = m;
                o.hx__closures__[m.__id__] = f;
            }
            return f;
        };
        var $_;
        var $estr = function() {
            return _hcmn_.js_Boot.__string_rec(this, '');
        };
        if (typeof componentmodelImpl == 'undefined') {
            var componentmodelImpl = {};
        };
        componentmodelImpl.Activator = function() {};
        componentmodelImpl.Activator = ck_implements(componentmodelImpl.Activator, clientkernelModulesApi.IModuleActivator);
        componentmodelImpl.Activator.__interfaces__ = [clientkernelModulesApi.IModuleActivator];
        componentmodelImpl.Activator.__name__ = ["componentmodelImpl", "Activator"];
        componentmodelImpl.Activator.prototype.start = function(context) {
            context.getServiceTracker([clientkernelLoaderApi.IAssetRegistry]).then(function(m_context) {
                componentmodelImpl.ExternalService.initialize(m_context);
                context.registerService(new componentmodelImpl.GameAssemblyFactory(context), componentmodelAssemblyApi.IGameAssemblyFactory, null);
            });
        };
        componentmodelImpl.Activator.prototype.stop = function(context) {};
        componentmodelImpl.Activator.main = function() {};
        componentmodelImpl.Activator.prototype.__class__ = componentmodelImpl.Activator;
        if (typeof componentmodel == 'undefined') {
            var componentmodel = {};
        };
        if (!componentmodel.impl) {
            componentmodel.impl = {};
        };
        componentmodel.impl.ComponentContextState = {
            __ename__: ["componentmodel", "impl", "ComponentContextState"],
            __constructs__: ["STATE_NEW", "STATE_CREATING", "STATE_CREATED"]
        };
        componentmodel.impl.ComponentContextState.STATE_CREATED = ["STATE_CREATED", 2];
        componentmodel.impl.ComponentContextState.STATE_CREATED.toString = $estr;
        componentmodel.impl.ComponentContextState.STATE_CREATED.__enum__ = componentmodel.impl.ComponentContextState;
        componentmodel.impl.ComponentContextState.STATE_CREATING = ["STATE_CREATING", 1];
        componentmodel.impl.ComponentContextState.STATE_CREATING.toString = $estr;
        componentmodel.impl.ComponentContextState.STATE_CREATING.__enum__ = componentmodel.impl.ComponentContextState;
        componentmodel.impl.ComponentContextState.STATE_NEW = ["STATE_NEW", 0];
        componentmodel.impl.ComponentContextState.STATE_NEW.toString = $estr;
        componentmodel.impl.ComponentContextState.STATE_NEW.__enum__ = componentmodel.impl.ComponentContextState;
        componentmodelImpl.ComponentContext = function(context, gar, aicomponent) {
            this.gar = gar;
            this.context = context;
            this.aicomponent = aicomponent;
            this.id = haxe.crypto.Md5.encode(_hcmn_.Math.random() + "");
            this.configuration = aicomponent.getConfiguration();
            this.implementedPorts = [];
            this.usedPorts = [];
            this.factoryInterface = gar.getComponentFactory(aicomponent.getFactoryId());
            var _g = 0;
            var _g1 = aicomponent.getImplementedPortIds();
            while (_g < _g1.length) {
                var i = _g1[_g];
                ++_g;
                this.implementedPorts.push(gar.getImplementedPort(this, i));
            }
            var _g2 = 0;
            var _g11 = aicomponent.getUsedPortIds();
            while (_g2 < _g11.length) {
                var i1 = _g11[_g2];
                ++_g2;
                this.usedPorts.push(gar.getUsedPort(this, i1));
            }
            this.workersProm = gar.getWorkers(aicomponent.getWorkers());
            this.state = componentmodel.impl.ComponentContextState.STATE_NEW;
        };
        componentmodelImpl.ComponentContext = ck_implements(componentmodelImpl.ComponentContext, componentmodelComponentApi.IComponentInstance);
        componentmodelImpl.ComponentContext = ck_implements(componentmodelImpl.ComponentContext, componentmodelComponentApi.IComponentContext);
        componentmodelImpl.ComponentContext.__interfaces__ = [componentmodelComponentApi.IComponentInstance, componentmodelComponentApi.IComponentContext];
        componentmodelImpl.ComponentContext.__name__ = ["componentmodelImpl", "ComponentContext"];
        componentmodelImpl.ComponentContext.prototype.gar = null;
        componentmodelImpl.ComponentContext.prototype.aicomponent = null;
        componentmodelImpl.ComponentContext.prototype.id = null;
        componentmodelImpl.ComponentContext.prototype.children = null;
        componentmodelImpl.ComponentContext.prototype.configuration = null;
        componentmodelImpl.ComponentContext.prototype.declaration = null;
        componentmodelImpl.ComponentContext.prototype.usedPorts = null;
        componentmodelImpl.ComponentContext.prototype.implementedPorts = null;
        componentmodelImpl.ComponentContext.prototype.state = null;
        componentmodelImpl.ComponentContext.prototype.context = null;
        componentmodelImpl.ComponentContext.prototype.factoryInterface = null;
        componentmodelImpl.ComponentContext.prototype.factory = null;
        componentmodelImpl.ComponentContext.prototype.workersProm = null;
        componentmodelImpl.ComponentContext.prototype.workers = null;
        componentmodelImpl.ComponentContext.prototype.isNew = function() {
            return this.state == componentmodel.impl.ComponentContextState.STATE_NEW;
        };
        componentmodelImpl.ComponentContext.prototype.isCreated = function() {
            return this.state == componentmodel.impl.ComponentContextState.STATE_CREATED;
        };
        componentmodelImpl.ComponentContext.prototype.create = function() {
            var _g = this;
            this.state = componentmodel.impl.ComponentContextState.STATE_CREATING;
            var waitChildren = [];
            var $it0 = this.aicomponent.getChildren().allComponents();
            while ($it0.hasNext()) {
                var i = $it0.next();
                waitChildren.push(this.gar.createComponent(i));
            }
            if (waitChildren.length > 0) return Promise.all(waitChildren).then(function(a) {
                _g.children = a;
                return _g.context.getServiceTracker([_g.factoryInterface]);
            }).then(function(c) {
                return _g.workersProm.then(function(data) {
                    _g.workers = data;
                    _g.factory = _g.context.getAnyService(_g.factoryInterface);
                    var declClass = _g.factory.getComponentDeclaration();
                    _g.declaration = new declClass();
                    _g.state = componentmodel.impl.ComponentContextState.STATE_CREATED;
                    _g.factory.createComponent(_g);
                    return _g;
                });
            });
            else return this.context.getServiceTracker([this.factoryInterface]).then(function(context) {
                return _g.workersProm.then(function(data1) {
                    _g.workers = data1;
                    _g.factory = context.getAnyService(_g.factoryInterface);
                    var declClass2 = _g.factory.getComponentDeclaration();
                    _g.declaration = new declClass2();
                    _g.state = componentmodel.impl.ComponentContextState.STATE_CREATED;
                    _g.factory.createComponent(_g);
                    return _g;
                });
            });
        };
        componentmodelImpl.ComponentContext.prototype.getConfiguration = function() {
            return this.configuration;
        };
        componentmodelImpl.ComponentContext.prototype.getDeclaration = function() {
            return this.declaration;
        };
        componentmodelImpl.ComponentContext.prototype.getImplementedPort = function(port) {
            var _g = 0;
            var _g1 = this.implementedPorts;
            while (_g < _g1.length) {
                var i = _g1[_g];
                ++_g;
                if (ck_instanceof(i, port)) return i;
            }
            return null;
        };
        componentmodelImpl.ComponentContext.prototype.getUsedPort = function(port) {
            var _g = 0;
            var _g1 = this.usedPorts;
            while (_g < _g1.length) {
                var i = _g1[_g];
                ++_g;
                if (ck_instanceof(i, port)) return i;
            }
            return null;
        };
        componentmodelImpl.ComponentContext.prototype.getReferredComponents = function(qualifier) {
            var references = this.aicomponent.getHas().getReferences(qualifier);
            var ret = new _hcmn_.haxe_ds_StringMap();
            var $it0 = references.keys();
            while ($it0.hasNext()) {
                var i = $it0.next();
                var value = this.gar.getComponentInstance(_hcmn_.__map_reserved[i] != null ? references.getReserved(i) : references.h[i], null);
                if (_hcmn_.__map_reserved[i] != null) ret.setReserved(i, value);
                else ret.h[i] = value;
            }
            return ret;
        };
        componentmodelImpl.ComponentContext.prototype.getChildComponents = function(qualifier) {
            var ret = new _hcmn_.haxe_ds_StringMap();
            var _g = 0;
            var _g1 = this.children;
            while (_g < _g1.length) {
                var i = _g1[_g];
                ++_g;
                if (i.aicomponent.getQualifier() == qualifier) {
                    var key = i.aicomponent.getIndex();
                    if (_hcmn_.__map_reserved[key] != null) ret.setReserved(key, i);
                    else ret.h[key] = i;
                }
            }
            return ret;
        };
        componentmodelImpl.ComponentContext.prototype.getInstance = function() {
            return this;
        };
        componentmodelImpl.ComponentContext.prototype.equals = function(instance) {
            return this.id == instance.getId();
        };
        componentmodelImpl.ComponentContext.prototype.getId = function() {
            return this.id;
        };
        componentmodelImpl.ComponentContext.prototype.getComponentId = function() {
            return this.aicomponent.getId();
        };
        componentmodelImpl.ComponentContext.prototype.getWorkers = function() {
            return this.workers;
        };
        componentmodelImpl.ComponentContext.prototype.getComponentIndex = function() {
            return this.aicomponent.getIndex();
        };
        componentmodelImpl.ComponentContext.prototype.getQualifier = function() {
            return this.aicomponent.getQualifier();
        };
        componentmodelImpl.ComponentContext.prototype.getStarted = function() {
            return this.gar.getStarted();
        };
        componentmodelImpl.ComponentContext.prototype.createTopic = function(topic) {
            return new componentmodelImpl.ComponentTopic(this.getInstance(), topic);
        };
        componentmodelImpl.ComponentContext.prototype.__class__ = componentmodelImpl.ComponentContext;
        componentmodelImpl.ExternalService = function() {};
        componentmodelImpl.ExternalService.__name__ = ["componentmodelImpl", "ExternalService"];
        componentmodelImpl.ExternalService.assetRegistry = null;
        componentmodelImpl.ExternalService.initialize = function(context) {
            componentmodelImpl.ExternalService.assetRegistry = context.getAnyService(clientkernelLoaderApi.IAssetRegistry, null);
        };
        componentmodelImpl.ExternalService.prototype.__class__ = componentmodelImpl.ExternalService;
        componentmodelImpl.GameAssembly = function(context) {
            this.context = context;
            this.declaration = new componentmodelImpl.GameAssemblyDeclaration(this);
            this.implementation = new componentmodelImpl.GameAssemblyImplementation(this);
        };
        componentmodelImpl.GameAssembly = ck_implements(componentmodelImpl.GameAssembly, componentmodelAssemblyApi.IGameAssembly);
        componentmodelImpl.GameAssembly.__interfaces__ = [componentmodelAssemblyApi.IGameAssembly];
        componentmodelImpl.GameAssembly.__name__ = ["componentmodelImpl", "GameAssembly"];
        componentmodelImpl.GameAssembly.prototype.declaration = null;
        componentmodelImpl.GameAssembly.prototype.implementation = null;
        componentmodelImpl.GameAssembly.prototype.context = null;
        componentmodelImpl.GameAssembly.prototype.declare = function() {
            return this.declaration;
        };
        componentmodelImpl.GameAssembly.prototype.implement = function() {
            return this.implementation;
        };
        componentmodelImpl.GameAssembly.prototype.run = function() {
            var gar = new componentmodelImpl.GameAssemblyRunner(this.context, this);
            var ret = gar.run();
            return ret;
        };
        componentmodelImpl.GameAssembly.prototype.__class__ = componentmodelImpl.GameAssembly;
        componentmodelImpl.GameAssemblyDeclaration = function(assembly) {
            this.assembly = assembly;
            this.adbuses = new componentmodelImpl.ADBusses(this);
            this.adports = new componentmodelImpl.ADPorts(this);
            this.adcomponentFactories = new componentmodelImpl.ADComponentFactories(this);
        };
        componentmodelImpl.GameAssemblyDeclaration = ck_implements(componentmodelImpl.GameAssemblyDeclaration, componentmodelAssemblyApi.IGameAssemblyDeclaration);
        componentmodelImpl.GameAssemblyDeclaration.__interfaces__ = [componentmodelAssemblyApi.IGameAssemblyDeclaration];
        componentmodelImpl.GameAssemblyDeclaration.__name__ = ["componentmodelImpl", "GameAssemblyDeclaration"];
        componentmodelImpl.GameAssemblyDeclaration.prototype.assembly = null;
        componentmodelImpl.GameAssemblyDeclaration.prototype.adbuses = null;
        componentmodelImpl.GameAssemblyDeclaration.prototype.adports = null;
        componentmodelImpl.GameAssemblyDeclaration.prototype.adcomponentFactories = null;
        componentmodelImpl.GameAssemblyDeclaration.prototype.buses = function() {
            return this.adbuses;
        };
        componentmodelImpl.GameAssemblyDeclaration.prototype.componentFactiries = function() {
            return this.adcomponentFactories;
        };
        componentmodelImpl.GameAssemblyDeclaration.prototype.end = function() {
            return this.assembly;
        };
        componentmodelImpl.GameAssemblyDeclaration.prototype.ports = function() {
            return this.adports;
        };
        componentmodelImpl.GameAssemblyDeclaration.prototype.__class__ = componentmodelImpl.GameAssemblyDeclaration;
        componentmodelImpl.GameAssemblyFactory = function(context) {
            this.context = context;
        };
        componentmodelImpl.GameAssemblyFactory = ck_implements(componentmodelImpl.GameAssemblyFactory, clientkernelModulesApi.IService);
        componentmodelImpl.GameAssemblyFactory = ck_implements(componentmodelImpl.GameAssemblyFactory, componentmodelAssemblyApi.IGameAssemblyFactory);
        componentmodelImpl.GameAssemblyFactory.__interfaces__ = [clientkernelModulesApi.IService, componentmodelAssemblyApi.IGameAssemblyFactory];
        componentmodelImpl.GameAssemblyFactory.__name__ = ["componentmodelImpl", "GameAssemblyFactory"];
        componentmodelImpl.GameAssemblyFactory.prototype.context = null;
        componentmodelImpl.GameAssemblyFactory.prototype.create = function() {
            return new componentmodelImpl.GameAssembly(this.context);
        };
        componentmodelImpl.GameAssemblyFactory.prototype.__class__ = componentmodelImpl.GameAssemblyFactory;
        componentmodelImpl.GameAssemblyImplementation = function(assembly) {
            this.assembly = assembly;
            this.channels = new haxe.ds.ObjectMap();
        };
        componentmodelImpl.GameAssemblyImplementation = ck_implements(componentmodelImpl.GameAssemblyImplementation, componentmodelAssemblyApi.IGameAssemblyImplementation);
        componentmodelImpl.GameAssemblyImplementation.__interfaces__ = [componentmodelAssemblyApi.IGameAssemblyImplementation];
        componentmodelImpl.GameAssemblyImplementation.__name__ = ["componentmodelImpl", "GameAssemblyImplementation"];
        componentmodelImpl.GameAssemblyImplementation.prototype.assembly = null;
        componentmodelImpl.GameAssemblyImplementation.prototype.channels = null;
        componentmodelImpl.GameAssemblyImplementation.prototype.channel = function(id) {
            if (this.channels.exists(id)) return this.channels.get(id);
            else {
                var channel = new componentmodelImpl.AIChannel(this);
                this.channels.set(id, channel);
                return channel;
            }
        };
        componentmodelImpl.GameAssemblyImplementation.prototype.allChannels = function() {
            return _hcmn_.Lambda.array(this.channels);
        };
        componentmodelImpl.GameAssemblyImplementation.prototype.end = function() {
            return this.assembly;
        };
        componentmodelImpl.GameAssemblyImplementation.prototype.__class__ = componentmodelImpl.GameAssemblyImplementation;
        componentmodelImpl.GameAssemblyRunner = function(context, gameAssembly) {
            var _g = this;
            this.context = context;
            this.ga = gameAssembly;
            this.channels = new haxe.ds.ObjectMap();
            this.portFactories = new haxe.ds.ObjectMap();
            this.componentPortFactories = new haxe.ds.ObjectMap();
            this.componentPortFactoriesChannel = new haxe.ds.ObjectMap();
            this.portImplementations = new haxe.ds.ObjectMap();
            this.portUses = new haxe.ds.ObjectMap();
            this.portLabels = new haxe.ds.ObjectMap();
            this.componentFactoriesInterfaces = new haxe.ds.ObjectMap();
            this.componentFactories = new haxe.ds.ObjectMap();
            this.componentInstances = new haxe.ds.ObjectMap();
            this.componentInstanceHandlers = new haxe.ds.ObjectMap();
            this.componentInstancePromises = new haxe.ds.ObjectMap();
            this.started = new Promise(function(resolve, reject) {
                _g.startedCallback = resolve;
            });
        };
        componentmodelImpl.GameAssemblyRunner.__name__ = ["componentmodelImpl", "GameAssemblyRunner"];
        componentmodelImpl.GameAssemblyRunner.prototype.ga = null;
        componentmodelImpl.GameAssemblyRunner.prototype.context = null;
        componentmodelImpl.GameAssemblyRunner.prototype.channels = null;
        componentmodelImpl.GameAssemblyRunner.prototype.portFactories = null;
        componentmodelImpl.GameAssemblyRunner.prototype.componentPortFactories = null;
        componentmodelImpl.GameAssemblyRunner.prototype.componentPortFactoriesChannel = null;
        componentmodelImpl.GameAssemblyRunner.prototype.portImplementations = null;
        componentmodelImpl.GameAssemblyRunner.prototype.portUses = null;
        componentmodelImpl.GameAssemblyRunner.prototype.portLabels = null;
        componentmodelImpl.GameAssemblyRunner.prototype.componentFactoriesInterfaces = null;
        componentmodelImpl.GameAssemblyRunner.prototype.componentFactories = null;
        componentmodelImpl.GameAssemblyRunner.prototype.componentInstances = null;
        componentmodelImpl.GameAssemblyRunner.prototype.componentInstanceHandlers = null;
        componentmodelImpl.GameAssemblyRunner.prototype.componentInstancePromises = null;
        componentmodelImpl.GameAssemblyRunner.prototype.started = null;
        componentmodelImpl.GameAssemblyRunner.prototype.startedCallback = null;
        componentmodelImpl.GameAssemblyRunner.prototype.run = function() {
            var _g = this;
            this.createChannels();
            this.createPorts();
            this.createComponentFactories();
            var waitAll = [];
            waitAll.push(this.validateDeclaration());
            var _g1 = 0;
            var _g11 = this.ga.implement().allChannels();
            while (_g1 < _g11.length) {
                var i = _g11[_g1];
                ++_g1;
                waitAll.push(this.createChannelComponents(i).then(function(c) {}));
            }
            return Promise.all(waitAll).then(function(a) {
                _g.startedCallback(null);
            });
        };
        componentmodelImpl.GameAssemblyRunner.prototype.createChannels = function() {
            var eventBus = this.context.getAnyService(clientkernelEventbusApi.IEventBus, null);
            var $it0 = this.ga.declare().buses().getAll();
            while ($it0.hasNext()) {
                var i = $it0.next();
                this.channels.set(i, eventBus.getChannel(this.ga.declare().buses().get(i)));
            }
        };
        componentmodelImpl.GameAssemblyRunner.prototype.createPorts = function() {
            var $it0 = this.ga.declare().ports().getAll();
            while ($it0.hasNext()) {
                var i = $it0.next();
                var port = this.ga.declare().ports().get(i);
                if (!this.channels.exists(port.getBusId())) throw new Error("Invalid bus referenced");
                if (port.getPortFactory() != null) {
                    var channel = this.channels.get(port.getBusId());
                    this.portFactories.set(i, port.getPortFactory());
                    var pobject;
                    this.portUses.set(i, pobject = port.getPortFactory()["use"](channel));
                    this.portLabels.set(pobject, i);
                    this.portImplementations.set(i, pobject = port.getPortFactory().provide(channel));
                    this.portLabels.set(pobject, i);
                }
                if (port.getComponentPortFactory() != null) {
                    var channel1 = this.channels.get(port.getBusId());
                    this.componentPortFactoriesChannel.set(i, channel1);
                    this.componentPortFactories.set(i, port.getComponentPortFactory());
                }
            }
        };
        componentmodelImpl.GameAssemblyRunner.prototype.createComponentFactories = function() {
            var $it0 = this.ga.declare().componentFactiries().getAll();
            while ($it0.hasNext()) {
                var i = $it0.next();
                this.componentFactoriesInterfaces.set(i, this.ga.declare().componentFactiries().get(i));
            }
        };
        componentmodelImpl.GameAssemblyRunner.prototype.validateDeclaration = function() {
            var _g = this;
            return this.context.getServiceTracker(_hcmn_.Lambda.array(this.componentFactoriesInterfaces)).then(function(context) {
                var declarations = [];
                var $it0 = _g.componentFactoriesInterfaces.keys();
                while ($it0.hasNext()) {
                    var i = $it0.next();
                    _g.componentFactories.set(i, context.getAnyService(_g.componentFactoriesInterfaces.h[i.__id__], null));
                }
                var $it1 = _g.componentFactories.iterator();
                while ($it1.hasNext()) {
                    var i1 = $it1.next();
                    declarations.push(i1.getComponentDeclaration());
                }
                var _g1 = 0;
                while (_g1 < declarations.length) {
                    var di = declarations[_g1];
                    ++_g1;
                    var i2 = new di();
                    if (i2.getImplementedPorts() != null) {
                        var $it2 = (function($this) {
                            var $r;
                            var _this = i2.getImplementedPorts();
                            $r = _hcmn_.HxOverrides.iter(_this);
                            return $r;
                        }(this));
                        while ($it2.hasNext()) {
                            var iport1 = $it2.next();
                            var found = false;
                            var $it3 = _g.portImplementations.iterator();
                            while ($it3.hasNext()) {
                                var p = $it3.next();
                                var currentPort1 = p;
                                if (ck_instanceof(currentPort1, iport1)) {
                                    found = true;
                                    break;
                                }
                            }
                        }
                    }
                    if (i2.getUsedPorts() != null) {
                        var _g2 = 0;
                        var _g3 = i2.getUsedPorts();
                        while (_g2 < _g3.length) {
                            var iport2 = _g3[_g2];
                            ++_g2;
                            var found1 = false;
                            var $it4 = _g.portUses.iterator();
                            while ($it4.hasNext()) {
                                var p1 = $it4.next();
                                var currentPort2 = p1;
                                if (ck_instanceof(currentPort2, iport2)) {
                                    found1 = true;
                                    break;
                                }
                            }
                        }
                    }
                    var childComponents = i2.getChildComponents();
                    if (childComponents != null) {
                        var $it5 = new haxe.ds._StringMap.StringMapIterator(childComponents, childComponents.arrayKeys());
                        while ($it5.hasNext()) {
                            var child = $it5.next();
                            var found2 = false;
                            var $it6 = _hcmn_.HxOverrides.iter(declarations);
                            while ($it6.hasNext()) {
                                var s = $it6.next();
                                if (s == child) {
                                    found2 = true;
                                    break;
                                }
                            }
                            if (!found2) throw new Error("Not all child component factories registered.");
                        }
                    }
                    childComponents = i2.getReferredComponents();
                    if (childComponents != null) {
                        var $it7 = new haxe.ds._StringMap.StringMapIterator(childComponents, childComponents.arrayKeys());
                        while ($it7.hasNext()) {
                            var child1 = $it7.next();
                            var found3 = false;
                            var $it8 = _hcmn_.HxOverrides.iter(declarations);
                            while ($it8.hasNext()) {
                                var s1 = $it8.next();
                                if (s1 == child1) {
                                    found3 = true;
                                    break;
                                }
                            }
                            if (!found3) throw new Error("Not all referred component factories registered.");
                        }
                    }
                }
            });
        };
        componentmodelImpl.GameAssemblyRunner.prototype.createChannelComponents = function(channel) {
            var waitAll = [];
            var $it0 = channel.getComponents().allComponents();
            while ($it0.hasNext()) {
                var i = $it0.next();
                waitAll.push(this.createComponent(i));
            }
            return Promise.all(waitAll);
        };
        componentmodelImpl.GameAssemblyRunner.prototype.createComponent = function(aicomponentdata) {
            var _g = this;
            var i = new componentmodelImpl.ComponentContext(this.context, this, aicomponentdata);
            this.componentInstances.set(aicomponentdata.getId(), i);
            return i.create().then(function(cc) {
                if (_g.componentInstancePromises.exists(cc.getComponentId()) && (function($this) {
                        var $r;
                        var this1 = _g.componentInstancePromises.get(cc.getComponentId());
                        var key = cc.getComponentIndex();
                        $r = this1.exists(key);
                        return $r;
                    }(this))) {
                    ((function($this) {
                        var $r;
                        var this2 = _g.componentInstanceHandlers.get(cc.getComponentId());
                        var key1 = cc.getComponentIndex();
                        $r = this2.get(key1);
                        return $r;
                    }(this)))(i);
                    var this3 = _g.componentInstanceHandlers.get(cc.getComponentId());
                    var key2 = cc.getComponentIndex();
                    this3.remove(key2);
                    var this4 = _g.componentInstancePromises.get(cc.getComponentId());
                    var key3 = cc.getComponentIndex();
                    this4.remove(key3);
                }
                return cc;
            });
        };
        componentmodelImpl.GameAssemblyRunner.prototype.getComponentInstance = function(id, index) {
            var _g = this;
            if (this.componentInstances.exists(id) && this.componentInstances.get(id).isCreated()) return new Promise(function(resolve, reject) {
                resolve(_g.componentInstances.get(id));
            });
            else {
                if (!this.componentInstancePromises.exists(id)) {
                    this.componentInstancePromises.set(id, new _hcmn_.haxe_ds_StringMap());
                    this.componentInstanceHandlers.set(id, new _hcmn_.haxe_ds_StringMap());
                }
                if (!(function($this) {
                        var $r;
                        var this1 = $this.componentInstancePromises.get(id);
                        $r = this1.exists(index);
                        return $r;
                    }(this))) {
                    var this2 = this.componentInstancePromises.get(id);
                    var value = new Promise(function(resolve1, reject1) {
                        var this3 = _g.componentInstanceHandlers.get(id);
                        this3.set(index, resolve1);
                    });
                    this2.set(index, value);
                }
                var this4 = this.componentInstancePromises.get(id);
                return this4.get(index);
            }
        };
        componentmodelImpl.GameAssemblyRunner.prototype.getComponentFactory = function(factoryId) {
            return this.componentFactoriesInterfaces.get(factoryId);
        };
        componentmodelImpl.GameAssemblyRunner.prototype.getImplementedPort = function(context, portId) {
            if (this.portImplementations.exists(portId)) return this.portImplementations.get(portId);
            else if (this.componentPortFactories.exists(portId)) return this.componentPortFactories.get(portId).provide(context, this.componentPortFactoriesChannel.get(portId));
            else throw new Error("Illegal port factory.");
        };
        componentmodelImpl.GameAssemblyRunner.prototype.getWorkers = function(workerIds) {
            if (workerIds.length == 0) return Promise.resolve(null);
            var res = Promise.all(workerIds.map(function(k) {
                return componentmodelImpl.ExternalService.assetRegistry.getAsset(k).getContent();
            }));
            return res.then(function(workers) {
                var _workers = [];
                var _g1 = 0;
                var _g = workers.length;
                while (_g1 < _g) {
                    var i = _g1++;
                    var id = workerIds[i];
                    var worker = workers[i];
                    _workers.push({
                        id: id,
                        instance: worker
                    });
                }
                return _workers;
            });
        };
        componentmodelImpl.GameAssemblyRunner.prototype.getUsedPort = function(context, portId) {
            if (this.portUses.exists(portId)) return this.portUses.get(portId);
            else if (this.componentPortFactories.exists(portId)) return this.componentPortFactories.get(portId)["use"](context, this.componentPortFactoriesChannel.get(portId));
            else throw new Error("Illegal port factory.");
        };
        componentmodelImpl.GameAssemblyRunner.prototype.getStarted = function() {
            return this.started;
        };
        componentmodelImpl.GameAssemblyRunner.prototype.__class__ = componentmodelImpl.GameAssemblyRunner;
        componentmodelImpl.ADBusses = function(decl) {
            this.decl = decl;
            this.buses = new haxe.ds.ObjectMap();
        };
        componentmodelImpl.ADBusses = ck_implements(componentmodelImpl.ADBusses, componentmodelAssemblyApi.IADBusses);
        componentmodelImpl.ADBusses.__interfaces__ = [componentmodelAssemblyApi.IADBusses];
        componentmodelImpl.ADBusses.__name__ = ["componentmodelImpl", "ADBusses"];
        componentmodelImpl.ADBusses.prototype.decl = null;
        componentmodelImpl.ADBusses.prototype.buses = null;
        componentmodelImpl.ADBusses.prototype.bus = function(id, string) {
            if (this.buses.exists(id)) throw new Error("Duplicate bus declaration.");
            this.buses.set(id, string);
            return this;
        };
        componentmodelImpl.ADBusses.prototype.getAll = function() {
            return this.buses.keys();
        };
        componentmodelImpl.ADBusses.prototype.get = function(bus) {
            return this.buses.get(bus);
        };
        componentmodelImpl.ADBusses.prototype.end = function() {
            return this.decl;
        };
        componentmodelImpl.ADBusses.prototype.__class__ = componentmodelImpl.ADBusses;
        componentmodelImpl.ADComponentFactories = function(decl) {
            this.decl = decl;
            this.componentFactories = new haxe.ds.ObjectMap();
        };
        componentmodelImpl.ADComponentFactories = ck_implements(componentmodelImpl.ADComponentFactories, componentmodelAssemblyApi.IADComponentFactories);
        componentmodelImpl.ADComponentFactories.__interfaces__ = [componentmodelAssemblyApi.IADComponentFactories];
        componentmodelImpl.ADComponentFactories.__name__ = ["componentmodelImpl", "ADComponentFactories"];
        componentmodelImpl.ADComponentFactories.prototype.decl = null;
        componentmodelImpl.ADComponentFactories.prototype.componentFactories = null;
        componentmodelImpl.ADComponentFactories.prototype.componentFactory = function(id, componentFactory) {
            this.componentFactories.set(id, componentFactory);
            return this;
        };
        componentmodelImpl.ADComponentFactories.prototype.getAll = function() {
            return this.componentFactories.keys();
        };
        componentmodelImpl.ADComponentFactories.prototype.get = function(cf) {
            return this.componentFactories.get(cf);
        };
        componentmodelImpl.ADComponentFactories.prototype.end = function() {
            return this.decl;
        };
        componentmodelImpl.ADComponentFactories.prototype.__class__ = componentmodelImpl.ADComponentFactories;
        componentmodelImpl.ADPort = function(ports, portFactory, componentPortFactory) {
            this.busId = null;
            this.componentPortFactory = componentPortFactory;
            this.portFactory = portFactory;
            this.ports = ports;
        };
        componentmodelImpl.ADPort = ck_implements(componentmodelImpl.ADPort, componentmodelAssemblyApi.IADPort);
        componentmodelImpl.ADPort.__interfaces__ = [componentmodelAssemblyApi.IADPort];
        componentmodelImpl.ADPort.__name__ = ["componentmodelImpl", "ADPort"];
        componentmodelImpl.ADPort.prototype.ports = null;
        componentmodelImpl.ADPort.prototype.portFactory = null;
        componentmodelImpl.ADPort.prototype.busId = null;
        componentmodelImpl.ADPort.prototype.componentPortFactory = null;
        componentmodelImpl.ADPort.prototype.getPortFactory = function() {
            return this.portFactory;
        };
        componentmodelImpl.ADPort.prototype.getComponentPortFactory = function() {
            return this.componentPortFactory;
        };
        componentmodelImpl.ADPort.prototype.getBusId = function() {
            return this.busId;
        };
        componentmodelImpl.ADPort.prototype.connect = function(id) {
            if (this.busId != null) throw new Error("Duplicate port connection");
            this.busId = id;
            return this.ports;
        };
        componentmodelImpl.ADPort.prototype.__class__ = componentmodelImpl.ADPort;
        componentmodelImpl.ADPorts = function(decl) {
            this.decl = decl;
            this.ports = new haxe.ds.ObjectMap();
        };
        componentmodelImpl.ADPorts = ck_implements(componentmodelImpl.ADPorts, componentmodelAssemblyApi.IADPorts);
        componentmodelImpl.ADPorts.__interfaces__ = [componentmodelAssemblyApi.IADPorts];
        componentmodelImpl.ADPorts.__name__ = ["componentmodelImpl", "ADPorts"];
        componentmodelImpl.ADPorts.prototype.decl = null;
        componentmodelImpl.ADPorts.prototype.ports = null;
        componentmodelImpl.ADPorts.prototype.port = function(id, portFactory, componentPortFactory) {
            if (this.ports.exists(id)) throw new Error("Duplicate port declaration.");
            var port = new componentmodelImpl.ADPort(this, portFactory, componentPortFactory);
            this.ports.set(id, port);
            return port;
        };
        componentmodelImpl.ADPorts.prototype.getAll = function() {
            return this.ports.keys();
        };
        componentmodelImpl.ADPorts.prototype.get = function(port) {
            return this.ports.get(port);
        };
        componentmodelImpl.ADPorts.prototype.end = function() {
            return this.decl;
        };
        componentmodelImpl.ADPorts.prototype.__class__ = componentmodelImpl.ADPorts;
        componentmodelImpl.ComponentEvent = function(event, payload) {
            this.event = event;
            this.payload = payload;
        };
        componentmodelImpl.ComponentEvent = ck_implements(componentmodelImpl.ComponentEvent, clientkernelEventbusApi.IEvent);
        componentmodelImpl.ComponentEvent.__interfaces__ = [clientkernelEventbusApi.IEvent];
        componentmodelImpl.ComponentEvent.__name__ = ["componentmodelImpl", "ComponentEvent"];
        componentmodelImpl.ComponentEvent.prototype.event = null;
        componentmodelImpl.ComponentEvent.prototype.payload = null;
        componentmodelImpl.ComponentEvent.prototype.getChannel = function() {
            return this.event.getChannel();
        };
        componentmodelImpl.ComponentEvent.prototype.getPayload = function() {
            return this.payload;
        };
        componentmodelImpl.ComponentEvent.prototype.getTopic = function() {
            return this.event.getTopic();
        };
        componentmodelImpl.ComponentEvent.prototype.__class__ = componentmodelImpl.ComponentEvent;
        componentmodelImpl.ComponentTopic = function(instance, topic) {
            this.rootSubscription = null;
            this.callbacks = [];
            this.topic = new clientkernelEventbusApi.Topic(topic);
            this.instance = instance;
        };
        componentmodelImpl.ComponentTopic = ck_implements(componentmodelImpl.ComponentTopic, componentmodelComponentApi.IComponentTopic);
        componentmodelImpl.ComponentTopic.__interfaces__ = [componentmodelComponentApi.IComponentTopic];
        componentmodelImpl.ComponentTopic.__name__ = ["componentmodelImpl", "ComponentTopic"];
        componentmodelImpl.ComponentTopic.prototype.topic = null;
        componentmodelImpl.ComponentTopic.prototype.instance = null;
        componentmodelImpl.ComponentTopic.prototype.callbacks = null;
        componentmodelImpl.ComponentTopic.prototype.rootSubscription = null;
        componentmodelImpl.ComponentTopic.prototype.connect = function(channel) {
            this.topic.connect(channel);
        };
        componentmodelImpl.ComponentTopic.prototype.getId = function() {
            return this.topic.getId();
        };
        componentmodelImpl.ComponentTopic.prototype.subscribe = function(callback) {
            var callback1 = new componentmodelImpl.ComponentTopicCallback(this.instance, callback);
            return this.topic.subscribe($bind(callback1, callback1.callback));
        };
        componentmodelImpl.ComponentTopic.prototype.publish = function(payload) {
            return this.topic.publish(payload);
        };
        componentmodelImpl.ComponentTopic.prototype.subscribeForComponentInstance = function(instance, callback) {
            var callback1 = new componentmodelImpl.ComponentTopicCallback(instance, callback);
            return this.topic.subscribe($bind(callback1, callback1.callback));
        };
        componentmodelImpl.ComponentTopic.prototype.publishForThis = function(payload) {
            var mpayload = new haxe.ds.ObjectMap();
            mpayload.set(this.instance, payload);
            return new componentmodelImpl.ComponentEvent(this.publish(mpayload), payload);
        };
        componentmodelImpl.ComponentTopic.prototype.publishForComponentInstance = function(instance, payload) {
            var mpayload = new haxe.ds.ObjectMap();
            mpayload.set(instance, payload);
            return new componentmodelImpl.ComponentEvent(this.publish(mpayload), payload);
        };
        componentmodelImpl.ComponentTopic.prototype.__class__ = componentmodelImpl.ComponentTopic;
        componentmodelImpl.ComponentTopicCallback = function(instance, pcallback) {
            this.instance = instance;
            this.pcallback = pcallback;
        };
        componentmodelImpl.ComponentTopicCallback.__name__ = ["componentmodelImpl", "ComponentTopicCallback"];
        componentmodelImpl.ComponentTopicCallback.prototype.instance = null;
        componentmodelImpl.ComponentTopicCallback.prototype.pcallback = null;
        componentmodelImpl.ComponentTopicCallback.prototype.callback = function(event) {
            if ((function($this) {
                    var $r;
                    var this1 = event.getPayload();
                    $r = this1.exists($this.instance);
                    return $r;
                }(this))) this.pcallback(new componentmodelImpl.ComponentEvent(event, (function($this) {
                var $r;
                var this2 = event.getPayload();
                $r = this2.get($this.instance);
                return $r;
            }(this))));
        };
        componentmodelImpl.ComponentTopicCallback.prototype.__class__ = componentmodelImpl.ComponentTopicCallback;
        componentmodelImpl.AIChannel = function(impl) {
            this.impl = impl;
            this.aicomponents = new componentmodelImpl.AIComponents(this);
        };
        componentmodelImpl.AIChannel = ck_implements(componentmodelImpl.AIChannel, componentmodelAssemblyApi.IAIChannel);
        componentmodelImpl.AIChannel.__interfaces__ = [componentmodelAssemblyApi.IAIChannel];
        componentmodelImpl.AIChannel.__name__ = ["componentmodelImpl", "AIChannel"];
        componentmodelImpl.AIChannel.prototype.impl = null;
        componentmodelImpl.AIChannel.prototype.aicomponents = null;
        componentmodelImpl.AIChannel.prototype.getComponents = function() {
            return this.aicomponents;
        };
        componentmodelImpl.AIChannel.prototype.components = function() {
            return this.aicomponents;
        };
        componentmodelImpl.AIChannel.prototype.end = function() {
            return this.impl;
        };
        componentmodelImpl.AIChannel.prototype.__class__ = componentmodelImpl.AIChannel;

        componentmodelImpl.AIComponentData = function() {}
        componentmodelImpl.AIComponentData.prototype = {

            getId: function() {
                return {
                    arguments: [],
                    returns: "*"
                };
            },
            getConfiguration: function() {
                return {
                    arguments: [],
                    returns: "string"
                };
            },
            getFactoryId: function() {
                return {
                    arguments: [],
                    returns: "*"
                };
            },
            getQualifier: function() {
                return {
                    arguments: [],
                    returns: "string"
                };
            },
            getIndex: function() {
                return {
                    arguments: [],
                    returns: "string"
                };
            },
            getImplementedPortIds: function() {
                return {
                    arguments: [],
                    returns: "array"
                };
            },
            getUsedPortIds: function() {
                return {
                    arguments: [],
                    returns: "array"
                };
            },
            getChildren: function() {
                return {
                    arguments: [],
                    returns: "*"
                };
            },
            getHas: function() {
                return {
                    arguments: [],
                    returns: "*"
                };
            },
            getWorkers: function() {
                return {
                    arguments: [],
                    returns: "array"
                };
            }
        };
        componentmodelImpl.AIComponent = function(parent, id, qualifier, index, factoryId) {
            this.configuration = null;
            this.parent = parent;
            this.factoryId = factoryId;
            this.implementedPorts = [];
            this.usedPorts = [];
            this.aichildren = new componentmodelImpl.AIComponents(this);
            this.aihas = new componentmodelImpl.AIHas(this);
            this.qualifier = qualifier;
            this.index = index;
            this.id = id;
            this.workers = [];
        };
        componentmodelImpl.AIComponent = ck_implements(componentmodelImpl.AIComponent, componentmodelImpl.AIComponentData);
        componentmodelImpl.AIComponent = ck_implements(componentmodelImpl.AIComponent, componentmodelAssemblyApi.IAIComponent);
        componentmodelImpl.AIComponent.__interfaces__ = [componentmodelImpl.AIComponentData, componentmodelAssemblyApi.IAIComponent];
        componentmodelImpl.AIComponent.__name__ = ["componentmodelImpl", "AIComponent"];
        componentmodelImpl.AIComponent.prototype.parent = null;
        componentmodelImpl.AIComponent.prototype.factoryId = null;
        componentmodelImpl.AIComponent.prototype.configuration = null;
        componentmodelImpl.AIComponent.prototype.implementedPorts = null;
        componentmodelImpl.AIComponent.prototype.usedPorts = null;
        componentmodelImpl.AIComponent.prototype.aichildren = null;
        componentmodelImpl.AIComponent.prototype.aihas = null;
        componentmodelImpl.AIComponent.prototype.qualifier = null;
        componentmodelImpl.AIComponent.prototype.index = null;
        componentmodelImpl.AIComponent.prototype.id = null;
        componentmodelImpl.AIComponent.prototype.workers = null;
        componentmodelImpl.AIComponent.prototype.implement = function(id) {
            if ((function($this) {
                    var $r;
                    var x = id;
                    $r = _hcmn_.HxOverrides.indexOf($this.implementedPorts, x, 0);
                    return $r;
                }(this)) != -1) throw new Error("Duplicate implementation");
            this.implementedPorts.push(id);
            return this;
        };
        componentmodelImpl.AIComponent.prototype["use"] = function(id) {
            if ((function($this) {
                    var $r;
                    var x = id;
                    $r = _hcmn_.HxOverrides.indexOf($this.usedPorts, x, 0);
                    return $r;
                }(this)) != -1) throw new Error("Duplicate use");
            this.usedPorts.push(id);
            return this;
        };
        componentmodelImpl.AIComponent.prototype.configure = function(configuration) {
            if (this.configuration != null) throw new Error("Duplicate configuration");
            this.configuration = configuration;
            return this;
        };
        componentmodelImpl.AIComponent.prototype.worker = function(id) {
            this.workers.push(id);
            return this;
        };
        componentmodelImpl.AIComponent.prototype.end = function() {
            return this.parent;
        };
        componentmodelImpl.AIComponent.prototype.children = function() {
            return this.aichildren;
        };
        componentmodelImpl.AIComponent.prototype.has = function() {
            return this.aihas;
        };
        componentmodelImpl.AIComponent.prototype.getId = function() {
            return this.id;
        };
        componentmodelImpl.AIComponent.prototype.getConfiguration = function() {
            return this.configuration;
        };
        componentmodelImpl.AIComponent.prototype.getFactoryId = function() {
            return this.factoryId;
        };
        componentmodelImpl.AIComponent.prototype.getQualifier = function() {
            return this.qualifier;
        };
        componentmodelImpl.AIComponent.prototype.getIndex = function() {
            return this.index;
        };
        componentmodelImpl.AIComponent.prototype.getImplementedPortIds = function() {
            return this.implementedPorts;
        };
        componentmodelImpl.AIComponent.prototype.getUsedPortIds = function() {
            return this.usedPorts;
        };
        componentmodelImpl.AIComponent.prototype.getWorkers = function() {
            return this.workers;
        };
        componentmodelImpl.AIComponent.prototype.getChildren = function() {
            return this.aichildren;
        };
        componentmodelImpl.AIComponent.prototype.getHas = function() {
            return this.aihas;
        };
        componentmodelImpl.AIComponent.prototype.__class__ = componentmodelImpl.AIComponent;

        componentmodelImpl.AIComponentsData = function() {}
        componentmodelImpl.AIComponentsData.prototype = {

            allComponents: function() {
                return {
                    arguments: [],
                    returns: "null"
                };
            }
        };
        componentmodelImpl.AIComponents = function(parent) {
            this.parent = parent;
            this.components = new haxe.ds.ObjectMap();
        };
        componentmodelImpl.AIComponents = ck_implements(componentmodelImpl.AIComponents, componentmodelImpl.AIComponentsData);
        componentmodelImpl.AIComponents = ck_implements(componentmodelImpl.AIComponents, componentmodelAssemblyApi.IAIComponents);
        componentmodelImpl.AIComponents.__interfaces__ = [componentmodelImpl.AIComponentsData, componentmodelAssemblyApi.IAIComponents];
        componentmodelImpl.AIComponents.__name__ = ["componentmodelImpl", "AIComponents"];
        componentmodelImpl.AIComponents.prototype.parent = null;
        componentmodelImpl.AIComponents.prototype.components = null;
        componentmodelImpl.AIComponents.prototype.component = function(qualifier, index, id, factoryId) {
            if (this.components.exists(id)) throw new Error("Duplicate component");
            if (qualifier == null) qualifier = "component";
            var component = new componentmodelImpl.AIComponent(this, id, qualifier, index, factoryId);
            this.components.set(id, component);
            return component;
        };
        componentmodelImpl.AIComponents.prototype.allComponents = function() {
            return this.components.iterator();
        };
        componentmodelImpl.AIComponents.prototype.end = function() {
            return this.parent;
        };
        componentmodelImpl.AIComponents.prototype.__class__ = componentmodelImpl.AIComponents;

        componentmodelImpl.AIHasData = function() {}
        componentmodelImpl.AIHasData.prototype = {

            getReferences: function(slot) {
                return {
                    arguments: ["string"],
                    returns: Map
                };
            }
        };
        componentmodelImpl.AIHas = function(component) {
            this.component = component;
            this.references = new _hcmn_.haxe_ds_StringMap();
        };
        componentmodelImpl.AIHas = ck_implements(componentmodelImpl.AIHas, componentmodelImpl.AIHasData);
        componentmodelImpl.AIHas = ck_implements(componentmodelImpl.AIHas, componentmodelAssemblyApi.IAIHas);
        componentmodelImpl.AIHas.__interfaces__ = [componentmodelImpl.AIHasData, componentmodelAssemblyApi.IAIHas];
        componentmodelImpl.AIHas.__name__ = ["componentmodelImpl", "AIHas"];
        componentmodelImpl.AIHas.prototype.component = null;
        componentmodelImpl.AIHas.prototype.references = null;
        componentmodelImpl.AIHas.prototype.end = function() {
            return this.component;
        };
        componentmodelImpl.AIHas.prototype.reference = function(qualifier, index, id) {
            if (!this.references.exists(qualifier)) {
                var value = new _hcmn_.haxe_ds_StringMap();
                this.references.set(qualifier, value);
            }
            var slotE = this.references.get(qualifier);
            if (_hcmn_.__map_reserved[index] != null ? slotE.existsReserved(index) : slotE.h.hasOwnProperty(index)) throw new Error("Duplicate has qualifier/index");
            var value1 = id;
            slotE.set(index, value1);
            return this;
        };
        componentmodelImpl.AIHas.prototype.getReferences = function(qualifier) {
            var ret = new _hcmn_.haxe_ds_StringMap();
            if (!this.references.exists(qualifier)) return ret;
            return this.references.get(qualifier);
        };
        componentmodelImpl.AIHas.prototype.__class__ = componentmodelImpl.AIHas;
        if (typeof haxe == 'undefined') {
            var haxe = {};
        };

        haxe.IMap = function() {}
        haxe.IMap.prototype = {

            get: function(k) {
                return {
                    arguments: ["*"],
                    returns: "null"
                };
            },
            set: function(k, v) {
                return {
                    arguments: ["*", "*"],
                    returns: "void"
                };
            },
            exists: function(k) {
                return {
                    arguments: ["*"],
                    returns: "boolean"
                };
            },
            remove: function(k) {
                return {
                    arguments: ["*"],
                    returns: "boolean"
                };
            }
        };
        if (!haxe._Int64) {
            haxe._Int64 = {};
        };
        haxe._Int64.___Int64 = function(high, low) {
            this.high = high;
            this.low = low;
        };
        haxe._Int64.___Int64.__name__ = ["haxe", "_Int64", "___Int64"];
        haxe._Int64.___Int64.prototype.high = null;
        haxe._Int64.___Int64.prototype.low = null;
        haxe._Int64.___Int64.prototype.__class__ = haxe._Int64.___Int64;
        if (!haxe.crypto) {
            haxe.crypto = {};
        };
        haxe.crypto.Md5 = function() {};
        haxe.crypto.Md5.__name__ = ["haxe", "crypto", "Md5"];
        haxe.crypto.Md5.prototype.bitOR = function(a, b) {
            var lsb = a & 1 | b & 1;
            var msb31 = a >>> 1 | b >>> 1;
            return msb31 << 1 | lsb;
        };
        haxe.crypto.Md5.prototype.bitXOR = function(a, b) {
            var lsb = a & 1 ^ b & 1;
            var msb31 = a >>> 1 ^ b >>> 1;
            return msb31 << 1 | lsb;
        };
        haxe.crypto.Md5.prototype.bitAND = function(a, b) {
            var lsb = a & 1 & (b & 1);
            var msb31 = a >>> 1 & b >>> 1;
            return msb31 << 1 | lsb;
        };
        haxe.crypto.Md5.prototype.addme = function(x, y) {
            var lsw = (x & 65535) + (y & 65535);
            var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
            return msw << 16 | lsw & 65535;
        };
        haxe.crypto.Md5.prototype.hex = function(a) {
            var str = "";
            var hex_chr = "0123456789abcdef";
            var _g = 0;
            while (_g < a.length) {
                var num = a[_g];
                ++_g;
                var _g1 = 0;
                while (_g1 < 4) {
                    var j = _g1++;
                    str += hex_chr.charAt(num >> j * 8 + 4 & 15) + hex_chr.charAt(num >> j * 8 & 15);
                }
            }
            return str;
        };
        haxe.crypto.Md5.prototype.rol = function(num, cnt) {
            return num << cnt | num >>> 32 - cnt;
        };
        haxe.crypto.Md5.prototype.cmn = function(q, a, b, x, s, t) {
            return this.addme(this.rol(this.addme(this.addme(a, q), this.addme(x, t)), s), b);
        };
        haxe.crypto.Md5.prototype.ff = function(a, b, c, d, x, s, t) {
            return this.cmn(this.bitOR(this.bitAND(b, c), this.bitAND(~b, d)), a, b, x, s, t);
        };
        haxe.crypto.Md5.prototype.gg = function(a, b, c, d, x, s, t) {
            return this.cmn(this.bitOR(this.bitAND(b, d), this.bitAND(c, ~d)), a, b, x, s, t);
        };
        haxe.crypto.Md5.prototype.hh = function(a, b, c, d, x, s, t) {
            return this.cmn(this.bitXOR(this.bitXOR(b, c), d), a, b, x, s, t);
        };
        haxe.crypto.Md5.prototype.ii = function(a, b, c, d, x, s, t) {
            return this.cmn(this.bitXOR(c, this.bitOR(b, ~d)), a, b, x, s, t);
        };
        haxe.crypto.Md5.prototype.doEncode = function(x) {
            var a = 1732584193;
            var b = -271733879;
            var c = -1732584194;
            var d = 271733878;
            var step;
            var i = 0;
            while (i < x.length) {
                var olda = a;
                var oldb = b;
                var oldc = c;
                var oldd = d;
                step = 0;
                a = this.ff(a, b, c, d, x[i], 7, -680876936);
                d = this.ff(d, a, b, c, x[i + 1], 12, -389564586);
                c = this.ff(c, d, a, b, x[i + 2], 17, 606105819);
                b = this.ff(b, c, d, a, x[i + 3], 22, -1044525330);
                a = this.ff(a, b, c, d, x[i + 4], 7, -176418897);
                d = this.ff(d, a, b, c, x[i + 5], 12, 1200080426);
                c = this.ff(c, d, a, b, x[i + 6], 17, -1473231341);
                b = this.ff(b, c, d, a, x[i + 7], 22, -45705983);
                a = this.ff(a, b, c, d, x[i + 8], 7, 1770035416);
                d = this.ff(d, a, b, c, x[i + 9], 12, -1958414417);
                c = this.ff(c, d, a, b, x[i + 10], 17, -42063);
                b = this.ff(b, c, d, a, x[i + 11], 22, -1990404162);
                a = this.ff(a, b, c, d, x[i + 12], 7, 1804603682);
                d = this.ff(d, a, b, c, x[i + 13], 12, -40341101);
                c = this.ff(c, d, a, b, x[i + 14], 17, -1502002290);
                b = this.ff(b, c, d, a, x[i + 15], 22, 1236535329);
                a = this.gg(a, b, c, d, x[i + 1], 5, -165796510);
                d = this.gg(d, a, b, c, x[i + 6], 9, -1069501632);
                c = this.gg(c, d, a, b, x[i + 11], 14, 643717713);
                b = this.gg(b, c, d, a, x[i], 20, -373897302);
                a = this.gg(a, b, c, d, x[i + 5], 5, -701558691);
                d = this.gg(d, a, b, c, x[i + 10], 9, 38016083);
                c = this.gg(c, d, a, b, x[i + 15], 14, -660478335);
                b = this.gg(b, c, d, a, x[i + 4], 20, -405537848);
                a = this.gg(a, b, c, d, x[i + 9], 5, 568446438);
                d = this.gg(d, a, b, c, x[i + 14], 9, -1019803690);
                c = this.gg(c, d, a, b, x[i + 3], 14, -187363961);
                b = this.gg(b, c, d, a, x[i + 8], 20, 1163531501);
                a = this.gg(a, b, c, d, x[i + 13], 5, -1444681467);
                d = this.gg(d, a, b, c, x[i + 2], 9, -51403784);
                c = this.gg(c, d, a, b, x[i + 7], 14, 1735328473);
                b = this.gg(b, c, d, a, x[i + 12], 20, -1926607734);
                a = this.hh(a, b, c, d, x[i + 5], 4, -378558);
                d = this.hh(d, a, b, c, x[i + 8], 11, -2022574463);
                c = this.hh(c, d, a, b, x[i + 11], 16, 1839030562);
                b = this.hh(b, c, d, a, x[i + 14], 23, -35309556);
                a = this.hh(a, b, c, d, x[i + 1], 4, -1530992060);
                d = this.hh(d, a, b, c, x[i + 4], 11, 1272893353);
                c = this.hh(c, d, a, b, x[i + 7], 16, -155497632);
                b = this.hh(b, c, d, a, x[i + 10], 23, -1094730640);
                a = this.hh(a, b, c, d, x[i + 13], 4, 681279174);
                d = this.hh(d, a, b, c, x[i], 11, -358537222);
                c = this.hh(c, d, a, b, x[i + 3], 16, -722521979);
                b = this.hh(b, c, d, a, x[i + 6], 23, 76029189);
                a = this.hh(a, b, c, d, x[i + 9], 4, -640364487);
                d = this.hh(d, a, b, c, x[i + 12], 11, -421815835);
                c = this.hh(c, d, a, b, x[i + 15], 16, 530742520);
                b = this.hh(b, c, d, a, x[i + 2], 23, -995338651);
                a = this.ii(a, b, c, d, x[i], 6, -198630844);
                d = this.ii(d, a, b, c, x[i + 7], 10, 1126891415);
                c = this.ii(c, d, a, b, x[i + 14], 15, -1416354905);
                b = this.ii(b, c, d, a, x[i + 5], 21, -57434055);
                a = this.ii(a, b, c, d, x[i + 12], 6, 1700485571);
                d = this.ii(d, a, b, c, x[i + 3], 10, -1894986606);
                c = this.ii(c, d, a, b, x[i + 10], 15, -1051523);
                b = this.ii(b, c, d, a, x[i + 1], 21, -2054922799);
                a = this.ii(a, b, c, d, x[i + 8], 6, 1873313359);
                d = this.ii(d, a, b, c, x[i + 15], 10, -30611744);
                c = this.ii(c, d, a, b, x[i + 6], 15, -1560198380);
                b = this.ii(b, c, d, a, x[i + 13], 21, 1309151649);
                a = this.ii(a, b, c, d, x[i + 4], 6, -145523070);
                d = this.ii(d, a, b, c, x[i + 11], 10, -1120210379);
                c = this.ii(c, d, a, b, x[i + 2], 15, 718787259);
                b = this.ii(b, c, d, a, x[i + 9], 21, -343485551);
                a = this.addme(a, olda);
                b = this.addme(b, oldb);
                c = this.addme(c, oldc);
                d = this.addme(d, oldd);
                i += 16;
            }
            return [a, b, c, d];
        };
        haxe.crypto.Md5.encode = function(s) {
            var m = new haxe.crypto.Md5();
            var h = m.doEncode(haxe.crypto.Md5.str2blks(s));
            return m.hex(h);
        };
        haxe.crypto.Md5.str2blks = function(str) {
            var nblk = (str.length + 8 >> 6) + 1;
            var blks = [];
            var blksSize = nblk * 16;
            var _g = 0;
            while (_g < blksSize) {
                var i1 = _g++;
                blks[i1] = 0;
            }
            var i = 0;
            while (i < str.length) {
                blks[i >> 2] |= _hcmn_.HxOverrides.cca(str, i) << (str.length * 8 + i) % 4 * 8;
                i++;
            }
            blks[i >> 2] |= 128 << (str.length * 8 + i) % 4 * 8;
            var l = str.length * 8;
            var k = nblk * 16 - 2;
            blks[k] = l & 255;
            blks[k] |= (l >>> 8 & 255) << 8;
            blks[k] |= (l >>> 16 & 255) << 16;
            blks[k] |= (l >>> 24 & 255) << 24;
            return blks;
        };
        haxe.crypto.Md5.prototype.__class__ = haxe.crypto.Md5;
        if (!haxe.ds) {
            haxe.ds = {};
        };
        haxe.ds.ObjectMap = function() {
            this.h = {};
            this.h.__keys__ = {};
        };
        haxe.ds.ObjectMap.__interfaces__ = [haxe.IMap];
        haxe.ds.ObjectMap.__name__ = ["haxe", "ds", "ObjectMap"];
        haxe.ds.ObjectMap.prototype.h = null;
        haxe.ds.ObjectMap.prototype.set = function(key, value) {
            var id = key.__id__ || (key.__id__ = ++haxe.ds.ObjectMap.count);
            this.h[id] = value;
            this.h.__keys__[id] = key;
        };
        haxe.ds.ObjectMap.prototype.get = function(key) {
            return this.h[key.__id__];
        };
        haxe.ds.ObjectMap.prototype.exists = function(key) {
            return this.h.__keys__[key.__id__] != null;
        };
        haxe.ds.ObjectMap.prototype.remove = function(key) {
            var id = key.__id__;
            if (this.h.__keys__[id] == null) return false;
            delete(this.h[id]);
            delete(this.h.__keys__[id]);
            return true;
        };
        haxe.ds.ObjectMap.prototype.keys = function() {
            var a = [];
            for (var key in this.h.__keys__) {
                if (this.h.hasOwnProperty(key)) a.push(this.h.__keys__[key]);
            }
            return _hcmn_.HxOverrides.iter(a);
        };
        haxe.ds.ObjectMap.prototype.iterator = function() {
            return {
                ref: this.h,
                it: this.keys(),
                hasNext: function() {
                    return this.it.hasNext();
                },
                next: function() {
                    var i = this.it.next();
                    return this.ref[i.__id__];
                }
            };
        };
        haxe.ds.ObjectMap.prototype.__class__ = haxe.ds.ObjectMap;
        if (!haxe.ds._StringMap) {
            haxe.ds._StringMap = {};
        };
        haxe.ds._StringMap.StringMapIterator = function(map, keys) {
            this.map = map;
            this.keys = keys;
            this.index = 0;
            this.count = keys.length;
        };
        haxe.ds._StringMap.StringMapIterator.__name__ = ["haxe", "ds", "_StringMap", "StringMapIterator"];
        haxe.ds._StringMap.StringMapIterator.prototype.map = null;
        haxe.ds._StringMap.StringMapIterator.prototype.keys = null;
        haxe.ds._StringMap.StringMapIterator.prototype.index = null;
        haxe.ds._StringMap.StringMapIterator.prototype.count = null;
        haxe.ds._StringMap.StringMapIterator.prototype.hasNext = function() {
            return this.index < this.count;
        };
        haxe.ds._StringMap.StringMapIterator.prototype.next = function() {
            return this.map.get(this.keys[this.index++]);
        };
        haxe.ds._StringMap.StringMapIterator.prototype.__class__ = haxe.ds._StringMap.StringMapIterator;
        if (!haxe.io) {
            haxe.io = {};
        };
        haxe.io.Error = {
            __ename__: ["haxe", "io", "Error"],
            __constructs__: ["Blocked", "Overflow", "OutsideBounds", "Custom"]
        };
        haxe.io.Error.Custom = function(e) {
            var $x = ["Custom", 3, e];
            $x.__enum__ = haxe.io.Error;
            $x.toString = $estr;
            return $x;
        };
        haxe.io.Error.Blocked = ["Blocked", 0];
        haxe.io.Error.Blocked.toString = $estr;
        haxe.io.Error.Blocked.__enum__ = haxe.io.Error;
        haxe.io.Error.Overflow = ["Overflow", 1];
        haxe.io.Error.Overflow.toString = $estr;
        haxe.io.Error.Overflow.__enum__ = haxe.io.Error;
        haxe.io.Error.OutsideBounds = ["OutsideBounds", 2];
        haxe.io.Error.OutsideBounds.toString = $estr;
        haxe.io.Error.OutsideBounds.__enum__ = haxe.io.Error;
        haxe.io.FPHelper = function() {};
        haxe.io.FPHelper.__name__ = ["haxe", "io", "FPHelper"];
        haxe.io.FPHelper.i32ToFloat = function(i) {
            var sign = 1 - (i >>> 31 << 1);
            var exp = i >>> 23 & 255;
            var sig = i & 8388607;
            if (sig == 0 && exp == 0) return 0.0;
            return sign * (1 + _hcmn_.Math.pow(2, -23) * sig) * _hcmn_.Math.pow(2, exp - 127);
        };
        haxe.io.FPHelper.floatToI32 = function(f) {
            if (f == 0) return 0;
            var af;
            if (f < 0) af = -f;
            else af = f;
            var exp = _hcmn_.Math.floor(_hcmn_.Math.log(af) / 0.6931471805599453);
            if (exp < -127) exp = -127;
            else if (exp > 128) exp = 128;
            var sig = _hcmn_.Math.round((af / _hcmn_.Math.pow(2, exp) - 1) * 8388608) & 8388607;
            return (f < 0 ? -2147483648 : 0) | exp + 127 << 23 | sig;
        };
        haxe.io.FPHelper.i64ToDouble = function(low, high) {
            var sign = 1 - (high >>> 31 << 1);
            var exp = (high >> 20 & 2047) - 1023;
            var sig = (high & 1048575) * 4294967296. + (low >>> 31) * 2147483648. + (low & 2147483647);
            if (sig == 0 && exp == -1023) return 0.0;
            return sign * (1.0 + _hcmn_.Math.pow(2, -52) * sig) * _hcmn_.Math.pow(2, exp);
        };
        haxe.io.FPHelper.doubleToI64 = function(v) {
            var i64 = haxe.io.FPHelper.i64tmp;
            if (v == 0) {
                i64.low = 0;
                i64.high = 0;
            } else {
                var av;
                if (v < 0) av = -v;
                else av = v;
                var exp = _hcmn_.Math.floor(_hcmn_.Math.log(av) / 0.6931471805599453);
                var sig;
                var v1 = (av / _hcmn_.Math.pow(2, exp) - 1) * 4503599627370496.;
                sig = _hcmn_.Math.round(v1);
                var sig_l = sig | 0;
                var sig_h = sig / 4294967296.0 | 0;
                i64.low = sig_l;
                i64.high = (v < 0 ? -2147483648 : 0) | exp + 1023 << 20 | sig_h;
            }
            return i64;
        };
        haxe.io.FPHelper.prototype.__class__ = haxe.io.FPHelper;
        if (typeof js == 'undefined') {
            var js = {};
        };
        if (!js._Boot) {
            js._Boot = {};
        };
        js._Boot.HaxeError = function(val) {
            Error.call(this);
            this.val = val;
            this.message = String(val);
            if (Error.captureStackTrace) Error.captureStackTrace(this, js._Boot.HaxeError);
        };
        js._Boot.HaxeError.__name__ = ["js", "_Boot", "HaxeError"];
        js._Boot.HaxeError.__super__ = Error;
        for (var k in Error.prototype) js._Boot.HaxeError.prototype[k] = Error.prototype[k];
        js._Boot.HaxeError.prototype.val = null;
        js._Boot.HaxeError.prototype.__class__ = js._Boot.HaxeError;
        if (!js.html) {
            js.html = {};
        };
        if (!js.html.compat) {
            js.html.compat = {};
        };
        js.html.compat.DataView = function(buffer, byteOffset, byteLength) {
            this.buf = buffer;
            if (byteOffset == null) this.offset = 0;
            else this.offset = byteOffset;
            if (byteLength == null) this.length = buffer.byteLength - this.offset;
            else this.length = byteLength;
            if (this.offset < 0 || this.length < 0 || this.offset + this.length > buffer.byteLength) throw new js._Boot.HaxeError(haxe.io.Error.OutsideBounds);
        };
        js.html.compat.DataView.__name__ = ["js", "html", "compat", "DataView"];
        js.html.compat.DataView.prototype.buf = null;
        js.html.compat.DataView.prototype.offset = null;
        js.html.compat.DataView.prototype.length = null;
        js.html.compat.DataView.prototype.getInt8 = function(byteOffset) {
            var v = this.buf.a[this.offset + byteOffset];
            if (v >= 128) return v - 256;
            else return v;
        };
        js.html.compat.DataView.prototype.getUint8 = function(byteOffset) {
            return this.buf.a[this.offset + byteOffset];
        };
        js.html.compat.DataView.prototype.getInt16 = function(byteOffset, littleEndian) {
            var v = this.getUint16(byteOffset, littleEndian);
            if (v >= 32768) return v - 65536;
            else return v;
        };
        js.html.compat.DataView.prototype.getUint16 = function(byteOffset, littleEndian) {
            if (littleEndian) return this.buf.a[this.offset + byteOffset] | this.buf.a[this.offset + byteOffset + 1] << 8;
            else return this.buf.a[this.offset + byteOffset] << 8 | this.buf.a[this.offset + byteOffset + 1];
        };
        js.html.compat.DataView.prototype.getInt32 = function(byteOffset, littleEndian) {
            var p = this.offset + byteOffset;
            var a = this.buf.a[p++];
            var b = this.buf.a[p++];
            var c = this.buf.a[p++];
            var d = this.buf.a[p++];
            if (littleEndian) return a | b << 8 | c << 16 | d << 24;
            else return d | c << 8 | b << 16 | a << 24;
        };
        js.html.compat.DataView.prototype.getUint32 = function(byteOffset, littleEndian) {
            var v = this.getInt32(byteOffset, littleEndian);
            if (v < 0) return v + 4294967296.;
            else return v;
        };
        js.html.compat.DataView.prototype.getFloat32 = function(byteOffset, littleEndian) {
            return haxe.io.FPHelper.i32ToFloat(this.getInt32(byteOffset, littleEndian));
        };
        js.html.compat.DataView.prototype.getFloat64 = function(byteOffset, littleEndian) {
            var a = this.getInt32(byteOffset, littleEndian);
            var b = this.getInt32(byteOffset + 4, littleEndian);
            return haxe.io.FPHelper.i64ToDouble(littleEndian ? a : b, littleEndian ? b : a);
        };
        js.html.compat.DataView.prototype.setInt8 = function(byteOffset, value) {
            if (value < 0) this.buf.a[byteOffset + this.offset] = value + 128 & 255;
            else this.buf.a[byteOffset + this.offset] = value & 255;
        };
        js.html.compat.DataView.prototype.setUint8 = function(byteOffset, value) {
            this.buf.a[byteOffset + this.offset] = value & 255;
        };
        js.html.compat.DataView.prototype.setInt16 = function(byteOffset, value, littleEndian) {
            this.setUint16(byteOffset, value < 0 ? value + 65536 : value, littleEndian);
        };
        js.html.compat.DataView.prototype.setUint16 = function(byteOffset, value, littleEndian) {
            var p = byteOffset + this.offset;
            if (littleEndian) {
                this.buf.a[p] = value & 255;
                this.buf.a[p++] = value >> 8 & 255;
            } else {
                this.buf.a[p++] = value >> 8 & 255;
                this.buf.a[p] = value & 255;
            }
        };
        js.html.compat.DataView.prototype.setInt32 = function(byteOffset, value, littleEndian) {
            this.setUint32(byteOffset, value, littleEndian);
        };
        js.html.compat.DataView.prototype.setUint32 = function(byteOffset, value, littleEndian) {
            var p = byteOffset + this.offset;
            if (littleEndian) {
                this.buf.a[p++] = value & 255;
                this.buf.a[p++] = value >> 8 & 255;
                this.buf.a[p++] = value >> 16 & 255;
                this.buf.a[p++] = value >>> 24;
            } else {
                this.buf.a[p++] = value >>> 24;
                this.buf.a[p++] = value >> 16 & 255;
                this.buf.a[p++] = value >> 8 & 255;
                this.buf.a[p++] = value & 255;
            }
        };
        js.html.compat.DataView.prototype.setFloat32 = function(byteOffset, value, littleEndian) {
            this.setUint32(byteOffset, haxe.io.FPHelper.floatToI32(value), littleEndian);
        };
        js.html.compat.DataView.prototype.setFloat64 = function(byteOffset, value, littleEndian) {
            var i64 = haxe.io.FPHelper.doubleToI64(value);
            if (littleEndian) {
                this.setUint32(byteOffset, i64.low);
                this.setUint32(byteOffset, i64.high);
            } else {
                this.setUint32(byteOffset, i64.high);
                this.setUint32(byteOffset, i64.low);
            }
        };
        js.html.compat.DataView.prototype.__class__ = js.html.compat.DataView;
        var DataView = (Function("return typeof DataView != 'undefined' ? DataView : null"))() || js.html.compat.DataView;
        haxe.ds.ObjectMap.count = 0;;
        haxe.io.FPHelper.i64tmp = (function($this) {
            var $r;
            var x = new haxe._Int64.___Int64(0, 0);
            $r = x;
            return $r;
        }(this));;
        return {
            exports: componentmodelImpl,
            activator: componentmodelImpl.Activator
        };
    });
//# sourceURL=componentModel.js