define("smashthepigReelPicker", ["viewBuilderApi", "componentmodelComponentApi", "clientkernelLoaderApi", "displayEngineApi", "displayEngineUtils", "gameLayoutApi", "smashthepigComponentsReelPickerPort", "clientkernelEventbusApi", "clientkernelModulesApi"],
    function(viewBuilderApi, componentmodelComponentApi, clientkernelLoaderApi, displayEngineApi, displayEngineUtils, gameLayoutApi, smashthepigComponentsReelPickerPort, 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 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;
        if (typeof smashthepigReelPicker == 'undefined') {
            var smashthepigReelPicker = {};
        };
        smashthepigReelPicker.Activator = function(context) {};
        smashthepigReelPicker.Activator = ck_implements(smashthepigReelPicker.Activator, clientkernelModulesApi.IModuleActivator);
        smashthepigReelPicker.Activator.__interfaces__ = [clientkernelModulesApi.IModuleActivator];
        smashthepigReelPicker.Activator.__name__ = ["smashthepigReelPicker", "Activator"];
        smashthepigReelPicker.Activator.prototype.start = function(context) {
            context.getServiceTracker([viewBuilderApi.IViewBuilderFactory, clientkernelLoaderApi.IAssetRegistry, displayEngineApi.IDisplayProvider]).then(function(context1) {
                smashthepigReelPicker.ExternalService.initialize(context1);
                var vbf = context1.getAnyService(viewBuilderApi.IViewBuilderFactory, null);
                smashthepigReelPicker.ExternalService.viewBuilderFactory = vbf;
                context1.registerService(new smashthepigReelPicker.ReelPickerFactory(vbf, context1), smashthepigComponentsReelPickerPort.ReelPickerDeclaration, null);
            });
        };
        smashthepigReelPicker.Activator.prototype.stop = function(context) {};
        smashthepigReelPicker.Activator.main = function() {};
        smashthepigReelPicker.Activator.prototype.__class__ = smashthepigReelPicker.Activator;
        smashthepigReelPicker.ExternalService = function() {};
        smashthepigReelPicker.ExternalService.__name__ = ["smashthepigReelPicker", "ExternalService"];
        smashthepigReelPicker.ExternalService.displayProvider = null;
        smashthepigReelPicker.ExternalService.assetRegistry = null;
        smashthepigReelPicker.ExternalService.viewBuilderFactory = null;
        smashthepigReelPicker.ExternalService.initialize = function(context) {
            smashthepigReelPicker.ExternalService.displayProvider = context.getAnyService(displayEngineApi.IDisplayProvider, null);
            smashthepigReelPicker.ExternalService.assetRegistry = context.getAnyService(clientkernelLoaderApi.IAssetRegistry, null);
        };
        smashthepigReelPicker.ExternalService.prototype.__class__ = smashthepigReelPicker.ExternalService;
        smashthepigReelPicker.ReelPicker = function(context, vbf) {
            this.layoutCfgId = "reel_picker_definition_config.json";
            this.initialized = false;
            this.layoutPayload = null;
            this.assetsLoaded = false;
            this.vbf = vbf;
            this.context = context;
            this.components = new haxe.ds.EnumValueMap();
            this.implPort = context.getImplementedPort(smashthepigComponentsReelPickerPort.IReelPickerImplementationPort);
            this.layoutPort = context.getUsedPort(gameLayoutApi.IGameLayoutPort);
            this.layoutPort.getUpdateComponentLayout().subscribe($bind(this, this.updateLayout));
            this.loadConfigData();
            this.baseEvents = new smashthepigReelPicker.BaseEvents();
        };
        smashthepigReelPicker.ReelPicker.__name__ = ["smashthepigReelPicker", "ReelPicker"];
        smashthepigReelPicker.ReelPicker.prototype.view = null;
        smashthepigReelPicker.ReelPicker.prototype.components = null;
        smashthepigReelPicker.ReelPicker.prototype.layoutPort = null;
        smashthepigReelPicker.ReelPicker.prototype.implPort = null;
        smashthepigReelPicker.ReelPicker.prototype.context = null;
        smashthepigReelPicker.ReelPicker.prototype.vbf = null;
        smashthepigReelPicker.ReelPicker.prototype.vba = null;
        smashthepigReelPicker.ReelPicker.prototype.cfg = null;
        smashthepigReelPicker.ReelPicker.prototype.component = null;
        smashthepigReelPicker.ReelPicker.prototype.assetsLoaded = null;
        smashthepigReelPicker.ReelPicker.prototype.layoutPayload = null;
        smashthepigReelPicker.ReelPicker.prototype.initialized = null;
        smashthepigReelPicker.ReelPicker.prototype.componentId = null;
        smashthepigReelPicker.ReelPicker.prototype.layerContainers = null;
        smashthepigReelPicker.ReelPicker.prototype.layoutCfgId = null;
        smashthepigReelPicker.ReelPicker.prototype.baseEvents = null;
        smashthepigReelPicker.ReelPicker.prototype.loadConfigData = function() {
            var _g = this;
            smashthepigReelPicker.ExternalService.assetRegistry.getAsset(this.layoutCfgId).getContent().then(function(data) {
                _g.cfg = data;
                _g.loadVBAssets();
            });
        };
        smashthepigReelPicker.ReelPicker.prototype.loadVBAssets = function() {
            var _g = this;
            smashthepigReelPicker.ExternalService.assetRegistry.getAssetsContent(this.cfg.vbAssets).then(function(data) {
                smashthepigReelPicker.ExternalService.loadedAssets = data;
                _g.loadMainAssets();
            });
        };
        smashthepigReelPicker.ReelPicker.prototype.loadMainAssets = function() {
            var _g = this;
            smashthepigReelPicker.ExternalService.assetRegistry.getAsset(this.cfg.vbLayout).getContent().then(function(vba) {
                _g.vba = vba;
                _g.assetsLoaded = true;
                _g.initialize();
            });
        };
        smashthepigReelPicker.ReelPicker.prototype.updateLayout = function(e) {
            this.layoutPayload = e.getPayload();
            if (this.initialized) {
                this.handleUpdateLayout(this.layoutPayload);
                this.layoutPort.getComponentLayoutUpdated().publish(this.context.getInstance());
            } else this.initialize();
        };
        smashthepigReelPicker.ReelPicker.prototype.initialize = function() {
            if (!this.initialized && this.vba != null && this.layoutPayload != null) {
                this.view = this.vbf.createView(this.vba);
                this.registerAllComponents();
                this.handleUpdateLayout(this.layoutPayload);
                this.implPort.getShow().subscribe($bind(this, this.handleShow));
                this.implPort.getHide().subscribe($bind(this, this.handleHide));
                this.implPort.getSummary().subscribe($bind(this, this.handleSummary));
                this.implPort.getPicks().subscribe($bind(this, this.handlePicks));
                this.implPort.getUpdateReels().subscribe($bind(this, this.handleUpdateReels));
                this.implPort.getState().subscribe($bind(this, this.handleState));
                this.implPort.getVisible().subscribe($bind(this, this.handleVisibility));
                this.initialized = true;
                this.baseEvents.getEvent(smashthepigReelPicker.BaseEventsEnum.PLAYER_CHOICE).add($bind(this, this.handlePlayerChoice));
                this.baseEvents.getEvent(smashthepigReelPicker.BaseEventsEnum.AVAILABLE_PICKS).add($bind(this, this.handleAvailablePicks));
            }
        };
        smashthepigReelPicker.ReelPicker.prototype.handlePlayerChoice = function(e) {
            this.implPort.getChoice().publish(new smashthepigComponentsReelPickerPort.PlayerChoicePayload(_hcmn_.Std["int"](e)));
        };
        smashthepigReelPicker.ReelPicker.prototype.handleAvailablePicks = function(e) {
            this.implPort.getAvailablePicks().publish(e);
        };
        smashthepigReelPicker.ReelPicker.prototype.handleUpdateLayout = function(layoutPayload) {
            var $it0 = this.layerContainers.keys();
            while ($it0.hasNext()) {
                var layerId = $it0.next();
                var layerPayload = layoutPayload.containers.get(layerId);
                var stage;
                var this1 = smashthepigReelPicker.ExternalService.displayProvider.getStages();
                stage = this1.get(layerPayload.stage);
                var container = this.layerContainers.get(layerId).getDisplayObject();
                try {
                    stage.removeChild(container);
                } catch (e) {
                    if (e instanceof js._Boot.HaxeError) e = e.val;
                    if (_hcmn_.js_Boot.__instanceof(e, Error)) {} else throw (e);
                }
                stage.addChild(container);
                container.setX(layerPayload.left);
                container.setY(layerPayload.top);
                container.setScaleX(layerPayload.width / container.getUserData().viewBuilderW);
                container.setScaleY(layerPayload.height / container.getUserData().viewBuilderH);
                container.setZIndex(layerPayload.zIndex);
            }
            this.layoutPort.getComponentLayoutUpdated().publish(this.context.getInstance());
        };
        smashthepigReelPicker.ReelPicker.prototype.registerAllComponents = function() {
            this.layerContainers = this.view.getChildComponents();
            this.component = null;
            var $it0 = this.layerContainers.keys();
            while ($it0.hasNext()) {
                var layerId = $it0.next();
                var constructorIndex;
                var _this = _hcmn_.Type.getEnumConstructs(smashthepigReelPicker.ComponentsEnum);
                constructorIndex = _hcmn_.HxOverrides.indexOf(_this, layerId, 0);
                if (constructorIndex < 0) continue;
                var componentEnum = _hcmn_.Type.createEnum(smashthepigReelPicker.ComponentsEnum, layerId, null);
                this.registerContainerComponent(componentEnum, smashthepigReelPicker.ReelPickerAnimation);
            }
        };
        smashthepigReelPicker.ReelPicker.prototype.handleShow = function(e) {
            this.component.init(e.getPayload().symbols);
        };
        smashthepigReelPicker.ReelPicker.prototype.handleHide = function(e) {
            this.component.hide(e.getPayload().disposeAll);
        };
        smashthepigReelPicker.ReelPicker.prototype.handleState = function(e) {
            var state = e.getPayload();
            this.component.handleStateChange(state);
        };
        smashthepigReelPicker.ReelPicker.prototype.handleVisibility = function(e) {
            this.component.handleVisibility(e.getPayload());
        };
        smashthepigReelPicker.ReelPicker.prototype.handleUpdateReels = function(e) {
            var direction = e.getPayload().direction;
            var duration = e.getPayload().duration;
            this.component.updateReels(direction, duration);
        };
        smashthepigReelPicker.ReelPicker.prototype.handleSummary = function(e) {
            var reelId = e.getPayload().reelId;
            var value = e.getPayload().value;
            var state = e.getPayload().state;
            var complete = e.getPayload().complete;
            this.component.handleSummary(reelId, value, state, complete);
        };
        smashthepigReelPicker.ReelPicker.prototype.handlePicks = function(e) {
            this.component.handlePicks(e.getPayload());
        };
        smashthepigReelPicker.ReelPicker.prototype.registerContainerComponent = function(componentEnum, componentClass) {
            var container = this.view.getComponentById(componentEnum[0]);
            if (container == null) return;
            this.component = _hcmn_.Type.createInstance(componentClass, [container, this.cfg, this.baseEvents]);
        };
        smashthepigReelPicker.ReelPicker.prototype.__class__ = smashthepigReelPicker.ReelPicker;
        smashthepigReelPicker.ReelPickerFactory = function(vbf, context) {
            this.context = context;
            this.vbf = vbf;
        };
        smashthepigReelPicker.ReelPickerFactory = ck_implements(smashthepigReelPicker.ReelPickerFactory, clientkernelModulesApi.IService);
        smashthepigReelPicker.ReelPickerFactory = ck_implements(smashthepigReelPicker.ReelPickerFactory, componentmodelComponentApi.IComponentFactory);
        smashthepigReelPicker.ReelPickerFactory.__interfaces__ = [clientkernelModulesApi.IService, componentmodelComponentApi.IComponentFactory];
        smashthepigReelPicker.ReelPickerFactory.__name__ = ["smashthepigReelPicker", "ReelPickerFactory"];
        smashthepigReelPicker.ReelPickerFactory.prototype.vbf = null;
        smashthepigReelPicker.ReelPickerFactory.prototype.context = null;
        smashthepigReelPicker.ReelPickerFactory.prototype.getComponentDeclaration = function() {
            return smashthepigComponentsReelPickerPort.ReelPickerDeclaration;
        };
        smashthepigReelPicker.ReelPickerFactory.prototype.createComponent = function(context) {
            new smashthepigReelPicker.ReelPicker(context, this.vbf);
        };
        smashthepigReelPicker.ReelPickerFactory.prototype.__class__ = smashthepigReelPicker.ReelPickerFactory;
        smashthepigReelPicker.ReelPickerAnimation = function(container, cfg, baseEvents) {
            this.randomFrom = 0;
            this.randomTo = 0;
            this.marginLeft = 0;
            this.reelHeight = 0;
            this.reelWidth = 0;
            this.vbElements = cfg.vbElements;
            this.baseEvents = baseEvents;
            this.reelWidth = cfg.reelWidth;
            this.reelHeight = cfg.reelHeight;
            this.marginLeft = cfg.marginLeft;
            this.randomFrom = cfg.randomFrom;
            this.randomTo = cfg.randomTo;
            this.defaultAnimations = cfg.defaultAnimations;
            this.extendedAnimations = cfg.extendedAnimations;
            this.pickerPosition = cfg.pickerPosition;
            this.pickerSymbolId = cfg.pickerSymbolId;
            this.idleStates = cfg.idleStates;
            this.choiceButtonsConfig = cfg.decisionButtons;
            this.container = container;
            this.isIdle = [];
            this.symbolsPresented = [];
            this.buttonStates = new _hcmn_.haxe_ds_StringMap();
            this.definitions = new _hcmn_.haxe_ds_StringMap();
            var _g = 0;
            var _g1 = _hcmn_.Reflect.fields(cfg.vbSymbolsDefinitions);
            while (_g < _g1.length) {
                var key = _g1[_g];
                ++_g;
                var def = _hcmn_.Reflect.field(cfg.vbSymbolsDefinitions, key);
                this.definitions.set(key, def);
            }
            container.hide();
        };
        smashthepigReelPicker.ReelPickerAnimation.__name__ = ["smashthepigReelPicker", "ReelPickerAnimation"];
        smashthepigReelPicker.ReelPickerAnimation.prototype.container = null;
        smashthepigReelPicker.ReelPickerAnimation.prototype.animatonComponents = null;
        smashthepigReelPicker.ReelPickerAnimation.prototype.baseEvents = null;
        smashthepigReelPicker.ReelPickerAnimation.prototype.vbElements = null;
        smashthepigReelPicker.ReelPickerAnimation.prototype.definitions = null;
        smashthepigReelPicker.ReelPickerAnimation.prototype.reelWidth = null;
        smashthepigReelPicker.ReelPickerAnimation.prototype.reelHeight = null;
        smashthepigReelPicker.ReelPickerAnimation.prototype.marginLeft = null;
        smashthepigReelPicker.ReelPickerAnimation.prototype.choiceButtonsConfig = null;
        smashthepigReelPicker.ReelPickerAnimation.prototype.randomTo = null;
        smashthepigReelPicker.ReelPickerAnimation.prototype.randomFrom = null;
        smashthepigReelPicker.ReelPickerAnimation.prototype.idleStates = null;
        smashthepigReelPicker.ReelPickerAnimation.prototype.reelPicture = null;
        smashthepigReelPicker.ReelPickerAnimation.prototype.offsets = null;
        smashthepigReelPicker.ReelPickerAnimation.prototype.buttonStates = null;
        smashthepigReelPicker.ReelPickerAnimation.prototype.pickerSymbols = null;
        smashthepigReelPicker.ReelPickerAnimation.prototype.defaultAnimations = null;
        smashthepigReelPicker.ReelPickerAnimation.prototype.extendedAnimations = null;
        smashthepigReelPicker.ReelPickerAnimation.prototype.pickerPosition = null;
        smashthepigReelPicker.ReelPickerAnimation.prototype.pickerSymbolId = null;
        smashthepigReelPicker.ReelPickerAnimation.prototype.isIdle = null;
        smashthepigReelPicker.ReelPickerAnimation.prototype.symbolsPresented = null;
        smashthepigReelPicker.ReelPickerAnimation.prototype.isPicked = null;
        smashthepigReelPicker.ReelPickerAnimation.prototype.duration = null;
        smashthepigReelPicker.ReelPickerAnimation.prototype.init = function(reelPicture) {
            this.reelPicture = reelPicture;
            this.offsets = this.getOffsets(reelPicture);
            this.setButtonStates();
            this.pickerSymbols = [];
            var symbolCounter = 1;
            var $it0 = this.buttonStates.keys();
            while ($it0.hasNext()) {
                var key = $it0.next();
                if (this.buttonStates.get(key)) {
                    this.pickerSymbols[_hcmn_.Std.parseInt(key)] = symbolCounter;
                    symbolCounter++;
                } else this.pickerSymbols[_hcmn_.Std.parseInt(key)] = -1;
            }
            var _g1 = 0;
            var _g = reelPicture.length;
            while (_g1 < _g) {
                var i = _g1++;
                this.symbolsPresented[i] = false;
            }
            haxe.Log.trace("[LN] ReelPickerAnimation.init(): ", {
                fileName: "ReelPickerAnimation.hx",
                lineNumber: 127,
                className: "smashthepig.components.reelpicker.components.ReelPickerAnimation",
                methodName: "init",
                customParams: [reelPicture, this.buttonStates, this.offsets, this.pickerSymbols]
            });
            this.createAnimations(this.defaultAnimations);
            this.createButtons(this.choiceButtonsConfig);
            this.container.show();
            var availablePicks = new _hcmn_.haxe_ds_StringMap();
            var counter = 1;
            var _g11 = 0;
            var _g2 = this.pickerSymbols.length;
            while (_g11 < _g2) {
                var i1 = _g11++;
                if (this.pickerSymbols[i1] != -1) {
                    if (!this.symbolsPresented[i1]) availablePicks.set(counter == null ? "null" : "" + counter, !this.symbolsPresented[i1]);
                    counter++;
                }
            }
            haxe.Log.trace("[LN] ReelPickerAnimation.handleSummary:availablePicks ", {
                fileName: "ReelPickerAnimation.hx",
                lineNumber: 148,
                className: "smashthepig.components.reelpicker.components.ReelPickerAnimation",
                methodName: "init",
                customParams: [availablePicks]
            });
            this.baseEvents.getEvent(smashthepigReelPicker.BaseEventsEnum.AVAILABLE_PICKS).dispatch(availablePicks);
        };
        smashthepigReelPicker.ReelPickerAnimation.prototype.handleStateChange = function(state) {
            haxe.Log.trace("[LN] ReelPickerAnimation.handleStateChange ", {
                fileName: "ReelPickerAnimation.hx",
                lineNumber: 155,
                className: "smashthepig.components.reelpicker.components.ReelPickerAnimation",
                methodName: "handleStateChange",
                customParams: [state]
            });
            switch (state[1]) {
                case 1:
                    this.handleSymbols(state);
                    this.handleDefaultAnimations(state);
                    break;
                case 11:
                    this.handleSymbols(state);
                    this.handleDefaultAnimations(state);
                    break;
                case 2:
                    this.handleSymbols(state);
                    this.handleDefaultAnimations(state);
                    break;
                case 14:
                    this.disableAllButtons();
                    break;
                case 13:
                    this.enableAllButtons();
                    break;
                case 15:
                    this.handleSymbols(state);
                    this.handleDefaultAnimations(state);
                    break;
                case 12:
                    this.handleSymbols(state);
                    this.handleDefaultAnimations(state);
                    break;
                case 3:
                    var _g1 = 0;
                    var _g = this.reelPicture.length;
                    while (_g1 < _g) {
                        var i = _g1++;
                        this.isIdle[i] = true;
                    }
                    this.handleSymbols(state);
                    this.handleDefaultAnimations(state);
                    break;
                default:
            }
        };
        smashthepigReelPicker.ReelPickerAnimation.prototype.handleVisibility = function(visible) {
            haxe.Log.trace("[LN] ReelPickerAnimation.handleVisibility", {
                fileName: "ReelPickerAnimation.hx",
                lineNumber: 207,
                className: "smashthepig.components.reelpicker.components.ReelPickerAnimation",
                methodName: "handleVisibility"
            });
            if (visible) this.container.show();
            else this.container.hide();
        };
        smashthepigReelPicker.ReelPickerAnimation.prototype.disableAllButtons = function() {
            haxe.Log.trace("[LN] ReelPickerAnimation.disableAllButtons", {
                fileName: "ReelPickerAnimation.hx",
                lineNumber: 217,
                className: "smashthepig.components.reelpicker.components.ReelPickerAnimation",
                methodName: "disableAllButtons"
            });
            var $it0 = this.buttonStates.keys();
            while ($it0.hasNext()) {
                var key = $it0.next();
                var contId = "PlayerChoiceContainer" + key;
                var buttonId = "PlayerChoiceButton";
                this.disableButton(contId, buttonId);
            }
        };
        smashthepigReelPicker.ReelPickerAnimation.prototype.enableAllButtons = function() {
            haxe.Log.trace("[LN] ReelPickerAnimation.enableAllButtons", {
                fileName: "ReelPickerAnimation.hx",
                lineNumber: 226,
                className: "smashthepig.components.reelpicker.components.ReelPickerAnimation",
                methodName: "enableAllButtons"
            });
            var $it0 = this.buttonStates.keys();
            while ($it0.hasNext()) {
                var key = $it0.next();
                if (this.buttonStates.get(key)) {
                    var contId = "PlayerChoiceContainer" + key;
                    var buttonId = "PlayerChoiceButton";
                    this.enableButton(contId, buttonId);
                }
            }
        };
        smashthepigReelPicker.ReelPickerAnimation.prototype.updateButtonStates = function() {
            var $it0 = this.buttonStates.keys();
            while ($it0.hasNext()) {
                var key = $it0.next();
                var contId = "PlayerChoiceContainer" + key;
                var buttonId = "PlayerChoiceButton";
                if (this.buttonStates.get(key)) this.enableButton(contId, buttonId);
                else this.disableButton(contId, buttonId);
            }
        };
        smashthepigReelPicker.ReelPickerAnimation.prototype.handleSymbols = function(state) {
            var _g1 = 0;
            var _g = this.reelPicture.length;
            while (_g1 < _g) {
                var i = _g1++;
                var _g3 = 0;
                var _g2 = this.reelPicture[i].length;
                while (_g3 < _g2) {
                    var j = _g3++;
                    var $it0 = this.definitions.keys();
                    while ($it0.hasNext()) {
                        var assetId = $it0.next();
                        var symbolDef = this.definitions.get(assetId);
                        if (this.reelPicture[i][j] == symbolDef) {
                            var reelsContainer;
                            reelsContainer = _hcmn_.js_Boot.__cast(this.container.getComponentById("reelsContainer"), viewBuilderApi.IViewBuilderContainer);
                            var animId = assetId + "_" + i + j;
                            var symbolExists;
                            var this1 = reelsContainer.getChildComponents();
                            symbolExists = this1.exists(animId);
                            if (!symbolExists) this.createReelSymbols("reelsContainer", assetId, animId, i, j);
                            if (state == smashthepigComponentsReelPickerPort.ReelPickerStateEnum.IDLE) {
                                var rnd = _hcmn_.Std.string(smashthepigReelPicker.ReelPickerAnimation.randomInt(0, this.idleStates.length - 1));
                                var constr = this.getString(smashthepigComponentsReelPickerPort.ReelPickerStateEnum.IDLE) + "_" + rnd;
                                state = _hcmn_.Type.createEnum(smashthepigComponentsReelPickerPort.ReelPickerStateEnum, constr, null);
                            }
                            this.getClip("reelsContainer", animId).gotoAndPlay(false, this.getString(state));
                            this.getClip("reelsContainer", animId).addEventListener("evIdleComplete", $bind(this, this.handleIdleState), ["reelsContainer", animId, i]);
                        }
                    }
                }
            }
        };
        smashthepigReelPicker.ReelPickerAnimation.prototype.updateReels = function(direction, duration) {
            this.duration = duration;
            var _g1 = 0;
            var _g = this.reelPicture.length;
            while (_g1 < _g) {
                var i = _g1++;
                var _g3 = 0;
                var _g2 = this.reelPicture[i].length;
                while (_g3 < _g2) {
                    var j = _g3++;
                    var $it0 = this.definitions.keys();
                    while ($it0.hasNext()) {
                        var assetId = $it0.next();
                        var symbolDef = this.definitions.get(assetId);
                        if (this.reelPicture[i][j] == symbolDef) {
                            var animId = assetId + "_" + i + j;
                            this.updateSymbolPosition(i, animId, direction, duration);
                            if (direction == 0) {
                                var _g5 = 0;
                                var _g4 = this.isIdle.length;
                                while (_g5 < _g4) {
                                    var i1 = _g5++;
                                    this.isIdle[i1] = false;
                                }
                            }
                        }
                    }
                }
            }
        };
        smashthepigReelPicker.ReelPickerAnimation.prototype.handleDefaultAnimations = function(state) {
            if (state == smashthepigComponentsReelPickerPort.ReelPickerStateEnum.IDLE) {
                var rnd = _hcmn_.Std.string(smashthepigReelPicker.ReelPickerAnimation.randomInt(0, this.idleStates.length - 1));
                var constr = this.getString(smashthepigComponentsReelPickerPort.ReelPickerStateEnum.IDLE) + "_" + rnd;
                state = _hcmn_.Type.createEnum(smashthepigComponentsReelPickerPort.ReelPickerStateEnum, constr, null);
            }
            var _g1 = 0;
            var _g = this.defaultAnimations.length;
            while (_g1 < _g) {
                var i = _g1++;
                var containerId = this.defaultAnimations[i] + "_CONTAINER";
                var animationId = this.defaultAnimations[i] + "_VB";
                if (this.container.getComponentById(containerId) != null) {
                    var clipContainer;
                    clipContainer = _hcmn_.js_Boot.__cast(this.container.getComponentById(containerId), viewBuilderApi.IViewBuilderContainer);
                    if (clipContainer.getComponentById(animationId) != null) {
                        var vbAnimHolder = clipContainer.getComponentById(animationId);
                        var vbAnimationContent;
                        vbAnimationContent = _hcmn_.js_Boot.__cast(vbAnimHolder.getComponentById("ANIMATION_CONTENT"), viewBuilderApi.IVBAnimationComponent);
                        vbAnimationContent.gotoAndPlay(false, this.getString(state));
                    }
                }
            }
        };
        smashthepigReelPicker.ReelPickerAnimation.prototype.handleIdleState = function(data) {
            var _g = this;
            var containerId = data[0];
            var animId = data[1];
            var reelId = data[2];
            var rnd = _hcmn_.Std.string(smashthepigReelPicker.ReelPickerAnimation.randomInt(0, this.idleStates.length - 1));
            var state = _hcmn_.Std.string(smashthepigComponentsReelPickerPort.ReelPickerStateEnum.IDLE) + "_" + rnd;
            this.getClip(containerId, animId).gotoAndStop(false, state);
            _hcmn_.haxe_Timer.delay(function() {
                if (_g.isIdle[reelId]) _g.getClip(containerId, animId).gotoAndPlay(false, state);
            }, smashthepigReelPicker.ReelPickerAnimation.randomInt(this.randomFrom, this.randomTo));
        };
        smashthepigReelPicker.ReelPickerAnimation.prototype.updateSymbolPosition = function(reelId, animId, direction, duration) {
            var reelsContainer;
            reelsContainer = _hcmn_.js_Boot.__cast(this.container.getComponentById("reelsContainer"), viewBuilderApi.IViewBuilderContainer);
            var clip = this.getClip("reelsContainer", animId).getDisplayObject();
            displayEngineUtils.TweenX.to(clip, {
                y: this.reelHeight * this.offsets[reelId] * direction
            }, duration, null, null, null, null, null, null, null, {
                fileName: "ReelPickerAnimation.hx",
                lineNumber: 357,
                className: "smashthepig.components.reelpicker.components.ReelPickerAnimation",
                methodName: "updateSymbolPosition"
            }).onFinish(function() {});
        };
        smashthepigReelPicker.ReelPickerAnimation.prototype.handleChoice = function(e) {
            this.disableAllButtons();
            var reelId = _hcmn_.Std["int"](e.getName());
            var contId = "PlayerChoiceContainer" + reelId;
            var buttonId = "PlayerChoiceButton";
            var symbolOffset = this.pickerPosition - this.offsets[reelId];
            var symbolId;
            symbolId = this.pickerSymbolId + "_" + (reelId == null ? "null" : "" + reelId) + symbolOffset;
            var containerId = "reelsContainer";
            var reelsContainer;
            reelsContainer = _hcmn_.js_Boot.__cast(this.container.getComponentById(containerId), viewBuilderApi.IViewBuilderContainer);
            if ((function($this) {
                    var $r;
                    var this1 = reelsContainer.getChildComponents();
                    $r = this1.exists(symbolId);
                    return $r;
                }(this))) {
                this.isIdle[reelId] = false;
                this.getClip(containerId, symbolId).removeEventListener("evIdleComplete");
                if (!this.symbolsPresented[reelId]) this.getClip(containerId, symbolId).gotoAndPlay(false, "PICKED");
            }
            this.baseEvents.getEvent(smashthepigReelPicker.BaseEventsEnum.PLAYER_CHOICE).dispatch(this.pickerSymbols[reelId]);
            var symbolOffset1 = this.pickerPosition - this.offsets[reelId];
            var symbolId1;
            symbolId1 = this.pickerSymbolId + "_" + (reelId == null ? "null" : "" + reelId) + symbolOffset1;
            var animId = "PICKER_SMASH_" + symbolId1;
            this.handleExtendedAnimations(reelId, animId, smashthepigComponentsReelPickerPort.ReelPickerStateEnum.END);
            this.handleSmokeAnimation(reelId, "PSB_WAITING");
            haxe.Log.trace("[LN] GameController.handleChoice: ", {
                fileName: "ReelPickerAnimation.hx",
                lineNumber: 405,
                className: "smashthepig.components.reelpicker.components.ReelPickerAnimation",
                methodName: "handleChoice",
                customParams: [" reelId: ", reelId, " pick: ", this.pickerSymbols[reelId]]
            });
        };
        smashthepigReelPicker.ReelPickerAnimation.prototype.handleSummary = function(pickName, value, animId, complete) {
            haxe.Log.trace("[LN] ReelPickerAnimation.handleSummary: ", {
                fileName: "ReelPickerAnimation.hx",
                lineNumber: 413,
                className: "smashthepig.components.reelpicker.components.ReelPickerAnimation",
                methodName: "handleSummary",
                customParams: [pickName]
            });
            var reelId = 0;
            var _g1 = 0;
            var _g = this.pickerSymbols.length;
            while (_g1 < _g) {
                var i = _g1++;
                if (this.pickerSymbols[i] == pickName) reelId = i;
            }
            this.setButtonStates();
            var buttonContainerId = "PlayerChoiceContainer" + reelId;
            this.disableButton(buttonContainerId, "PlayerChoiceButton");
            var symbolOffset = this.pickerPosition - this.offsets[reelId];
            var symbolId;
            symbolId = this.pickerSymbolId + "_" + (reelId == null ? "null" : "" + reelId) + symbolOffset;
            var containerId = "reelsContainer";
            var reelsContainer;
            reelsContainer = _hcmn_.js_Boot.__cast(this.container.getComponentById(containerId), viewBuilderApi.IViewBuilderContainer);
            if ((function($this) {
                    var $r;
                    var this1 = reelsContainer.getChildComponents();
                    $r = this1.exists(symbolId);
                    return $r;
                }(this))) {
                this.isIdle[reelId] = false;
                if (!this.symbolsPresented[reelId]) {
                    if (this.container.getComponentById(containerId) != null) {
                        var clipContainer;
                        clipContainer = _hcmn_.js_Boot.__cast(this.container.getComponentById(containerId), viewBuilderApi.IViewBuilderContainer);
                        if (clipContainer.getComponentById(symbolId) != null) {
                            var vbAnimHolder = clipContainer.getComponentById(symbolId);
                            vbAnimHolder.getDisplayObject().bringToTop();
                            if (vbAnimHolder.getComponentById("ANIMATION_CONTENT") != null) {
                                var vbAnimationContent;
                                vbAnimationContent = _hcmn_.js_Boot.__cast(vbAnimHolder.getComponentById("ANIMATION_CONTENT"), viewBuilderApi.IVBAnimationComponent);
                                vbAnimationContent.removeEventListener("evIdleComplete");
                                vbAnimationContent.gotoAndPlay(false, animId);
                                var labelContainer = this.getClip(containerId, symbolId).getComponentById(animId + "_CONTAINER");
                                if (labelContainer.getComponentById(animId + "_LABEL_RP") != null) {
                                    var label = labelContainer.getComponentById(animId + "_LABEL_RP");
                                    label.setText(value);
                                }
                                this.symbolsPresented[reelId] = true;
                            }
                        }
                    }
                }
            }
            if (this.container.getComponentById("PSB_WAITING_CONTAINER") != null) {
                var clipContainer1;
                clipContainer1 = _hcmn_.js_Boot.__cast(this.container.getComponentById("PSB_WAITING_CONTAINER"), viewBuilderApi.IViewBuilderContainer);
                if (clipContainer1.getComponentById("PSB_WAITING" + reelId) != null) {
                    var vbAnimHolder1 = clipContainer1.getComponentById("PSB_WAITING" + reelId);
                    if (vbAnimHolder1.getComponentById("ANIMATION_CONTENT") != null) {
                        var vbAnimationContent1;
                        vbAnimationContent1 = _hcmn_.js_Boot.__cast(vbAnimHolder1.getComponentById("ANIMATION_CONTENT"), viewBuilderApi.IVBAnimationComponent);
                        vbAnimationContent1.stop();
                        vbAnimationContent1.hide();
                    }
                }
            }
            var availablePicks = new _hcmn_.haxe_ds_StringMap();
            var counter = 1;
            var _g11 = 0;
            var _g2 = this.pickerSymbols.length;
            while (_g11 < _g2) {
                var i1 = _g11++;
                if (this.pickerSymbols[i1] != -1) {
                    if (!this.symbolsPresented[i1]) availablePicks.set(counter == null ? "null" : "" + counter, !this.symbolsPresented[i1]);
                    counter++;
                }
            }
            haxe.Log.trace("[LN] ReelPickerAnimation.handleSummary:pickName ", {
                fileName: "ReelPickerAnimation.hx",
                lineNumber: 499,
                className: "smashthepig.components.reelpicker.components.ReelPickerAnimation",
                methodName: "handleSummary",
                customParams: [pickName, " value: ", value, " animId: ", animId, " pickedSymbolIds: ", this.pickerSymbols, " reelId: ", reelId, " symbolId: ", symbolId, " pickedSymbols: ", this.symbolsPresented]
            });
            haxe.Log.trace("[LN] ReelPickerAnimation.handleSummary:availablePicks ", {
                fileName: "ReelPickerAnimation.hx",
                lineNumber: 500,
                className: "smashthepig.components.reelpicker.components.ReelPickerAnimation",
                methodName: "handleSummary",
                customParams: [availablePicks]
            });
            this.baseEvents.getEvent(smashthepigReelPicker.BaseEventsEnum.AVAILABLE_PICKS).dispatch(availablePicks);
        };
        smashthepigReelPicker.ReelPickerAnimation.prototype.handleExtendedAnimations = function(reelId, animationId, state) {
            var _g1 = 0;
            var _g = this.extendedAnimations.length;
            while (_g1 < _g) {
                var i = _g1++;
                var containerId = this.extendedAnimations[i] + "_CONTAINER";
                var vbAsset = smashthepigReelPicker.ExternalService.loadedAssets.get(this.extendedAnimations[i] + "_VB");
                var animView = smashthepigReelPicker.ExternalService.viewBuilderFactory.createView(vbAsset);
                animView.show();
                var vbAnimHolder = animView.createContainerFromStoredConfig("ANIMATION_HOLDER");
                var xPos = 20 + reelId * this.reelWidth;
                var yPos = 230;
                vbAnimHolder.setX(xPos);
                vbAnimHolder.setY(yPos);
                var cont;
                cont = _hcmn_.js_Boot.__cast(this.container.getComponentById(containerId), viewBuilderApi.IViewBuilderContainer);
                var exists;
                var this1 = cont.getChildComponents();
                exists = this1.exists(animationId);
                if (!exists) cont.addChildComponent(vbAnimHolder, animationId);
                var clipContainer;
                clipContainer = _hcmn_.js_Boot.__cast(this.container.getComponentById(containerId), viewBuilderApi.IViewBuilderContainer);
                if (clipContainer.getComponentById(animationId) != null) {
                    var vbAnimHolder1 = clipContainer.getComponentById(animationId);
                    var vbAnimationContent;
                    vbAnimationContent = _hcmn_.js_Boot.__cast(vbAnimHolder1.getComponentById("ANIMATION_CONTENT"), viewBuilderApi.IVBAnimationComponent);
                    vbAnimationContent.show();
                    vbAnimationContent.gotoAndPlay(false, this.getString(state));
                }
            }
        };
        smashthepigReelPicker.ReelPickerAnimation.prototype.createReelSymbols = function(contId, assetId, animId, reelId, symbolPosition) {
            var vbAsset = smashthepigReelPicker.ExternalService.loadedAssets.get(assetId + "_VB");
            var animView = smashthepigReelPicker.ExternalService.viewBuilderFactory.createView(vbAsset);
            animView.show();
            var vbAnimHolder = animView.createContainerFromStoredConfig("ANIMATION_HOLDER");
            vbAnimHolder.setX(reelId * (this.reelWidth + this.marginLeft));
            vbAnimHolder.setY((symbolPosition - 1) * this.reelHeight);
            var vbAnimationContent;
            vbAnimationContent = _hcmn_.js_Boot.__cast(vbAnimHolder.getComponentById("ANIMATION_CONTENT"), viewBuilderApi.IVBAnimationComponent);
            vbAnimationContent.show();
            var cont;
            cont = _hcmn_.js_Boot.__cast(this.container.getComponentById(contId), viewBuilderApi.IViewBuilderContainer);
            cont.show();
            var exists;
            var this1 = cont.getChildComponents();
            exists = this1.exists(animId);
            if (!exists) cont.addChildComponent(vbAnimHolder, animId);
        };
        smashthepigReelPicker.ReelPickerAnimation.prototype.handleSmokeAnimation = function(reelId, animationId) {
            var containerId = animationId + "_CONTAINER";
            var vbAsset = smashthepigReelPicker.ExternalService.loadedAssets.get(animationId + "_VB");
            var animView = smashthepigReelPicker.ExternalService.viewBuilderFactory.createView(vbAsset);
            animView.show();
            var vbAnimHolder = animView.createContainerFromStoredConfig("ANIMATION_HOLDER");
            var xPos = -70 + this.reelWidth * reelId;
            var yPos = 215;
            vbAnimHolder.setX(xPos);
            vbAnimHolder.setY(yPos);
            var cont;
            cont = _hcmn_.js_Boot.__cast(this.container.getComponentById(containerId), viewBuilderApi.IViewBuilderContainer);
            var exists;
            var this1 = cont.getChildComponents();
            exists = this1.exists(animationId);
            if (!exists) cont.addChildComponent(vbAnimHolder, animationId + reelId);
            var vbAnimationContent;
            vbAnimationContent = _hcmn_.js_Boot.__cast(vbAnimHolder.getComponentById("ANIMATION_CONTENT"), viewBuilderApi.IVBAnimationComponent);
            vbAnimationContent.show();
            vbAnimationContent.gotoAndPlay(false, "LOOP");
        };
        smashthepigReelPicker.ReelPickerAnimation.prototype.handlePicks = function(picks) {
            var _g1 = 0;
            var _g = this.pickerSymbols.length;
            while (_g1 < _g) {
                var i = _g1++;
                var pick = _hcmn_.Std.string(this.pickerSymbols[i]);
                if (_hcmn_.__map_reserved[pick] != null ? picks.existsReserved(pick) : picks.h.hasOwnProperty(pick)) {
                    var value;
                    value = _hcmn_.__map_reserved[pick] != null ? picks.getReserved(pick) : picks.h[pick];
                    this.buttonStates.set(i == null ? "null" : "" + i, value);
                }
            }
            this.updateButtonStates();
            haxe.Log.trace("[LN] ReelPickerAnimation.handlePicks: ", {
                fileName: "ReelPickerAnimation.hx",
                lineNumber: 612,
                className: "smashthepig.components.reelpicker.components.ReelPickerAnimation",
                methodName: "handlePicks",
                customParams: [picks, " buttonStates ", this.buttonStates, " pickerSymbols ", this.pickerSymbols]
            });
        };
        smashthepigReelPicker.ReelPickerAnimation.prototype.createAnimations = function(animations) {
            var _g1 = 0;
            var _g = animations.length;
            while (_g1 < _g) {
                var i = _g1++;
                var contId = animations[i] + "_CONTAINER";
                var animId = animations[i] + "_VB";
                var vbAsset = smashthepigReelPicker.ExternalService.loadedAssets.get(animId);
                var animView = smashthepigReelPicker.ExternalService.viewBuilderFactory.createView(vbAsset);
                animView.show();
                var animationsContainer = this.container.getComponentById(contId);
                var vbAnimHolder = animView.createContainerFromStoredConfig("ANIMATION_HOLDER");
                var exists;
                var this1 = animationsContainer.getChildComponents();
                exists = this1.exists(animId);
                if (!exists) animationsContainer.addChildComponent(vbAnimHolder, animId);
                this.getClip(contId, animId).stop();
            }
        };
        smashthepigReelPicker.ReelPickerAnimation.prototype.createButtons = function(cfg) {
            var _g = 0;
            var _g1 = _hcmn_.Reflect.fields(cfg);
            while (_g < _g1.length) {
                var key = _g1[_g];
                ++_g;
                var buttonsContainer = this.container.getComponentById("ButtonsContainer");
                var buttonContainer = buttonsContainer.createContainerFromStoredConfig("PlayerChoiceContainer");
                var props = _hcmn_.Reflect.field(cfg, key);
                var buttonContainerId = "PlayerChoiceContainer" + key;
                var exists;
                var this1 = buttonsContainer.getChildComponents();
                exists = this1.exists(buttonContainerId);
                if (!exists) buttonsContainer.addChildComponent(buttonContainer, buttonContainerId);
                var button = buttonContainer.getComponentById("PlayerChoiceButton");
                button.setX(props.x);
                button.setY(props.y);
                button.show();
                button.disable();
                button.getMainMovieClip().setName(key);
                button.getEvents().DOWN().addListener($bind(this, this.handleChoice));
            }
        };
        smashthepigReelPicker.ReelPickerAnimation.prototype.getClip = function(contId, clipId) {
            var clipContainer;
            clipContainer = _hcmn_.js_Boot.__cast(this.container.getComponentById(contId), viewBuilderApi.IViewBuilderContainer);
            var vbAnimHolder = clipContainer.getComponentById(clipId);
            var vbAnimationContent;
            vbAnimationContent = _hcmn_.js_Boot.__cast(vbAnimHolder.getComponentById("ANIMATION_CONTENT"), viewBuilderApi.IVBAnimationComponent);
            return vbAnimationContent;
        };
        smashthepigReelPicker.ReelPickerAnimation.prototype.getString = function(state) {
            return _hcmn_.Std.string(state);
        };
        smashthepigReelPicker.ReelPickerAnimation.prototype.getOffsets = function(reelPic) {
            var fixedOffsets = [];
            var pickerPosition = 2;
            var symbolId = "9";
            var _g1 = 0;
            var _g = reelPic.length;
            while (_g1 < _g) {
                var i = _g1++;
                fixedOffsets[i] = 0;
                var _g3 = 1;
                var _g2 = reelPic[i].length - 1;
                while (_g3 < _g2) {
                    var j = _g3++;
                    if (reelPic[i][j] == symbolId) {
                        if (j > pickerPosition) fixedOffsets[i] = -1;
                        else if (j < pickerPosition) fixedOffsets[i] = 1;
                        else fixedOffsets[i] = 0;
                    }
                }
            }
            return fixedOffsets;
        };
        smashthepigReelPicker.ReelPickerAnimation.prototype.setButtonStates = function() {
            var offsets = this.getOffsets(this.reelPicture);
            var symbolId = "9";
            var _g1 = 0;
            var _g = this.reelPicture.length;
            while (_g1 < _g) {
                var i = _g1++;
                this.buttonStates.set(i == null ? "null" : "" + i, false);
                var pickerPosition = 2 - offsets[i];
                if (this.reelPicture[i][pickerPosition] == symbolId) this.buttonStates.set(i == null ? "null" : "" + i, true);
            }
        };
        smashthepigReelPicker.ReelPickerAnimation.prototype.disableButton = function(contId, buttonId) {
            var buttonsContainer = this.container.getComponentById("ButtonsContainer");
            var buttonContainer = buttonsContainer.getComponentById(contId);
            var button = buttonContainer.getComponentById(buttonId);
            button.disable();
        };
        smashthepigReelPicker.ReelPickerAnimation.prototype.enableButton = function(contId, buttonId) {
            var buttonsContainer = this.container.getComponentById("ButtonsContainer");
            var buttonContainer = buttonsContainer.getComponentById(contId);
            var button = buttonContainer.getComponentById(buttonId);
            button.enable();
        };
        smashthepigReelPicker.ReelPickerAnimation.prototype.hide = function(disposeAll) {
            this.symbolsPresented = [];
            if (!disposeAll) {
                if (this.reelPicture != null) {
                    var _g1 = 0;
                    var _g = this.reelPicture.length;
                    while (_g1 < _g) {
                        var i = _g1++;
                        this.isIdle[i] = false;
                    }
                    var containerId = "reelsContainer";
                    var reelsContainer;
                    reelsContainer = _hcmn_.js_Boot.__cast(this.container.getComponentById(containerId), viewBuilderApi.IViewBuilderContainer);
                    var _g11 = 0;
                    var _g2 = this.reelPicture.length;
                    while (_g11 < _g2) {
                        var i1 = _g11++;
                        var _g3 = 0;
                        var _g21 = this.reelPicture[i1].length;
                        while (_g3 < _g21) {
                            var j = _g3++;
                            var $it0 = this.definitions.keys();
                            while ($it0.hasNext()) {
                                var assetId = $it0.next();
                                var symbolDef = this.definitions.get(assetId);
                                if (this.reelPicture[i1][j] == symbolDef) {
                                    var animId = assetId + "_" + i1 + j;
                                    if (this.reelPicture[i1][j] == "9") reelsContainer.getComponentById(animId).show();
                                    else {
                                        reelsContainer.getComponentById(animId).hide();
                                        var clipContainer;
                                        clipContainer = _hcmn_.js_Boot.__cast(this.container.getComponentById(containerId), viewBuilderApi.IViewBuilderContainer);
                                        if (clipContainer.getComponentById(animId) != null) {
                                            var vbAnimHolder = clipContainer.getComponentById(animId);
                                            if (vbAnimHolder.getComponentById("ANIMATION_CONTENT") != null) {
                                                var vbAnimationContent;
                                                vbAnimationContent = _hcmn_.js_Boot.__cast(vbAnimHolder.getComponentById("ANIMATION_CONTENT"), viewBuilderApi.IVBAnimationComponent);
                                                vbAnimationContent.stop();
                                                vbAnimationContent.removeEventListener("evIdleComplete");
                                                reelsContainer.disposeChildComponent(animId);
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                    var _g12 = 0;
                    var _g4 = this.defaultAnimations.length;
                    while (_g12 < _g4) {
                        var j1 = _g12++;
                        var containerId1 = this.defaultAnimations[j1] + "_CONTAINER";
                        var animationId = this.defaultAnimations[j1] + "_VB";
                        var cont = this.container.getComponentById(containerId1);
                        cont.disposeChildComponent(animationId);
                    }
                    var buttonsContainer = this.container.getComponentById("ButtonsContainer");
                    var $it1 = (function($this) {
                        var $r;
                        var this1 = buttonsContainer.getChildComponents();
                        $r = this1.keys();
                        return $r;
                    }(this));
                    while ($it1.hasNext()) {
                        var key = $it1.next();
                        buttonsContainer.disposeChildComponent(key);
                    }
                }
            } else {
                if (this.reelPicture != null) {
                    var _g13 = 0;
                    var _g5 = this.reelPicture.length;
                    while (_g13 < _g5) {
                        var i2 = _g13++;
                        this.isIdle[i2] = false;
                    }
                }
                this.container.hide();
                this.dispose();
            }
        };
        smashthepigReelPicker.ReelPickerAnimation.prototype.dispose = function() {
            this.symbolsPresented = [];
            var containerId = "reelsContainer";
            var reelsContainer;
            reelsContainer = _hcmn_.js_Boot.__cast(this.container.getComponentById(containerId), viewBuilderApi.IViewBuilderContainer);
            var $it0 = (function($this) {
                var $r;
                var this1 = reelsContainer.getChildComponents();
                $r = this1.keys();
                return $r;
            }(this));
            while ($it0.hasNext()) {
                var key = $it0.next();
                this.getClip(containerId, key).stop();
                this.getClip(containerId, key).removeEventListener("evIdleComplete");
                reelsContainer.disposeChildComponent(key);
            }
            var _g1 = 0;
            var _g = this.extendedAnimations.length;
            while (_g1 < _g) {
                var i = _g1++;
            }
            var _g11 = 0;
            var _g2 = this.defaultAnimations.length;
            while (_g11 < _g2) {
                var j = _g11++;
                var containerId1 = this.defaultAnimations[j] + "_CONTAINER";
                var animationId = this.defaultAnimations[j] + "_VB";
                var cont = this.container.getComponentById(containerId1);
                cont.disposeChildComponent(animationId);
            }
            var buttonsContainer = this.container.getComponentById("ButtonsContainer");
            var $it1 = (function($this) {
                var $r;
                var this2 = buttonsContainer.getChildComponents();
                $r = this2.keys();
                return $r;
            }(this));
            while ($it1.hasNext()) {
                var key1 = $it1.next();
                buttonsContainer.disposeChildComponent(key1);
            }
            var waitingContainer = this.container.getComponentById("PSB_WAITING_CONTAINER");
            var $it2 = (function($this) {
                var $r;
                var this3 = waitingContainer.getChildComponents();
                $r = this3.keys();
                return $r;
            }(this));
            while ($it2.hasNext()) {
                var animations = $it2.next();
                waitingContainer.disposeChildComponent(animations);
            }
        };
        smashthepigReelPicker.ReelPickerAnimation.randomInt = function(from, to) {
            return from + _hcmn_.Math.floor((to - from + 1) * _hcmn_.Math.random());
        };
        smashthepigReelPicker.ReelPickerAnimation.prototype.__class__ = smashthepigReelPicker.ReelPickerAnimation;
        smashthepigReelPicker.ReelPickerConfig = function() {};
        smashthepigReelPicker.ReelPickerConfig.__name__ = ["smashthepigReelPicker", "ReelPickerConfig"];
        smashthepigReelPicker.ReelPickerConfig.prototype.__class__ = smashthepigReelPicker.ReelPickerConfig;
        smashthepigReelPicker.BaseEventsEnum = {
            __ename__: ["smashthepigReelPicker", "BaseEventsEnum"],
            __constructs__: ["PLAYER_CHOICE", "AVAILABLE_PICKS"]
        };
        smashthepigReelPicker.BaseEventsEnum.PLAYER_CHOICE = ["PLAYER_CHOICE", 0];
        smashthepigReelPicker.BaseEventsEnum.PLAYER_CHOICE.toString = $estr;
        smashthepigReelPicker.BaseEventsEnum.PLAYER_CHOICE.__enum__ = smashthepigReelPicker.BaseEventsEnum;
        smashthepigReelPicker.BaseEventsEnum.AVAILABLE_PICKS = ["AVAILABLE_PICKS", 1];
        smashthepigReelPicker.BaseEventsEnum.AVAILABLE_PICKS.toString = $estr;
        smashthepigReelPicker.BaseEventsEnum.AVAILABLE_PICKS.__enum__ = smashthepigReelPicker.BaseEventsEnum;
        smashthepigReelPicker.ComponentsEnum = {
            __ename__: ["smashthepigReelPicker", "ComponentsEnum"],
            __constructs__: ["REEL_PICKER_CONTAINER"]
        };
        smashthepigReelPicker.ComponentsEnum.REEL_PICKER_CONTAINER = ["REEL_PICKER_CONTAINER", 0];
        smashthepigReelPicker.ComponentsEnum.REEL_PICKER_CONTAINER.toString = $estr;
        smashthepigReelPicker.ComponentsEnum.REEL_PICKER_CONTAINER.__enum__ = smashthepigReelPicker.ComponentsEnum;
        smashthepigReelPicker.BaseEvents = function() {
            this.events = new haxe.ds.EnumValueMap();
            this.registerEvents();
        };
        smashthepigReelPicker.BaseEvents.__name__ = ["smashthepigReelPicker", "BaseEvents"];
        smashthepigReelPicker.BaseEvents.prototype.events = null;
        smashthepigReelPicker.BaseEvents.prototype.registerEvents = function() {
            var value = new _hcmn_.msignal_Signal1();
            this.events.set(smashthepigReelPicker.BaseEventsEnum.PLAYER_CHOICE, value);
            var value1 = new _hcmn_.msignal_Signal1();
            this.events.set(smashthepigReelPicker.BaseEventsEnum.AVAILABLE_PICKS, value1);
        };
        smashthepigReelPicker.BaseEvents.prototype.getEvent = function(id) {
            return this.events.get(id);
        };
        smashthepigReelPicker.BaseEvents.prototype.__class__ = smashthepigReelPicker.BaseEvents;
        smashthepigReelPicker.ExternalService.loadedAssets = new _hcmn_.haxe_ds_StringMap();;
        return {
            exports: smashthepigReelPicker,
            activator: smashthepigReelPicker.Activator
        };
    });
//# sourceURL=smashThePigReelPicker.js