define("Picker", ["viewBuilderApi", "componentmodelComponentApi", "translationmanagerApi", "clientkernelLoaderApi", "displayEngineApi", "PickerApi", "displayEngineUtils", "gameLayoutApi", "PIXI", "BABYLON", "clientkernelEventbusApi", "clientkernelModulesApi"],
    function(viewBuilderApi, componentmodelComponentApi, translationmanagerApi, clientkernelLoaderApi, displayEngineApi, PickerApi, displayEngineUtils, gameLayoutApi, PIXI, BABYLON, 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 Picker == 'undefined') {
            var Picker = {};
        };
        Picker.Activator = function(context) {};
        Picker.Activator = ck_implements(Picker.Activator, clientkernelModulesApi.IModuleActivator);
        Picker.Activator.__interfaces__ = [clientkernelModulesApi.IModuleActivator];
        Picker.Activator.__name__ = ["Picker", "Activator"];
        Picker.Activator.prototype.start = function(context) {
            context.getServiceTracker([clientkernelLoaderApi.IAssetRegistry, viewBuilderApi.IViewBuilderFactory, displayEngineApi.IDisplayProvider, translationmanagerApi.ITranslationManager]).then(function(context1) {
                Picker.ExternalService.initialize(context1);
                var vbf = context1.getAnyService(viewBuilderApi.IViewBuilderFactory, null);
                Picker.ExternalService.viewBuilderFactory = vbf;
                context1.registerService(new Picker.PickerFactory(context1), PickerApi.PickerDeclaration, null);
            });
        };
        Picker.Activator.prototype.stop = function(context) {};
        Picker.Activator.main = function() {};
        Picker.Activator.prototype.__class__ = Picker.Activator;
        Picker.ExternalService = function() {};
        Picker.ExternalService.__name__ = ["Picker", "ExternalService"];
        Picker.ExternalService.assetRegistry = null;
        Picker.ExternalService.vbf = null;
        Picker.ExternalService.displayProvider = null;
        Picker.ExternalService.viewBuilderFactory = null;
        Picker.ExternalService.loadedCallback = null;
        Picker.ExternalService.translationManager = null;
        Picker.ExternalService.busChanel = null;
        Picker.ExternalService.variableRegistry = null;
        Picker.ExternalService.initialize = function(context) {
            Picker.ExternalService.assetRegistry = context.getAnyService(clientkernelLoaderApi.IAssetRegistry, null);
            Picker.ExternalService.vbf = context.getAnyService(viewBuilderApi.IViewBuilderFactory, null);
            Picker.ExternalService.displayProvider = context.getAnyService(displayEngineApi.IDisplayProvider, null);
            Picker.ExternalService.translationManager = context.getAnyService(translationmanagerApi.ITranslationManager, null);
            Picker.ExternalService.variableRegistry = context.getAnyService(clientkernelLoaderApi.IVariableRegistry, null);
            var bus = context.getAnyService(clientkernelEventbusApi.IEventBus, null);
            Picker.ExternalService.busChanel = bus.getChannel("GFBus");
        };
        Picker.ExternalService.getAsset = function(id) {
            return Picker.ExternalService.assetRegistry.getAsset(id).getContent();
        };
        Picker.ExternalService.loadVBAssets = function(id, loadedCallback) {
            Picker.ExternalService.loadedCallback = loadedCallback;
            Picker.ExternalService.loading++;
            Picker.ExternalService.assetRegistry.getAsset(id).getContent().then(function(vba) {
                Picker.ExternalService.loadedAssets.set(id, vba);
                Picker.ExternalService.checkLoaded();
            });
        };
        Picker.ExternalService.checkLoaded = function() {
            Picker.ExternalService.totalLoaded++;
            if (Picker.ExternalService.totalLoaded == Picker.ExternalService.loading) Picker.ExternalService.loadedCallback();
        };
        Picker.ExternalService.prototype.__class__ = Picker.ExternalService;
        Picker.FreespinWheelScreen = function(container, configuration) {
            this.animationCache = new _hcmn_.haxe_ds_StringMap();
            this.view = container;
            this.viewContent = this.view.getContainerById("Content").getContainerById("FREESPIN_WHEEL");
            var bkg = this.viewContent.getContainerById("bkg");
            bkg.getDisplayObject().setCacheAsBitmap(true);
            this.wheel = this.viewContent.getContainerById("WheelContainer").getDisplayObject();
            this.buttonContainer = this.viewContent.getButtonContainerById("Spin_Btn");
            this.buttonContainer.getEvents().DOWN().addListener($bind(this, this.onSpinButtonPressed));
            this.wheelAnimator = new Picker.WheelAnimator(this.wheel, configuration);
            this.wheelAnimator.getEvent().add($bind(this, this.onWheelEvent));
            this.initEvent();
            this.createButtonAnimation();
            this.createPointerAnimation();
            this.initLabels();
            this.initConnectingAnimation();
        };
        Picker.FreespinWheelScreen.__name__ = ["Picker", "FreespinWheelScreen"];
        Picker.FreespinWheelScreen.prototype.stage = null;
        Picker.FreespinWheelScreen.prototype.viewContent = null;
        Picker.FreespinWheelScreen.prototype.view = null;
        Picker.FreespinWheelScreen.prototype.wheel = null;
        Picker.FreespinWheelScreen.prototype.stopStripIndex = null;
        Picker.FreespinWheelScreen.prototype.event = null;
        Picker.FreespinWheelScreen.prototype.buttonContainer = null;
        Picker.FreespinWheelScreen.prototype.pressToSpinLabel = null;
        Picker.FreespinWheelScreen.prototype.goodLuckLabel = null;
        Picker.FreespinWheelScreen.prototype.labelContainer = null;
        Picker.FreespinWheelScreen.prototype.frameAnimation = null;
        Picker.FreespinWheelScreen.prototype.panelAnimation = null;
        Picker.FreespinWheelScreen.prototype.pointerAnimation = null;
        Picker.FreespinWheelScreen.prototype.fireAnimation = null;
        Picker.FreespinWheelScreen.prototype.animationCache = null;
        Picker.FreespinWheelScreen.prototype.labelTween = null;
        Picker.FreespinWheelScreen.prototype.config = null;
        Picker.FreespinWheelScreen.prototype.wheelAnimator = null;
        Picker.FreespinWheelScreen.prototype.connecting = null;
        Picker.FreespinWheelScreen.prototype.connectingDisplayObject = null;
        Picker.FreespinWheelScreen.prototype.createPointerAnimation = function() {
            this.pointerAnimation = this.getAnimation("POINTER_ANIMATION_HOLDER", "ANIMATION_CONTENT", "PANEL_ANIMATION");
            this.addAnimationToViewContent("pointer", "pointer_animation", this.pointerAnimation, false);
            this.pointerAnimation.show();
        };
        Picker.FreespinWheelScreen.prototype.createButtonAnimation = function() {
            var animContainer = this.buttonContainer.getContainerById("FIRE_ANIMATION_HOLDER");
            this.fireAnimation = this.getAnimation("FIRE_ANIMATION_HOLDER", "ANIMATION_CONTENT", "PICKER_ANIMATION");
            animContainer.addChildComponent(this.fireAnimation, "FIRE_ANIMATION");
        };
        Picker.FreespinWheelScreen.prototype.getAnimation = function(holderID, animationID, assetID) {
            var cacheKey = holderID + animationID;
            if (this.animationCache.exists(cacheKey)) return this.animationCache.get(cacheKey);
            var animAssets = Picker.ExternalService.loadedAssets.get(assetID);
            var animView = Picker.ExternalService.viewBuilderFactory.createView(animAssets);
            var animHolder = animView.createContainerFromStoredConfig(holderID);
            var animation = animHolder.getVBAnimationById(animationID);
            this.animationCache.set(cacheKey, animation);
            return animation;
        };
        Picker.FreespinWheelScreen.prototype.initLabels = function() {
            this.labelContainer = this.buttonContainer.getContainerById("labelsContainer");
            this.pressToSpinLabel = this.labelContainer.getContainerById("enabledLabel");
            this.goodLuckLabel = this.labelContainer.getContainerById("disabledLabel");
            this.setLabelsVisible(true, false);
        };
        Picker.FreespinWheelScreen.prototype.setLabelsVisible = function(spinVisible, goodluckVisible) {
            this.pressToSpinLabel.getDisplayObject().setVisible(spinVisible);
            this.goodLuckLabel.getDisplayObject().setVisible(goodluckVisible);
        };
        Picker.FreespinWheelScreen.prototype.onSpinButtonPressed = function(data) {
            this.setLabelsVisible(false, true);
            this.buttonContainer.disable();
            this.event.dispatch(Picker.Picker.SPIN_BTN_PRESSED);
            this.animateConnecting(Picker.FreespinWheelScreen.CONNECTING_STATE);
        };
        Picker.FreespinWheelScreen.prototype.initConnectingAnimation = function() {
            this.connecting = this.buttonContainer.getContainerById("connecting");
            this.connecting.hide();
            this.connectingDisplayObject = this.connecting.getDisplayObject();
            this.connectingDisplayObject.setPivot(new displayEngineApi.Point(this.connectingDisplayObject.getWidth() / 2, this.connectingDisplayObject.getHeight() / 2));
        };
        Picker.FreespinWheelScreen.prototype.animateConnecting = function(state) {
            this.connecting.show();
            if (state == Picker.FreespinWheelScreen.CONNECTING_STATE) {
                displayEngineUtils.TweenX.from(this.connectingDisplayObject, {
                    rotation: 0
                }, null, null, null, null, {
                    fileName: "FreespinWheelScreen.hx",
                    lineNumber: 122,
                    className: "components.picker.FreespinWheelScreen",
                    methodName: "animateConnecting"
                });
                displayEngineUtils.TweenX.to(this.connectingDisplayObject, {
                    rotation: 360
                }, 500, null, null, null, null, null, null, null, {
                    fileName: "FreespinWheelScreen.hx",
                    lineNumber: 123,
                    className: "components.picker.FreespinWheelScreen",
                    methodName: "animateConnecting"
                }).repeat(0);
            } else if (state == Picker.FreespinWheelScreen.CONNECTED_STATE) this.connecting.hide();
        };
        Picker.FreespinWheelScreen.prototype.createPanelAnimation = function() {
            this.panelAnimation = this.getAnimation("ANIMATION_HOLDER", "ANIMATION_CONTENT", "PANEL_ANIMATION");
            this.addAnimationToViewContent("powerUPmet", "animationID", this.panelAnimation, true);
            this.panelAnimation.getDisplayObject().setRotation(-90);
            this.panelAnimation.getDisplayObject().setPos(0, 1080);
            this.panelAnimation.play(false);
        };
        Picker.FreespinWheelScreen.prototype.init = function(data) {
            this.stopStripIndex = -1;
            this.wheel.setRotation(0);
            this.initWheelValues(data);
        };
        Picker.FreespinWheelScreen.prototype.show = function() {
            this.wheelAnimator.setDefaultState();
            this.view.show();
            this.setLabelsVisible(true, false);
            this.stopLabelTween($bind(this, this.playLabelTween));
            this.fireAnimation.play(false);
        };
        Picker.FreespinWheelScreen.prototype.playLabelTween = function() {
            var _g = this;
            if (this.labelTween != null) throw new js._Boot.HaxeError("labelTween should be null!!!");
            this.labelTween = displayEngineUtils.TweenX.serial([displayEngineUtils.TweenX.to(this.labelContainer.getDisplayObject(), {
                scaleX: 1.2,
                scaleY: 1.2
            }, 300, null, null, null, null, null, null, null, {
                fileName: "FreespinWheelScreen.hx",
                lineNumber: 159,
                className: "components.picker.FreespinWheelScreen",
                methodName: "playLabelTween"
            }), displayEngineUtils.TweenX.wait(1, {
                fileName: "FreespinWheelScreen.hx",
                lineNumber: 160,
                className: "components.picker.FreespinWheelScreen",
                methodName: "playLabelTween"
            }), displayEngineUtils.TweenX.to(this.labelContainer.getDisplayObject(), {
                scaleX: 1,
                scaleY: 1
            }, 300, null, null, null, null, null, null, null, {
                fileName: "FreespinWheelScreen.hx",
                lineNumber: 161,
                className: "components.picker.FreespinWheelScreen",
                methodName: "playLabelTween"
            })], null, {
                fileName: "FreespinWheelScreen.hx",
                lineNumber: 158,
                className: "components.picker.FreespinWheelScreen",
                methodName: "playLabelTween"
            }).repeat().onStop(function() {
                _g.labelTween = null;
            });
        };
        Picker.FreespinWheelScreen.prototype.stopLabelTween = function(callback) {
            var _g = this;
            if (this.labelTween != null) {
                this.labelTween.onStop(function() {
                    _g.labelTween = null;
                    callback();
                });
                this.labelTween.stop();
            } else callback();
        };
        Picker.FreespinWheelScreen.prototype.hide = function() {
            this.view.getDisplayObject().setVisible(false);
            this.hideSectorFrame();
            this.pointerAnimation.gotoAndStop(false);
        };
        Picker.FreespinWheelScreen.prototype.start = function() {
            this.wheelAnimator.playWheelRotation();
            this.createPanelAnimation();
            this.fireAnimation.hide();
            this.fireAnimation.stop();
            this.event.dispatch(Picker.Picker.WHEEL_STARTED);
        };
        Picker.FreespinWheelScreen.prototype.stop = function(data) {
            this.wheelAnimator.stop(data);
            this.stopStripIndex = data;
            this.animateConnecting(Picker.FreespinWheelScreen.CONNECTED_STATE);
        };
        Picker.FreespinWheelScreen.prototype.onWheelEvent = function(data) {
            if (data == Picker.Picker.WHEEL_SPINNING) Picker.ExternalService.busChanel.publish(Picker.Picker.WHEEL_SPINNING, "");
            else {
                this.event.dispatch(Picker.Picker.WHEEL_STOPPED);
                this.showSectorAndArrow();
                this.hidePanelAnimation();
                this.labelTween.stop();
            }
        };
        Picker.FreespinWheelScreen.prototype.hidePanelAnimation = function() {
            if (this.panelAnimation != null) {
                this.panelAnimation.stop();
                this.panelAnimation.hide();
            }
        };
        Picker.FreespinWheelScreen.prototype.showSectorAndArrow = function() {
            var animID = "BLUE_FRAME_ANIMATION_HOLDER";
            if (this.stopStripIndex % 2 == 0) animID = "RED_FRAME_HOLDER";
            this.frameAnimation = this.getAnimation(animID, "ANIMATION_CONTENT", "PICKER_ANIMATION");
            var sectorID = "sectorFrame" + (this.stopStripIndex + 1);
            this.addAnimationToPlaceholder(sectorID, sectorID, this.frameAnimation, false);
            this.frameAnimation.gotoAndPlay(false, "loop");
            this.pointerAnimation.play(false);
        };
        Picker.FreespinWheelScreen.prototype.addAnimationToViewContent = function(placeholderID, animationID, animation, play) {
            var placeHolder = this.viewContent.getContainerById(placeholderID);
            if (placeHolder.getComponentById(animationID) == null) placeHolder.addChildComponent(animation, animationID);
            if (play) animation.play(false);
        };
        Picker.FreespinWheelScreen.prototype.addAnimationToPlaceholder = function(placeholderID, animationID, animation, play) {
            var placeHolder = this.viewContent.getContainerById("WheelContainer").getContainerById("wheel").getContainerById(placeholderID);
            if ((function($this) {
                    var $r;
                    var this1 = placeHolder.getChildComponents();
                    $r = this1.get(animationID);
                    return $r;
                }(this)) == null) placeHolder.addChildComponent(animation, animationID);
            if (play) animation.play(false);
        };
        Picker.FreespinWheelScreen.prototype.hideSectorFrame = function() {
            var sectorID = "sectorFrame" + (_hcmn_.Math.max(0, this.stopStripIndex) + 1);
            var placeholder = this.viewContent.getContainerById("WheelContainer").getContainerById("wheel").getContainerById(sectorID);
            if (this.frameAnimation != null) {
                this.frameAnimation.stop();
                this.frameAnimation.hide();
            }
        };
        Picker.FreespinWheelScreen.prototype.initEvent = function() {
            this.event = new _hcmn_.msignal_Signal1();
        };
        Picker.FreespinWheelScreen.prototype.getEvent = function() {
            return this.event;
        };
        Picker.FreespinWheelScreen.prototype.initWheelValues = function(data) {
            var container = this.viewContent.getContainerById("WheelContainer").getContainerById("wheel");
            var _g1 = 0;
            var _g = data.length;
            while (_g1 < _g) {
                var i = _g1++;
                var labelContainer = container.getContainerById("Sector" + (i + 1));
                var label = labelContainer.getLabelById("sectorValue");
                label.setText(data[i]);
            }
        };
        Picker.FreespinWheelScreen.prototype.setConfig = function(cfg, stage) {
            this.config = cfg;
            this.stage = stage;
            this.updateLayout();
        };
        Picker.FreespinWheelScreen.prototype.setIdle = function() {
            this.wheelAnimator.setIdle();
            this.panelAnimation.stop();
            this.panelAnimation.hide();
            this.stopStripIndex = -1;
            this.setLabelsVisible(true, false);
            this.stopLabelTween($bind(this, this.playLabelTween));
            this.activateSpin();
        };
        Picker.FreespinWheelScreen.prototype.updateLayout = function() {
            var contentContainer = this.view.getContainerById("Content");
            if (this.config != null) {
                var stageH = this.stage.getHeight();
                var stageW = this.stage.getWidth();
                contentContainer.getDisplayObject().setRotation(this.config.rotation);
                if (this.buttonContainer != null) {
                    this.buttonContainer.getDisplayObject().setRotation(-this.config.rotation);
                    this.buttonContainer.getDisplayObject().setPos(this.config.spinButtonPos.x, this.config.spinButtonPos.y);
                }
                var midBall = this.viewContent.getContainerById("midBall");
                midBall.getDisplayObject().setRotation(-this.config.rotation);
                midBall.getDisplayObject().setPos(this.config.midBallPos.x, this.config.midBallPos.y);
                var powerUPmet = this.viewContent.getContainerById("powerUPmet");
                powerUPmet.getDisplayObject().setPos(this.config.panelPos.x, this.config.panelPos.y);
            }
        };
        Picker.FreespinWheelScreen.prototype.activateSpin = function() {
            this.buttonContainer.enable();
        };
        Picker.FreespinWheelScreen.prototype.deactivateSpin = function() {
            this.buttonContainer.disable();
        };
        Picker.FreespinWheelScreen.prototype.__class__ = Picker.FreespinWheelScreen;
        Picker.Picker = function(context, cfgId) {
            this.isResume = false;
            this.PICKER_CONFIG_ID = "picker-assets/picker_config";
            this.PANEL_ANIMATION_ID = "picker-assets/PANEL_ANIMATION";
            this.ANIMATION_ID = "picker-assets/PICKER_ANIMATION";
            this.PICKER_ID = "picker-assets/PICKER";
            this.flag_addedToStage = false;
            this.initialized = false;
            var _g = this;
            this.context = context;
            this.port = context.getImplementedPort(PickerApi.IPickerImplementationPort);
            this.port.getHide().subscribe($bind(this, this.onHide));
            this.port.getStop().subscribe($bind(this, this.onStopWheel));
            this.port.getStart().subscribe($bind(this, this.onStartWheel));
            this.port.getShow().subscribe($bind(this, this.onShowPicker));
            this.port.isResume().subscribe($bind(this, this.setResume));
            this.port.getInitWheelStrips().subscribe($bind(this, this.onInitWheelStripsValues));
            this.port.getIdle().subscribe($bind(this, this.onPickerIdle));
            this.port.getActivateSpin().subscribe($bind(this, this.onActivateSpin));
            this.port.getDeactivateSpin().subscribe($bind(this, this.onDeactivateSpin));
            this.layoutPort = context.getUsedPort(gameLayoutApi.IGameLayoutPort);
            this.layoutPort.getUpdateComponentLayout().subscribe($bind(this, this.onUpdateLayout));
            this.container = Picker.ExternalService.displayProvider.getFactory().createDisplayObjectContainer();
            this.container.setName("picker");
            var assetsToLoad = [this.PICKER_ID, this.ANIMATION_ID, this.PANEL_ANIMATION_ID, this.PICKER_CONFIG_ID];
            Picker.ExternalService.assetRegistry.getAssetsContent(assetsToLoad).then(function(data) {
                Picker.ExternalService.loadedAssets = data;
                _g.vba = Picker.ExternalService.loadedAssets.get("PICKER");
                _g.pickerConfig = Picker.ExternalService.loadedAssets.get("picker_config");
                _g.initialize();
            });
            this.container.setName("picker");
        };
        Picker.Picker.__name__ = ["Picker", "Picker"];
        Picker.Picker.prototype.port = null;
        Picker.Picker.prototype.context = null;
        Picker.Picker.prototype.layoutPort = null;
        Picker.Picker.prototype.layoutPayload = null;
        Picker.Picker.prototype.initialized = null;
        Picker.Picker.prototype.vba = null;
        Picker.Picker.prototype.container = null;
        Picker.Picker.prototype.currentPanel = null;
        Picker.Picker.prototype.animationAssets = null;
        Picker.Picker.prototype.panelAnimationAssets = null;
        Picker.Picker.prototype.pickerConfig = null;
        Picker.Picker.prototype.flag_addedToStage = null;
        Picker.Picker.prototype.PICKER_ID = null;
        Picker.Picker.prototype.ANIMATION_ID = null;
        Picker.Picker.prototype.PANEL_ANIMATION_ID = null;
        Picker.Picker.prototype.PICKER_CONFIG_ID = null;
        Picker.Picker.prototype.isResume = null;
        Picker.Picker.prototype.onStopWheel = function(e) {
            this.currentPanel.stop(e.getPayload());
        };
        Picker.Picker.prototype.onStartWheel = function(e) {
            this.currentPanel.start();
        };
        Picker.Picker.prototype.onHide = function(e) {
            if (this.currentPanel != null) this.currentPanel.hide();
        };
        Picker.Picker.prototype.onActivateSpin = function(e) {
            if (this.currentPanel != null) this.currentPanel.activateSpin();
        };
        Picker.Picker.prototype.onDeactivateSpin = function(e) {
            if (this.currentPanel != null) this.currentPanel.deactivateSpin();
        };
        Picker.Picker.prototype.setResume = function(e) {
            this.isResume = e.getPayload();
        };
        Picker.Picker.prototype.onInitWheelStripsValues = function(e) {
            this.currentPanel.init(e.getPayload());
            this.currentPanel.show();
            if (!this.isResume) _hcmn_.haxe_Timer.delay(($_ = this.currentPanel, $bind($_, $_.hide)), 1);
            else {
                this.currentPanel.hide();
                this.isResume = false;
            }
        };
        Picker.Picker.prototype.onShowPicker = function(e) {
            this.currentPanel.show();
        };
        Picker.Picker.prototype.onPickerIdle = function(e) {
            this.currentPanel.setIdle();
        };
        Picker.Picker.prototype.onWheelScreenChanged = function(data) {
            switch (data) {
                case "picker:wheelStopped":
                    this.port.getWheelStopped().publish(null);
                    break;
                case "picker:spinBtnPressed":
                    this.port.getSpinBtnPressed().publish(null);
                    break;
                case "picker:wheelStarted":
                    this.port.getWheelStarted().publish(null);
                    break;
            }
        };
        Picker.Picker.prototype.onUpdateLayout = function(e) {
            this.layoutPayload = e.getPayload();
            if (!this.initialized) this.initialize();
            else this.updateLayout();
        };
        Picker.Picker.prototype.initialize = function() {
            if (this.layoutPayload != null && this.vba != null) {
                var view = Picker.ExternalService.vbf.createView(this.vba);
                this.currentPanel = new Picker.FreespinWheelScreen(view.getContainerById("PICKER"), this.pickerConfig);
                this.currentPanel.getEvent().add($bind(this, this.onWheelScreenChanged));
                this.initialized = true;
                this.container.addChild(this.currentPanel.view.getDisplayObject());
                this.currentPanel.hide();
                this.updateLayout();
            }
        };
        Picker.Picker.prototype.updateLayout = function() {
            var $it0 = this.layoutPayload.containers.keys();
            while ($it0.hasNext()) {
                var layerId = $it0.next();
                var layerPayload = this.layoutPayload.containers.get(layerId);
                var cfg = layerPayload.configuration;
                var stage;
                var this1 = Picker.ExternalService.displayProvider.getStages();
                stage = this1.get(layerPayload.stage);
                if (this.flag_addedToStage) stage.removeChild(this.container);
                this.container.setZIndex(layerPayload.zIndex);
                this.container.setX(layerPayload.left);
                this.container.setY(layerPayload.top);
                var userData = this.container.getChildren()[0].getUserData();
                if (cfg != null) this.currentPanel.setConfig(cfg, stage);
                this.container.setScaleX(layerPayload.width / userData.viewBuilderW);
                this.container.setScaleY(layerPayload.height / userData.viewBuilderH);
                stage.addChild(this.container);
                this.flag_addedToStage = true;
                this.layoutPort.getComponentLayoutUpdated().publish(this.context.getInstance());
            }
        };
        Picker.Picker.prototype.__class__ = Picker.Picker;
        Picker.PickerConfig = function() {};
        Picker.PickerConfig.__name__ = ["Picker", "PickerConfig"];
        Picker.PickerConfig.prototype.rotationPhases = null;
        Picker.PickerConfig.prototype.awatingCyclesAmout = null;
        Picker.PickerConfig.prototype.__class__ = Picker.PickerConfig;
        Picker.PickerFactory = function(context) {
            this.context = context;
        };
        Picker.PickerFactory = ck_implements(Picker.PickerFactory, clientkernelModulesApi.IService);
        Picker.PickerFactory = ck_implements(Picker.PickerFactory, componentmodelComponentApi.IComponentFactory);
        Picker.PickerFactory.__interfaces__ = [clientkernelModulesApi.IService, componentmodelComponentApi.IComponentFactory];
        Picker.PickerFactory.__name__ = ["Picker", "PickerFactory"];
        Picker.PickerFactory.prototype.context = null;
        Picker.PickerFactory.prototype.getComponentDeclaration = function() {
            return PickerApi.PickerDeclaration;
        };
        Picker.PickerFactory.prototype.createComponent = function(context) {
            var cfgId = context.getConfiguration();
            new Picker.Picker(context, cfgId);
        };
        Picker.PickerFactory.prototype.__class__ = Picker.PickerFactory;
        Picker.WheelAnimator = function(animatedObject, configuration) {
            this.pickerConfig = configuration;
            this.wheel = animatedObject;
            this.wheel.setCacheAsBitmap(true);
            this.setDefaultState();
            this.initEvent();
        };
        Picker.WheelAnimator.__name__ = ["Picker", "WheelAnimator"];
        Picker.WheelAnimator.prototype.pickerConfig = null;
        Picker.WheelAnimator.prototype.wheel = null;
        Picker.WheelAnimator.prototype.stoppingPosition = null;
        Picker.WheelAnimator.prototype.stopStripIndex = null;
        Picker.WheelAnimator.prototype.event = null;
        Picker.WheelAnimator.prototype.currentPhase = null;
        Picker.WheelAnimator.prototype.sectorProgress = null;
        Picker.WheelAnimator.prototype.rotateTween = null;
        Picker.WheelAnimator.prototype.phaseParam = null;
        Picker.WheelAnimator.prototype.playWheelRotation = function() {
            var phaseParam = this.pickerConfig.rotationPhases[this.currentPhase];
            var endAngle = 180.0 * phaseParam.cyclesPerPhase;
            var duration = phaseParam.cyclesPerPhase * phaseParam.timePerCycle;
            this.rotateTween = displayEngineUtils.TweenX.to(this.wheel, {
                rotation: endAngle
            }, duration, null, null, null, null, null, null, null, {
                fileName: "WheelAnimator.hx",
                lineNumber: 46,
                className: "components.picker.WheelAnimator",
                methodName: "playWheelRotation"
            }).ease(displayEngineUtils.EaseX.quadIn).onFinish($bind(this, this.startNextRotationPhase)).onUpdate($bind(this, this.rotate));
        };
        Picker.WheelAnimator.prototype.startNextRotationPhase = function() {
            this.stopTween();
            if (this.stopStripIndex >= 0) {
                this.currentPhase++;
                var phaseParam = this.pickerConfig.rotationPhases[this.currentPhase];
                var angle = this.wheel.getRotation() + 180.0 * phaseParam.cyclesPerPhase;
                var duration = phaseParam.cyclesPerPhase * phaseParam.timePerCycle;
                this.rotateTween = displayEngineUtils.TweenX.to(this.wheel, {
                    rotation: angle
                }, duration, null, null, null, null, null, null, null, {
                    fileName: "WheelAnimator.hx",
                    lineNumber: 56,
                    className: "components.picker.WheelAnimator",
                    methodName: "startNextRotationPhase"
                }).ease(displayEngineUtils.EaseX.linear).onFinish($bind(this, this.startStoppingRotationPhase)).onUpdate($bind(this, this.rotate));
            } else {
                var phaseParam1 = this.pickerConfig.rotationPhases[this.currentPhase];
                var angle1 = this.wheel.getRotation() + 180.0 * this.pickerConfig.awatingCyclesAmout;
                var duration1 = this.pickerConfig.awatingCyclesAmout * phaseParam1.timePerCycle;
                this.rotateTween = displayEngineUtils.TweenX.to(this.wheel, {
                    rotation: angle1
                }, duration1, null, null, null, null, null, null, null, {
                    fileName: "WheelAnimator.hx",
                    lineNumber: 61,
                    className: "components.picker.WheelAnimator",
                    methodName: "startNextRotationPhase"
                }).ease(displayEngineUtils.EaseX.linear).onFinish($bind(this, this.startNextRotationPhase)).onUpdate($bind(this, this.rotate));
            }
        };
        Picker.WheelAnimator.prototype.startStoppingRotationPhase = function() {
            this.stopTween();
            this.currentPhase++;
            this.calculateStoppingAngle();
            var phaseParam = this.pickerConfig.rotationPhases[this.currentPhase];
            this.wheel.setRotation(this.wheel.getRotation() % 360);
            var angle;
            if (this.wheel.getRotation() < this.stoppingPosition) angle = this.stoppingPosition;
            else angle = 360 + this.stoppingPosition;
            var duration = phaseParam.cyclesPerPhase * phaseParam.timePerCycle;
            this.rotateTween = displayEngineUtils.TweenX.to(this.wheel, {
                rotation: angle
            }, duration, null, null, null, null, null, null, null, {
                fileName: "WheelAnimator.hx",
                lineNumber: 73,
                className: "components.picker.WheelAnimator",
                methodName: "startStoppingRotationPhase"
            }).ease(displayEngineUtils.EaseX.cubicOut).onFinish($bind(this, this.stoppingWheel)).onUpdate($bind(this, this.rotate));
        };
        Picker.WheelAnimator.prototype.stopTween = function() {
            if (this.rotateTween != null) {
                this.rotateTween.stop();
                this.rotateTween = null;
            }
        };
        Picker.WheelAnimator.prototype.setIdle = function() {
            this.stopTween();
            this.rotateTween = displayEngineUtils.TweenX.to(this.wheel, {
                rotation: 0
            }, 1, null, null, null, null, null, null, null, {
                fileName: "WheelAnimator.hx",
                lineNumber: 85,
                className: "components.picker.WheelAnimator",
                methodName: "setIdle"
            }).onFinish($bind(this, this.onIdle));
        };
        Picker.WheelAnimator.prototype.onIdle = function() {
            this.setDefaultState();
        };
        Picker.WheelAnimator.prototype.setDefaultState = function() {
            this.currentPhase = 0;
            this.stopStripIndex = -1;
            this.wheel.setRotation(0);
        };
        Picker.WheelAnimator.prototype.stop = function(data) {
            this.stopStripIndex = data;
        };
        Picker.WheelAnimator.prototype.calculateStoppingAngle = function() {
            var stop = 270.0 - 30.0 * this.stopStripIndex;
            if (stop > 0) this.stoppingPosition = stop;
            else this.stoppingPosition = 360 + stop;
        };
        Picker.WheelAnimator.prototype.rotate = function() {
            var rotation = _hcmn_.Std["int"](this.wheel.getRotation()) % 360;
            var newSectorProgress = rotation % 30.0 | 0;
            if (this.sectorProgress > newSectorProgress) this.event.dispatch(Picker.Picker.WHEEL_SPINNING);
            this.sectorProgress = newSectorProgress;
        };
        Picker.WheelAnimator.prototype.stoppingWheel = function() {
            this.stopTween();
            this.wheel.setCacheAsBitmap(false);
            this.event.dispatch(Picker.Picker.WHEEL_STOPPED);
        };
        Picker.WheelAnimator.prototype.initEvent = function() {
            this.event = new _hcmn_.msignal_Signal1();
        };
        Picker.WheelAnimator.prototype.getEvent = function() {
            return this.event;
        };
        Picker.WheelAnimator.prototype.__class__ = Picker.WheelAnimator;
        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;
        Picker.ExternalService.loadedAssets = new _hcmn_.haxe_ds_StringMap();;
        Picker.ExternalService.loading = 0;;
        Picker.ExternalService.totalLoaded = 0;;
        Picker.FreespinWheelScreen.CONNECTING_STATE = "CONNECTING_STATE";;
        Picker.FreespinWheelScreen.CONNECTED_STATE = "CONNECTED_STATE";;
        Picker.Picker.SPIN_BTN_PRESSED = "picker:spinBtnPressed";;
        Picker.Picker.WHEEL_STARTED = "picker:wheelStarted";;
        Picker.Picker.WHEEL_STOPPED = "picker:wheelStopped";;
        Picker.Picker.WHEEL_SPINNING = "picker:wheelSpinning";;
        Picker.WheelAnimator.DEGREE_PER_SECTOR = 30.0;;
        Picker.WheelAnimator.DEGREE_TO_ARROW = 270.0;;
        Picker.WheelAnimator.BASIC_ANGLE = 180.0;;
        return {
            exports: Picker,
            activator: Picker.Activator
        };
    });
//# sourceURL=wildFuryPicker.js