define("ballooniesIXFSlotModelGleGamePlugin", ["clientkernelLoaderApi", "slotModelApi", "slotmodelGamePluginCommonGle", "money", "clientkernelEventbusApi", "clientkernelModulesApi", "slotmodelGamePluginApi", "clientkernelLoggerApi"],
    function(clientkernelLoaderApi, slotModelApi, slotmodelGamePluginCommonGle, money, clientkernelEventbusApi, clientkernelModulesApi, slotmodelGamePluginApi, clientkernelLoggerApi) {
        "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 ballooniesIXFSlotModelGleGamePlugin == 'undefined') {
            var ballooniesIXFSlotModelGleGamePlugin = {};
        };
        ballooniesIXFSlotModelGleGamePlugin.BonusParser = function(commonParser) {
            this.commonParser = commonParser;
        };
        ballooniesIXFSlotModelGleGamePlugin.BonusParser.__name__ = ["ballooniesIXFSlotModelGleGamePlugin", "BonusParser"];
        ballooniesIXFSlotModelGleGamePlugin.BonusParser.prototype.commonParser = null;
        ballooniesIXFSlotModelGleGamePlugin.BonusParser.prototype.parseBonus = function(platformResponse, stage) {
            var reelsInfo = this.parseHiglight(platformResponse, "BaseGame.Bonus");
            if (reelsInfo == null) return null;
            var win = ballooniesIXFSlotModelGleGamePlugin.Helper.createBonusWin("BaseGame.Bonus", "BaseGame.Bonus", 0, reelsInfo);
            return [win];
        };
        ballooniesIXFSlotModelGleGamePlugin.BonusParser.prototype.parseHiglight = function(platformResponse, name) {
            var bonus = this.commonParser.parseHighlightOutcome(platformResponse, name);
            if (bonus == null) return null;
            var highlight = slotmodelGamePluginCommonGle.StdHelper.getArrayField(bonus, "Highlight");
            if (highlight == null) return null;
            if (this.isHiglightEmpty(highlight)) return null;
            var reelsInfo = ballooniesIXFSlotModelGleGamePlugin.Helper.createIntMatrix(5, 3);
            var _g1 = 0;
            var _g = highlight.length;
            while (_g1 < _g) {
                var i = _g1++;
                var cells = slotmodelGamePluginCommonGle.StdHelper.getArrayField(highlight[i], "Cell");
                if (cells != null) ballooniesIXFSlotModelGleGamePlugin.Helper.fillMatrix(reelsInfo, cells);
            }
            return reelsInfo;
        };
        ballooniesIXFSlotModelGleGamePlugin.BonusParser.prototype.isHiglightEmpty = function(highlight) {
            var _g1 = 0;
            var _g = highlight.length;
            while (_g1 < _g) {
                var i = _g1++;
                var cells = slotmodelGamePluginCommonGle.StdHelper.getArrayField(highlight[i], "Cell");
                if (cells != null) return false;
            }
            return true;
        };
        ballooniesIXFSlotModelGleGamePlugin.BonusParser.prototype.parseCustomFields = function(platformResponse) {
            return {
                multipliers: this.getTriggeredMultipliers(platformResponse),
                baseGameTotalWin: this.getBaseGameTotalWin(platformResponse),
                fsTotalPrevious: this.getFSTotalPrevious(platformResponse),
                fsTotalWin: this.getFSTotalWin(platformResponse),
                fsSingleWin: this.getSingleFreeSpinWin(platformResponse),
                totalMultiplier: this.getTotalMultiplier(platformResponse),
                totalFSMultiplier: this.getTotalFSMultiplier(platformResponse)
            };
        };
        ballooniesIXFSlotModelGleGamePlugin.BonusParser.prototype.getTriggeredMultipliers = function(platformResponse) {
            var triggerOutcome = slotmodelGamePluginCommonGle.StdHelper.getArrayField(platformResponse, "TriggerOutcome");
            if (triggerOutcome == null) return null;
            var multiplier = null;
            var outcomeRE = new _hcmn_.EReg("[^\\.]+\\.AppliedTriggers", "");
            var valueRE = new _hcmn_.EReg("multiplier,(\\d)+", "");
            var _g = 0;
            while (_g < triggerOutcome.length) {
                var entry = triggerOutcome[_g];
                ++_g;
                var name = slotmodelGamePluginCommonGle.StdHelper.getField(entry, "@name");
                var trigger = slotmodelGamePluginCommonGle.StdHelper.getArrayField(entry, "Trigger");
                if (outcomeRE.match(name) && trigger != null) {
                    multiplier = [];
                    var _g1 = 0;
                    while (_g1 < trigger.length) {
                        var e = trigger[_g1];
                        ++_g1;
                        var triggerName = slotmodelGamePluginCommonGle.StdHelper.getField(e, "@name");
                        if (valueRE.match(triggerName)) {
                            var value = _hcmn_.Std.parseInt(valueRE.matched(1));
                            multiplier.push(value);
                        }
                    }
                }
            }
            return multiplier;
        };
        ballooniesIXFSlotModelGleGamePlugin.BonusParser.prototype.getTotalMultiplier = function(platformResponse) {
            var multiplierOutcome = slotmodelGamePluginCommonGle.StdHelper.getField(platformResponse, "MultiplierOutcome");
            if (multiplierOutcome != null) {
                var multiplier = slotmodelGamePluginCommonGle.StdHelper.getField(multiplierOutcome, "Multiplier");
                if (multiplier != null) {
                    var value = slotmodelGamePluginCommonGle.StdHelper.getField(multiplier, "#text");
                    if (value == null) return 0;
                    else return _hcmn_.Std.parseInt(value);
                }
            }
            return 0;
        };
        ballooniesIXFSlotModelGleGamePlugin.BonusParser.prototype.getTotalFSMultiplier = function(platformResponse) {
            var multiplierOutcome = slotmodelGamePluginCommonGle.StdHelper.getArrayField(platformResponse, "MultiplierOutcome");
            if (multiplierOutcome != null) {
                var _g = 0;
                while (_g < multiplierOutcome.length) {
                    var mo = multiplierOutcome[_g];
                    ++_g;
                    var name = slotmodelGamePluginCommonGle.StdHelper.getField(mo, "@name");
                    if (name == "FreeSpin.Multiplier") {
                        var multiplier = slotmodelGamePluginCommonGle.StdHelper.getField(mo, "Multiplier");
                        if (multiplier == null) return 0;
                        else return _hcmn_.Std.parseInt(slotmodelGamePluginCommonGle.StdHelper.getField(multiplier, "#text"));
                    }
                }
            }
            return 0;
        };
        ballooniesIXFSlotModelGleGamePlugin.BonusParser.prototype.getSingleFreeSpinWin = function(platformResponse) {
            var fsSingleOutcome = this.parseResponseOutcome(platformResponse, "PrizeOutcome", "FreeSpin.Total.SingleFreeSpin");
            if (fsSingleOutcome == null) return 0;
            else return _hcmn_.Std.parseFloat(slotmodelGamePluginCommonGle.StdHelper.getField(fsSingleOutcome, "@totalPay"));
        };
        ballooniesIXFSlotModelGleGamePlugin.BonusParser.prototype.getBaseGameTotalWin = function(platformResponse) {
            var baseGameTotal = this.parseResponseOutcome(platformResponse, "PrizeOutcome", "BaseGame.Total");
            if (baseGameTotal == null) return 0;
            else return _hcmn_.Std.parseFloat(slotmodelGamePluginCommonGle.StdHelper.getField(baseGameTotal, "@totalPay"));
        };
        ballooniesIXFSlotModelGleGamePlugin.BonusParser.prototype.getFSTotalPrevious = function(platformResponse) {
            var fsTotalOutcome = this.parseResponseOutcome(platformResponse, "PrizeOutcome", "FreeSpin.Total.Previous");
            if (fsTotalOutcome == null) return 0;
            else return _hcmn_.Std.parseFloat(slotmodelGamePluginCommonGle.StdHelper.getField(fsTotalOutcome, "@totalPay"));
        };
        ballooniesIXFSlotModelGleGamePlugin.BonusParser.prototype.getFSTotalWin = function(platformResponse) {
            var fsTotalOutcome = this.parseResponseOutcome(platformResponse, "PrizeOutcome", "FreeSpin.Total");
            if (fsTotalOutcome == null) return 0;
            else return _hcmn_.Std.parseFloat(slotmodelGamePluginCommonGle.StdHelper.getField(fsTotalOutcome, "@totalPay"));
        };
        ballooniesIXFSlotModelGleGamePlugin.BonusParser.prototype.parseResponseOutcome = function(platformResponse, outcomeName, fieldName) {
            var populationOutcomes = slotmodelGamePluginCommonGle.StdHelper.getArrayField(platformResponse, outcomeName);
            if (populationOutcomes == null) return null;
            var result = null;
            var _g = 0;
            while (_g < populationOutcomes.length) {
                var populationOutcome = populationOutcomes[_g];
                ++_g;
                var name = slotmodelGamePluginCommonGle.StdHelper.getField(populationOutcome, "@name");
                if (name == fieldName) return result = populationOutcome;
            }
            return result;
        };
        ballooniesIXFSlotModelGleGamePlugin.BonusParser.prototype.getRowIndex = function(cellName) {
            var result = [];
            var r = new _hcmn_.EReg("L.C(\\d)R.", "");
            r.match(cellName);
            return _hcmn_.Std.parseInt(r.matched(1));
        };
        ballooniesIXFSlotModelGleGamePlugin.BonusParser.prototype.getStage = function(platformResponse) {
            var outcomeDetail = slotmodelGamePluginCommonGle.StdHelper.getField(platformResponse, "OutcomeDetail");
            var stage = slotmodelGamePluginCommonGle.StdHelper.getField(outcomeDetail, "Stage");
            if (new _hcmn_.EReg("^BaseGame", "").match(stage)) return "BaseGame";
            return "FreeSpin";
        };
        ballooniesIXFSlotModelGleGamePlugin.BonusParser.prototype.__class__ = ballooniesIXFSlotModelGleGamePlugin.BonusParser;
        ballooniesIXFSlotModelGleGamePlugin.GamePlugin = function() {
            this.commonParser = new slotmodelGamePluginCommonGle.PfPluginCommonResponseParser(ballooniesIXFSlotModelGleGamePlugin.GamePlugin.GAME_ID, $bind(this, this.onError), ballooniesIXFSlotModelGleGamePlugin.GamePlugin.PF_RESPONSE_PARSER_ERROR_ID);
            this.bonusParser = new ballooniesIXFSlotModelGleGamePlugin.BonusParser(this.commonParser);
        };
        ballooniesIXFSlotModelGleGamePlugin.GamePlugin = ck_implements(ballooniesIXFSlotModelGleGamePlugin.GamePlugin, clientkernelModulesApi.IService);
        ballooniesIXFSlotModelGleGamePlugin.GamePlugin = ck_implements(ballooniesIXFSlotModelGleGamePlugin.GamePlugin, slotmodelGamePluginApi.IGamePlugin);
        ballooniesIXFSlotModelGleGamePlugin.GamePlugin.__interfaces__ = [clientkernelModulesApi.IService, slotmodelGamePluginApi.IGamePlugin];
        ballooniesIXFSlotModelGleGamePlugin.GamePlugin.__name__ = ["ballooniesIXFSlotModelGleGamePlugin", "GamePlugin"];
        ballooniesIXFSlotModelGleGamePlugin.GamePlugin.prototype.commonParser = null;
        ballooniesIXFSlotModelGleGamePlugin.GamePlugin.prototype.bonusParser = null;
        ballooniesIXFSlotModelGleGamePlugin.GamePlugin.prototype.getAdditionalLineWins = function(platformResponse, stage, slotDefinition) {
            throw new js._Boot.HaxeError("Not implemented");
        };
        ballooniesIXFSlotModelGleGamePlugin.GamePlugin.prototype.getBonusWins = function(platformResponse, stage, slotDefinition) {
            var bonusWins = null;
            if (stage == "BaseGame" || stage == "BaseGameTumble") bonusWins = this.bonusParser.parseBonus(platformResponse, stage);
            return bonusWins;
        };
        ballooniesIXFSlotModelGleGamePlugin.GamePlugin.prototype.getCustomBigWin = function(totalStakeCredit, totalWinCredit) {
            throw new js._Boot.HaxeError("Not implemented");
        };
        ballooniesIXFSlotModelGleGamePlugin.GamePlugin.prototype.getImplementedFeatures = function() {
            return [slotmodelGamePluginApi.EPluginFeature.BONUS_OUTCOMES, slotmodelGamePluginApi.EPluginFeature.CUSTOM_FIELD];
        };
        ballooniesIXFSlotModelGleGamePlugin.GamePlugin.prototype.getNextSpinStripeLayersForSynchronizedReels = function(platformResponse, slotDefinition) {
            throw new js._Boot.HaxeError("Not implemented");
        };
        ballooniesIXFSlotModelGleGamePlugin.GamePlugin.prototype.getNextSpinStripeLayersPerBet = function(platformResponse, slotDefinition) {
            throw new js._Boot.HaxeError("Not implemented");
        };
        ballooniesIXFSlotModelGleGamePlugin.GamePlugin.prototype.getProgressMeter = function(platformResponse, slotDefinition) {
            throw new js._Boot.HaxeError("Not implemented");
        };
        ballooniesIXFSlotModelGleGamePlugin.GamePlugin.prototype.getResumePerStake = function(platformResponse, slotDefinition) {
            throw new js._Boot.HaxeError("Not implemented");
        };
        ballooniesIXFSlotModelGleGamePlugin.GamePlugin.prototype.getScatterWins = function(platformResponse, stage, slotDefinition) {
            throw new js._Boot.HaxeError("Not implemented");
        };
        ballooniesIXFSlotModelGleGamePlugin.GamePlugin.prototype.parseCustomField = function(platformResponse) {
            return this.bonusParser.parseCustomFields(platformResponse);
        };
        ballooniesIXFSlotModelGleGamePlugin.GamePlugin.prototype.stop = function(context) {};
        ballooniesIXFSlotModelGleGamePlugin.GamePlugin.prototype.onError = function(error) {
            slotmodelGamePluginCommonGle.Log.getLogger(this).error("[GamePlugin][" + error.id + "] " + error.message);
            throw new js._Boot.HaxeError(error);
        };
        ballooniesIXFSlotModelGleGamePlugin.GamePlugin.prototype.__class__ = ballooniesIXFSlotModelGleGamePlugin.GamePlugin;
        ballooniesIXFSlotModelGleGamePlugin.Helper = function() {};
        ballooniesIXFSlotModelGleGamePlugin.Helper.__name__ = ["ballooniesIXFSlotModelGleGamePlugin", "Helper"];
        ballooniesIXFSlotModelGleGamePlugin.Helper.createIntMatrix = function(columns, rows) {
            var _g = [];
            var _g1 = 0;
            while (_g1 < columns) {
                var i = _g1++;
                _g.push((function($this) {
                    var $r;
                    var _g2 = []; {
                        var _g3 = 0;
                        while (_g3 < rows) {
                            var j = _g3++;
                            _g2.push(0);
                        }
                    }
                    $r = _g2;
                    return $r;
                }(this)));
            }
            return _g;
        };
        ballooniesIXFSlotModelGleGamePlugin.Helper.fillMatrix = function(mat, cells) {
            var _g1 = 0;
            var _g = cells.length;
            while (_g1 < _g) {
                var i = _g1++;
                var name = _hcmn_.Reflect.field(cells[i], ballooniesIXFSlotModelGleGamePlugin.Helper.NAME);
                var position = ballooniesIXFSlotModelGleGamePlugin.Helper.parsePosition(_hcmn_.Reflect.field(cells[i], ballooniesIXFSlotModelGleGamePlugin.Helper.NAME));
                mat[position.x][position.y] = 1;
            }
            return cells.length;
        };
        ballooniesIXFSlotModelGleGamePlugin.Helper.createBonusWin = function(type, id, lineId, path) {
            var win = new slotmodelGamePluginCommonGle.BonusWin(type, id, "", lineId);
            win.setWinPath(new slotModelApi.ReelPictureInfo(path));
            win.setPayProperties(0, new money.Money("0"), 0, 0);
            return win;
        };
        ballooniesIXFSlotModelGleGamePlugin.Helper.parsePosition = function(name) {
            var pos = {
                x: _hcmn_.Std.parseInt(name.charAt(3)),
                y: _hcmn_.Std.parseInt(name.charAt(5))
            };
            return pos;
        };
        ballooniesIXFSlotModelGleGamePlugin.Helper.prototype.__class__ = ballooniesIXFSlotModelGleGamePlugin.Helper;
        ballooniesIXFSlotModelGleGamePlugin.ModuleActivator = function() {};
        ballooniesIXFSlotModelGleGamePlugin.ModuleActivator = ck_implements(ballooniesIXFSlotModelGleGamePlugin.ModuleActivator, clientkernelModulesApi.IModuleActivator);
        ballooniesIXFSlotModelGleGamePlugin.ModuleActivator.__interfaces__ = [clientkernelModulesApi.IModuleActivator];
        ballooniesIXFSlotModelGleGamePlugin.ModuleActivator.__name__ = ["ballooniesIXFSlotModelGleGamePlugin", "ModuleActivator"];
        ballooniesIXFSlotModelGleGamePlugin.ModuleActivator.prototype.gamePlugin = null;
        ballooniesIXFSlotModelGleGamePlugin.ModuleActivator.prototype.registration = null;
        ballooniesIXFSlotModelGleGamePlugin.ModuleActivator.prototype.start = function(context) {
            var _g = this;
            context.getServiceTracker([clientkernelLoaderApi.IAssetRegistry, clientkernelLoggerApi.ILoggerFactory, clientkernelEventbusApi.IEventBus]).then(function(context1) {
                _g.gamePlugin = new ballooniesIXFSlotModelGleGamePlugin.GamePlugin();
                _g.registration = context1.registerService(_g.gamePlugin, slotmodelGamePluginApi.IGamePlugin, null);
            });
        };
        ballooniesIXFSlotModelGleGamePlugin.ModuleActivator.prototype.stop = function(context) {
            if (this.gamePlugin != null) this.gamePlugin.stop(context);
            if (this.registration != null) this.registration.unregister();
        };
        ballooniesIXFSlotModelGleGamePlugin.ModuleActivator.main = function() {};
        ballooniesIXFSlotModelGleGamePlugin.ModuleActivator.prototype.__class__ = ballooniesIXFSlotModelGleGamePlugin.ModuleActivator;
        if (typeof haxe == 'undefined') {
            var haxe = {};
        };

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

        };
        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;
        ballooniesIXFSlotModelGleGamePlugin.GamePlugin.GAME_ID = "ballooniesixf";;
        ballooniesIXFSlotModelGleGamePlugin.GamePlugin.PF_RESPONSE_PARSER_ERROR_ID = 9999;;
        ballooniesIXFSlotModelGleGamePlugin.Helper.NAME = "@name";;
        return {
            exports: ballooniesIXFSlotModelGleGamePlugin,
            activator: ballooniesIXFSlotModelGleGamePlugin.ModuleActivator
        };
    });
//# sourceURL=ballooniesIxfSlotModelGleGamePlugin.js