define("Popup", ["viewBuilderApi", "componentmodelComponentApi", "translationmanagerApi", "clientkernelLoaderApi", "slotModelApi", "displayEngineApi", "gameLayoutApi", "BABYLON", "PopupApi", "clientkernelEventbusApi", "clientkernelModulesApi"],
    function(viewBuilderApi, componentmodelComponentApi, translationmanagerApi, clientkernelLoaderApi, slotModelApi, displayEngineApi, gameLayoutApi, BABYLON, PopupApi, clientkernelEventbusApi, clientkernelModulesApi) {
        "use strict";

        function $iterator(o) {
            if (o instanceof Array) return function() {
                return {
                    cur: 0,
                    arr: o,
                    hasNext: function() {
                        return this.cur < this.arr.length;
                    },
                    next: function() {
                        return this.arr[this.cur++];
                    }
                };
            };
            return typeof(o.iterator) == 'function' ? $bind(o, o.iterator) : o.iterator;
        };;
        var $fid = 0;

        function $bind(o, m) {
            if (m == null) return null;
            if (m.__id__ == null) m.__id__ = $fid++;
            var f;
            if (o.hx__closures__ == null) o.hx__closures__ = {};
            else f = o.hx__closures__[m.__id__];
            if (f == null) {
                f = function() {
                    return f.method.apply(f.scope, arguments);
                };
                f.scope = o;
                f.method = m;
                o.hx__closures__[m.__id__] = f;
            }
            return f;
        };
        var $_;
        var $estr = function() {
            return _hcmn_.js_Boot.__string_rec(this, '');
        };
        if (typeof Popup == 'undefined') {
            var Popup = {};
        };
        Popup.Activator = function(context) {};
        Popup.Activator = ck_implements(Popup.Activator, clientkernelModulesApi.IModuleActivator);
        Popup.Activator.__interfaces__ = [clientkernelModulesApi.IModuleActivator];
        Popup.Activator.__name__ = ["Popup", "Activator"];
        Popup.Activator.prototype.start = function(context) {
            context.getServiceTracker([viewBuilderApi.IViewBuilderFactory, clientkernelLoaderApi.IAssetRegistry, displayEngineApi.IDisplayProvider, translationmanagerApi.ITranslationManager]).then(function(context1) {
                Popup.ExternalService.initialize(context1);
                context1.registerService(new Popup.PopupFactory(context1), PopupApi.PopupDeclaration, null);
            });
        };
        Popup.Activator.prototype.stop = function(context) {};
        Popup.Activator.main = function() {};
        Popup.Activator.prototype.__class__ = Popup.Activator;
        Popup.ExternalService = function() {};
        Popup.ExternalService.__name__ = ["Popup", "ExternalService"];
        Popup.ExternalService.bus = null;
        Popup.ExternalService.assetRegistry = null;
        Popup.ExternalService.displayProvider = null;
        Popup.ExternalService.viewBuilderFactory = null;
        Popup.ExternalService.translationManager = null;
        Popup.ExternalService.context = null;
        Popup.ExternalService.initialize = function(cntxt) {
            Popup.ExternalService.context = cntxt;
            Popup.ExternalService.assetRegistry = Popup.ExternalService.context.getAnyService(clientkernelLoaderApi.IAssetRegistry, null);
            Popup.ExternalService.displayProvider = Popup.ExternalService.context.getAnyService(displayEngineApi.IDisplayProvider, null);
            Popup.ExternalService.viewBuilderFactory = Popup.ExternalService.context.getAnyService(viewBuilderApi.IViewBuilderFactory, null);
            Popup.ExternalService.translationManager = Popup.ExternalService.context.getAnyService(translationmanagerApi.ITranslationManager, null);
            Popup.ExternalService.bus = Popup.ExternalService.context.getAnyService(clientkernelEventbusApi.IEventBus, null);
        };
        Popup.ExternalService.getAsset = function(id) {
            return Popup.ExternalService.assetRegistry.getAsset(id).getContent();
        };
        Popup.ExternalService.loadAsset = function(id, index, loadCallback) {
            Popup.ExternalService.assetRegistry.getAsset(id).getContent().then(function(data) {
                loadCallback(data);
            });
        };
        Popup.ExternalService.prototype.__class__ = Popup.ExternalService;
        Popup.PickerIdleAnimation = function(numItems) {
            var _g = [];
            var _g1 = 0;
            while (_g1 < numItems) {
                var i = _g1++;
                _g.push(null);
            }
            this.animations = _g;
        };
        Popup.PickerIdleAnimation.__name__ = ["Popup", "PickerIdleAnimation"];
        Popup.PickerIdleAnimation.prototype.animationHolder = null;
        Popup.PickerIdleAnimation.prototype.animations = null;
        Popup.PickerIdleAnimation.prototype.setAnimationHolder = function(parent) {
            this.animationHolder = parent.getComponentById("ANIMATIONS");
        };
        Popup.PickerIdleAnimation.prototype.addItem = function(index, assets) {
            var animView = Popup.ExternalService.viewBuilderFactory.createView(assets);
            var animHolder = animView.createContainerFromStoredConfig("ANIMATION_HOLDER");
            this.animations[index] = animHolder.getComponentById("ANIMATION_CONTENT");
            this.animationHolder.addChildComponent(this.animations[index], "IDLE_" + index);
            this.animationHolder.hide();
        };
        Popup.PickerIdleAnimation.prototype.setBalloonPosition = function(index, btn) {
            this.animations[index].setX(_hcmn_.Std["int"](btn.getX()));
            this.animations[index].setY(_hcmn_.Std["int"](btn.getY()));
        };
        Popup.PickerIdleAnimation.prototype.startAll = function() {
            this.animationHolder.show();
            var _g = 0;
            var _g1 = this.animations;
            while (_g < _g1.length) {
                var anim = _g1[_g];
                ++_g;
                anim.show();
                anim.gotoAndPlay(false, "loop");
            }
        };
        Popup.PickerIdleAnimation.prototype.pause = function(itemIndex) {
            this.animations[itemIndex].stop();
            this.animations[itemIndex].hide();
        };
        Popup.PickerIdleAnimation.prototype.play = function(itemIndex) {
            this.animations[itemIndex].show();
            this.animations[itemIndex].play(false);
        };
        Popup.PickerIdleAnimation.prototype.hideAll = function() {
            var _g = 0;
            var _g1 = this.animations;
            while (_g < _g1.length) {
                var anim = _g1[_g];
                ++_g;
                anim.stop();
                anim.hide();
            }
            this.animationHolder.hide();
        };
        Popup.PickerIdleAnimation.prototype.__class__ = Popup.PickerIdleAnimation;
        Popup.Popup = function(context, cfgId) {
            this.context = context;
            this.layoutPort = context.getUsedPort(gameLayoutApi.IGameLayoutPort);
            this.layoutPort.getUpdateComponentLayout().subscribe($bind(this, this.onLayoutUpdate));
            this.popupImplPort = context.getImplementedPort(PopupApi.IPopupImplementationPort);
            this.popupImplPort.getShowPicker().subscribe($bind(this, this.onShowPicker));
            this.popupImplPort.getShowPickerOutro().subscribe($bind(this, this.onShowPickerOutro));
            this.popupImplPort.getShowFSIntro().subscribe($bind(this, this.onShowFSIntro));
            this.popupImplPort.getShowFSOutro().subscribe($bind(this, this.onShowFSOutro));
            this.popupImplPort.getShowNoWinOutro().subscribe($bind(this, this.onShowNoWinOutro));
            this.popupImplPort.getShowAwardCap().subscribe($bind(this, this.onShowAwardCap));
            this.popupImplPort.getHide().subscribe($bind(this, this.onHidePopup));
            this.builder = new Popup.PopupBuilder();
        };
        Popup.Popup.__name__ = ["Popup", "Popup"];
        Popup.Popup.prototype.context = null;
        Popup.Popup.prototype.layoutPayload = null;
        Popup.Popup.prototype.layoutPort = null;
        Popup.Popup.prototype.popupImplPort = null;
        Popup.Popup.prototype.builder = null;
        Popup.Popup.prototype.popupScreen = null;
        Popup.Popup.prototype.pickerScreen = null;
        Popup.Popup.prototype.publishPopupFinished = null;
        Popup.Popup.prototype.onHidePopup = function(e) {
            this.hide();
        };
        Popup.Popup.prototype.hide = function() {
            if (this.popupScreen != null) {
                this.popupScreen.remove();
                this.popupScreen = null;
            }
        };
        Popup.Popup.prototype.show = function(initData) {
            var _g = this;
            if (this.popupScreen == null) return;
            this.popupScreen.init(initData);
            this.popupScreen.show();
            this.popupScreen.updateLayout(this.layoutPayload);
            if (this.popupScreen.showDuration > 0) _hcmn_.haxe_Timer.delay(function() {
                _g.hide();
                _g.publishPopupFinished();
            }, this.popupScreen.showDuration);
        };
        Popup.Popup.prototype.onShowAwardCap = function(e) {
            var _g = this;
            this.builder.create(Popup.Popup.AWARD_CAP_ASSET_ID, Popup.AwardCap).then(function(popup) {
                _g.popupScreen = popup;
                _g.show(e.getPayload());
            });
        };
        Popup.Popup.prototype.onShowPicker = function(e) {
            var _g = this;
            if (this.pickerScreen == null) this.builder.createPicker(Popup.Popup.PICKER_ASSET_ID).then(function(picker) {
                _g.popupImplPort.getEnablePickerButtons().subscribe($bind(picker, picker.onEnableButtons));
                _g.popupImplPort.getShowPickerResult().subscribe($bind(picker, picker.onShowResult));
                picker.onSelect = $bind(_g, _g.publishPickerChoice);
                picker.onOver = $bind(_g, _g.publishPickerOver);
                picker.onResultShown = $bind(_g, _g.publishPickerResultShown);
                picker.onShowAnimationDone = $bind(_g, _g.publishPickerIsVisible);
                picker.onHideAnimationDone = $bind(_g, _g.publishPickerOutroDone);
                picker.init(null);
                _g.pickerScreen = picker;
                _g.showPicker();
            });
            else this.showPicker();
        };
        Popup.Popup.prototype.showPicker = function() {
            this.pickerScreen.show();
            this.pickerScreen.updateLayout(this.layoutPayload);
        };
        Popup.Popup.prototype.onShowPickerOutro = function(e) {
            this.pickerScreen.remove();
        };
        Popup.Popup.prototype.onShowFSIntro = function(e) {
            var _g = this;
            Popup.ExternalService.getAsset(Popup.Popup.FS_INTRO_ANIM_ID).then(function(vba) {
                _g.builder.create(Popup.Popup.FS_INTRO_ASSET_ID, Popup.FSIntro).then(function(popup) {
                    _g.popupScreen = popup;
                    _g.popupScreen.animAssets = vba;
                    _g.show(e.getPayload());
                    _g.publishPopupFinished = $bind(_g, _g.publishFSIntroFinished);
                });
            });
        };
        Popup.Popup.prototype.onShowFSOutro = function(e) {
            var _g = this;
            Popup.ExternalService.getAsset(Popup.Popup.FS_OUTRO_ANIM_ID).then(function(vba) {
                _g.builder.create(Popup.Popup.FS_OUTRO_ASSET_ID, Popup.FSOutro).then(function(popup) {
                    _g.popupScreen = popup;
                    _g.popupScreen.animAssets = vba;
                    _g.show(e.getPayload());
                    _g.publishPopupFinished = $bind(_g, _g.publishFSOutroFinished);
                });
            });
        };
        Popup.Popup.prototype.onShowNoWinOutro = function(e) {
            var _g = this;
            Popup.ExternalService.getAsset(Popup.Popup.FS_OUTRO_ANIM_ID).then(function(vba) {
                _g.builder.create(Popup.Popup.FS_OUTRO_ASSET_ID, Popup.NoWinOutro).then(function(popup) {
                    _g.popupScreen = popup;
                    _g.popupScreen.animAssets = vba;
                    _g.show(null);
                    _g.publishPopupFinished = $bind(_g, _g.publishFSOutroFinished);
                });
            });
        };
        Popup.Popup.prototype.publishFSIntroFinished = function() {
            this.popupImplPort.getFSIntroFinished().publish(null);
        };
        Popup.Popup.prototype.publishFSOutroFinished = function() {
            this.popupImplPort.getFSOutroFinished().publish(null);
        };
        Popup.Popup.prototype.publishPickerIsVisible = function() {
            this.popupImplPort.getPickerIsVisible().publish(null);
        };
        Popup.Popup.prototype.publishPickerChoice = function(choice) {
            this.popupImplPort.getPickerChoice().publish(choice);
        };
        Popup.Popup.prototype.publishPickerOver = function(choice) {
            this.popupImplPort.getPickerOver().publish(choice);
        };
        Popup.Popup.prototype.publishPickerResultShown = function() {
            this.popupImplPort.getPickerResultShown().publish(null);
        };
        Popup.Popup.prototype.publishPickerOutroDone = function() {
            this.popupImplPort.getPickerOutroDone().publish(null);
        };
        Popup.Popup.prototype.onLayoutUpdate = function(e) {
            this.layoutPayload = e.getPayload();
            this.builder.setLayout(this.layoutPayload);
            if (this.popupScreen != null) this.popupScreen.updateLayout(this.layoutPayload);
            if (this.pickerScreen != null) this.pickerScreen.updateLayout(this.layoutPayload);
            this.layoutPort.getComponentLayoutUpdated().publish(this.context.getInstance());
        };
        Popup.Popup.prototype.__class__ = Popup.Popup;
        Popup.PopupAnimation = function(assets, view) {
            var animView = Popup.ExternalService.viewBuilderFactory.createView(assets);
            var animHolder = animView.createContainerFromStoredConfig("ANIMATION_HOLDER");
            this.zoomAnimation = animHolder.getComponentById("ANIMATION_CONTENT");
            this.zoomAnimationHolder = view.getComponentById("ZOOM_ANIM");
            this.zoomAnimationHolder.addChildComponent(this.zoomAnimation, "ZOOM_ANIM" + "_VB");
            this.zoomAnimationHolder.hide();
        };
        Popup.PopupAnimation.__name__ = ["Popup", "PopupAnimation"];
        Popup.PopupAnimation.prototype.zoomAnimationHolder = null;
        Popup.PopupAnimation.prototype.zoomAnimation = null;
        Popup.PopupAnimation.prototype.zoomIn = function(onShowLabels) {
            this.zoomAnimationHolder.show();
            this.zoomAnimation.addEventListener("evShowLabels", onShowLabels);
            this.zoomAnimation.addEventListener("evIntroComplete", $bind(this, this.onZoomInCompleted));
            this.zoomAnimation.gotoAndPlay(false, "intro");
        };
        Popup.PopupAnimation.prototype.onZoomInCompleted = function() {
            this.zoomAnimation.stop();
            this.zoomAnimation.removeEventListener("evIntroComplete");
            this.zoomAnimation.removeEventListener("evShowLabels");
        };
        Popup.PopupAnimation.prototype.zoomOut = function(onFinish) {
            this.zoomAnimation.addEventListener("evOutroComplete", $bind(this, this.onZoomOutCompleted));
            this.zoomAnimation.addEventListener("evOutroComplete", onFinish);
            this.zoomAnimation.gotoAndPlay(false, "outro");
        };
        Popup.PopupAnimation.prototype.onZoomOutCompleted = function() {
            this.zoomAnimation.stop();
            this.zoomAnimation.removeEventListener("evOutroComplete");
            this.zoomAnimation.hide();
            this.zoomAnimationHolder.hide();
        };
        Popup.PopupAnimation.prototype.__class__ = Popup.PopupAnimation;
        Popup.PopupFactory = function(context) {
            this.context = context;
        };
        Popup.PopupFactory = ck_implements(Popup.PopupFactory, clientkernelModulesApi.IService);
        Popup.PopupFactory = ck_implements(Popup.PopupFactory, componentmodelComponentApi.IComponentFactory);
        Popup.PopupFactory.__interfaces__ = [clientkernelModulesApi.IService, componentmodelComponentApi.IComponentFactory];
        Popup.PopupFactory.__name__ = ["Popup", "PopupFactory"];
        Popup.PopupFactory.prototype.context = null;
        Popup.PopupFactory.prototype.getComponentDeclaration = function() {
            return PopupApi.PopupDeclaration;
        };
        Popup.PopupFactory.prototype.createComponent = function(context) {
            var cfgId = context.getConfiguration();
            new Popup.Popup(context, cfgId);
        };
        Popup.PopupFactory.prototype.__class__ = Popup.PopupFactory;
        Popup.PopupBase = function(id, view, stage) {
            this.isShowing = true;
            this.labels = [];
            var _g = this;
            this.stage = stage;
            this.id = id;
            this.view = view.getComponentById(id);
            Popup.ExternalService.assetRegistry.getAsset("game-config_json").getContent().then(function(data) {
                _g.config = data.popup;
            });
            this.showDuration = 0;
        };
        Popup.PopupBase.__name__ = ["Popup", "PopupBase"];
        Popup.PopupBase.prototype.stage = null;
        Popup.PopupBase.prototype.id = null;
        Popup.PopupBase.prototype.view = null;
        Popup.PopupBase.prototype.showDuration = null;
        Popup.PopupBase.prototype.config = null;
        Popup.PopupBase.prototype.animAssets = null;
        Popup.PopupBase.prototype.onShowAnimationDone = null;
        Popup.PopupBase.prototype.onHideAnimationDone = null;
        Popup.PopupBase.prototype.labels = null;
        Popup.PopupBase.prototype.isShowing = null;
        Popup.PopupBase.prototype.init = function(data) {};
        Popup.PopupBase.prototype.show = function() {
            this.stage.addChild(this.view.getDisplayObject());
            this.view.show();
            this.isShowing = true;
        };
        Popup.PopupBase.prototype.remove = function() {
            this.stage.removeChild(this.view.getDisplayObject());
            this.isShowing = false;
        };
        Popup.PopupBase.prototype.updateLayout = function(componentLayout) {
            if (!this.isShowing) return;
            var layout = componentLayout.containers.get(this.id);
            var container = this.view.getDisplayObject();
            container.setX(layout.left);
            container.setY(layout.top);
            container.setScaleX(layout.width / container.getUserData().viewBuilderW);
            container.setScaleY(layout.height / container.getUserData().viewBuilderH);
            container.setZIndex(layout.zIndex);
        };
        Popup.PopupBase.prototype.setLabelTextTranslated = function(labelId) {
            var textValue = Popup.ExternalService.translationManager.stringLookup(labelId);
            this.setLabelText(labelId, textValue);
        };
        Popup.PopupBase.prototype.translateLabels = function() {
            this.doForAllLabels($bind(this, this.setLabelTextTranslated));
        };
        Popup.PopupBase.prototype.setLabelText = function(labelId, textValue) {
            var label = this.view.getComponentById(labelId);
            label.setText(textValue);
        };
        Popup.PopupBase.prototype.hideLabel = function(labelId) {
            var label = this.view.getComponentById(labelId);
            label.hide();
        };
        Popup.PopupBase.prototype.showLabel = function(labelId) {
            var label = this.view.getComponentById(labelId);
            label.show();
        };
        Popup.PopupBase.prototype.hideAllLabels = function() {
            this.doForAllLabels($bind(this, this.hideLabel));
        };
        Popup.PopupBase.prototype.showAllLabels = function() {
            this.doForAllLabels($bind(this, this.showLabel));
        };
        Popup.PopupBase.prototype.doForAllLabels = function(actionOnLabel) {
            var _g = 0;
            var _g1 = this.labels;
            while (_g < _g1.length) {
                var lab = _g1[_g];
                ++_g;
                actionOnLabel(lab);
            }
        };
        Popup.PopupBase.prototype.__class__ = Popup.PopupBase;
        Popup.AwardCap = function(id, view, stage) {
            Popup.PopupBase.call(this, id, view, stage);
        };
        Popup.AwardCap.__name__ = ["Popup", "AwardCap"];
        Popup.AwardCap.__super__ = Popup.PopupBase;
        for (var k in Popup.PopupBase.prototype) Popup.AwardCap.prototype[k] = Popup.PopupBase.prototype[k];
        Popup.AwardCap.prototype.isFreeSpin = null;
        Popup.AwardCap.prototype.init = function(data) {
            this.labels = ["AwardCap_Congrats", "AwardCap_YouWonMax"];
            this.setLabelText("MaxWinValue", data.value);
            this.isFreeSpin = data.freeSpin;
            if (data.freeSpin) this.setLabelTextTranslated("AwardCap_FSComplete");
            else this.setLabelText("AwardCap_FSComplete", "");
            this.translateLabels();
        };
        Popup.AwardCap.prototype.show = function() {
            Popup.PopupBase.prototype.show.call(this);
            var gfBus = Popup.ExternalService.bus.getChannel("GFBus");
            gfBus.publish(this.isFreeSpin ? "awardcap:freespin" : "awardcap:basegame", null);
        };
        Popup.AwardCap.prototype.__class__ = Popup.AwardCap;
        Popup.FSIntro = function(id, view, stage) {
            Popup.PopupBase.call(this, id, view, stage);
        };
        Popup.FSIntro.__name__ = ["Popup", "FSIntro"];
        Popup.FSIntro.__super__ = Popup.PopupBase;
        for (var k in Popup.PopupBase.prototype) Popup.FSIntro.prototype[k] = Popup.PopupBase.prototype[k];
        Popup.FSIntro.prototype.animation = null;
        Popup.FSIntro.prototype.init = function(data) {
            this.showDuration = this.config.fsIntroDuration;
            this.labels = ["Intro_Congratulations", "Intro_YouWon", "Intro_FreeSpins"];
            this.translateLabels();
            this.setLabelText(Popup.FSIntro.VALUE_LABEL, data == null ? "null" : "" + data);
            this.labels.push(Popup.FSIntro.VALUE_LABEL);
            this.hideAllLabels();
            this.animation = new Popup.PopupAnimation(this.animAssets, this.view);
        };
        Popup.FSIntro.prototype.show = function() {
            Popup.PopupBase.prototype.show.call(this);
            this.animation.zoomIn($bind(this, this.showAllLabels));
        };
        Popup.FSIntro.prototype.__class__ = Popup.FSIntro;
        Popup.FSOutro = function(id, view, stage) {
            Popup.PopupBase.call(this, id, view, stage);
        };
        Popup.FSOutro.__name__ = ["Popup", "FSOutro"];
        Popup.FSOutro.__super__ = Popup.PopupBase;
        for (var k in Popup.PopupBase.prototype) Popup.FSOutro.prototype[k] = Popup.PopupBase.prototype[k];
        Popup.FSOutro.prototype.animation = null;
        Popup.FSOutro.prototype.init = function(data) {
            this.showDuration = this.config.fsOutroDuration;
            this.labels = ["Outro_Congratulations", "Outro_YouWon"];
            this.translateLabels();
            this.setLabelText(Popup.FSOutro.VALUE_LABEL, _hcmn_.Std.string(data));
            this.setLabelText(Popup.FSOutro.COMPLETE_LABEL, "");
            this.labels = this.labels.concat([Popup.FSOutro.VALUE_LABEL, Popup.FSOutro.COMPLETE_LABEL]);
            this.hideAllLabels();
            this.animation = new Popup.PopupAnimation(this.animAssets, this.view);
        };
        Popup.FSOutro.prototype.show = function() {
            Popup.PopupBase.prototype.show.call(this);
            this.animation.zoomIn($bind(this, this.showAllLabels));
        };
        Popup.FSOutro.prototype.remove = function() {
            this.hideAllLabels();
            this.animation.zoomOut($bind(this, this.dispose));
        };
        Popup.FSOutro.prototype.dispose = function() {
            Popup.PopupBase.prototype.remove.call(this);
        };
        Popup.FSOutro.prototype.__class__ = Popup.FSOutro;
        Popup.NoWinOutro = function(id, view, stage) {
            Popup.PopupBase.call(this, id, view, stage);
        };
        Popup.NoWinOutro.__name__ = ["Popup", "NoWinOutro"];
        Popup.NoWinOutro.__super__ = Popup.PopupBase;
        for (var k in Popup.PopupBase.prototype) Popup.NoWinOutro.prototype[k] = Popup.PopupBase.prototype[k];
        Popup.NoWinOutro.prototype.animation = null;
        Popup.NoWinOutro.prototype.init = function(data) {
            this.showDuration = this.config.fsOutroDuration;
            this.labels = [Popup.NoWinOutro.COMPLETE_LABEL, "Outro_Congratulations", "Outro_YouWon", "BonusTotalWinValue"];
            this.setLabelTextTranslated(Popup.NoWinOutro.COMPLETE_LABEL);
            this.hideAllLabels();
            this.animation = new Popup.PopupAnimation(this.animAssets, this.view);
        };
        Popup.NoWinOutro.prototype.show = function() {
            Popup.PopupBase.prototype.show.call(this);
            this.animation.zoomIn($bind(this, this.showAllLabels));
        };
        Popup.NoWinOutro.prototype.showAllLabels = function() {
            this.showLabel(Popup.NoWinOutro.COMPLETE_LABEL);
        };
        Popup.NoWinOutro.prototype.remove = function() {
            this.hideLabel(Popup.NoWinOutro.COMPLETE_LABEL);
            this.animation.zoomOut($bind(this, this.dispose));
        };
        Popup.NoWinOutro.prototype.dispose = function() {
            Popup.PopupBase.prototype.remove.call(this);
        };
        Popup.NoWinOutro.prototype.__class__ = Popup.NoWinOutro;
        Popup.Picker = function(id, parentContainer, stage) {
            this.isActive = false;
            this.choiceDone = false;
            this.idleBalloons = 0;
            Popup.PopupBase.call(this, id, parentContainer, stage);
            this.idleAnimation = new Popup.PickerIdleAnimation(Popup.Picker.NUM_BUTTONS);
            this.buttonContainer = this.view.getComponentById(Popup.Picker.BUTTONS_CONTAINER_ID);
            this.idleAnimation.setAnimationHolder(this.buttonContainer);
            var _g1 = 0;
            var _g = Popup.Picker.NUM_BUTTONS;
            while (_g1 < _g) {
                var i = _g1++;
                Popup.ExternalService.loadAsset(Popup.Picker.PICKER_IDLE_ANIM_ID + i, i, $bind(this, this.initIdleBalloon));
            }
            Popup.ExternalService.bus.getChannel("GFBus").subscribe("multipicker:choice", $bind(this, this.testFrameworkPicker));
        };
        Popup.Picker.__name__ = ["Popup", "Picker"];
        Popup.Picker.__super__ = Popup.PopupBase;
        for (var k in Popup.PopupBase.prototype) Popup.Picker.prototype[k] = Popup.PopupBase.prototype[k];
        Popup.Picker.prototype.onOver = null;
        Popup.Picker.prototype.onSelect = null;
        Popup.Picker.prototype.onResultShown = null;
        Popup.Picker.prototype.showResultDuration = null;
        Popup.Picker.prototype.buttonContainer = null;
        Popup.Picker.prototype.idleAnimation = null;
        Popup.Picker.prototype.idleBalloons = null;
        Popup.Picker.prototype.choiceDone = null;
        Popup.Picker.prototype.isActive = null;
        Popup.Picker.prototype.initIdleBalloon = function(data) {
            this.idleAnimation.addItem(this.idleBalloons++, data);
        };
        Popup.Picker.prototype.testFrameworkPicker = function(e) {
            var buttonIndex = e.getPayload().playerChoice;
            this.clickOnBtn(buttonIndex - 1);
        };
        Popup.Picker.prototype.init = function(data) {
            this.showResultDuration = this.config.pickerResultDuration;
            this.setLabelTextTranslated(Popup.Picker.POP_BALLOON_LABEL);
            this.setLabelTextTranslated(Popup.Picker.RESULT_LABEL);
            this.initButtons();
        };
        Popup.Picker.prototype.show = function() {
            Popup.PopupBase.prototype.show.call(this);
            this.choiceDone = false;
            this.hideLabel(Popup.Picker.RESULT_LABEL);
            this.showLabel(Popup.Picker.POP_BALLOON_LABEL);
            this.setButtonsState(false, true);
            this.view.getComponentById(Popup.Picker.BUTTONS_CONTAINER_ID).show();
            this.view.getComponentById(Popup.Picker.COINS_CONTAINER_ID).hide();
            _hcmn_.haxe_Timer.delay(this.onShowAnimationDone, this.config.pickerEnableButtonsDelay);
        };
        Popup.Picker.prototype.remove = function() {
            Popup.PopupBase.prototype.remove.call(this);
            this.onHideAnimationDone();
        };
        Popup.Picker.prototype.getButtonId = function(buttonIndex) {
            return "BUTTON_" + _hcmn_.Std.string(buttonIndex + 1);
        };
        Popup.Picker.prototype.initButtons = function() {
            var _g1 = 0;
            var _g = Popup.Picker.NUM_BUTTONS;
            while (_g1 < _g) {
                var i = _g1++;
                var btn = this.buttonContainer.getButtonById(this.getButtonId(i));
                this.idleAnimation.setBalloonPosition(i, btn.getDisplayObject());
                btn.disable();
                btn.getEvents().DOWN().addListener($bind(this, this.onClick));
                btn.getEvents().OVER().addListener($bind(this, this.onBalloonOver));
                btn.getEvents().OUT().addListener($bind(this, this.onBalloonOut));
            }
        };
        Popup.Picker.prototype.setButtonsState = function(enable, visible, selectedBtn) {
            var _g1 = 0;
            var _g = Popup.Picker.NUM_BUTTONS;
            while (_g1 < _g) {
                var i = _g1++;
                var btn = this.buttonContainer.getButtonById(this.getButtonId(i));
                if (enable) btn.enable();
                else btn.disable();
                btn.getDisplayObject().setAlpha(visible ? 1 : 0);
                var state;
                if (i == selectedBtn) state = "down";
                else if (enable) state = "enabled";
                else state = "disabled";
                btn.getMainMovieClip().gotoAndStop(state);
            }
        };
        Popup.Picker.prototype.getButtonIndex = function(buttonName) {
            var r = new _hcmn_.EReg(".+_(\\d)", "");
            r.match(buttonName);
            return _hcmn_.Std.parseInt(r.matched(1));
        };
        Popup.Picker.prototype.onBalloonOver = function(e) {
            if (e != null) {
                var selectedBalloonIndex = this.getButtonIndex(e.getName()) - 1;
                this.onOver(selectedBalloonIndex);
                this.idleAnimation.pause(selectedBalloonIndex);
                this.buttonContainer.getButtonById(e.getName()).getDisplayObject().setAlpha(1);
            }
        };
        Popup.Picker.prototype.onBalloonOut = function(e) {
            if (e != null) {
                this.idleAnimation.play(this.getButtonIndex(e.getName()) - 1);
                this.buttonContainer.getButtonById(e.getName()).getDisplayObject().setAlpha(0);
            }
        };
        Popup.Picker.prototype.onClick = function(e) {
            var selectedBalloonIndex = this.getButtonIndex(e.getName());
            this.clickOnBtn(selectedBalloonIndex - 1);
        };
        Popup.Picker.prototype.clickOnBtn = function(btnIndex) {
            if (this.choiceDone || !this.isActive) return;
            this.choiceDone = true;
            this.isActive = false;
            this.idleAnimation.hideAll();
            this.setButtonsState(false, true, btnIndex);
            this.hideLabel(Popup.Picker.POP_BALLOON_LABEL);
            this.onSelect(btnIndex);
        };
        Popup.Picker.prototype.onEnableButtons = function(e) {
            this.isActive = true;
            this.choiceDone = false;
            this.publishAvailablePicksForAutoTest();
            this.idleAnimation.startAll();
            this.setButtonsState(true, false);
        };
        Popup.Picker.prototype.publishAvailablePicksForAutoTest = function() {
            var pickerData = {};
            pickerData.instanceId = "";
            var availablePicks = new _hcmn_.haxe_ds_StringMap();
            var _g1 = 0;
            var _g = Popup.Picker.NUM_BUTTONS;
            while (_g1 < _g) {
                var i = _g1++;
                var choice = i + 1;
                availablePicks.set(choice == null ? "null" : "" + choice, true);
            }
            pickerData.availablePicks = availablePicks;
            Popup.ExternalService.bus.getChannel("GFBus").publish("multipicker:availablePicks", pickerData);
        };
        Popup.Picker.prototype.onShowResult = function(e) {
            this.isActive = false;
            this.view.getComponentById(Popup.Picker.BUTTONS_CONTAINER_ID).hide();
            this.setCoinValues(e.getPayload());
            this.view.getComponentById(Popup.Picker.COINS_CONTAINER_ID).show();
            this.showLabel(Popup.Picker.RESULT_LABEL);
            _hcmn_.haxe_Timer.delay(this.onResultShown, this.showResultDuration);
        };
        Popup.Picker.prototype.getCoinLabelId = function(index) {
            return "Picker_Value" + index;
        };
        Popup.Picker.prototype.setCoinValues = function(values) {
            var container = this.view.getComponentById(Popup.Picker.COINS_CONTAINER_ID);
            var i = 1;
            var _g = 0;
            while (_g < values.length) {
                var v = values[_g];
                ++_g;
                this.setSelectedCoin(container, i, v.value);
                var labelId = this.getCoinLabelId(i++);
                var label = container.getComponentById(labelId);
                label.setText(v.key);
            }
        };
        Popup.Picker.prototype.setSelectedCoin = function(container, index, isSelected) {
            var darkCoinId = "CoinDis" + index;
            if (isSelected) container.getComponentById(darkCoinId).hide();
            else container.getComponentById(darkCoinId).show();
        };
        Popup.Picker.prototype.__class__ = Popup.Picker;
        Popup.PopupBuilder = function() {};
        Popup.PopupBuilder.__name__ = ["Popup", "PopupBuilder"];
        Popup.PopupBuilder.prototype.layoutPayload = null;
        Popup.PopupBuilder.prototype.create = function(id, popupClass) {
            var _g = this;
            var promise = new Promise(function(resolve, reject) {
                _g.createView(id).then(function(view) {
                    var popup = _hcmn_.Type.createInstance(popupClass, [id, view, _g.getStage(id)]);
                    resolve(popup);
                });
            });
            return promise;
        };
        Popup.PopupBuilder.prototype.createPicker = function(id) {
            var _g = this;
            var promise = new Promise(function(resolve, reject) {
                _g.createView(id).then(function(view) {
                    var popup = new Popup.Picker(id, view, _g.getStage(id));
                    resolve(popup);
                });
            });
            return promise;
        };
        Popup.PopupBuilder.prototype.createView = function(id) {
            var promise = new Promise(function(resolve, reject) {
                var assetId = "popup-assets/" + id;
                Popup.ExternalService.getAsset(assetId).then(function(vbAssets) {
                    var view = Popup.ExternalService.viewBuilderFactory.createView(vbAssets);
                    resolve(view);
                });
            });
            return promise;
        };
        Popup.PopupBuilder.prototype.setLayout = function(layoutPayload) {
            this.layoutPayload = layoutPayload;
        };
        Popup.PopupBuilder.prototype.getStage = function(container) {
            var stage = this.layoutPayload.containers.get(container).stage;
            var this1 = Popup.ExternalService.displayProvider.getStages();
            return this1.get(stage);
        };
        Popup.PopupBuilder.prototype.__class__ = Popup.PopupBuilder;
        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;
        Popup.PickerIdleAnimation.ANIM_CONTAINER_ID = "ANIMATIONS";;
        Popup.Popup.AWARD_CAP_ASSET_ID = "AWARD_CAP";;
        Popup.Popup.PICKER_ASSET_ID = "PICKER";;
        Popup.Popup.FS_INTRO_ASSET_ID = "FS_INTRO";;
        Popup.Popup.FS_OUTRO_ASSET_ID = "FS_OUTRO";;
        Popup.Popup.FS_INTRO_ANIM_ID = "popup-assets/FS_INTRO_VB";;
        Popup.Popup.FS_OUTRO_ANIM_ID = "popup-assets/FS_OUTRO_VB";;
        Popup.PopupAnimation.ANIM_CONTAINER_ID = "ZOOM_ANIM";;
        Popup.PopupAnimation.ANIM_ZOOM_IN = "intro";;
        Popup.PopupAnimation.ANIM_SHOW_LABELS = "evShowLabels";;
        Popup.PopupAnimation.ANIM_ZOOM_IN_DONE = "evIntroComplete";;
        Popup.PopupAnimation.ANIM_ZOOM_OUT = "outro";;
        Popup.PopupAnimation.ANIM_ZOOM_OUT_DONE = "evOutroComplete";;
        Popup.AwardCap.FREE_SPINS_LABEL = "AwardCap_FSComplete";;
        Popup.AwardCap.MAX_VALUE_LABEL = "MaxWinValue";;
        Popup.AwardCap.SHOW_AWARD_CAP_FS = "awardcap:freespin";;
        Popup.AwardCap.SHOW_AWARD_CAP_BASE = "awardcap:basegame";;
        Popup.FSIntro.VALUE_LABEL = "FreeSpinsValue";;
        Popup.FSOutro.VALUE_LABEL = "BonusTotalWinValue";;
        Popup.FSOutro.COMPLETE_LABEL = "Outro_Complete";;
        Popup.NoWinOutro.COMPLETE_LABEL = "Outro_Complete";;
        Popup.Picker.POP_BALLOON_LABEL = "Picker_PopABalloon";;
        Popup.Picker.RESULT_LABEL = "Picker_FreeSpins";;
        Popup.Picker.BUTTONS_CONTAINER_ID = "BUTTONS_CONTAINER";;
        Popup.Picker.COINS_CONTAINER_ID = "COINS_CONTAINER";;
        Popup.Picker.NUM_BUTTONS = 3;;
        Popup.Picker.PICKER_IDLE_ANIM_ID = "popup-assets/PICKER_IDLE_BALLOON_VB_";;
        return {
            exports: Popup,
            activator: Popup.Activator
        };
    });
//# sourceURL=ballooniesIxfPopup.js