define("wolfrunComponentsWinlines", ["viewBuilderApi", "componentmodelComponentApi", "clientkernelLoaderApi", "slotModelApi", "displayEngineApi", "clientkernelTestableApi", "gameLayoutApi", "wolfRunComponentsWinlinesPort", "clientkernelEventbusApi", "clientkernelModulesApi", "wolfRunSpaghettiPort", "wolfRunComponentsWinlinesDeclaration"],
    function(viewBuilderApi, componentmodelComponentApi, clientkernelLoaderApi, slotModelApi, displayEngineApi, clientkernelTestableApi, gameLayoutApi, wolfRunComponentsWinlinesPort, clientkernelEventbusApi, clientkernelModulesApi, wolfRunSpaghettiPort, wolfRunComponentsWinlinesDeclaration) {
        "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"
                };
            },
            keys: function() {
                return {
                    arguments: [],
                    returns: "null"
                };
            },
            iterator: function() {
                return {
                    arguments: [],
                    returns: "null"
                };
            }
        };
        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.iterator = function() {
            var ret = [];
            this.iteratorLoop(this.root, ret);
            return _hcmn_.HxOverrides.iter(ret);
        };
        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.iteratorLoop = function(node, acc) {
            if (node != null) {
                this.iteratorLoop(node.left, acc);
                acc.push(node.value);
                this.iteratorLoop(node.right, acc);
            }
        };
        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 (!haxe.ds._StringMap) {
            haxe.ds._StringMap = {};
        };
        haxe.ds._StringMap.StringMapIterator = function(map, keys) {
            this.map = map;
            this.keys = keys;
            this.index = 0;
            this.count = keys.length;
        };
        haxe.ds._StringMap.StringMapIterator.__name__ = ["haxe", "ds", "_StringMap", "StringMapIterator"];
        haxe.ds._StringMap.StringMapIterator.prototype.map = null;
        haxe.ds._StringMap.StringMapIterator.prototype.keys = null;
        haxe.ds._StringMap.StringMapIterator.prototype.index = null;
        haxe.ds._StringMap.StringMapIterator.prototype.count = null;
        haxe.ds._StringMap.StringMapIterator.prototype.hasNext = function() {
            return this.index < this.count;
        };
        haxe.ds._StringMap.StringMapIterator.prototype.next = function() {
            return this.map.get(this.keys[this.index++]);
        };
        haxe.ds._StringMap.StringMapIterator.prototype.__class__ = haxe.ds._StringMap.StringMapIterator;
        if (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 wolfrunComponentsWinlines == 'undefined') {
            var wolfrunComponentsWinlines = {};
        };
        wolfrunComponentsWinlines.Activator = function(context) {};
        wolfrunComponentsWinlines.Activator = ck_implements(wolfrunComponentsWinlines.Activator, clientkernelModulesApi.IModuleActivator);
        wolfrunComponentsWinlines.Activator.__interfaces__ = [clientkernelModulesApi.IModuleActivator];
        wolfrunComponentsWinlines.Activator.__name__ = ["wolfrunComponentsWinlines", "Activator"];
        wolfrunComponentsWinlines.Activator.prototype.start = function(context) {
            context.getServiceTracker([displayEngineApi.IDisplayProvider, clientkernelTestableApi.ITestable, viewBuilderApi.IViewBuilderFactory]).then(function(context1) {
                wolfrunComponentsWinlines.ExternalService.initialize(context1);
                var factory = context1.getAnyService(viewBuilderApi.IViewBuilderFactory, null);
                wolfrunComponentsWinlines.ExternalService.viewBuilderFactory = factory;
                context1.registerService(new wolfrunComponentsWinlines.WinLinesFactory(factory), wolfRunComponentsWinlinesDeclaration.WinLinesDeclaration, null);
            });
        };
        wolfrunComponentsWinlines.Activator.prototype.stop = function(context) {};
        wolfrunComponentsWinlines.Activator.main = function() {};
        wolfrunComponentsWinlines.Activator.prototype.__class__ = wolfrunComponentsWinlines.Activator;

        wolfrunComponentsWinlines.IWinFrames = function() {}
        wolfrunComponentsWinlines.IWinFrames.prototype = {

            show: function(winSymbols, lineId, isLowWin) {
                return {
                    arguments: ["array", "number", "boolean"],
                    returns: "void"
                };
            },
            hide: function() {
                return {
                    arguments: [],
                    returns: "void"
                };
            },
            dispose: function() {
                return {
                    arguments: [],
                    returns: "void"
                };
            }
        };

        wolfrunComponentsWinlines.IWinLines = function() {}
        wolfrunComponentsWinlines.IWinLines.prototype = {

            getDisplayObject: function() {
                return {
                    arguments: [],
                    returns: "*"
                };
            },
            setVisible: function(visible) {
                return {
                    arguments: ["boolean"],
                    returns: "void"
                };
            },
            getContainerComponent: function(component) {
                return {
                    arguments: ["*"],
                    returns: "*"
                };
            }
        };

        wolfrunComponentsWinlines.IWinSymbols = function() {}
        wolfrunComponentsWinlines.IWinSymbols.prototype = {

            show: function(winSymbols, reels, isHighWin, isLowWin) {
                return {
                    arguments: ["array", "array", "boolean", "boolean"],
                    returns: "void"
                };
            },
            setAnimationsSkin: function(skinId) {
                return {
                    arguments: ["number"],
                    returns: "void"
                };
            },
            hide: function() {
                return {
                    arguments: [],
                    returns: "void"
                };
            },
            dispose: function() {
                return {
                    arguments: [],
                    returns: "void"
                };
            }
        };
        wolfrunComponentsWinlines.ExternalService = function() {};
        wolfrunComponentsWinlines.ExternalService.__name__ = ["wolfrunComponentsWinlines", "ExternalService"];
        wolfrunComponentsWinlines.ExternalService.displayProvider = null;
        wolfrunComponentsWinlines.ExternalService.assetRegistry = null;
        wolfrunComponentsWinlines.ExternalService.testableLogger = null;
        wolfrunComponentsWinlines.ExternalService.viewBuilderFactory = null;
        wolfrunComponentsWinlines.ExternalService.loadedCallback = null;
        wolfrunComponentsWinlines.ExternalService.initialize = function(context) {
            wolfrunComponentsWinlines.ExternalService.displayProvider = context.getAnyService(displayEngineApi.IDisplayProvider, null);
            wolfrunComponentsWinlines.ExternalService.assetRegistry = context.getAnyService(clientkernelLoaderApi.IAssetRegistry, null);
            var testable = context.getAnyService(clientkernelTestableApi.ITestable, null);
            wolfrunComponentsWinlines.ExternalService.testableLogger = testable.getLogger(context);
        };
        wolfrunComponentsWinlines.ExternalService.loadConfig = function(config_id, configCallback) {
            wolfrunComponentsWinlines.ExternalService.assetRegistry.getAsset(config_id).getContent().then(function(data) {
                configCallback(data);
            });
        };
        wolfrunComponentsWinlines.ExternalService.loadVBAssets = function(id, loadedCallback) {
            if (loadedCallback) wolfrunComponentsWinlines.ExternalService.loadedCallback = loadedCallback;
            wolfrunComponentsWinlines.ExternalService.loading++;
            wolfrunComponentsWinlines.ExternalService.assetRegistry.getAsset(id).getContent().then(function(vba) {
                wolfrunComponentsWinlines.ExternalService.loadedAssets.set(id, vba);
                wolfrunComponentsWinlines.ExternalService.checkLoaded(id);
            });
        };
        wolfrunComponentsWinlines.ExternalService.checkLoaded = function(id) {
            wolfrunComponentsWinlines.ExternalService.totalLoaded++;
            if (wolfrunComponentsWinlines.ExternalService.totalLoaded == wolfrunComponentsWinlines.ExternalService.loading) wolfrunComponentsWinlines.ExternalService.loadedCallback();
        };
        wolfrunComponentsWinlines.ExternalService.setLoadedCallback = function(callback) {
            wolfrunComponentsWinlines.ExternalService.loadedCallback = callback;
        };
        wolfrunComponentsWinlines.ExternalService.prototype.__class__ = wolfrunComponentsWinlines.ExternalService;
        wolfrunComponentsWinlines.WinLines = function(context, factory) {
            this.initialized = false;
            this.assetsLoaded = false;
            this.vba = null;
            this.DEFINITION_CONFIG_ID = "winlines-assets/win_definitions_config_custom";
            this.MAIN_CONFIG_ID = "win_animations";
            this.context = context;
            this.layoutPort = context.getUsedPort(gameLayoutApi.IGameLayoutPort);
            this.spaghettiPort = context.getUsedPort(wolfRunSpaghettiPort.ISpaghettiPort);
            this.outcomePhasePort = context.getUsedPort(slotModelApi.IOutcomePhasePort);
            this.factory = factory;
            this.port = context.getImplementedPort(wolfRunComponentsWinlinesPort.IWinLinesImplementationPort);
            this.baseEvents = new wolfrunComponentsWinlines.BaseEvents();
            this.components = new haxe.ds.EnumValueMap();
            this.layoutPort.getUpdateComponentLayout().subscribe($bind(this, this.updateLayout));
            this.controller = new wolfrunComponentsWinlines.WinLinesController(this);
            this.loadAssets();
        };
        wolfrunComponentsWinlines.WinLines = ck_implements(wolfrunComponentsWinlines.WinLines, wolfrunComponentsWinlines.IWinLines);
        wolfrunComponentsWinlines.WinLines.__interfaces__ = [wolfrunComponentsWinlines.IWinLines];
        wolfrunComponentsWinlines.WinLines.__name__ = ["wolfrunComponentsWinlines", "WinLines"];
        wolfrunComponentsWinlines.WinLines.prototype.MAIN_CONFIG_ID = null;
        wolfrunComponentsWinlines.WinLines.prototype.DEFINITION_CONFIG_ID = null;
        wolfrunComponentsWinlines.WinLines.prototype.components = null;
        wolfrunComponentsWinlines.WinLines.prototype.factory = null;
        wolfrunComponentsWinlines.WinLines.prototype.controller = null;
        wolfrunComponentsWinlines.WinLines.prototype.vba = null;
        wolfrunComponentsWinlines.WinLines.prototype.config = null;
        wolfrunComponentsWinlines.WinLines.prototype.winAnimationAssets = null;
        wolfrunComponentsWinlines.WinLines.prototype.assetsLoaded = null;
        wolfrunComponentsWinlines.WinLines.prototype.initialized = null;
        wolfrunComponentsWinlines.WinLines.prototype.view = null;
        wolfrunComponentsWinlines.WinLines.prototype.layerContainers = null;
        wolfrunComponentsWinlines.WinLines.prototype.port = null;
        wolfrunComponentsWinlines.WinLines.prototype.spaghettiPort = null;
        wolfrunComponentsWinlines.WinLines.prototype.context = null;
        wolfrunComponentsWinlines.WinLines.prototype.outcomePhasePort = null;
        wolfrunComponentsWinlines.WinLines.prototype.baseEvents = null;
        wolfrunComponentsWinlines.WinLines.prototype.layoutPayload = null;
        wolfrunComponentsWinlines.WinLines.prototype.layoutPort = null;
        wolfrunComponentsWinlines.WinLines.prototype.loadAssets = function() {
            wolfrunComponentsWinlines.ExternalService.setLoadedCallback($bind(this, this.loadMainAssets));
            wolfrunComponentsWinlines.ExternalService.loadVBAssets("WILD_WOLF");
            wolfrunComponentsWinlines.ExternalService.loadVBAssets("WILD_WOLF_BLINK");
            wolfrunComponentsWinlines.ExternalService.loadVBAssets("DARK_WOLF");
            wolfrunComponentsWinlines.ExternalService.loadVBAssets("DARK_WOLF_BLINK");
            wolfrunComponentsWinlines.ExternalService.loadVBAssets("WHITE_WOLF");
            wolfrunComponentsWinlines.ExternalService.loadVBAssets("WHITE_WOLF_BLINK");
            wolfrunComponentsWinlines.ExternalService.loadVBAssets("BIRD_TOTEM");
            wolfrunComponentsWinlines.ExternalService.loadVBAssets("BIRD_TOTEM_BLINK");
            wolfrunComponentsWinlines.ExternalService.loadVBAssets("BEAR_TOTEM");
            wolfrunComponentsWinlines.ExternalService.loadVBAssets("BEAR_TOTEM_BLINK");
            wolfrunComponentsWinlines.ExternalService.loadVBAssets("ACE_BLINK");
            wolfrunComponentsWinlines.ExternalService.loadVBAssets("KING_BLINK");
            wolfrunComponentsWinlines.ExternalService.loadVBAssets("QUEEN_BLINK");
            wolfrunComponentsWinlines.ExternalService.loadVBAssets("JACK_BLINK");
            wolfrunComponentsWinlines.ExternalService.loadVBAssets("TEN_BLINK");
            wolfrunComponentsWinlines.ExternalService.loadVBAssets("NINE_BLINK");
            wolfrunComponentsWinlines.ExternalService.loadVBAssets("BONUS");
            wolfrunComponentsWinlines.ExternalService.loadVBAssets("BONUS_BLINK");
            wolfrunComponentsWinlines.ExternalService.loadVBAssets("FS_WILD_WOLF");
            wolfrunComponentsWinlines.ExternalService.loadVBAssets("FS_WILD_WOLF_BLINK");
            wolfrunComponentsWinlines.ExternalService.loadVBAssets("FS_DARK_WOLF");
            wolfrunComponentsWinlines.ExternalService.loadVBAssets("FS_DARK_WOLF_BLINK");
            wolfrunComponentsWinlines.ExternalService.loadVBAssets("FS_WHITE_WOLF");
            wolfrunComponentsWinlines.ExternalService.loadVBAssets("FS_WHITE_WOLF_BLINK");
            wolfrunComponentsWinlines.ExternalService.loadVBAssets("FS_BIRD_TOTEM");
            wolfrunComponentsWinlines.ExternalService.loadVBAssets("FS_BIRD_TOTEM_BLINK");
            wolfrunComponentsWinlines.ExternalService.loadVBAssets("FS_BEAR_TOTEM");
            wolfrunComponentsWinlines.ExternalService.loadVBAssets("FS_BEAR_TOTEM_BLINK");
            wolfrunComponentsWinlines.ExternalService.loadVBAssets("FS_ACE_BLINK");
            wolfrunComponentsWinlines.ExternalService.loadVBAssets("FS_KING_BLINK");
            wolfrunComponentsWinlines.ExternalService.loadVBAssets("FS_QUEEN_BLINK");
            wolfrunComponentsWinlines.ExternalService.loadVBAssets("FS_JACK_BLINK");
            wolfrunComponentsWinlines.ExternalService.loadVBAssets("FS_TEN_BLINK");
            wolfrunComponentsWinlines.ExternalService.loadVBAssets("FS_NINE_BLINK");
            wolfrunComponentsWinlines.ExternalService.loadVBAssets("FS_BONUS");
            wolfrunComponentsWinlines.ExternalService.loadVBAssets("FS_BONUS_BLINK");
            wolfrunComponentsWinlines.ExternalService.loadVBAssets("WIN_FRAME");
        };
        wolfrunComponentsWinlines.WinLines.prototype.loadMainAssets = function() {
            var _g = this;
            wolfrunComponentsWinlines.ExternalService.assetRegistry.getAsset(this.MAIN_CONFIG_ID).getContent().then(function(vba) {
                _g.vba = vba;
                wolfrunComponentsWinlines.ExternalService.assetRegistry.getAsset(_g.DEFINITION_CONFIG_ID).getContent().then(function(config) {
                    _g.config = config;
                    _g.assetsLoaded = true;
                    _g.initialize();
                });
            });
        };
        wolfrunComponentsWinlines.WinLines.prototype.updateLayout = function(e) {
            this.layoutPayload = e.getPayload();
            if (!this.initialized) this.initialize();
            else {
                this.controller.updateLayout(this.layoutPayload);
                this.layoutPort.getComponentLayoutUpdated().publish(this.context.getInstance());
            }
        };
        wolfrunComponentsWinlines.WinLines.prototype.initialize = function() {
            if (this.assetsLoaded && this.layoutPayload != null) {
                this.view = this.factory.createView(this.vba);
                this.registerAllComponents();
                this.controller.init(this.config);
                this.controller.updateLayout(this.layoutPayload);
                this.layoutPort.getComponentLayoutUpdated().publish(this.context.getInstance());
                this.initialized = true;
            }
        };
        wolfrunComponentsWinlines.WinLines.prototype.registerAllComponents = function() {
            this.layerContainers = this.view.getChildComponents();
            var $it0 = this.layerContainers.keys();
            while ($it0.hasNext()) {
                var layerId = $it0.next();
                var constructorIndex;
                var _this = _hcmn_.Type.getEnumConstructs(wolfrunComponentsWinlines.ComponentsEnum);
                constructorIndex = _hcmn_.HxOverrides.indexOf(_this, layerId, 0);
                if (constructorIndex < 0) continue;
                var componentEnum = _hcmn_.Type.createEnum(wolfrunComponentsWinlines.ComponentsEnum, layerId, null);
                if (!this.registerComponent(componentEnum, layerId)) continue;
            }
        };
        wolfrunComponentsWinlines.WinLines.prototype.registerComponent = function(componentEnum, layerId) {
            switch (componentEnum[1]) {
                case 0:
                    this.registerContainerComponent(wolfrunComponentsWinlines.ComponentsEnum.WIN_FRAMES, layerId, wolfrunComponentsWinlines.WinFrames);
                    break;
                case 1:
                    this.registerContainerComponent(wolfrunComponentsWinlines.ComponentsEnum.WIN_SYMBOLS, layerId, wolfrunComponentsWinlines.WinSymbols, this.port);
                    break;
            }
            return true;
        };
        wolfrunComponentsWinlines.WinLines.prototype.registerContainerComponent = function(component, layerId, componentClass, port) {
            var container = this.view.getComponentById(component[0]);
            if (container == null) return;
            if (componentClass != null) {
                var specificComponent = _hcmn_.Type.createInstance(componentClass, [container, this.baseEvents, this.config]);
                this.components.set(component, specificComponent);
                if (component == wolfrunComponentsWinlines.ComponentsEnum.WIN_SYMBOLS) this.components.get(wolfrunComponentsWinlines.ComponentsEnum.WIN_SYMBOLS).createPort(port);
            } else this.components.set(component, container);
        };
        wolfrunComponentsWinlines.WinLines.prototype.setVisible = function(visible) {
            this.view.getDisplayObject().setVisible(visible);
        };
        wolfrunComponentsWinlines.WinLines.prototype.getDisplayObject = function() {
            return this.view.getDisplayObject();
        };
        wolfrunComponentsWinlines.WinLines.prototype.getWinFrames = function() {
            return this.components.get(wolfrunComponentsWinlines.ComponentsEnum.WIN_FRAMES);
        };
        wolfrunComponentsWinlines.WinLines.prototype.getWinSymbols = function() {
            return this.components.get(wolfrunComponentsWinlines.ComponentsEnum.WIN_SYMBOLS);
        };
        wolfrunComponentsWinlines.WinLines.prototype.getContainerComponent = function(component) {
            return this.components.get(component);
        };
        wolfrunComponentsWinlines.WinLines.prototype.getBaseEvent = function(id) {
            return this.baseEvents.getEvent(id);
        };
        wolfrunComponentsWinlines.WinLines.prototype.__class__ = wolfrunComponentsWinlines.WinLines;
        wolfrunComponentsWinlines.WinLinesController = function(winLines) {
            this.isLowWin = false;
            this.sendEndCycle = false;
            this.freeSpinsEnded = false;
            this.currentLine = -1;
            this.totalWins = 0;
            this.reelsNum = 5;
            this.cellsNum = 4;
            this.WILD_ID = "w01";
            this.BONUS_ID = "b01";
            this.SPAGHETTI_INDEX = -1;
            this.winLines = winLines;
        };
        wolfrunComponentsWinlines.WinLinesController.__name__ = ["wolfrunComponentsWinlines", "WinLinesController"];
        wolfrunComponentsWinlines.WinLinesController.prototype.SPAGHETTI_INDEX = null;
        wolfrunComponentsWinlines.WinLinesController.prototype.BONUS_ID = null;
        wolfrunComponentsWinlines.WinLinesController.prototype.WILD_ID = null;
        wolfrunComponentsWinlines.WinLinesController.prototype.winLines = null;
        wolfrunComponentsWinlines.WinLinesController.prototype.config = null;
        wolfrunComponentsWinlines.WinLinesController.prototype.outcome = null;
        wolfrunComponentsWinlines.WinLinesController.prototype.totalBet = null;
        wolfrunComponentsWinlines.WinLinesController.prototype.winLineTime = null;
        wolfrunComponentsWinlines.WinLinesController.prototype.highWinLineTime = null;
        wolfrunComponentsWinlines.WinLinesController.prototype.loop = null;
        wolfrunComponentsWinlines.WinLinesController.prototype.cellsNum = null;
        wolfrunComponentsWinlines.WinLinesController.prototype.reelsNum = null;
        wolfrunComponentsWinlines.WinLinesController.prototype.allLineWins = null;
        wolfrunComponentsWinlines.WinLinesController.prototype.totalWins = null;
        wolfrunComponentsWinlines.WinLinesController.prototype.currentLine = null;
        wolfrunComponentsWinlines.WinLinesController.prototype.freeSpinsEnded = null;
        wolfrunComponentsWinlines.WinLinesController.prototype.timer = null;
        wolfrunComponentsWinlines.WinLinesController.prototype.sendEndCycle = null;
        wolfrunComponentsWinlines.WinLinesController.prototype.isLowWin = null;
        wolfrunComponentsWinlines.WinLinesController.prototype.init = function(config) {
            this.config = config;
            this.winLines.port.getShowOutcome().subscribe($bind(this, this.handleShowOutcome));
            this.winLines.port.getHideOutcome().subscribe($bind(this, this.handleHideOutcome));
            this.winLines.port.setVisible().subscribe($bind(this, this.handleSetVisible));
            this.winLines.port.setAnimationsSkin().subscribe($bind(this, this.onSetAnimationsSkin));
            this.winLines.getBaseEvent(wolfrunComponentsWinlines.BaseEventsEnum.WIN_SYMBOL_ANIMATIONS_READY).add($bind(this, this.handleWinSymbolsShown));
        };
        wolfrunComponentsWinlines.WinLinesController.prototype.onSetAnimationsSkin = function(e) {
            this.freeSpinsEnded = e.getPayload() == 0;
            this.winLines.getWinSymbols().setAnimationsSkin(e.getPayload());
        };
        wolfrunComponentsWinlines.WinLinesController.prototype.handleSetVisible = function(e) {
            this.winLines.setVisible(e.getPayload());
        };
        wolfrunComponentsWinlines.WinLinesController.prototype.updateLayout = function(layoutPayload) {
            var $it0 = this.winLines.layerContainers.keys();
            while ($it0.hasNext()) {
                var layerId = $it0.next();
                var layerPayload = layoutPayload.containers.get(layerId);
                if (layerPayload == null) continue;
                var cfg = layerPayload.configuration;
                var stage;
                var this1 = wolfrunComponentsWinlines.ExternalService.displayProvider.getStages();
                stage = this1.get(layerPayload.stage);
                var container = this.winLines.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);
            }
        };
        wolfrunComponentsWinlines.WinLinesController.prototype.handleHideOutcome = function(e) {
            this.disposeAll();
        };
        wolfrunComponentsWinlines.WinLinesController.prototype.handleShowOutcome = function(e) {
            var outcomeOptionsPayload = e.getPayload();
            this.isLowWin = e.getPayload().isLowWin;
            this.outcome = outcomeOptionsPayload.spinOutcome;
            this.totalBet = outcomeOptionsPayload.totalBet;
            this.winLineTime = outcomeOptionsPayload.winLineTime;
            this.highWinLineTime = outcomeOptionsPayload.highWinLineTime;
            this.loop = outcomeOptionsPayload.loop;
            this.allLineWins = [];
            if (this.outcome != null) {
                if (this.outcome.lineWins != null) {
                    if (this.outcome.lineWins.length > 0) {
                        var _g1 = 0;
                        var _g = this.outcome.lineWins.length;
                        while (_g1 < _g) {
                            var i = _g1++;
                            this.allLineWins.push(this.outcome.lineWins[i]);
                        }
                    }
                }
                if (this.outcome.bonusWins != null) {
                    if (this.outcome.bonusWins.length > 0) {
                        var _g11 = 0;
                        var _g2 = this.outcome.bonusWins.length;
                        while (_g11 < _g2) {
                            var i1 = _g11++;
                            if (this.outcome.bonusWins[i1].type == "LineRight") this.allLineWins.push(this.outcome.bonusWins[i1]);
                        }
                    }
                }
                if (this.outcome.scatterWins != null) {
                    if (this.outcome.scatterWins.length > 0) {
                        var _g12 = 0;
                        var _g3 = this.outcome.scatterWins.length;
                        while (_g12 < _g3) {
                            var i2 = _g12++;
                            var hasWin = false;
                            var rls = this.outcome.scatterWins[i2].winPath.reelsInfo.length;
                            var _g21 = 0;
                            while (_g21 < rls) {
                                var j = _g21++;
                                var rws = this.outcome.scatterWins[i2].winPath.reelsInfo[j].length;
                                var _g31 = 0;
                                while (_g31 < rws) {
                                    var k = _g31++;
                                    if (this.outcome.scatterWins[i2].winPath.reelsInfo[j][k] == 1) hasWin = true;
                                }
                            }
                            if (hasWin) this.allLineWins.push(this.outcome.scatterWins[i2]);
                        }
                    }
                }
            }
            this.currentLine = this.SPAGHETTI_INDEX;
            this.totalWins = this.allLineWins.length;
            this.sendEndCycle = false;
            this.sortData();
            if (this.totalWins == 0) this.winLineCycleEnded();
            else this.enterCycle();
        };
        wolfrunComponentsWinlines.WinLinesController.prototype.sortData = function() {
            this.allLineWins.sort(function(a, b) {
                if (a.lineId < b.lineId) return -1;
                if (a.lineId > b.lineId) return 1;
                return 0;
            });
            var linesRightArray = [];
            var _g1 = 0;
            var _g = this.allLineWins.length;
            while (_g1 < _g) {
                var i = _g1++;
                if (this.allLineWins[i].type == "LineRight") linesRightArray.push(this.allLineWins[i]);
            }
            linesRightArray.sort(function(a1, b1) {
                if (a1.lineId < b1.lineId) return -1;
                if (a1.lineId > b1.lineId) return 1;
                return 0;
            });
            var _g11 = 0;
            var _g2 = linesRightArray.length;
            while (_g11 < _g2) {
                var i1 = _g11++;
                this.allLineWins.push(linesRightArray[i1]);
                _hcmn_.HxOverrides.remove(this.allLineWins, linesRightArray[i1]);
            }
            var _g12 = 0;
            var _g3 = this.allLineWins.length;
            while (_g12 < _g3) {
                var i2 = _g12++;
                if (this.allLineWins[i2].type == "Scatter") {
                    this.allLineWins.push(this.allLineWins[i2]);
                    _hcmn_.HxOverrides.remove(this.allLineWins, this.allLineWins[i2]);
                }
            }
        };
        wolfrunComponentsWinlines.WinLinesController.prototype.enterCycle = function() {
            this.iterateWinLineCycle();
        };
        wolfrunComponentsWinlines.WinLinesController.prototype.iterateWinLineCycle = function() {
            if (this.sendEndCycle) {
                this.winLineCycleEnded();
                return;
            }
            var time = this.getWinLineTime();
            if (this.currentLine == this.SPAGHETTI_INDEX) {
                this.showSpaghetti();
                this.timer = _hcmn_.haxe_Timer.delay($bind(this, this.iterateWinLineCycle), time);
            } else this.show();
        };
        wolfrunComponentsWinlines.WinLinesController.prototype.showSpaghetti = function() {
            this.currentLine++;
            this.winLineCycleStarted();
        };
        wolfrunComponentsWinlines.WinLinesController.prototype.getWinLineTime = function() {
            var time = 0;
            if (this.currentLine == this.SPAGHETTI_INDEX) time = this.winLineTime;
            else if (this.isHighWin()) time = this.highWinLineTime;
            else time = this.winLineTime;
            return time;
        };
        wolfrunComponentsWinlines.WinLinesController.prototype.isHighWin = function() {
            var payout = parseFloat(this.allLineWins[this.currentLine].payout);
            return payout > this.totalBet && (this.hasWilds() || !this.isLowSymbolWin()) && !this.isScatterLineAfterFS();
        };
        wolfrunComponentsWinlines.WinLinesController.prototype.isScatterLineAfterFS = function() {
            return this.allLineWins[this.currentLine].winningSymbol == this.BONUS_ID && this.freeSpinsEnded;
        };
        wolfrunComponentsWinlines.WinLinesController.prototype.isLowSymbolWin = function() {
            var _g = 0;
            var _g1 = _hcmn_.Reflect.fields(this.config.lowSymbols);
            while (_g < _g1.length) {
                var i = _g1[_g];
                ++_g;
                if (this.allLineWins[this.currentLine].winningSymbol == _hcmn_.Reflect.field(this.config.lowSymbols, i)) return true;
            }
            return false;
        };
        wolfrunComponentsWinlines.WinLinesController.prototype.hasWilds = function() {
            var winLine = this.allLineWins[this.currentLine].winPath.reelsInfo;
            var reels = this.outcome.reelStop.reels;
            var _g1 = 0;
            var _g = winLine.length;
            while (_g1 < _g) {
                var i = _g1++;
                var _g3 = 0;
                var _g2 = winLine[i].length;
                while (_g3 < _g2) {
                    var j = _g3++;
                    if (winLine[i][j] == 1 && reels[i][j] == this.WILD_ID) return true;
                }
            }
            return false;
        };
        wolfrunComponentsWinlines.WinLinesController.prototype.show = function() {
            if (this.allLineWins[this.currentLine] != null) this.handleCurrentWinLine();
        };
        wolfrunComponentsWinlines.WinLinesController.prototype.winLineCycleStarted = function() {
            var paylines;
            var _g = [];
            var _g1 = 0;
            var _g2 = this.allLineWins;
            while (_g1 < _g2.length) {
                var win = _g2[_g1];
                ++_g1;
                _g.push(win.lineId - 1);
            }
            paylines = _g;
            this.winLines.port.getWinLineCycleStarted().publish(paylines);
            this.hideAll();
        };
        wolfrunComponentsWinlines.WinLinesController.prototype.winLineCycleEnded = function() {
            this.winLines.port.getWinLineCycleAnimated().publish(null);
        };
        wolfrunComponentsWinlines.WinLinesController.prototype.handleCurrentWinLine = function() {
            this.winLines.spaghettiPort.getHideLines().publish(null);
            this.handleWinFrames();
            this.handleWinSymbols();
        };
        wolfrunComponentsWinlines.WinLinesController.prototype.handleWinSymbolsShown = function(evt) {
            if (this.allLineWins == null) return;
            var time = this.getWinLineTime();
            this.winLines.port.getCurrentWin().publish(this.allLineWins[this.currentLine]);
            this.currentLine++;
            if (!this.loop) {
                if (this.currentLine >= this.totalWins && this.outcome.totalPayout != null) {
                    this.currentLine = this.SPAGHETTI_INDEX;
                    this.sendEndCycle = true;
                }
            } else if (this.currentLine >= this.totalWins) this.currentLine = this.SPAGHETTI_INDEX;
            this.timer = _hcmn_.haxe_Timer.delay($bind(this, this.iterateWinLineCycle), time);
        };
        wolfrunComponentsWinlines.WinLinesController.prototype.constructCurrentWinlineWinningSymbols = function() {
            var lineWinningSymbols;
            var _g = [];
            var _g2 = 0;
            var _g1 = this.reelsNum;
            while (_g2 < _g1) {
                var i = _g2++;
                _g.push((function($this) {
                    var $r;
                    var _g3 = []; {
                        var _g5 = 0;
                        var _g4 = $this.cellsNum;
                        while (_g5 < _g4) {
                            var j = _g5++;
                            _g3.push(false);
                        }
                    }
                    $r = _g3;
                    return $r;
                }(this)));
            }
            lineWinningSymbols = _g;
            var _g21 = 0;
            var _g11 = this.reelsNum;
            while (_g21 < _g11) {
                var i1 = _g21++;
                var _g41 = 0;
                var _g31 = this.cellsNum;
                while (_g41 < _g31) {
                    var j1 = _g41++;
                    lineWinningSymbols[i1][j1] = this.allLineWins[this.currentLine].winPath.reelsInfo[i1][j1] == 1;
                }
            }
            return lineWinningSymbols;
        };
        wolfrunComponentsWinlines.WinLinesController.prototype.handleWinFrames = function() {
            this.winLines.getWinFrames().show(this.constructCurrentWinlineWinningSymbols(), this.allLineWins[this.currentLine].lineId, this.isLowWin);
        };
        wolfrunComponentsWinlines.WinLinesController.prototype.handleWinSymbols = function() {
            this.winLines.getWinSymbols().show(this.constructCurrentWinlineWinningSymbols(), this.outcome.reelStop.reels, this.isHighWin(), this.isLowWin);
        };
        wolfrunComponentsWinlines.WinLinesController.prototype.hideAll = function() {
            this.winLines.getWinSymbols().hide();
            this.winLines.getWinFrames().hide();
        };
        wolfrunComponentsWinlines.WinLinesController.prototype.disposeAll = function() {
            this.winLines.getWinSymbols().dispose();
            this.winLines.getWinFrames().dispose();
            this.allLineWins = null;
            this.freeSpinsEnded = false;
            if (this.timer != null) {
                this.timer.stop();
                this.timer.run = null;
                this.timer = null;
            }
        };
        wolfrunComponentsWinlines.WinLinesController.prototype.__class__ = wolfrunComponentsWinlines.WinLinesController;
        wolfrunComponentsWinlines.WinLinesFactory = function(vbf) {
            this.vbf = vbf;
        };
        wolfrunComponentsWinlines.WinLinesFactory = ck_implements(wolfrunComponentsWinlines.WinLinesFactory, clientkernelModulesApi.IService);
        wolfrunComponentsWinlines.WinLinesFactory = ck_implements(wolfrunComponentsWinlines.WinLinesFactory, componentmodelComponentApi.IComponentFactory);
        wolfrunComponentsWinlines.WinLinesFactory.__interfaces__ = [clientkernelModulesApi.IService, componentmodelComponentApi.IComponentFactory];
        wolfrunComponentsWinlines.WinLinesFactory.__name__ = ["wolfrunComponentsWinlines", "WinLinesFactory"];
        wolfrunComponentsWinlines.WinLinesFactory.prototype.vbf = null;
        wolfrunComponentsWinlines.WinLinesFactory.prototype.getComponentDeclaration = function() {
            return wolfRunComponentsWinlinesDeclaration.WinLinesDeclaration;
        };
        wolfrunComponentsWinlines.WinLinesFactory.prototype.createComponent = function(context) {
            var _winlines = new wolfrunComponentsWinlines.WinLines(context, this.vbf);
        };
        wolfrunComponentsWinlines.WinLinesFactory.prototype.__class__ = wolfrunComponentsWinlines.WinLinesFactory;
        wolfrunComponentsWinlines.WinFrames = function(container, baseEvents, config) {
            this.currentLine = -1;
            this.prevY = 0;
            this.y = 0;
            this.x = 0;
            this.SPAGHETTI_INDEX = -1;
            this.container = container;
            this.config = config;
            this.winAnimationAssets = wolfrunComponentsWinlines.ExternalService.loadedAssets;
            this.container.hide();
        };
        wolfrunComponentsWinlines.WinFrames = ck_implements(wolfrunComponentsWinlines.WinFrames, wolfrunComponentsWinlines.IWinFrames);
        wolfrunComponentsWinlines.WinFrames.__interfaces__ = [wolfrunComponentsWinlines.IWinFrames];
        wolfrunComponentsWinlines.WinFrames.__name__ = ["wolfrunComponentsWinlines", "WinFrames"];
        wolfrunComponentsWinlines.WinFrames.prototype.SPAGHETTI_INDEX = null;
        wolfrunComponentsWinlines.WinFrames.prototype.container = null;
        wolfrunComponentsWinlines.WinFrames.prototype.config = null;
        wolfrunComponentsWinlines.WinFrames.prototype.x = null;
        wolfrunComponentsWinlines.WinFrames.prototype.y = null;
        wolfrunComponentsWinlines.WinFrames.prototype.prevY = null;
        wolfrunComponentsWinlines.WinFrames.prototype.currentLine = null;
        wolfrunComponentsWinlines.WinFrames.prototype.allLineWins = null;
        wolfrunComponentsWinlines.WinFrames.prototype.winAnimationAssets = null;
        wolfrunComponentsWinlines.WinFrames.prototype.show = function(winSymbols, lineId, isLowWin) {
            var _g1 = 0;
            var _g = winSymbols.length;
            while (_g1 < _g) {
                var i = _g1++;
                var _g3 = 0;
                var _g2 = winSymbols[i].length;
                while (_g3 < _g2) {
                    var j = _g3++;
                    this.showFrame(i, j, winSymbols[i][j], lineId);
                }
            }
            this.container.show();
        };
        wolfrunComponentsWinlines.WinFrames.prototype.showFrame = function(i, j, frameVisible, lineId) {
            var contId = "FRAME_CONTAINER";
            var vbAssetId = "WIN_FRAME";
            var id;
            id = contId + (i == null ? "null" : "" + i) + (j == null ? "null" : "" + j);
            var symbolExists = false;
            if (this.container.getComponentById(id) != null) symbolExists = true;
            if (symbolExists) {
                var winFrame = this.container.getComponentById(id);
                winFrame.hide();
                if (frameVisible) {
                    var frame = winFrame.getContainerById(vbAssetId);
                    this.fillFrame(frame, lineId);
                    winFrame.show();
                }
            } else {
                var winFrame1;
                var vbAsset = this.winAnimationAssets.get(vbAssetId);
                var vbAnimView = wolfrunComponentsWinlines.ExternalService.viewBuilderFactory.createView(vbAsset);
                winFrame1 = vbAnimView;
                this.container.addChildComponent(winFrame1, id);
                this.x = _hcmn_.Math.floor((this.config.cellWidth + this.config.cellHorizontalSpacing) * i);
                this.prevY = this.y;
                if (j > 0) {
                    this.y = this.y + this.config.cellHeight;
                    winFrame1.getDisplayObject().setHeight(this.y - this.prevY);
                } else winFrame1.getDisplayObject().setHeight(this.config.cellHeight);
                winFrame1.getDisplayObject().setScale(1.0);
                winFrame1.getDisplayObject().setX(this.x);
                winFrame1.getDisplayObject().setY(this.y);
                if (j == 3) this.y = 0;
                winFrame1.hide();
                if (frameVisible) {
                    var frame1 = winFrame1.getContainerById(vbAssetId);
                    this.fillFrame(frame1, lineId);
                    winFrame1.show();
                }
            }
        };
        wolfrunComponentsWinlines.WinFrames.prototype.fillFrame = function(frame, lineId) {
            var tint_mask_tl;
            tint_mask_tl = _hcmn_.js_Boot.__cast(frame.getComponentById("tint_mask_tl").getDisplayObject(), displayEngineApi.IGraphics);
            var tint_mask_br;
            tint_mask_br = _hcmn_.js_Boot.__cast(frame.getComponentById("tint_mask_br").getDisplayObject(), displayEngineApi.IGraphics);
            this.fillFrameShape(tint_mask_tl, lineId);
            this.fillFrameShape(tint_mask_br, lineId);
        };
        wolfrunComponentsWinlines.WinFrames.prototype.fillFrameShape = function(shape, lineId) {
            shape.endFill();
            shape.clear();
            shape.update(this.config.frameColors[lineId]);
            shape.endFill();
        };
        wolfrunComponentsWinlines.WinFrames.prototype.hide = function() {
            var $it0 = (function($this) {
                var $r;
                var this1 = $this.container.getChildComponents();
                $r = this1.iterator();
                return $r;
            }(this));
            while ($it0.hasNext()) {
                var child = $it0.next();
                child.hide();
            }
        };
        wolfrunComponentsWinlines.WinFrames.prototype.dispose = function() {
            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.getDisplayObject().removeChildren();
            this.container.hide();
        };
        wolfrunComponentsWinlines.WinFrames.prototype.__class__ = wolfrunComponentsWinlines.WinFrames;
        wolfrunComponentsWinlines.WinSymbols = function(container, baseEvents, config) {
            this.totalVisibleSymbols = 0;
            this.fsPrefix = "";
            this.CONTAINER_PREFIX = "_CONTAINER";
            this.BLINK_PREFIX = "_BLINK";
            this.ANIMATION_CONTENT = "ANIMATION_CONTENT";
            this.ANIMATION_HOLDER = "ANIMATION_HOLDER";
            this.container = container;
            this.baseEvents = baseEvents;
            this.config = config;
            this.maskedContainer = _hcmn_.js_Boot.__cast(container.getComponentById("maskedContainer"), viewBuilderApi.IViewBuilderContainer);
            container.hide();
            this.winSymbolsAssets = wolfrunComponentsWinlines.ExternalService.loadedAssets;
            var _g = new _hcmn_.haxe_ds_IntMap();
            var _g1 = 0;
            var _g2 = _hcmn_.Reflect.fields(config.win_symbols_definitions);
            while (_g1 < _g2.length) {
                var key = _g2[_g1];
                ++_g1;
                var key1 = _hcmn_.Reflect.field(config.win_symbols_definitions, key);
                _g.h[key1] = key;
            }
            this.symbolsList = _g;
        };
        wolfrunComponentsWinlines.WinSymbols = ck_implements(wolfrunComponentsWinlines.WinSymbols, wolfrunComponentsWinlines.IWinSymbols);
        wolfrunComponentsWinlines.WinSymbols.__interfaces__ = [wolfrunComponentsWinlines.IWinSymbols];
        wolfrunComponentsWinlines.WinSymbols.__name__ = ["wolfrunComponentsWinlines", "WinSymbols"];
        wolfrunComponentsWinlines.WinSymbols.prototype.ANIMATION_HOLDER = null;
        wolfrunComponentsWinlines.WinSymbols.prototype.ANIMATION_CONTENT = null;
        wolfrunComponentsWinlines.WinSymbols.prototype.BLINK_PREFIX = null;
        wolfrunComponentsWinlines.WinSymbols.prototype.CONTAINER_PREFIX = null;
        wolfrunComponentsWinlines.WinSymbols.prototype.fsPrefix = null;
        wolfrunComponentsWinlines.WinSymbols.prototype.container = null;
        wolfrunComponentsWinlines.WinSymbols.prototype.config = null;
        wolfrunComponentsWinlines.WinSymbols.prototype.symbolsList = null;
        wolfrunComponentsWinlines.WinSymbols.prototype.symbolMap = null;
        wolfrunComponentsWinlines.WinSymbols.prototype.maskedContainer = null;
        wolfrunComponentsWinlines.WinSymbols.prototype.winSymbolsAssets = null;
        wolfrunComponentsWinlines.WinSymbols.prototype.port = null;
        wolfrunComponentsWinlines.WinSymbols.prototype.baseEvents = null;
        wolfrunComponentsWinlines.WinSymbols.prototype.totalVisibleSymbols = null;
        wolfrunComponentsWinlines.WinSymbols.prototype.createPort = function(port) {
            this.port = port;
        };
        wolfrunComponentsWinlines.WinSymbols.prototype.show = function(winSymbols, reels, isHighWin, isLowWin) {
            this.countAnimatedSymbols(winSymbols, reels);
            var _g1 = 0;
            var _g = this.config.reelsNum;
            while (_g1 < _g) {
                var col = _g1++;
                var _g3 = 0;
                var _g2 = this.config.cellsNum;
                while (_g3 < _g2) {
                    var row = _g3++;
                    var symbolNum = reels[col][row];
                    var symbolName = this.getSymbolName(symbolNum, isHighWin);
                    var symbolVisible = winSymbols[col][row];
                    var id = symbolName + this.CONTAINER_PREFIX + "_" + row + "_" + col;
                    this.resetAnimatedSymbol(symbolNum, row, col);
                    if (this.maskedContainer.getComponentById(id) != null) {
                        var symbolContainer = this.maskedContainer.getComponentById(id);
                        var vbAnimationHolder = symbolContainer.getComponentById(symbolName);
                        var vbAnimationComponent;
                        vbAnimationComponent = _hcmn_.js_Boot.__cast(vbAnimationHolder.getComponentById(this.ANIMATION_CONTENT), viewBuilderApi.IVBAnimationComponent);
                        if (symbolVisible) {
                            if (vbAnimationComponent.isPlaying()) vbAnimationComponent.stop();
                            symbolContainer.show();
                            if (isLowWin) this.played();
                            else vbAnimationComponent.gotoAndPlay(true, null, $bind(this, this.played));
                        }
                    } else {
                        var vbAsset = this.winSymbolsAssets.get(symbolName);
                        if (vbAsset != null) {
                            var vbAnimView = wolfrunComponentsWinlines.ExternalService.viewBuilderFactory.createView(vbAsset);
                            var vbAnimationHolder1 = vbAnimView.createContainerFromStoredConfig(this.ANIMATION_HOLDER);
                            var vbAnimationComponent1;
                            vbAnimationComponent1 = _hcmn_.js_Boot.__cast(vbAnimationHolder1.getComponentById(this.ANIMATION_CONTENT), viewBuilderApi.IVBAnimationComponent);
                            vbAnimationComponent1.addEventListener("animationComplete", $bind(this, this.onAnimationCompleted), [vbAnimationComponent1]);
                            var symbolContainer1 = this.container.createContainerFromStoredConfig(symbolName + this.CONTAINER_PREFIX);
                            this.maskedContainer.addChildComponent(symbolContainer1, id);
                            symbolContainer1.setX((this.config.cellWidth + this.config.cellHorizontalSpacing) * col);
                            symbolContainer1.setY((this.config.cellHeight + this.config.cellVerticalSpacing) * row);
                            symbolContainer1.addChildComponent(vbAnimationHolder1, symbolName);
                            if (symbolVisible) {
                                symbolContainer1.show();
                                if (isLowWin) this.played();
                                else vbAnimationComponent1.play(true, $bind(this, this.played));
                            }
                        }
                    }
                }
            }
            this.container.show();
        };
        wolfrunComponentsWinlines.WinSymbols.prototype.countAnimatedSymbols = function(winSymbols, reels) {
            this.totalVisibleSymbols = 0;
            var _g1 = 0;
            var _g = this.config.reelsNum;
            while (_g1 < _g) {
                var col = _g1++;
                var _g3 = 0;
                var _g2 = this.config.cellsNum;
                while (_g3 < _g2) {
                    var row = _g3++;
                    var symbolNum = reels[col][row];
                    var symbolVisible = winSymbols[col][row];
                    if (symbolVisible && (function($this) {
                            var $r;
                            var key = symbolNum;
                            $r = $this.symbolsList.h.hasOwnProperty(key);
                            return $r;
                        }(this))) this.totalVisibleSymbols++;
                }
            }
        };
        wolfrunComponentsWinlines.WinSymbols.prototype.played = function() {
            this.totalVisibleSymbols--;
            if (this.totalVisibleSymbols == 0) this.baseEvents.getEvent(wolfrunComponentsWinlines.BaseEventsEnum.WIN_SYMBOL_ANIMATIONS_READY).dispatch("WinSymbols");
        };
        wolfrunComponentsWinlines.WinSymbols.prototype.onAnimationCompleted = function(args) {
            args[0].stop();
        };
        wolfrunComponentsWinlines.WinSymbols.prototype.getSymbolName = function(symbolNum, isHighWin) {
            var isLowSymbol = false;
            var _g = 0;
            var _g1 = _hcmn_.Reflect.fields(this.config.lowSymbols);
            while (_g < _g1.length) {
                var i = _g1[_g];
                ++_g;
                if (_hcmn_.Reflect.field(this.config.lowSymbols, i) == symbolNum) {
                    isLowSymbol = true;
                    break;
                }
            }
            if (isLowSymbol || !isHighWin) return this.fsPrefix + (function($this) {
                var $r;
                var key = symbolNum;
                $r = $this.symbolsList.h[key];
                return $r;
            }(this)) + this.BLINK_PREFIX;
            else return this.fsPrefix + (function($this) {
                var $r;
                var key1 = symbolNum;
                $r = $this.symbolsList.h[key1];
                return $r;
            }(this));
        };
        wolfrunComponentsWinlines.WinSymbols.prototype.resetAnimatedSymbol = function(symbolNum, row, col) {
            var id;
            id = this.fsPrefix + (function($this) {
                var $r;
                var key = symbolNum;
                $r = $this.symbolsList.h[key];
                return $r;
            }(this)) + this.CONTAINER_PREFIX + "_" + row + "_" + col;
            var blinkId;
            blinkId = this.fsPrefix + (function($this) {
                var $r;
                var key1 = symbolNum;
                $r = $this.symbolsList.h[key1];
                return $r;
            }(this)) + this.BLINK_PREFIX + this.CONTAINER_PREFIX + "_" + row + "_" + col;
            if (this.maskedContainer.getComponentById(id) != null) {
                var symbolContainer = this.maskedContainer.getComponentById(id);
                symbolContainer.hide();
            }
            if (this.maskedContainer.getComponentById(blinkId) != null) {
                var symbolContainer1 = this.maskedContainer.getComponentById(blinkId);
                symbolContainer1.hide();
            }
        };
        wolfrunComponentsWinlines.WinSymbols.prototype.setAnimationsSkin = function(skinId) {
            if (skinId == 0) this.fsPrefix = "";
            else if (skinId == 1) this.fsPrefix = "FS_";
        };
        wolfrunComponentsWinlines.WinSymbols.prototype.hide = function() {
            var $it0 = (function($this) {
                var $r;
                var this1 = $this.maskedContainer.getChildComponents();
                $r = this1.iterator();
                return $r;
            }(this));
            while ($it0.hasNext()) {
                var child = $it0.next();
                child.hide();
            }
        };
        wolfrunComponentsWinlines.WinSymbols.prototype.dispose = function() {
            var $it0 = (function($this) {
                var $r;
                var this1 = $this.maskedContainer.getChildComponents();
                $r = this1.keys();
                return $r;
            }(this));
            while ($it0.hasNext()) {
                var key = $it0.next();
                this.maskedContainer.disposeChildComponent(key);
            }
        };
        wolfrunComponentsWinlines.WinSymbols.prototype.__class__ = wolfrunComponentsWinlines.WinSymbols;
        wolfrunComponentsWinlines.BaseEventsEnum = {
            __ename__: ["wolfrunComponentsWinlines", "BaseEventsEnum"],
            __constructs__: ["WIN_SYMBOL_ANIMATIONS_READY"]
        };
        wolfrunComponentsWinlines.BaseEventsEnum.WIN_SYMBOL_ANIMATIONS_READY = ["WIN_SYMBOL_ANIMATIONS_READY", 0];
        wolfrunComponentsWinlines.BaseEventsEnum.WIN_SYMBOL_ANIMATIONS_READY.toString = $estr;
        wolfrunComponentsWinlines.BaseEventsEnum.WIN_SYMBOL_ANIMATIONS_READY.__enum__ = wolfrunComponentsWinlines.BaseEventsEnum;
        wolfrunComponentsWinlines.ComponentsEnum = {
            __ename__: ["wolfrunComponentsWinlines", "ComponentsEnum"],
            __constructs__: ["WIN_FRAMES", "WIN_SYMBOLS"]
        };
        wolfrunComponentsWinlines.ComponentsEnum.WIN_FRAMES = ["WIN_FRAMES", 0];
        wolfrunComponentsWinlines.ComponentsEnum.WIN_FRAMES.toString = $estr;
        wolfrunComponentsWinlines.ComponentsEnum.WIN_FRAMES.__enum__ = wolfrunComponentsWinlines.ComponentsEnum;
        wolfrunComponentsWinlines.ComponentsEnum.WIN_SYMBOLS = ["WIN_SYMBOLS", 1];
        wolfrunComponentsWinlines.ComponentsEnum.WIN_SYMBOLS.toString = $estr;
        wolfrunComponentsWinlines.ComponentsEnum.WIN_SYMBOLS.__enum__ = wolfrunComponentsWinlines.ComponentsEnum;
        wolfrunComponentsWinlines.BaseEvents = function() {
            this.events = new haxe.ds.EnumValueMap();
            this.registerEvents();
        };
        wolfrunComponentsWinlines.BaseEvents.__name__ = ["wolfrunComponentsWinlines", "BaseEvents"];
        wolfrunComponentsWinlines.BaseEvents.prototype.events = null;
        wolfrunComponentsWinlines.BaseEvents.prototype.registerEvents = function() {
            var value = new _hcmn_.msignal_Signal1();
            this.events.set(wolfrunComponentsWinlines.BaseEventsEnum.WIN_SYMBOL_ANIMATIONS_READY, value);
        };
        wolfrunComponentsWinlines.BaseEvents.prototype.getEvent = function(id) {
            return this.events.get(id);
        };
        wolfrunComponentsWinlines.BaseEvents.prototype.__class__ = wolfrunComponentsWinlines.BaseEvents;
        wolfrunComponentsWinlines.ExternalService.loadedAssets = new _hcmn_.haxe_ds_StringMap();;
        wolfrunComponentsWinlines.ExternalService.loading = 0;;
        wolfrunComponentsWinlines.ExternalService.totalLoaded = 0;;
        return {
            exports: wolfrunComponentsWinlines,
            activator: wolfrunComponentsWinlines.Activator
        };
    });
//# sourceURL=wolfRunWinLines.js