define("commonTools", ["moneyApi"],
    function(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 _List == 'undefined') {
            var _List = {};
        };
        _List.ListIterator = function(head) {
            this.head = head;
            this.val = null;
        };
        _List.ListIterator.__name__ = ["_List", "ListIterator"];
        _List.ListIterator.prototype.head = null;
        _List.ListIterator.prototype.val = null;
        _List.ListIterator.prototype.hasNext = function() {
            return this.head != null;
        };
        _List.ListIterator.prototype.next = function() {
            this.val = this.head[0];
            this.head = this.head[1];
            return this.val;
        };
        _List.ListIterator.prototype.__class__ = _List.ListIterator;
        if (typeof commonTools == 'undefined') {
            var commonTools = {};
        };
        commonTools.ArrayUtil = function() {};
        commonTools.ArrayUtil.__name__ = ["commonTools", "ArrayUtil"];
        commonTools.ArrayUtil.getMostFrequent = function(arr) {
            arr.sort(function(a, b) {
                return a - b;
            });
            var maxCount = 1;
            var ressult = arr[0];
            var currentCount = 1;
            var _g1 = 1;
            var _g = arr.length;
            while (_g1 < _g) {
                var i = _g1++;
                if (arr[i] == arr[i - 1]) currentCount++;
                else {
                    if (currentCount > maxCount) {
                        maxCount = currentCount;
                        ressult = arr[i - 1];
                    }
                    currentCount = 1;
                }
            }
            if (currentCount > maxCount) {
                maxCount = currentCount;
                ressult = arr[arr.length - 1];
            }
            return ressult;
        };
        commonTools.ArrayUtil.shuffle = function(array) {
            var result = array.slice();
            var _g1 = 0;
            var _g = result.length;
            while (_g1 < _g) {
                var i = _g1++;
                var k = _hcmn_.Std.random(result.length);
                var tmp = result[i];
                result[i] = result[k];
                result[k] = tmp;
            }
            return result;
        };
        commonTools.ArrayUtil.prototype.__class__ = commonTools.ArrayUtil;
        commonTools.Await = function() {};
        commonTools.Await.__name__ = ["commonTools", "Await"];
        commonTools.Await.await = function(booleanSupplier, calback, scriptTimeout) {
            if (scriptTimeout == null) scriptTimeout = 100;
            var intervalId = 0;
            intervalId = window.setInterval(function() {
                if (booleanSupplier()) {
                    window.clearInterval(intervalId);
                    calback();
                }
            }, scriptTimeout);
        };
        commonTools.Await.prototype.__class__ = commonTools.Await;
        commonTools.HotKeyPanel = function(actions) {
            this.groupLimit = 3;
            this.groupStatuses = new commonTools.CustomMap();
            this.actions = actions;
        };
        commonTools.HotKeyPanel.__name__ = ["commonTools", "HotKeyPanel"];
        commonTools.HotKeyPanel.prototype.actions = null;
        commonTools.HotKeyPanel.prototype.bg = null;
        commonTools.HotKeyPanel.prototype.bgHeader = null;
        commonTools.HotKeyPanel.prototype.bgContent = null;
        commonTools.HotKeyPanel.prototype.closePanelCheckBox = null;
        commonTools.HotKeyPanel.prototype.groupStatuses = null;
        commonTools.HotKeyPanel.prototype.groupLimit = null;
        commonTools.HotKeyPanel.prototype.activateTouchScreen = function() {
            var _g = this;
            this.bg = window.document.createElement("div");
            this.bgHeader = window.document.createElement("div");
            this.bgHeader.style.padding = "5px";
            this.bgContent = window.document.createElement("div");
            this.bgContent.style.padding = "5px";
            this.bg.appendChild(this.bgHeader);
            this.bg.appendChild(this.bgContent);
            this.bg.style.backgroundColor = "#0000008c";
            this.bg.style.width = "80%";
            this.bg.style.height = "80%";
            this.bg.style.top = "10%";
            this.bg.style.left = "10%";
            this.bg.style.zIndex = "100500";
            this.bg.style.position = "absolute";
            this.bg.style.display = "none";
            this.bg.id = "devPopup";
            var _this = window.document;
            this.closePanelCheckBox = _this.createElement("input");
            this.closePanelCheckBox.type = "checkbox";
            this.closePanelCheckBox.id = "isNeedToCloseDevTool";
            this.closePanelCheckBox.checked = !new _hcmn_.EReg("(.*DevTool.closeAfterCall=0.*)(\\w+)", "g").match(window.document.cookie);
            this.closePanelCheckBox.onclick = function() {
                window.document.cookie = "DevTool.closeAfterCall=" + (_g.closePanelCheckBox.checked ? 1 : 0);
            };
            var label;
            var _this1 = window.document;
            label = _this1.createElement("label");
            label.textContent = "Close after call";
            label.htmlFor = this.closePanelCheckBox.id;
            label.style.color = "#ffffff";
            label.style.fontWeight = "bold";
            this.makeElementUnselectable(label);
            this.makeElementUnselectable(this.closePanelCheckBox);
            this.bgHeader.appendChild(this.closePanelCheckBox);
            this.bgHeader.appendChild(label);
            var btn;
            var _this2 = window.document;
            btn = _this2.createElement("button");
            btn.style.position = "absolute";
            btn.style.zIndex = "100500";
            btn.style.top = "50px";
            btn.style.left = "7px";
            btn.textContent = "Debug";
            btn.onclick = function(event) {
                if (_g.bg.style.display == "block") _g.bg.style.display = "none";
                else _g.bg.style.display = "block";
                _g.redrawPanel();
            };
            var game = window.document.getElementById("game");
            window.document.body.appendChild(this.bg);
            window.document.body.appendChild(btn);
        };
        commonTools.HotKeyPanel.prototype.redrawPanel = function() {
            var _g = this;
            this.bgContent.innerHTML = "";
            var groups = this.getCheatGroups();
            var groupsElement;
            var _this = window.document;
            groupsElement = _this.createElement("div");
            groupsElement.id = "groupsElement";
            var reset;
            var _this1 = window.document;
            reset = _this1.createElement("label");
            reset.style.color = "#CECECE";
            reset.style.fontWeight = "bold";
            reset.style.textDecoration = "underline";
            reset.textContent = "Reset: ";
            reset.onclick = function() {
                _g.groupLimit = 3;
                _g.groupStatuses.setAll(false);
                _g.redrawPanel();
            };
            this.useHandCursour(reset);
            groupsElement.appendChild(reset);
            var _g1 = 0;
            while (_g1 < groups.length) {
                var group = [groups[_g1]];
                ++_g1;
                this.groupStatuses.set(group[0], this.groupStatuses.getOrDefault(group[0], false));
                var groupCheckBox = [(function($this) {
                    var $r;
                    var _this2 = window.document;
                    $r = _this2.createElement("input");
                    return $r;
                }(this))];
                groupCheckBox[0].type = "checkbox";
                groupCheckBox[0].id = group[0];
                groupCheckBox[0].value = group[0];
                groupCheckBox[0].checked = this.groupStatuses.get(group[0]);
                groupCheckBox[0].onchange = (function(groupCheckBox, group) {
                    return function() {
                        _g.groupStatuses.set(group[0], groupCheckBox[0].checked);
                        _g.redrawPanel();
                    };
                })(groupCheckBox, group);
                var label;
                var _this3 = window.document;
                label = _this3.createElement("label");
                label.textContent = group[0];
                label.htmlFor = groupCheckBox[0].id;
                label.style.color = "#ffffff";
                label.style.fontWeight = "bold";
                groupsElement.appendChild(groupCheckBox[0]);
                groupsElement.appendChild(label);
                this.makeElementUnselectable(label);
                this.makeElementUnselectable(groupCheckBox[0]);
            }
            var showMore;
            var _this4 = window.document;
            showMore = _this4.createElement("label");
            showMore.style.color = "#CECECE";
            showMore.style.textDecoration = "underline";
            showMore.style.fontWeight = "bold";
            showMore.textContent = " ... ";
            showMore.onclick = function() {
                _g.groupLimit = _hcmn_.Math.round(_hcmn_.Math.max(1, _g.groupLimit - 1));
                _g.redrawPanel();
            };
            this.useHandCursour(showMore);
            groupsElement.appendChild(showMore);
            var previousGroupsElement = window.document.getElementById(groupsElement.id);
            if (previousGroupsElement != null) this.bgHeader.removeChild(previousGroupsElement);
            this.bgHeader.appendChild(groupsElement);
            this.redrawHotKeyButtons();
        };
        commonTools.HotKeyPanel.prototype.redrawHotKeyButtons = function() {
            var _g1 = this;
            var checkGroups = this.groupStatuses.containsValue(true);
            var $it0 = this.actions.iterator();
            while ($it0.hasNext()) {
                var actions = $it0.next();
                var _g = 0;
                while (_g < actions.length) {
                    var action = [actions[_g]];
                    ++_g;
                    var isInGroups = action[0].description.toUpperCase().split(" ").filter((function() {
                        return function(v) {
                            return _g1.groupStatuses.get(v);
                        };
                    })()).length > 0;
                    if (checkGroups && !isInGroups) continue;
                    var actionBtn;
                    var _this = window.document;
                    actionBtn = _this.createElement("button");
                    actionBtn.textContent = action[0].description;
                    actionBtn.disabled = action[0].action == null;
                    actionBtn.onclick = (function(action) {
                        return function() {
                            var isNeedToClose = _g1.closePanelCheckBox.checked;
                            if (isNeedToClose) _g1.bg.style.display = "none";
                            action[0].action();
                            if (!isNeedToClose) _g1.redrawPanel();
                        };
                    })(action);
                    this.makeElementUnselectable(actionBtn);
                    this.bgContent.appendChild(actionBtn);
                }
            }
        };
        commonTools.HotKeyPanel.prototype.getCheatGroups = function() {
            var tmpResult = [];
            var result = [];
            var $it0 = this.actions.iterator();
            while ($it0.hasNext()) {
                var actions = $it0.next();
                var _g = 0;
                while (_g < actions.length) {
                    var action = actions[_g];
                    ++_g;
                    tmpResult = tmpResult.concat(action.description.split(" "));
                }
            }
            var cache = new commonTools.CustomMap();
            var collectCache = function(a) {
                cache.set(a, cache.getOrDefault(a, 0) + 1);
            };
            tmpResult = tmpResult.map(function(a1) {
                return a1.toUpperCase();
            });
            _hcmn_.Lambda.iter(tmpResult, collectCache);
            tmpResult.sort(function(a2, b) {
                return cache.get(b) - cache.get(a2);
            });
            var _g1 = 0;
            while (_g1 < tmpResult.length) {
                var tag = tmpResult[_g1];
                ++_g1;
                if (_hcmn_.HxOverrides.indexOf(result, tag, 0) == -1 && cache.get(tag) >= this.groupLimit) result.push(tag);
            }
            return result;
        };
        commonTools.HotKeyPanel.prototype.useHandCursour = function(element) {
            this.makeElementUnselectable(element);
            var style = element.style;
            style.cursor = "pointer";
        };
        commonTools.HotKeyPanel.prototype.makeElementUnselectable = function(element) {
            var style = element.style;
            style.setProperty("ser-select", "none");
            style.setProperty("-moz-user-select", "none");
            style.setProperty("-khtml-user-select", "none");
            style.setProperty("-webkit-user-select", "none");
            style.setProperty("-o-user-select", "none");
        };
        commonTools.HotKeyPanel.prototype.__class__ = commonTools.HotKeyPanel;
        commonTools.HotKeyTool = function() {
            this.actions = new _hcmn_.haxe_ds_StringMap();
        };
        commonTools.HotKeyTool.__name__ = ["commonTools", "HotKeyTool"];
        commonTools.HotKeyTool.prototype.actions = null;
        commonTools.HotKeyTool.prototype.isDevice = null;
        commonTools.HotKeyTool.prototype.activateHotKeys = function() {
            var _g = this;
            var documentOnkeypressF = window.document.body.onkeypress;
            window.document.onkeypress = function(e) {
                if (documentOnkeypressF != null) documentOnkeypressF(e);
                _g.onkeypress(e);
            };
        };
        commonTools.HotKeyTool.prototype.initSystemHotkeys = function() {
            var _g1 = this;
            var unRegisterFunctionalKeys = function() {
                var _g = 0;
                while (_g < 10) {
                    var i = _g++;
                    _g1.unRegisterOnKey("" + i);
                }
                _g1.unRegisterOnKey(" ");
            };
            if (this.isDevice) this.registerOnKey("`", function() {
                _g1.dispatchKBEvent(192);
                _g1.unRegisterOnKey("`");
                _g1.registerOnKey("`", null, "Show FPS metter");
            }, "Show FPS metter");
            else this.registerOnKey("`", function() {
                new commonTools.HotKeyPanel(_g1.actions).activateTouchScreen();
                _g1.unRegisterOnKey("`");
                _g1.registerOnKey("`", null, "Show FPS metter");
            }, "activate touch screen");
            this.registerOnKey("e", (function(f, a1) {
                return function() {
                    f(a1);
                };
            })($bind(this, this.dispatchKBEvent), 69), "Show EMY simulator");
            this.registerOnKey("F9", (function(f1, a11) {
                return function() {
                    f1(a11);
                };
            })($bind(this, this.dispatchKBEvent), 120), "Show GAFF tool(Cheat panel)");
            this.registerOnKey("F10", (function(f2, a12) {
                return function() {
                    f2(a12);
                };
            })($bind(this, this.dispatchKBEvent), 121), "Show Fps graph tool");
            this.registerOnKey("F8", (function(f3, a13) {
                return function() {
                    f3(a13);
                };
            })($bind(this, this.dispatchKBEvent), 119), "Show SOUNDS test tool");
            this.registerOnKey("Alt + i", (function(f4, a14, a2, a3) {
                return function() {
                    f4(a14, a2, a3);
                };
            })($bind(this, this.dispatchKBEvent), 73, false, true), "Show elements inspector");
            this.registerOnKey("d", unRegisterFunctionalKeys, "UNREGISTER SYSTEM KEYS");
            this.registerOnKey("~", $bind(this, this.showAllPopupWithHotKeysDescriptions), "Show popup with hot keys descriptions");
        };
        commonTools.HotKeyTool.prototype.dispatchKBEvent = function(keyCode, ctrlKey, altKey, shiftKey) {
            if (shiftKey == null) shiftKey = false;
            if (altKey == null) altKey = false;
            if (ctrlKey == null) ctrlKey = false;
            var e = new Event("keydown");
            e.keyCode = keyCode;
            e.which = e.keyCode;
            e.altKey = altKey;
            e.ctrlKey = ctrlKey;
            e.shiftKey = shiftKey;
            window.document.body.dispatchEvent(e);
            window.dispatchEvent(e);
        };
        commonTools.HotKeyTool.prototype.showAllPopupWithHotKeysDescriptions = function() {
            var allActions = [];
            var $it0 = this.actions.iterator();
            while ($it0.hasNext()) {
                var actions = $it0.next();
                var _g = 0;
                while (_g < actions.length) {
                    var action = actions[_g];
                    ++_g;
                    allActions.push(action);
                }
            }
            while (allActions.length > 0) {
                var actions1 = allActions.splice(0, 23);
                if (!this.showPopupWithActionsDescription(actions1)) return;
            }
        };
        commonTools.HotKeyTool.prototype.showPopupWithActionsDescription = function(actions) {
            var message = "Actual reserved hot keys:\n";
            var _g = 0;
            while (_g < actions.length) {
                var action = actions[_g];
                ++_g;
                var action1 = action;
                message += "• " + action1.key + " : " + action1.description + "\n";
            }
            return window.confirm(message);
        };
        commonTools.HotKeyTool.prototype.unRegisterOnKey = function(key) {
            if (this.actions.exists(key)) this.actions.remove(key);
        };
        commonTools.HotKeyTool.prototype.registerOnKey = function(key, action, description, overrideAction) {
            if (overrideAction == null) overrideAction = false;
            if (description == null) description = "Empty description";
            if (!this.actions.exists(key) || overrideAction) this.actions.set(key, []);
            this.actions.get(key).push(new common.tools.hokeys.Action(action, description, key));
        };
        commonTools.HotKeyTool.prototype.onkeypress = function(e) {
            console.log("GC::HotKeyTool:\n            \te.ctrlKey: " + (e.ctrlKey == null ? "null" : "" + e.ctrlKey) + "\n            \te.altKey: " + (e.altKey == null ? "null" : "" + e.altKey) + "\n            \te.shiftKey: " + (e.shiftKey == null ? "null" : "" + e.shiftKey) + "\n            \te.charCode: " + e.charCode + "\n            \te.keyCode: " + e.keyCode + "\n            \te.key: " + e.key + "\n            \te.repeat: " + (e.repeat == null ? "null" : "" + e.repeat) + "\n                        ");
            this.call(e.key);
        };
        commonTools.HotKeyTool.prototype.unRegisterFunctionalKeys = function() {
            this.call("e");
        };
        commonTools.HotKeyTool.prototype.call = function(key) {
            if (this.actions.exists(key)) {
                var _g = 0;
                var _g1 = this.actions.get(key);
                while (_g < _g1.length) {
                    var action = _g1[_g];
                    ++_g;
                    if (action.action != null) action.action();
                }
            }
        };
        commonTools.HotKeyTool.instance = null;
        commonTools.HotKeyTool.getInstance = function() {
            if (commonTools.HotKeyTool.instance == null) commonTools.HotKeyTool.instance = new commonTools.HotKeyTool();
            return commonTools.HotKeyTool.instance;
        };
        commonTools.HotKeyTool.prototype.__class__ = commonTools.HotKeyTool;
        if (typeof common == 'undefined') {
            var common = {};
        };
        if (!common.tools) {
            common.tools = {};
        };
        if (!common.tools.hokeys) {
            common.tools.hokeys = {};
        };
        common.tools.hokeys.Action = function(action, description, key) {
            this.action = action;
            this.description = description;
            this.key = key;
        };
        common.tools.hokeys.Action.__name__ = ["common", "tools", "hokeys", "Action"];
        common.tools.hokeys.Action.prototype.action = null;
        common.tools.hokeys.Action.prototype.description = null;
        common.tools.hokeys.Action.prototype.key = null;
        common.tools.hokeys.Action.prototype.__class__ = common.tools.hokeys.Action;
        commonTools.CustomMap = function(map) {
            this.map = map;
            if (map == null) this.map = new _hcmn_.haxe_ds_StringMap();
        };
        commonTools.CustomMap.__name__ = ["commonTools", "CustomMap"];
        commonTools.CustomMap.prototype.map = null;
        commonTools.CustomMap.prototype.getOrDefault = function(k, defaultValue) {
            if (this.exists(k)) return this.get(k);
            else return defaultValue;
        };
        commonTools.CustomMap.prototype.get = function(k) {
            return this.map.get(k);
        };
        commonTools.CustomMap.prototype.setAll = function(v) {
            var $it0 = this.keys();
            while ($it0.hasNext()) {
                var key = $it0.next();
                this.set(key, v);
            }
        };
        commonTools.CustomMap.prototype.setIfNotExist = function(k, v) {
            this.set(k, this.getOrDefault(k, v));
        };
        commonTools.CustomMap.prototype.set = function(k, v) {
            this.map.set(k, v);
        };
        commonTools.CustomMap.prototype.exists = function(k) {
            return this.map.exists(k);
        };
        commonTools.CustomMap.prototype.remove = function(k) {
            return this.map.remove(k);
        };
        commonTools.CustomMap.prototype.keys = function() {
            return this.map.keys();
        };
        commonTools.CustomMap.prototype.iterator = function() {
            return this.map.iterator();
        };
        commonTools.CustomMap.prototype.toString = function() {
            return this.map.toString();
        };
        commonTools.CustomMap.prototype.containsValue = function(value) {
            var $it0 = this.map.iterator();
            while ($it0.hasNext()) {
                var mapValue = $it0.next();
                if (mapValue == value) return true;
            }
            return false;
        };
        commonTools.CustomMap.prototype.__class__ = commonTools.CustomMap;
        commonTools.DecimalValue = function(decimalValue) {
            this.decimalValue = decimalValue;
        };
        commonTools.DecimalValue.__name__ = ["commonTools", "DecimalValue"];
        commonTools.DecimalValue.prototype.decimalValue = null;
        commonTools.DecimalValue.prototype.asString = function() {
            return this.decimalValue;
        };
        commonTools.DecimalValue.prototype.asFloat = function() {
            return parseFloat(this.decimalValue);
        };
        commonTools.DecimalValue.prototype.asFixedFloat = function(precision) {
            if (precision == null) precision = 0;
            return commonTools.FloatUtil.fixedFloat(this.asFloat(), precision);
        };
        commonTools.DecimalValue.prototype.asInt = function() {
            return _hcmn_.Std.parseInt(this.decimalValue);
        };
        commonTools.DecimalValue.prototype.__class__ = commonTools.DecimalValue;
        commonTools.MoneyValue = function(moneyFromater, moneyValue) {
            commonTools.DecimalValue.call(this, moneyValue);
            this.moneyFromater = moneyFromater;
        };
        commonTools.MoneyValue.__name__ = ["commonTools", "MoneyValue"];
        commonTools.MoneyValue.__super__ = commonTools.DecimalValue;
        for (var k in commonTools.DecimalValue.prototype) commonTools.MoneyValue.prototype[k] = commonTools.DecimalValue.prototype[k];
        commonTools.MoneyValue.prototype.moneyFromater = null;
        commonTools.MoneyValue.prototype.format = function(precision) {
            if (precision == null) precision = 2;
            return this.moneyFromater.format(this.asFixedFloat(precision) + "");
        };
        commonTools.MoneyValue.prototype.formatAndRemoveTrailingZeroes = function(precision) {
            if (precision == null) precision = 2;
            var result = this.format(precision);
            if (new _hcmn_.EReg("\\D", "").match(result)) return new _hcmn_.EReg("\\D?0+$", "").replace(result, "");
            return result;
        };
        commonTools.MoneyValue.prototype.isZero = function() {
            return this.moneyFromater.isZero(this.decimalValue);
        };
        commonTools.MoneyValue.prototype.isNotZero = function() {
            return !this.isZero();
        };
        commonTools.MoneyValue.prototype.__class__ = commonTools.MoneyValue;

        commonTools.Provider = function() {}
        commonTools.Provider.prototype = {

            provide: function(t) {
                return {
                    arguments: ["*"],
                    returns: "*"
                };
            }
        };
        commonTools.MoneyValueProvider = function(moneyFormatter) {
            this.moneyFormatter = moneyFormatter;
        };
        commonTools.MoneyValueProvider = ck_implements(commonTools.MoneyValueProvider, commonTools.Provider);
        commonTools.MoneyValueProvider.__interfaces__ = [commonTools.Provider];
        commonTools.MoneyValueProvider.__name__ = ["commonTools", "MoneyValueProvider"];
        commonTools.MoneyValueProvider.prototype.moneyFormatter = null;
        commonTools.MoneyValueProvider.prototype.provide = function(moneyValue) {
            return new commonTools.MoneyValue(this.moneyFormatter, moneyValue);
        };
        commonTools.MoneyValueProvider.prototype.__class__ = commonTools.MoneyValueProvider;
        commonTools.FloatUtil = function() {};
        commonTools.FloatUtil.__name__ = ["commonTools", "FloatUtil"];
        commonTools.FloatUtil.fixedFloat = function(v, precision) {
            if (precision == null) precision = 2;
            var pow = _hcmn_.Math.pow(10, precision);
            return _hcmn_.Math.round(v * pow) / pow;
        };
        commonTools.FloatUtil.correctDivision = function(dividend, divisor, floatPointOffset) {
            if (floatPointOffset == null) floatPointOffset = 100;
            return dividend * floatPointOffset / (divisor * floatPointOffset);
        };
        commonTools.FloatUtil.correctMultiplication = function(factor, multiplier, floatPointOffset) {
            if (floatPointOffset == null) floatPointOffset = 100;
            return factor * floatPointOffset * (multiplier * floatPointOffset) / (floatPointOffset * floatPointOffset);
        };
        commonTools.FloatUtil.prototype.__class__ = commonTools.FloatUtil;

        commonTools.IPool = function() {}
        commonTools.IPool.prototype = {

            addToPool: function(poolKey, poolElement) {
                return {
                    arguments: ["string", "*"],
                    returns: "void"
                };
            },
            backToPool: function(poolKey, poolElement) {
                return {
                    arguments: ["string", "*"],
                    returns: "void"
                };
            },
            getFromPool: function(poolKey) {
                return {
                    arguments: ["string"],
                    returns: "*"
                };
            }
        };
        commonTools.Pool = function() {
            this.occupiedPoolMap = new _hcmn_.haxe_ds_StringMap();
            this.freePoolMap = new _hcmn_.haxe_ds_StringMap();
        };
        commonTools.Pool = ck_implements(commonTools.Pool, commonTools.IPool);
        commonTools.Pool.__interfaces__ = [commonTools.IPool];
        commonTools.Pool.__name__ = ["commonTools", "Pool"];
        commonTools.Pool.prototype.freePoolMap = null;
        commonTools.Pool.prototype.occupiedPoolMap = null;
        commonTools.Pool.prototype.addToPool = function(poolKey, poolElement) {
            this.backToPool(poolKey, poolElement);
        };
        commonTools.Pool.prototype.backToPool = function(poolKey, poolElement) {
            this.moveFromTo(poolElement, this.getOccupiedList(poolKey), this.getFreeList(poolKey));
        };
        commonTools.Pool.prototype.getFromPool = function(poolKey) {
            var list = this.getFreeList(poolKey);
            var result;
            if (list.length > 0) result = list[0];
            else result = null;
            this.moveFromTo(result, this.getFreeList(poolKey), this.getOccupiedList(poolKey));
            return result;
        };
        commonTools.Pool.prototype.getFreeList = function(listName) {
            return this.getListFromMap(listName, this.freePoolMap);
        };
        commonTools.Pool.prototype.getOccupiedList = function(listName) {
            return this.getListFromMap(listName, this.occupiedPoolMap);
        };
        commonTools.Pool.prototype.getListFromMap = function(listName, poolMap) {
            if (!(_hcmn_.__map_reserved[listName] != null ? poolMap.existsReserved(listName) : poolMap.h.hasOwnProperty(listName))) poolMap.set(listName, []);
            return _hcmn_.__map_reserved[listName] != null ? poolMap.getReserved(listName) : poolMap.h[listName];
        };
        commonTools.Pool.prototype.moveFromTo = function(what, from, to) {
            if (what != null) {
                _hcmn_.HxOverrides.remove(from, what);
                to.push(what);
            }
        };
        commonTools.Pool.prototype.__class__ = commonTools.Pool;
        commonTools.ConditionsCollector = function(map, conditions) {
            this.timeoutId = 0;
            this.map = map;
            var $it0 = map.keys();
            while ($it0.hasNext()) {
                var condition = $it0.next();
                this.addCondition(condition);
            }
            if (conditions != null) {
                var _g = 0;
                while (_g < conditions.length) {
                    var condition1 = conditions[_g];
                    ++_g;
                    this.addCondition(condition1);
                }
            }
            this.timeoutId = window.setTimeout($bind(this, this.checkConditionsComplete), 60000);
        };
        commonTools.ConditionsCollector.__name__ = ["commonTools", "ConditionsCollector"];
        commonTools.ConditionsCollector.prototype.callback = null;
        commonTools.ConditionsCollector.prototype.map = null;
        commonTools.ConditionsCollector.prototype.timeoutId = null;
        commonTools.ConditionsCollector.prototype.checkConditionsComplete = function() {
            if (!this.isFinished()) {
                var noCompeletedConditions = "Unresolved conditions: \\n";
                var $it0 = this.map.keys();
                while ($it0.hasNext()) {
                    var key = $it0.next();
                    if (this.map.get(key) == false) noCompeletedConditions += "" + _hcmn_.Std.string(key) + " \\n";
                }
                eval("console.error('" + noCompeletedConditions + "')");
            }
        };
        commonTools.ConditionsCollector.prototype.addCondition = function(id, status) {
            if (status == null) status = false;
            this.map.set(id, status);
        };
        commonTools.ConditionsCollector.prototype.getStatus = function(id) {
            return !this.map.exists(id) || this.map.get(id);
        };
        commonTools.ConditionsCollector.prototype.resolveConditions = function(conditions) {
            var _g = 0;
            while (_g < conditions.length) {
                var condition = conditions[_g];
                ++_g;
                this.resolveCondition(condition);
            }
        };
        commonTools.ConditionsCollector.prototype.resolveCondition = function(id) {
            if (this.map.exists(id)) {
                this.map.set(id, true);
                if (this.isFinished()) {
                    this.clearAll();
                    this.callback();
                }
            }
        };
        commonTools.ConditionsCollector.prototype.isFinished = function() {
            var out = true;
            var $it0 = this.map.iterator();
            while ($it0.hasNext()) {
                var value = $it0.next();
                out = out && value;
            }
            return out;
        };
        commonTools.ConditionsCollector.prototype.clearAll = function() {
            var $it0 = this.map.keys();
            while ($it0.hasNext()) {
                var key = $it0.next();
                this.map.remove(key);
            }
        };
        commonTools.ConditionsCollector.prototype.resolveAll = function() {
            if (_hcmn_.Lambda.array(this.map).length > 0) {
                this.clearAll();
                window.clearTimeout(this.timeoutId);
                this.callback();
            }
        };
        commonTools.ConditionsCollector.prototype.then = function(callback) {
            this.callback = callback;
            return this;
        };
        commonTools.ConditionsCollector.prototype.__class__ = commonTools.ConditionsCollector;
        commonTools.EnumConditionsCollector = function(value) {
            var values = _hcmn_.Lambda.array(_hcmn_.Lambda.map(_hcmn_.Type.getEnumConstructs(value), function(e) {
                return _hcmn_.Type.createEnum(value, e, null);
            }));
            commonTools.ConditionsCollector.call(this, new haxe.ds.EnumValueMap(), values);
        };
        commonTools.EnumConditionsCollector.__name__ = ["commonTools", "EnumConditionsCollector"];
        commonTools.EnumConditionsCollector.__super__ = commonTools.ConditionsCollector;
        for (var k in commonTools.ConditionsCollector.prototype) commonTools.EnumConditionsCollector.prototype[k] = commonTools.ConditionsCollector.prototype[k];
        commonTools.EnumConditionsCollector.prototype.__class__ = commonTools.EnumConditionsCollector;
        commonTools.PromiseExtension = function() {};
        commonTools.PromiseExtension.__name__ = ["commonTools", "PromiseExtension"];
        commonTools.PromiseExtension.thenCall = function(promise, callback) {
            promise.then(function(data) {
                callback();
            });
        };
        commonTools.PromiseExtension.prototype.__class__ = commonTools.PromiseExtension;
        commonTools.PromizesWaiter = function() {
            this.promizes = [];
        };
        commonTools.PromizesWaiter.__name__ = ["commonTools", "PromizesWaiter"];
        commonTools.PromizesWaiter.prototype.promizes = null;
        commonTools.PromizesWaiter.prototype.awaitPromise = function(promize) {
            this.promizes.push(promize);
            return this;
        };
        commonTools.PromizesWaiter.prototype.await = function(calback) {
            var _g = this;
            var amountOfCompletion = 0;
            var awaitChecker = function(data) {
                amountOfCompletion++;
                if (amountOfCompletion == _g.promizes.length) calback();
            };
            var _g1 = 0;
            var _g11 = this.promizes;
            while (_g1 < _g11.length) {
                var promise = _g11[_g1];
                ++_g1;
                promise.then(awaitChecker);
            }
        };
        commonTools.PromizesWaiter.prototype.__class__ = commonTools.PromizesWaiter;
        commonTools.StringsConditionsCollector = function(conditions) {
            commonTools.ConditionsCollector.call(this, new _hcmn_.haxe_ds_StringMap(), conditions);
        };
        commonTools.StringsConditionsCollector.__name__ = ["commonTools", "StringsConditionsCollector"];
        commonTools.StringsConditionsCollector.__super__ = commonTools.ConditionsCollector;
        for (var k in commonTools.ConditionsCollector.prototype) commonTools.StringsConditionsCollector.prototype[k] = commonTools.ConditionsCollector.prototype[k];
        commonTools.StringsConditionsCollector.prototype.__class__ = commonTools.StringsConditionsCollector;
        commonTools.LocalStorage = function(prefix) {
            if (prefix == null) prefix = "ollie_settings_";
            this.prefix = prefix;
            if (this.testLocalStorage("testkey", "testvalue")) this.storage = js.Browser.getLocalStorage();
        };
        commonTools.LocalStorage.__name__ = ["commonTools", "LocalStorage"];
        commonTools.LocalStorage.prototype.prefix = null;
        commonTools.LocalStorage.prototype.storage = null;
        commonTools.LocalStorage.prototype.testLocalStorage = function(key, value) {
            var fullKey = this.prefix + key;
            try {
                js.Browser.getLocalStorage().setItem(fullKey, value);
                var result = js.Browser.getLocalStorage().getItem(fullKey);
                if (value != result) {
                    window.console.error("Local storage test failed");
                    return false;
                }
                js.Browser.getLocalStorage().removeItem(fullKey);
            } catch (err) {
                if (err instanceof js._Boot.HaxeError) err = err.val;
                window.console.error("Failed to use local storage");
                return false;
            }
            return true;
        };
        commonTools.LocalStorage.prototype.writeOption = function(id, value) {
            if (this.storage == null) return;
            this.storage.setItem(this.prefix + id, value);
        };
        commonTools.LocalStorage.prototype.writeOptionIfNotExists = function(id, value) {
            if (!this.hasOption(id)) this.writeOption(id, value);
        };
        commonTools.LocalStorage.prototype.readOption = function(id, defaultValue) {
            if (this.storage == null) return defaultValue;
            return this.storage.getItem(this.prefix + id);
        };
        commonTools.LocalStorage.prototype.hasOption = function(id) {
            if (this.storage == null) return false;
            return this.storage.getItem(this.prefix + id) != null;
        };
        commonTools.LocalStorage.prototype.__class__ = commonTools.LocalStorage;
        commonTools.TimeoutInvoker = function() {};
        commonTools.TimeoutInvoker.__name__ = ["commonTools", "TimeoutInvoker"];
        commonTools.TimeoutInvoker.clearTimeoutsWithForceInvoke = function(groupName) {
            commonTools.TimeoutInvoker.clearTimeouts(groupName, true);
        };
        commonTools.TimeoutInvoker.clearTimeoutsWithoutForceInvoke = function(groupName) {
            commonTools.TimeoutInvoker.clearTimeouts(groupName, false);
        };
        commonTools.TimeoutInvoker.clearTimeouts = function(groupName, isNeedInvokeBeforeClear) {
            if (isNeedInvokeBeforeClear == null) isNeedInvokeBeforeClear = false;
            var list;
            var _this = commonTools.TimeoutInvoker.getTimeoutsGroup(groupName);
            list = _this.slice();
            var _g = 0;
            while (_g < list.length) {
                var instance = list[_g];
                ++_g;
                if (instance.isInterval) window.clearInterval(instance.timeOutId);
                else window.clearTimeout(instance.timeOutId);
                var _this1 = commonTools.TimeoutInvoker.getTimeoutsGroup(groupName);
                _hcmn_.HxOverrides.remove(_this1, instance);
                if (isNeedInvokeBeforeClear) {
                    instance.isCalled = true;
                    instance.handler();
                }
            }
            commonTools.TimeoutInvoker.TIMEOUT_GROUPS.remove(groupName);
        };
        commonTools.TimeoutInvoker.setTimeout = function(groupName, handler, timeout, isInterval) {
            if (isInterval == null) isInterval = false;
            if (timeout == null) timeout = 0;
            var invokeInstance = new common.tools.timeouts.InvokeInstance();
            var id = 0;
            if (isInterval) id = window.setInterval(commonTools.TimeoutInvoker.getInvokeHandler(invokeInstance), timeout);
            else id = window.setTimeout(commonTools.TimeoutInvoker.getInvokeHandler(invokeInstance), timeout);
            invokeInstance.groupName = groupName;
            invokeInstance.timeOutId = id;
            invokeInstance.handler = handler;
            invokeInstance.isInterval = isInterval;
            commonTools.TimeoutInvoker.getTimeoutsGroup(groupName).push(invokeInstance);
        };
        commonTools.TimeoutInvoker.getInvokeHandler = function(instance) {
            return function() {
                if (!instance.isCalled) {
                    instance.isCalled = true;
                    if (!instance.isInterval) {
                        var _this = commonTools.TimeoutInvoker.getTimeoutsGroup(instance.groupName);
                        _hcmn_.HxOverrides.remove(_this, instance);
                    }
                }
                instance.handler();
            };
        };
        commonTools.TimeoutInvoker.getTimeoutsGroup = function(groupName) {
            if (!commonTools.TimeoutInvoker.TIMEOUT_GROUPS.exists(groupName)) {
                var value = [];
                commonTools.TimeoutInvoker.TIMEOUT_GROUPS.set(groupName, value);
            }
            return commonTools.TimeoutInvoker.TIMEOUT_GROUPS.get(groupName);
        };
        commonTools.TimeoutInvoker.prototype.__class__ = commonTools.TimeoutInvoker;
        if (!common.tools.timeouts) {
            common.tools.timeouts = {};
        };
        common.tools.timeouts.InvokeInstance = function() {
            this.isCalled = false;
        };
        common.tools.timeouts.InvokeInstance.__name__ = ["common", "tools", "timeouts", "InvokeInstance"];
        common.tools.timeouts.InvokeInstance.prototype.isCalled = null;
        common.tools.timeouts.InvokeInstance.prototype.groupName = null;
        common.tools.timeouts.InvokeInstance.prototype.handler = null;
        common.tools.timeouts.InvokeInstance.prototype.timeOutId = null;
        common.tools.timeouts.InvokeInstance.prototype.isInterval = null;
        common.tools.timeouts.InvokeInstance.prototype.__class__ = common.tools.timeouts.InvokeInstance;
        commonTools.WinCounter = function() {};
        commonTools.WinCounter.__name__ = ["commonTools", "WinCounter"];
        commonTools.WinCounter.prototype.startValue = null;
        commonTools.WinCounter.prototype.targetValue = null;
        commonTools.WinCounter.prototype.totalTime = null;
        commonTools.WinCounter.prototype.values = null;
        commonTools.WinCounter.prototype.countUpTimer = null;
        commonTools.WinCounter.prototype.currentStep = null;
        commonTools.WinCounter.prototype.onStepCallback = null;
        commonTools.WinCounter.prototype.onFinishCallback = null;
        commonTools.WinCounter.prototype.setOnStepCallback = function(onStepCallback) {
            this.onStepCallback = onStepCallback;
        };
        commonTools.WinCounter.prototype.setOnFinishCallback = function(onFinishCallback) {
            this.onFinishCallback = onFinishCallback;
        };
        commonTools.WinCounter.prototype.startCount = function(startValue, targetValue, totalTime, stepsCount) {
            this.startValue = startValue;
            this.targetValue = targetValue;
            this.totalTime = totalTime;
            this.values = this.generateValues(startValue, targetValue, stepsCount);
            this.startCountUp();
        };
        commonTools.WinCounter.prototype.isRunning = function() {
            return this.countUpTimer != null;
        };
        commonTools.WinCounter.prototype.generateValues = function(from, to, numSteps) {
            var res = [];
            var stepFloat = (to - from) / numSteps;
            var _g1 = 0;
            var _g = numSteps + 1;
            while (_g1 < _g) {
                var i = _g1++;
                res.push(from + stepFloat * i);
            }
            return res;
        };
        commonTools.WinCounter.prototype.startCountUp = function() {
            this.currentStep = -1;
            var oneStepTime = _hcmn_.Math.floor(this.totalTime / this.values.length);
            this.countUpTimer = new _hcmn_.haxe_Timer(oneStepTime);
            this.countUpTimer.run = $bind(this, this.countUp);
        };
        commonTools.WinCounter.prototype.countUp = function() {
            this.currentStep++;
            if (this.onStepCallback != null) this.onStepCallback(this.values[this.currentStep]);
            if (this.currentStep == this.values.length - 1) this.stop();
        };
        commonTools.WinCounter.prototype.stop = function() {
            if (this.countUpTimer != null) {
                this.countUpTimer.stop();
                this.countUpTimer = null;
                if (this.onFinishCallback != null) this.onFinishCallback(this.values[this.currentStep]);
            }
        };
        commonTools.WinCounter.prototype.__class__ = commonTools.WinCounter;
        commonTools.CanvasCorrector = function(canvasPrefix) {
            if (canvasPrefix == null) canvasPrefix = "skgl_";
            this.canvasPrefix = canvasPrefix;
        };
        commonTools.CanvasCorrector.__name__ = ["commonTools", "CanvasCorrector"];
        commonTools.CanvasCorrector.prototype.canvasPrefix = null;
        commonTools.CanvasCorrector.prototype.registerCorrectorOnPageResize = function(topOffset) {
            window.onresize = this.getCorrectorForGameCanvases(topOffset);
        };
        commonTools.CanvasCorrector.prototype.correctGameCanvases = function(topOffset) {
            this.correctCanvases(topOffset);
        };
        commonTools.CanvasCorrector.prototype.getCorrectorForGameCanvases = function(topOffset) {
            var _g = this;
            return function() {
                _g.correctCanvases(topOffset);
            };
        };
        commonTools.CanvasCorrector.prototype.correctCanvases = function(panelHeight) {
            var innerWidth = window.innerWidth;
            var canvases = this.getAvailableCanvases();
            var _g = 0;
            while (_g < canvases.length) {
                var canvas = canvases[_g];
                ++_g;
                var inNeedToUseStyle = canvas.style.width + canvas.style.height != "";
                var canvasWidth;
                if (inNeedToUseStyle) canvasWidth = _hcmn_.Std.parseInt(canvas.style.width);
                else canvasWidth = canvas.width;
                var canvasHeight;
                if (inNeedToUseStyle) canvasHeight = _hcmn_.Std.parseInt(canvas.style.height);
                else canvasHeight = canvas.height;
                var expectedCanvasHeight = canvasHeight - panelHeight;
                var scale = expectedCanvasHeight / canvasHeight;
                var expectedCanvasWidth = canvasWidth * scale | 0;
                var expectedCanvasLeft = _hcmn_.Math.round(_hcmn_.Math.abs(innerWidth - expectedCanvasWidth) * .5);
                this.correctCanvas(canvas, panelHeight, expectedCanvasLeft, expectedCanvasWidth, expectedCanvasHeight);
            }
        };
        commonTools.CanvasCorrector.prototype.getAvailableCanvases = function() {
            var i = 0;
            var result;
            var _g = [];
            while (this.hasCanvas(i)) _g.push(this.getCanvas(i++));
            result = _g;
            return result;
        };
        commonTools.CanvasCorrector.prototype.hasCanvas = function(index) {
            return this.getCanvas(index) != null;
        };
        commonTools.CanvasCorrector.prototype.getCanvas = function(index) {
            return window.document.getElementById(this.canvasPrefix + index);
        };
        commonTools.CanvasCorrector.prototype.correctCanvas = function(canvas, top, left, width, height) {
            canvas.style.top = top + "px";
            canvas.style.left = left + "px";
            canvas.style.width = width + "px";
            canvas.style.height = height + "px";
        };
        commonTools.CanvasCorrector.prototype.__class__ = commonTools.CanvasCorrector;
        if (typeof haxe == 'undefined') {
            var haxe = {};
        };

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

            get: function(k) {
                return {
                    arguments: ["*"],
                    returns: "null"
                };
            },
            set: function(k, v) {
                return {
                    arguments: ["*", "*"],
                    returns: "void"
                };
            },
            exists: function(k) {
                return {
                    arguments: ["*"],
                    returns: "boolean"
                };
            },
            remove: function(k) {
                return {
                    arguments: ["*"],
                    returns: "boolean"
                };
            },
            keys: function() {
                return {
                    arguments: [],
                    returns: "null"
                };
            },
            iterator: function() {
                return {
                    arguments: [],
                    returns: "null"
                };
            },
            toString: function() {
                return {
                    arguments: [],
                    returns: "string"
                };
            }
        };
        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.remove = function(key) {
            try {
                this.root = this.removeLoop(key, this.root);
                return true;
            } catch (e) {
                if (e instanceof js._Boot.HaxeError) e = e.val;
                if (_hcmn_.js_Boot.__instanceof(e, String)) {
                    return false;
                } else throw (e);
            }
        };
        haxe.ds.BalancedTree.prototype.exists = function(key) {
            var node = this.root;
            while (node != null) {
                var c = this.compare(key, node.key);
                if (c == 0) return true;
                else if (c < 0) node = node.left;
                else node = node.right;
            }
            return false;
        };
        haxe.ds.BalancedTree.prototype.iterator = function() {
            var ret = [];
            this.iteratorLoop(this.root, ret);
            return _hcmn_.HxOverrides.iter(ret);
        };
        haxe.ds.BalancedTree.prototype.keys = function() {
            var ret = [];
            this.keysLoop(this.root, ret);
            return _hcmn_.HxOverrides.iter(ret);
        };
        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.removeLoop = function(k, node) {
            if (node == null) throw new js._Boot.HaxeError("Not_found");
            var c = this.compare(k, node.key);
            if (c == 0) return this.merge(node.left, node.right);
            else if (c < 0) return this.balance(this.removeLoop(k, node.left), node.key, node.value, node.right);
            else return this.balance(node.left, node.key, node.value, this.removeLoop(k, node.right));
        };
        haxe.ds.BalancedTree.prototype.iteratorLoop = function(node, acc) {
            if (node != null) {
                this.iteratorLoop(node.left, acc);
                acc.push(node.value);
                this.iteratorLoop(node.right, acc);
            }
        };
        haxe.ds.BalancedTree.prototype.keysLoop = function(node, acc) {
            if (node != null) {
                this.keysLoop(node.left, acc);
                acc.push(node.key);
                this.keysLoop(node.right, acc);
            }
        };
        haxe.ds.BalancedTree.prototype.merge = function(t1, t2) {
            if (t1 == null) return t2;
            if (t2 == null) return t1;
            var t = this.minBinding(t2);
            return this.balance(t1, t.key, t.value, this.removeMinBinding(t2));
        };
        haxe.ds.BalancedTree.prototype.minBinding = function(t) {
            if (t == null) throw new js._Boot.HaxeError("Not_found");
            else if (t.left == null) return t;
            else return this.minBinding(t.left);
        };
        haxe.ds.BalancedTree.prototype.removeMinBinding = function(t) {
            if (t.left == null) return t.right;
            else return this.balance(this.removeMinBinding(t.left), t.key, t.value, t.right);
        };
        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.toString = function() {
            if (this.root == null) return "{}";
            else return "{" + this.root.toString() + "}";
        };
        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.toString = function() {
            return (this.left == null ? "" : this.left.toString() + ", ") + ("" + _hcmn_.Std.string(this.key) + "=" + _hcmn_.Std.string(this.value)) + (this.right == null ? "" : ", " + this.right.toString());
        };
        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 (!haxe.ds._StringMap) {
            haxe.ds._StringMap = {};
        };
        haxe.ds._StringMap.StringMapIterator = function(map, keys) {
            this.map = map;
            this.keys = keys;
            this.index = 0;
            this.count = keys.length;
        };
        haxe.ds._StringMap.StringMapIterator.__name__ = ["haxe", "ds", "_StringMap", "StringMapIterator"];
        haxe.ds._StringMap.StringMapIterator.prototype.map = null;
        haxe.ds._StringMap.StringMapIterator.prototype.keys = null;
        haxe.ds._StringMap.StringMapIterator.prototype.index = null;
        haxe.ds._StringMap.StringMapIterator.prototype.count = null;
        haxe.ds._StringMap.StringMapIterator.prototype.hasNext = function() {
            return this.index < this.count;
        };
        haxe.ds._StringMap.StringMapIterator.prototype.next = function() {
            return this.map.get(this.keys[this.index++]);
        };
        haxe.ds._StringMap.StringMapIterator.prototype.__class__ = haxe.ds._StringMap.StringMapIterator;
        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;
        js.Browser = function() {};
        js.Browser.__name__ = ["js", "Browser"];
        js.Browser.window = null;
        js.Browser.document = null;
        js.Browser.location = null;
        js.Browser.navigator = null;
        js.Browser.console = null;
        js.Browser.supported = null;
        js.Browser.getLocalStorage = function() {
            try {
                var s = window.localStorage;
                s.getItem("");
                return s;
            } catch (e) {
                if (e instanceof js._Boot.HaxeError) e = e.val;
                return null;
            }
        };
        js.Browser.prototype.__class__ = js.Browser;
        commonTools.LocalStorage.DEFAULT_PREFIX = "ollie_settings_";;
        commonTools.TimeoutInvoker.TIMEOUT_GROUPS = new _hcmn_.haxe_ds_StringMap();;
        commonTools.CanvasCorrector.DEFAULT_CANVAS_PREFIX = "skgl_";;
        return {
            exports: commonTools
        };
    });