define("paytable", ["viewBuilderApi", "componentmodelComponentApi", "translationmanagerApi", "clientkernelLoaderApi", "slotModelApi", "displayEngineApi", "clientkernelEventbusApi", "clientkernelModulesApi", "paytableApi", "moneyApi"],
    function(viewBuilderApi, componentmodelComponentApi, translationmanagerApi, clientkernelLoaderApi, slotModelApi, displayEngineApi, clientkernelEventbusApi, clientkernelModulesApi, paytableApi, moneyApi) {
        "use strict";

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

        function $bind(o, m) {
            if (m == null) return null;
            if (m.__id__ == null) m.__id__ = $fid++;
            var f;
            if (o.hx__closures__ == null) o.hx__closures__ = {};
            else f = o.hx__closures__[m.__id__];
            if (f == null) {
                f = function() {
                    return f.method.apply(f.scope, arguments);
                };
                f.scope = o;
                f.method = m;
                o.hx__closures__[m.__id__] = f;
            }
            return f;
        };
        var $_;
        var $estr = function() {
            return _hcmn_.js_Boot.__string_rec(this, '');
        };
        if (typeof haxe == 'undefined') {
            var haxe = {};
        };

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

        };
        if (!haxe.ds) {
            haxe.ds = {};
        };
        haxe.ds.BalancedTree = function() {};
        haxe.ds.BalancedTree.__name__ = ["haxe", "ds", "BalancedTree"];
        haxe.ds.BalancedTree.prototype.root = null;
        haxe.ds.BalancedTree.prototype.set = function(key, value) {
            this.root = this.setLoop(key, value, this.root);
        };
        haxe.ds.BalancedTree.prototype.get = function(key) {
            var node = this.root;
            while (node != null) {
                var c = this.compare(key, node.key);
                if (c == 0) return node.value;
                if (c < 0) node = node.left;
                else node = node.right;
            }
            return null;
        };
        haxe.ds.BalancedTree.prototype.setLoop = function(k, v, node) {
            if (node == null) return new haxe.ds.TreeNode(null, k, v, null);
            var c = this.compare(k, node.key);
            if (c == 0) return new haxe.ds.TreeNode(node.left, k, v, node.right, node == null ? 0 : node._height);
            else if (c < 0) {
                var nl = this.setLoop(k, v, node.left);
                return this.balance(nl, node.key, node.value, node.right);
            } else {
                var nr = this.setLoop(k, v, node.right);
                return this.balance(node.left, node.key, node.value, nr);
            }
        };
        haxe.ds.BalancedTree.prototype.balance = function(l, k, v, r) {
            var hl;
            if (l == null) hl = 0;
            else hl = l._height;
            var hr;
            if (r == null) hr = 0;
            else hr = r._height;
            if (hl > hr + 2) {
                if ((function($this) {
                        var $r;
                        var _this = l.left;
                        $r = _this == null ? 0 : _this._height;
                        return $r;
                    }(this)) >= (function($this) {
                        var $r;
                        var _this1 = l.right;
                        $r = _this1 == null ? 0 : _this1._height;
                        return $r;
                    }(this))) return new haxe.ds.TreeNode(l.left, l.key, l.value, new haxe.ds.TreeNode(l.right, k, v, r));
                else return new haxe.ds.TreeNode(new haxe.ds.TreeNode(l.left, l.key, l.value, l.right.left), l.right.key, l.right.value, new haxe.ds.TreeNode(l.right.right, k, v, r));
            } else if (hr > hl + 2) {
                if ((function($this) {
                        var $r;
                        var _this2 = r.right;
                        $r = _this2 == null ? 0 : _this2._height;
                        return $r;
                    }(this)) > (function($this) {
                        var $r;
                        var _this3 = r.left;
                        $r = _this3 == null ? 0 : _this3._height;
                        return $r;
                    }(this))) return new haxe.ds.TreeNode(new haxe.ds.TreeNode(l, k, v, r.left), r.key, r.value, r.right);
                else return new haxe.ds.TreeNode(new haxe.ds.TreeNode(l, k, v, r.left.left), r.left.key, r.left.value, new haxe.ds.TreeNode(r.left.right, r.key, r.value, r.right));
            } else return new haxe.ds.TreeNode(l, k, v, r, (hl > hr ? hl : hr) + 1);
        };
        haxe.ds.BalancedTree.prototype.compare = function(k1, k2) {
            return _hcmn_.Reflect.compare(k1, k2);
        };
        haxe.ds.BalancedTree.prototype.__class__ = haxe.ds.BalancedTree;
        haxe.ds.TreeNode = function(l, k, v, r, h) {
            if (h == null) h = -1;
            this.left = l;
            this.key = k;
            this.value = v;
            this.right = r;
            if (h == -1) this._height = ((function($this) {
                var $r;
                var _this = $this.left;
                $r = _this == null ? 0 : _this._height;
                return $r;
            }(this)) > (function($this) {
                var $r;
                var _this1 = $this.right;
                $r = _this1 == null ? 0 : _this1._height;
                return $r;
            }(this)) ? (function($this) {
                var $r;
                var _this2 = $this.left;
                $r = _this2 == null ? 0 : _this2._height;
                return $r;
            }(this)) : (function($this) {
                var $r;
                var _this3 = $this.right;
                $r = _this3 == null ? 0 : _this3._height;
                return $r;
            }(this))) + 1;
            else this._height = h;
        };
        haxe.ds.TreeNode.__name__ = ["haxe", "ds", "TreeNode"];
        haxe.ds.TreeNode.prototype.left = null;
        haxe.ds.TreeNode.prototype.right = null;
        haxe.ds.TreeNode.prototype.key = null;
        haxe.ds.TreeNode.prototype.value = null;
        haxe.ds.TreeNode.prototype._height = null;
        haxe.ds.TreeNode.prototype.__class__ = haxe.ds.TreeNode;
        haxe.ds.EnumValueMap = function() {
            haxe.ds.BalancedTree.call(this);
        };
        haxe.ds.EnumValueMap.__interfaces__ = [haxe.IMap];
        haxe.ds.EnumValueMap.__name__ = ["haxe", "ds", "EnumValueMap"];
        haxe.ds.EnumValueMap.__super__ = haxe.ds.BalancedTree;
        for (var k in haxe.ds.BalancedTree.prototype) haxe.ds.EnumValueMap.prototype[k] = haxe.ds.BalancedTree.prototype[k];
        haxe.ds.EnumValueMap.prototype.compare = function(k1, k2) {
            var d = k1[1] - k2[1];
            if (d != 0) return d;
            var p1 = k1.slice(2);
            var p2 = k2.slice(2);
            if (p1.length == 0 && p2.length == 0) return 0;
            return this.compareArgs(p1, p2);
        };
        haxe.ds.EnumValueMap.prototype.compareArgs = function(a1, a2) {
            var ld = a1.length - a2.length;
            if (ld != 0) return ld;
            var _g1 = 0;
            var _g = a1.length;
            while (_g1 < _g) {
                var i = _g1++;
                var d = this.compareArg(a1[i], a2[i]);
                if (d != 0) return d;
            }
            return 0;
        };
        haxe.ds.EnumValueMap.prototype.compareArg = function(v1, v2) {
            if (_hcmn_.Reflect.isEnumValue(v1) && _hcmn_.Reflect.isEnumValue(v2)) return this.compare(v1, v2);
            else if ((v1 instanceof Array) && v1.__enum__ == null && ((v2 instanceof Array) && v2.__enum__ == null)) return this.compareArgs(v1, v2);
            else return _hcmn_.Reflect.compare(v1, v2);
        };
        haxe.ds.EnumValueMap.prototype.__class__ = haxe.ds.EnumValueMap;
        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;
        if (typeof paytable == 'undefined') {
            var paytable = {};
        };
        paytable.Activator = function(context) {};
        paytable.Activator = ck_implements(paytable.Activator, clientkernelModulesApi.IModuleActivator);
        paytable.Activator.__interfaces__ = [clientkernelModulesApi.IModuleActivator];
        paytable.Activator.__name__ = ["paytable", "Activator"];
        paytable.Activator.prototype.start = function(context) {
            context.getServiceTracker([viewBuilderApi.IViewBuilderFactory, clientkernelLoaderApi.IAssetRegistry, displayEngineApi.IDisplayProvider, translationmanagerApi.ITranslationManager]).then(function(context1) {
                var vbf = context1.getAnyService(viewBuilderApi.IViewBuilderFactory, null);
                paytable.ExternalService.initialize(context1, vbf);
                context1.registerService(new paytable.PaytableFactory(context1), paytableApi.PaytableDeclaration, null);
            });
        };
        paytable.Activator.prototype.stop = function(context) {};
        paytable.Activator.main = function() {};
        paytable.Activator.prototype.__class__ = paytable.Activator;
        paytable.ExternalService = function() {};
        paytable.ExternalService.__name__ = ["paytable", "ExternalService"];
        paytable.ExternalService.displayProvider = null;
        paytable.ExternalService.assetRegistry = null;
        paytable.ExternalService.viewBuilderFactory = null;
        paytable.ExternalService.translationManager = null;
        paytable.ExternalService.loadedAssets = null;
        paytable.ExternalService.loadedDefinitionConfig = null;
        paytable.ExternalService.moneyFormatter = null;
        paytable.ExternalService.variableRegistry = null;
        paytable.ExternalService.eventBus = null;
        paytable.ExternalService.initialize = function(context, vbf) {
            paytable.ExternalService.displayProvider = context.getAnyService(displayEngineApi.IDisplayProvider, null);
            paytable.ExternalService.assetRegistry = context.getAnyService(clientkernelLoaderApi.IAssetRegistry, null);
            paytable.ExternalService.moneyFormatter = context.getAnyService(moneyApi.IMoneyFormatter);
            paytable.ExternalService.translationManager = context.getAnyService(translationmanagerApi.ITranslationManager);
            paytable.ExternalService.variableRegistry = context.getAnyService(clientkernelLoaderApi.IVariableRegistry, null);
            paytable.ExternalService.eventBus = context.getAnyService(clientkernelEventbusApi.IEventBus, null);
            paytable.ExternalService.viewBuilderFactory = vbf;
        };
        paytable.ExternalService.getLanguage = function() {
            return paytable.ExternalService.variableRegistry.get("language");
        };
        paytable.ExternalService.prototype.__class__ = paytable.ExternalService;
        paytable.Paytable = function(context) {
            this.presentationInitializationPayload = null;
            this.DEFINITION_CONFIG_ID = "paytable-assets/paytable_definition_config.json";
            var _g = this;
            this.context = context;
            this.baseEvents = new paytable.BaseEvents();
            this.port = context.getImplementedPort(paytableApi.IPaytableImplementationPort);
            this.slotModelPort = context.getUsedPort(slotModelApi.ISlotModelPort);
            this.slotModelPort.getStages().getInitStage().getInitializeGamePhase().getInitializeGame().subscribe($bind(this, this.handlePresentationInitialization));
            this.slotModelPort.getStages().getResumeStage().getPrepareResume().subscribe($bind(this, this.handlePrepareResume));
            paytable.ExternalService.assetRegistry.getAsset(this.DEFINITION_CONFIG_ID).getContent().then(function(config) {
                paytable.ExternalService.loadedDefinitionConfig = config;
                _g.paytableComponent = new paytable.DefaultPaytable();
                _g.port.show().subscribe($bind(_g, _g.handleShow));
                _g.port.hide().subscribe($bind(_g, _g.handleHide));
            });
        };
        paytable.Paytable.__name__ = ["paytable", "Paytable"];
        paytable.Paytable.prototype.DEFINITION_CONFIG_ID = null;
        paytable.Paytable.prototype.paytableComponent = null;
        paytable.Paytable.prototype.helpComponent = null;
        paytable.Paytable.prototype.port = null;
        paytable.Paytable.prototype.slotModelPort = null;
        paytable.Paytable.prototype.context = null;
        paytable.Paytable.prototype.presentationInitializationPayload = null;
        paytable.Paytable.prototype.baseEvents = null;
        paytable.Paytable.prototype.handlePrepareResume = function(e) {
            this.paytableComponent.initializeContent(e.getPayload().initializationProperties);
        };
        paytable.Paytable.prototype.handlePresentationInitialization = function(e) {
            this.paytableComponent.initializeContent(e.getPayload());
        };
        paytable.Paytable.prototype.handleShow = function(e) {
            this.closeHelp(null);
            this.paytableComponent.show();
        };
        paytable.Paytable.prototype.handleHide = function(e) {
            this.paytableComponent.hide();
        };
        paytable.Paytable.prototype.setStageVisible = function(stageId, visible) {};
        paytable.Paytable.prototype.handleClose = function(e) {
            this.port.onCloseButtonPressed().publish(null);
        };
        paytable.Paytable.prototype.openDefaultHelpPage = function(event) {
            var url = event.getPayload();
            console.log("[PAYTABLE][defaultHelpPage] OPEN/CLOSE with url:" + url);
            if (url == null || url == "") {
                console.log("[PAYTABLE][defaultHelpPage] WARNING: url == null || url == \"\"");
                return;
            }
            if (window.document.getElementById("rulesInstance") != null) {
                this.closeHelp(null);
                return;
            }
            if (this.paytableComponent.isOpen()) this.handleClose(null);
            this.helpComponent = new paytable.HelpComponent(url, "Help", $bind(this, this.helpClosed));
        };
        paytable.Paytable.prototype.closeHelp = function(event) {
            console.log("[PAYTABLE][defaultHelpPage] CLOSE closeHelp");
            if (this.helpComponent == null) {
                console.log("[PAYTABLE][defaultHelpPage] WARNING: helpComponent == null");
                return;
            }
            this.helpComponent.close();
        };
        paytable.Paytable.prototype.helpClosed = function() {
            console.log("[PAYTABLE][defaultHelpPage] CLOSE helpClosed");
            this.helpComponent.close();
            this.helpComponent = null;
        };
        paytable.Paytable.prototype.__class__ = paytable.Paytable;
        paytable.PaytableFactory = function(context) {
            this.context = context;
        };
        paytable.PaytableFactory = ck_implements(paytable.PaytableFactory, clientkernelModulesApi.IService);
        paytable.PaytableFactory = ck_implements(paytable.PaytableFactory, componentmodelComponentApi.IComponentFactory);
        paytable.PaytableFactory.__interfaces__ = [clientkernelModulesApi.IService, componentmodelComponentApi.IComponentFactory];
        paytable.PaytableFactory.__name__ = ["paytable", "PaytableFactory"];
        paytable.PaytableFactory.prototype.vbf = null;
        paytable.PaytableFactory.prototype.context = null;
        paytable.PaytableFactory.prototype.getComponentDeclaration = function() {
            return paytableApi.PaytableDeclaration;
        };
        paytable.PaytableFactory.prototype.createComponent = function(context) {
            new paytable.Paytable(context);
        };
        paytable.PaytableFactory.prototype.__class__ = paytable.PaytableFactory;

        paytable.IPaytableComponent = function() {}
        paytable.IPaytableComponent.prototype = {

            hide: function() {
                return {
                    arguments: [],
                    returns: "void"
                };
            },
            show: function() {
                return {
                    arguments: [],
                    returns: "void"
                };
            },
            showNext: function() {
                return {
                    arguments: [],
                    returns: "void"
                };
            },
            showPrevious: function() {
                return {
                    arguments: [],
                    returns: "void"
                };
            },
            changeLabelContent: function(pageId, labelId, text, style) {
                return {
                    arguments: ["string", "string", "string", "*"],
                    returns: "void"
                };
            },
            setConfig: function(cfg, stage, fullScreenCanvas) {
                return {
                    arguments: ["*", "*", {
                        type: "boolean",
                        opt: true
                    }],
                    returns: "void"
                };
            },
            initializeContent: function(presentationInitializationPayload, newPage) {
                return {
                    arguments: ["*", {
                        type: "*",
                        opt: true
                    }],
                    returns: "void"
                };
            },
            isFullScreenMobile: function() {
                return {
                    arguments: [],
                    returns: "boolean"
                };
            },
            isOpen: function() {
                return {
                    arguments: [],
                    returns: "boolean"
                };
            }
        };
        paytable.DefaultPaytable = function() {
            this.visible = false;
        };
        paytable.DefaultPaytable = ck_implements(paytable.DefaultPaytable, paytable.IPaytableComponent);
        paytable.DefaultPaytable.__interfaces__ = [paytable.IPaytableComponent];
        paytable.DefaultPaytable.__name__ = ["paytable", "DefaultPaytable"];
        paytable.DefaultPaytable.prototype.iframe = null;
        paytable.DefaultPaytable.prototype.node = null;
        paytable.DefaultPaytable.prototype.divWrapper = null;
        paytable.DefaultPaytable.prototype.minRTP = null;
        paytable.DefaultPaytable.prototype.maxRTP = null;
        paytable.DefaultPaytable.prototype.singleRTP = null;
        paytable.DefaultPaytable.prototype.maxSingleRTP = null;
        paytable.DefaultPaytable.prototype.awardCap = null;
        paytable.DefaultPaytable.prototype.initialPayload = null;
        paytable.DefaultPaytable.prototype.payLines = null;
        paytable.DefaultPaytable.prototype.visible = null;
        paytable.DefaultPaytable.prototype.jpValue = null;
        paytable.DefaultPaytable.prototype.initializeContent = function(initialPayload, newPage) {
            this.initialPayload = initialPayload;
            this.minRTP = initialPayload.slotDefinition.rtp.minRTP;
            this.maxRTP = initialPayload.slotDefinition.rtp.maxRTP;
            this.singleRTP = initialPayload.slotDefinition.rtp.singleRTP;
            this.maxSingleRTP = initialPayload.slotDefinition.rtp.maxSingleRTP;
            var decimalSeparator = paytable.ExternalService.translationManager.stringLookup("rtpDecimalSeparator");
            if (decimalSeparator != null && decimalSeparator != "rtpDecimalSeparator") {
                if (this.minRTP != null) this.minRTP = _hcmn_.StringTools.replace(this.minRTP, ".", decimalSeparator);
                else this.minRTP = null;
                if (this.maxRTP != null) this.maxRTP = _hcmn_.StringTools.replace(this.maxRTP, ".", decimalSeparator);
                else this.maxRTP = null;
                if (this.maxSingleRTP != null) this.maxSingleRTP = _hcmn_.StringTools.replace(this.maxSingleRTP, ".", decimalSeparator);
                else this.maxSingleRTP = null;
            }
            this.awardCap = initialPayload.riskControlSettings.awardCap;
            if (initialPayload.defaultStake.outcome.customField != null) {
                if (initialPayload.defaultStake.outcome.customField.payLines != null) this.payLines = initialPayload.defaultStake.outcome.customField.payLines;
            }
            if (initialPayload.defaultStake.outcome.customField != null) {
                if (initialPayload.defaultStake.outcome.customField.jackpotValue != null) this.jpValue = paytable.ExternalService.moneyFormatter.format(_hcmn_.Std.string(_hcmn_.Std.parseInt(initialPayload.defaultStake.outcome.customField.jackpotValue) * initialPayload.riskControlSettings.denomination));
            }
            this.setPaytable();
        };
        paytable.DefaultPaytable.prototype.setPaytable = function() {
            var _g = this;
            var _this = window.document;
            this.iframe = _this.createElement("iframe");
            this.iframe.marginHeight = "0";
            this.iframe.marginWidth = "0";
            this.iframe.src = _hcmn_.Std.string(paytable.ExternalService.loadedDefinitionConfig.url) + "paytable_" + paytable.ExternalService.variableRegistry.get("language") + ".html";
            this.iframe.frameBorder = "0";
            this.iframe.setAttribute("style", "width:100%; height:100%; background:white; position:absolute;");
            this.iframe.height = window.document.body.scrollHeight + "px";
            var _this1 = window.document;
            this.divWrapper = _this1.createElement("div");
            this.setDivWrapperStyle();
            this.divWrapper.appendChild(this.iframe);
            this.divWrapper.id = "paytableInstance";
            this.divWrapper.style.display = "none";
            this.node = window.document.body.appendChild(this.divWrapper);
            this.iframe.onload = function() {
                _g.placePaytableTexts();
                if (_g.payLines != null) {
                    _g.createPaylinesTables("baseGame", "bg", paytable.ExternalService.loadedDefinitionConfig.bgColumns, paytable.ExternalService.loadedDefinitionConfig.bgRows);
                    _g.createPaylinesTables("freeSpin", "fs", paytable.ExternalService.loadedDefinitionConfig.fsColumns, paytable.ExternalService.loadedDefinitionConfig.fsRows);
                }
            };
        };
        paytable.DefaultPaytable.prototype.show = function() {
            var _g = this;
            _hcmn_.Reflect.setProperty(window, "closePaytable", function() {
                var frame = window.document.getElementById("paytableInstance");
                var closePaytableEvt = window.document.createEvent("Event");
                closePaytableEvt.initEvent("closePaytable", false, false);
                window.dispatchEvent(closePaytableEvt);
                _g.hide();
            });
            this.visible = true;
            this.divWrapper.style.display = "block";
        };
        paytable.DefaultPaytable.prototype.setDivWrapperStyle = function() {
            this.divWrapper.setAttribute("style", "overflow-x: hidden; overflow-y: auto; width:100%; height:100%; position: absolute; z-index: 99999; background:white; top:0px");
            this.divWrapper.style.setProperty("-webkit-overflow-scrolling", "touch");
            this.divWrapper.style.setProperty("-webkit-user-select", "none");
            this.divWrapper.style.setProperty("-webkit-text-size-adjust", "none");
        };
        paytable.DefaultPaytable.prototype.closeListener = function(event) {
            if (event.data == "rules:close$id") window.document.removeEventListener("message", $bind(this, this.closeListener));
        };
        paytable.DefaultPaytable.prototype.showNext = function() {};
        paytable.DefaultPaytable.prototype.showPrevious = function() {};
        paytable.DefaultPaytable.prototype.changeLabelContent = function(pageId, labelId, text, style) {};
        paytable.DefaultPaytable.prototype.setConfig = function(cfg, stage, fullScreenCanvas) {
            if (fullScreenCanvas == null) fullScreenCanvas = false;
        };
        paytable.DefaultPaytable.prototype.isFullScreenMobile = function() {
            return false;
        };
        paytable.DefaultPaytable.prototype.hide = function() {
            this.visible = false;
            this.divWrapper.style.display = "none";
        };
        paytable.DefaultPaytable.prototype.isOpen = function() {
            var isOpen = false;
            if (this.node != null) isOpen = true;
            return isOpen;
        };
        paytable.DefaultPaytable.prototype.setPaytableText = function(div, texts, style) {
            var paytableDiv = this.iframe.contentDocument.getElementById(div);
            if (paytableDiv != null) {
                paytableDiv.innerText = texts;
                if (style != null) paytableDiv.setAttribute("style", style);
            }
        };
        paytable.DefaultPaytable.prototype.placePaytableTexts = function() {
            this.setRTPValues();
            this.setAwardCapValue();
            this.setJackpotValues();
        };
        paytable.DefaultPaytable.prototype.setJackpotValues = function() {
            this.setPaytableText("jpValue", this.jpValue);
        };
        paytable.DefaultPaytable.prototype.setRTPValues = function() {
            if (this.singleRTP != null && this.singleRTP) {
                this.setPaytableText("multipleRTP", "", "display:none;");
                this.setPaytableText("maxSingleRTP", this.maxSingleRTP);
            } else {
                this.setPaytableText("singleRTP", "", "display:none;");
                this.setPaytableText("minRTP", this.minRTP);
                this.setPaytableText("maxRTP", this.maxRTP);
            }
        };
        paytable.DefaultPaytable.prototype.setAwardCapValue = function() {
            var showDecimalValueInAwardCap = false;
            var formattedAwardCap = paytable.ExternalService.moneyFormatter.format(this.awardCap);
            this.setPaytableText("awardcap", formattedAwardCap);
        };
        paytable.DefaultPaytable.prototype.bgpaylines = function() {
            var baseGamePaylines = new _hcmn_.haxe_ds_StringMap();
            var $it0 = this.payLines.keys();
            while ($it0.hasNext()) {
                var key = $it0.next();
                if (_hcmn_.StringTools.startsWith(key, "bg_")) {
                    var value = this.payLines.get(key);
                    if (_hcmn_.__map_reserved[key] != null) baseGamePaylines.setReserved(key, value);
                    else baseGamePaylines.h[key] = value;
                }
            }
            return baseGamePaylines;
        };
        paytable.DefaultPaytable.prototype.fppaylines = function() {
            var freeSpinPaylines = new _hcmn_.haxe_ds_StringMap();
            var $it0 = this.payLines.keys();
            while ($it0.hasNext()) {
                var key = $it0.next();
                if (_hcmn_.StringTools.startsWith(key, "fs_")) {
                    var value = this.payLines.get(key);
                    if (_hcmn_.__map_reserved[key] != null) freeSpinPaylines.setReserved(key, value);
                    else freeSpinPaylines.h[key] = value;
                }
            }
            return freeSpinPaylines;
        };
        paytable.DefaultPaytable.prototype.createPaylinesTables = function(elementId, type, rows, columns) {
            var lineOffset = 0;
            if (paytable.ExternalService.loadedDefinitionConfig.lineOffset != null) lineOffset = paytable.ExternalService.loadedDefinitionConfig.lineOffset;
            var $it0 = this.payLines.keys();
            while ($it0.hasNext()) {
                var key = $it0.next();
                if (_hcmn_.StringTools.startsWith(key, type)) {
                    var div = this.iframe.contentDocument.getElementById(elementId);
                    var tbl = this.iframe.contentDocument.createElement("table");
                    tbl.setAttribute("border", "1");
                    var th = this.iframe.contentDocument.createElement("th");
                    tbl.appendChild(th);
                    var _g = 0;
                    while (_g < rows) {
                        var k = _g++;
                        var tr = this.iframe.contentDocument.createElement("tr");
                        var _g1 = 0;
                        while (_g1 < columns) {
                            var j = _g1++;
                            var td = this.iframe.contentDocument.createElement("td");
                            tr.appendChild(td);
                            var _g2 = 0;
                            while (_g2 < columns) {
                                var z = _g2++;
                                var xx = this.payLines.get(key)[z].x;
                                var yy = this.payLines.get(key)[z].y - lineOffset;
                                if (xx == j && yy == k) td.setAttribute("class", "payline-color");
                            }
                        }
                        tbl.appendChild(tr);
                    }
                    th.setAttribute("colspan", "5");
                    div.appendChild(tbl);
                    th.setAttribute("id", "tHead" + key);
                    tbl.setAttribute("id", "table" + key);
                    th.appendChild(this.iframe.contentDocument.createTextNode(_hcmn_.Std.string(_hcmn_.HxOverrides.substr(key, 3, null))));
                }
            }
        };
        paytable.DefaultPaytable.prototype.__class__ = paytable.DefaultPaytable;
        paytable.Extender = function() {};
        paytable.Extender.__name__ = ["paytable", "Extender"];
        paytable.Extender.getField = function(obj, field) {
            if (obj == null) return null;
            if (Object.prototype.hasOwnProperty.call(obj, field)) return _hcmn_.Reflect.field(obj, field);
            else return null;
        };
        paytable.Extender.getFieldAsArray = function(obj, path) {
            return paytable.Extender.makeArray(paytable.Extender.getField(obj, path));
        };
        paytable.Extender.makeArray = function(field) {
            if (field == null) return [];
            if ((field instanceof Array) && field.__enum__ == null) return field;
            else return [field];
        };
        paytable.Extender.find = function(arr, field, value) {
            var _g = 0;
            while (_g < arr.length) {
                var elem = arr[_g];
                ++_g;
                if (paytable.Extender.getField(elem, field) == value) return elem;
            }
            return null;
        };
        paytable.Extender.isEmpty = function(value) {
            if (value == null) return true;
            if (value.length == 0) return true;
            return false;
        };
        paytable.Extender.getBoolValue = function(obj) {
            if (obj != null) {
                if (typeof(obj) == "string") return obj.toLowerCase() == "true";
                return obj;
            }
            return false;
        };
        paytable.Extender.toIntArray = function(arr) {
            var out = [];
            var _g = 0;
            while (_g < arr.length) {
                var elem = arr[_g];
                ++_g;
                out.push(_hcmn_.Std.parseInt(elem));
            }
            return out;
        };
        paytable.Extender.toInt = function(obj) {
            if (obj == null) return null;
            return _hcmn_.Std.parseInt(obj);
        };
        paytable.Extender.toStringArray = function(arr) {
            var out = [];
            var _g = 0;
            while (_g < arr.length) {
                var elem = arr[_g];
                ++_g;
                out.push(_hcmn_.Std.string(elem));
            }
            return out;
        };
        paytable.Extender.clone = function(obj) {
            return JSON.parse(JSON.stringify(obj));
        };
        paytable.Extender.getBoolField = function(object, name, defaultValue) {
            var dynammicValue = paytable.Extender.getField(object, name);
            if (dynammicValue == null) return defaultValue;
            return _hcmn_.Std.string(dynammicValue).toLowerCase() == "true";
        };
        paytable.Extender.strToArray = function(str, delimiter) {
            var _g = [];
            var _g1 = 0;
            var _g2 = str.split(delimiter);
            while (_g1 < _g2.length) {
                var $char = _g2[_g1];
                ++_g1;
                _g.push($char);
            }
            return _g;
        };
        paytable.Extender.parsePosition = function(name) {
            var pos = {
                x: _hcmn_.Std.parseInt(name.split("C")[1].split("R")[0]),
                y: _hcmn_.Std.parseInt(name.split("R")[1])
            };
            return pos;
        };
        paytable.Extender.sortIntArray = function(array) {
            var temp;
            if (paytable.Extender.isEmpty(array)) return null;
            var _g1 = 1;
            var _g = array.length;
            while (_g1 < _g) {
                var i = _g1++;
                var j = i;
                while (j > 0) {
                    if (array[j] < array[j - 1]) {
                        temp = array[j];
                        array[j] = array[j - 1];
                        array[j - 1] = temp;
                    }
                    j--;
                }
            }
            return array;
        };
        paytable.Extender.prototype.__class__ = paytable.Extender;
        paytable.HelpComponent = function(url, id, closeCallback) {
            this.id = id;
            this.closeCallback = closeCallback;
            var _this = window.document;
            this.iframe = _this.createElement("iframe");
            this.iframe.marginHeight = "0";
            this.iframe.marginWidth = "0";
            this.iframe.src = url;
            this.iframe.frameBorder = "0";
            this.iframe.setAttribute("style", "width:100%; height:100%; background:white; position:absolute;");
            this.iframe.height = window.document.body.scrollHeight + "px";
            var _this1 = window.document;
            this.divWrapper = _this1.createElement("div");
            this.setDivWrapperStyle();
            this.divWrapper.appendChild(this.iframe);
            this.divWrapper.id = "rulesInstance";
            this.node = window.document.body.appendChild(this.divWrapper);
            window.addEventListener("resize", $bind(this, this.onResize));
            this.iframe.addEventListener("load", $bind(this, this.onLoad));
        };
        paytable.HelpComponent.__name__ = ["paytable", "HelpComponent"];
        paytable.HelpComponent.prototype.iframe = null;
        paytable.HelpComponent.prototype.node = null;
        paytable.HelpComponent.prototype.id = null;
        paytable.HelpComponent.prototype.closeCallback = null;
        paytable.HelpComponent.prototype.divWrapper = null;
        paytable.HelpComponent.prototype.onLoad = function(e) {
            this.iframe.height = this.iframe.contentWindow.document.body.scrollHeight + "px";
            this.setDivWrapperStyle();
        };
        paytable.HelpComponent.prototype.setDivWrapperStyle = function() {
            this.divWrapper.setAttribute("style", "overflow-x: hidden; overflow-y: auto; width:100%; height:100%; position: absolute; z-index: 99999; background:white; top:0px");
            this.divWrapper.style.setProperty("-webkit-overflow-scrolling", "touch");
            this.divWrapper.style.setProperty("-webkit-user-select", "none");
            this.divWrapper.style.setProperty("-webkit-text-size-adjust", "none");
        };
        paytable.HelpComponent.prototype.onResize = function() {
            this.setDivWrapperStyle();
            _hcmn_.haxe_Timer.delay($bind(this, this.updateIFrame), 0);
        };
        paytable.HelpComponent.prototype.updateIFrame = function() {
            if (this.iframe == null || this.iframe.contentWindow == null || this.iframe.contentWindow.document == null) {
                window.removeEventListener("resize", $bind(this, this.onResize));
                this.iframe.removeEventListener("load", $bind(this, this.onLoad));
                this.divWrapper = null;
                this.iframe = null;
                return;
            }
            this.iframe.height = this.iframe.contentWindow.document.body.scrollHeight + "px";
        };
        paytable.HelpComponent.prototype.closeListener = function(event) {
            if ("rules:close" + this.id == event.data) {
                window.document.removeEventListener("message", $bind(this, this.closeListener));
                this.close();
            }
        };
        paytable.HelpComponent.prototype.close = function() {
            if (this.node == null) return;
            if (this.node.parentNode != null) this.node.parentNode.removeChild(this.node);
            this.node = null;
            if (this.closeCallback != null) {
                console.log("[PAYTABLE][defaultHelpPage] closeCallback called");
                this.closeCallback();
            }
        };
        paytable.HelpComponent.prototype.__class__ = paytable.HelpComponent;
        paytable.BaseEventsEnum = {
            __ename__: ["paytable", "BaseEventsEnum"],
            __constructs__: ["CLOSE", "OPEN", "CURRENT_PAGE", "NAVIGATE_LEFT", "NAVIGATE_RIGHT"]
        };
        paytable.BaseEventsEnum.CURRENT_PAGE = ["CURRENT_PAGE", 2];
        paytable.BaseEventsEnum.CURRENT_PAGE.toString = $estr;
        paytable.BaseEventsEnum.CURRENT_PAGE.__enum__ = paytable.BaseEventsEnum;
        paytable.BaseEventsEnum.NAVIGATE_LEFT = ["NAVIGATE_LEFT", 3];
        paytable.BaseEventsEnum.NAVIGATE_LEFT.toString = $estr;
        paytable.BaseEventsEnum.NAVIGATE_LEFT.__enum__ = paytable.BaseEventsEnum;
        paytable.BaseEventsEnum.CLOSE = ["CLOSE", 0];
        paytable.BaseEventsEnum.CLOSE.toString = $estr;
        paytable.BaseEventsEnum.CLOSE.__enum__ = paytable.BaseEventsEnum;
        paytable.BaseEventsEnum.NAVIGATE_RIGHT = ["NAVIGATE_RIGHT", 4];
        paytable.BaseEventsEnum.NAVIGATE_RIGHT.toString = $estr;
        paytable.BaseEventsEnum.NAVIGATE_RIGHT.__enum__ = paytable.BaseEventsEnum;
        paytable.BaseEventsEnum.OPEN = ["OPEN", 1];
        paytable.BaseEventsEnum.OPEN.toString = $estr;
        paytable.BaseEventsEnum.OPEN.__enum__ = paytable.BaseEventsEnum;
        paytable.BaseEvents = function() {
            this.events = new haxe.ds.EnumValueMap();
            this.registerEvents();
        };
        paytable.BaseEvents.__name__ = ["paytable", "BaseEvents"];
        paytable.BaseEvents.prototype.events = null;
        paytable.BaseEvents.prototype.registerEvents = function() {
            var value = new _hcmn_.msignal_Signal1();
            this.events.set(paytable.BaseEventsEnum.CLOSE, value);
            var value1 = new _hcmn_.msignal_Signal1();
            this.events.set(paytable.BaseEventsEnum.CURRENT_PAGE, value1);
            var value2 = new _hcmn_.msignal_Signal1();
            this.events.set(paytable.BaseEventsEnum.NAVIGATE_LEFT, value2);
            var value3 = new _hcmn_.msignal_Signal1();
            this.events.set(paytable.BaseEventsEnum.NAVIGATE_RIGHT, value3);
        };
        paytable.BaseEvents.prototype.getEvent = function(id) {
            return this.events.get(id);
        };
        paytable.BaseEvents.prototype.__class__ = paytable.BaseEvents;
        return {
            exports: paytable,
            activator: paytable.Activator
        };
    });
//# sourceURL=slotPaytable.js