define("ballooniesIxfTumbleReels", ["viewBuilderApi", "componentmodelComponentApi", "clientkernelLoaderApi", "slotModelApi", "displayEngineApi", "clientkernelTestableApi", "gameLayoutApi", "BABYLON", "ballooniesIxfTumbleReelsApi", "clientkernelEventbusApi", "clientkernelModulesApi", "moneyApi"],
    function(viewBuilderApi, componentmodelComponentApi, clientkernelLoaderApi, slotModelApi, displayEngineApi, clientkernelTestableApi, gameLayoutApi, BABYLON, ballooniesIxfTumbleReelsApi, 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 ballooniesIxfTumbleReels == 'undefined') {
            var ballooniesIxfTumbleReels = {};
        };
        ballooniesIxfTumbleReels.Activator = function(context) {};
        ballooniesIxfTumbleReels.Activator = ck_implements(ballooniesIxfTumbleReels.Activator, clientkernelModulesApi.IModuleActivator);
        ballooniesIxfTumbleReels.Activator.__interfaces__ = [clientkernelModulesApi.IModuleActivator];
        ballooniesIxfTumbleReels.Activator.__name__ = ["ballooniesIxfTumbleReels", "Activator"];
        ballooniesIxfTumbleReels.Activator.prototype.start = function(context) {
            var interfaces = [displayEngineApi.IDisplayProvider, clientkernelTestableApi.ITestable, viewBuilderApi.IViewBuilderFactory];
            context.getServiceTracker(interfaces).then(function(context1) {
                ballooniesIxfTumbleReels.ExternalService.initialize(context1);
                var factory = new ballooniesIxfTumbleReels.TumbleReelsFactory(context1.getAnyService(viewBuilderApi.IViewBuilderFactory, null));
                context1.registerService(factory, ballooniesIxfTumbleReelsApi.TumbleReelsDeclaration, null);
            });
        };
        ballooniesIxfTumbleReels.Activator.prototype.stop = function(context) {};
        ballooniesIxfTumbleReels.Activator.main = function() {};
        ballooniesIxfTumbleReels.Activator.prototype.__class__ = ballooniesIxfTumbleReels.Activator;
        ballooniesIxfTumbleReels.Bounce = function(enterSpd, bounceDuration, displacement) {
            this.enterSpd = enterSpd;
            this.duration2 = bounceDuration;
            this.duration1 = displacement / enterSpd;
            this.duration = this.duration1 + this.duration2 | 0;
            this.displacement = displacement;
        };
        ballooniesIxfTumbleReels.Bounce.__name__ = ["ballooniesIxfTumbleReels", "Bounce"];
        ballooniesIxfTumbleReels.Bounce.prototype.duration = null;
        ballooniesIxfTumbleReels.Bounce.prototype.displacement = null;
        ballooniesIxfTumbleReels.Bounce.prototype.duration1 = null;
        ballooniesIxfTumbleReels.Bounce.prototype.duration2 = null;
        ballooniesIxfTumbleReels.Bounce.prototype.enterSpd = null;
        ballooniesIxfTumbleReels.Bounce.prototype.getDistance = function(time) {
            if (time < this.duration1) return this.enterSpd * time;
            else {
                var t = time - this.duration1;
                if (t < this.duration2) return this.easeOutBounce(t, this.displacement, -this.displacement, this.duration2 | 0);
                else return 0;
            }
        };
        ballooniesIxfTumbleReels.Bounce.prototype.easeOutBounce = function(t, b, c, d) {
            if ((t /= d) < 0.363636363636363646) return c * (7.5625 * t * t) + b;
            else if (t < 0.727272727272727293) return c * (7.5625 * (t -= 0.545454545454545414) * t + 0.75) + b;
            else if (t < 0.909090909090909061) return c * (7.5625 * (t -= 0.818181818181818232) * t + 0.9375) + b;
            return c * (7.5625 * (t -= 0.954545454545454586) * t + 0.984375) + b;
        };
        ballooniesIxfTumbleReels.Bounce.prototype.__class__ = ballooniesIxfTumbleReels.Bounce;
        ballooniesIxfTumbleReels.ExternalService = function() {};
        ballooniesIxfTumbleReels.ExternalService.__name__ = ["ballooniesIxfTumbleReels", "ExternalService"];
        ballooniesIxfTumbleReels.ExternalService.displayProvider = null;
        ballooniesIxfTumbleReels.ExternalService.assetRegistry = null;
        ballooniesIxfTumbleReels.ExternalService.testableLogger = null;
        ballooniesIxfTumbleReels.ExternalService.initialize = function(context) {
            ballooniesIxfTumbleReels.ExternalService.displayProvider = context.getAnyService(displayEngineApi.IDisplayProvider, null);
            ballooniesIxfTumbleReels.ExternalService.assetRegistry = context.getAnyService(clientkernelLoaderApi.IAssetRegistry, null);
            var testable = context.getAnyService(clientkernelTestableApi.ITestable, null);
            ballooniesIxfTumbleReels.ExternalService.testableLogger = testable.getLogger(context);
        };
        ballooniesIxfTumbleReels.ExternalService.loadConfig = function(configId, configCallback) {
            ballooniesIxfTumbleReels.ExternalService.assetRegistry.getAsset(configId).getContent().then(function(data) {
                configCallback(data);
            });
        };
        ballooniesIxfTumbleReels.ExternalService.prototype.__class__ = ballooniesIxfTumbleReels.ExternalService;
        ballooniesIxfTumbleReels.TumbleReel = function(pos, parent) {
            this.component = parent;
            this.pos = pos;
            this.view = new ballooniesIxfTumbleReels.TumbleReelsView(pos, parent.config);
            parent.view.addReel(this);
            this.state = ballooniesIxfTumbleReels.TumbleReelsState.IDLE;
            this.animator = new ballooniesIxfTumbleReels.TumbleReelsAnimator(this, parent.config);
        };
        ballooniesIxfTumbleReels.TumbleReel.__name__ = ["ballooniesIxfTumbleReels", "TumbleReel"];
        ballooniesIxfTumbleReels.TumbleReel.prototype.pos = null;
        ballooniesIxfTumbleReels.TumbleReel.prototype.view = null;
        ballooniesIxfTumbleReels.TumbleReel.prototype.animator = null;
        ballooniesIxfTumbleReels.TumbleReel.prototype.component = null;
        ballooniesIxfTumbleReels.TumbleReel.prototype.state = null;
        ballooniesIxfTumbleReels.TumbleReel.prototype.updateReel = function(currentTime) {
            if (this.state != ballooniesIxfTumbleReels.TumbleReelsState.IDLE) this.animator.updateReel(currentTime);
        };
        ballooniesIxfTumbleReels.TumbleReel.prototype.clearCells = function(cells) {
            this.animator.dropOutSymbols(cells);
        };
        ballooniesIxfTumbleReels.TumbleReel.prototype.dropInSymbols = function(targetPicture) {
            this.animator.dropInSymbols(targetPicture);
        };
        ballooniesIxfTumbleReels.TumbleReel.prototype.onReelStopped = function() {
            this.component.onReelStopped(this.pos);
        };
        ballooniesIxfTumbleReels.TumbleReel.prototype.onReelUp = function() {
            this.component.onReelUp(this.pos);
        };
        ballooniesIxfTumbleReels.TumbleReel.prototype.onSpinStopped = function() {
            this.component.onSpinStopped();
        };
        ballooniesIxfTumbleReels.TumbleReel.prototype.__class__ = ballooniesIxfTumbleReels.TumbleReel;
        ballooniesIxfTumbleReels.TumbleReelsAnimator = function(reel, config) {
            this.gaps = [];
            this.config = config;
            this.reel = reel;
            this.reelConfig = config.reels[reel.pos];
            this.defaultSpeedPxMs = this.reelConfig.defaultSpeed * this.reelConfig.cellHeight * 0.001;
            this.reelPicture = new ballooniesIxfTumbleReels.TumbleReelsPicture();
            this.bounceFn = new ballooniesIxfTumbleReels.Bounce(this.defaultSpeedPxMs, config.bounceDuration, config.bounceDist);
            this.calculateDropAllMovement();
            this.dropIn = new components.tumblereels.MovementParams(this.reelConfig.cellsNum, 0, 0);
        };
        ballooniesIxfTumbleReels.TumbleReelsAnimator.__name__ = ["ballooniesIxfTumbleReels", "TumbleReelsAnimator"];
        ballooniesIxfTumbleReels.TumbleReelsAnimator.prototype.reelPicture = null;
        ballooniesIxfTumbleReels.TumbleReelsAnimator.prototype.reel = null;
        ballooniesIxfTumbleReels.TumbleReelsAnimator.prototype.config = null;
        ballooniesIxfTumbleReels.TumbleReelsAnimator.prototype.reelConfig = null;
        ballooniesIxfTumbleReels.TumbleReelsAnimator.prototype.defaultSpeedPxMs = null;
        ballooniesIxfTumbleReels.TumbleReelsAnimator.prototype.bounceFn = null;
        ballooniesIxfTumbleReels.TumbleReelsAnimator.prototype.gaps = null;
        ballooniesIxfTumbleReels.TumbleReelsAnimator.prototype.dropIn = null;
        ballooniesIxfTumbleReels.TumbleReelsAnimator.prototype.dropAll = null;
        ballooniesIxfTumbleReels.TumbleReelsAnimator.prototype.startTimeStamp = null;
        ballooniesIxfTumbleReels.TumbleReelsAnimator.prototype.moveDuration = null;
        ballooniesIxfTumbleReels.TumbleReelsAnimator.prototype.forceReelPicture = function(picture) {
            this.reelPicture.symbols = picture.slice();
            var _g = [];
            var _g2 = 0;
            var _g1 = picture.length;
            while (_g2 < _g1) {
                var i = _g2++;
                _g.push(0);
            }
            this.reelPicture.offsets = _g;
            this.reel.view.update(this.reelPicture);
        };
        ballooniesIxfTumbleReels.TumbleReelsAnimator.prototype.clearReelPicture = function() {
            var _g = [];
            var _g2 = 0;
            var _g1 = this.reelConfig.cellsNum;
            while (_g2 < _g1) {
                var i = _g2++;
                _g.push(null);
            }
            this.reelPicture.symbols = _g;
            var _g11 = [];
            var _g3 = 0;
            var _g21 = this.reelConfig.cellsNum;
            while (_g3 < _g21) {
                var i1 = _g3++;
                _g11.push(0);
            }
            this.reelPicture.offsets = _g11;
        };
        ballooniesIxfTumbleReels.TumbleReelsAnimator.prototype.changeReelState = function(state) {
            this.reel.state = state;
        };
        ballooniesIxfTumbleReels.TumbleReelsAnimator.prototype.clear = function() {
            this.clearReelPicture();
            this.reel.view.update(this.reelPicture);
            this.changeReelState(ballooniesIxfTumbleReels.TumbleReelsState.CLEARED);
        };
        ballooniesIxfTumbleReels.TumbleReelsAnimator.prototype.stop = function(img) {
            this.reelPicture.symbols = img.slice();
            this.dropIn.dist = this.dropAll.dist.slice();
            this.dropIn.time = this.dropAll.time.slice();
            this.moveDuration = this.dropAll.getMaxTime();
            this.startTimeStamp = new _hcmn_.Date().getTime();
            this.changeReelState(ballooniesIxfTumbleReels.TumbleReelsState.DROP_IN);
        };
        ballooniesIxfTumbleReels.TumbleReelsAnimator.prototype.dropOutSymbols = function(cellsToClear) {
            this.gaps = [];
            var _g1 = 0;
            var _g = this.reelConfig.cellsNum;
            while (_g1 < _g) {
                var i = _g1++;
                if (cellsToClear[i]) {
                    this.reelPicture.symbols[i] = null;
                    this.gaps.push(i);
                }
            }
            this.reel.view.update(this.reelPicture);
            return this.gaps.length > 0;
        };
        ballooniesIxfTumbleReels.TumbleReelsAnimator.prototype.dropInSymbols = function(targetImg) {
            if (this.gaps.length == 0) return;
            this.reelPicture.symbols = targetImg.slice();
            this.calculateFillingGaps();
            this.startTimeStamp = new _hcmn_.Date().getTime();
            this.changeReelState(ballooniesIxfTumbleReels.TumbleReelsState.DROP_IN);
        };
        ballooniesIxfTumbleReels.TumbleReelsAnimator.prototype.updateReel = function(currentTime) {
            if (this.reel.state == ballooniesIxfTumbleReels.TumbleReelsState.DROP_IN) {
                var elapsed = currentTime - this.startTimeStamp | 0;
                this.calculateOffsets(elapsed);
                this.reel.view.update(this.reelPicture);
                if (elapsed >= this.moveDuration) {
                    this.reel.onReelStopped();
                    this.changeReelState(ballooniesIxfTumbleReels.TumbleReelsState.IDLE);
                }
            }
        };
        ballooniesIxfTumbleReels.TumbleReelsAnimator.prototype.calculateOffsets = function(elapsed) {
            var deltaY;
            var _g1 = 0;
            var _g = this.reelConfig.cellsNum;
            while (_g1 < _g) {
                var i = _g1++;
                if (this.dropIn.dist[i] == 0.0) {
                    this.reelPicture.offsets[i] = 0;
                    continue;
                }
                if (elapsed > this.dropIn.time[i] - this.bounceFn.duration) {
                    deltaY = this.dropIn.dist[i] + this.bounceFn.getDistance(elapsed - this.dropIn.time[i] + this.config.bounceDuration);
                    if (this.dropIn.isIn[i] == true) {
                        this.reel.onReelUp();
                        this.dropIn.isIn[i] = false;
                    }
                } else {
                    deltaY = elapsed * this.defaultSpeedPxMs;
                    this.dropIn.isIn[i] = true;
                }
                this.reelPicture.offsets[i] = this.dropIn.dist[i] - deltaY;
            }
        };
        ballooniesIxfTumbleReels.TumbleReelsAnimator.prototype.getCellDelay = function(reelIndex, cellIndex, numVisibleSymb) {
            var delay = 0;
            if (numVisibleSymb > 0) {
                if (cellIndex >= numVisibleSymb) delay = this.getCellDelayRegular(reelIndex, cellIndex - numVisibleSymb);
            } else delay = this.getCellDelayRegular(reelIndex, cellIndex);
            return delay;
        };
        ballooniesIxfTumbleReels.TumbleReelsAnimator.prototype.getCellDelayRegular = function(reelIndex, cellIndex) {
            var del = reelIndex * this.reelConfig.reelStopDelay + cellIndex * this.reelConfig.cellStopDelay;
            return del;
        };
        ballooniesIxfTumbleReels.TumbleReelsAnimator.prototype.calculateTimeFromDist = function(dist) {
            var evenDist = dist - this.config.bounceDist;
            var evenTime = evenDist / this.defaultSpeedPxMs | 0;
            return evenTime + this.config.bounceDuration;
        };
        ballooniesIxfTumbleReels.TumbleReelsAnimator.prototype.calculateFillingGaps = function() {
            this.dropIn = new components.tumblereels.MovementParams(this.reelConfig.cellsNum, 0.0, 0);
            var numSymbolsVisible = this.reelConfig.cellsNum - this.gaps.length;
            var prevCellDist = 0.0;
            var _g1 = 0;
            var _g = this.reelConfig.cellsNum;
            while (_g1 < _g) {
                var i = _g1++;
                if (i < numSymbolsVisible) {
                    var _g2 = 0;
                    var _g3 = this.gaps;
                    while (_g2 < _g3.length) {
                        var g = _g3[_g2];
                        ++_g2;
                        if (g <= i) this.dropIn.dist[i] += this.reelConfig.cellHeight;
                    }
                } else {
                    this.dropIn.dist[i] = (this.reelConfig.cellsNum - i) * this.reelConfig.cellHeight;
                    if (i > 0 && this.dropIn.dist[i] < prevCellDist) this.dropIn.dist[i] = prevCellDist;
                }
                prevCellDist = this.dropIn.dist[i];
                if (this.dropIn.dist[i] == 0) continue;
                this.dropIn.dist[i] += this.defaultSpeedPxMs * this.getCellDelay(this.reel.pos, i, numSymbolsVisible);
                this.dropIn.time[i] = this.calculateTimeFromDist(this.dropIn.dist[i]);
            }
            this.moveDuration = this.dropIn.getMaxTime();
        };
        ballooniesIxfTumbleReels.TumbleReelsAnimator.prototype.calculateDropAllMovement = function() {
            var reelHeight = this.reelConfig.cellsNum * this.reelConfig.cellHeight;
            this.dropAll = new components.tumblereels.MovementParams(this.reelConfig.cellsNum, reelHeight, 0);
            var _g1 = 0;
            var _g = this.reelConfig.cellsNum;
            while (_g1 < _g) {
                var i = _g1++;
                this.dropAll.dist[i] += this.defaultSpeedPxMs * this.getCellDelayRegular(this.reel.pos, i);
                this.dropAll.time[i] = this.calculateTimeFromDist(this.dropAll.dist[i]);
            }
        };
        ballooniesIxfTumbleReels.TumbleReelsAnimator.prototype.__class__ = ballooniesIxfTumbleReels.TumbleReelsAnimator;
        if (typeof components == 'undefined') {
            var components = {};
        };
        if (!components.tumblereels) {
            components.tumblereels = {};
        };
        components.tumblereels.MovementParams = function(n, d, t) {
            var _g = [];
            var _g1 = 0;
            while (_g1 < n) {
                var i = _g1++;
                _g.push(t);
            }
            this.time = _g;
            var _g11 = [];
            var _g2 = 0;
            while (_g2 < n) {
                var i1 = _g2++;
                _g11.push(d);
            }
            this.dist = _g11;
            var _g21 = [];
            var _g3 = 0;
            while (_g3 < n) {
                var i2 = _g3++;
                _g21.push(true);
            }
            this.isIn = _g21;
        };
        components.tumblereels.MovementParams.__name__ = ["components", "tumblereels", "MovementParams"];
        components.tumblereels.MovementParams.prototype.dist = null;
        components.tumblereels.MovementParams.prototype.time = null;
        components.tumblereels.MovementParams.prototype.isIn = null;
        components.tumblereels.MovementParams.prototype.getMaxTime = function() {
            var max = 0;
            var _g = 0;
            var _g1 = this.time;
            while (_g < _g1.length) {
                var t = _g1[_g];
                ++_g;
                if (t > max) max = t;
            }
            return max;
        };
        components.tumblereels.MovementParams.prototype.__class__ = components.tumblereels.MovementParams;
        ballooniesIxfTumbleReels.TumbleReelsComponent = function(context, vbFactory) {
            this.reelsInitialized = false;
            this.reels = [];
            var _g = this;
            this.context = context;
            this.port = context.getImplementedPort(ballooniesIxfTumbleReelsApi.ITumbleReelsImplementationPort);
            this.slotModelPort = context.getUsedPort(slotModelApi.ISlotModelPort);
            this.layoutPort = context.getUsedPort(gameLayoutApi.IGameLayoutPort);
            this.vbFactory = vbFactory;
            this.subscribeToEvents();
            ballooniesIxfTumbleReels.ExternalService.assetRegistry.getAsset("tumble-reel-config").getContent().then(function(data) {
                _g.config = data;
                var _g1 = 0;
                var _g2 = _g.config.configs;
                while (_g1 < _g2.length) {
                    var asset = _g2[_g1];
                    ++_g1;
                    ballooniesIxfTumbleReels.ExternalService.assetRegistry.getAsset(asset).getContent().then(function(vb) {
                        ballooniesIxfTumbleReels.ExternalService.loadedAssets.push(vb);
                        _g.initialize();
                    });
                }
            });
        };
        ballooniesIxfTumbleReels.TumbleReelsComponent.__name__ = ["ballooniesIxfTumbleReels", "TumbleReelsComponent"];
        ballooniesIxfTumbleReels.TumbleReelsComponent.prototype.port = null;
        ballooniesIxfTumbleReels.TumbleReelsComponent.prototype.slotModelPort = null;
        ballooniesIxfTumbleReels.TumbleReelsComponent.prototype.layoutPort = null;
        ballooniesIxfTumbleReels.TumbleReelsComponent.prototype.state = null;
        ballooniesIxfTumbleReels.TumbleReelsComponent.prototype.config = null;
        ballooniesIxfTumbleReels.TumbleReelsComponent.prototype.view = null;
        ballooniesIxfTumbleReels.TumbleReelsComponent.prototype.context = null;
        ballooniesIxfTumbleReels.TumbleReelsComponent.prototype.vbFactory = null;
        ballooniesIxfTumbleReels.TumbleReelsComponent.prototype.stage = null;
        ballooniesIxfTumbleReels.TumbleReelsComponent.prototype.layoutPayload = null;
        ballooniesIxfTumbleReels.TumbleReelsComponent.prototype.reels = null;
        ballooniesIxfTumbleReels.TumbleReelsComponent.prototype.outcomeReelPicture = null;
        ballooniesIxfTumbleReels.TumbleReelsComponent.prototype.reelsInitialized = null;
        ballooniesIxfTumbleReels.TumbleReelsComponent.prototype.receivedReelPicture = null;
        ballooniesIxfTumbleReels.TumbleReelsComponent.prototype.receivedVisibility = null;
        ballooniesIxfTumbleReels.TumbleReelsComponent.prototype.spinStartTime = null;
        ballooniesIxfTumbleReels.TumbleReelsComponent.prototype.delayBeforeStop = null;
        ballooniesIxfTumbleReels.TumbleReelsComponent.prototype.numReelsMoving = null;
        ballooniesIxfTumbleReels.TumbleReelsComponent.prototype.gaps = null;
        ballooniesIxfTumbleReels.TumbleReelsComponent.prototype.initProperties = null;
        ballooniesIxfTumbleReels.TumbleReelsComponent.prototype.subscribeToEvents = function() {
            this.port.getStartSpin().subscribe($bind(this, this.onStartSpin));
            this.port.getStopSpin().subscribe($bind(this, this.onStopSpin));
            this.port.getAbortSpin().subscribe($bind(this, this.onSpinAborted));
            this.port.getUpdateGaps().subscribe($bind(this, this.onUpdateGaps));
            this.port.getUpdateReelPicture().subscribe($bind(this, this.onSetReelPicture));
            this.port.getShow().subscribe($bind(this, this.onShow));
            this.port.getHide().subscribe($bind(this, this.onHide));
            this.port.getUpdateReelSkin().subscribe($bind(this, this.onSetReelSkin));
            this.port.getUpdateCellsVisibility().subscribe($bind(this, this.onSetReelCellsVisibility));
            this.slotModelPort.getStages().getInitStage().getInitializeGamePhase().getInitializeGame().subscribe($bind(this, this.onSlotModelInit));
            this.slotModelPort.getStages().getResumeStage().getPrepareResume().subscribe($bind(this, this.onResumeGame));
            this.layoutPort.getUpdateComponentLayout().subscribe($bind(this, this.onLayoutUpdate));
        };
        ballooniesIxfTumbleReels.TumbleReelsComponent.prototype.onResumeGame = function(e) {
            this.continueInit(e.getPayload().initializationProperties);
        };
        ballooniesIxfTumbleReels.TumbleReelsComponent.prototype.onSlotModelInit = function(e) {
            this.continueInit(e.getPayload());
        };
        ballooniesIxfTumbleReels.TumbleReelsComponent.prototype.continueInit = function(initProperties) {
            this.initProperties = initProperties;
            this.initialize();
        };
        ballooniesIxfTumbleReels.TumbleReelsComponent.prototype.onLayoutUpdate = function(e) {
            this.layoutPayload = e.getPayload();
            this.layoutPort.getComponentLayoutUpdated().publish(this.context.getInstance());
            if (this.reelsInitialized) this.view.onLayoutUpdate(this.layoutPayload);
            else this.initialize();
        };
        ballooniesIxfTumbleReels.TumbleReelsComponent.prototype.initialize = function() {
            if (this.config == null) return;
            var assetsLoaded = ballooniesIxfTumbleReels.ExternalService.loadedAssets.length == this.config.configs.length;
            if (!this.reelsInitialized && this.layoutPayload != null && assetsLoaded && this.initProperties != null) this.initReels();
            this.delayBeforeStop = this.config.delayBeforeDrop;
        };
        ballooniesIxfTumbleReels.TumbleReelsComponent.prototype.createViews = function() {
            this.config.viewBuilder = [];
            var _g = 0;
            var _g1 = ballooniesIxfTumbleReels.ExternalService.loadedAssets;
            while (_g < _g1.length) {
                var asset = _g1[_g];
                ++_g;
                this.config.viewBuilder.push(this.vbFactory.createView(asset));
            }
        };
        ballooniesIxfTumbleReels.TumbleReelsComponent.prototype.initSymbolMap = function() {
            this.config.symbolMap = new _hcmn_.haxe_ds_StringMap();
            var _g = 0;
            var _g1 = this.initProperties.slotDefinition.symbols;
            while (_g < _g1.length) {
                var symbol = _g1[_g];
                ++_g;
                this.config.symbolMap.set(symbol.id, symbol);
            }
        };
        ballooniesIxfTumbleReels.TumbleReelsComponent.prototype.initReels = function() {
            this.createViews();
            this.initSymbolMap();
            var this1 = ballooniesIxfTumbleReels.ExternalService.displayProvider.getStages();
            var key = this.layoutPayload.containers.get("layout").stage;
            this.stage = this1.get(key);
            this.view = new ballooniesIxfTumbleReels.TumbleReelsComponentView(this.config);
            this.view.onLayoutUpdate(this.layoutPayload);
            var _g1 = 0;
            var _g = this.config.reels.length;
            while (_g1 < _g) {
                var i = _g1++;
                var reel = new ballooniesIxfTumbleReels.TumbleReel(i, this);
                this.reels.push(reel);
                reel.view.addCellToBleedLayer = ($_ = this.view, $bind($_, $_.addCellToBleedLayer));
                reel.view.removeCellFromBleedLayer = ($_ = this.view, $bind($_, $_.removeCellFromBleedLayer));
            }
            this.changeState(ballooniesIxfTumbleReels.TumbleReelsComponentState.IDLE);
            if (this.receivedReelPicture != null) this.forceReelPicture(this.receivedReelPicture);
            if (this.receivedVisibility != null) this.setCellsVisibility(this.receivedVisibility);
            this.stage.on(displayEngineApi.DisplayObjectEvents.ENTER_FRAME, $bind(this, this.updateReels));
            this.reelsInitialized = true;
            this.spinStartTime = _hcmn_.Std["int"](new _hcmn_.Date().getTime());
        };
        ballooniesIxfTumbleReels.TumbleReelsComponent.prototype.onStartSpin = function(e) {
            if (this.state != ballooniesIxfTumbleReels.TumbleReelsComponentState.IDLE && this.state != ballooniesIxfTumbleReels.TumbleReelsComponentState.ABORTING) return;
            this.changeState(ballooniesIxfTumbleReels.TumbleReelsComponentState.SPINNING);
            if (this.gaps == null) {
                this.spinStartTime = _hcmn_.Std["int"](new _hcmn_.Date().getTime());
                this.port.getReelPictureExited().publish(0);
                this.numReelsMoving = this.reels.length;
            } else this.clearGaps();
        };
        ballooniesIxfTumbleReels.TumbleReelsComponent.prototype.clearGaps = function() {
            this.numReelsMoving = 0;
            var _g1 = 0;
            var _g = this.reels.length;
            while (_g1 < _g) {
                var i = _g1++;
                if (this.reels[i].animator.dropOutSymbols(this.gaps[i])) this.numReelsMoving++;
            }
            this.port.getReelPictureExited().publish(0);
        };
        ballooniesIxfTumbleReels.TumbleReelsComponent.prototype.onUpdateGaps = function(e) {
            this.gaps = e.getPayload();
        };
        ballooniesIxfTumbleReels.TumbleReelsComponent.prototype.onShow = function(e) {
            if (this.reelsInitialized) this.view.setVisible(true);
        };
        ballooniesIxfTumbleReels.TumbleReelsComponent.prototype.onHide = function(e) {
            if (this.reelsInitialized) this.view.setVisible(false);
        };
        ballooniesIxfTumbleReels.TumbleReelsComponent.prototype.onStopSpin = function(e) {
            if (this.state != ballooniesIxfTumbleReels.TumbleReelsComponentState.SPINNING && this.state != ballooniesIxfTumbleReels.TumbleReelsComponentState.ABORTING) return;
            this.changeState(ballooniesIxfTumbleReels.TumbleReelsComponentState.STOPPING);
            this.outcomeReelPicture = e.getPayload().reelPicture;
            if (this.gaps == null) {
                var elapsedFromStart = _hcmn_.Std["int"](new _hcmn_.Date().getTime()) - this.spinStartTime;
                var delay = this.delayBeforeStop - elapsedFromStart;
                if (delay > 0) _hcmn_.haxe_Timer.delay($bind(this, this.triggerStopping), delay);
                else this.triggerStopping();
            } else {
                this.port.getStopping().publish(null);
                var _g1 = 0;
                var _g = this.reels.length;
                while (_g1 < _g) {
                    var i = _g1++;
                    this.reels[i].animator.dropInSymbols(this.outcomeReelPicture[i]);
                }
            }
            this.gaps = e.getPayload().winSymbols;
        };
        ballooniesIxfTumbleReels.TumbleReelsComponent.prototype.triggerStopping = function() {
            this.port.getStopping().publish(null);
            var _g1 = 0;
            var _g = this.reels.length;
            while (_g1 < _g) {
                var i = _g1++;
                this.reels[i].animator.clear();
                this.reels[i].animator.stop(this.outcomeReelPicture[i]);
            }
        };
        ballooniesIxfTumbleReels.TumbleReelsComponent.prototype.updateReels = function() {
            if (this.state == ballooniesIxfTumbleReels.TumbleReelsComponentState.IDLE) return;
            var _g = 0;
            var _g1 = this.reels;
            while (_g < _g1.length) {
                var reel = _g1[_g];
                ++_g;
                reel.updateReel(new _hcmn_.Date().getTime());
            }
            this.view.sortBleed();
        };
        ballooniesIxfTumbleReels.TumbleReelsComponent.prototype.onReelUp = function(pos) {
            this.port.getReelTumbledUp().publish(pos);
        };
        ballooniesIxfTumbleReels.TumbleReelsComponent.prototype.onReelStopped = function(pos) {
            var stoppedPicture = this.reels[pos].animator.reelPicture.symbols;
            ballooniesIxfTumbleReels.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.getReelStopped().publish(pos);
            this.numReelsMoving--;
            if (this.numReelsMoving == 0) this.onSpinStopped();
        };
        ballooniesIxfTumbleReels.TumbleReelsComponent.prototype.onSpinStopped = function(value) {
            if (value != null) console.log(value);
            this.port.getSpinStopped().publish(value);
            this.changeState(ballooniesIxfTumbleReels.TumbleReelsComponentState.IDLE);
        };
        ballooniesIxfTumbleReels.TumbleReelsComponent.prototype.onSpinAborted = function(e) {
            console.log("[AbortSpin] : TumbleReelscomponent - onSpinAborted ");
            this.port.getSpinStopped().publish("[AbortSpin] : TumbleReelscomponent - onSpinAborted ");
            this.changeState(ballooniesIxfTumbleReels.TumbleReelsComponentState.ABORTING);
        };
        ballooniesIxfTumbleReels.TumbleReelsComponent.prototype.onSetReelPicture = function(e) {
            this.receivedReelPicture = e.getPayload();
            if (!this.reelsInitialized) return;
            this.forceReelPicture(this.receivedReelPicture);
            this.receivedReelPicture = null;
        };
        ballooniesIxfTumbleReels.TumbleReelsComponent.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.cacheAsBitmap(true);
        };
        ballooniesIxfTumbleReels.TumbleReelsComponent.prototype.onSetReelSkin = function(e) {
            var id = e.getPayload();
            if (id > this.config.configs.length - 1) return;
            var _g = 0;
            var _g1 = this.reels;
            while (_g < _g1.length) {
                var reel = _g1[_g];
                ++_g;
                var _g2 = 0;
                var _g3 = reel.view.cells;
                while (_g2 < _g3.length) {
                    var cell = _g3[_g2];
                    ++_g2;
                    cell.loadSkin(id);
                }
            }
        };
        ballooniesIxfTumbleReels.TumbleReelsComponent.prototype.changeState = function(state) {
            this.state = state;
            var cacheAsBitmap = state == ballooniesIxfTumbleReels.TumbleReelsComponentState.IDLE;
            this.view.cacheAsBitmap(cacheAsBitmap);
        };
        ballooniesIxfTumbleReels.TumbleReelsComponent.prototype.onSetReelCellsVisibility = function(e) {
            if (!this.reelsInitialized) {
                this.receivedVisibility = e.getPayload();
                return;
            }
            this.setCellsVisibility(e.getPayload());
        };
        ballooniesIxfTumbleReels.TumbleReelsComponent.prototype.setCellsVisibility = function(values) {
            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++;
                    cells[j].displayObject.setVisible(values[i][j]);
                }
            }
            this.view.cacheAsBitmap(this.state == ballooniesIxfTumbleReels.TumbleReelsComponentState.IDLE);
        };
        ballooniesIxfTumbleReels.TumbleReelsComponent.prototype.__class__ = ballooniesIxfTumbleReels.TumbleReelsComponent;
        ballooniesIxfTumbleReels.TumbleReelsConfig = function() {
            this.bleedOffscreen = true;
            this.reelOffscreen = true;
        };
        ballooniesIxfTumbleReels.TumbleReelsConfig.__name__ = ["ballooniesIxfTumbleReels", "TumbleReelsConfig"];
        ballooniesIxfTumbleReels.TumbleReelsConfig.prototype.configs = null;
        ballooniesIxfTumbleReels.TumbleReelsConfig.prototype.defaultReelConfig = null;
        ballooniesIxfTumbleReels.TumbleReelsConfig.prototype.reels = null;
        ballooniesIxfTumbleReels.TumbleReelsConfig.prototype.symbolMap = null;
        ballooniesIxfTumbleReels.TumbleReelsConfig.prototype.boundsWidth = null;
        ballooniesIxfTumbleReels.TumbleReelsConfig.prototype.boundsHeight = null;
        ballooniesIxfTumbleReels.TumbleReelsConfig.prototype.bounceDist = null;
        ballooniesIxfTumbleReels.TumbleReelsConfig.prototype.bounceDuration = null;
        ballooniesIxfTumbleReels.TumbleReelsConfig.prototype.delayBeforeDrop = null;
        ballooniesIxfTumbleReels.TumbleReelsConfig.prototype.viewBuilder = null;
        ballooniesIxfTumbleReels.TumbleReelsConfig.prototype.reelOffscreen = null;
        ballooniesIxfTumbleReels.TumbleReelsConfig.prototype.bleedOffscreen = null;
        ballooniesIxfTumbleReels.TumbleReelsConfig.prototype.marginWidth = null;
        ballooniesIxfTumbleReels.TumbleReelsConfig.prototype.__class__ = ballooniesIxfTumbleReels.TumbleReelsConfig;
        ballooniesIxfTumbleReels.TumbleReelsFactory = function(vbf) {
            this.vbf = vbf;
        };
        ballooniesIxfTumbleReels.TumbleReelsFactory = ck_implements(ballooniesIxfTumbleReels.TumbleReelsFactory, clientkernelModulesApi.IService);
        ballooniesIxfTumbleReels.TumbleReelsFactory = ck_implements(ballooniesIxfTumbleReels.TumbleReelsFactory, componentmodelComponentApi.IComponentFactory);
        ballooniesIxfTumbleReels.TumbleReelsFactory.__interfaces__ = [clientkernelModulesApi.IService, componentmodelComponentApi.IComponentFactory];
        ballooniesIxfTumbleReels.TumbleReelsFactory.__name__ = ["ballooniesIxfTumbleReels", "TumbleReelsFactory"];
        ballooniesIxfTumbleReels.TumbleReelsFactory.prototype.vbf = null;
        ballooniesIxfTumbleReels.TumbleReelsFactory.prototype.getComponentDeclaration = function() {
            return ballooniesIxfTumbleReelsApi.TumbleReelsDeclaration;
        };
        ballooniesIxfTumbleReels.TumbleReelsFactory.prototype.createComponent = function(context) {
            new ballooniesIxfTumbleReels.TumbleReelsComponent(context, this.vbf);
        };
        ballooniesIxfTumbleReels.TumbleReelsFactory.prototype.__class__ = ballooniesIxfTumbleReels.TumbleReelsFactory;
        ballooniesIxfTumbleReels.TumbleReelsPicture = function() {
            this.symbols = [];
            this.offsets = [];
        };
        ballooniesIxfTumbleReels.TumbleReelsPicture.__name__ = ["ballooniesIxfTumbleReels", "TumbleReelsPicture"];
        ballooniesIxfTumbleReels.TumbleReelsPicture.prototype.symbols = null;
        ballooniesIxfTumbleReels.TumbleReelsPicture.prototype.offsets = null;
        ballooniesIxfTumbleReels.TumbleReelsPicture.prototype.toString = function() {
            return _hcmn_.Std.string(this.symbols) + ":" + _hcmn_.Std.string(this.offsets);
        };
        ballooniesIxfTumbleReels.TumbleReelsPicture.prototype.__class__ = ballooniesIxfTumbleReels.TumbleReelsPicture;
        ballooniesIxfTumbleReels.TumbleReelsComponentState = {
            __ename__: ["ballooniesIxfTumbleReels", "TumbleReelsComponentState"],
            __constructs__: ["IDLE", "SPINNING", "STOPPING", "ABORTING"]
        };
        ballooniesIxfTumbleReels.TumbleReelsComponentState.IDLE = ["IDLE", 0];
        ballooniesIxfTumbleReels.TumbleReelsComponentState.IDLE.toString = $estr;
        ballooniesIxfTumbleReels.TumbleReelsComponentState.IDLE.__enum__ = ballooniesIxfTumbleReels.TumbleReelsComponentState;
        ballooniesIxfTumbleReels.TumbleReelsComponentState.SPINNING = ["SPINNING", 1];
        ballooniesIxfTumbleReels.TumbleReelsComponentState.SPINNING.toString = $estr;
        ballooniesIxfTumbleReels.TumbleReelsComponentState.SPINNING.__enum__ = ballooniesIxfTumbleReels.TumbleReelsComponentState;
        ballooniesIxfTumbleReels.TumbleReelsComponentState.STOPPING = ["STOPPING", 2];
        ballooniesIxfTumbleReels.TumbleReelsComponentState.STOPPING.toString = $estr;
        ballooniesIxfTumbleReels.TumbleReelsComponentState.STOPPING.__enum__ = ballooniesIxfTumbleReels.TumbleReelsComponentState;
        ballooniesIxfTumbleReels.TumbleReelsComponentState.ABORTING = ["ABORTING", 3];
        ballooniesIxfTumbleReels.TumbleReelsComponentState.ABORTING.toString = $estr;
        ballooniesIxfTumbleReels.TumbleReelsComponentState.ABORTING.__enum__ = ballooniesIxfTumbleReels.TumbleReelsComponentState;
        ballooniesIxfTumbleReels.TumbleReelsState = {
            __ename__: ["ballooniesIxfTumbleReels", "TumbleReelsState"],
            __constructs__: ["IDLE", "CLEARED", "DROP_IN"]
        };
        ballooniesIxfTumbleReels.TumbleReelsState.CLEARED = ["CLEARED", 1];
        ballooniesIxfTumbleReels.TumbleReelsState.CLEARED.toString = $estr;
        ballooniesIxfTumbleReels.TumbleReelsState.CLEARED.__enum__ = ballooniesIxfTumbleReels.TumbleReelsState;
        ballooniesIxfTumbleReels.TumbleReelsState.DROP_IN = ["DROP_IN", 2];
        ballooniesIxfTumbleReels.TumbleReelsState.DROP_IN.toString = $estr;
        ballooniesIxfTumbleReels.TumbleReelsState.DROP_IN.__enum__ = ballooniesIxfTumbleReels.TumbleReelsState;
        ballooniesIxfTumbleReels.TumbleReelsState.IDLE = ["IDLE", 0];
        ballooniesIxfTumbleReels.TumbleReelsState.IDLE.toString = $estr;
        ballooniesIxfTumbleReels.TumbleReelsState.IDLE.__enum__ = ballooniesIxfTumbleReels.TumbleReelsState;
        ballooniesIxfTumbleReels.Cell = function(config) {
            this.visibleSymbolName = "";
            this.visibleSymbolId = "";
            this.config = config;
            this.displayObject = ballooniesIxfTumbleReels.ExternalService.displayProvider.getFactory().createDisplayObjectContainer();
            this.loadSkin(0);
        };
        ballooniesIxfTumbleReels.Cell.__name__ = ["ballooniesIxfTumbleReels", "Cell"];
        ballooniesIxfTumbleReels.Cell.prototype.displayObject = null;
        ballooniesIxfTumbleReels.Cell.prototype.initialY = null;
        ballooniesIxfTumbleReels.Cell.prototype.visibleSymbolId = null;
        ballooniesIxfTumbleReels.Cell.prototype.visibleSymbolName = null;
        ballooniesIxfTumbleReels.Cell.prototype.symbols = null;
        ballooniesIxfTumbleReels.Cell.prototype.config = null;
        ballooniesIxfTumbleReels.Cell.prototype.vbCont = null;
        ballooniesIxfTumbleReels.Cell.prototype.loadSkin = function(id) {
            this.vbCont = this.config.viewBuilder[id];
            this.visibleSymbolName = "";
            this.visibleSymbolId = "";
            this.loadSymbols();
        };
        ballooniesIxfTumbleReels.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 symbolMapId = this.config.symbolMap.get(id).asset;
                if (!this.symbols.exists(symbolMapId)) {
                    var vbCont = this.vbCont.createContainerFromStoredConfig(symbolMapId);
                    var innerBmp = vbCont.getComponentById("innerBmp");
                    if (innerBmp != null) disp = innerBmp.getDisplayObject();
                    else disp = vbCont.getDisplayObject();
                    disp.setX(0);
                    disp.setY(0);
                    disp.setName(symbolMapId);
                    disp.setVisible(false);
                    this.symbols.set(symbolMapId, disp);
                    this.displayObject.addChild(disp);
                }
            }
        };
        ballooniesIxfTumbleReels.Cell.prototype.setSymbol = function(id) {
            if (id == null) return;
            var symbolDef = this.config.symbolMap.get(id);
            var symbolName = symbolDef.asset;
            if (this.visibleSymbolName == symbolName) return;
            if (this.visibleSymbolName != "") this.symbols.get(this.visibleSymbolName).setVisible(false);
            this.visibleSymbolName = symbolName;
            this.visibleSymbolId = id;
            this.symbols.get(this.visibleSymbolName).setVisible(true);
        };
        ballooniesIxfTumbleReels.Cell.prototype.getSymbolId = function() {
            return this.visibleSymbolId;
        };
        ballooniesIxfTumbleReels.Cell.prototype.__class__ = ballooniesIxfTumbleReels.Cell;
        ballooniesIxfTumbleReels.TumbleReelsComponentView = function(config) {
            this.bleedSortFlag = false;
            this.addedToStage = false;
            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 = ballooniesIxfTumbleReels.ExternalService.displayProvider.getFactory().createDisplayObjectContainer();
            this.displayObject.setName("layout");
            this.displayObjectBleed = ballooniesIxfTumbleReels.ExternalService.displayProvider.getFactory().createDisplayObjectContainer();
            this.displayObjectBleed.setName("bleed");
            if (config.reelOffscreen) {
                this.layoutOS = ballooniesIxfTumbleReels.ExternalService.displayProvider.getFactory().createOffscreenStage(config.boundsWidth, config.boundsHeight);
                this.layoutBmp = ballooniesIxfTumbleReels.ExternalService.displayProvider.getFactory().createBitmap(this.layoutOS);
                this.layoutBmp.setName("bmpLayout");
                this.displayObject.addChild(this.layoutBmp);
                this.layoutOSTimingMode = this.layoutOS.getStage().getTimingMode();
            } else {
                var m1 = ballooniesIxfTumbleReels.ExternalService.displayProvider.getFactory().createGraphics();
                m1.beginFill(16711680).drawRect(0, 0, config.boundsWidth, config.boundsHeight);
                this.displayObject.setMask(m1);
            }
            if (config.bleedOffscreen) {
                this.bleedOS = ballooniesIxfTumbleReels.ExternalService.displayProvider.getFactory().createOffscreenStage(config.boundsWidth + config.marginWidth, config.boundsHeight);
                this.bleedBmp = ballooniesIxfTumbleReels.ExternalService.displayProvider.getFactory().createBitmap(this.bleedOS);
                this.bleedBmp.setName("bmpBleed");
                this.displayObjectBleed.addChild(this.bleedBmp);
            } else {
                var m2 = ballooniesIxfTumbleReels.ExternalService.displayProvider.getFactory().createGraphics();
                m2.setX(-config.marginWidth / 2);
                m2.beginFill(16711680).drawRect(0, 0, config.boundsWidth + config.marginWidth, config.boundsHeight);
                this.displayObjectBleed.setMask(m2);
            }
        };
        ballooniesIxfTumbleReels.TumbleReelsComponentView.__name__ = ["ballooniesIxfTumbleReels", "TumbleReelsComponentView"];
        ballooniesIxfTumbleReels.TumbleReelsComponentView.prototype.displayObjectsMap = null;
        ballooniesIxfTumbleReels.TumbleReelsComponentView.prototype.displayObject = null;
        ballooniesIxfTumbleReels.TumbleReelsComponentView.prototype.displayObjectBleed = null;
        ballooniesIxfTumbleReels.TumbleReelsComponentView.prototype.layoutOS = null;
        ballooniesIxfTumbleReels.TumbleReelsComponentView.prototype.bleedOS = null;
        ballooniesIxfTumbleReels.TumbleReelsComponentView.prototype.layoutBmp = null;
        ballooniesIxfTumbleReels.TumbleReelsComponentView.prototype.bleedBmp = null;
        ballooniesIxfTumbleReels.TumbleReelsComponentView.prototype.layoutOSTimingMode = null;
        ballooniesIxfTumbleReels.TumbleReelsComponentView.prototype.layoutContainers = null;
        ballooniesIxfTumbleReels.TumbleReelsComponentView.prototype.displayObjects = null;
        ballooniesIxfTumbleReels.TumbleReelsComponentView.prototype.reels = null;
        ballooniesIxfTumbleReels.TumbleReelsComponentView.prototype.config = null;
        ballooniesIxfTumbleReels.TumbleReelsComponentView.prototype.addedToStage = null;
        ballooniesIxfTumbleReels.TumbleReelsComponentView.prototype.bleedSortFlag = null;
        ballooniesIxfTumbleReels.TumbleReelsComponentView.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);
            }
        };
        ballooniesIxfTumbleReels.TumbleReelsComponentView.prototype.onLayoutUpdate = function(layoutPayload) {
            this.layoutContainers = layoutPayload.containers;
            var layoutContainer = this.layoutContainers.get(ballooniesIxfTumbleReels.TumbleReelsComponentView.SYMBOLS_LAYER);
            var layoutContainerTop = this.layoutContainers.get(ballooniesIxfTumbleReels.TumbleReelsComponentView.BLEED_LAYER);
            if (!this.addedToStage) {
                ((function($this) {
                    var $r;
                    var this1 = ballooniesIxfTumbleReels.ExternalService.displayProvider.getStages();
                    $r = this1.get(layoutContainer.stage);
                    return $r;
                }(this))).addChild(this.displayObject);
                ((function($this) {
                    var $r;
                    var this2 = ballooniesIxfTumbleReels.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);
        };
        ballooniesIxfTumbleReels.TumbleReelsComponentView.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 this.displayObject.setCacheAsBitmap(value);
        };
        ballooniesIxfTumbleReels.TumbleReelsComponentView.prototype.setVisible = function(value) {
            this.displayObject.setVisible(value);
            this.displayObjectBleed.setVisible(value);
        };
        ballooniesIxfTumbleReels.TumbleReelsComponentView.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;
            }
        };
        ballooniesIxfTumbleReels.TumbleReelsComponentView.prototype.removeCellFromBleedLayer = function(cell) {
            if (this.config.reelOffscreen) this.layoutOS.getStage().addChildAt(cell, this.layoutOS.getStage().getNumChildren() - 1);
            else this.displayObject.addChild(cell);
        };
        ballooniesIxfTumbleReels.TumbleReelsComponentView.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;
            }
        };
        ballooniesIxfTumbleReels.TumbleReelsComponentView.prototype.cellSortFn = function(a, b) {
            if (a.getX() == b.getX()) return _hcmn_.Math.round(a.getY() - b.getY());
            else return _hcmn_.Math.round(a.getX() - b.getX());
        };
        ballooniesIxfTumbleReels.TumbleReelsComponentView.prototype.__class__ = ballooniesIxfTumbleReels.TumbleReelsComponentView;
        ballooniesIxfTumbleReels.TumbleReelsView = function(pos, config) {
            this.reelConfig = config.reels[pos];
            this.cells = [];
            var _g1 = 0;
            var _g = this.reelConfig.cellsNum;
            while (_g1 < _g) {
                var i = _g1++;
                var cell = new ballooniesIxfTumbleReels.Cell(config);
                cell.displayObject.setName("R_" + pos + "_C" + i);
                this.cells.push(cell);
                cell.initialY = this.reelConfig.cellHeight * i | 0;
                cell.displayObject.setX(pos * (this.reelConfig.cellWidth + this.reelConfig.leftMargin));
                cell.displayObject.setY(cell.initialY);
            }
        };
        ballooniesIxfTumbleReels.TumbleReelsView.__name__ = ["ballooniesIxfTumbleReels", "TumbleReelsView"];
        ballooniesIxfTumbleReels.TumbleReelsView.prototype.cells = null;
        ballooniesIxfTumbleReels.TumbleReelsView.prototype.reelConfig = null;
        ballooniesIxfTumbleReels.TumbleReelsView.prototype.reelPicture = null;
        ballooniesIxfTumbleReels.TumbleReelsView.prototype.setAllVisible = function() {
            this.update(this.reelPicture);
        };
        ballooniesIxfTumbleReels.TumbleReelsView.prototype.update = function(reelPicture) {
            this.reelPicture = reelPicture;
            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.offsets[i]);
                if (reelPicture.symbols[i] == null) {
                    cell.displayObject.setVisible(false);
                    continue;
                }
                var symbolId = reelPicture.symbols[i];
                if (symbolId != cell.getSymbolId()) cell.setSymbol(symbolId);
                cell.displayObject.setVisible(true);
            }
        };
        ballooniesIxfTumbleReels.TumbleReelsView.prototype.addCellToBleedLayer = function(cell) {};
        ballooniesIxfTumbleReels.TumbleReelsView.prototype.removeCellFromBleedLayer = function(cell) {};
        ballooniesIxfTumbleReels.TumbleReelsView.prototype.__class__ = ballooniesIxfTumbleReels.TumbleReelsView;
        if (typeof haxe == 'undefined') {
            var haxe = {};
        };

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

            get: function(k) {
                return {
                    arguments: ["*"],
                    returns: "null"
                };
            }
        };
        ballooniesIxfTumbleReels.ExternalService.loadedAssets = [];;
        ballooniesIxfTumbleReels.TumbleReelsComponentView.SYMBOLS_LAYER = "layout";;
        ballooniesIxfTumbleReels.TumbleReelsComponentView.BLEED_LAYER = "layout_top";;
        return {
            exports: ballooniesIxfTumbleReels,
            activator: ballooniesIxfTumbleReels.Activator
        };
    });
//# sourceURL=ballooniesIxfTumbleReels.js