define("scarabWilds", ["viewBuilderApi", "componentmodelComponentApi", "translationmanagerApi", "clientkernelLoaderApi", "displayEngineApi", "displayEngineUtils", "scarabWildsApi", "gameLayoutApi", "PIXI", "BABYLON", "clientkernelEventbusApi", "clientkernelModulesApi"],
    function(viewBuilderApi, componentmodelComponentApi, translationmanagerApi, clientkernelLoaderApi, displayEngineApi, displayEngineUtils, scarabWildsApi, gameLayoutApi, PIXI, BABYLON, 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 scarabWilds == 'undefined') {
            var scarabWilds = {};
        };
        scarabWilds.Activator = function(context) {};
        scarabWilds.Activator = ck_implements(scarabWilds.Activator, clientkernelModulesApi.IModuleActivator);
        scarabWilds.Activator.__interfaces__ = [clientkernelModulesApi.IModuleActivator];
        scarabWilds.Activator.__name__ = ["scarabWilds", "Activator"];
        scarabWilds.Activator.prototype.start = function(context) {
            context.getServiceTracker([clientkernelLoaderApi.IAssetRegistry, viewBuilderApi.IViewBuilderFactory, displayEngineApi.IDisplayProvider]).then(function(context1) {
                scarabWilds.ExternalService.initialize(context1);
                var vbf = context1.getAnyService(viewBuilderApi.IViewBuilderFactory, null);
                scarabWilds.ExternalService.bus = context1.getAnyService(clientkernelEventbusApi.IEventBus, null);
                scarabWilds.ExternalService.viewBuilderFactory = vbf;
                context1.registerService(new scarabWilds.WildsFactory(vbf, context1), scarabWildsApi.WildsDeclaration, null);
            });
        };
        scarabWilds.Activator.prototype.stop = function(context) {};
        scarabWilds.Activator.main = function() {};
        scarabWilds.Activator.prototype.__class__ = scarabWilds.Activator;
        scarabWilds.ExternalService = function() {};
        scarabWilds.ExternalService.__name__ = ["scarabWilds", "ExternalService"];
        scarabWilds.ExternalService.assetRegistry = null;
        scarabWilds.ExternalService.vbf = null;
        scarabWilds.ExternalService.displayProvider = null;
        scarabWilds.ExternalService.translationManager = null;
        scarabWilds.ExternalService.bus = null;
        scarabWilds.ExternalService.viewBuilderFactory = null;
        scarabWilds.ExternalService.assets = null;
        scarabWilds.ExternalService.initialize = function(context) {
            scarabWilds.ExternalService.assetRegistry = context.getAnyService(clientkernelLoaderApi.IAssetRegistry, null);
            scarabWilds.ExternalService.vbf = context.getAnyService(viewBuilderApi.IViewBuilderFactory, null);
            scarabWilds.ExternalService.displayProvider = context.getAnyService(displayEngineApi.IDisplayProvider, null);
        };
        scarabWilds.ExternalService.prototype.__class__ = scarabWilds.ExternalService;
        scarabWilds.Wilds = function(context, vbf) {
            this.assetsLoaded = false;
            this.initialized = false;
            this.layoutPayload = null;
            this.vba = null;
            this.cfgId = "wilds_definition_config.json";
            this.vbAssetID = "wilds.viewbuilder.json";
            this.vbf = vbf;
            this.context = context;
            this.components = new haxe.ds.EnumValueMap();
            this.baseEvents = new scarabWilds.BaseEvents();
            this.port = context.getImplementedPort(scarabWildsApi.IWildsImplementationPort);
            this.layoutPort = context.getUsedPort(gameLayoutApi.IGameLayoutPort);
            this.layoutPort.getUpdateComponentLayout().subscribe($bind(this, this.updateLayout));
            haxe.Log.trace("[WILDS] loadConfigData() ", {
                fileName: "Wilds.hx",
                lineNumber: 61,
                className: "game.wilds.Wilds",
                methodName: "new"
            });
            this.loadConfigData();
        };
        scarabWilds.Wilds.__name__ = ["scarabWilds", "Wilds"];
        scarabWilds.Wilds.prototype.vbAssetID = null;
        scarabWilds.Wilds.prototype.cfgId = null;
        scarabWilds.Wilds.prototype.view = null;
        scarabWilds.Wilds.prototype.context = null;
        scarabWilds.Wilds.prototype.vba = null;
        scarabWilds.Wilds.prototype.vbf = null;
        scarabWilds.Wilds.prototype.controller = null;
        scarabWilds.Wilds.prototype.layoutPayload = null;
        scarabWilds.Wilds.prototype.initialized = null;
        scarabWilds.Wilds.prototype.assetsLoaded = null;
        scarabWilds.Wilds.prototype.port = null;
        scarabWilds.Wilds.prototype.layoutPort = null;
        scarabWilds.Wilds.prototype.cfg = null;
        scarabWilds.Wilds.prototype.vbView = null;
        scarabWilds.Wilds.prototype.components = null;
        scarabWilds.Wilds.prototype.baseEvents = null;
        scarabWilds.Wilds.prototype.loadConfigData = function() {
            var _g = this;
            scarabWilds.ExternalService.assetRegistry.getAsset(this.cfgId).getContent().then(function(data) {
                haxe.Log.trace("[WILDS] loadConfigData() ", {
                    fileName: "Wilds.hx",
                    lineNumber: 86,
                    className: "game.wilds.Wilds",
                    methodName: "loadConfigData",
                    customParams: [_g.cfg]
                });
                _g.cfg = data;
                _g.loadVBAssets();
            });
        };
        scarabWilds.Wilds.prototype.loadVBAssets = function() {
            var _g = this;
            haxe.Log.trace("[WILDS] loadVBAssets() " + _hcmn_.Std.string(this.cfg.vbAssets), {
                fileName: "Wilds.hx",
                lineNumber: 95,
                className: "game.wilds.Wilds",
                methodName: "loadVBAssets"
            });
            scarabWilds.ExternalService.assetRegistry.getAssetsContent(this.cfg.vbAssets).then(function(data) {
                scarabWilds.ExternalService.assets = data;
                _g.loadMainAssets();
            });
        };
        scarabWilds.Wilds.prototype.loadMainAssets = function() {
            var _g = this;
            haxe.Log.trace("[WILDS] loadMainAssets()", {
                fileName: "Wilds.hx",
                lineNumber: 105,
                className: "game.wilds.Wilds",
                methodName: "loadMainAssets"
            });
            scarabWilds.ExternalService.assetRegistry.getAsset(this.vbAssetID).getContent().then(function(vba) {
                _g.vba = vba;
                _g.assetsLoaded = true;
                _g.initialize();
            });
        };
        scarabWilds.Wilds.prototype.updateLayout = function(e) {
            haxe.Log.trace("[WILDS] updateLayout() ", {
                fileName: "Wilds.hx",
                lineNumber: 116,
                className: "game.wilds.Wilds",
                methodName: "updateLayout"
            });
            this.layoutPayload = e.getPayload();
            if (!this.initialized) this.initialize();
            else {
                this.controller.updateLayout(this.layoutPayload);
                this.layoutPort.getComponentLayoutUpdated().publish(this.context.getInstance());
            }
        };
        scarabWilds.Wilds.prototype.initialize = function() {
            haxe.Log.trace("[WILDS] initialize() " + _hcmn_.Std.string(this.initialized) + _hcmn_.Std.string(this.layoutPayload), {
                fileName: "Wilds.hx",
                lineNumber: 131,
                className: "game.wilds.Wilds",
                methodName: "initialize"
            });
            if (!this.initialized && this.vba != null && this.layoutPayload != null) {
                this.controller = new scarabWilds.WildsController(this);
                this.view = this.vbf.createView(this.vba);
                this.registerAllComponents();
                this.controller.updateLayout(this.layoutPayload);
                this.layoutPort.getComponentLayoutUpdated().publish(this.context.getInstance());
                this.port.getHide().subscribe($bind(this, this.handleHide));
                this.port.getShowBaseGameWilds().subscribe($bind(this, this.handleShowBaseGameWilds));
                this.port.getShowFreeSpinWilds().subscribe($bind(this, this.handleShowFreeSpinWilds));
                this.port.getShowLanding().subscribe($bind(this, this.handleShowLanding));
                this.port.getTransition().subscribe($bind(this, this.handleTransition));
                this.port.getState().subscribe($bind(this, this.handleStateChange));
                this.port.getSymbolState().subscribe($bind(this, this.handleSymbolStateChange));
                this.initialized = true;
            }
        };
        scarabWilds.Wilds.prototype.registerAllComponents = function() {
            haxe.Log.trace("[WILDS] registerAllComponents()", {
                fileName: "Wilds.hx",
                lineNumber: 155,
                className: "game.wilds.Wilds",
                methodName: "registerAllComponents"
            });
            var $it0 = (function($this) {
                var $r;
                var this1 = $this.view.getChildComponents();
                $r = this1.keys();
                return $r;
            }(this));
            while ($it0.hasNext()) {
                var compId = $it0.next();
                haxe.Log.trace("[WILDS] registerAllComponents() " + compId, {
                    fileName: "Wilds.hx",
                    lineNumber: 158,
                    className: "game.wilds.Wilds",
                    methodName: "registerAllComponents"
                });
                var constructorIndex;
                var _this = _hcmn_.Type.getEnumConstructs(scarabWildsApi.WildsTypeEnum);
                constructorIndex = _hcmn_.HxOverrides.indexOf(_this, compId, 0);
                if (constructorIndex < 0) continue;
                var componentEnum = _hcmn_.Type.createEnum(scarabWildsApi.WildsTypeEnum, compId, null);
                this.registerComponent(componentEnum);
            }
        };
        scarabWilds.Wilds.prototype.registerComponent = function(componentEnum) {
            haxe.Log.trace("[WILDS] registerComponent", {
                fileName: "Wilds.hx",
                lineNumber: 169,
                className: "game.wilds.Wilds",
                methodName: "registerComponent",
                customParams: [componentEnum]
            });
            switch (componentEnum[1]) {
                case 0:
                    this.registerContainerComponent(scarabWildsApi.WildsTypeEnum.wilds, scarabWilds.WildSymbols);
                    break;
                case 1:
                    this.registerContainerComponent(scarabWildsApi.WildsTypeEnum.wild_trigger, scarabWilds.WildTrigger);
                    break;
            }
            return true;
        };
        scarabWilds.Wilds.prototype.registerContainerComponent = function(componentEnum, componentClass) {
            haxe.Log.trace("[WILDS] registerContainerComponent", {
                fileName: "Wilds.hx",
                lineNumber: 185,
                className: "game.wilds.Wilds",
                methodName: "registerContainerComponent"
            });
            var container = this.view.getContainerById(componentEnum[0]);
            if (container == null) return;
            var value = _hcmn_.Type.createInstance(componentClass, [container, this.cfg]);
            this.components.set(componentEnum, value);
        };
        scarabWilds.Wilds.prototype.handleHide = function(e) {
            haxe.Log.trace("[WILDS] hide", {
                fileName: "Wilds.hx",
                lineNumber: 194,
                className: "game.wilds.Wilds",
                methodName: "handleHide"
            });
            ((function($this) {
                var $r;
                var key = e.getPayload();
                $r = $this.components.get(key);
                return $r;
            }(this))).hide();
        };
        scarabWilds.Wilds.prototype.handleStateChange = function(e) {
            haxe.Log.trace("[WILDS] handleStateChange ", {
                fileName: "Wilds.hx",
                lineNumber: 200,
                className: "game.wilds.Wilds",
                methodName: "handleStateChange",
                customParams: [e.getPayload().state]
            });
            ((function($this) {
                var $r;
                var key = e.getPayload().wildType;
                $r = $this.components.get(key);
                return $r;
            }(this))).handleStateChange(e.getPayload().state);
        };
        scarabWilds.Wilds.prototype.handleSymbolStateChange = function(e) {
            haxe.Log.trace("[WILDS] handleStateChange ", {
                fileName: "Wilds.hx",
                lineNumber: 206,
                className: "game.wilds.Wilds",
                methodName: "handleSymbolStateChange",
                customParams: [e.getPayload().state]
            });
            ((function($this) {
                var $r;
                var key = e.getPayload().type;
                $r = $this.components.get(key);
                return $r;
            }(this))).handleSymbolStateChange(e.getPayload().position, e.getPayload().state);
        };
        scarabWilds.Wilds.prototype.handleShowBaseGameWilds = function(e) {
            haxe.Log.trace("[WILDS] handleShow ", {
                fileName: "Wilds.hx",
                lineNumber: 212,
                className: "game.wilds.Wilds",
                methodName: "handleShowBaseGameWilds",
                customParams: [e.getPayload().content]
            });
            this.components.get(scarabWildsApi.WildsTypeEnum.wilds).showBaseGameWilds(e.getPayload());
        };
        scarabWilds.Wilds.prototype.handleShowFreeSpinWilds = function(e) {
            haxe.Log.trace("[WILDS] handleShow ", {
                fileName: "Wilds.hx",
                lineNumber: 219,
                className: "game.wilds.Wilds",
                methodName: "handleShowFreeSpinWilds",
                customParams: [e.getPayload()]
            });
            this.components.get(scarabWildsApi.WildsTypeEnum.wilds).showFreeSpinWilds(e.getPayload());
        };
        scarabWilds.Wilds.prototype.handleShowLanding = function(e) {
            haxe.Log.trace("[WILDS] handleShowLanding ", {
                fileName: "Wilds.hx",
                lineNumber: 226,
                className: "game.wilds.Wilds",
                methodName: "handleShowLanding",
                customParams: [e.getPayload()]
            });
            var type = e.getPayload().type;
            var position = e.getPayload().position;
            var state = e.getPayload().state;
            this.components.get(type).showLanding(position, state);
        };
        scarabWilds.Wilds.prototype.handleTransition = function(e) {
            haxe.Log.trace("[WILDS] handleShowFrames ", {
                fileName: "Wilds.hx",
                lineNumber: 236,
                className: "game.wilds.Wilds",
                methodName: "handleTransition",
                customParams: [e.getPayload().content]
            });
            this.components.get(scarabWildsApi.WildsTypeEnum.wilds).handleTransition(e.getPayload());
        };
        scarabWilds.Wilds.prototype.__class__ = scarabWilds.Wilds;
        scarabWilds.WildsController = function(wilds) {
            this.flag_addedToStage = false;
            this.wilds = wilds;
        };
        scarabWilds.WildsController.__name__ = ["scarabWilds", "WildsController"];
        scarabWilds.WildsController.prototype.flag_addedToStage = null;
        scarabWilds.WildsController.prototype.wilds = null;
        scarabWilds.WildsController.prototype.updateLayout = function(layoutPayload) {
            var $it0 = layoutPayload.containers.keys();
            while ($it0.hasNext()) {
                var layerId = $it0.next();
                var layerPayload = layoutPayload.containers.get(layerId);
                var cfg = layerPayload.configuration;
                var stage;
                var this1 = scarabWilds.ExternalService.displayProvider.getStages();
                stage = this1.get(layerPayload.stage);
                var container;
                container = (function($this) {
                    var $r;
                    var this2 = $this.wilds.view.getChildComponents();
                    $r = this2.get(layerId);
                    return $r;
                }(this));
                var containerDO = container.getDisplayObject();
                if (!this.flag_addedToStage) stage.addChild(containerDO);
                containerDO.setX(layerPayload.left);
                containerDO.setY(layerPayload.top);
                containerDO.setScaleX(layerPayload.width / containerDO.getUserData().viewBuilderW);
                containerDO.setScaleY(layerPayload.height / containerDO.getUserData().viewBuilderH);
                containerDO.setZIndex(layerPayload.zIndex);
                if (cfg != null) {}
            }
            if (!this.flag_addedToStage) this.flag_addedToStage = true;
        };
        scarabWilds.WildsController.prototype.__class__ = scarabWilds.WildsController;
        scarabWilds.WildsFactory = function(vbf, context) {
            this.context = context;
            this.vbf = vbf;
        };
        scarabWilds.WildsFactory = ck_implements(scarabWilds.WildsFactory, clientkernelModulesApi.IService);
        scarabWilds.WildsFactory = ck_implements(scarabWilds.WildsFactory, componentmodelComponentApi.IComponentFactory);
        scarabWilds.WildsFactory.__interfaces__ = [clientkernelModulesApi.IService, componentmodelComponentApi.IComponentFactory];
        scarabWilds.WildsFactory.__name__ = ["scarabWilds", "WildsFactory"];
        scarabWilds.WildsFactory.prototype.context = null;
        scarabWilds.WildsFactory.prototype.vbf = null;
        scarabWilds.WildsFactory.prototype.getComponentDeclaration = function() {
            return scarabWildsApi.WildsDeclaration;
        };
        scarabWilds.WildsFactory.prototype.createComponent = function(context) {
            new scarabWilds.Wilds(context, this.vbf);
        };
        scarabWilds.WildsFactory.prototype.__class__ = scarabWilds.WildsFactory;

        scarabWilds.IWilds = function() {}
        scarabWilds.IWilds.prototype = {

            showBaseGameWilds: function(payload) {
                return {
                    arguments: ["*"],
                    returns: "void"
                };
            },
            showFreeSpinWilds: function(payload) {
                return {
                    arguments: ["number"],
                    returns: "void"
                };
            },
            showLanding: function(position, state) {
                return {
                    arguments: ["*", "string"],
                    returns: "void"
                };
            },
            hide: function() {
                return {
                    arguments: [],
                    returns: "void"
                };
            },
            handleStateChange: function(state) {
                return {
                    arguments: ["string"],
                    returns: "void"
                };
            },
            handleSymbolStateChange: function(position, state) {
                return {
                    arguments: ["*", "string"],
                    returns: "void"
                };
            },
            handleTransition: function(payload) {
                return {
                    arguments: ["*"],
                    returns: "void"
                };
            }
        };
        scarabWilds.WildSymbols = function(container, config) {
            haxe.Log.trace("[WILDS] WildSymbols " + _hcmn_.Std.string(config), {
                fileName: "WildSymbols.hx",
                lineNumber: 29,
                className: "game.wilds.components.WildSymbols",
                methodName: "new"
            });
            this.config = config;
            this.container = container;
            var assetId = "wilds_vb";
            if (config.rect != null) this.rect = new displayEngineApi.Point(config.rect[0], config.rect[1]);
            else this.rect = new displayEngineApi.Point(0, 0);
            this.vbAnimView = scarabWilds.ExternalService.viewBuilderFactory.createView(scarabWilds.ExternalService.assets.get(assetId));
            container.show();
        };
        scarabWilds.WildSymbols.__name__ = ["scarabWilds", "WildSymbols"];
        scarabWilds.WildSymbols.prototype.container = null;
        scarabWilds.WildSymbols.prototype.vbAnimView = null;
        scarabWilds.WildSymbols.prototype.config = null;
        scarabWilds.WildSymbols.prototype.wildView = null;
        scarabWilds.WildSymbols.prototype.tweens = null;
        scarabWilds.WildSymbols.prototype.rect = null;
        scarabWilds.WildSymbols.prototype.showBaseGameWilds = function(payload) {
            var state = payload.state;
            var content = payload.content;
            haxe.Log.trace("[WILDS] WildSymbols.showWilds totalWilds " + _hcmn_.Std.string(content), {
                fileName: "WildSymbols.hx",
                lineNumber: 54,
                className: "game.wilds.components.WildSymbols",
                methodName: "showBaseGameWilds"
            });
            var len = content.length;
            var _g1 = 0;
            var _g = content.length;
            while (_g1 < _g) {
                var i = _g1++;
                var _g3 = 0;
                var _g2 = content[i].length;
                while (_g3 < _g2) {
                    var j = _g3++;
                    var position = content[i][j];
                    if (position != -1) {
                        var wildId = "wildView" + "_" + i + "_" + position;
                        var symbolContainer = this.vbAnimView.createContainerFromStoredConfig("WildFrame");
                        if (!(function($this) {
                                var $r;
                                var this1 = $this.container.getChildComponents();
                                $r = this1.exists(wildId);
                                return $r;
                            }(this))) this.container.addChildComponent(symbolContainer, wildId);
                        var wildSymbol = this.container.getContainerById(wildId);
                        wildSymbol.setX(this.rect.x * i | 0);
                        wildSymbol.setY(this.rect.y * position | 0);
                        wildSymbol.getVBAnimationById("ANIMATION_CONTENT").show();
                        wildSymbol.getVBAnimationById("ANIMATION_CONTENT").gotoAndPlay(false, state);
                        wildSymbol.show();
                    }
                }
            }
            this.container.show();
        };
        scarabWilds.WildSymbols.prototype.showFreeSpinWilds = function(totalWilds) {
            haxe.Log.trace("[WILDS] WildSymbols.showFSWilds totalWilds " + totalWilds, {
                fileName: "WildSymbols.hx",
                lineNumber: 89,
                className: "game.wilds.components.WildSymbols",
                methodName: "showFreeSpinWilds"
            });
            var _g = 0;
            while (_g < totalWilds) {
                var i = _g++;
                var wildId = "wildView" + "_" + i;
                var symbolContainer = this.vbAnimView.createContainerFromStoredConfig("WildFrame");
                if (!(function($this) {
                        var $r;
                        var this1 = $this.container.getChildComponents();
                        $r = this1.exists(wildId);
                        return $r;
                    }(this))) this.container.addChildComponent(symbolContainer, wildId);
                haxe.Log.trace("[WILDS] WildSymbols.showFSWilds wildId  " + wildId, {
                    fileName: "WildSymbols.hx",
                    lineNumber: 98,
                    className: "game.wilds.components.WildSymbols",
                    methodName: "showFreeSpinWilds"
                });
                var wildSymbol = this.container.getContainerById(wildId);
                wildSymbol.setX(this.rect.x * 2 | 0);
                wildSymbol.setY(this.rect.y * 2 | 0);
                wildSymbol.getVBAnimationById("ANIMATION_CONTENT").show();
                wildSymbol.getVBAnimationById("ANIMATION_CONTENT").gotoAndPlay(false, "2");
                wildSymbol.show();
                this.container.show();
            }
        };
        scarabWilds.WildSymbols.prototype.showLanding = function(position, state) {
            haxe.Log.trace("[WILDS] WildSymbols.showLanding " + _hcmn_.Std.string(position), {
                fileName: "WildSymbols.hx",
                lineNumber: 113,
                className: "game.wilds.components.WildSymbols",
                methodName: "showLanding",
                customParams: [state]
            });
            var xPos = position.x | 0;
            var yPos = position.y | 0;
            if (yPos != -1) {
                var wildId = "wildView" + "_" + xPos + "_" + yPos;
                haxe.Log.trace("[WILDS] WildSymbols.showFrames wildId " + wildId, {
                    fileName: "WildSymbols.hx",
                    lineNumber: 120,
                    className: "game.wilds.components.WildSymbols",
                    methodName: "showLanding"
                });
                if (!(function($this) {
                        var $r;
                        var this1 = $this.container.getChildComponents();
                        $r = this1.exists(wildId);
                        return $r;
                    }(this))) {
                    var symbolContainer = this.vbAnimView.createContainerFromStoredConfig("WildFrame");
                    this.container.addChildComponent(symbolContainer, wildId);
                    symbolContainer.setX(this.rect.x * xPos | 0);
                    symbolContainer.setY(this.rect.y * yPos | 0);
                    symbolContainer.getVBAnimationById("ANIMATION_CONTENT").show();
                    symbolContainer.getVBAnimationById("ANIMATION_CONTENT").gotoAndPlay(false, state);
                    symbolContainer.show();
                } else haxe.Log.trace("[WILDS] WildSymbols.showLanding EXISTS " + _hcmn_.Std.string(position), {
                    fileName: "WildSymbols.hx",
                    lineNumber: 136,
                    className: "game.wilds.components.WildSymbols",
                    methodName: "showLanding",
                    customParams: [state]
                });
            }
            this.container.show();
        };
        scarabWilds.WildSymbols.prototype.hide = function() {
            haxe.Log.trace("[WILDS] WildSymbols.hide", {
                fileName: "WildSymbols.hx",
                lineNumber: 150,
                className: "game.wilds.components.WildSymbols",
                methodName: "hide"
            });
            var $it0 = (function($this) {
                var $r;
                var this1 = $this.container.getChildComponents();
                $r = this1.keys();
                return $r;
            }(this));
            while ($it0.hasNext()) {
                var key = $it0.next();
                this.container.disposeChildComponent(key);
            }
            this.container.hide();
        };
        scarabWilds.WildSymbols.prototype.handleTransition = function(payload) {
            haxe.Log.trace("[WILDS] WildSymbols.handleTransition payload " + _hcmn_.Std.string(payload), {
                fileName: "WildSymbols.hx",
                lineNumber: 161,
                className: "game.wilds.components.WildSymbols",
                methodName: "handleTransition"
            });
            this.tweens = null;
            this.tweens = [];
            var state = payload.state;
            var offset = payload.offset;
            var alpha = payload.alpha;
            var tweenTime = 1000;
            var content = payload.content;
            var currentElement = 0;
            currentElement = 0;
            var $it0 = (function($this) {
                var $r;
                var this1 = $this.container.getChildComponents();
                $r = this1.keys();
                return $r;
            }(this));
            while ($it0.hasNext()) {
                var key = $it0.next();
                haxe.Log.trace("[WILDS] WildSymbols.handleTransition key " + key, {
                    fileName: "WildSymbols.hx",
                    lineNumber: 177,
                    className: "game.wilds.components.WildSymbols",
                    methodName: "handleTransition"
                });
                var vbAnimHolder = this.container.getContainerById(key);
                var vbAnimContent = vbAnimHolder.getVBAnimationById("ANIMATION_CONTENT");
                vbAnimContent.gotoAndStop(false, state);
                var velocityX = 1;
                var velocityY = 1;
                var symbolX = _hcmn_.Std.parseInt(key.split("_")[1]);
                var symbolY = _hcmn_.Std.parseInt(key.split("_")[2]);
                var name = content[currentElement];
                var row = _hcmn_.Std.parseInt(name.split("R")[1]);
                var col = _hcmn_.Std.parseInt(name.split("R")[0].split("C")[1]);
                var wildId = "wildView" + "_" + col + "_" + row;
                vbAnimHolder.getDisplayObject().setName(wildId);
                if (symbolX < row) velocityX = -1;
                if (symbolY < col) velocityY = -1;
                var dObj = this.container.getContainerById(key).getDisplayObject();
                this.tweens.push(displayEngineUtils.TweenX.to(dObj, {
                    x: this.rect.x * col + offset * velocityX,
                    y: this.rect.y * row + offset * velocityY,
                    alpha: alpha
                }, tweenTime, null, null, null, null, null, null, null, {
                    fileName: "WildSymbols.hx",
                    lineNumber: 198,
                    className: "game.wilds.components.WildSymbols",
                    methodName: "handleTransition"
                }).ease(displayEngineUtils.EaseX.backInOut).onFinish(function() {}));
                currentElement++;
            }
        };
        scarabWilds.WildSymbols.prototype.handleStateChange = function(state) {
            haxe.Log.trace("[WILDS] WildSymbols.handleStateChange " + state, {
                fileName: "WildSymbols.hx",
                lineNumber: 216,
                className: "game.wilds.components.WildSymbols",
                methodName: "handleStateChange"
            });
            var $it0 = (function($this) {
                var $r;
                var this1 = $this.container.getChildComponents();
                $r = this1.keys();
                return $r;
            }(this));
            while ($it0.hasNext()) {
                var key = $it0.next();
                haxe.Log.trace("[WILDS] WildSymbols.handleStateChange key " + key, {
                    fileName: "WildSymbols.hx",
                    lineNumber: 220,
                    className: "game.wilds.components.WildSymbols",
                    methodName: "handleStateChange"
                });
                var vbAnimHolder = this.container.getContainerById(key);
                var vbAnimContent = vbAnimHolder.getVBAnimationById("ANIMATION_CONTENT");
                vbAnimContent.gotoAndPlay(false, state);
            }
        };
        scarabWilds.WildSymbols.prototype.handleSymbolStateChange = function(position, state) {
            haxe.Log.trace("[WILDS] WildSymbols.handleStateChange " + state, {
                fileName: "WildSymbols.hx",
                lineNumber: 229,
                className: "game.wilds.components.WildSymbols",
                methodName: "handleSymbolStateChange"
            });
            var wildId = "wildView" + "_" + position.x + "_" + position.y;
            if ((function($this) {
                    var $r;
                    var this1 = $this.container.getChildComponents();
                    $r = this1.exists(wildId);
                    return $r;
                }(this))) {
                var vbAnimHolder = this.container.getContainerById(wildId);
                var vbAnimContent = vbAnimHolder.getVBAnimationById("ANIMATION_CONTENT");
                vbAnimContent.stop();
                vbAnimContent.gotoAndPlay(false, state);
            } else {
                var $it0 = (function($this) {
                    var $r;
                    var this2 = $this.container.getChildComponents();
                    $r = this2.keys();
                    return $r;
                }(this));
                while ($it0.hasNext()) {
                    var key = $it0.next();
                    var displayObjectName = this.container.getContainerById(key).getDisplayObject().getName();
                    if (displayObjectName == wildId) {
                        var vbAnimHolder1 = this.container.getContainerById(key);
                        var vbAnimContent1 = vbAnimHolder1.getVBAnimationById("ANIMATION_CONTENT");
                        vbAnimContent1.stop();
                        vbAnimContent1.gotoAndPlay(false, state);
                    }
                }
            }
        };
        scarabWilds.WildSymbols.prototype.__class__ = scarabWilds.WildSymbols;
        scarabWilds.WildTrigger = function(container, config) {
            haxe.Log.trace("[WILDS] WildSymbols " + _hcmn_.Std.string(config), {
                fileName: "WildTrigger.hx",
                lineNumber: 22,
                className: "game.wilds.components.WildTrigger",
                methodName: "new"
            });
            this.config = config;
            this.container = container;
            var assetId = "wilds_vb";
            if (config.triggerRect != null) this.rect = new displayEngineApi.Point(config.triggerRect[0], config.triggerRect[1]);
            else this.rect = new displayEngineApi.Point(0, 0);
            this.vbAnimView = scarabWilds.ExternalService.viewBuilderFactory.createView(scarabWilds.ExternalService.assets.get(assetId));
            container.show();
        };
        scarabWilds.WildTrigger.__name__ = ["scarabWilds", "WildTrigger"];
        scarabWilds.WildTrigger.prototype.container = null;
        scarabWilds.WildTrigger.prototype.vbAnimView = null;
        scarabWilds.WildTrigger.prototype.config = null;
        scarabWilds.WildTrigger.prototype.wildView = null;
        scarabWilds.WildTrigger.prototype.tweens = null;
        scarabWilds.WildTrigger.prototype.rect = null;
        scarabWilds.WildTrigger.prototype.showLanding = function(position, state) {
            haxe.Log.trace("[WILDS] WildTrigger.showLanding " + _hcmn_.Std.string(position), {
                fileName: "WildTrigger.hx",
                lineNumber: 45,
                className: "game.wilds.components.WildTrigger",
                methodName: "showLanding",
                customParams: [state]
            });
            var xPos = position.x | 0;
            var yPos = position.y | 0;
            var symbolId = "wildView" + "_" + xPos + "_" + yPos;
            if (!(function($this) {
                    var $r;
                    var this1 = $this.container.getChildComponents();
                    $r = this1.exists(symbolId);
                    return $r;
                }(this))) {
                var symbolContainer = this.vbAnimView.createContainerFromStoredConfig("Scarab");
                this.container.addChildComponent(symbolContainer, symbolId);
                symbolContainer.setX(this.rect.x * xPos | 0);
                symbolContainer.setY(this.rect.y * yPos | 0);
                symbolContainer.getVBAnimationById("ANIMATION_CONTENT").show();
                symbolContainer.getVBAnimationById("ANIMATION_CONTENT").gotoAndPlay(false, state);
                symbolContainer.getVBAnimationById("ANIMATION_CONTENT").addEventListener("evtComplete", $bind(this, this.handleComplete), [symbolId]);
                symbolContainer.show();
            }
            this.container.show();
        };
        scarabWilds.WildTrigger.prototype.handleComplete = function(evt) {
            haxe.Log.trace("[WildSymbols] [handleComplete] ", {
                fileName: "WildTrigger.hx",
                lineNumber: 69,
                className: "game.wilds.components.WildTrigger",
                methodName: "handleComplete",
                customParams: [evt[0]]
            });
            var animHolderId = evt[0];
            if ((function($this) {
                    var $r;
                    var this1 = $this.container.getChildComponents();
                    $r = this1.exists(animHolderId);
                    return $r;
                }(this))) {
                var vbAnimHolder = this.container.getContainerById(animHolderId);
                var vbAnimContent = vbAnimHolder.getVBAnimationById("ANIMATION_CONTENT");
                vbAnimHolder.hide();
                vbAnimContent.stop();
                vbAnimContent.removeEventListener("evtComplete");
            }
        };
        scarabWilds.WildTrigger.prototype.hide = function() {
            haxe.Log.trace("[WILDS] WildSymbols.hide", {
                fileName: "WildTrigger.hx",
                lineNumber: 87,
                className: "game.wilds.components.WildTrigger",
                methodName: "hide"
            });
            var $it0 = (function($this) {
                var $r;
                var this1 = $this.container.getChildComponents();
                $r = this1.keys();
                return $r;
            }(this));
            while ($it0.hasNext()) {
                var key = $it0.next();
                this.container.disposeChildComponent(key);
            }
        };
        scarabWilds.WildTrigger.prototype.handleStateChange = function(state) {};
        scarabWilds.WildTrigger.prototype.handleSymbolStateChange = function(position, state) {};
        scarabWilds.WildTrigger.prototype.__class__ = scarabWilds.WildTrigger;
        scarabWilds.BaseEvents = function() {
            this.choice = new _hcmn_.msignal_Signal1();
        };
        scarabWilds.BaseEvents.__name__ = ["scarabWilds", "BaseEvents"];
        scarabWilds.BaseEvents.prototype.choice = null;
        scarabWilds.BaseEvents.prototype.__class__ = scarabWilds.BaseEvents;
        if (typeof haxe == 'undefined') {
            var haxe = {};
        };

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

            get: function(k) {
                return {
                    arguments: ["*"],
                    returns: "null"
                };
            },
            exists: function(k) {
                return {
                    arguments: ["*"],
                    returns: "boolean"
                };
            },
            keys: function() {
                return {
                    arguments: [],
                    returns: "null"
                };
            }
        };
        haxe.Log = function() {};
        haxe.Log.__name__ = ["haxe", "Log"];
        haxe.Log.trace = function(v, infos) {
            _hcmn_.js_Boot.__trace(v, infos);
        };
        haxe.Log.prototype.__class__ = haxe.Log;
        if (!haxe.ds) {
            haxe.ds = {};
        };
        haxe.ds.BalancedTree = function() {};
        haxe.ds.BalancedTree.__name__ = ["haxe", "ds", "BalancedTree"];
        haxe.ds.BalancedTree.prototype.root = null;
        haxe.ds.BalancedTree.prototype.set = function(key, value) {
            this.root = this.setLoop(key, value, this.root);
        };
        haxe.ds.BalancedTree.prototype.get = function(key) {
            var node = this.root;
            while (node != null) {
                var c = this.compare(key, node.key);
                if (c == 0) return node.value;
                if (c < 0) node = node.left;
                else node = node.right;
            }
            return null;
        };
        haxe.ds.BalancedTree.prototype.exists = function(key) {
            var node = this.root;
            while (node != null) {
                var c = this.compare(key, node.key);
                if (c == 0) return true;
                else if (c < 0) node = node.left;
                else node = node.right;
            }
            return false;
        };
        haxe.ds.BalancedTree.prototype.keys = function() {
            var ret = [];
            this.keysLoop(this.root, ret);
            return _hcmn_.HxOverrides.iter(ret);
        };
        haxe.ds.BalancedTree.prototype.setLoop = function(k, v, node) {
            if (node == null) return new haxe.ds.TreeNode(null, k, v, null);
            var c = this.compare(k, node.key);
            if (c == 0) return new haxe.ds.TreeNode(node.left, k, v, node.right, node == null ? 0 : node._height);
            else if (c < 0) {
                var nl = this.setLoop(k, v, node.left);
                return this.balance(nl, node.key, node.value, node.right);
            } else {
                var nr = this.setLoop(k, v, node.right);
                return this.balance(node.left, node.key, node.value, nr);
            }
        };
        haxe.ds.BalancedTree.prototype.keysLoop = function(node, acc) {
            if (node != null) {
                this.keysLoop(node.left, acc);
                acc.push(node.key);
                this.keysLoop(node.right, acc);
            }
        };
        haxe.ds.BalancedTree.prototype.balance = function(l, k, v, r) {
            var hl;
            if (l == null) hl = 0;
            else hl = l._height;
            var hr;
            if (r == null) hr = 0;
            else hr = r._height;
            if (hl > hr + 2) {
                if ((function($this) {
                        var $r;
                        var _this = l.left;
                        $r = _this == null ? 0 : _this._height;
                        return $r;
                    }(this)) >= (function($this) {
                        var $r;
                        var _this1 = l.right;
                        $r = _this1 == null ? 0 : _this1._height;
                        return $r;
                    }(this))) return new haxe.ds.TreeNode(l.left, l.key, l.value, new haxe.ds.TreeNode(l.right, k, v, r));
                else return new haxe.ds.TreeNode(new haxe.ds.TreeNode(l.left, l.key, l.value, l.right.left), l.right.key, l.right.value, new haxe.ds.TreeNode(l.right.right, k, v, r));
            } else if (hr > hl + 2) {
                if ((function($this) {
                        var $r;
                        var _this2 = r.right;
                        $r = _this2 == null ? 0 : _this2._height;
                        return $r;
                    }(this)) > (function($this) {
                        var $r;
                        var _this3 = r.left;
                        $r = _this3 == null ? 0 : _this3._height;
                        return $r;
                    }(this))) return new haxe.ds.TreeNode(new haxe.ds.TreeNode(l, k, v, r.left), r.key, r.value, r.right);
                else return new haxe.ds.TreeNode(new haxe.ds.TreeNode(l, k, v, r.left.left), r.left.key, r.left.value, new haxe.ds.TreeNode(r.left.right, r.key, r.value, r.right));
            } else return new haxe.ds.TreeNode(l, k, v, r, (hl > hr ? hl : hr) + 1);
        };
        haxe.ds.BalancedTree.prototype.compare = function(k1, k2) {
            return _hcmn_.Reflect.compare(k1, k2);
        };
        haxe.ds.BalancedTree.prototype.__class__ = haxe.ds.BalancedTree;
        haxe.ds.TreeNode = function(l, k, v, r, h) {
            if (h == null) h = -1;
            this.left = l;
            this.key = k;
            this.value = v;
            this.right = r;
            if (h == -1) this._height = ((function($this) {
                var $r;
                var _this = $this.left;
                $r = _this == null ? 0 : _this._height;
                return $r;
            }(this)) > (function($this) {
                var $r;
                var _this1 = $this.right;
                $r = _this1 == null ? 0 : _this1._height;
                return $r;
            }(this)) ? (function($this) {
                var $r;
                var _this2 = $this.left;
                $r = _this2 == null ? 0 : _this2._height;
                return $r;
            }(this)) : (function($this) {
                var $r;
                var _this3 = $this.right;
                $r = _this3 == null ? 0 : _this3._height;
                return $r;
            }(this))) + 1;
            else this._height = h;
        };
        haxe.ds.TreeNode.__name__ = ["haxe", "ds", "TreeNode"];
        haxe.ds.TreeNode.prototype.left = null;
        haxe.ds.TreeNode.prototype.right = null;
        haxe.ds.TreeNode.prototype.key = null;
        haxe.ds.TreeNode.prototype.value = null;
        haxe.ds.TreeNode.prototype._height = null;
        haxe.ds.TreeNode.prototype.__class__ = haxe.ds.TreeNode;
        haxe.ds.EnumValueMap = function() {
            haxe.ds.BalancedTree.call(this);
        };
        haxe.ds.EnumValueMap.__interfaces__ = [haxe.IMap];
        haxe.ds.EnumValueMap.__name__ = ["haxe", "ds", "EnumValueMap"];
        haxe.ds.EnumValueMap.__super__ = haxe.ds.BalancedTree;
        for (var k in haxe.ds.BalancedTree.prototype) haxe.ds.EnumValueMap.prototype[k] = haxe.ds.BalancedTree.prototype[k];
        haxe.ds.EnumValueMap.prototype.compare = function(k1, k2) {
            var d = k1[1] - k2[1];
            if (d != 0) return d;
            var p1 = k1.slice(2);
            var p2 = k2.slice(2);
            if (p1.length == 0 && p2.length == 0) return 0;
            return this.compareArgs(p1, p2);
        };
        haxe.ds.EnumValueMap.prototype.compareArgs = function(a1, a2) {
            var ld = a1.length - a2.length;
            if (ld != 0) return ld;
            var _g1 = 0;
            var _g = a1.length;
            while (_g1 < _g) {
                var i = _g1++;
                var d = this.compareArg(a1[i], a2[i]);
                if (d != 0) return d;
            }
            return 0;
        };
        haxe.ds.EnumValueMap.prototype.compareArg = function(v1, v2) {
            if (_hcmn_.Reflect.isEnumValue(v1) && _hcmn_.Reflect.isEnumValue(v2)) return this.compare(v1, v2);
            else if ((v1 instanceof Array) && v1.__enum__ == null && ((v2 instanceof Array) && v2.__enum__ == null)) return this.compareArgs(v1, v2);
            else return _hcmn_.Reflect.compare(v1, v2);
        };
        haxe.ds.EnumValueMap.prototype.__class__ = haxe.ds.EnumValueMap;
        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;
        return {
            exports: scarabWilds,
            activator: scarabWilds.Activator
        };
    });
//# sourceURL=scarabWilds.js