define("commonControls", ["componentmodelComponentApi", "slotModelApi", "winMeterApi", "winControllerApi", "reelsApi", "gameLayoutApi", "clientkernelEventbusApi", "infoBarApi", "backgroundApi", "paytableApi", "betPanelApi"],
    function(componentmodelComponentApi, slotModelApi, winMeterApi, winControllerApi, reelsApi, gameLayoutApi, clientkernelEventbusApi, infoBarApi, backgroundApi, paytableApi, betPanelApi) {
        "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 commonControls == 'undefined') {
            var commonControls = {};
        };
        commonControls.ControlsInjector = function(context) {
            this.context = context;
            this.initializeProvider();
        };
        commonControls.ControlsInjector.__name__ = ["commonControls", "ControlsInjector"];
        commonControls.ControlsInjector.prototype.context = null;
        commonControls.ControlsInjector.prototype.controlProviderMap = null;
        commonControls.ControlsInjector.prototype.inject = function(object) {
            var fields = this.getInjectedFields(object);
            var _g = 0;
            while (_g < fields.length) {
                var field = fields[_g];
                ++_g;
                var control = ((function($this) {
                    var $r;
                    var key = field.toLowerCase();
                    $r = $this.controlProviderMap.get(key);
                    return $r;
                }(this)))();
                object[field] = control;
            }
            return object;
        };
        commonControls.ControlsInjector.prototype.getInjectedFields = function(object) {
            var _g = this;
            var protoFields = _hcmn_.Reflect.fields(object.__proto__).filter(function(field) {
                var key = field.toLowerCase();
                return _g.controlProviderMap.exists(key);
            });
            var fields = _hcmn_.Reflect.fields(object).filter(function(field1) {
                var key1 = field1.toLowerCase();
                return _g.controlProviderMap.exists(key1);
            });
            var _g1 = 0;
            while (_g1 < protoFields.length) {
                var protoField = protoFields[_g1];
                ++_g1;
                if (_hcmn_.HxOverrides.indexOf(fields, protoField, 0) == -1) fields.push(protoField);
            }
            return fields;
        };
        commonControls.ControlsInjector.prototype.initializeProvider = function() {
            var _g = this;
            this.controlProviderMap = new _hcmn_.haxe_ds_StringMap();
            this.registerInject(commonControls.InfoBarControl, function() {
                return new commonControls.InfoBarControl(_g.getUsedPort(infoBarApi.IInfoBarPort));
            });
            this.registerInject(commonControls.ReelsControl, function() {
                return new commonControls.ReelsControl(_g.getUsedPort(reelsApi.IReelsPort));
            });
            this.registerInject(commonControls.BetPanelControl, function() {
                return new commonControls.BetPanelControl(_g.getUsedPort(betPanelApi.IBetPanelPort));
            });
            this.registerInject(commonControls.WinControllerControl, function() {
                return new commonControls.WinControllerControl(_g.getUsedPort(winControllerApi.IWinControllerPort));
            });
            this.registerInject(commonControls.PaytableControl, function() {
                return new commonControls.PaytableControl(_g.getUsedPort(paytableApi.IPaytablePort));
            });
            this.registerInject(commonControls.WinMeterControl, function() {
                return new commonControls.WinMeterControl(_g.getUsedPort(winMeterApi.IWinMeterPort));
            });
            this.registerInject(commonControls.BackgroundControl, function() {
                return new commonControls.BackgroundControl(_g.getUsedPort(backgroundApi.IBackgroundPort));
            });
            this.registerInject(commonControls.GameLayoutControl, function() {
                return new commonControls.GameLayoutControl(_g.getUsedPort(gameLayoutApi.IGameLayoutPort));
            });
            var _g1 = 0;
            var _g11 = this.getUsedPorts();
            while (_g1 < _g11.length) {
                var usedPort = _g11[_g1];
                ++_g1;
                var classOfPort;
                if (usedPort == null) classOfPort = null;
                else classOfPort = _hcmn_.js_Boot.getClass(usedPort);
                this.registerInjectionValue(classOfPort, usedPort);
            }
        };
        commonControls.ControlsInjector.prototype.registerInjectionValue = function(injectionClass, value) {
            var simpleClassName = this.getSimpleClassName(injectionClass);
            this.registerCustomInjectionValue(simpleClassName, value);
        };
        commonControls.ControlsInjector.prototype.registerCustomInjectionValue = function(valueName, value) {
            this.registerCustomInject(valueName, function() {
                return value;
            });
        };
        commonControls.ControlsInjector.prototype.registerInject = function(injectionClass, valueProvider) {
            this.registerCustomInject(this.getSimpleClassName(injectionClass), valueProvider);
        };
        commonControls.ControlsInjector.prototype.registerPort = function(injectionClass) {
            var _g = this;
            this.registerCustomInject(this.getSimpleClassName(injectionClass), function() {
                return _g.getUsedPort(injectionClass);
            });
        };
        commonControls.ControlsInjector.prototype.registerCustomInject = function(name, valueProvider) {
            var key = name.toLowerCase();
            this.controlProviderMap.set(key, valueProvider);
        };
        commonControls.ControlsInjector.prototype.getUsedPorts = function() {
            return this.context.usedPorts;
        };
        commonControls.ControlsInjector.prototype.getUsedPort = function(port) {
            return this.context.getUsedPort(port);
        };
        commonControls.ControlsInjector.prototype.getSimpleClassName = function(object) {
            return new _hcmn_.EReg(".*\\.", "").replace(_hcmn_.Type.getClassName(object), "");
        };
        commonControls.ControlsInjector.prototype.__class__ = commonControls.ControlsInjector;
        commonControls.BackgroundControl = function(port) {
            this.backgroundPort = port;
        };
        commonControls.BackgroundControl.__name__ = ["commonControls", "BackgroundControl"];
        commonControls.BackgroundControl.prototype.backgroundPort = null;
        commonControls.BackgroundControl.prototype.show = function(id) {
            this.backgroundPort.showBackground().publish(id);
        };
        commonControls.BackgroundControl.prototype.hide = function() {
            this.backgroundPort.hideBackground().publish(null);
        };
        commonControls.BackgroundControl.prototype.__class__ = commonControls.BackgroundControl;
        commonControls.BetPanelControl = function(betPanelPort) {
            this.betPanelPort = betPanelPort;
        };
        commonControls.BetPanelControl.__name__ = ["commonControls", "BetPanelControl"];
        commonControls.BetPanelControl.prototype.betPanelPort = null;
        commonControls.BetPanelControl.prototype.disableButton = function(button, isDisable) {
            if (isDisable == null) isDisable = true;
            if (isDisable) this.betPanelPort.disableButton().publish(button);
            else this.enableButton(button);
        };
        commonControls.BetPanelControl.prototype.enableButton = function(button, isEnable) {
            if (isEnable == null) isEnable = true;
            if (isEnable) this.betPanelPort.enableButton().publish(button);
            else this.disableButton(button);
        };
        commonControls.BetPanelControl.prototype.hideBetPanell = function() {
            this.betPanelPort.hideBetPanell().publish(null);
        };
        commonControls.BetPanelControl.prototype.hideButton = function(button) {
            this.betPanelPort.hideButton().publish(button);
        };
        commonControls.BetPanelControl.prototype.hidePaytableControl = function() {
            this.betPanelPort.hidePaytableControl().publish(null);
        };
        commonControls.BetPanelControl.prototype.onButtonPressed = function(callback, button) {
            var _g = this;
            if (button != null) return this.betPanelPort.onButtonPressed().subscribe(function(e) {
                if (_g.isEButtonEquals(button, e.getPayload())) callback(e);
            });
            return this.betPanelPort.onButtonPressed().subscribe(callback);
        };
        commonControls.BetPanelControl.prototype.onStakeChanged = function(callback) {
            return this.betPanelPort.onStakeChanged().subscribe(callback);
        };
        commonControls.BetPanelControl.prototype.setAutoPlayButtonState = function(state) {
            this.betPanelPort.setAutoPlayButtonState().publish(state);
        };
        commonControls.BetPanelControl.prototype.setBalance = function(balance) {
            this.betPanelPort.setBalance().publish(balance);
        };
        commonControls.BetPanelControl.prototype.setContent = function(win, stake, balance) {
            this.betPanelPort.setContent().publish(new betPanelApi.BetPanelContentPayload(win, stake, balance));
        };
        commonControls.BetPanelControl.prototype.setCustomButtonState = function(button, state) {
            this.betPanelPort.setCustomButtonState().publish(new betPanelApi.CustomButtonStatePayload(button, state));
        };
        commonControls.BetPanelControl.prototype.setNumberOffAutoSpinsLeft = function(value) {
            this.betPanelPort.setNumberOffAutoSpinsLeft().publish(value);
        };
        commonControls.BetPanelControl.prototype.setStake = function(stake) {
            this.betPanelPort.setStake().publish(stake);
        };
        commonControls.BetPanelControl.prototype.showBetPanell = function() {
            this.betPanelPort.showBetPanell().publish(null);
        };
        commonControls.BetPanelControl.prototype.showButton = function(button) {
            this.betPanelPort.showButton().publish(button);
        };
        commonControls.BetPanelControl.prototype.showSkipButton = function(isEnable) {
            if (isEnable == null) isEnable = true;
            this.showButton(betPanelApi.EButton.SKIP);
            this.enableButton(betPanelApi.EButton.SKIP, isEnable);
        };
        commonControls.BetPanelControl.prototype.showSpinButton = function(isEnable) {
            if (isEnable == null) isEnable = true;
            this.showButton(betPanelApi.EButton.SPIN);
            this.enableButton(betPanelApi.EButton.SPIN, isEnable);
            this.enableButton(betPanelApi.EButton.MAX_BET, isEnable);
        };
        commonControls.BetPanelControl.prototype.showPaytableControl = function(value) {
            this.betPanelPort.showPaytableControl().publish(value);
        };
        commonControls.BetPanelControl.prototype.isEButtonEquals = function(eButton1, eButton2) {
            return _hcmn_.Type.enumEq(eButton1, eButton2) || eButton1.toLocaleString() == eButton2.toLocaleString();
        };
        commonControls.BetPanelControl.prototype.__class__ = commonControls.BetPanelControl;
        commonControls.GameLayoutControl = function(port) {
            this.port = port;
        };
        commonControls.GameLayoutControl.__name__ = ["commonControls", "GameLayoutControl"];
        commonControls.GameLayoutControl.prototype.port = null;
        commonControls.GameLayoutControl.prototype.onGameLayoutUpdated = function(callback) {
            return this.port.getGameLayoutUpdated().subscribe(function(e) {
                callback();
            });
        };
        commonControls.GameLayoutControl.prototype.onUpdateComponentLayout = function(callback, componentInstance) {
            if (componentInstance == null) return this.port.getUpdateComponentLayout().subscribe(callback);
            return this.port.getUpdateComponentLayout().subscribeForComponentInstance(componentInstance, callback);
        };
        commonControls.GameLayoutControl.prototype.cacheLayers = function(layers) {
            this.port.getCacheLayers().publish(layers);
        };
        commonControls.GameLayoutControl.prototype.unCacheLayers = function() {
            this.port.getUncacheLayers().publish(null);
        };
        commonControls.GameLayoutControl.prototype.componentLayoutUpdated = function(componentInstance) {
            this.port.getComponentLayoutUpdated().publish(componentInstance);
        };
        commonControls.GameLayoutControl.prototype.hideLayers = function(layers) {
            this.port.getHideLayers().publish(layers);
        };
        commonControls.GameLayoutControl.prototype.unHideLayers = function() {
            this.port.getUnhideLayers().publish(null);
        };
        commonControls.GameLayoutControl.prototype.__class__ = commonControls.GameLayoutControl;
        commonControls.InfoBarControl = function(infoBarPort) {
            this.infoBarPort = infoBarPort;
        };
        commonControls.InfoBarControl.__name__ = ["commonControls", "InfoBarControl"];
        commonControls.InfoBarControl.prototype.infoBarPort = null;
        commonControls.InfoBarControl.prototype.hideAll = function() {
            this.hideAllLabels();
            this.hideWinLineSummary();
        };
        commonControls.InfoBarControl.prototype.hideAllLabels = function() {
            this.hideLabel(infoBarApi.InfoBarLabelEnum.RIGHT);
            this.hideLabel(infoBarApi.InfoBarLabelEnum.LEFT);
            this.hideLabel(infoBarApi.InfoBarLabelEnum.CENTRAL);
        };
        commonControls.InfoBarControl.prototype.hideRightLabel = function() {
            this.hideLabel(infoBarApi.InfoBarLabelEnum.RIGHT);
        };
        commonControls.InfoBarControl.prototype.hideLeftLabel = function() {
            this.hideLabel(infoBarApi.InfoBarLabelEnum.LEFT);
        };
        commonControls.InfoBarControl.prototype.hideCentralLabel = function() {
            this.hideLabel(infoBarApi.InfoBarLabelEnum.CENTRAL);
        };
        commonControls.InfoBarControl.prototype.hideLabel = function(infoBarLabel) {
            this.infoBarPort.hideLabel().publish(infoBarLabel);
        };
        commonControls.InfoBarControl.prototype.hideWinLineSummary = function() {
            this.infoBarPort.hideWinLineSummary().publish(null);
        };
        commonControls.InfoBarControl.prototype.showRightLabel = function(value) {
            this.showLabel(infoBarApi.InfoBarLabelEnum.RIGHT, value);
        };
        commonControls.InfoBarControl.prototype.showLeftLabel = function(value) {
            this.showLabel(infoBarApi.InfoBarLabelEnum.LEFT, value);
        };
        commonControls.InfoBarControl.prototype.showCentralLabel = function(value) {
            this.showLabel(infoBarApi.InfoBarLabelEnum.CENTRAL, value);
        };
        commonControls.InfoBarControl.prototype.showLabel = function(infoBarLabel, value) {
            this.infoBarPort.showLabel().publish(new infoBarApi.LabelContentPayload(infoBarLabel, value));
        };
        commonControls.InfoBarControl.prototype.showWinLineSummary = function(linePicture, winId, winSum) {
            this.infoBarPort.showWinLineSummary().publish(new infoBarApi.WinLineSummaryPayload(linePicture, winId, winSum));
        };
        commonControls.InfoBarControl.prototype.__class__ = commonControls.InfoBarControl;
        commonControls.PaytableControl = function(paytablePort) {
            this.paytablePort = paytablePort;
        };
        commonControls.PaytableControl.__name__ = ["commonControls", "PaytableControl"];
        commonControls.PaytableControl.prototype.paytablePort = null;
        commonControls.PaytableControl.prototype.hide = function() {
            this.paytablePort.hide().publish(null);
        };
        commonControls.PaytableControl.prototype.show = function() {
            this.paytablePort.show().publish(null);
        };
        commonControls.PaytableControl.prototype.onPaytableClose = function(callback) {
            return this.paytablePort.onCloseButtonPressed().subscribe(callback);
        };
        commonControls.PaytableControl.prototype.__class__ = commonControls.PaytableControl;
        commonControls.ReelsControl = function(reelsPort) {
            this.reelsPort = reelsPort;
        };
        commonControls.ReelsControl.__name__ = ["commonControls", "ReelsControl"];
        commonControls.ReelsControl.prototype.reelsPort = null;
        commonControls.ReelsControl.prototype.onReelStopped = function(callback) {
            return this.reelsPort.onReelStopped().subscribe(callback);
        };
        commonControls.ReelsControl.prototype.onSpinStopped = function(callback) {
            return this.reelsPort.onSpinStopped().subscribe(callback);
        };
        commonControls.ReelsControl.prototype.onStartSpinReelPictureExit = function(callback) {
            return this.reelsPort.onStartSpinReelPictureExit().subscribe(callback);
        };
        commonControls.ReelsControl.prototype.onStoppingStarted = function(callback) {
            return this.reelsPort.onStoppingStarted().subscribe(callback);
        };
        commonControls.ReelsControl.prototype.setReelCellsVisibility = function(symbols) {
            this.reelsPort.setReelCellsVisibility().publish(symbols);
        };
        commonControls.ReelsControl.prototype.setReelPicture = function(reels) {
            this.reelsPort.setReelPicture().publish(reels);
        };
        commonControls.ReelsControl.prototype.setReelSkin = function(skin) {
            this.reelsPort.setReelSkin().publish(skin);
        };
        commonControls.ReelsControl.prototype.show = function() {
            this.reelsPort.show().publish(null);
        };
        commonControls.ReelsControl.prototype.hide = function() {
            this.reelsPort.hide().publish(null);
        };
        commonControls.ReelsControl.prototype.startSpin = function(startSpinPayload) {
            this.reelsPort.startSpin().publish(new reelsApi.StartSpinPayload(startSpinPayload));
        };
        commonControls.ReelsControl.prototype.stopSpin = function(reelPicture, tensionReels, tensionParams) {
            this.reelsPort.stopSpin().publish(new reelsApi.StopSpinPayload(reelPicture, tensionReels, tensionParams));
        };
        commonControls.ReelsControl.prototype.__class__ = commonControls.ReelsControl;
        commonControls.WinControllerControl = function(winControllerPort) {
            this.isWinPresentationActive = false;
            this.winControllerPort = winControllerPort;
        };
        commonControls.WinControllerControl.__name__ = ["commonControls", "WinControllerControl"];
        commonControls.WinControllerControl.prototype.winControllerPort = null;
        commonControls.WinControllerControl.prototype.isWinPresentationActive = null;
        commonControls.WinControllerControl.prototype.onCurrentWinLineShown = function(callback) {
            return this.onCurrentWinLine(function(winLinePayload) {
                callback(winLinePayload.win);
            });
        };
        commonControls.WinControllerControl.prototype.onCurrentWinLine = function(callback) {
            return this.winControllerPort.onCurrentWinLine().subscribe(function(e) {
                callback(e.getPayload());
            });
        };
        commonControls.WinControllerControl.prototype.onReady = function(callback) {
            return this.winControllerPort.onReady().subscribe(function(e) {
                callback();
            });
        };
        commonControls.WinControllerControl.prototype.onWinCycleFinished = function(callback) {
            return this.winControllerPort.onWinCycleFinished().subscribe(function(e) {
                callback();
            });
        };
        commonControls.WinControllerControl.prototype.reconfigure = function() {
            this.winControllerPort.reconfigure().publish(null);
        };
        commonControls.WinControllerControl.prototype.hide = function() {
            if (this.isWinPresentationActive) this.winControllerPort.dispose().publish(null);
            this.isWinPresentationActive = false;
        };
        commonControls.WinControllerControl.prototype.requestConfiguration = function(timeout) {
            if (timeout == null) timeout = 0;
            return this.winControllerPort.requestConfiguration().request(null, timeout);
        };
        commonControls.WinControllerControl.prototype.showWin = function(outcome, loop, frozenSymbols, timeout) {
            if (timeout == null) timeout = 0;
            if (loop == null) loop = false;
            return this.showWinPayload(new winControllerApi.ShowWinPayload(outcome, loop, frozenSymbols), timeout);
        };
        commonControls.WinControllerControl.prototype.showWinPayload = function(payload, timeout) {
            if (timeout == null) timeout = 0;
            this.isWinPresentationActive = true;
            return this.winControllerPort.showWin().request(payload, timeout);
        };
        commonControls.WinControllerControl.prototype.isActive = function() {
            return this.isWinPresentationActive;
        };
        commonControls.WinControllerControl.prototype.__class__ = commonControls.WinControllerControl;
        commonControls.WinMeterControl = function(winMeterPort) {
            this.winMeterPort = winMeterPort;
            this.winMeterImplemetationControl = new commonControls.WinMeterImplementationControl(winMeterPort);
        };
        commonControls.WinMeterControl.__name__ = ["commonControls", "WinMeterControl"];
        commonControls.WinMeterControl.prototype.winMeterPort = null;
        commonControls.WinMeterControl.prototype.displayingValue = null;
        commonControls.WinMeterControl.prototype.winMeterImplemetationControl = null;
        commonControls.WinMeterControl.prototype.getImplemetationControl = function() {
            return this.winMeterImplemetationControl;
        };
        commonControls.WinMeterControl.prototype.displayWin = function(winAmount, winSegments, instantShow, startingAmount) {
            if (instantShow == null) instantShow = false;
            this.displayingValue = winAmount;
            if (winAmount != "0") this.winMeterPort.displayWin().publish(new winMeterApi.WinMeterPayload(winAmount, winSegments, instantShow, startingAmount));
        };
        commonControls.WinMeterControl.prototype.onBigAnimationStart = function(callback) {
            return this.winMeterPort.onBigAnimationStart().subscribe(callback);
        };
        commonControls.WinMeterControl.prototype.onCountUpFinished = function(callback) {
            return this.winMeterPort.onCountUpFinished().subscribe(callback);
        };
        commonControls.WinMeterControl.prototype.onCountUpStarted = function(callback) {
            return this.winMeterPort.onCountUpStarted().subscribe(callback);
        };
        commonControls.WinMeterControl.prototype.onDisplayWinFinished = function(callback) {
            this.displayingValue = "";
            return this.winMeterPort.onDisplayWinFinished().subscribe(callback);
        };
        commonControls.WinMeterControl.prototype.onInterruptAvailable = function(callback) {
            return this.winMeterPort.onInterruptAvailable().subscribe(callback);
        };
        commonControls.WinMeterControl.prototype.onMediumAnimationStart = function(callback) {
            return this.winMeterPort.onMediumAnimationStart().subscribe(callback);
        };
        commonControls.WinMeterControl.prototype.clear = function() {
            this.displayingValue = "";
            this.showMessage(" ");
        };
        commonControls.WinMeterControl.prototype.showMessage = function(message) {
            this.winMeterPort.showMessage().publish(message);
        };
        commonControls.WinMeterControl.prototype.stop = function() {
            this.displayWin(this.displayingValue, [], true);
            this.displayingValue = "";
        };
        commonControls.WinMeterControl.prototype.__class__ = commonControls.WinMeterControl;
        commonControls.WinMeterImplementationControl = function(winMeterPort) {
            this.winMeterPort = winMeterPort;
        };
        commonControls.WinMeterImplementationControl.__name__ = ["commonControls", "WinMeterImplementationControl"];
        commonControls.WinMeterImplementationControl.prototype.winMeterPort = null;
        commonControls.WinMeterImplementationControl.prototype.onDisplayWin = function(callback) {
            return this.winMeterPort.displayWin().subscribe(function(e) {
                callback(e.getPayload());
            });
        };
        commonControls.WinMeterImplementationControl.prototype.onShowMessage = function(callback) {
            return this.winMeterPort.showMessage().subscribe(function(e) {
                callback(e.getPayload());
            });
        };
        commonControls.WinMeterImplementationControl.prototype.__class__ = commonControls.WinMeterImplementationControl;
        if (typeof haxe == 'undefined') {
            var haxe = {};
        };

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

        };
        return {
            exports: commonControls
        };
    });