define("tripleRedHotSevensIXFReels", ["viewBuilderApi", "componentmodelComponentApi", "clientkernelLoaderApi", "slotModelApi", "displayEngineApi", "reelsApi", "clientkernelTestableApi", "displayEngineUtils", "gameLayoutApi", "PIXI", "BABYLON", "tripleRedHotSevensIXFReelsApi", "clientkernelEventbusApi", "clientkernelModulesApi", "moneyApi"],
    function(viewBuilderApi, componentmodelComponentApi, clientkernelLoaderApi, slotModelApi, displayEngineApi, reelsApi, clientkernelTestableApi, displayEngineUtils, gameLayoutApi, PIXI, BABYLON, tripleRedHotSevensIXFReelsApi, clientkernelEventbusApi, clientkernelModulesApi, moneyApi) {
        "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 tripleRedHotSevensIXFReels == 'undefined') {
            var tripleRedHotSevensIXFReels = {};
        };
        tripleRedHotSevensIXFReels.Activator = function(context) {};
        tripleRedHotSevensIXFReels.Activator = ck_implements(tripleRedHotSevensIXFReels.Activator, clientkernelModulesApi.IModuleActivator);
        tripleRedHotSevensIXFReels.Activator.__interfaces__ = [clientkernelModulesApi.IModuleActivator];
        tripleRedHotSevensIXFReels.Activator.__name__ = ["tripleRedHotSevensIXFReels", "Activator"];
        tripleRedHotSevensIXFReels.Activator.prototype.start = function(context) {
            context.getServiceTracker([displayEngineApi.IDisplayProvider, clientkernelTestableApi.ITestable, viewBuilderApi.IViewBuilderFactory]).then(function(context1) {
                tripleRedHotSevensIXFReels.ExternalService.initialize(context1);
                tripleRedHotSevensIXFReels.ExternalService.assetRegistry.getAsset("reel-config").getContent().then(function(data) {
                    tripleRedHotSevensIXFReels.ExternalService.config = tripleRedHotSevensIXFReels.ReelsConfig.create(data);
                    context1.registerService(new tripleRedHotSevensIXFReels.ReelsRegistryService(), reelsApi.IReelsRegistryService, null);
                    context1.registerService(new tripleRedHotSevensIXFReels.ReelFactory(context1.getAnyService(viewBuilderApi.IViewBuilderFactory, null)), tripleRedHotSevensIXFReelsApi.ReelsDeclaration, null);
                    new tripleRedHotSevensIXFReels.ReelRegistryModel(context1);
                    var _g1 = 0;
                    var _g = tripleRedHotSevensIXFReels.ExternalService.config.configs.length;
                    while (_g1 < _g) {
                        var i = [_g1++];
                        tripleRedHotSevensIXFReels.ExternalService.assetRegistry.getAsset(tripleRedHotSevensIXFReels.ExternalService.config.configs[i[0]]).getContent().then((function(i) {
                            return function(vb) {
                                tripleRedHotSevensIXFReels.ExternalService.loadedAssets[i[0]] = vb;
                            };
                        })(i));
                    }
                });
            });
        };
        tripleRedHotSevensIXFReels.Activator.prototype.stop = function(context) {};
        tripleRedHotSevensIXFReels.Activator.main = function() {};
        tripleRedHotSevensIXFReels.Activator.prototype.__class__ = tripleRedHotSevensIXFReels.Activator;
        tripleRedHotSevensIXFReels.ExternalService = function() {};
        tripleRedHotSevensIXFReels.ExternalService.__name__ = ["tripleRedHotSevensIXFReels", "ExternalService"];
        tripleRedHotSevensIXFReels.ExternalService.displayProvider = null;
        tripleRedHotSevensIXFReels.ExternalService.assetRegistry = null;
        tripleRedHotSevensIXFReels.ExternalService.testableLogger = null;
        tripleRedHotSevensIXFReels.ExternalService.config = null;
        tripleRedHotSevensIXFReels.ExternalService.initialize = function(context) {
            tripleRedHotSevensIXFReels.ExternalService.displayProvider = context.getAnyService(displayEngineApi.IDisplayProvider, null);
            tripleRedHotSevensIXFReels.ExternalService.assetRegistry = context.getAnyService(clientkernelLoaderApi.IAssetRegistry, null);
            var testable = context.getAnyService(clientkernelTestableApi.ITestable, null);
            tripleRedHotSevensIXFReels.ExternalService.testableLogger = testable.getLogger(context);
        };
        tripleRedHotSevensIXFReels.ExternalService.loadConfig = function(config_id, configCallback) {
            tripleRedHotSevensIXFReels.ExternalService.assetRegistry.getAsset(config_id).getContent().then(function(data) {
                configCallback(data);
            });
        };
        tripleRedHotSevensIXFReels.ExternalService.prototype.__class__ = tripleRedHotSevensIXFReels.ExternalService;
        tripleRedHotSevensIXFReels.Reel = function(pos, parent, stripes_arr) {
            this.component = parent;
            this.pos = pos;
            this.view = new tripleRedHotSevensIXFReels.ReelView(pos, parent.config);
            parent.view.addReel(this);
            this.state = tripleRedHotSevensIXFReels.ReelState.IDLE;
            this.animator = new tripleRedHotSevensIXFReels.ReelAnimator(this, parent.config, stripes_arr);
        };
        tripleRedHotSevensIXFReels.Reel.__name__ = ["tripleRedHotSevensIXFReels", "Reel"];
        tripleRedHotSevensIXFReels.Reel.prototype.pos = null;
        tripleRedHotSevensIXFReels.Reel.prototype.view = null;
        tripleRedHotSevensIXFReels.Reel.prototype.animator = null;
        tripleRedHotSevensIXFReels.Reel.prototype.component = null;
        tripleRedHotSevensIXFReels.Reel.prototype.state = null;
        tripleRedHotSevensIXFReels.Reel.prototype.updateReel = function(elapsed_ms, current_time) {
            if (this.state != tripleRedHotSevensIXFReels.ReelState.IDLE) this.animator.updateReel(elapsed_ms, current_time);
        };
        tripleRedHotSevensIXFReels.Reel.prototype.start = function(stripe_layer_id) {
            this.view.setAllVisible();
            this.animator.start(stripe_layer_id);
        };
        tripleRedHotSevensIXFReels.Reel.prototype.onReelStopped = function() {
            this.component.onReelStopped(this.pos);
        };
        tripleRedHotSevensIXFReels.Reel.prototype.onSpinStopped = function() {
            this.component.onSpinStopped();
        };
        tripleRedHotSevensIXFReels.Reel.prototype.__class__ = tripleRedHotSevensIXFReels.Reel;
        tripleRedHotSevensIXFReels.ReelAnimator = function(reel, config, stripes_arr) {
            this.stopped = false;
            this.reelPos = 0;
            this.reelIndex = 0;
            this.config = config;
            this.reel = reel;
            this.reel_config = config.reels[reel.pos];
            this.default_speed_px_ms = this.reel_config.defaultSpeed * this.reel_config.cellHeight * 0.001;
            this.tension_speed_px_ms = this.reel_config.extendedSpinSpeed * this.reel_config.cellHeight * 0.001;
            this.reelPicture = new tripleRedHotSevensIXFReels.ReelPicture();
            this.stoppingFunction = new tripleRedHotSevensIXFReels.CubicSpline(this.reel_config.stoppingFunction, this.reel_config.cellHeight);
            this.startingFunction = new tripleRedHotSevensIXFReels.CubicSpline(this.reel_config.startingFunction, this.reel_config.cellHeight);
            this.stripes = [];
            var _g1 = 0;
            var _g = stripes_arr.length;
            while (_g1 < _g) {
                var i = _g1++;
                this.stripes.push(stripes_arr[i].symbols);
            }
        };
        tripleRedHotSevensIXFReels.ReelAnimator.__name__ = ["tripleRedHotSevensIXFReels", "ReelAnimator"];
        tripleRedHotSevensIXFReels.ReelAnimator.prototype.reel = null;
        tripleRedHotSevensIXFReels.ReelAnimator.prototype.config = null;
        tripleRedHotSevensIXFReels.ReelAnimator.prototype.default_speed_px_ms = null;
        tripleRedHotSevensIXFReels.ReelAnimator.prototype.tension_speed_px_ms = null;
        tripleRedHotSevensIXFReels.ReelAnimator.prototype.reelPicture = null;
        tripleRedHotSevensIXFReels.ReelAnimator.prototype.reelIndex = null;
        tripleRedHotSevensIXFReels.ReelAnimator.prototype.reelPos = null;
        tripleRedHotSevensIXFReels.ReelAnimator.prototype.stripes = null;
        tripleRedHotSevensIXFReels.ReelAnimator.prototype.active_stripe = null;
        tripleRedHotSevensIXFReels.ReelAnimator.prototype.used_stripe = null;
        tripleRedHotSevensIXFReels.ReelAnimator.prototype.used_stripe_length = null;
        tripleRedHotSevensIXFReels.ReelAnimator.prototype.used_stripe_length_px = null;
        tripleRedHotSevensIXFReels.ReelAnimator.prototype.buffer = null;
        tripleRedHotSevensIXFReels.ReelAnimator.prototype.stopPosition = null;
        tripleRedHotSevensIXFReels.ReelAnimator.prototype.bufferIndex = null;
        tripleRedHotSevensIXFReels.ReelAnimator.prototype.bufferPos = null;
        tripleRedHotSevensIXFReels.ReelAnimator.prototype.stopped = null;
        tripleRedHotSevensIXFReels.ReelAnimator.prototype.lastStopReelPos = null;
        tripleRedHotSevensIXFReels.ReelAnimator.prototype.reel_config = null;
        tripleRedHotSevensIXFReels.ReelAnimator.prototype.stoppingFunction = null;
        tripleRedHotSevensIXFReels.ReelAnimator.prototype.startingFunction = null;
        tripleRedHotSevensIXFReels.ReelAnimator.prototype.stopDuration = null;
        tripleRedHotSevensIXFReels.ReelAnimator.prototype.startDuration = null;
        tripleRedHotSevensIXFReels.ReelAnimator.prototype.stop_time_bookmark = null;
        tripleRedHotSevensIXFReels.ReelAnimator.prototype.start_time_bookmark = null;
        tripleRedHotSevensIXFReels.ReelAnimator.prototype.stop_time_buffer_pos = null;
        tripleRedHotSevensIXFReels.ReelAnimator.prototype.start_time_buffer_pos = null;
        tripleRedHotSevensIXFReels.ReelAnimator.prototype.time1 = null;
        tripleRedHotSevensIXFReels.ReelAnimator.prototype.dist1 = null;
        tripleRedHotSevensIXFReels.ReelAnimator.prototype.time2 = null;
        tripleRedHotSevensIXFReels.ReelAnimator.prototype.dist2 = null;
        tripleRedHotSevensIXFReels.ReelAnimator.prototype.time3 = null;
        tripleRedHotSevensIXFReels.ReelAnimator.prototype.dist3 = null;
        tripleRedHotSevensIXFReels.ReelAnimator.prototype.total_stopping_time = null;
        tripleRedHotSevensIXFReels.ReelAnimator.prototype.total_starting_time = null;
        tripleRedHotSevensIXFReels.ReelAnimator.prototype.outcomeExitDist = null;
        tripleRedHotSevensIXFReels.ReelAnimator.prototype.outcomeEnterDist = null;
        tripleRedHotSevensIXFReels.ReelAnimator.prototype.currentTime = null;
        tripleRedHotSevensIXFReels.ReelAnimator.prototype.forceReelPicture = function(picture) {
            this.reelPicture.cells = picture.slice();
            while (this.reelPicture.cells.length < this.config.inGameRPSize) {
                var len = this.reelPicture.cells.length;
                var dif = this.config.inGameRPSize % len;
                if (dif == 1) {
                    var symbol_id = this.reelPicture.cells[len - 1];
                    var block = this.config.symbolMap.get(symbol_id).block;
                    if (block != null) {
                        var symbolInBlock = _hcmn_.HxOverrides.lastIndexOf(block, symbol_id, block.length - 1) + 1;
                        if (symbolInBlock == block.length) this.pushRandomNonBlockSymbols(this.reelPicture.cells);
                        else this.reelPicture.cells.push(block[symbolInBlock]);
                    } else this.pushRandomNonBlockSymbols(this.reelPicture.cells);
                } else this.unshiftRandomNonBlockSymbol(this.reelPicture.cells);
            }
            this.reelPicture.offset = 0;
            this.reel.view.update(this.reelPicture);
        };
        tripleRedHotSevensIXFReels.ReelAnimator.prototype.activateReelStripe = function(stripe_id) {
            this.active_stripe = stripe_id;
            this.setUsedStripe();
        };
        tripleRedHotSevensIXFReels.ReelAnimator.prototype.changeReelState = function(state) {
            this.reel.state = state;
            this.setUsedStripe();
        };
        tripleRedHotSevensIXFReels.ReelAnimator.prototype.setUsedStripe = function() {
            var _g = this.reel.state;
            switch (_g[1]) {
                case 0:
                case 2:
                    this.used_stripe = this.stripes[this.active_stripe];
                    break;
                case 1:
                case 3:
                    this.used_stripe = this.buffer;
                    break;
                default:
                    this.used_stripe = this.stripes[this.active_stripe];
            }
            this.used_stripe_length = this.used_stripe.length;
            this.used_stripe_length_px = this.used_stripe_length * this.reel_config.cellHeight;
        };
        tripleRedHotSevensIXFReels.ReelAnimator.prototype.calculateReelPicture = function(stripe_index, stripe_pos) {
            this.reelPicture.cells = this.getImageFromUsedStripe(stripe_index);
            this.reelPicture.offset = stripe_pos % this.reel_config.cellHeight;
            this.reel.view.update(this.reelPicture);
        };
        tripleRedHotSevensIXFReels.ReelAnimator.prototype.getImageFromUsedStripe = function(stripe_index) {
            var image = [];
            var _g1 = 0;
            var _g = this.config.inGameRPSize;
            while (_g1 < _g) {
                var i = _g1++;
                var index = this.checkIndex(stripe_index + i - 1, this.used_stripe_length);
                image[i] = this.used_stripe[index];
            }
            return image;
        };
        tripleRedHotSevensIXFReels.ReelAnimator.prototype.getImageFromStripe = function(stripe_index, stripe) {
            var arr_len = stripe.length;
            var image = [];
            var _g1 = 0;
            var _g = this.config.inGameRPSize;
            while (_g1 < _g) {
                var i = _g1++;
                var index = this.checkIndex(stripe_index + i - 1, arr_len);
                image[i] = stripe[index];
            }
            return image;
        };
        tripleRedHotSevensIXFReels.ReelAnimator.prototype.stop = function(img, desiredTimeToStop, firstReelInTensionTime, tension) {
            if (firstReelInTensionTime != 0 && tension == 1) {
                this.time1 = firstReelInTensionTime;
                this.dist1 = this.time1 * this.default_speed_px_ms;
                this.time2 = desiredTimeToStop - this.time1 - this.stoppingFunction.total_time;
                this.dist2 = this.time2 * this.tension_speed_px_ms | 0;
            } else {
                this.time2 = 0;
                this.dist2 = 0;
                this.time1 = desiredTimeToStop - this.stoppingFunction.total_time;
                this.dist1 = this.time1 * this.default_speed_px_ms;
            }
            var symbols_total = _hcmn_.Math.ceil((this.dist1 + this.dist2 + this.stoppingFunction.distance) / this.reel_config.cellHeight);
            if (symbols_total < img.length) symbols_total = img.length;
            var offset;
            if (this.config.bleedOn) offset = 0;
            else offset = 1;
            var total_dist = (symbols_total + offset) * this.reel_config.cellHeight + this.reelPicture.offset;
            this.dist1 = total_dist - this.stoppingFunction.distance - this.dist2;
            this.time1 = this.dist1 / this.default_speed_px_ms | 0;
            this.buffer = [];
            var stopPositionFound = this.findStopPositionIndex(img);
            if (stopPositionFound) {
                this.buffer.push(this.used_stripe[this.checkIndex(this.reelIndex - 3, this.used_stripe_length)]);
                this.buffer.push(this.used_stripe[this.checkIndex(this.reelIndex - 2, this.used_stripe_length)]);
                this.buffer.push(this.used_stripe[this.checkIndex(this.reelIndex - 1, this.used_stripe_length)]);
            } else {
                var firstBlank = this.usingBlankSymbol() && this.isNotBlank(img[0]);
                this.buffer.push(firstBlank ? this.config.blankSymbol : this.getRandomNonBlockSymbol());
                this.pushRandomNonBlockSymbols(this.buffer, 2);
            }
            this.buffer = this.buffer.concat(img.slice());
            var symbols_to_add = symbols_total - img.length;
            var lastSymbolInOutcome = this.buffer[this.buffer.length - 1];
            var _block = this.config.symbolMap.get(lastSymbolInOutcome).block;
            var stacked = this.isStacked(_block);
            if (_block != null) {
                var _blockPartToAdd;
                if (!stacked) _blockPartToAdd = _block.slice(_hcmn_.HxOverrides.indexOf(_block, lastSymbolInOutcome, 0) + 1);
                else {
                    var stackedCountInOutcome = 0;
                    var currentSymbolIndex = this.buffer.length - 1;
                    while (currentSymbolIndex >= 0 && this.buffer[currentSymbolIndex] == lastSymbolInOutcome) {
                        stackedCountInOutcome++;
                        currentSymbolIndex--;
                    }
                    _blockPartToAdd = _block.slice(stackedCountInOutcome);
                }
                if (_blockPartToAdd.length > 0) {
                    this.buffer = this.buffer.concat(_blockPartToAdd);
                    symbols_to_add -= _blockPartToAdd.length;
                }
            }
            var blockCandidateInReelPicture = this.reelPicture.cells[0];
            var blockCandidate = [];
            var _block1 = this.config.symbolMap.get(blockCandidateInReelPicture).block;
            var stacked1 = this.isStacked(_block1);
            if (_block1 != null) {
                if (!stacked1) blockCandidate = _block1.slice(0, _hcmn_.HxOverrides.indexOf(_block1, blockCandidateInReelPicture, 0));
                else {
                    var stackedCountInRP = 0;
                    var currentSymbolIndex1 = 0;
                    while (currentSymbolIndex1 < this.reelPicture.cells.length && this.reelPicture.cells[currentSymbolIndex1] == blockCandidateInReelPicture) {
                        stackedCountInRP++;
                        currentSymbolIndex1++;
                    }
                    blockCandidate = _block1.slice(stackedCountInRP);
                }
                if (blockCandidate.length > 0) symbols_to_add -= blockCandidate.length;
            }
            if (symbols_to_add < 0) {
                var distanceToAdd = -symbols_to_add * this.reel_config.cellHeight;
                this.dist1 += distanceToAdd;
                var addedTime = distanceToAdd / this.default_speed_px_ms | 0;
                this.time1 += addedTime;
                this.total_stopping_time + addedTime;
            } else this.pushRandomNonBlockSymbols(this.buffer, symbols_to_add);
            if (blockCandidate.length > 0) this.buffer = this.buffer.concat(blockCandidate);
            if (!this.isValidBlankSymbolConcatenation(this.buffer[this.buffer.length - 1], this.reelPicture.cells[0])) {
                this.pushRandomNonBlockSymbols(this.buffer);
                this.dist1 += this.reel_config.cellHeight;
                this.time1 += this.reel_config.cellHeight / this.default_speed_px_ms | 0;
            }
            this.buffer = this.buffer.concat(this.reelPicture.cells);
            this.bufferIndex = this.buffer.length - this.reelPicture.cells.length + 1;
            this.bufferPos = this.bufferIndex * this.reel_config.cellHeight + this.reelPicture.offset;
            this.total_stopping_time = this.time1 + this.time2 + this.stoppingFunction.total_time;
            this.stop_time_bookmark = new _hcmn_.Date().getTime();
            this.stop_time_buffer_pos = this.bufferPos;
            console.log("[mj][stop  " + this.reel.pos + "]     outcome:" + _hcmn_.Std.string(img));
            console.log("[mj][stop  " + this.reel.pos + "] curentState:" + _hcmn_.Std.string(this.reelPicture.cells));
            console.log("[mj][stop  " + this.reel.pos + "]      buffer:" + _hcmn_.Std.string(this.buffer));
            this.outcomeEnterDist = total_dist - this.reel_config.cellHeight * (this.reel_config.cellsNum - 0.5);
            this.changeReelState(tripleRedHotSevensIXFReels.ReelState.STOPPING);
            return this.total_stopping_time;
        };
        tripleRedHotSevensIXFReels.ReelAnimator.prototype.start = function(stripe_id) {
            this.activateReelStripe(stripe_id);
            this.buffer = [];
            this.buffer = this.reelPicture.cells.slice();
            this.reelIndex -= this.reelPicture.cells.length;
            this.reelIndex = this.checkIndex(this.reelIndex, this.used_stripe_length);
            var added_symbols = 0;
            var blockCandidateInReelPicture = this.reelPicture.cells[0];
            var _block = this.config.symbolMap.get(blockCandidateInReelPicture).block;
            var stacked = this.isStacked(_block);
            if (_block != null) {
                if (!stacked) {
                    if (blockCandidateInReelPicture != _block[0]) {
                        var blockCandidate = _block.slice(0, _hcmn_.HxOverrides.indexOf(_block, blockCandidateInReelPicture, 0));
                        this.buffer = blockCandidate.concat(this.buffer);
                        added_symbols += blockCandidate.length;
                    }
                } else {
                    var stackedCountInRP = 0;
                    var currentSymbolIndex = 0;
                    while (currentSymbolIndex < this.reelPicture.cells.length && this.reelPicture.cells[currentSymbolIndex] == blockCandidateInReelPicture) {
                        stackedCountInRP++;
                        currentSymbolIndex++;
                    }
                    var blockCandidate1 = _block.slice(stackedCountInRP);
                    this.buffer = blockCandidate1.concat(this.buffer);
                    added_symbols += blockCandidate1.length;
                }
            }
            var activeStripeCandidate = this.getImageFromStripe(this.reelIndex, this.used_stripe);
            var activeStripeLastSymbol = activeStripeCandidate[activeStripeCandidate.length - 1];
            while (this.config.symbolMap.get(activeStripeLastSymbol).block != null || !this.isValidBlankSymbolConcatenation(activeStripeLastSymbol, this.buffer[0])) {
                this.reelIndex--;
                activeStripeCandidate = this.getImageFromStripe(this.reelIndex, this.used_stripe);
                activeStripeLastSymbol = activeStripeCandidate[activeStripeCandidate.length - 1];
            }
            activeStripeCandidate.unshift(this.used_stripe[this.checkIndex(this.reelIndex - 2, this.used_stripe_length)]);
            this.buffer = activeStripeCandidate.concat(this.buffer);
            this.bufferIndex = this.buffer.length - this.reelPicture.cells.length + 1;
            this.bufferPos = this.bufferIndex * this.reel_config.cellHeight;
            this.reelPos = this.reelIndex * this.reel_config.cellHeight;
            var symbols_to_travel = this.reelPicture.cells.length + added_symbols;
            var total_starting_distance = symbols_to_travel * this.reel_config.cellHeight;
            this.dist1 = total_starting_distance - this.startingFunction.distance;
            this.time1 = this.dist1 / this.default_speed_px_ms | 0;
            this.start_time_bookmark = new _hcmn_.Date().getTime();
            this.start_time_buffer_pos = this.bufferPos;
            console.log("[mj][start " + this.reel.pos + "] curentState:" + _hcmn_.Std.string(this.reelPicture.cells));
            console.log("[mj][start " + this.reel.pos + "]      buffer:" + _hcmn_.Std.string(this.buffer));
            this.outcomeExitDist = this.reel_config.cellHeight * (this.reel_config.cellsNum + 1);
            this.changeReelState(tripleRedHotSevensIXFReels.ReelState.STARTING);
        };
        tripleRedHotSevensIXFReels.ReelAnimator.prototype.updateReel = function(elapsed_ms, currentTime) {
            this.currentTime = currentTime;
            if (this.used_stripe == null) {
                console.log("[mj] used_stripe==null");
                return;
            }
            if (this.reel.state == tripleRedHotSevensIXFReels.ReelState.STOPPING) {
                var elapsed_from_stop = currentTime - this.stop_time_bookmark | 0;
                var end = false;
                var elapsed_dist;
                if (elapsed_from_stop < this.time1) elapsed_dist = elapsed_from_stop * this.default_speed_px_ms;
                else if (elapsed_from_stop < this.time1 + this.time2) elapsed_dist = this.dist1 + (elapsed_from_stop - this.time1) * this.tension_speed_px_ms;
                else if (elapsed_from_stop < this.total_stopping_time) elapsed_dist = this.dist1 + this.dist2 + this.stoppingFunction.map.h[elapsed_from_stop - this.time1 - this.time2];
                else {
                    elapsed_dist = this.dist1 + this.dist2 + this.stoppingFunction.distance;
                    end = true;
                }
                this.bufferPos = this.stop_time_buffer_pos - elapsed_dist;
                this.bufferIndex = _hcmn_.Math.floor(this.bufferPos / this.reel_config.cellHeight);
                if (end) {
                    this.bufferPos = _hcmn_.Math.round(this.bufferPos);
                    this.bufferIndex = _hcmn_.Math.floor(this.bufferPos / this.reel_config.cellHeight);
                    this.calculateReelPicture(this.bufferIndex, this.bufferPos);
                    console.log("[mj] stopping ended " + this.reelIndex + ", pos:" + this.bufferPos + ", index:" + this.bufferIndex);
                    this.publishStop();
                } else this.calculateReelPicture(this.bufferIndex, this.bufferPos);
                if (this.outcomeEnterDist != 0 && elapsed_dist > this.outcomeEnterDist) {
                    this.outcomeEnterDist = 0;
                    this.publishOutcomeEnter();
                }
                return;
            }
            if (this.reel.state == tripleRedHotSevensIXFReels.ReelState.STARTING) {
                var elapsed_from_start = currentTime - this.start_time_bookmark | 0;
                var end_start = false;
                var elapsed_dist1;
                if (elapsed_from_start < this.startingFunction.total_time) elapsed_dist1 = this.startingFunction.map.h[elapsed_from_start];
                else if (elapsed_from_start <= this.time1 + this.startingFunction.total_time) elapsed_dist1 = this.startingFunction.distance + (elapsed_from_start - this.startingFunction.total_time) * this.default_speed_px_ms;
                else {
                    var overPos = (elapsed_from_start - this.time1 - this.startingFunction.total_time) * this.default_speed_px_ms;
                    elapsed_dist1 = this.dist1 + this.startingFunction.distance + overPos;
                    this.reelPos -= overPos;
                    end_start = true;
                }
                this.bufferPos = this.start_time_buffer_pos - elapsed_dist1;
                this.bufferIndex = _hcmn_.Math.floor(this.bufferPos / this.reel_config.cellHeight);
                this.calculateReelPicture(this.bufferIndex, this.bufferPos);
                if (end_start) this.changeReelState(tripleRedHotSevensIXFReels.ReelState.SPINNING);
                else {}
                if (this.outcomeExitDist != 0 && elapsed_dist1 > this.outcomeExitDist) {
                    this.outcomeExitDist = 0;
                    this.publishOutcomeExit();
                }
                return;
            }
            this.reelPos -= this.default_speed_px_ms * elapsed_ms;
            this.reelPos = this.checkPosition(this.reelPos, this.used_stripe_length_px);
            this.reelIndex = _hcmn_.Math.floor(this.reelPos / this.reel_config.cellHeight);
            this.calculateReelPicture(this.reelIndex, this.reelPos);
        };
        tripleRedHotSevensIXFReels.ReelAnimator.prototype.resetOnAbortEnd = function() {
            this.changeReelState(tripleRedHotSevensIXFReels.ReelState.IDLE);
            this.activateReelStripe(this.active_stripe);
        };
        tripleRedHotSevensIXFReels.ReelAnimator.prototype.isStacked = function(block) {
            if (block == null || block[0] == null) return false;
            var stackedSymbol = block[0];
            var _g = 0;
            while (_g < block.length) {
                var s = block[_g];
                ++_g;
                if (s != stackedSymbol) return false;
            }
            return true;
        };
        tripleRedHotSevensIXFReels.ReelAnimator.prototype.findStopPositionIndex = function(arr) {
            var _g1 = 0;
            var _g = this.used_stripe_length;
            while (_g1 < _g) {
                var i = _g1++;
                var found = true;
                var _g3 = 0;
                var _g2 = arr.length;
                while (_g3 < _g2) {
                    var r = _g3++;
                    var _ind = this.checkIndex(i + r, this.used_stripe_length);
                    if (this.used_stripe[_ind] != arr[r]) {
                        found = false;
                        continue;
                    }
                }
                if (found) {
                    this.reelIndex = i;
                    this.reelPos = this.reelIndex * this.reel_config.cellHeight;
                    this.lastStopReelPos = this.reelPos;
                    return true;
                }
            }
            return false;
        };
        tripleRedHotSevensIXFReels.ReelAnimator.prototype.pushRandomNonBlockSymbols = function(buffer, count) {
            if (count == null) count = 1;
            if (!this.usingBlankSymbol()) {
                var _g = 0;
                while (_g < count) {
                    var i = _g++;
                    buffer.push(this.getRandomNonBlockSymbol());
                }
            } else {
                var isNextSymbolBlank = buffer.length > 0 && this.isNotBlank(buffer[buffer.length - 1]);
                var _g1 = 0;
                while (_g1 < count) {
                    var i1 = _g1++;
                    buffer.push(isNextSymbolBlank ? this.config.blankSymbol : this.getRandomNonBlockSymbol());
                    isNextSymbolBlank = !isNextSymbolBlank;
                }
            }
        };
        tripleRedHotSevensIXFReels.ReelAnimator.prototype.unshiftRandomNonBlockSymbol = function(buffer) {
            if (!this.usingBlankSymbol()) buffer.unshift(this.getRandomNonBlockSymbol());
            else {
                var isNextSymbolBlank = buffer.length > 0 && this.isNotBlank(buffer[0]);
                buffer.unshift(isNextSymbolBlank ? this.config.blankSymbol : this.getRandomNonBlockSymbol());
            }
        };
        tripleRedHotSevensIXFReels.ReelAnimator.prototype.isValidBlankSymbolConcatenation = function(symbol1, symbol2) {
            if (!this.usingBlankSymbol()) return true;
            else return symbol1 == this.config.blankSymbol && symbol2 != this.config.blankSymbol || symbol1 != this.config.blankSymbol && symbol2 == this.config.blankSymbol;
        };
        tripleRedHotSevensIXFReels.ReelAnimator.prototype.usingBlankSymbol = function() {
            return this.config.blankSymbol != null;
        };
        tripleRedHotSevensIXFReels.ReelAnimator.prototype.isNotBlank = function(symbol) {
            return symbol != this.config.blankSymbol;
        };
        tripleRedHotSevensIXFReels.ReelAnimator.prototype.getRandomNonBlockSymbol = function() {
            return this.config.nonBlockSymbols[_hcmn_.Std.random(this.config.nonBlockSymbols.length)];
        };
        tripleRedHotSevensIXFReels.ReelAnimator.prototype.publishStop = function() {
            this.changeReelState(tripleRedHotSevensIXFReels.ReelState.IDLE);
            this.reel.onReelStopped();
            if (this.reel.pos == this.config.reels.length - 1) this.reel.onSpinStopped();
        };
        tripleRedHotSevensIXFReels.ReelAnimator.prototype.publishOutcomeExit = function() {
            this.reel.component.port.onStartSpinReelPictureExit().publish(this.reel.pos);
        };
        tripleRedHotSevensIXFReels.ReelAnimator.prototype.publishOutcomeEnter = function() {};
        tripleRedHotSevensIXFReels.ReelAnimator.prototype.checkIndex = function(value, maxValue) {
            while (value < 0) value += maxValue;
            return value % maxValue;
        };
        tripleRedHotSevensIXFReels.ReelAnimator.prototype.checkPosition = function(value, maxValue) {
            while (value < 0) value += maxValue;
            return value % maxValue;
        };
        tripleRedHotSevensIXFReels.ReelAnimator.prototype.get_stopDuration = function() {
            return this.stoppingFunction.total_time;
        };
        tripleRedHotSevensIXFReels.ReelAnimator.prototype.get_startDuration = function() {
            return this.startingFunction.total_time;
        };
        tripleRedHotSevensIXFReels.ReelAnimator.prototype.__class__ = tripleRedHotSevensIXFReels.ReelAnimator;
        tripleRedHotSevensIXFReels.ReelComponent = function(context, vbFactory) {
            this.serverMinSpinDuration = 100;
            this.reelsInitialized = false;
            this.reels = [];
            console.log("[mj] ReelComponent.new");
            this.context = context;
            this.port = context.getImplementedPort(reelsApi.IReelsImplementationPort);
            this.slotModelPort = context.getUsedPort(slotModelApi.ISlotModelPort);
            this.layoutPort = context.getUsedPort(gameLayoutApi.IGameLayoutPort);
            this.vbFactory = vbFactory;
            this.port.startSpin().subscribe($bind(this, this.handleStartSpin));
            this.port.stopSpin().subscribe($bind(this, this.handleStopSpin));
            this.port.setReelPicture().subscribe($bind(this, this.handleSetReelPicture));
            this.port.setReelCellsVisibility().subscribe($bind(this, this.handleSetReelCellsVisibility));
            this.port.show().subscribe($bind(this, this.handleShow));
            this.port.hide().subscribe($bind(this, this.handleHide));
            this.port.setReelSkin().subscribe($bind(this, this.handleSetReelSkin));
            this.slotModelPort.getStages().getInitStage().getInitializeGamePhase().getInitializeGame().subscribe($bind(this, this.handleModelInit));
            this.slotModelPort.getStages().getResumeStage().getPrepareResume().subscribe($bind(this, this.handleResumeGame));
            this.layoutPort.getUpdateComponentLayout().subscribe($bind(this, this.updateLayout));
            this.config = tripleRedHotSevensIXFReels.ExternalService.config;
        };
        tripleRedHotSevensIXFReels.ReelComponent.__name__ = ["tripleRedHotSevensIXFReels", "ReelComponent"];
        tripleRedHotSevensIXFReels.ReelComponent.prototype.context = null;
        tripleRedHotSevensIXFReels.ReelComponent.prototype.vbFactory = null;
        tripleRedHotSevensIXFReels.ReelComponent.prototype.port = null;
        tripleRedHotSevensIXFReels.ReelComponent.prototype.slotModelPort = null;
        tripleRedHotSevensIXFReels.ReelComponent.prototype.layoutPort = null;
        tripleRedHotSevensIXFReels.ReelComponent.prototype.state = null;
        tripleRedHotSevensIXFReels.ReelComponent.prototype.config = null;
        tripleRedHotSevensIXFReels.ReelComponent.prototype.view = null;
        tripleRedHotSevensIXFReels.ReelComponent.prototype.stage = null;
        tripleRedHotSevensIXFReels.ReelComponent.prototype.layoutPayload = null;
        tripleRedHotSevensIXFReels.ReelComponent.prototype.tensionArray = null;
        tripleRedHotSevensIXFReels.ReelComponent.prototype.reels = null;
        tripleRedHotSevensIXFReels.ReelComponent.prototype._outcomeReelPicture = null;
        tripleRedHotSevensIXFReels.ReelComponent.prototype._lastBaseGameOutcome = null;
        tripleRedHotSevensIXFReels.ReelComponent.prototype.oldTime = null;
        tripleRedHotSevensIXFReels.ReelComponent.prototype.timer = null;
        tripleRedHotSevensIXFReels.ReelComponent.prototype.spinStartTime = null;
        tripleRedHotSevensIXFReels.ReelComponent.prototype.reelStopTimer = null;
        tripleRedHotSevensIXFReels.ReelComponent.prototype.reelPictureVisibility = null;
        tripleRedHotSevensIXFReels.ReelComponent.prototype.reelsInitialized = null;
        tripleRedHotSevensIXFReels.ReelComponent.prototype.setReelPicturePayload = null;
        tripleRedHotSevensIXFReels.ReelComponent.prototype.firstReelInTension = null;
        tripleRedHotSevensIXFReels.ReelComponent.prototype.serverMinSpinDuration = null;
        tripleRedHotSevensIXFReels.ReelComponent.prototype.outcomeSize = null;
        tripleRedHotSevensIXFReels.ReelComponent.prototype.outcomeStartIndex = null;
        tripleRedHotSevensIXFReels.ReelComponent.prototype.initProperties = null;
        tripleRedHotSevensIXFReels.ReelComponent.prototype.handleResumeGame = function(e) {
            console.log("[mj] ReelComponent.handleResumeGame");
            this.continueInit(e.getPayload().initializationProperties);
        };
        tripleRedHotSevensIXFReels.ReelComponent.prototype.handleModelInit = function(e) {
            console.log("[mj] ReelComponent.handleModelInit");
            this.continueInit(e.getPayload());
        };
        tripleRedHotSevensIXFReels.ReelComponent.prototype.continueInit = function(initProperties) {
            this.initProperties = initProperties;
            console.log("[mj] ReelComponent.continueInit");
            this.outcomeSize = initProperties.slotDefinition.reelPictureSize.reelLength;
            if (this.outcomeSize == this.config.defaultReelConfig.cellsNum) {
                this.config.bleedOn = false;
                this.outcomeStartIndex = 1;
                this.config.inGameRPSize = this.outcomeSize + 2;
            } else {
                this.config.bleedOn = true;
                this.outcomeStartIndex = 0;
                this.config.inGameRPSize = this.outcomeSize + 1;
            }
            this.reelPictureVisibility = initProperties.slotDefinition.reelPictureVisibility.reelsInfo;
            this.initialize();
        };
        tripleRedHotSevensIXFReels.ReelComponent.prototype.updateLayout = function(e) {
            console.log("[mj] ReelComponent.updateLayout handler");
            this.layoutPayload = e.getPayload();
            this.layoutPort.getComponentLayoutUpdated().publish(this.context.getInstance());
            if (this.reelsInitialized) this.view.onLayoutUpdate(this.layoutPayload);
            else this.initialize();
        };
        tripleRedHotSevensIXFReels.ReelComponent.prototype.initialize = function() {
            console.log("[mj] ReelComponent.initialize");
            if (this.config == null) return;
            if (!this.reelsInitialized && this.layoutPayload != null && tripleRedHotSevensIXFReels.ExternalService.loadedAssets.length == this.config.configs.length && this.initProperties != null) this.initReels();
        };
        tripleRedHotSevensIXFReels.ReelComponent.prototype.initReels = function() {
            console.log("[mj] ReelComponent.initReels");
            this.config.viewBuilder = [];
            var _g1 = 0;
            var _g = tripleRedHotSevensIXFReels.ExternalService.loadedAssets.length;
            while (_g1 < _g) {
                var n = _g1++;
                this.config.viewBuilder[n] = this.vbFactory.createView(tripleRedHotSevensIXFReels.ExternalService.loadedAssets[n]);
            }
            this.config.symbolMap = new _hcmn_.haxe_ds_StringMap();
            var _g11 = 0;
            var _g2 = this.initProperties.slotDefinition.symbols.length;
            while (_g11 < _g2) {
                var s = _g11++;
                this.config.symbolMap.set(this.initProperties.slotDefinition.symbols[s].id, this.initProperties.slotDefinition.symbols[s]);
            }
            if (this.config.nonBlockSymbols == null) {
                this.config.nonBlockSymbols = [];
                var $it0 = this.config.symbolMap.keys();
                while ($it0.hasNext()) {
                    var key = $it0.next();
                    if (this.config.symbolMap.get(key).block == null) this.config.nonBlockSymbols.push(key);
                }
            }
            var this1 = tripleRedHotSevensIXFReels.ExternalService.displayProvider.getStages();
            var key1 = this.layoutPayload.containers.get("layout").stage;
            this.stage = this1.get(key1);
            this.view = new tripleRedHotSevensIXFReels.ReelComponentView(this.config);
            this.view.onLayoutUpdate(this.layoutPayload);
            var _g12 = 0;
            var _g3 = this.config.reels.length;
            while (_g12 < _g3) {
                var i = _g12++;
                var _reel = new tripleRedHotSevensIXFReels.Reel(i, this, this.initProperties.slotDefinition.reels[i].stripes);
                this.reels.push(_reel);
                _reel.view.addCellToBleedLayer = ($_ = this.view, $bind($_, $_.addCellToBleedLayer));
                _reel.view.removeCellFromBleedLayer = ($_ = this.view, $bind($_, $_.removeCellFromBleedLayer));
            }
            if (this.setReelPicturePayload != null) this.forceReelPicture(this.setReelPicturePayload);
            this.changeState(tripleRedHotSevensIXFReels.ReelComponentState.IDLE);
            this.stage.on(displayEngineApi.DisplayObjectEvents.ENTER_FRAME, $bind(this, this.updateReels));
            this.reelsInitialized = true;
        };
        tripleRedHotSevensIXFReels.ReelComponent.prototype.handleStartSpin = function(e) {
            console.log("[mj] ReelComponent.handleStartSpin");
            if (this.state != tripleRedHotSevensIXFReels.ReelComponentState.IDLE) return;
            this.changeState(tripleRedHotSevensIXFReels.ReelComponentState.SPINNING);
            this.oldTime = new _hcmn_.Date().getTime();
            this.spinStartTime = _hcmn_.Std["int"](new _hcmn_.Date().getTime());
            var stripe_layer_ids = e.getPayload().stripeLayerIds;
            var _g1 = 0;
            var _g = this.reels.length;
            while (_g1 < _g) {
                var i = _g1++;
                this.reels[i].start(stripe_layer_ids[i]);
            }
        };
        tripleRedHotSevensIXFReels.ReelComponent.prototype.handleShow = function(e) {
            this.view.setVisible(true);
        };
        tripleRedHotSevensIXFReels.ReelComponent.prototype.handleHide = function(e) {
            this.view.setVisible(false);
        };
        tripleRedHotSevensIXFReels.ReelComponent.prototype.handleStopSpin = function(e) {
            var _g = this;
            if (this.state != tripleRedHotSevensIXFReels.ReelComponentState.SPINNING) return;
            this.changeState(tripleRedHotSevensIXFReels.ReelComponentState.STOPPING);
            this._outcomeReelPicture = e.getPayload().reelPicture;
            var tensionParams = e.getPayload().tensionParams;
            this.tensionArray = e.getPayload().tensionReels;
            this.firstReelInTension = _hcmn_.HxOverrides.indexOf(this.tensionArray, 1, 0);
            var reelsInTension = 0;
            var _g1 = 0;
            var _g2 = this.tensionArray.length;
            while (_g1 < _g2) {
                var t = _g1++;
                if (this.tensionArray[t] == 1) reelsInTension++;
            }
            var startDuration = this.config.reels[0].cellsNum * this.config.reels[0].cellHeight / (this.config.reels[0].defaultSpeed * this.config.reels[0].cellHeight) * 1000 | 0;
            var elapsedFromStart = _hcmn_.Std["int"](new _hcmn_.Date().getTime()) - this.spinStartTime;
            var timeForStopAll = this.reels[0].animator.get_stopDuration() + (this.config.reels.length - 1 - reelsInTension) * this.config.defaultReelConfig.stopDelay + reelsInTension * this.config.defaultReelConfig.extendedSpinDuration;
            var delay = this.serverMinSpinDuration - timeForStopAll - elapsedFromStart;
            if (delay > 0) _hcmn_.haxe_Timer.delay(function() {
                _g.triggerStopping(reelsInTension, tensionParams);
            }, delay);
            else this.triggerStopping(reelsInTension, tensionParams);
        };
        tripleRedHotSevensIXFReels.ReelComponent.prototype.triggerStopping = function(reelsInTension, tensionParams) {
            this.port.onStoppingStarted().publish(null);
            var desiredTimeToStop = 0;
            var time = new _hcmn_.Date().getTime();
            var firstReelInTensionTime = 0;
            if (tensionParams != null && tensionParams.stopInSameTime == true && tensionParams.duration != null && reelsInTension > 0) {
                var _g1 = 0;
                var _g = this.reels.length;
                while (_g1 < _g) {
                    var i = _g1++;
                    this.reels[i].animator.stop(this._outcomeReelPicture[i], tensionParams.duration, 0, this.tensionArray[i]);
                }
            } else {
                var _g11 = 0;
                var _g2 = this.reels.length;
                while (_g11 < _g2) {
                    var i1 = _g11++;
                    if (this.tensionArray[i1] != 0) desiredTimeToStop += this.config.reels[i1].extendedSpinDuration;
                    else if (i1 != 0) desiredTimeToStop += this.config.reels[i1].stopDelay;
                    else desiredTimeToStop = this.reels[0].animator.get_stopDuration();
                    desiredTimeToStop = this.reels[i1].animator.stop(this._outcomeReelPicture[i1], desiredTimeToStop, firstReelInTensionTime, this.tensionArray[i1]);
                    if (i1 == this.firstReelInTension - 1) firstReelInTensionTime = desiredTimeToStop;
                }
            }
        };
        tripleRedHotSevensIXFReels.ReelComponent.prototype.updateReels = function() {
            if (this.state == tripleRedHotSevensIXFReels.ReelComponentState.IDLE) return;
            var currentTime = new _hcmn_.Date().getTime();
            var elapsed_ms = currentTime - this.oldTime | 0;
            var elapsed = (currentTime - this.oldTime) * 0.001;
            this.oldTime = currentTime;
            var _g1 = 0;
            var _g = this.reels.length;
            while (_g1 < _g) {
                var i = _g1++;
                var _reel = this.reels[i];
                _reel.updateReel(elapsed_ms, currentTime);
            }
            this.view.sortBleed();
        };
        tripleRedHotSevensIXFReels.ReelComponent.prototype.onReelStopped = function(pos) {
            var stoppedPicture;
            if (this.config.cascadingReels) stoppedPicture = this.reels[pos].animator.reelPicture.cells.slice(this.outcomeStartIndex, this.outcomeStartIndex + this.config.reels[pos].cellsNum);
            else stoppedPicture = this.reels[pos].animator.reelPicture.cells.slice(this.outcomeStartIndex, this.outcomeStartIndex + this.outcomeSize);
            tripleRedHotSevensIXFReels.ExternalService.testableLogger.info("reelPicture", {
                pos: pos,
                cells: stoppedPicture
            });
            var resultOK = this._outcomeReelPicture[pos].toString() == stoppedPicture.toString();
            var msg;
            msg = "[mj][stopped " + pos + "] server:" + _hcmn_.Std.string(this._outcomeReelPicture[pos]) + " > " + _hcmn_.Std.string(stoppedPicture) + " > " + (resultOK ? "OK" : "ERROR");
            if (resultOK) console.log(msg);
            else console.log("%c" + msg, "color:white;background:red;");
            this.port.onReelStopped().publish(pos);
        };
        tripleRedHotSevensIXFReels.ReelComponent.prototype.onSpinStopped = function() {
            this.changeState(tripleRedHotSevensIXFReels.ReelComponentState.IDLE);
            var dur = _hcmn_.Std["int"](new _hcmn_.Date().getTime()) - this.spinStartTime;
            console.log("[mj] Spin stopped for " + dur + "ms");
            this.port.onSpinStopped().publish(null);
        };
        tripleRedHotSevensIXFReels.ReelComponent.prototype.handleSetReelPicture = function(e) {
            this.setReelPicturePayload = e.getPayload();
            if (!this.reelsInitialized) return;
            if (this.state != tripleRedHotSevensIXFReels.ReelComponentState.IDLE) {
                this.changeState(tripleRedHotSevensIXFReels.ReelComponentState.IDLE);
                var _g1 = 0;
                var _g = this.reels.length;
                while (_g1 < _g) {
                    var i = _g1++;
                    this.reels[i].animator.resetOnAbortEnd();
                }
            }
            this.forceReelPicture(this.setReelPicturePayload);
            this.setReelPicturePayload = null;
        };
        tripleRedHotSevensIXFReels.ReelComponent.prototype.forceReelPicture = function(pic) {
            this.view.cacheAsBitmap(false);
            var _g1 = 0;
            var _g = this.reels.length;
            while (_g1 < _g) {
                var i = _g1++;
                this.reels[i].animator.forceReelPicture(pic[i]);
            }
            this.view.sortBleed();
            this.view.cacheAsBitmap(true);
        };
        tripleRedHotSevensIXFReels.ReelComponent.prototype.handleSetReelSkin = function(e) {
            console.log("setReelSkin:" + e.getPayload());
            if (e.getPayload() > this.config.configs.length - 1) {
                console.log("[mj] setReelSkin error: reelSkin index out of bounds");
                return;
            }
            var _g1 = 0;
            var _g = this.reels.length;
            while (_g1 < _g) {
                var i = _g1++;
                var _reel = this.reels[i];
                var _g3 = 0;
                var _g2 = _reel.view.cells.length;
                while (_g3 < _g2) {
                    var j = _g3++;
                    _reel.view.cells[j].loadSkin(e.getPayload());
                }
            }
        };
        tripleRedHotSevensIXFReels.ReelComponent.prototype.handleSetReelCellsVisibility = function(e) {
            var visibility_info = e.getPayload();
            this.view.cacheAsBitmap(false);
            var _g1 = 0;
            var _g = this.reels.length;
            while (_g1 < _g) {
                var i = _g1++;
                var cells = this.reels[i].view.cells;
                var _g3 = 0;
                var _g2 = cells.length;
                while (_g3 < _g2) {
                    var j = _g3++;
                    var vis_info = visibility_info[i][j - 1];
                    if (vis_info != null && vis_info == 1) {
                        var cell = cells[j];
                        cell.displayObject.setVisible(false);
                        var block;
                        block = ((function($this) {
                            var $r;
                            var key = cell.getSymbolId();
                            $r = $this.config.symbolMap.get(key);
                            return $r;
                        }(this))).block;
                        if (block != null) {
                            var symbolInBlock;
                            symbolInBlock = (function($this) {
                                var $r;
                                var x = cell.getSymbolId();
                                $r = _hcmn_.HxOverrides.lastIndexOf(block, x, block.length - 1);
                                return $r;
                            }(this)) + 1;
                            var m = j + 1;
                            while (symbolInBlock < block.length && cells[m] != null) {
                                cells[m].displayObject.setVisible(false);
                                m++;
                                symbolInBlock++;
                            }
                        }
                    }
                }
            }
            this.view.cacheAsBitmap(true);
        };
        tripleRedHotSevensIXFReels.ReelComponent.prototype.changeState = function(state) {
            this.state = state;
            if (state == tripleRedHotSevensIXFReels.ReelComponentState.IDLE) this.view.cacheAsBitmap(true);
            else this.view.cacheAsBitmap(false);
        };
        tripleRedHotSevensIXFReels.ReelComponent.prototype.__class__ = tripleRedHotSevensIXFReels.ReelComponent;
        tripleRedHotSevensIXFReels.ReelFactory = function(vbf) {
            this.vbf = vbf;
        };
        tripleRedHotSevensIXFReels.ReelFactory = ck_implements(tripleRedHotSevensIXFReels.ReelFactory, clientkernelModulesApi.IService);
        tripleRedHotSevensIXFReels.ReelFactory = ck_implements(tripleRedHotSevensIXFReels.ReelFactory, componentmodelComponentApi.IComponentFactory);
        tripleRedHotSevensIXFReels.ReelFactory.__interfaces__ = [clientkernelModulesApi.IService, componentmodelComponentApi.IComponentFactory];
        tripleRedHotSevensIXFReels.ReelFactory.__name__ = ["tripleRedHotSevensIXFReels", "ReelFactory"];
        tripleRedHotSevensIXFReels.ReelFactory.prototype.vbf = null;
        tripleRedHotSevensIXFReels.ReelFactory.prototype.getComponentDeclaration = function() {
            return tripleRedHotSevensIXFReelsApi.ReelsDeclaration;
        };
        tripleRedHotSevensIXFReels.ReelFactory.prototype.createComponent = function(context) {
            new tripleRedHotSevensIXFReels.ReelComponent(context, this.vbf);
        };
        tripleRedHotSevensIXFReels.ReelFactory.prototype.__class__ = tripleRedHotSevensIXFReels.ReelFactory;
        tripleRedHotSevensIXFReels.ReelPicture = function() {
            this.offset = 0;
            this.cells = [];
        };
        tripleRedHotSevensIXFReels.ReelPicture.__name__ = ["tripleRedHotSevensIXFReels", "ReelPicture"];
        tripleRedHotSevensIXFReels.ReelPicture.prototype.cells = null;
        tripleRedHotSevensIXFReels.ReelPicture.prototype.offset = null;
        tripleRedHotSevensIXFReels.ReelPicture.prototype.toString = function() {
            return _hcmn_.Std.string(this.cells) + ":" + this.offset;
        };
        tripleRedHotSevensIXFReels.ReelPicture.prototype.__class__ = tripleRedHotSevensIXFReels.ReelPicture;
        tripleRedHotSevensIXFReels.ReelsConfig = function() {
            this.bleedOffscreen = true;
            this.reelOffscreen = true;
        };
        tripleRedHotSevensIXFReels.ReelsConfig.__name__ = ["tripleRedHotSevensIXFReels", "ReelsConfig"];
        tripleRedHotSevensIXFReels.ReelsConfig.prototype.configs = null;
        tripleRedHotSevensIXFReels.ReelsConfig.prototype.defaultReelConfig = null;
        tripleRedHotSevensIXFReels.ReelsConfig.prototype.reels = null;
        tripleRedHotSevensIXFReels.ReelsConfig.prototype.symbolMap = null;
        tripleRedHotSevensIXFReels.ReelsConfig.prototype.nonBlockSymbols = null;
        tripleRedHotSevensIXFReels.ReelsConfig.prototype.blankSymbol = null;
        tripleRedHotSevensIXFReels.ReelsConfig.prototype.boundsWidth = null;
        tripleRedHotSevensIXFReels.ReelsConfig.prototype.boundsHeight = null;
        tripleRedHotSevensIXFReels.ReelsConfig.prototype.stopTensionInSameTime = null;
        tripleRedHotSevensIXFReels.ReelsConfig.prototype.viewBuilder = null;
        tripleRedHotSevensIXFReels.ReelsConfig.prototype.inGameRPSize = null;
        tripleRedHotSevensIXFReels.ReelsConfig.prototype.bleedOn = null;
        tripleRedHotSevensIXFReels.ReelsConfig.prototype.reelOffscreen = null;
        tripleRedHotSevensIXFReels.ReelsConfig.prototype.bleedOffscreen = null;
        tripleRedHotSevensIXFReels.ReelsConfig.prototype.marginWidth = null;
        tripleRedHotSevensIXFReels.ReelsConfig.prototype.cascadingReels = null;
        tripleRedHotSevensIXFReels.ReelsConfig.prototype.bleedSortOrder = null;
        tripleRedHotSevensIXFReels.ReelsConfig.create = function(data) {
            var cfg = data;
            if (cfg.bleedSortOrder == null) cfg.bleedSortOrder = [1, 1];
            return cfg;
        };
        tripleRedHotSevensIXFReels.ReelsConfig.prototype.__class__ = tripleRedHotSevensIXFReels.ReelsConfig;
        tripleRedHotSevensIXFReels.ReelComponentState = {
            __ename__: ["tripleRedHotSevensIXFReels", "ReelComponentState"],
            __constructs__: ["IDLE", "SPINNING", "STOPPING"]
        };
        tripleRedHotSevensIXFReels.ReelComponentState.IDLE = ["IDLE", 0];
        tripleRedHotSevensIXFReels.ReelComponentState.IDLE.toString = $estr;
        tripleRedHotSevensIXFReels.ReelComponentState.IDLE.__enum__ = tripleRedHotSevensIXFReels.ReelComponentState;
        tripleRedHotSevensIXFReels.ReelComponentState.SPINNING = ["SPINNING", 1];
        tripleRedHotSevensIXFReels.ReelComponentState.SPINNING.toString = $estr;
        tripleRedHotSevensIXFReels.ReelComponentState.SPINNING.__enum__ = tripleRedHotSevensIXFReels.ReelComponentState;
        tripleRedHotSevensIXFReels.ReelComponentState.STOPPING = ["STOPPING", 2];
        tripleRedHotSevensIXFReels.ReelComponentState.STOPPING.toString = $estr;
        tripleRedHotSevensIXFReels.ReelComponentState.STOPPING.__enum__ = tripleRedHotSevensIXFReels.ReelComponentState;
        tripleRedHotSevensIXFReels.ReelState = {
            __ename__: ["tripleRedHotSevensIXFReels", "ReelState"],
            __constructs__: ["IDLE", "STARTING", "SPINNING", "STOPPING", "TENSION", "SLOWING"]
        };
        tripleRedHotSevensIXFReels.ReelState.SLOWING = ["SLOWING", 5];
        tripleRedHotSevensIXFReels.ReelState.SLOWING.toString = $estr;
        tripleRedHotSevensIXFReels.ReelState.SLOWING.__enum__ = tripleRedHotSevensIXFReels.ReelState;
        tripleRedHotSevensIXFReels.ReelState.IDLE = ["IDLE", 0];
        tripleRedHotSevensIXFReels.ReelState.IDLE.toString = $estr;
        tripleRedHotSevensIXFReels.ReelState.IDLE.__enum__ = tripleRedHotSevensIXFReels.ReelState;
        tripleRedHotSevensIXFReels.ReelState.STARTING = ["STARTING", 1];
        tripleRedHotSevensIXFReels.ReelState.STARTING.toString = $estr;
        tripleRedHotSevensIXFReels.ReelState.STARTING.__enum__ = tripleRedHotSevensIXFReels.ReelState;
        tripleRedHotSevensIXFReels.ReelState.SPINNING = ["SPINNING", 2];
        tripleRedHotSevensIXFReels.ReelState.SPINNING.toString = $estr;
        tripleRedHotSevensIXFReels.ReelState.SPINNING.__enum__ = tripleRedHotSevensIXFReels.ReelState;
        tripleRedHotSevensIXFReels.ReelState.STOPPING = ["STOPPING", 3];
        tripleRedHotSevensIXFReels.ReelState.STOPPING.toString = $estr;
        tripleRedHotSevensIXFReels.ReelState.STOPPING.__enum__ = tripleRedHotSevensIXFReels.ReelState;
        tripleRedHotSevensIXFReels.ReelState.TENSION = ["TENSION", 4];
        tripleRedHotSevensIXFReels.ReelState.TENSION.toString = $estr;
        tripleRedHotSevensIXFReels.ReelState.TENSION.__enum__ = tripleRedHotSevensIXFReels.ReelState;
        tripleRedHotSevensIXFReels.ReelRegistryModel = function(context) {
            tripleRedHotSevensIXFReels.ReelRegistryModel.reelsRegistryService = _hcmn_.js_Boot.__cast(context.getAnyService(reelsApi.IReelsRegistryService), reelsApi.IReelsRegistryService);
        };
        tripleRedHotSevensIXFReels.ReelRegistryModel.__name__ = ["tripleRedHotSevensIXFReels", "ReelRegistryModel"];
        tripleRedHotSevensIXFReels.ReelRegistryModel.reelsRegistryService = null;
        tripleRedHotSevensIXFReels.ReelRegistryModel.prototype.__class__ = tripleRedHotSevensIXFReels.ReelRegistryModel;
        tripleRedHotSevensIXFReels.ReelsRegistryService = function() {
            this.reelsMap = new _hcmn_.haxe_ds_StringMap();
            this.cellsOnReel = [];
        };
        tripleRedHotSevensIXFReels.ReelsRegistryService = ck_implements(tripleRedHotSevensIXFReels.ReelsRegistryService, clientkernelModulesApi.IService);
        tripleRedHotSevensIXFReels.ReelsRegistryService = ck_implements(tripleRedHotSevensIXFReels.ReelsRegistryService, reelsApi.IReelsRegistryService);
        tripleRedHotSevensIXFReels.ReelsRegistryService.__interfaces__ = [clientkernelModulesApi.IService, reelsApi.IReelsRegistryService];
        tripleRedHotSevensIXFReels.ReelsRegistryService.__name__ = ["tripleRedHotSevensIXFReels", "ReelsRegistryService"];
        tripleRedHotSevensIXFReels.ReelsRegistryService.prototype.reelsMap = null;
        tripleRedHotSevensIXFReels.ReelsRegistryService.prototype.cellsOnReel = null;
        tripleRedHotSevensIXFReels.ReelsRegistryService.prototype.setCellsOnReel = function(cells, column) {
            this.cellsOnReel[column] = cells;
        };
        tripleRedHotSevensIXFReels.ReelsRegistryService.prototype.getCellSymbolId = function(row, column) {
            return this.cellsOnReel[row][column];
        };
        tripleRedHotSevensIXFReels.ReelsRegistryService.prototype.getPositionOnReel = function(row, column) {
            var id = "R_" + column + "_C" + row;
            return this.reelsMap.get(id);
        };
        tripleRedHotSevensIXFReels.ReelsRegistryService.prototype.setPositionOnReel = function(key, value) {
            this.reelsMap.set(key, value);
        };
        tripleRedHotSevensIXFReels.ReelsRegistryService.prototype.getReelPicture = function() {
            return this.cellsOnReel;
        };
        tripleRedHotSevensIXFReels.ReelsRegistryService.prototype.__class__ = tripleRedHotSevensIXFReels.ReelsRegistryService;
        tripleRedHotSevensIXFReels.Cell = function(config) {
            this.visible_symbol_name = "";
            this.visible_symbol_id = "";
            this.config = config;
            this.displayObject = tripleRedHotSevensIXFReels.ExternalService.displayProvider.getFactory().createDisplayObjectContainer();
            this.loadSkin(0);
        };
        tripleRedHotSevensIXFReels.Cell.__name__ = ["tripleRedHotSevensIXFReels", "Cell"];
        tripleRedHotSevensIXFReels.Cell.prototype.displayObject = null;
        tripleRedHotSevensIXFReels.Cell.prototype.initialY = null;
        tripleRedHotSevensIXFReels.Cell.prototype.visible_symbol_id = null;
        tripleRedHotSevensIXFReels.Cell.prototype.visible_symbol_name = null;
        tripleRedHotSevensIXFReels.Cell.prototype.symbols = null;
        tripleRedHotSevensIXFReels.Cell.prototype.config = null;
        tripleRedHotSevensIXFReels.Cell.prototype.vbCont = null;
        tripleRedHotSevensIXFReels.Cell.prototype.loadSkin = function(id) {
            this.vbCont = this.config.viewBuilder[id];
            this.visible_symbol_name = "";
            this.visible_symbol_id = "";
            this.loadSymbols();
        };
        tripleRedHotSevensIXFReels.Cell.prototype.loadSymbols = function() {
            this.displayObject.removeChildren();
            this.symbols = new _hcmn_.haxe_ds_StringMap();
            var _disp;
            var $it0 = this.config.symbolMap.keys();
            while ($it0.hasNext()) {
                var id = $it0.next();
                var symbol_map_id = this.config.symbolMap.get(id).asset;
                if (!this.symbols.exists(symbol_map_id)) {
                    var _vbCont = this.vbCont.createContainerFromStoredConfig(symbol_map_id);
                    var innerBmp = _vbCont.getComponentById("innerBmp");
                    if (innerBmp != null) _disp = innerBmp.getDisplayObject();
                    else _disp = _vbCont.getDisplayObject();
                    _disp.setX(0);
                    _disp.setY(0);
                    _disp.setName(symbol_map_id);
                    _disp.setVisible(false);
                    this.symbols.set(symbol_map_id, _disp);
                    this.displayObject.addChild(_disp);
                }
            }
        };
        tripleRedHotSevensIXFReels.Cell.prototype.setSymbol = function(id) {
            if (id == null) return;
            var symbolDef = this.config.symbolMap.get(id);
            var symbol_name = symbolDef.asset;
            if (this.visible_symbol_name == symbol_name) return;
            if (this.visible_symbol_name != "") this.symbols.get(this.visible_symbol_name).setVisible(false);
            this.visible_symbol_name = symbol_name;
            this.visible_symbol_id = id;
            this.symbols.get(this.visible_symbol_name).setVisible(true);
        };
        tripleRedHotSevensIXFReels.Cell.prototype.getSymbolId = function() {
            return this.visible_symbol_id;
        };
        tripleRedHotSevensIXFReels.Cell.prototype.__class__ = tripleRedHotSevensIXFReels.Cell;
        tripleRedHotSevensIXFReels.CubicSpline = function(points, cellHeight) {
            this.xs = [];
            this.ys = [];
            this.total_time = 0;
            var _g1 = 0;
            var _g = points.length;
            while (_g1 < _g) {
                var p = _g1++;
                var point = points[p].split(":");
                this.ys.push(parseFloat(point[0]));
                var xt = _hcmn_.Std.parseInt(point[1]);
                this.total_time += xt;
                this.xs.push(this.total_time);
            }
            this.ks = [];
            this.getNaturalKs();
            this.ks[0] = 0;
            this.ks[this.xs.length - 1] = 0;
            this.map = new _hcmn_.haxe_ds_IntMap();
            this.function_graph = tripleRedHotSevensIXFReels.ExternalService.displayProvider.getFactory().createSprite();
            this.function_graph.setY(500);
            var graphics = this.function_graph.getGraphics();
            graphics.moveTo(0, 0);
            graphics.lineStyle(1, 16711680, 1);
            var _g11 = 0;
            var _g2 = this.total_time + 1;
            while (_g11 < _g2) {
                var t = _g11++;
                var sp = this.evalSpline(t);
                var dist = sp * cellHeight * 0.001;
                this.distance += dist;
                this.map.h[t] = this.distance;
                graphics.lineTo(t, -sp * 10);
            }
        };
        tripleRedHotSevensIXFReels.CubicSpline.__name__ = ["tripleRedHotSevensIXFReels", "CubicSpline"];
        tripleRedHotSevensIXFReels.CubicSpline.prototype.xs = null;
        tripleRedHotSevensIXFReels.CubicSpline.prototype.ys = null;
        tripleRedHotSevensIXFReels.CubicSpline.prototype.ks = null;
        tripleRedHotSevensIXFReels.CubicSpline.prototype.map = null;
        tripleRedHotSevensIXFReels.CubicSpline.prototype.function_graph = null;
        tripleRedHotSevensIXFReels.CubicSpline.prototype.total_time = null;
        tripleRedHotSevensIXFReels.CubicSpline.prototype.distance = null;
        tripleRedHotSevensIXFReels.CubicSpline.prototype.solve = function(A) {
            var m = A.length;
            var _g = 0;
            while (_g < m) {
                var k = _g++;
                var i_max = 0;
                var vali = -Infinity;
                var _g1 = k;
                while (_g1 < m) {
                    var i1 = _g1++;
                    if (A[i1][k] > vali) {
                        i_max = i1;
                        vali = A[i1][k];
                    }
                }
                this.swapRows(A, k, i_max);
                if (A[i_max][k] == 0) console.log("matrix is singular!");
                var _g11 = k + 1;
                while (_g11 < m) {
                    var i2 = _g11++;
                    var _g3 = k + 1;
                    var _g2 = m + 1;
                    while (_g3 < _g2) {
                        var j = _g3++;
                        A[i2][j] = A[i2][j] - A[k][j] * (A[i2][k] / A[k][k]);
                    }
                    A[i2][k] = 0;
                }
            }
            var i = m - 1;
            while (i >= 0) {
                var v = A[i][m] / A[i][i];
                this.ks[i] = v;
                var j1 = i - 1;
                while (j1 >= 0) {
                    A[j1][m] -= A[j1][i] * v;
                    A[j1][i] = 0;
                    j1--;
                }
                i--;
            }
        };
        tripleRedHotSevensIXFReels.CubicSpline.prototype.zerosMat = function(r, c) {
            var A = [];
            var _g = 0;
            while (_g < r) {
                var i = _g++;
                A.push([]);
                var _g1 = 0;
                while (_g1 < c) {
                    var j = _g1++;
                    A[i].push(0);
                }
            }
            return A;
        };
        tripleRedHotSevensIXFReels.CubicSpline.prototype.swapRows = function(m, k, l) {
            var p = m[k];
            m[k] = m[l];
            m[l] = p;
        };
        tripleRedHotSevensIXFReels.CubicSpline.prototype.getNaturalKs = function() {
            var n = this.xs.length - 1;
            var A = this.zerosMat(n + 1, n + 2);
            var _g = 1;
            while (_g < n) {
                var i = _g++;
                A[i][i - 1] = 1 / (this.xs[i] - this.xs[i - 1]);
                A[i][i] = 2 * (1 / (this.xs[i] - this.xs[i - 1]) + 1 / (this.xs[i + 1] - this.xs[i]));
                A[i][i + 1] = 1 / (this.xs[i + 1] - this.xs[i]);
                A[i][n + 1] = 3 * ((this.ys[i] - this.ys[i - 1]) / ((this.xs[i] - this.xs[i - 1]) * (this.xs[i] - this.xs[i - 1])) + (this.ys[i + 1] - this.ys[i]) / ((this.xs[i + 1] - this.xs[i]) * (this.xs[i + 1] - this.xs[i])));
            }
            A[0][0] = 2 / (this.xs[1] - this.xs[0]);
            A[0][1] = 1 / (this.xs[1] - this.xs[0]);
            A[0][n + 1] = 3 * (this.ys[1] - this.ys[0]) / ((this.xs[1] - this.xs[0]) * (this.xs[1] - this.xs[0]));
            A[n][n - 1] = 1 / (this.xs[n] - this.xs[n - 1]);
            A[n][n] = 2 / (this.xs[n] - this.xs[n - 1]);
            A[n][n + 1] = 3 * (this.ys[n] - this.ys[n - 1]) / ((this.xs[n] - this.xs[n - 1]) * (this.xs[n] - this.xs[n - 1]));
            this.solve(A);
        };
        tripleRedHotSevensIXFReels.CubicSpline.prototype.evalSpline = function(x) {
            var i = 1;
            while (this.xs[i] < x) i++;
            var t = (x - this.xs[i - 1]) / (this.xs[i] - this.xs[i - 1]);
            var a = this.ks[i - 1] * (this.xs[i] - this.xs[i - 1]) - (this.ys[i] - this.ys[i - 1]);
            var b = -this.ks[i] * (this.xs[i] - this.xs[i - 1]) + (this.ys[i] - this.ys[i - 1]);
            var q = (1 - t) * this.ys[i - 1] + t * this.ys[i] + t * (1 - t) * (a * (1 - t) + b * t);
            return q;
        };
        tripleRedHotSevensIXFReels.CubicSpline.prototype.__class__ = tripleRedHotSevensIXFReels.CubicSpline;
        tripleRedHotSevensIXFReels.ReelComponentView = function(config) {
            this.bleedSortFlag = false;
            this.addedToStage = false;
            this.BLEED_LAYER = "layout_top";
            this.SYMBOLS_LAYER = "layout";
            if (config.reelOffscreen == null) {
                if (window.location.search.indexOf("rof=true") != -1) config.reelOffscreen = true;
                if (window.location.search.indexOf("bof=true") != -1) config.bleedOffscreen = true;
            }
            if (config.marginWidth == null) config.marginWidth = 60;
            this.config = config;
            this.displayObject = tripleRedHotSevensIXFReels.ExternalService.displayProvider.getFactory().createDisplayObjectContainer();
            this.displayObject.setName("layout");
            this.displayObjectBleed = tripleRedHotSevensIXFReels.ExternalService.displayProvider.getFactory().createDisplayObjectContainer();
            this.displayObjectBleed.setName("bleed");
            if (config.reelOffscreen) {
                this.layoutOS = tripleRedHotSevensIXFReels.ExternalService.displayProvider.getFactory().createOffscreenStage(config.boundsWidth, config.boundsHeight);
                this.layoutBmp = tripleRedHotSevensIXFReels.ExternalService.displayProvider.getFactory().createBitmap(this.layoutOS);
                this.layoutBmp.setName("bmpLayout");
                this.displayObject.addChild(this.layoutBmp);
                this.layoutOSTimingMode = this.layoutOS.getStage().getTimingMode();
            } else {
                var m1 = tripleRedHotSevensIXFReels.ExternalService.displayProvider.getFactory().createGraphics();
                if (config.cascadingReels) this.drawCascadingMask(m1, config.reels);
                else m1.beginFill(16711680).drawRect(0, 0, config.boundsWidth, config.boundsHeight);
                this.displayObject.setMask(m1);
            }
            if (config.bleedOffscreen) {
                this.bleedOS = tripleRedHotSevensIXFReels.ExternalService.displayProvider.getFactory().createOffscreenStage(config.boundsWidth + config.marginWidth, config.boundsHeight);
                this.bleedBmp = tripleRedHotSevensIXFReels.ExternalService.displayProvider.getFactory().createBitmap(this.bleedOS);
                this.bleedBmp.setName("bmpBleed");
                this.displayObjectBleed.addChild(this.bleedBmp);
            } else {
                var m2 = tripleRedHotSevensIXFReels.ExternalService.displayProvider.getFactory().createGraphics();
                if (config.cascadingReels) this.drawCascadingMask(m2, config.reels);
                else {
                    m2.setX(-config.marginWidth / 2);
                    m2.beginFill(16711680).drawRect(0, 0, config.boundsWidth + config.marginWidth, config.boundsHeight);
                }
                this.displayObjectBleed.setMask(m2);
            }
        };
        tripleRedHotSevensIXFReels.ReelComponentView.__name__ = ["tripleRedHotSevensIXFReels", "ReelComponentView"];
        tripleRedHotSevensIXFReels.ReelComponentView.prototype.SYMBOLS_LAYER = null;
        tripleRedHotSevensIXFReels.ReelComponentView.prototype.BLEED_LAYER = null;
        tripleRedHotSevensIXFReels.ReelComponentView.prototype.displayObjectsMap = null;
        tripleRedHotSevensIXFReels.ReelComponentView.prototype.displayObject = null;
        tripleRedHotSevensIXFReels.ReelComponentView.prototype.displayObjectBleed = null;
        tripleRedHotSevensIXFReels.ReelComponentView.prototype.layoutOS = null;
        tripleRedHotSevensIXFReels.ReelComponentView.prototype.bleedOS = null;
        tripleRedHotSevensIXFReels.ReelComponentView.prototype.layoutBmp = null;
        tripleRedHotSevensIXFReels.ReelComponentView.prototype.bleedBmp = null;
        tripleRedHotSevensIXFReels.ReelComponentView.prototype.layoutOSTimingMode = null;
        tripleRedHotSevensIXFReels.ReelComponentView.prototype.layout_containers = null;
        tripleRedHotSevensIXFReels.ReelComponentView.prototype.display_objects = null;
        tripleRedHotSevensIXFReels.ReelComponentView.prototype.reels = null;
        tripleRedHotSevensIXFReels.ReelComponentView.prototype.config = null;
        tripleRedHotSevensIXFReels.ReelComponentView.prototype.addedToStage = null;
        tripleRedHotSevensIXFReels.ReelComponentView.prototype.bleedSortFlag = null;
        tripleRedHotSevensIXFReels.ReelComponentView.prototype.drawCascadingMask = function(m1, reelsDefinitions) {
            m1.beginFill(16711680);
            var _g1 = 0;
            var _g = reelsDefinitions.length;
            while (_g1 < _g) {
                var i = _g1++;
                var x = 0;
                var _g2 = 0;
                while (_g2 < i) {
                    var j = _g2++;
                    x += reelsDefinitions[j].cellWidth + reelsDefinitions[j].leftMargin;
                }
                var y = reelsDefinitions[i].yOffset * reelsDefinitions[i].cellHeight;
                m1.drawRect(x, y, reelsDefinitions[i].cellWidth, reelsDefinitions[i].cellsNum * reelsDefinitions[i].cellHeight);
            }
        };
        tripleRedHotSevensIXFReels.ReelComponentView.prototype.addReel = function(reel) {
            var _g = 0;
            var _g1 = reel.view.cells;
            while (_g < _g1.length) {
                var c = _g1[_g];
                ++_g;
                if (this.config.reelOffscreen) this.layoutOS.getStage().addChildAt(c.displayObject, this.layoutOS.getStage().getNumChildren() - 1);
                else this.displayObject.addChildAt(c.displayObject, this.displayObject.getNumChildren() - 1);
            }
        };
        tripleRedHotSevensIXFReels.ReelComponentView.prototype.onLayoutUpdate = function(layoutPayload) {
            this.layout_containers = layoutPayload.containers;
            var layoutContainer = this.layout_containers.get("layout");
            var layoutContainerTop = this.layout_containers.get("layout_top");
            if (!this.addedToStage) {
                ((function($this) {
                    var $r;
                    var this1 = tripleRedHotSevensIXFReels.ExternalService.displayProvider.getStages();
                    $r = this1.get(layoutContainer.stage);
                    return $r;
                }(this))).addChild(this.displayObject);
                ((function($this) {
                    var $r;
                    var this2 = tripleRedHotSevensIXFReels.ExternalService.displayProvider.getStages();
                    $r = this2.get(layoutContainerTop.stage);
                    return $r;
                }(this))).addChild(this.displayObjectBleed);
                this.addedToStage = true;
            }
            var scaleX = layoutContainer.width / this.config.boundsWidth;
            var scaleY = layoutContainer.height / this.config.boundsHeight;
            this.displayObject.setScaleX(scaleX);
            this.displayObject.setScaleY(scaleY);
            this.displayObject.setX(layoutContainer.left);
            this.displayObject.setY(layoutContainer.top);
            this.displayObject.setZIndex(layoutContainer.zIndex);
            this.displayObjectBleed.setScaleX(scaleX);
            this.displayObjectBleed.setScaleY(scaleY);
            this.displayObjectBleed.setX(layoutContainerTop.left);
            this.displayObjectBleed.setY(layoutContainerTop.top);
            this.displayObjectBleed.setZIndex(layoutContainerTop.zIndex);
        };
        tripleRedHotSevensIXFReels.ReelComponentView.prototype.cacheAsBitmap = function(value) {
            if (this.config.reelOffscreen) {
                if (value) this.layoutOS.getStage().setTimingMode(displayEngineApi.TimingMode.ONCE);
                else this.layoutOS.getStage().setTimingMode(this.layoutOSTimingMode);
            } else {
                var iOS = eval("/iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream");
                if (!iOS) this.displayObject.setCacheAsBitmap(value);
            }
        };
        tripleRedHotSevensIXFReels.ReelComponentView.prototype.setVisible = function(value) {
            this.displayObject.setVisible(value);
            this.displayObjectBleed.setVisible(value);
        };
        tripleRedHotSevensIXFReels.ReelComponentView.prototype.addCellToBleedLayer = function(cell) {
            if (this.config.bleedOffscreen) this.bleedOS.getStage().addChildAt(cell, this.bleedOS.getStage().getNumChildren() - 1);
            else {
                this.displayObjectBleed.addChild(cell);
                this.bleedSortFlag = true;
            }
        };
        tripleRedHotSevensIXFReels.ReelComponentView.prototype.removeCellFromBleedLayer = function(cell) {
            if (this.config.reelOffscreen) this.layoutOS.getStage().addChildAt(cell, this.layoutOS.getStage().getNumChildren() - 1);
            else this.displayObject.addChild(cell);
        };
        tripleRedHotSevensIXFReels.ReelComponentView.prototype.sortBleed = function() {
            if (this.bleedSortFlag) {
                var cells = this.displayObjectBleed.getChildren();
                cells.sort($bind(this, this.cellSortFn));
                var _g1 = 0;
                var _g = cells.length;
                while (_g1 < _g) {
                    var i = _g1++;
                    cells[i].bringToTop();
                }
                this.bleedSortFlag = false;
            }
        };
        tripleRedHotSevensIXFReels.ReelComponentView.prototype.cellSortFn = function(a, b) {
            var sortOrder = this.config.bleedSortOrder;
            if (a.getX() == b.getX()) return _hcmn_.Math.round(a.getY() - b.getY()) * sortOrder[1];
            else return _hcmn_.Math.round(a.getX() - b.getX()) * sortOrder[0];
        };
        tripleRedHotSevensIXFReels.ReelComponentView.prototype.__class__ = tripleRedHotSevensIXFReels.ReelComponentView;
        tripleRedHotSevensIXFReels.ReelView = function(pos, config) {
            this.pos = pos;
            this.config = config;
            this.reel_config = config.reels[pos];
            this.cells = [];
            var _g1 = 0;
            var _g = config.inGameRPSize;
            while (_g1 < _g) {
                var i = _g1++;
                var _cell = new tripleRedHotSevensIXFReels.Cell(config);
                _cell.displayObject.setName("R_" + pos + "_C" + i);
                this.cells.push(_cell);
                var yOffset = 0;
                if (config.cascadingReels && config.reels[pos].yOffset != null) yOffset = config.reels[pos].yOffset * config.reels[pos].cellHeight;
                _cell.initialY = (this.reel_config.cellHeight * (i - 1) | 0) + yOffset;
                _cell.displayObject.setX(pos * (this.reel_config.cellWidth + this.reel_config.leftMargin));
                _cell.displayObject.setY(_cell.initialY);
                tripleRedHotSevensIXFReels.ReelRegistryModel.reelsRegistryService.setPositionOnReel("R_" + pos + "_C" + i, new reelsApi.CellPositionOnReel(_cell.displayObject.getX(), _cell.displayObject.getY()));
            }
        };
        tripleRedHotSevensIXFReels.ReelView.__name__ = ["tripleRedHotSevensIXFReels", "ReelView"];
        tripleRedHotSevensIXFReels.ReelView.prototype.cells = null;
        tripleRedHotSevensIXFReels.ReelView.prototype.reel_config = null;
        tripleRedHotSevensIXFReels.ReelView.prototype.config = null;
        tripleRedHotSevensIXFReels.ReelView.prototype.reelPicture = null;
        tripleRedHotSevensIXFReels.ReelView.prototype.pos = null;
        tripleRedHotSevensIXFReels.ReelView.prototype.setAllVisible = function() {
            this.update(this.reelPicture);
        };
        tripleRedHotSevensIXFReels.ReelView.prototype.update = function(reelPicture) {
            this.reelPicture = reelPicture;
            var rp_len = reelPicture.cells.length;
            tripleRedHotSevensIXFReels.ReelRegistryModel.reelsRegistryService.setCellsOnReel(reelPicture.cells, this.pos);
            var _g1 = 0;
            var _g = this.cells.length;
            while (_g1 < _g) {
                var i = _g1++;
                var cell = this.cells[i];
                cell.displayObject.setY(cell.initialY - reelPicture.offset);
                if (reelPicture.cells[i] == null) {
                    cell.displayObject.setVisible(false);
                    continue;
                }
                var symbol_id = reelPicture.cells[i];
                if (symbol_id != cell.getSymbolId()) {
                    cell.setSymbol(symbol_id);
                    this.setCellLayer(this.config.symbolMap.get(symbol_id).isBleed, cell.displayObject);
                }
                var showCell = true;
                var block = this.config.symbolMap.get(symbol_id).block;
                var stacked = this.isStacked(block);
                if (block != null && !stacked) {
                    var symbolInBlock = _hcmn_.HxOverrides.lastIndexOf(block, symbol_id, block.length - 1);
                    showCell = false;
                    if (symbolInBlock == block.length - 1) showCell = true;
                    else if (i + 1 == rp_len) showCell = true;
                } else if (i == 0) showCell = false;
                else if (i > this.reel_config.cellsNum) {
                    if (reelPicture.offset == 0) showCell = false;
                    else if (i - this.reel_config.cellsNum == 1) showCell = true;
                    else showCell = false;
                }
                cell.displayObject.setVisible(showCell);
            }
        };
        tripleRedHotSevensIXFReels.ReelView.prototype.isStacked = function(block) {
            if (block == null || block[0] == null) return false;
            var stackedSymbol = block[0];
            var _g = 0;
            while (_g < block.length) {
                var s = block[_g];
                ++_g;
                if (s != stackedSymbol) return false;
            }
            return true;
        };
        tripleRedHotSevensIXFReels.ReelView.prototype.setCellLayer = function(isBleed, cell) {
            if (isBleed) this.addCellToBleedLayer(cell);
            else this.removeCellFromBleedLayer(cell);
        };
        tripleRedHotSevensIXFReels.ReelView.prototype.addCellToBleedLayer = function(cell) {};
        tripleRedHotSevensIXFReels.ReelView.prototype.removeCellFromBleedLayer = function(cell) {};
        tripleRedHotSevensIXFReels.ReelView.prototype.__class__ = tripleRedHotSevensIXFReels.ReelView;
        if (typeof haxe == 'undefined') {
            var haxe = {};
        };

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

            get: function(k) {
                return {
                    arguments: ["*"],
                    returns: "null"
                };
            }
        };
        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;
        tripleRedHotSevensIXFReels.ExternalService.loadedAssets = [];;
        return {
            exports: tripleRedHotSevensIXFReels,
            activator: tripleRedHotSevensIXFReels.Activator
        };
    });