! function() {
    var G = {};
    window.G = G, window.gameG = G, G.BuildEnvironment = {
        production: !0,
        version: "2.1.0",
        APP_ID: "cookie-crush-2-network",
        RAVEN_DSN: void 0,
        GAGK: void 0,
        GASK: void 0
    }, void 0 === G && (G = {}), console.log = function() {};
    var po = document.createElement("script");
    po.type = "text/javascript", po.src = "api.js";
    var s = document.getElementsByTagName("script")[0];
    s.parentNode.insertBefore(po, s), AnbycookGP = function() {
        var t = document.createElement("div");
        t.id = "anbycook", t.style.cssText = "height: 100%;width: 100%;background: #1F2E65;position: absolute;z-index: 9999998;top: 0", document.body.appendChild(t), window.addEventListener("message", function(t) {
            "okvid" === t.data.toString().split("|")[0] && setTimeout(function() {
                document.getElementById("anbycook").remove(), G.sfx.music.resume()
            }, 1)
        });
        var e = document.getElementById("anbycook"),
            i = document.createElement("iframe");
        i.frameBorder = 0, i.scrolling = "no", i.width = "100%", i.height = "90%", i.id = "randomid", i.setAttribute("src", "https://ludosmundi.com/games/vgenf/ytb.html"), i.setAttribute("style", "position: absolute;z-index: 9999999;margin: auto;top: 0;bottom: 0;left: 0;right: 0;padding: 0px;max-height: 100%;max-width: 100%");
        var s = new Image;
        s.src = "//ludosmundi.com/games/loading.gif", s.width = 120, s.setAttribute("alt", "Chargement..."), s.setAttribute("style", "position: absolute;z-index: 9999999;margin: auto;bottom: 0;left: 0;right: 0;padding: 0px;max-height: 100%;max-width: 100%"), e.appendChild(i), e.appendChild(s)
    }, G.ExtLoader = function() {
        Phaser.Loader.call(this, game), game.state.onStateChange.add(this.reset, this), this.imagesToRemoveOnStateChange = [], this.loadedUrls = {}
    }, G.ExtLoader.prototype = Object.create(Phaser.Loader.prototype), G.ExtLoader.prototype.reset = function(t, e) {
        this.imagesToRemoveOnStateChange.forEach(function(t) {
            this.cache.removeImage(t)
        }, this), this.imagesToRemoveOnStateChange = [], Phaser.Loader.prototype.reset.call(this, t, e)
    }, G.ExtLoader.prototype.addToFileList = function(t, e, i, s, a, n) {
        if (void 0 === a && (a = !1), void 0 === e || "" === e) return console.warn("Phaser.Loader: Invalid or no key given of type " + t), this;
        if (null == i) {
            if (!n) return console.warn("Phaser.Loader: No URL given for file type: " + t + " key: " + e), this;
            i = e + n
        }
        var o = {
            type: t,
            key: e,
            path: this.path,
            url: i,
            syncPoint: 0 < this._withSyncPointDepth,
            data: null,
            loading: !1,
            loaded: !1,
            error: !1
        };
        if (s)
            for (var r in s) o[r] = s[r];
        var h = this.getAssetIndex(t, e);
        if (a && -1 < h) {
            var l = this._fileList[h];
            l.loading || l.loaded ? (this._fileList.push(o), this._totalFileCount++) : this._fileList[h] = o
        } else -1 === h && (this._fileList.push(o), this._totalFileCount++);
        return this.loadFile(this._fileList.shift()), this
    }, G.ExtLoader.prototype.asyncComplete = function(t, e) {
        void 0 === e && (e = ""), t.loaded = !0, t.error = !!e, e && (t.errorMessage = e, console.warn("Phaser.Loader - " + t.type + "[" + t.key + "]: " + e))
    }, G.ExtLoader.prototype.fileComplete = function(e, t) {
        switch (e.type) {
            case "packfile":
                var i = JSON.parse(t.responseText);
                e.data = i || {};
                break;
            case "image":
                this.cache.addImage(e.key, e.url, e.data);
                break;
            case "spritesheet":
                this.cache.addSpriteSheet(e.key, e.url, e.data, e.frameWidth, e.frameHeight, e.frameMax, e.margin, e.spacing);
                break;
            case "textureatlas":
                if (null == e.atlasURL) this.cache.addTextureAtlas(e.key, e.url, e.data, e.atlasData, e.format);
                else if (!1, e.format == Phaser.Loader.TEXTURE_ATLAS_JSON_ARRAY || e.format == Phaser.Loader.TEXTURE_ATLAS_JSON_HASH || e.format == Phaser.Loader.TEXTURE_ATLAS_JSON_PYXEL) this.xhrLoad(e, this.transformUrl(e.atlasURL, e), "text", this.jsonLoadComplete);
                else {
                    if (e.format != Phaser.Loader.TEXTURE_ATLAS_XML_STARLING) throw new Error("Phaser.Loader. Invalid Texture Atlas format: " + e.format);
                    this.xhrLoad(e, this.transformUrl(e.atlasURL, e), "text", this.xmlLoadComplete)
                }
                break;
            case "bitmapfont":
                e.atlasURL ? (!1, this.xhrLoad(e, this.transformUrl(e.atlasURL, e), "text", function(t, e) {
                    var i;
                    try {
                        i = JSON.parse(e.responseText)
                    } catch (t) {}
                    i ? (t.atlasType = "json", this.jsonLoadComplete(t, e)) : (t.atlasType = "xml", this.xmlLoadComplete(t, e))
                })) : this.cache.addBitmapFont(e.key, e.url, e.data, e.atlasData, e.atlasType, e.xSpacing, e.ySpacing);
                break;
            case "video":
                if (e.asBlob) try {
                    e.data = t.response
                } catch (t) {
                    throw new Error("Phaser.Loader. Unable to parse video file as Blob: " + e.key)
                }
                this.cache.addVideo(e.key, e.url, e.data, e.asBlob);
                break;
            case "audio":
                this.game.sound.usingWebAudio ? (e.data = t.response, this.cache.addSound(e.key, e.url, e.data, !0, !1), e.autoDecode && this.game.sound.decode(e.key)) : this.cache.addSound(e.key, e.url, e.data, !1, !0);
                break;
            case "text":
                e.data = t.responseText, this.cache.addText(e.key, e.url, e.data);
                break;
            case "shader":
                e.data = t.responseText, this.cache.addShader(e.key, e.url, e.data);
                break;
            case "physics":
                i = JSON.parse(t.responseText);
                this.cache.addPhysicsData(e.key, e.url, i, e.format);
                break;
            case "script":
                e.data = document.createElement("script"), e.data.language = "javascript", e.data.type = "text/javascript", e.data.defer = !1, e.data.text = t.responseText, document.head.appendChild(e.data), e.callback && (e.data = e.callback.call(e.callbackContext, e.key, t.responseText));
                break;
            case "binary":
                e.callback ? e.data = e.callback.call(e.callbackContext, e.key, t.response) : e.data = t.response, this.cache.addBinary(e.key, e.data)
        }
        this.onFileComplete.dispatch(0, e.key, !e.error)
    };
    var saveAs = saveAs || function(r) {
        "use strict";
        if (!(void 0 === r || "undefined" != typeof navigator && /MSIE [1-9]\./.test(navigator.userAgent))) {
            var t = r.document,
                h = function() {
                    return r.URL || r.webkitURL || r
                },
                l = t.createElementNS("http://www.w3.org/1999/xhtml", "a"),
                d = "download" in l,
                c = /constructor/i.test(r.HTMLElement) || r.safari,
                u = /CriOS\/[\d]+/.test(navigator.userAgent),
                p = function(t) {
                    (r.setImmediate || r.setTimeout)(function() {
                        throw t
                    }, 0)
                },
                g = function(t) {
                    setTimeout(function() {
                        "string" == typeof t ? h().revokeObjectURL(t) : t.remove()
                    }, 4e4)
                },
                f = function(t) {
                    return /^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(t.type) ? new Blob([String.fromCharCode(65279), t], {
                        type: t.type
                    }) : t
                },
                s = function(t, i, e) {
                    e || (t = f(t));
                    var s, a = this,
                        n = "application/octet-stream" === t.type,
                        o = function() {
                            ! function(t, e, i) {
                                for (var s = (e = [].concat(e)).length; s--;) {
                                    var a = t["on" + e[s]];
                                    if ("function" == typeof a) try {
                                        a.call(t, i || t)
                                    } catch (t) {
                                        p(t)
                                    }
                                }
                            }(a, "writestart progress write writeend".split(" "))
                        };
                    if (a.readyState = a.INIT, d) return s = h().createObjectURL(t), void setTimeout(function() {
                        var t, e;
                        l.href = s, l.download = i, t = l, e = new MouseEvent("click"), t.dispatchEvent(e), o(), g(s), a.readyState = a.DONE
                    });
                    ! function() {
                        if ((u || n && c) && r.FileReader) {
                            var e = new FileReader;
                            return e.onloadend = function() {
                                var t = u ? e.result : e.result.replace(/^data:[^;]*;/, "data:attachment/file;");
                                r.open(t, "_blank") || (r.location.href = t), t = void 0, a.readyState = a.DONE, o()
                            }, e.readAsDataURL(t), a.readyState = a.INIT
                        }
                        s || (s = h().createObjectURL(t)), n ? r.location.href = s : r.open(s, "_blank") || (r.location.href = s);
                        a.readyState = a.DONE, o(), g(s)
                    }()
                },
                e = s.prototype;
            return "undefined" != typeof navigator && navigator.msSaveOrOpenBlob ? function(t, e, i) {
                return e = e || t.name || "download", i || (t = f(t)), navigator.msSaveOrOpenBlob(t, e)
            } : (e.abort = function() {}, e.readyState = e.INIT = 0, e.WRITING = 1, e.DONE = 2, e.error = e.onwritestart = e.onprogress = e.onwrite = e.onabort = e.onerror = e.onwriteend = null, function(t, e, i) {
                return new s(t, e || t.name || "download", i)
            })
        }
    }("undefined" != typeof self && self || "undefined" != typeof window && window || this.content);
    "undefined" != typeof module && module.exports ? module.exports.saveAs = saveAs : "undefined" != typeof define && null !== define && null !== define.amd && define("FileSaver.js", function() {
        return saveAs
    }), void 0 === G && (G = {}), G.Button = function(t, e, i, s, a) {
        Phaser.Button.call(this, game, G.l(t), G.l(e), null), this.state = game.state.getCurrentState(), G.changeTexture(this, i), this.anchor.setTo(.5), this.sfx = G.sfx.pop, this.active = !0, this.onClick = new Phaser.Signal, s && this.onClick.add(s, a || this), this._addClickListener(), this.terms = [], this.IMMEDIATE = !1, this.scaleOnClick = !0, this.refractorPeriod = 200, this.scaleChange = .1, this.pulsing = !1
    }, G.Button.prototype = Object.create(Phaser.Button.prototype), G.Button.constructor = G.Button, G.Button.prototype._addClickListener = function() {
        var t = G.Input.createCustomInputClickHandler();
        t.clickSignal.add(this.click, this), G.Input.initializeCustomInput(this), this.customInput.addHandler(t)
    }, G.Button.prototype.pulse = function(t) {
        this.pulsing = !0, this.pulsingTween = game.add.tween(this.scale).to({
            x: t || 1.1,
            y: t || 1.1
        }, 500, Phaser.Easing.Sinusoidal.InOut, !0, 0, -1, !0)
    }, G.Button.prototype.stopPulse = function(t) {
        this.pulsingTween && this.pulsingTween.stop(), this.scale.setTo(t || 1), this.pulsing = !1
    }, G.Button.prototype.click = function() {
        if (this.active && this.checkTerms()) {
            this.active = !1, this.onClick.dispatch(), this.sfx && this.sfx.play();
            var t = this.scale.x,
                e = this.scale.y;
            this.IMMEDIATE ? this.active = !0 : this.pulsing || !this.scaleOnClick ? game.time.events.add(this.refractorPeriod, function() {
                this.active = !0
            }, this) : game.add.tween(this.scale).to({
                x: t + this.scaleChange,
                y: e + this.scaleChange
            }, this.refractorPeriod, Phaser.Easing.Quadratic.Out, !0, 0, 0, !0).onComplete.add(function() {
                this.active = !0
            }, this)
        }
    }, G.Button.prototype.checkTerms = function() {
        for (var t = 0; t < this.terms.length; t++)
            if (!this.terms[t][0].call(this.terms[t][1])) return !1;
        return !0
    }, G.Button.prototype.addTerm = function(t, e) {
        this.terms.push([t, e])
    }, G.Button.prototype.addImageLabel = function(t) {
        this.label = game.make.image(0, 0, "ssheet", t), this.label.anchor.setTo(.5), this.addChild(this.label)
    }, G.Button.prototype.addTextLabel = function(t, e, i, s, a, n) {
        var o = 1 / G.Loader.currentConfigMulti;
        s = void 0 === s ? -2 : s, a = void 0 === a ? -2 : a, n = void 0 === n ? this.width * o * .7 : n, this.label = new G.Text(s, a, e, {
            style: t,
            fontSize: i || Math.floor(this.height * o * .7)
        }, .5, n), this.label.hitArea = new Phaser.Rectangle(0, 0, 0, 0), this.addChild(this.label)
    }, G.Button.prototype.addTextLabelMultiline = function(t, e) {
        this.label = new G.Text(0, 0, e, {
            style: t,
            fontSize: Math.floor(.5 * this.height)
        }, .5, .7 * this.width, .7 * this.height, !0, "center"), this.addChild(this.label)
    }, G.Button.prototype.stopTweens = function() {
        G.stopTweens(this)
    }, G.Button.prototype.changeTexture = function(t) {
        G.changeTexture(this, t)
    }, G.Button.prototype.add = function(t) {
        return this.addChild(t)
    }, G.Button.prototype.updateChildren = function() {
        for (var t = this.children.length; t--;) this.children[t].update()
    }, void 0 === G && (G = {}), G.FrameAnimation = function(t, e, i, s, a) {
        Phaser.Image.call(this, game, G.l(t), G.l(e)), this.anchor.setTo(.5), this.frameNamePrefix = i, this.animFramesLen = this.getAnimationLength(this.frameNamePrefix), this.timerEvery = s ? 60 / s : 1, this.animDir = 1, G.changeTexture(this, this.frameNamePrefix + "_0"), this.currentTimer = 0, this.currentIndex = 0, this.onFinish = new Phaser.Signal, this.active = a || !1
    }, G.FrameAnimation.prototype = Object.create(Phaser.Image.prototype), G.FrameAnimation.prototype.play = function(t, e, i) {
        return this.currentTimer = 0, this.currentIndex = i || 0, this.active = !0, this.loop = t - 1 || 0, this.animDir = 1, this.bounce = e || !1, G.changeTexture(this, this.frameNamePrefix + "_" + this.currentIndex), this
    }, G.FrameAnimation.prototype.update = function() {
        if (this.active && (this.currentTimer += G.deltaTime, this.currentTimer >= this.timerEvery)) {
            if (this.currentTimer = this.currentTimer - this.timerEvery, this.currentIndex += this.animDir, this.bounce) {
                if (this.currentIndex == this.animFramesLen || 0 == this.currentIndex) {
                    if (0 == this.loop && 0 == this.currentIndex) return this.onFinish.dispatch(), this.active = !1;
                    0 < this.loop && 0 == this.currentIndex && this.loop--, this.currentIndex == this.animFramesLen && (this.currentIndex = this.animFramesLen - 1), this.animDir *= -1
                }
            } else if (this.currentIndex == this.animFramesLen) {
                if (0 == this.loop) return this.onFinish.dispatch(), this.active = !1;
                0 < this.loop && this.loop--, this.currentIndex = 0
            }
            G.changeTexture(this, this.frameNamePrefix + "_" + this.currentIndex)
        }
    }, G.FrameAnimation.prototype.getAnimationLength = function(t) {
        if (G.FrameAnimation.CacheAnimLength[t]) return G.FrameAnimation.CacheAnimLength[t];
        for (var e = 0, i = 0; i < 1e3 && G.isImageInCache(t + "_" + i); i++) e++;
        return G.FrameAnimation.CacheAnimLength[t] = e
    }, G.FrameAnimation.CacheAnimLength = {}, G.gift = {}, G.gift.getGift = function(t) {
        t = t || "normals";
        var e = G.json.settings.gifts[t],
            i = e.boosterMaxNr || G.json.settings.gifts.boosterMaxNr,
            s = e.boosterChance || G.json.settings.gifts.boosterChance,
            a = [];
        e.list.forEach(function(t) {
            "coin" == t[0] ? a.push(t) : -1 !== t[0].indexOf("booster") && G.saveState.isBoosterUnlocked(parseInt(t[0][8])) && G.saveState.getBoosterAmount(parseInt(t[0][8])) < i && a.push(t)
        }), Phaser.ArrayUtils.shuffle(a);
        for (var n = Math.random() < s, o = 0; o < a.length; o++) {
            var r = a[o];
            if (-1 === r[0].indexOf("booster")) return r.slice();
            if (n) return r.slice()
        }
        return ["coin", 50]
    }, G.gift.getLabelString = function(t) {
        return t[1] + " @" + G.json.settings.gifts.icons[t[0]] + "@"
    }, G.gift.applyGift = function(t) {
        "coin" == t[0] ? G.saveState.changeCoins(t[1]) : G.saveState.changeBoosterAmount(parseInt(t[0][8]), t[1])
    }, G.gift.getIcon = function(t) {
        return G.json.settings.gifts.icons[t[0]]
    }, void 0 === G && (G = {}), G.GridArray = function(t, e, i, s) {
        "number" == typeof t ? this.createGrid.apply(this, arguments) : "string" == typeof t ? (this.data = JSON.parse(t), this.width = this.data.length, this.height = this.data[0].length) : Array.isArray(t) && (a = t, this.data = t, this.width = this.data.length, this.height = this.data[0].length)
    }, G.GridArray.prototype = {
        createGrid: function(t, e, i) {
            this.data = [], this.width = t, this.height = e;
            for (var s = 0; s < t; s++) {
                this.data[s] = [];
                for (var a = 0; a < e; a++) this.data[s][a] = i
            }
        },
        set: function(t, e, i) {
            return this.isInGrid(t, e) ? this.data[t][e] = i : (this.dbg && console.log("setValue OUT OF RANGE"), !1)
        },
        get: function(t, e) {
            return this.isInGrid(t, e) ? this.data[t][e] : (this.dbg && console.log("getValue OUT OF RANGE"), !1)
        },
        swapValues: function(t, e, i, s) {
            if (!this.isInGrid(t, e) || !this.isInGrid(i, s)) return this.dbg && console.log("swapValues OUT OF RANGE"), !1;
            var a = this.data[t][e];
            this.data[t][e] = this.data[i][s], this.data[i][s] = a
        },
        isInGrid: function(t, e) {
            return !(t < 0 || t >= this.width || e < 0 || e >= this.height)
        },
        find: function(t, e) {
            for (var i = 0; i < this.width; i++)
                for (var s = 0; s < this.height; s++) {
                    if (t.call(e, this.data[i][s], i, s, this.data)) return this.data[i][s]
                }
            return !1
        },
        filter: function(t, e) {
            for (var i = [], s = 0; s < this.width; s++)
                for (var a = 0; a < this.height; a++) {
                    t.call(e, this.data[s][a], s, a, this.data) && i.push(this.data[s][a])
                }
            return i
        },
        loop: function(t, e) {
            for (var i = 0; i < this.width; i++)
                for (var s = 0; s < this.height; s++) t.call(e, this.data[i][s], i, s, this.data)
        },
        clear: function(a) {
            this.loop(function(t, e, i, s) {
                s[e][i] = a || !1
            })
        },
        findPattern: function(o, r) {
            var h = !1,
                l = o.length;
            return this.loop(function(t, e, i, s) {
                if (t == r && !h) {
                    for (var a = 0; a < l; a += 2) {
                        if (!this.get(e + o[a], i + o[a + 1])) return;
                        if (this.get(e + o[a], i + o[a + 1]) !== r) return
                    }
                    h = [];
                    for (var n = 0; n < l; n += 2) h.push(e + o[n], i + o[n + 1])
                }
            }, this), h
        },
        count: function() {
            for (var t = 0, e = 0; e < this.width; e++)
                for (var i = 0; i < this.height; i++) this.data[e][i] && t++;
            return t
        },
        getAllElements: function() {
            for (var t = [], e = 0; e < this.width; e++)
                for (var i = 0; i < this.height; i++) this.data[e][i] && t.push(this.data[e][i]);
            return t
        }
    }, G.Image = function(t, e, i, s, a) {
        Phaser.Image.call(this, game, G.l(t), G.l(e), null), this.state = game.state.getCurrentState(), this.changeTexture(i), s && ("number" == typeof s ? this.anchor.setTo(s) : this.anchor.setTo(s[0], s[1])), a ? (a.add || a.addChild).call(a, this) : null !== a && game.world.add(this)
    }, G.Image.prototype = Object.create(Phaser.Image.prototype), G.Image.prototype.stopTweens = function() {
        G.stopTweens(this)
    }, G.Image.prototype.changeTexture = function(t) {
        G.changeTexture(this, t)
    }, Phaser.Image.prototype.changeTexture = function(t) {
        G.changeTexture(this, t)
    }, G.Image.prototype.add = function(t) {
        return this.addChild(t)
    }, G.LabelGroupT = function(t, e, i, s, a, n, o) {
        Phaser.Group.call(this, game), this.str = t, this.tagArray = G.LabelParser.changeIntoTagArray(t), this.x = e, this.y = i, this.textStyle = s, this.fontSize = parseInt(s.fontSize), this.distanceBetween = o || 0, "number" == typeof a ? this.anchorX = this.anchorY = a : (this.anchorX = a[0], this.anchorY = a[1]), this.maxWidth = n || 0, this.processTagArray()
    }, G.LabelGroupT.prototype = Object.create(Phaser.Group.prototype), G.LabelGroupT.prototype.processTagArray = function() {
        for (var t = 0; t < this.tagArray.length; t++) {
            if ("img" == this.tagArray[t].type)(e = G.makeImage(0, 0, this.tagArray[t].content, 0, this)).tagScale = this.tagArray[t].scale;
            else if ("separator" == this.tagArray[t].type) {
                var e;
                (e = G.makeImage(0, 0, null, 0, this)).SEPARATOR = !0, e.SEP_LENGTH = this.tagArray[t].length
            } else this.add(new G.Text(0, 0, this.tagArray[t].content, this.textStyle))
        }
        this.refresh()
    }, G.LabelGroupT.prototype.refresh = function() {
        if (this.applySizeAndAnchor(), 0 < this.maxWidth && this.getWholeWidth() > this.maxWidth)
            for (; this.getWholeWidth() > this.maxWidth;) this.distanceBetween = Math.floor(.9 * this.distanceBetween), this.fontSize = Math.floor(.9 * this.fontSize), this.applySizeAndAnchor();
        this.spreadElements()
    }, G.LabelGroupT.prototype.applySizeAndAnchor = function() {
        this.children.forEach(function(t) {
            t.anchor.setTo(this.anchorX, this.anchorY), t.fontSize ? (t.fontSize = this.fontSize, t.updateTransform()) : (t.height = this.fontSize * (t.tagScale || 1), t.scale.x = t.scale.y), t.SEPARATOR && (t.width = this.fontSize * t.SEP_LENGTH)
        }, this)
    }, G.LabelGroupT.prototype.getWholeWidth = function() {
        var t = (this.children.length - 1) * this.distanceBetween,
            e = 0;
        return this.children.forEach(function(t) {
            e += t.width
        }), t + e
    }, G.LabelGroupT.prototype.spreadElements = function() {
        var s = this.getWholeWidth() * this.anchorX * -1;
        this.children.forEach(function(t, e, i) {
            t.left = 0 == e ? s : i[e - 1].right + this.distanceBetween
        }, this)
    }, G.LabelParser = {
        specialChars: ["$", "@", "%", "^"],
        changeIntoTagArray: function(t, e) {
            for (var i = [], s = 0; 0 < t.length && !(20 < s++);) {
                var a = this.findFirstSpecialChar(t);
                if (-1 === a) {
                    i.push(t);
                    break
                }
                0 < a[0] && (i.push(t.slice(0, a[0])), t = t.slice(a[0])), t = this.cutOffTag(t, i, a[1])
            }
            var n = [];
            for (s = 0; s < i.length; s++) n.push(this.processTag(i[s], e));
            return this.mergeTextTagsInArray(n)
        },
        mergeTextTagsInArray: function(t) {
            for (var e = [], i = null, s = 0; s < t.length; s++) "text" !== t[s].type ? (null !== i && (e.push(this.mergeTextTags(t, i, s)), i = null), e.push(t[s])) : null == i && (i = s);
            return null !== i && e.push(this.mergeTextTags(t, i, s)), e
        },
        mergeTextTags: function(t, e, i) {
            for (var s = {
                    type: "text",
                    content: []
                }; e < i; e++) s.content.push(t[e].content);
            return s.content = s.content.join(" "), s
        },
        processTag: function(t, e) {
            if ("@" == t[0]) {
                var i = 1;
                return "*" == t[1] && t.indexOf("*", 2) && (i = parseFloat(t.slice(t.indexOf("*") + 1, t.indexOf("*", 2))), t = t.slice(t.indexOf("*", 2))), {
                    type: "img",
                    content: t.slice(1, -1),
                    scale: i
                }
            }
            return "%" == t[0] ? {
                type: "text",
                content: e[t.slice(1, -1)]
            } : "$" == t[0] ? {
                type: "text",
                content: G.txt(t.slice(1, -1))
            } : "^" == t[0] ? {
                type: "text",
                content: t.slice(1, -1)
            } : this.isStringJustSpaces(t) ? {
                type: "separator",
                content: t,
                length: t.length
            } : {
                type: "text",
                content: t
            }
        },
        isStringJustSpaces: function(t) {
            for (var e = 0; e < t.length; e++)
                if (" " !== t[e]) return !1;
            return !0
        },
        cutOffTag: function(t, e, i) {
            var s = t.indexOf(i),
                a = t.indexOf(i, s + 1);
            return e.push(t.slice(s, a + 1)), t.slice(0, s) + t.slice(a + 1)
        },
        findFirstSpecialChar: function(i) {
            var s = 1 / 0,
                a = !1;
            return this.specialChars.forEach(function(t) {
                var e = i.indexOf(t); - 1 < e && e < s && (a = t, s = Math.min(e, s))
            }), s === 1 / 0 ? -1 : [s, a]
        },
        createLabel: function(t, e, i, s, a, n, o, r, h, l) {
            this.changeIntoTagArray(t, e);
            return new G.LabelGroup(i, s, n, h, o, r, l)
        }
    }, G.LabelGroup = function(t, e, i, s, a, n, o, r) {
        Phaser.Group.call(this, game), this.fontData = game.cache.getBitmapFont(s).font, this.fontBaseSize = this.fontData.size, this.fontSpaceOffset = this.fontData.chars[32].xOffset + this.fontData.chars[32].xAdvance, this.str = t, this.tagArray = G.LabelParser.changeIntoTagArray(t), this.x = void 0 === e ? 0 : G.l(e), this.y = void 0 === i ? 0 : G.l(i), this.font = s, this.fontSize = void 0 === a ? G.l(30) : G.l(a), this.distanceBetween = 0, this.anchorX = void 0 === n ? .5 : n, this.anchorY = void 0 === o ? .5 : o, this.maxWidth = r || 0, this.processTagArray()
    }, G.LabelGroup.prototype = Object.create(Phaser.Group.prototype), G.LabelGroup.prototype.processTagArray = function() {
        for (var t = 0; t < this.tagArray.length; t++) {
            if ("img" == this.tagArray[t].type)(e = G.makeImage(0, 0, this.tagArray[t].content, 0, this)).tagScale = this.tagArray[t].scale;
            else if ("separator" == this.tagArray[t].type) {
                var e;
                (e = G.makeImage(0, 0, null, 0, this)).SEPARATOR = !0, e.SEP_LENGTH = this.tagArray[t].length
            } else this.add(game.add.bitmapText(0, 0, this.font, this.tagArray[t].content, this.fontSize))
        }
        this.refresh()
    }, G.LabelGroup.prototype.refresh = function() {
        if (this.applySizeAndAnchor(), 0 < this.maxWidth && this.getWholeWidth() > this.maxWidth)
            for (; this.getWholeWidth() > this.maxWidth;) this.distanceBetween *= .9, this.fontSize *= .9, this.applySizeAndAnchor();
        this.spreadElements()
    }, G.LabelGroup.prototype.applySizeAndAnchor = function() {
        this.children.forEach(function(t) {
            t.anchor.setTo(this.anchorX, this.anchorY), t.fontSize ? (t.fontSize = this.fontSize, t.updateText()) : (t.height = this.fontSize * (t.tagScale || 1), t.scale.x = t.scale.y), t.SEPARATOR && (t.width = this.fontSize / this.fontBaseSize * this.fontSpaceOffset * t.SEP_LENGTH)
        }, this)
    }, G.LabelGroup.prototype.getWholeWidth = function() {
        var t = (this.children.length - 1) * this.distanceBetween,
            e = 0;
        return this.children.forEach(function(t) {
            e += t.width
        }), t + e
    }, G.LabelGroup.prototype.spreadElements = function() {
        var s = this.getWholeWidth() * this.anchorX * -1;
        this.children.forEach(function(t, e, i) {
            t.left = 0 == e ? s : i[e - 1].right + this.distanceBetween
        }, this)
    }, G.LineEditor = function() {
        Phaser.Group.call(this, game), this.gfx = game.add.graphics(), this.gfx.fixedToCamera = !0, this.points = {
            x: [],
            y: []
        }, this.currentIndex = null, this.pointerStart = new Phaser.Point(0, 0), this.interpolation = "linearInterpolation", game.input.onDown.add(function(t) {
            this.currentIndex = this.findCurrentIndex(t), null !== this.currentIndex && (this.pointerStart.x = t.x, this.pointerStart.y = t.y)
        }, this), game.input.onUp.add(function(t) {
            this.currentIndex = null
        }, this), this.keys = game.input.keyboard.addKeys({
            Z: Phaser.Keyboard.Z,
            X: Phaser.Keyboard.X,
            C: Phaser.Keyboard.C,
            A: Phaser.Keyboard.A,
            S: Phaser.Keyboard.S,
            D: Phaser.Keyboard.D
        }), this.keys.Z.onDown.add(function() {
            this.interpolation = "catmullRomInterpolation"
        }, this), this.keys.X.onDown.add(function() {
            this.interpolation = "bezierInterpolation"
        }, this), this.keys.C.onDown.add(function() {
            this.interpolation = "linearInterpolation"
        }, this), this.keys.A.onDown.add(function() {
            var t = game.input.activePointer;
            this.points.x.push(t.x), this.points.y.push(t.y)
        }, this), this.keys.S.onDown.add(function() {
            this.currentIndex && (this.points.x.splice(this.currentIndex, 1), this.points.y.splice(this.currentIndex, 1))
        }, this), this.keys.D.onDown.add(function() {
            this.points.x.pop(), this.points.y.pop()
        }, this)
    }, G.LineEditor.prototype = Object.create(Phaser.Group.prototype), G.LineEditor.prototype.update = function() {
        if (this.currentIndex) {
            var t = game.input.activePointer,
                e = this.pointerStart.x - t.x,
                i = this.pointerStart.y - t.y;
            this.pointerStart.x = t.x, this.pointerStart.y = t.y, this.points.x[this.currentIndex] -= e, this.points.y[this.currentIndex] -= i
        }
        this.redraw()
    }, G.LineEditor.prototype.findCurrentIndex = function(t) {
        for (var e = null, i = 1 / 0, s = 0; s < this.points.x.length; s++) {
            var a = game.math.distance(t.x, t.y, this.points.x[s], this.points.y[s]);
            a < i && (e = s, i = a)
        }
        return e
    }, G.LineEditor.prototype.redraw = function() {
        this.gfx.clear(), this.drawLine(), this.drawPoints()
    }, G.LineEditor.prototype.drawPoints = function() {
        this.gfx.lineStyle(2, 255, 1), this.gfx.beginFill(255, .5);
        for (var t = 0; t < this.points.x.length; t++) this.gfx.drawCircle(this.points.x[t], this.points.y[t], 10)
    }, G.LineEditor.prototype.drawLine = function() {
        if (0 != this.points.x.length) {
            this.gfx.lineStyle(2, 16711680, 1), this.gfx.moveTo(this.points.x[0], this.points.y[0]);
            for (var t = 0; t < 1; t += .001) {
                var e = game.math[this.interpolation](this.points.x, t),
                    i = game.math[this.interpolation](this.points.y, t);
                this.gfx.lineTo(e, i)
            }
        }
    }, void 0 === G && (G = {}), G.Loader = {
        currentConfig: "hd",
        currentConfigMulti: 1,
        loadingScreenActive: !1,
        lang: !1,
        passConfigs: function(t) {
            this.configs = t
        },
        setConfig: function(t) {
            this.currentConfig = t, this.currentConfigMulti = this.configs[t]
        },
        killLoadingScreen: function() {
            G.imgRotate && (G.whiteOverlay.destroy(), G.imgRotate.fadeOut = !0, G.imgRotate = !1, this.loadingScreenActive = !1)
        },
        loadPOSTImage: function(t) {
            void 0 !== t && (game.cache.checkImageKey(t) || (this.makeLoadingScreen(), game.load.image(t, "assets/" + this.currentConfig + "/imagesPOST/" + t)))
        },
        loadBootAssets: function(t) {
            t && (this.lang = t.toUpperCase()), G.ASSETS.images.forEach(function(t) {
                this.checkIfLoad(t, !0) && game.load.image(this.removeExt(this.cutOffPrefixes(t)), "assets/" + this.currentConfig + "/images/" + t)
            }, this), G.ASSETS.spritesheets.forEach(function(t) {
                this.checkIfLoad(t, !0) && game.load.atlasJSONHash(this.cutOffPrefixes(t), "assets/" + this.currentConfig + "/spritesheets/" + t + ".png", "assets/" + this.currentConfig + "/spritesheets/" + t + ".json")
            }, this), game.load.onLoadComplete.addOnce(function() {
                this.createSpritesheetMap(!0)
            }, this)
        },
        loadAssets: function(t) {
            t && (this.lang = t.toUpperCase()), game.load.onLoadComplete.addOnce(this.processAssets, this), this.loadSFX(G.ASSETS.sfx), this.loadImages(G.ASSETS.images), this.loadSpritesheets(G.ASSETS.spritesheets), this.loadJson(G.ASSETS.json), this.loadFonts(G.ASSETS.fonts)
        },
        processAssets: function() {
            this.processJson(G.ASSETS.json), this.processSFX(G.ASSETS.sfx), this.createSpritesheetMap()
        },
        createSpritesheetMap: function(t) {
            G.spritesheetMap || (G.spritesheetMap = {});
            for (var e = 0, i = G.ASSETS.spritesheets.length; e < i; e++)
                if (this.checkIfLoad(G.ASSETS.spritesheets[e], t)) {
                    var s = this.cutOffPrefixes(G.ASSETS.spritesheets[e]);
                    if (game.cache.checkImageKey(s))
                        for (var a = game.cache.getFrameData(s), n = 0; n < a._frames.length; n++) {
                            var o = a._frames[n];
                            G.spritesheetMap[o.name] && console.warn("Images name collision: " + o.name), G.spritesheetMap[o.name] = s
                        }
                }
        },
        loadSFX: function(t) {
            t.forEach(function(t) {
                game.load.audio(this.removeExt(t), "assets/sfx/" + t)
            }, this)
        },
        loadFonts: function(t) {
            for (var e in t) {
                if (!this.checkIfLoad(e)) return;
                game.load.bitmapFont(this.cutOffPrefixes(e), "assets/" + this.currentConfig + "/fonts/" + t[e].frame, "assets/" + this.currentConfig + "/fonts/" + t[e].data)
            }
        },
        loadImages: function(t) {
            t.forEach(function(t) {
                this.checkIfLoad(t) && game.load.image(this.removeExt(this.cutOffPrefixes(t)), "assets/" + this.currentConfig + "/images/" + t)
            }, this)
        },
        loadJson: function(t) {
            t.forEach(function(t) {
                game.load.json(this.removeExt(t), "assets/json/" + t)
            }, this)
        },
        loadSpritesheets: function(t) {
            t.forEach(function(t) {
                this.checkIfLoad(t) && game.load.atlasJSONHash(this.cutOffPrefixes(t), "assets/" + this.currentConfig + "/spritesheets/" + t + ".png", "assets/" + this.currentConfig + "/spritesheets/" + t + ".json")
            }, this)
        },
        checkIfLoad: function(t, e) {
            return (!e || -1 != t.indexOf("BOOT-")) && (!(!e && -1 !== t.indexOf("BOOT-")) && ((-1 === t.indexOf("MOBILE-") || !game.device.desktop) && (!(-1 !== t.indexOf("DESKTOP-") && !game.device.desktop) && (!this.lang || !t.match(/^[A-Z]{2}\-/) || 0 == t.indexOf(this.lang + "-")))))
        },
        cutOffPrefixes: function(t) {
            return t = (t = (t = (t = t.replace(/^[A-Z]{2}\-/, "")).replace("BOOT-", "")).replace("MOBILE-", "")).replace("DESKTOP-", "")
        },
        removeExt: function(t) {
            return t.slice(0, t.lastIndexOf("."))
        },
        processJson: function(t) {
            G.json = {}, t.forEach(function(t) {
                t = this.removeExt(t), G.json[t] = game.cache.getJSON(t)
            }, this)
        },
        processSFX: function(t) {
            G.sfx = {}, game.sfx = G.sfx;
            var s = {};
            t.forEach(function(t) {
                t = this.removeExt(t), G.sfx[t] = game.add.audio(t);
                var e = t.lastIndexOf("_");
                if (-1 !== e && !isNaN(t.slice(e + 1))) {
                    parseInt(t.slice(e + 1));
                    var i = t.slice(0, e);
                    s[i] || (s[i] = []), s[i].push(G.sfx[t])
                }
            }, this), Object.keys(s).forEach(function(t) {
                G.sfx[t] = {
                    sfxArray: s[t],
                    play: function(t, e, i) {
                        game.rnd.pick(this.sfxArray).play("", 0, t, e, i)
                    }
                }
            })
        }
    }, G.MultiLineText = function(t, e, i, s, a, n, o, r, h, l) {
        if (t = G.l(t), e = G.l(e), a = G.l(a), n = G.l(n), o = G.l(o), this.maxUserWidth = n, this.maxUserHeight = o, Phaser.BitmapText.call(this, game, t, e, i, "", a), this.splitText(s, n), this.align = r || "center", o)
            for (; this.height > o && (this.fontSize -= 2, this.splitText(s, n), this.updateText(), !(this.fontSize < 5)););
        this.anchor.setTo(h, l), this.cacheAsBitmap = !0
    }, G.MultiLineText.prototype = Object.create(Phaser.BitmapText.prototype), G.MultiLineText.prototype.constructor = G.MultiLineText, G.MultiLineText.prototype.splitText = function(t, e) {
        for (var i = t, s = [], a = 0, n = 0; 0 < i.length;)
            if (a = n, -1 == (n = i.indexOf(" ", n + 1)) ? this.setText(i) : this.setText(i.substring(0, n)), this.updateText(), this.width > e) {
                if (0 == a && -1 == n) {
                    s.push(i), i = "", n = 0;
                    continue
                }
                if (0 == a) {
                    s.push(i.substring(0, n)), i = i.substring(n + 1), n = 0;
                    continue
                }
                s.push(i.substring(0, a)), i = i.substring(a + 1), n = 0
            } else -1 == n && (s.push(i), i = "");
        this.setText(s.join("\n"))
    }, G.MultiLineText.prototype.popUpAnimation = function() {
        this.cacheAsBitmap = !1;
        for (var t = this.children.length, s = [], e = 0; e < t; e++) s[e] = e;
        s = Phaser.ArrayUtils.shuffle(s), delay_index = 0, this.activeTweens = 0, this.children.forEach(function(t) {
            0 == t.anchor.x && (t.x = t.x + .5 * t.width, t.y = t.y + t.height, t.anchor.setTo(.5, 1));
            var e = t.scale.x;
            t.scale.setTo(0, 0), this.activeTweens++;
            var i = game.add.tween(t.scale).to({
                x: 1.5 * e,
                y: 1.5 * e
            }, 200, Phaser.Easing.Quadratic.In, !1, 25 * s[delay_index]).to({
                x: e,
                y: e
            }, 200, Phaser.Easing.Sinusoidal.In);
            i.onComplete.add(function() {
                this.activeTweens--, 0 == this.activeTweens && this.alive && (this.cacheAsBitmap = !0)
            }, this), i.start(), delay_index++
        }, this)
    }, G.OneLineText = function(t, e, i, s, a, n, o, r) {
        if (Phaser.BitmapText.call(this, game, G.l(t), G.l(e), i, s, G.l(a), G.l(n)), n)
            for (; this.width > G.l(n) && (this.fontSize -= 2, this.updateText(), !(this.fontSize < 5)););
        this.orgFontSize = G.l(a), this.maxUserWidth = G.l(n), this.skipCaching = G.skipOneLineTextCaching || !1, this.hAnchor = o, this.vAnchor = r, this.anchor.setTo(this.hAnchor, this.vAnchor), this.updateText(), this.insertCoin(this.fontSize), this.skipCaching || (this.cacheAsBitmap = !0, this.updateCache())
    }, G.OneLineText.prototype = Object.create(Phaser.BitmapText.prototype), G.OneLineText.prototype.constructor = G.OneLineText, G.OneLineText.prototype.insertCoin = function(n) {
        -1 != this.text.indexOf("$$") && this.children.forEach(function(t, e, i) {
            if (t.name && "$" == t.name && t.visible && e + 1 <= i.length - 1 && "$" == i[e].name) {
                var s = t,
                    a = i[e + 1];
                s.visible = !1, a.visible = !1, coin = G.makeImage(s.x + .05 * n, s.y - .05 * n, "coin"), coin.width = n, coin.height = n, s.parent.addChild(coin)
            }
        })
    }, G.OneLineText.prototype.setText = function(t) {
        Phaser.BitmapText.prototype.setText.call(this, t.toString());
        var e = this.scale.x,
            i = this.scale.y,
            s = this.alpha,
            a = this.angle;
        if (this.alpha = 1, this.scale.setTo(1), this.maxUserWidth) {
            this.fontSize = this.orgFontSize, this.updateText();
            for (; this.width > this.maxUserWidth && (this.fontSize -= 1, this.updateText(), !(this.fontSize < 5)););
        }!this.skipCaching && this.cacheAsBitmap && this.updateCache(), this.scale.setTo(e, i), this.alpha = s, this.angle = a
    }, G.OneLineText.prototype.popUpAnimation = function() {
        this.cacheAsBitmap = !1;
        for (var t = this.children.length, s = [], e = 0; e < t; e++) s[e] = e;
        s = Phaser.ArrayUtils.shuffle(s), delay_index = 0, this.activeTweens = 0, this.children.forEach(function(t) {
            0 == t.anchor.x && (t.x = t.x + .5 * t.width, t.y = t.y + t.height, t.anchor.setTo(.5, 1));
            var e = t.scale.x;
            t.scale.setTo(0, 0), this.activeTweens++;
            var i = game.add.tween(t.scale).to({
                x: 1.5 * e,
                y: 1.5 * e
            }, 200, Phaser.Easing.Quadratic.In, !1, 25 * s[delay_index]).to({
                x: e,
                y: e
            }, 200, Phaser.Easing.Sinusoidal.In);
            i.onComplete.add(function() {
                this.activeTweens--, 0 == this.activeTweens && this.alive && !this.skipCaching && (this.cacheAsBitmap = !0)
            }, this), i.start(), delay_index++
        }, this)
    }, G.OneLineText.prototype.scaleOut = function(t, e) {
        this.cacheAsBitmap = !1, this.activeTweens = 0, this.children.forEach(function(t, e) {
            0 == t.anchor.x && (t.x = t.x + .5 * t.width, t.y = t.y + .5 * t.height, t.anchor.setTo(.5, .5)), this.activeTweens++, t.scale.setTo(t.scale.x, t.scale.y);
            var i = game.add.tween(t.scale).to({
                x: 0,
                y: 0
            }, 400, Phaser.Easing.Cubic.In, !1, 20 * e);
            i.onComplete.add(function() {
                this.activeTweens--, 0 == this.activeTweens && this.destroy()
            }, this), i.start()
        }, this)
    }, G.OneLineCounter = function(t, e, i, s, a, n, o, r, h, l) {
        G.OneLineText.call(this, t, e, i, "", a, n, o, r), this.amount = s, this.amountDisplayed = s, this.amountMaxInterval = 5, this.amountMaxNegInterval = -5, this.absoluteDisplay = !1, this.fixedToDecimal = 0, this.stepCurrent = 0, this.step = 0, this.preText = h || "", this.postText = l || "", this.setText(this.preText + s + this.postText)
    }, G.OneLineCounter.prototype = Object.create(G.OneLineText.prototype), G.OneLineCounter.prototype.update = function() {
        if (this.lerp) this.lerpUpdate();
        else if (this.amountDisplayed != this.amount && this.stepCurrent-- <= 0 && (this.stepCurrent = this.step, this.amountDisplayed != this.amount)) {
            var t = this.amount - this.amountDisplayed;
            this.amountDisplayed += game.math.clamp(t, this.amountMaxNegInterval, this.amountMaxInterval);
            var e = this.amountDisplayed;
            this.absoluteDisplay && (e = Math.abs(e)), 0 != this.fixedTo && (e = e.toFixed(this.fixedToDecimal)), this.setText(this.preText + e + this.postText)
        }
    }, G.OneLineCounter.prototype.changeAmount = function(t) {
        this.amount = t
    }, G.OneLineCounter.prototype.increaseAmount = function(t) {
        this.amount += t
    }, G.OneLineCounter.prototype.changeIntervals = function(t, e) {
        void 0 === e ? (this.amountMaxInterval = t, this.amountMaxNegInterval = -t) : (this.amountMaxInterval = t, this.amountMaxNegInterval = e)
    }, G.OneLineCounter.prototype.lerpUpdate = function() {
        this.amountDisplayed != this.amount && this.stepCurrent-- <= 0 && (this.stepCurrent = this.step, this.amountDisplayed = Math.round(G.lerp(this.amountDisplayed, this.amount, .5, .6)), this.setText(this.amountDisplayed.toString()))
    }, G.PartCacher = function() {
        Phaser.Group.call(this, game), this.active = !1, this.every = 1, this.rt = game.add.renderTexture(10, 10), this.frameCounter = 0, this.framesToRecord = null
    }, G.PartCacher.prototype = Object.create(Phaser.Group.prototype), G.PartCacher.prototype.update = function() {
        if (this.active) {
            if (this.stepForward(), !this.checkChildren()) return this.active = !1, void this.removeAll(!0, !0);
            this.frameCounter % this.frameRate == 0 && (this.saveFrame(), this.frameNr++, null !== this.framesToRecord && (this.framesToRecord--, 0 == this.framesToRecord && (this.active = !1))), this.frameCounter++
        }
    }, G.PartCacher.prototype.stepForward = function() {
        for (var t = this.children.length; t--;) this.children[t].update()
    }, G.PartCacher.prototype.start = function(t, e, i) {
        this.fileName = t, this.frameNr = 0, this.frameRate = 60 / e, this.active = !0, this.frameCounter = 0, this.framesToRecord = i || null
    }, G.PartCacher.prototype.saveFrame = function() {
        var t = this.getBounds(),
            e = Math.max(this.x - t.x, t.x + t.width - this.x, 400),
            i = Math.max(this.y - t.y, t.y + t.height - this.y, 400);
        this.rt.resize(2 * e, 2 * i, !0), this.rt.renderXY(this, e, i, !0);
        var s = this.rt.getCanvas(),
            a = this.fileName + "_" + this.frameNr;
        s.toBlob(function(t) {
            saveAs(t, a)
        })
    }, G.PartCacher.prototype.checkChildren = function() {
        var t = this.children.filter(function(t) {
            return !t.alive || 0 === t.alpha || 0 == t.scale.x || 0 == t.scale.y
        });
        return this.children.length !== t.length
    }, G.PoolGroup = function(t, e, i, s) {
        if (Phaser.Group.call(this, game), this._deadArray = [], this._elementConstructor = t, this._argumentsArray = e || [], this._argumentsArray.unshift(null), i && G.sb(i).add(this.init, this), s)
            for (var a = 0; a < s; a++) element = new(Function.prototype.bind.apply(this._elementConstructor, this._argumentsArray)), this.add(element), element.events.onKilled.add(this._onElementKilled, this), element.kill()
    }, G.PoolGroup.prototype = Object.create(Phaser.Group.prototype), G.PoolGroup.prototype.getFreeElement = function() {
        var t;
        return 0 < this._deadArray.length ? t = this._deadArray.pop() : (t = new(Function.prototype.bind.apply(this._elementConstructor, this._argumentsArray))).events.onKilled.add(this._onElementKilled, this), this.add(t), t
    }, G.PoolGroup.prototype._onElementKilled = function(t) {
        this === t.parent && (this._deadArray.push(t), this.removeChild(t))
    }, G.PoolGroup.prototype.init = function() {
        var t = this.getFreeElement();
        return t.init.apply(t, arguments), t
    }, G.PoolGroup.prototype.initBatch = function(t) {
        for (var e = 0; e < t; e++) this.init.apply(this, [].slice.call(arguments, 1))
    }, G.PreloaderBar = function() {
        Phaser.Group.call(this, game), this.fixedToCamera = !0, this.softgamesBtn = game.add.button(0, 200, "sg_logo", function() {
            SG_Hooks.triggerMoreGames()
        }, this), this.softgamesBtn.anchor.setTo(.5, .5), this.add(this.softgamesBtn), this.gfx = game.add.graphics(), this.add(this.gfx), this.drawProgress(0), G.sb("onScreenResize").add(this.onResize, this), this.onResize(), game.load.onFileComplete.add(this.drawProgress, this)
    }, G.PreloaderBar.prototype = Object.create(Phaser.Group.prototype), G.PreloaderBar.prototype.onResize = function() {
        this.cameraOffset.x = .5 * game.width, this.cameraOffset.y = .4 * game.height
    }, G.PreloaderBar.prototype.drawProgress = function(t) {
        this.gfx.clear(), this.gfx.lineStyle(2, 16777215, 1), this.gfx.beginFill(0, 1), this.gfx.drawRect(-150, 0, 300, 50), this.gfx.beginFill(16777215, 1), this.gfx.drawRect(-145, 5, t / 100 * 290, 40)
    }, G.ProgressBar = function(t, e, i, s, a, n, o) {
        G.Image.call(this, t, e, i + "_empty", 0, null), n = void 0 === n ? 0 : n, o = void 0 === o ? 0 : n, this.fill = G.makeImage(n, o, i + "_full", 0, this), this.fillFullWidth = this.fill.width, this.fillOverlay = G.makeImage(n, o, i + "_full_overlay", this.fill, this), this.fillOverlay.alpha = 0, this.fill.cropRect = new Phaser.Rectangle(0, 0, 0, this.fill.height), this.fill.updateCrop(), this.currentValue = s, this.prevCurrentValue = s, this.targetValue = s, this.maxValue = a, this.lerpValue = .05, this.updateBarCrop(), this.onTargetReached = new Phaser.Signal, this.onBarFilled = new Phaser.Signal
    }, G.ProgressBar.prototype = Object.create(G.Image.prototype), G.ProgressBar.prototype.update = function() {
        this.currentValue !== this.targetValue && (this.currentValue = G.lerp(this.currentValue, this.targetValue, this.lerpValue, .005 * this.maxValue), this.currentValue === this.targetValue && this.onTargetReached.dispatch()), this.currentValue !== this.prevCurrentValue && (this.updateBarCrop(), this.currentValue === this.maxValue && (game.add.tween(this.fillOverlay).to({
            alpha: 1
        }, 300, Phaser.Easing.Sinusoidal.InOut, !0, 0, 0, !0), this.onBarFilled.dispatch(), this.label && game.add.tween(this.label).to({
            alpha: 0
        }, 600, Phaser.Easing.Sinusoidal.InOut, !0)), this.label && Math.floor(this.currentValue) !== Math.floor(this.prevCurrentValue) && (console.log("updating label"), this.label.updateValue(Math.floor(this.currentValue)))), this.prevCurrentValue = this.currentValue
    }, G.ProgressBar.prototype.updateBarCrop = function() {
        var t = this.fill.cropRect.width,
            e = Math.round(this.fillFullWidth * (this.currentValue / this.maxValue));
        t !== e && (this.fill.cropRect.width = e, this.fill.updateCrop())
    }, G.ProgressBar.prototype.changeCurrentValue = function(t, e) {
        this.targetValue = game.math.clamp(t, 0, this.maxValue), this.lerpValue = e || this.lerpValue
    }, G.ProgressBar.prototype.increaseCurrentValue = function(t) {
        this.changeCurrentValue(this.targetValue + (t || 1))
    }, G.ProgressBar.prototype.decreaseCurrentValue = function(t) {
        this.changeCurrentValue(this.targetValue - (t || 1))
    }, G.ProgressBar.prototype.changeValues = function(t, e) {
        this.currentValue = t, this.prevCurrentValue = t, this.targetValue = t, this.maxValue = e, this.label && this.label.changeValues(t, e), this.updateBarCrop()
    }, G.ProgressBar.prototype.addLabel = function(t, e) {
        this.label = new G.ProgressBar.Label(G.rl(.5 * this.width), G.rl(.5 * this.height), this.currentValue, this.maxValue, Math.floor(.6 * G.rl(this.height)), G.rl(.7 * this.width), t, e), this.add(this.label)
    }, G.ProgressBar.Label = function(t, e, i, s, a, n, o, r) {
        G.OneLineText.call(this, t, e, "font", "", a, n, .5, .5), this.labelType = o || 0, this.labelType1Text = G.txt("%AMOUNT% left"), this.currentValue = i, this.maxValue = s, this.animationOnIncrease = r || !1, this.updateValue(this.currentValue, !0)
    }, G.ProgressBar.Label.prototype = Object.create(G.OneLineText.prototype), G.ProgressBar.Label.prototype.updateValue = function(t, e) {
        (e || Math.min(t, this.maxValue) !== this.currentValue) && (this.currentValue = t, this.updateLabelText(), !e && this.animationOnIncrease && (G.stopTweens(this), this.scale.setTo(1), game.add.tween(this.scale).to({
            x: 1.2,
            y: 1.2
        }, 200, Phaser.Easing.Sinusoidal.InOut, !0, 0, 0, !0)))
    }, G.ProgressBar.Label.prototype.changeValues = function(t, e) {
        this.currentValue = t, this.maxValue = e, this.alpha = this.currentValue < this.maxValue ? 1 : 0, this.updateLabelText()
    }, G.ProgressBar.Label.prototype.updateLabelText = function() {
        0 == this.labelType ? this.setText(this.currentValue + "/" + this.maxValue) : this.setText(this.labelType1Text.replace("%AMOUNT%", this.maxValue - this.currentValue))
    }, G.Reasons = function() {
        var a = new Phaser.Signal,
            n = new Map;
        return {
            add: i,
            remove: s,
            setPresence: function(t, e) {
                e ? i(t) : s(t)
            },
            hasAnyChangedSignal: a,
            has: o,
            hasAny: r,
            hasNone: t
        };

        function i(t, e) {
            var i = r();
            n.set(t, e ? (n.get(t) || 0) + 1 : n.get(t) || 1), !i && r() && a.dispatch(!0)
        }

        function s(t, e) {
            var i = r();
            if (e) {
                var s = (n.get(t) || 0) - 1;
                n.set(t, s)
            } else n.delete(t);
            return i && !r() && a.dispatch(!1), !o(t)
        }

        function o(t) {
            return n.has(t) && 0 < n.get(t)
        }

        function r() {
            return !t()
        }

        function t() {
            return 0 === (e = 0, n.forEach(function(t) {
                0 < t && ++e
            }), e);
            var e
        }
    }, void 0 === G && (G = {}), G.SignalBox = function() {
        Phaser.Signal.prototype.addPermanent || (Phaser.Signal.prototype.addPermanent = function() {
            var t = this.add.apply(this, arguments);
            return t._PERMANENT = !0, t
        }, Phaser.Signal.prototype.removeNonPermanent = function() {
            if (this._bindings)
                for (var t = this._bindings.length; t--;) this._bindings[t]._PERMANENT || (this._bindings[t]._destroy(), this._bindings.splice(t, 1))
        });
        var e = {};

        function i() {
            Object.keys(e).forEach(function(t) {
                e[t].removeNonPermanent()
            })
        }

        function t(t) {
            return game.state.onStateChange.add(i, this), e[t] || (e[t] = new Phaser.Signal), e[t]
        }
        return t.signals = e, t.clearNonPermanent = i, t.clearAll = function() {
            Object.keys(e).forEach(function(t) {
                e[t].removeAll()
            })
        }, t
    }(), G.Slider = function(t, e, i, s) {
        Phaser.Graphics.call(this, game, t, e), this.sliderWidth = i, this.pos = s, this.beginFill(0, 1), this.drawRect(0, -2, this.sliderWidth, 4), this.circleGfx = this.addChild(game.make.graphics(i * s, 0)), this.circleGfx.clear(), this.circleGfx.lineStyle(1, 0, 1), this.circleGfx.beginFill(10066329, 1), this.circleGfx.drawCircle(0, 0, 32), this.circleGfx.sliderWidth = i, this.circleGfx.inputEnabled = !0, this.circleGfx.input.useHandCursor = !0, this.circleGfx.input.draggable = !0, this.circleGfx.input.setDragLock(!0, !1)
    }, G.Slider.prototype = Object.create(Phaser.Graphics.prototype), G.Slider.prototype.update = function() {
        this.circleGfx.x = game.math.clamp(this.circleGfx.x, 0, this.sliderWidth), this.pos = this.circleGfx.x / this.sliderWidth
    }, G.SliderPanel = function(t, e, i, s, a, n) {
        Phaser.Group.call(this, game), this.sliderWidth = G.l(i), this.sliderHeight = G.l(s), this.x = t + -.5 * this.sliderWidth, this.y = e + -.5 * this.sliderHeight, this.gfxMask = game.add.graphics(), this.gfxMask.beginFill(0, 1), this.gfxMask.drawRect(0, 0, i, s), this.clickableObjects = [], this.config = n, this.applyConfig(this.config), this.addContent(a), this.add(this.gfxMask), this.contentGroup.mask = this.gfxMask, this.slideY = 0, this.inputSprite = G.makeImage(0, 0, null, 0, this), this.inputSprite.inputEnabled = !0, this.inputSprite.hitArea = new Phaser.Rectangle(0, 0, i, s), this.inputSpriteDown = !1, this.inputData = {
            x: null,
            y: null,
            velX: 0,
            velY: 0,
            xStart: null,
            yStart: null,
            startFrameStamp: null,
            clickDistanceWindow: 10,
            clickTimeWindow: 10
        }, this.inputSprite.events.onInputDown.add(function(t) {
            var e = game.input.activePointer;
            this.inputSpriteDown = !0, this.inputData.x = this.inputData.xStart = e.worldX, this.inputData.y = this.inputData.yStart = e.worldY, this.inputData.startFrameStamp = this.frameCounter
        }, this), this.inputSprite.events.onInputUp.add(function() {
            var t = game.input.activePointer;
            this.inputSpriteDown = !1;
            var e = game.math.distance(this.inputData.xStart, this.inputData.yStart, t.worldX, t.worldY),
                i = this.frameCounter - this.inputData.startFrameStamp;
            e <= this.inputData.clickDistanceWindow && i <= this.inputData.clickTimeWindow && (this.propagateClick(t.x, t.y), this.inputData.velX = 0, this.inputData.velY = 0)
        }, this), this.frameCounter = 0
    }, G.SliderPanel.prototype = Object.create(Phaser.Group.prototype), G.SliderPanel.prototype.applyConfig = function(t) {
        this.horizontal = t.horizontal || !1, this.horizontalLerp = t.horizontalLerp || !1, this.vertical = t.vertical || !0, this.verticalLerp = t.verticalLerp
    }, G.SliderPanel.prototype.addContent = function(t) {
        this.changeInputSettings(t), this.contentGroup = t, this.add(t), this.contentGroup.x = 0, this.contentGroupMinY = -this.contentGroup.height + this.sliderHeight, this.contentGroupMaxY = 0, this.contentGroupMinX = this.sliderWidth - this.contentGroup.width, this.contentGroupMaxX = 0
    }, G.SliderPanel.prototype.changeInputSettings = function(t) {
        for (var e = t.children.length; e--;) {
            var i = t.children[e];
            i.inputEnabled && (this.clickableObjects.push(i), i.inputEnabled = !1), 0 < i.children.length && this.changeInputSettings(i)
        }
    }, G.SliderPanel.prototype.update = function() {
        if (this.frameCounter++, this.inputSpriteDown && game.input.activePointer.isDown) {
            var t = this.inputData.x - game.input.activePointer.worldX,
                e = this.inputData.y - game.input.activePointer.worldY;
            this.inputData.x = game.input.activePointer.worldX, this.inputData.y = game.input.activePointer.worldY, this.inputData.velX = .8 * t + .2 * this.inputData.velX, this.inputData.velY = .8 * e + .2 * this.inputData.velY, this.horizontal && (this.contentGroup.x -= this.inputData.velX), this.vertical && (this.contentGroup.y -= this.inputData.velY)
        } else this.horizontal && (this.contentGroup.x -= this.inputData.velX, this.inputData.velX *= .95, Math.abs(this.inputData.velX) < 1 && (this.inputData.velX = 0)), this.vertical && (this.contentGroup.y -= this.inputData.velY, this.inputData.velY *= .95, Math.abs(this.inputData.velY) < 1 && (this.inputData.velY = 0));
        this.vertical && this.boundRestrict("y", this.verticalLerp, this.contentGroupMinY, this.contentGroupMaxY), this.horizontal && this.boundRestrict("x", this.horizontalLerp, this.contentGroupMinX, this.contentGroupMaxX), this.boundRestrict()
    }, G.SliderPanel.prototype.propagateClick = function(t, e) {
        for (var i = 0; i < this.clickableObjects.length; i++)
            if (this.clickableObjects[i].visible && this.clickableObjects[i].getBounds().contains(t, e)) {
                this.clickableObjects[i].onInputDown.dispatch();
                break
            }
    }, G.SliderPanel.prototype.boundRestrict = function(t, e, i, s) {
        e ? (this.contentGroup[t] > s && (this.contentGroup[t] = G.lerp(this.contentGroup[t], s, .5), this.contentGroup[t] < s + 1 && (this.contentGroup[t] = s)), this.contentGroup[t] < i && (this.contentGroup[t] = G.lerp(this.contentGroup[t], i, .2), this.contentGroup[t] > i - 1 && (this.contentGroup[t] = i))) : this.contentGroup[t] = game.math.clamp(this.contentGroup[t], i, s)
    }, void 0 === G && (G = {}), G.StateMachine = function(t, i) {
        var s = G.Utils,
            n = t,
            o = new Phaser.Signal;
        return {
            isInState: function(t) {
                return n === t
            },
            transit: function(t, e) {
                a(t, e) || s.debugError("Transition not allowed: " + n + " -> " + t)
            },
            transitIfPossible: a,
            canTransitTo: r,
            transitionSignal: o
        };

        function r(t) {
            var e = i[n];
            return e && 0 <= e.indexOf(t)
        }

        function a(t, e) {
            return !!r(t) && (s = e, a = n, n = i = t, !0 && o.dispatch(i, a, s), !0);
            var i, s, a
        }
    }, G.StrObjGroup = function(t, e, i) {
        Phaser.Group.call(this, game), this.x = t || 0, this.y = e || 0, this.importObj = "string" == typeof i ? JSON.parse(i) : i, this.parseImportObj(this.importObj)
    }, G.StrObjGroup.prototype = Object.create(Phaser.Group.prototype), G.StrObjGroup.prototype.parseImportObj = function(t) {
        for (var e = 0; e < t.length; e++) {
            var i = t[e],
                s = G.makeImage(i.x, i.y, i.frame, i.anchor, this);
            s.scale.setTo(i.scale[0], i.scale[1]), s.angle = i.angle
        }
    }, G.Text = function(t, e, i, s, a, n, o, r, h) {
        "object" != typeof s && (s = G.Utils.clone(G.Text.styles[s])), G.Text.setMaxWidth(this, n || 1 / 0), G.Text.setMaxHeight(this, n || 1 / 0), r && (s.wordWrap = !0, s.wordWrapWidth = n, s.align = h || "left"), Phaser.Text.call(this, game, t, e, i, s), s.lineSpacing && (this.lineSpacing = s.lineSpacing), a && ("number" == typeof a ? this.anchor.setTo(a) : this.anchor.setTo(a[0], a[1])), this.width = Math.min(this.width, this.customComponents.text.maxWidth), this.height = Math.min(this.height, this.customComponents.text.maxHeight)
    }, G.Text.prototype = Object.create(Phaser.Text.prototype), G.Text.setMaxWidth = function(t, e) {
        G.Text.ensureTextComponentAvailable(t), t.customComponents.text.maxWidth = e
    }, G.Text.setMaxHeight = function(t, e) {
        G.Text.ensureTextComponentAvailable(t), t.customComponents.text.maxHeight = e
    }, G.Text.ensureTextComponentAvailable = function(t) {
        t.customComponents = t.customComponents || {}, t.customComponents.text = t.customComponents.text || {}
    }, G.Text.styles = {}, G.Text.addStyle = function(t, e) {
        G.Text.styles[t] = e
    }, G.Text.prototype.setText = function(t) {
        Phaser.Text.prototype.setText.call(this, t), this.scale.setTo(1), this.width = Math.min(this.width, this.customComponents.text.maxWidth), this.height = Math.min(this.height, this.customComponents.text.maxHeight)
    }, G.TextCounter = function(t, e, i, s, a, n, o) {
        this.amount = i, this.amountDisplayed = i, G.Text.call(this, t, e, null === i ? "..." : i.toString(), s, a, n), o = o || {
            lerpValue: .5
        }, this.lerp = !0, this.lerpValue = o.lerpValue, this.stepCurrent = 0, this.step = 0
    }, G.TextCounter.prototype = Object.create(G.Text.prototype), G.TextCounter.prototype.setAmount = function(t, e) {
        this.amount = t, e && (this.amountDisplayed = t, this.setText(this.amountDisplayed.toString()))
    }, G.TextCounter.prototype.changeAmount = function(t, e) {
        this.amount += t, e && (this.amountDisplayed = this.amount, this.setText(this.amountDisplayed.toString()))
    }, G.TextCounter.prototype.update = function() {
        this.amountDisplayed != this.amount && this.stepCurrent-- <= 0 && (this.stepCurrent = this.step, this.lerp && this.lerpUpdate())
    }, G.TextCounter.prototype.lerpUpdate = function() {
        this.amountDisplayed = G.lerp(this.amountDisplayed, this.amount, this.lerpValue, .2), this.setText(Math.round(this.amountDisplayed).toString())
    }, G.TextRTCacher = function() {}, G.TextRTCacher.prototype.cacheText = function(t, e, i, s, a) {
        this.txt || (this.txt = game.make.bitmapText(0, 0, t, "", 80)), this.txt.fontSize = i, this.txt.setText(e), this.txt.updateCache(), game.make.renderTexture(this.txt.width, this.txt.height, s, !0).render(this.txt)
    }, G.TextRTCacher.prototype.cachePhaserText = function(t, e, i) {
        var s = game.make.text(0, 0, t, i);
        game.make.renderTexture(s.width, s.height, e, !0).render(s), s.destroy()
    }, G.Timer = function(t, e, i, s, a, n, o) {
        G.OneLineText.call(this, t, e, i, "???", s, a, n, o), this.secLeft = 0, this.active = !1, this.timerBinding = G.sb("onWallClockTimeUpdate").add(this.updateTimer, this), this.events.onDestroy.add(function() {
            this.timerBinding.detach()
        }, this)
    }, G.Timer.prototype = Object.create(G.OneLineText.prototype), G.Timer.prototype.updateTimer = function() {
        this.active && (G.sfx.clock_tick.play(), this.secLeft = Math.max(0, this.secLeft - 1), this.setText(G.changeSecToTimerFormat(this.secLeft)))
    }, G.Timer.prototype.setSecLeft = function(t) {
        this.secLeft = t, this.setText(G.changeSecToTimerFormat(this.secLeft))
    }, G.Timer.prototype.start = function(t) {
        this.active = !0
    }, G.TimerT = function(t, e, i, s, a, n, o, r) {
        G.Text.call(this, t, e, "???", s, a, n), this.secLeft = 0, this.active = !1, this.timerFormat = o, this.dots = !0, this.sfx = r ? G.sfx[sfs] : null, this.timerBinding = G.sb("onWallClockTimeUpdate").add(this.updateTimer, this), this.events.onDestroy.add(function() {
            this.timerBinding.detach()
        }, this), i && this.setDate(i)
    }, G.TimerT.prototype = Object.create(G.Text.prototype), G.TimerT.prototype.updateTimer = function() {
        this.active && (this.sfx && this.sfx.play(), this.secLeft = Math.max(0, this.secLeft - 1), this.updateTimerText(this.secLeft, this.dots), this.dots = !this.dots)
    }, G.TimerT.prototype.setSecLeft = function(t) {
        this.secLeft = Math.max(0, t), this.updateTimerText(this.secLeft, !0)
    }, G.TimerT.prototype.updateTimerText = function(t, e) {
        var i = G.changeSecToDHMS(this.secLeft),
            s = []; - 1 < this.timerFormat.indexOf("d") && s.push(i[0]), -1 < this.timerFormat.indexOf("h") && s.push(i[1]), -1 < this.timerFormat.indexOf("m") && s.push(i[2]), -1 < this.timerFormat.indexOf("s") && s.push(i[3]), this.setText(s.join(e ? ":" : " "))
    }, G.TimerT.prototype.start = function(t) {
        this.active = !0
    }, G.TimerT.prototype.setDate = function(t) {
        var e = new Date(t).getTime(),
            i = Date.now(),
            s = Math.ceil((e - i) / 1e3);
        this.setSecLeft(s), this.active = !0
    }, G.UITargetParticles = function() {
        G.PoolGroup.call(this, G.UITargetParticle), this.fixedToCamera = !0
    }, G.UITargetParticles.prototype = Object.create(G.PoolGroup.prototype), G.UITargetParticles.prototype.initPart = function(t, e, i, s, a, n) {
        return this.init(t, e, i, s, a)
    }, G.UITargetParticles.prototype.createDividedBatch = function(t, e, i, s, a, n) {
        var o = new G.UITargetParticles.BatchObj,
            r = r || 25;
        r < a / n && (n = Math.ceil(a / r));
        for (var h = Math.floor(a / n) + Math.sign(a % n), l = 0; l < h; l++) {
            var d = this.init(t, e, i, s, Math.min(n, a));
            a -= n, o.add(d)
        }
        return o
    }, G.UITargetParticles.prototype.createBatch = function(t, e, i, s, a, n) {
        for (var o = new G.UITargetParticles.BatchObj, r = Array.isArray(t), h = 0; h < n; h++) {
            if (r) var l = this.init(t[h].x, t[h].y, i, s, a);
            else l = this.init(t, e, i, s, a);
            o.add(l)
        }
        return o
    }, G.UITargetParticles.BatchObj = function() {
        this.parts = [], this.nrOfParts = 0, this.nrOfFinished = 0, this.onFinish = new Phaser.Signal
    }, G.UITargetParticles.BatchObj.prototype.add = function(t) {
        this.parts.push(t), t.onFinish.addOnce(this.onPartFinish, this), this.nrOfParts++
    }, G.UITargetParticles.BatchObj.prototype.onPartFinish = function() {
        this.nrOfFinished++, this.nrOfFinished == this.nrOfParts && this.onFinish.dispatch()
    }, G.UITargetParticles.BatchObj.prototype.addOnPartStart = function(e, i) {
        this.parts.forEach(function(t) {
            t.onStart.addOnce(e, i || t, 1)
        })
    }, G.UITargetParticles.BatchObj.prototype.addOnPartFinish = function(e, i) {
        this.parts.forEach(function(t) {
            t.onFinish.addOnce(e, i || t, 1)
        })
    }, G.UITargetParticles.BatchObj.prototype.start = function(e) {
        var i = 0;
        this.parts.forEach(function(t) {
            t.start(i), i += e || 0
        })
    }, G.UITargetParticle = function() {
        G.Image.call(this, 0, 0, null, .5), this.onStart = new Phaser.Signal, this.onFinish = new Phaser.Signal, this.speed = 0, this.speedMax = 30, this.speedDelta = .75, this.vel = new Phaser.Point(0, 0), this.velInit = new Phaser.Point(0, 0), this.kill()
    }, G.UITargetParticle.prototype = Object.create(G.Image.prototype), G.UITargetParticle.prototype.init = function(t, e, i, s, a) {
        this.position.setTo(t, e), this.changeTexture(i), this.onStart.removeAll(), this.onFinish.removeAll(), this.carriedValue = a || 1, this.targetObj = s, this.stopTweens(this), this.scale.setTo(1), this.alpha = 1, this.speed = 0, this.vel.setTo(0, 0)
    }, G.UITargetParticle.prototype.start = function(t) {
        t ? game.time.events.add(t, this.start, this) : (this.revive(), this.onStart.dispatch(this, this.carriedValue))
    }, G.UITargetParticle.prototype.update = function() {
        if (this.alive) {
            this.position.add(this.vel.x, this.vel.y), this.vel.x *= .95, this.vel.y *= .95, this.speed += this.speedDelta, this.speed = Math.min(this.speed, this.speedMax);
            var t = Phaser.Point.distance(this.worldPosition, this.targetObj.worldPosition),
                e = Phaser.Point.angle(this.targetObj.worldPosition, this.worldPosition);
            this.position.add(G.lengthDirX(e, Math.min(t, this.speed), !0), G.lengthDirY(e, Math.min(t, this.speed), !0)), t < 1.2 * this.speedMax && (this.onFinish.dispatch(this, this.carriedValue), this.kill())
        }
    }, void 0 === G && (G = {}), Math.sign = Math.sign || function(t) {
        return 0 === (t = +t) || isNaN(t) ? t : 0 < t ? 1 : -1
    }, G.isImageInCache = function(t) {
        return "" != this.checkSheet(t) || game.cache.checkImageKey(t)
    }, G.checkSheet = function(t) {
        return G.spritesheetMap ? G.spritesheetMap[t] || "" : this.checkSheetOld()
    }, G.checkSheetOld = function() {
        for (var t = 0, e = G.ASSETS.spritesheets.length; t < e; t++) {
            G.ASSETS.spritesheets[t];
            if (game.cache.checkImageKey(G.ASSETS.spritesheets[t]) && game.cache.getFrameData(G.ASSETS.spritesheets[t]).getFrameByName(frame)) return G.ASSETS.spritesheets[t]
        }
        return ""
    }, G.lerp = function(t, e, i, s) {
        return s && Math.abs(t - e) <= s ? e : t + i * (e - t)
    }, G.l = function(t) {
        return Math.floor(t * G.Loader.currentConfigMulti)
    }, G.rl = function(t) {
        return Math.floor(t * (1 / G.Loader.currentConfigMulti))
    }, G.lnf = function(t) {
        return t * G.Loader.currentConfigMulti
    }, G.rnd = function(t, e) {
        return game.rnd.realInRange(t || 0, e || 1)
    }, G.rndInt = function(t, e) {
        return game.rnd.between(t, e)
    }, G.changeTexture = function(t, e) {
        if (null !== t.game) {
            if ("string" != typeof e) return t.loadTexture(e);
            var i = this.checkSheet(e);
            "" == i ? t.loadTexture(e) : t.loadTexture(i, e)
        }
    }, G.txt = function(t) {
        return G.lang || (G.lang = "en"), G.json.languages[G.lang] || (G.lang = "en"), G.json.languages[G.lang][t] || t + "***"
    }, G.deltaTime = 1, G.delta = function() {
        G.deltaTime = Math.min(1.5, game.time.elapsedMS / 16), 17 == game.time.elapsedMS && (G.deltaTime = 1)
    }, G.rotatePositions = function(t) {
        for (var e = [], i = 0, s = t.length; i < s; i += 2) e.push(-1 * t[i + 1], t[i]);
        return e
    }, G.loadTexture = G.changeTexture, G.makeImage = function(t, e, i, s, a) {
        var n, o = this.checkSheet(i);
        return n = "" == o ? game.make.image(this.l(t), this.l(e), i) : game.make.image(this.l(t), this.l(e), o, i), s && ("number" == typeof s ? n.anchor.setTo(s) : n.anchor.setTo(s[0], s[1])), a ? (a.add || a.addChild).call(a, n) : null !== a && game.world.add(n), n
    }, G.capitalize = function(t) {
        return t.charAt(0).toUpperCase() + t.slice(1)
    }, G.lengthDirX = function(t, e, i) {
        return (i = i || !1) ? Math.cos(t) * e : Math.cos(game.math.degToRad(t)) * e
    }, G.lengthDirY = function(t, e, i) {
        return (i = i || !1) ? Math.sin(t) * e : Math.sin(game.math.degToRad(t)) * e
    }, G.stopTweens = function(e) {
        game.tweens._add.forEach(function(t) {
            e.scale && t.target == e.scale && t.stop(), t.target == e && t.stop()
        }), game.tweens._tweens.forEach(function(t) {
            e.scale && t.target == e.scale && t.stop(), t.target == e && t.stop()
        })
    }, G.makeExtImage = function(t, e, s, i, a, n, o, r) {
        var h;
        if (G.extLoader || (G.extLoader = new G.ExtLoader(game), G.extLoader.crossOrigin = "anonymous"), G.extLoader.loadedUrls[s]) return h = G.makeImage(t, e, G.extLoader.loadedUrls[s], a, n), r.call(h), h;
        (h = G.makeImage(t, e, i, a, n)).onImgLoaded = new Phaser.Signal, G.extImagesKeys || (G.extImagesKeys = []);
        var l = "extImgBlankName" + G.extImagesKeys.length;
        G.extImagesKeys.push(l);
        var d = G.extLoader.onFileComplete.add(function(t, e, i) {
            e == l && i && (G.extLoader.loadedUrls[s] = l, null !== h.game && (G.changeTexture(h, l), r && r.call(h)), d.detach())
        });
        return G.extLoader.image(l, s, !0), h
    }, G.drawCircleSegment = function(t, e, i, s, a, n, o) {
        if (a === n) return t;
        void 0 === o && (o = 10);
        var r = (n - a) / o;
        t.moveTo(e, i);
        for (var h = t.currentPath.shape.points; a <= n; a += r) h.push(Math.floor(e + G.lengthDirX(a, s, !1)), Math.floor(i + G.lengthDirY(a, s, !1)));
        return h.push(Math.floor(e + G.lengthDirX(n, s, !1)), Math.floor(i + G.lengthDirY(n, s, !1))), t.dirty = !0, t._boundsDirty = !0, t
    }, G.centerElements = function(t, s, e) {
        void 0 === e && (e = 0), void 0 === s && (s = []);
        var i = 0,
            a = Array.isArray(s);
        t.forEach(function(t, e) {
            i += t.width, (a ? s[e - 1] : void 0 !== s) && (i += G.l(a ? s[e - 1] : s))
        });
        var n = e + -.5 * i;
        t.forEach(function(t, e, i) {
            t.x = n, t.x += t.width * t.anchor.x, n += t.width, (a ? s[e - 1] : void 0 !== s) && (n += G.l(a ? s[e] : s))
        })
    }, G.centerElements2 = function(t, s, a) {
        void 0 === a && (a = 0), void 0 === s && (s = 0);
        var n = 0;
        t.forEach(function(t, e) {
            n += t.width
        }), n += s * (t.length - 1), t.forEach(function(t, e, i) {
            t.left = 0 == e ? a + -.5 * n : i[e - 1].right + s
        })
    }, G.makeMover = function(e) {
        void 0 !== G.activeMover && (G.activeMover.destroy(), G.activeMover.eKey.onDown.removeAll()), G.activeMover = game.add.image(), G.activeMover.obj = e, G.activeMover.cursors = game.input.keyboard.createCursorKeys(), G.activeMover.shiftKey = game.input.keyboard.addKey(Phaser.Keyboard.SHIFT), G.activeMover.eKey = game.input.keyboard.addKey(Phaser.Keyboard.E), G.activeMover.eKey.onDown.add(function() {}, G.activeMover), G.activeMover.update = function() {
            var t = this.shiftKey.isDown ? 10 : 2;
            this.cursors.down.isDown && (e.y += t), this.cursors.up.isDown && (e.y -= t), this.cursors.left.isDown && (e.x -= t), this.cursors.right.isDown && (e.x += t)
        }
    }, G.makeLineEditor = function(t) {
        var a = game.add.group();
        return a.interpolation = t || "linear", a.pointsX = [0], a.pointsY = [0], a.gfx = a.add(game.make.graphics()), a.shiftKey = game.input.keyboard.addKey(Phaser.Keyboard.SHIFT), a.wKey = game.input.keyboard.addKey(Phaser.Keyboard.W), a.wKey.onDown.add(function() {
            var t, e;
            2 < this.children.length ? (t = this.children[this.children.length - 1].x, e = this.children[this.children.length - 1].y) : e = t = 0;
            var i = G.makeImage(t, e, "candy_1");
            i.anchor.setTo(.5), i.scale.setTo(.1), this.add(i), this.activeObject = i, this.changed = !0
        }, a), a.qKey = game.input.keyboard.addKey(Phaser.Keyboard.Q), a.qKey.onDown.add(function() {
            this.children.length <= 2 || (this.removeChildAt(this.children.length - 1), 3 < this.children.length ? this.activeObject = this.children[this.children.length - 1] : this.activeObject = null, this.changed = !0)
        }, a), a.aKey = game.input.keyboard.addKey(Phaser.Keyboard.A), a.aKey.onDown.add(function() {
            if (this.activeObject) {
                var t = this.getChildIndex(this.activeObject);
                2 != t && (this.activeObject = this.getChildAt(t - 1))
            }
        }, a), a.sKey = game.input.keyboard.addKey(Phaser.Keyboard.S), a.sKey.onDown.add(function() {
            if (this.activeObject) {
                var t = this.getChildIndex(this.activeObject);
                t != this.children.length - 1 && (this.activeObject = this.getChildAt(t + 1))
            }
        }, a), a.eKey = game.input.keyboard.addKey(Phaser.Keyboard.E), a.eKey.onDown.add(function() {
            console.log(JSON.stringify([this.pointsX, this.pointsY]))
        }, a), a.cursors = game.input.keyboard.createCursorKeys(), a.activeObject = null, a.preview = G.makeImage(0, 0, "candy_2", .5, a), a.preview.width = 8, a.preview.height = 8, a.preview.progress = 0, a.update = function() {
            if (null !== this.activeObject && (this.forEach(function(t) {
                    t == this.activeObject ? t.alpha = 1 : t.alpha = .5
                }, this), 0 != this.children.length)) {
                var t = this.shiftKey.isDown ? 3 : 1;
                if (this.cursors.down.isDown && (this.activeObject.y += t, this.changed = !0), this.cursors.up.isDown && (this.activeObject.y -= t, this.changed = !0), this.cursors.left.isDown && (this.activeObject.x -= t, this.changed = !0), this.cursors.right.isDown && (this.activeObject.x += t, this.changed = !0), a.preview.progress += .01, 1 < a.preview.progress && (a.preview.progress = 0), a.preview.x = game.math[this.interpolation + "Interpolation"](this.pointsX, a.preview.progress), a.preview.y = game.math[this.interpolation + "Interpolation"](this.pointsY, a.preview.progress), this.changed) {
                    var i = [],
                        s = [];
                    this.pointsX = i, this.pointsY = s, this.children.forEach(function(t, e) {
                        e <= 1 || (i.push(t.x), s.push(t.y))
                    }), this.gfx.clear(), this.gfx.beginFill(16711680, 1);
                    for (var e = 0; e < 200; e++) this.gfx.drawRect(game.math[this.interpolation + "Interpolation"](i, e / 200), game.math[this.interpolation + "Interpolation"](s, e / 200), 3, 3)
                }
            }
        }, a
    }, G.lineUtils = {
        getWholeDistance: function(t, e) {
            for (var i = 0, s = 1; s < t.length; s++) i += game.math.distance(t[s - 1], e[s - 1], t[s], e[s]);
            return i
        },
        findPointAtDitance: function(t, e, i) {
            for (var s = 0, a = 1; a < t.length; a++) {
                var n = game.math.distance(t[a - 1], e[a - 1], t[a], e[a]);
                if (i < n + s) {
                    var o = game.math.angleBetween(t[a - 1], e[a - 1], t[a], e[a]);
                    return [t[a - 1] + G.lengthDirX(o, i - s, !0), e[a - 1] + G.lengthDirY(o, i - s, !0)]
                }
                s += n
            }
            return [t[t.length - 1], e[e.length - 1]]
        },
        spreadAcrossLine: function(t, e, i, s, a) {
            for (var n = this.getWholeDistance(t, e) / (i.length - 1), o = 0; o < i.length; o++) {
                var r = this.findPointAtDitance(t, e, n * o);
                i[o][s || "x"] = r[0], i[o][a || "y"] = r[1]
            }
        },
        spreadOnNodes: function(t, e, i, s, a) {
            for (var n = 0; n < t.length; n++) {
                if (void 0 === i[n]) return;
                i[n][s || "x"] = t[n], i[n][a || "y"] = e[n]
            }
        }
    }, G.changeSecToTimerFormat = function(t, e) {
        var i = parseInt(t, 10),
            s = !!e && -1 !== e.toUpperCase().indexOf("D"),
            a = !!e && -1 !== e.toUpperCase().indexOf("H"),
            n = Math.floor(i / 86400),
            o = Math.floor((i - 86400 * n) / 3600),
            r = Math.floor((i - 86400 * n - 3600 * o) / 60),
            h = i - 86400 * n - 3600 * o - 60 * r,
            l = G.zeroPad(r) + ":" + G.zeroPad(h);
        return (0 < o || 0 < n || a) && (l = G.zeroPad(o) + ":" + l), (0 < n || s) && (l = G.zeroPad(n) + ":" + l), l
    }, G.changeSecToDHMS = function(t) {
        var e = parseInt(t, 10),
            i = Math.floor(e / 86400),
            s = Math.floor((e - 86400 * i) / 3600),
            a = Math.floor((e - 86400 * i - 3600 * s) / 60),
            n = e - 86400 * i - 3600 * s - 60 * a;
        return [this.zeroPad(i), this.zeroPad(s), this.zeroPad(a), this.zeroPad(n)]
    }, G.changeSecToHMS = function(t) {
        var e = parseInt(t, 10),
            i = Math.floor(e / 3600),
            s = Math.floor((e - 3600 * i) / 60),
            a = e - 3600 * i - 60 * s;
        return [this.zeroPad(i), this.zeroPad(s), this.zeroPad(a)]
    }, G.changeSecToMS = function(t) {
        var e = parseInt(t, 10),
            i = Math.floor(e / 60),
            s = e - 60 * i;
        return [this.zeroPad(i), this.zeroPad(s)]
    }, G.zeroPad = function(t) {
        return t < 10 ? "0" + t : t
    }, G.arrayJoin = function(t, i) {
        return t.reduce(function(t, e) {
            return e ? t ? t + i + e : e : t
        }, "")
    }, G.makeTextButton = function(t, e, i, s, a, n) {
        var o = game.make.text(t, e, i, s);
        return o.inputEnabled = !0, o.input.useHandCursor = !0, o.hitArea = new Phaser.Rectangle(0, 0, o.width, o.height), o.events.onInputDown.add(a, n || null), o
    }, G.setObjProp = function(t, e, i) {
        var s = t;
        "string" == typeof e && e.split(".");
        try {
            for (var a = 0; a < this.refreshProp.length - 1; a++) s = s[this.refreshProp[a]];
            s[this.refreshProp[this.refreshProp.length - 1]] = i
        } catch (t) {
            console.warn("cant set prop")
        }
    }, G.getObjProp = function(t, e) {
        var i = t;
        "string" == typeof e && (e = e.split("."));
        try {
            for (var s = 0; s < e.length; s++) i = i[e[s]]
        } catch (t) {
            return
        }
        return i
    }, void 0 === G && (G = {}), G.Utils = {
        loadScript: function(s) {
            return new Promise(function(t, e) {
                var i = document.createElement("script");
                i.onload = t, i.onerror = e, i.src = s, document.head.appendChild(i)
            })
        },
        clone: function(t) {
            return JSON.parse(JSON.stringify(t))
        },
        cleanUpOnDestroy: function(t, e) {
            return (t instanceof Phaser.Group ? t.onDestroy : t.events.onDestroy).addOnce(e.detach, e), e
        },
        createScheduler: function(t) {
            var i = null,
                s = function(t) {
                    {
                        if (!1 === t) return function(t, e) {
                            setTimeout(e, t);
                            return function(t) {
                                cancelTimeout(t)
                            }
                        };
                        if (!t) throw TypeError("Argument must be an instance of Phaser.Game or a false");
                        var e = t,
                            s = e.time.events;
                        return function(t, e) {
                            var i = s.add(t, e);
                            return function() {
                                s.remove(i)
                            }
                        }
                    }
                }(t);
            return {
                rescheduleAction: function(t, e) {
                    a(), i = s(e, function() {
                        i = null, t()
                    })
                },
                cancelSchedule: a
            };

            function a() {
                null !== i && (i(), i = null)
            }
        },
        retryAsyncAction: function(t, e, i) {
            var s, a, n, o, r = G.Utils.createScheduler(e || !1),
                h = (s = 0, a = i || (n = 1e3, o = 3e4, function(t) {
                    return Math.min(o, n * Math.pow(2, t - 1))
                }), {
                    getDelay: function() {
                        return 0 === s ? 0 : a(s)
                    },
                    increase: incease,
                    reset: function() {
                        s = 0
                    }
                }),
                l = !1;

            function d() {
                return l
            }
            var c = !1;

            function u() {
                return c
            }
            var p = null;
            return g(), {
                isRunning: d,
                isCancelled: u,
                cancel: function() {
                    if (u()) return;
                    c = !0, l = !1, r.cancelSchedule(), p && p()
                },
                resetDelays: function() {
                    if (u()) throw "Reset after cancel is not supported";
                    h.reset(), g()
                }
            };

            function g() {
                if (!d()) {
                    r.cancelSchedule();
                    var t = Math.max(0, h.getDelay());
                    isFinite(t) && r.rescheduleAction(t, f)
                }
            }

            function f() {
                if (u()) throw "Retry after cancel is not supported";
                if (!d()) {
                    var e = !(l = !0);
                    p = t(function(t) {
                        l = !1, e = !(p = null), u() || t || (h.increase(), g())
                    }), e && (p = null)
                }
            }
        },
        cacheText: function(t, e, i, s, a) {
            (e = game.make.bitmapText(0, 0, i, e, s)).updateCache(), game.make.renderTexture(e.width, e.height, t, !0).render(e), e.destroy()
        },
        cacheGText: function(t, e, i) {
            e = new G.Text(0, 0, e, i, 0);
            game.make.renderTexture(e.width, e.height, t, !0).render(e), e.destroy()
        },
        lerp: function(t, e, i, s) {
            return s && Math.abs(t - e) <= s ? e : t + i * (e - t)
        },
        copyToClipboard: function(t) {
            this.copyArea || (this.copyArea = document.createElement("textarea"), this.copyArea.style.positon = "fixed", this.copyArea.style.opacity = 0, document.body.appendChild(this.copyArea)), this.copyArea.value = t, this.copyArea.select(), document.execCommand("copy")
        },
        getObjProp: function(t, e) {
            var i = t;
            "string" == typeof e && (e = e.split("."));
            try {
                for (var s = 0; s < e.length; s++) i = i[e[s]]
            } catch (t) {
                return
            }
            return i
        },
        setObjProp: function(t, e, i) {
            var s = t;
            "string" == typeof e && (e = e.split("."));
            try {
                for (var a = 0; a < e.length - 1; a++) s = s[e[a]];
                s[e[e.length - 1]] = i
            } catch (t) {
                return null
            }
        },
        replaceAll: function(t, e, i) {
            return t.split(e).join(i)
        },
        removeDuplicates: function(t) {
            var e = [];
            return t.forEach(function(t) {
                -1 === e.indexOf(t) && e.push(t)
            }), e
        },
        getParentsScaleX: function(t, e) {
            return t == game.stage ? 1 : G.Utils.getParentsScaleX(t.parent, !0) * (e ? t.scale.x : 1)
        },
        getParentsScaleY: function(t, e) {
            return t == game.stage ? 1 : G.Utils.getParentsScaleY(t.parent, !0) * (e ? t.scale.y : 1)
        },
        makeTextButton: function(t, e, i, s, a, n) {
            var o = game.add.text(t, e, i, n);
            return o.inputEnabled = !0, o.input.useHandCursor = !0, o.hitArea = new Phaser.Rectangle(0, 0, o.width, o.height), o.events.onInputDown.add(s, a), o
        },
        injectCSS: function(t) {
            var e = document.createElement("style");
            e.type = "text/css", e.innerHTML = t, document.getElementsByTagName("head")[0].appendChild(e)
        },
        toClientX: function(t) {
            return (parseInt(game.canvas.style.marginLeft) || 0) + t / game.width * game.canvas.clientWidth
        },
        toClientY: function(t) {
            return (parseInt(game.canvas.style.marginTop) || 0) + t / game.height * game.canvas.clientHeight
        },
        clientXToWorldX: function(t) {
            t -= parseInt(game.canvas.style.marginLeft) || 0;
            var e = parseInt(game.canvas.style.width),
                i = (parseInt(game.canvas.style.height), parseInt(game.canvas.width));
            parseInt(game.canvas.height);
            return t * (i / e)
        },
        clientYToWorldY: function(t) {
            t -= parseInt(game.canvas.style.marginTop) || 0;
            parseInt(game.canvas.style.width);
            var e = parseInt(game.canvas.style.height);
            parseInt(game.canvas.width);
            return t * (parseInt(game.canvas.height) / e)
        },
        getImageURI: function(t) {
            return this._bmpMarker || (this._bmpMarker = G.makeImage(0, 0, null, 0, null)), this._bmp || (this._bmp = game.make.bitmapData()), this._bmp.clear(), G.changeTexture(this._bmpMarker, t), this._bmp.resize(this._bmpMarker.width, this._bmpMarker.height), this._bmp.draw(this._bmpMarker), this._bmp.canvas.toDataURL()
        },
        getRT: function(t) {
            return game.cache.getRenderTexture(t).texture
        },
        arraysEqual: function(t, e) {
            if (t === e) return !0;
            if (null == t || null == e) return !1;
            if (t.length != e.length) return !1;
            for (var i = 0; i < t.length; ++i)
                if (t[i] !== e[i]) return !1;
            return !0
        },
        find1stObjectWithName: function(t, e) {
            if (!t) return null;
            if (t.name === e) return t;
            if (t.children)
                for (var i = 0; i < t.children.length; ++i) {
                    var s = G.Utils.find1stObjectWithName(t.children[i], e);
                    if (s) return s
                }
            return null
        },
        debugError: function debugError() {
            console.error.apply(console, arguments);
            var localhost = !1;
            window && window.location && "localhost" === window.location.hostname && (localhost = !0), localhost && eval("debugger")
        },
        moveArrayElementToBeFirst: function(t, e) {
            var i = t.indexOf(e);
            return 0 < i && (t.unshift(t.splice(i, 1)[0]), !0)
        },
        defined: function() {
            for (var t = 0; t < arguments.length; ++t)
                if (void 0 !== arguments[t]) return arguments[t]
        },
        createTrackingScheduler: function(s, e) {
            var a = [];
            return {
                add: function() {
                    var t = s.apply(null, arguments);
                    return e = t, i = e, console.assert(-1 === a.indexOf(i), "addFunc must return something unique"), a.push(e), t;
                    var e, i
                },
                remove: t,
                removeAll: function() {
                    for (; 0 < a.length;) t(a[0])
                }
            };

            function t(t) {
                (function(t) {
                    var e = a.indexOf(t);
                    if (0 <= e) return a.splice(e, 1), !0;
                    return !1
                })(t) && e(t)
            }
        },
        createDynamicMap: function(e) {
            var i = {};
            return {
                getValue: function(t) {
                    s(t) || (value = e(), i[t] = value);
                    return value
                },
                setValue: function(t, e) {
                    i[t] = e
                },
                hasKey: s,
                removeKey: function(t) {
                    delete i[t]
                },
                getKeys: function() {
                    return Object.keys(i)
                },
                forEachKeyValuePair: function(e) {
                    Object.keys(i).forEach(function(t) {
                        e(t, i[t])
                    })
                }
            };

            function s(t) {
                return i.hasOwnProperty(t)
            }
        }
    }, G.lineCircleColl = function(t, e, i) {
        var s = t.start,
            a = t.end,
            n = Math.sqrt(Math.pow(a.x - s.x, 2) + Math.pow(a.y - s.y, 2)),
            o = (a.x - s.x) / n,
            r = (a.y - s.y) / n,
            h = o * (e.x - s.x) + r * (e.y - s.y),
            l = h * o + s.x,
            d = h * r + s.y,
            c = Math.sqrt(Math.pow(l - e.x, 2) + Math.pow(d - e.y, 2));
        if (c < e.radius) {
            var u = Math.sqrt(e.radius * e.radius - c * c),
                p = (h - u) * o + s.x,
                g = (h - u) * r + s.y,
                f = (h + u) * o + s.x,
                m = (h + u) * r + s.y,
                G = game.math.distance(s.x, s.y, p, g),
                y = game.math.distance(s.x, s.y, f, m);
            return G < y ? t.length > G && (i.setTo(p, g), i) : t.length > y && (i.setTo(f, m), i)
        }
        return !1
    }, G.getRT = function(t) {
        var e = game.cache.getRenderTexture(t);
        return e ? e.texture : null
    }, G.numberDot = function(t) {
        for (var e = "", i = 0, s = (t = t.toString()).length - 1; 0 <= s; s--) e = t[s] + e, 3 == ++i && 0 !== s && (e = "." + e, i = 0);
        return e
    }, G.guid = function() {
        function t() {
            return Math.floor(65536 * (1 + Math.random())).toString(16).substring(1)
        }
        return t() + t() + "-" + t() + "-" + t() + "-" + t() + "-" + t() + t() + t()
    }, G.AnimationElement = function(t, e, i, s) {
        G.Image.call(this, t, e, null), this.ANIMATIONELEMENT = !0, this.SPR = new G.Image(0, 0, null, .5, this), this.frameCounter = 0, this.data = i, this.currentAnimationData = null, this.currentAnimationName = null, this.playing = void 0 === s || s
    }, G.AnimationElement.prototype = Object.create(G.Image.prototype), G.AnimationElement.prototype.update = function() {
        this.currentAnimationName && this.playing && (this.frameCounter++, this.updateAnimation(this.frameCounter))
    }, G.AnimationElement.prototype.pause = function() {
        this.playing = !1
    }, G.AnimationElement.prototype.resume = function() {
        this.playing = !0
    }, G.AnimationElement.prototype.play = function() {
        this.playing = !0
    }, G.AnimationElement.prototype.stop = function() {
        this.playing = !1, this.updateAnimation(0)
    };
    var testObj = {
            normal: {
                eventTL: [],
                frameTL: [{
                    f: 0,
                    v: "candy_1"
                }],
                propTLS: {
                    alpha: [{
                        f: 0,
                        v: 1
                    }],
                    x: [{
                        f: 0,
                        v: 0
                    }],
                    y: [{
                        f: 0,
                        v: 0
                    }],
                    angle: [{
                        f: 0,
                        v: 0
                    }],
                    "scale.x": [{
                        f: 0,
                        v: 1
                    }],
                    "scale.y": [{
                        f: 0,
                        v: 1
                    }],
                    "anchor.x": [{
                        f: 0,
                        v: .5
                    }],
                    "anchor.y": [{
                        f: 0,
                        v: 1
                    }]
                }
            },
            jump: {
                eventTL: [],
                frameTL: [{
                    f: 0,
                    v: null
                }],
                propTLS: {
                    alpha: [{
                        f: 0,
                        v: 1
                    }],
                    x: [{
                        f: 0,
                        v: 0
                    }],
                    y: [{
                        f: 0,
                        v: 0
                    }, {
                        f: 120,
                        v: -300
                    }],
                    angle: [{
                        f: 0,
                        v: 0,
                        e: ["Linear", "None"]
                    }, {
                        f: 400,
                        v: 360
                    }],
                    "scale.x": [{
                        f: 0,
                        v: 1
                    }],
                    "scale.y": [{
                        f: 0,
                        v: 1
                    }],
                    "anchor.x": [{
                        f: 0,
                        v: .5
                    }],
                    "anchor.y": [{
                        f: 0,
                        v: 1
                    }]
                }
            }
        },
        Aoa, Boa;
    G.AnimationElement.prototype.changeAnimationData = function(t) {
        this.data[t] || (t = Object.keys(this.data)[0]), this.eventTL = this.data[t].eventTL, this.frameTL = this.data[t].frameTL, this.propTLS = this.data[t].propTLS, this.propKeys = Object.keys(this.propTLS), this.currentAnimationData = this.data[t], this.currentAnimationName = t, this.updateAnimation(0)
    }, G.AnimationElement.prototype.playAnimation = function(t) {
        this.changeAnimationData(t), this.playing = !0
    }, G.AnimationElement.prototype.getLastKeyFrame = function(t, e) {
        for (var i = t.length, s = 0; s < i; s++) {
            if (t[s].f == e || s == i - 1) return t[s];
            if (t[s].f < e && e < t[s + 1].f) return t[s]
        }
    }, G.AnimationElement.prototype.getNextKeyFrame = function(t, e) {
        for (var i = t.length, s = 0; s < i; s++)
            if (t[s].f > t || s == i - 1) return t[s]
    }, G.AnimationElement.prototype.getKeyFrameAt = function(t, e) {
        if (!this.currentAnimationName) return null;
        for (var i = 0; i < t.length; i++) {
            var s = t[i];
            if (s.f === e) return s
        }
        return null
    }, G.AnimationElement.prototype.isAnyKeyFrameAt = function(t) {
        if (!this.currentAnimationName) return !1;
        if (this.getKeyFrameAt(this.eventTL, t)) return !0;
        if (this.getKeyFrameAt(this.frameTL, t)) return !0;
        for (var e = 0; e < this.propKeys.length; e++) {
            var i = this.propKeys[e];
            if (this.getKeyFrameAt(this.propTLS[i], t)) return !0
        }
        return !1
    }, G.AnimationElement.prototype.getFrameValue = function(t, e) {
        var i = this.getLastKeyFrame(t, e),
            s = this.getNextKeyFrame(t, e);
        if (i.e) {
            var a = s.f - i.f,
                n = s.v - i.v,
                o = Phaser.Easing[i.e[0]][i.e[1]]((e - i.f) / a);
            return i.v + n * o
        }
        return i.v
    }, G.AnimationElement.prototype.updateAnimation = function(t) {
        if (this.currentAnimationName) {
            this.frameCounter = t, this.updateFromPropTLS(t);
            var e = this.getTextureFrameValue(this.frameTL, t);
            this.SPR.key != e && this.SPR.frameName != e && G.changeTexture(this.SPR, e)
        }
    }, G.AnimationElement.prototype.updateFromPropTLS = function(t) {
        for (var e = 0; e < this.propKeys.length; e++) {
            var i = this.propKeys[e];
            this.setProp(i, this.getFrameValue(this.propTLS[i], t))
        }
    }, G.AnimationElement.prototype.setProp = function(t, e) {
        "scale.x" == t ? this.SPR.scale.x = e : "scale.y" == t ? this.SPR.scale.y = e : "anchor.x" == t ? this.SPR.anchor.x = e : "anchor.y" == t ? this.SPR.anchor.y = e : this.SPR[t] = e
    }, G.AnimationElement.prototype.getTextureFrameValue = function(t, e) {
        var i = this.getLastKeyFrame(t, e),
            s = i.frameSkip || 1,
            a = e - i.f;
        if (a = Math.floor(a / s), !i.animation) return i.v;
        var n = i.v.length;
        return i.loop ? i.refraction || i.reverse ? i.refraction && !i.reverse ? i.v[Math.min(n - 1, a % (n + i.refraction))] : void 0 : i.v[a % n] : i.v[Math.min(n - 1, a)]
    }, G.GroupColliderLineLine = function(t, e, i, s) {
        G.Image.call(this, 0, 0, null), this.group1 = t, this.group2 = e, this.callback = i, this.context = s || null, this.collPoint = new Phaser.Point(0, 0)
    }, G.GroupColliderLineLine.prototype = Object.create(G.Image.prototype), G.GroupColliderLineLine.prototype.update = function() {
        for (var t = this.group1.length, e = this.group2.length, i = 0; i < t; i++)
            for (var s = this.group1.children[i], a = 0; a < e; a++) {
                var n = this.group2.children[a];
                s !== n && (s.collLine.intersects(n.collLine, !0, this.collPoint) && this.callback.call(this.context, s, n, this.collPoint, this.group1, this.group2))
            }
    }, G.GroupColliderLineCircle = function(t, e, i, s) {
        G.Image.call(this, 0, 0, null), this.group1 = t, this.group2 = e, this.callback = i, this.context = s || null, this.collPoint = new Phaser.Point(0, 0)
    }, G.GroupColliderLineCircle.prototype = Object.create(G.Image.prototype), G.GroupColliderLineCircle.prototype.update = function() {
        this.group1.length, this.group2.length;
        for (var t = this.group1.length; t--;)
            for (var e = this.group1.children[t], i = this.group2.length; i--;) {
                var s = this.group2.children[i];
                e !== s && (G.lineCircleColl(e.collLine, s.collCircle, this.collPoint) && this.callback.call(this.context, e, s, this.collPoint, this.group1, this.group2))
            }
    }, Phaser.Group.prototype.destroy = function(t, e) {
        null === this.game || this.ignoreDestroy || (void 0 === t && (t = !0), void 0 === e && (e = !1), this.onDestroy.dispatch(this, t, e), this.removeAll(t), this.cursor = null, this.filters = null, this.alive = !1, this.pendingDestroy = !1, e || (this.parent && this.parent.removeChild(this), this.game = null, this.exists = !1))
    }, Phaser.exportChildren = function(t) {
        for (var e = [], i = 0; i < t.children.length; i++) {
            var s = t.children[i];
            s.exportToString && e.push(s.exportToString())
        }
        return e
    }, Phaser.Group.prototype.exportToString = function() {
        return {
            type: "GROUP",
            x: this.x,
            y: this.y,
            scale: [this.scale.x, this.scale.y],
            angle: this.angle,
            children: Phaser.exportChildren(this)
        }
    }, Phaser.Image.prototype.exportToString = function() {
        return exportObj = {
            type: "IMG",
            x: this.x,
            y: this.y,
            frame: this.frameName,
            anchor: [this.anchor.x, this.anchor.y],
            scale: [this.scale.x, this.scale.y],
            angle: this.angle,
            children: Phaser.exportChildren(this)
        }, exportObj
    }, G.Input = G.Input || {}, G.Input.initializeCustomInput = function(t, e) {
        var i, s, a, n, o, r, h, l, d = G.Input.EventType,
            c = G.Utils;
        return s = e, (i = t).customInput = (l = [], {
            handleEventShared: function(t, e) {
                for (var i = !1, s = 0; s < l.length; ++s) i = l[s].handleEventShared(t, e) || i;
                return i
            },
            handleEventExclusive: function(t, e) {
                for (var i = !1, s = 0; s < l.length; ++s) i ? l[s].cancelEvent(t) : i = l[s].handleEventExclusive(t, e);
                return i
            },
            cancelEvent: function(t) {
                for (var e = 0; e < l.length; ++e) l[e].cancelEvent(t)
            },
            addHandler: function(t) {
                l.push(t)
            }
        }), n = i, o = c.defined(s, 15), n.inputEnabled = !0, r = n.input, h = o, r.draggable = !0, r.allowHorizontalDrag = !1, r.allowVerticalDrag = !1, r.dragDistanceThreshold = h, void[{
            signal: (a = i.events).onInputOver,
            eventType: d.InputOver
        }, {
            signal: a.onInputOut,
            eventType: d.InputOut
        }, {
            signal: a.onInputDown,
            eventType: d.InputDown
        }, {
            signal: a.onInputUp,
            eventType: d.InputUp
        }, {
            signal: a.onDragStart,
            eventType: d.DragStart
        }, {
            signal: a.onDragUpdate,
            eventType: d.DragUpdate
        }, {
            signal: a.onDragStop,
            eventType: d.DragStop
        }].forEach(function(t) {
            var e = t.signal,
                i = t.eventType;
            e.add(function(t, e) {
                ! function(t, i, s) {
                    var a = [];
                    i.interactiveCandidates.forEach(function(t) {
                        var e = t.sprite;
                        e && Boolean(e.customInput) && e.customInput.handleEventShared(s, i) && a.push(e)
                    }), a.sort(function(t, e) {
                        return t.renderOrderID === e.renderOrderID ? 0 : t.renderOrderID < e.renderOrderID ? 1 : -1
                    }), c.moveArrayElementToBeFirst(a, t);
                    for (var e = !1, n = 0; n < a.length; ++n) {
                        var o = a[n].customInput;
                        e ? o.cancelEvent(s) : e = o.handleEventExclusive(s, i)
                    }
                }(t, e, i)
            })
        })
    }, G.Input = G.Input || {}, G.Input.EventType = {
        InputOver: "inputOver",
        InputOut: "inputOut",
        InputDown: "inputDown",
        InputUp: "inputUp",
        DragStart: "dragStart",
        DragUpdate: "dragUpdate",
        DragStop: "dragStop"
    }, void 0 === G && (G = {}), G.Math = G.Math || {}, G.Math.Vector2 = function(t, e) {
        this.x = t || 0, this.y = e || 0
    }, G.Math.Vector2.prototype.set = function(t, e) {
        this.x = t, this.y = e
    }, void 0 === G && (G = {}), G.UI = G.UI || {}, G.UI.createAnchoredLayoutComponent = function() {
        var a = G.Math.Vector2,
            s = G.lerp,
            n = new a(0, 0),
            o = new a(1, 1),
            h = {
                start: new a(0, 0),
                end: new a(1, 1)
            },
            l = {
                fromTop: 0,
                fromLeft: 0,
                fromBottom: 0,
                fromRight: 0
            };
        return {
            anchors: h,
            cornerOffsets: l,
            calculateOffsetsFor: function(t, e, i, s, a, n) {
                var o = i + a,
                    r = s + n;
                l.fromLeft = d(t, h.start.x, i), l.fromTop = d(e, h.start.y, s), l.fromRight = -d(t, h.end.x, o), l.fromBottom = -d(e, h.end.y, r)
            },
            calculateAnchorsFor: function(t, e, i, s, a, n) {
                h.start.x = u(t, i, l.fromLeft), h.start.y = u(e, s, l.fromTop), h.end.x = u(t, i + a, -l.fromRight), h.end.y = u(e, s + n, -l.fromBottom)
            },
            getLocalPosition: r,
            getLocalSize: function(t, e) {
                var i = r(t, e, n),
                    s = r(t, e, o);
                return new a(s.x - i.x, s.y - i.y)
            }
        };

        function r(t, e, i) {
            return new a(s(c(t, h.start.x, l.fromLeft), c(t, h.end.x, -l.fromRight), i && i.x || 0), s(c(e, h.start.y, l.fromTop), c(e, h.end.y, -l.fromBottom), i && i.y || 0))
        }

        function d(t, e, i) {
            return i - t * e
        }

        function c(t, e, i) {
            return t * e + i
        }

        function u(t, e, i) {
            return (e - i) / t
        }
    }, void 0 === G && (G = {}), G.UI = G.UI || {}, G.UI.ComponentType = {
        Image: "image",
        Text: "text",
        Transparency: "transparency",
        Visibility: "visibility",
        Input: "input",
        JSON: "json"
    }, void 0 === G && (G = {}), G.UI = G.UI || {}, G.UI.ElementType = {
        Image: "image",
        NineSlice: "nineslice",
        Group: "group",
        Text: "text",
        Button: "button",
        JSON: "json"
    }, void 0 === G && (G = {}), G.UI = G.UI || {}, G.UI.createExportsManager = function(a) {
        return {
            getExportFunc: function() {
                return t
            },
            result: {
                arrayByName: a = {},
                getAmountOf: n,
                getFirst: o,
                forFirst: function(t, e, i) {
                    if (0 < n(t)) {
                        var s = o(t);
                        e(s.rootElement, s.exports)
                    } else r(i, t)
                },
                forEach: function(t, i, e) {
                    var s = a[t];
                    s && 0 < s.length ? s.forEach(function(t, e) {
                        i(t.rootElement, e, t.exports)
                    }) : r(e, t)
                }
            }
        };

        function t(t, e) {
            a[t] || (a[t] = []), a[t].push(e)
        }

        function n(t) {
            var e = a[t];
            return e ? e.length : 0
        }

        function o(t, e) {
            if (0 < n(t)) return a[t][0];
            r(e, t)
        }

        function r(t, e) {
            if ("function" == typeof t) t(e);
            else {
                var i = "Element " + e + " not found";
                if ("warn" === t) console.warn(i);
                else if (null != t) throw i
            }
        }
    }, void 0 === G && (G = {}), G.UI = G.UI || {}, G.UI.resize = function e(t, i, s) {
        var a = G.UI.ElementType,
            n = G.Text.setMaxWidth,
            o = G.Text.setMaxHeight,
            r = t.customComponents.ui;
        if (!r) return !1;
        var h, l, d, c = r.anchoredLayout,
            u = c.getLocalPosition(i, s, r.pivot),
            p = c.getLocalSize(i, s);
        return function(t, e, i, s, a) {
            var n = i.x,
                o = i.y,
                r = n,
                h = o;
            null !== s.widthMin && (r = Math.max(r, s.widthMin));
            null !== s.widthMax && (r = Math.min(r, s.widthMax));
            null !== s.heightMin && (h = Math.max(h, s.heightMin));
            null !== s.heightMax && (h = Math.min(h, s.heightMax));
            var l = null;
            s.preserveAspectRatio ? 0 < a.x && 0 < a.y && (l = a.x / a.y) : null === s.aspectRatioMin && null === s.aspectRatioMax || 0 < n && 0 < o && (l = n / o);
            null !== l && (null !== s.aspectRatioMin && (l = Math.max(l, s.aspectRatioMin)), null !== s.aspectRatioMax && (l = Math.min(l, s.aspectRatioMax)));
            null !== l ? (d = t, (g = (u = h) * (p = l)) * (f = u) < (m = c = r) * (G = c / p) ? (d.x = g, d.y = f) : (d.x = m, d.y = G), r = t.x, h = t.y) : (t.x = r, t.y = h);
            var d, c, u, p, g, f, m, G;
            e.x += s.constrainAnchorX * (n - r), e.y += s.constrainAnchorY * (o - h)
        }(p, u, p, r.layoutConstrains, r.desiredSize), t.parent instanceof Phaser.Group || (u.x /= t.parent.scale.x, u.y /= t.parent.scale.y, p.x /= t.parent.scale.x, p.y /= t.parent.scale.y), t.x = u.x, t.y = u.y, h = t, l = p, (d = r.type) === a.Text ? (n(h, l.x), o(h, l.y), h.wordWrapWidth = l.x) : d === a.NineSlice ? h.resize(l.x, l.y) : d !== a.Group && d !== a.JSON && (h.width = l.x, h.height = l.y), t.pivot.set(r.pivot.x * p.x / t.scale.x, r.pivot.y * p.y / t.scale.y), t.children && t.children.forEach(function(t) {
            t.customComponents && e(t, p.x, p.y)
        }), !0
    }, void 0 === G && (G = {}), G.UI = G.UI || {}, G.UI.createUIElement = function(t, e, i, s, a) {
        var M = G.UI.ElementType,
            O = G.UI.ComponentType,
            L = G.UI.createAnchoredLayoutComponent,
            E = G.UI.createExportsManager,
            D = G.Math.Vector2,
            _ = G.txt,
            A = G.Utils.defined,
            F = G.Utils.clone,
            W = G.Text,
            N = G.Button,
            j = G.makeImage.bind(G),
            R = function() {
                return t.add.group()
            },
            U = function(t) {
                var e = t.split("/"),
                    i = e[e.length - 2],
                    s = e[e.length - 1],
                    a = "assets/" + t;
                return G.json.hasOwnProperty(a) ? G.Utils.NineSlice.fromJSON(a, 0, 0, 1, 1) : (console.warn("No JSON found for " + a + " nine-slice!"), new PhaserNineSlice.NineSlice(0, 0, i, s, 1, 1, {
                    left: 0,
                    right: 0,
                    top: 0,
                    bottom: 0
                }))
            };
        return function i(t, e, s, a, n, o, r) {
            var h = E();
            var l = h.getExportFunc();

            function d() {
                r && r.apply(null, arguments), l.apply(null, arguments)
            }
            var c = {
                rootElement: null,
                exports: h.result
            };
            var u;
            switch (t.type) {
                case M.Image:
                    var p = z(t.components, O.Image) || {};
                    u = j(0, 0, p.cacheKey, 0, 0), A(p.antialiasing, !0) || (u.smoothed = !1);
                    break;
                case M.NineSlice:
                    var p = z(t.components, O.Image) || {};
                    u = U(p.cacheKey);
                    break;
                case M.Group:
                case M.JSON:
                    u = R();
                    break;
                case M.Text:
                    var p = z(t.components, O.Text) || {},
                        g = p.textLocalizationKey ? _(p.textLocalizationKey) : p.textUnlocalized;
                    u = new W(0, 0, g = g || "", function(t, i) {
                        var e = t;
                        t && t.fontSize && ((e = F(t)).fontSize = e.fontSize.replace(/(\d+(?:\.\d+)?)/, function(t, e) {
                            return String(Number(e) * i)
                        }));
                        return e
                    }(p.style, Math.min(a, n)), 0, p.maxWidth, p.maxHeight, p.textWrap, p.align);
                    break;
                case M.Button:
                    var p = z(t.components, O.Image) || {};
                    (u = new N(0, 0, p.cacheKey)).anchor.setTo(0);
                    break;
                default:
                    console.error("Unsupported element type:", t.type)
            }
            if (u) {
                c.rootElement = u, t.exportNames && t.exportNames.forEach(function(t) {
                    d(t, c)
                }), t.name && (u.name = t.name);
                var f = L(),
                    m = t.layout || {};
                ! function(t, e, i, s) {
                    var a = e.offsets || [0, 0, 0, 0];
                    t.cornerOffsets.fromLeft = a[0] * i, t.cornerOffsets.fromTop = a[1] * s, t.cornerOffsets.fromRight = -a[2] * i, t.cornerOffsets.fromBottom = -a[3] * s;
                    var n = e.pivot || [0, 0];
                    if (e.anchorsManualEditHelper) {
                        var o = e.anchorsManualEditHelper,
                            r = o.imaginaryPivot || n;
                        t.calculateAnchorsFor(o.imaginaryParentSize[0], o.imaginaryParentSize[1], o.imaginaryPosition[0] - r[0] * o.imaginarySize[0], o.imaginaryPosition[1] - r[1] * o.imaginarySize[1], o.imaginarySize[0], o.imaginarySize[1])
                    } else e.anchors && (t.anchors.start.set(e.anchors[0], e.anchors[1]), t.anchors.end.set(e.anchors[2], e.anchors[3]))
                }(f, m, a, n);
                var G = f.getLocalSize(e, s),
                    y = m.pivot || [0, 0];
                if (u.pivot.set(y[0] * u.width, y[1] * u.height), t.type === M.Text && u.anchor.setTo(y[0], y[1]), m.angle && (u.angle = m.angle), o && t.type === M.JSON) {
                    var b = z(t.components, O.JSON);
                    if (b && b.cacheKey) {
                        var v = o(b.cacheKey);
                        if (v) {
                            var x = i(v.rootElement, G.x, G.y, G.x / v.desiredSize[0], G.y / v.desiredSize[1], o, d);
                            u.addChild(x.rootElement)
                        }
                    }
                }
                t.children && t.children.forEach(function(t) {
                    var e = i(t, G.x, G.y, a, n, o, d);
                    e.rootElement && u.addChild(e.rootElement)
                }), I = u, B = z(t.components, O.Transparency) || {}, I.alpha = A(B.alpha, 1), k = u, (z(t.components, O.Visibility) || {}).hidden && (k.visible = !1, k.exists = !1), C = u, (z(t.components, O.Input) || {}).enabled && (C.inputEnabled = !0), u.customComponents = u.customComponents || {}, u.customComponents.ui = {
                    pivot: new D(y[0], y[1]),
                    anchoredLayout: f,
                    layoutConstrains: (w = m.constrains || {}, T = a, S = n, P = A(w.constrainCenter, [.5, .5]), {
                        widthMin: H(w.widthMin, T),
                        widthMax: H(w.widthMax, T),
                        heightMin: H(w.heightMin, S),
                        heightMax: H(w.heightMax, S),
                        preserveAspectRatio: A(w.preserveAspectRatio, !1),
                        aspectRatioMin: A(w.aspectRatioMin, null),
                        aspectRatioMax: A(w.aspectRatioMax, null),
                        constrainAnchorX: P[0],
                        constrainAnchorY: P[1]
                    }),
                    type: t.type,
                    desiredSize: G
                }
            }
            var w, T, S, P;
            var C;
            var k;
            var I, B;
            return c
        }(e.rootElement, e.desiredSize[0], e.desiredSize[1], A(i, 1), A(s, 1), a);

        function z(t, e) {
            if (t) {
                var i = t.find(function(t) {
                    return t.type === e
                });
                return i ? i.data : i
            }
        }

        function H(t, e) {
            return void 0 === t ? null : t * e
        }
    }, G.Input = G.Input || {}, G.Input.createCustomBlockInputHandler = function(t) {
        G.Input.EventType;
        var i = new Phaser.Signal;
        return {
            handleEventShared: function(t, e) {
                return !0
            },
            handleEventExclusive: function(t, e) {
                return i.dispatch(), !0
            },
            cancelEvent: function(t) {},
            signal: i
        }
    }, G.Input = G.Input || {}, G.Input.createCustomInputClickHandler = function() {
        var i = G.Input.EventType,
            e = G.StateMachine,
            s = {
                down: new Phaser.Signal,
                click: new Phaser.Signal,
                cancel: new Phaser.Signal
            },
            t = {
                handleEventShared: function(t, e) {
                    if (t === i.InputDown) return n.transitIfPossible(a.Down);
                    if (t === i.DragStart || t === i.InputOut) return n.transitIfPossible(a.Cancel), !1;
                    return t === i.InputUp && n.canTransitTo(a.Confirm)
                },
                handleEventExclusive: function(t, e) {
                    if (t === i.InputUp && n.canTransitTo(a.Confirm)) return n.transit(a.Confirm), !0;
                    return !1
                },
                cancelEvent: function(t) {
                    n.transitIfPossible(a.Cancel)
                },
                downSignal: s.down,
                clickSignal: s.click,
                cancelSignal: s.cancel
            },
            a = {
                Idle: "idle",
                Down: "down",
                Cancel: "cancel",
                Confirm: "confirm"
            },
            n = function() {
                var t = {};
                t[a.Idle] = [a.Down], t[a.Down] = [a.Cancel, a.Confirm], t[a.Cancel] = [a.Idle], t[a.Confirm] = [a.Idle];
                var i = new e(a.Idle, t);
                return i.transitionSignal.add(function(t, e) {
                    switch (t) {
                        case a.Idle:
                            break;
                        case a.Down:
                            s.down.dispatch();
                            break;
                        case a.Cancel:
                            i.transit(a.Idle), s.cancel.dispatch();
                            break;
                        case a.Confirm:
                            i.transit(a.Idle), s.click.dispatch()
                    }
                }), i
            }();
        return t
    }, G.Input = G.Input || {}, G.Input.createCustomInputDragHandler = function() {
        var i = G.Input.EventType,
            e = G.StateMachine,
            a = {
                inputDown: new Phaser.Signal,
                start: new Phaser.Signal,
                update: new Phaser.Signal,
                stop: new Phaser.Signal,
                cancel: new Phaser.Signal
            },
            t = {
                handleEventShared: function(t, e) {
                    if (t === i.InputDown) return a.inputDown.dispatch(), !1;
                    if (t === i.DragStart) return s.transitIfPossible(n.Dragging, e);
                    if (t === i.DragUpdate || t === i.DragStop) return s.isInState(n.Dragging);
                    return !1
                },
                handleEventExclusive: function(t, e) {
                    if (t === i.DragUpdate) return s.transitIfPossible(n.Dragging, e);
                    if (t === i.DragStop) return s.transitIfPossible(n.DragFinish, e);
                    return !1
                },
                cancelEvent: function(t) {
                    s.transitIfPossible(n.Cancel)
                },
                inputDownSignal: a.inputDown,
                dragStartSignal: a.start,
                dragUpdateSignal: a.update,
                dragStopSignal: a.stop,
                dragCancelSignal: a.cancel
            },
            n = {
                Idle: "idle",
                Dragging: "dragging",
                Cancel: "cancel",
                DragFinish: "confirm"
            },
            s = function() {
                var t = {};
                t[n.Idle] = [n.Dragging], t[n.Dragging] = [n.Dragging, n.Cancel, n.DragFinish], t[n.Cancel] = [n.Idle], t[n.DragFinish] = [n.Idle];
                var s = new e(n.Idle, t);
                return s.transitionSignal.add(function(t, e, i) {
                    switch (t) {
                        case n.Idle:
                            break;
                        case n.Dragging:
                            e === n.Idle ? a.start.dispatch(i) : e === n.Dragging && a.update.dispatch(i);
                            break;
                        case n.Cancel:
                            s.transit(n.Idle), a.cancel.dispatch(i);
                            break;
                        case n.DragFinish:
                            s.transit(n.Idle), a.stop.dispatch(i)
                    }
                }), s
            }();
        return t
    }, void 0 === G && (G = {}), G.Animations = G.Animations || {}, G.Animations.getBoxSmallJumpAnimation = function() {
        return {
            animate: function(t, e) {
                var i = t.add.tween(e).to({
                        y: e.y - 15
                    }, 150, Phaser.Easing.Cubic.Out),
                    s = t.add.tween(e).to({
                        y: e.y
                    }, 150, Phaser.Easing.Circular.In);
                i.chain(s), i.start();
                var a = t.add.tween(e).to({
                        angle: -3
                    }, 100, Phaser.Easing.Cubic.InOut),
                    n = t.add.tween(e).to({
                        angle: 3
                    }, 170, Phaser.Easing.Sinusoidal.In),
                    o = t.add.tween(e).to({
                        angle: 0
                    }, 30, Phaser.Easing.Cubic.InOut);
                a.chain(n, o), a.start()
            }
        }
    }, void 0 === G && (G = {}), G.Animations = G.Animations || {}, G.Animations.getClockPointersAnimation = function() {
        return {
            animate: function(t, e) {
                var o = Math.floor(12 * Math.random()) / 12,
                    r = G.Utils.find1stObjectWithName(e, "pointer1"),
                    h = G.Utils.find1stObjectWithName(e, "pointer2");
                t.add.tween(e).to(null, 144e3, Phaser.Easing.Linear.None, !0, 0, -1).onUpdateCallback(function(t, e) {
                    var i = 12 * e * 12,
                        s = Math.floor(i),
                        a = i - s,
                        n = (s + Phaser.Easing.Elastic.Out(Math.min(1, a / .33))) / 12 / 12;
                    r && (r.angle = 360 * (o + n));
                    h && (h.angle = 360 * (o + n) * 12)
                })
            }
        }
    }, void 0 === G && (G = {}), G.Animations = G.Animations || {}, G.Animations.getDoubleShineAnimation = function() {
        return {
            animate: function(t, e) {
                var i = G.Utils.find1stObjectWithName(e, "shine1"),
                    s = G.Utils.find1stObjectWithName(e, "shine2");
                i && (t.add.tween(i.scale).to({
                    x: 1.1,
                    y: 1.1
                }, 400, Phaser.Easing.Sinusoidal.InOut, !0, 0, -1, !0), t.add.tween(i).to({
                    angle: -360
                }, 2e4, Phaser.Easing.Linear.None, !0, 0, -1));
                s && (t.add.tween(s.scale).to({
                    x: 1.1,
                    y: 1.1
                }, 500, Phaser.Easing.Sinusoidal.InOut, !0, 0, -1, !0), t.add.tween(s).to({
                    angle: 360
                }, 15e3, Phaser.Easing.Linear.None, !0, 0, -1))
            }
        }
    }, void 0 === G && (G = {}), G.Animations = G.Animations || {}, G.Animations.getShineAnimation = function() {
        return {
            animate: function(t, e) {
                var i = G.Utils.find1stObjectWithName(e, "shine");
                i && t.add.tween(i).to({
                    angle: -360
                }, 2e4, Phaser.Easing.Linear.None, !0, 0, -1)
            }
        }
    }, void 0 === G && (G = {}), G.Animations = G.Animations || {}, G.Animations.getGameplayChestGiftRevealAnimation = function() {
        var i = new Phaser.Signal;
        return {
            animate: function(t, e) {
                e.scale.setTo(0), e.angle = -10, e.y = -10, t.add.tween(e.scale).to({
                    x: 1,
                    y: 1
                }, 600, Phaser.Easing.Bounce.Out, !0), t.add.tween(e).to({
                    y: -40
                }, 400, Phaser.Easing.Sinusoidal.InOut).to({
                    y: -35
                }, 1100, Phaser.Easing.Sinusoidal.Out).start(), t.add.tween(e).to({
                    angle: 10
                }, 1500, Phaser.Easing.Sinusoidal.InOut, !0).onComplete.add(i.dispatch, i)
            },
            onComplete: i
        }
    }, void 0 === G && (G = {}), G.Animations = G.Animations || {}, G.Animations.getGameplayChestTHGiftRevealAnimation = function() {
        var i = new Phaser.Signal;
        return {
            animate: function(t, e) {
                e.scale.setTo(0), e.alpha = 1, e.angle = -10, e.y = -20, t.add.tween(e.scale).to({
                    x: 1,
                    y: 1
                }, 600, Phaser.Easing.Bounce.Out, !0);
                t.add.tween(e).to({
                    y: -50
                }, 1200, Phaser.Easing.Sinusoidal.InOut, !0);
                t.add.tween(e).to({
                    angle: 10
                }, 1200, Phaser.Easing.Sinusoidal.InOut, !0).onComplete.add(function() {
                    e.scale.setTo(0), i.dispatch()
                })
            },
            onComplete: i
        }
    }, void 0 === G && (G = {}), G.Animations = G.Animations || {}, G.Animations.getGameplayChestOpenAnimation = function() {
        var r = new Phaser.Signal;
        return {
            animate: function(t, e) {
                var i = G.Utils.find1stObjectWithName(e, "base"),
                    s = G.Utils.find1stObjectWithName(e, "cover"),
                    a = G.Utils.find1stObjectWithName(e, "light");
                G.Utils.find1stObjectWithName(e, "gift");
                e.alpha = 1, t.add.tween(e).to({
                    y: e.y - 30
                }, 1500, Phaser.Easing.Sinusoidal.Out, !0), t.add.tween(e.scale).to({
                    x: 1.2,
                    y: 1.2
                }, 400, Phaser.Easing.Sinusoidal.Out, !0), t.add.tween(e).to({
                    alpha: 0
                }, 300, Phaser.Easing.Sinusoidal.Out, !0, 1200).onComplete.add(function() {
                    r.dispatch()
                }), i && i.changeTexture("chest_bottom");
                if (s) {
                    var n = 0;
                    s.changeTexture("chest_top_00");
                    var o = t.add.tween(s).to(null, 50, Phaser.Easing.Sinusoidal.In, !1, 0, 3);
                    o.onRepeat.add(function() {
                        n++, s.changeTexture("chest_top_0" + n)
                    }), o.start()
                }
                a && (a.angle = 0, a.alpha = 0, t.add.tween(a).to({
                    angle: -250
                }, 1500, Phaser.Easing.Linear.None, !0), t.add.tween(a).to({
                    alpha: .3
                }, 200, Phaser.Easing.Sinusoidal.Out, !0).onComplete.add(function() {
                    t.add.tween(a).to({
                        alpha: 0
                    }, 200, Phaser.Easing.Sinusoidal.Out, !0, 1300)
                }))
            },
            onComplete: r
        }
    }, void 0 === G && (G = {}), G.Animations = G.Animations || {}, G.Animations.getGameplayChestTHOpenAnimation = function() {
        var r = new Phaser.Signal;
        return {
            animate: function(t, e) {
                var i = G.Utils.find1stObjectWithName(e, "base"),
                    s = G.Utils.find1stObjectWithName(e, "cover"),
                    a = G.Utils.find1stObjectWithName(e, "light");
                G.Utils.find1stObjectWithName(e, "gift");
                e.alpha = 1, t.add.tween(e).to({
                    y: e.y - 30
                }, 1500, Phaser.Easing.Sinusoidal.Out, !0), t.add.tween(e.scale).to({
                    x: 1.2,
                    y: 1.2
                }, 400, Phaser.Easing.Sinusoidal.Out, !0), t.add.tween(e).to({
                    alpha: 0
                }, 300, Phaser.Easing.Sinusoidal.Out, !0, 1200).onComplete.add(function() {
                    r.dispatch()
                }), i && i.changeTexture("chest_th_bottom");
                if (s) {
                    var n = 0;
                    s.changeTexture("chest_th_top_00");
                    var o = t.add.tween(s).to(null, 50, Phaser.Easing.Sinusoidal.In, !1, 0, 2);
                    o.onRepeat.add(function() {
                        n++, s.changeTexture("chest_th_top_0" + n)
                    }), o.start()
                }
                a && (a.angle = 0, a.alpha = 0, t.add.tween(a).to({
                    angle: -250
                }, 1500, Phaser.Easing.Linear.None, !0), t.add.tween(a).to({
                    alpha: .3
                }, 200, Phaser.Easing.Sinusoidal.Out, !0).onComplete.add(function() {
                    t.add.tween(a).to({
                        alpha: 0
                    }, 200, Phaser.Easing.Sinusoidal.Out, !0, 1300)
                }))
            },
            onComplete: r
        }
    }, void 0 === G && (G = {}), G.Animations = G.Animations || {}, G.Animations.getTHFailGingyAnimationHide = function() {
        return {
            animate: function(t, e) {
                var i = G.Utils.find1stObjectWithName(e, "speakBubble"),
                    s = G.Utils.find1stObjectWithName(e, "gingyCharacter");
                s && t.add.tween(s).to({
                    y: 300
                }, 100, Phaser.Easing.Sinusoidal.In, !0, 100);
                i && t.add.tween(i.scale).to({
                    x: 0,
                    y: 0
                }, 100, Phaser.Easing.Sinusoidal.Out, !0)
            }
        }
    }, void 0 === G && (G = {}), G.Animations = G.Animations || {}, G.Animations.getTHFailGingyAnimationShow = function() {
        return {
            animate: function(t, e) {
                var i = G.Utils.find1stObjectWithName(e, "speakBubble"),
                    s = G.Utils.find1stObjectWithName(e, "gingyCharacter");
                s && t.add.tween(s).to({
                    y: 10
                }, 300, Phaser.Easing.Cubic.Out, !0);
                i && (i.scale.setTo(0), t.add.tween(i.scale).to({
                    x: 1,
                    y: 1
                }, 400, Phaser.Easing.Elastic.Out, !0, 200))
            }
        }
    }, void 0 === G && (G = {}), G.Animations = G.Animations || {}, G.Animations.getMysteryGiftHeaderHide = function() {
        var s = new Phaser.Signal;
        return {
            animate: function(t, e) {
                var i = G.Utils.find1stObjectWithName(e, "message");
                i && t.add.tween(i).to({
                    y: -200
                }, 200, Phaser.Easing.Sinusoidal.In, !0).onComplete.add(s.dispatch, s)
            },
            onComplete: s
        }
    }, void 0 === G && (G = {}), G.Animations = G.Animations || {}, G.Animations.getMysteryGiftHeaderShow = function() {
        return {
            animate: function(t, e) {
                var i = G.Utils.find1stObjectWithName(e, "message");
                i && (i.y = -200, t.add.tween(i).to({
                    y: 0
                }, 200, Phaser.Easing.Sinusoidal.Out, !0))
            }
        }
    }, void 0 === G && (G = {}), G.Animations = G.Animations || {}, G.Animations.getProgressBarOverlayAlphaAnimation = function(s) {
        new Phaser.Signal;
        return {
            animate: function(t, e) {
                var i = G.Utils.find1stObjectWithName(e, "barOverlay");
                i && (t.tweens.removeFrom(i), t.add.tween(i).to({
                    alpha: s
                }, 300, Phaser.Easing.Sinusoidal.Out, !0))
            }
        }
    }, void 0 === G && (G = {}), G.Animations = G.Animations || {}, G.Animations.getProgressionFlowPanelProgressionAnimation = function() {
        var o = new Phaser.Signal,
            r = new Phaser.Signal,
            h = new Phaser.Signal;
        return {
            animate: function(t, e) {
                var i = e.valueObj;
                if (!i) return h.dispatch();
                i.value;
                var s = i.valueTarget,
                    a = t.add.tween(e.valueObj).to({
                        value: s
                    }, 1e3, Phaser.Easing.Sinusoidal.Out, !1, 100);

                function n(t, e) {
                    r.dispatch(e)
                }
                a.onStart.add(o.dispatch, o), a.onComplete.add(function() {
                    n(null, 1), h.dispatch()
                }, h), a.onUpdateCallback(n), a.start()
            },
            onStart: o,
            onUpdate: r,
            onComplete: h
        }
    }, void 0 === G && (G = {}), G.Animations = G.Animations || {}, G.Animations.getTreasureHuntGemBounceAnimation = function() {
        var s = new Phaser.Signal;
        return {
            animate: function(t, e) {
                var i = G.Utils.find1stObjectWithName(e, "gem");
                i && t.add.tween(i.scale).to({
                    x: 1.1,
                    y: 1.1
                }, 50, Phaser.Easing.Bounce.Out, !0, 0, 0, !0).onComplete.add(s.dispatch, s)
            },
            onComplete: s
        }
    }, void 0 === G && (G = {}), G.Board = function(t, e, i) {
        Phaser.Group.call(this, game), this.state = game.state.getCurrentState(), this.onBoardDeconstructed = new Phaser.Signal, this.onActionQueueEmpty = new Phaser.Signal, this.MAX_NUMBER_OF_REGULAR_CANDY = G.lvlData.nrOfTypes, this.collectCells = t.collectCells || !1, this.tilesize = e, this.offsetX = 0, this.offsetY = 0, this.editorMode = i, this.borderSize = G.l(8), this.tweenObj = {
            a: .6
        }, game.add.tween(this.tweenObj).to({
            a: 1
        }, 500, Phaser.Easing.Sinusoidal.InOut, !0, 0, -1, !0), this.levelData = new G.GridArray(t.levelData), this.boardData = new G.GridArray(this.levelData.width, this.levelData.height), this.checkMatchList = [], this.checkSpecialMatchList = [], this.checkAfterFall = [], this.fallCheckList = [], this.duringAnimation = 0, this.duringFall = 0, G.sb("onCandyFallStart").add(function() {
            this.duringFall++
        }, this), G.sb("onCandyFallFinish").add(function(t) {
            this.duringFall--, -1 == this.fallCheckList.indexOf(t) && this.fallCheckList.push(t)
        }, this), G.sb("onCandyAnimationStart").add(function() {
            this.duringAnimation++
        }, this), G.sb("onCandyAnimationFinish").add(function() {
            this.duringAnimation--
        }, this), G.sb("onScreenResize").add(this.onResize, this), this.matcher = new G.BoardMatcher(this), this.boardBackground = new G.BoardBackground(this), this.background = game.make.image(0, 0, this.boardBackground.renderTexture), this.background.x = -this.tilesize, this.background.y = -this.tilesize, this.add(this.background), this.tileShade = G.makeImage(0, 0, "tile_shade", .5, this), this.tileShade.visible = !1, this.boardDirt = new G.BoardDirt(this), this.boardDirtS = new G.BoardDirtS(this), this.candySelection = new G.CandySelection(this), this.boardCandies = new G.BoardCandies(this, this.boardData, t), this.boardJam = new G.BoardJam(this), this.boardIce = new G.BoardIce(this), this.boardIce.alpha = .8, this.boardCage = new G.BoardConcrete(this), this.boardCandies.secondFloor.parent.bringToTop(this.boardCandies.secondFloor), this.boardCandies.fxGroup.parent.bringToTop(this.boardCandies.fxGroup), this.boardCandies.boosterFxGroup.parent.bringToTop(this.boardCandies.boosterFxGroup), this.boardCandies.thirdFloor.parent.bringToTop(this.boardCandies.thirdFloor), this.boardCandies.fxTopGroup.parent.bringToTop(this.boardCandies.fxTopGroup), this.layers = [this.boardDirt, this.boardDirtS, this.boardCandies, this.boardJam, this.boardCage, this.boardIce], this.layersNoCandies = [this.boardDirt, this.boardDirtS, this.boardJam, this.boardCage, this.boardIce], this.inputController = new G.InputController(this), this.actionManager = new G.BoardActionManager(this), this.actionManager.onActionQueueEmpty.add(function() {
            this.onActionQueueEmpty.dispatch()
        }, this), this.refiller = new G.Refiller(t, this), this.fallMgr = new G.BoardFallMgr(this, this.refiller), this.goalCandies = G.json.specialCandies.goalCandies, this.import(this.levelData), this.boardBackground.redraw(), this.lastRowInCollumn = this.getLastRowInCollumn(), this.onResize()
    }, G.Board.prototype = Object.create(Phaser.Group.prototype), G.Board.prototype.getLastRowInCollumn = function() {
        for (var t = [], e = 0; e < this.boardData.width; e++) t.push(this.getLastCellInCollumn(e));
        return t
    }, G.Board.prototype.pushToFallCheckList = function(t) {
        !1 !== t && -1 == this.fallCheckList.indexOf(t) && this.fallCheckList.push(t)
    }, G.Board.prototype.onResize = function() {
        this.center()
    }, G.Board.prototype.destroyBoard = function() {
        this.boardDirt.destroy(), this.boardCandies.destroy(), this.boardCage.destroy(), this.boardIce.destroy(), this.destroy()
    }, G.Board.prototype.clearBoard = function() {
        this.boardData.loop(function(t, e, i) {
            this.boardCandies.goalCandies = [], this.boardCandies.rabbitCandy = !1;
            var s = this.boardCandies.getCandy(e, i);
            s && this.boardCandies.removeCandy(s), this.boardIce.destroyCell(e, i), this.boardDirt.destroyCell(e, i)
        }, this)
    }, G.Board.prototype.center = function() {
        var t = this.tilesize * this.boardData.width,
            e = this.tilesize * this.boardData.height,
            i = Math.min(1, 640 / t),
            s = Math.min(1, (game.height - 220 - 150) / e),
            a = Math.min(i, s);
        this.scale.setTo(a), this.x = G.l(320) - t * a * .5, this.y = G.l(220) + .5 * (game.height - 220 - 150 - e * a)
    }, G.Board.prototype.update = function() {
        this.actionManager.update()
    }, G.Board.prototype.isIdle = function() {
        return 0 === this.actionManager.actionList.length
    }, G.Board.prototype.checkGoalCandy = function() {
        for (var t = !1, e = 0; e < this.boardData.width; e++) {
            var i = this.getCandy(e, this.lastRowInCollumn[e]);
            if (i && -1 !== this.goalCandies.indexOf(i.candyType)) {
                var s = !0;
                this.collectCells && (this.isCandyOnCollectCell(i) || (s = !1)), s && (this.boardCandies.removeCandy(e, this.lastRowInCollumn[e]), G.sfx.xylophone_positive6.play(), t = !0)
            }
        }
        if (t) return this.actionManager.newAction("processFall"), !0
    }, G.Board.prototype.isCandyOnCollectCell = function(e) {
        if (this.collectCells && this.collectCells.find(function(t) {
                return t.x === e.cellX && t.y === e.cellY
            })) return !0;
        return !1
    }, G.Board.prototype.makeMove = function(t, e, i) {
        this.actionManager.newAction("move", t, e, i)
    }, G.Board.prototype.hitCell = function(t, e) {
        for (var i = this.layers.length; i--;)
            if (!this.layers[i].onHit(t, e)) return
    }, G.Board.prototype.isMoveable = function(t, e, i) {
        return "number" != typeof t && (e = t[1], t = t[0]), !!this.isCellOnBoard(t, e) && (!this.isMoveBlocked(t, e) && !!this.getCandy(t, e))
    }, G.Board.prototype.isMoveBlocked = function(t, e) {
        for (var i = this.layers.length; i--;)
            if (this.layers[i].isMoveBlocked(t, e)) return !0;
        return !1
    }, G.Board.prototype.isBoosterChangeBlocked = function(t, e) {
        for (var i = this.layers.length; i--;)
            if (this.layers[i].isBoosterChangeBlocked(t, e)) return !0;
        return !1
    }, G.Board.prototype.isMatchBlocked = function(t, e) {
        for (var i = this.layers.length; i--;)
            if (this.layers[i].isMatchBlocked(t, e)) return !0;
        return !1
    }, G.Board.prototype.matchCellExceptCandy = function(t, e) {
        for (var i = this.layersNoCandies.length; i--;)
            if (!this.layersNoCandies[i].onMatch(t, e)) return
    }, G.Board.prototype.getLastCellInCollumn = function(t) {
        for (var e = this.boardData.height - 1; 0 <= e; e--)
            if (this.isCellOnBoard(t, e)) return e
    }, G.Board.prototype.matchCell = function(t, e, i, s, a) {
        for (var n = this.layers.length; n--;)
            if (!this.layers[n].onMatch(t, e, i, s, a)) return void console.log("** stopped propagation")
    }, G.Board.prototype.isCellInBoardArea = function(t, e) {
        return t < this.boardData.width && 0 <= t && 0 <= e && e < this.boardData.height
    }, G.Board.prototype.isCellMatchable = function(t, e, i) {
        if ("number" != typeof t && (e = t[1], t = t[0]), !this.isCellOnBoard(t, e)) return !1;
        if (this.isMatchBlocked(t, e)) return !1;
        var s = this.getCandy(t, e);
        return !!s && (!i || s.candyType == i)
    }, G.Board.prototype.isCellMatchable = function(t, e, i) {
        if ("number" != typeof t && (e = t[1], t = t[0]), !this.isCellOnBoard(t, e)) return !1;
        if (this.boardIce.isToken(t, e)) return !1;
        if (this.isMatchBlocked(t, e)) return !1;
        var s = this.getCandy(t, e);
        return !!s && (!!s.matchable && (!s.falling && (!s.goalCandy && (!s.chocolate && (!i || this.getCandy(t, e).candyType == i)))))
    }, G.Board.prototype.isCellOnBoard = function(t, e) {
        return "boolean" != typeof t && ("number" != typeof t && (e = t[1], t = t[0]), !(t < 0 || t >= this.boardData.width || e < 0 || e >= this.boardData.height) && "X" != this.boardData.get(t, e))
    }, G.Board.prototype.getCandy = function(t, e) {
        return "number" != typeof t ? this.boardCandies.getCandy(t[0], t[1]) : this.boardCandies.getCandy(t, e)
    }, G.Board.prototype.cellToPxOut = function(t) {
        var e = this.tilesize * this.scale.x;
        return [this.x + this.offsetX + e * t[0] + .5 * e, this.y + this.offsetY + e * t[1] + .5 * e]
    }, G.Board.prototype.pxInToCellX = function(t) {
        return Math.floor(t / this.tilesize)
    }, G.Board.prototype.pxInToCellY = function(t) {
        return Math.floor(t / this.tilesize)
    }, G.Board.prototype.cellXToPxIn = function(t) {
        return t * this.tilesize + .5 * this.tilesize
    }, G.Board.prototype.cellYToPxIn = function(t) {
        return t * this.tilesize + .5 * this.tilesize
    }, G.Board.prototype.cellToPxIn = function(t) {
        return [this.cellXToPxIn(t[0]), this.cellYToPxIn(t[1])]
    }, G.Board.prototype.swapCandies = function(t, e) {
        this.boardCandies.swapCandies(t, e)
    }, G.Board.prototype.removeCandy = function() {
        this.boardCandies.removeCandy.apply(this.boardCandies, arguments)
    }, G.Board.prototype.newFallingCandy = function(t, e, i, s) {
        var a = this.boardCandies.newCandy(t, e, i);
        a.y = this.cellYToPxIn(s), a.fallTo(t, e), a.alpha = 0
    }, G.Board.prototype.export = function() {
        var t = new G.GridArray(this.boardData.width, this.boardData.height);
        return t.loop(function(t, i, s, e) {
            var a = [];
            "X" == this.boardData.get(i, s) && a.push("X"), this.layers.forEach(function(t) {
                var e = t.export(i, s);
                e && a.push(e)
            }), e[i][s] = a
        }, this), JSON.stringify(t.data)
    }, G.Board.prototype.import = function(t) {
        t.loop(function(i, s, a) {
            for (var n = 0, t = i.length; n < t; n++)
                if (i[n] = i[n].toString(), "W" == i[n][0] && (i[n] = i[n][1] + ":" + i[n][0]), "r" !== i[n][0] || this.editorMode || (i[n] = this.getRandomThatDoesntMatch(s, a) + i[n].substr(1)), "X" == i[n]) this.boardData.set(s, a, "X");
                else {
                    var o = !1;
                    this.layersNoCandies.forEach(function(t) {
                        var e = t.import(s, a, i[n]);
                        !o && e && (o = !0)
                    }), o || this.boardCandies.import(s, a, i[n])
                }
        }, this), 0 == this.matcher.checkPossibleMoves().length && this.shuffleCandies(!0), this.possibleMoves = this.matcher.checkPossibleMoves()
    }, G.Board.prototype.makePossibleMatch = function() {
        for (var t, e, i, s = this.boardData.width, a = this.boardData.height, n = [
                [1, 0, 1, -1, 1, 1],
                [-1, 0, -1, -1, -1, 1],
                [0, -1, -1, -1, 1, -1],
                [0, 1, -1, 1, 1, 1]
            ];;)
            if (t = Math.floor(Math.random() * s), e = Math.floor(Math.random() * a), i = n[Math.floor(Math.random() * n.length)], this.isMoveable(t, e) && this.isCellMatchable(t, e) && this.isMoveable(t + i[0], e + i[1]) && this.isCellMatchable(t + i[2], e + i[3]) && this.isCellMatchable(t + i[4], e + i[5])) {
                var o = this.getCandy(t, e),
                    r = this.getCandy(t + i[2], e + i[3]),
                    h = r.candyType,
                    l = this.getCandy(t + i[4], e + i[5]),
                    d = l.candyType;
                if (!o.goalCandy && !r.goalCandy && !l.goalCandy) {
                    if (r.candyType = o.candyType, l.candyType = o.candyType, !this.matcher.quickMatchCheck(r) && !this.matcher.quickMatchCheck(l)) {
                        G.changeTexture(r, o.frameName), G.changeTexture(l, o.frameName);
                        break
                    }
                    r.candyType = h, l.candyType = d
                }
            }
    }, G.Board.prototype.getRandomThatDoesntMatch = function(t, e) {
        for (var i = game.rnd.between(1, this.MAX_NUMBER_OF_REGULAR_CANDY), s = 0; s < this.MAX_NUMBER_OF_REGULAR_CANDY; s++) {
            if (!(this.isCellMatchable(t - 2, e, i) && this.isCellMatchable(t - 1, e, i) || this.isCellMatchable(t, e - 2, i) && this.isCellMatchable(t, e - 1, i) || this.isCellMatchable(t - 1, e, i) && this.isCellMatchable(t - 1, e - 1, i) && this.isCellMatchable(t, e - 1, i))) return i;
            i = (i + 1) % this.MAX_NUMBER_OF_REGULAR_CANDY
        }
        return i
    }, G.Board.prototype.shuffleFailure = function() {
        for (var t = 0; t < 24; t++) this.removeCandy(t % 8, Math.floor(t / 8));
        for (t = 0; t < 24; t++) this.boardCandies.newCandy(t % 8, Math.floor(t / 8), game.rnd.between(1, 3).toString())
    }, G.Board.prototype.shuffleCandies = function(r) {
        for (var h = this.boardData.width, l = this.boardData.height, t = 0; 20 < ++t && this.shuffleFailure(), this.boardCandies.grid.loop(function(t, e, i, s) {
                if (t && this.isMoveable(e, i) && !t.goalCandy) {
                    for (var a, n, o; a = game.rnd.between(0, h - 1), n = game.rnd.between(0, l - 1), e == a && n == i || (o = s[a][n], !this.isMoveable(a, n) || o.goalCandy););
                    r || G.IMMEDIATE ? this.swapCandiesWithPosition(t, o) : this.swapCandies(t, o)
                }
            }, this), 0 == this.matcher.checkPossibleMoves().length;);
        G.sfx.whoosh_short_1.play(), this.boardCandies.grid.loop(function(t, e, i) {
            t && (!r && this.isMoveable(e, i) && t.shuffleMoveToOwnCell(), this.isCellMatchable(e, i) && this.matcher.quickMatchCheck(t) && this.checkMatchList.push(t))
        }, this), 0 < this.checkMatchList.length && this.actionManager.newAction("processMatch")
    }, G.Board.prototype.swapCandiesWithPosition = function(t, e) {
        this.boardCandies.grid.set(t.cellX, t.cellY, e), this.boardCandies.grid.set(e.cellX, e.cellY, t);
        var i = t.cellX,
            s = t.cellY,
            a = t.x,
            n = t.y;
        t.x = e.x, t.y = e.y, t.cellX = e.cellX, t.cellY = e.cellY, e.x = a, e.y = n, e.cellX = i, e.cellY = s
    }, G.Board.prototype.deconstruct = function() {
        this.deconstructing = !0, this.background.x += .5 * this.background.width, this.background.y += .5 * this.background.height, this.background.anchor.setTo(.5), this.glowImg = G.makeImage(0, 0, "popup_lighht", .5, this), this.glowImg.x = this.background.x, this.glowImg.y = this.background.y, this.glowImg.blendMode = 1, game.add.tween(this.glowImg).to({
            angle: 360
        }, 6e3, Phaser.Easing.Linear.None, !0), this.glowImg.alpha = 0, this.wellDoneTxt = game.add.image(0, 0, "shoutouts", "well_done"), this.wellDoneTxt.anchor.setTo(.5), this.add(this.wellDoneTxt), this.wellDoneTxt.x = this.background.x, this.wellDoneTxt.y = this.background.y, this.wellDoneTxt.visible = !1, game.add.tween(this.boardDirt).to({
            alpha: 0
        }, 200, Phaser.Easing.Sinusoidal.In, !0), game.add.tween(this.boardIce).to({
            alpha: 0
        }, 200, Phaser.Easing.Sinusoidal.In, !0), game.add.tween(this.boardCage).to({
            alpha: 0
        }, 200, Phaser.Easing.Sinusoidal.In, !0), game.add.tween(this.boardDirtS).to({
            alpha: 0
        }, 200, Phaser.Easing.Sinusoidal.In, !0), game.add.tween(this.boardJam).to({
            alpha: 0
        }, 200, Phaser.Easing.Sinusoidal.In, !0), game.time.events.add(200, this.boardCandies.deconstruct, this.boardCandies), game.time.events.add(900, function() {
            game.add.tween(this.background.scale).to({
                x: 0,
                y: 0
            }, 500, Phaser.Easing.Sinusoidal.InOut, !0), game.add.tween(this.background).to({
                angle: 70
            }, 500, Phaser.Easing.Sinusoidal.InOut, !0)
        }, this), game.time.events.add(900, function() {
            game.add.tween(this.glowImg).to({
                alpha: .2
            }, 300, Phaser.Easing.Sinusoidal.Out, !0), this.wellDoneTxt.visible = !0, this.wellDoneTxt.scale.setTo(0), game.add.tween(this.wellDoneTxt.scale).to({
                x: 1,
                y: 1
            }, 500, Phaser.Easing.Elastic.Out, !0)
        }, this), game.time.events.add(2200, function() {
            game.add.tween(this.glowImg).to({
                alpha: 0
            }, 300, Phaser.Easing.Sinusoidal.Out, !0), game.add.tween(this.wellDoneTxt).to({
                alpha: 0
            }, 300, Phaser.Easing.Sinusoidal.Out, !0), this.onBoardDeconstructed.dispatch()
        }, this)
    }, G.BoardActionManager = function(t) {
        this.board = t, this.onActionQueueEmpty = new Phaser.Signal, this.state = game.state.getCurrentState(), this.actionList = [], this.noAction = !0, this.madeMove = !1, G.sb("madeMove").add(function() {
            this.madeMove = !0
        }, this), this.availableActions = {
            move: G.ActionMove,
            processMatch: G.ActionProcessMatch,
            processFall: G.ActionProcessFall,
            boosterMatch: G.ActionBoosterMatch,
            boosterSwap: G.ActionBoosterSwap,
            shuffle: G.ActionShuffle,
            startBoosterInit: G.ActionStartBoosters
        }, G.sb("onBoosterSelect").add(function(t) {
            1 == t ? this.newAction("boosterSwap") : this.newAction("boosterMatch", t)
        }, this), G.sb("onBoosterDeselect").add(function() {
            1 == this.actionList.length && this.actionList[0].finish()
        }, this), this.noActionFrames = 0, this.shakingCandies = []
    }, G.BoardActionManager.prototype.update = function() {
        0 == this.actionList.length ? (this.noAction = !0, this.noActionFrames++, 160 < this.noActionFrames && (this.noActionFrames = 0, this.glowPossibleMoves()), this.updateShakes()) : (this.noActionFrames = 0, this.noAction = !1, this.actionList[0].update())
    }, G.BoardActionManager.prototype.normalCandies = ["0", "1", "2", "3", "4", "5", "6"], G.BoardActionManager.prototype.updateShakes = function() {
        for (var t = this.shakingCandies.length; t--;) {
            var e = this.shakingCandies[t],
                i = e.candy;
            e.dt += .04, i.x = e.orgX + Math.sin(e.dt * (4 * Math.PI)) * e.wave, 1 <= e.dt && (i.x = e.orgX, i.y = e.orgY, this.shakingCandies.pop())
        }
    }, G.BoardActionManager.prototype.breakShakes = function() {
        this.shakingCandies.forEach(function(t) {
            t.candy.x = t.orgX, t.candy.y = t.orgY
        }), this.shakingCandies = []
    }, G.BoardActionManager.prototype.glowPossibleMoves = function() {
        if (!G.tutorialOpened) {
            var t = this.board.matcher.checkPossibleMoves();
            if (Phaser.ArrayUtils.shuffle(t), 0 != t.length) {
                var e = t[0];
                this.shakeCandy(this.board.getCandy(e[0], e[1])), this.shakeCandy(this.board.getCandy(e[2], e[3]))
            }
        }
    }, G.BoardActionManager.prototype.shakeCandy = function(t) {
        this.shakingCandies.push({
            candy: t,
            orgX: t.x,
            orgY: t.y,
            dt: 0,
            wave: G.l(5)
        })
    }, G.BoardActionManager.prototype.newAction = function(t) {
        this.breakShakes();
        var e = [].slice.call(arguments, 1);
        this.actionList.push(new this.availableActions[t](this.board, this, e))
    }, G.BoardActionManager.prototype.removeAction = function(t) {
        var e = this.actionList.indexOf(t);
        if (-1 != e ? this.actionList.splice(e, 1) : this.actionList.splice(0, 1), 0 == this.actionList.length) {
            if (G.lvl.endCombo(), G.lvl.goalAchieved) {
                if (0 < G.lvl.moves) {
                    var i = this.board.boardCandies.getNormalCandies();
                    Phaser.ArrayUtils.shuffle(i);
                    for (var s = Math.min(G.lvl.moves, i.length, 15), a = 0; a < s; a++) {
                        var n = i[a];
                        n.changeInto(Math.random() < .5 ? "horizontal" : "vertical"), n.activatedByMove = !0, G.lvl.changePointsNumber(G.json.settings.pointsForMoveLeft);
                        var o = G.lvl.state.board.cellToPxOut([n.cellX, n.cellY]);
                        G.sb("displayPoints").dispatch(o[0], o[1], G.json.settings.pointsForMoveLeft), G.lvl.madeMove(), this.board.checkSpecialMatchList.push(n)
                    }
                    return G.sfx.booster.play(), void game.time.events.add(800, function() {
                        this.newAction("processMatch")
                    }, this)
                }
                var r = this.board.boardCandies.getAllSpecialCandies();
                if (!(0 < r.length)) return "CHALLENGE" == this.state.mode && (G.saveState.data.dailyBeaten || (G.saveState.data.dailyBeaten = 0), G.saveState.data.dailyBeaten++), this.board.deconstruct();
                r.forEach(function(t) {
                    t.activatedByMove = !0, this.board.checkSpecialMatchList.push(t)
                }, this), G.IMMEDIATE ? this.newAction("processMatch") : game.time.events.add(G.IMMEDIATE ? 1 : 300, function() {
                    this.newAction("processMatch")
                }, this)
            }
            if (this.board.possibleMoves = this.possibleMoves = this.board.matcher.checkPossibleMoves(), 0 == this.possibleMoves.length) return this.newAction("shuffle");
            this.onActionQueueEmpty.dispatch(), G.sb("actionQueueEmpty").dispatch(), this.madeMove && (this.madeMove = !1, G.sb("actionQueueEmptyAfterMove").dispatch())
        }
    }, G.BoardBackground = function(t) {
        Phaser.Group.call(this, game), this.board = t, this.borderSize = G.l(8), this.renderTexture = game.add.renderTexture(1, 1), this.markerImg = game.make.image(), this.markerImg.anchor.setTo(.5)
    }, G.BoardBackground.prototype = Object.create(Phaser.Group.prototype), G.BoardBackground.prototype.redraw = function() {
        this.renderTexture.resize((this.board.boardData.width + 2) * this.board.tilesize, (this.board.boardData.height + 2) * this.board.tilesize, !0), this.renderTexture.clear(), this.drawBg()
    }, G.BoardBackground.prototype.drawBg = function() {
        this.board.tilesize;
        for (var t = -1; t < this.board.boardData.width + 1; t++)
            for (var e = -1; e < this.board.boardData.height + 1; e++) {
                var i = this.checkIfTile(t, e),
                    s = this.checkIfTile(t, e - 1),
                    a = this.checkIfTile(t, e + 1),
                    n = this.checkIfTile(t - 1, e),
                    o = this.checkIfTile(t + 1, e),
                    r = this.checkIfTile(t + 1, e - 1),
                    h = this.checkIfTile(t - 1, e - 1),
                    l = this.checkIfTile(t + 1, e + 1),
                    d = this.checkIfTile(t - 1, e + 1);
                i ? this.drawSprite(t, e, "tile_" + (1 + (t % 2 + e % 2) % 2), 0) : (s && this.drawSprite(t, e, "tile_border_straight", 180), a && this.drawSprite(t, e, "tile_border_straight", 0), n && this.drawSprite(t, e, "tile_border_straight", 90), o && this.drawSprite(t, e, "tile_border_straight", 270), !l || o || a || this.drawSprite(t, e, "tile_border_outside_corner", 0), !d || n || a || this.drawSprite(t, e, "tile_border_outside_corner", 90), !r || o || s || this.drawSprite(t, e, "tile_border_outside_corner", 270), !h || n || s || this.drawSprite(t, e, "tile_border_outside_corner", 180), a && o && this.drawSprite(t, e, "tile_border_inside_corner", 0), a && n && this.drawSprite(t, e, "tile_border_inside_corner", 90), s && o && this.drawSprite(t, e, "tile_border_inside_corner", 270), s && n && this.drawSprite(t, e, "tile_border_inside_corner", 180))
            }
    }, G.BoardBackground.prototype.drawSprite = function(t, e, i, s) {
        var a = t * this.board.tilesize,
            n = e * this.board.tilesize;
        this.markerImg.angle = s || 0, G.changeTexture(this.markerImg, i), this.markerImg.updateTransform(), this.renderTexture.renderXY(this.markerImg, a + 1.5 * this.board.tilesize, n + 1.5 * this.board.tilesize)
    }, G.BoardBackground.prototype.checkIfTile = function(t, e) {
        var i = this.board.boardData.get(t, e);
        return !1 !== i && "X" !== i
    }, G.BoardCandies = function(t, e) {
        Phaser.Group.call(this, game), this.board = t, this.position = t.position, this.scale = t.scale, this.boardData = e, this.grid = new G.GridArray(this.boardData.width, this.boardData.height, !1), this.deadGroup = game.add.group(), this.deadGroup.visible = !1, this.firstFloor = game.add.group(), this.secondFloor = game.add.group(), this.collectCells = t.collectCells, this.boardCollectCells = new G.BoardCollectCells(t, this.collectCells), this.boardCollectCells.pivot.y = 2, game.add.tween(this.boardCollectCells.pivot).to({
            y: -4
        }, 600, Phaser.Easing.Sinusoidal.InOut, !0, 0, -1, !0), t.boardCollectCells = this.boardCollectCells, this.fxGroup = new G.TopFxLayer(this.board), this.boosterFxGroup = game.add.group(), this.thirdFloor = game.add.group(), this.fxTopGroup = this.fxGroup.aboveThirdFloorLayer = game.add.group(), G.IMMEDIATE && (this.deadGroup.visible = this.firstFloor.visible = this.secondFloor.visible = this.fxGroup.visible = this.thirdFloor.visible = this.fxTopGroup.visible = !1), this.firstFloor.position = this.secondFloor.position = this.fxGroup.position = this.fxTopGroup.position = this.boosterFxGroup.position = this.thirdFloor.position = this.position, this.firstFloor.scale = this.secondFloor.scale = this.fxGroup.scale = this.fxTopGroup.scale = this.boosterFxGroup.scale = this.thirdFloor.scale = this.scale, this.infectionSources = [], this.infectionSuperSources = [], this.infectionCoords = [
            [-1, 0],
            [1, 0],
            [0, -1],
            [0, -1],
            [-1, -1],
            [-1, -1],
            [1, -1],
            [1, 1]
        ], G.sb("onCandyInfect").add(function(t) {
            this.addInfectionSource(t, this.infectionSources)
        }, this), G.sb("onCandyInfectionRemove").add(function(t) {
            this.removeInfectionSource(t, this.infectionSources)
        }, this), this.removedInfectionSource = !1, this.infectionToMakeStep = 0, G.sb("actionQueueEmptyAfterMove").add(function() {
            this.removedInfectionSource || 0 < this.infectionSuperSources.length && (this.spreadInfection(this.infectionSuperSources) || this.spreadInfection(this.infectionSources));
            this.removedInfectionSource = !1
        }, this)
    }, G.BoardCandies.prototype = Object.create(Phaser.Group.prototype), G.BoardCandies.prototype.onMatch = function(t, e, i, s, a) {
        var n = this.getCandy(t, e);
        return n && n.match(i, s, a), !0
    }, G.BoardCandies.prototype.onHit = function(t, e) {
        var i = this.getCandy(t, e);
        return i && i.hit(), !0
    }, G.BoardCandies.prototype.isMoveBlocked = function(t, e) {
        return !1
    }, G.BoardCandies.prototype.isMatchBlocked = function(t, e) {
        var i = this.getCandy(t, e);
        return !!i && (!i.matchable || i.falling || i.goalCandy || i.chocolate)
    }, G.BoardCandies.prototype.isBoosterChangeBlocked = function(t, e) {
        var i = this.getCandy(t, e);
        return !!i && (i.special || i.wrapped || i.infected)
    }, G.BoardCandies.prototype.import = function(t, e, i) {
        var s = i.indexOf(":");
        s = -1 == s ? i.length : s;
        var a = this.newCandy(t, e, i.slice(0, s)),
            n = i.slice(s); - 1 !== n.indexOf("W") && a.wrap(), -1 !== n.indexOf("B") && a.changeIntoBlocker(n[2]), -1 !== n.indexOf("I") && a.infect(), -1 !== n.indexOf("H") && a.changeInto("horizontal", !0), -1 !== n.indexOf("V") && a.changeInto("vertical", !0), -1 !== n.indexOf("S") && a.changeInto("spiral", !0), -1 !== n.indexOf("C") && a.changeInto("cross", !0)
    }, G.BoardCandies.prototype.export = function(t, e) {
        var i = this.getCandy(t, e);
        return !(!i || i.blocker) && (i.wrapped ? "W" + i.candyType : i.chocolate ? "c" + i.hp : i.candyType)
    }, G.BoardCandies.prototype.spreadInfection = function(t) {
        if (0 != t.length) {
            Phaser.ArrayUtils.shuffle(t);
            for (var e = game.rnd.pick(t), i = 0, s = this.infectionCoords.length; i < s; i++) {
                var a = this.infectionCoords[i],
                    n = e.cellX + a[0],
                    o = e.cellY + a[1],
                    r = this.getCandy(n, o);
                if (r && (this.board.isMoveable(n, o) && this.board.isCellMatchable(n, o) && !r.wrapped && !r.infected && !r.special)) return r.infect(), !0
            }
            return !1
        }
    }, G.BoardCandies.prototype.getRandom = function() {
        var t, e = this.firstFloor.children.concat(this.secondFloor.children),
            i = e.length,
            s = game.rnd.between(0, i);
        if (0 == i) return !1;
        for (var a = 0; a < i; a++)
            if (t = e[(a + s) % i], this.grid.get(t.cellX, t.cellY) == t && t && t.alive && !t.goalCandy && this.board.isCellMatchable(t.cellX, t.cellY)) return t;
        return !1
    }, G.BoardCandies.prototype.getRandomNormal = function() {
        var t, e = this.firstFloor.children.concat(this.secondFloor.children),
            i = e.length,
            s = game.rnd.between(0, i);
        if (0 == i) return !1;
        for (var a = 0; a < i; a++)
            if (t = e[(a + s) % i], this.grid.get(t.cellX, t.cellY) == t && t && !t.special && !t.chocolate && !t.wrapped && t.alive && !t.goalCandy && this.board.isCellMatchable(t.cellX, t.cellY) && this.board.isMoveable(t.cellX, t.cellY)) return t;
        return !1
    }, G.BoardCandies.prototype.getNormalCandies = function() {
        var t, e = this.firstFloor.children.concat(this.secondFloor.children),
            i = e.length,
            s = game.rnd.between(0, i),
            a = [];
        if (0 == i) return !1;
        for (var n = 0; n < i; n++) t = e[(n + s) % i], this.grid.get(t.cellX, t.cellY) == t && t && !t.special && !t.chocolate && !t.wrapped && t.alive && !t.goalCandy && this.board.isCellMatchable(t.cellX, t.cellY) && this.board.isMoveable(t.cellX, t.cellY) && "chest" !== t.candyType && "chest_th" !== t.candyType && a.push(t);
        return a
    }, G.BoardCandies.prototype.moveTo = function(t, e) {
        this.x = t, this.y = e
    }, G.BoardCandies.prototype.isSpaceFree = function(t, e) {
        return !this.grid.get(t, e)
    }, G.BoardCandies.prototype.gridMoveFromTo = function(t, e, i, s) {
        this.grid.set(i, s, this.grid.get(t, e)), this.grid.set(t, e, null)
    }, G.BoardCandies.prototype.newCandy = function(t, e, i) {
        var s = this.deadGroup.children[0] ? this.deadGroup.children[0] : new G.Candy(this.board, this.grid);
        return this.firstFloor.add(s), void 0 !== i && i.indexOf && -1 !== i.indexOf("CHAIN") ? (s.init(t, e, i.slice(-1)), s.wrap()) : s.init(t, e, i || game.rnd.between(1, this.board.MAX_NUMBER_OF_REGULAR_CANDY)), this.grid.set(t, e, s), "infection" == i && (s.matchable = !1, this.addInfectionSource(s, this.infectionSuperSources)), "chest" != i && "chest_th" != i || (s.matchable = !1), s
    }, G.BoardCandies.prototype.getCandy = function(t, e) {
        return this.grid.get(t, e)
    }, G.BoardCandies.prototype.swapCandies = function(t, e) {
        this.grid.set(t.cellX, t.cellY, e), this.grid.set(e.cellX, e.cellY, t);
        var i = t.cellX,
            s = t.cellY;
        t.cellX = e.cellX, t.cellY = e.cellY, e.cellX = i, e.cellY = s
    }, G.BoardCandies.prototype.removeCandy = function() {
        var t, e = !1;
        "object" == typeof arguments[0] ? (t = Array.isArray(arguments[0]) ? this.getCandy(arguments[0][0], arguments[0][1]) : arguments[0], e = arguments[1]) : (t = this.getCandy(arguments[0], arguments[1]), e = arguments[2]), t && (this.removeInfectionSource(t, this.infectionSuperSources), this.grid.set(t.cellX, t.cellY, !1), e || G.sb("onCollectableRemove").dispatch(t.candyType, !t.specialType && t), t.kill(), this.deadGroup.add(t))
    }, G.BoardCandies.prototype.removeToken = G.BoardCandies.prototype.removeCandy, G.BoardCandies.prototype.destroyCell = G.BoardCandies.prototype.removeCandy, G.BoardCandies.prototype.addInfectionSource = function(t, e) {
        -1 === e.indexOf(t) && e.push(t)
    }, G.BoardCandies.prototype.removeInfectionSource = function(t, e) {
        var i = e.indexOf(t); - 1 !== i && (e.splice(i, 1), this.removedInfectionSource = !0)
    }, G.BoardCandies.prototype.consoleInfectionSources = function() {
        for (var t = 0; t < this.infectionSources.length; t++) console.log("INFECTION SOURCE: " + this.infectionSources[t].cellX + "x" + this.infectionSources[t].cellY)
    }, G.BoardCandies.prototype.getAllSpecialCandies = function() {
        var s = [];
        return this.grid.loop(function(t, e, i) {
            t && t.special && s.push(t)
        }), s
    }, G.BoardCandies.prototype.deconstruct = function() {
        for (var t = 0, e = 0; e <= 20; e++) {
            for (var i = 0, s = e; 0 <= s; s--) this.grid.get(i, s) && (t1 = game.add.tween(this.grid.get(i, s).scale).to({
                x: 0,
                y: 0
            }, 300, Phaser.Easing.Sinusoidal.InOut, !0, t)), i++;
            t += 40
        }
    }, G.BoardCandies.prototype.areCandiesNeighbours = function(t, e) {
        return !(!t || !e) && Math.abs(t.cellX - e.cellX) + Math.abs(t.cellY - e.cellY) == 1
    }, G.BoardCollectCells = function(t, e) {
        Phaser.Group.call(this, game), this.board = t, this.position = t.position, this.scale = t.scale, this.ccs = [], e && this.init(e)
    }, G.BoardCollectCells.prototype = Object.create(Phaser.Group.prototype), G.BoardCollectCells.prototype.init = function(t) {
        t.forEach(function(t) {
            this.addCC(t)
        }, this), G.sb("onCollectableTaskFinished").add(function(t) {
            "goalCandy" === t && this.hide()
        }, this), G.sb("onGoalAchieved").add(this.hide, this)
    }, G.BoardCollectCells.prototype.hide = function() {
        1 === this.alpha && game.add.tween(this).to({
            alpha: 0
        }, 300, Phaser.Easing.Sinusoidal.In, !0)
    }, G.BoardCollectCells.prototype.addCC = function(t) {
        var e = t.x * this.board.tilesize,
            i = t.y * this.board.tilesize,
            s = G.makeImage(e, i, "collect_cell_2", 0, this);
        s.cellX = t.x, s.cellY = t.y, this.ccs.push(s)
    }, G.BoardCollectCells.prototype.editorChangeCC = function(e, i) {
        var t = this.ccs.find(function(t) {
            return t.cellX === e && t.cellY === i
        });
        t ? (t.destroy(), this.ccs.splice(this.ccs.indexOf(t), 1)) : this.addCC({
            x: e,
            y: i
        }), G.lvlData.collectCells = this.editorExport()
    }, G.BoardCollectCells.prototype.editorExport = function() {
        return 0 === this.ccs.length ? null : this.ccs.map(function(t) {
            return {
                x: t.cellX,
                y: t.cellY
            }
        })
    }, G.BoardMatcher = function(t) {
        this.board = t, this.specialsCoordinates = G.specialCandies.patterns, this.grid = new G.GridArray(this.board.boardData.width, this.board.boardData.height, !1), this.grid.set = function(t, e, i) {
            return !!this.isInGrid(t, e) && (this.data[t][e] ? "m" == this.data[t][e] && "m" != i ? this.data[t][e] = i : void 0 : this.data[t][e] = i)
        }, this.tempGrid = new G.GridArray(this.board.boardData.width, this.board.boardData.height, !1), this.hitGrid = new G.GridArray(this.board.boardData.width, this.board.boardData.height, !1), this.toCheck = []
    }, G.BoardMatcher.prototype.isMoveValid = function(t) {
        var e = t.cellX,
            i = t.cellY;
        return !!this.board.isCellMatchable(e, i) && (!(!t.special || !t.activatedByMove) || (!!this.quickCheckCoords(t, this.horCoords, !1) || !!this.quickCheckCoords(t, this.verCoords, !1)))
    }, G.BoardMatcher.prototype.quickMatchCheck = function(t) {
        if (!t) return !1;
        var e = t.cellX,
            i = t.cellY;
        return !!this.board.isCellMatchable(e, i) && (!!this.quickCheckCoords(t, this.horCoords, !1) || !!this.quickCheckCoords(t, this.verCoords, !1))
    }, G.BoardMatcher.prototype.checkPossibleMoves = function() {
        var s = [];
        return this.board.boardCandies.grid.loop(function(t, e, i) {
            t && this.board.isMoveable(t.cellX, t.cellY) && this.board.isCellMatchable(t.cellX, t.cellY) && (t && this.board.isMoveable(e + 1, i) && this.quickCheckCoords(t, this.possibleRightMoves, !1) && s.push([e, i, e + 1, i]), t && this.board.isMoveable(e - 1, i) && this.quickCheckCoords(t, this.possibleLeftMoves, !1) && s.push([e, i, e - 1, i]), t && this.board.isMoveable(e, i - 1) && this.quickCheckCoords(t, this.possibleUpMoves, !1) && s.push([e, i, e, i - 1]), t && this.board.isMoveable(e, i + 1) && this.quickCheckCoords(t, this.possibleDownMoves, !1) && s.push([e, i, e, i + 1]))
        }, this), s
    }, G.BoardMatcher.prototype.quickCheckCoords = function(t, e, i) {
        for (var s, a, n = t.cellX, o = t.cellY, r = t.candyType, h = 0, l = e.length; h < l; h++) {
            a = !0;
            for (var d = 0, c = (s = e[h]).length; d < c; d += 2)
                if (!this.board.isCellMatchable(n + s[d], o + s[d + 1], r)) {
                    a = !1;
                    break
                } if (i && !a) return !1;
            if (!i && a) return !0
        }
        return !!i
    }, G.BoardMatcher.prototype.processMatchList = function() {
        if (0 != this.board.checkMatchList.length || 0 != this.board.checkSpecialMatchList.length) {
            G.lvl.increaseCombo(), G.sfx["match_" + game.math.clamp(G.lvl.combo || 1, 1, 5)].play(), this.candiesToProcess = this.board.checkMatchList, this.specialCandiesToProcess = this.board.checkSpecialMatchList;
            for (var t = 0, e = this.candiesToProcess.length; t < e; t++) this.grid.get(this.candiesToProcess[t].cellX, this.candiesToProcess[t].cellY) || (this.candiesToProcess[t].special && this.candiesToProcess[t].activatedByMove ? this.specialCandiesToProcess.push(this.candiesToProcess[t]) : this.processTemp(this.candiesToProcess[t]));
            this.inflateHitGrid();
            for (var i = 0; i < this.specialCandiesToProcess.length; i++) this.processTempSpecial(this.specialCandiesToProcess[i]);
            this.board.checkMatchList = [], this.board.checkSpecialMatchList = [], this.processGrid(), this.processHitGrid(), this.grid.clear(), this.hitGrid.clear()
        }
    }, G.BoardMatcher.prototype.inflateHitGrid = function() {
        this.grid.loop(function(t, e, i) {
            t && (this.hitGrid.set(e - 1, i, "h"), this.hitGrid.set(e + 1, i, "h"), this.hitGrid.set(e, i - 1, "h"), this.hitGrid.set(e, i + 1, "h"))
        }, this)
    }, G.BoardMatcher.prototype.processHitGrid = function() {
        this.hitGrid.loop(function(t, e, i) {
            t && this.board.hitCell(e, i)
        }, this)
    }, G.BoardMatcher.prototype.processGrid = function() {
        var s = [];
        this.grid.loop(function(t, e, i) {
            t && ("m" == t ? this.board.matchCell(e, i) : ("change" == t[0] && (this.board.getCandy(e, i) && this.board.getCandy(e, i).changeInto(t[1]), this.board.matchCellExceptCandy(e, i), s.push(this.board.getCandy(e, i))), "match-move" == t[0] && this.board.matchCell(e, i, t[1], t[2], t[3])))
        }, this), s.forEach(function(t) {
            this.quickMatchCheck(t) && this.board.checkMatchList.push(t)
        }, this)
    }, G.BoardMatcher.prototype.processTempSpecial = function(t) {
        for (var e, i = 0, s = t.exe.length; i < s; i++) "loop" == (e = t.exe[i])[0] && this.processSpecialExeLoop(t, e[1]), "specific" == e[0] && this.processSpecialExeSpecific(t, e[1]), "matchType" == e[0] && this.processSpecialExeMatchType(t, e[1]), "changeTypeInto" == e[0] && this.processSpecialExeChangeTypeInto(t, e[1], e[2]), "perform" == e[0] && this.processSpecialExePerform(t, e[1]), "superSpiral" == e[0] && this.processSpecialExeSuperSpiral(t, e[1]);
        this.copyTempGridToMatchGrid()
    }, G.BoardMatcher.prototype.processSpecialExeLoop = function(t, e) {
        G.sfx.line.play();
        for (var i = t.cellX, s = t.cellY; this.board.isCellInBoardArea(i, s);) this.tempCheckAndMark(i, s), i += e.x, s += e.y
    }, G.BoardMatcher.prototype.processSpecialExePerform = function(t, e) {
        t[e]()
    }, G.BoardMatcher.prototype.processSpecialExeSpecific = function(t, e) {
        G.sfx.boom.play();
        var i, s, a = t.cellX,
            n = t.cellY;
        G.sb("fx").dispatch("explosion", t);
        for (var o = 0, r = e.length; o < r; o += 2) i = a + e[o], s = n + e[o + 1], this.tempCheckAndMark(i, s)
    }, G.BoardMatcher.prototype.processSpecialExeMatchType = function(s, a) {
        G.sfx.lightning.play(), "LASTMOVEDWITH" == a && (a = s.lastMovedWith ? s.lastMovedWith.candyType : game.rnd.between(1, this.board.MAX_NUMBER_OF_REGULAR_CANDY)), "CANDYTYPE" == a && (a = s.candyType), this.board.getCandy(s.cellX, s.cellY) == s && this.tempGrid.set(s.cellX, s.cellY, "m"), this.board.boardCandies.grid.loop(function(t, e, i) {
            t && t.candyType == a && this.tempCheckAndMark(e, i, !0) && G.sb("fx").dispatch("lightning", s, [e, i])
        }, this)
    }, G.BoardMatcher.prototype.processSpecialExeChangeTypeInto = function(s, a, n) {
        "CANDYTYPE" == a && (a = s.candyType), "SPECIALLASTMOVED" == n && (n = s.lastMovedWith.specialType), this.board.getCandy(s.cellX, s.cellY) == s && this.tempGrid.set(s.cellX, s.cellY, "m"), this.board.boardCandies.grid.loop(function(t, e, i) {
            t && t.candyType == a && !t.special && t !== s && this.board.isCellMatchable(e, i) && this.board.isMoveable(e, i) && (this.board.checkAfterFall.push(t), t.changeInto(n), G.sb("fx").dispatch("lightning", s, [e, i]))
        }, this)
    }, G.BoardMatcher.prototype.processSpecialExeSuperSpiral = function(t) {
        this.board.boardData.loop(function(t, e, i) {
            this.board.isCellOnBoard(e, i) && this.tempCheckAndMark(e, i)
        }, this)
    }, G.BoardMatcher.prototype.tempCheckAndMark = function(t, e, i) {
        return i || this.hitGrid.set(t, e, !0), !(!this.board.isCellMatchable(t, e) || this.grid.get(t, e)) && (candy = this.board.getCandy(t, e), candy.special ? (this.specialCandiesToProcess.push(candy), this.tempGrid.set(t, e, "mSpecial")) : this.tempGrid.set(t, e, "m"), this.hitGrid.set(t, e, !0), !0)
    }, G.BoardMatcher.prototype.processTemp = function(t) {
        for (var e, i, s, a, n, o = [t], r = 0; r < o.length; r++) {
            e = o[r], [], s = this.getHorizontalMatchPos(e, this.quickCheckCoords(e, this.horCoords, !1)), a = this.getVerticalMatchPos(e, this.quickCheckCoords(e, this.verCoords, !1));
            for (var h = 0, l = (n = [].concat(s, a)).length; h < l; h += 2) i = this.board.getCandy(n[h], n[h + 1]), -1 == o.indexOf(i) && o.push(i)
        }
        o.forEach(function(t) {
            t.special ? (this.tempGrid.set(t.cellX, t.cellY, "m"), this.specialCandiesToProcess.push(t)) : this.tempGrid.set(t.cellX, t.cellY, "m")
        }, this), this.searchAndProcessSpecialsInTemp(o[0]), this.copyTempGridToMatchGrid()
    }, G.BoardMatcher.prototype.copyTempGridToMatchGrid = function() {
        var a = 0,
            n = 0,
            o = 0,
            r = [],
            t = !1;
        this.tempGrid.loop(function(t, e, i) {
            if (t) {
                a++, n += e, o += i;
                var s = this.board.getCandy(e, i);
                s && -1 === r.indexOf(s.candyType.toString()) && r.push(s.candyType.toString()), "mSpecial" == t ? this.grid.set(e, i, "m") : this.grid.set(e, i, t)
            }
        }, this), 1 == r.length && (t = r[0]), 0 < a && G.lvl.processMatch(a, n / a, o / a, t), this.tempGrid.clear()
    }, G.BoardMatcher.prototype.searchAndProcessSpecialsInTemp = function(t) {
        for (;;) {
            for (var e = 0, i = this.specialsCoordinates.length; e < i; e++)
                for (var s = 0, a = this.specialsCoordinates[e][1].length; s < a; s++) {
                    var n = this.tempGrid.findPattern(this.specialsCoordinates[e][1][s], "m");
                    n && this.pushSpecialToTempGrid(n, this.specialsCoordinates[e][0], t) && s--
                }
            break
        }
    }, G.BoardMatcher.prototype.pushSpecialToTempGrid = function(t, e, i) {
        var s, a = !1,
            n = t.length,
            o = ["change", e],
            r = t[0],
            h = t[1],
            l = !1;
        if (i)
            for (s = 0; s < n; s += 2) {
                this.board.getCandy(t[s], t[s + 1]);
                if (t[s] == i.cellX && t[s + 1] == i.cellY && !this.board.isBoosterChangeBlocked(t[s], t[s + 1])) {
                    a = !0, r = t[s], h = t[s + 1], this.tempGrid.set(t[s], t[s + 1], o), l = !0;
                    break
                }
            }
        for (s = 0; s < n; s += 2) 0 != s || a || this.board.isBoosterChangeBlocked(t[s], t[s + 1]) ? this.tempGrid.get(t[s], t[s + 1]) == o || this.board.getCandy(t[s], t[s + 1]).wrapped || this.board.boardCage.isToken(t[s], t[s + 1]) || (this.tempGrid.set(t[s], t[s + 1], ["match-move", 0, r, h]), l = !0) : (this.tempGrid.set(t[s], t[s + 1], o), l = !0);
        return l
    }, G.BoardMatcher.prototype.getHorizontalMatchPos = function(t, e) {
        var i = [],
            s = (t.cellX, t.cellY);
        if (!e) return i;
        var a = t.cellX,
            n = t.cellX;
        for (i.push(t.cellX, t.cellY); this.board.isCellMatchable(--a, s, t.candyType) && !this.grid.get(a, s);) i.push(a, s);
        for (; this.board.isCellMatchable(++n, s, t.candyType) && !this.grid.get(n, s);) i.push(n, s);
        return i
    }, G.BoardMatcher.prototype.getVerticalMatchPos = function(t, e) {
        var i = [],
            s = t.cellX,
            a = t.cellY;
        if (!e) return i;
        var n = a,
            o = a;
        for (i.push(t.cellX, t.cellY); this.board.isCellMatchable(s, --n, t.candyType) && !this.grid.get(s, n);) i.push(s, n);
        for (; this.board.isCellMatchable(s, ++o, t.candyType) && !this.grid.get(s, o);) i.push(s, o);
        return i
    }, G.BoardMatcher.prototype.getBirdMatchPos = function(t) {
        for (var e = [], i = t.cellX, s = t.cellY, a = 0; a < 4; a++) this.board.isCellMatchable(i + this.birdCoords[a][0], s + this.birdCoords[a][1], t.candyType) && this.board.isCellMatchable(i + this.birdCoords[a][2], s + this.birdCoords[a][3], t.candyType) && this.board.isCellMatchable(i + this.birdCoords[a][4], s + this.birdCoords[a][5], t.candyType) && e.push(i + this.birdCoords[a][0], s + this.birdCoords[a][1], i + this.birdCoords[a][2], s + this.birdCoords[a][3], i + this.birdCoords[a][4], s + this.birdCoords[a][5]);
        return e
    }, G.BoardMatcher.prototype.possibleDownMoves = [
        [-1, 1, 1, 1],
        [1, 1, 2, 1],
        [-2, 1, -1, 1],
        [0, 2, 0, 3]
    ], G.BoardMatcher.prototype.possibleRightMoves = [
        [2, 0, 3, 0],
        [1, 1, 1, 2],
        [1, -1, 1, 1],
        [1, -2, 1, -1]
    ], G.BoardMatcher.prototype.possibleLeftMoves = [
        [-3, 0, -2, 0],
        [-1, -2, -1, -1],
        [-1, -1, -1, 1],
        [-1, 1, -1, 2]
    ], G.BoardMatcher.prototype.possibleUpMoves = [
        [-1, -1, 1, -1],
        [1, -1, 2, -1],
        [-2, -1, -1, -1],
        [0, -3, 0, -2]
    ], G.BoardMatcher.prototype.horCoords = [
        [-1, 0, 1, 0],
        [-2, 0, -1, 0],
        [1, 0, 2, 0]
    ], G.BoardMatcher.prototype.verCoords = [
        [0, -1, 0, 1],
        [0, -1, 0, -2],
        [0, 1, 0, 2]
    ], G.BoardMatcher.prototype.birdCoords = [
        [-1, -1, -1, 0, 0, -1],
        [1, 0, 0, -1, 1, -1],
        [-1, 0, -1, 1, 0, 1],
        [1, 0, 0, 1, 1, 1]
    ], G.Candy = function(t, e) {
        this.grid = e, this.board = t, this.boardCandies = t.boardCandies, Phaser.Image.call(this, game, 0, 0), this.anchor.setTo(.5), this.wrapperImg = G.makeImage(0, 0, "blocker_chain_wrapped", .5, null), this.anchor.setTo(.5, .5), this.animationData = {
            active: !1
        }, this.fallData = {
            alpha0: this.board.cellYToPxIn(-1),
            alpha1: this.board.cellYToPxIn(0),
            alphaDistance: Math.abs(this.board.cellYToPxIn(-1) - this.board.cellYToPxIn(0)),
            active: !1,
            delay: 0,
            targetY: 0,
            targetX: 0,
            velY: 0,
            grav: G.lnf(2.5)
        }, this.kill()
    }, G.Candy.prototype = Object.create(Phaser.Image.prototype), G.Candy.prototype.init = function(t, e, i) {
        this.loadTexture(null), this.scale.setTo(1), this.candyType = !1, this.special = !1, this.specialType = !1, this.animationData.active = !1, this.fallData.active = !1, this.alpha = 1, this.angle = 0, this.scale.setTo(1), this.revive(), this.onMatchFx = !1, this.activatedByMove = !1, this.exe = [], this.matchable = !0, this.goalCandy = !1, this.blocker = !1, this.blockerHp = 0, this.wrapped = !1, this.infected = !1, this.chocolate = !1, this.cellX = t, this.cellY = e, this.x = this.board.cellXToPxIn(t), this.y = this.board.cellYToPxIn(e), this.changeInto(i, !0)
    }, G.Candy.prototype.fallTo = function(t, e, i) {
        this.setCell(t, e), this.fallData.active || G.sb("onCandyFallStart").dispatch(this), this.fallData.active = !0, this.fallData.delay = i || 0, this.fallData.velY = G.IMMEDIATE ? 1e3 : 0, this.fallData.targetY = this.board.cellYToPxIn(e), this.fallData.targetX = this.board.cellXToPxIn(t)
    }, G.Candy.prototype.fallFrom = function(t, e) {
        G.sb("onCandyFallStart").dispatch(this), this.y = this.board.cellYToPxIn(t), this.fallData.active = !0, this.fallData.delay = e || 0, this.fallData.velY = 0, this.fallData.targetX = this.board.cellXToPxIn(this.cellX), this.fallData.targetY = this.board.cellYToPxIn(this.cellY)
    }, G.Candy.prototype.movedWith = function(t) {
        this.lastMovedWith = t
    }, G.Candy.prototype.changeInto = function(t, e) {
        if (this.bringToTop(), G.specialCandies.isTypeSpecial(t)) {
            e || G.sb("fx").dispatch("changeCircle", this);
            var i = G.specialCandies.getSpecialData(t);
            this.special = !0, i.texture && (this.boardCandies.secondFloor.add(this), G.changeTexture(this, i.texture.replace("%CANDYTYPE%", this.candyType))), i.candyType && ("RANDOM" == i.candyType ? this.candyType = Math.random() : this.candyType = i.candyType), i.onMatchFx && (this.onMatchFx = i.onMatchFx.slice()), i.specialType && (this.specialType = i.specialType), G.sb("onCandyChangedIntoSpecial").dispatch(this.specialType), i.activatedByMove && (this.activatedByMove = !0), i.exe && (this.exe = i.exe.slice()), i.specialInit && this["changeInto" + G.capitalize(t)]()
        } else G.changeTexture(this, "candy_" + t), this.candyType = t, this.boardCandies.firstFloor.add(this); - 1 !== G.json.specialCandies.goalCandies.indexOf(this.candyType) && (this.matchable = !1, this.goalCandy = !0)
    }, G.Candy.prototype.changeIntoBlocker = function(t) {
        this.blocker = !0, this.blockerHp = t, G.changeTexture(this, "candy_blocker_" + t), this.matchable = !1
    }, G.Candy.prototype.removeBlocker = function() {
        this.blocker = !1, G.changeTexture(this, "candy_" + this.candyType), this.matchable = !0
    }, G.Candy.prototype.prepareToProcess = function() {
        this.startAnimation("biggerAndExplode")
    }, G.Candy.prototype.wrap = function() {
        this.wrapped = !0, this.wrapperImg.alpha = 1, this.wrapperImg.scale.setTo(1), G.changeTexture(this.wrapperImg, "blocker_chain_wrapped"), this.addChild(this.wrapperImg)
    }, G.Candy.prototype.unwrap = function() {
        G.sfx.brick_break.play(), G.sb("onCollectableRemove").dispatch("chain", this), game.add.tween(this.wrapperImg).to({
            width: 1.5 * this.wrapperImg.width,
            height: 1.5 * this.wrapperImg.height,
            alpha: 0
        }, 1e3, Phaser.Easing.Cubic.Out, !0).onComplete.add(function() {
            this.removeChild(this.wrapperImg)
        }, this), G.sb("fx").dispatch("changeCircle", this), G.sb("fxTop").dispatch("burstChainAnim", this, this), G.sfx.chain_rattle.play(), this.wrapped = !1, this.board.pushToFallCheckList(this)
    }, G.Candy.prototype.coverWithChocolate = function() {
        this.chocolateHp = 2, this.chocolate = !0
    }, G.Candy.prototype.hitChocolate = function() {
        G.sb("fx").dispatch("changeCircle", this), G.sb("fx").dispatch("chocolatePart", this), G.sb("fx").dispatch("chocolatePart", this), G.sb("fx").dispatch("chocolatePart", this), G.sb("fx").dispatch("chocolatePart", this), G.sfx.explosion_subtle.play(), 1 == --this.chocolateHp || (this.chocolate = !1, this.board.fallCheckList.push(this))
    }, G.Candy.prototype.detachFromGrid = function() {
        this.boardCandies.grid.set(this.cellX, this.cellY, null)
    }, G.Candy.prototype.hit = function() {
        this.blocker && (this.blockerHp--, 0 === this.blockerHp ? (this.candyType = "blocker", this.remove()) : G.changeTexture(this, "candy_blocker_" + this.blockerHp)), "infection" == this.candyType && (G.sb("fxTop").dispatch("burstInfectionAnim", this, this), this.remove()), "chest" != this.candyType && "chest_th" != this.candyType || (G.sb("onChestOpen").dispatch(this, this.candyType), this.remove()), this.chocolate && this.hitChocolate()
    }, G.Candy.prototype.update = function() {
        this.updateFall(), this.updateAnimation(), this.chainAttachement && (this.chainAttachement.x = this.x, this.chainAttachement.y = this.y)
    }, G.Candy.prototype.updateFall = function() {
        if (this.fallData.active) {
            if (0 < this.fallData.delay) return this.fallData.delay -= 1 * G.deltaTime;
            this.fallData.velY += this.fallData.grav * G.deltaTime, this.y += this.fallData.velY * G.deltaTime, this.y < this.fallData.alpha1 ? this.y < this.fallData.alpha0 ? this.alpha = 0 : this.alpha = Math.abs(this.fallData.alpha0 - this.y) / this.fallData.alphaDistance : this.alpha = 1;
            var t = this.fallData.targetX - this.x,
                e = this.fallData.targetY - this.y;
            Math.abs(t) > e && (this.x = this.fallData.targetX - e * game.math.sign(t)), this.y > this.fallData.targetY && (this.y = this.fallData.targetY, this.x = this.fallData.targetX, this.fallData.active = !1, this.startAnimation("bounce"), G.sfx["stone_impact_" + game.rnd.between(1, 3)].play(), G.sb("onCandyFallFinish").dispatch(this))
        }
    }, G.Candy.prototype.setCell = function(t, e) {
        this.grid.get(this.cellX, this.cellY) == this && this.grid.set(this.cellX, this.cellY, null), this.cellX = t, this.cellY = e, this.grid.set(t, e, this)
    }, G.Candy.prototype.isGoalCandy = function() {
        return -1 != this.boardCandies.goalCandies.indexOf(this)
    }, G.Candy.prototype.infect = function() {
        this.infected = !0, G.stopTweens(this.wrapperImg), this.wrapperImg.alpha = 1, this.wrapperImg.scale.setTo(1), G.changeTexture(this.wrapperImg, "infection_front"), game.add.tween(this.wrapperImg).from({
            alpha: 0,
            width: 0,
            height: 0
        }, 250, Phaser.Easing.Sinusoidal.Out, !0), this.addChild(this.wrapperImg), G.sb("onCandyInfect").dispatch(this)
    }, G.Candy.prototype.removeInfection = function() {
        G.sb("fxTop").dispatch("burstInfectionAnim", this, this), this.infected = !1, G.stopTweens(this.wrapperImg), this.board.pushToFallCheckList(this), game.add.tween(this.wrapperImg).to({
            alpha: 0
        }, 250, Phaser.Easing.Sinusoidal.Out, !0).onComplete.add(function() {
            this.removeChild(this.wrapperImg)
        }, this), G.sb("onCandyInfectionRemove").dispatch(this)
    }, G.Candy.prototype.match = function(t, e, i) {
        if (this.matchable) {
            if (this.wrapped) return this.unwrap();
            if (this.infected) return this.removeInfection();
            if (!this.animationData.active) return this.detachFromGrid(), G.sb("onCandyMatch").dispatch(this), this.special ? (this.onMatchFx && this.onMatchFx.forEach(function(t) {
                G.sb("fx").dispatch(t[0], this, t[1], this)
            }, this), game.camera.shake(.0075, 250), this.boardCandies.thirdFloor.add(this), this.startAnimation("growAndFade", t)) : G.lvl.isGoal(this.candyType) ? this.remove() : void(void 0 === e ? this.startAnimation("vanishAlphaBurst", t) : this.startAnimation("moveTo", [t, e, i]))
        }
    }, G.Candy.prototype.remove = function() {
        this.boardCandies.removeCandy(this)
    }, G.Candy.prototype.updateAnimation = function() {
        this.animationData.active && (this.animationData.func && this.animationData.func.call(this), this.animationData.active || G.sb("onCandyAnimationFinish").dispatch())
    }, G.Candy.prototype.startAnimation = function(t, e) {
        if (this.animationData.active) return alert("during another animation");
        this["animation-init-" + t] && (G.sb("onCandyAnimationStart").dispatch(), this.animationData.active = !0, this["animation-init-" + t](e))
    }, G.Candy.prototype["animation-init-bounce"] = function() {
        if (G.IMMEDIATE) return this.animationData.active = !1, void G.sb("onCandyAnimationFinish").dispatch(this);
        game.add.tween(this).to({
            y: this.y - G.l(5)
        }, 100, Phaser.Easing.Sinusoidal.Out, !0, 0, 0, !0).onComplete.add(function() {
            this.animationData.active = !1, G.sb("onCandyAnimationFinish").dispatch(this)
        }, this)
    }, G.Candy.prototype["animation-init-vanishAlphaBurst"] = function(t) {
        G.sb("fx").dispatch("burstCandy", this, this), G.sb("onCandyAnimationFinish").dispatch(this), this.remove()
    }, G.Candy.prototype["animation-init-vanish"] = function(t) {
        if (G.IMMEDIATE) return G.sb("onCandyAnimationFinish").dispatch(this), this.remove(), void this.scale.setTo(1);
        game.add.tween(this.scale).to({
            x: 0,
            y: 0
        }, 200, Phaser.Easing.Sinusoidal.In, !0, t || 0).onComplete.add(function() {
            G.sb("onCandyAnimationFinish").dispatch(this), this.remove(), this.scale.setTo(1)
        }, this)
    }, G.Candy.prototype["animation-init-scaleEndlessly"] = function() {
        G.IMMEDIATE || game.add.tween(this.scale).to({
            x: .5,
            y: .5
        }, 300, Phaser.Easing.Sinusoidal.In, !0, 0, -1, !0)
    }, G.Candy.prototype["animation-init-shrink"] = function() {
        this.boardCandies.thirdFloor.add(this), this.bringToTop();
        game.add.tween(this.scale).to({
            x: 0,
            y: 0
        }, 200, Phaser.Easing.Sinusoidal.In, !0).onComplete.add(function() {
            G.sb("onCandyAnimationFinish").dispatch(this), this.remove()
        }, this)
    }, G.Candy.prototype["animation-init-growAndFade"] = function() {
        if (G.IMMEDIATE) return G.sb("onCandyAnimationFinish").dispatch(this), void this.remove();
        this.boardCandies.thirdFloor.add(this), this.bringToTop();
        var t = game.add.tween(this.scale).to({
            x: 2.5,
            y: 2.5
        }, 200, Phaser.Easing.Sinusoidal.In, !0);
        game.add.tween(this).to({
            alpha: 0
        }, 100, Phaser.Easing.Sinusoidal.In, !0, 100).onComplete.add(function() {
            t.stop(), G.sb("onCandyAnimationFinish").dispatch(this), this.remove()
        }, this)
    }, G.Candy.prototype["animation-init-biggerAndExplode"] = function(t) {
        if (G.IMMEDIATE) return this.board.checkSpecialMatchList.push(this), this.burst = !0, this.readyToProcess = !0, G.sb("onCandyAnimationFinish").dispatch(this), void this.remove();
        t ? game.time.events.add(t, function() {
            this.bringToTop(), game.add.tween(this.scale).to({
                x: 1.5,
                y: 1.5
            }, 300, Phaser.Easing.Sinusoidal.In, !0).onComplete.add(function() {
                this.board.checkSpecialMatchList.push(this), this.burst = !0, this.readyToProcess = !0, G.sb("onCandyAnimationFinish").dispatch(this), this.remove(), this.scale.setTo(1)
            }, this)
        }, this) : (this.bringToTop(), game.add.tween(this.scale).to({
            x: 1.5,
            y: 1.5
        }, 300, Phaser.Easing.Sinusoidal.In, !0).onComplete.add(function() {
            this.board.checkSpecialMatchList.push(this), this.burst = !0, this.readyToProcess = !0, G.sb("onCandyAnimationFinish").dispatch(this), this.remove(), this.scale.setTo(1)
        }, this))
    }, G.Candy.prototype["animation-init-moveTo"] = function(e) {
        if (G.IMMEDIATE) return G.sb("onCandyAnimationFinish").dispatch(this), void this.remove();
        if (e[0]) game.time.events.add(e[0], function() {
            var t = game.add.tween(this).to({
                x: this.board.cellXToPxIn(e[1]),
                y: this.board.cellYToPxIn(e[2])
            }, 300, Phaser.Easing.Sinusoidal.In, !0);
            game.add.tween(this).to({
                alpha: 0
            }, 200, Phaser.Easing.Sinusoidal.In, !0, 100).onComplete.add(function() {
                t.stop(), G.sb("onCandyAnimationFinish").dispatch(this), this.remove()
            }, this)
        }, this);
        else {
            var t = game.add.tween(this).to({
                x: this.board.cellXToPxIn(e[1]),
                y: this.board.cellYToPxIn(e[2])
            }, 300, Phaser.Easing.Sinusoidal.In, !0);
            game.add.tween(this).to({
                alpha: 0
            }, 200, Phaser.Easing.Sinusoidal.In, !0, 100).onComplete.add(function() {
                t.stop(), G.sb("onCandyAnimationFinish").dispatch(this), this.remove()
            }, this)
        }
    }, G.Candy.prototype["animation-init-moveToCombo"] = function(t) {
        if (G.IMMEDIATE) return G.sb("onCandyAnimationFinish").dispatch(this), void this.remove();
        if (0 !== t[3]) var e = game.add.tween(this).to({
            angle: t[3]
        }, 300, Phaser.Easing.Sinusoidal.InOut, !0);
        var i = game.add.tween(this).to({
            x: this.board.cellXToPxIn(t[1]),
            y: this.board.cellYToPxIn(t[2])
        }, 300, Phaser.Easing.Sinusoidal.InOut, !0);
        game.add.tween(this).to({
            alpha: .8
        }, 200, Phaser.Easing.Sinusoidal.In, !0, 200).onComplete.add(function() {
            i.stop(), e && e.stop(), G.sb("onCandyAnimationFinish").dispatch(this), game.time.events.add(1, this.remove, this)
        }, this)
    }, G.Candy.prototype.moveTo = function(t, e, i) {
        if (G.IMMEDIATE) return G.sb("onCandyAnimationFinish").dispatch(this), this.cellX = s[0], this.cellY = s[1], this.animationData.active = !1, void this.boardCandies.grid.set(this.cellX, this.cellY, this);
        this.board.getCandy(t, e);
        var s = [t, e];
        this.bringToTop(), G.sb("onCandyAnimationStart").dispatch(), this.animationData.active = !0, i && game.add.tween(this.scale).to({
            x: 2 * this.scale.x,
            y: 2 * this.scale.y
        }, 250, Phaser.Easing.Sinusoidal.InOut, !0, 0, 0, !0), game.add.tween(this).to({
            x: this.board.cellXToPxIn(t),
            y: this.board.cellYToPxIn(e)
        }, 500, Phaser.Easing.Sinusoidal.InOut, !0).onComplete.add(function() {
            G.sb("onCandyAnimationFinish").dispatch(this), this.cellX = s[0], this.cellY = s[1], this.animationData.active = !1, this.boardCandies.grid.set(this.cellX, this.cellY, this)
        }, this)
    }, G.Candy.prototype.shuffleMoveToOwnCell = function() {
        var t = this.parent;
        this.special ? this.boardCandies.thirdFloor.add(this) : this.boardCandies.secondFloor.add(this), G.sb("onCandyAnimationStart").dispatch(), this.animationData.active = !0, game.add.tween(this).to({
            x: this.board.cellXToPxIn(this.cellX),
            y: this.board.cellYToPxIn(this.cellY)
        }, 500, Phaser.Easing.Sinusoidal.InOut, !0).onComplete.add(function() {
            t.add(this), G.sb("onCandyAnimationFinish").dispatch(this), this.animationData.active = !1
        }, this)
    }, G.CandySelection = function(t) {
        G.Image.call(this, 0, 0, null, .5), this.board = t, this.alpha = 0, game.add.existing(this), this.selection = G.makeImage(0, 0, "selected_cookie_new", .5, this), game.add.tween(this.selection.scale).to({
            x: 1.2,
            y: 1.2
        }, 800, Phaser.Easing.Sinusoidal.InOut, !0, 0, -1, !0), this.frameIndex = 0, this.every = 3, this.frameCounter = 0, this.scale = this.board.scale
    }, G.CandySelection.prototype = Object.create(G.Image.prototype), G.CandySelection.prototype.selectCandy = function(t) {
        this.alpha = 1, this.x = this.board.boardCandies.x + t.x * this.board.scale.x, this.y = this.board.boardCandies.y + t.y * this.board.scale.y
    }, G.CandySelection.prototype.hide = function() {
        this.alpha = 0
    }, G.AttachementsGroup = function() {
        Phaser.Group.call(this, game), this.deadArray = []
    }, G.AttachementsGroup.prototype = Object.create(Phaser.Group.prototype), G.AttachementsGroup.prototype.attach = function(t, e) {
        var i;
        return (i = 0 < this.deadArray.length ? this.deadArray.pop() : new G.AttachementPart).init(t, e), this.add(i), i
    }, G.AttachementPart = function() {
        Phaser.Image.call(this, game, 0, 0, null), this.anchor.setTo(.5), this.kill()
    }, G.AttachementPart.prototype = Object.create(Phaser.Image.prototype), G.AttachementPart.prototype.init = function(t, e) {
        this.attachement = e, this.position = e.position, this.scale = e.scale, this.position, this["init" + G.capitalize(t)](e), this.revive()
    }, G.AttachementPart.prototype.postUpdate = function() {
        this.alive && (this.rotation = this.attachement.rotation)
    }, G.AttachementPart.prototype.remove = function() {
        this.kill(), this.parent.deadArray.push(this), this.parent.removeChild(this)
    }, G.AttachementPart.prototype.detach = function() {
        this.position = new Phaser.Point(this.x, this.y)
    }, G.AttachementPart.prototype.initChain = function(t) {
        G.changeTexture(this, "blocker_chain_wrapped")
    }, G.BoardFallMgr = function(t, e) {
        this.board = t, this.boardData = t.boardData, this.refiller = e, this.refillData = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1]
    }, G.BoardFallMgr.prototype.allCollumsFall = function() {
        this.refillData = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1];
        for (var t = 0; t < this.boardData.width; t++) this.collumnFall(t)
    }, G.BoardFallMgr.prototype.collumnFall = function(t) {
        for (var e = this.boardData.height - 1; 0 <= e; e--)
            if ("X" != this.boardData.get(t, e) && !this.board.getCandy(t, e) && !this.board.boardIce.isToken(t, e)) {
                for (var i = !1, s = e; 0 <= s; s--) {
                    i = this.board.getCandy(t, s);
                    if (this.board.isMoveBlocked(t, s)) {
                        i = !0;
                        break
                    }
                    if (i && this.board.isMoveable(t, s)) {
                        i.fallTo(t, e);
                        break
                    }
                }
                i || this.board.newFallingCandy(t, e, this.refiller.getTypeToDrop(t), this.refillData[t]--)
            }
    }, G.BoardFallMgr.prototype.collumnFall = function(t) {
        for (var e = this.boardData.height - 1; 0 <= e; e--)
            if ("X" != this.boardData.get(t, e) && !this.board.getCandy(t, e) && !this.board.boardIce.isToken(t, e)) {
                for (var i = !1, s = e; 0 <= s; s--) {
                    i = this.board.getCandy(t, s);
                    if (this.board.isMoveBlocked(t, s)) {
                        i = !0;
                        break
                    }
                    if (i && this.board.isMoveable(t, s)) {
                        i.fallTo(t, e);
                        break
                    }
                }
                i || this.board.newFallingCandy(t, e, this.refiller.getTypeToDrop(t), this.refillData[t]--)
            }
    }, G.BoardFallMgr.prototype.isCellSolid = function(t, e) {
        return e == this.boardData.height || "X" == this.boardData.get(t, e) || this.board.getCandy(t, e)
    }, G.BoardFallMgr.prototype.crossCollumnFall = function() {
        for (var t = !1, e = 1, i = this.boardData.height - 1; 0 <= i; i--)
            for (var s = 0; s < this.boardData.width; s++)
                if (this.board.isCellOnBoard(s, i) && !this.isCellSolid(s, i) && this.isCellSolid(s, i + 1) && !this.board.isMoveBlocked(s, i)) {
                    if (this.board.isMoveable(s + e, i - 1)) {
                        this.board.getCandy(s + e, i - 1).fallTo(s, i), this.collumnFall(s + e), t = !0;
                        continue
                    }
                    if (this.board.isMoveable(s - e, i - 1)) {
                        this.board.getCandy(s - e, i - 1).fallTo(s, i), this.collumnFall(s - e), t = !0;
                        continue
                    }
                    e *= -1
                } return t
    }, G.GameplayChest = function() {
        G.Image.call(this), this.base = G.makeImage(0, 0, null, .5, this), this.base.name = "base", this.cover = G.makeImage(-40, 0, null, [0, 1], this), this.cover.name = "cover", this.light = G.makeImage(0, -20, "popup_lighht", .5, this), this.light.name = "light", this.light.scale.setTo(.5), this.light.blendMode = 1, this.gift = G.makeImage(0, 0, null, .5, this), this.gift.name = "gift", this.onGiftShown = new Phaser.Signal, this.kill()
    }, G.GameplayChest.prototype = Object.create(G.Image.prototype), G.GameplayChest.prototype.init = function(t, e, i) {
        var s, a, n = this.gift,
            o = this.onGiftShown,
            r = G.gift,
            h = null;
        this.orgY = e, this.position.setTo(t, e), this.revive(), "chest" === i ? (! function() {
            if (h = r.getGift("ingamechests"), n.changeTexture(r.getIcon(h)), "coin" === h[0]) {
                var t = ["coin_package_icon_0", "coin_package_icon_1", "coin_package_icon_2"][h[1] - 1];
                t && G.changeTexture(n, t)
            }
        }(), s = G.Animations.getGameplayChestOpenAnimation(), a = G.Animations.getGameplayChestGiftRevealAnimation()) : "chest_th" === i && (h = ["THGEM"], n.changeTexture("gem5_small"), s = G.Animations.getGameplayChestTHOpenAnimation(), a = G.Animations.getGameplayChestTHGiftRevealAnimation()), G.sfx.match_5.play(), s && (s.animate(this.game, this), s.onComplete.add(this.kill, this)), a && (a.animate(this.game, n), a.onComplete.add(function() {
            o.dispatch(h), console.log("on gift animation complete")
        }, this))
    }, G.GameplayChest.prototype.getGiftObject = function() {
        return this.gift
    }, G.InputController = function(t) {
        Phaser.Group.call(this, game), this.state = game.state.getCurrentState(), this.board = t, this.booster = null, this.clicked = !1, this.clickedCell = !1, this.anyWindowOpen = !1, this.possibleCandies = [], G.sb("onWindowOpened").add(function() {
            this.anyWindowOpen = !0
        }, this), G.sb("onAllWindowsClosed").add(function() {
            this.anyWindowOpen = !1
        }, this), this.state.EDITOR || game.input.onDown.add(this.onClick, this), game.input.onUp.add(function() {
            this.clicked = !1
        }, this), this.locked = !1
    }, G.InputController.prototype = Object.create(Phaser.Group.prototype), G.InputController.prototype.update = function() {
        this.board.tileShade.visible = !1;
        var t = this.pointerToCell2(game.input.activePointer);
        if (game.device.desktop && !G.lvl.goalAchieved && this.board.isCellOnBoard(t[0], t[1]) && (this.board.tileShade.visible = !0, this.board.tileShade.x = this.board.cellXToPxIn(t[0]), this.board.tileShade.y = this.board.cellYToPxIn(t[1])), this.canMakeMove() && this.clicked) {
            if (0 < this.possibleCandies.length && (-1 == this.possibleCandies.indexOf(this.board.getCandy(this.clickedCell)) || -1 == this.possibleCandies.indexOf(this.board.getCandy(t)))) return;
            t && this.board.isMoveable(t) && this.areNeighbours(this.clickedCell, t) && this.board.getCandy(t) && (this.board.makeMove(this.board.getCandy(this.clickedCell), this.board.getCandy(t)), this.clicked = !1, this.clickedCell = null)
        }
    }, G.InputController.prototype.canMakeMove = function() {
        return !this.locked && (!!this.board.actionManager.noAction && (!G.lvl.goalAchieved && !this.anyWindowOpen))
    }, G.InputController.prototype.onClick = function(t) {
        if (this.canMakeMove()) {
            var e = this.pointerToCell(t);
            if (e && this.board.isMoveable(e[0], e[1]) && this.board.getCandy(e)) {
                if (G.sfx.pop.play(), this.clickedCell && Math.abs(this.clickedCell[0] - e[0]) + Math.abs(this.clickedCell[1] - e[1]) == 1) {
                    if (!(0 < this.possibleCandies.length)) return this.board.makeMove(this.board.getCandy(this.clickedCell), this.board.getCandy(e)), this.clickedCell = null, void(this.clicked = !1);
                    if (-1 < this.possibleCandies.indexOf(this.board.getCandy(this.clickedCell)) && -1 < this.possibleCandies.indexOf(this.board.getCandy(e))) return this.board.makeMove(this.board.getCandy(this.clickedCell), this.board.getCandy(e)), this.clickedCell = null, void(this.clicked = !1)
                }
                this.clicked = !0, this.clickedCell = e
            }
        }
    }, G.InputController.prototype.pointerToCell = function(t) {
        if (this.anyWindowOpen) return !1;
        var e = t.worldX,
            i = t.worldY;
        return !!this.isPointerInRange(t) && [Math.floor((e - (this.board.x + this.board.offsetX)) / (this.board.tilesize * this.board.scale.x)), Math.floor((i - (this.board.y + this.board.offsetY)) / (this.board.tilesize * this.board.scale.y))]
    }, G.InputController.prototype.pointerToCell2 = function(t) {
        var e = t.worldX,
            i = t.worldY;
        return [Math.floor((e - (this.board.x + this.board.offsetX)) / (this.board.tilesize * this.board.scale.x)), Math.floor((i - (this.board.y + this.board.offsetY)) / (this.board.tilesize * this.board.scale.y))]
    }, G.InputController.prototype.isPointerInRange = function(t) {
        var e = t.worldX,
            i = t.worldY;
        return !(e < this.board.x + this.board.offsetX || e > this.board.x + this.board.offsetX + this.board.width || i < this.board.y + this.board.offsetY || i > this.board.y + this.board.offsetY + this.board.height)
    }, G.InputController.prototype.areNeighbours = function(t, e) {
        return t[0] == e[0] ? 1 == Math.abs(t[1] - e[1]) : t[1] == e[1] ? 1 == Math.abs(t[0] - e[0]) : void 0
    }, G.MatchList = function() {
        this.list = []
    }, G.MatchList.prototype.push = function(t) {
        for (var e = 0, i = this.list.length; e < i; e++)
            if (this.list[e][0] == t[0] && this.list[e][1] == t[1]) return;
        this.list.push(t)
    }, G.MatchList.prototype.remove = function(t) {
        for (var e = 0, i = this.list.length; e < i; e++)
            if (this.list[e][0] == t[0] && this.list[e][1] == t[1]) return void this.list.splice(e, 1)
    }, G.MatchList.prototype.addHorizontal = function(t, e, i) {
        for (; t <= e; t++) this.push([t, i])
    }, G.MatchList.prototype.addVertical = function(t, e, i) {
        for (; i <= e; e--) this.push([t, e])
    }, G.MatchList.prototype.loop = function(t, e) {
        for (var i = 0, s = this.list.length; i < s; i++) t.call(e || this, this.list[i])
    }, G.Refiller = function(t, e) {
        var i = G.TreasureHunt.treasureHuntMgr;
        this.board = e, this.drops = G.Utils.clone(t.drops), this.goalDrops = t.goalDrops ? G.Utils.clone(t.goalDrops) : [], this.predefinedDrops = t.predefinedDrops ? G.Utils.clone(t.predefinedDrops) : [], void 0 === this.drops.chest && (this.drops.chest = 0), void 0 === this.drops.infection && (this.drops.infection = 0), void 0 === this.drops.chain && (this.drops.chain = 0), void 0 === this.drops.goalCandy && (this.drops.goalCandy = 0), this.drops.chest *= G.lvl.coinChanceProb;
        var s = game.state.getCurrentState().lvlIndex;
        this.treasureHunt = i.isLevelTreasureHuntActive(s), this.treasureHunt && this.initTreasureHuntOverwrites(s)
    }, G.Refiller.prototype.initTreasureHuntOverwrites = function(t) {
        var e = G.json.settings,
            i = G.Utils.defined(e.treasureHuntConfig, {});
        this.drops.chest = i.chestDropOverwrite, 20 === t && 20 == G.saveState.getLastPassedLevelNr() && this.predefinedDrops[3].push("r", "r", "r", "r", "r", "chest_th")
    }, G.Refiller.prototype.getTypeToDrop = function(t) {
        G.TreasureHunt.treasureHuntMgr;
        var e = this.checkPredifinedDrops(t);
        if (e) return "r" === e && (e = game.rnd.between(1, this.board.MAX_NUMBER_OF_REGULAR_CANDY)), e;
        this.substractGoalDropCounter();
        var i = this.checkGoalDropList();
        if (i) return i;
        var s = Math.random() < this.drops.goalCandy / 100,
            a = Math.random() < this.drops.chest / 100,
            n = Math.random() < this.drops.chain / 100,
            o = Math.random() < this.drops.infection / 100;
        if (s) return "goalCandy";
        if (a) return this.treasureHunt ? "chest_th" : "chest";
        if (o) return "infection";
        var r = game.rnd.between(1, this.board.MAX_NUMBER_OF_REGULAR_CANDY);
        return n && 0 == (r = "CHAIN" + r) && console.log(r), r
    }, G.Refiller.prototype.checkPredifinedDrops = function(t) {
        return this.predefinedDrops[t] ? this.predefinedDrops[t].shift() : null
    }, G.Refiller.prototype.checkGoalDropList = function() {
        for (var t = 0, e = this.goalDrops.length; t < e; t++)
            if (this.goalDrops[t][1] <= 0) {
                var i = this.goalDrops[t][0];
                return this.goalDrops.splice(t, 1), i
            } return !1
    }, G.Refiller.prototype.substractGoalDropCounter = function() {
        for (var t = 0, e = this.goalDrops.length; t < e; t++) this.goalDrops[t][1] = this.goalDrops[t][1] - 1
    }, G.Action = function(t, e, i) {
        this.state = game.state.getCurrentState(), this.board = t, this.am = e, this.args = i
    }, G.Action.prototype.finish = function() {
        this.am.removeAction(this)
    }, G.ActionBoosterMatch = function(t, e, i) {
        G.Action.call(this, t, e, i), this.clickedCandy = !1, this.availableCandies = [], this.inputController = this.board.inputController, this.signalBinding = game.input.onDown.add(function(t) {
            var e = this.inputController.pointerToCell(t);
            if (e) {
                var i = this.board.getCandy(e[0], e[1]);
                !i || 0 != this.availableCandies.length && -1 == this.availableCandies.indexOf(i) || (G.sfx.pop.play(), this.clickedCandy = i, G.saveState.useBooster(this.args[0]), G.lvl.onBoosterUse(this.args[0]))
            }
        }, this), this.boosterInit = !1
    }, G.ActionBoosterMatch.prototype = Object.create(G.Action.prototype), G.ActionBoosterMatch.prototype.update = function() {
        this.clickedCandy && (this.boosterInit || this.board.duringAnimation || this.board.duringFall || (this.boosterInit = !0, G.sb("onBoosterUsed").dispatch(this.args[0]), this.signalBinding.detach(), 3 == this.args[0] ? this.board.boardCandies.boosterFxGroup.add(new G.BoosterHorizontal(this.clickedCandy.cellX, this.clickedCandy.cellY, this.args[0])) : 4 == this.args[0] ? this.board.boardCandies.boosterFxGroup.add(new G.BoosterVertical(this.clickedCandy.cellX, this.clickedCandy.cellY, this.args[0])) : this.board.boardCandies.boosterFxGroup.add(new G.Booster(this.clickedCandy.cellX, this.clickedCandy.cellY, this.args[0]))))
    }, G.ActionBoosterMatch.prototype.finish = function() {
        this.signalBinding.detach(), this.am.removeAction(this)
    }, G.ActionBoosterSwap = function(t, e, i) {
        G.Action.call(this, t, e, i), this.availableCandies = [], this.clickedCandy = !1, this.clickedCandy2 = !1, this.madeMove = !1, this.inputController = this.board.inputController, this.signalBinding = game.input.onDown.add(function(t) {
            var e = this.inputController.pointerToCell(t);
            if (e && this.board.isMoveable(e[0], e[1])) {
                var i = this.board.getCandy(e[0], e[1]);
                if (i.goalCandy) return;
                if (!this.clickedCandy && (0 == this.availableCandies.length || -1 != this.availableCandies.indexOf(i))) return this.selection = this.board.candySelection, this.selection.selectCandy(i), G.sb("onBoosterSwapCandySelect").dispatch(i), this.clickedCandy = i;
                if (this.clickedCandy != i && (0 == this.availableCandies.length || -1 != this.availableCandies.indexOf(i))) {
                    if (G.lvl.tutOpen) {
                        var s = game.state.getCurrentState().tut;
                        game.add.tween(s.hand).to({
                            alpha: 0
                        }, 300, Phaser.Easing.Sinusoidal.In, !0)
                    }
                    this.clickedCandy2 = i, G.saveState.useBooster(1), G.lvl.onBoosterUse(1)
                }
            }
        }, this)
    }, G.ActionBoosterSwap.prototype = Object.create(G.Action.prototype), G.ActionBoosterSwap.prototype.update = function() {
        this.clickedCandy && this.clickedCandy2 && (this.madeMove || (this.madeMove = !0, this.signalBinding.detach(), this.selection && this.selection.hide(), this.clickedCandy2.moveTo(this.clickedCandy.cellX, this.clickedCandy.cellY), this.clickedCandy.moveTo(this.clickedCandy2.cellX, this.clickedCandy2.cellY, !0)), this.board.duringAnimation || this.board.duringFall || (this.board.matcher.isMoveValid(this.clickedCandy) && this.board.checkMatchList.push(this.clickedCandy), this.board.matcher.isMoveValid(this.clickedCandy2) && this.board.checkMatchList.push(this.clickedCandy2), 0 < this.board.checkMatchList.length && this.am.newAction("processMatch"), G.sb("onBoosterActionFinished").dispatch(), this.finish(), G.sb("onBoosterUsed").dispatch(1)))
    }, G.ActionBoosterSwap.prototype.finish = function() {
        this.selection && this.selection.hide(), this.signalBinding.detach(), this.am.removeAction(this)
    }, G.ActionMove = function(t, e, i) {
        G.Action.call(this, t, e, i), this.candy1 = i[0], this.candy1orgParent = this.candy1.parent, this.candy2 = i[1], this.candy2orgParent = this.candy2.parent, this.forceMove = i[2], this.back = !1, this.startAnimation()
    }, G.ActionMove.prototype = Object.create(G.Action.prototype), G.ActionMove.prototype.update = function() {
        if (this.updateAnimation(), this.progress += .075 * G.deltaTime, 1 <= this.progress) {
            if (this.finishAnimation(), this.back) return this.finish();
            if (this.candy1.movedWith(this.candy2), this.candy2.movedWith(this.candy1), this.candy1.special && this.candy2.special) {
                if (this.checkCombo(this.candy1, this.candy2)) return G.lvl.madeMove(), this.am.newAction("processMatch"), this.finish();
                if ("spiral" == this.candy1.specialType || "spiral" == this.candy2.specialType) {
                    var t = "spiral" == this.candy1.specialType ? this.candy1 : this.candy2,
                        e = "spiral" != this.candy1.specialType ? this.candy1 : this.candy2;
                    return e.startAnimation("moveTo", [0, t.cellX, t.cellY]), t.exe = [
                        ["changeTypeInto", 1 <= e.candyType ? e.candyType : game.rnd.between(1, this.board.MAX_NUMBER_OF_REGULAR_CANDY), e.specialType]
                    ], this.board.checkMatchList.push(t), G.lvl.madeMove(), this.am.newAction("processMatch"), this.finish()
                }
                return this.candy1.activatedByMove = !0, this.candy2.activatedByMove = !0, this.board.checkMatchList.push(this.candy1), this.board.checkMatchList.push(this.candy2), G.lvl.madeMove(), this.am.newAction("processMatch"), this.finish()
            }
            if (this.additionalChecks(this.candy1, this.candy2) && (this.board.matcher.isMoveValid(this.candy1) && this.board.checkMatchList.push(this.candy1), this.board.matcher.isMoveValid(this.candy2) && this.board.checkMatchList.push(this.candy2)), 0 != this.board.checkMatchList) return this.candy1.movedWith(this.candy2), this.candy2.movedWith(this.candy1), this.forceMove || G.lvl.madeMove(), this.am.newAction("processMatch"), this.finish();
            this.back || this.forceMove ? this.finish() : (this.back = !0, this.startAnimation())
        }
    }, G.ActionMove.prototype.additionalChecks = function(t, e) {
        var i = [t, e].find(function(t) {
                return "spiral" == t.specialType
            }),
            s = [t, e].find(function(t) {
                return "goalCandy" === t.candyType
            }),
            a = [t, e].find(function(t) {
                return "chest" === t.candyType
            }),
            n = [t, e].find(function(t) {
                return "infection" === t.candyType
            });
        return !(i && s || i && n || i && a)
    }, G.ActionMove.prototype.startAnimation = function() {
        G.sfx.exchange.play(), this.candy1anim = {
            startX: this.candy1.x,
            deltaX: this.candy2.x - this.candy1.x,
            startY: this.candy1.y,
            deltaY: this.candy2.y - this.candy1.y
        }, this.board.boardCandies.secondFloor.add(this.candy1), this.candy2anim = {
            startX: this.candy2.x,
            deltaX: this.candy1.x - this.candy2.x,
            startY: this.candy2.y,
            deltaY: this.candy1.y - this.candy2.y
        }, this.board.boardCandies.secondFloor.add(this.candy2), this.candy1.bringToTop(), this.progress = 0, G.IMMEDIATE && (this.progress = 1)
    }, G.ActionMove.prototype.finishAnimation = function() {
        this.board.swapCandies(this.candy1, this.candy2), this.candy1.x = this.board.cellXToPxIn(this.candy1.cellX), this.candy1.y = this.board.cellYToPxIn(this.candy1.cellY), this.candy1.scale.setTo(1), this.candy1orgParent.add(this.candy1), this.candy2.x = this.board.cellXToPxIn(this.candy2.cellX), this.candy2.y = this.board.cellYToPxIn(this.candy2.cellY), this.candy2orgParent.add(this.candy2)
    }, G.ActionMove.prototype.updateAnimation = function() {
        var t = Phaser.Easing.Sinusoidal.InOut(this.progress);
        this.candy1.x = this.candy1anim.startX + t * this.candy1anim.deltaX, this.candy1.y = this.candy1anim.startY + t * this.candy1anim.deltaY, this.candy1.scale.setTo(2 - 2 * Math.abs(.5 - t)), this.candy2.x = this.candy2anim.startX + t * this.candy2anim.deltaX, this.candy2.y = this.candy2anim.startY + t * this.candy2anim.deltaY
    }, G.ActionMove.prototype.checkCombo = function(t, e) {
        for (var i, s = 0, a = G.specialCandies.combos.length; s < a; s++)
            if (i = G.specialCandies.combos[s], t.specialType == i[0] && e.specialType == i[1] || t.specialType == i[1] && e.specialType == i[0]) {
                var n = i[3];
                return "vertical" != i[0] && "horizontal" != i[0] || "cross" != i[1] || "vertical" != t.specialType && "horizontal" != t.specialType || (game.add.tween(t).to({
                    angle: i[3]
                }, 300, Phaser.Easing.Sinusoidal.InOut, !0), n = 0), t.changeInto(i[2]), e.detachFromGrid(), e.startAnimation("moveToCombo", [0, t.cellX, t.cellY, n]), t.onMatchFx || (t.onMatchFx = []), t.onMatchFx.push(["dummyComboGrowAndFade", [e.frameName, n]]), e.bringToTop(), e.candyType = Math.random(), t.activatedByMove = !0, this.board.checkMatchList.push(this.candy1), !0
            } return !1
    }, G.ActionProcessFall = function(t, e, i) {
        G.Action.call(this, t, e, i), this.madeCrossCollumn = !1, this.board.fallMgr.allCollumsFall()
    }, G.ActionProcessFall.prototype = Object.create(G.Action.prototype), G.ActionProcessFall.prototype.update = function() {
        if (!this.board.duringAnimation && !this.board.duringFall) {
            if (!this.madeCrossCollumn) {
                for (; this.board.fallMgr.crossCollumnFall(););
                return void(this.madeCrossCollumn = !0)
            }
            if (this.board.fallCheckList.forEach(function(t) {
                    this.board.matcher.quickMatchCheck(t) && this.board.checkMatchList.push(t)
                }, this), this.board.fallCheckList = [], 0 != this.board.checkMatchList || 0 < this.board.checkAfterFall.length) {
                for (var t = 0, e = this.board.checkAfterFall.length; t < e; t++) this.board.checkMatchList.push(this.board.checkAfterFall[t]);
                this.board.checkAfterFall = [], this.am.newAction("processMatch")
            }
            G.sb("actionFallEnd").dispatch(), this.board.checkGoalCandy(), this.finish()
        }
    }, G.ActionProcessMatch = function(t, e, i) {
        G.Action.call(this, t, e, i), this.preFall = !0, this.processed = !1
    }, G.ActionProcessMatch.prototype = Object.create(G.Action.prototype), G.ActionProcessMatch.prototype.update = function() {
        this.board.duringAnimation || this.board.duringFall || this.board.matcher.processMatchList(), this.board.duringAnimation || this.board.duringFall || 0 != this.board.checkMatchList || 0 != this.board.checkSpecialMatchList || (this.am.newAction("processFall"), this.finish())
    }, G.ActionShuffle = function(t, e, i) {
        G.Action.call(this, t, e, i), this.state = game.state.getCurrentState(), this.board = this.state.board, this.shuffleText = new G.Text(0, 0, G.txt("No possible match - shuffling"), {
            style: "font-blue",
            fontSize: "70px"
        }, .5, 620), this.shuffleText.position.setTo(this.board.x + .5 * (this.board.width - 2 * this.board.tilesize), this.board.y + .45 * (this.board.height - 2 * this.board.tilesize)), game.state.getCurrentState().UIFxLayer.add(this.shuffleText), this.shuffleText.scale.setTo(0), game.add.tween(this.shuffleText.scale).to({
            x: 1,
            y: 1
        }, 400, Phaser.Easing.Elastic.Out, !0), this.updateActive = !1, game.add.tween(this.shuffleText).to({
            alpha: 0
        }, G.IMMEDIATE ? 1 : 300, Phaser.Easing.Sinusoidal.Out, !0, G.IMMEDIATE ? 10 : 2e3).onComplete.add(function() {
            this.board.shuffleCandies(), this.updateActive = !0, this.shuffleText.destroy()
        }, this)
    }, G.ActionShuffle.prototype = Object.create(G.Action.prototype), G.ActionShuffle.prototype.update = function() {
        this.updateActive && (this.board.duringAnimation || this.board.duringFall || (this.updateActive = !1, 0 == this.board.checkMatchList.length ? this.finish() : G.IMMEDIATE ? this.finish() : game.time.events.add(300, this.finish, this)))
    }, G.ActionStartBoosters = function(t, e, i) {
        G.Action.call(this, t, e, i), this.state = game.state.getCurrentState(), this.boosters = [], this.popCounter = 0, this.positions = this.generatePositions(), this.positionIndex = 0;
        this.delay = 500, this.delayIncrease = 200;
        var s = this.state.startBoosters || [];
        this.normals = this.getTargetCandies(), this.normalsIndex = 0, this.initStartBoosters(s), G.MYSTERYGIFT && !this.state.flags.mysteryBoostersInitialized && (this.state.flags.mysteryBoostersInitialized = !0, this.initMysteryGifts(G.saveState.mysteryGift_getCurrentGifts())), this.state.UIFxLayer.addMultiple(this.boosters), this.boosters.forEach(function(t) {
            t.events.onDestroy.add(function() {
                this.popCounter++
            }, this)
        }, this)
    }, G.ActionStartBoosters.prototype = Object.create(G.Action.prototype), G.ActionStartBoosters.prototype.update = function() {
        this.popCounter == this.boosters.length && this.finish()
    }, G.ActionStartBoosters.prototype.generatePositions = function() {
        for (var t = [], e = .15; e <= .85; e += .14)
            for (var i = .15; i <= .85; i += .14) t.push([e + game.rnd.realInRange(-.02, .02), i + game.rnd.realInRange(-.02, .02)]);
        return Phaser.ArrayUtils.shuffle(t)
    }, G.ActionStartBoosters.prototype.initStartBoosters = function(t) {
        t[5] && (G.saveState.useStartBooster(5), (i = new G.StartBoosterBubble(this.positions[this.positionIndex++], "ui_booster_5", this.state.topBar.movesTxt, function() {
            G.lvl.changeMoveNumber(5)
        })).goToTarget(this.delay), this.delay += this.delayIncrease, this.boosters.push(i), G.sb("onStartBoosterUsed").dispatch(6), G.lvl.onPreBoosterUse(6));
        if (t[7]) {
            for (var e = 0; e < 3; e++) {
                var i;
                if (this.normals[this.normalsIndex + 1])(i = new G.StartBoosterBubble(this.positions[this.positionIndex++], "ui_booster_7", this.normals[this.normalsIndex++], function() {
                    this.target.changeInto(Math.random() < .5 ? "vertical" : "horizontal")
                })).goToTarget(this.delay), this.delay += this.delayIncrease, this.boosters.push(i), G.sb("onStartBoosterUsed").dispatch(7)
            }
            G.saveState.useStartBooster(7), G.lvl.onPreBoosterUse(7)
        }
        t[8] && (this.normals[this.normalsIndex + 1] && (G.saveState.useStartBooster(8), (i = new G.StartBoosterBubble(this.positions[this.positionIndex++], "ui_booster_8", this.normals[this.normalsIndex++], function() {
            this.target.changeInto("spiral")
        })).goToTarget(this.delay), this.delay += this.delayIncrease, this.boosters.push(i), G.sb("onStartBoosterUsed").dispatch(8), G.lvl.onPreBoosterUse(8)))
    }, G.ActionStartBoosters.prototype.initMysteryGifts = function(t) {
        t.forEach(this.addChangeIntoBooster, this)
    }, G.ActionStartBoosters.prototype.addChangeIntoBooster = function(t) {
        var e = this.normals[this.normalsIndex + 1];
        if (e) {
            var i = {
                    cross: "ui_booster_9",
                    vertical: "ui_booster_3",
                    spiral: "ui_booster_8",
                    horizontal: "ui_booster_4"
                } [t].replace("%%", e.frameName),
                s = new G.StartBoosterBubble(this.positions[this.positionIndex], i, e, function() {
                    this.target.changeInto(t)
                });
            this.normalsIndex++, this.positionIndex++, s.goToTarget(this.delay), this.delay += this.delayIncrease, this.boosters.push(s)
        }
    }, G.ActionStartBoosters.prototype.getTargetCandies = function() {
        var t = this.board.boardCandies.getNormalCandies();
        Phaser.ArrayUtils.shuffle(t);
        var i = [],
            s = [];
        return t.forEach(function(e) {
            i.find(function(t) {
                return this.board.boardCandies.areCandiesNeighbours(e, t)
            }, this) ? s.push(e) : i.push(e)
        }, this), i.concat(s)
    }, G.BoardLayer = function(t, e) {
        Phaser.Group.call(this, game), this.position = t.position, this.scale = t.scale, this.board = t, this.boardData = t.boardData, this.config = e, this.grid = new G.GridArray(this.boardData.width, this.boardData.height, !1)
    }, G.BoardLayer.prototype = Object.create(Phaser.Group.prototype), G.BoardLayer.prototype.isMoveBlocked = function(t, e) {
        return this.isToken(t, e) && this.config.blockMove
    }, G.BoardLayer.prototype.isMatchBlocked = function(t, e) {
        return this.isToken(t, e) && this.config.blockMatch
    }, G.BoardLayer.prototype.isBoosterChangeBlocked = function(t, e) {
        return this.isToken(t, e) && this.config.blockMove
    }, G.BoardLayer.prototype.isProperChunk = function(t) {
        return 0 === t.indexOf(this.config.editorSymbol)
    }, G.BoardLayer.prototype.createToken = function(t, e, i) {
        var s = this.add(new this.config.constructor(this, t, e, i));
        return this.grid.set(t, e, s), s.grid = this.grid, s
    }, G.BoardLayer.prototype.import = function(t, e, i) {
        return 0 === i.indexOf(this.config.editorSymbol) && (this.config.hpToken && this.createToken(t, e, i[this.config.editorSymbol.length]), !0)
    }, G.BoardLayer.prototype.export = function(t, e) {
        var i = this.getToken(t, e);
        return i ? this.config.hpToken ? this.config.editorSymbol + i.hp : i.export ? i.export() : this.config.editorSymbol : null
    }, G.BoardLayer.prototype.getRandom = function() {
        if (0 == this.children.length) return !1;
        for (var t, e = this.children.length, i = (game.rnd.between(0, e), 0); i < e; i++)
            if ((t = this.children[i]) && this.grid.get(t.cellX, t.cellY) == t) return t;
        return !1
    }, G.BoardLayer.prototype.removeToken = function(t, e) {
        var i = this.grid.get(t, e);
        if (i) {
            this.grid.set(t, e, !1), this.config.collectableType && G.sb("onCollectableRemove").dispatch(this.config.collectableType, i, i.frameName), i.deathAnimation();
            var s = this.board.getCandy(t, e);
            s && (this.config.blockMove && this.board.pushToFallCheckList(s), this.config.blockMatch && this.board.matcher.quickMatchCheck(s) && this.board.checkMatchList.push(s))
        }
    }, G.BoardLayer.prototype.onMatch = function(t, e) {
        var i = this.getToken(t, e);
        return !i || (i.onMatch(), !this.config.stopMatchPropagation)
    }, G.BoardLayer.prototype.onHit = function(t, e) {
        var i = this.getToken(t, e);
        return !i || (i.onHit(), !this.config.stopHitPropagation)
    }, G.BoardLayer.prototype.isCellFree = function(t, e) {
        return !this.grid.get(t, e)
    }, G.BoardLayer.prototype.getToken = function(t, e) {
        return this.grid.get(t, e)
    }, G.BoardLayer.prototype.isToken = G.BoardLayer.prototype.getToken, G.BoardLayer.prototype.destroyCell = G.BoardLayer.prototype.removeToken, G.BoardToken = function(t, e, i, s, a) {
        Phaser.Image.call(this, game, t.board.cellXToPxIn(i), t.board.cellYToPxIn(s)), this.board = t.board, this.config = e, this.anchor.setTo(.5), this.layer = t, this.layerGrid = t.grid, this.cellX = i, this.cellY = s, this.hp = parseInt(a)
    }, G.BoardToken.prototype = Object.create(Phaser.Image.prototype), G.BoardToken.prototype.onMatch = function() {}, G.BoardToken.prototype.onHit = function() {}, G.BoardToken.prototype.remove = function() {
        this.layer.removeToken(this.cellX, this.cellY)
    }, G.BoardToken.prototype.deathAnimation = function() {
        this.destroy()
    }, G.BoardConcrete = function(t) {
        G.BoardLayer.call(this, t, {
            constructor: G.Concrete,
            maxHp: 3,
            hpToken: !0,
            editorSymbol: "cn",
            blockMove: !0,
            blockBoosterChange: !0,
            collectableType: "concrete",
            stopMatchPropagation: !0,
            stopHitPropagation: !0
        })
    }, G.BoardConcrete.prototype = Object.create(G.BoardLayer.prototype), G.BoardDirt = function(t) {
        G.BoardLayer.call(this, t, {
            constructor: G.Dirt,
            maxHp: 3,
            hpToken: !0,
            editorSymbol: "dirt",
            collectableType: "dirt"
        })
    }, G.BoardDirt.prototype = Object.create(G.BoardLayer.prototype), G.BoardDirtS = function(t) {
        G.BoardLayer.call(this, t, {
            constructor: G.DirtS,
            maxHp: 3,
            hpToken: !0,
            editorSymbol: "dS",
            collectableType: "dirtS"
        }), this.decreasedToken = !1, G.sb("hitDirtS").add(function(t) {
            this.decreasedToken = !0
        }, this), G.sb("actionQueueEmptyAfterMove").add(function() {
            this.decreasedToken || this.spread(), this.decreasedToken = !1
        }, this)
    }, G.BoardDirtS.prototype = Object.create(G.BoardLayer.prototype), G.BoardDirtS.prototype.spread = function() {
        for (var t = ["U", "D", "L", "R", "I"], e = this.children.length, i = game.rnd.between(0, e - 1), s = 0; s < e; s++) {
            var a = this.children[(s + i) % e];
            Phaser.ArrayUtils.shuffle(t);
            for (var n = 0; n < t.length; n++) {
                switch (t[n]) {
                    case "U":
                        if (this.isSpreadPossible(a.cellX, a.cellY - 1)) return void this.spreadToken(a.cellX, a.cellY - 1);
                        break;
                    case "D":
                        if (this.isSpreadPossible(a.cellX, a.cellY + 1)) return void this.spreadToken(a.cellX, a.cellY + 1);
                        break;
                    case "L":
                        if (this.isSpreadPossible(a.cellX - 1, a.cellY)) return void this.spreadToken(a.cellX - 1, a.cellY);
                        break;
                    case "R":
                        if (this.isSpreadPossible(a.cellX + 1, a.cellY)) return void this.spreadToken(a.cellX + 1, a.cellY)
                }
            }
        }
    }, G.BoardDirtS.prototype.isSpreadPossible = function(t, e) {
        var i = !0;
        this.board.boardDirt && this.board.boardDirt.isToken(t, e) && (i = !1);
        var s = !0;
        this.board.boardIce && this.board.boardIce.isToken(t, e) && (s = !1);
        var a = !0;
        return this.board.boardCage && this.board.boardCage.isToken(t, e) && (a = !1), this.board.isCellOnBoard(t, e) && !this.getToken(t, e) && i && a && s
    }, G.BoardDirtS.prototype.spreadToken = function(t, e) {
        G.sb("onCollectableAdded").dispatch("dirtS");
        var i = this.createToken(t, e, 1);
        game.add.tween(i.scale).from({
            x: 0,
            y: 0
        }, 500, Phaser.Easing.Sinusoidal.Out, !0)
    }, G.BoardIce = function(t) {
        G.BoardLayer.call(this, t, {
            constructor: G.Ice,
            maxHp: 4,
            hpToken: !0,
            editorSymbol: "ice",
            collectableType: "ice",
            blockMove: !0,
            blockMatch: !0,
            blockBoosterChange: !0,
            stopHitPropagation: !0
        })
    }, G.BoardIce.prototype = Object.create(G.BoardLayer.prototype), G.BoardJam = function(t) {
        G.BoardLayer.call(this, t, {
            constructor: G.Jam,
            maxHp: 3,
            hpToken: !0,
            editorSymbol: "jam",
            collectableType: "jam",
            blockMove: !0,
            blockMatch: !0,
            stopHitPropagation: !0
        }), this.decreasedToken = !1, G.sb("hitJam").add(function(t) {
            this.decreasedToken = !0
        }, this), G.sb("actionQueueEmptyAfterMove").add(function() {
            this.decreasedToken || this.spread(), this.decreasedToken = !1
        }, this)
    }, G.BoardJam.prototype = Object.create(G.BoardLayer.prototype), G.BoardJam.prototype.spread = function() {
        for (var t = ["U", "D", "L", "R", "I"], e = this.children.length, i = game.rnd.between(0, e - 1), s = 0; s < e; s++) {
            var a = this.children[(s + i) % e];
            Phaser.ArrayUtils.shuffle(t);
            for (var n = 0; n < t.length; n++) {
                switch (t[n]) {
                    case "U":
                        if (this.isSpreadPossible(a.cellX, a.cellY - 1)) return void this.spreadToken(a.cellX, a.cellY - 1);
                        break;
                    case "D":
                        if (this.isSpreadPossible(a.cellX, a.cellY + 1)) return void this.spreadToken(a.cellX, a.cellY + 1);
                        break;
                    case "L":
                        if (this.isSpreadPossible(a.cellX - 1, a.cellY)) return void this.spreadToken(a.cellX - 1, a.cellY);
                        break;
                    case "R":
                        if (this.isSpreadPossible(a.cellX + 1, a.cellY)) return void this.spreadToken(a.cellX + 1, a.cellY);
                        break;
                    case "I":
                        if (a.hp < this.config.maxHp) return void a.increaseHp()
                }
            }
        }
    }, G.BoardJam.prototype.isSpreadPossible = function(t, e) {
        return this.board.isCellOnBoard(t, e) && !this.getToken(t, e)
    }, G.BoardJam.prototype.spreadToken = function(t, e) {
        var i = this.createToken(t, e, 1);
        game.add.tween(i.scale).from({
            x: 0,
            y: 0
        }, 500, Phaser.Easing.Sinusoidal.Out, !0)
    }, G.Concrete = function(t, e, i, s) {
        G.BoardToken.call(this, t, {
            tokenType: "concrete"
        }, e, i, s), G.changeTexture(this, "concrete_" + this.hp)
    }, G.Concrete.prototype = Object.create(G.BoardToken.prototype), G.Concrete.prototype.onMatch = function() {
        G.sb("fx").dispatch("burstConcrete", this, this.hp), G.sfx.explosion_subtle.play(), this.hp--, G.sb("fxTop").dispatch("burstConcreteAnim", this, this), G.sfx.brick_break.play(), 0 == this.hp ? this.remove() : G.changeTexture(this, "concrete_" + this.hp)
    }, G.Dirt = function(t, e, i, s) {
        G.BoardToken.call(this, t, {
            tokenType: "dirt"
        }, e, i, s), G.changeTexture(this, "dirt_" + this.hp)
    }, G.Dirt.prototype = Object.create(G.BoardToken.prototype), G.Dirt.prototype.onMatch = function() {
        G.sb("fxTop").dispatch("burstDirtAnim", this, this), this.hp--, 0 < this.hp ? G.changeTexture(this, "dirt_" + this.hp) : this.remove()
    }, G.DirtS = function(t, e, i, s) {
        G.BoardToken.call(this, t, {
            tokenType: "dirtS"
        }, e, i, s), G.changeTexture(this, "dirt_s_" + this.hp), this.top
    }, G.DirtS.prototype = Object.create(G.BoardToken.prototype), G.DirtS.prototype.onMatch = function() {
        G.sb("hitDirtS").dispatch(this), G.sb("fxTop").dispatch("burstDirtAnim", this, this), this.hp--, 0 < this.hp ? G.changeTexture(this, "dirt_s_" + this.hp) : this.remove()
    }, G.DirtS.prototype.increaseHp = function() {
        this.hp++, G.changeTexture(this, "dirt_s_" + this.hp)
    }, G.Ice = function(t, e, i, s) {
        G.BoardToken.call(this, t, {
            tokenType: "ice"
        }, e, i, s), G.changeTexture(this, "ice_front"), this.breakImg = G.makeImage(0, 0, null, .5, this), this.hp < 4 && G.changeTexture(this.breakImg, "ice_crack_" + this.hp)
    }, G.Ice.prototype = Object.create(G.BoardToken.prototype), G.Ice.prototype.onHit = function() {
        G.sfx.explosion_subtle.play(), G.sb("fxTop").dispatch("burstIce", this, this), this.hp--, 0 < this.hp ? G.changeTexture(this.breakImg, "ice_crack_" + this.hp) : (G.sb("fx").dispatch("smallCircle", this), this.remove())
    }, G.Jam = function(t, e, i, s) {
        G.BoardToken.call(this, t, {
            tokenType: "jam"
        }, e, i, s), G.changeTexture(this, "jam_" + this.hp)
    }, G.Jam.prototype = Object.create(G.BoardToken.prototype), G.Jam.prototype.onHit = function() {
        if (G.sb("hitJam").dispatch(this), G.sfx.explosion_subtle.play(), this.hp--, 0 == this.hp) {
            this.remove();
            this.board.removeCandy(this.cellX, this.cellY, !0)
        } else G.changeTexture(this, "jam_" + this.hp)
    }, G.Jam.prototype.increaseHp = function() {
        this.hp++, G.changeTexture(this, "jam_" + this.hp)
    }, G.EditorDropPanel = function(t, e) {
        Phaser.Group.call(this, game), this.x = G.l(t), this.y = G.l(e), this.goalTxt = new G.Text(0, 0, "% DROPS:", {
            font: "Verdana",
            fontWeight: "bold",
            fontSize: 40,
            fill: "white",
            stroke: "black",
            strokeThickness: 5
        }, [0, .5], 400), this.add(this.goalTxt), this.drops = G.lvlData.drops, this.makeField(50, "candy_chest", "chest"), this.makeField(100, "blocker_chain_wrapped", "chain"), this.makeField(150, "candy_infection", "infection"), this.makeField(200, "candy_goalCandy", "goalCandy")
    }, G.EditorDropPanel.prototype = Object.create(Phaser.Group.prototype), G.EditorDropPanel.prototype.makeField = function(t, e, i) {
        G.makeImage(50, t, e, [0, .5], this).scale.setTo(.6);
        var s = new G.Text(150, t - 30, this.drops[i] || "0", {
            font: "Verdana",
            fontWeight: "bold",
            fontSize: 40,
            fill: "#a8dbc6",
            stroke: "black",
            strokeThickness: 5
        });
        s.inputEnabled = !0, s.input.useHandCursor = !0, s.events.onInputDown.add(function() {
            var t = prompt("Enter % of getting " + i),
                e = parseFloat(t);
            isNaN(e) || e < 0 || 100 <= e || (G.lvlData.drops[i] = e, this.setText(e.toString()))
        }, s), this.add(s)
    }, G.EditorDropZones = function(t, e) {
        Phaser.Group.call(this, game), this.board = t, this.position = t.position, this.scale = t.scale, this.dropZones = [], this.import(e)
    }, G.EditorDropZones.prototype = Object.create(Phaser.Group.prototype), G.EditorDropZones.prototype.import = function(t) {
        t && (this.update(), t.forEach(function(t, i) {
            t.forEach(function(t, e) {
                this.dropZones[i].addElement(t, e)
            }, this)
        }, this))
    }, G.EditorDropZones.prototype.export = function() {
        return this.dropZones.filter(function(t) {
            return null !== t
        }).map(function(t) {
            return t.elements
        })
    }, G.EditorDropZones.prototype.update = function() {
        for (var t = Math.max(this.dropZones.length, this.board.boardData.width), e = 0; e < t; e++) e < this.board.boardData.width ? this.dropZones[e] ? this.dropZones[e].update() : this.dropZones[e] = this.add(new G.EditorDropZone(this.board, e)) : this.dropZones[e] && (this.dropZones[e].destroy(), this.dropZones[e] = null)
    }, G.EditorDropZone = function(t, e) {
        Phaser.Group.call(this, game), this.board = t, this.col = e, this.elements = [], this.elementsObj = [], this.x = e * t.tilesize, this.y = this.getTopTile() * t.tilesize, this.gfx = game.add.graphics(), this.add(this.gfx), this.redrawGfx(), this.gfx.inputEnabled = !0, this.keys = game.input.keyboard.addKeys({
            one: Phaser.Keyboard.ONE,
            two: Phaser.Keyboard.TWO,
            three: Phaser.Keyboard.THREE,
            four: Phaser.Keyboard.FOUR,
            five: Phaser.Keyboard.FIVE,
            six: Phaser.Keyboard.SIX,
            seven: Phaser.Keyboard.SEVEN,
            eight: Phaser.Keyboard.EIGHT,
            nine: Phaser.Keyboard.NINE,
            zero: Phaser.Keyboard.ZERO,
            bs: Phaser.Keyboard.BACKSPACE
        }), this.keys.one.onDown.add(function() {
            this.onBtnPressed("1")
        }, this), this.keys.two.onDown.add(function() {
            this.onBtnPressed("2")
        }, this), this.keys.three.onDown.add(function() {
            this.onBtnPressed("3")
        }, this), this.keys.four.onDown.add(function() {
            this.onBtnPressed("4")
        }, this), this.keys.five.onDown.add(function() {
            this.onBtnPressed("5")
        }, this), this.keys.six.onDown.add(function() {
            this.onBtnPressed("6")
        }, this), this.keys.seven.onDown.add(function() {
            this.onBtnPressed("r")
        }, this), this.keys.eight.onDown.add(function(t) {
            t.shiftKey ? this.onBtnPressed("chest_th") : this.onBtnPressed("chest")
        }, this), this.keys.nine.onDown.add(function() {
            this.onBtnPressed("goalCandy")
        }, this), this.keys.bs.onDown.add(this.removeLastElement, this)
    }, G.EditorDropZone.prototype = Object.create(Phaser.Group.prototype), G.EditorDropZone.prototype.onBtnPressed = function(t) {
        if (this.gfx.input.pointerOver()) {
            var e = Math.floor((this.gfx.worldPosition.y - game.input.activePointer.worldY) / (this.board.tilesize * this.board.scale.y));
            this.addElement(t, e)
        }
    }, G.EditorDropZone.prototype.addElement = function(t, e) {
        this.elementsObj[e] && this.elementsObj[e].destroy(), this.elements[e] = t, this.elementsObj[e] = G.makeImage(.5 * this.board.tilesize, (e + .5) * this.board.tilesize * -1, "candy_" + t, .5, this), this.redrawGfx()
    }, G.EditorDropZone.prototype.removeLastElement = function(t) {
        this.gfx.input.pointerOver() && 0 < this.elements.length && (this.elements.splice(-1, 1), this.elementsObj.splice(-1, 1)[0].destroy()), this.redrawGfx()
    }, G.EditorDropZone.prototype.redrawGfx = function() {
        var t = this.board.tilesize;
        this.gfx.clear(), this.gfx.beginFill(255, .5);
        var e = Math.max(1, this.elements.length + 1) * t;
        this.gfx.drawRect(0, -e, t, e)
    }, G.EditorDropZone.prototype.update = function() {
        var t = this.getTopTile();
        null === t ? this.visible = !1 : this.y = t * this.board.tilesize, this.gfx.input.pointerOver() ? this.gfx.alpha = 1 : this.gfx.alpha = .1
    }, G.EditorDropZone.prototype.getTopTile = function(t) {
        for (var e = 0; e < this.board.boardData.height; e++)
            if (this.board.isCellOnBoard(this.col, e)) return e;
        return null
    }, G.EditorGoalDropPanel = function(t, e) {
        Phaser.Group.call(this, game), this.x = G.l(t), this.y = G.l(e), G.lvlData.goalDrops || (G.lvlData.goalDrops = []), this.goalTxt = new G.Text(0, 0, "DROPS:", {
            font: "Verdana",
            fontWeight: "bold",
            fontSize: 40,
            fill: "white",
            stroke: "black",
            strokeThickness: 5
        }, [0, .5], 400), this.plusBtn = new G.Button(200, 0, "plus_ico", function() {
            this.makeGoalItem(this.goals.length)
        }, this), this.minusBtn = new G.Button(240, 0, "minus_ico", function() {
            0 != this.goals.length && this.removeGoal()
        }, this), this.addMultiple([this.goalTxt, this.plusBtn, this.minusBtn]), this.goals = [], this.loadLvlDrops()
    }, G.EditorGoalDropPanel.prototype = Object.create(Phaser.Group.prototype), G.EditorGoalDropPanel.prototype.loadLvlDrops = function() {
        G.lvlData.goalDrops.forEach(function(t, e) {
            this.makeGoalItem(e, t[0], t[1])
        }, this)
    }, G.EditorGoalDropPanel.prototype.removeGoal = function() {
        this.goals.pop().destroy(), G.lvlData.goalDrops.pop()
    }, G.EditorGoalDropPanel.prototype.makeGoalItem = function(t, e, i) {
        var s = game.make.group();
        s.goalIndex = t, s.x = G.l(100), s.y = G.l(50 + 50 * t), s.allGoals = ["goalCandy"], s.goalName = e || s.allGoals[0], s.goalNr = i || 5, s.img = G.makeImage(-50, 0, null, .5, s), s.img.scale.setTo(.6), s.img.refreshGraphics = function() {
            G.changeTexture(this, G.json.settings.goals[this.parent.goalName].sprite)
        }, s.img.refreshGraphics(), s.img.inputEnabled = !0, s.img.input.useHandCursor = !0, s.img.events.onInputDown.add(function() {
            var t = s.allGoals.indexOf(s.goalName);
            s.goalName = s.allGoals[(t + 1) % s.allGoals.length], G.lvlData.goalDrops[s.goalIndex][0] = s.goalName, s.img.refreshGraphics()
        }), s.nr = new G.Text(50, 0, s.goalNr.toString(), {
            font: "Verdana",
            fontWeight: "bold",
            fontSize: 40,
            fill: "#a8dbc6",
            stroke: "black",
            strokeThickness: 5
        }), s.add(s.nr), s.nr.anchor.setTo(0, .5), s.nr.inputEnabled = !0, s.nr.input.useHandCursor = !0, s.nr.events.onInputDown.add(function() {
            var t = prompt("Enter moves number");
            isNaN(parseInt(t)) || (G.lvlData.goalDrops[s.goalIndex][1] = parseInt(t), s.goalNr = t, s.nr.setText(s.goalNr.toString()))
        }), this.add(s), this.goals.push(s), t >= G.lvlData.goalDrops.length && G.lvlData.goalDrops.push([s.goalName, s.goalNr])
    }, G.EditorGoalPanel = function(t, e) {
        Phaser.Group.call(this, game), this.x = G.l(t), this.y = G.l(e), this.state = game.state.getCurrentState(), this.goalTxt = new G.Text(0, 0, "GOAL:", {
            font: "Verdana",
            fontWeight: "bold",
            fontSize: 40,
            fill: "white",
            stroke: "black",
            strokeThickness: 5
        }, [0, .5], 400), this.plusBtn = new G.Button(160, 0, "plus_ico", function() {
            "points" !== G.lvlData.goal[0] && (4 <= this.goals.length || this.makeGoalItem(this.goals.length))
        }, this), this.plusBtn.IMMEDIATE = !0, this.minusBtn = new G.Button(200, 0, "minus_ico", function() {
            "points" !== G.lvlData.goal[0] && 1 != this.goals.length && this.removeGoal()
        }, this), this.minusBtn.IMMEDIATE = !0, this.changeGoalType = new G.Button(270, 0, "minus_ico", function() {
            "points" === G.lvlData.goal[0] ? G.lvlData.goal = ["collect", [
                ["1", 5],
                ["2", 5]
            ]] : G.lvlData.goal = ["points", 5e3], this.loadLvlGoals()
        }, this), this.changeGoalType.IMMEDIATE = !0, this.changeGoalType.angle = 90, this.addMultiple([this.goalTxt, this.plusBtn, this.minusBtn, this.changeGoalType]), this.goals = [], this.normals = ["1", "2", "3", "4", "5", "6"];
        var i = "points" === G.lvlData.goal[0] ? G.lvlData.goal[1] : 1e3;
        this.pointTxt = new G.Text(50, 50, i, {
            font: "Verdana",
            fontWeight: "bold",
            fontSize: 40,
            fill: "#a8dbc6",
            stroke: "black",
            strokeThickness: 5
        }), this.add(this.pointTxt), this.pointTxt.anchor.setTo(0, .5), this.pointTxt.inputEnabled = !0, this.pointTxt.input.useHandCursor = !0, this.pointTxt.events.onInputDown.add(function() {
            var t = prompt("Enter points target");
            isNaN(parseInt(t)) || (G.lvlData.goal[1] = parseInt(t), this.setText(parseInt(t)))
        }, this.pointTxt), this.loadLvlGoals()
    }, G.EditorGoalPanel.prototype = Object.create(Phaser.Group.prototype), G.EditorGoalPanel.prototype.update = function() {
        if ("points" !== G.lvlData.goal[0])
            for (var t = 0; t < this.goals.length; t++) this.updateGoal(this.goals[t])
    }, G.EditorGoalPanel.prototype.loadLvlGoals = function() {
        if (this.goals.forEach(function(t) {
                t.destroy()
            }), this.goals = [], "points" == G.lvlData.goal[0]) return this.pointTxt.visible = !0, void this.pointTxt.setText(G.lvlData.goal[1]);
        this.pointTxt.visible = !1, G.lvlData.goal[1].forEach(function(t, e) {
            this.makeGoalItem(e, t[0], t[1])
        }, this)
    }, G.EditorGoalPanel.prototype.removeGoal = function() {
        this.goals.pop().destroy(), G.lvlData.goal[1].pop()
    }, G.EditorGoalPanel.prototype.makeGoalItem = function(t, e, i) {
        var s = game.make.group();
        s.goalIndex = t, s.x = G.l(50), s.y = G.l(50 + 50 * t), s.allGoals = Object.keys(G.json.settings.goals), s.goalName = e || s.allGoals[0], s.goalNr = i || 5, s.img = G.makeImage(0, 0, null, .5, s), s.img.scale.setTo(.6), s.img.refreshGraphics = function() {
            this.parent.goalName;
            G.changeTexture(this, G.json.settings.goals[this.parent.goalName].sprite)
        }, s.img.refreshGraphics(), s.img.inputEnabled = !0, s.img.input.useHandCursor = !0, s.img.events.onInputDown.add(function() {
            var t = s.allGoals.indexOf(s.goalName);
            s.goalName = s.allGoals[(t + 1) % s.allGoals.length], G.lvlData.goal[1][s.goalIndex][0] = s.goalName, s.img.refreshGraphics()
        }), s.alert = new G.Text(250, 0, "ALERT", {
            font: "Verdana",
            fontWeight: "bold",
            fontSize: 40,
            fill: "white",
            stroke: "black",
            strokeThickness: 5
        }), s.alert.anchor.setTo(0, .5), s.alert.visible = !1, s.add(s.alert), s.nr = new G.Text(50, 0, s.goalNr.toString(), {
            font: "Verdana",
            fontWeight: "bold",
            fontSize: 40,
            fill: "#a8dbc6",
            stroke: "black",
            strokeThickness: 5
        }), s.add(s.nr), s.nr.anchor.setTo(0, .5), s.nr.inputEnabled = !0, s.nr.input.useHandCursor = !0, s.nr.events.onInputDown.add(function() {
            var t = prompt("Enter moves number");
            isNaN(parseInt(t)) || (G.lvlData.goal[1][s.goalIndex][1] = parseInt(t), s.goalNr = t, s.nr.setText(s.goalNr.toString()))
        }), this.add(s), this.goals.push(s), t >= G.lvlData.goal[1].length && G.lvlData.goal[1].push([s.goalName, s.goalNr])
    }, G.EditorGoalPanel.prototype.updateGoal = function(t) {
        var e = t.goalNr.toString();
        if (-1 !== this.normals.indexOf(t.goalName)) t.nr.setText(e), t.nr.fill = "#a8dbc6";
        else {
            var i, s = !1;
            "concrete" === t.goalName && (i = this.countConcrete()), "goalCandy" === t.goalName ? i = this.countGoalCandies() : "ice" === t.goalName ? i = this.countIce() : "dirt" === t.goalName ? i = this.countDirt() : "chain" === t.goalName ? (i = this.countChains(), s = 0 < G.lvlData.drops.chain) : "infection" === t.goalName && (i = this.countInfections(), s = 0 < G.lvlData.drops.infection), e += " (" + i + ")", t.nr.setText(" "), t.nr.setText(e), t.goalNr > i ? t.nr.fill = s ? "#ffa500" : "#ff0000" : t.nr.fill = "#a8dbc6"
        }
    }, G.EditorGoalPanel.prototype.countConcrete = function() {
        var e = 0;
        return this.state.board.boardCage.grid.loop(function(t) {
            null !== t && !1 !== t && e++
        }), e
    }, G.EditorGoalPanel.prototype.countGoalCandies = function() {
        var e = 0;
        return this.state.board.boardCandies.grid.loop(function(t) {
            null !== t && !1 !== t && "goalCandy" == t.candyType && e++
        }), G.lvlData.goalDrops.forEach(function(t) {
            "goalCandy" === t[0] && e++
        }), e
    }, G.EditorGoalPanel.prototype.countDirt = function() {
        var e = 0;
        return this.state.board.boardDirt.grid.loop(function(t) {
            null !== t && !1 !== t && e++
        }), e
    }, G.EditorGoalPanel.prototype.countChains = function() {
        var e = 0;
        return this.state.board.boardCandies.grid.loop(function(t) {
            null !== t && !1 !== t && t.wrapped && e++
        }), e
    }, G.EditorGoalPanel.prototype.countIce = function() {
        var e = 0;
        return this.state.board.boardIce.grid.loop(function(t) {
            null !== t && !1 !== t && e++
        }), e
    }, G.EditorGoalPanel.prototype.countInfections = function() {
        var e = 0;
        return this.state.board.boardCandies.grid.loop(function(t) {
            null !== t && !1 !== t && "infection" === t.candyType && e++
        }), e
    }, void 0 === G && (G = {}), G.EditorSidePanel = function(t) {
        Phaser.Group.call(this, game), this.state = game.state.getCurrentState(), this.x = t, this.makeKeyLabels(0, 0), this.makeBoardSizeController(0, 150), this.makeMoveController(0, 220), this.makeMaxNumberController(0, 270), this.makeStarsReqController(0, 320), this.makeTutorialIdBtn(0, 370), this.goalPanel = new G.EditorGoalPanel(0, 470), this.add(this.goalPanel), this.dropPanel = new G.EditorDropPanel(350, 470), this.add(this.dropPanel), this.dropGoalPanel = new G.EditorGoalDropPanel(650, 470), this.add(this.dropGoalPanel), this.makeShowAsHardControls(0, Math.max(this.goalPanel.bottom, this.dropPanel.bottom, this.dropGoalPanel.bottom)), this.backBtn = this.makeTextBtn(0, 1370, "Back to WORLD MAP", function() {
            this.exportLevel(), game.state.start("EditorWorld", !0, !1, G.lvlNr)
        }, this), this.makeNextPrevExport(0, 1420)
    }, G.EditorSidePanel.prototype = Object.create(Phaser.Group.prototype), G.EditorSidePanel.prototype.makeShowAsHardControls = function(t, e) {
        var a = this;
        this.hard = function() {
            var t = game.make.group(),
                e = a.makeText(0, 0, "Show as:");
            t.add(e);
            var i = G.makeImage(e.right + 10, 0, null, 0, t);
            return i.inputEnabled = !0, i.input.useHandCursor = !0, i.events.onInputDown.add(function() {
                G.lvlData.showAsHard ? delete G.lvlData.showAsHard : G.lvlData.showAsHard = !0, s()
            }), s(), {
                container: t
            };

            function s() {
                G.changeTexture(i, G.lvlData.showAsHard ? "map_point_hard" : "map_point")
            }
        }(), this.hard.container.left = t, this.hard.container.top = e, this.add(this.hard.container)
    }, G.EditorSidePanel.prototype.makeTutorialIdBtn = function(t, e) {
        var i = this.add(game.add.group());
        i.position.setTo(t, e), i.label = i.add(this.makeText(0, 0, "Tutorial ID:"));
        var s = G.lvlData.tutID;
        i.switch = this.makeTextBtn(300, 0, s || "---", function() {
            var t = prompt("Enter tutorial ID");
            0 == t.length ? (delete G.lvlData.tutID, this.setText("---"), this.fill = "#a8dbc6") : (G.lvlData.tutID = t, this.setText(t), this.fill = G.json.tutorials[t] ? "green" : "orange")
        }), i.add(i.switch), s && G.json.tutorials[s] && (i.switch.fill = "green")
    }, G.EditorSidePanel.prototype.makeNextPrevExport = function(t, e) {
        this.makeTextBtn(t + 200, e, "Prev", function() {
            this.exportLevel(), game.state.start("Editor", !0, !1, Math.max(0, G.lvlNr - 1))
        }, this), this.makeTextBtn(t, e, "Play", function() {
            this.exportLevel(), game.state.start("Game", !0, !1, G.lvlNr, !0)
        }, this), this.makeTextBtn(t + 350, e, "Next", function() {
            this.exportLevel(), game.state.start("Editor", !0, !1, Math.min(G.json.levels.length - 1, G.lvlNr + 1))
        }, this), this.makeTextBtn(t + 600, e, "EXPORT", function() {
            this.exportLevel();
            var t = new Blob([JSON.stringify(G.json.levels, null, "\t")], {
                type: "text/plain;charset=utf-8"
            });
            saveAs(t, "levels.json")
        }, this)
    }, G.EditorSidePanel.prototype.makeText = function(t, e, i) {
        i = new G.Text(t, e, i, {
            font: "Verdana",
            fontWeight: "bold",
            fontSize: 40,
            fill: "white",
            stroke: "black",
            strokeThickness: 5
        });
        return this.add(i), i
    }, G.EditorSidePanel.prototype.makeTextBtn = function(t, e, i, s, a) {
        return (i = new G.Text(t, e, i, {
            font: "Verdana",
            fontWeight: "bold",
            fontSize: 40,
            fill: "#a8dbc6",
            stroke: "black",
            strokeThickness: 5
        })).inputEnabled = !0, i.input.useHandCursor = !0, i.events.onInputDown.add(s, a || i), this.add(i), i
    }, G.EditorSidePanel.prototype.makeMaxNumberController = function(t, e) {
        this.maxNrGroup = this.add(game.make.group()), this.maxNrGroup.x = G.l(t), this.maxNrGroup.y = G.l(e), this.maxNrLabel = this.makeText(0, 0, "Types of candies:"), this.maxNrGroup.add(this.maxNrLabel), this.maxNrBtn = this.makeTextBtn(400, 0, G.lvlData.nrOfTypes.toString(), function() {
            var t = prompt("Enter max candy number (4 or 5)"),
                e = parseInt(t);
            isNaN(e) || (G.lvlData.nrOfTypes = parseInt(t), this.maxNrBtn.setText(parseInt(t).toString()))
        }, this), this.maxNrGroup.add(this.maxNrBtn)
    }, G.EditorSidePanel.prototype.makeMoveController = function(t, e) {
        this.moveControllerGroup = this.add(game.make.group()), this.moveControllerGroup.x = G.l(t), this.moveControllerGroup.y = G.l(e), this.moveLabel = this.makeText(0, 0, "Moves:"), this.movesNr = this.makeTextBtn(200, 0, G.lvlData.moves.toString(), function() {
            var t = prompt("Enter moves number");
            isNaN(parseInt(t)) || (G.lvlData.moves = parseInt(t), this.setText(parseInt(t).toString()))
        }), this.moveControllerGroup.addMultiple([this.moveLabel, this.movesNr])
    }, G.EditorSidePanel.prototype.makeStarsReqController = function(t, e) {
        this.starsReqGroup = this.add(game.make.group()), this.starsReqGroup.x = G.l(t), this.starsReqGroup.y = G.l(e), this.starsReqGroup.add(this.makeText(0, 0, "Stars:")), this.btns = [];
        for (var i = 0; i < 3; i++) this.btns[i] = this.makeTextBtn(200 + 150 * i, 0, G.lvlData.starsReq[i].toString(), function() {
            var t = prompt("Enter requirement for " + (this.index + 1) + " stars:"),
                e = parseInt(t);
            isNaN(e) || (G.lvlData.starsReq[this.index] = e, this.setText(e.toString()))
        }), this.btns[i].index = i;
        this.starsReqGroup.addMultiple(this.btns)
    }, G.EditorSidePanel.prototype.makeKeyPreview = function(t, e, i, s) {
        var a = game.add.group();
        a.position.setTo(t, e);
        var n = G.makeImage(0, 0, s, 0, a),
            o = new G.Text(45, 30, i, {
                font: "Verdana",
                fontWeight: "bold",
                fontSize: 20,
                fill: "white",
                stroke: "black",
                strokeThickness: 5
            }, 0);
        a.add(o), n.width = G.l(60), n.height = G.l(60), this.add(a)
    }, G.EditorSidePanel.prototype.makeBoardSizeController = function(t, e) {
        this.makeText(t, e, "Board size:"), this.widthMinus = new G.Button(t + 320, e + 30, "minus_ico", function() {
            this.state.changeBoardSize(Math.max(4, this.state.board.boardData.width - 1), Math.max(4, this.state.board.boardData.height)), this.widthText.setText(this.state.board.boardData.width)
        }, this), this.widthMinus.IMMEDIATE = !0, this.widthText = this.makeText(t + 340, e, this.state.board.boardData.width.toString()), this.widthPlus = new G.Button(t + 390, e + 30, "plus_ico", function() {
            this.state.changeBoardSize(Math.max(4, this.state.board.boardData.width + 1), Math.max(4, this.state.board.boardData.height)), this.widthText.setText(this.state.board.boardData.width)
        }, this), this.widthPlus.IMMEDIATE = !0, this.heightMinus = new G.Button(t + 440, e + 30, "minus_ico", function() {
            this.state.changeBoardSize(Math.max(4, this.state.board.boardData.width), Math.max(4, this.state.board.boardData.height - 1)), this.heightText.setText(this.state.board.boardData.height)
        }, this), this.heightMinus.IMMEDIATE = !0, this.heightText = this.makeText(t + 460, e, this.state.board.boardData.height.toString()), this.heightPlus = new G.Button(t + 510, e + 30, "plus_ico", function() {
            this.state.changeBoardSize(Math.max(4, this.state.board.boardData.width), Math.max(4, this.state.board.boardData.height + 1)), this.heightText.setText(this.state.board.boardData.height)
        }, this), this.heightPlus.IMMEDIATE = !0, this.addMultiple([this.widthMinus, this.widthPlus, this.heightPlus, this.heightMinus])
    }, G.EditorSidePanel.prototype.makeKeyLabels = function(i, s) {
        var a = {
                1: "candy_1",
                2: "candy_2",
                3: "candy_3",
                4: "candy_4",
                5: "candy_5",
                6: "candy_6",
                7: "candy_r",
                8: "candy_chest",
                9: "candy_goalCandy",
                B: "candy_spiral"
            },
            n = {
                E: "concrete_3",
                R: "dirt_2",
                T: "eraser",
                Y: "tile_1",
                W: "ice_front",
                A: "blocker_chain_wrapped",
                S: "candy_infection",
                C: "collect_cell",
                F: "dirt_s_2",
                G: "jam_2",
                S: "candy_infection",
                0: "candy_r"
            };
        Object.keys(a).forEach(function(t, e) {
            this.makeKeyPreview(i + 70 * e, s, t, a[t])
        }, this), Object.keys(n).forEach(function(t, e) {
            this.makeKeyPreview(i + 70 * e, s + 70, t, n[t])
        }, this)
    }, G.EditorSidePanel.prototype.exportLevel = function() {
        var t = new G.GridArray(this.state.board.boardData.width, this.state.board.boardData.height);
        t.loop(function(t, e, i, a) {
            a[e][i] = [], "X" == s.board.boardData.data[e][i] && a[e][i].push("X");
            var n = s.board.boardDirt.grid.data[e][i];
            n && a[e][i].push("dirt" + n.hp);
            var o = s.board.boardDirtS.grid.data[e][i];
            o && a[e][i].push("dS" + o.hp);
            var r = s.board.boardJam.grid.data[e][i];
            r && a[e][i].push("jam" + r.hp);
            var h = s.board.boardIce.grid.data[e][i];
            h && a[e][i].push("ice" + h.hp);
            var l = s.board.boardCage.grid.data[e][i];
            l && a[e][i].push("cn" + l.hp);
            var d = s.board.boardCandies.grid.data[e][i];
            if (d) {
                var c = d.candyType;
                d.blocker && (c += ":B" + d.blockerHp), d.wrapped && (c += ":W"), d.infected && (c += ":I"), d.specialType && ("horizontal" == d.specialType && (c += ":H"), "vertical" == d.specialType && (c += ":V"), "cross" == d.specialType && (c += ":C"), "spiral" == d.specialType && (c = "1:S")), a[e][i].push(c)
            }
        }, this), G.lvlData.predefinedDrops = this.state.dropZones.export(), G.lvlData.levelData = t.data
    }, G.EditorWorldSidePanel = function(t, e) {
        Phaser.Group.call(this, game), this.x = G.l(t), this.y = G.l(e), this.state = game.state.getCurrentState(), this.levelNr = this.makeText(0, 0, "LEVEL: --"), this.add(this.levelNr), this.starsReq = this.makeText(0, 50, "--"), this.add(this.starsReq), this.previewBitmap = game.add.bitmapData(400, 400), this.previewBitmapImg = this.add(this.previewBitmap.addToWorld(0, 100)), this.swapUpBtn = this.makeTextButton(0, 500, "Swap Up", 50, function() {
            void 0 !== this.state.selectedLevels[0] && this.swapLevels(this.state.selectedLevels[0] + 1)
        }, this), this.add(this.swapUpBtn), this.swapDownBtn = this.makeTextButton(0, 550, "Swap Down", 50, function() {
            void 0 !== this.state.selectedLevels[0] && this.swapLevels(Math.max(0, this.state.selectedLevels[0] - 1))
        }, this), this.add(this.swapDownBtn), this.changeNumberBtn = this.makeTextButton(0, 600, "Change number", 50, function() {
            var t = parseInt(prompt("New lvl nr")) - 1;
            isNaN(t) || this.swapLevels(t)
        }, this), this.add(this.changeNumberBtn), this.removeLevelsBtn = this.makeTextButton(0, 675, "Remove Levels", 50, this.removeLevels, this), this.removeLevelsBtn.fill = "red", this.add(this.removeLevelsBtn), this.playLevelBtn = this.makeTextButton(0, 750, "Play Level", 50, function() {
            void 0 !== this.state.selectedLevels[0] && (G.lvlNr = this.state.selectedLevels[0], game.state.start("Game", !0, !1, G.lvlNr, !0))
        }, this), this.add(this.playLevelBtn), this.editLevelBtn = this.makeTextButton(0, 800, "Edit Level", 50, function() {
            void 0 !== this.state.selectedLevels[0] && game.state.start("Editor", !0, !1, this.state.selectedLevels[0])
        }, this), this.add(this.editLevelBtn), this.copyLevelBtn = this.makeTextButton(0, 850, "Copy Levels", 50, function() {
            this.copyLevels()
        }, this), this.add(this.copyLevelBtn), this.exportBtn = this.makeTextButton(0, 950, "Export JSON", 50, function() {
            var t = new Blob([JSON.stringify(G.json.levels, null, "\t")], {
                type: "text/plain;charset=utf-8"
            });
            saveAs(t, "levels.json")
        }, this), this.add(this.exportBtn), this.lineEditorInit()
    }, G.EditorWorldSidePanel.prototype = Object.create(Phaser.Group.prototype), G.EditorWorldSidePanel.prototype.makeText = function(t, e, i, s) {
        i = new G.Text(t, e, i, {
            style: "font-white",
            fontSize: (s || 50) + "px"
        });
        return this.add(i), i
    }, G.EditorWorldSidePanel.prototype.makeTextButton = function(t, e, i, s, a, n) {
        return (i = this.makeText(t, e, i, s)).inputEnabled = !0, i.input.useHandCursor = !0, i.events.onInputDown.add(a, n), i
    }, G.EditorWorldSidePanel.prototype.swapLevels = function(t) {
        if (0 !== this.state.selectedLevels.length) {
            console.log("swap levels");
            var i = G.json.levels.map(function(t) {
                    return {
                        mapX: t.mapX,
                        mapY: t.mapY
                    }
                }),
                e = [];
            this.state.selectedLevels.forEach(function(t) {
                e.push(G.json.levels[t])
            }), e.forEach(function(t) {
                var e = G.json.levels.indexOf(t);
                0 <= e && G.json.levels.splice(e, 1)
            }), G.json.levels.splice.apply(G.json.levels, [t, 0].concat(e)), G.json.levels.forEach(function(t, e) {
                t && (t.mapX = i[e].mapX, t.mapY = i[e].mapY)
            });
            var s = e.map(function(t) {
                return G.json.levels.indexOf(t)
            });
            this.state.selectLevel(s)
        }
    }, G.EditorWorldSidePanel.prototype.copyLevels = function() {
        var t = this.state.selectedLevels.map(function(t) {
            var e = G.Utils.clone(G.json.levels[t]);
            return e.mapX += 150, e.id = game.rnd.uuid().split("-")[0], e
        });
        G.json.levels = G.json.levels.concat(t), this.state.fillSaveState3Stars(), this.state.map.refreshButtons();
        var e = t.map(function(t) {
            return G.json.levels.indexOf(t)
        });
        this.state.selectLevel(e)
    }, G.EditorWorldSidePanel.prototype.removeLevels = function(t) {
        if (confirm("ARE YOU SURE?") && 0 !== this.state.selectedLevels.length) {
            var e = [];
            this.state.selectedLevels.forEach(function(t) {
                e.push(G.json.levels[t])
            }), e.forEach(function(t) {
                var e = G.json.levels.indexOf(t);
                0 <= e && G.json.levels.splice(e, 1)
            }), this.state.selectLevel(null)
        }
    }, G.EditorWorldSidePanel.prototype.refresh = function() {
        void 0 === s.selectedLevels[0] ? (this.levelNr.setText("LEVEL: --"), this.starsReq.setText("--"), this.previewBitmapImg.alpha = 0) : (this.previewBitmapImg.alpha = 1, G.makeLvlPreview(G.json.levels[s.selectedLevels[0]], this.previewBitmap), this.levelNr.setText("LEVEL: " + (s.selectedLevels[0] + 1)), this.starsReq.setText(G.json.levels[s.selectedLevels[0]].starsReq.toString()))
    }, G.makeLvlPreview = function(t, e) {
        var i = game.make.image(0, 0, null);
        e.clear(), e.fill(0, 0, 0, 1);
        for (var s = t.levelData.length, a = t.levelData[0].length, n = e.width / s, o = e.height / a, r = Math.min(n, o), h = {
                1: "candy_1",
                2: "candy_2",
                3: "candy_3",
                4: "candy_4",
                5: "candy_5",
                6: "candy_6",
                r: "candy_r",
                goalCandy: "candy_goalCandy",
                cn1: "concrete_1",
                cn2: "concrete_2",
                cn3: "concrete_3",
                dirt1: "dirt_1",
                dirt2: "dirt_2",
                dirt3: "dirt_3",
                ice1: "ice_front",
                ice2: "ice_front",
                ice3: "ice_front",
                chest: "candy_chest",
                infection: "candy_infection",
                dS1: "dirt_s_1",
                dS2: "dirt_s_2",
                dS3: "dirt_s_3",
                jam1: "jam_1",
                jam2: "jam_2",
                jam3: "jam_3"
            }, l = 0; l < s; l++)
            for (var d = 0; d < a; d++) {
                var c = t.levelData[l][d];
                if ("X" != c[0]) {
                    G.changeTexture(i, "tile_1"), e.draw(i, l * r, d * r, r, r);
                    for (var u = 0; u < c.length; u++) {
                        var p = c[u];
                        if ("S" != p[2])
                            if ("H" != p[2] && "V" != p[2] && "C" != p[2]) "W" == p[2] ? (G.changeTexture(i, h[p[0]]), e.draw(i, l * r, d * r, r, r), G.changeTexture(i, "blocker_chain_wrapped"), i.alpha = .5, e.draw(i, l * r, d * r, r, r), i.alpha = 1) : h[p] && (G.changeTexture(i, h[p]), e.draw(i, l * r, d * r, r, r));
                            else {
                                var g = "candy_" + p[0] + "_bonus_" + [0, "H", "V", "C"].indexOf(p[2]);
                                G.changeTexture(i, g), e.draw(i, l * r, d * r, r, r)
                            }
                        else G.changeTexture(i, "candy_spiral"), e.draw(i, l * r, d * r, r, r)
                    }
                } else G.changeTexture(i, "dark_screen"), e.draw(i, l * r, d * r, r, r)
            }
    }, G.EditorWorldSidePanel.prototype.lineEditorInit = function() {
        this.line = this.makeText(0, 1050, "LVL LINE:\nZ-clearLine\nX-add node\nC-remove last node\nV-spread\nB-improt from lvls\nN-spread on nodes", 25), this.lvlLineX = [], this.lvlLineY = [], gfx = game.add.graphics(), gfx.sidePanel = this, gfx.update = function() {
            if (this.x = s.map.x, this.y = s.map.y, this.clear(), this.beginFill(16711680, 1), !(this.sidePanel.lvlLineX.length < 2))
                for (var t = 0; t < 1e4; t++) this.drawRect(game.math.linearInterpolation(this.sidePanel.lvlLineX, t / 1e4), game.math.linearInterpolation(this.sidePanel.lvlLineY, t / 1e4), 1, 1)
        }, this.keys = game.input.keyboard.addKeys({
            Z: Phaser.Keyboard.Z,
            X: Phaser.Keyboard.X,
            C: Phaser.Keyboard.C,
            V: Phaser.Keyboard.V,
            B: Phaser.Keyboard.B,
            N: Phaser.Keyboard.N
        }), this.keys.Z.onDown.add(function() {
            this.lvlLineX = [], this.lvlLineY = []
        }, this), this.keys.X.onDown.add(function() {
            var t = game.input.activePointer,
                e = Math.floor((t.worldX - s.map.x) * (1 / G.Loader.currentConfigMulti)),
                i = Math.floor((t.worldY - s.map.y) * (1 / G.Loader.currentConfigMulti));
            this.lvlLineX.push(e), this.lvlLineY.push(i)
        }, this), this.keys.C.onDown.add(function() {
            this.lvlLineX.pop(), this.lvlLineY.pop()
        }, this), this.keys.V.onDown.add(function() {
            var t = parseInt(prompt("FROM: ")),
                e = parseInt(prompt("TO: "));
            if (isNaN(t) && isNaN(e)) G.lineUtils.spreadAcrossLine(this.lvlLineX, this.lvlLineY, G.json.levels, "mapX", "mapY");
            else {
                isNaN(t) && !isNaN(e) && (t = 0), !isNaN(t) && isNaN(e) && (e = G.json.levels.length), t--;
                var i = G.json.levels.slice(t, e);
                G.lineUtils.spreadAcrossLine(this.lvlLineX, this.lvlLineY, i, "mapX", "mapY")
            }
            s.map.refreshButtons()
        }, this), this.keys.N.onDown.add(function() {
            console.log("N key");
            var t = parseInt(prompt("FROM: ")),
                e = parseInt(prompt("TO: "));
            if (isNaN(t) && isNaN(e)) G.lineUtils.spreadAcrossLine(this.lvlLineX, this.lvlLineY, G.json.levels, "mapX", "mapY");
            else {
                isNaN(t) && !isNaN(e) && (t = 0), !isNaN(t) && isNaN(e) && (e = G.json.levels.length), t--;
                var i = G.json.levels.slice(t, e);
                console.log("from to: " + t + "x" + e), G.lineUtils.spreadOnNodes(this.lvlLineX, this.lvlLineY, i, "mapX", "mapY")
            }
            s.map.refreshButtons()
        }, this), this.keys.B.onDown.add(function() {
            this.lvlLineX = [], this.lvlLineY = [], G.json.levels.forEach(function(t) {
                this.lvlLineX.push(t.mapX), this.lvlLineY.push(t.mapY)
            }, this)
        }, this)
    }, G.BOT = function(t) {
        Phaser.Group.call(this, game), this.board = t, this.active = !1, this.finished = !1, this.spacebar = game.input.keyboard.addKey(Phaser.Keyboard.SPACEBAR), this.spacebar.onDown.add(function() {
            this.active = !this.active
        }, this), G.sb("onGoalAchieved").add(function() {
            this.finished = !0
        }, this)
    }, G.BOT.prototype = Object.create(Phaser.Group.prototype), G.BOT.prototype.update = function() {
        this.active && !this.finished ? (G.IMMEDIATE = !0, this.active && this.board.isIdle() && this.board.possibleMoves[0] && this.makeMove()) : G.IMMEDIATE = !1
    }, G.BOT.prototype.makeMove = function() {
        var t = game.rnd.pick(this.board.possibleMoves),
            e = this.board.getCandy(t[0], t[1]),
            i = this.board.getCandy(t[2], t[3]);
        this.board.makeMove(e, i)
    }, G.BoosterTutorialText = function() {
        Phaser.Group.call(this, game), this.x = G.l(480), this.y = .8 * game.height, this.alpha = 0, this.bg = G.makeImage(0, 0, "text_shade_bg", .5, this), this.bg.alpha = 0, G.sb("onBoosterUse").add(function(t) {
            G.lvl.tutOpen || ((this.alpha = 1) == t && this.makeNewText("CANDY SWIPER CHANGES THE PLACE OF TWO CANDIES"), 2 == t && this.makeNewText("SWEET APPLE CRUSHES ONE CANDY. TAP ON CANDY YOU WANT TO CRUSH"), 3 != t && 4 != t || this.makeNewText("THE ROLLING PIN CAN CLEAR WHOLE ROW OR COLUMN"))
        }, this), G.sb("onBoosterUsed").add(function() {
            G.lvl.tutOpen || game.add.tween(this).to({
                alpha: 0
            }, 500, Phaser.Easing.Sinusoidal.Out, !0).onComplete.add(this.hide, this)
        }, this)
    }, G.BoosterTutorialText.prototype = Object.create(Phaser.Group.prototype), G.BoosterTutorialText.prototype.makeNewText = function(t) {
        this.txt = new G.Text(0, 0, G.txt(t), {
            style: "font-white",
            fontSize: "50px"
        }, .5, 940, 400, "center"), this.txt.alpha = 0, this.add(this.txt), game.add.tween(this.txt).to({
            alpha: 1
        }, 500, Phaser.Easing.Sinusoidal.Out, !0), this.bg.width = this.txt.width + G.l(100), this.bg.height = this.txt.height + G.l(100), game.add.tween(this.bg).to({
            alpha: .7
        }, 500, Phaser.Easing.Sinusoidal.Out, !0)
    }, G.BoosterTutorialText.prototype.changeText = function(t) {
        var e = this.txt;
        game.add.tween(e).to({
            alpha: 0
        }, 500, Phaser.Easing.Sinusoidal.Out, !0).onComplete.add(e.destroy, e), this.makeNewText(t)
    }, G.BoosterTutorialText.prototype.hide = function() {
        if (this.txt) {
            var t = this.txt;
            game.add.tween(this).to({
                alpha: 0
            }, 500, Phaser.Easing.Sinusoidal.Out, !0).onComplete.add(function() {
                this.bg.alpha = 0, t.destroy()
            }, this)
        }
    }, G.CollectableAnimLayer = function(t, e) {
        Phaser.Group.call(this, game), this.board = t, this.goalPanel = e.goalPanel, G.IMMEDIATE || G.sb("onCandyToUIAnim").add(function(t, e, i, s, a) {
            if (e) {
                var n = this.goalPanel.getGoalPanel(t);
                this.getFreeParticle().init(t, e, n, i, s, a)
            } else s.call(a)
        }, this)
    }, G.CollectableAnimLayer.prototype = Object.create(Phaser.Group.prototype), G.CollectableAnimLayer.prototype.getFreeParticle = function() {
        return this.getFirstDead() || this.add(new G.CollectableAnimPart(this.board, this.goalPanel))
    }, G.CollectableAnimLayer.prototype.initNofly = function(t) {
        this.getFreeParticle().initNofly(t)
    }, G.CollectableAnimPart = function(t, e) {
        Phaser.Image.call(this, game), this.kill(), this.anchor.setTo(.5), this.board = t, this.goalPanel = e
    }, G.CollectableAnimPart.prototype = Object.create(Phaser.Image.prototype), G.CollectableAnimPart.prototype.init = function(t, e, i, s, a, n) {
        this.revive();
        var o = this.board.cellToPxOut([e.cellX, e.cellY]);
        this.x = o[0], this.y = o[1], this.scale.setTo(1), this.alpha = 1, G.changeTexture(this, s || G.json.settings.goals[t].sprite);
        var r = (i = i).img.worldPosition.x + game.world.bounds.x,
            h = i.img.worldPosition.y;
        game.add.tween(this.scale).to({
            x: 1.2,
            y: 1.2
        }, 250, Phaser.Easing.Sinusoidal.Out, !0).onComplete.add(function() {
            game.add.tween(this).to({
                x: r,
                y: h,
                width: i.img.width * i.scale.x,
                height: i.img.height * i.scale.y
            }, 500, Phaser.Easing.Sinusoidal.InOut, !0).onComplete.add(function() {
                a && a.call(n), game.add.tween(this).to({
                    alpha: 0
                }, 300, Phaser.Easing.Sinusoidal.Out, !0), game.add.tween(this.scale).to({
                    x: 2,
                    y: 2
                }, 300, Phaser.Easing.Sinusoidal.Out, !0).onComplete.add(function() {
                    this.kill()
                }, this)
            }, this)
        }, this)
    }, G.CollectableAnimPart.prototype.initNofly = function(t) {
        this.revive(), this.x = game.world.bounds.x + t.img.worldPosition.x, this.y = t.img.worldPosition.y, this.alpha = 1, G.changeTexture(this, G.json.settings.goals[t.goalName].sprite), this.width = t.img.width * t.scale.x, this.height = t.img.height * t.scale.y, game.add.tween(this).to({
            alpha: 0
        }, 300, Phaser.Easing.Sinusoidal.Out, !0), game.add.tween(this.scale).to({
            x: 1.5,
            y: 1.5
        }, 300, Phaser.Easing.Sinusoidal.Out, !0).onComplete.add(function() {
            this.kill()
        }, this)
    }, G.FadeLayer = function() {
        Phaser.Image.call(this, game, 0, 0), game.camera.flash(16777215, 600, !0), G.sb("onStateChange").add(this.setupChange, this), this.game.add.existing(this), G._loadingTxt || this.initLoadingTxt(), "World" == game.state.current && (G.stopTweens(G._loadingTxt), game.add.tween(G._loadingTxt).to({
            alpha: 0
        }, 600, Phaser.Easing.Sinusoidal.Out, !0)), G.sb("onScreenResize").add(this.onResize, this), this.onResize()
    }, G.FadeLayer.prototype = Object.create(Phaser.Image.prototype), G.FadeLayer.constructor = G.FadeLayer, G.FadeLayer.prototype.onResize = function() {
        G._loadingTxt && (G._loadingTxt.x = .5 * game.width, G._loadingTxt.y = .45 * game.height)
    }, G.FadeLayer.prototype.setupChange = function(t, e, i, s, a) {
        G.sfx.transition.play(), 0 < game.camera.onFadeComplete.getNumListeners() || (game.camera.onFadeComplete.addOnce(function() {
            game.state.start(t, !0, !1, e, i, s, a)
        }), game.camera.fade(16777215, 300, !0), "World" === t && game.add.tween(G._loadingTxt).to({
            alpha: 1
        }, 200, Phaser.Easing.Sinusoidal.Out, !0))
    }, G.FadeLayer.prototype.initLoadingTxt = function() {
        G._loadingTxt = game.stage.addChild(new G.Text(0, 0, G.txt("Loading Map..."), {
            style: "font-white",
            fill: "black",
            fontSize: 60
        }, .5)), G._loadingTxt.alpha = 0
    }, G.FxParticle = function(t, e) {
        Phaser.Image.call(this, game), this.board = t, this.fxGroup = e, this.anchor.setTo(.5), this.kill(), this.id = Math.random(), this.animationData = {
            currentIndex: 0,
            currentTimer: 0,
            timer: 3,
            loop: 0,
            maxFrame: 0,
            gfxName: ""
        }
    }, G.FxParticle.prototype = Object.create(Phaser.Image.prototype), G.FxParticle.prototype.getOther = function() {
        return this.parent.getFreeParticle()
    }, G.FxParticle.prototype.update = function() {
        this.alive && this.updateFunc()
    }, G.FxParticle.prototype.updateAnimation = function() {
        if (this.animationData.currentTimer += G.deltaTime, this.animationData.currentTimer >= this.animationData.timer) {
            if (this.animationData.currentIndex++, this.animationData.currentTimer -= this.animationData.timer, this.animationData.currentIndex > this.animationData.maxFrame) {
                if (0 == this.animationData.loop) return this.kill();
                this.animationData.loop--, this.animationData.currentIndex = 0
            }
            G.changeTexture(this, this.animationData.gfxName + this.animationData.currentIndex)
        }
    }, G.FxParticle.prototype.initAnimation = function(t, e, i, s, a) {
        this.animationData.currentIndex = a || 0, this.animationData.currentTimer = 0, this.animationData.timer = i, this.animationData.gfxName = t, this.animationData.maxFrame = e, this.animationData.loop = s || 0, G.changeTexture(this, t + this.animationData.currentIndex), this.updateFunc = this.updateAnimation
    }, G.FxParticle.prototype.emptyFunc = function() {}, G.FxParticle.prototype.init = function(t, e) {
        this.x = t, this.y = e, this.blendMode = 0, this.alpha = 1, this.angle = 0, this.scale.setTo(1), this.updateFunc = this.emptyFunc, this.anchor.setTo(.5), this.revive()
    }, G.FxParticle.prototype.explosion = function(t, e, i) {
        this.init(t, e), this.initAnimation("cookie_match_", 10, 2, 0, 1)
    }, G.FxParticle.prototype.spiral = function(t, e, i) {
        this.init(t, e), this.initAnimation("candy_spiral_explode_", 13, 2)
    }, G.FxParticle.prototype.dummyFadeOut = function(t, e, i) {
        this.init(t, e), G.changeTexture(this, i), game.add.tween(this).to({
            alpha: 0
        }, 300, Phaser.Easing.Sinusoidal.In, !0).onComplete.add(this.kill, this)
    }, G.FxParticle.prototype.dummyFadeOutScaleIn = function(t, e, i) {
        this.init(t, e), G.changeTexture(this, i), game.add.tween(this.scale).to({
            x: 0,
            y: 0
        }, 300, Phaser.Easing.Sinusoidal.In, !0).onComplete.add(this.kill, this)
    }, G.FxParticle.prototype.dummyComboGrowAndFade = function(t, e, i) {
        this.fxGroup.aboveThirdFloorLayer.add(this), this.init(t, e), G.changeTexture(this, i[0]), this.angle = i[1], this.alpha = .8;
        var s = game.add.tween(this.scale).to({
            x: 2.5,
            y: 2.5
        }, 200, Phaser.Easing.Sinusoidal.In, !0);
        game.add.tween(this).to({
            alpha: 0
        }, 100, Phaser.Easing.Sinusoidal.In, !0, 100).onComplete.add(function() {
            s.stop(), this.fxGroup.add(this), this.kill()
        }, this)
    }, G.FxParticle.prototype.electricCircle = function(t, e) {
        this.init(t, e), this.blendMode = 1, G.loadTexture(this, "circle"), game.add.tween(this).to({
            alpha: 0
        }, 200, Phaser.Easing.Sinusoidal.Out, !0, 300).onComplete.add(this.kill, this), this.updateFunc = this.electricCircleUpdate, this.other = this.getOther(), this.other.blendMode = 1, G.loadTexture(this.other, "circle"), this.other.updateFunc = this.other.electricCircleUpdate, game.add.tween(this.other).to({
            alpha: 0
        }, 200, Phaser.Easing.Sinusoidal.Out, !0, 300).onComplete.add(this.other.kill, this.other)
    }, G.FxParticle.prototype.burstingCoin = function(t, e) {
        this.init(t, e), G.changeTexture(this, "coin_1"), this.orgY = e, this.scale.setTo(.5), this.velX = game.rnd.realInRange(-3, 3), this.velY = game.rnd.realInRange(-10, -5), this.grav = .5, this.timer = game.rnd.between(40, 60), this.updateFunc = this.burstingCoinUpdate
    }, G.FxParticle.prototype.burstingCoinUpdate = function() {
        this.x += this.velX, this.velX *= .98, this.y += this.velY, this.y > this.orgY && (this.y = this.orgY, this.velY *= -1), this.velY += this.grav, this.timer--, this.timer < 0 && (this.alpha -= .05, this.alpha <= 0 && this.kill())
    }, G.FxParticle.prototype.electricCircleUpdate = function() {
        this.scale.setTo(1 + .5 * Math.random())
    }, G.FxParticle.prototype.smallCircle = function(t, e) {
        this.init(t, e), this.blendMode = 1, G.loadTexture(this, "circle"), this.scale.setTo(0), this.alpha = .5, game.add.tween(this.scale).to({
            x: .5,
            y: .5
        }, 150, Phaser.Easing.Cubic.Out, !0), game.add.tween(this).to({
            alpha: 0
        }, 150, Phaser.Easing.Cubic.Out, !0, 200).onComplete.add(this.kill, this)
    }, G.FxParticle.prototype.lightCircle = function(t, e) {
        this.init(t, e), this.blendMode = 1, G.loadTexture(this, "circle"), this.scale.setTo(0), game.add.tween(this.scale).to({
            x: 1.5,
            y: 1.5
        }, 500, Phaser.Easing.Cubic.Out, !0), game.add.tween(this).to({
            alpha: 0
        }, 300, Phaser.Easing.Cubic.Out, !0, 200).onComplete.add(this.kill, this)
    }, G.FxParticle.prototype.lightCircleFast = function(t, e) {
        this.init(t, e), this.blendMode = 1, G.loadTexture(this, "circle"), this.scale.setTo(0), game.add.tween(this.scale).to({
            x: 1.5,
            y: 1.5
        }, 300, Phaser.Easing.Cubic.Out, !0), game.add.tween(this).to({
            alpha: 0
        }, 200, Phaser.Easing.Cubic.Out, !0, 100).onComplete.add(this.kill, this)
    }, G.FxParticle.prototype.changeCircle = function(t, e) {
        this.init(t, e), this.blendMode = 1, G.loadTexture(this, "circle"), this.scale.setTo(.6), game.add.tween(this.scale).to({
            x: 1.5,
            y: 1.5
        }, 600, Phaser.Easing.Cubic.Out, !0), game.add.tween(this).to({
            alpha: 0
        }, 600, Phaser.Easing.Cubic.Out, !0).onComplete.add(this.kill, this)
    }, G.FxParticle.prototype.initStroke = function(t, e, i, s) {
        this.init(t, e);
        var a = parseInt(i.candyType),
            n = "line_effect_" + game.rnd.between(1, 6);
        1 <= a && a <= 6 && (n = "line_effect_" + a), G.changeTexture(this, n), this.angle = s || 0, game.add.tween(this.scale).to({
            y: 15
        }, 500, Phaser.Easing.Sinusoidal.Out, !0), game.add.tween(this).to({
            alpha: 0
        }, 100, Phaser.Easing.Cubic.In, !0, 400).onComplete.add(function() {
            this.kill()
        }, this)
    }, G.FxParticle.prototype.strokeH = function(t, e, i, s) {
        this.initStroke(t, e, s, 90)
    }, G.FxParticle.prototype.strokeV = function(t, e, i, s) {
        this.initStroke(t, e, s, 0)
    }, G.FxParticle.prototype.strokeDR = function(t, e, i, s) {
        this.initStroke(t, e, s, -45)
    }, G.FxParticle.prototype.strokeDF = function(t, e, i, s) {
        this.initStroke(t, e, s, 45)
    }, G.FxParticle.prototype.lightning = function(t, e, i) {
        this.init(t, e), G.changeTexture(this, "lightning"), this.anchor.setTo(.5, 0);
        var s = this.board.cellXToPxIn(i[0]),
            a = this.board.cellYToPxIn(i[1]);
        this.height = game.math.distance(t, e, s, a), this.rotation = game.math.angleBetween(t, e, s, a), this.angle -= 90, this.timer = 0, this.updateFunc = this.lightningUpdate, game.add.tween(this).to({
            alpha: 0
        }, 500, Phaser.Easing.Cubic.In, !0).onComplete.add(function() {
            this.kill()
        }, this)
    }, G.FxParticle.prototype.lightningUpdate = function() {
        this.timer += 1 * G.deltaTime, 2 < this.timer && (this.scale.x *= -1, this.timer = 0)
    }, G.FxParticle.prototype.chocolatePart = function(t, e) {
        this.init(t, e), this.x += G.l(40 * Math.random() - 20), this.y += G.l(40 * Math.random() - 20), G.changeTexture(this, "chocolatePiece"), this.scale.setTo(.8), this.angle = 360 * Math.random(), this.velX = Math.random() * G.lnf(-12) + G.lnf(6), this.velY = Math.random() * G.lnf(-6) - G.lnf(4), this.gravity = G.lnf(.6), this.updateFunc = this.fallingPartUpdate
    }, G.FxParticle.prototype.chocolatePartW = function(t, e) {
        this.init(t, e), this.x += G.l(40 * Math.random() - 20), this.y += G.l(40 * Math.random() - 20), G.changeTexture(this, "chocolatePieceW"), this.scale.setTo(.8), this.angle = 360 * Math.random(), this.velX = Math.random() * G.lnf(-12) + G.lnf(6), this.velY = Math.random() * G.lnf(-6) - G.lnf(4), this.gravity = G.lnf(.6), this.updateFunc = this.fallingPartUpdate
    }, G.FxParticle.prototype.burstConcrete = function(t, e, i, s, a) {
        this.init(t + G.l(i), e + G.l(s)), G.changeTexture(this, a), this.burstConcreteVelX = Math.sign(i) * G.lnf(2 + 3 * Math.random()), this.burstConcreteVelY = G.lnf(-3 * Math.random() - 3), this.burstConcreteGrav = G.lnf(.6), this.updateFunc = this.burstConcreteUpdate
    }, G.FxParticle.prototype.burstConcreteUpdate = function() {
        this.x += this.burstConcreteVelX, this.y += this.burstConcreteVelY, this.angle += 2 * this.burstConcreteVelX, this.burstConcreteVelX *= .98, this.burstConcreteVelY += this.burstConcreteGrav, this.alpha -= .03, this.scale.setTo(this.scale.x + .01), this.alpha <= 0 && this.kill()
    }, G.FxParticle.prototype.burstLookup = {
        1: 17,
        2: 15,
        3: 16,
        4: 16,
        5: 16,
        6: 17
    }, G.FxParticle.prototype.burstCandy = function(t, e, i) {
        this.init(t, e), this.alpha = 1, this.scale.setTo(1.5), this.initAnimation("cookie_match_", 10, 2, 0, 1)
    }, G.FxParticle.prototype.burstIce = function(t, e, i) {
        this.init(t, e), this.alpha = 1, this.scale.setTo(1), this.initAnimation("ice_part_", 13, 2, 0, 1)
    }, G.FxParticle.prototype.burstConcreteAnim = function(t, e, i) {
        this.init(t, e), this.alpha = 1, this.scale.setTo(1), this.initAnimation("concrete_part_", 17, 2, 0, 0)
    }, G.FxParticle.prototype.burstDirtAnim = function(t, e, i) {
        this.init(t, e), this.alpha = 1, this.scale.setTo(1), this.initAnimation("dirt_part_", 16, 2, 0, 0)
    }, G.FxParticle.prototype.burstInfectionAnim = function(t, e, i) {
        this.init(t, e), this.alpha = 1, this.scale.setTo(1), this.initAnimation("infection_part_", 18, 2, 0, 0)
    }, G.FxParticle.prototype.burstChainAnim = function(t, e, i) {
        this.init(t, e), this.alpha = 1, this.scale.setTo(1), this.initAnimation("unwrap_part_", 14, 2, 0, 0)
    }, G.FxParticle.prototype.glowLookup = {
        1: 8,
        2: 12,
        3: 5,
        4: 6,
        5: 11,
        6: 8
    }, G.FxParticle.prototype.whiteStarPart = function(t, e) {
        this.init(t, e), G.changeTexture(this, "starPart"), this.blendMode = 1, this.angle = 360 * Math.random(), this.velX = Math.random(20) * G.lnf(-20) + G.lnf(10), this.velY = Math.random() * G.lnf(-9) - G.lnf(3), this.gravity = G.lnf(.5), this.updateFunc = this.fallingPartUpdate
    }, G.FxParticle.prototype.fallingPartUpdate = function() {
        this.x += this.velX * G.deltaTime, this.y += this.velY * G.deltaTime, this.angle += .1 * this.velX, this.velX *= .99, this.velY += this.gravity * G.deltaTime, this.alpha -= .02, this.alpha <= 0 && this.kill()
    }, G.FxParticle.prototype.whiteStarPartFast = function(t, e) {
        this.init(t, e), G.changeTexture(this, "starPart"), this.blendMode = 1, this.angle = 360 * Math.random(), this.velX = Math.random(20) * G.lnf(-20) + G.lnf(10), this.velY = Math.random() * G.lnf(-9) - G.lnf(3), this.gravity = G.lnf(.25), this.updateFunc = this.fallingPartUpdate
    }, G.addTextStyles = function() {
        G.Text.addStyle("font-white", {
            font: "Lobster",
            fill: "white",
            fontSize: "30px",
            shadow: [2, 3, "rgba(0,0,0,0.3)", 0]
        }), G.Text.addStyle("font-blue", {
            font: "Lobster",
            fill: "#008aca",
            fontSize: "30px"
        }), G.Text.addStyle("font-darkBlue", {
            font: "Lobster",
            fill: "#006A8F",
            fontSize: "30px"
        }), G.Text.addStyle("font-num-blue", {
            font: "Lobster",
            fill: "white",
            fontSize: "30px",
            stroke: "#3d95ea",
            strokeThickness: 3
        }), G.Text.addStyle("font-num-orange", {
            font: "Lobster",
            fill: "white",
            fontSize: "30px",
            stroke: "#ff7200",
            strokeThickness: 3
        }), G.Text.addStyle("font-score-0", {
            font: "RubikBold",
            fontSize: "50px",
            stroke: "white",
            strokeThickness: 8,
            fill: "#eea1c2"
        }), G.Text.addStyle("font-score-1", {
            font: "RubikBold",
            fontSize: "50px",
            stroke: "white",
            strokeThickness: 8,
            fill: "#c52216"
        }), G.Text.addStyle("font-score-2", {
            font: "RubikBold",
            fontSize: "50px",
            stroke: "white",
            strokeThickness: 8,
            fill: "#1eb3e5"
        }), G.Text.addStyle("font-score-3", {
            font: "RubikBold",
            fontSize: "50px",
            stroke: "white",
            strokeThickness: 8,
            fill: "#eac867"
        }), G.Text.addStyle("font-score-4", {
            font: "RubikBold",
            fontSize: "50px",
            stroke: "white",
            strokeThickness: 8,
            fill: "#e34bbc"
        }), G.Text.addStyle("font-score-5", {
            font: "RubikBold",
            fontSize: "50px",
            stroke: "white",
            strokeThickness: 8,
            fill: "#7adc2c"
        }), G.Text.addStyle("font-score-6", {
            font: "RubikBold",
            fontSize: "50px",
            stroke: "white",
            strokeThickness: 8,
            fill: "#e79909"
        }), G.Text.addStyle("rubikWB", {
            font: "RubikBold",
            fontSize: "40px",
            stroke: "#49abe8",
            strokeThickness: 6,
            fill: "white"
        }), G.Text.addStyle("rubikPW", {
            font: "RubikBold",
            fontSize: "40px",
            stroke: "white",
            strokeThickness: 6,
            fill: "#EC048D"
        }), G.Text.addStyle("font-grey", {
            font: "Lobster",
            fontSize: 40,
            fill: "#686F70"
        })
    }, G.AdLoadOverlay = function() {
        Phaser.Group.call(this, game), this.fixedToCamera = !0, this.gfx = game.add.graphics(), this.gfx.inputEnabled = !0, this.add(this.gfx), this.gfx.beginFill(0, .8), this.gfx.drawRect(0, 0, game.width, game.height), this.waitingIcon = new G.WaitingIcon(.5 * game.width, .5 * game.height), G.changeTexture(this.waitingIcon, "waiting_icon_white"), this.add(this.waitingIcon)
    }, G.AdLoadOverlay.prototype = Object.create(Phaser.Group.prototype), G.ChestLayer = function() {
        Phaser.Group.call(this, game), this.deadElems = [], this.state = game.state.getCurrentState(), this.board = this.state.board, this.onChestGiftShown = new Phaser.Signal, this.deadArray = [], G.sb("onChestOpen").add(function(t, e) {
            var i = this.board.cellToPxOut([t.cellX, t.cellY]);
            this.getFreeParticle().init(i[0], i[1], e), this.sort("orgY", Phaser.Group.SORT_ASCENDING)
        }, this)
    }, G.ChestLayer.prototype = Object.create(Phaser.Group.prototype), G.ChestLayer.prototype.onElemKilled = function(t) {
        this === t.parent && (this.deadArray.push(t), this.removeChild(t))
    }, G.ChestLayer.prototype.getFreeParticle = function() {
        var e;
        return 0 < this.deadArray.length ? e = this.deadArray.pop() : ((e = new G.GameplayChest(this.board, this)).onGiftShown.add(function(t) {
            this.onChestGiftShown.dispatch(e, t)
        }, this), e.events.onKilled.add(this.onElemKilled, this)), this.add(e), e
    }, G.Chest = function() {
        Phaser.Image.call(this, game, 0, 0), G.changeTexture(this, "chest_bottom"), this.anchor.setTo(.5), this.state = game.state.getCurrentState(), this.cover = G.makeImage(-33, 0, null, [0, 1], this), this.light = G.makeImage(0, -20, "popup_lighht", .5, this), this.light.scale.setTo(.5), this.light.cacheAsBitmap = !0, this.light.blendMode = 1, this.addChild(this.light), this.gift = G.makeImage(0, -10, null, .5, this), this.animTimer = 0, this.animEvery = 3, this.animIndex = 0, this.coverCoords = [
            [G.l(-33), 0],
            [G.l(-33), G.l(-8)],
            [G.l(-33), G.l(-8)],
            [G.l(-35), G.l(-8)]
        ], this.kill()
    }, G.Chest.prototype = Object.create(Phaser.Image.prototype), G.Chest.prototype.init = function(t, e) {
        G.stopTweens(this), G.changeTexture(this.cover, "chest_top_00"), this.cover.y = 0, this.orgX = t, this.orgY = e, this.alpha = 1, this.scale.setTo(1), this.animTimer = 0, this.animIndex = 0, this.x = t, this.y = e + G.l(5), this.light.alpha = 0, game.add.tween(this).to({
            y: e - G.l(30)
        }, 1500, Phaser.Easing.Sinusoidal.Out, !0), game.add.tween(this.scale).to({
            x: 1.2,
            y: 1.2
        }, 400, Phaser.Easing.Sinusoidal.Out, !0), G.stopTweens(this.gift), this.giftData = G.gift.getGift("ingamechests"), G.changeTexture(this.gift, G.gift.getIcon(this.giftData)), "coin" == this.giftData[0] && (1 == this.giftData[1] ? G.changeTexture(this.gift, "coin_package_icon_0") : 2 == this.giftData[1] ? G.changeTexture(this.gift, "coin_package_icon_1") : 3 == this.giftData[1] ? G.changeTexture(this.gift, "coin_package_icon_2") : G.changeTexture(this.gift, "coin_package_icon_3")), this.gift.scale.setTo(0), this.gift.angle = -10, this.gift.y = G.l(-10), this.update = this.updatePreOpen, this.revive(), G.sfx.chest_open_louder.play()
    }, G.Chest.prototype.updatePreOpen = function() {
        if (this.alive) {
            if (this.animIndex < 3 && this.animTimer++ % this.animEvery == 0 && (this.animIndex++, this.cover.x = this.coverCoords[this.animIndex][0], this.cover.y = this.coverCoords[this.animIndex][1], G.changeTexture(this.cover, "chest_top_0" + this.animIndex), 3 == this.animIndex)) {
                game.add.tween(this.gift.scale).to({
                    x: 1,
                    y: 1
                }, 600, Phaser.Easing.Bounce.Out, !0), game.add.tween(this.gift).to({
                    y: G.l(-40)
                }, 400, Phaser.Easing.Sinusoidal.InOut).to({
                    y: G.l(-30)
                }, 1100, Phaser.Easing.Sinusoidal.Out).start(), game.add.tween(this.gift).to({
                    angle: 10
                }, 1500, Phaser.Easing.Sinusoidal.InOut, !0), game.time.events.add(1e3, function() {
                    G.sb("coinsFromGameplayChest").dispatch(this.giftData[1]), G.gift.applyGift(this.giftData, !0), game.add.tween(this).to({
                        alpha: 0
                    }, 500, Phaser.Easing.Sinusoidal.In, !0).onComplete.add(function() {
                        this.kill()
                    }, this)
                }, this)
            }
            this.light.angle++, this.light.alpha = game.math.clamp(this.light.alpha + .03, 0, .5)
        }
    }, G.DotBg = function(t) {
        this.texture = game.add.renderTexture(game.width, game.height), this.marker = G.makeImage(0, 0, "background_star_tile", 0, null), this.marker.alpha = .4, this.img = game.add.image(0, 0, this.texture), G.sb("onScreenResize").add(this.onScreenResize, this), this.onScreenResize()
    }, G.DotBg.prototype = Object.create(Phaser.Image.prototype), G.DotBg.prototype.onScreenResize = function() {
        this.texture.resize(game.width, game.height), this.texture.clear(), this.img.x = game.world.bounds.x;
        for (var t = 0; t < game.width; t += this.marker.width)
            for (var e = 0; e < game.height; e += this.marker.height) this.texture.renderXY(this.marker, t, e)
    }, G.ErrorMsg = function(t) {
        Phaser.Group.call(this, game), this.fixedToCamera = !0, this.gfx = this.add(game.add.graphics()), this.gfx.beginFill(0, 1), this.gfx.drawRect(0, 0, game.width, game.height), this.add(game.add.text(0, 0, JSON.stringify(t), {
            wordWrap: !0,
            wordWrapWidth: game.width,
            fill: "white"
        })), game.time.events.add(5e3, function() {
            this.destroy()
        }, this)
    }, G.ErrorMsg.prototype = Object.create(Phaser.Group.prototype), G.FxMapLayer = function() {
        G.PoolGroup.call(this, G.FxMapPart), this.fixedToCamera = !0, G.sb("fxMap").add(this.init, this)
    }, G.FxMapLayer.prototype = Object.create(G.PoolGroup.prototype), G.FxMapPart = function() {
        G.Image.call(this), this.state = game.state.getCurrentState()
    }, G.FxMapPart.prototype = Object.create(G.Image.prototype), G.FxMapPart.prototype.emptyUpdate = function() {}, G.FxMapPart.prototype.reset = function(t) {
        this.x = t.position ? t.position.x : t.x, this.y = t.position ? t.position.y : t.y, this.anchor.setTo(.5), this.scale.setTo(1), this.alpha = 1, this.angle = 0, this.blendMode = 0, this.changeTexture(null), this.visible = !0, this.update = this.emptyUpdate, this.revive()
    }, G.FxMapPart.prototype.init = function(t, e) {
        this.reset(e), this[t] ? this[t].apply(this, arguments) : console.warn("There is no " + t + " in G.FxPart")
    }, G.FxMapPart.prototype.star = function(t, e) {
        this.changeTexture("starPart"), this.blendMode = 1, this.alpha = e.alpha || 1, this.grav = void 0 === e.grav ? 0 : e.grav, this.timer = e.timer || game.rnd.between(20, 40), this.blendMode = 0, this.scale.setTo(e.scale || .7), this.velX = e.velX || game.rnd.realInRange(-10, 10), this.velY = e.velY || game.rnd.realInRange(-20, -8), this.velAngle = game.rnd.realInRange(-5, 5), this.angle = game.rnd.realInRange(0, 360), this.update = this.starUpdate
    }, G.FxMapPart.prototype.starUpdate = function() {
        this.x += this.velX, this.y += this.velY, this.velX *= .95, this.velY *= .95, this.angle += this.velAngle, this.timer-- < 0 && (this.alpha -= .05, this.alpha <= 0 && this.kill())
    }, G.gift = {}, G.gift.getGift = function(t) {
        t = t || "normals";
        var e = G.json.settings.gifts[t],
            i = e.boosterMaxNr || G.json.settings.gifts.boosterMaxNr,
            s = e.boosterChance || G.json.settings.gifts.boosterChance,
            a = [];
        e.list.forEach(function(t) {
            "coin" == t[0] ? a.push(t) : -1 !== t[0].indexOf("booster") ? G.saveState.isBoosterUnlocked(parseInt(t[0][8])) && G.saveState.getBoosterAmount(parseInt(t[0][8])) < i && a.push(t) : "ginger" === t[0] && G.GINGEREVENT && a.push(t)
        }), Phaser.ArrayUtils.shuffle(a);
        for (var n = Math.random() < s, o = 0; o < a.length; o++) {
            var r = a[o];
            if (-1 === r[0].indexOf("booster")) return r.slice();
            if (n) return r.slice()
        }
        return ["coin", 50]
    }, G.gift.getLabelString = function(t, e) {
        if (Array.isArray(t[0])) return t.map(function(t) {
            return this.getLabelString(t, e)
        }, this).join("    ");
        var i = G.json.settings.gifts.icons[t[0]];
        e = e ? "*" + e + "*" : "";
        switch (t[0]) {
            case "coin":
                return t[1] + "@" + e + i + "@";
            case "lifeUnlimited":
                return this.getUnlimitedLivesTimeLabel(t) + "@" + e + i + "@";
            default:
                return t[1] + "x@" + e + i + "@"
        }
    }, G.gift.getUnlimitedLivesTimeLabel = function(t) {
        var e = Math.floor(t[1] / 60),
            i = Math.floor(t[1] % 60);
        return e && i ? e + "h " + i + "min" : e ? e + "h" : i + "min"
    }, G.gift.applyGift = function(t, e) {
        if (Array.isArray(t[0])) t.forEach(function(t) {
            this.applyGift(t, !0)
        }, this), G.saveState.save();
        else switch (t[0]) {
            case "coin":
                G.saveState.changeCoins(t[1], e);
                break;
            case "life":
                G.saveState.addLife(t[1], e);
                break;
            case "lifeUnlimited":
                G.saveState.addUnlimitedLivesTimeMin(t[1], e);
                break;
            case "ginger":
                G.saveState.addGinger(t[1]);
                break;
            default:
                G.saveState.changeBoosterAmount(parseInt(t[0][8]), t[1], e)
        }
    }, G.gift.getIcon = function(t) {
        return G.json.settings.gifts.icons[t[0]]
    }, G.gift.processRandomBoosters = function(t) {
        if ("booster#R" !== t[0]) return t;
        var e = [1, 2, 3, 4, 5, 6, 7, 8].filter(function(t) {
            return G.saveState.isBoosterUnlocked(t)
        });
        return 0 < e.length ? t[0] = "booster#" + game.rnd.pick(e) : (t[0] = "coin", t[1] = t[1] * G.json.settings.gifts.fallbackCoins), t
    }, G.gift.getLabelPackString = function(t, i) {
        var s = "";
        return t.forEach(function(t, e) {
            0 !== e && (s += "   "), s += G.gift.getLabelString(t, i || 2)
        }), s
    }, G.GiftBox = function(t, e, i, s) {
        Phaser.Group.call(this, game), this.state = game.state.getCurrentState(), this.giftData = s || G.gift.getGift("normals"), this.giftData = G.gift.processRandomBoosters(this.giftData), this.x = t, this.y = e, this.light = G.makeImage(0, 0, "popup_lighht", .5, this), this.light.update = function() {
            this.angle++
        }, this.light.alpha = 0, this.light.blendMode = 1, this.inside = new G.LabelTextT(G.gift.getLabelString(this.giftData), 0, 0, {
            style: "font-blue",
            fontSize: "100px"
        }, .5, 180), this.add(this.inside), this.inside.alpha = 0, this.gift = G.makeImage(0, 0, "gift", .5, this), i && (this.gift.inputEnabled = !0, this.gift.events.onInputDown.add(function() {
            this.gift.inputEnabled = !1, this.unpack()
        }, this), this.hand = G.makeImage(30, 40, "tut_hand", 0, this), this.hand.scale.setTo(.6), game.add.tween(this.hand).to({
            x: G.l(50),
            y: G.l(60)
        }, 600, Phaser.Easing.Sinusoidal.InOut, !0, 0, -1, !0))
    }, G.GiftBox.prototype = Object.create(Phaser.Group.prototype), G.GiftBox.prototype.applyGift = function() {
        if ("coin" == this.giftData[0] && "World" == game.state.current && this.state.uiTargetParticles) {
            this.state.uiTargetParticles.createCoinBatch(game.world.bounds.x + this.worldPosition.x, this.worldPosition.y, this.state.panel.coinsTxt, this.giftData[1]);
            this.state.uiTargetParticles.createDividedBatch(this.worldPosition.y, "coin_1", this.state.panel.coinsTxt, this.giftData[1], 5)
        } else G.gift.applyGift(this.giftData)
    }, G.GiftBox.prototype.unpack = function(t) {
        this.applyGift(), G.sfx.xylophone_positive_12.play(), game.add.tween(this.gift).to({
            alpha: 0,
            width: 1.2 * this.gift.width,
            height: 1.2 * this.gift.height
        }, 500, Phaser.Easing.Sinusoidal.InOut, !0), game.add.tween(this.light).to({
            alpha: .5
        }, 500, Phaser.Easing.Sinusoidal.InOut, !0), game.add.tween(this.inside).to({
            alpha: 1
        }, 500, Phaser.Easing.Sinusoidal.InOut, !0), this.hand && game.add.tween(this.hand).to({
            alpha: 0
        }, 200, Phaser.Easing.Sinusoidal.InOut, !0)
    }, G.GiftBox.prototype.doubleGift = function() {
        this.applyGift(), this.giftData[1] *= 2, game.add.tween(this.inside).to({
            alpha: 0
        }, 400, Phaser.Easing.Sinusoidal.In, !0), this.inside = new G.LabelTextT(G.gift.getLabelString(this.giftData), 0, 0, {
            style: "font-blue",
            fontSize: "100px"
        }, .5, 180), this.add(this.inside), this.inside.alpha = 0, game.add.tween(this.inside).to({
            alpha: 1
        }, 400, Phaser.Easing.Sinusoidal.In, !0)
    }, G.Gingy = function() {
        Phaser.Group.call(this, game), this.gingyShown = !1, this.gingyImg = G.makeImage(0, 0, "gingerbread_man_large", .5, this), this.gingyImg.angle = 20, this.gingyImg.pivot.y = -340, this.gingyImg.scale.setTo(.57), this.gingyImg.x = -150, this.gingyImg.pY = 1;
        var t = [100, 60, 60, 100];
        this.bubbles = [];
        for (var e = 0; e < 4; e++) {
            var i = G.makeImage(t[e], 0, "bubble" + (e + 1), .5, this);
            i.scale.setTo(0), this.bubbles.push(i)
        }
        this.bubbleMsg = G.makeImage(320, 0, "tut_bubble_speech", .5, this), this.bubbleMsg.pY = .3, this.bubbleMsg.pivot.y = 140, this.bubbleMsg.scale.setTo(0), this.updateRelY()
    }, G.Gingy.prototype = Object.create(Phaser.Group.prototype), G.Gingy.prototype.showGingy = function(t, e) {
        G.stopTweens(this.gingyImg), this.gingyShown = !0, this.gingyImg.pY = 1.3, this.gingyImg.x = 0;
        var i = game.add.tween(this.gingyImg).to({
            x: 200,
            pY: .65
        }, 800, Phaser.Easing.Cubic.Out, !0);
        i.onComplete.add(function() {
            game.add.tween(this.gingyImg).to({
                pY: .655
            }, 1e3, Phaser.Easing.Sinusoidal.InOut, !0, 0, -1, !0)
        }, this), t && i.onComplete.add(t, e)
    }, G.Gingy.prototype.updateRelY = function() {
        for (var t = this.children.length; t--;) void 0 !== this.children[t].pY && (this.children[t].y = this.children[t].pY * game.height)
    }, G.Gingy.prototype.update = function() {
        this.updateRelY()
    }, G.Gingy.prototype.showMsg = function(t, e) {
        if (!this.gingyShown) return this.showGingy(function() {
            this.showMsg(t, e)
        }, this);
        this.bubbleMsg.alpha = 1, this.bubbleMsg.scale.setTo(0), this.bubbleMsg.pY = .3, this.msg && this.msg.destroy(), this.msg = new G.Text(0, -5, t, {
            style: "font-blue",
            fontSize: "40px",
            lineSpacing: -15
        }, .5, 560, 180, !0, "center"), this.bubbleMsg.addChild(this.msg);
        var i = this.bubbles.length,
            s = (.65 - .3) / i;
        this.bubbles.forEach(function(t, e) {
            G.stopTweens(t), t.pY = .65 - (e + .2) * s, 0 == e && (t.pY -= .2 * s), 3 == e && (t.pY -= .2 * s), t.alpha = 1, t.scale.setTo(0), game.add.tween(t.scale).to({
                x: 1,
                y: 1
            }, 400, Phaser.Easing.Elastic.Out, !0, 100 * e)
        }, this), game.add.tween(this.bubbleMsg.scale).to({
            x: 1,
            y: 1
        }, 400, Phaser.Easing.Elastic.Out, !0, 400), this.updateRelY()
    }, G.Gingy.prototype.hide = function() {
        this.gingyShown = !1, G.stopTweens(this.gingyImg), game.add.tween(this.gingyImg).to({
            pY: 1.3,
            x: 0
        }, 300, Phaser.Easing.Cubic.In, !0), G.stopTweens(this.bubbleMsg), game.add.tween(this.bubbleMsg).to({
            alpha: 0
        }, 200, Phaser.Easing.Cubic.Out, !0), this.bubbles.forEach(function(t, e) {
            G.stopTweens(t), game.add.tween(t).to({
                alpha: 0
            }, 200, Phaser.Easing.Cubic.Out, !0)
        }, this)
    }, G.Gingy.prototype.setMsg = function(t) {
        t ? this.showMsg(G.txt(t.text), .3) : this.hide()
    }, G.LabelTextT = function(t, e, i, s, a, n, o) {
        Phaser.Group.call(this, game), this.str = t, this.tagArray = G.LabelParser.changeIntoTagArray(t), this.x = e, this.y = i, this.textStyle = G.Text.getStyle(s), this.fontSize = parseInt(s.fontSize), this.distanceBetween = o || 0, "number" == typeof a ? this.anchorX = this.anchorY = a : (this.anchorX = a[0], this.anchorY = a[1]), this.maxWidth = n || 0, this.processTagArray()
    }, G.LabelTextT.prototype = Object.create(Phaser.Group.prototype), G.LabelTextT.prototype.processTagArray = function() {
        for (var t = 0; t < this.tagArray.length; t++) {
            if ("img" == this.tagArray[t].type)(e = G.makeImage(0, 0, this.tagArray[t].content, 0, this)).tagScale = this.tagArray[t].scale;
            else if ("separator" == this.tagArray[t].type) {
                var e;
                (e = G.makeImage(0, 0, null, 0, this)).SEPARATOR = !0, e.SEP_LENGTH = .5 * this.tagArray[t].length
            } else this.add(new G.Text(0, 0, this.tagArray[t].content, this.textStyle))
        }
        this.refresh()
    }, G.LabelTextT.prototype.refresh = function() {
        if (this.applySizeAndAnchor(), 0 < this.maxWidth && this.getWholeWidth() > this.maxWidth)
            for (; this.getWholeWidth() > this.maxWidth;) this.distanceBetween = Math.floor(.9 * this.distanceBetween), this.fontSize = Math.floor(.9 * this.fontSize), this.applySizeAndAnchor();
        this.spreadElements()
    }, G.LabelTextT.prototype.applySizeAndAnchor = function() {
        this.children.forEach(function(t) {
            t.anchor.setTo(this.anchorX, this.anchorY), t.fontSize ? (t.fontSize = this.fontSize, t.updateTransform(), t.y += t.padding.y) : (t.height = this.fontSize * (t.tagScale || 1), t.scale.x = t.scale.y), t.SEPARATOR && (t.width = this.fontSize * t.SEP_LENGTH)
        }, this)
    }, G.LabelTextT.prototype.getWholeWidth = function() {
        var t = (this.children.length - 1) * this.distanceBetween,
            e = 0;
        return this.children.forEach(function(t) {
            e += t.width
        }), t + e
    }, G.LabelTextT.prototype.spreadElements = function() {
        var s = this.getWholeWidth() * this.anchorX * -1;
        this.children.forEach(function(t, e, i) {
            t.left = 0 == e ? s : i[e - 1].right + this.distanceBetween
        }, this)
    }, G.LabelTextT.prototype.addOffsetYToText = function(e) {
        this.children.forEach(function(t) {
            t.fontSize && (t.y += e)
        })
    }, G.LevelGenerator = {}, G.LevelGenerator.generate = function(t) {
        var e = {
                mapX: 400 * Math.random() - 200,
                mapY: -400 * Math.random(),
                moves: t.movesNr,
                nrOfTypes: t.typesOfCandy,
                goal: ["collect", []],
                bgImg: t.bgImg,
                starsReq: [3e3, 5e3, 7e3],
                drops: {
                    chest: t.chestDrop,
                    chain: t.chainDrop,
                    infection: t.infectionDrop
                }
            },
            i = new G.GridArray(8, 8);
        i.loop(function(t, e, i, s) {
            s[e][i] = []
        });
        var s = this.pickBlockers(e, t);
        return this.putBlockers(i, t, s), e.levelData = i.data, e.goal[1] = this.makeGoal(i, t, e, s), this.fillWithRandom(i, t), e
    }, G.LevelGenerator.putBlockers = function(t, e, i) {
        for (var s = 0; s < i.length; s++) switch (i[s]) {
            case "concrete":
                this.putSymmetrical(t, [!1, "cn3", "cn2", "cn1"], this.getRandomEvenInRange(e.concrete[0], e.concrete[1]), ["dirt3", "dirt2", "dirt1", "cn3", "cn2", "cn1", "infection"], 2);
                break;
            case "ice":
                this.putSymmetrical(t, "ice", this.getRandomEvenInRange(e.ice[0], e.ice[1]), ["ice", "dirt3", "dirt2", "dirt1", "infection"], 3);
                break;
            case "chain":
                this.putWrapped(t, e);
                break;
            case "dirt":
                this.putSymmetrical(t, ["dirt3", "dirt2", "dirt1"], this.getRandomEvenInRange(e.dirt[0], e.dirt[1]), ["ice", "dirt3", "dirt2", "dirt1", "cn3", "cn2", "cn1"], 0);
                break;
            case "infection":
                this.putSymmetrical(t, "infection", this.getRandomEvenInRange(e.infection[0], e.infection[1]), ["infection", "cn3", "cn2", "cn1", "ice", "W1", "W2", "W3", "W4", "W5", "W6"], 0)
        }
    }, G.LevelGenerator.pickBlockers = function(t, e) {
        var i = [];
        ["concrete", "ice", "chain", "dirt", "infection"].forEach(function(t) {
            0 < e[t][1] && i.push(t)
        });
        Phaser.ArrayUtils.shuffle(i);
        for (var s = [], a = game.rnd.between(e.blockersTypes[0], e.blockersTypes[1]), n = 0; n < Math.min(i.length, a); n++) s.push(i[n]);
        return s
    }, G.LevelGenerator.putWrapped = function(t, e) {
        for (var i = [!1], s = 1; s <= e.typesOfCandy; s++) i.push("W" + s.toString());
        this.putSymmetrical(t, i, this.getRandomEvenInRange(e.chain[0], e.chain[1]), ["infection", "W1", "W2", "W3", "W4", "W5", "W6"])
    }, G.LevelGenerator.fillWithRandom = function(s, t) {
        var a = ["W1", "W2", "W3", "W4", "W5", "W6", "infection"];
        s.loop(function(t, e, i) {
            this.shouldAvoidCell(s, e, i, a) || t.unshift("r")
        }, this)
    }, G.LevelGenerator.getRandomEven = function(t) {
        var e = game.rnd.between(0, t);
        return e % 2 == 1 && (e < t ? e++ : e--), e
    }, G.LevelGenerator.getRandomEvenInRange = function(t, e) {
        var i = game.rnd.between(t, e);
        return i % 2 == 1 && (i < e ? i++ : i--), i
    }, G.LevelGenerator.makeGoal = function(t, e, i, s) {
        for (var a = [], n = 1; n <= e.typesOfCandy; n++) a.push([n.toString(), 5 * Math.ceil(game.rnd.between(e.normReq[0], e.normReq[1]) / 5)]);
        var o = {
            concrete: ["cn3", "cn2", "cn1"],
            ice: ["ice"],
            chain: ["W1", "W2", "W3", "W4", "W5", "W6"],
            dirt: ["dirt3", "dirt2", "dirt1"],
            infection: ["infection"]
        };
        for (n = 0; n < s.length; n++) a.push([s[n], this.countOnBoard(t, o[s[n]])]);
        var r = game.rnd.between(e.goalRange[0], e.goalRange[1]);
        return Phaser.ArrayUtils.shuffle(a), a.splice(0, r)
    }, G.LevelGenerator.countEmptySpaces = function(t) {
        return this.countOnBoard(t, "X")
    }, G.LevelGenerator.countOnBoard = function(t, e) {
        var s = 0;
        Array.isArray(e) || (e = Array.prototype.slice.call(arguments).splice(1));
        for (var i = 0; i < e.length; i++) {
            var a = e[i];
            t.loop(function(t, e, i) {
                -1 !== t.indexOf(a) && s++
            })
        }
        return s
    }, G.LevelGenerator.putSymmetrical = function(t, e, i, s, a) {
        if (a = a || 0, Array.isArray(e)) var n = e,
            o = n.shift();
        if (console.log("PUT SYMETRIC: " + e + " x " + i), 0 != i) {
            var r = Math.random() < .5;
            console.log(r);
            for (var h = Math.ceil(.5 * t.width), l = r ? Math.ceil(.5 * t.height) : t.height, d = [], c = 0; 0 < i;) {
                if (400 == c++) return;
                n && o && (e = n[Math.floor(Math.random() * n.length)]), d = [];
                var u = Math.floor(Math.random() * h),
                    p = Math.floor(Math.random() * l),
                    g = t.width - 1 - u,
                    f = t.height - 1 - p;
                !this.shouldAvoidCell(t, u, p, s) && 0 < i && a <= p && (console.log("PUT: " + u + "x" + p), n && !o && (e = n[Math.floor(Math.random() * n.length)]), t.data[u][p].push(e), i--, d.push(!0)), !this.shouldAvoidCell(t, g, p, s) && 0 < i && a <= p && (console.log("PUT XR: " + g + "x" + p), n && !o && (e = n[Math.floor(Math.random() * n.length)]), t.data[g][p].push(e), i--, d.push(!0)), r && (!this.shouldAvoidCell(t, u, f, s) && 0 < i && a <= f && (n && !o && (e = n[Math.floor(Math.random() * n.length)]), t.data[u][f].push(e), console.log("PUT YR: " + u + "x" + f), i--, d.push(!0)), !this.shouldAvoidCell(t, g, f, s) && 0 < i && a <= f && (n && !o && (e = n[Math.floor(Math.random() * n.length)]), t.data[g][f].push(e), console.log("PUT XR YR: " + g + "x" + f), i--, d.push(!0))), d.length % 2 == 1 && i--
            }
        }
    }, G.LevelGenerator.shouldAvoidCell = function(t, e, i, s) {
        for (var a = t.data[e][i], n = 0; n < s.length; n++)
            if (-1 !== a.indexOf(s[n])) return !0;
        return !1
    }, G.LvlGoalMgr = function(t) {
        this.onGoalAchieved = new Phaser.Signal, this.onGoalNumberChanged = new Phaser.Signal, this.goalsSettings = G.json.settings.goals, this.bindings = [], "collect" === t[0] ? (this.COLLECT = !0, this.tasksMap = this.processCollectGoals(t[1]), this.bindings.push(G.sb("onCollectableRemove").add(this.onCollectableRemove, this), G.sb("onCollectableAdded").add(this.onCollectableAdded, this))) : (this.POINTS = !0, this.pointsTarget = t[1], this.bindings.push(G.sb("onPointsChange").add(this.onPointsChange, this)))
    }, G.LvlGoalMgr.prototype = {
        isPointBased: function() {
            return this.POINTS
        },
        getPointTarget: function() {
            return this.pointsTarget
        },
        isGoal: function(t) {
            return !(!this.tasksMap || !this.tasksMap[t]) && !this.tasksMap[t].completed
        },
        goalAchieved: function() {
            this.bindings.forEach(function(t) {
                t.detach()
            }), this.onGoalAchieved.dispatch()
        },
        onPointsChange: function(t) {
            t >= this.pointsTarget && this.goalAchieved()
        },
        processCollectGoals: function(t) {
            var n = {};
            return t.forEach(function(t) {
                var e = t[0],
                    i = t[1],
                    s = this.goalsSettings[e],
                    a = {
                        target: i,
                        dynamic: s.dynamic || !1,
                        uiAnimation: s.toUIAnimation,
                        completed: !1
                    };
                n[e] = a
            }, this), n
        },
        onCollectableAdded: function(t) {
            var e = this.tasksMap[t];
            e && e.dynamic && !e.completed && (e.target++, G.sb("onTaskAmountChanged").dispatch(t, 1))
        },
        onCollectableRemove: function(t, e, i) {
            var s = this.tasksMap[t];
            s && !s.completed && (s.uiAnimation ? G.sb("onCandyToUIAnim").dispatch(t, e, i, function() {
                G.sb("onTaskAmountChanged").dispatch(t, -1)
            }) : G.sb("onTaskAmountChanged").dispatch(t, -1), s.target--, 0 == s.target && (G.sb("onCollectableTaskFinished").dispatch(t), s.completed = !0, this.areAllCompleted() && this.goalAchieved()))
        },
        areAllCompleted: function() {
            var e = !0;
            return Object.keys(this.tasksMap).forEach(function(t) {
                this.tasksMap[t].completed || (e = !1)
            }, this), e
        }
    }, G.LvlObject = function(t, e) {
        var i = G.LvlGoalMgr,
            s = G.LvlObjectBoosterTracking,
            a = G.saveState,
            n = G.json.settings;
        G.gameTracking;
        this.state = game.state.getCurrentState(), this.lvlIndex = t, this.lvlNr = t, this.latestLevel = this.lvlIndex === a.getLastPassedLevelNr(), this.boosterTracking = new s(this.lvlIndex), this.coinChanceProb = 0 == a.getStars(this.lvlIndex) ? 1 : n.completedLevelCoinsProb, this.stars = 0, this.combo = 0, this.data = e, this.goalAchieved = !1, this.moves = e.moves, this.points = 0, this.boosterInUse = !1, this.movesMade = 0, this.goal = e.goal, this.goalMgr = new i(e.goal), this.goalMgr.onGoalAchieved.add(function() {
            this.goalAchieved = !0, G.sb("onGoalAchieved").dispatch(), this.boosterTracking.sendTrackingEvents()
        }, this), this.firstMoveMade = !1, this.extraMovesBoughtNr = 0, this.outOfMovesPopUp = 0, this.matchNumber = 0, this.moneyGained = 0, this.comboBonus = G.json.settings.comboBonus, this.moneyGainedChest = 0, G.sb("onLevelMoneyGain").add(function(t) {
            this.moneyGained += t
        }, this)
    }, G.LvlObject.prototype = {
        getPoints: function() {
            return this.points
        },
        getMoves: function() {
            return this.moves
        },
        getPriceOfExtraMoves: function() {
            return G.json.settings.priceOfExtraMoves * (this.extraMovesBoughtNr + 1)
        },
        onPreBoosterUse: function(t) {
            this.boosterTracking.onPreBoosterUse(t)
        },
        onBoosterUse: function(t) {
            this.boosterTracking.onBoosterUse(t)
        },
        buyExtraMoves: function(t, e) {
            var i = e || G.json.settings.priceOfExtraMoves * (t ? 2 : 1);
            G.saveState.changeCoins(-i), this.extraMovesBoughtNr++, this.changeMoveNumber(5), G.sb("onExtraMovesUsed").dispatch(), G.gameTracking.sink("Coins", "Moves", "InGame", i)
        },
        isGoalAchieved: function() {
            return this.goalAchieved
        },
        madeMove: function() {
            G.IMMEDIATE || this.changeMoveNumber(-1), this.goalAchieved || (this.movesMade++, G.sb("userMadeMove").dispatch()), G.sb("madeMove").dispatch()
        },
        changeMoveNumber: function(t) {
            this.moves += t, G.sb("changeMoveNumber").dispatch()
        },
        changePointsNumber: function(t) {
            this.points += t, G.sb("onPointsAdded").dispatch(t), G.sb("onPointsChange").dispatch(this.points)
        },
        increaseCombo: function() {
            this.combo++, G.sb("onComboIncrease").dispatch(this.combo)
        },
        endCombo: function() {
            this.combo = 0, G.sb("onComboBreak").dispatch()
        },
        processMatch: function(t, e, i, s) {
            var a = t * (10 + this.getComboBonus());
            this.changePointsNumber(a);
            var n = this.state.board.cellToPxOut([e, i]);
            if (G.sb("displayPoints").dispatch(n[0], n[1], a, s), this.matchNumber++, 0 === this.lvlIndex && this.state.tut && !this.state.tut.skipped) switch (this.matchNumber) {
                case 1:
                    G.gameTracking.FTUEDesign("FTUX_TutOn_FirstMatch");
                    break;
                case 2:
                    G.gameTracking.FTUEDesign("FTUX_TutOn_SecondMatch");
                    break;
                case 3:
                    G.gameTracking.FTUEDesign("FTUX_TutOn_ThirdMatch")
            }
        },
        getComboBonus: function() {
            return this.comboBonus[Math.min(this.combo, this.comboBonus.length - 1)]
        },
        isGoal: function(t) {
            return this.goalMgr.isGoal(t)
        }
    }, G.LvlObjectBoosterTracking = function(t) {
        this.lvlIndex = t, this.uses = [0, 0, 0, 0, 0, 0, 0, 0, 0], this.boosterIds = [null, "SWAP", "REMOVE", "HORIZONTAL", "VERTICAL", "MOVES", null, "VERHOR", "COLOR"]
    }, G.LvlObjectBoosterTracking.prototype.onBoosterUse = function(t) {
        this.uses[t]++
    }, G.LvlObjectBoosterTracking.prototype.onPreBoosterUse = function(t) {
        this.uses[t]++
    }, G.LvlObjectBoosterTracking.prototype.sendTrackingEvents = function() {
        var i = [];
        this.boosterIds.forEach(function(t, e) {
            null !== t && i.push({
                eventId: "BoosterUse:Level" + G.pad(this.lvlIndex + 1, 4) + ":" + t,
                value: this.uses[e]
            })
        }, this), i.forEach(function(t) {
            try {
                console.log("^^ booster tracking event ", t.eventId, t.value)
            } catch (t) {
                console.log(t)
            }
        })
    }, G.MapGift = function() {
        Phaser.Group.call(this, game), this.position.setTo(0, 240), G.saveState.data.lastMapGiftOpenTime || (G.saveState.data.lastMapGiftOpenTime = 0), this.msGiftCooldown = 60 * G.json.settings.mapGiftTimeMinutes * 1e3, this.active = Date.now() - G.saveState.data.lastMapGiftOpenTime > this.msGiftCooldown, this.btn = new G.Button(3, 0, "gift", this.open, this), this.btnDarkOverlay = G.makeImage(0, 0, "gift", .5, this.btn), this.btnDarkOverlay.alpha = .5, this.btn.scale.setTo(.4), this.add(this.btn), this.btn.addTerm(function() {
            return this.active
        }, this), this.addTimer(), this.active || this.startTimer(), this.notificationBubble = new G.NotificationBubble(30, -25), this.add(this.notificationBubble), G.sb("onScreenResize").add(this.onResize, this), this.onResize()
    }, G.MapGift.prototype = Object.create(Phaser.Group.prototype), G.MapGift.prototype.update = function() {
        Date.now() - G.saveState.data.lastMapGiftOpenTime > this.msGiftCooldown ? (this.active = !0, this.ignoreChildInput = !1) : (this.active && this.startTimer(), this.active = !1, this.ignoreChildInput = !0), this.notificationBubble.setImportant(this.active), this.btnDarkOverlay.visible = !this.active, this.timer.visible = !this.active
    }, G.MapGift.prototype.onResize = function() {
        this.x = game.world.bounds.x + game.width - 60
    }, G.MapGift.prototype.open = function() {
        G.gameTracking.design("FreeGiftButtonClicked"), G.sb("pushWindow").dispatch("mapGift")
    }, G.MapGift.prototype.addTimer = function() {
        this.timer = new G.TextTimer(0, 55, null, {
            style: "font-num-blue",
            fontSize: "30px"
        }, .5, 130), this.add(this.timer)
    }, G.MapGift.prototype.startTimer = function() {
        var t = Math.floor((G.saveState.data.lastMapGiftOpenTime + this.msGiftCooldown - Date.now()) / 1e3);
        this.timer.setSecLeft(t), this.timer.active = !0
    }, G.MapGift.prototype.addGlow = function() {
        this.glow = G.makeImage(0, 0, "popup_lighht", .5, this), this.glow.alpha = .5, this.glow.scale.setTo(.5), this.glow.blendMode = 1
    }, G.MapTilesRenderer = function() {
        Phaser.Group.call(this, game), this.marker = G.makeImage(0, 0, null), this.rts = [], this.imgs = [];
        for (var t = this.getMapTotalHeight(), e = t, i = Math.ceil(e / 600), s = {
                totalHeight: t,
                tiles: []
            }, a = 0; a < i; a++) {
            Math.min(600, e);
            this.rts[a] = game.make.renderTexture(1200, 600, "map-tile-" + a, !0), this.drawMap(this.rts[a], G.json.map, 600 * a), e -= 600, s.tiles.push({
                rt: "map-tile-" + a,
                y: 600 * -a
            })
        }
        G.json.settings.mapTiles = s, this.marker.destroy()
    }, G.MapTilesRenderer.prototype = Object.create(Phaser.Group.prototype), G.MapTilesRenderer.prototype.getMapTotalHeight = function() {
        for (var t = 0; t < G.json.map.length; t++)
            if (G.json.map[t].label && "ENDMARKER" === G.json.map[t].label) return Math.floor(-1 * G.json.map[t].y)
    }, G.MapTilesRenderer.prototype.drawMap = function(t, e, i) {
        for (var s = .5 * t.width, a = t.height + i, n = 0; n < e.length; n++) {
            var o = e[n];
            o.label && "ENDMARKER" === o.label || this.drawElementXY(o.x + s, o.y + a, o, t)
        }
    }, G.MapTilesRenderer.prototype.drawElementXY = function(t, e, i, s) {
        this.marker.position.setTo(t, e), this.marker.anchor.setTo(i.anchor[0], i.anchor[1]), this.marker.angle = i.angle, this.marker.scale.setTo(i.scale[0], i.scale[1]), G.changeTexture(this.marker, i.frame), this.marker.updateTransform(), s.renderXY(this.marker, t, e)
    }, G.MapTutHand = function(t) {
        G.Image.call(this, 0, 0, "tut_hand", 0);
        var e = G.saveState.getLastPassedLevelNr();
        this.map = t, G.json.levels[e] && (this.levelPos = {
            x: G.json.levels[e].mapX,
            y: G.json.levels[e].mapY
        }), e === G.saveState.getFirstClosedGateLvLIndex() && (this.levelPos.y += 35), this.closestBubble = G.json.settings.bubbleGifts.find(function(t) {
            return !G.saveState.isBubbleGiftUsed(t.levelNumber) && t.levelNumber - 1 <= e && Math.abs(e - t.levelNumber) < 2
        }), this.closestBubble && (this.bubblePos = {
            x: G.json.levels[this.closestBubble.levelNumber - 1].mapX + 20,
            y: G.json.levels[this.closestBubble.levelNumber - 1].mapY - 90
        }, this.bubbleLvlNr = this.closestBubble.levelNumber), this.closestBubble ? (this.position.setTo(this.bubblePos.x, this.bubblePos.y), G.sb("onBubbleGiftOpened").add(this.onBubbleGiftOpened, this), this.showingBubble = !0) : this.levelPos ? this.position.setTo(this.levelPos.x, this.levelPos.y) : this.visible = !1, game.add.tween(this.anchor).to({
            x: -.1,
            y: -.1
        }, 500, Phaser.Easing.Sinusoidal.InOut, !0, 0, -1, !0), game.add.existing(this)
    }, G.MapTutHand.prototype = Object.create(G.Image.prototype), G.MapTutHand.prototype.onBubbleGiftOpened = function(t) {
        this.showingBubble && this.bubbleLvlNr === t && (this.levelPos ? (this.showingBubble = !1, game.add.tween(this).to({
            x: this.levelPos.x,
            y: this.levelPos.y
        }, 300, Phaser.Easing.Sinusoidal.InOut, !0)) : game.add.tween(this).to({
            alpha: 0
        }, 300, Phaser.Easing.Sinusoidal.InOut, !0))
    }, G.MultiLineText = function(t, e, i, s, a, n, o, r, h, l) {
        if (t = G.l(t), e = G.l(e), a = G.l(a), n = G.l(n), o = G.l(o), Phaser.BitmapText.call(this, game, t, e, i, "", a), this.splitText(s, n), this.align = r || "center", o)
            for (; this.height > o;) this.fontSize -= 2, this.splitText(s, n), this.updateText();
        this.hAnchor = "number" == typeof h ? h : .5, this.vAnchor = "number" == typeof l ? l : 0, this.cacheAsBitmap = !0, this._cachedSprite.anchor.setTo(this.hAnchor, this.vAnchor)
    }, G.MultiLineText.prototype = Object.create(Phaser.BitmapText.prototype), G.MultiLineText.prototype.splitText = function(t, e) {
        for (var i = t, s = [], a = 0, n = 0; 0 < i.length;)
            if (a = n, -1 == (n = i.indexOf(" ", n + 1)) ? this.setText(i) : this.setText(i.substring(0, n)), this.updateText(), this.width > e) {
                if (0 == a && -1 == n) {
                    s.push(i), i = "", n = 0;
                    continue
                }
                if (0 == a) {
                    s.push(i.substring(0, n)), i = i.substring(n + 1), n = 0;
                    continue
                }
                s.push(i.substring(0, a)), i = i.substring(a + 1), n = 0
            } else -1 == n && (s.push(i), i = "");
        this.setText(s.join("\n"))
    }, G.MultiLineText.prototype.popUpAnimation = function() {
        this.cacheAsBitmap = !1;
        for (var t = this.children.length, s = [], e = 0; e < t; e++) s[e] = e;
        s = Phaser.ArrayUtils.shuffle(s), delay_index = 0, this.activeTweens = 0, this.children.forEach(function(t) {
            0 == t.anchor.x && (t.x = t.x + .5 * t.width, t.y = t.y + t.height, t.anchor.setTo(.5, 1));
            var e = t.scale.x;
            t.scale.setTo(0, 0), this.activeTweens++;
            var i = game.add.tween(t.scale).to({
                x: 1.5 * e,
                y: 1.5 * e
            }, 200, Phaser.Easing.Quadratic.In, !1, 25 * s[delay_index]).to({
                x: e,
                y: e
            }, 200, Phaser.Easing.Sinusoidal.In);
            i.onComplete.add(function() {
                this.activeTweens--, 0 == this.activeTweens && this.alive && (this.cacheAsBitmap = !0)
            }, this), i.start(), delay_index++
        }, this)
    }, G.MysteryGiftHeader = function(t) {
        var e;
        Phaser.Group.call(this, game), this.fixedToCamera = !0, e = 3 <= G.saveState.mysteryGift_getCurrentStreak() ? G.txt("Continue winning with one try to keep your boosters!") : G.saveState.mysteryGift_getCurrentStreak() < 3 && t ? G.txt("Win this level now and get a cool mystery gift!") : G.txt("Finish with one try"), t || 0 !== G.saveState.mysteryGift_getCurrentStreak() || (this.visible = !1), this.msg = game.add.group(this), this.msg.name = "message", this.msg.y = -200, this.bg = G.makeImage(0, 0, "First_try_bar", [.5, 0], this.msg), this.bg.width = 640, this.text = new G.Text(0, 35, e, {
            fill: "#0089D4",
            font: "Lobster",
            fontSize: "30px",
            stroke: "#0089D4"
        }, .5, 600, 100, !0, "center"), this.text.lineSpacing = -15, this.msg.add(this.text), G.Utils.cleanUpOnDestroy(this, G.sb("onScreenResize").add(this.onResize, this)), this.onResize()
    }, G.MysteryGiftHeader.prototype = Object.create(Phaser.Group.prototype), G.MysteryGiftHeader.prototype.onResize = function() {
        this.cameraOffset.x = Math.floor(.5 * game.width), this.cameraOffset.y = 0
    }, G.MysteryGiftHeader.prototype.show = function() {
        G.Animations.getMysteryGiftHeaderShow().animate(game, this.msg)
    }, G.MysteryGiftHeader.prototype.hide = function(t) {
        var e = G.Animations.getMysteryGiftHeaderHide();
        e.animate(game, this.msg), t && e.onComplete.add(t)
    }, G.MysteryGiftHeaderInGame = function(t) {
        G.MysteryGiftHeader.call(this, t), this.state = game.state.getCurrentState(), this.board = this.state.board, this.x = this.board.x + .5 * (this.board.width - 2 * this.board.tilesize), this.y = -300, game.add.tween(this).to({
            y: 80
        }, 600, Phaser.Easing.Sinusoidal.Out, !0, 0).onComplete.add(function() {
            game.add.tween(this).to({
                y: -300
            }, 600, Phaser.Easing.Sinusoidal.In, !0, 2500)
        }, this)
    }, G.MysteryGiftHeaderInGame.prototype = Object.create(G.MysteryGiftHeader.prototype), G.NoMoreAds = function(t) {
        Phaser.Image.call(this, game), this.config = t || {}, this.bg = G.makeImage(0, 0, "text_shade_bg", .5, this), this.txt = new G.Text(0, 0, this.config.txt || G.txt("You watched all videos for today. Come back tomorrow!"), {
            style: "font-white",
            fontSize: "70px"
        }, .5, 600, 300, !0, "center"), this.addChild(this.txt), this.bg.width = this.txt.width + G.l(100), this.bg.height = this.txt.height + G.l(100), this.fixedToCamera = !0, this.cameraOffset.x = .5 * game.width, this.cameraOffset.y = .5 * game.height, game.add.tween(this).to({
            alpha: 0
        }, 500, Phaser.Easing.Sinusoidal.InOut, !0, this.config.duration || 2500).onComplete.add(function() {
            this.destroy()
        }, this), game.add.tween(this).from({
            alpha: 0
        }, 500, Phaser.Easing.Sinusoidal.InOut, !0), game.add.existing(this)
    }, G.NoMoreAds.prototype = Object.create(Phaser.Image.prototype), G.NoMoreAds.prototype.update = function() {
        this.cameraOffset.x = .5 * game.width, this.cameraOffset.y = .5 * game.height
    }, G.NotificationBubble = function(t, e) {
        Phaser.Group.call(this, game), this.position.setTo(t, e), this.amount = 0, this.important = !1, this.bg = G.makeImage(0, 0, "reddot", .5, this), this.amountTxt = new G.Text(1, 4, "0", {
            style: "font-white",
            fontSize: 25
        }, .5), this.add(this.amountTxt), this.alpha = 0
    }, G.NotificationBubble.prototype = Object.create(Phaser.Group.prototype), G.NotificationBubble.prototype.setImportant = function(t) {
        this.important !== t && (this.important = t, this.important ? this.tweenAlpha(1) : 0 === this.amount && this.tweenAlpha(0), this.setTextAmount(this.amount))
    }, G.NotificationBubble.prototype.addNotification = function() {
        this.amount++, this.tweenAlpha(1), this.setTextAmount(this.amount)
    }, G.NotificationBubble.prototype.removeNotification = function() {
        this.amount = Math.max(this.amount - 1, 0), 0 == this.amount && this.tweenAlpha(0), this.setTextAmount(this.amount)
    }, G.NotificationBubble.prototype.tweenAlpha = function(t) {
        this.alpha !== t && (this.alphaTween && (this.alphaTween.stop(), this.alphaTween = null), this.alphaTween = game.add.tween(this).to({
            alpha: t
        }, 300, Phaser.Easing.Sinusoidal.Out, !0))
    }, G.NotificationBubble.prototype.setTextAmount = function(t) {
        this.important ? this.amountTxt.setText("!") : 0 == t ? this.amountTxt.setText("") : this.amountTxt.setText(t.toString()), this.scaleTween && (this.scaleTween.stop(), this.scaleTween = null), this.scale.setTo(1), this.scaleTween = game.add.tween(this.scale).to({
            x: 1.2,
            y: 1.2
        }, 300, Phaser.Easing.Sinusoidal.Out, !0, 0, 0, !0)
    }, G.runDebugTests = function() {
        var t = G.json.tutorials;
        Object.entries(t).filter(function(t) {
            t[0];
            return !t[1].steps
        }).forEach(function(t) {
            console.log("%c No steps in tutorial " + t[0], "background: orange; color: white")
        }), Object.entries(t).filter(function(t) {
            var e = t[0];
            return "POPUPTUTORIALS" !== e && !G.json.levels.find(function(t) {
                return t.tutID == e
            })
        }).forEach(function(t) {
            console.log("%c Unused tutorial " + t[0], "background: red; color: white")
        })
    }, Object.entries || (Object.entries = function(t) {
        for (var e = Object.keys(t), i = e.length, s = new Array(i); i--;) s[i] = [e[i], t[e[i]]];
        return s
    }), G.StartBoosterBubble = function(t, e, i, s, a) {
        Phaser.Image.call(this, game, 0, 0), this.anchor.setTo(.5), this.state = game.state.getCurrentState(), this.board = this.state.board, this.x = this.board.x + this.board.width * t[0], this.y = this.board.y + this.board.height * t[1], this.tweenFloating = game.add.tween(this).to({
            y: this.y + G.l(30)
        }, 1e3, Phaser.Easing.Sinusoidal.InOut, !0, 0, -1, !0), game.add.tween(this.scale).from({
            x: 0,
            y: 0
        }, 1e3, Phaser.Easing.Elastic.Out, !0), G.changeTexture(this, e), this.target = i || null, this.onPop = s || function() {}, this.onPopContext = a || this, this.goingToTarget = !1
    }, G.StartBoosterBubble.prototype = Object.create(Phaser.Image.prototype), G.StartBoosterBubble.prototype.update = function() {}, G.StartBoosterBubble.prototype.goToTarget = function(t) {
        null == this.target ? game.time.events.add(t + 500, function() {
            this.tweenFloating.stop(), this.pop()
        }, this) : game.time.events.add(t, function() {
            this.tweenFloating.stop(), game.add.tween(this).to({
                x: game.world.bounds.x + this.target.worldPosition.x,
                y: game.world.bounds.y + this.target.worldPosition.y
            }, 300, Phaser.Easing.Sinusoidal.In, !0).onComplete.add(this.pop, this), game.add.tween(this.scale).to({
                x: .6,
                y: .6
            }, 300, Phaser.Easing.Sinusoidal.In, !0)
        }, this)
    }, G.StartBoosterBubble.prototype.pop = function() {
        G.sfx["match_" + game.rnd.between(1, 5)].play(), this.onPop.call(this.onPopContext), G.sb("UIfx").dispatch(this.worldPosition.x + game.world.bounds.x, this.worldPosition.y, "whiteStarPart"), G.sb("UIfx").dispatch(this.worldPosition.x + game.world.bounds.x, this.worldPosition.y, "whiteStarPart"), G.sb("UIfx").dispatch(this.worldPosition.x + game.world.bounds.x, this.worldPosition.y, "whiteStarPart"), G.sb("UIfx").dispatch(this.worldPosition.x + game.world.bounds.x, this.worldPosition.y, "whiteStarPart"), this.destroy()
    }, G.StartBoosterConfig = function() {
        this.data = [], this.preLevelAdBooster = []
    }, G.StartBoosterConfig.prototype.select = function(t, e) {
        this.data[t] || (this.data[t] = []), this.data[t][e] = !0, G.sb("onStartBoosterConfigChange").dispatch()
    }, G.StartBoosterConfig.prototype.deselect = function(t, e) {
        this.data[t] || (this.data[t] = []), this.data[t][e] = !1, G.sb("onStartBoosterConfigChange").dispatch()
    }, G.StartBoosterConfig.prototype.isSelected = function(t, e) {
        return !!this.data[t] && this.data[t][e]
    }, G.StartBoosterConfig.prototype.getConfigForLevel = function(t) {
        return this.data[t] || []
    }, G.StartBoosterConfig.prototype.getPreLevelAdBoosterNr = function(t) {
        return this.preLevelAdBooster[t] || (this.preLevelAdBooster[t] = game.rnd.pick([5, 7, 8])), this.preLevelAdBooster[t]
    }, G.Text = function(t, e, i, s, a, n, o, r, h) {
        for (s = G.Text.getStyle(s), this.userMaxWidth = n || 1 / 0, this.userMaxHeight = o || 1 / 0, r && (s.wordWrap = !0, s.wordWrapWidth = n, s.align = h || "left"), Phaser.Text.call(this, game, t, e, i, s), s.lineSpacing && (this.lineSpacing = s.lineSpacing, "ja" === G.lang && (this.lineSpacing = Math.floor(.2 * this.lineSpacing))), s.shadow && (this.setShadow.apply(this, s.shadow), this.padding.setTo(s.shadow[0], s.shadow[1])), a && ("number" == typeof a ? this.anchor.setTo(a) : this.anchor.setTo(a[0], a[1]));
            (this.width > this.userMaxWidth || this.height > this.userMaxHeight) && (this.fontSize -= 2, !(this.fontSize < 10)););
    }, G.Text.prototype = Object.create(Phaser.Text.prototype), G.Text.styles = {}, G.Text.addStyle = function(t, e) {
        G.Text.styles[t] = e
    }, G.Text.getStyle = function(t) {
        var e;
        if ("object" != typeof t) e = G.Utils.clone(G.Text.styles[t]);
        else if (t.style || t.fontStyle) {
            t.style = t.fontStyle || t.style;
            var i = G.Utils.clone(G.Text.styles[t.style]);
            if (t.scaleStroke && t.fontSize && i.fontSize && i.strokeThickness) {
                var s = i.strokeThickness / parseInt(i.fontSize);
                t.strokeThickness = Math.ceil(parseInt(t.fontSize) * s)
            }
            e = Object.assign(i, t)
        } else e = t;
        return "vi" === G.lang && "Lobster" === e.font && (delete e.font, e.fontWeight = "bold"), e
    }, G.Text.prototype.setText = function(t) {
        Phaser.Text.prototype.setText.call(this, t), this.scale.setTo(1), this.width = Math.min(this.width, this.userMaxWidth), this.height = Math.min(this.height, this.userMaxHeight)
    }, G.Text.prototype.setStyle = function(t, e) {
        t = G.Text.getStyle(t), Phaser.Text.prototype.setStyle.call(this, t, e)
    }, G.TextCounter = function(t, e, i, s, a, n, o) {
        this.amount = i, this.amountDisplayed = i, G.Text.call(this, t, e, null === i ? "..." : i.toString(), s, a, n), o = o || {
            lerpValue: .5
        }, this.lerp = !0, this.lerpValue = o.lerpValue, this.stepCurrent = 0, this.step = 0
    }, G.TextCounter.prototype = Object.create(G.Text.prototype), G.TextCounter.prototype.setAmount = function(t, e) {
        this.amount = t, e && (this.amountDisplayed = t, this.setText(this.amountDisplayed.toString()))
    }, G.TextCounter.prototype.changeAmount = function(t, e) {
        this.amount += t, e && (this.amountDisplayed = this.amount, this.setText(this.amountDisplayed.toString()))
    }, G.TextCounter.prototype.increaseAmount = function(t, e) {
        this.changeAmount(t)
    }, G.TextCounter.prototype.update = function() {
        this.amountDisplayed != this.amount && this.stepCurrent-- <= 0 && (this.stepCurrent = this.step, this.lerp && this.lerpUpdate())
    }, G.TextCounter.prototype.lerpUpdate = function() {
        this.amountDisplayed = G.lerp(this.amountDisplayed, this.amount, this.lerpValue, .2), this.setText(Math.round(this.amountDisplayed).toString())
    }, "function" != typeof Object.assign && Object.defineProperty(Object, "assign", {
        value: function(t, e) {
            "use strict";
            if (null == t) throw new TypeError("Cannot convert undefined or null to object");
            for (var i = Object(t), s = 1; s < arguments.length; s++) {
                var a = arguments[s];
                if (null != a)
                    for (var n in a) Object.prototype.hasOwnProperty.call(a, n) && (i[n] = a[n])
            }
            return i
        },
        writable: !0,
        configurable: !0
    }), G.TextTimer = function(t, e, i, s, a, n, o) {
        G.Text.call(this, t, e, "???", s, a, n), this.secLeft = 0, this.active = !1, this.timerFormat = o || "hms", this.dots = !0, this.timerBinding = G.sb("onWallClockTimeUpdate").add(this.updateTimer, this), this.events.onDestroy.add(function() {
            this.timerBinding.detach()
        }, this), i && this.setDate(i)
    }, G.TextTimer.prototype = Object.create(G.Text.prototype), G.TextTimer.prototype.sfx = null, G.TextTimer.prototype.updateTimer = function() {
        this.active && (this.sfx && this.sfx.play(), this.secLeft = Math.max(0, this.secLeft - 1), this.updateTimerText(this.secLeft, this.dots), this.dots = !this.dots)
    }, G.TextTimer.prototype.setSecLeft = function(t) {
        this.secLeft = Math.max(0, t), this.updateTimerText(this.secLeft, !0)
    }, G.TextTimer.prototype.updateTimerText = function(t, e) {
        var i;
        i = "hms" === this.timerFormat ? G.changeSecToHMS(this.secLeft) : "ms" === this.timerFormat ? G.changeSecToMS(this.secLeft) : G.changeSecToDHMS(this.secLeft), this.setText(i.join(":"))
    }, G.TextTimer.prototype.start = function(t) {
        t && this.setSecLeft(t), this.active = !0
    }, G.TextTimer.prototype.setDate = function(t) {
        var e = new Date(t).getTime(),
            i = Date.now(),
            s = Math.ceil((e - i) / 1e3);
        this.setSecLeft(s), this.active = !0
    }, G.TitleScreenGemsThrower = function() {
        Phaser.Group.call(this, game), G.sb("onScreenResize").add(this.onScreenResize, this), this.onScreenResize(), this.chanceForShoot = .1, this.horizontal = !1;
        for (var t = 0; t < 20; t++) this.addChild(new G.TitleScreenGem)
    }, G.TitleScreenGemsThrower.prototype = Object.create(Phaser.Group.prototype), G.TitleScreenGemsThrower.prototype.onScreenResize = function() {
        this.x = game.world.bounds.x, this.y = 0
    }, G.TitleScreenGemsThrower.prototype.throwGem = function() {
        var t, e, i, s, a = this.getFreeGem();
        null != a && (this.horizontal ? (t = Math.random() < .5 ? game.world.bounds.x - G.l(50) : -game.world.bounds.x + game.width + G.l(50), e = .5 * game.height + .5 * game.height * Math.random(), i = G.l(3 + 6 * Math.random()) * Math.sign(t) * -1, s = G.l(-2 * Math.random() - 2)) : (t = Math.random() * game.width, e = game.height + G.l(50), i = G.l(1 + -2 * Math.random()), s = G.l(-3 * Math.random() - 1)), a.init(t, e, i, s))
    }, G.TitleScreenGemsThrower.prototype.getFreeGem = function() {
        return this.getFirstDead()
    }, G.TitleScreenGemsThrower.prototype.update = function() {
        Math.random() < this.chanceForShoot && this.throwGem();
        for (var t = 0; t < this.children.length; t++) this.children[t].update()
    }, G.TitleScreenGem = function() {
        Phaser.Image.call(this, game, 0, 0), this.anchor.setTo(.5), this.grav = G.lnf(.02), this.kill()
    }, G.TitleScreenGem.prototype = Object.create(Phaser.Image.prototype), G.TitleScreenGem.prototype.init = function(t, e, i, s) {
        G.changeTexture(this, "candy_" + game.rnd.between(1, 6)), this.x = t, this.y = e, this.velX = i, this.velX *= .99, this.velY = s, this.angleSpeed = 3 * Math.random() - 1.5, this.revive()
    }, G.TitleScreenGem.prototype.update = function() {
        this.alive && (this.x += this.velX, this.angle += this.angleSpeed, this.y += this.velY, this.velY += this.grav, this.y > game.height + 100 && this.kill())
    }, G.UITargetParticles = function(t, e) {
        G.PoolGroup.call(this, G.UITargetParticle), this.minNrOfPart = t || 3, this.maxNrOfPart = e || 100
    }, G.UITargetParticles.prototype = Object.create(G.PoolGroup.prototype), G.UITargetParticles.prototype.createDividedBatch = function(t, e, i, s, a, n, o) {
        var r = new G.UITargetParticles.BatchObj;
        (o = o || 25) < a / n && (n = Math.ceil(a / o));
        for (var h = Math.floor(a / n) + Math.sign(a % n), l = 0; l < h; l++) {
            var d = this.init(t, e, i, s, Math.min(n, a));
            a -= n, r.add(d)
        }
        return r
    }, G.UITargetParticles.prototype.createBatch = function(t, e, i, s, a, n) {
        for (var o = new G.UITargetParticles.BatchObj, r = 0; r < n; r++) {
            var h = this.init(t, e, i, s, a);
            o.add(h)
        }
        return o
    }, G.UITargetParticles.prototype.createCoinBatch = function(t, e, i, s) {
        game.state.getCurrentState();
        var a = this.createDividedBatch(t, e, "coin_1", i, s, 5);
        a.addOnPartStart(function() {
            this.scale.setTo(.75), this.vel.setTo(game.rnd.realInRange(-12, 12), game.rnd.realInRange(-12, 12))
        }), a.addOnPartFinish(function() {
            G.sfx.pop.play(), G.saveState.changeCoins(this.carriedValue, !0)
        }), a.start(), a.onFinish.add(function() {
            G.saveState.save()
        })
    }, G.UITargetParticles.BatchObj = function() {
        this.parts = [], this.nrOfParts = 0, this.nrOfFinished = 0, this.onFinish = new Phaser.Signal
    }, G.UITargetParticles.BatchObj.prototype.add = function(t) {
        this.parts.push(t), t.onFinish.addOnce(this.onPartFinish, this), this.nrOfParts++
    }, G.UITargetParticles.BatchObj.prototype.onPartFinish = function() {
        this.nrOfFinished++, this.nrOfFinished == this.nrOfParts && this.onFinish.dispatch()
    }, G.UITargetParticles.BatchObj.prototype.addOnPartStart = function(e, i) {
        this.parts.forEach(function(t) {
            t.onStart.addOnce(e, i || t, 1)
        })
    }, G.UITargetParticles.BatchObj.prototype.addOnPartFinish = function(e, i) {
        this.parts.forEach(function(t) {
            t.onFinish.addOnce(e, i || t, 1)
        })
    }, G.UITargetParticles.BatchObj.prototype.start = function(e) {
        var i = 0;
        this.parts.forEach(function(t) {
            t.start(i), i += e || 0
        })
    }, G.UITargetParticle = function() {
        G.Image.call(this, 0, 0, null, .5), this.onStart = new Phaser.Signal, this.onFinish = new Phaser.Signal, this.speed = 0, this.speedMax = 30, this.speedDelta = .75, this.vel = new Phaser.Point(0, 0), this.velInit = new Phaser.Point(0, 0), this.kill()
    }, G.UITargetParticle.prototype = Object.create(G.Image.prototype), G.UITargetParticle.prototype.init = function(t, e, i, s, a) {
        this.position.setTo(t, e), this.changeTexture(i), this.onStart.removeAll(), this.onFinish.removeAll(), this.carriedValue = a || 1, this.targetObj = s, this.stopTweens(this), this.scale.setTo(1), this.alpha = 1, this.speed = 0, this.speedMax = 30, this.speedDelta = .75, this.vel.setTo(0, 0)
    }, G.UITargetParticle.prototype.start = function(t) {
        t ? game.time.events.add(t, this.start, this) : (this.revive(), this.worldPosition.x = 9999, this.worldPosition.y = 9999, this.onStart.dispatch(this, this.carriedValue))
    }, G.UITargetParticle.prototype.update = function() {
        if (this.alive) {
            this.position.add(this.vel.x, this.vel.y), this.vel.x *= .95, this.vel.y *= .95, this.speed += this.speedDelta, this.speed = Math.min(this.speed, this.speedMax);
            var t = Phaser.Point.distance(this.worldPosition, this.targetObj.worldPosition),
                e = Phaser.Point.angle(this.targetObj.worldPosition, this.worldPosition);
            this.position.add(G.lengthDirX(e, Math.min(t, this.speed), !0), G.lengthDirY(e, Math.min(t, this.speed), !0)), t < this.speedMax && (this.onFinish.dispatch(this, this.carriedValue), this.kill())
        }
    }, G.UI_BoosterButton = function(t, e, i) {
        Phaser.Group.call(this, game), this.x = G.l(t), this.y = G.l(e), this.orgY = this.y, this.state = game.state.getCurrentState(), this.boosterNr = i, this.overlay = this.state.overlay, this.selected = !1, this.highlighted = !1, this.hl = G.makeImage(0, 0, "popup_lighht", .5, this), this.hl.blendMode = 1, this.hl.alpha = 0, this.hl.angle2 = 0, this.openLock = !1, G.sb("onTutorialFinish").add(function() {
            this.hideSuggestion()
        }, this), this.btn = new G.Button(0, 0, "ui_booster_" + i, function() {
            if (this.selected && !G.tutorialOpened) return G.sb("onBoosterDeselect").dispatch(this.boosterNr);
            0 < this.state.board.actionManager.actionList.length || (0 < G.saveState.getBoosterAmount(this.boosterNr) || G.saveState.isEnoughToBuyBooster(this.boosterNr) ? G.sb("onBoosterSelect").dispatch(this.boosterNr) : G.IAP ? G.sb("pushWindow").dispatch("coinShop") : game.incentivised ? G.sb("pushWindow").dispatch("moreMoney") : (G.stopTweens(this.priceLabel), this.priceLabel.scale.setTo(1), game.add.tween(this.priceLabel.scale).to({
                x: .6,
                y: 1.4
            }, 150, Phaser.Easing.Bounce.InOut, !0, 0, 2, !0)))
        }, this), this.add(this.btn), this.btn.addTerm(function() {
            return 0 == this.state.board.actionManager.actionList.length || this.selected
        }, this), this.boosterActiveOffset = G.l(20), this.tweenObj = {
            angle: -15,
            alpha: 1
        }, game.add.tween(this.tweenObj).to({
            angle: 15
        }, 2e3, Phaser.Easing.Sinusoidal.InOut, !0, 0, -1, !0), game.add.tween(this.tweenObj).to({
            alpha: 0
        }, 500, Phaser.Easing.Sinusoidal.InOut, !0, 0, -1, !0), this.angleMulti = 0, this.priceLabel = new G.LabelTextT(G.json.settings["priceOfBooster" + i] + "@currency@", 0, 35, {
            style: "font-white",
            fontSize: "40px"
        }, .5, 85), this.add(this.priceLabel), this.plus = G.makeImage(40, 30, "booster_plus", .5, this), this.amount = new G.Text(40, 33, G.saveState.getBoosterAmount(i).toString(), {
            style: "font-blue",
            fontSize: "25px"
        }, .5, 100), this.add(this.amount), this.hand = G.makeImage(0, 0, "tut_hand", [24 / 90, 11 / 98], this), this.hand.alpha = 0, this.alphaTween = !1, this.refreshBoosterAmount(), G.sb("refreshBoosterAmount").add(function(t) {
            t == this.boosterNr && this.refreshBoosterAmount()
        }, this), G.sb("onBoosterSelect").add(function(t) {
            t == this.boosterNr ? this.select() : this.squeeze()
        }, this), G.sb("onBoosterUsed").add(function(t) {
            t == this.boosterNr ? this.deselect() : this.unsqueeze()
        }, this), G.sb("onBoosterDeselect").add(function(t) {
            t == this.boosterNr ? this.deselect() : this.unsqueeze()
        }, this)
    }, G.UI_BoosterButton.prototype = Object.create(Phaser.Group.prototype), G.UI_BoosterButton.prototype.refreshBoosterAmount = function() {
        0 == G.saveState.getBoosterAmount(this.boosterNr) ? (this.plus.visible = !1, this.amount.visible = !1, this.priceLabel.visible = !0) : (G.changeTexture(this.plus, "booster_ammount"), this.plus.visible = !0, this.amount.visible = !0, this.priceLabel.visible = !1, this.amount.setText(G.saveState.getBoosterAmount(this.boosterNr).toString()))
    }, G.UI_BoosterButton.prototype.update = function() {
        this.angle = this.angleMulti * this.tweenObj.angle, this.y = this.orgY - this.angleMulti * this.boosterActiveOffset, this.x = this.orgX, this.hl.angle2++, this.hl.angle = -this.angle + this.hl.angle2, this.hl.alpha = G.lerp(this.hl.alpha, this.selected || this.tutHighlight ? .5 : 0, .1)
    }, G.UI_BoosterButton.prototype.select = function() {
        G.sb("startOverlay").dispatch([
            ["clearBoard"],
            ["moveToAboveGroup", this, "boosterGroup"]
        ]), this.selected = !0, game.add.tween(this).to({
            angleMulti: 1
        }, 300, Phaser.Easing.Sinusoidal.InOut, !0)
    }, G.UI_BoosterButton.prototype.deselect = function() {
        G.sb("closeOverlay").dispatch(), this.selected = !1, game.add.tween(this).to({
            angleMulti: 0
        }, 300, Phaser.Easing.Sinusoidal.InOut, !0)
    }, G.UI_BoosterButton.prototype.squeeze = function() {
        game.add.tween(this.scale).to({
            x: .8,
            y: .8
        }, 300, Phaser.Easing.Sinusoidal.Out, !0)
    }, G.UI_BoosterButton.prototype.unsqueeze = function() {
        1 != this.scale.x && game.add.tween(this.scale).to({
            x: 1,
            y: 1
        }, 300, Phaser.Easing.Sinusoidal.Out, !0)
    }, G.UI_BoosterButton.prototype.lock = function() {
        this.ignoreChildInput = !0
    }, G.UI_BoosterButton.prototype.unlock = function() {
        this.ignoreChildInput = !1
    }, G.UI_BoosterButton.prototype.hideSuggestion = function() {
        0 != this.hand.alpha && (this.alphaTween && this.alphaTween.stop(), G.stopTweens(this.hand), this.alphaTween = game.add.tween(this.hand).to({
            alpha: 0
        }, 300, Phaser.Easing.Sinusoidal.Out, !0))
    }, G.UI_BoosterButton.prototype.showSuggestion = function() {
        this.openLock || (this.alphaTween && this.alphaTween.stop(), this.alphaTween = game.add.tween(this.hand).to({
            alpha: 1
        }, 300, Phaser.Easing.Sinusoidal.Out, !0), function(t, e) {
            var i = (o = e, r = G.l(640), h = G.l(960), l = new Phaser.Point(.5 * r, .5 * h), l.subtract(o.worldPosition.x, o.worldPosition.y), l.normalize(), l),
                s = Math.atan2(-i.y, i.x),
                a = G.l(50),
                n = a + G.l(80);
            var o, r, h, l;
            t.position.setTo(a * i.x, a * i.y);
            var d = 115 * Math.PI / 180;
            t.rotation = Math.PI + d - s, game.add.tween(t).to({
                x: n * i.x,
                y: n * i.y
            }, 800, Phaser.Easing.Sinusoidal.InOut, !0, 0, -1, !0)
        }(this.hand, this.btn), this.openLock = !0, G.tutorialOpened || game.time.events.add(5e3, function() {
            this.hideSuggestion()
        }, this), game.time.events.add(15e3, function() {
            this.openLock = !1
        }, this))
    }, G.UI_BoosterButton.prototype.showTutorialHighlight = function() {
        this.tutHighlight = !0, this.priceLabel.alpha = 0, game.add.tween(this.pivot).to({
            y: 50
        }, 300, Phaser.Easing.Sinusoidal.Out, !0), this.parent.bringToTop(this)
    }, G.UI_BoosterButton.prototype.hideTutorialHighlight = function() {
        this.tutHighlight = !1, this.priceLabel.alpha = 1, this.amount.alpha = 1, G.stopTweens(this.pivot), game.add.tween(this.pivot).to({
            y: 0
        }, 300, Phaser.Easing.Sinusoidal.Out, !0)
    }, G.UI_BoosterLabel = function() {
        Phaser.Group.call(this, game), this.state = game.state.getCurrentState(), this.ico = G.makeImage(0, 0, null, .5, this), this.txt = new G.Text(0, 0, "", {
            style: "font-white",
            fontSize: "30px"
        }, 0, !1, !1, !0, "center"), this.add(this.txt), this.topBar = this.state.topBar, this.textLookup = {
            1: G.txt("Use the swap booster to change the place of two cookies!") + " ",
            2: G.txt("Use the star wand to crush one cookie!") + " ",
            3: G.txt("Use the horizontal pin to clear the whole row!") + " ",
            4: G.txt("Use the vertical pin to clear the whole column!") + " "
        }, G.sb("onScreenResize").add(this.resize, this), this.resize(), this.pivotYSettings = null, G.sb("onBoosterSelect").add(this.init, this), G.sb("closeOverlay").add(this.hide, this)
    }, G.UI_BoosterLabel.prototype = Object.create(Phaser.Group.prototype), G.UI_BoosterLabel.prototype.init = function(t) {
        G.tutorialOpened || (G.changeTexture(this.ico, "ui_booster_" + t), this.txt.setText(this.textLookup[t.toString()]), this.refreshPivot(), this.alpha = 0, G.stopTweens(this), game.add.tween(this).to({
            alpha: 1
        }, 500, Phaser.Easing.Sinusoidal.Out, !0), this.resize())
    }, G.UI_BoosterLabel.prototype.hide = function() {
        G.stopTweens(this), game.add.tween(this).to({
            alpha: 0
        }, 500, Phaser.Easing.Sinusoidal.Out, !0)
    }, G.UI_BoosterLabel.prototype.refreshPivot = function() {
        null !== this.pivotYSettings && (this.pivot.y = this.pivotYSettings, this.pivotYSettings = null)
    }, G.UI_BoosterLabel.prototype.resize = function() {
        G.horizontal ? (this.x = 0, this.y = G.l(280), this.txt.wordWrapWidth = G.l(200), this.refreshHorizontal()) : (this.x = G.l(330), this.y = G.l(100), this.txt.wordWrapWidth = G.l(400), this.refreshVertical())
    }, G.UI_BoosterLabel.prototype.refreshHorizontal = function() {
        var t = -.5 * (this.ico.height + this.txt.height + G.l(10));
        this.ico.y = t, this.ico.x = 0, this.txt.y = this.ico.y + this.ico.height + G.l(10), this.txt.x = 0, this.txt.anchor.setTo(.5, 0)
    }, G.UI_BoosterLabel.prototype.refreshVertical = function() {
        var t = -.5 * (this.ico.width + this.txt.width + G.l(10));
        this.ico.y = 0, this.ico.x = t, this.txt.x = this.ico.x + this.ico.width + G.l(10), this.txt.y = 0, this.txt.anchor.setTo(0, .5)
    }, G.UI_CoinCounter = function() {
        Phaser.Group.call(this, game), this.x = 100, this.y = 100, this.state = game.state.getCurrentState(), this.text = new G.TextCounter(0, 0, G.saveState.data.coins, {
            style: "font-white",
            fontSize: "40px"
        }, [1, .5], 200), this.add(this.text), this.ico = G.makeImage(0, 0, "currency", [0, .5], this), this.alpha = 0, G.sb("onScreenResize").add(this.resize, this), this.resize(), G.sb("onBoosterSelect").add(this.init, this), G.sb("closeOverlay").add(this.hide, this), G.sb("onCoinsChange").add(this.text.setAmount, this.text)
    }, G.UI_CoinCounter.prototype = Object.create(Phaser.Group.prototype), G.UI_CoinCounter.prototype.resize = function() {
        G.horizontal ? (this.x = 0, this.y = G.l(700)) : (this.x = G.l(330), this.y = this.state.board.y - G.l(60), this.x += Math.floor(.5 * this.text.width))
    }, G.UI_CoinCounter.prototype.init = function(t) {
        G.saveState.getBoosterAmount(t) <= 0 && (this.alpha = 0, G.stopTweens(this), game.add.tween(this).to({
            alpha: 1
        }, 500, Phaser.Easing.Sinusoidal.Out, !0), this.resize())
    }, G.UI_CoinCounter.prototype.hide = function() {
        G.stopTweens(this), game.add.tween(this).to({
            alpha: 0
        }, 500, Phaser.Easing.Sinusoidal.Out, !0)
    }, G.UI_DailyChallengeIcon = function(t, e) {
        this.state = game.state.getCurrentState(), Phaser.Group.call(this, game), this.unlocked = G.saveState.getLastPassedLevelNr() >= G.json.settings.featuresUnlock.dailyChallenge, this.unlocked && G.gameTracking.FTUEDesign("FTUX_DailyChallengeUnlock"), this.x = G.l(t), this.y = G.l(e), this.glow = G.makeImage(0, 0, "popup_lighht", .5, this), this.glow.alpha = .5, this.glow.scale.setTo(.5), this.glow.blendMode = 1, this.glow.update = function() {
            this.angle++
        }, this.icon = new G.Button(0, 0, "btn_daily_challenge", function() {
            this.available && G.sb("pushWindow").dispatch(["dailyChallenge", G.saveState.getDailyChallengeLevel()])
        }, this), this.add(this.icon), this.freeText = new G.Text(0, 65, G.txt("Daily Challenge"), {
            fill: "white",
            font: "Lobster",
            fontSize: "30px",
            stroke: "#c0317d",
            strokeThickness: 5
        }, .5, 140, 150, !0, "center"), this.freeText.inputEnabled = !0, this.freeText.input.useHandCursor = !0, this.freeText.events.onInputDown.add(function() {
            this.available && G.sb("pushWindow").dispatch(["dailyChallenge", G.saveState.getDailyChallengeLevel()])
        }, this), this.freeText.lineSpacing = -20, this.freeText.setShadow(0, 0, "black", 3), this.add(this.freeText), game.add.tween(this.freeText.scale).to({
            x: .9,
            y: .9
        }, 500, Phaser.Easing.Sinusoidal.InOut, !0, 0, -1, !0), this.checkAvailability(), G.sb("onScreenResize").add(this.onResize, this), this.onResize();
        var i = this.state.lastLevelData;
        i && i.challenge && (this.visible = !0, this.glow.visible = !0, this.postFlow = !0, this.icon.inputEnabled = !1, game.time.events.add(1e3, function() {
            game.add.tween(this.scale).to({
                x: 0,
                y: 0
            }, 300, Phaser.Easing.Sinusoidal.Out, !0), this.batchesWaitingForFinish = 0, this.createParticlesBatch(i)
        }, this))
    }, G.UI_DailyChallengeIcon.prototype = Object.create(Phaser.Group.prototype), G.UI_DailyChallengeIcon.prototype.update = function() {
        this.glow.angle++
    }, G.UI_DailyChallengeIcon.prototype.checkAvailability = function() {
        this.postFlow || (this.unlocked && G.saveState.isChallengeAvailable() ? (this.available = !0, this.freeText.visible = this.glow.visible = !0, this.visible = !0) : (this.freeText.visible = this.glow.visible = !1, this.available = !1, this.visible = !1, game.time.events.add(5e3, this.checkAvailability, this)))
    }, G.UI_DailyChallengeIcon.prototype.onResize = function() {
        this.x = game.world.bounds.x + 60, this.y = 300
    }, G.UI_DailyChallengeIcon.prototype.createParticlesBatch = function(t) {
        0 < t.starImprovement && this.afterLvlPartBatch(t.lvlNr, t.starImprovement, "stars"), 0 < t.reward && this.afterLvlPartBatch(t.lvlNr, t.reward, "coins")
    }, G.UI_DailyChallengeIcon.prototype.afterLvlPartBatch = function(t, e, i) {
        var s = "coins" == i,
            a = this.state.uiTargetParticlesBW.createDividedBatch(game.world.bounds.x + this.worldPosition.x, this.worldPosition.y, s ? "coin_1" : "map_star_1", s ? this.state.panel.coinsTxt : this.state.panel.starsTxt, e, s ? 3 : 1);
        a.addOnPartStart(function() {
            s ? this.scale.setTo(.9) : this.scale.setTo(1.2), this.speedDelta = .5, this.speedMax = 20, this.vel.x = game.rnd.realInRange(-20, 20), this.vel.y = game.rnd.realInRange(-20, 20)
        }), a.addOnPartFinish(function() {
            if (G.sfx.pop.play(), s) G.saveState.changeCoins(this.carriedValue, !0);
            else {
                var t = this.state.panel.starsTxt;
                t.setText(parseInt(t.text) + 1)
            }
        }), this.batchesWaitingForFinish++, a.onFinish.add(function() {
            this.batchesWaitingForFinish--, 0 == this.batchesWaitingForFinish && G.saveState.save()
        }, this), a.start()
    }, G.UI_DailyIcon = function(t, e) {
        this.active = G.saveState.getLastPassedLevelNr() >= G.json.settings.featuresUnlock.daily, this.tutorial = this.active && !G.saveState.data.sawDailyTut, this.state = game.state.getCurrentState(), Phaser.Group.call(this, game), this.x = G.l(t), this.y = G.l(e), this.addIcon(), this.active ? (this.addTimerAndFreeText(), G.gameTracking.FTUEDesign("FTUX_SpinWheelUnlock")) : this.addUnlockTxt(), this.notificationBubble = new G.NotificationBubble(30, -30), this.add(this.notificationBubble), this.update(), this.tutorial && (this.tutHand = G.makeImage(0, 20, "tut_hand", 0, this), game.add.tween(this.tutHand).to({
            x: G.l(20),
            y: G.l(50)
        }, 300, Phaser.Easing.Sinusoidal.InOut, !0, 0, -1, !0)), G.sb("onScreenResize").add(this.onResize, this), this.onResize()
    }, G.UI_DailyIcon.prototype = Object.create(Phaser.Group.prototype), G.UI_DailyIcon.prototype.update = function() {
        this.active ? (this.freeText.visible = G.saveState.data.freeSpin, this.icon.adIcon.visible = !G.saveState.data.freeSpin, this.notificationBubble.setImportant(G.saveState.data.freeSpin), game.incentivised ? this.timer.visible = !1 : this.timer.visible = !this.freeText.visible) : (this.notificationBubble.setImportant(!1), this.icon.adIcon.visible = !1)
    }, G.UI_DailyIcon.prototype.onResize = function() {
        this.x = game.world.bounds.x + game.width - 60
    }, G.UI_DailyIcon.prototype.addIcon = function() {
        this.icon = new G.Button(0, 0, "new_wheel_menu", function() {
            this.active && (game.incentivised || G.saveState.data.freeSpin) && (G.sb("pushWindow").dispatch(["daily2", this.tutorial]), this.tutorial && (this.tutHand && this.tutHand.destroy(), G.saveState.data.sawDailyTut = !0, G.saveState.save(), G.sb("onWindowClosed").addOnce(function() {
                var t = game.state.getCurrentState();
                t.lvlTutHand && game.add.tween(t.lvlTutHand).to({
                    alpha: 1
                }, 500, Phaser.Easing.Sinusoidal.Out, !0)
            })))
        }, this), this.icon.adIcon = G.makeImage(20, 20, "video_wheel_menu", .5, this.icon), game.add.tween(this.icon.adIcon.scale).to({
            x: 1.2,
            y: 1.2
        }, 1e3, Phaser.Easing.Sinusoidal.InOut, !0, 0, -1, !0), this.icon.adIcon.angle = -4, game.add.tween(this.icon.adIcon).to({
            angle: 4
        }, 2e3, Phaser.Easing.Sinusoidal.InOut, !0, 0, -1, !0), this.add(this.icon), game.incentivised || (this.icon.adIcon.renderable = !1)
    }, G.UI_DailyIcon.prototype.addGlow = function() {
        this.glow = G.makeImage(0, 0, "popup_lighht", .5, this), this.glow.alpha = .5, this.glow.scale.setTo(.5), this.glow.blendMode = 1, this.glow.update = function() {
            this.angle++
        }, this.sendToBack(this.glow)
    }, G.UI_DailyIcon.prototype.addTimerAndFreeText = function() {
        this.timer = new G.TextTimer(0, 7, null, {
            style: "font-num-blue",
            fontSize: "30px"
        }, .5, 130), this.timer.setSecLeft((G.saveState.data.lastDaily + 864e5 - Date.now()) / 1e3), this.timer.active = !0, this.add(this.timer), G.sb("onDailyFreeSpinGain").add(function() {
            this.timer.setSecLeft((G.saveState.data.lastDaily + 864e5 - Date.now()) / 1e3)
        }, this), this.freeText = new G.Text(0, 0, G.txt("Free spin!"), {
            fill: "white",
            font: "Lobster",
            fontSize: "30px",
            stroke: "black",
            strokeThickness: 1
        }, .5, 150, 150, !0, "center"), this.freeText.lineSpacing = -15, this.freeText.setShadow(0, 0, "black", 3), this.add(this.freeText), game.add.tween(this.freeText.scale).to({
            x: .9,
            y: .9
        }, 500, Phaser.Easing.Sinusoidal.InOut, !0, 0, -1, !0)
    }, G.UI_DailyIcon.prototype.addUnlockTxt = function(t) {
        this.unlockTxt = new G.Text(0, 0, G.txt("Unlock at Level X").replace("X", G.json.settings.featuresUnlock.daily + 1), {
            fill: "white",
            font: "Lobster",
            fontSize: "30px",
            stroke: "black",
            strokeThickness: 1
        }, .5, 150, 150, !0, "center"), this.unlockTxt.lineSpacing = -15, this.unlockTxt.setShadow(0, 0, "black", 3), this.add(this.unlockTxt), game.add.tween(this.unlockTxt.scale).to({
            x: .9,
            y: .9
        }, 500, Phaser.Easing.Sinusoidal.InOut, !0, 0, -1, !0)
    }, G.UI_ExtraMovesBuyButton = function() {
        Phaser.Group.call(this, game), this.targetY = 0, this.state = game.state.getCurrentState(), this.hl = G.makeImage(0, 0, "popup_lighht", .5, this), this.hl.alpha = .2, this.hl.scale.setTo(.6), this.hl.blendMode = 1, this.floating = {
            offset: G.l(-10)
        }, game.add.tween(this.floating).to({
            offset: G.l(10)
        }, 700, Phaser.Easing.Sinusoidal.InOut, !0, 0, -1, !0), this.btn = new G.Button(0, 0, "ui_booster_5", this.btnClick, this), this.btn.sfx = G.sfx.cash_register, this.btn.addTerm(function() {
            return G.lvl.moves < 5
        }), this.add(this.btn), this.labelBg = G.makeImage(0, 45, "move_extra_label", .5, this), G.sb("madeMove").add(function() {
            G.lvl.goalAchieved || 4 == G.lvl.moves && this.show()
        }, this), G.sb("onWindowOpened").add(function() {
            this.hide()
        }, this), G.sb("onWindowClosed").add(function() {
            this.visible || G.saveState.data.coins >= G.lvl.getPriceOfExtraMoves() && G.lvl.moves <= 4 && 0 < G.lvl.moves && this.show()
        }, this), this.scale.setTo(0), this.visible = !1, G.sb("onGoalAchieved").add(this.hide, this)
    }, G.UI_ExtraMovesBuyButton.prototype = Object.create(Phaser.Group.prototype), G.UI_ExtraMovesBuyButton.prototype.update = function() {
        this.y = this.targetY + this.floating.offset, this.hl.angle++
    }, G.UI_ExtraMovesBuyButton.prototype.btnClick = function() {
        if (G.saveState.data.coins >= G.lvl.getPriceOfExtraMoves()) {
            var t = this.worldPosition;
            G.sb("UIfx").dispatch(t.x + game.world.bounds.x, t.y, "whiteStarPart"), G.sb("UIfx").dispatch(t.x + game.world.bounds.x, t.y, "whiteStarPart"), G.sb("UIfx").dispatch(t.x + game.world.bounds.x, t.y, "whiteStarPart"), G.sb("UIfx").dispatch(t.x + game.world.bounds.x, t.y, "whiteStarPart"), G.lvl.buyExtraMoves(), this.hide()
        } else G.IAP ? G.sb("pushWindow").dispatch("coinShop") : this.state.windowLayer.pushWindow(["moreMoney"]), G.sb("onAllWindowsClosed").addOnce(function() {
            G.lvl.moves < 5 && this.show()
        }, this)
    }, G.UI_ExtraMovesBuyButton.prototype.show = function() {
        !game.incentivised && !G.IAP && G.saveState.getCoins() < G.lvl.getPriceOfExtraMoves() || (this.priceTxt && this.priceTxt.destroy(), this.priceTxt = new G.LabelTextT("$+5 moves$ " + G.lvl.getPriceOfExtraMoves() + "@coin_1@", 5, 45, {
            style: "font-white",
            fontSize: "30px"
        }, .5, 180), this.add(this.priceTxt), this.visible = !0, G.stopTweens(this), this.scale.setTo(0), game.add.tween(this.scale).to({
            x: 1,
            y: 1
        }, 2e3, Phaser.Easing.Elastic.Out, !0))
    }, G.UI_ExtraMovesBuyButton.prototype.hide = function() {
        G.stopTweens(this), game.add.tween(this.scale).to({
            x: 0,
            y: 0
        }, 400, Phaser.Easing.Cubic.Out, !0).onComplete.add(function() {
            this.visible = !1
        }, this)
    }, G.UI_Life = function(t, e) {
        Phaser.Group.call(this, game), this.x = G.l(t), this.y = G.l(e), this.glow = G.makeImage(0, 0, "popup_lighht", .5, this), this.glow.blendMode = 1, this.glow.alpha = .2, this.lifeIcon = new G.Button(0, 0, "top-panel-heart", function() {
            G.gameTracking.design("GetLivesButtonClicked"), G.sb("pushWindow").dispatch("notEnoughLives")
        }, this), this.lifeIconUnlimited = G.makeImage(0, 0, "heart_unlimited", .5, this), game.add.tween(this.lifeIconUnlimited.scale).to({
            x: 1.1,
            y: 1.1
        }, 1e3, Phaser.Easing.Sinusoidal.InOut, !0, 0, -1, !0), this.add(this.lifeIcon), this.prevStatus = null, this.currentLivesNr = G.saveState.getCurrentLivesNr(), this.livesMax = G.json.settings.livesMax, this.livesNrTxt = new G.Text(0, 0, this.currentLivesNr.toString(), {
            style: "font-white",
            fontSize: "40px"
        }, .5, 150), this.add(this.livesNrTxt), this.timer = new G.TextTimer(85, 7, 0, {
            style: "font-white",
            fontSize: "35px"
        }, .5, 140, "ms"), this.add(this.timer), this.unlimitedTimer = new G.TextTimer(85, 7, 0, {
            style: "font-white",
            fontSize: "35px",
            stroke: "#a41d02",
            strokeThickness: 5
        }, .5, 140, "hms"), this.add(this.unlimitedTimer), this.timerMax = new G.Text(80, 7, G.txt("Max"), {
            style: "font-white",
            fontSize: "35px"
        }, .5, 100), this.add(this.timerMax), this.timer.start(), G.sb("onWallClockTimeUpdate").add(this.onTickUpdate, this), G.sb("onLifeAdded").add(this.onTickUpdate, this), G.sb("onLifeTimerUpdate").add(this.timer.setSecLeft, this.timer), G.sb("onUnlimitedLivesChanged").add(this.unlimitedTimer.setSecLeft, this.unlimitedTimer), G.sb("onWindowOpened").add(this.lockInput, this), G.sb("onAllWindowsClosed").add(this.unlockInput, this)
    }, G.UI_Life.prototype = Object.create(Phaser.Group.prototype), G.UI_Life.prototype.onTickUpdate = function() {
        var t = G.saveState.getCurrentLivesNr();
        this.currentLivesNr !== t && (this.currentLivesNr = t, this.livesNrTxt.setText(this.currentLivesNr.toString()))
    }, G.UI_Life.prototype.update = function() {
        var t;
        if (this.glow.angle++, (t = 0 < G.saveState.getUnlimitedLivesSec() ? "unlimited" : this.currentLivesNr < this.livesMax ? "normal" : "max") !== this.prevStatus) switch (t) {
            case "max":
                this.showMax();
                break;
            case "normal":
                this.showNormal();
                break;
            case "unlimited":
                this.showUnlimited()
        }
        this.prevStatus = t
    }, G.UI_Life.prototype.showUnlimited = function() {
        this.glow.visible = !0, this.timer.visible = !1, this.lifeIconUnlimited.visible = !0, this.lifeIcon.visible = !1, this.unlimitedTimer.visible = !0, this.unlimitedTimer.start(G.saveState.getUnlimitedLivesSec()), this.timerMax.visible = !1, this.timer.visible = !1, this.livesNrTxt.visible = !1
    }, G.UI_Life.prototype.showMax = function() {
        this.glow.visible = !1, this.timer.visible = !1, this.lifeIconUnlimited.visible = !1, this.unlimitedTimer.visible = !1, this.timerMax.visible = !0, this.timer.visible = !1, this.lifeIcon.visible = !0, this.lifeIcon.inputEnabled = !1, this.livesNrTxt.visible = !0
    }, G.UI_Life.prototype.showNormal = function() {
        this.glow.visible = !1, this.timer.visible = !0, this.lifeIconUnlimited.visible = !1, this.unlimitedTimer.visible = !1, this.timerMax.visible = !1, this.timer.visible = !0, this.lifeIcon.inputEnabled = !0, this.lifeIcon.visible = !0, this.livesNrTxt.visible = !0
    }, G.UI_Life.prototype.lockInput = function() {
        this.ignoreChildInput = !0
    }, G.UI_Life.prototype.unlockInput = function() {
        this.ignoreChildInput = !1
    }, G.UI_PopOutMoney = function() {
        Phaser.Image.call(this, game, 0, 0, null), this.state = game.state.getCurrentState(), this.double = this.state.doubleMoney, G.changeTexture(this, this.double ? "coin_2" : "coin_1"), this.anchor.setTo(.5), this.kill()
    }, G.UI_PopOutMoney.prototype = Object.create(Phaser.Image.prototype), G.UI_PopOutMoney.prototype.init = function(t, e) {
        G.stopTweens(this), this.revive(), G.saveState.changeCoins(this.double ? 2 : 1), G.sb("onLevelMoneyGain").dispatch(this.double ? 2 : 1), G.sfx.cash_register.play(), this.x = t, this.y = e, this.scale.setTo(0), this.angle = -10, game.add.tween(this).to({
            y: this.y - G.l(20 * Math.random() + 30)
        }, 500, Phaser.Easing.Cubic.InOut, !0, 0, 0, !0), game.add.tween(this.scale).to({
            x: 1,
            y: 1
        }, 500, Phaser.Easing.Cubic.InOut, !0, 0, 0, !0).onComplete.add(this.kill, this)
    }, G.UI_ShoutOuts = function() {
        Phaser.Group.call(this, game), this.state = game.state.getCurrentState(), this.board = this.state.board, this.glowImg = G.makeImage(0, 0, "popup_lighht", .5, this), this.glowImg.alpha = .5, this.glowImg.visible = !1, this.shoutOut = G.makeImage(0, 0, null, .5, this), this.shoutOut.visible = !1, this.combo = 0, G.sb("onComboIncrease").add(this.increaseCombo, this), G.sb("onComboBreak").add(this.breakCombo, this), G.sb("onGoalAchieved").add(this.cookieCrush, this), G.sb("madeMove").add(function() {
            G.lvl.goalAchieved || (10 == G.lvl.moves && this.lockedShoutOut("10_moves_left"), 5 == G.lvl.moves && this.lockedShoutOut("5_moves_left"))
        }, this), this.locked = !1, this.board = game.state.getCurrentState().board, this.x = this.board.x + .5 * (this.board.width - 2 * this.board.tilesize), this.y = this.board.y + .45 * (this.board.height - 2 * this.board.tilesize)
    }, G.UI_ShoutOuts.prototype = Object.create(Phaser.Group.prototype), G.UI_ShoutOuts.prototype.update = function() {
        this.x = this.board.x + .5 * (this.board.width - 2 * this.board.tilesize), this.y = this.board.y + .45 * (this.board.height - 2 * this.board.tilesize), this.glowImg.angle++
    }, G.UI_ShoutOuts.prototype.increaseCombo = function(t) {
        if (this.isTextureAvailable() && !this.locked && !G.lvl.goalAchieved) {
            this.combo = t;
            var e = !1;
            3 == this.combo && (e = "good"), 5 == this.combo && (e = "nice"), 7 <= this.combo && (e = "amazing"), 9 <= this.combo && (e = "excellent"), 11 == this.combo && (e = "cookielicious"), e && (G.stopTweens(this.shoutOut), this.shoutOut.visible = !0, this.shoutOut.alpha = 1, this.shoutOut.loadTexture("shoutouts", e), this.shoutOut.scale.setTo(0), game.add.tween(this.shoutOut.scale).to({
                x: 1,
                y: 1
            }, 700, Phaser.Easing.Elastic.Out, !0), game.add.tween(this.shoutOut).to({
                alpha: 0
            }, 300, Phaser.Easing.Sinusoidal.In, !0, 1e3).onComplete.add(function() {
                this.shoutOut.visible = !1
            }, this))
        }
    }, G.UI_ShoutOuts.prototype.lockedShoutOut = function(t) {
        this.isTextureAvailable() && (this.locked = !0, G.stopTweens(this.shoutOut), this.shoutOut.visible = !0, this.shoutOut.alpha = 1, this.shoutOut.loadTexture("shoutouts", t), this.shoutOut.scale.setTo(0), game.add.tween(this.shoutOut.scale).to({
            x: 1,
            y: 1
        }, 700, Phaser.Easing.Elastic.Out, !0), game.add.tween(this.shoutOut).to({
            alpha: 0
        }, 300, Phaser.Easing.Sinusoidal.In, !0, 1500).onComplete.add(function() {
            this.shoutOut.visible = !1, this.locked = !1
        }, this))
    }, G.UI_ShoutOuts.prototype.cookieCrush = function() {
        if (this.isTextureAvailable()) {
            this.glowImg.scale.setTo(0), this.glowImg.visible = !0, game.add.tween(this.glowImg.scale).to({
                x: 1.5,
                y: 1.5
            }, 500, Phaser.Easing.Elastic.Out, !0), game.add.tween(this.glowImg).to({
                alpha: 0
            }, 300, Phaser.Easing.Sinusoidal.Out, !0, 1500), G.stopTweens(this.shoutOut), this.shoutOut.visible = !0, this.shoutOut.alpha = 1, this.shoutOut.loadTexture("shoutouts", "cookie_crush"), this.shoutOut.scale.setTo(0), game.add.tween(this.shoutOut.scale).to({
                x: 1,
                y: 1
            }, 700, Phaser.Easing.Elastic.Out, !0), game.add.tween(this.shoutOut).to({
                alpha: 0
            }, 300, Phaser.Easing.Sinusoidal.In, !0, 1500).onComplete.add(function() {
                this.shoutOut.visible = !1
            }, this);
            for (var t = 0; t < 10; t++) G.sb("UIfx").dispatch(this.x - 100 + 20 * t, this.y, "whiteStarPart")
        }
    }, G.UI_ShoutOuts.prototype.breakCombo = function() {
        this.combo = 0
    }, G.UI_ShoutOuts.prototype.isTextureAvailable = function() {
        return null !== game.cache.getFrame("shoutouts")
    }, G.UI_StartBoosterButton = function(t, e, i, s) {
        Phaser.Group.call(this, game), this.state = game.state.getCurrentState(), this.unlocked = G.saveState.isBoosterUnlocked(i), this.x = G.l(t), this.y = G.l(e), this.nr = i, this.lvlNr = s, this.unlocked ? (this.initUnlocked(i, s), G.saveState.data.startBoosterAnim[i - 5] && (G.saveState.data.startBoosterAnim[i - 5] = !1, G.saveState.save(), this.initUlockAnimation())) : this.img = G.makeImage(0, 0, "ui_booster_" + i + "_locked", .5, this)
    }, G.UI_StartBoosterButton.prototype = Object.create(Phaser.Group.prototype), G.UI_StartBoosterButton.prototype.update = function() {
        this.hl && (this.hl.angle++, this.hl.alpha = game.math.clamp(this.hl.alpha + (this.selected ? .05 : -.05), 0, .6), this.priceTxt.alpha = game.math.clamp(this.priceTxt.alpha + (0 != this.amount || this.selected ? -.05 : .05), 0, 1));
        for (var t = this.children.length; t--;) this.children[t].update()
    }, G.UI_StartBoosterButton.prototype.select = function() {
        this.startBoosterConfig.select(this.levelNr, this.boosterNr), this.selected = !0, this.amount--, this.amountTxt.setText(this.amount.toString())
    }, G.UI_StartBoosterButton.prototype.deselect = function() {
        this.startBoosterConfig.deselect(this.levelNr, this.boosterNr), this.selected = !1, this.amount++, this.amountTxt.setText(this.amount.toString())
    }, G.UI_StartBoosterButton.prototype.initUnlocked = function(t, e) {
        this.startBoosterConfig = game.state.getCurrentState().startBoosterConfig, this.boosterNr = t, this.levelNr = e, this.hl = G.makeImage(0, 0, "popup_lighht", .5, this), this.hl.scale.setTo(.6), this.hl.blendMode = 1, this.hl.angle = 360 * Math.random(), this.hl.alpha = 0, this.btn = new G.Button(0, 0, "ui_booster_" + t, function() {
            this.selected ? this.deselect() : 0 < this.amount ? (this.select(), G.sb("onStartBoosterSelectBounce").dispatch()) : G.saveState.isEnoughToBuyBooster(this.boosterNr) ? (G.saveState.buyBooster(this.boosterNr), G.gameTracking.source(G.saveState.nrToBoosterName(this.boosterNr), "Gameplay", "Level" + G.pad(G.lvlNr + 1, 4), 1), this.amount++, this.amountTxt.setText(this.amount.toString()), G.sb("onStartBoosterSelectBounce").dispatch()) : G.IAP ? ("World" === game.state.current ? G.sb("pushWindow").dispatch(["coinShop", {
                coinTargetObject: this.state.panel.coinsTxt
            }]) : G.sb("pushWindow").dispatch("coinShop"), G.sb("pushWindow").dispatch("level"), this.parent.closeWindow()) : game.incentivised ? (this.parent.state.windowLayer.pushWindow(["moreMoney", "level"]), this.parent.closeWindow()) : (this.alpha = .5, this.btn.inputEnabled = !1)
        }, this), this.add(this.btn), this.selected = !1, this.amountBg = G.makeImage(-40, -40, "booster_ammount", .5, this), this.amount = G.saveState.getBoosterAmount(t), this.amountTxt = new G.Text(-40, -37, this.amount.toString(), {
            style: "font-blue",
            fontSize: "25px"
        }, .5, 100), this.add(this.amountTxt), this.priceTxt = new G.LabelTextT(G.json.settings["priceOfBooster" + this.boosterNr] + "@coin_1@", 10, 40, {
            style: "font-num-blue",
            fontSize: 30,
            scaleStroke: !0
        }, .5, 100), this.add(this.priceTxt), 0 < this.amount && (this.priceTxt.alpha = 0), this.startBoosterConfig.isSelected(this.levelNr, this.boosterNr) && this.select(), 0 == this.amount && !game.incentivised && !G.IAP && G.saveState.getCoins() < G.json.settings["priceOfBooster" + this.boosterNr] && (this.alpha = .5, this.btn.inputEnabled = !1)
    }, G.UI_StartBoosterButton.prototype.initUlockAnimation = function() {
        this.ignoreChildInput = !0, this.amountTxt.alpha = 0, this.amountBg.alpha = 0;
        var t = G.makeImage(0, 0, "circle", .5, this),
            e = t.width,
            i = t.height;
        t.scale.setTo(0), t.blendMode = 1, game.add.tween(t).to({
            width: 2 * e,
            height: 2 * i,
            alpha: 0
        }, 600, Phaser.Easing.Cubic.Out, !0, 500), game.time.events.add(500, function() {
            G.sfx.match_1.play();
            for (var t = 0; t < 5; t++) {
                var e = G.makeImage(0, 0, "starPart", .5, this);
                e.angle = 360 * Math.random(), e.velX = Math.random(20) * G.lnf(-20) + G.lnf(10), e.velY = Math.random() * G.lnf(-9) - G.lnf(3), e.gravity = G.lnf(.5), e.update = function() {
                    this.x += this.velX * G.deltaTime, this.y += this.velY * G.deltaTime, this.angle += .1 * this.velX, this.velX *= .99, this.velY += this.gravity * G.deltaTime, this.alpha -= .02, this.alpha <= 0 && this.kill()
                }
            }
            game.add.tween(this.amountTxt).to({
                alpha: 1
            }, 300, Phaser.Easing.Sinusoidal.Out, !0), game.add.tween(this.amountBg).to({
                alpha: 1
            }, 300, Phaser.Easing.Sinusoidal.Out, !0), this.ignoreChildInput = !1
        }, this), this.lock = G.makeImage(0, 0, "ui_booster_" + this.nr + "_locked", .5, this), game.add.tween(this.lock).to({
            alpha: 0
        }, 500, Phaser.Easing.Sinusoidal.InOut, !0, 500)
    }, G.WaitingIcon = function(t, e, i) {
        Phaser.Image.call(this, game, t, e), G.changeTexture(this, i || "waiting_icon"), this.anchor.setTo(.5, .5), this.frameCounter = 0
    }, G.WaitingIcon.prototype = Object.create(Phaser.Image.prototype), G.WaitingIcon.prototype.update = function() {
        this.frameCounter++ % 5 == 0 && (this.angle += 45)
    }, G.WorldLifeBtn = function() {
        Phaser.Group.call(this, game), this.state = game.state.getCurrentState(), this.btn = new G.Button(0, 0, "Send_lives_button", this.onClick, this), this.add(this.btn), this.text = new G.Text(22, 0, G.txt("Send Lives"), {
            fill: "white",
            font: "Lobster",
            fontSize: "30px"
        }, .5, 140), this.btn.addChild(this.text), G.sb("onScreenResize").add(this.onResize, this), this.onResize(), G.saveState.data.lives <= 0 && (G.changeTexture(this.btn, "Request_lives_button"), this.text.setText(G.txt("Request Lives")), G.sb("onLifeAdded").addOnce(function() {
            G.changeTexture(this.btn, "Send_lives_button"), this.text.setText(G.txt("Send Lives"))
        }, this))
    }, G.WorldLifeBtn.prototype = Object.create(Phaser.Group.prototype), G.WorldLifeBtn.prototype.update = function() {
        0 === this.state.windowLayer.length ? this.alpha = Math.min(1, this.alpha + .05) : this.alpha = Math.max(0, this.alpha - .1), this.visible = 0 < this.alpha
    }, G.WorldLifeBtn.prototype.onResize = function() {
        var t = game.world.bounds.x + Math.floor(.5 * game.width);
        this.x = t + 210, this.y = game.height - 190
    }, G.WorldLifeBtn.prototype.onClick = function() {
        0 < G.saveState.data.lives ? (G.gameTracking.design("SendLifeButtonClickedBottom"), G.sb("pushWindow").dispatch("sendLives")) : (G.gameTracking.design("RequestLifeButtonClickedBottom"), G.sb("pushWindow").dispatch("requestLives"))
    }, G.WorldLifeRequestBtn = function() {
        Phaser.Group.call(this, game), this.btn = new G.Button(0, 0, "Request_lives_button", this.onClick, this), this.add(this.btn), this.text = new G.Text(22, 0, G.txt("Request life!"), {
            fill: "white",
            font: "Lobster",
            fontSize: "30px"
        }, .5, 140), this.btn.addChild(this.text), G.sb("onScreenResize").add(this.onResize, this), this.onResize()
    }, G.WorldLifeRequestBtn.prototype = Object.create(Phaser.Group.prototype), G.WorldLifeRequestBtn.prototype.onResize = function() {
        var t = game.world.bounds.x + Math.floor(.5 * game.width);
        this.x = t, this.y = game.height - 240
    }, G.WorldLifeRequestBtn.prototype.onClick = function() {
        G.sb("pushWindow").dispatch("requestLives")
    }, G.WorldMapBubbleGiftDynamicLayer = function(t) {
        Phaser.Group.call(this, game), this.position = t.position, this.map = t, this.freeInstances = [], this.activeBubbleGiftsData = G.Utils.clone(G.json.settings.bubbleGifts).filter(function(t) {
            return !G.saveState.isBubbleGiftUsed(t.levelNumber)
        }), G.sb("onWindowOpened").add(this.lockInput, this), G.sb("onWindowClosed").add(this.unlockInput, this)
    }, G.WorldMapBubbleGiftDynamicLayer.prototype = Object.create(Phaser.Group.prototype), G.WorldMapBubbleGiftDynamicLayer.prototype.unlockInput = function() {
        this.ignoreChildInput = !1, this.children.forEach(function(t) {
            t.ignoreChildInput = !1
        })
    }, G.WorldMapBubbleGiftDynamicLayer.prototype.lockInput = function() {
        this.ignoreChildInput = !0, this.children.forEach(function(t) {
            t.ignoreChildInput = !0
        })
    }, G.WorldMapBubbleGiftDynamicLayer.prototype.update = function() {
        for (var t = 0, e = this.activeBubbleGiftsData.length; t < e; t++) {
            var i = this.activeBubbleGiftsData[t];
            if (G.json.levels[i.levelNumber - 1]) {
                var s = this.y + G.json.levels[i.levelNumber - 1].mapY; - 500 < s && s < game.height + 500 ? i.instance || G.saveState.isBubbleGiftUsed(i.levelNumber) || this.placeInstance(i) : i.instance && this.hideInstance(i)
            }
        }
    }, G.WorldMapBubbleGiftDynamicLayer.prototype.placeInstance = function(t) {
        t.instance = this.getFreeInstance(), t.instance.init(t), this.add(t.instance)
    }, G.WorldMapBubbleGiftDynamicLayer.prototype.hideInstance = function(t) {
        t.instance.hide(), t.instance.parent.removeChild(t.instance), this.freeInstances.push(t.instance), t.instance = null
    }, G.WorldMapBubbleGiftDynamicLayer.prototype.getFreeInstance = function() {
        return this.freeInstances.shift() || new G.WorldMapBubbleGiftDynamicLayer.BubbleGift
    }, G.WorldMapBubbleGiftDynamicLayer.BubbleGift = function() {
        Phaser.Group.call(this, game), this.state = game.state.getCurrentState(), this.iconImg = G.makeImage(0, 0, null, .5, this), this.bubbleImg = G.makeImage(0, 0, null, .5, this), this.bubbleImg2 = G.makeImage(0, 0, null, .5, this), this.bubbleImg2.blendMode = 1, this.bubbleImg2.scale = this.bubbleImg.scale, this.bubbleImg2.alpha = .3, game.add.tween(this.bubbleImg2).to({
            alpha: 0
        }, 500, Phaser.Easing.Sinusoidal.InOut, !0, 0, -1, !0), game.add.tween(this.pivot).to({
            y: 20
        }, 2600, Phaser.Easing.Sinusoidal.InOut, !0, 0, -1, !0)
    }, G.WorldMapBubbleGiftDynamicLayer.BubbleGift.prototype = Object.create(Phaser.Group.prototype), G.WorldMapBubbleGiftDynamicLayer.BubbleGift.prototype.init = function(t) {
        this.config = t, this.levelNumber = this.config.levelNumber, this.lvlData = G.json.levels[t.levelNumber - 1], this.position.setTo(this.lvlData.mapX, this.lvlData.mapY), this.config.offset ? (this.position.x += this.config.offset.x, this.position.y += this.config.offset.y) : this.position.y -= 120;
        var e = G.gift.getIcon(this.config.gift);
        G.changeTexture(this.iconImg, "coin_1" === e ? "coin_3" : e), this.iconImg.scale.setTo("coin_3" === e ? .9 : 1), this.bubbleImg.scale.setTo(1), this.unlocked = this.config.levelNumber - 1 <= G.saveState.getLastPassedLevelNr(), G.changeTexture(this.bubbleImg, this.unlocked ? "giftBubble_active" : "giftBubble"), G.changeTexture(this.bubbleImg2, this.unlocked ? "giftBubble_active" : "giftBubble"), this.unlocked ? (this.bubbleImg.inputEnabled = !0, this.bubbleImg.input.useHandCursor = !0, this.bubbleImg.events.onInputDown.addOnce(this.open, this), this.bubbleImg2.visible = !0, this.alpha = 1) : (this.bubbleImg.inputEnabled = !1, this.bubbleImg2.visible = !1, this.alpha = .75)
    }, G.WorldMapBubbleGiftDynamicLayer.BubbleGift.prototype.hide = function() {
        G.stopTweens(this), G.stopTweens(this.bubbleImg), G.stopTweens(this.iconImg), this.bubbleImg.events.onInputDown.removeAll(), this.rewardLabel && (this.rewardLabel.destroy(), this.rewardLabel = null)
    }, G.WorldMapBubbleGiftDynamicLayer.BubbleGift.prototype.open = function() {
        G.gameTracking.design("BubbleGiftOpened", this.config.levelNumber), G.saveState.markBubbleGiftAsUsed(this.config.levelNumber), G.gift.applyGift(this.config.gift), G.sb("onBubbleGiftOpened").dispatch(this.config.levelNumber), G.sfx.pop.play(), game.time.events.add(300, G.sfx.line.play, G.sfx.line), this.bubbleImg.inputEnabled = !1;
        var t = G.gift.getLabelString(this.config.gift, 1.2);
        game.add.tween(this.bubbleImg.scale).to({
            x: 0,
            y: 0
        }, 300, Phaser.Easing.Cubic.In, !0), game.add.tween(this.iconImg.scale).to({
            x: 0,
            y: 0
        }, 300, Phaser.Easing.Cubic.In, !0), this.rewardLabel = this.add(new G.LabelTextT(t, 0, 0, {
            style: "font-white",
            fontSize: "50px"
        }, .5, 300)), this.rewardLabel.scale.setTo(0), game.add.tween(this.rewardLabel.scale).to({
            x: 1,
            y: 1
        }, 400, Phaser.Easing.Elastic.Out, !0, 300), game.add.tween(this).to({
            alpha: 0
        }, 400, Phaser.Easing.Sinusoidal.Out, !0, 1200)
    }, G.WorldMapChestDynamicLayer = function(t) {
        Phaser.Group.call(this, game), this.position = t.position, this.map = t, this.freeInstances = [], this.activeChestsData = G.Utils.clone(G.json.settings.mapChests).filter(function(t) {
            return !G.saveState.data.mapChests[t.id]
        }), G.sb("onWindowOpened").add(this.lockInput, this), G.sb("onWindowClosed").add(this.unlockInput, this)
    }, G.WorldMapChestDynamicLayer.prototype = Object.create(Phaser.Group.prototype), G.WorldMapChestDynamicLayer.prototype.unlockInput = function() {
        this.ignoreChildInput = !1, this.children.forEach(function(t) {
            t.ignoreChildInput = !1
        })
    }, G.WorldMapChestDynamicLayer.prototype.lockInput = function() {
        this.ignoreChildInput = !0, this.children.forEach(function(t) {
            t.ignoreChildInput = !0
        })
    }, G.WorldMapChestDynamicLayer.prototype.update = function() {
        for (var t = 0, e = this.activeChestsData.length; t < e; t++) {
            var i = this.activeChestsData[t],
                s = this.y + i.mapY; - 500 < s && s < game.height + 500 ? (0, i.instance || i.opened || G.saveState.data.mapChests[i.id] || this.placeInstance(i)) : i.instance && this.hideInstance(i)
        }
        for (var a = this.children.length; a--;) this.children[a].update()
    };
    G.WorldMapChestDynamicLayer.prototype.placeInstance = function(t) {
        t.instance = this.getFreeInstance(), t.instance.init(t), this.add(t.instance)
    }, G.WorldMapChestDynamicLayer.prototype.hideInstance = function(t) {
        t.instance.hide(), t.instance.parent.removeChild(t.instance), this.freeInstances.push(t.instance), t.instance = null
    }, G.WorldMapChestDynamicLayer.prototype.getFreeInstance = function() {
        return this.freeInstances.shift() || new G.WorldMapChestDynamicLayer.ChestInstance
    }, G.WorldMapChestDynamicLayer.ChestInstance = function() {
        Phaser.Group.call(this, game), this.state = game.state.getCurrentState(), this.shadow = G.makeImage(0, 40, "chest_shadow", .5, this), this.chest = new G.Button(0, 0, "chest", this.onClick, this), this.chest.IMMEDIATE = !0, this.chestGlow = G.makeImage(0, 0, "chest", .5, this.chest), this.chestGlow.blendMode = 1, this.chestGlow.alpha = .4, game.add.tween(this.chestGlow).to({
            alpha: 0
        }, 500, Phaser.Easing.Sinusoidal.InOut, !0, 0, -1, !0), this.add(this.chest), game.time.events.loop(2e3, this.setJumpRepeat, this)
    }, G.WorldMapChestDynamicLayer.ChestInstance.prototype = Object.create(Phaser.Group.prototype), G.WorldMapChestDynamicLayer.ChestInstance.prototype.init = function(t) {
        G.changeTexture(this.chest, "chest"), G.changeTexture(this.chestGlow, "chest"), this.chestData = t, this.position.setTo(t.mapX, t.mapY), this.orgX = this.x, this.orgY = this.y, this.chest.inputEnabled = !0, this.chest.input.useHandCursor = !0, this.chest.scale.x = this.x < 0 ? -1 : 1, this.shadow.scale.x = this.chest.scale.x, this.alpha = 1, this.opened = !1, this.currentStars = G.saveState.getAllStars(), this.unlocked = this.currentStars >= t.req, this.unlocked ? (this.chestGlow.visible = !0, this.setJumpRepeat()) : (this.chestGlow.visible = !1, this.label = new G.LabelTextT(Math.min(this.currentStars, t.req) + "/" + this.chestData.req + "@map_star_1@", 0, 50, {
            style: "font-white",
            fontSize: "40px"
        }, .5, 150), this.add(this.label))
    }, G.WorldMapChestDynamicLayer.ChestInstance.prototype.update = function() {
        this.shadow.alpha = 1 + this.chest.y / 150
    }, G.WorldMapChestDynamicLayer.ChestInstance.prototype.hide = function() {
        G.stopTweens(this.chest), this.chest.position.setTo(0, 0), this.chest.angle = 0, this.label && this.label.destroy()
    }, G.WorldMapChestDynamicLayer.ChestInstance.prototype.onClick = function() {
        this.unlocked ? (G.changeTexture(this.chest, "chest_open"), G.changeTexture(this.chestGlow, "chest_open"), this.opened = !0, this.chestData.opened = !0, G.saveState.data.mapChests[this.chestData.id] = !0, G.saveState.save(), this.chest.inputEnabled = !1, G.sb("onMapChestOpened").dispatch(), G.sb("pushWindow").dispatch(["mapChest", this.chestData.gifts]), game.add.tween(this).to({
            alpha: 0
        }, 500, Phaser.Easing.Sinusoidal.InOut, !0, 1e3).onComplete.add(function() {
            this.hide()
        }, this)) : (this.chest.inputEnabled = !1, this.jump(function() {
            this.chest.inputEnabled = !0, this.chest.input.useHandCursor = !0
        }, this))
    }, G.WorldMapChestDynamicLayer.ChestInstance.prototype.setJumpRepeat = function(t, e) {
        this.opened || this.unlocked && this.parent && this.jump()
    }, G.WorldMapChestDynamicLayer.ChestInstance.prototype.jump = function(t, e) {
        var i = game.add.tween(this.chest).to({
                y: -G.l(150)
            }, 300, Phaser.Easing.Cubic.Out),
            s = game.add.tween(this.chest).to({
                y: 0
            }, 300, Phaser.Easing.Circular.In);
        i.chain(s), i.start();
        var a = game.add.tween(this.chest).to({
                angle: -15
            }, 200, Phaser.Easing.Cubic.InOut),
            n = game.add.tween(this.chest).to({
                angle: 15
            }, 375, Phaser.Easing.Sinusoidal.In),
            o = game.add.tween(this.chest).to({
                angle: 0
            }, 50, Phaser.Easing.Cubic.InOut);
        a.chain(n, o), a.start(), t && o.onComplete.add(t, e)
    }, G.WorldMapCloudDynamicLayer = function(t) {
        Phaser.Group.call(this, game), this.position = t.position, this.map = t, this.freeInstances = [], this.activeGatesData = G.Utils.clone(G.json.settings.gates).filter(function(t) {
            if (G.saveState.checkGate(t), G.json.levels[t.lvlNr - 1]) return t.savedGateData = G.saveState.getGateData(t.id), !t.savedGateData.open
        })
    }, G.WorldMapCloudDynamicLayer.prototype = Object.create(Phaser.Group.prototype), G.WorldMapCloudDynamicLayer.prototype.update = function() {
        for (var t = this.children.length; t--;) this.children[t].update();
        for (var e = 0, i = this.activeGatesData.length; e < i; e++) {
            var s = this.activeGatesData[e],
                a = this.y + G.json.levels[s.lvlNr - 1].mapY; - 500 < a && a < game.height + 500 ? s.instance || s.savedGateData.open || this.placeInstance(s) : s.instance && this.hideInstance(s)
        }
    }, G.WorldMapCloudDynamicLayer.prototype.placeInstance = function(t) {
        t.instance = this.getFreeInstance(), t.instance.init(t), this.add(t.instance)
    }, G.WorldMapCloudDynamicLayer.prototype.hideInstance = function(t) {
        t.instance.hide(), t.instance.parent.removeChild(t.instance), this.freeInstances.push(t.instance), t.instance = null
    }, G.WorldMapCloudDynamicLayer.prototype.getFreeInstance = function() {
        return this.freeInstances.shift() || new G.WorldMapCloudDynamicLayer.CloudInstance
    }, G.WorldMapCloudDynamicLayer.CloudInstance = function() {
        Phaser.Group.call(this, game), this.state = game.state.getCurrentState(), this.cloud1 = G.makeImage(-450, 0, "cloud_1", .5, this), this.cloud1.scale.setTo(2), this.c1tween = game.add.tween(this.cloud1.scale).to({
            x: 2.1,
            y: 2.1
        }, 4e3, Phaser.Easing.Sinusoidal.InOut, !0, 0, -1, !0), this.c1tween.timeline[0].dt = 2e3, this.cloud1.alpha = .95, this.cloud2 = G.makeImage(0, 50, "cloud_1", .5, this), this.cloud2.scale.setTo(2), this.c2tween = game.add.tween(this.cloud2.scale).to({
            x: 2.1,
            y: 2.1
        }, 8e3, Phaser.Easing.Sinusoidal.InOut, !0, 0, -1, !0), this.c2tween.timeline[0].dt = 3e3, this.cloud2.alpha = .95, this.cloud3 = G.makeImage(450, 0, "cloud_1", .5, this), this.cloud3.scale.setTo(-2, 2), this.c3tween = game.add.tween(this.cloud3.scale).to({
            x: -2.1,
            y: 2.1
        }, 6e3, Phaser.Easing.Sinusoidal.InOut, !0, 0, -1, !0), this.c3tween.timeline[0].dt = 1500, this.cloud3.alpha = .95
    }, G.WorldMapCloudDynamicLayer.CloudInstance.prototype = Object.create(Phaser.Group.prototype), G.WorldMapCloudDynamicLayer.CloudInstance.prototype.init = function(t) {
        this.savedGateData = t.savedGateData, this.y = G.json.levels[t.lvlNr - 1].mapY - 370, this.fading = !1, this.cloud1.x = -450, this.cloud1.y = 50, this.cloud2.x = 0, this.cloud2.y = 50, this.cloud2.alpha = .95, this.cloud3.x = 450, this.alpha = 1
    }, G.WorldMapCloudDynamicLayer.CloudInstance.prototype.hide = function() {
        this.fadingTweens && (this.fadingTweens.forEach(function(t) {
            t.stop()
        }), this.fadingTweens = null)
    }, G.WorldMapCloudDynamicLayer.CloudInstance.prototype.fadeAway = function() {
        if (!this.fading) {
            this.fading = !0;
            var t = game.add.tween(this.cloud1).to({
                    x: -900,
                    y: 50
                }, 3e3, Phaser.Easing.Sinusoidal.Out, !0),
                e = game.add.tween(this.cloud3).to({
                    x: 900,
                    y: 50
                }, 3e3, Phaser.Easing.Sinusoidal.Out, !0),
                i = game.add.tween(this.cloud2).to({
                    alpha: 0
                }, 3e3, Phaser.Easing.Sinusoidal.Out, !0),
                s = game.add.tween(this).to({
                    alpha: 0
                }, 2e3, Phaser.Easing.Sinusoidal.In, !0, 1e3);
            this.fadingTweens = [t, e, i, s]
        }
    }, G.WorldMapCloudDynamicLayer.CloudInstance.prototype.update = function() {
        !this.fading && this.savedGateData.open && this.fadeAway()
    }, G.WorldMapGateLayer = function(t) {
        Phaser.Group.call(this, game), this.position = t.position, this.init(), this.minGateY = null, this.onGateOpen = new Phaser.Signal, G.sb("onWindowOpened").add(this.lockInput, this), G.sb("onWindowClosed").add(this.unlockInput, this)
    }, G.WorldMapGateLayer.prototype = Object.create(Phaser.Group.prototype), G.WorldMapGateLayer.prototype.getMinY = function() {
        if (0 == this.children.length) return 1 / 0;
        for (var t = -1 / 0, e = 0; e < this.length; e++) this.children[e].y > t && (t = this.children[e].y);
        return -1 * t
    }, G.WorldMapGateLayer.prototype.unlockInput = function() {
        this.ignoreChildInput = !1, this.children.forEach(function(t) {
            t.ignoreChildInput = !1
        })
    }, G.WorldMapGateLayer.prototype.lockInput = function() {
        this.ignoreChildInput = !0, this.children.forEach(function(t) {
            t.ignoreChildInput = !0
        })
    }, G.WorldMapGateLayer.prototype.init = function() {
        G.json.settings.gates.forEach(function(t) {
            if ((G.saveState.checkGate(t), G.json.levels[t.lvlNr - 1]) && !G.saveState.getGateData(t.id).open) {
                var e = new G.WorldMapGateLayer.Gate(t);
                this.add(e), e.onOpen.add(function(t) {
                    this.onGateOpen.dispatch(t)
                }, this)
            }
        }, this)
    }, G.WorldMapGateLayer.Gate = function(t) {
        var e = G.saveState;
        Phaser.Group.call(this, game), this.state = game.state.getCurrentState(), this.onOpen = new Phaser.Signal, this.gate = t, this.lvlIndex = this.gate.lvlNr - 1, this.savedData = e.getGateData(t.id);
        var i = G.json.levels[this.lvlIndex];
        this.x = G.l(i.mapX), this.y = G.l(i.mapY), this.gateImg = G.makeImage(0, 20, "gate", [.5, 1], this), this.active = this.lvlIndex <= e.getLastPassedLevelNr(), this.active && (e.activateGate(t), this.unlockBtn = new G.Button(10, 30, "btn_chest_gate", function() {
            this.savedData.readyToOpen ? (console.log("opening readyToOpen"), this.onOpen.dispatch(this.gate.id)) : G.sb("pushWindow").dispatch(["gateNew", {
                gateData: this.gate,
                onOpenCallback: function(t) {
                    this.unlock(), this.onOpen.dispatch(this.gate.id)
                }.bind(this)
            }])
        }, this), this.unlockBtn.addTextLabel("font-white", G.txt("Unlock")), this.unlockBtn.label.x += G.l(5), this.add(this.unlockBtn), this.savedData.readyToOpen ? (this.unlockBtn.x = 0, this.unlockBtn.pulse()) : this.lockImg = G.makeImage(-65, 15, "lock", .5, this), G.Utils.cleanUpOnDestroy(this, e.signals.onGateOpened.add(this.unlock, this))), this.bursedParts = !1
    }, G.WorldMapGateLayer.Gate.prototype = Object.create(Phaser.Group.prototype), G.WorldMapGateLayer.Gate.prototype.update = function() {
        this.visible = -1e3 < this.state.map.y + this.y
    }, G.WorldMapGateLayer.Gate.prototype.unlock = function() {
        for (var t = 0; t < 10; t++) G.sb("fxMap").dispatch("star", {
            x: this.worldPosition.x,
            y: this.worldPosition.y
        });
        game.add.tween(this).to({
            alpha: 0
        }, 300, Phaser.Easing.Sinusoidal.Out, !0).onComplete.add(function() {
            this.destroy()
        }, this)
    }, G.WorldMapLastLevel = function(t, e, i) {
        Phaser.Group.call(this, game), this.y = i, this.map = t, this.addClouds(), this.addGate(e, 0), this.addMessage(0, -250)
    }, G.WorldMapLastLevel.prototype = Object.create(Phaser.Group.prototype), G.WorldMapLastLevel.prototype.update = function() {
        this.visible = -20 < this.map.y + this.y
    }, G.WorldMapLastLevel.prototype._checkUpdate = function() {
        console.log(this.map.y + this.y), console.log(-20 < this.map.y + this.y)
    }, G.WorldMapLastLevel.prototype.addClouds = function() {
        this.cloud1 = G.makeImage(-450, -360, "cloud_1", .5, this), this.cloud1.scale.setTo(2), this.c1tween = game.add.tween(this.cloud1.scale).to({
            x: 2.1,
            y: 2.1
        }, 4e3, Phaser.Easing.Sinusoidal.InOut, !0, 0, -1, !0), this.c1tween.timeline[0].dt = 2e3, this.cloud1.alpha = .95, this.cloud2 = G.makeImage(0, -410, "cloud_1", .5, this), this.cloud2.scale.setTo(2), this.c2tween = game.add.tween(this.cloud2.scale).to({
            x: 2.1,
            y: 2.1
        }, 8e3, Phaser.Easing.Sinusoidal.InOut, !0, 0, -1, !0), this.c2tween.timeline[0].dt = 3e3, this.cloud2.alpha = .95, this.cloud3 = G.makeImage(450, -360, "cloud_1", .5, this), this.cloud3.scale.setTo(-2, 2), this.c3tween = game.add.tween(this.cloud3.scale).to({
            x: -2.1,
            y: 2.1
        }, 6e3, Phaser.Easing.Sinusoidal.InOut, !0, 0, -1, !0), this.c3tween.timeline[0].dt = 1500, this.cloud3.alpha = .95
    }, G.WorldMapLastLevel.prototype.addGate = function(t, e) {
        this.gate = G.makeImage(t, e, "gate", [.5, 1], this), this.gateLock = G.makeImage(0, -15, "lock", .5, this.gate)
    }, G.WorldMapLastLevel.prototype.addMessage = function(t, e) {
        this.msg = G.makeImage(t, e, "MysteryGift_header", .5, this), this.msgTxt = this.msg.addChild(new G.Text(0, 0, G.txt("More levels coming soon..."), {
            style: "font-blue",
            fontSize: 40
        }, .5, 400)), game.add.tween(this.msg).to({
            y: e + 10
        }, 1500, Phaser.Easing.Sinusoidal.InOut, !0, 0, -1, !0)
    }, G.WorldMapPlayerAvatar = function(t) {
        Phaser.Group.call(this, game), this.state = game.state.getCurrentState(), this.onAnimFinished = new Phaser.Signal, this.avatar = G.makeExtImage(0, 0, sgSettings.config.user.avatar, "avatar_m", 0, this, !1, function() {
            this.width = this.height = 80
        }), this.avatar.anchor.setTo(.5), this.avatar.width = this.avatar.height = 80, this.pivotTween = game.add.tween(this.pivot).to({
            x: 10
        }, 500, Phaser.Easing.Sinusoidal.InOut, !0, 0, -1, !0), this.add(this.avatar), this.frame = G.makeImage(0, 0, "avatar_frame_big", [.5, .52], this), this.frame.position = this.avatar.position, this.worldMap = t, this.position = t.position, this.state.lastLevelData ? this.animPosToLevel(this.state.lastLevelData.lvlNr, G.saveState.getLastPassedLevelNr()) : this.setPosToLevel(G.saveState.getLastPassedLevelNr())
    }, G.WorldMapPlayerAvatar.prototype = Object.create(Phaser.Group.prototype), G.WorldMapPlayerAvatar.prototype.setPosToLevel = function(t) {
        t = game.math.clamp(t, 0, G.json.levels.length - 1);
        var e = G.json.levels[t];
        this.avatar.x = e.mapX - 90, this.avatar.y = e.mapY - 10, this.onAnimFinished.dispatch()
    }, G.WorldMapPlayerAvatar.prototype.animPosToLevel = function(t, e) {
        t = game.math.clamp(t, 0, G.json.levels.length - 1), e = game.math.clamp(e, 0, G.json.levels.length - 1);
        var i = G.json.levels[t],
            s = G.json.levels[e];
        this.avatar.x = i.mapX - 90, this.avatar.y = i.mapY - 10, game.add.tween(this.avatar).to({
            x: s.mapX - 90,
            y: s.mapY - 10
        }, 1e3, Phaser.Easing.Sinusoidal.InOut, !0).onComplete.add(function() {
            this.onAnimFinished.dispatch()
        }, this)
    }, G.WorldMapSocialLayer = function(t) {
        Phaser.Group.call(this, game), this.state = game.state.getCurrentState(), this.position = t.position, this.initialized = !1
    }, G.WorldMapSocialLayer.prototype = Object.create(Phaser.Group.prototype), G.WorldMapSocialLayer.prototype.initLabels = function(t) {
        if (null !== this.game && t) {
            for (var e = [], i = 0; i < t.length; i++) {
                var s = t[i];
                if (void 0 !== s.maxLevel && 3 !== e[s.maxLevel]) {
                    var a = G.json.levels[Math.max(0, s.maxLevel - 1)];
                    if (!a) continue;
                    void 0 === e[s.maxLevel] && (e[s.maxLevel] = 0);
                    var n = 30 * e[s.maxLevel];
                    e[s.maxLevel]++, this.add(new G.WorldMapSocialLayer.MapLabel(a.mapX, a.mapY, s.avatar, n))
                }
            }
            this.initialized = !0
        }
    }, G.WorldMapSocialLayer.MapLabel = function(t, e, i, s) {
        s = s || 0, Phaser.Image.call(this, game, G.l(t) + G.l(1 * (50 + s)), G.l(e - 20)), this.anchor.setTo(.5, .5), this.orgX = G.l(t) + G.l(1 * (70 + s)), this.tweenOffsetX = 0, this.scale.setTo(0);
        var a = this;
        this.avatar = G.makeExtImage(0, 0, i, null, .5, this, !1, function() {
            this.width = 50, this.height = 50, game.add.tween(a.scale).to({
                x: 1,
                y: 1
            }, 500, Phaser.Easing.Elastic.Out, !0)
        }), this.border = G.makeImage(0, 0, "avatar_frame", .5, this)
    }, G.WorldMapSocialLayer.MapLabel.prototype = Object.create(Phaser.Image.prototype), G.WorldMapSocialLayer.MapLabel.prototype.update = function() {
        this.x = this.orgX + this.tweenOffsetX * this.scale.x
    }, G.WorldMapSocialLayer.prototype.update = function() {
        !this.initialized && G.FRIENDS && this.initLabels(G.FRIENDS)
    }, G.LevelBg = function(t) {
        Phaser.Image.call(this, game, 0, 0), this.anchor.setTo(.5), G.changeTexture(this, "background_1"), G.sb("onScreenResize").add(this.onScreenResize, this), this.onScreenResize(), game.add.existing(this)
    }, G.LevelBg.prototype = Object.create(Phaser.Image.prototype), G.LevelBg.prototype.onScreenResize = function() {
        this.x = game.world.bounds.x + .5 * game.width, this.y = game.world.bounds.y + .5 * game.height, this.scale.setTo(1), this.width = Math.max(this.width, game.width), this.height = Math.max(this.height, game.height), this.width += 10, this.height += 10, this.updateCache()
    }, G.MoreGamesBtn = function(t, e) {
        G.Button.call(this, t, e, "btn_moregames", function() {}), this.visible = sgSettings.config.moreGames.displayButton, game.add.existing(this)
    }, G.MoreGamesBtn.prototype = Object.create(G.Button.prototype), G.Modify = function() {
        if (this === G) return new G.Modify;
        Phaser.Group.call(this, game), (G.Modify.instance = this).onLevelObjChange = new Phaser.Signal, this.onCurrentObjChange = new Phaser.Signal, this.onObjDestroy = new Phaser.Signal, this.inputBlocker = new G.ModifyInputBlocked, this.add(this.inputBlocker), game.stage.disableVisibilityChange = !0, game.paused = !1, obj = game.state.getCurrentState(), obj === game.state.getCurrentState() && (game.state.getCurrentState().children = game.world.children), this.objectName = "WORLD", this.currentLevel = [], this.currentChildIndex = 0, this.currentPropIndex = 0, this.mods = [], this.gfx = game.add.graphics(), this.gfx.fixedToCamera = !0, this.add(this.gfx), this.obj = obj, this.propGroup = this.add(new G.ModifyPropGroup(this)), this.childrenPropNames = this.getChildrenPropNames(), this.buttonGroup = new G.ModifyButtonGroup, this.add(this.buttonGroup), this.childList = new G.ModifyChildList, this.add(this.childList), this.addKeyboardControlls(), this.bottomBar = this.add(new G.ModifyBottomBar), this.frameSelector = this.add(new G.ModifyFrameSelector), this.frameSelector.onFrameClicked.add(this.changeFrame, this), this.animationEditor = new G.ModifyAnimationEditor(this), this.add(this.animationEditor), this.removeCash = {}, this.codeGenerator = new G.ModifyCodeGenerator(this), this.defaultNewObjectsNames = !0, this.hideGroupTxt = !1, game.state.states.MODIFYEMPTYSTATE || game.state.add("MODIFYEMPTYSTATE", {
            create: function() {
                new G.Modify
            }
        }), this.domLayer = new G.ModifyDOMLayer(this), game.input.onDown.add(this.processClick, this)
    }, G.Modify.prototype = Object.create(Phaser.Group.prototype), G.countChildren = function(t) {
        var e = 1;
        return t.children && 0 < t.children.length && t.children.forEach(function(t) {
            e += G.countChildren(t)
        }), e
    }, G.Modify.prototype.removeCashObjToString = function(t) {
        if (!this.removeCash[t]) return "";
        for (var e = "\tREMOVED:", i = 0; i < this.removeCash[t].length; i++) e += "\t\t" + this.removeCash[t][i] + "\n";
        return e
    }, G.Modify.prototype.removeObject = function() {
        console.log("removeObject");
        var t = this.getCurrentObject();
        if (console.log(t), t) {
            var e = this.currentLevel.join("/") || this.currentLevel[0] || game.state.current,
                i = this.childrenPropNames[this.currentChildIndex].toString();
            t.___NEWOBJECT, this.removeCash[e] || (this.removeCash[e] = []), this.removeCash[e].push(i), t.destroy(), this.refreshLevel()
        }
    }, G.Modify.prototype.refreshLevel = function() {
        this.currentLevel = this.currentLevel, this.childrenPropNames = this.getChildrenPropNames(), this.onLevelObjChange.dispatch()
    }, G.Modify.prototype.addToGroup = function(t, e) {
        var i;
        t != game.world && t != game.state.getCurrentState() || (t = game.world, e.x = game.camera.x + .5 * game.width, e.y = game.camera.y + .5 * game.height), t.add ? t.add(e) : t.addChild && t.addChild(e);
        var s = this.getCurrentLevelObject();
        (i = this.defaultNewObjectsNames ? "child_" + s.children.length : prompt("Enter object name")) && (e.___LABEL = i, t == game.world ? game.state.getCurrentState()[i] = e : t[i] = e)
    }, G.Modify.prototype.addGroup = function() {
        var t = this.getCurrentLevelObject(),
            e = game.make.group();
        e.___NEWOBJECT = !0, this.addToGroup(t, e), this.refreshLevel()
    }, G.Modify.prototype.addImage = function() {
        var t = this.getCurrentLevelObject(),
            e = new G.Image(0, 0, "__missing", .5, null);
        return e.___NEWOBJECT = !0, this.addToGroup(t, e), this.refreshLevel(), e
    }, G.Modify.prototype.addButton = function() {
        var t = this.getCurrentLevelObject(),
            e = new G.Button(0, 0, "__missing", function() {}, this);
        e.___NEWOBJECT = !0, this.addToGroup(t, e), this.refreshLevel()
    }, G.Modify.prototype.addOneLineText = function() {
        var t = this.getCurrentLevelObject(),
            e = Object.keys(game.cache._cache.bitmapFont),
            i = new G.OneLineText(0, 0, e[0], "TEXT", 50, 300, .5, .5);
        i.cacheAsBitmap = !1, this.addToGroup(t, i), this.refreshLevel()
    }, G.Modify.prototype.addMultiLineText = function() {
        var t = this.getCurrentLevelObject(),
            e = Object.keys(game.cache._cache.bitmapFont),
            i = new G.MultiLineText(0, 0, e[0], "TEXT", 50, 300, 300, "center", .5, .5);
        i.cacheAsBitmap = !1, this.addToGroup(t, i), this.refreshLevel()
    }, G.Modify.prototype.update = function() {
        this.updateKeyboard(), this.redrawGfx(), this.propGroup.update(), this.hideGroupTxt ? (this.childList.hideList(), this.propGroup.cameraOffset.y = this.childList.cameraOffset.y + 50) : (this.childList.showList(), this.propGroup.cameraOffset.y = this.childList.cameraOffset.y + this.childList.height + 30), this.frameSelector.update(), this.bottomBar.x = game.world.bounds.x, this.bottomBar.y = game.world.bounds.y + game.height - this.bottomBar.height;
        for (var t = 0; t < this.children.length; t++) this.children[t].update()
    }, G.Modify.prototype.getChildrenPropNames = function() {
        game.world.bringToTop(this);
        var t = [],
            e = this.getCurrentLevelObject(),
            i = e;
        e === game.world && (i = game.state.getCurrentState());
        for (var s = 0; s < e.children.length; s++) {
            var a = !1,
                n = e.children[s];
            if (n !== this)
                if (n.___LABEL) t.push([n.___LABEL]);
                else {
                    for (var o in i)
                        if ("children" != o && "cursor" != o && (a || n !== i[o] || (a = !0, n.___LABEL = o, t.push([o])), Array.isArray(i[o]) && "children" !== o))
                            for (var r = 0; r < i[o].length; r++) a || n !== i[o][r] || (a = !0, t.push([o, r]));
                    a || t.push(["children", s])
                }
            else t.push(["G.MODIFY-EDITOR"])
        }
        return t
    }, G.Modify.prototype.getCurrentObject = function() {
        return this.getCurrentLevelObject().children[this.currentChildIndex]
    }, G.Modify.prototype.changeFrame = function(t) {
        console.log(t);
        var e = this.getCurrentObject();
        this.saveInitPropValue("frameName", t), e.loadTexture && G.changeTexture(e, t)
    }, G.Modify.prototype.getCurrentLevelObject = function() {
        for (var t = this.obj, e = 0; e < this.currentLevel.length; e++) t = t[this.currentLevel[e]];
        return t
    }, G.Modify.prototype.redrawGfx = function() {
        this.gfx.clear();
        var t = this.getCurrentLevelObject();
        if (t !== game.state.getCurrentState()) {
            var e = t.getLocalBounds();
            this.gfx.lineStyle(3, 16711680, .2), this.gfx.drawRect(t.worldPosition.x + e.x, t.worldPosition.y + e.y, e.width, e.height), this.gfx.beginFill(0, .5), this.gfx.drawRect(t.worldPosition.x - 10, t.worldPosition.y - 10, 20, 20)
        }
        this.gfx.beginFill(0, 0), this.childrenPropNames.forEach(function(t, e) {
            var i = e == this.currentChildIndex;
            this.gfx.lineStyle(i ? 3 : 1, 255, i ? 1 : .2);
            var s = this.getCurrentLevelObject().children[e];
            if (s) {
                var a = s.getBounds(),
                    n = s.getLocalBounds();
                this.gfx.drawRect(s.worldPosition.x + n.x * s.scale.x, s.worldPosition.y + n.y * s.scale.y, a.width * s.scale.x, a.height * s.scale.y), i && s.maxUserWidth && !s.maxUserHeight ? (this.gfx.lineStyle(2, 65280, .5), this.gfx.drawRect(s.worldPosition.x - s.anchor.x * s.maxUserWidth, s.worldPosition.y - s.anchor.y * s.height, s.maxUserWidth, s.height)) : i && s.maxUserWidth && s.maxUserHeight && (this.gfx.lineStyle(2, 65280, .5), this.gfx.drawRect(s.worldPosition.x - s.anchor.x * s.maxUserWidth, s.worldPosition.y - s.anchor.y * s.maxUserHeight, s.maxUserWidth, s.maxUserHeight))
            }
        }, this);
        this.getCurrentObject()
    }, G.Modify.prototype.addKeyboardControlls = function() {
        this.keys = game.input.keyboard.addKeys({
            Q: Phaser.Keyboard.Q,
            A: Phaser.Keyboard.A,
            E: Phaser.Keyboard.E,
            UP: Phaser.Keyboard.UP,
            ONE: Phaser.Keyboard.ONE,
            TWO: Phaser.Keyboard.TWO,
            DOWN: Phaser.Keyboard.DOWN,
            RIGHT: Phaser.Keyboard.RIGHT,
            LEFT: Phaser.Keyboard.LEFT,
            ALT: Phaser.Keyboard.ALT,
            Z: Phaser.Keyboard.Z,
            X: Phaser.Keyboard.X,
            C: Phaser.Keyboard.C,
            U: Phaser.Keyboard.U,
            PLUS: 107,
            MINUS: 109,
            ESC: Phaser.Keyboard.ESC,
            NUM8: 104,
            NUM5: 101,
            NUM4: 100,
            NUM6: 102,
            NUM2: 98,
            NUM7: 103,
            NUM9: 105,
            NUMSTAR: 106,
            SPACE: Phaser.Keyboard.SPACEBAR,
            V: Phaser.Keyboard.V,
            L: Phaser.Keyboard.L,
            I: Phaser.Keyboard.I,
            P: Phaser.Keyboard.P,
            O: Phaser.Keyboard.O,
            M: Phaser.Keyboard.M,
            DEL: Phaser.Keyboard.DELETE,
            sqBracketOpen: 219,
            sqBracketClose: 221,
            SHIFT: Phaser.Keyboard.SHIFT
        }), this.keys.sqBracketOpen.onDown.add(function() {
            this.keys.SHIFT.isDown ? this.objToBottom() : this.objMoveDown()
        }, this), this.keys.sqBracketClose.onDown.add(function() {
            this.keys.SHIFT.isDown ? this.objToTop() : this.objMoveUp()
        }, this), this.keys.frameCounter = 0, this.keys.L.onDown.add(function() {
            var e = this.getCurrentLevelObject(),
                i = this.getCurrentObject();
            this.domLayer.openInputDiv((i.___LABEL || "obj") + " | label", i.___LABEL || "", function(t) {
                void 0 === e[t] && (i.___LABEL && delete e[i.___LABEL], (e[t] = i).___LABEL = t, this.refreshLevel())
            }, this, "string")
        }, this), this.keys.Q.onDown.add(function() {
            this.changeCurrentChildrenIndex(this.currentChildIndex + 1)
        }, this), this.keys.A.onDown.add(function() {
            console.log("children -1"), this.changeCurrentChildrenIndex(this.currentChildIndex - 1)
        }, this), this.keys.E.onDown.add(function() {
            this.exportChanges()
        }, this), this.keys.NUM5.onDown.add(function() {
            var t = this.getCurrentObject();
            t && (t.scale.setTo(1), t.angle = 0, t.alpha = 1, t.visible = !0, t.anchor.setTo(.5))
        }, this), this.keys.TWO.onDown.add(function() {
            0 < this.getCurrentObject().children.length && (this.currentLevel = this.currentLevel.concat(this.childrenPropNames[this.currentChildIndex]), this.childrenPropNames = this.getChildrenPropNames(), this.currentChildIndex = 0, this.makeTexts())
        }, this), this.keys.ONE.onDown.add(function() {
            0 != this.currentLevel.length && (this.currentLevel = "number" == typeof this.currentLevel[this.currentLevel.length - 1] ? this.currentLevel.splice(0, this.currentLevel.length - 2) : this.currentLevel.splice(0, this.currentLevel.length - 1), this.childrenPropNames = this.getChildrenPropNames(), this.currentChildIndex = 0, this.makeTexts())
        }, this), this.keys.ESC.onDown.add(this.turnOff, this), this.keys.V.onDown.add(function() {
            this.alpha = 1 == this.alpha ? .1 : 1
        }, this), this.keys.O.onDown.add(function() {
            var t = this.getCurrentObject();
            t instanceof Phaser.Group && (t.___CONSTRUCTOR = !0)
        }, this), this.keys.P.onDown.add(function() {
            var t = this.getCurrentObject();
            this.codeGenerator.start(t)
        }, this), this.keys.C.onDown.add(function() {
            var t = game.input.activePointer,
                e = this.addImage();
            this.setNewCurrentChildren(e), this.moveCurrentObjectToWorldPos(t.x, t.y)
        }, this), this.keys.I.onDown.add(function() {
            void 0 === this.pressCounterI && (this.pressCounterI = 0), this.pressCounterI++, 3 == this.pressCounterI && game.state.start("MODIFYEMPTYSTATE"), game.time.events.add(1e3, function() {
                this.pressCounterI = 0
            }, this)
        }, this), this.keys.DEL.onDown.add(this.removeObject, this), this.keys.NUMSTAR.onDown.add(function() {
            console.log("numstar"), this.frameSelector.opened ? this.frameSelector.close() : this.frameSelector.open()
        }, this), this.keys.U.onDown.add(function() {
            this.hideGroupTxt = !this.hideGroupTxt
        }, this)
    }, G.Modify.prototype.turnOff = function() {
        if (void 0 === this.escPressed && (this.escPressed = 0), this.escPressed++, game.time.events.add(2e3, function() {
                this.escPressed = 0
            }, this), !(this.escPressed < 5)) {
            for (key in this.keys) this.keys[key].onDown && this.keys[key].onDown.removeAll();
            this.gfx.destroy(), this.levelTxt.destroy(), this.propGroup.destroy(), this.groupTxt.destroy(), this.destroy()
        }
    }, G.Modify.prototype.modifyCurrentObjProp = function(t, e) {
        var i = this.getCurrentObject();
        this.saveInitPropValue(t, e), G.Utils.setObjProp(i, t, e)
    }, G.Modify.prototype.saveInitPropValue = function(t, e) {
        var i = this.getCurrentObject();
        Array.isArray(t) && (t = t.join(".")), G.Utils.getObjProp(i, t) !== e && (i.___initState || (i.___initState = {}), void 0 === i.___initState[t] && (i.___initState[t] = G.Utils.getObjProp(i, t)))
    }, G.Modify.prototype.updateKeyboard = function() {
        var t = this.getCurrentObject();
        if (t) {
            this.keys.frameCounter++;
            var e = 1,
                i = !0;
            this.keys.Z.isDown && this.keys.frameCounter % 5 != 0 && (i = !1), this.keys.X.isDown && (e = 5), this.keys.C.isDown && (e = 20), i && this.keys.UP.isDown && this.modifyCurrentObjProp("y", t.y - e), i && this.keys.DOWN.isDown && this.modifyCurrentObjProp("y", t.y + e), i && this.keys.LEFT.isDown && this.modifyCurrentObjProp("x", t.x - e), i && this.keys.RIGHT.isDown && this.modifyCurrentObjProp("x", t.x + e), e = .025, this.keys.X.isDown && (e = .05), this.keys.C.isDown && (e = .1), i && this.keys.NUM8.isDown && this.modifyCurrentObjProp("scale.y", t.scale.y + e), i && this.keys.NUM2.isDown && (this.modifyCurrentObjProp("scale.y", t.scale.y - e), t.scale.y -= e), i && this.keys.NUM4.isDown && this.modifyCurrentObjProp("scale.x", t.scale.x - e), i && this.keys.NUM6.isDown && this.modifyCurrentObjProp("scale.x", t.scale.x + e), i && this.keys.PLUS.isDown && (this.modifyCurrentObjProp("scale.x", t.scale.x + e), this.modifyCurrentObjProp("scale.y", t.scale.y + e)), i && this.keys.MINUS.isDown && (this.modifyCurrentObjProp("scale.x", t.scale.x - e), this.modifyCurrentObjProp("scale.y", t.scale.y - e)), e = 1, this.keys.X.isDown && (e = 2), this.keys.C.isDown && (e = 5), i && this.keys.NUM7.isDown && this.modifyCurrentObjProp("angle", t.angle - e), i && this.keys.NUM9.isDown && this.modifyCurrentObjProp("angle", t.angle + e), this.keys.SPACE.isDown && (this.modifyCurrentObjProp("x", 5 * Math.floor(t.x / 5)), this.modifyCurrentObjProp("y", 5 * Math.floor(t.y / 5)), this.modifyCurrentObjProp("scale.x", .025 * Math.floor(t.scale.x / .025)), this.modifyCurrentObjProp("scale.y", .025 * Math.floor(t.scale.y / .025)), this.modifyCurrentObjProp("angle", Math.floor(t.angle)))
        }
    }, G.Modify.prototype.currentLevelGoUp = function() {
        0 != this.currentLevel.length && (this.currentLevel = "number" == typeof this.currentLevel[this.currentLevel.length - 1] ? this.currentLevel.splice(0, this.currentLevel.length - 2) : this.currentLevel.splice(0, this.currentLevel.length - 1), this.childrenPropNames = this.getChildrenPropNames(), this.currentChildIndex = 0, this.onLevelObjChange.dispatch())
    }, G.Modify.prototype.currentLevelGoDown = function(t) {
        console.log(arguments), console.log(this.childrenPropNames[t]), this.currentLevel = this.currentLevel.concat(this.childrenPropNames[t]), this.childrenPropNames = this.getChildrenPropNames(), this.currentChildIndex = 0, this.onLevelObjChange.dispatch()
    }, G.Modify.prototype.changeCurrentChildrenIndex = function(t) {
        this.currentChildIndex = t, this.currentChildIndex < 0 && (this.currentChildIndex = this.childrenPropNames.length - 1), this.currentChildIndex >= this.childrenPropNames.length && (this.currentChildIndex = 0), this.onCurrentObjChange.dispatch()
    }, G.Modify.prototype.setNewCurrentChildren = function(t) {
        var e = this.getCurrentLevelObject().children.indexOf(t); - 1 != e && this.changeCurrentChildrenIndex(e)
    }, G.Modify.prototype.childPropChange = function(t) {
        var e = this.currentLevel,
            i = this.currentChildIndex;
        this.currentLevel = t || [];
        for (var s = this.currentLevel.join("/") || this.currentLevel[0] || game.state.current, a = this.removeCashObjToString(s), n = "", o = this.getChildrenPropNames(), r = 0; r < o.length; r++) {
            this.currentChildIndex = r;
            var h = this.getCurrentObject();
            if (h !== this) {
                o[r].toString();
                var l = h.___NEWOBJECT,
                    d = h.constructor === G.OneLineText || h.constructor === G.MultiLineText;
                if (l && (n += "NEW OBJECT \n"), h.___initState) n += "\t" + o[r] + "\n", Object.keys(h.___initState).forEach(function(t) {
                    n += "\t" + t + ":  " + G.Utils.getObjProp(h, t) + "\n"
                }, this), h.___initState = void 0;
                !d && (l || h.children && 0 < h.children.length) && this.childPropChange(this.currentLevel.concat(o[r]))
            }
        }(0 < n.length || 0 < a.length) && (a.length, n.length, this.export += s + "\n" + a + n), this.currentChildIndex = i, this.currentLevel = e
    }, G.Modify.prototype.exportChanges = function() {
        this.export = "", this.childPropChange(), this.export ? (this.export = this.objectName + "\n" + this.export, G.Utils.copyToClipboard(this.export), console.log(this.export)) : console.log("NO CHANGES TO EXPORT")
    }, G.Modify.prototype.processClick = function() {
        var t = game.input.activePointer;
        this.keys.M.isDown && this.moveCurrentObjectToWorldPos(t.x, t.y)
    }, G.Modify.prototype.moveCurrentObjectToWorldPos = function(t, e) {
        var i = this.getCurrentObject();
        if (i) {
            i.updateTransform();
            var s = t - i.worldPosition.x,
                a = e - i.worldPosition.y,
                n = new Phaser.Point(s, a),
                o = new Phaser.Point(t, e);
            n.normalize();
            for (var r = i.worldPosition.distance(o);;) {
                var h = r;
                if (i.x += n.x, i.y += n.y, i.updateTransform(), h < (r = i.worldPosition.distance(o))) break
            }
            i.x = Math.round(i.x), i.y = Math.round(i.y)
        }
    }, G.Modify.prototype.addMouseWheel = function() {
        game.input.mouse.mouseWheelCallback = function(t) {
            var e = this.getCurrentLevelObject();
            e && e !== game.world && (e.y += 150 * game.input.mouse.wheelDelta)
        }.bind(this)
    }, G.Modify.prototype.exportLvlAsString = function() {
        for (var t = [], e = this.getCurrentLevelObject(), i = 0; i < e.children.length; i++) {
            var s = e.children[i];
            if (s instanceof Phaser.Image) {
                var a = null;
                "string" == typeof s.frameName && (a = -1 == s.frameName.indexOf("/") ? s.frameName : s.key);
                var n = {
                    x: s.x,
                    y: s.y,
                    frame: a,
                    anchor: [s.anchor.x, s.anchor.y],
                    scale: [s.scale.x, s.scale.y],
                    angle: s.angle
                };
                s.___LABEL && (n.label = s.___LABEL), s.___DATA && (n.data = s.___DATA), t.push(n)
            }
        }
        console.log(JSON.stringify(t)), G.Utils.copyToClipboard(JSON.stringify(t))
    }, G.Modify.prototype.objToTop = function() {
        var t = this.getCurrentObject();
        t && (this.getCurrentLevelObject().bringToTop(t), this.refreshLevel(), this.setNewCurrentChildren(t))
    }, G.Modify.prototype.objMoveUp = function() {
        var t = this.getCurrentObject();
        t && (this.getCurrentLevelObject().moveUp(t), this.refreshLevel(), this.setNewCurrentChildren(t))
    }, G.Modify.prototype.objMoveDown = function() {
        var t = this.getCurrentObject();
        t && (this.getCurrentLevelObject().moveDown(t), this.refreshLevel(), this.setNewCurrentChildren(t))
    }, G.Modify.prototype.objToBottom = function() {
        var t = this.getCurrentObject();
        t && (this.getCurrentLevelObject().sendToBack(t), this.refreshLevel(), this.setNewCurrentChildren(t))
    }, G.ModifyAnimationEditor = function(t) {
        Phaser.Group.call(this, game), this.modify = G.Modify.instance, this.tl = new G.ModifyAnimationTL, this.tl.x = 100, this.add(this.tl), this.fw = new G.ModifyAnimationFrameWindow, this.fw.x = -250, this.add(this.fw), this.tl.onFrameSelected.add(this.fw.refresh, this.fw), this.fw.onChange.add(function(t, e) {
            console.log("fw onchange"), this.tl.redrawTl(), t.updateAnimation(e)
        }, this), this.tl.changeTlPxWidth(800), this.visible = !1, this.modify.onLevelObjChange.add(function() {
            var t = this.modify.getCurrentLevelObject();
            t.ANIMATIONELEMENT ? this.open(t) : this.close()
        }, this)
    }, G.ModifyAnimationEditor.prototype = Object.create(Phaser.Group.prototype), G.ModifyAnimationEditor.prototype.open = function(t) {
        this.visible = !0, this.tl.open(t), this.fw.refresh(t, 0)
    }, G.ModifyAnimationEditor.prototype.close = function() {
        this.visible = !1
    }, G.ModifyAnimationFrameGroup = function(t, e) {
        Phaser.Group.call(this, game), this.x = t, this.y = e, this.active = !1, this.currentObj = null, this.currentKeyFrame = null, this.currentFrameNr = 0, this.style = {
            font: "Verdana",
            fontSize: 13,
            fontWeight: "bold"
        }, this.onOffBtn = game.add.text(0, 0, "off", this.style), this.onOffBtn.inputEnabled = !0, this.onOffBtn.hitArea = new Phaser.Rectangle(0, 0, this.onOffBtn.width, this.onOffBtn.height), this.onOffBtn.events.onInputDown.add(this.onOff, this), this.propValue = game.add.text(280, 0, "---", this.style), this.propValue.anchor.x = 1, this.addMultiple([this.onOffBtn, this.propValue]), this.onChange = new Phaser.Signal
    }, G.ModifyAnimationFrameGroup.prototype = Object.create(Phaser.Group.prototype), G.ModifyAnimationFrameGroup.prototype.onOff = function() {
        if (0 != this.currentFrameNr) {
            if (this.active) {
                this.active = !1, this.alpha = .5, this.onOffBtn.setText("off");
                var t = this.currentObj.frameTL.indexOf(this.currentKeyFrame);
                this.currentObj.frameTL.splice(t, 1)
            } else {
                this.active = !0, this.alpha = 1, this.onOffBtn.setText("on");
                for (var e = {
                        f: this.currentFrameNr,
                        v: G.Utils.getObjProp(this.currentObj.SPR, "frameName")
                    }, i = this.currentFrameNr, s = this.currentObj.frameTL, a = 0, n = 0; n < s.length; n++) s[n].f < i && a++;
                s.splice(a, 0, e)
            }
            this.refresh(this.currentObj, this.currentFrameNr)
        }
    }, G.ModifyAnimationFrameGroup.prototype.update = function() {
        if (this.currentObj.playing) this.refresh(this.currentObj, this.currentObj.frameCounter);
        else if (this.currentObj) {
            var t = G.Utils.getObjProp(this.currentObj.SPR, "frameName") || G.Utils.getObjProp(this.currentObj.SPR, "key");
            t.indexOf("/") && (t = t.slice(t.lastIndexOf("/") + 1)), null == this.currentKeyFrame && (t != this.valAtRefresh ? (this.propValue.fill = "red", this.alpha = 1) : (this.alpha = .5, this.propValue.fill = "black")), !this.currentObj.playing && this.currentKeyFrame && this.currentKeyFrame.v !== t && (this.currentKeyFrame.v = t), this.propValue.setText(t)
        } else this.propValue.setText("---")
    }, G.ModifyAnimationFrameGroup.prototype.refresh = function(t, e) {
        this.currentObj = t, this.currentObj.currentAnimationName && (this.currentKeyFrame = t.getKeyFrameAt(t.frameTL, e), this.currentFrameNr = e, this.propValue.fill = "black", this.valAtRefresh = G.Utils.getObjProp(this.currentObj.SPR, "frameName"), this.currentKeyFrame ? (this.active = !0, this.alpha = 1, this.onOffBtn.setText("on"), console.log("frameGroup refresh"), console.log(this.currentObj.getTextureFrameValue(t.frameTL, e)), this.propValue.setText(this.currentObj.getTextureFrameValue(t.frameTL, e) || "---")) : (this.onOffBtn.setText("off"), this.active = !1, this.alpha = .5, this.propValue.setText("---")))
    }, G.ModifyAnimationFrameWindow = function() {
        Phaser.Group.call(this, game), this.onChange = new Phaser.Signal, this.gfx = game.add.graphics(), this.gfx.inputEnabled = !0, this.add(this.gfx), this.gfx.beginFill(14540253), this.gfx.drawRect(0, 0, 300, 500), this.style = {
            font: "Verdana",
            fontSize: 13,
            fontWeight: "bold"
        }, this.currentAnimationTxt = game.add.text(10, 10, "", this.style), this.add(this.currentAnimationTxt), this.currentAnimationTxt.inputEnabled = !0, this.currentAnimationTxt.events.onInputDown.add(function() {
            this.changeAnimation()
        }, this), this.addAnimationBtn = game.add.text(170, 10, "+", this.style), this.add(this.addAnimationBtn), this.addAnimationBtn.inputEnabled = !0, this.addAnimationBtn.events.onInputDown.add(this.addNewAnimation, this), this.renameAnimationBtn = game.add.text(200, 10, "R", this.style), this.add(this.renameAnimationBtn), this.renameAnimationBtn.inputEnabled = !0, this.renameAnimationBtn.events.onInputDown.add(this.renameAnimation, this), this.removeAnimationBtn = game.add.text(230, 10, "-", this.style), this.add(this.removeAnimationBtn), this.removeAnimationBtn.inputEnabled = !0, this.removeAnimationBtn.events.onInputDown.add(this.removeAnimation, this), this.frameNr = game.add.text(290, 10, "", this.style), this.frameNr.anchor.x = 1, this.add(this.frameNr), this.frameGroup = new G.ModifyAnimationFrameGroup(10, 50), this.add(this.frameGroup), this.propGroups = [new G.ModifyAnimationPropGroup(10, 70, "alpha", "#43c9e7"), new G.ModifyAnimationPropGroup(10, 90, "x", "#e08040"), new G.ModifyAnimationPropGroup(10, 110, "y", "#d8ff30"), new G.ModifyAnimationPropGroup(10, 130, "angle", "#072ba0"), new G.ModifyAnimationPropGroup(10, 150, "scale.x", "#6c0674"), new G.ModifyAnimationPropGroup(10, 170, "scale.y", "#d34ed9"), new G.ModifyAnimationPropGroup(10, 190, "anchor.x"), new G.ModifyAnimationPropGroup(10, 210, "anchor.y")], this.propGroups.forEach(function(t) {
            t.onChange.add(this.onChange.dispatch, this.onChange)
        }, this), this.addMultiple(this.propGroups)
    }, G.ModifyAnimationFrameWindow.prototype = Object.create(Phaser.Group.prototype), G.ModifyAnimationFrameWindow.prototype.update = function() {
        this.currentObj && (this.propGroups.forEach(function(t) {
            t.update()
        }, this), this.frameGroup.update())
    }, G.ModifyAnimationFrameWindow.prototype.loadFrame = function(t, e) {
        this.currentObj = t, this.labelObjTxt.setText(t.LABEL || "obj"), this.frameNr.setText(e)
    }, G.ModifyAnimationFrameWindow.prototype.refresh = function(e, i) {
        this.propGroups.forEach(function(t) {
            t.refresh(e, i)
        }), this.frameGroup.refresh(e, i), this.frameNr.setText(i), this.currentFrameNr = i, this.currentObj = e, this.currentAnimationTxt.setText(this.currentObj.currentAnimationName || "------")
    }, G.ModifyAnimationFrameWindow.prototype.changeAnimation = function(t) {
        if (this.currentObj) {
            var e = Object.keys(this.currentObj.dataAnimation);
            if (console.log(JSON.stringify(e)), t) this.currentObj.changeAnimationData(t);
            else if (this.currentObj.currentAnimationName) {
                var i = e.indexOf(this.currentObj.currentAnimationName),
                    s = (i + 1) % e.length;
                console.log(i, s), this.currentObj.changeAnimationData(e[s])
            } else this.currentObj.changeAnimationData(e[0]);
            this.refresh(this.currentObj, this.currentFrameNr), this.onChange.dispatch(this.currentObj, 0)
        }
    }, G.ModifyAnimationFrameWindow.prototype.addNewAnimation = function() {
        if (this.currentObj) {
            for (var t = Object.keys(this.currentObj.dataAnimation), e = "newAnimation", i = 0; - 1 !== t.indexOf(e + i);) i++;
            this.currentObj.dataAnimation[e + i] = {
                eventTL: [],
                frameTL: [{
                    f: 0,
                    v: null
                }],
                propTLS: {
                    alpha: [{
                        f: 0,
                        v: 1
                    }],
                    x: [{
                        f: 0,
                        v: 0
                    }],
                    y: [{
                        f: 0,
                        v: 0
                    }],
                    angle: [{
                        f: 0,
                        v: 0
                    }],
                    "scale.x": [{
                        f: 0,
                        v: 1
                    }],
                    "scale.y": [{
                        f: 0,
                        v: 1
                    }],
                    "anchor.x": [{
                        f: 0,
                        v: .5
                    }],
                    "anchor.y": [{
                        f: 0,
                        v: .5
                    }]
                }
            }, this.changeAnimation(e + i)
        }
    }, G.ModifyAnimationFrameWindow.prototype.removeAnimation = function() {
        this.currentObj && this.currentObj.currentAnimationName && 1 != Object.keys(this.currentObj.dataAnimation).length && confirm("delete " + this.currentObj.currentAnimationName + "?") && (delete this.currentObj.dataAnimation[this.currentObj.currentAnimationName], this.changeAnimation())
    }, G.ModifyAnimationFrameWindow.prototype.renameAnimation = function() {
        this.currentObj && this.currentObj.currentAnimationName && G.Modify.instance.domLayer.openInputDiv(this.currentObj.currentAnimationName, this.currentObj.currentAnimationName, function(t) {
            var e = this.currentObj.currentAnimationName,
                i = this.currentObj.currentAnimationData;
            delete this.currentObj.dataAnimation[e], this.currentObj.dataAnimation[t] = i, this.changeAnimation(t)
        }, this, "string")
    }, G.ModifyAnimationPropGroup = function(t, e, i, s) {
        Phaser.Group.call(this, game), this.x = t, this.y = e, this.propKey = i, this.active = !1, this.currentObj = null, this.currentKeyFrame = null, this.currentFrameNr = 0, this.style = {
            font: "Verdana",
            fontSize: 13,
            fontWeight: "bold"
        }, this.easings = ["Back", "Bounce", "Circular", "Cubic", "Elastic", "Exponential", "Linear", "Quadratic", "Quartic", "Quintic", "Sinusoidal"], this.onOffBtn = game.add.text(0, 0, "off", this.style), this.onOffBtn.inputEnabled = !0, this.onOffBtn.hitArea = new Phaser.Rectangle(0, 0, this.onOffBtn.width, this.onOffBtn.height), this.onOffBtn.events.onInputDown.add(this.onOff, this), this.label = game.add.text(30, 0, i, this.style), s && this.label.addColor(s, 0), this.easingLabel0 = game.add.text(120, 0, "", this.style), this.easingLabel0.inputEnabled = !0, this.easingLabel0.hitArea = new Phaser.Rectangle(0, 0, 80, this.easingLabel0.height), this.easingLabel0.events.onInputDown.add(this.changeEasing0, this), this.easingLabel1 = game.add.text(200, 0, "", this.style), this.easingLabel1.inputEnabled = !0, this.easingLabel1.hitArea = new Phaser.Rectangle(0, 0, 50, this.easingLabel1.height), this.easingLabel1.events.onInputDown.add(this.changeEasing1, this), this.propValue = game.add.text(280, 0, "", this.style), this.propValue.anchor.x = 1, this.addMultiple([this.label, this.onOffBtn, this.easingLabel0, this.easingLabel1, this.propValue]), this.onChange = new Phaser.Signal
    }, G.ModifyAnimationPropGroup.prototype = Object.create(Phaser.Group.prototype), G.ModifyAnimationPropGroup.prototype.onOff = function() {
        if (0 != this.currentFrameNr) {
            if (this.active) {
                this.active = !1, this.alpha = .5, this.onOffBtn.setText("off");
                var t = this.currentObj.propTLS[this.propKey].indexOf(this.currentKeyFrame);
                this.currentObj.propTLS[this.propKey].splice(t, 1)
            } else {
                this.active = !0, this.alpha = 1, this.onOffBtn.setText("on");
                for (var e = {
                        f: this.currentFrameNr,
                        v: G.Utils.getObjProp(this.currentObj.SPR, this.propKey)
                    }, i = this.currentFrameNr, s = this.currentObj.propTLS[this.propKey], a = 0, n = 0; n < s.length; n++) s[n].f < i && a++;
                s.splice(a, 0, e)
            }
            this.refresh(this.currentObj, this.currentFrameNr)
        }
    }, G.ModifyAnimationPropGroup.prototype.update = function() {
        if (this.currentObj.playing) this.refresh(this.currentObj, this.currentObj.frameCounter);
        else if (this.currentObj) {
            var t = G.Utils.getObjProp(this.currentObj.SPR, this.propKey);
            null == this.currentKeyFrame && (t != this.valAtRefresh ? (this.propValue.fill = "red", this.alpha = 1) : (this.alpha = .5, this.propValue.fill = "black")), !this.currentObj.playing && this.currentKeyFrame && this.currentKeyFrame.v !== t && (this.currentKeyFrame.v = t), this.propValue.setText(t.toFixed(1))
        } else this.propValue.setText("---")
    }, G.ModifyAnimationPropGroup.prototype.changeEasing0 = function() {
        if (this.currentKeyFrame) {
            if (this.currentKeyFrame.e) {
                var t = this.easings.indexOf(this.currentKeyFrame.e[0]);
                if (t + 1 == this.easings.length) this.currentKeyFrame.e = !1, this.easingLabel0.setText("--"), this.easingLabel1.setText("--");
                else {
                    this.currentKeyFrame.e[0] = this.easings[t + 1], this.easingLabel0.setText(this.easings[t + 1]);
                    var e = this.currentKeyFrame.e[1];
                    Phaser.Easing[this.easings[t + 1]][e] || (Phaser.Easing[this.easings[t + 1]].None ? this.currentKeyFrame.e[1] = "None" : Phaser.Easing[this.easings[t + 1]].In && (this.currentKeyFrame.e[1] = "In")), this.easingLabel1.setText(this.currentKeyFrame.e[1])
                }
            } else this.currentKeyFrame.e = ["Back", "In"], this.easingLabel0.setText("Back"), this.easingLabel1.setText("In");
            this.onChange.dispatch(this.currentObj, this.currentFrameNr)
        }
    }, G.ModifyAnimationPropGroup.prototype.changeEasing1 = function() {
        if (this.currentKeyFrame && this.currentKeyFrame.e) {
            var t = this.currentKeyFrame.e[1],
                e = Object.keys(Phaser.Easing[this.currentKeyFrame.e[0]]),
                i = e.indexOf(t);
            this.currentKeyFrame.e[1] = e[(i + 1) % e.length], this.easingLabel1.setText(this.currentKeyFrame.e[1]), this.onChange.dispatch(this.currentObj, this.currentFrameNr)
        }
    }, G.ModifyAnimationPropGroup.prototype.refresh = function(t, e) {
        this.currentObj = t, this.currentObj.currentAnimationName && (this.currentKeyFrame = t.getKeyFrameAt(t.propTLS[this.propKey], e), this.currentFrameNr = e, this.propValue.fill = "black", this.valAtRefresh = G.Utils.getObjProp(this.currentObj.SPR, this.propKey), this.currentKeyFrame ? (this.active = !0, this.alpha = 1, this.onOffBtn.setText("on"), this.currentKeyFrame.e ? (this.easingLabel0.setText(this.currentKeyFrame.e[0]), this.easingLabel1.setText(this.currentKeyFrame.e[1])) : (this.easingLabel0.setText("---"), this.easingLabel1.setText("---"))) : (this.onOffBtn.setText("off"), this.active = !1, this.alpha = .5, this.easingLabel0.setText("---"), this.easingLabel1.setText("---")))
    }, G.ModifyAnimationTL = function() {
        Phaser.Group.call(this, game), this.gfx = game.add.graphics(), this.add(this.gfx), this.tlGfx = game.add.graphics(), this.tlGfx.inputEnabled = !0, this.pointerPressed = !1, this.pointerStartFrame = 0, this.tlGfx.events.onInputDown.add(this.onDown, this), this.tlGfx.events.onInputUp.add(this.onUp, this), this.add(this.tlGfx), this.visible = !1, this.currentObj = null, this.frameWidth = 10, this.frameHeight = 50, this.tlPxWidth = 400, this.tlFrameLength = this.tlPxWidth / this.frameWidth, this.selectedFrame = null, this.frameOffset = 0, this.cursors = game.input.keyboard.createCursorKeys(), this.cursors.left.onDown.add(function() {
            this.frameOffset--, this.redrawTl()
        }, this), this.cursors.right.onDown.add(function() {
            this.frameOffset++, this.redrawTl()
        }, this), this.onFrameSelected = new Phaser.Signal
    }, G.ModifyAnimationTL.prototype = Object.create(Phaser.Group.prototype), G.ModifyAnimationTL.prototype.colors = [9904692, 35664, 4442599, 14712896, 14221104, 469920, 7079540, 13848281], G.ModifyAnimationTL.prototype.update = function() {
        if (this.pointerPressed) {
            var t = game.input.activePointer,
                e = Math.floor((t.x - this.tlGfx.worldPosition.x) / this.frameWidth);
            if (e !== this.pointerStartFrame) {
                var i = this.pointerStartFrame - e;
                this.frameOffset += i, this.pointerStartFrame = e, this.frameOffset = Math.max(0, this.frameOffset), this.redrawTl()
            }
        }
    }, G.ModifyAnimationTL.prototype.changeFrameWidth = function(t) {
        this.frameWidth = t, this.tlFrameLength = Math.floor(this.tlPxWidth / this.frameWidth), this.redrawTl()
    }, G.ModifyAnimationTL.prototype.changeTlPxWidth = function(t) {
        this.tlPxWidth = t, this.tlFrameLength = Math.floor(this.tlPxWidth / this.frameWidth), this.redrawTl()
    }, G.ModifyAnimationTL.prototype.open = function(t) {
        this.currentObj = t, this.visible = !0, this.redrawTl(), this.currentObj.stop()
    }, G.ModifyAnimationTL.prototype.onDown = function(t, e) {
        this.currentObj.pause();
        var i = Math.floor((e.x - this.tlGfx.worldPosition.x) / this.frameWidth);
        this.pointerStartFrame = i, this.pointerPressed = !0
    }, G.ModifyAnimationTL.prototype.onUp = function(t, e) {
        var i = Math.floor((e.x - this.tlGfx.worldPosition.x) / this.frameWidth);
        this.pointerStartFrame == i && (this.selectFrame(i), this.pointerStar), this.pointerPressed = !1
    }, G.ModifyAnimationTL.prototype.selectFrame = function(t) {
        this.selectedFrame = t + this.frameOffset, this.currentObj.updateAnimation(this.selectedFrame), this.redrawTl(), this.onFrameSelected.dispatch(this.currentObj, this.selectedFrame)
    }, G.ModifyAnimationTL.prototype.redrawTl = function() {
        if (this.tlGfx.clear(), this.currentObj && this.currentObj.currentAnimationName) {
            this.tlGfx.beginFill(14540253, 1), this.tlGfx.drawRect(0, 0, this.tlFrameLength * this.frameWidth, this.frameHeight), this.tlGfx.beginFill(10066329, 1);
            for (var t = this.frameOffset; t < this.frameOffset + this.tlFrameLength; t++) this.currentObj.isAnyKeyFrameAt(t) && (this.tlGfx.lineStyle(1, 0, 1), this.tlGfx.drawRect(this.frameWidth * t - this.frameOffset * this.frameWidth, 0, this.frameWidth, this.frameHeight)), t % 60 == 0 && (this.tlGfx.lineStyle(1, 0, .25), this.tlGfx.moveTo(this.frameWidth * t - this.frameOffset * this.frameWidth, 0), this.tlGfx.lineTo(this.frameWidth * t - this.frameOffset * this.frameWidth, this.frameHeight));
            this.tlGfx.lineStyle(0, 0, 0);
            for (t = 0; t < this.currentObj.eventTL.length; t++) {
                var e = this.currentObj.eventTL[t];
                this.tlGfx.beginFill(this.colors[0], 1), e.f >= this.frameOffset && e.f < this.frameOffset + this.tlFrameLength && this.tlGfx.drawRect(this.frameWidth * e.f - this.frameOffset * this.frameWidth, 0, this.frameWidth, 5)
            }
            for (t = 0; t < this.currentObj.frameTL.length; t++) {
                e = this.currentObj.frameTL[t];
                this.tlGfx.beginFill(this.colors[1], 1), e.f >= this.frameOffset && e.f < this.frameOffset + this.tlFrameLength && this.tlGfx.drawRect(this.frameWidth * e.f - this.frameOffset * this.frameWidth, 5, this.frameWidth, 5)
            }
            for (t = 0; t < this.currentObj.propKeys.length; t++) this.drawPropLine(this.currentObj.propTLS[this.currentObj.propKeys[t]], 15 + 5 * t, this.colors[2 + t]);
            null !== this.selectedFrame && this.selectedFrame >= this.frameOffset && this.selectedFrame < this.frameOffset + this.tlFrameLength && (this.tlGfx.beginFill(255, .5), this.tlGfx.drawRect(this.frameWidth * this.selectedFrame - this.frameOffset * this.frameWidth, 0, this.frameWidth, this.frameHeight))
        }
    }, G.ModifyAnimationTL.prototype.drawPropLine = function(t, e, i) {
        for (var s, a = .5 * this.frameWidth, n = 0; n < t.length; n++) {
            var o = t[n];
            if (s = o.f * this.frameWidth + .5 * this.frameWidth - this.frameOffset * this.frameWidth, this.tlGfx.lineStyle(0, 0, 0), !(o.f < this.frameOffset)) {
                var r = t[n - 1];
                if (r && r.e && (this.tlGfx.lineStyle(2, i, 1), this.tlGfx.moveTo(0, e), this.tlGfx.lineTo(Math.min(this.tlFrameLength * this.frameWidth, o.f * this.frameWidth - this.frameOffset * this.frameWidth), e)), !(o.f >= this.frameOffset + this.tlFrameLength))
                    if (o.e) {
                        if (this.tlGfx.beginFill(i, 1), this.tlGfx.drawCircle(s, e, a), t[n + 1]) {
                            this.tlGfx.lineStyle(2, i, 1), this.tlGfx.moveTo(s, e);
                            var h = t[n + 1].f * this.frameWidth - this.frameOffset * this.frameWidth;
                            h = Math.min(this.tlFrameLength * this.frameWidth, h), this.tlGfx.lineTo(h, e)
                        }
                    } else this.tlGfx.endFill(), this.tlGfx.lineStyle(2, i, 1), this.tlGfx.drawCircle(s, e, a - 2)
            }
        }
    }, G.ModifyBottomBar = function() {
        Phaser.Group.call(this, game), this.modify = G.Modify.instance, this.gfx = game.add.graphics(), this.gfx.beginFill(13421772, 1), this.gfx.drawRect(0, 0, 3e3, 30), this.gfx.inputEnabled = !0, this.gfx.events.onInputDown.add(function() {}), this.add(this.gfx);
        var t = {
            font: "Verdana",
            fontSize: 15,
            fontWeight: "bold"
        };
        this.buttons = [G.Utils.makeTextButton(10, 5, "+GROUP", this.modify.addGroup, this.modify, t), G.Utils.makeTextButton(90, 5, "+IMG", this.modify.addImage, this.modify, t), G.Utils.makeTextButton(160, 5, "+OneLine", this.modify.addOneLineText, this.modify, t), G.Utils.makeTextButton(260, 5, "+MultiLine", this.modify.addMultiLineText, this.modify, t), G.Utils.makeTextButton(360, 5, "+BTN", this.modify.addButton, this.modify, t), G.Utils.makeTextButton(450, 5, "REMOVE", this.modify.removeObject, this.modify, t), G.Utils.makeTextButton(600, 5, "EXPORT LVL STR", this.modify.exportLvlAsString, this.modify, t)], this.addMultiple(this.buttons)
    }, G.ModifyBottomBar.prototype = Object.create(Phaser.Group.prototype), G.ModifyButtonGroup = function() {
        Phaser.Group.call(this, game), this.modify = G.Modify.instance, this.fixedToCamera = !0, this.gfx = this.add(game.add.graphics()), this.transformButtons = this.add(game.add.group()), this.changeObjButtons = this.add(game.add.group()), this.mode = 0, this.tabKey = game.input.keyboard.addKey(Phaser.Keyboard.TAB), this.tabKey.onDown.add(function() {
            this.gfx.clear(), this.mode = (this.mode + 1) % 2, this.transformButtons.visible = 0 == this.mode, this.changeObjButtons.visible = 1 == this.mode
        }, this), this.keys = {
            ALT: game.input.keyboard.addKey(Phaser.Keyboard.ALT)
        }, this.clickedButton = null, this.clickedPos = null, this.posButton = game.add.button(0, 0, null), this.posButton.onInputDown.add(function() {
            this.clickedButton = this.posButton, this.clickedPos = {
                x: game.input.activePointer.x,
                y: game.input.activePointer.y
            }
        }, this), this.posButton.anchor.setTo(.5, .5), this.transformButtons.add(this.posButton), this.scaleButton = game.add.button(0, 0, null), this.scaleButton.onInputDown.add(function() {
            this.clickedButton = this.scaleButton, this.clickedPos = {
                x: game.input.activePointer.x,
                y: game.input.activePointer.y
            }
        }, this), this.scaleButton.anchor.setTo(.5, .5), this.transformButtons.add(this.scaleButton), this.rotateButton = game.add.button(0, 0, null), this.rotateButton.onInputDown.add(function() {
            this.clickedButton = this.rotateButton, this.clickedPos = {
                x: game.input.activePointer.x,
                y: game.input.activePointer.y
            }
        }, this), this.rotateButton.anchor.setTo(.5, .5), this.transformButtons.add(this.rotateButton), this.refreshChangeObjButtons(), this.modify.onLevelObjChange.add(this.refreshChangeObjButtons, this), this.modify.onObjDestroy.add(this.refreshChangeObjButtons, this)
    }, G.ModifyButtonGroup.prototype = Object.create(Phaser.Group.prototype), G.ModifyButtonGroup.prototype.update = function() {
        0 == this.mode ? (this.updateTransformButtons(), this.transformButtons.ignoreChildInput = !1, this.changeObjButtons.ignoreChildInput = !0) : (this.transformButtons.ignoreChildInput = !0, this.changeObjButtons.ignoreChildInput = !1, this.updateChangeObjButtons())
    }, G.ModifyButtonGroup.prototype.updateTransformButtons = function() {
        var t = this.modify.getCurrentObject();
        if (!t) return this.posButton.position.setTo(-9999, -9999), this.scaleButton.position.setTo(-9999, -9999), void this.rotateButton.position.setTo(-9999, -9999);
        var e = t.getBounds(),
            i = t.getLocalBounds(),
            s = game.input.activePointer;
        if (this.posButton.x = t.worldPosition.x, this.posButton.y = t.worldPosition.y, this.scaleButton.x = t.worldPosition.x + i.x * t.scale.x + e.width * t.scale.x + 20, this.scaleButton.y = t.worldPosition.y + i.y * t.scale.y + e.height * t.scale.y + 20, this.rotateButton.x = t.worldPosition.x + i.x * t.scale.x - 20, this.rotateButton.y = t.worldPosition.y + i.y * t.scale.y - 20, this.gfx.clear(), this.gfx.lineStyle(1, 0, 1), this.gfx.beginFill(16711680, 1), this.gfx.drawCircle(this.posButton.worldPosition.x, this.posButton.worldPosition.y, 10), this.gfx.endFill(), this.gfx.beginFill(65280, 1), this.gfx.drawCircle(this.scaleButton.worldPosition.x, this.scaleButton.worldPosition.y, 10), this.gfx.endFill(), this.gfx.beginFill(255, 1), this.gfx.drawCircle(this.rotateButton.worldPosition.x, this.rotateButton.worldPosition.y, 10), this.gfx.endFill(), this.clickedButton)
            if (s.isDown) {
                var a = s.x - this.clickedPos.x,
                    n = s.y - this.clickedPos.y;
                this.clickedButton === this.posButton && (this.modify.modifyCurrentObjProp("x", t.x + a), this.modify.modifyCurrentObjProp("y", t.y + n)), this.clickedButton === this.scaleButton && (this.modify.modifyCurrentObjProp("width", t.width + a), this.modify.modifyCurrentObjProp("height", t.height + n), this.keys.ALT.isDown && this.modify.modifyCurrentObjProp("scale.y", t.scale.x)), this.clickedButton === this.rotateButton && this.modify.modifyCurrentObjProp("angle", t.angle + .25 * a), this.clickedPos = {
                    x: game.input.activePointer.x,
                    y: game.input.activePointer.y
                }
            } else this.modify.modifyCurrentObjProp("x", 5 * Math.floor(t.x / 5)), this.modify.modifyCurrentObjProp("y", 5 * Math.floor(t.y / 5)), this.modify.modifyCurrentObjProp("scale.x", .025 * Math.floor(t.scale.x / .025)), this.modify.modifyCurrentObjProp("scale.y", .025 * Math.floor(t.scale.y / .025)), this.modify.modifyCurrentObjProp("angle", Math.floor(t.angle)), this.clickedButton = null
    }, G.ModifyButtonGroup.prototype.updateChangeObjButtons = function() {
        this.gfx.clear(), this.gfx.beginFill(65280, 1), this.gfx.lineStyle(3, 16711680, 1);
        for (var t = 0; t < this.changeObjButtons.length; t++) {
            var e = this.changeObjButtons.children[t];
            this.gfx.drawCircle(e.worldPosition.x, e.worldPosition.y, 10)
        }
    }, G.ModifyButtonGroup.prototype.refreshChangeObjButtons = function() {
        this.changeObjButtons.removeAll(!0);
        for (var t = this.modify.getCurrentLevelObject(), e = 0; e < t.children.length; e++)
            if (t.children[e] != this.modify) {
                var i = t.children[e],
                    s = game.make.button(0, 0, null);
                this.changeObjButtons.add(s), s.attachement = i, s.modify = this.modify, s.position = i.worldPosition, s.hitArea = new Phaser.Circle(0, 0, 10), s.onInputDown.add(function() {
                    this.modify.setNewCurrentChildren(this.attachement)
                }, s)
            }
    }, G.ModifyChildList = function() {
        Phaser.Group.call(this, game), this.fixedToCamera = !0, this.modify = G.Modify.instance, this.levelTxt = game.add.text(20, 0, "", {
            font: "Verdana",
            fontSize: 20
        }), this.levelTxtBack = game.add.text(0, 0, "<", {
            font: "Verdana",
            backgroundColor: "rgba(0,255,0,0.5)",
            fontSize: 20,
            fontWeight: "bold"
        }), this.levelTxtBack.visible = !1, this.levelTxtBack.inputEnabled = !0, this.levelTxtBack.input.useHandCursor = !0, this.levelTxtBack.events.onInputDown.add(function() {
            this.modify.currentLevelGoUp()
        }, this), this.add(this.levelTxtBack), this.add(this.levelTxt), this.listGroup = this.add(game.add.group()), this.listGroup.y = 40, this.makeList(), this.currentLevelObj = this.modify.getCurrentLevelObject(), this.currentObj = this.modify.getCurrentObject(), this.modify.onLevelObjChange.add(this.makeList, this), this.modify.onCurrentObjChange.add(this.refreshTexts, this), this.modify.onObjDestroy.add(this.makeList)
    }, G.ModifyChildList.prototype = Object.create(Phaser.Group.prototype), G.ModifyChildList.prototype.hideList = function() {
        this.listGroup.visible = !1
    }, G.ModifyChildList.prototype.showList = function() {
        this.listGroup.visible = !0
    }, G.ModifyChildList.prototype.makeList = function() {
        var t = this.modify.getCurrentLevelObject();
        this.listGroup.removeAll();
        for (var e = 0; e < this.modify.childrenPropNames.length; e++) {
            var i = t.children[e].children && 0 < t.children[e].children.length || t.children[e].constructor === Phaser.Group,
                s = t.children[e].constructor == G.OneLineText || t.children[e].constructor == G.MultiLineText,
                a = "";
            i && (a = "(" + (G.countChildren(t.children[e]) - 1) + ")");
            var n = game.make.text(0, 20 * e, this.modify.childrenPropNames[e].join(".") + a, {
                    font: "Verdana",
                    fontSize: 15,
                    backgroundColor: "rgba(221,221,221,0.5)",
                    fontWeight: "bold"
                }),
                o = "G.MODIFY-EDITOR" == this.modify.childrenPropNames[e].join(".");
            if (!s && !o && i) {
                var r = game.make.text(n.width + 10, 0, "+", {
                    font: "Verdana",
                    fontSize: 15,
                    backgroundColor: "rgba(200,255,200,0.75)",
                    fontWeight: "bold"
                });
                n.addChild(r), r.txtBtn = n, r.modify = this.modify, r.childList = this, r.indexChild = e, r.inputEnabled = !0, r.input.useHandCursor = !0, r.hitArea = new Phaser.Rectangle(0, 0, r.width, r.height), r.events.onInputDown.add(function() {
                    this.modify.currentLevelGoDown(this.indexChild)
                }, r)
            }
            this.listGroup.add(n), o || (n.inputEnabled = !0, n.indexChild = e, n.childList = this, n.modify = this.modify, n.hitArea = new Phaser.Rectangle(0, 0, n.width, n.height), n.input.useHandCursor = !0, n.events.onInputDown.add(function() {
                this.modify.changeCurrentChildrenIndex(this.indexChild)
            }, n))
        }
        this.refreshTexts()
    }, G.ModifyChildList.prototype.refreshTexts = function() {
        this.levelTxt.setText(this.modify.currentLevel.join("/") || this.modify.currentLevel[0] || game.state.current), this.levelTxtBack.visible = this.levelTxt.text !== game.state.current;
        for (var t = 0; t < this.listGroup.length; t++) {
            var e = this.listGroup.children[t];
            this.modify.currentChildIndex == t ? (e.x = 10, "rgba(221,221,221,0.5)" === e.style.backgroundColor && (e.style.backgroundColor = "rgba(180,180,255,1)", e.updateText())) : (e.x = 0, "rgba(180,180,255,1)" === e.style.backgroundColor && (e.style.backgroundColor = "rgba(221,221,221,0.5)", e.updateText()))
        }
    }, G.ModifyCodeGenerator = function(t) {
        this.modify = t
    }, G.ModifyCodeGenerator.prototype.start = function(t) {
        this.constStr = "";
        var e = this.generateCode(t),
            i = this.constStr + "\n\n" + e;
        G.Utils.copyToClipboard(i), console.log(i)
    }, G.ModifyCodeGenerator.prototype.generateCode = function(t, e) {
        return G.OneLineText && t instanceof G.OneLineText ? this.generateCodeOneLineText(t, e) : G.MultiLineText && t instanceof G.MultiLineText ? this.generateCodeMultiLineText(t, e) : G.Button && t instanceof G.Button ? this.generateCodeButton(t, e) : t instanceof Phaser.Group && !(t instanceof Phaser.BitmapText) ? t.___CONSTRUCTOR ? this.generateConstructorCode(t, e) : this.generateGroupCode(t, e) : this.generateCodeImage(t, e)
    }, G.ModifyCodeGenerator.prototype.generateConstructorCode = function(t, e, i) {
        var s = this.getObjName(t),
            a = G.capitalize(s),
            n = "";
        n += "G." + a + " = function(x,y){\n", n += "\tPhaser.Group.call(this,game);\n", n += "\tthis.position.setTo(x,y);\n", n += this.generateCodeUniProp(t, "this"), n += "\n";
        for (var o = 0; o < t.children.length; o++) n += "\t" + this.generateCode(t.children[o], "this"), n += "\n";
        n += "};\n", n += "G." + a + ".prototype = Object.create(Phaser.Group.prototype);\n\n", this.constStr += n;
        var r = (e ? e + "." : "var ") + "%NAME% = new G." + a + "(^x^,^y^);\n";
        return e && (r += e + ".add(" + e + ".%NAME%);\n"), r = G.Utils.replaceAll(r, "%NAME%", s), r = this.injectObjPropToString(t, r)
    }, G.ModifyCodeGenerator.prototype.generateGroupCode = function(t, e) {
        var i = this.getObjName(t),
            s = (e ? e + "." : "var ") + "%NAME% = game.add.group();\n";
        s += (e ? e + "." : "") + "%NAME%.position.setTo(^x^,^y^);\n", s += this.generateCodeUniProp(t, e), e && (s += e + ".add(" + e + ".%NAME%);\n");
        for (var a = 0; a < t.children.length; a++) {
            var n = this.generateCode(t.children[a], (e ? e + "." : "") + i, !0);
            s += G.Utils.replaceAll(n, "this", "%NAME%")
        }
        return s = G.Utils.replaceAll(s, "%NAME%", i), this.injectObjPropToString(t, s)
    }, G.ModifyCodeGenerator.prototype.generateGroupConstructor = function(t) {}, G.ModifyCodeGenerator.prototype.generateChildrensCode = function(t) {}, G.ModifyCodeGenerator.prototype.generateCodeButton = function(t, e) {
        var i = "";
        return i += ((e = e || "") ? e + "." : "var ") + "%NAME% = new G.Button(^x^,^y^,'^frameName^',function(){},this);\n", i += (e ? e + "." : "") + "add(" + (e ? e + "." : "var ") + "%NAME%);\n", i += this.generateCodeUniProp(t, e), i = G.Utils.replaceAll(i, "%NAME%", this.getObjName(t)), this.injectObjPropToString(t, i)
    }, G.ModifyCodeGenerator.prototype.generateCodeImage = function(t, e) {
        var i = "";
        return i += (e ? e + "." : "var ") + "%NAME% = G.makeImage(^x^,^y^,'^frameName^',[^anchor.x^,^anchor.y^]," + e + ");\n", i += this.generateCodeUniProp(t, e), i = G.Utils.replaceAll(i, "%NAME%", this.getObjName(t)), this.injectObjPropToString(t, i)
    }, G.ModifyCodeGenerator.prototype.generateCodeOneLineText = function(t, e) {
        var i = "";
        return i += (e ? e + "." : "var ") + "%NAME% = new G.OneLineText(^x^,^y^,'^font^','^text^',^fontSize^,^maxUserWidth^,^anchor.x^,^anchor.y^);\n", i += (e ? e + "." : "") + "add(" + (e ? e + "." : "var ") + "%NAME%);\n", i += this.generateCodeUniProp(t, e), i = G.Utils.replaceAll(i, "%NAME%", this.getObjName(t)), this.injectObjPropToString(t, i)
    }, G.ModifyCodeGenerator.prototype.generateCodeMultiLineText = function(t, e) {
        var i = "";
        return i += (e ? e + "." : "var ") + "%NAME% = new G.MultiLineText(^x^,^y^,'^font^','^text^',^fontSize^,^maxUserWidth^,^maxUserHeight^,'^align^',^anchor.x^,^anchor.y^);\n", i += (e ? e + "." : "") + "add(" + (e ? e + "." : "var ") + "%NAME%);\n", i += this.generateCodeUniProp(t, e), i = G.Utils.replaceAll(i, "%NAME%", this.getObjName(t)), this.injectObjPropToString(t, i)
    }, G.ModifyCodeGenerator.prototype.getObjName = function(t) {
        if (t.___LABEL) return t.___LABEL;
        var e = prompt("enter name");
        return t.___LABEL = e
    }, G.ModifyCodeGenerator.prototype.generateCodeUniProp = function(t, e) {
        var i = "";
        return e = e ? e + "." : "", 1 === t.scale.x && 1 === t.scale.y || (i += e + "%NAME%.scale.setTo(^scale.x^, ^scale.y^);\n"), 0 !== t.angle && (i += e + "%NAME%.angle = ^angle^;\n"), 1 !== t.alpha && (i += e + "%NAME%.alpha = ^alpha^;\n"), t.fixedToCamera && (i += e + "%NAME%.fixedToCamera = true;\n", i += e + "%NAME%.cameraOffset.setTo(^cameraOffset.x^,^cameraOffset.y^);\n"), i
    }, G.ModifyCodeGenerator.prototype.injectObjPropToString = function(t, e) {
        for (;;) {
            var i = e.indexOf("^"),
                s = e.indexOf("^", i + 1);
            if (-1 == i) break;
            var a = e.slice(i, s + 1),
                n = e.slice(i + 1, s);
            e = e.replace(a, G.Utils.getObjProp(t, n))
        }
        return e
    }, G.ModifyDOMLayer = function(t) {
        this.modify = t, this.openElement = null, this.extraDataDiv = this.initExtraDataDiv(), this.inputDataDiv = this.initInputDiv()
    }, G.ModifyDOMLayer.prototype.closeCurrent = function() {
        game.time.events.add(1, function() {
            game.input.enabled = !0
        }), this.openElement.style.display = "none", game.canvas.focus()
    }, G.ModifyDOMLayer.prototype.initExtraDataDiv = function() {
        var dataInputDiv = document.createElement("DIV");
        dataInputDiv.style.backgroundColor = "green", dataInputDiv.style.left = "10%", dataInputDiv.style.top = "10%", dataInputDiv.style.position = "fixed", dataInputDiv.style.width = "80%", dataInputDiv.style.height = "80%";
        var input = document.createElement("TEXTAREA");
        return input.style.marginTop = "2%", input.style.marginLeft = "2%", input.style.width = "95%", input.style.height = "94%", input.style.resize = "none", input.onkeydown = function(e) {
            var textarea = e.target,
                div = dataInputDiv;
            if (game.time.events.add(1, function() {
                    try {
                        eval("var tmp = " + textarea.value), "object" == typeof tmp ? (div.style.backgroundColor = "green", div.proper = !0) : (div.style.backgroundColor = "red", div.proper = !1)
                    } catch (t) {
                        div.style.backgroundColor = "red", div.proper = !1
                    }
                }), 9 == e.keyCode || 9 == e.which) {
                e.preventDefault();
                var s = textarea.selectionStart;
                textarea.value = textarea.value.substring(0, textarea.selectionStart) + "\t" + textarea.value.substring(textarea.selectionEnd), textarea.selectionEnd = s + 1
            }
            if (83 == e.keyCode && e.ctrlKey) return e.preventDefault(), div.proper && (this.closeCurrent(), div.callback.call(div.context, textarea.value)), !1;
            27 == e.keyCode && this.closeCurrent()
        }.bind(this), dataInputDiv.textarea = input, dataInputDiv.appendChild(input), document.body.appendChild(dataInputDiv), dataInputDiv.style.display = "none", dataInputDiv.style.position = "fixed", dataInputDiv
    }, G.ModifyDOMLayer.prototype.openExtraData = function(t, e, i, s) {
        console.log("openExtraData"), this.openElement = this.extraDataDiv, this.extraDataDiv.style.backgroundColor = "green", this.extraDataDiv.callback = i || function() {}, this.extraDataDiv.context = s || this, this.extraDataDiv.style.display = "block", game.input.enabled = !1, e ? "object" == typeof e && (e = JSON.stringify(e, null, "\t")) : e = "", this.extraDataDiv.textarea.value = e, game.time.events.add(1, function() {
            this.extraDataDiv.textarea.focus()
        }, this)
    }, G.ModifyDOMLayer.prototype.initInputDiv = function() {
        var a = document.createElement("DIV");
        a.style.backgroundColor = "gray", a.style.left = "30%", a.style.top = "10%", a.style.position = "fixed", a.style.width = "40%", a.style.textAlign = "center", a.style.padding = "10px", a.style.fontFamily = "Verdana";
        var t = document.createElement("h3"),
            e = document.createElement("SPAN");
        e.style.float = "right";
        var i = document.createElement("SPAN");
        i.style.float = "left", t.innerHTML = "";
        var s = document.createElement("INPUT");
        return s.style.width = "90%", s.style.fontSize = "25px", s.onkeydown = function(t) {
            var e = t.target,
                i = a;
            if (83 == t.keyCode && t.ctrlKey || 13 == t.keyCode) {
                t.preventDefault();
                var s = i.filter(e.value);
                return void 0 === s ? (i.style.backgroundColor = "red", game.time.events.add(50, function() {
                    i.style.backgroundColor = "gray"
                })) : (this.closeCurrent(), i.callback.call(i.context, s)), !1
            }
            27 == t.keyCode && this.closeCurrent()
        }.bind(this), a.appendChild(t), a.appendChild(s), a.appendChild(e), a.appendChild(i), document.body.appendChild(a), a.span = t, a.textarea = s, a.input = s, a.filterLabel = e, a.initValue = i, a.filters = {
            number: function(t) {
                var e = parseFloat(t);
                return isNaN(e) ? void 0 : e
            },
            string: function(t) {
                if (0 != t.length) return t
            },
            none: function(t) {
                return t
            }
        }, a.style.display = "none", a.style.position = "fixed", a
    }, G.ModifyDOMLayer.prototype.openInputDiv = function(t, e, i, s, a) {
        this.inputDataDiv || this.initInputArea(), this.openElement = this.inputDataDiv, this.inputDataDiv.style.display = "block", game.input.enabled = !1, this.inputDataDiv.span.innerHTML = t || "", this.inputDataDiv.input.value = e, this.inputDataDiv.callback = i || function() {}, this.inputDataDiv.context = s || this, a = a || "none", this.inputDataDiv.filter = this.inputDataDiv.filters[a], this.inputDataDiv.filterLabel.innerHTML = a, this.inputDataDiv.initValue.innerHTML = "init val: " + e, game.time.events.add(1, function() {
            this.inputDataDiv.input.focus(), this.inputDataDiv.input.select()
        }, this)
    }, G.ModifyFrameSelector = function() {
        Phaser.Group.call(this, game), this.panelWidth = 300, this.gfx = game.make.graphics(), this.add(this.gfx), this.gfx.beginFill(14540253, 1), this.gfx.drawRect(0, 0, this.panelWidth, game.height), this.gfx.inputEnabled = !0, this.gfx.events.onInputDown.add(function() {}), this.framesBtns = [], this.framesGroup = this.add(game.add.group()), this.framesGroup.y = 50, this.topGroup = this.add(this.createTopBar()), this.bottomGroup = this.add(this.createBottomBar()), this.opened = !1, this.onFrameClicked = new Phaser.Signal
    }, G.ModifyFrameSelector.prototype = Object.create(Phaser.Group.prototype), G.ModifyFrameSelector.prototype.open = function() {
        this.opened = !0
    }, G.ModifyFrameSelector.prototype.close = function() {
        this.opened = !1
    }, G.ModifyFrameSelector.prototype.update = function() {
        this.opened ? this.x = game.world.bounds.x + game.width - this.panelWidth : this.x = game.world.bounds.x + game.width, this.bottomGroup.y = game.world.bounds.y + game.height - this.bottomGroup.height
    }, G.ModifyFrameSelector.prototype.loadAtlas = function(t) {
        var e = this.panelWidth / 5;
        this.framesGroup.removeAll();
        for (var i = "__singleImages" == t ? this.__singleImages : game.cache.getFrameData(t)._frames, s = 0; s < i.length; s++) {
            var a = s % 5,
                n = Math.floor(s / 5),
                o = i[s].name;
            this.createFrameButton(a * e, n * e, o, e, "__singleImages" == t)
        }
    }, G.ModifyFrameSelector.prototype.createBottomBar = function() {
        var e = game.add.group();
        e.gfx = game.add.graphics(), e.gfx.beginFill(13421772, 1), e.gfx.drawRect(0, 0, this.panelWidth, 20), e.gfx.inputEnabled = !0, e.gfx.events.onInputDown.add(function() {}), e.add(e.gfx);
        var t = {
                font: "Verdana",
                fontSize: 15,
                fontWeight: "bold"
            },
            i = [game.make.text(10, 2, "UP", t), game.make.text(10 + .3 * this.panelWidth, 2, "DOWN", t), game.make.text(10 + .6 * this.panelWidth, 2, "CLOSE", t)];
        return i.forEach(function(t) {
            e.add(t), t.inputEnabled = !0, t.hitArea = new Phaser.Rectangle(0, 0, t.width, t.height), t.input.useHandCursor = !0
        }), i[0].events.onInputDown.add(function() {
            this.framesGroup.y += 300, this.framesGroup.y = Math.min(50, this.framesGroup.y)
        }, this), i[1].events.onInputDown.add(function() {
            this.framesGroup.y -= 300, this.framesGroup.y = Math.min(this.framesGroup.y, -(this.framesGroup.height - game.height))
        }, this), i[2].events.onInputDown.add(function() {
            this.opened = !1
        }, this), e
    }, G.ModifyFrameSelector.prototype.createTopBar = function() {
        var t = game.add.group();
        (this.topGroup = t).gfx = game.add.graphics(), t.gfx.beginFill(13421772, 1), t.gfx.drawRect(0, 0, this.panelWidth, 25), t.gfx.inputEnabled = !0, t.gfx.events.onInputDown.add(function() {}), t.add(t.gfx);
        var e = game.cache._cache.image;
        this.__singleImages = [];
        var i = 0;
        for (prop in e) "_" == prop[0] && "_" == prop[1] || (e[prop].frame ? this.__singleImages.push({
            name: e[prop].key
        }) : (this.createAtlasButton(5 + 25 * i, 2, i + 1, prop), i++));
        return this.createAtlasButton(5 + 25 * i + 10, 2, "img", "__singleImages"), t
    }, G.ModifyFrameSelector.prototype.createAtlasButton = function(t, e, i, s) {
        var a = game.make.text(t, e, i, {
            font: "Verdana",
            fontSize: 15,
            fontWeight: "bold"
        });
        this.topGroup.add(a), a.inputEnabled = !0, a.atlas = s, a.hitArea = new Phaser.Rectangle(0, 0, a.width, a.height), a.input.useHandCursor = !0, a.frameSelector = this, a.events.onInputDown.add(function() {
            this.frameSelector.framesGroup.y = 50, this.frameSelector.loadAtlas(this.atlas)
        }, a)
    }, G.ModifyFrameSelector.prototype.createFrameButton = function(t, e, i, s, a) {
        var n = G.makeImage(t, e, i, 0, this.framesGroup);
        n.inputEnabled = !0, n.FS = this, n.singleImgs = a, n.events.onInputDown.add(function() {
            console.log(this.key), this.FS.onFrameClicked.dispatch(this.singleImgs ? this.key : this.frameName)
        }, n), n.input.useHandCursor = !0, n.width > n.height ? (n.width = .95 * s, n.scale.y = n.scale.x) : (n.height = .95 * s, n.scale.x = n.scale.y)
    }, G.ModifyInputBlocked = function() {
        Phaser.Graphics.call(this, game, 0, 0), this.beginFill(16711680, 1e-4), this.drawRect(0, 0, 5e3, 4e3), this.inputEnabled = !0, this.events.onInputDown.add(function() {}), this.fixedToCamera = !0
    }, G.ModifyInputBlocked.prototype = Object.create(Phaser.Graphics.prototype), G.ModifyPropButton = function(t, e, i, s, a, n, o) {
        Phaser.Text.call(this, game, e, i, s + ": ", {
            font: "Verdana",
            backgroundColor: "rgba(255,255,255,0.5)",
            fontSize: 15
        }), this.label = s, this.modify = t, "string" == typeof a ? this.refreshProp = a.split(".") : this.refreshFunc = a, "string" == typeof n ? (this.filterProperty = n.slice(0, n.indexOf(":")), this.setProp = n.slice(n.indexOf(":") + 1).split("."), this.setFunc = this.openInput) : this.setFunc = n, this.postSet = o, this.inputEnabled = !0, this.input.useHandCursor = !0, this.events.onInputDown.add(this.setFunc, this)
    }, G.ModifyPropButton.prototype = Object.create(Phaser.Text.prototype), G.ModifyPropButton.prototype.setFunc = function() {
        var t = this.modify.getCurrentObject();
        if (t) {
            var e = this[this.askFunc]();
            null !== e && (this.modify.modifyCurrentObjProp(this.refreshProp, e), this.postSet && this.postSet(t, e))
        }
    }, G.ModifyPropButton.prototype.openInput = function() {
        var e = this.modify.getCurrentObject();
        this.modify.domLayer.openInputDiv((e.___LABEL || "obj") + " | " + this.setProp, G.Utils.getObjProp(e, this.setProp), function(t) {
            this.modify.modifyCurrentObjProp(this.refreshProp, t), this.postSet && this.postSet(e, t)
        }, this, this.filterProperty)
    }, G.ModifyPropButton.prototype.refreshFunc = function(t) {
        if (this.setText(this.label + ": ---"), t = this.modify.getCurrentObject()) {
            this.visible = !0;
            var e = G.Utils.getObjProp(t, this.refreshProp);
            void 0 === e ? this.visible = !1 : ("number" == typeof e && (e = e.toFixed(2)), this.setText(this.label + ": " + e))
        }
    }, G.ModifyPropButton.prototype.int = function() {
        var t = prompt(this.label || "int"),
            e = parseInt(t);
        return isNaN(e) ? null : e
    }, G.ModifyPropButton.prototype.float = function() {
        var t = prompt(this.label || "float"),
            e = parseFloat(t);
        return isNaN(e) ? null : parseFloat(e.toFixed(2))
    }, G.ModifyPropButton.prototype.string = function() {
        return prompt(this.label || "string")
    }, G.ModifyPropGroup = function(modify) {
        Phaser.Group.call(this, game), this.fixedToCamera = !0;
        var x = new G.ModifyPropButton(modify, 10, 10, "x", "x", "number:x");
        this.add(x);
        var y = new G.ModifyPropButton(modify, 10, 30, "y", "y", "number:y");
        this.add(y);
        var width = new G.ModifyPropButton(modify, 10, 50, "width", "width", "number:width");
        this.add(width);
        var height = new G.ModifyPropButton(modify, 10, 70, "height", "height", "number:height");
        this.add(height);
        var scaleX = new G.ModifyPropButton(modify, 10, 90, "scale.x", "scale.x", "number:scale.x");
        this.add(scaleX);
        var scaleY = new G.ModifyPropButton(modify, 10, 110, "scale.y", "scale.y", "number:scale.y");
        this.add(scaleY);
        var angle = new G.ModifyPropButton(modify, 10, 130, "angle", "angle", "number:angle");
        this.add(angle);
        var alpha = new G.ModifyPropButton(modify, 10, 150, "alpha", "alpha", "number:alpha");
        this.add(alpha);
        var visible = new G.ModifyPropButton(modify, 10, 170, "visible", "visible", function() {
            var t = this.modify.getCurrentObject();
            this.modify.modifyCurrentObjProp("visible", !t.visible)
        });
        this.add(visible);
        var anchorX = new G.ModifyPropButton(modify, 10, 190, "anchor.x", "anchor.x", "number:anchor.x");
        this.add(anchorX);
        var anchorY = new G.ModifyPropButton(modify, 10, 210, "anchor.y", "anchor.y", "number:anchor.y");
        this.add(anchorY);
        var frame = new G.ModifyPropButton(modify, 10, 230, "frame", "frameName", function() {
            modify.frameSelector.open()
        });
        this.add(frame);
        var fontSize = new G.ModifyPropButton(modify, 10, 250, "fontSize", "fontSize", "number:fontSize", function(t, e) {
            t.cacheAsBitmap && (t.orgFontSize = e, t.setText && t.setText(t.text)), t.refresh && t.refresh()
        });
        this.add(fontSize);
        var font = new G.ModifyPropButton(modify, 10, 270, "font", "font", function() {
            var t = this.modify.getCurrentObject(),
                e = Object.keys(game.cache._cache.bitmapFont),
                i = e.indexOf(t.font);
            this.modify.modifyCurrentObjProp("font", e[(i + 1) % e.length]), t.cacheAsBitmap && t.setText && t.setText(t.text), t.refresh && t.refresh()
        });
        this.add(font);
        var text = new G.ModifyPropButton(modify, 10, 290, "text", "text", "string:text", function(t) {
            t.cacheAsBitmap && t.setText && t.setText(t.text)
        });
        this.add(text);
        var maxUserWidth = new G.ModifyPropButton(modify, 10, 310, "maxUserWidth", "maxUserWidth", "number:maxUserWidth", function(t, e) {
            t.cacheAsBitmap && t.setText(t.text)
        });
        this.add(maxUserWidth);
        var maxUserHeight = new G.ModifyPropButton(modify, 10, 330, "maxUserHeight", "maxUserHeight", "number:maxUserHeight", function(t, e) {
            t.cacheAsBitmap && t.setText(t.text)
        });
        this.add(maxUserHeight);
        var fixedToCamera = new G.ModifyPropButton(modify, 10, 350, "fixedToCamera", "fixedToCamera", function() {
            var t = this.modify.getCurrentObject();
            this.modify.modifyCurrentObjProp("fixedToCamera", !t.fixedToCamera)
        });
        this.add(fixedToCamera);
        var cameraOffsetX = new G.ModifyPropButton(modify, 10, 370, "cameraOffset.x", "cameraOffset.x", "number:cameraOffset.x");
        this.add(cameraOffsetX);
        var cameraOffsetY = new G.ModifyPropButton(modify, 10, 390, "cameraOffset.y", "cameraOffset.y", "number:cameraOffset.y");
        this.add(cameraOffsetY);
        var data = new G.ModifyPropButton(modify, 10, 420, "EXTRA_DATA", function() {
            var t = this.modify.getCurrentObject();
            t && (t && t.___DATA ? this.setText(this.label + ": YES") : this.setText(this.label + ": ---"))
        }, function() {
            var obj = this.modify.getCurrentObject();
            this.modify.domLayer.openExtraData(obj.label, obj.___DATA || {}, function(newData) {
                if (newData) try {
                    eval("var tmp = " + newData), "object" == typeof tmp ? obj.___DATA = tmp : console.warn("extra data cannot be a string")
                } catch (t) {
                    console.warn("something went wrong with parsing value")
                } else delete obj.___DATA
            })
        });
        this.add(data)
    }, G.ModifyPropGroup.prototype = Object.create(Phaser.Group.prototype), G.ModifyPropGroup.prototype.update = function() {
        var i = 10;
        this.forEach(function(t, e) {
            t.refreshFunc(), t.visible && (t.y = i, i += 20)
        })
    }, void 0 === G && (G = {}), G.Mover = function(t) {
        Phaser.Group.call(this, game), this.groupToMove = t, this.currentIndex = 0, this.keys = game.input.keyboard.addKeys({
            z: Phaser.Keyboard.Z,
            x: Phaser.Keyboard.X,
            c: Phaser.Keyboard.C,
            minus: Phaser.Keyboard.MINUS,
            plus: Phaser.Keyboard.PLUS
        }), this.keys.plus.onDown.add(function() {
            this.grouptoMove && (this.currentIndex++, this.currentIndex = this.currentIndex % this.groupToMove.length)
        }, this), this.keys.minus.onDown.add(function() {
            this.grouptoMove && (this.currentIndex--, -1 == this.currentIndex && (this.currentIndex = this.groupToMove.length - 1))
        }, this), this.cursors = game.input.keyboard.createCursorKeys()
    }, G.Mover.prototype = Object.create(Phaser.Group.prototype), G.Mover.prototype.update = function() {
        if (this.groupToMove) {
            var t = 1;
            this.keys.z.isDown && (t = 5), this.keys.x.isDown && (t = 10), this.keys.c.isDown && (t = 20), this.cursors.up.isDown && (this.groupToMove.children[this.currentIndex].y -= t), this.cursors.down.isDown && (this.groupToMove.children[this.currentIndex].y += t), this.cursors.left.isDown && (this.groupToMove.children[this.currentIndex].x -= t), this.cursors.left.isDown && (this.groupToMove.children[this.currentIndex].x += t)
        }
    }, G.PointsLayer = function(t, e) {
        Phaser.Group.call(this, game), this.board = e, this.pointsCounter = t.pointsCounter, G.sb("displayPoints").add(this.onPointMade, this), this.deadArray = []
    }, G.PointsLayer.prototype = Object.create(Phaser.Group.prototype), G.PointsLayer.prototype.getFreeText = function() {
        var t;
        return 0 < this.deadArray.length ? t = this.deadArray.pop() : (t = new G.Text(0, 0, "0", {
            style: "font-blue",
            fontSize: "50px"
        }, .5, 500)).events.onKilled.add(this.onElemKilled, this), this.add(t), t
    }, G.PointsLayer.prototype.onElemKilled = function(t) {
        this === t.parent && (this.deadArray.push(t), this.removeChild(t))
    }, G.PointsLayer.prototype.onPointMade = function(t, e, i, s) {
        var a, n = this.getFreeText();
        n.revive(), n.target = this.pointsCounter, a = s && G.Text.styles["font-score-" + s] ? "font-score-" + s : "font-score-0", n.setStyle(a, !1), n.x = t, n.y = e, n.scale.setTo(1), n.alpha = 1, n.setText("+" + i.toString()), game.add.tween(n.scale).from({
            x: 0,
            y: 0
        }, 300, Phaser.Easing.Bounce.InOut, !0).onComplete.add(function() {
            var t = this.target.worldPosition.x + game.world.bounds.x,
                e = this.target.worldPosition.y;
            game.add.tween(this).to({
                x: t,
                y: e
            }, 500, Phaser.Easing.Sinusoidal.InOut, !0), game.add.tween(this.scale).to({
                x: 0,
                y: 0
            }, 300, Phaser.Easing.Cubic.In, !0, 500).onComplete.add(function() {
                this.kill()
            }, this)
        }, n)
    }, G.saveState = {
        ready: !1,
        onReadySignal: new Phaser.Signal,
        signals: {
            onGateOpened: new Phaser.Signal,
            onLifeAmountChanged: new Phaser.Signal
        },
        makeNewDataObject: function() {
            for (var t = {
                    coins: G.json.settings.coinsOnStart,
                    lives: G.json.settings.livesOnStart,
                    lastRefillDate: Date.now(),
                    mapVisibleCounter: 0,
                    lastDaily: Date.now(),
                    lastGiftCheck: 0,
                    firstTimeBtn: [!1, !1],
                    freeSpin: !0,
                    levels: [],
                    points: [],
                    gates: [],
                    sentLives: {},
                    packs: [],
                    items: [],
                    mapChests: [],
                    boosters: [],
                    globalGoals: [],
                    finishedTutorials: [],
                    startBoosterAnim: [!0, !0, !0, !0],
                    mute: !1,
                    version: 1,
                    whatsNewSaw: []
                }, e = 0; e < 10; e++) t.boosters[e] = G.json.settings.boostersOnStart;
            return G.firstTimePlay = !0, t
        },
        _reset: function() {
            G.saveState.data = G.saveState.makeNewDataObject(), this._mysteryGift_checkData(), G.saveState.save(), game.state.start("World")
        },
        _resetHard: function() {
            sdkHandler.trigger("save", {
                key: "cookie-crush-3",
                value: null,
                callback: function() {
                    window.location.reload()
                }
            }, this)
        },
        increaseMapVisibleCounter: function() {
            this.data.mapVisibleCounter++
        },
        wasInitPlayWithMeMsgSent: function(t) {
            return G.saveState.data.initPlayWithMeContexts || (G.saveState.data.initPlayWithMeContexts = []), -1 !== G.saveState.data.initPlayWithMeContexts.indexOf(t)
        },
        saveInitPlayWithMeMsgContext: function(t) {
            G.saveState.data.initPlayWithMeContexts || (G.saveState.data.initPlayWithMeContexts = []), G.saveState.data.initPlayWithMeContexts.push(t), G.saveState.save()
        },
        isChallengeAvailable: function() {
            void 0 === this.data.lastChallengeTry && (this.data.lastChallengeTry = 0);
            var t = new Date,
                e = new Date(this.data.lastChallengeTry);
            return t.getTime() > e.getTime() && t.toDateString() !== e.toDateString()
        },
        startChallenge: function() {
            this.data.lastChallengeTry = Date.now(), this.save()
        },
        getTimeToNextChallenge: function() {
            void 0 === this.data.lastChallengeTry && (this.data.lastChallengeTry = 0);
            var t = new Date;
            return t.setHours(0), t.setMinutes(0), t.setSeconds(0), t.setMilliseconds(0), t.getTime() + 864e5
        },
        getDailyChallengeLevel: function() {
            game.rnd.sow([this.getTimeToNextChallenge()]);
            var t = game.rnd.between(0, Math.max(30, this.getLastPassedLevelNr()));
            t = game.math.clamp(t, 0, G.json.levels.length - 1);
            var e = G.Utils.clone(G.json.levels[t]);
            return e.lvlNumber = t + 1, e.moves -= 3, e.tutID && (e.tutID = null), e
        },
        isPopUpTutorialPassed: function(t) {
            return this.data.popUpTutorials || (this.data.popUpTutorials = []), -1 !== this.data.popUpTutorials.indexOf(t)
        },
        passPopUpTutorial: function(t) {
            this.data.popUpTutorials || (this.data.popUpTutorials = []), this.isPopUpTutorialPassed(t) || (this.data.popUpTutorials.push(t), this.save())
        },
        isPackActive: function(t) {
            var e = this.getPackSaveData(t.id),
                i = this.data.payingUser || !1;
            if (t.group) {
                if ("paying" == t.group && !i) return !1;
                if ("nonPaying" == t.group && i) return !1
            }
            return this.getLastPassedLevelNr() >= t.afterLvlNr && !e.activationTime && (e.activationTime = Date.now(), this.save()), this.getLastPassedLevelNr() >= t.afterLvlNr && !e.bought && Date.now() - e.activationTime < 60 * t.timeMinutes * 1e3
        },
        getPackStage: function(t) {
            for (var e = G.saveState.getPackSaveData(t.id), i = (Date.now() - e.activationTime) / 1e3 / 60, s = t.stages[this.data.payingUser ? "payingUser" : "nonPayingUser"], a = 0, n = 0; n < s.length; n++) {
                var o = s[n];
                if (i < (a += o.timeMinutes || 1 / 0)) return o
            }
            return s[s.length - 1]
        },
        getPackSaveData: function(t) {
            return this.data.packs[t] || (this.data.packs[t] = {
                activationTime: !1,
                bought: !1
            }), this.data.packs[t]
        },
        getCurrentLivesNr: function() {
            return this.data.lives
        },
        sendLife: function(t) {},
        checkIfCanSendLifeTo: function(t) {},
        checkGateNr: function(t) {
            for (var e = [0].concat(G.json.settings.gates.map(function(t) {
                    return t.lvlNr
                })), i = 0; i < e.length; i++)
                if (t < e[i] - 1) return i - 1;
            return i
        },
        activateGate: function(e) {
            var t = this.getGateData(e.id),
                i = G.json.settings.gates.find(function(t) {
                    return t.id === e.id
                });
            t.timerStartedAt || (this.checkGate(i), t.timerStartedAt = Date.now(), this.save())
        },
        openGate: function(t) {
            this.data.gates[t] && (this.data.gates[t].open = !0, this.signals.onGateOpened.dispatch(t), this.save())
        },
        tickCheckGate: function() {
            for (var t = 0; t < G.json.settings.gates.length; t++) this.checkGate(G.json.settings.gates[t])
        },
        checkGate: function(t) {
            var e = this.getGateData(t.id);
            return e.open || e.readyToOpen || (this.getAllStars() >= t.req.stars && (G.gameTracking.design("GateUnlockStars", t.id), e.readyToOpen = !0), e.timerStartedAt && Date.now() - e.timerStartedAt > 6e4 * t.req.timeMinutes && (e.readyToOpen = !0, G.gameTracking.design("GateUnlockTime", t.id)), e.invites >= t.req.invites && (e.readyToOpen = !0, G.gameTracking.design("GateUnlockFriends", t.id)), e.readyToOpen && this.save()), e
        },
        getGateData: function(t) {
            return this.data.gates[t] || (this.data.gates[t] = {
                open: !1,
                timerStartedAt: !1,
                invites: 0
            }), this.data.gates[t]
        },
        getFirstClosedGateLvLIndex: function() {
            for (var t = 0; t < G.json.settings.gates.length; t++)
                if (!this.getGateData(G.json.settings.gates[t].id).open) return G.json.settings.gates[t].lvlNr - 1;
            return null
        },
        passExtraLevel: function(t) {
            this.data.extraStars || (this.data.extraStars = 0), this.data.extraStars += t, this.save()
        },
        passLevel: function(t, e, i, s) {
            0 === G.saveState.getStars(t) && (this.data.mysteryGift.endOfLastStreak = 0), G.sb("onLevelFinished").dispatch(t, e, i);
            var a = game.state.getCurrentState(),
                n = this.getStars(t),
                o = this.getPoints(t),
                r = {
                    highscore: !1,
                    points: i,
                    reward: 0,
                    stars: e,
                    passedFriend: !1,
                    starImprovement: Math.max(0, e - n)
                };
            if (o < i && (this.data.points[t] = i, r.highscore = !0), n < e) {
                this.data.levels[t] = e;
                var h = G.json.settings.coinsForStar[e - 1] - (G.json.settings.coinsForStar[n - 1] || 0);
                a.doubleMoney && (h *= 2), r.reward = h
            }
            return r.highscore, s || (this.data.coins += r.reward), this.save(), r
        },
        getPoints: function(t) {
            return this.data.points[t] ? this.data.points[t] : 0
        },
        isLevelBehindGate: function(t) {
            for (var e = 0; e < G.json.settings.gates.length; e++)
                if (G.json.settings.gates[e].lvlNr === t + 1) return !this.getGateData(G.json.settings.gates[e].id).open;
            return !1
        },
        getStars: function(t) {
            return this.data.levels[t] ? this.data.levels[t] : 0
        },
        getCoins: function() {
            return this.data.coins
        },
        getItemAmount: function(t) {
            return void 0 !== this.data.items[t] && null != this.data.items[t] || (this.data.items[t] = 0), this.data.items[t]
        },
        changeItemAmount: function(t, e) {
            return void 0 === this.data.items[t] && (this.data.items[t] = 0), this.data.items[t] += e, G.sb("refreshItemAmount").dispatch(t, this.data.items[t]), this.save(), this.data.items[t]
        },
        getBoosterAmount: function(t) {
            return void 0 !== this.data.boosters[t] && null != this.data.boosters[t] || (this.data.boosters[t] = G.json.settings.boostersOnStart), this.data.boosters[t]
        },
        buyBooster: function(t) {
            return this.data.coins >= G.json.settings["priceOfBooster" + t] && (this.changeCoins(-G.json.settings["priceOfBooster" + t]), this.changeBoosterAmount(t, 1), G.sb("onBoosterBought").dispatch(t), G.gameTracking.sink("Coins", this.nrToBoosterName(t), "InGame", G.json.settings["priceOfBooster" + t]), !0)
        },
        removeMapGift: function(t) {
            G.saveState.data.mapGifts = G.saveState.data.mapGifts.slice(1), t || this.save(), G.sb("onMapGiftRemoved").dispatch()
        },
        isEnoughToBuyBooster: function(t) {
            return this.data.coins >= G.json.settings["priceOfBooster" + t]
        },
        isEnoughToBuy: function(t) {
            return this.data.coins >= t
        },
        isBoosterUnlocked: function(t) {
            if (6 == t) return !1;
            var e = this.getLastPassedLevelNr();
            return t < 5 ? e + 1 >= G.json.settings.boostersUnlock[t] : e + 1 >= G.json.settings.startBoosterUnlock[t - 5]
        },
        changeBoosterAmount: function(t, e, i) {
            this.data.boosters[t] += e, i || this.save(), G.sb("refreshBoosterAmount").dispatch(t)
        },
        useBooster: function(t) {
            this.data.boosters[t] <= 0 && (G.saveState.buyBooster(t), G.lvl && G.gameTracking.source(this.nrToBoosterName(t), "Gameplay", "Level" + G.pad(G.lvlNr + 1, 4), 1), G.sfx.cash_register.play()), G.lvl && G.gameTracking.sink(this.nrToBoosterName(t), "Gameplay", "Level" + G.pad(G.lvlNr + 1, 4), 1), this.changeBoosterAmount(t, -1), G.sb("onBoosterUsed").dispatch(t)
        },
        isBubbleGiftUsed: function(t) {
            return G.saveState.data.bubbleGifts || (G.saveState.data.bubbleGifts = []), -1 !== G.saveState.data.bubbleGifts.indexOf(t)
        },
        markBubbleGiftAsUsed: function(t) {
            G.saveState.data.bubbleGifts || (G.saveState.data.bubbleGifts = []), G.saveState.data.bubbleGifts.push(t)
        },
        useStartBooster: function(t) {
            this.data.boosters[t] && (this.data.boosters[t]--, G.lvl && G.gameTracking.sink(this.nrToBoosterName(t), "Gameplay", "Level" + G.pad(G.lvlNr + 1, 4), 1), this.save())
        },
        nrToBoosterName: function(t) {
            return [null, "SWAP", "REMOVE", "HORIZONTAL", "VERTICAL", "MOVES", "DOUBLE", "VERHOR", "COLOR"][t]
        },
        nrToWord: function(t) {
            return ["ZERO", "ONE", "TWO", "THREE", "FOUR", "FIVE", "SIX", "SEVEN", "EIGHT", "NINE", "TEN", "ELEVEN", "TWELVE", "THIRTEEN", "FOURTEEN", "FIVETEEN", "SIXTEEN", "SEVENTEEN", "EIGHTEEN", "NINETEEN", "TWENTY"][parseInt(t)]
        },
        changeCoins: function(t, e) {
            0 < t && G.sb("onCoinsIncrease").dispatch(t), this.data.coins += t, e || this.save(), G.sb("onCoinsChange").dispatch(this.data.coins)
        },
        getAllStars: function() {
            for (var t = 0, e = 0, i = this.data.levels.length; e < i; e++) t += this.data.levels[e] || 0;
            return void 0 === this.data.extraStars && (this.data.extraStars = 0), t += this.data.extraStars
        },
        getLastPassedLevelNr: function() {
            return this.data.levels.length
        },
        isLevelAvailable: function(t) {
            return t <= this.data.levels.length
        },
        save: function() {
            console.log("### SAVE"), window.localStorage.setItem("gmdatastringcc3", JSON.stringify(this.data))
        },
        _initLoadData: function() {
            var t = window.localStorage.getItem("gmdatastringcc3");
            this.init(t)
        },
        init: function(t, e, i) {
            this.refillRate = Math.floor(6e4 * G.json.settings.refillRateMin), (i || "null" === t) && (t = null), console.log(t), t ? (this.data = JSON.parse(t), game.sound.mute = this.data.mute, void 0 === this.data.whatsNewSaw && (this.data.whatsNewSaw = []), 3 < this.getLastPassedLevelNr() && (this.data.sawDailyTut = !0), this.versionCheck()) : (this.data = this.makeNewDataObject(), G.firstTime = !0), this.loginStatsTracker(), setInterval(function() {
                G.sb("onWallClockTimeUpdate").dispatch(Date.now())
            }, 1e3), game.sound.mute = this.data.mute, this.ready = !0, this.onReadySignal.dispatch(), this._mysteryGift_checkData(), G.sb("onWallClockTimeUpdate").addPermanent(this.onTick, this, 99), G.sb("onWallClockTimeUpdate").addPermanent(this.tickCheckGate, this, 99)
        },
        onReadyCallback: function(t) {
            this.ready ? t() : this.onReadySignal.addOnce(t)
        },
        loginStatsTracker: function() {
            this.data.loginTrack || (this.data.loginTrack = {
                creation: G.firstTime ? Date.now() : 0,
                count: 0,
                dailyCount: 0,
                lastDate: Date.now()
            }), this.data.loginTrack.count++;
            var t = new Date,
                e = new Date(this.data.loginTrack.creation),
                i = new Date(this.data.loginTrack.lastDate);
            this.data.loginTrack.firstDay = e.toDateString() === t.toDateString(), this.data.loginTrack.count++, t.toDateString() !== i.toDateString() && (this.data.loginTrack.dailyCount = 0), this.data.loginTrack.dailyCount++, this.data.loginTrack.lastDate = Date.now(), this.save()
        },
        getLoginStats: function() {
            return this.data.loginTrack
        },
        abTestTracking: function() {
            if (this.data.ABTEST) {
                var t = Object.keys(this.data.ABTEST),
                    s = {
                        FTUF: ["FTUF_A", "FTUF_B"]
                    };
                t.forEach(function(t) {
                    if (s[t]) {
                        var e = this.data.ABTEST[t],
                            i = s[t]["A" == e ? 0 : 1];
                        console.log("^^ ab eventName", i), sdkHandler.GA.GameAnalytics.setCustomDimension01(i), G.gameTracking.design(i)
                    }
                }, this)
            }
        },
        versionCheck: function() {
            if (!this.data.version) {
                this.data.version = 1;
                var i = this.getLastPassedLevelNr();
                G.json.settings.gates.forEach(function(t) {
                    var e = this.getGateData(t.id);
                    t.lvlNr < i && !e.open && (e.open = !0)
                }, this)
            }
        },
        addUnlimitedLivesTimeMin: function(t, e) {
            this.data.unlimitedLives || (this.data.unlimitedLives = 0);
            var i = Math.round(6e4 * t);
            0 === this.data.unlimitedLives && (this.data.unlimitedLivesStart = Date.now()), Date.now() > this.data.unlimitedLives ? this.data.unlimitedLives = Date.now() + i : this.data.unlimitedLives += i, G.sb("onUnlimitedLivesChanged").dispatch(this.getUnlimitedLivesSec()), e || this.save()
        },
        getUnlimitedLivesSec: function() {
            if (this.data.unlimitedLives || (this.data.unlimitedLives = 0), this.data.unlimitedLivesStart && this.data.unlimitedLivesStart > Date.now()) return this.data.unlimitedLives = 0, this.save(), 0;
            var t = Math.round((this.data.unlimitedLives - Date.now()) / 1e3);
            return t = Math.max(0, t)
        },
        loseLife: function() {
            if (G.LIVES && !(0 < this.getUnlimitedLivesSec() || this.data.lives <= 0)) return this.data.lives = Math.max(0, this.data.lives - 1), this.signals.onLifeAmountChanged.dispatch(this.data.lives), this.save(), this.data.lives
        },
        addLife: function(t, e, i) {
            if (t = t || 1, i) {
                if (this.data.lives >= G.json.settings.livesMax) return;
                t = Math.min(t, G.json.settings.livesMax - this.data.lives)
            }
            if (!(10 <= this.data.lives)) return t = Math.min(t, 10 - this.data.lives), this.data.lives = this.data.lives + t, e || this.save(), this.signals.onLifeAmountChanged.dispatch(this.data.lives), G.sb("onLifeAdded").dispatch(this.data.lives), this.data.lives
        },
        addGinger: function(t) {
            this.data.ginger || (this.data.ginger = 0), this.data.ginger += t, G.sb("onGingerAdded").dispach(this.data.ginger)
        },
        onTick: function(t) {
            if (864e5 <= Date.now() - this.data.lastDaily && (this.data.lastDaily = Date.now(), this.data.freeSpin = !0, this.save(), G.sb("onDailyFreeSpinGain").dispatch()), this.data.lives >= G.json.settings.livesMax && (this.data.lastRefillDate = Date.now()), this.data.lives < G.json.settings.livesMax) {
                var e = t - this.data.lastRefillDate,
                    i = Math.floor(e / this.refillRate);
                0 < i && (this.data.lastRefillDate += i * this.refillRate, this.addLife(i, !1, !0));
                var s = Math.round((this.refillRate - (t - this.data.lastRefillDate)) / 1e3);
                G.sb("onLifeTimerUpdate").dispatch(s)
            }
        },
        debugStarsUpTo: function(t, e) {
            for (this.data.levels = []; t--;) this.data.levels.push(e || 3);
            game.state.start("World")
        },
        getResourceSentTimestamp: function(t, e) {
            return this.data.resourceSentTimestamp || (this.data.resourceSentTimestamp = {}), this.data.resourceSentTimestamp[t] || (this.data.resourceSentTimestamp[t] = {}), this.data.resourceSentTimestamp[t][e] || 0
        },
        setResourceSentTimestamp: function(t, e) {
            this.getResourceSentTimestamp(t, e), this.data.resourceSentTimestamp[t][e] = Date.now(), this.save()
        },
        canResourceBeSent: function(t, e) {
            if (G.json.settings && G.json.settings.sendResourceLimitsMin) {
                var i = this.getResourceSentTimestamp(t, e),
                    s = G.json.settings.sendResourceLimitsMin[e];
                return !s || Date.now() > i + 60 * s * 1e3
            }
        },
        isMsgRead: function(t, e) {
            return this.data[t] || (this.data[t] = []), -1 !== this.data[t].indexOf(e)
        },
        markMsgAsRead: function(t, e) {
            this.data[t] || (this.data[t] = []), this.data[t].push(e)
        },
        addGateInvite: function(e, t, i) {
            var s = {
                    inviteAccepted: !1,
                    gateData: !1
                },
                a = G.json.settings.gates.find(function(t) {
                    return t.id == e
                }),
                n = G.saveState.getGateData(e);
            return a && n && !n.open && (s.gateData = a, n.invitesList || (n.invitesList = []), n.avatarsList || (n.avatarsList = []), -1 == n.invitesList.indexOf(t) && (n.invitesList.push(t), n.avatarsList.push(i), n.invites++, s.inviteAccepted = !0, n.invites >= a.req.invites && (n.open = !0, s.gateOpened = !0), this.save())), s
        },
        isGateOpen: function(t) {
            return this.getGateData(t).open
        },
        _mysteryGift_checkData: function() {
            this.data.mysteryGift ? this.data.mysteryGift.duringLevel && (console.log("++ reseting progress - duringLevel"), this.data.mysteryGift.streak = 0, this.data.mysteryGift.duringLevel = !1, this.data.mysteryGift.endOfLastStreak = Date.now()) : this.data.mysteryGift = {
                endOfLastStreak: 0,
                gifts: ["spiral", "vertical", "horizontal", "cross"],
                streak: 0,
                duringLevel: !1
            }
        },
        mysteryGift_getCurrentGifts: function() {
            var t = this.data.mysteryGift.streak;
            return this.data.mysteryGift.gifts.slice(0, Math.min(3, t))
        },
        mysteryGift_increaseStreak: function() {
            if (this.mysteryGift_isModeReady()) return 0 == this.data.mysteryGift.streak && (G.gameTracking.design("Design_OneTry_Activated"), Phaser.ArrayUtils.shuffle(this.data.mysteryGift.gifts)), this.data.mysteryGift.streak++, !0
        },
        mysteryGift_finishStreak: function(t) {
            0 < this.data.mysteryGift.streak && G.gameTracking.design("Design_OneTry_Deactivated"), (0 < this.data.mysteryGift.streak || t) && (console.log("%% finish streak"), this.data.mysteryGift.streak = 0, this.data.mysteryGift.duringLevel = !1, this.data.mysteryGift.endOfLastStreak = Date.now())
        },
        mysteryGift_isModeReady: function() {
            if (this.data.levels.length < 10) return !1;
            var t = this.data.mysteryGift.endOfLastStreak,
                e = 60 * G.json.settings.mysteryGift.cooldownMin * 1e3;
            return Date.now() - t > e
        },
        mysteryGift_getCurrentStreak: function() {
            return this.data.mysteryGift.streak
        },
        mysteryGift_markLevelBeggining: function() {
            this.data.mysteryGift.duringLevel = !0
        },
        mysteryGift_markLevelFinish: function() {
            this.data.mysteryGift.duringLevel = !1
        },
        daily_getTimeForNextAd: function() {
            return this.data.daily || (this.data.daily = {}), (this.data.daily.lastTimeWatched || 0) + 60 * G.json.settings.dailyAdCooldownMin * 1e3
        },
        daily_markAdWatched: function() {
            this.data.daily || (this.data.daily = {}), this.data.daily.lastTimeWatched = Date.now()
        },
        dailyReward_reportVisit: function() {
            this.data.dailyReward || (this.data.dailyReward = {}, this.data.dailyReward.nextDaily = 0, this.data.dailyReward.currentDay = 0);
            var t = this.dailyReward_daySinceEpoch(Date.now());
            if (t >= this.data.dailyReward.nextDaily) {
                var e = this.data.dailyReward.nextDaily - t;
                return this.data.dailyReward.nextDaily = t + 1, 0 === e ? this.data.dailyReward.currentDay++ : this.data.dailyReward.currentDay = 0, G.saveState.save(), this.data.dailyReward.currentDay % 7
            }
            return null
        },
        dailyReward_daySinceEpoch: function(t) {
            return Math.floor(t / 864e5)
        },
        initAB: function() {
            this.data.ABTEST || (this.data.ABTEST = {}), "object" != typeof this.data.ABTEST && (this.data.ABTEST = {});
            for (var t = 0; t < arguments.length; t++) {
                var e = arguments[t];
                this.data.ABTEST[e] || (this.data.ABTEST[e] = Math.random() < .5 ? "A" : "B")
            }
        },
        checkAB: function(t) {
            return this.data.ABTEST || (this.data.ABTEST = {}), this.data.ABTEST[t]
        },
        getLastMoneySpin: function() {
            return void 0 === this.data.lastMoneySpin && (this.data.lastMoneySpin = 0), this.data.lastMoneySpin
        },
        getSecToNextFreeMoneySpin: function() {
            return Math.floor((this.getLastMoneySpin() + 6e4 * G.json.settings.freeMoneySpinMinutes - Date.now()) / 1e3)
        },
        markLastMoneySpin: function() {
            return this.data.lastMoneySpin = Date.now()
        },
        isFreeMoneySpinAvailable: function() {
            return Date.now() - this.getLastMoneySpin() > 6e4 * G.json.settings.freeMoneySpinMinutes
        },
        wasNewsAlreadySeen: function(t) {
            return this.data.seenNewsAnnouncements || (this.data.seenNewsAnnouncements = []), -1 !== this.data.seenNewsAnnouncements.indexOf(t)
        },
        markNewsAsSeen: function(t) {
            this.data.seenNewsAnnouncements || (this.data.seenNewsAnnouncements = []), this.data.seenNewsAnnouncements.push(t), this.save()
        },
        getTreasureHuntData: function() {
            return this.data.treasureHunt
        },
        saveTreasureHuntData: function(t) {
            this.data.treasureHunt = t, this.save()
        }
    }, G.SoundBtn = function(t, e) {
        G.Button.call(this, t, e, game.sound.mute ? "btn_sound_off" : "btn_sound_on", function() {
            game.sound.mute = !game.sound.mute, game.sound.mute ? G.sfx.music.pause() : G.sfx.music.resume(), G.saveState.data.mute = game.sound.mute, G.changeTexture(this, game.sound.mute ? "btn_sound_off" : "btn_sound_on"), G.saveState.save(), G.sb("onSoundSettingsChange").dispatch(game.sound.mute)
        }), game.add.existing(this)
    }, G.SoundBtn.prototype = Object.create(G.Button.prototype), G.TopFxLayer = function(t, e) {
        Phaser.Group.call(this, game), this.aboveThirdFloorLayer = !1, this.board = t, G.sb(e || "fx").add(this.initEffect, this), this.deadArray = []
    }, G.TopFxLayer.prototype = Object.create(Phaser.Group.prototype), G.TopFxLayer.constructor = G.TopFxLayer, G.TopFxLayer.prototype.onElemKilled = function(t) {
        this === t.parent && (this.removeChild(t), this.deadArray.push(t))
    }, G.TopFxLayer.prototype.getFreeParticle = function() {
        var t;
        return 0 < this.deadArray.length ? t = this.deadArray.pop() : (t = new G.FxParticle(this.board, this)).events.onKilled.add(this.onElemKilled, this), this.add(t), t
    }, G.TopFxLayer.prototype.initEffect = function(t, e, i, s) {
        if ("burstConcrete" == t) return this.initConcreteBreak(e, i);
        var a = this.getFreeParticle();
        return a[t](this.board.cellXToPxIn(e.cellX), this.board.cellYToPxIn(e.cellY), i, s), a
    }, G.TopFxLayer.prototype.initConcreteBreak = function(t, e) {
        3 == e ? this.getFreeParticle().burstConcrete(this.board.cellXToPxIn(t.cellX), this.board.cellYToPxIn(t.cellY), -9, -1, "concrete_3_1") : 2 == e ? this.getFreeParticle().burstConcrete(this.board.cellXToPxIn(t.cellX), this.board.cellYToPxIn(t.cellY), 14, 5, "concrete_2_1") : (this.getFreeParticle().burstConcrete(this.board.cellXToPxIn(t.cellX), this.board.cellYToPxIn(t.cellY), 15, 20, "concrete_1_1"), this.getFreeParticle().burstConcrete(this.board.cellXToPxIn(t.cellX), this.board.cellYToPxIn(t.cellY), -15, 20, "concrete_1_2"))
    }, G.Overlay = function() {
        this.bitmap = G.overlayBitmap, this.state = game.state.getCurrentState(), s.tutO = this, game.width === G.overlayBitmap.width && game.height === G.overlayBitmap.height || this.bitmap.resize(game.width, game.height), this.board = game.state.getCurrentState().board, this.img = this.bitmap.addToWorld(), this.img.x = game.world.bounds.x, this.img.alpha = 0, G.sb("onScreenResize").add(this.onResize, this), this.topBar = game.add.group(), this.topBar.position = this.state.topBar.position, this.boosterGroup = game.add.group(), this.boosterGroup.position = this.state.boosterPanel.position, this.tasks = [], this.aboveObjects = [], G.sb("closeOverlay").add(function() {
            G.tutorialOpened || this.hideAndClear()
        }, this), G.sb("startOverlay").add(function(t) {
            G.tutorialOpened || this.start(t)
        }, this), this.alphaValue = .7, this.boosterLabel = new G.UI_BoosterLabel(this.board), this.coinCounter = new G.UI_CoinCounter
    }, G.Overlay.prototype.hideAndClear = function() {
        G.stopTweens(this), game.add.tween(this.img).to({
            alpha: 0
        }, 300, Phaser.Easing.Sinusoidal.InOut, !0).onComplete.add(function() {
            this.tasks = [], this.moveAboveObjectsToOriginalParents()
        }, this)
    }, G.Overlay.prototype.clearCell = function(t, e) {
        var i = this.board.tilesize * this.board.scale.x,
            s = this.board.x + t * i,
            a = this.board.y + e * i;
        this.bitmap.context.clearRect(-game.world.bounds.x + s, a, i, i)
    }, G.Overlay.prototype.clearCells = function(t) {
        for (var e = 0, i = (this.clearCellsArray = t).length; e < i; e += 2) this.clearCell(t[e], t[e + 1])
    }, G.Overlay.prototype.clearBoard = function(t) {
        this.clearObject = t;
        var a = this.board.tilesize * this.board.scale.x,
            n = .5 * a;
        this.board.levelData.loop(function(t, e, i) {
            if (this.board.isCellOnBoard(e, i)) {
                var s = this.board.cellToPxOut([e, i]);
                this.bitmap.context.clearRect(-game.world.bounds.x + s[0] - n - G.l(6), s[1] - n - G.l(6), a + G.l(12), a + G.l(12))
            }
        }, this)
    }, G.Overlay.prototype.onResize = function() {
        game.width === G.overlayBitmap.width && game.height === G.overlayBitmap.height || this.bitmap.resize(game.width, game.height), this.bitmap.fill(0, 0, 0, this.alphaValue), this.img.x = game.world.bounds.x, game.time.events.add(5, this.redoTasks, this)
    }, G.Overlay.prototype.redoTasks = function() {
        for (var t = this.tasks.length; t--;) {
            var e = this.tasks[t];
            this[e[0]].apply(this, e.slice(1))
        }
    }, G.Overlay.prototype.moveToAboveGroup = function(t, e) {
        t.parent != this[e] && (t._originalParent = t.parent, this[e].add(t), this.aboveObjects.push(t))
    }, G.Overlay.prototype.moveAboveObjectsToOriginalParents = function() {
        for (var t = this.aboveObjects.length; t--;) {
            var e = this.aboveObjects[t];
            e._originalParent.add(e)
        }
    }, G.Overlay.prototype.start = function(t) {
        G.stopTweens(this), this.tasks = t, this.bitmap.cls(), this.bitmap.fill(0, 0, 0, this.alphaValue), this.redoTasks(), 1 != this.img.alpha && game.add.tween(this.img).to({
            alpha: 1
        }, 300, Phaser.Easing.Sinusoidal.Out, !0)
    }, G.Overlay.prototype.set = function(t) {
        t ? this.start(t) : this.hideAndClear()
    }, G.UIFxLayer = function(t) {
        Phaser.Group.call(this, game), this.board = t, this.state = game.state.getCurrentState(), G.sb("UIfx").add(this.initEffect, this)
    }, G.UIFxLayer.prototype = Object.create(Phaser.Group.prototype), G.UIFxLayer.constructor = G.TopFxLayer, G.UIFxLayer.prototype.getFreeParticle = function() {
        return this.getFirstDead() || this.add(new G.FxParticle(this.board))
    }, G.UIFxLayer.prototype.initEffect = function(t, e, i) {
        var s = this.getFreeParticle();
        return s[i](t, e), s
    }, G.UIFxLayer.prototype.initFeedbackText = function(t) {
        var e;
        this.feedbackText.alive || (G.stopTweens(this.feedbackText), 4 == t && (e = "good"), 5 == t && (e = "nice"), 6 <= t && (e = "amazing"), 7 <= t && (e = "excellent"), 8 <= t && (e = "cookielicious"), this.feedbackText.revive(), this.feedbackText.x = this.state.board.x + .5 * this.state.board.width, this.feedbackText.y = this.state.board.y + .5 * this.state.board.height, G.changeTexture(this.feedbackText, e), this.feedbackText.alpha = 1, this.feedbackText.scale.setTo(0), game.add.tween(this.feedbackText.scale).to({
            x: 1,
            y: 1
        }, 500, Phaser.Easing.Elastic.Out, !0), game.add.tween(this.feedbackText).to({
            alpha: 0
        }, 300, Phaser.Easing.Sinusoidal.In, !0, 1e3).onComplete.add(this.feedbackText.kill, this.feedbackText))
    }, G.UI_BoosterPanel = function() {
        Phaser.Group.call(this, game), this.state = game.state.getCurrentState(), this.board = this.state.board, this.y = game.height, this.tweenObj = {
            angle: -15,
            alpha: 1
        }, game.add.tween(this.tweenObj).to({
            angle: 15
        }, 2e3, Phaser.Easing.Sinusoidal.InOut, !0, 0, -1, !0), game.add.tween(this.tweenObj).to({
            alpha: 0
        }, 500, Phaser.Easing.Sinusoidal.InOut, !0, 0, -1, !0), this.bg = G.makeImage(7, 0, "bottom_ui_base", [0, 1], this), this.shadows = [G.makeImage(0, -20, "bottom_ui_shadow", .5, this.bg), G.makeImage(0, -20, "bottom_ui_shadow", .5, this.bg), G.makeImage(0, -20, "bottom_ui_shadow", .5, this.bg), G.makeImage(0, -20, "bottom_ui_shadow", .5, this.bg), G.makeImage(0, -20, "bottom_ui_shadow", .5, this.bg)], this.pauseBtn = new G.Button(60, -70, "btn_game_pause", function() {
            new G.Window("pause")
        }, this), this.add(this.pauseBtn), this.boostersBtn = [this.makeBoosterBtn(290, -64, 1), this.makeBoosterBtn(480, -64, 2), this.makeBoosterBtn(860, -64, 3), this.makeBoosterBtn(670, -64, 4)], G.sb("onWindowOpened").add(this.lockInput, this), G.sb("onAllWindowsClosed").add(this.unlockInput, this), G.sb("onStateChange").add(this.lockInput, this), G.sb("actionQueueEmpty").add(function() {
            G.lvl.goalAchieved || this.checkSuggestions()
        }, this), G.sb("onGoalAchieved").add(function() {
            this.boostersBtn.forEach(function(t) {
                t.suggested = !1
            }), this.lockInput()
        }, this), G.sb("onScreenResize").add(this.onScreenResize, this), this.onScreenResize()
    }, G.UI_BoosterPanel.prototype = Object.create(Phaser.Group.prototype), G.UI_BoosterPanel.prototype.onScreenResize = function() {
        this.y = game.height, G.changeTexture(this.bg, "bottom_ui_base"), this.x = 0, this.pauseBtn.y = G.l(-58), this.boostersBtn.forEach(function(t, e) {
            t.y = t.orgY = G.l(-64), t.x = t.orgX = G.l(180 + 125 * e), this.shadows[0].x = this.pauseBtn.x - G.l(7), this.shadows[e + 1].x = t.x - G.l(7)
        }, this)
    }, G.UI_BoosterPanel.prototype.lockInput = function() {
        this.pauseBtn.input.enabled = !1, this.boostersBtn.forEach(function(t) {
            t.lock && t.lock()
        }, this)
    }, G.UI_BoosterPanel.prototype.unlockInput = function() {
        this.pauseBtn.input.enabled = !0, this.pauseBtn.input.useHandCursor = !0, this.boostersBtn.forEach(function(t) {
            t.unlock && t.unlock()
        }, this)
    }, G.UI_BoosterPanel.prototype.makeBoosterBtn = function(t, e, i) {
        if (G.saveState.isBoosterUnlocked(i)) {
            var s = new G.UI_BoosterButton(t, e, i);
            return this.add(s)
        }
        return G.makeImage(t, e, "ui_booster_" + i + "_locked", .5, this)
    }, G.UI_BoosterPanel.prototype.checkSuggestions = function() {
        this.boostersBtn.forEach(function(t, e) {
            !G.lvl.goalAchieved && this["checkBooster" + (e + 1) + "Suggestion"]() ? t.showSuggestion && t.showSuggestion() : t.hideSuggestion && t.hideSuggestion()
        }, this)
    }, G.UI_BoosterPanel.prototype.checkBooster1Suggestion = function() {
        return !1
    }, G.UI_BoosterPanel.prototype.checkBooster2Suggestion = function() {
        return !1
    }, G.UI_BoosterPanel.prototype.checkBooster3Suggestion = function() {
        return !1
    }, G.UI_BoosterPanel.prototype.checkBooster4Suggestion = function() {
        return !1
    }, G.UI_BoosterPanel.prototype.checkIfBlocker = function(t, e) {
        if (this.board.boardIce.isToken(t, e) || this.board.boardDirt.isToken(t, e) || this.board.boardCage.isToken(t, e)) return !0;
        var i = this.board.getCandy(t, e);
        return i && (i.wrapped || i.infected)
    }, G.UI_GoalPanelCollect = function(t, e) {
        Phaser.Group.call(this, game), this.x = G.l(t), this.y = G.l(e), this.state = game.state.getCurrentState(), this.objectsToCollect = G.Utils.clone(G.lvlData.goal[1]), this.panels = [], this.makePanels(this.objectsToCollect), G.sb("onTaskAmountChanged").add(this.updateDisplay, this), G.sb("onScreenResize").add(this.onScreenResize, this), this.onScreenResize()
    }, G.UI_GoalPanelCollect.prototype = Object.create(Phaser.Group.prototype), G.UI_GoalPanelCollect.prototype.onScreenResize = function() {
        var t = G.l(260);
        2 == this.panels.length ? t = G.l(130) : 3 == this.panels.length && (t = G.l(210));
        var i = 0;
        this.panels.length - 1 && (i = t / (this.panels.length - 1));
        var s = t * Math.sign(i) * -.5;
        this.panels.forEach(function(t, e) {
            t.x = s + e * i, t.y = 0, t.scale.setTo(.5)
        }), this.panels.forEach(function(t) {
            t.turnVertical()
        })
    }, G.UI_GoalPanelCollect.prototype.getGoalPanel = function(t) {
        for (var e = 0, i = this.panels.length; e < i; e++)
            if (this.panels[e].goalName == t) return this.panels[e]
    }, G.UI_GoalPanelCollect.prototype.updateDisplay = function(t, e) {
        var i = this.getGoalPanel(t);
        if (i.nr.alive && i.nr.alive) {
            var s = parseInt(i.nr.text) + e;
            i.nr.setText(s), 0 == s && i.nr.alive && (i.checkmark.visible = !0, i.nr.destroy())
        }
    }, G.UI_GoalPanelCollect.prototype.makePanel = function(t, e, i, s, a) {
        var n = G.json.settings.goals[i].sprite,
            o = game.make.group();
        o.x = G.l(t), o.y = G.l(e), o.scale.setTo(a), o.goalName = i, o.amount = s, o.nr = o.add(new G.Text(38, 0, s.toString(), {
            style: "font-blue",
            fontSize: "60px"
        }, .5, 85)), o.img = G.makeImage(-40, 0, n, .5, o), o.imgFade = G.makeImage(-40, 0, n, .5, this), o.imgFade.alpha = 0, o.checkmark = G.makeImage(o.nr.x, o.nr.y, "task_complete", [1, .5], o), o.checkmark.position = o.nr.position, o.checkmark.anchor = o.nr.anchor, o.checkmark.visible = !1, o.turnHorizontal = function() {
            this.img.x = 0, this.nr.x = 0, this.nr.y = G.l(60), this.nr.anchor.setTo(.5), this.nr.cacheAsBitmap = !1
        }, o.turnVertical = function() {
            this.img.x = G.l(-40), this.nr.x = G.l(38), this.nr.y = 0, this.nr.anchor.setTo(.5), this.nr.cacheAsBitmap = !1
        }, o.fadeAnim = function() {
            G.stopTweens(this.imgFade), this.imgFade.scale.setTo(0), this.imgFade.alpha = 1, game.add.tween(this.imgFade).to({
                alpha: 0
            }, 300, Phaser.Easing.Sinusoidal.Out, !0), game.add.tween(this.imgFade.scale).to({
                x: 2,
                y: 2
            }, 300, Phaser.Easing.Sinusoidal.Out, !0)
        }, this.add(o), this.panels.push(o)
    }, G.UI_GoalPanelCollect.prototype.makePanels = function(t) {
        1 == t.length && this.makePanel(0, -25, t[0][0], t[0][1], .8), 2 == t.length && (this.makePanel(-30, 0, t[0][0], t[0][1], .6), this.makePanel(30, 0, t[1][0], t[1][1], .6)), 3 == t.length && (this.makePanel(-60, 0, t[0][0], t[0][1], .6), this.makePanel(0, 0, t[1][0], t[1][1], .6), this.makePanel(60, 0, t[2][0], t[2][1], .6)), 4 == t.length && (this.makePanel(-120, 0, t[0][0], t[0][1], .6), this.makePanel(-40, 0, t[1][0], t[1][1], .6), this.makePanel(40, 0, t[2][0], t[2][1], .6), this.makePanel(120, 0, t[3][0], t[3][1], .6))
    }, G.UI_GoalPanelCollect.prototype.refreshPanelsHorizontalPositions = function() {
        var t = G.l(-40),
            e = G.l(40),
            i = G.l(-60),
            s = G.l(30);
        1 == this.panels.length ? (this.panels[0].x = 0, this.panels[0].y = -25, this.panels[0].scale.setTo(.8)) : 2 == this.panels.length ? (this.panels[0].x = 0, this.panels[0].y = i, this.panels[0].scale.setTo(.6), this.panels[1].x = 0, this.panels[1].y = s, this.panels[1].scale.setTo(.6)) : 3 == this.panels.length ? (this.panels[0].x = t, this.panels[0].y = i, this.panels[0].scale.setTo(.6), this.panels[1].x = e, this.panels[1].y = i, this.panels[1].scale.setTo(.6), this.panels[2].x = t, this.panels[2].y = s, this.panels[2].scale.setTo(.6)) : 4 == this.panels.length && (this.panels[0].x = t, this.panels[0].y = i, this.panels[0].scale.setTo(.6), this.panels[1].x = e, this.panels[1].y = i, this.panels[1].scale.setTo(.6), this.panels[2].x = t, this.panels[2].y = s, this.panels[2].scale.setTo(.6), this.panels[3].x = e, this.panels[3].y = s, this.panels[3].scale.setTo(.6))
    }, G.UI_GoalPanelPoints = function(t, e) {
        Phaser.Group.call(this, game), this.x = G.l(t), this.y = G.l(e), this.state = game.state.getCurrentState(), this.objectsToCollect = JSON.parse(JSON.stringify(G.lvlData.goal[1])), this.labelTxt = new G.Text(0, 0, "/" + G.lvlData.goal[1], {
            style: "font-blue",
            fontSize: "40px"
        }, [0, .5], 150), this.pointsCounter = new G.Text(0, 0, 0, {
            style: "font-blue",
            fontSize: "40px"
        }, .5, 150), this.pointsTarget = G.lvlData.goal[1], this.add(this.labelTxt), this.add(this.pointsCounter), G.sb("onScreenResize").add(this.onScreenResize, this), this.onScreenResize()
    }, G.UI_GoalPanelPoints.prototype = Object.create(Phaser.Group.prototype), G.UI_GoalPanelPoints.prototype.update = function() {
        this.centerTexts(), this.pointsCounter.setText(this.state.topBar.pointsCounter.text)
    }, G.UI_GoalPanelPoints.prototype.onScreenResize = function() {
        this.pointsCounter.anchor.x = 1, this.labelTxt.y = this.pointsCounter.y = 0, this.pointsCounter.updateText(), this.pointsCounter.updateCache(), this.centerTexts()
    }, G.UI_GoalPanelPoints.prototype.centerTexts = function() {
        var t = -.5 * (this.pointsCounter.width + this.labelTxt.width);
        this.pointsCounter.x = t + this.pointsCounter.width, this.labelTxt.x = t + this.pointsCounter.width
    }, G.UI_MapPanel = function() {
        Phaser.Group.call(this, game), this.fixedToCamera = !0, this.cameraOffset.x = Math.floor(.5 * game.width), this.bg = G.makeImage(0, 0, "top-panel-bg", [.5, 0], this), this.bg.inputEnabled = !0, this.state = game.state.getCurrentState(), this.soundBtn = new G.SoundBtn(275, 35), this.add(this.soundBtn), this.soundBtn.scale.setTo(.35);
        var t = G.saveState.getAllStars() - (this.state.lastLevelData ? this.state.lastLevelData.starImprovement : 0);
        this.starsIcon = G.makeImage(0, 36, "top-panel-start", .5, this), this.starsTxt = new G.Text(-240, 43, t.toString(), {
            style: "font-white",
            fontSize: "35px"
        }, [0, .5], 150), this.starsTxt.currentVal = G.saveState.getAllStars() - (this.state.lastLevelData ? this.state.lastLevelData.starImprovement : 0), this.add(this.starsTxt), this.coinsBg = G.makeImage(0, 37, "top-panel-coinsBg", .5, this), this.coinsTxt = new G.Text(-40, 43, G.saveState.getCoins().toString(), {
            style: "font-white",
            fontSize: "35px"
        }, .5, 110), this.coinsTxt.currentVal = G.saveState.getCoins() - (this.state.lastLevelData ? this.state.lastLevelData.reward : 0), this.add(this.coinsTxt), this.plusIcon = new G.Button(210, 37, "btn_plus", function() {
            G.IAP ? G.sb("pushWindow").dispatch(["coinShop", {
                coinTargetObject: this.coinsTxt,
                sagaMap: !0
            }]) : game.incentivised || G.sb("pushWindow").dispatch("moreMoney")
        }, this), this.plusIcon.hitArea = new Phaser.Rectangle(-200, -40, 230, 80), this.plusIcon.scale.setTo(.9), this.add(this.plusIcon), this.lifeUI = new G.UI_Life(-278, 36), this.add(this.lifeUI), G.LIVES ? (this.moveStarsTo(-90), this.moveCoinsTo(120)) : (this.moveStarsTo(-270), this.moveCoinsTo(-50), this.lifeUI.visible = !1), game.incentivised || G.IAP || (this.plusIcon.visible = !0), G.sb("turnOnIAP").add(function() {
            this.plusIcon.visible = !0
        }, this), this.fxLayer = new G.UI_MapPanelFxLayer(this), G.sb("onScreenResize").add(this.onResize, this), G.sb("onWindowOpened").add(this.lockInput, this), G.sb("onAllWindowsClosed").add(this.unlockInput, this), G.sb("onStateChange").add(this.lockInput, this), G.sb("onCoinsChange").add(function(t) {
            this.coinsTxt.setText(t.toString())
        }, this), G.sb("onMapToUIPartFinished").add(function(t) {
            G.sfx.pop.play(), "coin" == t.rewardType ? (this.coinsTxt.setText(this.coinsTxt.currentVal + t.coinValue), this.coinsTxt.currentVal += t.coinValue) : this.starsTxt.setText(++this.starsTxt.currentVal)
        }, this), this.onResize()
    }, G.UI_MapPanel.prototype = Object.create(Phaser.Group.prototype), G.UI_MapPanel.prototype.lockInput = function() {
        this.ignoreChildInput = !0
    }, G.UI_MapPanel.prototype.unlockInput = function() {
        this.ignoreChildInput = !1
    }, G.UI_MapPanel.prototype.onResize = function() {
        this.cameraOffset.x = Math.floor(.5 * game.width)
    }, G.UI_MapPanel.prototype.moveStarsTo = function(t) {
        this.starsIcon.x = t, this.starsTxt.x = this.starsIcon.right + 8
    }, G.UI_MapPanel.prototype.moveCoinsTo = function(t) {
        this.coinsBg.x = t, this.coinsTxt.x = this.coinsBg.centerX + 15
    }, G.UI_MapPanelFxLayer = function(t) {
        Phaser.Group.call(this, game), this.mapPanel = t, G.sb("onMapToUIPart").add(function(t) {
            this.getFreeParticle().init(t)
        }, this)
    }, G.UI_MapPanelFxLayer.prototype = Object.create(Phaser.Group.prototype), G.UI_MapPanelFxLayer.prototype.getFreeParticle = function() {
        return this.getFirstDead() || this.add(new G.UI_MapPanelFxPart(this.mapPanel))
    }, G.UI_MapPanelFxLayer.prototype.update = function() {
        this.sort("y", Phaser.Group.SORT_ASCENDING)
    }, G.UI_MapPanelFxPart = function(t) {
        Phaser.Image.call(this, game), this.kill(), this.anchor.setTo(.5), this.mapPanel = t
    }, G.UI_MapPanelFxPart.prototype = Object.create(Phaser.Image.prototype), G.UI_MapPanelFxPart.prototype.init = function(t) {
        this.revive(), this.x = t.worldPosition.x + game.world.bounds.x, this.y = t.worldPosition.y, this.coinValue = t.coinValue, this.scale.setTo(t.scale.x), this.rewardType = t.rewardType, G.changeTexture(this, t.frameName);
        var e = "coin" == t.rewardType ? this.mapPanel.coinsTxt : this.mapPanel.starsTxt,
            i = e.worldPosition.x + game.world.bounds.x,
            s = e.worldPosition.y;
        game.add.tween(this.scale).to({
            width: 1.5 * this.width,
            height: 1.5 * this.height
        }, 250, Phaser.Easing.Sinusoidal.Out, !0).onComplete.add(function() {
            game.add.tween(this).to({
                x: i,
                y: s,
                width: e.width,
                height: e.height
            }, 500, Phaser.Easing.Sinusoidal.InOut, !0).onComplete.add(function() {
                G.sb("onMapToUIPartFinished").dispatch(this), this.destroy()
            }, this)
        }, this)
    }, G.UI_PointsCounter = function(t, e) {
        G.Text.call(this, t, e, G.capitalize(G.txt("points")) + ": 0", {
            style: "font-white",
            fontSize: "35px"
        }, .5, 320), this.points = 0, this.pointsTarget = 0, G.sb("onPointsChange").add(function(t) {
            this.pointsTarget = t
        }, this), game.add.existing(this)
    }, G.UI_PointsCounter.prototype = Object.create(G.Text.prototype), G.UI_PointsCounter.prototype.update = function() {
        this.points != this.pointsTarget && (this.points += game.math.clamp(Math.ceil(.2 * (this.pointsTarget - this.points)), 0, this.pointsTarget - this.points), this.setText(G.capitalize(G.txt("points")) + ": " + this.points.toString()))
    }, G.UI_ProgressBar = function(t, e) {
        Phaser.Group.call(this, game);
        var i = G.lvlData;
        this.x = G.l(t), this.y = G.l(e), this.points = 0, this.pointsTarget = 0, this.barMaxPoints = 1.2 * i.starsReq[2], this.barProgress = G.makeImage(0, 0, "ingame_progress_bar", [.5, 1], this), this.barProgressMask = game.add.graphics(), this.add(this.barProgressMask), this.barProgressMask.position = this.barProgress.position, this.barProgress.mask = this.barProgressMask, this.barProgressMask.beginFill(0), G.drawCircleSegment(this.barProgressMask, 0, 0, 100, 170, 171);
        this.stars = [G.makeImage(G.lengthDirX(this.pointsToAngle(i.starsReq[0]), 99, !1), 5 + G.lengthDirY(this.pointsToAngle(i.starsReq[0]), 99, !1), "progress_bar_star_1", .5, this), G.makeImage(G.lengthDirX(this.pointsToAngle(i.starsReq[1]), 99, !1), 5 + G.lengthDirY(this.pointsToAngle(i.starsReq[1]), 99, !1), "progress_bar_star_2", .5, this), G.makeImage(G.lengthDirX(this.pointsToAngle(i.starsReq[2]), 99, !1), 5 + G.lengthDirY(this.pointsToAngle(i.starsReq[2]), 99, !1), "progress_bar_star_3", .5, this)], this.stars.forEach(function(t, e) {
            t.req = i.starsReq[e]
        }), G.sb("onPointsChange").add(function(t) {
            this.pointsTarget = t
        }, this)
    }, G.UI_ProgressBar.prototype = Object.create(Phaser.Group.prototype), G.UI_ProgressBar.prototype.pointsToAngle = function(t) {
        return game.math.clamp(180 + t / this.barMaxPoints * 180, 0, 380)
    }, G.UI_ProgressBar.prototype.update = function() {
        this.points != this.pointsTarget && this.changePoints(game.math.clamp(Math.ceil(.05 * (this.pointsTarget - this.points)), 0, this.pointsTarget - this.points))
    }, G.UI_ProgressBar.prototype.changePoints = function(t) {
        var e = this.points;
        this.points += t, this.barProgressMask.clear(), this.barProgressMask.beginFill(0), G.drawCircleSegment(this.barProgressMask, 0, 0, 100, 90, this.pointsToAngle(this.points));
        for (var i = 0; i < 3; i++) e < this.stars[i].req && this.stars[i].req <= this.points && (G.lvl.stars++, i < 2 ? G.sfx.xylophone_positive.play() : G.sfx.xylophone_positive2.play(), game.add.tween(this.stars[i].scale).to({
            x: 1.5,
            y: 1.5
        }, 300, Phaser.Easing.Sinusoidal.InOut, !0, 0, 0, !0), G.sb("UIfx").dispatch(this.stars[i].worldPosition.x + game.world.bounds.x, this.stars[i].worldPosition.y, "whiteStarPart"), G.sb("UIfx").dispatch(this.stars[i].worldPosition.x + game.world.bounds.x, this.stars[i].worldPosition.y, "whiteStarPart"), G.sb("UIfx").dispatch(this.stars[i].worldPosition.x + game.world.bounds.x, this.stars[i].worldPosition.y, "whiteStarPart"), G.sb("UIfx").dispatch(this.stars[i].worldPosition.x + game.world.bounds.x, this.stars[i].worldPosition.y, "whiteStarPart"))
    }, G.UI_TopBar = function(t) {
        Phaser.Group.call(this, game), this.bg = G.makeImage(320, -2, "top_ui_new", [.5, 0], this), this.progressBar = new G.UI_ProgressBar(132, 110), this.movesLeft = G.lvl.moves, this.movesTxt = new G.Text(130, 75, G.txt("Moves"), {
            style: "font-blue",
            fontSize: "25px"
        }, [.5, 0], 160), this.add(this.movesTxt), this.movesAmountTxt = new G.Text(130, 100, G.lvl.moves, {
            style: "font-blue",
            fontSize: "30px"
        }, [.5, 0], 160), this.add(this.movesAmountTxt), "collect" == G.lvlData.goal[0] ? this.goalPanel = new G.UI_GoalPanelCollect(410, 50) : this.goalPanel = new G.UI_GoalPanelPoints(410, 50), this.pointsCounter = new G.UI_PointsCounter(405, 105), this.extraMovesBtn = new G.UI_ExtraMovesBuyButton, this.extraMovesBtn.x = 250, this.extraMovesBtn.targetY = 100, G.sb("changeMoveNumber").add(function() {
            this.movesAmountTxt.setText(G.lvl.moves.toString())
        }, this), G.sb("onScreenResize").add(this.onScreenResize, this), this.onScreenResize()
    }, G.UI_TopBar.prototype = Object.create(Phaser.Group.prototype), G.UI_TopBar.prototype.onScreenResize = function() {}, G.WindowLayer = function(t, e) {
        this.queue = [], this.outOfQueueCache = null, this.outOfQueueGroup = game.make.group(), this.outOfQueueGroup.update = function() {}, this.fadeImg = game.add.graphics(), this.fadeImg.fixedToCamera = !0, this.fadeImg.cameraOffset.x = -5, this.fadeImg.cameraOffset.y = -5, this.fadeImg.alpha = 0, this.inputLayer = G.makeImage(0, 0, null, .5), this.inputLayer.inputEnabled = !0, this.inputLayer.events.onInputDown.add(function() {}, this), this.inputLayer.hitArea = new Phaser.Rectangle(-1e4, -1e4, 2e4, 2e4), Phaser.Group.call(this, game), this.fixedToCamera = !0, this.outOfQueueGroup.position = this.position, this.prevLength = 0, this.dispatch = !1, this.offsetH = G.l(t || 0), this.offsetV = G.l(e || 0), G.sb("onScreenResize").add(this.resize, this), G.sb("onWindowOpened").add(this.cacheWindow, this), G.sb("onWindowClosed").add(this.onWindowClosed, this), G.sb("pushWindow").add(this.pushWindow, this), G.sb("pushWindowOnTop").add(this.putOnTop, this), G.sb("closeAndOpenWindow").add(function(t, e) {
            0 < this.children.length && this.children[0].closeWindow(), this.pushWindow([t, e])
        }, this), this.resize()
    }, G.WindowLayer.prototype = Object.create(Phaser.Group.prototype), G.WindowLayer.constructor = G.WindowLayer, G.WindowLayer.prototype.resize = function() {
        this.cameraOffset.x = Math.floor(.5 * game.width) + this.offsetH, this.cameraOffset.y = Math.floor(.5 * game.height) + this.offsetV, this.fadeImg.clear(), this.fadeImg.beginFill(0, .8), this.fadeImg.drawRect(0, 0, game.width + 10, game.height + 10)
    }, G.WindowLayer.prototype.update = function() {
        0 < this.prevLength && 0 == this.length && (this.dispatch = !0), 0 == this.length ? (this.inputLayer.visible = !1, this.fadeImg.alpha = Math.max(0, this.fadeImg.alpha - .2), this.dispatch && 0 == this.fadeImg.alpha && (G.sb("onWindowClosed").dispatch(this), this.dispatch = !1)) : (this.inputLayer.visible = !0, this.children[0].stopFade || (this.fadeImg.alpha = Math.min(1, this.fadeImg.alpha + .1))), 0 < this.length && this.children[0].update()
    }, G.WindowLayer.prototype.onWindowClosed = function() {
        if (0 < this.queue.length) {
            var t = this.queue.splice(0, 1);
            new G.Window(t[0])
        } else G.sb("onAllWindowsClosed").dispatch()
    }, G.WindowLayer.prototype.cacheWindow = function(t) {
        this.add(t)
    }, G.WindowLayer.prototype.pushWindow = function(t, e) {
        0 == this.queue.length && 0 == this.children.length ? new G.Window(t) : e ? this.queue.unshift(t) : this.queue.push(t)
    }, G.WindowLayer.prototype.push = G.WindowLayer.prototype.pushWindow, G.WindowLayer.prototype.putOnTop = function(t) {
        this.children[0] && (this.outOfQueueCache = this.children[0], game.add.tween(this.children[0]).to({
            alpha: 0
        }, 250, Phaser.Easing.Sinusoidal.In, !0).onComplete.add(function() {
            this.outOfQueueGroup.add(this.children[0])
        }, this)), this.add(t), t.onDestroy ? t.onDestroy.add(this.putOutOfQueueCache, this) : t.events && t.events.onDestroy && t.events.onDestroy.add(this.putOutOfQueueCache, this)
    }, G.WindowLayer.prototype.putOutOfQueueCache = function() {
        this.outOfQueueCache && (this.add(this.outOfQueueCache), game.add.tween(this.outOfQueueCache).to({
            alpha: 1
        }, 250, Phaser.Easing.Sinusoidal.Out, !0), this.outOfQueueCache = null)
    }, G.WinStarPart = function(t, e, i) {
        Phaser.Image.call(this, game, t, e), G.changeTexture(this, "starPart"), this.anchor.setTo(.5), this.visible = !1, this.scale.setTo(1.5), this.grav = G.lnf(.75), i ? this.start() : this.visible = !1
    }, G.WinStarPart.prototype = Object.create(Phaser.Image.prototype), G.WinStarPart.prototype.start = function() {
        this.visible = !0, this.spdX = G.lnf(25 * Math.random() - 12.5), this.spdY = G.lnf(-15 * Math.random() - 5), this.angle = 360 * Math.random()
    }, G.WinStarPart.prototype.update = function() {
        this.visible && (this.x += this.spdX, this.y += this.spdY, this.spdX *= .98, this.angle += this.spdX, this.spdY += this.grav, this.alpha -= .02, this.alpha <= 0 && this.destroy())
    }, G.WorldMap = function(t, e, i, s) {
        if (Phaser.Group.call(this, game), this.onGateOpen = new Phaser.Signal, this.activePointer = null, this.initCustomInput(), this.x = .5 * G.l(640), this.centerX = .5 * G.l(640), this.y = game.height, this.editorMode = s, this.state = game.state.getCurrentState(), this.processMaptilesStatic(), this.btnLayer = new G.WorldMapLvls(this), this.chestLayer = new G.WorldMapChestDynamicLayer(this), G.json.settings.mapLvlEndPoint && (this.lastLvlMsg = this.add(new G.WorldMapLastLevel(this, G.json.settings.mapLvlEndPoint.x, G.json.settings.mapLvlEndPoint.y))), this.socialLayer = new G.WorldMapSocialLayer(this), this.cloudLayer = new G.WorldMapCloudDynamicLayer(this), this.gateLayer = new G.WorldMapGateLayer(this), this.gateLayer.onGateOpen.add(function(t) {
                this.onGateOpen.dispatch(t)
            }, this), this.bubbleGiftLayer = new G.WorldMapBubbleGiftDynamicLayer(this), s) {
            game.input.mouse.mouseWheelCallback = function(t) {
                if (!this.alive) return game.input.mouse.mouseWheelCallback = null;
                this.y += 300 * game.input.mouse.wheelDelta
            }.bind(this), this.prevX = null, this.prevY = null, this.update = function() {
                this.x = 700, game.input.activePointer.middleButton.isDown ? (null !== this.prevX && (this.y -= 3 * (this.prevY - game.input.activePointer.y)), this.prevX = game.input.activePointer.x, this.prevY = game.input.activePointer.y) : (this.prevX = null, this.prevY = null)
            }
        }
        this.mapWidth = 1.1 * this.width, this.localBounds = this.getLocalBounds(), this.additionalMargin = G.l(50), this.velX = 0, this.velY = 0, this._x = G.l(320), this._y = this.y;
        this.state.lastLevelData;
        this.lockedInput = !1, this.centerOnLvl(G.saveState.getLastPassedLevelNr());
        var a = this.state.lastLevelData;
        this.postLevelFlow(a)
    }, G.WorldMap.prototype = Object.create(Phaser.Group.prototype), G.WorldMap.prototype.initCustomInput = function() {
        this.inputLayer = G.makeImage(0, 0, null);
        var t = G.Input.createCustomInputDragHandler();
        t.inputDownSignal.add(this.stopDragInertia, this), t.dragUpdateSignal.add(this.startDragging, this), t.dragStopSignal.add(this.stopDragging, this), t.dragCancelSignal.add(this.stopDragging, this), G.Input.initializeCustomInput(this.inputLayer), this.inputLayer.customInput.addHandler(t), this.inputLayer.hitArea = new Phaser.Rectangle(-1e4, -1e4, 2e4, 2e4)
    }, G.WorldMap.prototype.startDragging = function(t) {
        this.activePointer = t
    }, G.WorldMap.prototype.stopDragging = function() {
        this.activePointer = null
    }, G.WorldMap.prototype.stopDragInertia = function() {
        this.velX = 0, this.velY = 0
    }, G.WorldMap.prototype.postLevelFlow = function(t) {
        t && (0 < t.starImprovement || 0 < t.reward) && !t.challenge && (this.lockInput(), t.mysteryGiftStreakIncrease && G.saveState.mysteryGift_getCurrentStreak() < 4 ? game.time.events.add(1, function() {
            G.sb("pushWindow").dispatch("mysteryGiftStreakIncrese"), G.sb("onAllWindowsClosed").addOnce(function() {
                this.startBatches(t)
            }, this)
        }, this) : game.time.events.add(500, function() {
            this.startBatches(t)
        }, this))
    }, G.WorldMap.prototype.startBatches = function(t) {
        (this.batchesWaitingForFinish = 0) < t.starImprovement && this.afterLvlPartBatch(t.lvlNr, t.starImprovement, "stars"), 0 < t.reward && this.afterLvlPartBatch(t.lvlNr, t.reward, "coins"), 0 == this.batchesWaitingForFinish && this.afterBatch()
    }, G.WorldMap.prototype.centerOnLvl = function(t) {
        t = Math.min(G.json.levels.length - 1, t);
        var e = G.l(G.json.levels[t].mapX),
            i = G.l(G.json.levels[t].mapY);
        this.x = this._x = 320 - e, this.y = this._y = game.math.clamp(game.height + (Math.abs(i) - .5 * game.height), game.height, Math.max(game.height, this.mapHeight)), this.updatePosition()
    }, G.WorldMap.prototype.scrollToPoint = function(t, e, i) {
        var s = {};
        this.chestScroll = !0, this.lockInput();
        var a = Math.max(0, .5 * (1200 - game.width));
        t.lvlNr ? (t.lvlNr = Math.min(G.json.levels.length - 1, t.lvlNr), s.x = game.math.clamp(320 - G.json.levels[t.lvlNr].mapX, 320 - a, 320 + a), s.y = game.math.clamp(game.height + (Math.abs(G.json.levels[t.lvlNr].mapY) - .5 * game.height), game.height, Math.max(game.height, this.mapHeight))) : (s.x = game.math.clamp(320 - t.x, 320 - a, 320 + a), s.y = game.math.clamp(game.height + (Math.abs(t.y) - .5 * game.height), game.height, Math.max(game.height, this.mapHeight)));
        var n = game.add.tween(this).to({
            x: s.x,
            _x: s.x,
            y: s.y,
            _y: s.y
        }, 1300, Phaser.Easing.Sinusoidal.InOut, !0);
        n.onComplete.add(function() {
            this.chestScroll = !1, this.unlockInput()
        }, this), e && n.onComplete.add(e, i)
    }, G.WorldMap.prototype.update = function() {
        if (!this.chestScroll && !this.lockedInput) {
            if (0 < this.state.windowLayer.children.length) return this.velY = 0, void(this.velX = 0);
            var t = this.activePointer;
            this.activePointer ? (null != this.prevY && (this.velY = t.y - this.prevY), this.prevY = t.y, null != this.prevX && (this.velX = t.x - this.prevX), this.prevX = t.x) : (this.prevY = null, this.prevX = null), this._x += this.velX, this._y += this.velY, this.velX *= .95, this.velY *= .95, this.updatePosition(), this.lastLvlMsg && this.lastLvlMsg.update()
        }
    }, G.WorldMap.prototype.updatePosition = function() {
        var t = Math.min(this.mapHeight, this.gateLayer.getMinY() + 500);
        this.state.EDITOR && (t = this.mapHeight), this._y = game.math.clamp(this._y, game.height, Math.max(game.height, t)), this.y = game.math.clamp(Math.round(this._y), game.height, Math.max(game.height, t));
        var e = Math.max(0, .5 * (1200 - game.width));
        this._x = game.math.clamp(this._x, 320 - e, 320 + e), this.x = Math.ceil(this._x)
    }, G.WorldMap.prototype.processMaptiles = function(t) {
        this.mapHeight = t.totalHeight, this.editorMode && (this.mapHeight *= 2);
        for (var e = 0; e < t.tiles.length; e++) {
            var i = t.tiles[e],
                s = game.cache.getRenderTexture(i.rt);
            img = game.make.image(0, i.y, s.texture), img.anchor.setTo(.5, 1), img.autoCull = !0, this.add(img)
        }
    }, G.WorldMap.prototype.processMaptilesStatic = function() {
        this.mapHeight = G.json.settings.mapHeight, this.editorMode && (this.mapHeight *= 2);
        for (var t = G.json.settings.mapHeight, e = 0, i = 0; 0 < t;) {
            var s = "Map_background_tileable_" + e % 4;
            G.makeImage(0, i, s, [.5, 1], this).autoCull = !0;
            var a = game.cache.getFrame(s).height;
            i -= a, t -= a, e++
        }
    }, G.WorldMap.prototype.refreshButtons = function() {
        this.btnLayer.refreshData()
    }, G.WorldMap.prototype.processAnimElements = function(t) {
        t.forEach(function(t) {
            var e = G.makeImage(t[0], t[1], t[2], .5, this);
            e.tweenY = game.add.tween(e).to({
                y: e.y - G.l(20)
            }, 5e3, Phaser.Easing.Sinusoidal.InOut, !0, 0, -1, !0), e.angle = -15, e.tweenAngle = game.add.tween(e).to({
                angle: 15
            }, 1e4, Phaser.Easing.Sinusoidal.InOut, !0, 0, -1, !0), e.tweenY.timeline[0].dt = Math.random() * e.tweenY.timeline[0].duration, e.tweenAngle.timeline[0].dt = Math.random() * e.tweenAngle.timeline[0].duration
        }, this)
    }, G.WorldMap.prototype.lockInput = function() {
        this.lockedInput = !0, this.btnLayer.ignoreChildInput = !0, this.chestLayer.lockInput(), this.gateLayer.lockInput()
    }, G.WorldMap.prototype.unlockInput = function() {
        this.lockedInput = !1, this.btnLayer.ignoreChildInput = !1, this.chestLayer.unlockInput(), this.gateLayer.unlockInput()
    }, G.WorldMap.prototype.afterLvlPartBatch = function(t, e, i) {
        console.log("after lvl batch");
        var n = "coins" == i,
            s = this.btnLayer.getButtonObj(t);
        if (s) {
            var a = this.state.uiTargetParticlesBW.createDividedBatch(game.world.bounds.x + s.worldPosition.x, s.worldPosition.y, n ? "coin_1" : "map_star_1", n ? this.state.panel.coinsTxt : this.state.panel.starsTxt, e, n ? 5 : 1);
            a.addOnPartStart(function() {
                n && this.scale.setTo(.75), this.speedDelta = 1.5, this.speedMax = 35;
                var t = 0,
                    e = G.lnf(-2 * Math.random() - 5),
                    i = game.rnd.realInRange(-2.5, 2.5),
                    s = this.y,
                    a = game.rnd.realInRange(-2.5, 2.5);
                this.update = function() {
                    this.grounded || (this.x += i, s += a, 0 < (t += e) ? 4 < Math.abs(e) ? e *= -.7 : (verVelX = 0, !(a = i = 0), game.time.events.add(game.rnd.between(200, 600), function() {
                        this.update = G.UITargetParticle.prototype.update
                    }, this)) : e += .5, t = Math.min(0, t), this.y = s + t)
                }
            }), a.addOnPartFinish(function() {
                if (n) G.saveState.changeCoins(this.carriedValue, !0);
                else {
                    var t = this.state.panel.starsTxt;
                    t.setText(parseInt(t.text) + 1)
                }
            }), this.batchesWaitingForFinish++, a.onFinish.add(function() {
                this.batchesWaitingForFinish--, 0 == this.batchesWaitingForFinish && (this.afterBatch(), G.saveState.save())
            }, this), a.start()
        }
    }, G.WorldMap.prototype.afterBatch = function() {
        var e = G.saveState.getAllStars(),
            t = G.json.settings.mapChests.filter(function(t) {
                return t.req <= e && !G.saveState.data.mapChests[t.id]
            })[0];
        if (t) this.scrollToPoint({
            x: t.mapX,
            y: t.mapY
        }), G.sb("mapChestWindowClosed").addOnce(function() {
            this.scrollToPoint({
                lvlNr: G.saveState.getLastPassedLevelNr()
            })
        }, this);
        else {
            if (this.unlockInput(), G.saveState.getLastPassedLevelNr() == G.json.levels.length) return;
            if (G.saveState.getLastPassedLevelNr() === G.saveState.getFirstClosedGateLvLIndex()) return;
            if (!G.json.settings.bubbleGifts.find(function(t) {
                    return t.levelNumber - 1 == G.saveState.getLastPassedLevelNr() && !G.saveState.isBubbleGiftUsed(t.levelNumber)
                })) {
                var i = game.math.clamp(G.saveState.getLastPassedLevelNr(), 0, G.json.levels.length - 1),
                    s = G.json.levels[i];
                G.lvlNr = i, G.lvlData = s, G.sb("pushWindow").dispatch(["level", i])
            }
        }
    }, G.WorldMapCoinLayer = function(t) {
        Phaser.Group.call(this, game), this.position = t.position, this.inputEnabledChildren = !1
    }, G.WorldMapCoinLayer.prototype = Object.create(Phaser.Group.prototype), G.WorldMapCoinLayer.prototype.update = function() {
        this.sort("y", Phaser.Group.SORT_ASCENDING);
        for (var t = this.children.length; t--;) this.children[t].update()
    }, G.WorldMapCoinLayer.prototype.rewardOnLvl = function(t, e, i) {
        for (var s = G.l(G.json.levels[t].mapX), a = G.l(G.json.levels[t].mapY), n = e; 0 < n;) this.add(new G.WorldMapRewardPart(s, a, "coin", Math.min(n, 15))), n -= 15;
        for (var o = 0; o < i; o++) this.add(new G.WorldMapRewardPart(s, a, "star"))
    }, G.WorldMapRewardPart = function(t, e, i, s) {
        Phaser.Image.call(this, game, t, e), G.changeTexture(this, "coin" == i ? "coin_1" : "star"), this.rewardType = i, this.coinValue = s || 0, this.anchor.setTo(.5), this.scale.setTo("coin" == i ? .5 : .3), this.verOffsetY = 0, this.verVelY = G.lnf(-2 * Math.random() - 3), this.velX = G.lnf(3 * Math.random() - 1.5), this.yy = e, this.velYY = G.lnf(3 * Math.random() - 1.5), this.grounded = !1
    }, G.WorldMapRewardPart.prototype = Object.create(Phaser.Image.prototype), G.WorldMapRewardPart.prototype.update = function() {
        this.grounded || (this.x += this.velX, this.yy += this.velYY, this.verOffsetY += this.verVelY, this.verVelY += .2, 0 < this.verOffsetY && (2 < Math.abs(this.verVelY) ? this.verVelY *= -.6 : (this.verVelX = 0, this.velX = 0, this.velYY = 0, this.grounded = !0, game.time.events.add(Math.floor(500 * Math.random() + 200), function() {
            G.sb("onMapToUIPart").dispatch(this), this.destroy()
        }, this))), this.verOffsetY = Math.min(0, this.verOffsetY), this.y = this.yy + this.verOffsetY)
    }, G.WorldMapLvlButton = function() {
        var t = G.TreasureHunt.treasureHuntMgr;
        G.Button.call(this, 0, 0, null, this.handleClick, this), this.state = game.state.getCurrentState(), this.treasureHuntWrapper = G.makeImage(-3, 5, "trasure_hunt_wrapper", .5, this), this.starsImg = G.makeImage(0, 30, null, .5, this), this.lvlNrTxt = this.addChild(new G.Text(0, -16, "1", {
            style: "font-white",
            fontSize: "50px"
        }, .5)), this.state = game.state.getCurrentState(), this.addTerm(function() {
            return !G.saveState.isLevelBehindGate(this.lvlIndex)
        }, this), this.kill(), this.state.EDITOR && G.sb("editorLevelSelected").add(this.editorCheckTint, this), G.Utils.cleanUpOnDestroy(this, t.onEventTurnedOnChange.add(this.setTreasureHuntWrapper, this))
    }, G.WorldMapLvlButton.prototype = Object.create(G.Button.prototype), G.WorldMapLvlButton.prototype.handleClick = function() {
        (this.state.EDITOR || this.lvlAvailable) && (this.state.EDITOR ? (this.state.selectLevel(this.lvlIndex), this.IMMEDIATE = !0) : 0 == G.saveState.getCurrentLivesNr() && 0 == G.saveState.getUnlimitedLivesSec() ? G.sb("pushWindow").dispatch("notEnoughLives") : (G.lvlNr = this.lvlIndex, G.lvlData = G.json.levels[this.lvlIndex], G.sb("pushWindow").dispatch(["level", this.lvlIndex])))
    }, G.WorldMapLvlButton.prototype.revealChange = function() {
        game.add.tween(this.starsImg.scale).to({
            x: 1,
            y: 1
        }, 500, Phaser.Easing.Elastic.Out, !0, 1500).onComplete.add(function() {
            this.inputEnabled = !0, this.input.useHandCursor = !0
        }, this), this.state.lastLevelData.lvlNr = -999
    }, G.WorldMapLvlButton.prototype.init = function(t, e) {
        this.alpha = 1, this.stopPulse(), this.revive(), G.stopTweens(this), G.stopTweens(this.starsImg), this.starsImg.scale.setTo(1), this.x = G.l(e.mapX), this.y = G.l(e.mapY), this.lvlIndex = t, this.lvlAvailable = G.saveState.isLevelAvailable(this.lvlIndex), this.lvlStarsNr = G.saveState.getStars(this.lvlIndex), this.lvlAvailable ? (this.lvlNrTxt.visible = !0, this.lvlNrTxt.setText((this.lvlIndex + 1).toString()), 0 == this.lvlStarsNr ? (G.changeTexture(this, "map_point_2"), G.changeTexture(this.starsImg, null), this.pulse()) : (G.changeTexture(this, "map_point"), G.changeTexture(this.starsImg, "map_star_" + this.lvlStarsNr)), this.inputEnabled = !0, this.input.useHandCursor = !0) : (G.changeTexture(this, "map_point"), G.changeTexture(this.starsImg, null), this.lvlNrTxt.visible = !1, this.alpha = .5, this.inputEnabled = !1, this.input.useHandCursor = !1), e.showAsHard && G.changeTexture(this, "map_point_hard"), this.state.EDITOR && this.editorCheckTint(), this.setTreasureHuntWrapper()
    }, G.WorldMapLvlButton.prototype.setTreasureHuntWrapper = function() {
        var t = G.TreasureHunt.treasureHuntMgr,
            e = t.isEventActive();
        this.alive && (e && t.isLevelTreasureHuntActive(this.lvlIndex) ? this.treasureHuntWrapper.visible = !0 : this.treasureHuntWrapper.visible = !1)
    }, G.WorldMapLvlButton.prototype.editorCheckTint = function() {
        this.state.EDITOR && this.state.selectedLevels.includes(this.lvlIndex)
    }, G.WorldMapLvls = function(t) {
        G.PoolGroup.call(this, G.WorldMapLvlButton), this.position = t.position, this.lvlBtnCoords = G.json.levels.map(function(t, e) {
            return {
                mapY: G.l(t.mapY),
                lvlIndex: e,
                btnObj: null,
                lvlData: t
            }
        }).sort(function(t, e) {
            return t.mapY - e.mapY
        }), G.sb("onWindowOpened").add(this.lockInput, this), G.sb("onWindowClosed").add(this.unlockInput, this)
    }, G.WorldMapLvls.prototype = Object.create(G.PoolGroup.prototype), G.WorldMapLvls.prototype.refreshData = function() {
        this.lvlBtnCoords.forEach(function(t, e) {
            t.btnObj && this.detachButton(e)
        }, this), this.lvlBtnCoords = G.json.levels.map(function(t, e) {
            return {
                mapY: G.l(t.mapY),
                lvlIndex: e,
                btnObj: null,
                lvlData: t
            }
        })
    }, G.WorldMapLvls.prototype.getButtonObj = function(t) {
        for (var e = 0; e < this.children.length; e++) {
            var i = this.children[e];
            if (i.lvlIndex == t) return i
        }
    }, G.WorldMapLvls.prototype.update = function() {
        for (var t = this.y - game.height, e = !1, i = 0; i < this.lvlBtnCoords.length; i++) t - G.l(40) + this.lvlBtnCoords[i].mapY < 0 && 0 < t + game.height + G.l(40) + this.lvlBtnCoords[i].mapY ? (null === this.lvlBtnCoords[i].btnObj && this.attachButton(i), e = !0) : null !== this.lvlBtnCoords[i].btnObj ? this.detachButton(i) : e
    }, G.WorldMapLvls.prototype.attachButton = function(t) {
        this.lvlBtnCoords[t].btnObj = this.getFreeElement(), this.lvlBtnCoords[t].btnObj.init(this.lvlBtnCoords[t].lvlIndex, this.lvlBtnCoords[t].lvlData)
    }, G.WorldMapLvls.prototype.detachButton = function(t) {
        this.lvlBtnCoords[t].btnObj.kill(), this.lvlBtnCoords[t].btnObj = null
    }, G.WorldMapLvls.prototype.unlockInput = function() {
        this.ignoreChildInput = !1
    }, G.WorldMapLvls.prototype.lockInput = function() {
        this.ignoreChildInput = !0
    }, G.Booster = function(t, e, i) {
        this.board = G.lvl.state.board, this.am = this.board.actionManager, this.cellX = t, this.cellY = e, Phaser.Image.call(this, game, this.board.cellXToPxIn(t), this.board.cellYToPxIn(e - 2)), this.anchor.setTo(.5), this.boosterNr = i, this.orgY = this.y, this.targetY = this.board.cellYToPxIn(e), G.changeTexture(this, "ui_booster_" + i), this.alpha = 0, this.scale.setTo(2), game.add.tween(this.scale).to({
            x: 1,
            y: 1
        }, 700, Phaser.Easing.Sinusoidal.Out, !0), game.add.tween(this).to({
            alpha: 1
        }, 700, Phaser.Easing.Sinusoidal.Out, !0).onComplete.add(function() {
            game.add.tween(this).to({
                y: this.targetY
            }, 300, Phaser.Easing.Cubic.In, !0).onComplete.add(function() {
                var t = this.getMatchCandy(this.boosterNr);
                3 == this.boosterNr && (G.sb("fx").dispatch("strokeH", t), G.sb("fx").dispatch("lightCircle", t), G.sb("fx").dispatch("explosion", t)), 4 == this.boosterNr && (G.sb("fx").dispatch("strokeV", t), G.sb("fx").dispatch("lightCircle", t), G.sb("fx").dispatch("explosion", t)), this.board.checkSpecialMatchList.push(t), this.am.newAction("processMatch"), this.am.removeAction(), game.add.tween(this).to({
                    y: this.orgY,
                    alpha: 0
                }, 600, Phaser.Easing.Cubic.Out, !0), game.time.events.add(600, this.destroy, this)
            }, this)
        }, this)
    }, G.Booster.prototype = Object.create(Phaser.Image.prototype), G.Booster.prototype.getMatchCandy = function(t) {
        return 2 == t ? {
            cellX: this.cellX,
            cellY: this.cellY,
            exe: [
                ["specific", [0, 0]]
            ]
        } : 3 == t ? {
            cellX: this.cellX,
            cellY: this.cellY,
            exe: [
                ["loop", {
                    x: -1,
                    y: 0
                }],
                ["loop", {
                    x: 1,
                    y: 0
                }]
            ]
        } : 4 == t ? {
            cellX: this.cellX,
            cellY: this.cellY,
            exe: [
                ["loop", {
                    x: 0,
                    y: -1
                }],
                ["loop", {
                    x: 0,
                    y: 1
                }]
            ]
        } : void 0
    }, G.BoosterHorizontal = function(t, e, i) {
        this.board = G.lvl.state.board, this.am = this.board.actionManager, this.cellX = t, this.cellY = e, Phaser.Image.call(this, game, this.board.cellXToPxIn(-.5), this.board.cellYToPxIn(e)), this.anchor.setTo(.5), this.oldCellX = -1, this.boosterNr = i, this.active = !1, this.orgY = this.y, this.targetX = this.board.cellYToPxIn(this.board.boardData.width) + G.l(30), G.changeTexture(this, "ui_booster_" + i), this.alpha = 0, this.scale.setTo(2), game.add.tween(this.scale).to({
            x: 1,
            y: 1
        }, 1e3, Phaser.Easing.Sinusoidal.Out, !0), game.add.tween(this).to({
            alpha: 1
        }, 1e3, Phaser.Easing.Sinusoidal.Out, !0).onComplete.add(function() {
            this.active = !0
        }, this)
    }, G.BoosterHorizontal.prototype = Object.create(Phaser.Image.prototype), G.BoosterHorizontal.prototype.update = function() {
        if (this.active) {
            this.x += G.l(10);
            var t, e = this.board.pxInToCellX(this.x);
            e != this.oldCellX && (this.oldCellX = e, (t = this.board.getCandy(e - 1, this.cellY)) && (this.board.hitCell(e - 1, this.cellY), this.board.isCellMatchable(e - 1, this.cellY) && (this.board.boardDirt.isToken(e - 1, this.cellY) && this.board.boardDirt.onMatch(e - 1, this.cellY), this.board.boardDirtS.isToken(e - 1, this.cellY) && this.board.boardDirtS.onMatch(e - 1, this.cellY), this.board.boardCage.isToken(e - 1, this.cellY) ? this.board.boardCage.onMatch(e - 1, this.cellY) : t.special ? this.board.checkSpecialMatchList.push(t) : (t.match(), G.sfx.boom.play(), G.lvl.processMatch(1, t.cellX, t.cellY))))), this.x >= this.targetX && 0 == this.board.duringAnimation && (this.active = !1, 0 == this.board.checkSpecialMatchList.length ? this.am.newAction("processFall") : this.am.newAction("processMatch"), G.sb("onBoosterActionFinished").dispatch(), this.am.removeAction(), this.destroy())
        }
    }, G.BoosterSelection = function(t, e, i) {
        this.board = G.lvl.state.board, this.am = this.board.actionManager, this.cellX = t, this.cellY = e, Phaser.Image.call(this, game, this.board.cellXToPxIn(t), this.board.cellYToPxIn(e)), this.alpha = 0, this.follow = i, this.anchor.setTo(0), G.changeTexture(this, "tut_hand"), this.offsetTween = 0, game.add.tween(this).to({
            offsetTween: G.l(20)
        }, 300, Phaser.Easing.Sinusoidal.InOut, !0, 0, -1, !0), this.alphaTween = game.add.tween(this).to({
            alpha: .8
        }, 300, Phaser.Easing.Sinusoidal.Out, !0)
    }, G.BoosterSelection.prototype = Object.create(Phaser.Image.prototype), G.BoosterSelection.prototype.update = function() {
        this.x = this.follow.x + this.offsetTween, this.y = this.follow.y + this.offsetTween
    }, G.BoosterSelection.prototype.hide = function() {
        this.alphaTween.stop(), game.add.tween(this).to({
            alpha: 0
        }, 300, Phaser.Easing.Sinusoidal.Out, !0, 200).onComplete.add(function() {
            this.destroy()
        }, this)
    }, G.BoosterVertical = function(t, e, i) {
        this.board = G.lvl.state.board, this.am = this.board.actionManager, this.cellX = t, this.cellY = e, Phaser.Image.call(this, game, this.board.cellXToPxIn(t), this.board.cellYToPxIn(-.5)), this.anchor.setTo(.5), this.boosterNr = i, this.oldCellY = -1, this.orgY = this.y, this.targetY = this.board.cellYToPxIn(this.board.boardData.height) + G.l(30), G.changeTexture(this, "ui_booster_" + i), this.alpha = 0, this.scale.setTo(2), game.add.tween(this.scale).to({
            x: 1,
            y: 1
        }, 1e3, Phaser.Easing.Sinusoidal.Out, !0), game.add.tween(this).to({
            alpha: 1
        }, 1e3, Phaser.Easing.Sinusoidal.Out, !0).onComplete.add(function() {
            this.active = !0
        }, this)
    }, G.BoosterVertical.prototype = Object.create(Phaser.Image.prototype), G.BoosterVertical.prototype.getMatchCandy = function(t) {
        return 2 == t ? {
            cellX: this.cellX,
            cellY: this.cellY,
            exe: [
                ["specific", [0, 0]]
            ]
        } : 3 == t ? {
            cellX: this.board.boardData.width - 1,
            cellY: this.cellY,
            exe: [
                ["loop", {
                    x: -1,
                    y: 0
                }],
                ["loop", {
                    x: 1,
                    y: 0
                }]
            ]
        } : 4 == t ? {
            cellX: this.cellX,
            cellY: this.board.boardData.height - 1,
            exe: [
                ["loop", {
                    x: 0,
                    y: -1
                }],
                ["loop", {
                    x: 0,
                    y: 1
                }]
            ]
        } : void 0
    }, G.BoosterVertical.prototype.update = function() {
        if (this.active) {
            this.y += G.l(10);
            var t, e = this.board.pxInToCellY(this.y);
            e != this.oldCellY && (this.oldCellY = e, (t = this.board.getCandy(this.cellX, e - 1)) && (this.board.hitCell(this.cellX, e - 1), this.board.isCellMatchable(this.cellX, e - 1) && (this.board.boardDirt.isToken(this.cellX, e - 1) && this.board.boardDirt.onMatch(this.cellX, e - 1), this.board.boardDirtS.isToken(this.cellX, e - 1) && this.board.boardDirtS.onMatch(this.cellX, e - 1), this.board.boardCage.isToken(this.cellX, e - 1) ? this.board.boardCage.onMatch(this.cellX, e - 1) : t.special ? this.board.checkSpecialMatchList.push(t) : (t.match(), G.sfx.boom.play(), G.lvl.processMatch(1, t.cellX, t.cellY))))), this.y >= this.targetY && 0 == this.board.duringAnimation && (this.active = !1, 0 == this.board.checkSpecialMatchList.length ? this.am.newAction("processFall") : this.am.newAction("processMatch"), G.sb("onBoosterActionFinished").dispatch(), this.am.removeAction(), this.destroy())
        }
    }, G.CommonObjects = G.CommonObjects || {}, G.CommonObjects.ClockTimer = function(t, e) {
        Phaser.Group.call(this, game), this.position.setTo(t, e), this.bg = G.makeImage(0, 0, "timer_bar", .5, this), this.text = this.add(new G.Text(27, 2, "??d ??h ??m", {
            style: "font-white",
            fontSize: 25
        }, .5, 100)), this.active = !1, this.secLeft = 0, G.sb("onWallClockTimeUpdate").add(this.onTick, this)
    }, G.CommonObjects.ClockTimer.prototype = Object.create(Phaser.Group.prototype), G.CommonObjects.ClockTimer.prototype.setEndDate = function(t, e) {
        this.secLeft = Math.floor((t - Date.now()) / 1e3), this.updateText(this.secLeft), e && this.start()
    }, G.CommonObjects.ClockTimer.prototype.start = function() {
        return 0 < this.secLeft && (this.active = !0, this.updateText(this.secLeft), !0)
    }, G.CommonObjects.ClockTimer.prototype.onTick = function() {
        this.active && (this.secLeft--, this.updateText(this.secLeft), 0 === this.secLeft && (this.active = !1))
    }, G.CommonObjects.ClockTimer.prototype.updateText = function(t) {
        var e = G.changeSecToDHMS(t),
            i = e[0] + "d " + e[1] + "h " + e[2] + "m";
        this.text.text !== i && this.text.setText(i)
    }, G.CommonObjects = G.CommonObjects || {}, G.CommonObjects.DoubleShine = function(t, e) {
        Phaser.Group.call(this, game), this.position.setTo(t || 0, e || 0), this.shine1 = G.makeImage(0, 0, "shine_godrays", .5, this), this.shine1.blendMode = 1, this.shine1.name = "shine1", G.Animations.getDoubleShineAnimation().animate(this.game, this)
    }, G.CommonObjects.DoubleShine.prototype = Object.create(Phaser.Group.prototype), G.CommonObjects = G.CommonObjects || {}, G.CommonObjects.PageScroller = function(t) {
        Phaser.Group.call(this, game), this.onPageIndexChanged = new Phaser.Signal, this.scrollInput = this.addDragContainer(t.width, t.height), this.pagesContainer = game.add.group(this), this.currentPageIndex = 0, this.visiblePageIndex = 0, this.pageWidth = t.pageWidth, this.dragThreshold = t.dragThreshold
    }, G.CommonObjects.PageScroller.prototype = Object.create(Phaser.Group.prototype), G.CommonObjects.PageScroller.prototype.addDragContainer = function(t, e) {
        var i = new G.ScrollInput(-.5 * t, -.5 * e, t, e);
        return this.add(i), i
    }, G.CommonObjects.PageScroller.prototype.update = function() {
        Phaser.Group.prototype.update.call(this), this.updateInput(), this.pagesContainer.x = this.visiblePageIndex * this.pageWidth * -1, this.updatePagesAlpha()
    }, G.CommonObjects.PageScroller.prototype.updateInput = function() {
        if (this.scrollInput.isDuringDrag()) {
            this.visiblePageIndex += this.scrollInput.getDeltaX() / this.pageWidth;
            var t = this.visiblePageIndex - this.currentPageIndex;
            Math.abs(t) > this.dragThreshold && (this.scrollInput.stopDragging(), this.changePage(this.currentPageIndex + Math.sign(t)))
        } else this.visiblePageIndex = G.lerp(this.visiblePageIndex, this.currentPageIndex, .3, .01)
    }, G.CommonObjects.PageScroller.prototype.updatePagesAlpha = function() {
        for (var t = 0, e = this.pagesContainer.length; t < e; t++) {
            var i = this.pagesContainer.getChildAt(t);
            if (i) {
                var s = Math.abs(this.visiblePageIndex - t);
                i.alpha = game.math.clamp(1 - s, 0, 1)
            }
        }
    }, G.CommonObjects.PageScroller.prototype.changePage = function(t) {
        if (t = game.math.clamp(t, 0, this.getMaxPageIndex()), this.currentPageIndex === t) return !1;
        var e = this.pagesContainer.children[this.currentPageIndex];
        e && (e.ignoreChildInput = !0), this.currentPageIndex = t;
        var i = this.pagesContainer.children[this.currentPageIndex];
        return i && (i.ignoreChildInput = !1), this.onPageIndexChanged.dispatch(this.currentPageIndex, this.getMaxPageIndex()), !0
    }, G.CommonObjects.PageScroller.prototype.goToNextPage = function() {
        this.changePage(this.currentPageIndex + 1)
    }, G.CommonObjects.PageScroller.prototype.goToPreviousPage = function() {
        this.changePage(this.currentPageIndex - 1)
    }, G.CommonObjects.PageScroller.prototype.addPage = function(t) {
        return t.x = this.pagesContainer.children.length * this.pageWidth, this.pagesContainer.add(t), this.currentPageIndex !== this.pagesContainer.getChildIndex(t) && (t.ignoreChildInput = !0, t.alpha = 0), t
    }, G.CommonObjects.PageScroller.prototype.getCurrentPageIndex = function() {
        return this.currentPageIndex
    }, G.CommonObjects.PageScroller.prototype.getMaxPageIndex = function() {
        return this.pagesContainer.length - 1
    }, G.DailyWheel = function(t, e) {
        Phaser.Group.call(this, game), this.state = game.state.getCurrentState(), this.x = G.l(t), this.y = G.l(e), this.prizeTable = G.json.settings.wheelPrizes, this.prizeTableGold = G.json.settings.wheelPrizesGold, this.prizeTable.forEach(function(t) {
            G.gift.processRandomBoosters(t.prize)
        }), this.prizeTableGold.forEach(function(t) {
            G.gift.processRandomBoosters(t.prize)
        }), this.angleBetweenFields = 360 / this.prizeTable.length, this.anglePrizeStartOffset = this.angleBetweenFields / 2, this.angleDiffSinceLastPin = 0, this.angleBetweenPins = 15, this.angleSpeedMulti = .985, this.wheelGfx = this.add(this.makeWheelGfx(0, 0, "prize_wheel_2", this.prizeTable)), this.wheelGfxGold = this.add(this.makeWheelGfx(0, 0, "gold_wheel", this.prizeTableGold)), this.wheelPointer = this.add(this.makeWheelPointer(0, -180, "prize_wheel_arrow")), WH = this.wheelGfx, this.wheelGfx.wheelDistancePassed = 0, this.wheelGfx.prevDistancePassed = 0, this.wheelGfx.inputEnabled = !0, this.pointer = null, this.pointerStartX = 0, this.pointerClickedDate = 0, this.launched = !1, this.finished = !1, this.wheelGfx.events.onInputDown.add(function() {
            var t = game.input.activePointer;
            this.pointerStartX.worldX, this.pointerClickedDate = Date.now(), this.pointer = t
        }, this), this.onFinish = new Phaser.Signal, this.gold = !1
    }, G.DailyWheel.prototype = Object.create(Phaser.Group.prototype), G.DailyWheel.prototype.changeToRegular = function() {
        this.gold = !1
    }, G.DailyWheel.prototype.changeToGold = function() {
        this.gold = !0
    }, G.DailyWheel.prototype.update = function() {
        if (this.wheelGfxGold.angle = this.wheelGfx.angle, this.gold ? (this.wheelGfx.alpha = G.lerp(this.wheelGfx.alpha, 0, .1, .02), this.wheelGfxGold.alpha = G.lerp(this.wheelGfxGold.alpha, 1, .1, .02)) : (this.wheelGfx.alpha = G.lerp(this.wheelGfx.alpha, 1, .1, .02), this.wheelGfxGold.alpha = G.lerp(this.wheelGfxGold.alpha, 0, .1, .02)), this.wheelPointer.update(), !this.finished) {
            if (this.launched) {
                var t = this.updateLaunched();
                t && (this.onFinish.dispatch(t.prize), this.finished = !0)
            } else null !== this.pointer && this.pointer.isDown;
            for (var e = this.children.length; e--;) this.children[e].update()
        }
    }, G.DailyWheel.prototype.restart = function() {
        this.finished && (this.launched = !1, this.pointer = null, this.finished = !1, this.giftGfx && game.add.tween(this.giftGfx.scale).to({
            x: 0,
            y: 0
        }, 300, Phaser.Easing.Cubic.In, !0).onComplete.add(function() {
            this.destroy()
        }, this.giftGfx), this.wheelGfx.inputEnabled = !0)
    }, G.DailyWheel.prototype.launch = function(t) {
        for (this.wheelGfx.inputEnabled = !1;;) {
            var e = this.testSpin(t, this.wheelGfx.prevDistancePassed, this.wheelGfx.wheelDistancePassed);
            if (!e.keep) break;
            if (!(Math.random() > e.keep)) break;
            t += 80
        }
        this.wheelGfx.angleSpeed = .025 * t, this.launched = !0
    }, G.DailyWheel.prototype.updateLaunched = function() {
        return this.updateWheel(this.wheelGfx, !0)
    }, G.DailyWheel.prototype.applyPrize = function(t) {}, G.DailyWheel.prototype.testSpin = function(t, e, i) {
        var s = {
            angle: 0
        };
        for (s.angleSpeed = .025 * t, s.prevDistancePassed = e || 0, s.wheelDistancePassed = i || 0;;) {
            var a = this.updateWheel(s);
            if (a) return a
        }
    }, G.DailyWheel.prototype.updateWheel = function(t, e) {
        t.angle += t.angleSpeed;
        var i = t.wheelDistancePassed;
        return t.wheelDistancePassed += t.angleSpeed, Math.floor(i / this.angleBetweenPins) !== Math.floor(t.wheelDistancePassed / this.angleBetweenPins) && (e && this.wheelPointer.bounce(-1 * Math.sign(t.angleSpeed)), t.angleSpeed = .95 * t.angleSpeed, t.angleSpeed < .25 && (t.wheelDistancePassed = i, t.angle = game.math.wrapAngle(i), t.angleSpeed *= -.5)), t.angleSpeed *= this.angleSpeedMulti, this.wheelGfxGold.angle = t.angle, Math.abs(t.angleSpeed) < .05 && this.getPrizeFromAngle(t.angle)
    }, G.DailyWheel.prototype.getPrizeFromAngle = function(t) {
        var e = t + 180;
        return t < 0 && (e = 180 + t), (this.gold ? this.prizeTableGold : this.prizeTable)[Math.floor(e / this.angleBetweenFields)]
    }, G.DailyWheel.prototype.makeWheelGfx = function(t, e, i, s) {
        wheel = G.makeImage(0, 0, i, .5), wheel.labels = wheel.addChild(game.make.group());
        for (var a = s.length - 1, n = this.anglePrizeStartOffset; n < 360; n += this.angleBetweenFields) {
            var o = s[a],
                r = new G.LabelTextT(G.gift.getLabelString(o.prize, 1.4), G.lengthDirX(90 + n, 160, !1), G.lengthDirY(90 + n, 160, !1), {
                    style: o.specialField ? "font-num-orange" : "font-num-blue",
                    fontSize: "30px",
                    scaleStroke: !0
                }, [1, .5], 200);
            r.angle = 90 + n, wheel.labels.add(r), a--
        }
        return wheel.labels.cacheAsBitmap = !0, wheel
    }, G.DailyWheel.prototype.makeWheelPointer = function(t, e, i) {
        var s = G.makeImage(t, e, i, .5, null);
        return s.soundTimer = 2, s.bounce = function(t) {
            this.soundTimer < 0 && (G.sfx.pop.play(), this.soundTimer = 2), this.angle = 10 * t
        }, s.update = function() {
            this.soundTimer--, this.angle = G.lerp(this.angle, 0, .2)
        }, s
    }, G.DailyRewardBoxIcon = function(t, e, i) {
        Phaser.Group.call(this, game), this.position.setTo(t, e), G.json.settings.dailyReward.days[i - 1].boxIcon.forEach(function(t) {
            var e = t.sprite || "medium_green_present",
                i = t.pos || [0, 0],
                s = t.scale || [1, 1];
            G.makeImage(i[0], i[1], e, .5, this).scale.setTo(s[0], s[1])
        }, this)
    }, G.DailyRewardBoxIcon.prototype = Object.create(Phaser.Group.prototype), G.DailyRewardCurrentGift = function(t, e, i) {
        Phaser.Group.call(this, game), this.position.setTo(t, e), this.dayConfig = G.json.settings.dailyReward.days[i], this.giftPanel = this.add(new G.DailyRewardCurrentGiftPrizePanel(0, -30, this.dayConfig)), this.giftPanel.visible = !1, this.boxIcon = G.makeImage(0, 0, "big_pink_present", .5, this), this.boxIcon.inputEnabled = !0, this.boxIcon.input.useHandCursor = !0, this.onBoxClicked = new Phaser.Signal, this.boxIcon.events.onInputDown.add(function() {
            this.onBoxClicked.dispatch()
        }, this), this.boxJump(), this.add(this.boxIcon)
    }, G.DailyRewardCurrentGift.prototype = Object.create(Phaser.Group.prototype), G.DailyRewardCurrentGift.prototype.showReward = function() {
        this.boxIcon.inputEnabled = !1, game.add.tween(this.boxIcon).to({
            alpha: 0,
            width: 1.2 * this.boxIcon.width,
            height: 1.2 * this.boxIcon.height
        }, 300, Phaser.Easing.Sinusoidal.Out, !0), this.giftPanel.show()
    }, G.DailyRewardCurrentGift.prototype.doubleGift = function(t, e) {
        this.giftPanel.doubleGift(t, e)
    }, G.DailyRewardCurrentGift.prototype.claimReward = function() {
        this.giftPanel.claimPrize()
    }, G.DailyRewardCurrentGift.prototype.boxJump = function() {
        if (1 == this.boxIcon.alpha && this.boxIcon.visible) {
            var t = game.add.tween(this.boxIcon).to({
                    y: -G.l(15)
                }, 150, Phaser.Easing.Cubic.Out),
                e = game.add.tween(this.boxIcon).to({
                    y: 0
                }, 150, Phaser.Easing.Circular.In);
            t.chain(e), t.start();
            var i = game.add.tween(this.boxIcon).to({
                    angle: -3
                }, 100, Phaser.Easing.Cubic.InOut),
                s = game.add.tween(this.boxIcon).to({
                    angle: 3
                }, 170, Phaser.Easing.Sinusoidal.In),
                a = game.add.tween(this.boxIcon).to({
                    angle: 0
                }, 30, Phaser.Easing.Cubic.InOut);
            i.chain(s, a), i.start(), game.time.events.add(1e3, this.boxJump, this)
        }
    }, G.DailyRewardCurrentGiftPrizePanel = function(t, e, i) {
        Phaser.Group.call(this, game), this.position.setTo(t, e), this.dayConfig = i, this.prize = G.Utils.clone(this.dayConfig.gifts), this.bg = G.makeImage(0, 0, "daily_prize_panel_bg", .5, this), "coin" === this.prize[0][0] ? this.icon = G.makeImage(0, 0, "coin_3", .5, this) : this.icon = this.add(new G.DailyRewardGiftIcon(0, 0, this.prize)), this.descText = this.addDescText(0, 130, this.prize), this.visible = !1
    }, G.DailyRewardCurrentGiftPrizePanel.prototype = Object.create(Phaser.Group.prototype), G.DailyRewardCurrentGiftPrizePanel.prototype.doubleGift = function(t, e) {
        G.platform.showAd(!0, function() {
            t.call(e), this.dblSuccess()
        }, function() {
            new G.NoMoreAds
        }, this)
    }, G.DailyRewardCurrentGiftPrizePanel.prototype.show = function() {
        this.visible = !0, this.alpha = 0, game.add.tween(this).to({
            alpha: 1
        }, 300, Phaser.Easing.Sinusoidal.Out, !0), this.icon.scale.setTo(0), game.add.tween(this.icon.scale).to({
            x: 1.2,
            y: 1.2
        }, 300, Phaser.Easing.Elastic.Out, !0), this.dblBtn && (this.dblBtn.scale.setTo(0), game.add.tween(this.dblBtn.scale).to({
            x: 1,
            y: 1
        }, 300, Phaser.Easing.Elastic.Out, !0, 150)), this.descText.scale.setTo(0), game.add.tween(this.descText.scale).to({
            x: 1,
            y: 1
        }, 300, Phaser.Easing.Elastic.Out, !0, 300)
    }, G.DailyRewardCurrentGiftPrizePanel.prototype.claimPrize = function() {
        this.dblBtn && (this.dblBtn.inputEnabled = !1), this.processClaim(this.icon, this.prize), this.dblIcon && this.processClaim(this.dblIcon, this.prize)
    }, G.DailyRewardCurrentGiftPrizePanel.prototype.addDescText = function(t, e, i) {
        var s;
        return s = "coin" === i[0][0] ? G.txt("%NR% Coins").replace("%NR%", i[0][1]) : G.txt("Get more boosters!"), this.add(new G.Text(t, e, s, {
            fill: "#008aca",
            font: "Lobster",
            fontSize: "40px",
            lineSpacing: -20
        }, .5, 400, 200, !0, "center"))
    }, G.DailyRewardCurrentGiftPrizePanel.prototype.dblSuccess = function() {
        "coin" === this.prize[0][0] ? this.dblIcon = G.makeImage(0, 0, "coin_3", .5, this) : this.dblIcon = this.add(new G.DailyRewardGiftIcon(-80, 0, this.prize)), game.add.tween(this.icon).to({
            x: -80
        }, 500, Phaser.Easing.Sinusoidal.InOut, !0), this.dblIcon.scale.setTo(1.2), game.add.tween(this.dblIcon.scale).to({
            x: 1.3,
            y: 1.3
        }, 300, Phaser.Easing.Elastic.Out, !0, 0, 0, !0, 500), game.add.tween(this.dblIcon).to({
            x: 80,
            y: 0
        }, 500, Phaser.Easing.Sinusoidal.InOut, !0), "coin" === this.prize[0][0] ? this.descText.setText(G.txt("%NR% Coins").replace("%NR%", 2 * this.prize[0][1])) : this.descText.setText(G.txt("Use these to boost your game!"))
    }, G.DailyRewardCurrentGiftPrizePanel.prototype.dblFail = function() {
        new G.NoMoreAds
    }, G.DailyRewardCurrentGiftPrizePanel.prototype.processClaim = function(e, t) {
        var i = game.state.getCurrentState();
        t.forEach(function(t) {
            "coin" === t[0] ? G.gameTracking.source("Coins", "Reward", "NewDailyReward", t[1]) : G.gameTracking.source(G.saveState.nrToBoosterName(t[0][8]), "Reward", "NewDailyReward", t[1]), "coin" === t[0] ? i.uiTargetParticles.createCoinBatch(game.world.bounds.x + e.worldPosition.x, e.worldPosition.y, i.panel.coinsTxt, t[1]) : G.gift.applyGift(t, !0)
        })
    }, G.DailyRewardDay = function(t, e, i) {
        Phaser.Group.call(this, game), this.position.setTo(t, e), this.bg = G.makeImage(0, 0, i.bgSprite, .5, this), this.addRibbon(0, -.5 * this.bg.height + 10, i), i.giftsVisible ? this.icon = this.add(new G.DailyRewardGiftIcon(0, 10, i.gifts)) : this.icon = this.add(new G.DailyRewardBoxIcon(0, 10, i.dayNr)), this.icon.height = Math.min(this.icon.height, .9 * this.bg.height), this.icon.scale.setTo(this.icon.scale.y), i.past && (this.checkedIconPast = G.makeImage(35, 15, "task_complete", .5, this)), i.today && (this.checkedIcon = G.makeImage(35, 15, "task_complete", .5, this), this.checkedIcon.alpha = 0, this.checkedIcon.scale.setTo(2))
    }, G.DailyRewardDay.prototype = Object.create(Phaser.Group.prototype), G.DailyRewardDay.prototype.checkedIconAnimation = function() {
        this.checkedIcon && (game.add.tween(this.checkedIcon).to({
            alpha: 1
        }, 400, Phaser.Easing.Cubic.In, !0), game.add.tween(this.checkedIcon.scale).to({
            x: 1,
            y: 1
        }, 400, Phaser.Easing.Cubic.In, !0))
    }, G.DailyRewardDay.prototype.addRibbon = function(t, e, i) {
        this.dayRibbon = G.makeImage(t, e, i.today ? "selected_day" : "unselected_day", .5, this), this.dayText = new G.Text(t, e, i.today ? G.txt("Today") : G.txt("Day %NR%").replace("%NR%", i.dayNr), {
            fill: "white",
            font: "Lobster",
            fontSize: "30px"
        }, .5, 76), this.add(this.dayText)
    }, G.DailyRewardDay.prototype.addBoxesIcons = function(t, e, i) {
        this.iconGroup = this.add(this.iconGroup)
    }, G.DailyRewardGiftIcon = function(t, e, i) {
        Phaser.Group.call(this, game), this.position.setTo(t, e), 1 == i.length ? this.addIcon(0, 0, i[0]) : (this.addIcon(20, 20, i[0]), this.addIcon(-20, -20, i[1]))
    }, G.DailyRewardGiftIcon.prototype = Object.create(Phaser.Group.prototype), G.DailyRewardGiftIcon.prototype.addIcon = function(t, e, i) {
        var s = G.makeImage(t, e, G.gift.getIcon(i), .5, this);
        1 < i[1] && (s.amountTxt = new G.Text(0, 30, "x" + i[1], {
            fill: "#454545",
            font: "Lobster",
            fontSize: "35px"
        }, .5), s.addChild(s.amountTxt)), "coin" === i[0] && (s.y -= 10, s.amountTxt.y += 10)
    }, G.DailyRewardWeek = function(t, e, i, s) {
        Phaser.Group.call(this, game), this.position.setTo(t, e), this.days = [], this.init(i, s)
    }, G.DailyRewardWeek.prototype = Object.create(Phaser.Group.prototype), G.DailyRewardWeek.prototype.init = function(t, e) {
        for (var i = G.json.settings.dailyReward.days, s = 0; s < 7; s++) {
            var a;
            a = s === t ? "current_day_box" : s < t ? "passed_day_box" : "future_day_box", a += 6 === s ? "_big" : "";
            var n = new G.DailyRewardDay(s % 3 * 140 - 140, 135 * Math.floor(s / 3) - 135, {
                gifts: i[s].gifts,
                dayNr: s + 1,
                past: s < t,
                today: s === t,
                bgSprite: a,
                giftsVisible: s <= t
            });
            n.scale.setTo(0), game.add.tween(n.scale).to({
                x: 1,
                y: 1
            }, 200, Phaser.Easing.Sinusoidal.Out, !0, 50 + 50 * s), 6 == s && (n.x += 140), this.add(n), this.days.push(n)
        }
        game.time.events.add(50 + 50 * s, function() {
            this.days.forEach(function(t) {
                t.checkedIconAnimation()
            })
        }, this)
    }, G.FillRateFallback = function(t) {
        Phaser.Group.call(this, game), this.bg = G.makeImage(0, 0, "popup_background_2", .5, this), this.success = !1, this.config = t, this.config.reqAmount || (this.config.reqAmount = 3), this.reqAmount = t.reqAmount, this.currentAmount = 0, this.visitedContexts = [FBInstant.context.getID()], this.titleTxt = new G.Text(0, -260, G.txt("Get your reward"), {
            style: "font-white",
            fontSize: "50px"
        }, .5, 450), this.add(this.titleTxt), this.closeBtn = new G.Button(250, -270, "btn_x", function() {
            this.config.trackingName && G.gameTracking.design(this.config.trackingName + "_Close"), this.close()
        }, this), this.closeBtn.addTerm(function() {
            return !this.success
        }, this), this.add(this.closeBtn), this.firstScreen = this.add(this.createFirstScreen(0, 0)), this.progressPage = this.add(new G.FillRateProgressPage(0, 0, this.config)), this.progressPage.alpha = 0, this.askFriendsBtn = this.createAskFriendsButton(0, 135), this.add(this.askFriendsBtn), this.tryAgainBtn = this.createTryAgainBtn(0, 250), this.add(this.tryAgainBtn), G.sb("pushWindowOnTop").dispatch(this), this.alpha = 0, game.add.tween(this).to({
            alpha: 1
        }, 500, Phaser.Easing.Sinusoidal.Out, !0), this.config.trackingName && G.gameTracking.design(this.config.trackingName + "_PopupVisible")
    }, G.FillRateFallback.prototype = Object.create(Phaser.Group.prototype), G.FillRateFallback.prototype.close = function() {
        this.closing || (this.closing = !0, this.ignoreChildInput = !0, game.add.tween(this).to({
            alpha: 0
        }, 300, Phaser.Easing.Sinusoidal.In, !0).onComplete.add(function() {
            this.destroy(), G.sb("fillRateFallbackClosed").dispatch(), this.success && this.config.callback && (this.config.trackingName && G.gameTracking.design(this.config.trackingName + "_Success"), this.config.callback.call(this.config.context))
        }, this))
    }, G.FillRateFallback.prototype.createFirstScreen = function(t, e) {
        var i = game.make.group();
        return i.position.setTo(0, 0), i.somethingWentWrongTxt = new G.Text(0, -150, G.txt("No video available"), {
            style: "font-blue",
            fontSize: "45px"
        }, .5, 480), i.add(i.somethingWentWrongTxt), i.gingy = G.makeImage(0, -25, "failed_dimond", .5, i), i.gingy.scale.setTo(.9), i
    }, G.FillRateFallback.prototype.tryWatchAd = function() {
        this.config.trackingName && G.gameTracking.design(this.config.trackingName + "_PopupTryAgain"), G.platform.showAd(!0, function() {
            this.success = !0, this.close()
        }, function() {
            new G.NoMoreAds, this.tryAgainBtn.inputEnabled = !1, game.add.tween(this.tryAgainBtn).to({
                alpha: 0
            }, 500, Phaser.Easing.Sinusoidal.Out, !0), game.add.tween(this.askFriendsBtn).to({
                y: 170
            }, 500, Phaser.Easing.Elastic.Out, !0)
        }, this)
    }, G.FillRateFallback.prototype.goToSecondScreen = function() {
        game.add.tween(this.firstScreen).to({
            alpha: 0
        }, 200, Phaser.Easing.Sinusoidal.In, !0), game.add.tween(this.progressPage).to({
            alpha: 1
        }, 200, Phaser.Easing.Sinusoidal.Out, !0), game.add.tween(this.askFriendsBtn).to({
            y: 310
        }, 1e3, Phaser.Easing.Elastic.Out, !0), this.tryAgainBtn.inputEnabled = !1, game.add.tween(this.tryAgainBtn).to({
            alpha: 0
        }, 300, Phaser.Easing.Sinusoidal.Out, !0)
    }, G.FillRateFallback.prototype.askFriends = function() {
        FBInstant.context.chooseAsync({
            filters: ["NEW_PLAYERS_ONLY"]
        }).then(function() {
            var t = FBInstant.context.getID();
            console.log("^^ context", t), -1 === this.visitedContexts.indexOf(t) ? (this.visitedContexts.push(t), console.log("^^ new context, send msg"), G.platform.sendHelpMsg(), 0 === this.currentAmount && this.goToSecondScreen(), this.increaseAskedAmount(), this.config.trackingName && G.gameTracking.design(this.config.trackingName + "_PopupAskFriend" + this.currentAmount)) : (this.config.trackingName && G.gameTracking.design(this.config.trackingName + "_PopupAskFriendSameContext"), console.log("^^ context already visited"))
        }.bind(this)).catch(function(t) {
            console.log(t)
        })
    }, G.FillRateFallback.prototype.increaseAskedAmount = function() {
        this.currentAmount++, this.progressPage.increase(), this.currentAmount >= this.reqAmount && (this.success = !0, game.add.tween(this.closeBtn).to({
            alpha: 0
        }, 300, Phaser.Easing.Sinusoidal.In, !0), game.add.tween(this.askFriends).to({
            alpha: 0
        }, 300, Phaser.Easing.Sinusoidal.In, !0), game.time.events.add(1e3, this.close, this))
    }, G.FillRateFallback.prototype.createTryAgainBtn = function(t, e) {
        var i = new G.Button(t, e, "blue_button", this.tryWatchAd, this);
        return i.addTerm(function() {
            return !this.success
        }, this), i.label = new G.Text(0, -5, G.txt("Try again"), {
            style: "font-white",
            fontSize: 30,
            lineSpacing: -20
        }, .5, 150, 50, !0, "center"), i.addChild(i.label), i
    }, G.FillRateFallback.prototype.createAskFriendsButton = function(t, e) {
        var i = new G.Button(t, e, "btn_orange_long_big", this.askFriends, this);
        return i.addTerm(function() {
            return !this.success
        }, this), i.icon = G.makeImage(-95, -5, "friends_avatars", .5, i), i.label = i.addChild(new G.Text(30, -5, G.txt("Ask your friends"), {
            style: "font-white",
            fontSize: 30,
            lineSpacing: -20
        }, .5, 165, 60, !0, "center")), i
    }, G.FillRateProgressBar = function(t, e, i, s) {
        Phaser.Group.call(this, game), this.position.setTo(t, e), this.status = {
            current: i,
            full: s
        }, this.cropAnim = !1, this.bgBar = G.makeImage(-140, -26, "bar", 0, this), this.fill = G.makeImage(-130, -16, "bar_fill", 0, this), this.fill.cropRect = new Phaser.Rectangle(0, 0, Math.ceil(i / s * 260), 32), this.fill.updateCrop(), this.label = new G.Text(0, 0, i + "/" + s, {
            style: "font-white",
            fontSize: 40
        }, .5), this.add(this.label), this.onFull = new Phaser.Signal
    }, G.FillRateProgressBar.prototype = Object.create(Phaser.Group.prototype), G.FillRateProgressBar.prototype.update = function() {
        if (this.cropAnim) {
            var t = Math.round(this.status.current / this.status.full * 260);
            this.fill.cropRect.width = t, this.fill.updateCrop()
        }
    }, G.FillRateProgressBar.prototype.increase = function() {
        this.cropAnim = !0, game.add.tween(this.status).to({
            current: this.status.current + 1
        }, 500, Phaser.Easing.Cubic.Out, !0).onComplete.add(function() {
            this.cropAnim = !1
        }, this), game.add.tween(this.label.scale).to({
            x: 1.2,
            y: 1.2
        }, 300, Phaser.Easing.Sinusoidal.InOut, !0, 0, 0, !0), this.label.setText(this.status.current + 1 + "/" + this.status.full)
    }, G.FillRateProgressPage = function(t, e, i) {
        Phaser.Group.call(this, game), this.current = 0, this.reqAmount = i.reqAmount || 3, this.askMoreTxt = new G.Text(0, -145, " ", {
            style: "font-blue",
            fontSize: 40
        }, .5, 490), this.updateAskTxt(), this.add(this.askMoreTxt), this.arrow = G.makeImage(0, -40, "arrow", [.5, 0], this), this.progressBar = new G.FillRateProgressBar(0, -60, 0, this.reqAmount), this.add(this.progressBar), this.rewardImage = new G.FillRateRewardImage(0, -30, i.reward), this.add(this.rewardImage)
    }, G.FillRateProgressPage.prototype = Object.create(Phaser.Group.prototype), G.FillRateProgressPage.prototype.increase = function() {
        this.current++, this.progressBar.increase(), this.updateAskTxt()
    }, G.FillRateProgressPage.prototype.updateAskTxt = function() {
        var t, e = this.reqAmount - this.current;
        0 === e ? game.add.tween(this.askMoreTxt).to({
            alpha: 0
        }, 500, Phaser.Easing.Sinusoidal.Out, !0) : t = 1 === e ? G.txt("Ask 1 more friend") : G.txt("Ask %NR% more friends").replace("%NR%", e), t && this.askMoreTxt.setText(t)
    }, G.FillRateRewardImage = function(t, e, i) {
        Phaser.Group.call(this, game), this.position.setTo(t, e), this.bg = G.makeImage(0, 140, "reward_BG", .5, this), this.bg.scale.setTo(.7), game.add.tween(this.bg).to({
            angle: 5
        }, 2e3, Phaser.Easing.Sinusoidal.InOut, !0, 0, -1, !0), this.rewardIcon = this.addRewardIcon(0, 140, i)
    }, G.FillRateRewardImage.prototype = Object.create(Phaser.Group.prototype), G.FillRateRewardImage.prototype.debugIcon = function() {
        this.dbg || (this.dbg = {
            current: "extraMoves",
            testList: ["extraMoves", "extraSpin", "dailyChallenge", "skipMission", "life"]
        }, this.dbg.keyA = game.input.keyboard.addKey(Phaser.Keyboard.A), this.dbg.keyA.onDown.add(this.debugIcon, this)), this.dbg.current = this.dbg.testList[(this.dbg.testList.indexOf(this.dbg.current) + 1) % this.dbg.testList.length], this.rewardIcon && this.rewardIcon.destroy(), this.rewardIcon = this.addRewardIcon(0, 140, {
            type: this.dbg.current,
            data: ["coin", 250]
        })
    }, G.FillRateRewardImage.prototype.addRewardIcon = function(t, e, i) {
        var s = "";
        return "extraMoves" === i.type ? (s = G.makeImage(t, e, "ui_booster_5", .5, this)).scale.setTo(1.3) : "extraSpin" === i.type ? (s = G.makeImage(t, e, "new_wheel_menu", .5, this)).scale.setTo(1.3) : "dailyChallenge" === i.type ? (s = G.makeImage(t, e, "btn_daily_challenge", .5, this)).scale.setTo(1.5) : "skipMission" === i.type ? (s = new G.Text(t, e, G.txt("Skip"), {
            style: "rubikWB",
            fontSize: 40,
            lineSpacing: -15
        }, .5, 170, 120, !0, "center"), this.add(s)) : "gift" === i.type && (s = this.createGifts(t, e, i.giftData, i.double), this.add(s)), s
    }, G.FillRateRewardImage.prototype.createGifts = function(t, e, i, s) {
        var a = game.make.group();
        return a.position.setTo(t, e), Array.isArray(i[0]) ? 2 == i.length ? (a.add(this.createSingleGift(30, -30, i[0], s)), a.add(this.createSingleGift(-30, 30, i[1], s))) : a.add(this.createSingleGift(0, 0, i[0], s)) : a.add(this.createSingleGift(0, 0, i, s)), a
    }, G.FillRateRewardImage.prototype.createSingleGift = function(t, e, i, s) {
        var a = game.make.group();
        return a.position.setTo(t, e), "coin" === i[0] ? (a.amountTxt = new G.Text(0, 0, i[1], {
            style: "rubikWB",
            fontSize: 65
        }, .5), a.add(a.amountTxt), a.coinIcon = G.makeImage(0, 0, "coin_1", .5, a), G.centerElements2([a.amountTxt, a.coinIcon], -10), s && (a.doubleTxt = new G.Text(a.coinIcon.right - 5, 20, "x2", {
            style: "rubikPW",
            fontSize: 45
        }, .5), a.add(a.doubleTxt))) : (a.icon = G.makeImage(0, 0, G.gift.getIcon(i), .5, a), s && (a.doubleTxt = new G.Text(30, 30, "x2", {
            style: "rubikWB",
            fontSize: 40
        }, .5), a.add(a.doubleTxt)), a.scale.setTo(1.3)), a
    }, G.FillRateRewardImage.prototype.createCoinsTxt = function(t, e) {
        game.make.group().amountTxt = new G.Text(0, 0, t.toString(), this)
    }, G.FillRateRewardImage.prototype.createBoostersImg = function(t, e) {}, G.gameTracking = {
        sink: function(t, e, i, s) {
            console.log("sink", t, e, i, s);
            try {
                sdkHandler.trigger("gameTracking", {
                    event: "Sink",
                    dimension1: t ? t.toString() : void 0,
                    dimension2: e ? e.toString() : void 0,
                    dimension3: i ? i.toString() : void 0,
                    value: s || 1
                })
            } catch (t) {
                console.log(t)
            }
        },
        source: function(t, e, i, s) {
            console.log("source", t, e, i, s);
            try {
                sdkHandler.trigger("gameTracking", {
                    event: "Source",
                    dimension1: t ? t.toString() : void 0,
                    dimension2: e ? e.toString() : void 0,
                    dimension3: i ? i.toString() : void 0,
                    value: s || 1
                })
            } catch (t) {
                console.log(t)
            }
        },
        start: function(t, e, i, s) {
            try {
                sdkHandler.trigger("gameTracking", {
                    event: "Start",
                    dimension1: t ? t.toString() : void 0,
                    dimension2: e ? e.toString() : void 0,
                    dimension3: i ? i.toString() : void 0,
                    value: s
                })
            } catch (t) {
                console.log(t)
            }
        },
        fail: function(t, e, i, s) {
            try {
                sdkHandler.trigger("gameTracking", {
                    event: "Fail",
                    dimension1: t ? t.toString() : void 0,
                    dimension2: e ? e.toString() : void 0,
                    dimension3: i ? i.toString() : void 0,
                    value: s
                })
            } catch (t) {
                console.log(t)
            }
        },
        complete: function(t, e, i, s) {
            try {
                sdkHandler.trigger("gameTracking", {
                    event: "Complete",
                    dimension1: t ? t.toString() : void 0,
                    dimension2: e ? e.toString() : void 0,
                    dimension3: i ? i.toString() : void 0,
                    value: s
                })
            } catch (t) {
                console.log(t)
            }
        },
        design: function(t, e) {
            console.log("DESIGN", t, e);
            try {
                sdkHandler.trigger("gameTracking", {
                    event: "Design",
                    dimension1: t ? t.toString() : void 0,
                    value: e
                })
            } catch (t) {
                console.log(t)
            }
        },
        designGA: function(t, e) {
            console.log("DESIGNGA", t, e);
            try {
                sdkHandler.GA.GameAnalytics.addDesignEvent(t, e)
            } catch (t) {
                console.log(t)
            }
        },
        init: function() {
            G.Trackers.treasureHuntTracker.init(this), this.onInitFinished = new Phaser.Signal, sdkHandler.trigger("restore", {
                key: "ftueEventsData",
                callback: function(t, e) {
                    if (!t) {
                        try {
                            this.ftueData = null === e || e == {} ? {} : JSON.parse(e)
                        } catch (t) {
                            this.ftueData = {}
                        }
                        this.initialized = !0, this.onInitFinished.dispatch()
                    }
                }
            }, this)
        },
        FTUEDesign: function(t, e) {
            this.initialized && this._FTUEDesign(t, e)
        },
        _FTUEDesign: function(t, e) {
            this.ftueData[t] || (console.log("FTUE EVENT: ", t, e), this.ftueData[t] = !0, this.design(t, e), sdkHandler.trigger("save", {
                key: "ftueEventsData",
                value: JSON.stringify(this.ftueData),
                callback: function() {}
            }))
        },
        checkFTUE: function(t) {
            return this.ftueData[t]
        }
    }, G.ga = {
        event: function() {}
    }, G.Trackers = G.Trackers || {}, G.Trackers.treasureHuntTracker = {
        init: function(t) {
            var e = G.TreasureHunt.treasureHuntMgr,
                i = t;
            e.onEventStart.add(function() {
                i.design("TreasureHuntBegin")
            }), e.onEventCompleted.add(function(t) {
                i.design("TreasureHuntComplete"), i.design("TreasureHuntInvites", t.invitedContexts.length)
            }), e.onEventExpired.add(function() {
                i.design("TreasureHuntExpired")
            }), e.onLevelComplete.add(function(t, e) {
                i.designGA("THLevelGemDrop:" + G.pad(t + 1, 4), e)
            })
        }
    }, G.GingyCharacterTutorial = function(t, e) {
        Phaser.Group.call(this, game), this.position.setTo(t, e), this.gingy = game.add.group(this), this.backEyes = G.makeImage(0, -115, "gingy_eyes_back", .5, this.gingy), this.eyes = G.makeImage(7, -121, "gingy_eyes", .5, this.gingy), this.body = G.makeImage(0, 0, "gingy_body", [.5, 207 / 228], this.gingy), this.eyelids = G.makeImage(6, -121, "gingy_eyelids", .5, this.gingy), this.eyelids.visible = !1, this.mouth = G.makeImage(11, -80, "gingy_mouth_closed", .5, this.gingy), this.breathingTween = game.add.tween(this.gingy.scale).to({
            y: 1.01
        }, 1200, Phaser.Easing.Sinusoidal.InOut, !0, 0, -1, !0), this.lookAtTween = null, this.blinkingTween = game.add.tween(this).to(null, 2500, Phaser.Easing.Linear.None, !0, 0, -1), this.blinkingTween.onUpdateCallback(function(t, e) {
            this.eyelids.visible = .75 < e && e < .8 || .95 < e
        }, this), this.gingyTalkingTween = game.add.tween(this).to(null, 150, Phaser.Easing.Linear.None, !0, 0, -1), this.gingyTalkingTween.onLoop.add(function() {
            if (null !== this.mouth.cache) {
                var t = ["gingy_mouth_closed", "gingy_mouth_open", "gingy_mouth_surprised"];
                t.splice(t.indexOf(this.mouth.frameName), 1), this.mouth.changeTexture(game.rnd.pick(t))
            }
        }, this), this.idle(), this.onDestroy.add(function() {
            this.blinkingTween.stop(), this.gingyTalkingTween.stop(), this.gingyTalkingTween.stop()
        }, this)
    }, G.GingyCharacterTutorial.prototype = Object.create(Phaser.Group.prototype), G.GingyCharacterTutorial.prototype.talk = function() {
        this.blinkingTween.resume(), this.gingyTalkingTween.resume()
    }, G.GingyCharacterTutorial.prototype.idle = function() {
        this.blinkingTween.resume(), this.gingyTalkingTween.pause(), this.mouth.changeTexture("gingy_mouth_closed")
    }, G.GingyCharacterTutorial.prototype.smile = function() {
        this.blinkingTween.pause(), this.eyelids.visible = !0, this.gingyTalkingTween.pause(), this.mouth.changeTexture("gingy_mouth_closed")
    }, G.GingyCharacterTutorial.prototype.lookAt = function(t) {
        if (t) {
            var e = t.x,
                i = t.y;
            this.lookAtTween && this.lookAtTween.stop(), this.lookAtTween = game.add.tween(this.eyes.pivot).to({
                x: -7 * e,
                y: -7 * i
            }, 500, Phaser.Easing.Sinusoidal.Out, !0)
        }
    }, G.GingyTutorialBar = function() {
        Phaser.Group.call(this, game), this.x = 320, this.bar = game.add.tileSprite(0, 0, game.width, 222, "ginger", "tutorial_bar", this), this.bar.anchor.setTo(.5), this.gingy = this.add(new G.GingyCharacterTutorial(-220, 88)), this.msg = this.add(new G.TutorialMsgText(90, 0)), this.iconContainer = game.make.group(this), this.icon = G.makeImage(0, 160, null, .5, this.iconContainer), this.pY = .12, this.hide(null, null, !0), G.Utils.cleanUpOnDestroy(this, G.sb("onScreenResize").add(this.onResize, this))
    }, G.GingyTutorialBar.prototype = Object.create(Phaser.Group.prototype), G.GingyTutorialBar.prototype.onResize = function() {
        this.bar.width = game.width
    }, G.GingyTutorialBar.prototype.update = function() {
        this.updatePYPosition(!1)
    }, G.GingyTutorialBar.prototype.displayMsg = function(t) {
        null !== this.game && (this.hidden ? (t.position && (this.pY = t.position, this.updatePYPosition(!0)), this.show(function() {
            this.displayMsg(t)
        }, this)) : (t.position && (this.pY = t.position), this.msg.displayText(t.text), this.gingy.talk(), this.msg.onTextAnimationFinished.addOnce(function() {
            this.gingy.idle()
        }, this), t.gingy && t.gingy.lookAt && this.gingy.lookAt(t.gingy.lookAt), this.processIconData(t.icon)))
    }, G.GingyTutorialBar.prototype.updatePYPosition = function(t) {
        this.y = t ? Math.floor(game.height * this.pY) : G.lerp(this.y, Math.floor(this.pY * game.height), .3, 1)
    }, G.GingyTutorialBar.prototype.processIconData = function(t) {
        t && t.sprite ? (this.icon.scale.setTo(0), this.icon.changeTexture(t.sprite), this.icon.y = t.y || 160, game.add.tween(this.icon.scale).to({
            x: 1,
            y: 1
        }, 300, Phaser.Easing.Sinusoidal.Out, !0)) : game.add.tween(this.icon.scale).to({
            x: 0,
            y: 0
        }, 300, Phaser.Easing.Sinusoidal.Out, !0).onComplete.add(function() {
            this.icon.changeTexture(null)
        }, this)
    }, G.GingyTutorialBar.prototype.hide = function(t, e, i) {
        this.hidden ? t && t.call(e) : (this.hidden = !0, i ? (this.msg.alpha = 0, this.gingy.scale.setTo(0), this.bar.scale.y = 0, this.iconContainer.scale.setTo(0), t && t.call(e)) : (game.add.tween(this.msg).to({
            alpha: 0
        }, 150, Phaser.Easing.Sinusoidal.In, !0), game.add.tween(this.gingy.scale).to({
            x: 0,
            y: 0
        }, 150, Phaser.Easing.Sinusoidal.In, !0), game.add.tween(this.bar.scale).to({
            y: 0
        }, 200, Phaser.Easing.Sinusoidal.In, !0, 150).onComplete.add(function() {
            t && t.call(e)
        }), game.add.tween(this.iconContainer.scale).to({
            x: 0,
            y: 0
        }, 300, Phaser.Easing.Sinusoidal.In, !0, 100)))
    }, G.GingyTutorialBar.prototype.show = function(t, e) {
        this.hidden ? (this.hidden = !1, this.bar.scale.y = 0, this.gingy.scale.setTo(0), game.add.tween(this.msg).to({
            alpha: 1
        }, 150, Phaser.Easing.Sinusoidal.In, !0), game.add.tween(this.bar.scale).to({
            y: 1
        }, 400, Phaser.Easing.Elastic.Out, !0), game.add.tween(this.gingy.scale).to({
            x: 1,
            y: 1
        }, 800, Phaser.Easing.Elastic.Out, !0, 100).onComplete.add(function() {
            t && t.call(e)
        }), game.add.tween(this.iconContainer.scale).to({
            x: 1,
            y: 1
        }, 300, Phaser.Easing.Elastic.Out, !0, 100)) : t && t.call(e)
    }, G.Tutorial = function(t) {
        Phaser.Group.call(this, game), this.tutorialID = t, G.tutorialOpened = !0, this.boardGroup = game.add.group(), this.add(this.boardGroup), this.state = game.state.getCurrentState(), this.overlay = this.state.overlay, this.board = this.state.board, this.boardGroup.x = this.board.x, this.boardGroup.y = this.board.y, this.tutData = G.json.tutorials[t], this.tutData.booster ? this.makeBoosterTutorial(this.tutData) : G.GINGY_TUTORIAL ? this.makeGingyTutorial(this.tutData) : this.makeStandardTutorial(this.tutData), this.tutData.booster || (this.skipBtn = this.add(new G.Button(530, .9 * game.height, "btn_invite_ingame", this.skip, this)), this.skipBtn.addTextLabel("font-white", G.txt("Skip"), 40), this.skipBtn.scale.setTo(1.5), game.add.tween(this.skipBtn).from({
            alpha: 0
        }, 300, Phaser.Easing.Sinusoidal.Out, !0), this.skipBtn.pY = .9), game.add.tween(this.boardGroup).from({
            alpha: 0
        }, 300, Phaser.Easing.Sinusoidal.InOut, !0)
    }, G.Tutorial.prototype = Object.create(Phaser.Group.prototype), G.Tutorial.prototype.update = function() {
        this.skipBtn && (this.skipBtn.y = this.skipBtn.pY * game.height), this.boardGroup.x = this.board.x, this.boardGroup.y = this.board.y, this.boardGroup.update()
    }, G.Tutorial.prototype.makeGingyTutorial = function(t) {
        this.gingy = new G.Gingy, t.overlayTask && this.overlay.start(t.overlayTask), t.handCells && this.makeHandAnim(t.handCells), t.inputCells && this.setBoardCandyInput(t.inputCells), t.msg && this.gingy.showMsg(G.txt(t.msg.text), .3), G.sb("madeMove").addOnce(this.finish, this), this.state.boosterPanel.lockInput(), this.afterMsg = function(t, e, i) {
            this.hand && game.add.tween(this.hand).to({
                alpha: 0
            }, 300, Phaser.Easing.Sinusoidal.InOut, !0), G.sb("actionQueueEmpty").addOnce(function() {
                G.lvl.goalAchieved || this.skipped || (this.gingy.showMsg(G.txt(t), e), game.time.events.add(i, function() {
                    this.gingy.hide(), G.sb("onTutorialFinishDisplay").dispatch()
                }, this))
            }, this)
        }
    }, G.Tutorial.prototype.makeStandardTutorial = function(t) {
        t.overlayTask && this.overlay.start(t.overlayTask), t.handCells && this.makeHandAnim(t.handCells), t.inputCells && this.setBoardCandyInput(t.inputCells), t.msg && this.makeMsg(t.msg.text, t.msg.position), G.sb("madeMove").addOnce(this.finish, this), this.state.boosterPanel.lockInput()
    }, G.Tutorial.prototype.makeBoosterTutorial = function(t) {
        0 === G.saveState.data.boosters[t.boosterNr] && (G.saveState.data.boosters[t.boosterNr] = 1), t.msg && this.makeMsg(t.msg.text, t.msg.position, !0), this.lockBoard(), this.state.boosterPanel.lockInput(), this.state.boosterPanel.boostersBtn[t.boosterNr - 1].unlock(), this.state.boosterPanel.boostersBtn[t.boosterNr - 1].showSuggestion(), G.sb("onBoosterSelect").addOnce(function() {
            t.overlayTask && this.overlay.start(t.overlayTask), this.makeHandAnim(this.tutData.handCells), this.state.boosterPanel.boostersBtn[t.boosterNr - 1].hideSuggestion(), this.hideMsg(), this.state.board.actionManager.actionList[0].availableCandies = this.inputCellsToCandies(this.tutData.inputCells), 1 == this.tutData.boosterNr && (this.state.board.actionManager.actionList[0].availableCandies = [this.board.getCandy(this.tutData.inputCells[0], this.tutData.inputCells[1])], G.sb("onBoosterSwapCandySelect").addOnce(function() {
                this.hand.destroy(), this.makeHandAnim([this.tutData.inputCells[2], this.tutData.inputCells[3]]), this.state.board.actionManager.actionList[0].availableCandies = [this.board.getCandy(this.tutData.inputCells[2], this.tutData.inputCells[3])]
            }, this))
        }, this), G.sb("onBoosterUsed").addOnce(this.finish, this)
    }, G.Tutorial.prototype.makeMsg = function(t, e, i) {
        i && (this.msgShade = G.makeImage(0, 0, "text_shade_bg", .5), this.msgShade.alpha = .7), this.msg = new G.Text(0, 0, G.txt(t), {
            style: "font-white",
            fontSize: "40px"
        }, .5, 580, 200, !0, "center"), this.msg.x = .5 * (this.board.width - 2 * this.board.tilesize), this.msg.y = (this.board.height - 2 * this.board.tilesize) * (e || .7), i && (this.msgShade.width = this.msg.width + G.l(80), this.msgShade.height = this.msg.height + G.l(60), this.msgShade.position = this.msg.position, this.boardGroup.add(this.msgShade)), this.boardGroup.add(this.msg)
    }, G.Tutorial.prototype.hideMsg = function() {
        this.msgShade && game.add.tween(this.msgShade).to({
            alpha: 0
        }, 300, Phaser.Easing.Sinusoidal.InOut, !0), this.msg && game.add.tween(this.msg).to({
            alpha: 0
        }, 300, Phaser.Easing.Sinusoidal.InOut, !0), this.msg = !1, this.msgShade = !1
    }, G.Tutorial.prototype.afterMsg = function(t, e, i) {
        t && (this.msg && game.add.tween(this.msg).to({
            alpha: 0
        }, 300, Phaser.Easing.Sinusoidal.InOut, !0), this.msgShade && game.add.tween(this.msgShade).to({
            alpha: 0
        }, 300, Phaser.Easing.Sinusoidal.InOut, !0), this.hand && game.add.tween(this.hand).to({
            alpha: 0
        }, 300, Phaser.Easing.Sinusoidal.InOut, !0), this.msgShade = G.makeImage(0, 0, "text_shade_bg", .5), this.boardGroup.add(this.msgShade), this.afterMsg = new G.Text(0, 0, G.txt(t), {
            style: "font-white",
            fontSize: "40px"
        }, .5, 580, 200, !0, "center"), this.afterMsg.x = .5 * (this.board.width - 2 * this.board.tilesize), this.afterMsg.y = (this.board.height - 2 * this.board.tilesize) * (e || .7), this.boardGroup.add(this.afterMsg), game.add.tween(this.afterMsg).from({
            alpha: 0
        }, 300, Phaser.Easing.Sinusoidal.InOut, !0), this.msgShade.width = this.afterMsg.width + G.l(80), this.msgShade.height = this.afterMsg.height + G.l(60), this.msgShade.position = this.afterMsg.position, this.msgShade.alpha = .7, game.add.tween(this.msgShade).from({
            alpha: 0
        }, 300, Phaser.Easing.Sinusoidal.InOut, !0), game.add.tween(this).to({
            alpha: 0
        }, 400, Phaser.Easing.Sinusoidal.Out, !0, this.tutData.afterMsgTime || 2500).onComplete.add(function() {
            this.destroy(), G.sb("onTutorialFinishDisplay").dispatch()
        }, this))
    }, G.Tutorial.prototype.makeHandAnim = function(t) {
        this.hand = G.makeImage(0, 0, "tut_hand", 0, this), this.hand.alpha = 1, this.boardGroup.add(this.hand);
        var e, i, s = this.board.tilesize * this.board.scale.x;
        this.hand.x = s * t[0] + .7 * s, this.hand.y = s * t[1] + .7 * s, 2 == t.length ? (e = this.hand.x + G.l(15), i = this.hand.y + G.l(15), game.add.tween(this.hand).to({
            x: e,
            y: i
        }, 1e3, Phaser.Easing.Sinusoidal.InOut, !0, 0, -1, !0)) : (e = s * t[2] + .7 * s, i = s * t[3] + .7 * s, game.add.tween(this.hand).to({
            x: e,
            y: i
        }, 1e3, Phaser.Easing.Sinusoidal.InOut, !0, 0, -1))
    }, G.Tutorial.prototype.addInputCells = function(t) {
        if (t) {
            this.board.inputController.possibleCandies = [];
            for (var e = 0; e < tutData.inputCells.length; e += 2) this.board.inputController.possibleCandies.push(this.board.getCandy(t[e], t[e + 1]))
        }
    }, G.Tutorial.prototype.skip = function() {
        G.gameTracking.design("Tutorial:Skip:Level", G.lvl.lvlNr + 1), G.sb("onTutorialFinishDisplay").dispatch(), this.skipped = !0, this.finish()
    }, G.Tutorial.prototype.finish = function() {
        this.skipBtn && (this.skipBtn.inputEnabled = !1, game.add.tween(this.skipBtn).to({
            alpha: 0
        }, 300, Phaser.Easing.Sinusoidal.Out, !0)), this.gingy && this.gingy.hide(), this.overlay.hideAndClear(), this.state.boosterPanel.unlockInput(), G.saveState.data.finishedTutorials.push(this.tutorialID), G.saveState.save(), this.tutData.afterMsg && !this.skipped ? this.afterMsg(this.tutData.afterMsg, .85, this.tutData.afterMsgTime || 3500) : (game.add.tween(this).to({
            alpha: 0
        }, 400, Phaser.Easing.Sinusoidal.Out, !0).onComplete.add(function() {
            this.destroy()
        }, this), game.time.events.add(this.tutData.afterMsgTime || 3500, function() {
            G.sb("onTutorialFinishDisplay").dispatch()
        }, this)), this.clearBoardCandyInput(), G.sb("onTutorialFinish").dispatch(), G.tutorialOpened = !1
    }, G.Tutorial.prototype.lockBoard = function() {
        this.state.board.inputController.possibleCandies = [{}]
    }, G.Tutorial.prototype.setBoardCandyInput = function(t) {
        this.state.board.inputController.possibleCandies = [];
        for (var e = 0; e < t.length; e += 2) this.state.board.inputController.possibleCandies.push(this.state.board.getCandy(t[e], t[e + 1]))
    }, G.Tutorial.prototype.clearBoardCandyInput = function(t) {
        this.state.board.inputController.possibleCandies = []
    }, G.Tutorial.prototype.inputCellsToCandies = function(t) {
        for (var e = [], i = 0; i < t.length; i++) e.push(this.board.getCandy(t[i], t[i + 1]));
        return e
    }, G.TutorialHand = function(t) {
        G.Image.call(this, 0, 0, "tut_hand", 0), this.board = t, this.alpha = 0, this.alphaTween = null, this.moveTween = null
    }, G.TutorialHand.prototype = Object.create(G.Image.prototype), G.TutorialHand.prototype.setCells = function(t) {
        if (void 0 === t) return this.hide();
        this.show(), this.moveTween && (this.moveTween.stop(), this.moveTween = null);
        var e, i, s, a = this.board.tilesize;
        this.x = t[0] * a + .7 * a, this.y = t[1] * a + .7 * a, 2 == t.length ? (e = this.x + 15, i = this.y + 15, s = !0) : (e = t[2] * a + .7 * a, i = t[3] * a + .7 * a, s = !1), this.moveTween = game.add.tween(this).to({
            x: e,
            y: i
        }, 1e3, Phaser.Easing.Sinusoidal.InOut, !0, 0, -1, s)
    }, G.TutorialHand.prototype.show = function() {
        this.startAlphaTween(1)
    }, G.TutorialHand.prototype.hide = function() {
        this.startAlphaTween(0)
    }, G.TutorialHand.prototype.startAlphaTween = function(t) {
        this.alpha !== t && (this.alphaTween && (this.alphaTween.stop(), this.alphaTween = null), this.alphaTween = game.add.tween(this).to({
            alpha: t
        }, 300, Phaser.Easing.Sinusoidal.Out, !0))
    }, G.TutorialMsgText = function(t, e) {
        Phaser.Group.call(this, game), this.position.setTo(t, e), this.onTextAnimationFinished = new Phaser.Signal
    }, G.TutorialMsgText.prototype = Object.create(Phaser.Group.prototype), G.TutorialMsgText.prototype.displayText = function(t) {
        if (void 0 !== t) {
            if (this.textObj) {
                var e = this.textObj;
                e.dontAnimate = !0, game.add.tween(e).to({
                    alpha: 0
                }, 300, Phaser.Easing.Sinusoidal.Out, !0).onComplete.add(function() {
                    e.destroy()
                })
            }
            this.textObj = new G.Text(0, -3, G.txt(t), {
                style: "font-blue",
                fontSize: 45,
                lineSpacing: -17
            }, .5, 400, 190, !0, "center"), this.add(this.textObj), this.animateText(this.textObj)
        }
    }, G.TutorialMsgText.prototype.animateText = function(e) {
        var i = this.onTextAnimationFinished,
            s = 0;
        ! function t() {
            null === e.game || e.dontAnimate || (s !== e.text.length + 1 ? (e.clearColors(), e.addColor("rgba(0, 0, 0, 0)", s), s++, game.time.events.add(10, t)) : i.dispatch())
        }()
    }, G.TutorialNewGingy = function(t) {
        Phaser.Group.call(this, game), G.tutorialOpened = !0, t && this.initTutorial(this, t)
    }, G.TutorialNewGingy.prototype = Object.create(Phaser.Group.prototype), G.TutorialNewGingy.prototype.initTutorial = function(t, e) {
        var i = this,
            s = G.Utils.clone(G.json.tutorials[e]),
            a = new G.GingyTutorialBar;
        this.msgBar = a, this.add(a);
        var n = game.state.getCurrentState(),
            o = n.overlay,
            r = n.board,
            h = n.boosterPanel,
            l = s.steps,
            d = game.add.group(this);
        d.position = r.position, d.scale = r.scale;
        var c, u, p, g, f, m = (c = game, u = G.Utils.createTrackingScheduler(function(t, e) {
                var i = G.sb(t).addOnce(e);
                return i
            }, function(t) {
                t.detach()
            }), p = G.Utils.createTrackingScheduler(function(t, e) {
                var i = c.time.events.add(t, e);
                return i
            }, function(t) {
                c.time.events.remove(t)
            }), {
                scheduleByTime: function(t, e) {
                    var i = !1,
                        s = p.add(t, function() {
                            i || (i = !0, p.remove(s), e())
                        })
                },
                scheduleByEvent: function(t, e) {
                    var i = !1,
                        s = u.add(t, function() {
                            i || (i = !0, u.remove(s), e())
                        })
                },
                scheduleByTimeOrEvent: function(t, e, i) {
                    var s = !1,
                        a = u.add(e, o),
                        n = p.add(t, o);

                    function o() {
                        s || (s = !0, u.remove(a), p.remove(n), i())
                    }
                },
                cleanup: function() {
                    u.removeAll(), p.removeAll()
                }
            }),
            y = !1;

        function b() {
            var t = l.shift();
            if (console.log("!! doNextStep", t), h.lockInput(), !t) return T();
            "booster" === t.type ? function(e) {
                e.msg && a.displayMsg(e.msg);
                S([]), void 0 !== e.boosterLabelPivotY && (o.boosterLabel.pivotYSettings = e.boosterLabelPivotY);
                0 === G.saveState.data.boosters[e.boosterNr] && (G.saveState.data.boosters[e.boosterNr] = 1);
                var i = h.boostersBtn[e.boosterNr - 1];
                i.unlock(), i.showSuggestion(), i.showTutorialHighlight(), o.set([]), o.moveToAboveGroup(i, "boosterGroup"), m.scheduleByEvent("onBoosterSelect", function() {
                    i.hideTutorialHighlight(), o.set(e.overlayTask), hand.setCells(e.handCells), i.hideSuggestion();
                    var t = r.actionManager.actionList[0];
                    1 === e.boosterNr ? (t.availableCandies = [r.getCandy(e.inputCells[0], e.inputCells[1])], m.scheduleByEvent("onBoosterSwapCandySelect", function() {
                        hand.setCells([e.inputCells[2], e.inputCells[3]]), t.availableCandies = [r.getCandy(e.inputCells[2], e.inputCells[3])]
                    })) : t.availableCandies = P(e.inputCells)
                }), m.scheduleByEvent("onBoosterUsed", w)
            }(t) : function(t) {
                if (o.set(t.overlayTask), t.actionText) {
                    var e = r.cellToPxOut([t.actionText.position[0] - 1, t.actionText.position[1] - 1]);
                    ! function(t, e, i, s) {
                        f || (a = e, n = i, o = s, f = new G.Text(a, n, o, {
                            style: "font-white",
                            fontSize: 40
                        }, .5, 400), t.add(f));
                        var a, n, o;
                        f.x = e, f.y = i, f.setText(s), f && (f.exists = !0, f.visible = !0)
                    }(i, e[0], e[1], G.txt(t.actionText.text))
                }
                hand.setCells(t.handCells), S(t.inputCells), t.msg && a.displayMsg(t.msg);
                "move" === t.type ? m.scheduleByEvent("madeMove", function() {
                    x(), m.scheduleByEvent("actionQueueEmpty", w)
                }) : "wait" === t.type ? m.scheduleByTime(t.waitMs, v) : "notification" === t.type && (t.waitMs ? m.scheduleByTimeOrEvent(t.waitMs, "madeMove", v) : m.scheduleByEvent("madeMove", v))
            }(t)
        }

        function v() {
            x(), w()
        }

        function x() {
            f && (f.visible = !1, f.exists = !1), o.set(), hand.setCells()
        }

        function w() {
            o.boosterLabel.pivot.y = 0, b()
        }

        function T() {
            y || (y = !0, m.cleanup(), s["SC-arrowsOverOverlay"] && game.world.setChildIndex(r.boardCollectCells, 37), g && g.turnOff(), o.set(), hand.setCells(), h.unlockInput(), S(), G.tutorialOpened = !1, G.saveState.data.finishedTutorials.push(e), G.saveState.save(), G.sb("onTutorialFinishDisplay").dispatch(), G.sb("onTutorialFinish").dispatch(), a.hide(function() {
                t.destroy()
            }))
        }

        function S(t) {
            void 0 === t ? r.inputController.possibleCandies = [] : 0 === t.length ? r.inputController.possibleCandies = [{}] : r.inputController.possibleCandies = P(t)
        }

        function P(t) {
            for (var e = [], i = 0; i < t.length; i += 2) e.push(r.getCandy(t[i], t[i + 1]));
            return e
        }
        s.skipBtn && ((g = new G.TutorialSkipBtn(s.skipConfig)).onSkip.add(function() {
            t.skipped = !0, T()
        }), this.add(g)), s["SC-arrowsOverOverlay"] && game.world.setChildIndex(r.boardCollectCells, 37), hand = new G.TutorialHand(r), d.add(hand), S([]), b(), G.sb("onGoalAchieved").add(T)
    }, G.TutorialSkipBtn = function(t) {
        this.onSkip = new Phaser.Signal, G.Button.call(this, 530, .9 * game.height, "btn_invite_ingame", function() {
            0 === G.lvl.lvlNr && G.gameTracking.FTUEDesign("FTUX_TutSkip_Lvl001"), this.onSkip.dispatch()
        }, this), this.addTextLabel("font-white", G.txt("Skip"), 40), this.scale.setTo(1.5), this.onResizeBinding = G.sb("onScreenResize").add(this.onResize, this), this.events.onDestroy.add(function() {
            this.onResizeBinding.detach()
        }, this)
    }, G.TutorialSkipBtn.prototype = Object.create(G.Button.prototype), G.TutorialSkipBtn.prototype.onResize = function() {
        this.y = Math.floor(.9 * game.height)
    }, G.TutorialSkipBtn.prototype.turnOff = function() {
        this.inputEnabled = !1, game.add.tween(this).to({
            alpha: 0
        }, 300, Phaser.Easing.Sinusoidal.In, !0).onComplete.add(function() {
            this.destroy()
        }, this)
    }, G.Helpers = G.Helpers || {}, G.Helpers.loadShoutouts = (Aoa = ["en", "ru", "de", "es", "fr", "it", "nl", "pl", "pt", "tr", "vi"], Boa = null, function(t) {
        var e = t; - 1 === Aoa.indexOf(e) && (e = "en"), Boa !== e && (Boa = e, G.extLoader.atlasJSONHash("shoutouts", "assets/hd/langdependent/shoutouts-" + e + ".png", "assets/hd/langdependent/shoutouts-" + e + ".json"))
    }), G.CoinBar = function(t, e) {
        Phaser.Group.call(this, game), this.position.setTo(t, e), this.bg = G.makeImage(0, 0, "top-panel-coinsBg", .5, this), this.bg.scale.setTo(1.1), this.counter = new G.TextCounter(17, 4, G.saveState.getCoins(), {
            style: "font-white",
            fontSize: 35
        }, .5, 110), this.add(this.counter), G.sb("onCoinsChange").add(function(t) {
            this.counter.setAmount(t)
        }, this), this.onPlusBtnClicked = new Phaser.Signal, this.plusBtn = new G.Button(115, 0, "btn_plus", function() {
            0 < this.onPlusBtnClicked.getNumListeners() ? this.onPlusBtnClicked.dispatch() : G.sb("pushWindow").dispatch("CoinShop")
        }, this), this.add(this.plusBtn)
    }, G.CoinBar.prototype = Object.create(Phaser.Group.prototype), G.CoinShop = function(t) {
        Phaser.Group.call(this, game), this.wheelGroup = new G.CoinShopWheel(t), this.wheelGroup.alpha = 0, this.wheelGroup.ignoreChildInput = !0, this.add(this.wheelGroup), this.catalog = new G.CoinShopCatalog(t), this.catalog.onSpinBtnClicked.add(function() {
            this.showView(this.wheelGroup)
        }, this), this.add(this.catalog), this.showView(this.catalog)
    }, G.CoinShop.prototype = Object.create(Phaser.Group.prototype), G.CoinShop.prototype.showView = function(t) {
        var e;
        t === this.catalog && (e = this.wheelGroup), t === this.wheelGroup && (e = this.catalog), e.ignoreChildInput = !0, game.add.tween(e).to({
            alpha: 0
        }, 300, Phaser.Easing.Sinusoidal.In, !0), game.add.tween(t).to({
            alpha: 1
        }, 300, Phaser.Easing.Sinusoidal.In, !0).onComplete.add(function() {
            t.ignoreChildInput = !1
        }, this)
    }, G.CoinShopSpinBtn = function(t, e) {
        G.Button.call(this, t, e, "long_button_green", function() {
            this.onClicked.dispatch()
        }, this), this.IMMEDIATE = !0, this.label = new G.Text(35, 0, " ", {
            fontSize: 50,
            style: "font-white"
        }, .5, 320), this.addChild(this.label), this.timer = new G.TextTimer(35, 0, 0, {
            fontSize: 50,
            style: "font-white"
        }, .5, 320), this.addChild(this.timer), this.icon = G.makeImage(-170, 0, null, .5, this), this.refreshState(), this.onClicked = new Phaser.Signal, this.bindings = [G.sb("onFreeMoneySpinUsed").add(this.refreshState, this)], this.events.onDestroy.add(function() {
            this.bindings.forEach(function(t) {
                t.detach()
            })
        }, this)
    }, G.CoinShopSpinBtn.prototype = Object.create(G.Button.prototype), G.CoinShopSpinBtn.prototype.refreshState = function() {
        if (null !== this.game) {
            var t = this.spinState,
                e = G.saveState.isFreeMoneySpinAvailable();
            e !== t && (e ? (this.changeTexture("long_button_green"), this.label.setText(G.txt("Free Spin")), this.label.visible = !0, this.icon.changeTexture("new_wheel_menu"), this.icon.scale.setTo(.8), this.timer.visible = !1) : game.incentivised ? (this.changeTexture("long_button_green"), this.label.setText(G.txt("Spin Wheel")), this.label.visible = !0, this.icon.changeTexture("btn-movie-icon"), this.icon.scale.setTo(1), this.timer.visible = !1) : (this.changeTexture("long_button_green"), this.icon.changeTexture("new_wheel_menu"), this.icon.scale.setTo(.8), this.label.visible = !1, this.timer.visible = !0, this.timer.start(G.saveState.getSecToNextFreeMoneySpin()))), this.spinState = e
        }
    }, G.CoinShopWheel = function(t) {
        Phaser.Group.call(this, game), this.config = t, this.state = game.state.getCurrentState(), this.titleTxt = new G.Text(0, -280, G.txt("Spin Wheel"), {
            style: "font-white",
            fontSize: "60px"
        }, .5, 440), this.add(this.titleTxt), this.moneyWheel = this.add(new G.MoneyWheel(0, 5, t)), this.moneyWheel.onFinish.add(this.onWheelFinish, this), this.addTimer(), G.saveState.isFreeMoneySpinAvailable() || this.activateTimer(), this.spinBtn = this.addSpinBtn(0, 255), this.spinBtn.addTerm(function() {
            return !this.isDuringSpin()
        }, this), this.moneyWheel.onLaunch.add(function() {
            this.spinBtn.visible = !1
        }, this), this.dontApplyPrize = t.dontApplyPrize, this.coinTargetObject = t.coinTargetObject, this.onPrizeWon = new Phaser.Signal, this.onBoosterWon = new Phaser.Signal
    }, G.CoinShopWheel.prototype = Object.create(Phaser.Group.prototype), G.CoinShopWheel.prototype.isDuringSpin = function() {
        return this.moneyWheel.launched
    }, G.CoinShopWheel.prototype.addTimer = function() {
        this.timerPrefix = new G.Text(0, -230, G.txt("Next free spin in: "), {
            style: "font-blue",
            fontSize: "30px"
        }, [0, .5], 380), this.add(this.timerPrefix), this.timer = new G.TextTimer(0, -230, 0, {
            style: "font-blue",
            fontSize: "30px"
        }, [0, .5], 150), this.add(this.timer), this.timerPrefix.visible = !1, this.timer.visible = !1, G.centerElements2([this.timerPrefix, this.timer], 10)
    }, G.CoinShopWheel.prototype.activateTimer = function() {
        this.timerPrefix.visible = !0, this.timer.visible = !0, this.timer.start(G.saveState.getSecToNextFreeMoneySpin()), G.centerElements2([this.timerPrefix, this.timer], 10)
    }, G.CoinShopWheel.prototype.addSpinBtn = function(t, e) {
        var i = new G.Button(t, e, "medium_button_green", this.onSpinBtnClicked, this);
        return i.label = new G.Text(35, 0, " ", {
            fontSize: 50,
            style: "font-white"
        }, .5, 250), i.addChild(i.label), i.addTerm(function() {
            return !this.moneyWheel.launched && (game.incentivised || G.saveState.isFreeMoneySpinAvailable())
        }, this), i.icon = G.makeImage(-105, 0, "btn-movie-icon", .5, i), i.refreshState = function() {
            if (null !== this.game) {
                var t = this.spinState,
                    e = G.saveState.isFreeMoneySpinAvailable();
                e !== t && (e ? (this.changeTexture("medium_button_green"), this.label.userMaxWidth = 250, this.label.setText(G.txt("Free Spin")), this.label.x = 0, this.icon.visible = !1) : game.incentivised ? (this.changeTexture("medium_button_green"), this.label.userMaxWidth = 200, this.label.setText(G.txt("Spin")), this.label.x = 20, this.icon.visible = !0) : (this.changeTexture("medium_button_gray"), this.label.userMaxWidth = 200, this.label.setText(G.txt("Spin")), this.label.x = 0, this.icon.visible = !1)), this.spinState = e
            }
        }, i.refreshState(), G.sb("onFreeMoneySpinUsed").add(i.refreshState, i), this.add(i), i
    }, G.CoinShopWheel.prototype.onSpinBtnClicked = function() {
        G.saveState.isFreeMoneySpinAvailable() ? (this.config.failFlow && G.gameTracking.FTUEDesign("FTUX_FirstFFWheelSpin"), this.moneyWheel.launch(), G.saveState.markLastMoneySpin(), G.sb("onFreeMoneySpinUsed").dispatch()) : (this.config.failFlow ? G.gameTracking.design("VideoAdWatchFFWheel") : G.gameTracking.design("VideoAdWatchCSWheel"), G.platform.showAd(!0, function() {
            this.config.failFlow && G.gameTracking.FTUEDesign("FTUX_FirstFFAdWheelSpin"), this.moneyWheel.launch()
        }, function() {
            new G.NoMoreAds
        }, this))
    }, G.CoinShopWheel.prototype.onWheelFinish = function(t) {
        this.onPrizeWon.dispatch(t), this.spinBtn.visible = !0, this.spinBtn.scale.setTo(0), G.saveState.isFreeMoneySpinAvailable() || this.activateTimer(), this.dontApplyPrize || this.applyPrize(t, function() {
            game.add.tween(this.spinBtn.scale).to({
                x: 1,
                y: 1
            }, 300, Phaser.Easing.Sinusoidal.In, !0), this.moneyWheel.restart()
        }, this)
    }, G.CoinShopWheel.prototype.applyPrize = function(t, e, i) {
        if ("coin" === t[0]) {
            var s = this.moneyWheel.getLabelIconByPrize(t);
            if (this.coinTargetObject && this.state.uiTargetParticles && s) this.state.uiTargetParticles.createCoinBatch(game.world.bounds.x + s.worldPosition.x, s.worldPosition.y, this.coinTargetObject, t[1]);
            else console.log("change coins", t[1]), G.saveState.changeCoins(t[1]), e && e.call(i);
            G.gameTracking.source("Coins", "Reward", "FailFlow", t[1])
        } else this.onBoosterWon.dispatch(), G.gameTracking.source("MOVES", "Reward", "FailFlow")
    }, G.MoneyWheel = function(t, e, i) {
        Phaser.Group.call(this, game), this.position.setTo(t, e), this.state = game.state.getCurrentState(), this.prizeTable = G.Utils.clone(G.json.settings.moneyWheelFreePrizes), this.prizeTableGold = G.Utils.clone(G.json.settings.moneyWheelAdPrizes), i.failFlow && (this.prizeTable[0].prize = ["boster_5", 1], this.prizeTableGold[1].prize = ["boster_5", 1]), this.angleBetweenFields = 360 / this.prizeTableGold.length, this.anglePrizeStartOffset = this.angleBetweenFields / 2, this.angleDiffSinceLastPin = 0, this.angleBetweenPins = 15, this.angleSpeedMulti = .985, this.wheelGfx = this.add(this.makeWheelGfx(0, 0, "prize_wheel_2", this.prizeTable)), this.wheelGfxGold = this.add(this.makeWheelGfx(0, 0, "gold_wheel", this.prizeTableGold)), this.wheelPointer = this.add(this.makeWheelPointer(0, -180, "prize_wheel_arrow")), this.wheelGfx.wheelDistancePassed = 0, this.wheelGfx.prevDistancePassed = 0, this.wheelGfx.inputEnabled = !0, this.pointer = null, this.pointerStartX = 0, this.pointerClickedDate = 0, this.launched = !1, this.finished = !1, this.wheelGfx.events.onInputDown.add(function() {
            var t = game.input.activePointer;
            this.pointerStartX.worldX, this.pointerClickedDate = Date.now(), this.pointer = t
        }, this), this.onLaunch = new Phaser.Signal, this.onFinish = new Phaser.Signal, this.gold = !G.saveState.isFreeMoneySpinAvailable()
    }, G.MoneyWheel.prototype = Object.create(Phaser.Group.prototype), G.MoneyWheel.prototype.changeToRegular = function() {
        this.gold = !1
    }, G.MoneyWheel.prototype.changeToGold = function() {
        this.gold = !0
    }, G.MoneyWheel.prototype.update = function() {
        if (this.wheelGfxGold.angle = this.wheelGfx.angle, this.gold ? (this.wheelGfx.alpha = G.lerp(this.wheelGfx.alpha, 0, .1, .02), this.wheelGfxGold.alpha = G.lerp(this.wheelGfxGold.alpha, 1, .1, .02)) : (this.wheelGfx.alpha = G.lerp(this.wheelGfx.alpha, 1, .1, .02), this.wheelGfxGold.alpha = G.lerp(this.wheelGfxGold.alpha, 0, .1, .02)), this.wheelPointer.update(), !this.finished)
            if (this.launched) {
                var t = this.updateLaunched();
                t && (this.finished = !0, this.onFinish.dispatch(t.prize))
            } else if (null !== this.pointer && !this.pointer.isDown)
            for (var e = this.children.length; e--;) this.children[e].update()
    }, G.MoneyWheel.prototype.getLabelIconByPrize = function(e) {
        var t = this.gold ? this.wheelGfxGold : this.wheelGfx;
        return console.log(t), t.children.find(function(t) {
            return console.log(t.prize), t.prize === e
        })
    }, G.MoneyWheel.prototype.restart = function() {
        this.finished ? (this.launched = !1, this.pointer = null, this.finished = !1, this.wheelGfx.inputEnabled = !0, this.gold = !G.saveState.isFreeMoneySpinAvailable()) : console.log("NOT FINISHED")
    }, G.MoneyWheel.prototype.testSpin = function(t, e, i) {
        var s = {
            angle: 0
        };
        for (s.angleSpeed = .025 * t, s.prevDistancePassed = e || 0, s.wheelDistancePassed = i || 0;;) {
            var a = this.updateWheel(s);
            if (a) return a
        }
    }, G.MoneyWheel.prototype.launch = function(t) {
        for (this.onLaunch.dispatch(), t = void 0 === t ? game.rnd.between(600, 1400) : t, this.wheelGfx.inputEnabled = !1;;) {
            var e = this.testSpin(t, this.wheelGfx.prevDistancePassed, this.wheelGfx.wheelDistancePassed);
            if (!e.keep) break;
            if (!(Math.random() > e.keep)) break;
            t += 80
        }
        this.wheelGfx.angleSpeed = .025 * t, this.launched = !0
    }, G.MoneyWheel.prototype.updateLaunched = function() {
        return this.updateWheel(this.wheelGfx, !0)
    }, G.MoneyWheel.prototype.updateWheel = function(t, e) {
        t.angle += t.angleSpeed;
        var i = t.wheelDistancePassed;
        return t.wheelDistancePassed += t.angleSpeed, Math.floor(i / this.angleBetweenPins) !== Math.floor(t.wheelDistancePassed / this.angleBetweenPins) && (e && this.wheelPointer.bounce(-1 * Math.sign(t.angleSpeed)), t.angleSpeed = .95 * t.angleSpeed, t.angleSpeed < .25 && (t.wheelDistancePassed = i, t.angle = game.math.wrapAngle(i), t.angleSpeed *= -.5)), t.angleSpeed *= this.angleSpeedMulti, this.wheelGfxGold.angle = t.angle, Math.abs(t.angleSpeed) < .05 && this.getPrizeFromAngle(t.angle)
    }, G.MoneyWheel.prototype.getPrizeFromAngle = function(t) {
        var e = t + 180;
        return t < 0 && (e = 180 + t), (this.gold ? this.prizeTableGold : this.prizeTable)[Math.floor(e / this.angleBetweenFields)]
    }, G.MoneyWheel.prototype.makeWheelGfx = function(t, e, i, s) {
        wheel = G.makeImage(0, 0, i, .5), wheel.labels = wheel.addChild(game.make.group());
        for (var a = s.length - 1, n = this.anglePrizeStartOffset; n < 360; n += this.angleBetweenFields) {
            var o = s[a];
            if ("coin" === o.prize[0]) {
                var r = G.makeImage(G.lengthDirX(90 + n, 120, !1), G.lengthDirY(90 + n, 120, !1), "coin_1", .5, wheel);
                r.angle = n + 180, r.prize = o.prize;
                var h = new G.Text(G.lengthDirX(90 + n, 80, !1), G.lengthDirY(90 + n, 80, !1), o.prize[1], {
                    style: "font-white",
                    fontSize: 50
                }, .5, 70);
                h.angle = n + 180, wheel.addChild(h)
            } else {
                var l = G.makeImage(G.lengthDirX(90 + n, 110, !1), G.lengthDirY(90 + n, 110, !1), "ui_booster_5", .5, wheel);
                l.angle = n + 180, l.prize = o.prize
            }
            a--
        }
        return wheel
    }, G.MoneyWheel.prototype.makeWheelPointer = function(t, e, i) {
        var s = G.makeImage(t, e, i, .5, null);
        return s.soundTimer = 2, s.bounce = function(t) {
            this.soundTimer < 0 && (G.sfx.pop.play(), this.soundTimer = 2), this.angle = 10 * t
        }, s.update = function() {
            this.soundTimer--, this.angle = G.lerp(this.angle, 0, .2)
        }, s
    }, G.OutOfMovesInfoPanel = function(t, e) {
        Phaser.Group.call(this, game), this.state = game.state.getCurrentState(), this.position.setTo(t, e), G.MYSTERYGIFT && G.saveState.mysteryGift_isModeReady() && 0 < G.saveState.mysteryGift_getCurrentStreak() ? this.initMysteryGiftPanel() : this.initRegularPanel()
    }, G.OutOfMovesInfoPanel.prototype = Object.create(Phaser.Group.prototype), G.OutOfMovesInfoPanel.prototype.initRegularPanel = function() {
        this.state._removedLifeAtStart ? this.gingy = G.makeImage(0, 0, "sad_gingy_heart_small", .5, this) : this.gingy = G.makeImage(0, 0, "failed_dimond", .5, this), this.continue = new G.Text(0, 140, G.txt("Continue?"), {
            style: "font-blue",
            fontSize: 50
        }, .5, 400), this.add(this.continue)
    }, G.OutOfMovesInfoPanel.prototype.initMysteryGiftPanel = function() {
        for (var t = {
                spiral: "ui_booster_8",
                vertical: "ui_booster_4",
                horizontal: "ui_booster_3",
                cross: "ui_booster_9"
            }, e = G.saveState.mysteryGift_getCurrentGifts(), i = 0; i < 3; i++) {
            var s = G.makeImage(140 * i - 140, 0, t[e[i]] || "MysteryGift_EmptyTile", .5, this);
            t[e[i]] && G.makeImage(-30, 30, "task_fail", .5, s)
        }
        this.dontLose = new G.Text(0, 140, G.txt("Don't lose your boost!"), {
            style: "font-blue",
            fontSize: 50
        }, .5, 400), this.add(this.dontLose)
    }, G.PurchaseMsg = function(t) {
        var e, i, s;
        Phaser.Image.call(this, game), this.config = t || {}, this.bg = G.makeImage(0, 0, "text_shade_bg", .5, this), e = t.success ? "@task_complete@ " + G.txt("Purchase successful!") : "@task_fail@ " + G.txt("Purchase failed!"), this.mainMsg = new G.LabelTextT(e, 0, 0, {
            style: "font-white",
            fontSize: 70
        }, .5, 600), this.addChild(this.mainMsg), i = this.mainMsg.width + 100, s = 140, t.success && (this.mainMsg.y = -50, this.rewardMsg = new G.LabelTextT(G.gift.getLabelPackString(t.reward, 1), 0, 50, {
            style: "font-white",
            fontSize: 70
        }, .5, 600), this.addChild(this.rewardMsg), i = Math.max(i, this.rewardMsg.width + 100), s = 300), this.bg.y = 10, this.bg.width = i, this.bg.height = s, this.fixedToCamera = !0, this.cameraOffset.x = .5 * game.width, this.cameraOffset.y = .5 * game.height, this.onFinished = new Phaser.Signal, game.add.tween(this).to({
            alpha: 0
        }, 500, Phaser.Easing.Sinusoidal.InOut, !0, this.config.duration || 2500).onComplete.add(function() {
            this.destroy()
        }, this), game.add.tween(this).from({
            alpha: 0
        }, 500, Phaser.Easing.Sinusoidal.InOut, !0), game.add.existing(this), this.events.onDestroy.add(function() {
            this.onFinished.dispatch()
        }, this)
    }, G.PurchaseMsg.prototype = Object.create(Phaser.Image.prototype), G.PurchaseMsg.prototype.update = function() {
        this.cameraOffset.x = .5 * game.width, this.cameraOffset.y = .5 * game.height
    }, G.HighscorePanel = function() {
        Phaser.Group.call(this, game), this.state = game.state.getCurrentState(), this.hidingOffset = 500, this.hidingOffsetTarget = 0, this.x = .5 * game.width + game.world.bounds.x + this.hidingOffset, this.y = game.height, this.scrolled = !1, this.opened = !1, this.contentBg = G.makeImage(0, 0, "highscore-panel-content-bg", [.5, 0], this), this.contentBg.inputEnabled = !0, this.contentBg.hitArea = new Phaser.Rectangle(-320, 50, 640, 3e3), this.contentBg.events.onInputDown.add(function() {
            this.clicked = !0
        }, this), this.clicked = !1, this.tabsGroup = this.add(game.add.group()), this.tabsGroup.x = -320, this.tabs = {}, this.contentGroup = this.add(game.add.group()), this.contentGroup.x = -302, this.contentGroup.y = 68, this.borderImg = G.makeImage(0, 0, "highscore-panel-border", [.5, 0], this), this.initCheck = !1, this.responseData = !1, this.prevY = this.y, this.inputPrevY = null, this.inputVelY = 0, this.inputPrevX = null, this.inputVelX = 0, this.maskGfx = this.add(game.add.graphics()), this.maskGfx.y = 68, this.maskGfx.alpha = .5, this.maskWidth = 604, this.borderWidth = 5, this.maskHeight = 80, this.visiblePx = 195, this.updateMaskSize(), this.chinGroup = this.add(game.add.group()), this.inviteBtn = new G.Button(0, 0, "btn_invite", G.platform.invite), this.inviteBtn.addTextLabel("font-white", G.txt("Invite!"), 50), this.chinGroup.add(this.inviteBtn), this.toggleBtn = new G.Button(260, 0, "btn_up", function() {
            this.opened ? this.close() : (G.gameTracking.design("LeaderBoardExpandBtnClicked"), this.open())
        }, this), this.chinGroup.add(this.toggleBtn), G.sb("onScreenResize").add(this.onScreenResize, this), this.onScreenResize(), this.leaderboards = {}, this.leaderboardsV = {}, this.fetchedData = {}, this.currentLeaderboard = null, G.PRELEVEL_PER_LEVEL_LEADERBOARD && (G.sb("levelWindowOpen").add(function() {
            this.hidingOffsetTarget = 1e3
        }, this), G.sb("levelWindowClose").add(function() {
            this.hidingOffsetTarget = 0
        }, this)), G.sb("hideMainHighscorePanel").add(function() {
            this.hidingOffsetTarget = 1e3
        }, this), G.sb("showMainHighscorePanel").add(function() {
            this.hidingOffsetTarget = 0
        }, this)
    }, G.HighscorePanel.prototype = Object.create(Phaser.Group.prototype), G.HighscorePanel.prototype.init = function() {
        var i = {
                FRIENDS: G.LeaderboardData.getLeaderboardData("FRIENDS")
            },
            s = {
                vertical: !0,
                allEntries: !0,
                entriesNr: 5
            },
            a = {
                vertical: !1,
                allEntries: !0,
                entriesNr: 5
            };
        Object.keys(i).forEach(function(t, e) {
            "GLOBAL" === t ? (a.displayFullPos = !0, a.displayPos = !1) : (a.displayFullPos = !1, a.displayPos = !0), this.leaderboardsV[t] = this.add(new G.HighscorePanelLeaderboard(i[t], s)), this.leaderboardsV[t].visible = !1, this.leaderboards[t] = this.add(new G.HighscorePanelLeaderboard(i[t], a)), this.leaderboards[t].visible = !1, this.tabs[t] = this.tabsGroup.add(new G.HighscorePanelTabBtn(0, 0, t)), this.tabs[t].onTabClick.add(this.showLeaderboard, this)
        }, this), -1 !== Object.keys(i).indexOf("FRIENDS") ? this.showLeaderboard("FRIENDS") : this.showLeaderboard(Object.keys(i)[0])
    }, G.HighscorePanel.prototype.fetchData = function(e) {
        this.fetchedData[e] || (this.fetchedData[e] = !0, G.LeaderboardData.fetchLeaderboard(e, function(t) {
            this.fetchedData[e] = t, this.leaderboards[e].init(t), this.leaderboardsV[e].init(t), this.leaderboardsV[e].centerOnCurrent(this.maskWidth, 712), this.leaderboards[e].centerOnCurrent(this.maskWidth, 712)
        }, this))
    }, G.HighscorePanel.prototype.onScreenResize = function() {
        this.x = .5 * game.width + game.world.bounds.x
    }, G.HighscorePanel.prototype.showLeaderboard = function(t) {
        for (name in this.contentGroup.removeAll(), this.leaderboards) this.leaderboards[name].visible = !1, this.leaderboards[name].mask = !1, this.tabs[name].setAsInactive();
        for (name in this.leaderboardsV) this.leaderboardsV[name].visible = !1, this.leaderboardsV[name].mask = !1, this.tabs[name].setAsInactive();
        var e = this.opened ? this.leaderboardsV : this.leaderboards;
        e[t] && (this.currentLeaderboard = e[t], this.maskGfx.visible = !0, this.currentLeaderboard.visible = !0, this.currentLeaderboard.mask = this.maskGfx, this.tabs[t].setAsActive(), this.tabsGroup.bringToTop(this.tabs[t]), this.contentGroup.add(this.currentLeaderboard), this.currentLeaderboardName = t, this.fetchData(t)), this.inputVelY = 0, this.inputVelX = 0
    }, G.HighscorePanel.prototype.update = function() {
        this.y = game.height + this.hidingOffset - this.visiblePx, this.chinGroup.y = this.visiblePx - 30, this.currentLeaderboard && this.currentLeaderboard.update(), this.updateMaskSize(), this.updateInput(), this.hidingOffset = G.lerp(this.hidingOffset, this.hidingOffsetTarget, .1)
    }, G.HighscorePanel.prototype.updateMaskSize = function() {
        this.maskGfx.clear(), this.maskGfx.beginFill(16711680, 1), this.maskGfx.drawRect(-.5 * this.maskWidth, 0, this.maskWidth, this.maskHeight)
    }, G.HighscorePanel.prototype.updateInput = function() {
        if (this.clicked && this.currentLeaderboard && this.currentLeaderboard.hasData() && game.input.activePointer.isDown) {
            if (null !== this.inputPrevX) {
                var t = .5 * (game.input.activePointer.x - this.inputPrevX);
                this.inputVelX = t
            }
            if (null !== this.inputPrevY) {
                var e = .5 * (game.input.activePointer.y - this.inputPrevY);
                this.inputVelY = e
            }
            this.scrolled || (G.gameTracking.design("LeaderboardMapScrolled"), this.scrolled = !0), this.inputPrevX = game.input.activePointer.x, this.inputPrevY = game.input.activePointer.y
        } else this.clicked = !1, this.inputPrevY = null, this.inputPrevX = null;
        this.currentLeaderboard && (this.currentLeaderboard.HORIZONTAL && (this.currentLeaderboard.x += this.inputVelX), this.currentLeaderboard.VERTICAL && (this.currentLeaderboard.y += this.inputVelY), this.boundRistrict(this.currentLeaderboard)), this.inputVelX *= .95, this.inputVelY *= .95, Math.abs(this.inputVelX) < 1 && (this.inputVelX = 0), Math.abs(this.inputVelY) < 1 && (this.inputVelY = 0)
    }, G.HighscorePanel.prototype.boundRistrict = function(t) {
        if (t.VERTICAL) {
            var e = Math.min(0, -(t.height - this.maskHeight));
            0 < t.y && (t.y = G.lerp(t.y, 0, .5), t.y < 1 && (t.y = 0)), t.y < e && (t.y = G.lerp(t.y, e, .5), t.y > e + 1 && (t.y = e))
        }
        if (t.HORIZONTAL) {
            var i = Math.min(0, -(t.width - this.maskWidth));
            0 < t.x && (t.x = G.lerp(t.x, 0, .5), t.x < 1 && (t.x = 0)), t.x < i && (t.x = G.lerp(t.x, i, .5), t.x > i + 1 && (t.x = i))
        }
    }, G.HighscorePanel.prototype.open = function(t) {
        this.opened = !0, G.stopTweens(this), this.visiblePx = 720, this.toggleBtn.angle = 180, this.maskHeight = this.visiblePx - 70 - 68, this.showLeaderboard(this.currentLeaderboardName)
    }, G.HighscorePanel.prototype.close = function(t) {
        this.opened = !1, G.stopTweens(this), this.visiblePx = 195, this.toggleBtn.angle = 0, this.maskHeight = this.visiblePx - 70, this.showLeaderboard(this.currentLeaderboardName)
    }, G.HighscorePanelIngame = function() {
        Phaser.Group.call(this, game), this.fixedToCamera = !0, this.contentBg = G.makeImage(0, 0, "leaderboard_ingame_panel", [.5, 1], this), this.contentBg.inputEnabled = !0, this.contentBg.events.onInputDown.add(function() {
            this.clicked = !0
        }, this), this.clicked = !1, this.contentGroup = this.add(game.add.group()), this.contentGroup.x = -302, this.contentGroup.y = -85, this.currentLeaderboard = new G.HighscorePanelLeaderboard([], {
            vertical: !1,
            entriesNr: 5,
            allEntries: !0,
            displayPos: !0
        }), this.contentGroup.add(this.currentLeaderboard), this.add(this.contentGroup), this.maskGfx = this.add(game.add.graphics()), this.maskGfx.y = -85, this.maskGfx.alpha = .5, this.maskWidth = 604, this.maskHeight = 80, this.maskGfx.beginFill(16711680, 1), this.maskGfx.drawRect(-.5 * this.maskWidth, 0, this.maskWidth - 140, this.maskHeight), this.inputPrevY = null, this.inputVelY = 0, this.inputPrevX = null, this.inputVelX = 0, this.currentLeaderboard.mask = this.maskGfx, this.inviteBtn = new G.Button(235, -45, "btn_invite_ingame", G.platform.invite, this), this.inviteBtn.addTextLabel("font-white", G.txt("Invite!"), 50), this.add(this.inviteBtn), this.additionalCameraOffset = 200, this.additionalCameraOffsetTarget = 200, this.update()
    }, G.HighscorePanelIngame.prototype = Object.create(Phaser.Group.prototype), G.HighscorePanelIngame.prototype.injectLevelData = function(t, e) {
        this.currentLeaderboard.init(t), this.currentLeaderboard.centerOnCurrent(this.maskWidth, this.maskHeight);
        var i = t.find(function(t) {
            return t.isCurrentUser
        });
        i && e && game.time.events.add(100, function() {
            G.sb("pushWindow").dispatch(["friendBeaten", i, e])
        })
    }, G.HighscorePanelIngame.prototype.update = function() {
        this.cameraOffset.x = .5 * game.width, this.cameraOffset.y = game.height + this.additionalCameraOffset, this.currentLeaderboard.update(), this.updateInput(), this.additionalCameraOffset = G.lerp(this.additionalCameraOffset, this.additionalCameraOffsetTarget, .1)
    }, G.HighscorePanelIngame.prototype.updateInput = function() {
        if (this.clicked && this.currentLeaderboard && this.currentLeaderboard.hasData() && game.input.activePointer.isDown) {
            if (null !== this.inputPrevX) {
                var t = .5 * (game.input.activePointer.x - this.inputPrevX);
                this.inputVelX = t
            }
            if (null !== this.inputPrevY) {
                var e = .5 * (game.input.activePointer.y - this.inputPrevY);
                this.inputVelY = e
            }
            this.scrolled || (G.gameTracking.design("LeaderboardMapScrolled"), this.scrolled = !0), this.inputPrevX = game.input.activePointer.x, this.inputPrevY = game.input.activePointer.y
        } else this.clicked = !1, this.inputPrevY = null, this.inputPrevX = null;
        this.currentLeaderboard && (this.currentLeaderboard.HORIZONTAL && (this.currentLeaderboard.x += this.inputVelX), this.currentLeaderboard.VERTICAL && (this.currentLeaderboard.y += this.inputVelY), this.boundRistrict(this.currentLeaderboard)), this.inputVelX *= .95, this.inputVelY *= .95, Math.abs(this.inputVelX) < 1 && (this.inputVelX = 0), Math.abs(this.inputVelY) < 1 && (this.inputVelY = 0)
    }, G.HighscorePanelIngame.prototype.boundRistrict = function(t) {
        if (t.HORIZONTAL) {
            var e = Math.min(0, -(t.width - this.maskWidth)) - 140;
            0 < t.x && (t.x = G.lerp(t.x, 0, .5), t.x < 1 && (t.x = 0)), t.x < e && (t.x = G.lerp(t.x, e, .5), t.x > e + 1 && (t.x = e))
        }
    }, G.HighscorePanelLeaderboard = function(t, e) {
        var i = G.Leaderboard.LeaderboardWaitingGroup;
        Phaser.Group.call(this, game), this.data = !1, this.config = e || {}, this.config = G.Utils.clone(e), this.brush = game.make.image(0, 0), this.avatarAlphaMask = game.make.image(0, 0, "leaderboard", "highscore-avatar-alphaMask"), this.txt = new G.Text(0, 0, " ", {}), this.rt = game.make.renderTexture(602, 70), this.rtPadding = e.rtPadding || 10, this.image = this.add(game.make.image(0, 0, this.rt));
        var s = {
            maxWidth: 400,
            maxHeight: 50,
            errorText: G.txt("Leaderboards currently unavailable") + "\n" + G.txt("Will be back soon!"),
            errorStyle: {
                style: "font-blue",
                fontSize: 30,
                lineSpacing: -15
            },
            messageTimeoutMS: 15e3
        };
        e.vertical ? (this.VERTICAL = !0, this.rt.resize(602, 300), s.errorStyle.fontSize = 40, s.maxWidth = 500, s.maxHeight = 100, this.waitingGroup = new i(301, 150, s)) : (this.HORIZONTAL = !0, this.waitingGroup = new i(301, 35, s)), this.add(this.waitingGroup), this.currentUser = null, this.currentUserX = null, this.currentUserY = null, this.removeData()
    }, G.HighscorePanelLeaderboard.prototype = Object.create(Phaser.Group.prototype), G.HighscorePanelLeaderboard.prototype.hasData = function() {
        return this.data
    }, G.HighscorePanelLeaderboard.prototype.removeData = function() {
        for (this.data = !1; this.children[3];) this.children[3].destroy();
        this.x = 0, this.waitingGroup.show(), this.rt.clear(), this.config.vertical ? this.rt.resize(602, 300) : this.rt.resize(602, 70)
    }, G.HighscorePanelLeaderboard.prototype.init = function(t) {
        var e;
        if (this.data = t, this.waitingGroup.hide(), e = this.config.allEntries ? Math.max(t.length, this.config.entriesNr) : this.config.entriesNr, this.config.entriesMax && (e = Math.min(e, this.config.entriesMax)), this.config.vertical) {
            var i = 70 * e;
            this.rt.resize(602, i)
        } else {
            var s = 145 * e;
            this.rt.resize(s + 2 * this.rtPadding, 70)
        }
        this.rt.x = game.world.bounds.x;
        for (var a = 0; a < e; a++) this.config.vertical ? t[a] ? this.createEntryVer(0, 70 * a, t[a].rank || a + 1, t[a]) : this.createEntryVer(0, 70 * a, a + 1) : t[a] ? this.createEntryHor(this.rtPadding + 145 * a, 10, t[a].rank || a + 1, t[a]) : this.createEntryHor(this.rtPadding + 145 * a, 10, a + 1)
    }, G.HighscorePanelLeaderboard.prototype.centerOnCurrent = function(t, e) {
        this.currentUser && (this.VERTICAL ? (this.y = -this.currentUserY + .5 * e, this.y = Math.min(0, this.y)) : (this.x = -this.currentUserX + .5 * t, this.x = Math.min(0, this.x)))
    }, G.HighscorePanelLeaderboard.prototype.createEntryVer = function(t, e, i, s) {
        s && s.isCurrentUser ? (G.changeTexture(this.brush, "highscore-v-hl-current"), this.rt.renderXY(this.brush, t, e)) : i % 2 == 1 && (G.changeTexture(this.brush, "highscore-v-hl"), this.rt.renderXY(this.brush, t, e)), this.txt.fill = "#008bf9", this.txt.fontSize = "25px", this.txt.anchor.x = .5, this.txt.updateTransform(), this.txt.userMaxWidth = 40, this.txt.setText(i.toString() + "."), this.txt.width = Math.min(40, this.txt.width), this.rt.renderXY(this.txt, t + 45, e + 17);
        var a = this;
        if (s) G.makeExtImage(t + 80, e + 10, s.image, "avatar_m", 0, this, !1, function() {
            avatar = a.alphaMaskAvatar(t + 80, e + 10, this, s && s.isCurrentUser, i), this.destroy()
        });
        else G.changeTexture(this.brush, "avatar_m"), avatar = this.alphaMaskAvatar(t + 80, e + 10, this.brush, s && s.isCurrentUser, i);
        var n = s ? s.name : "---";
        this.txt.anchor.x = 0, this.txt.updateTransform(), this.txt.fill = "#008bf9", this.txt.fontSize = "25px", this.txt.userMaxWidth = 250, this.txt.setText(n), this.rt.renderXY(this.txt, t + 145, e + 17), s && s.score && (this.txt.fill = "#008bf9", this.txt.fontSize = "25px", this.txt.userMaxWidth = 250, this.txt.anchor.x = 1, this.txt.updateTransform(), this.txt.setText(s.score.toString()), this.rt.renderXY(this.txt, t + 570, e + 17)), s && s.isCurrentUser && (this.currentUser = !0, this.currentUserY = e + 35)
    }, G.HighscorePanelLeaderboard.prototype.createEntryHor = function(t, e, i, s) {
        G.changeTexture(this.brush, "highscore-h-playerBg_small"), this.rt.renderXY(this.brush, t + 10, e);
        var a = this;
        if (s) G.makeExtImage(t + 0, e - 0, s.image, "avatar_m", 0, this, !1, function() {
            a.alphaMaskAvatar(t, e + 0, this, s && s.isCurrentUser, i), this.destroy()
        });
        else G.changeTexture(this.brush, "avatar_m"), this.alphaMaskAvatar(t, e + 0, this.brush, s && s.isCurrentUser, i);
        var n = s ? s.name : "---";
        this.txt.anchor.x = 0, this.txt.updateTransform(), this.txt.fill = "#008bf9", this.txt.fontSize = "20px", this.txt.userMaxWidth = 60, this.txt.setText(n), this.rt.renderXY(this.txt, t + 55, e + 3), s && s.score && (this.txt.fill = "#008bf9", this.txt.fontSize = "20px", this.txt.userMaxWidth = 60, this.txt.setText(s.score.toString()), this.rt.renderXY(this.txt, t + 55, e + 25)), s && s.isCurrentUser && (this.currentUser = !0, this.currentUserX = t + 100)
    }, G.HighscorePanelLeaderboard.prototype.alphaMaskAvatar = function(t, e, i, s, a) {
        var n, o = game.make.bitmapData(50, 50),
            r = new Phaser.Rectangle(0, 0, 50, 50);
        o.alphaMask(i, this.avatarAlphaMask, r, r), n = this.config.displayPos ? "highscore-avatar-border_num" : this.config.displayFullPos ? "highscore-avatar-border_num_full" : "highscore-avatar-border", G.changeTexture(this.brush, n), o.draw(this.brush, 0, 0, 50, 50);
        var h = o.addToWorld();
        if (this.rt.renderXY(h, t, e), o.destroy(), h.destroy(), s && (G.changeTexture(this.brush, "highscore-avatar-userBorder"), this.rt.renderXY(this.brush, t - 5, e - 5)), this.config.displayPos || this.config.displayFullPos) {
            this.txt.fontSize = "12px", this.txt.fill = "white", this.txt.anchor.x = .5, this.txt.userMaxWidth = this.config.displayPos ? 17 : 48, this.txt.setText(a.toString());
            var l = this.config.displayPos ? t + 10 : t + 25;
            this.rt.renderXY(this.txt, l, e + 32)
        }
    }, G.HighscorePanelTabBtn = function(t, e, i) {
        this.onTabClick = new Phaser.Signal, this.tabKeyLower = i.toLowerCase(), G.Button.call(this, t, e, "highscore-panel-tab-global-inactive", function() {
            "GLOBAL" === i && G.gameTracking.design("GlobalTabClickedLeaderboard"), this.onTabClick.dispatch(this.tabKey)
        }, this), this.anchor.setTo(0, 0), this.hitArea = new Phaser.Rectangle("FRIENDS" == i ? 0 : 320, 0, 320, 68), this.tabKey = i, this.keyTxt = new G.Text("FRIENDS" == i ? 160 : 480, 30, G.capitalize(G.txt(i).toLowerCase()), {
            fill: "white",
            font: "Lobster",
            fontSize: "40px",
            stroke: "#0a7fd5",
            strokeThickness: 1
        }, .5, 300), this.keyTxt.setShadow(0, 2, "#0a7fd5", 2, !0, !0), this.addChild(this.keyTxt), this.IMMEDIATE = !0, this.setAsInactive()
    }, G.HighscorePanelTabBtn.prototype = Object.create(G.Button.prototype), G.HighscorePanelTabBtn.prototype.setAsActive = function() {
        G.changeTexture(this, "highscore-panel-tab-global-active"), this.keyTxt.alpha = 1, this.keyTxt.y = 25
    }, G.HighscorePanelTabBtn.prototype.setAsInactive = function() {
        G.changeTexture(this, "highscore-panel-tab-global-inactive"), this.keyTxt.alpha = .5, this.keyTxt.y = 30
    }, G.LeaderboardData = {
        currentPlayer: null,
        lastGroupPosition: null,
        ready: !1,
        onReady: new Phaser.Signal,
        onFetch: {},
        onStateBinding: !1,
        leaderboards: {},
        onPerLevelFetch: [],
        perLevelPrev: [],
        cachedFRIENDS: !1,
        onBackendLive: function(t) {
            G.isBackendLive() ? (console.log("!! backendLive"), t()) : (console.log("!! NO backendLive"), G.onBackendLogin.addOnce(t))
        },
        fetchFriends: function() {
            var e = this,
                i = 1e3;

            function a(t) {
                console.log(t), G.isBackendLive() ? (setTimeout(function() {
                    e.fetchFriends()
                }, i), i = Math.min(2 * i, 3e4)) : (G.onBackendLogin.addOnce(e.fetchFriends, e), i = 1e3)
            }
            this.onBackendLive(function() {
                sdkHandler.trigger("social.getFriends", {
                    callback: function(t, s) {
                        if (t) return a(t);
                        sdkHandler.trigger("getFriendsScores", {
                            leaderboardId: "completedLevels",
                            callback: function(t, e) {
                                if (t) return a(t);
                                e.forEach(function(t) {
                                    var e = t.user.id.split(",").pop(),
                                        i = s.find(function(t) {
                                            return t.userId == e
                                        });
                                    i && (i.maxLevel = Math.min(G.json.levels.length, t.score + 1))
                                }), G.FRIENDS = s
                            }
                        })
                    }
                })
            })
        },
        fetchLeaderboard: function(t, e, i) {
            var n = this,
                s = !1,
                o = 1e3;
            if ("FRIENDS" !== t || !this.cachedFRIENDS || !this.leaderboards.FRIENDS) return e && (this.onFetch[t] || (this.onFetch[t] = new Phaser.Signal), this.onFetch[t].addOnce(e, i)), this.onStateBinding || (this.onStateBinding = game.state.onStateChange.add(this.clearFetch, this)), this.onBackendLive(r), {
                cancel: function() {
                    s = !0
                }
            };

            function r() {
                !s && n.onFetch[t].has(e, i) && sdkHandler.trigger("getFriendsScores", {
                    leaderboardId: "main",
                    callback: function(t, e) {
                        if (t) return i = t, console.log(i), void(G.isBackendLive() ? (setTimeout(r, o), o = Math.min(2 * o, 3e4)) : (G.onBackendLogin.addOnce(r), o = 1e3));
                        var i, s, a;
                        e && (a = "FRIENDS", s = {
                            FRIENDS: (s = e).map(function(t) {
                                var e = t.user.id.split(",").pop();
                                return {
                                    rank: t.rank,
                                    score: t.score,
                                    name: t.user.handle,
                                    image: t.user.avatarUrl,
                                    userId: e,
                                    isCurrentUser: e === sgSettings.config.user.userId
                                }
                            })
                        }, n.processLeaderboard(s, a), n.ready = !0, n.cachedFRIENDS = !0, n.onReady.dispatch(), n.onFetch[a].dispatch(n.getLeaderboardData(a)))
                    }
                })
            }
            e && e.call(i, this.getLeaderboardData("FRIENDS"))
        },
        fetchLevelLeaderboard: function(t, e, i, s) {
            var a = this,
                n = !1,
                o = 1e3;
            if (G.PERLEVEL_LEADERBOARD && G.json.levels[t - 1]) {
                var r = G.json.levels[t - 1].id || t;
                if (this.onPerLevelFetch[r] || (this.onPerLevelFetch[r] = new Phaser.Signal), s && this.perLevelPrev[r]) e && e.call(i, this.perLevelPrev[r]);
                else if (!this.busy) return e && this.onPerLevelFetch[r].addOnce(e, i), this.onStateBinding || (this.onStateBinding = game.state.onStateChange.add(this.clearFetch, this)), this.busy = !0, this.onBackendLive(h), {
                    cancel: function() {
                        n = !0
                    }
                }
            }

            function h() {
                !n && a.onPerLevelFetch[r].has(e, i) && sdkHandler.trigger("getFriendsScores", {
                    leaderboardId: "level_" + r,
                    callback: function(t, e) {
                        if (a.busy = !1, t) return i = t, console.log(i), void(G.isBackendLive() ? (setTimeout(h, o), o = Math.min(2 * o, 3e4)) : (G.onBackendLogin.addOnce(h), o = 1e3));
                        var i;
                        e && function(t) {
                            t = {
                                FRIENDS: t.map(function(t) {
                                    var e = t.user.id.split(",").pop();
                                    return {
                                        rank: t.rank,
                                        score: t.score,
                                        name: t.user.handle,
                                        image: t.user.avatarUrl,
                                        userId: e,
                                        isCurrentUser: e === sgSettings.config.user.userId
                                    }
                                })
                            };
                            var e = null;
                            a.perLevelPrev[r] && (e = a.getBeatenFriend(a.perLevelPrev[r], t.FRIENDS));
                            a.perLevelPrev[r] = t.FRIENDS, a.onPerLevelFetch[r].dispatch(t.FRIENDS, e)
                        }(e)
                    }
                }, this)
            }
        },
        getBeatenFriend: function(t, e) {
            try {
                var i = t.find(function(t) {
                        return t.isCurrentUser
                    }),
                    s = t.indexOf(i),
                    a = i ? i.score : 0,
                    n = e.find(function(t) {
                        return t.isCurrentUser
                    }),
                    o = e.indexOf(n),
                    r = n ? n.score : 0;
                if (!n) return null;
                if (r <= a) return null;
                var h = e[o + 1];
                if (!h) return null;
                if (0 === a) return h ? [n, h] : null;
                for (var l = h.userId, d = 0; d < s; d++)
                    if (t[d].userId === l) return [n, h];
                return null
            } catch (t) {
                console.log(t)
            }
        },
        clearFetch: function() {
            Object.keys(this.onFetch).forEach(function(t) {
                this.onFetch[t].removeAll()
            }, this), this.onReady.removeAll(), this.onPerLevelFetch.forEach(function(t) {
                t && t.removeAll()
            })
        },
        getLeaderboardData: function(t) {
            if (this.leaderboards && this.leaderboards[t]) return this.leaderboards[t];
            var e = [];
            return e.PLACEHOLDER = !0, e
        },
        processLeaderboard: function(t, e) {
            this.leaderboards[e] = t[e].sort(function(t, e) {
                return e.score - t.score
            }), this.leaderboards.FRIENDS && (this.currentPlayer = this.leaderboards.FRIENDS.find(function(t) {
                return t.isCurrentUser
            }), this.currentPlayer || (this.currentPlayer = {
                image: sgSettings.config.user.avatar,
                isCurrentUser: !0,
                name: sgSettings.config.user.name,
                score: 0,
                userId: sgSettings.config.user.userId
            }))
        },
        checkIfNewHighscoreTier: function() {
            if (G.saveState.data && this.currentPlayer && 15e3 < this.currentPlayer.score) {
                var t = Math.floor(this.currentPlayer.score / 15e3);
                G.saveState.data.highscoreTierMsgs || (G.saveState.data.highscoreTierMsgs = []), -1 == G.saveState.data.highscoreTierMsgs.indexOf(t) && (G.saveState.data.highscoreTierMsgs.push(t), G.saveState.save(), G.platform.sendMsg("New highscore!", G.MsgWOW, {
                    name: this.currentPlayer.name,
                    avatar: this.currentPlayer.image,
                    score: this.currentPlayer.score
                }))
            }
        },
        checkIfBeat: function() {
            try {
                if (this.leaderboardsPrev && this.leaderboards && this.leaderboardsPrev.GROUP && this.leaderboards.GROUP) {
                    var t = this.leaderboardsPrev.GROUP.find(function(t) {
                        return t.isCurrentUser
                    });
                    console.log("lastCurrent", t);
                    var e = this.leaderboards.GROUP.find(function(t) {
                        return t.isCurrentUser
                    });
                    if (console.log("current", e), t && e && e.rank > t.rank) {
                        var i = this.leaderboardsPrev.GROUP.indexOf(e),
                            s = this.leaderboardsPrev.GROUP[i + 1];
                        console.log("other", s), s && G.platform.beatMsg({
                            name: this.currentPlayer.name,
                            avatar: this.currentPlayer.image,
                            score: this.currentPlayer.score
                        }, {
                            name: s.name,
                            avatar: s.image,
                            score: s.score
                        })
                    }
                }
            } catch (t) {}
        },
        updateFriendsLeaderboard: function(t) {
            if (t <= 0) return !0;
            var e = this.getLeaderboardData("FRIENDS"),
                i = 0,
                s = 0,
                a = e.find(function(t) {
                    return t.isCurrentUser
                });
            a ? (i = a.score, a.score += t, s = a.score) : (this.currentPlayer = {
                image: sgSettings.config.user.avatar,
                isCurrentUser: !0,
                name: sgSettings.config.user.name,
                score: t,
                userId: sgSettings.config.user.userId
            }, e.push(this.currentPlayer), s = t), this.leaderboards.FRIENDS = e.sort(function(t, e) {
                return e.score - t.score
            }).map(function(t, e) {
                return t.rank = e + 1, t
            });
            var n = e.filter(function(t) {
                return t.score < s && t.score > i && !t.isCurrentUser
            });
            0 < n.length && (this.friendsLeaderboardPassedPlayer = n[0])
        },
        checkHighscoreProgress: function() {
            this.friendsLeaderboardPassedPlayer && (G.sb("pushWindow").dispatch(["highscoreBeaten", this.friendsLeaderboardPassedPlayer]), this.friendsLeaderboardPassedPlayer = null)
        },
        checkLevelProgress: function() {
            if (G.FRIENDS) {
                var t = game.state.getCurrentState();
                if (t.lastLevelData && t.lastLevelData.lvlNr + 1 === G.saveState.getLastPassedLevelNr() && t.lastLevelData.starImprovement === G.saveState.data.levels[t.lastLevelData.lvlNr]) {
                    var e = G.FRIENDS.filter(function(t) {
                        return t.maxLevel
                    }).find(function(t) {
                        return t.maxLevel === G.saveState.getLastPassedLevelNr()
                    });
                    e && G.sb("pushWindow").dispatch(["friendOvertaken", e])
                }
            }
        }
    }, G.PerLevelData = function(t) {
        this.currentUserScore = 0, this.data = null, console.log("per level data"), G.LeaderboardData.fetchLevelLeaderboard(t, function(t) {
            this.processData(t), this.data = t.sort(function(t, e) {
                return e.score - t.score
            })
        }, this, !0)
    }, G.PerLevelData.prototype.processData = function(t) {
        this.getCurrentUserScore(t)
    }, G.PerLevelData.prototype.getCurrentUserScore = function(t) {
        var e = t.find(function(t) {
            return t.isCurrentUser
        });
        e && (this.currentUser = e, this.currentUserScore = e.score)
    }, G.PerLevelData.prototype.passLevel = function(t) {
        var e = this.currentUserScore || 0,
            i = {
                leaderboard: null,
                passed: this.getPassedFriend(e, t),
                scoreImprovement: e < t,
                scoreImprovementDelta: t - e,
                requestFriendsUpdate: !0
            };
        if (!this.data) return G.LeaderboardData.cachedFRIENDS = !1, i;
        var s = 0;
        return this.currentUser ? (this.currentUser.score = Math.max(e, t), s = Math.max(0, t - e)) : (this.data.push({
            userId: sgSettings.config.user.userId,
            name: sgSettings.config.user.name,
            image: sgSettings.config.user.avatar,
            score: t,
            isCurrentUser: !0
        }), s = t), console.log("!! LEVEL SCORE IMPROVEMENT", s), G.LeaderboardData.updateFriendsLeaderboard(s), this.data.sort(function(t, e) {
            return e.score - t.score
        }), this.data.forEach(function(t, e) {
            t.rank = e + 1
        }), i.leaderboard = this.data, console.log("!!!", i), i
    }, G.PerLevelData.prototype.getPassedFriend = function(e, i) {
        if (!this.data) return null;
        if (i <= e) return null;
        var t = this.data.filter(function(t) {
            return !t.isCurrentUser && t.score > e && t.score < i
        });
        return console.log("^^ peopleAhead", t), t[0] || null
    }, G.platform = {
        showAd: function(t, e, i, s) {
            if (G.BuildEnvironment.production) {
                var a = new G.AdLoadOverlay;
                t ? G.gameTracking.design("RewardedAdRequested") : G.gameTracking.design("InterstitialAdRequested"), game.time.events.add(20, function() {
                    game.paused = !0, a.destroy()
                }, this)
            } else Math.random() < .2 ? i.call(s) : e.call(s)
        }
    }, G.Leaderboard = {}, G.Leaderboard.LeaderboardWaitingGroup = function(t, e, i) {
        Phaser.Group.call(this, game), this.position.setTo(t, e), this.config = Object.assign({
            maxWidth: 200,
            maxHeight: 80,
            errorText: "Error!",
            errorStyle: {
                fontSize: 30
            },
            messageTimeoutMS: 1e4
        }, i), this.spinningIcon = null, this.messageTxt = null, this.timeEvent = null, this.init(this.config), this.hide()
    }, G.Leaderboard.LeaderboardWaitingGroup.prototype = Object.create(Phaser.Group.prototype), G.Leaderboard.LeaderboardWaitingGroup.prototype.init = function(t) {
        this.spinningIcon = new G.WaitingIcon(0, 0), this.add(this.spinningIcon), this.spinningIcon.width = Math.min(t.maxWidth, this.spinningIcon.width), this.spinningIcon.height = Math.min(t.maxHeight, this.spinningIcon.height), this.spinningIcon.scale.setTo(Math.min(this.spinningIcon.scale.x, this.spinningIcon.scale.y)), this.messageTxt = new G.Text(0, 0, t.errorText, t.errorStyle, .5, t.maxWidth, t.maxHeight, !0, "center"), this.add(this.messageTxt)
    }, G.Leaderboard.LeaderboardWaitingGroup.prototype.show = function() {
        this.spinningIcon.visible = !0, this.messageTxt.visible = !1, this.visible = !0, this.setTimeEvent()
    }, G.Leaderboard.LeaderboardWaitingGroup.prototype.hide = function() {
        this.visible = !1, this.removeTimeEvent()
    }, G.Leaderboard.LeaderboardWaitingGroup.prototype.removeTimeEvent = function() {
        this.timeEvent && (game.time.events.remove(this.timeEvent), this.timeEvent = null)
    }, G.Leaderboard.LeaderboardWaitingGroup.prototype.setTimeEvent = function() {
        this.removeTimeEvent(), this.timeEvent = game.time.events.add(this.config.messageTimeoutMS, function() {
            this.spinningIcon.visible = !1, this.messageTxt.visible = !0
        }, this)
    }, G.checkPopUpTutorials = function(s) {
        G.json.tutorials.POPUPTUTORIALS && s && Object.keys(G.json.tutorials.POPUPTUTORIALS).forEach(function(t) {
            var e = G.json.tutorials.POPUPTUTORIALS[t];
            if (console.log("tutId", t), G.saveState.isPopUpTutorialPassed(t)) console.log("already seen");
            else {
                if (console.log(e), e.terms) {
                    if (console.log("!!!! checking terms"), e.terms.tutorialNotFinished)
                        for (var i = 0; i < e.terms.tutorialNotFinished.length; i++)
                            if (-1 !== G.saveState.data.finishedTutorials.indexOf(e.terms.tutorialNotFinished[i])) return void console.log("skiping because of tutorial");
                    if (e.terms.isAnyInLayer) {
                        if (console.log("checking isAnyInLayer"), "Game" !== game.state.current) return void console.log("failed isAnyInLayer - not game state");
                        if (0 === s.board[e.terms.isAnyInLayer].getAll().length) return void console.log("failed isAnyInLayer - no waffles")
                    }
                }
                G.sb("pushWindow").dispatch(["popUpTutorial", t])
            }
        })
    }, G.PFEventPanel = function(t) {
        this.config = t, Phaser.Group.call(this, game), this.onClick = new Phaser.Signal, this.valueObj = {
            value: t.value,
            target: t.target,
            valueTarget: void 0 === t.valueTarget ? t.value : t.valueTarget
        }, this.bg = G.makeImage(0, 0, "score_popup", .5, this), this.bg.inputEnabled = !0, this.bg.events.onInputDown.add(this.onClick.dispatch, this.onClick), this.onValueChanged = new Phaser.Signal, this.onShowProgressStart = new Phaser.Signal, this.onShowProgressFinish = new Phaser.Signal, this.config.progressBar && this.addProgressBar(this.config.progressBar), this.onShowProgressFinish.add(function() {
            this.showingProgress = !1
        }, this), this.showingProgress = !1
    }, G.PFEventPanel.prototype = Object.create(Phaser.Group.prototype), G.PFEventPanel.prototype.showProgress = function() {
        var t = G.Animations,
            e = G.Utils;
        if (this.valueObj.value === this.valueObj.valueTarget) this.onShowProgressFinish.dispatch();
        else {
            var i = this.valueObj.value,
                s = this.valueObj.valueTarget,
                a = t.getProgressionFlowPanelProgressionAnimation();
            this.onShowProgressStart.dispatch(i, s), a.onComplete.add(this.onShowProgressFinish.dispatch, this.onShowProgressFinish), a.onUpdate.add(function(t) {
                this.onValueChanged.dispatch(e.lerp(i, s, t))
            }, this), a.animate(this.game, this)
        }
    }, G.PFEventPanel.prototype.addProgressBar = function(t) {
        t.value = this.valueObj.value, t.valueMax = this.valueObj.target, this.progressBar = new G.PFProgressBar(t, this.valueObj, this), this.onShowProgressStart.add(function() {
            this.progressBar.startProgress()
        }, this), this.onValueChanged.add(function(t) {
            this.progressBar.setProgress(t / this.valueObj.target)
        }, this), this.onShowProgressFinish.add(function() {
            this.progressBar.finishProgress()
        }, this), this.add(this.progressBar)
    }, G.PFEventPanel.prototype.changeValue = function(t, e) {}, G.PFEventPanelChest = function(t) {
        this.chest = t.chest;
        var e = G.saveState.getAllStars();
        t.valueTarget = Math.min(this.chest.req, e), t.value = (t.startValue, t.valueTarget), t.target = this.chest.req, t.progressBar = {}, G.PFEventPanel.call(this, t), this.desc = this.add(new G.Text(0, -20, G.txt("Stars Collected"), {
            style: "font-white",
            fontSize: 25
        }, .5, 200)), this.starIcon = G.makeImage(-161, 4, "star", .5, this), this.starIcon.scale.setTo(.5), this.chestIcon = G.makeImage(160, 2, "chest_full", .5, this), this.chestIcon.scale.setTo(.8)
    }, G.PFEventPanelChest.prototype = Object.create(G.PFEventPanel.prototype), G.PFEventPanelFirstTry = function(t) {
        G.PFEventPanel.call(this);
        var e = G.saveState.data.mysteryGift.streak;
        this.currentValue = void 0 === t.startValue ? e : t.startValue, this.currentValueTarget = e, this.currentTarget = 3, this.barBg = G.makeImage(-150, 0, "goalPanel_bar_empty", 0, this), this.bar = G.makeImage(-150, 0, "goalPanel_bar_full", 0, this), this.barFullWidth = this.bar.width, this.bar.cropRect = new Phaser.Rectangle(0, 0, this.barFullWidth * (this.currentValue / this.currentTarget), this.bar.height), this.bar.updateCrop();
        var i = G.saveState.data.mysteryGift.gifts;
        e = G.saveState.data.mysteryGift.streak;
        this.icons = [this.addIcon(1 / 3 * this.barFullWidth - 150, 25, i[0]), this.addIcon(2 / 3 * this.barFullWidth - 150, 25, i[1]), this.addIcon(1 * this.barFullWidth - 150, 25, i[2])], this.desc = this.add(new G.Text(0, -25, G.txt("Finish with one try"), {
            style: "font-white",
            fontSize: 25
        }, .5, 300)), this.onShowAnimFinish.add(this.showProgress, this)
    }, G.PFEventPanelFirstTry.prototype = Object.create(G.PFEventPanel.prototype), G.PFEventPanelFirstTry.prototype.showProgress = function() {}, G.PFEventPanelFirstTry.prototype.update = function() {
        this.updatingProgress && (this.bar.cropRect.width = game.math.clamp(Math.round(this.barFullWidth * (this.currentValue / this.currentTarget)), 0, 500), this.bar.updateCrop(), this.updateGoalDesc())
    }, G.PFEventPanelFirstTry.prototype.addIcon = function(t, e, i, s) {
        var a = {
                spiral: "ui_booster_8",
                vertical: "ui_booster_4",
                horizontal: "ui_booster_3",
                cross: "ui_booster_9"
            } [i] || "MysteryGift_EmptyTile",
            n = G.makeImage(Math.floor(t), Math.floor(e), a, .5, this);
        return n.scale.setTo(.75), s && (n.hiddenIcon = G.makeImage(0, 0, "MysteryGift_EmptyTile", .5, n)), n
    }, G.PFEventPanelMission = function(t) {
        this.goalObj = t.mission, t.valueTarget = t.mission.getCurrentVal(), t.value = (t.startValue, t.valueTarget), t.target = t.mission.getTarget(), t.progressBar = {}, G.PFEventPanel.call(this, t), this.desc = this.add(new G.Text(0, -20, t.mission.getDescription(), {
            style: "font-white",
            fontSize: 25
        }, .5, 300)), this.goalObj.icon && (this.icon = G.makeImage(-180, 4, this.goalObj.icon, [0, .5], this), this.icon.width = this.icon.height = 50, this.icon.scale.setTo(Math.min(this.icon.scale.x, this.icon.scale.y)))
    }, G.PFEventPanelMission.prototype = Object.create(G.PFEventPanel.prototype), G.PFProgressBar = function(t) {
        this.config = Object.assign({
            x: -150,
            y: -4,
            bgSprite: "goalPanel_bar_empty",
            barSprite: "goalPanel_bar_full",
            value: 0,
            valueMax: 0,
            label: !0,
            overlaySprite: !1
        }, t), Phaser.Group.call(this, game), this.position.copyFrom(this.config), this.value = this.config.value, this.valueMax = this.config.valueMax, this.barBg = G.makeImage(0, 0, "goalPanel_bar_empty", 0, this), this.bar = G.makeImage(0, 0, "goalPanel_bar_full", 0, this), this.barFullWidth = this.bar.width;
        var e = new Phaser.Rectangle(0, 0, this.barFullWidth * (this.value / this.valueMax), this.bar.height);
        this.config.overlaySprite && (this.barOverlay = G.makeImage(0, 0, this.config.overlaySprite, 0, this), this.barOverlay.name = "barOverlay", this.barOverlay.alpha = 0, this.barOverlay.blendMode = 1, this.barOverlay.cropRect = e), this.bar.cropRect = e, this.updateBarCrop(), this.label = null, this.config.label && this.addLabel(this.config.labelConfig || {})
    }, G.PFProgressBar.prototype = Object.create(Phaser.Group.prototype), G.PFProgressBar.prototype.updateBarCrop = function() {
        this.bar.updateCrop(), this.barOverlay && this.barOverlay.updateCrop()
    }, G.PFProgressBar.prototype.startProgress = function() {
        G.Animations.getProgressBarOverlayAlphaAnimation(1).animate(this.game, this)
    }, G.PFProgressBar.prototype.setProgress = function(t) {
        null !== this.game && (this.bar.cropRect.width = game.math.clamp(Math.round(this.barFullWidth * t), 0, 500), this.updateBarCrop(), this.value = t * this.valueMax, this.label && this.updateLabelValue())
    }, G.PFProgressBar.prototype.finishProgress = function() {
        G.Animations.getProgressBarOverlayAlphaAnimation(0).animate(this.game, this)
    }, G.PFProgressBar.prototype.addLabel = function(t) {
        var e = {
            style: "font-white",
            fontSize: this.barBg.height
        };
        this.label = new G.Text(t.x || 150, t.y || 15, this.value + "/" + this.valueMax, t.style || e, .5), this.add(this.label)
    }, G.PFProgressBar.prototype.updateLabelValue = function() {
        var t = Math.floor(this.value) + "/" + this.valueMax;
        t !== this.label.text && this.label.setText(t)
    }, G.ProgressionFlowPanel = function(t, e, i) {
        Phaser.Group.call(this, game), this.position.setTo(t, e), this.config = i || {}, this.cancelationTokens = {}, this.preShowProgressDelay = 700, this.postShowProgressDelay = 700, this.currentPanel = null, this.panels = [new G.PFEventPanel({
            value: 10,
            valueTarget: 15,
            target: 20,
            progressBar: !0
        }), this.add(new G.PFEventPanelChest({
            chest: G.json.settings.mapChests[0],
            startValue: 0
        }))], this.panels.forEach(function(t) {
            t.x = 400, t.alpha = 0, this.add(t), t.onClick.add(function() {
                this.forceShowNext()
            }, this)
        }, this), this.showNextPanel()
    }, G.ProgressionFlowPanel.prototype = Object.create(Phaser.Group.prototype), G.ProgressionFlowPanel.prototype.showNextPanel = function() {
        var t = this.getNextPanel();
        if (null !== t || null !== this.currentPanel)
            if (this.currentPanel !== t) {
                if (this.currentPanel !== t && (this.currentPanel && this.hidePanelAnim(this.currentPanel), t)) {
                    var e = game.rnd.uuid();
                    this.cancelationTokens[e] = !1, this.currentCancelationToken = e, this.currentPanel = t, this.showPanelAnim(this.currentPanel, function() {
                        game.time.events.add(this.preShowProgressDelay, function() {
                            this.cancelationTokens[e] || this.currentPanel.showProgress()
                        }, this), this.currentPanel.onShowProgressFinish.addOnce(function() {
                            this.cancelationTokens[e] || game.time.events.add(this.postShowProgressDelay, function() {
                                this.cancelationTokens[e] || this.showNextPanel()
                            }, this)
                        }, this)
                    }, this)
                }
            } else this.config.cycle || this.hidePanelAnim(this.currentPanel)
    }, G.ProgressionFlowPanel.prototype.forceShowNext = function() {
        this.cancelationTokens[this.currentCancelationToken] = !0, this.showNextPanel()
    }, G.ProgressionFlowPanel.prototype.showPanelAnim = function(t, e, i) {
        t.x = 400, t.alpha = 0;
        var s = game.add.tween(t).to({
            x: 0,
            alpha: 1
        }, 500, Phaser.Easing.Sinusoidal.InOut, !0);
        e && s.onComplete.add(e, i)
    }, G.ProgressionFlowPanel.prototype.hidePanelAnim = function(t, e, i) {
        var s = game.add.tween(t).to({
            x: -400,
            alpha: 0
        }, 500, Phaser.Easing.Sinusoidal.InOut, !0);
        e && s.onComplete.add(e, i)
    }, G.ProgressionFlowPanel.prototype.getNextPanel = function() {
        if (0 == this.panels.length) return null;
        if (null === this.currentPanel) return this.panels[0];
        var t = this.panels.indexOf(this.currentPanel) + 1;
        return t >= this.panels.length ? this.config.cycle ? this.panels[0] : null : this.panels[t]
    }, G.ShareMsgBase = function(t) {
        Phaser.Group.call(this, game), this._imagesToLoad = t, this._imagesLoaded = 0, this.onReady = new Phaser.Signal, this.ready = !1, this.y = -9999
    }, G.ShareMsgBase.prototype = Object.create(Phaser.Group.prototype), G.ShareMsgBase.prototype.addExtImage = function(t, e, i, s, a, n) {
        var o = this,
            r = G.makeExtImage(t, e, i, null, s, this, !1, function() {
                (a || n) && (this.width = a, this.height = n || a), o._imagesLoaded++, o._imagesToLoad === o._imagesLoaded && (o.ready = !0, game.time.events.add(100, o.onReady.dispatch, o.onReady))
            });
        return (a || n) && (r.width = a, r.height = n || a), r
    }, G.msgToDataURL = function(t) {
        return G._msgBmp || (G._msgBmp = game.make.bitmapData(672, 354)), t.x = game.world.bounds.x, t.y = game.world.bounds.y, t.updateTransform(), G._msgBmp.clear(), G._msgBmp.drawGroup(t), t.destroy(), G._msgBmp.canvas.toDataURL()
    }, G.MsgBeaten = function(t, e) {
        G.ShareMsgBase.call(this, 3), console.log("G.MsgBeaten"), console.log(t, e);
        var i = game.state.getCurrentState().lvlNr + 1;
        t.avatar || (t.avatar = t.image), e.avatar || (e.avatar = e.image), this.bg = this.addExtImage(0, 0, "img/Msg_Friend_Beaten.png", 0), this.friendsBeaten = this.add(new G.Text(336, 40, "Friend beaten!", {
            font: "Lobster",
            fontSize: "50px",
            fill: "white"
        }, .5, 480)), this.avatar1 = this.addExtImage(163, 129, t.avatar, 0, 94), this.name1 = this.add(new G.Text(100, 156, t.name, {
            font: "Lobster",
            fontSize: "25px",
            fill: "white"
        }, [.5, .5], 100)), this.name1.setShadow(1, 2, "rgba(0,0,0,0.5)", 1), this.score1 = this.add(new G.Text(100, 193, t.score, {
            font: "Lobster",
            fontSize: "45px",
            fill: "white"
        }, [.5, .5], 100)), this.score1.setShadow(1, 2, "rgba(0,0,0,0.5)", 1), this.avatar2 = this.addExtImage(418, 149, e.avatar, 0, 94), this.name2 = this.add(new G.Text(577, 175, e.name, {
            font: "Lobster",
            fontSize: "25px",
            fill: "white"
        }, [.5, .5], 100)), this.name2.setShadow(1, 2, "rgba(0,0,0,0.5)", 1), this.score2 = this.add(new G.Text(577, 212, e.score, {
            font: "Lobster",
            fontSize: "45px",
            fill: "white"
        }, [.5, .5], 100)), this.score2.setShadow(1, 2, "rgba(0,0,0,0.5)", 1);
        var s = " scored higher than ";
        this.desc = this.add(new G.Text(336, 325, t.name + s + e.name + "!", {
            font: "Lobster",
            fontSize: "40px",
            fill: "#ffe715"
        }, .5, 580)), this.desc.addColor("#ffffff", t.name.length), this.desc.addColor("#ffe715", s.length + t.name.length), this.desc.addColor("#ffffff", s.length + t.name.length + e.name.length), this.levelTxt = this.add(new G.Text(336, 145, "Level", {
            font: "Lobster",
            fontSize: "35px",
            fill: "#de2289",
            stroke: "white",
            strokeThickness: 8
        }, .5, 200)), this.levelTxt.padding.x += 5, this.levelTxt.padding.y += 5, this.levelTxt.setShadow(1, 2, "rgba(0,0,0,0.3)", 2, !0, !1), this.levelNrTxt = this.add(new G.Text(336, 200, i.toString(), {
            font: "Lobster",
            fontSize: "70px",
            fill: "#de2289",
            stroke: "white",
            strokeThickness: 8
        }, .5, 200)), this.levelNrTxt.padding.x += 5, this.levelNrTxt.padding.y += 5, this.levelNrTxt.setShadow(1, 2, "rgba(0,0,0,0.3)", 2, !0, !1)
    }, G.MsgBeaten.prototype = Object.create(G.ShareMsgBase.prototype), G.MsgFirst = function(t) {
        G.ShareMsgBase.call(this, 2), this.bg = this.addExtImage(0, 0, "img/Msg_First_Highscore.jpg", 0), this.friendsBeaten = this.add(new G.Text(336, 39, "First highscore ever!", {
            font: "Lobster",
            fontSize: "40px",
            fill: "white"
        }, .5, 420)), this.avatar1 = this.addExtImage(266, 103, t.avatar, 0, 139), this.score1 = this.add(new G.Text(336, 295, t.score, {
            font: "Lobster",
            fontSize: "65px",
            fill: "#ffe715",
            stroke: "#0088d1",
            strokeThickness: 8
        }, .5, 420))
    }, G.MsgFirst.prototype = Object.create(G.ShareMsgBase.prototype), G.MsgGate = function(t) {
        G.ShareMsgBase.call(this, 1), this.bg = this.addExtImage(0, 0, "img/Msg_Gate_Key.png", 0)
    }, G.MsgGate.prototype = Object.create(G.ShareMsgBase.prototype), G.MsgGateRequest = function(t) {
        G.ShareMsgBase.call(this, 1), this.bg = this.addExtImage(0, 0, "img/Msg_Gate_Request.png", 0)
    }, G.MsgGateRequest.prototype = Object.create(G.ShareMsgBase.prototype), G.MsgHighscoreBeaten = function(t, e, i) {
        G.ShareMsgBase.call(this, 3), t.avatar || (t.avatar = t.image), e.avatar || (e.avatar = e.image), this.avatar1 = this.addExtImage(193, 74, t.avatar, 0, 125), this.avatar2 = this.addExtImage(372, 100, e.avatar, 0, 124), this.bg = this.addExtImage(0, 0, "img/Bot_Overall_Score_Beaten.png", 0)
    }, G.MsgHighscoreBeaten.prototype = Object.create(G.ShareMsgBase.prototype), G.MsgInvite = function(t) {
        G.ShareMsgBase.call(this, 2), this.bg = this.addExtImage(0, 0, "img/Msg_Wow.jpg", 0), this.friendsBeaten = this.add(new G.Text(336, 39, "Play with me!", {
            font: "Lobster",
            fontSize: "40px",
            fill: "white"
        }, .5, 420)), this.score1 = this.add(new G.Text(336, 295, t.name, {
            font: "Lobster",
            fontSize: "65px",
            fill: "#ffe715",
            stroke: "#0088d1",
            strokeThickness: 8
        }, .5, 420)), this.avatar1 = this.addExtImage(266, 103, t.avatar, 0, 139)
    }, G.MsgInvite.prototype = Object.create(G.ShareMsgBase.prototype), G.MsgLives = function() {
        G.ShareMsgBase.call(this, 1), this.bg = this.addExtImage(0, 0, "img/Msg_Life.jpg", 0), this.title = this.add(new G.Text(336, 43, "You got lives!", {
            font: "Lobster",
            fontSize: "50px",
            fill: "white"
        }, .5, 420))
    }, G.MsgLives.prototype = Object.create(G.ShareMsgBase.prototype), G.MsgLivesRequest = function(t) {
        G.ShareMsgBase.call(this, 2), this.bg = this.addExtImage(0, 0, "img/Msg_Life_Request.jpg", 0), this.avatar1 = this.addExtImage(379, 127, t.avatar, 0, 139), this.title = this.add(new G.Text(336, 43, "A friend needs you!", {
            font: "Lobster",
            fontSize: "50px",
            fill: "white"
        }, .5, 420))
    }, G.MsgLivesRequest.prototype = Object.create(G.ShareMsgBase.prototype), G.MsgNeedHelp = function(t) {
        G.ShareMsgBase.call(this, 2), this.bg = this.addExtImage(0, 0, "img/Msg_Help.jpg", 0), this.needHelpTxt = new G.Text(334, 49, G.txt("Hey buddy, I really need your help!"), {
            font: "RubikBold",
            fontSize: 26,
            fill: "#D500B9"
        }, .5, 500), this.add(this.needHelpTxt), this.avatar1 = this.addExtImage(264, 111, t.avatar, 0, 143)
    }, G.MsgNeedHelp.prototype = Object.create(G.ShareMsgBase.prototype), G.MsgOvertaken = function(t, e) {
        G.ShareMsgBase.call(this, 3), t.avatar || (t.avatar = t.image), e.avatar || (e.avatar = e.image), this.avatar1 = this.addExtImage(100, 126, t.avatar, 0, 118), this.avatar2 = this.addExtImage(347, 83, e.avatar, 0, 192), this.bg = this.addExtImage(0, 0, "img/Bot_Level_Passed.png", 0)
    }, G.MsgOvertaken.prototype = Object.create(G.ShareMsgBase.prototype), G.MsgTreasureHuntInvite = function(t) {
        G.ShareMsgBase.call(this, 2), t.avatar || (t.avatar = t.image), this.avatar1 = this.addExtImage(250, 78, t.avatar, 0, 190), this.bg = this.addExtImage(0, 0, "img/treasure_hunt_friend.png", 0)
    }, G.MsgTreasureHuntInvite.prototype = Object.create(G.ShareMsgBase.prototype), G.MsgWOW = function(t) {
        G.ShareMsgBase.call(this, 2), Phaser.Group.call(this, game), this.bg = this.addExtImage(0, 0, "img/Msg_Wow.jpg", 0), this.friendsBeaten = this.add(new G.Text(336, 39, "Wow! See what I achieved!", {
            font: "Lobster",
            fontSize: "40px",
            fill: "white"
        }, .5, 420)), this.avatar1 = this.addExtImage(266, 103, t.avatar, 0, 139), this.score1 = this.add(new G.Text(336, 295, t.score, {
            font: "Lobster",
            fontSize: "65px",
            fill: "#ffe715",
            stroke: "#0088d1",
            strokeThickness: 8
        }, .5, 420))
    }, G.MsgWOW.prototype = Object.create(G.ShareMsgBase.prototype), G.WorldSidePanel = function() {
        Phaser.Group.call(this, game), this.fixedToCamera = !0, this.overlay = this.add(game.make.graphics()), this.overlay.events.onInputDown.add(function() {
            this.sideGroup.toggle(), this.hideOverlay()
        }, this), this.overlay.alpha = 0, this.sideGroup = new G.WorldSidePanelGroup, this.add(this.sideGroup), this.sideGroup.onOpened.add(this.showOverlay, this), this.sideGroup.onClosed.add(this.hideOverlay, this), G.sb("onScreenResize").add(this.onScreenResize, this), this.onScreenResize(), this.isOpen = !1, this.windowOpened = !1, this.wasOpen = !1, G.sb("pushWindowOnTop").add(this.onWindowOpened, this), G.sb("onWindowOpened").add(this.onWindowOpened, this), G.sb("fillRateFallbackClosed").add(this.onAllWindowsClosed, this), G.sb("onAllWindowsClosed").add(this.onAllWindowsClosed, this)
    }, G.WorldSidePanel.prototype = Object.create(Phaser.Group.prototype), G.WorldSidePanel.prototype.onWindowOpened = function() {
        this.windowOpened || (this.wasOpen = this.isOpen, this.turnOffInput(), G.stopTweens(this), game.add.tween(this).to({
            alpha: 0
        }, 200, Phaser.Easing.Sinusoidal.In, !0).onComplete.add(function() {
            G.sb("worldSidePanelOnWindowHide").dispatch()
        }))
    }, G.WorldSidePanel.prototype.onAllWindowsClosed = function() {
        this.windowOpened = !1, this.turnOnInput(), G.stopTweens(this), game.add.tween(this).to({
            alpha: 1
        }, 200, Phaser.Easing.Sinusoidal.Out, !0)
    }, G.WorldSidePanel.prototype.showOverlay = function() {
        this.overlay.inputEnabled = !0, this.isOpen = !0, this.overlay.inputEnabled = !0, G.stopTweens(this.overlay), game.add.tween(this.overlay).to({
            alpha: .5
        }, 400, Phaser.Easing.Sinusoidal.Out, !0)
    }, G.WorldSidePanel.prototype.hideOverlay = function() {
        this.overlay.inputEnabled = !1, this.isOpen = !1, this.overlay.inputEnabled = !1, G.stopTweens(this.overlay), game.add.tween(this.overlay).to({
            alpha: 0
        }, 400, Phaser.Easing.Sinusoidal.Out, !0)
    }, G.WorldSidePanel.prototype.onScreenResize = function() {
        this.redrawOverlay()
    }, G.WorldSidePanel.prototype.redrawOverlay = function() {
        this.overlay.clear(), this.overlay.beginFill(0, 1), this.overlay.drawRect(0, 0, game.width, game.height)
    }, G.WorldSidePanel.prototype.turnOffInput = function() {
        this.setIgnoreChildrenRec(this, !0)
    }, G.WorldSidePanel.prototype.turnOnInput = function() {
        this.setIgnoreChildrenRec(this, !1)
    }, G.WorldSidePanel.prototype.setIgnoreChildrenRec = function(t, e) {
        void 0 !== t.ignoreChildInput && (t.ignoreChildInput = e), t.children && t.children.forEach(function(t) {
            this.setIgnoreChildrenRec(t, e)
        }, this)
    }, G.WorldSidePanelGroup = function() {
        Phaser.Group.call(this, game), this.x = 30, this.onOpened = new Phaser.Signal, this.onClosed = new Phaser.Signal, this.mainButton = new G.WorldSidePanelWidgetButton(-55, 100), this.mainButton.onClicked.add(function() {
            this.toggle()
        }, this), this.add(this.mainButton), this.bg = G.makeImage(-500, 0, "background_1", 0, this), this.bg.cropRect = new Phaser.Rectangle(0, 0, 430, 960), this.bg.updateCrop(), this.bg.contentMaxWidth = 430, this.bg.contentMaxHeight = game.height, this.scrollInput = new G.ScrollInput(this.bg.x, this.bg.y, 430, game.height), this.add(this.scrollInput), this.content = new G.WorldSidePanelGroupContent(this, -500, 0, 430), this.add(this.content), this.border = G.makeImage(-70, 0, "border_greenbush", 0, this), this.opened = !1, this.openOffset = 0, G.sb("toggleWorldSidePanel").add(this.toggle, this), G.sb("onScreenResize").add(this.onResize, this), this.onResize()
    }, G.WorldSidePanelGroup.prototype = Object.create(Phaser.Group.prototype), G.WorldSidePanelGroup.prototype.onResize = function() {
        this.border.height = Math.max(1400, game.height), this.bg.height = game.height, this.scrollInput.resizeArea(430, game.height)
    }, G.WorldSidePanelGroup.prototype.update = function() {
        Phaser.Group.prototype.update.call(this), this.content.visible = 30 !== this.x, this.content.y -= this.scrollInput.getVelY(), this.content.y = game.math.clamp(this.content.y, -1 * Math.max(0, this.content.getContentHeight() - game.height), 0)
    }, G.WorldSidePanelGroup.prototype.toggle = function() {
        this.opened = !this.opened, this.opened ? (game.sfx.transition.play(), this.content.y = 0, this.scrollInput.setVelToZero(), G.sb("onWorldSidePanelOpen").dispatch(), this.onOpened.dispatch()) : (game.sfx.whoosh.play(), G.sb("onWorldSidePanelClose").dispatch(), this.onClosed.dispatch()), G.stopTweens(this), game.add.tween(this).to({
            x: this.opened ? 460 : 30
        }, 400, Phaser.Easing.Custom.SoftBounce, !0)
    }, Phaser.Easing.Custom = {
        SoftBounce: function(t) {
            return --t * t * ((1.10158 + 1) * t + 1.10158) + 1
        }
    }, G.WorldSidePanelGroupContent = function(t, e, i, s) {
        Phaser.Group.call(this, game), this.position.setTo(e, i), this.contentElements = [], this.sidePanel = t, this.eventManagers = [], this.ribbonEvent = null, this.noEventPanel = null, this.contentHeight = 0, this.treasureHuntPanel = null, this.dailyMissions = null, this.init(), this.sidePanel.onOpened.add(this.open, this), this.sidePanel.onClosed.add(this.close, this)
    }, G.WorldSidePanelGroupContent.prototype = Object.create(Phaser.Group.prototype), G.WorldSidePanelGroupContent.prototype.init = function() {
        G.json.settings, G.saveState;
        var t = G.dailyMissionsMgr,
            e = G.SPDailyMissionContent,
            i = G.WorldSidePanel.NoEvent,
            s = G.WorldSidePanel.Ribbon,
            a = G.TreasureHunt.treasureHuntMgr,
            n = G.TreasureHunt.TreasureHuntEventPanel;
        this.addEventManager(a, n);
        this.contentElements;
        this.ribbonEvent = this.add(new s(0, 20, {
            ribbon: "gold_wheel_ribbon",
            text: G.txt("Events")
        })), this.noEventPanel = this.add(new i), t.isFeatureUnlocked() && (this.dailyMissions = this.add(new e)), this.updateEventsView()
    }, G.WorldSidePanelGroupContent.prototype.addEventManager = function(t, e, i) {
        this.eventManagers.push({
            manager: t,
            panelConstructor: e,
            panelInstance: null,
            priority: G.Utils.defined(i, 0)
        }), G.Utils.cleanUpOnDestroy(this, t.onEventTurnedOnChange.add(this.updateEventsView, this)), this.eventManagers.sort(function(t, e) {
            return e.priority - t.priority
        })
    }, G.WorldSidePanelGroupContent.prototype.updateEventsView = function() {
        console.log("TH update event view"), this.eventManagers.forEach(function(t) {
            var e = t.manager,
                i = t.panelInstance;
            e.isEventTurnedOn() ? null === i && (t.panelInstance = new t.panelConstructor, this.add(t.panelInstance)) : i && (i.destroy(), t.panelInstance = null)
        }, this), this.refreshElementsPlacement()
    }, G.WorldSidePanelGroupContent.prototype.getContentHeight = function() {
        return this.contentHeight
    }, G.WorldSidePanelGroupContent.prototype.getContentElementsList = function() {
        var t = [],
            e = this.eventManagers.find(function(t) {
                return t.manager.isFeatureUnlocked()
            }),
            i = this.eventManagers.map(function(t) {
                return t.panelInstance
            }).filter(function(t) {
                return t
            });
        return e ? (t.push(this.ribbonEvent), this.ribbonEvent.visible = !0, 0 == i.length ? (this.noEventPanel.visible = !0, t.push(this.noEventPanel)) : (this.noEventPanel.visible = !1, t = t.concat(i))) : (this.noEventPanel.visible = !1, this.ribbonEvent.visible = !1), this.dailyMissions && t.push(this.dailyMissions), t
    }, G.WorldSidePanelGroupContent.prototype.refreshElementsPlacement = function() {
        var t = this.getContentElementsList();
        if (0 != t.length) {
            var i = t[0].y;
            t.forEach(function(t, e) {
                t.x = 235, t.y = i, i += t.getContentHeight()
            }), this.contentHeight = this.countContentHeight(t)
        }
    }, G.WorldSidePanelGroupContent.prototype.countContentHeight = function(t) {
        return t.reduce(function(t, e) {
            return t + e.getContentHeight()
        }, 0)
    }, G.WorldSidePanelGroupContent.prototype.open = function() {
        this.eventRibbon && this.eventRibbon.show(!1, 0), this.missionRibbon && this.missionRibbon.show(!1, 100), this.missions && this.missions.show()
    }, G.WorldSidePanelGroupContent.prototype.close = function() {
        this.eventRibbon && this.eventRibbon.hide(), this.missionRibbon && this.missionRibbon.hide(), this.missions && this.missions.hide()
    }, G.WorldSidePanelLockedWidget = function() {
        Phaser.Group.call(this, game), this.lock = G.makeImage(0, 4, "lock", .5, this), game.world.removeChild(this), this.unlockTxt = new G.Text(0, 4, G.txt("Unlock at Level X").replace("X", G.json.settings.featuresUnlock.globalGoals + 1), {
            fill: "white",
            font: "Lobster",
            fontSize: "30px",
            stroke: "black",
            strokeThickness: 1
        }, .5, 140, 150, !0, "center"), this.unlockTxt.lineSpacing = -15, this.unlockTxt.setShadow(0, 0, "black", 3), this.add(this.unlockTxt), game.add.tween(this.unlockTxt.scale).to({
            x: .9,
            y: .9
        }, 500, Phaser.Easing.Sinusoidal.InOut, !0, 0, -1, !0)
    }, G.WorldSidePanelLockedWidget.prototype = Object.create(Phaser.Group.prototype), G.WorldSidePanelMissionPanel = function(t, e, i) {
        Phaser.Group.call(this, game), this.position.setTo(t, e), this.bg = G.makeImage(0, 0, "score_popup", .5, this), this.icon = G.makeImage(0, 0, "candy_spiral", .5, this), this.desc = new G.Text(0, 0, "10/20 open", {
            style: "font-white",
            fontSize: 25
        }, .5, this), this.add(this.desc), this.goalObj = i
    }, G.WorldSidePanelMissionPanel.prototype = Object.create(Phaser.Group.prototype), G.WorldSidePanelMissionPanel.prototype.injectGoal = function() {}, G.WorldSidePanelWidgetButton = function(t, e) {
        var i, s;
        Phaser.Group.call(this, game), this.position.setTo(t, e), this.bg = G.makeImage(0, 0, "missions_map_box", 0, this), (i = this.bg, s = G.Input.createCustomInputClickHandler(), G.Input.initializeCustomInput(i), i.customInput.addHandler(s), s.clickSignal).add(function() {
            0 < this.widgets.length && this.onClicked.dispatch()
        }, this), this.bg.input.useHandCursor = !0, this.widgets = [], this.currentWidget = null, this.widgetGroup = this.add(game.add.group()), this.widgetGroup.position.setTo(82, 60), this.widgetPlaceholder = new G.WorldSidePanelLockedWidget, this.onClicked = new Phaser.Signal, this.timer = this.add(new G.WorldSidePanelWidgetButtonTimer(-18, 0)), this.showNextWidget(), game.time.events.loop(5e3, this.showNextWidget, this), this.notification = new G.WorldSidePanelWidgetButtonNotification(145, 5), this.add(this.notification), G.sb("addSidePanelButtonWidget").add(this.addWidget, this), G.sb("removeSidePanelButtonWidget").add(this.removeWidget, this)
    }, G.WorldSidePanelWidgetButton.prototype = Object.create(Phaser.Group.prototype), G.WorldSidePanelWidgetButton.prototype.addWidget = function(t) {
        this.widgets.push(t), t.visible = !1, 1 == this.widgets.length && this.showNextWidget()
    }, G.WorldSidePanelWidgetButton.prototype.removeWidget = function(t) {
        var e = this.widgets.indexOf(t); - 1 !== e && this.widgets.splice(e, 1)
    }, G.WorldSidePanelWidgetButton.prototype.showNextWidget = function() {
        var t = this.getNextWidget();
        this.currentWidget !== t && (this.currentWidget && this.hideWidget(this.currentWidget), this.showWidget(t), this.currentWidget = t)
    }, G.WorldSidePanelWidgetButton.prototype.getNextWidget = function() {
        if (0 == this.widgets.length) return this.widgetPlaceholder;
        var t = (this.widgets.indexOf(this.currentWidget) + 1) % this.widgets.length;
        return this.widgets[t]
    }, G.WorldSidePanelWidgetButton.prototype.hideWidget = function(t) {
        game.add.tween(t).to({
            alpha: 0
        }, 400, Phaser.Easing.Sinusoidal.Out, !0).onComplete.add(function() {
            t.parent === this.widgetGroup && (this.widgetGroup.removeChild(t), t.visible = !1)
        }, this)
    }, G.WorldSidePanelWidgetButton.prototype.showWidget = function(t) {
        this.widgetGroup.add(t), t.visible = !0, t.alpha = 0, game.add.tween(t).to({
            alpha: 1
        }, 400, Phaser.Easing.Sinusoidal.Out, !0), t.getBannerConfig ? this.timer.showBanner(t.getBannerConfig()) : this.timer.hideBanner()
    }, G.WorldSidePanelWidgetButtonNotification = function(t, e) {
        Phaser.Group.call(this, game), this.position.setTo(t, e), this.amount = 0, this.bg = G.makeImage(0, 0, "reddot", .5, this), this.amountTxt = new G.Text(1, 4, "0", {
            style: "font-white",
            fontSize: 25
        }, .5), this.add(this.amountTxt), this.alpha = 0, G.sb("widgetButtonAddNotification").add(this.addNotification, this), G.sb("widgetButtonRemoveNotification").add(this.removeNotification, this)
    }, G.WorldSidePanelWidgetButtonNotification.prototype = Object.create(Phaser.Group.prototype), G.WorldSidePanelWidgetButtonNotification.prototype.addNotification = function() {
        this.amount++, this.tweenAlpha(1), this.setTextAmount(this.amount)
    }, G.WorldSidePanelWidgetButtonNotification.prototype.removeNotification = function() {
        this.amount = Math.max(this.amount - 1, 0), 0 == this.amount && this.tweenAlpha(0), this.setTextAmount(this.amount)
    }, G.WorldSidePanelWidgetButtonNotification.prototype.tweenAlpha = function(t) {
        this.alpha !== t && (this.alphaTween && (this.alphaTween.stop(), this.alphaTween = null), this.alphaTween = game.add.tween(this).to({
            alpha: t
        }, 300, Phaser.Easing.Sinusoidal.Out, !0))
    }, G.WorldSidePanelWidgetButtonNotification.prototype.setTextAmount = function(t) {
        this.amountTxt.setText(t.toString()), this.scaleTween && (this.scaleTween.stop(), this.scaleTween = null), this.scale.setTo(1), this.scaleTween = game.add.tween(this.scale).to({
            x: 1.2,
            y: 1.2
        }, 300, Phaser.Easing.Sinusoidal.Out, !0, 0, 0, !0)
    }, G.WorldSidePanelWidgetButtonTimer = function(t, e) {
        Phaser.Group.call(this, game), this.position.setTo(t, e), this.bg = G.makeImage(0, 0, "missions_map_banner_small", 0, this), this.bgTopFade = G.makeImage(0, 0, "missions_map_banner_small", 0, this), this.bgTopFade.alpha = 0, this.text = new G.Text(100, 20, " ", {
            style: "font-white",
            fontSize: "25px"
        }, .5, 110), this.add(this.text), this.timer = new G.TextTimer(100, 20, 0, {
            style: "font-white",
            fontSize: "25px"
        }, .5), this.add(this.timer), this.alpha = 0
    }, G.WorldSidePanelWidgetButtonTimer.prototype = Object.create(Phaser.Group.prototype), G.WorldSidePanelWidgetButtonTimer.prototype.showBanner = function(t) {
        null !== this.game && (this.alpha < 1 && (G.stopTweens(this), game.add.tween(this).to({
            alpha: 1
        }, 300, Phaser.Easing.Sinusoidal.Out, !0)), t.bgSprite && this.bg.frameName !== t.bgSprite && (G.changeTexture(this.bgTopFade, this.bg.frameName), this.bgTopFade.alpha = 1, game.add.tween(this.bgTopFade).to({
            alpha: 0
        }, 300, Phaser.Easing.Sinusoidal.Out, !0), G.changeTexture(this.bg, t.bgSprite)), G.stopTweens(this.text), G.stopTweens(this.timer), t.text ? (0 < this.timer.alpha && game.add.tween(this.timer).to({
            alpha: 0
        }, 300, Phaser.Easing.Sinusoidal.Out, !0), this.text.alpha < 1 && game.add.tween(this.text).to({
            alpha: 1
        }, 300, Phaser.Easing.Sinusoidal.Out, !0), this.text.setText(t.text)) : t.timer && (0 < this.text.alpha && game.add.tween(this.text).to({
            alpha: 0
        }, 300, Phaser.Easing.Sinusoidal.Out, !0), this.timer.alpha < 1 && game.add.tween(this.timer).to({
            alpha: 1
        }, 300, Phaser.Easing.Sinusoidal.Out, !0), this.timer.setSecLeft((t.endDate - Date.now()) / 1e3), this.timer.start()))
    }, G.WorldSidePanelWidgetButtonTimer.prototype.hideBanner = function() {
        0 < this.alpha && (G.stopTweens(this), game.add.tween(this).to({
            alpha: 0
        }, 300, Phaser.Easing.Sinusoidal.Out, !0))
    }, G.DailyMission = function(t) {
        this.missionData = t, this.reward = ["coin", 65], this.status = "active", this.listenerBinding = G.sb(t.listener).addPermanent(this.onListener, this), this.listener = t.listener, this.current = 0, this.target = t.getTarget(), this.terms = !!t.terms && G.Utils.clone(t.terms), this.increaser = t.increaser, this.onCompleted = new Phaser.Signal, this.onProgress = new Phaser.Signal, this.onClaimed = new Phaser.Signal
    }, G.DailyMission.prototype.getDescription = function() {
        return G.txt(this.missionData.description)
    }, G.DailyMission.prototype.export = function() {
        return {
            id: this.missionData.id,
            status: this.status,
            current: this.current,
            target: this.target
        }
    }, G.DailyMission.prototype.import = function(t) {
        this.status = t.status, this.current = t.current, this.target = t.target
    }, G.DailyMission.prototype.getProgress = function() {
        return Math.min(this.current, this.target) / this.target
    }, G.DailyMission.prototype.getCurrentVal = function() {
        return this.current
    }, G.DailyMission.prototype.getReward = function() {
        return this.reward
    }, G.DailyMission.prototype.getTarget = function() {
        return this.target
    }, G.DailyMission.prototype.getStatus = function() {
        return this.status
    }, G.DailyMission.prototype.getButtonSettings = function() {
        return this.missionData.btnSetting
    }, G.DailyMission.prototype.getLeft = function() {
        return Math.max(0, this.target - this.current)
    }, G.DailyMission.prototype.getIcon = function() {
        return this.missionData.icon
    }, G.DailyMission.prototype.getSpecialAction = function() {
        return this.missionData.specialAction
    }, G.DailyMission.prototype.claim = function() {
        "completed" === this.status && (this.status = "claimed", this.onClaimed.dispatch(), G.dailyMissionsMgr.saveData())
    }, G.DailyMission.prototype.finish = function() {
        "active" === this.status && (this.listenerBinding.detach(), G.gameTracking.design("DailyMissionCompleted"), this.status = "completed", this.current !== this.target && (this.current = this.target, this.onProgress.dispatch(this.current)), this.onCompleted.dispatch(this.status), G.dailyMissionsMgr.saveData())
    }, G.DailyMission.prototype.checkTerms = function(t) {
        if (this.terms)
            for (var e = 0, i = this.terms.length; e < i; e++) {
                var s = this.terms[e];
                if (Array.isArray(s)) {
                    if (!this.checkArrayTerm(t[e], s)) return !1
                } else if (!this.checkTerm(t[e], s)) return !1
            }
        return !0
    }, G.DailyMission.prototype.checkArrayTerm = function(t, e) {
        for (var i = 0; i < e.length; i++)
            if (!this.checkTerm(t, e[i])) return !1;
        return !0
    }, G.DailyMission.prototype.checkTerm = function(t, e) {
        return !1 === e || ("string" == typeof e && "!" === e[0] ? t != e.slice(1) : t == e)
    }, G.DailyMission.prototype.processIncrease = function(t) {
        if ("number" == typeof this.increaser) this.current += this.increaser;
        else if (Array.isArray(this.increaser))
            for (var e = 0, i = this.increaser.length; e < i; e++) this.increaser[e] && ("number" == typeof this.increaser[e] ? this.current += this.increaser[e] : this.current += t[e]);
        this.onProgress.dispatch(this.current)
    }, G.DailyMission.prototype.increaseCurrent = function(t) {
        this.current = game.math.clamp(this.current + t, 0, this.target), this.onProgress.dispatch(this.current), this.current >= this.target && this.finish(), G.dailyMissionsMgr.saveData()
    }, G.DailyMission.prototype.destroy = function() {
        this.listenerBinding.detach()
    }, G.DailyMission.prototype.onListener = function() {
        "active" === this.status && (this.checkTerms(arguments) && (this.processIncrease(arguments), this.missionData.afterIncreaseCallback && this.missionData.afterIncreaseCallback.apply(this, arguments)), this.current >= this.target && this.finish())
    }, G.DAILYMISSIONS = {
        missions: [{
            id: "spinWheel",
            SPECIAL: !0,
            icon: "new_wheel_menu",
            iconSize: {
                width: 60,
                height: 60
            },
            description: "Spin the Wheel",
            listener: "wheelSpin",
            increaser: 1,
            btnSetting: {
                sprite: "btn_gm_green",
                label: "Spin"
            },
            widget: [{
                type: "txt",
                txt: "Spin",
                props: {
                    y: -8
                }
            }, {
                type: "img",
                sprite: "new_wheel_menu",
                props: {
                    y: 27
                }
            }],
            getTarget: function() {
                return 1
            },
            filterFunction: function() {
                return !0
            },
            specialAction: function() {
                (game.incentivised || G.saveState.data.freeSpin) && G.sb("pushWindow").dispatch("daily2")
            }
        }, {
            id: "dailyChallenge",
            SPECIAL: !0,
            icon: "score_icon",
            description: "Play Daily Challenge",
            listener: "onDailyChallengeStart",
            increaser: 1,
            btnSetting: {
                sprite: "btn_gm_green",
                label: "Play"
            },
            widget: [{
                type: "txt",
                txt: "Play",
                props: {
                    y: -8
                }
            }, {
                type: "img",
                sprite: "score_icon",
                props: {
                    y: 27
                }
            }],
            getTarget: function() {
                return 1
            },
            filterFunction: function() {
                return G.saveState.getLastPassedLevelNr() >= G.json.settings.featuresUnlock.dailyChallenge
            },
            specialAction: function() {
                G.sb("pushWindow").dispatch(["dailyChallenge", G.saveState.getDailyChallengeLevel()])
            }
        }, {
            id: "collectCoinsChest",
            icon: "gameplay_chest_icon",
            description: "Collect Coins",
            listener: "coinsFromGameplayChest",
            increaser: [!0],
            adIncreaser: 3,
            widget: [{
                type: "txt",
                txt: "Collect",
                props: {
                    y: -8
                }
            }, {
                type: "img",
                sprite: "gameplay_chest_icon",
                props: {
                    y: 27
                }
            }],
            getTarget: function() {
                return 15
            },
            filterFunction: function() {
                return !0
            }
        }, {
            id: "collectCoinsl",
            icon: "coin_2",
            description: "Collect Coins",
            listener: "onCoinsIncrease",
            increaser: [!0],
            widget: [{
                type: "txt",
                txt: "Collect",
                props: {
                    y: -8
                }
            }, {
                type: "img",
                sprite: "coin_2",
                props: {
                    y: 27
                }
            }],
            getTarget: function() {
                return 500
            },
            filterFunction: function() {
                return !0
            }
        }, {
            id: "collectRed",
            icon: "candy_1",
            description: "Collect Cherry Pies",
            listener: "onCollectableRemove",
            increaser: 1,
            terms: ["1"],
            widget: [{
                type: "txt",
                txt: "Collect",
                props: {
                    y: -8
                }
            }, {
                type: "img",
                sprite: "candy_1",
                props: {
                    y: 27
                }
            }],
            getTarget: function() {
                return 65
            },
            filterFunction: function() {
                return !0
            }
        }, {
            id: "collectBlue",
            icon: "candy_2",
            description: "Collect Blue Doughnuts",
            listener: "onCollectableRemove",
            increaser: 1,
            terms: ["2"],
            widget: [{
                type: "txt",
                txt: "Collect",
                props: {
                    y: -8
                }
            }, {
                type: "img",
                sprite: "candy_2",
                props: {
                    y: 27
                }
            }],
            getTarget: function() {
                return 65
            },
            filterFunction: function() {
                return !0
            }
        }, {
            id: "collectWhite",
            icon: "candy_3",
            description: "Collect Cheesecakes",
            listener: "onCollectableRemove",
            increaser: 1,
            terms: ["3"],
            widget: [{
                type: "txt",
                txt: "Collect",
                props: {
                    y: -8
                }
            }, {
                type: "img",
                sprite: "candy_3",
                props: {
                    y: 27
                }
            }],
            getTarget: function() {
                return 65
            },
            filterFunction: function() {
                return !0
            }
        }, {
            id: "collectPink",
            icon: "candy_4",
            description: "Collect Pink Pies",
            listener: "onCollectableRemove",
            increaser: 1,
            terms: ["4"],
            widget: [{
                type: "txt",
                txt: "Collect",
                props: {
                    y: -8
                }
            }, {
                type: "img",
                sprite: "candy_4",
                props: {
                    y: 27
                }
            }],
            getTarget: function() {
                return 65
            },
            filterFunction: function() {
                return !0
            }
        }, {
            id: "collectGreen",
            icon: "candy_5",
            description: "Collect Green Cookies",
            listener: "onCollectableRemove",
            increaser: 1,
            terms: ["5"],
            widget: [{
                type: "txt",
                txt: "Collect",
                props: {
                    y: -8
                }
            }, {
                type: "img",
                sprite: "candy_5",
                props: {
                    y: 27
                }
            }],
            getTarget: function() {
                return 65
            },
            filterFunction: function() {
                return !0
            }
        }, {
            id: "collectYellow",
            icon: "candy_6",
            description: "Collect Star Treats",
            listener: "onCollectableRemove",
            increaser: 1,
            terms: ["6"],
            widget: [{
                type: "txt",
                txt: "Collect",
                props: {
                    y: -8
                }
            }, {
                type: "img",
                sprite: "candy_6",
                props: {
                    y: 27
                }
            }],
            getTarget: function() {
                return 65
            },
            filterFunction: function() {
                return !0
            }
        }, {
            id: "collectStars",
            icon: "map_star_1",
            description: "Collect Stars",
            listener: "onLevelFinished",
            increaser: [!1, !0],
            adIncreaser: 1,
            terms: [
                []
            ],
            widget: [{
                type: "txt",
                txt: "Collect",
                props: {
                    y: -8
                }
            }, {
                type: "img",
                sprite: "map_star_1",
                props: {
                    y: 27
                }
            }],
            getTarget: function() {
                return 9
            },
            filterFunction: function() {
                return !0
            },
            afterIncreaseCallback: function(t) {
                this.terms || (this.terms = [
                    []
                ]), this.terms[0].push("!" + t)
            }
        }, {
            id: "collectWaffles",
            icon: "dirt_1",
            description: "Collect Waffles",
            listener: "onCollectableRemove",
            increaser: 1,
            terms: ["dirt"],
            widget: [{
                type: "txt",
                txt: "Collect",
                props: {
                    y: -8
                }
            }, {
                type: "img",
                sprite: "dirt_1",
                props: {
                    y: 27
                }
            }],
            getTarget: function() {
                return 75
            },
            filterFunction: function() {
                return G.saveState.getLastPassedLevelNr() > G.DAILYMISSIONS.findLevelIndexWithToken("dirt")
            }
        }, {
            id: "collectJellyWaffles",
            icon: "dirt_s_3",
            iconSize: {
                width: 50,
                height: 50
            },
            description: "Collect Jelly Waffles",
            listener: "onCollectableRemove",
            increaser: 1,
            terms: ["dirtS"],
            widget: [{
                type: "txt",
                txt: "Collect",
                props: {
                    y: -8
                }
            }, {
                type: "img",
                sprite: "dirt_s_3",
                props: {
                    y: 27
                }
            }],
            getTarget: function() {
                return 65
            },
            filterFunction: function() {
                return G.saveState.getLastPassedLevelNr() > G.DAILYMISSIONS.findLevelIndexWithToken("dS")
            }
        }, {
            id: "collectIce",
            icon: "ice_front",
            description: "Break Ice",
            listener: "onCollectableRemove",
            increaser: 1,
            terms: ["ice"],
            widget: [{
                type: "txt",
                txt: "Collect",
                props: {
                    y: -8
                }
            }, {
                type: "img",
                sprite: "ice_front",
                props: {
                    y: 27
                }
            }],
            getTarget: function() {
                return 65
            },
            filterFunction: function() {
                return G.saveState.getLastPassedLevelNr() > G.DAILYMISSIONS.findLevelIndexWithToken("ice")
            }
        }, {
            id: "collectRopes",
            icon: "blocker_chain_wrapped",
            description: "Break Ropes",
            listener: "onCollectableRemove",
            increaser: 1,
            terms: ["chain"],
            widget: [{
                type: "txt",
                txt: "Collect",
                props: {
                    y: -8
                }
            }, {
                type: "img",
                sprite: "blocker_chain_wrapped",
                props: {
                    y: 27
                }
            }],
            getTarget: function() {
                return 50
            },
            filterFunction: function() {
                return G.saveState.getLastPassedLevelNr() > G.DAILYMISSIONS.findLevelIndexWithToken(":W")
            }
        }, {
            id: "collectsRock",
            icon: "concrete_3",
            description: "Destroy Rocks",
            listener: "onCollectableRemove",
            increaser: 1,
            adIncreaser: 5,
            terms: ["concrete"],
            widget: [{
                type: "txt",
                txt: "Collect",
                props: {
                    y: -8
                }
            }, {
                type: "img",
                sprite: "concrete_3",
                props: {
                    y: 27
                }
            }],
            getTarget: function() {
                return 45
            },
            filterFunction: function() {
                return G.saveState.getLastPassedLevelNr() > G.DAILYMISSIONS.findLevelIndexWithToken("cn")
            }
        }],
        getSpecialMissions: function(e) {
            return e = e || [], this.missions.filter(function(t) {
                return t.SPECIAL && t.filterFunction() && -1 === e.indexOf(t.id)
            })
        },
        getRegularMissions: function(e) {
            return e = e || [], this.missions.filter(function(t) {
                return !t.SPECIAL && t.filterFunction() && -1 === e.indexOf(t.id)
            })
        },
        getMissionById: function(e) {
            return this.missions.find(function(t) {
                return t.id === e
            })
        },
        findLevelIndexWithToken: function(e) {
            return G.json.levels.indexOf(G.json.levels.find(function(t) {
                return -1 !== JSON.stringify(t.levelData).indexOf(e)
            }))
        }
    }, G.dailyMissionsMgr = {
        data: null,
        midnightHoursOffset: 9,
        goals: [],
        isFeatureUnlocked: function() {
            var t = G.saveState,
                e = G.json.settings;
            return t.getLastPassedLevelNr() >= e.featuresUnlock.globalGoals
        },
        dayCheck: function() {
            if (this.initialized) G.saveState.save();
            else if (this.isFeatureUnlocked()) {
                G.gameTracking.FTUEDesign("FTUX_DailyMissionsUnlock");
                var t = G.saveState.data.dailyMissions;
                this.checkIfNewDay() || !t ? this.initNewDay(t) : this.loadDay(t), this.initialized = !0
            }
        },
        initNewDay: function(t) {
            this.goals.forEach(function(t) {
                t.destroy()
            }), this.goals = [], this.mainRewardClaimed = !1, G.saveState.data.dailyMissionDate = Date.now();
            var i = [];
            t && (i = t.missions.filter(function(t) {
                var e = G.DAILYMISSIONS.getMissionById(t.id);
                return !!e && (!e.SPECIAL && 0 < t.current && "active" === t.status)
            }));
            var e = this.getNumberOfGoals(),
                s = Phaser.ArrayUtils.shuffle(G.DAILYMISSIONS.getSpecialMissions()).slice(0, e.special),
                a = Phaser.ArrayUtils.shuffle(G.DAILYMISSIONS.getRegularMissions().filter(function(e) {
                    return !i.find(function(t) {
                        return t.id === e.id
                    })
                })).slice(0, Math.max(0, e.regular - i.length));
            s.concat(a).forEach(function(t) {
                this.goals.push(new G.DailyMission(t))
            }, this), i.forEach(function(t) {
                var e = G.DAILYMISSIONS.getMissionById(t.id),
                    i = new G.DailyMission(e);
                i.import(t), this.goals.push(i)
            }, this), this.saveData()
        },
        loadDay: function(t) {
            t.missions.forEach(function(t) {
                var e = G.DAILYMISSIONS.getMissionById(t.id);
                if (e) {
                    var i = new G.DailyMission(e);
                    i.import(t), this.goals.push(i)
                } else this.goals.push(new G.DailyMission(Phaser.ArrayUtils.shuffle(G.DAILYMISSIONS.getRegularMissions())[0]))
            }, this), this.mainRewardClaimed = t.mainRewardClaimed
        },
        claimMainReward: function() {
            console.log("CLAIM MAIN REWARD"), this.mainRewardClaimed = !0, G.gameTracking.FTUEDesign("FTUX_FirstDailyRewardMade"), G.gameTracking.design("DailyMissionsCompleted"), G.sb("dailyMissionMgr-mainRewardClaimed").dispatch(), this.saveData()
        },
        saveData: function() {
            G.saveState.data.dailyMissions = {
                mainRewardClaimed: this.mainRewardClaimed,
                missions: this.goals.map(function(t) {
                    return t.export()
                })
            }, G.saveState.save()
        },
        checkIfNewDay: function() {
            var t = G.saveState.data.dailyMissionDate || 0,
                e = new Date,
                i = new Date(t);
            return e.getTime() > i.getTime() && e.toDateString() !== i.toDateString() && e.getHours() > this.midnightHoursOffset
        },
        getSecToNextDaily: function() {
            var t = new Date;
            return t.setHours(0), t.setMinutes(0), t.setSeconds(0), t.setMilliseconds(0), Math.floor((t.getTime() + 864e5 - Date.now()) / 1e3) + 3600 * this.midnightHoursOffset
        },
        getNumberOfGoals: function() {
            var t = {
                    special: 3,
                    regular: 2
                },
                e = G.saveState.getLastPassedLevelNr();
            return 81 <= e ? t.regular = 4 : 41 <= e && (t.regular = 3), t
        },
        getProgress: function() {
            return {
                finished: this.goals.reduce(function(t, e) {
                    return t + ("claimed" === e.status ? 1 : 0)
                }, 0),
                goal: this.goals.length,
                mainRewardClaimed: this.mainRewardClaimed
            }
        },
        getCollectionIcons: function() {
            var t = Math.floor(Date.now() / 864e5) + 3;
            return {
                icon: ["cupcake_purple", "lolly_purple", "donut_purple", "icecream_purple"][t % 4],
                hole: ["cupcake_shape", "lolly_shape", "donut_shape", "icecream_shape"][t % 4]
            }
        },
        getGoals: function() {
            return this.goals
        }
    }, G.SPDailyMissionContent = function() {
        Phaser.Group.call(this, game), this.state = game.state.getCurrentState();
        var t = G.WorldSidePanel.Ribbon,
            e = G.SPDM_CompleteAllPanel,
            i = G.SPDM_CompletedSeparator;
        this.ribbon = new t(0, 15, {
            ribbon: "gold_wheel_ribbon_missions",
            text: G.txt("Daily Missions")
        }), this.add(this.ribbon), this.completeAllPanel = new e(0, 200, this), this.add(this.completeAllPanel), this.activeGoals = [], this.completedSeparator = new i(0, 450), this.add(this.completedSeparator), this.claimedGoals = [], this.widgetCollect = null, this.widgetNext = null, G.sb("dailyMissionMgr-mainRewardClaived").add(this.widgetCheck, this), G.sb("onWorldSidePanelOpen").add(function() {
            this.moveToProperPlacements(!0)
        }, this), G.sb("worldSidePanelOnWindowHide").add(function() {
            this.moveToProperPlacements(!0)
        }, this), this.init()
    }, G.SPDailyMissionContent.prototype = Object.create(Phaser.Group.prototype), G.SPDailyMissionContent.prototype.init = function() {
        G.dailyMissionsMgr.getGoals().forEach(function(t) {
            var e = this.add(new G.SPDM_MissionPanel(t));
            "claimed" === t.status ? this.claimedGoals.push(e) : (this.activeGoals.push(e), e.onClaimed.add(this.moveToClaimed, this), e.onCompleted.add(this.widgetCheck, this))
        }, this), this.moveToProperPlacements(!0)
    }, G.SPDailyMissionContent.prototype.getContentHeight = function() {
        return 200 * (this.activeGoals.length + this.claimedGoals.length + 2)
    }, G.SPDailyMissionContent.prototype.moveToClaimed = function(t) {
        console.log("!! moveToClaimed"), this.activeGoals.splice(this.activeGoals.indexOf(t), 1), this.claimedGoals.unshift(t), t.immediateY = !0, game.add.tween(t).to({
            x: -500
        }, 300, Phaser.Easing.Sinusoidal.Out, 1500, !0).onComplete.add(function() {
            game.add.tween(t).to({
                x: 0
            }, 300, Phaser.Easing.Sinusoidal.Out, !0, 500).onComplete.add(function() {
                t.immediateY = !1
            }, this), this.moveToProperPlacements()
        }, this);
        var e = this.completeAllPanel.getEmptyCupcake();
        e.aimed = !0;
        var i = this.state.uiTargetParticles.init(game.world.bounds.x + t.cupcake.worldPosition.x, t.cupcake.worldPosition.y, G.dailyMissionsMgr.getCollectionIcons().icon, e);
        i.onStart.add(function() {
            game.add.tween(i.scale).from({
                x: 1.8,
                y: 1.8
            }, 500, Phaser.Easing.Sinusoidal.Out, !0)
        }), i.onFinish.add(function() {
            this.completeAllPanel.fillCupcake(e), game.sfx.line.play()
        }, this), i.start()
    }, G.SPDailyMissionContent.prototype.widgetCheck = function() {
        this.activeGoals.find(function(t) {
            return "active" === t.mission.status
        }) || (G.dailyMissionsMgr.getProgress().mainRewardClaimed ? (this.widgetCollect && (G.sb("removeSidePanelButtonWidget").dispatch(this.widgetCollect), this.widgetCollect = null), this.widgetNext || (this.widgetNext = this.addWidgetNext(), G.sb("addSidePanelButtonWidget").dispatch(this.widgetNext))) : this.widgetCollect || (this.widgetCollect = this.addWidgetCollect(), G.sb("addSidePanelButtonWidget").dispatch(this.widgetCollect)))
    }, G.SPDailyMissionContent.prototype.addWidgetNext = function() {
        var t = game.make.group();
        return t.bannerConfig = {
            bgSprite: "missions_map_banner_yellow_small",
            text: G.txt("New Daily")
        }, t.getBannerConfig = function() {
            return this.bannerConfig
        }, t.img = function(t, e, i) {
            var s = game.make.group(t),
                a = (n = s, G.makeImage(0, 0, "Clock_base", [31 / 60, 29 / 63], n));
            r(a, "pointer1"), r(a, "pointer2");
            var n;
            return s.centerX = e, s.centerY = i, o = a, G.Animations.getClockPointersAnimation().animate(game, o), s;
            var o;

            function r(t, e) {
                var i = G.makeImage(0, 0, "Clock_pointer", [3 / 7, 19 / 22], t);
                return i.name = e, i
            }
        }(t, 0, 5), t.img.scale.setTo(.7), t.timer = t.add(new G.TextTimer(0, 40, 0, {
            style: "font-blue",
            fontSize: 25
        }, .5, 110)), t.timer.start(G.dailyMissionsMgr.getSecToNextDaily()), t
    }, G.SPDailyMissionContent.prototype.addWidgetCollect = function() {
        var t = game.make.group();
        return t.bannerConfig = {
            bgSprite: "missions_map_banner_yellow_small",
            text: G.txt("Daily")
        }, t.getBannerConfig = function() {
            return this.bannerConfig
        }, t.txt = t.add(new G.Text(0, 14, G.txt("Claim Reward"), {
            style: "font-blue",
            fontSize: 30,
            lineSpacing: -15
        }, .5, 110, 200, !0, "center")), t
    }, G.SPDailyMissionContent.prototype.moveToProperPlacements = function(e) {
        this.activeGoals.forEach(function(t, e) {
            t.targetY = 370 + 160 * e
        }), this.completedSeparator.targetY = 370 + 160 * (this.activeGoals.length - 1) + 160, this.completedSeparator.visible = 0 < this.claimedGoals.length, this.claimedGoals.forEach(function(t, e) {
            t.targetY = this.completedSeparator.targetY + 112 + 160 * e * .8
        }, this), this.activeGoals.concat([this.completedSeparator], this.claimedGoals).forEach(function(t) {
            if (t.tweenY && t.tweenY.stop(), e || t.immediateY) t.y = t.targetY;
            else {
                if (t.y === t.targetY) return;
                this.bringToTop(t), t.tweenY = game.add.tween(t).to({
                    y: t.targetY
                }, 1e3, Phaser.Easing.Sinusoidal.InOut, !0), t.doScaleOnMove && (t.doScaleOnMove = !1, game.add.tween(t.scale).to({
                    x: 1.2,
                    y: 1.2
                }, 500, Phaser.Easing.Sinusoidal.InOut, !0, 0, 0, !0))
            }
        }, this), this.widgetCheck()
    }, G.SPDM_CompleteAllPanel = function(t, e, i) {
        Phaser.Group.call(this, game), this.position.setTo(t, e), this.bindings = [], this.missionContent = i, this.onDestroy.add(function() {
            this.bindings.forEach(function(t) {
                t.detach()
            })
        }, this), this.bg = G.makeImage(0, 0, "Missions_completed_box", .5, this), this.completeAllTxt = new G.Text(0, -38, G.txt("Complete all Daily Missions"), {
            style: "font-white",
            fontSize: 25
        }, .5, 310), this.add(this.completeAllTxt), this.arrow = G.makeImage(80, 7, "arrow_right", .5, this), this.giftIcon = G.makeImage(130, 0, "prezent", .5, this), this.giftIcon.scale.setTo(.335, .365), game.add.tween(this.giftIcon.scale).to({
            x: .365,
            y: .335
        }, 800, Phaser.Easing.Sinusoidal.InOut, !0, 0, -1, !0), this.progressTxt = new G.Text(-70, 42, " ", {
            style: "font-white",
            fontSize: 20
        }, .5, 170), this.add(this.progressTxt), this.claimBtn = this.add(new G.Button(90, 70, "btn_gm_gray", this.onClaimBtnPressed, this)), this.claimBtn.label = new G.Text(0, 0, G.txt("Claim"), {
            style: "font-white",
            fontSize: 25
        }, .5, 130), this.claimBtn.addTerm(function() {
            var t = G.dailyMissionsMgr.getProgress();
            return t.finished === t.goal && !t.mainRewardClaimed
        }), this.claimBtn.addChild(this.claimBtn.label), this.checkMark = G.makeImage(170, 30, "task_complete", .5, this), this.checkMark.scale.setTo(0), this.cupcakes = [], this.initCupcakes(-145, 3, G.dailyMissionsMgr.getProgress()), this.checkWin(), G.dailyMissionsMgr.getProgress().mainRewardClaimed && (this.claimBtn.inputEnabled = !1, this.claimBtn.visible = !1, this.checkMark.scale.setTo(1), this.y = this.y + 50, this.addTimer())
    }, G.SPDM_CompleteAllPanel.prototype = Object.create(Phaser.Group.prototype), G.SPDM_CompleteAllPanel.prototype.addTimer = function() {
        this.timerGroup = game.add.group(), this.timerGroup.y = -120, this.add(this.timerGroup), this.timerGroup.newMissionsTxt = new G.Text(0, 0, G.txt("New Missions in:"), {
            style: "font-grey",
            fontSize: 27
        }, .5, 300), this.timerGroup.add(this.timerGroup.newMissionsTxt), this.timerGroup.timer = new G.TextTimer(0, 30, 0, {
            style: "font-grey",
            fontSize: 27
        }, .5, 300), this.timerGroup.timer.start(G.dailyMissionsMgr.getSecToNextDaily()), this.timerGroup.add(this.timerGroup.timer), game.add.tween(this.timerGroup).from({
            alpha: 0
        }, 300, Phaser.Easing.Sinusoidal.Out, !0, 200)
    }, G.SPDM_CompleteAllPanel.prototype.initCupcakes = function(t, e, i) {
        for (var s = (225 - 34 * i.goal) / Math.max(1, i.goal - 1), a = Math.min(70, 34 + s), n = 0; n < i.goal; n++) this.cupcakes[n] = new G.SPDM_CupcakeIcon(t + n * a, e, i.finished > n);
        this.progressFinished = i.finished, this.progressGoal = i.goal, this.addMultiple(this.cupcakes);
        var o = G.txt("%CURRENT%/%TARGET% Completed").replace("%CURRENT%", this.progressFinished).replace("%TARGET%", this.progressGoal);
        this.progressTxt.setText(o)
    }, G.SPDM_CompleteAllPanel.prototype.getEmptyCupcake = function() {
        return this.cupcakes.find(function(t) {
            return t.isEmpty() && !t.aimed
        })
    }, G.SPDM_CompleteAllPanel.prototype.fillCupcake = function(t) {
        t.fill(), this.progressFinished++;
        var e = G.txt("%CURRENT%/%TARGET% Completed").replace("%CURRENT%", this.progressFinished).replace("%TARGET%", this.progressGoal);
        this.progressTxt.setText(e), game.tweens.removeFrom(this.progressTxt.scale), this.progressTxt.scale.setTo(1), game.add.tween(this.progressTxt.scale).to({
            x: 1.2,
            y: 1.2
        }, 300, Phaser.Easing.Sinusoidal.InOut, !0, 0, 0, !0), this.checkWin()
    }, G.SPDM_CompleteAllPanel.prototype.checkWin = function(t) {
        var e = G.dailyMissionsMgr.getProgress();
        e.finished === e.goal && (G.gameTracking.FTUEDesign("FTUX_FirstDailyMissionMade"), this.claimBtn.changeTexture("btn_chest_gate"), this.claimBtn.scale.setTo(.96, 1.04), game.add.tween(this.claimBtn.scale).to({
            x: 1.04,
            y: .96
        }, 800, Phaser.Easing.Sinusoidal.InOut, !0, 0, -1, !0))
    }, G.SPDM_CompleteAllPanel.prototype.onClaimBtnPressed = function() {
        G.dailyMissionsMgr.claimMainReward(), G.sb("pushWindow").dispatch("dailyMissionMainReward"), this.claimBtn.inputEnabled = !1, this.missionContent.widgetCheck(), G.sb("toggleWorldSidePanel").dispatch(), game.sfx.line.play(), game.sfx.match_5.play(), game.add.tween(this.claimBtn).to({
            alpha: 0
        }, 300, Phaser.Easing.Sinusoidal.Out, !0), game.add.tween(this.checkMark.scale).to({
            x: 1,
            y: 1
        }, 300, Phaser.Easing.Elastic.Out, !0), game.add.tween(this).to({
            y: this.y + 50
        }, 300, Phaser.Easing.Sinusoidal.Out, !0), this.addTimer()
    }, G.SPDM_CompletedSeparator = function(t, e) {
        G.Image.call(this, t, e, "completed_missions_area", .5), this.text = this.add(new G.Text(0, 0, "ja" === G.lang ? G.txt("Completed Missions") : "Missions Complétées", {
            style: "font-white",
            fontSize: 35
        }, .5, 310))
    }, G.SPDM_CompletedSeparator.prototype = Object.create(G.Image.prototype), G.SPDM_CupcakeIcon = function(t, e, i) {
        this.dailyIcons = G.dailyMissionsMgr.getCollectionIcons(), G.Image.call(this, t, e, i ? this.dailyIcons.icon : this.dailyIcons.hole, .5), this.overlay = G.makeImage(0, 0, this.dailyIcons.icon, .5, this), this.overlay.visible = !1, this.filled = i
    }, G.SPDM_CupcakeIcon.prototype = Object.create(G.Image.prototype), G.SPDM_CupcakeIcon.prototype.isEmpty = function() {
        return !this.filled
    }, G.SPDM_CupcakeIcon.prototype.fill = function() {
        this.filled = !0, this.changeTexture(this.dailyIcons.icon), this.overlay.visible = !0, this.overlay.alpha = 0, this.overlay.blendMode = 1, game.add.tween(this.overlay).to({
            alpha: 1
        }, 200, Phaser.Easing.Sinusoidal.InOut, !0, 0, 0, !0)
    }, G.SPDM_MissionPanel = function(t) {
        this.state = game.state.getCurrentState();
        var e = {
            value: (this.mission = t).getCurrentVal(),
            target: t.getTarget(),
            valueTarget: t.getCurrentVal(),
            progressBar: {
                y: -10
            }
        };
        G.PFEventPanel.call(this, e), this.bg.width = 350, this.bg.inputEnabled = !1, this.icon = this.addIcon(-180, 0, t), this.desc = this.addDescription(0, -25, t), this.reward = this.addReward(-120, 30, t), this.checkMark = G.makeImage(149, -10, "task_complete", .5, this), this.checkMark.scale.setTo(0), this.cupcake = G.makeImage(154, -6, G.dailyMissionsMgr.getCollectionIcons().icon, .5, this), this.cupcake.scale.setTo(1.37), this.actionBtn = new G.SPDM_MissionPanelBtn(90, 60, t), this.add(this.actionBtn), "completed" !== t.status && "claimed" !== t.status || this.bg.changeTexture("score_popup_green"), "completed" === t.status && G.sb("widgetButtonAddNotification").dispatch(), "claimed" === t.status && (this.checkMark.scale.setTo(1.1), this.reward.alpha = 0, this.cupcake.visible = !1), this.bindings = [t.onCompleted.add(this.changeToCompleted, this), t.onClaimed.add(this.claimReward, this), t.onProgress.add(function(t) {
            this.valueObj.valueTarget = t, game.time.events.add(100, this.showProgress, this)
        }, this)], this.onClaimed = new Phaser.Signal, this.onCompleted = new Phaser.Signal, this.onDestroy.add(function() {
            this.bindings.forEach(function(t) {
                t.detach()
            })
        }, this), this.initWidget()
    }, G.SPDM_MissionPanel.prototype = Object.create(G.PFEventPanel.prototype), G.SPDM_MissionPanel.prototype.addIcon = function(t, e, i) {
        var s = null;
        return i.getIcon() && ((s = G.makeImage(t, e, i.getIcon(), [0, .5], this)).width = s.height = 60, s.scale.setTo(Math.min(s.scale.x, s.scale.y)), this.add(s), this.mission.missionData.iconSize && (s.width = this.mission.missionData.iconSize.width, s.height = this.mission.missionData.iconSize.height)), s
    }, G.SPDM_MissionPanel.prototype.addDescription = function(t, e, i) {
        var s = null;
        return i.getDescription() && (s = this.add(new G.Text(t, e, i.getDescription(), {
            style: "font-white",
            fontSize: 25
        }, .5, 300))), s
    }, G.SPDM_MissionPanel.prototype.addReward = function(t, e, i) {
        var s = null;
        return i.getReward() && (s = this.add(new G.LabelTextT(G.gift.getLabelString(i.getReward()), t, e, {
            style: "font-white",
            fontSize: 25
        }, [0, .5], 150))), s
    }, G.SPDM_MissionPanel.prototype.changeToCompleted = function() {
        this.onCompleted.dispatch(), G.sb("widgetButtonAddNotification").dispatch(), this.actionBtn.refresh(), this.bg.changeTexture("score_popup_green"), this.widget && G.sb("removeSidePanelButtonWidget").dispatch(this.widget)
    }, G.SPDM_MissionPanel.prototype.claimReward = function() {
        if (G.sb("widgetButtonRemoveNotification").dispatch(), console.log("!! claim reward"), game.sfx.xylophone_positive_12.play(), this.bg.changeTexture("score_popup_green"), this.actionBtn.inputEnabled = !1, "coin" === this.mission.reward[0]) {
            for (var t = 0; t < 8; t++) this.state.uiFxLayer.initEffect(game.world.bounds.x + this.reward.worldPosition.x + .5 * this.reward.width, this.reward.worldPosition.y, "burstingCoin");
            G.gift.applyGift(this.mission.reward), G.gameTracking.source("Coins", "Reward", "DailyMission", this.mission.reward[1])
        } else G.gift.applyGift(this.mission.reward);
        game.add.tween(this.reward).to({
            alpha: 0
        }, 500, Phaser.Easing.Sinusoidal.Out, !0), game.add.tween(this.cupcake.scale).to({
            x: 1.8,
            y: 1.8
        }, 600, Phaser.Easing.Sinusoidal.Out, !0).onComplete.add(function() {
            game.add.tween(this.checkMark.scale).to({
                x: 1.1,
                y: 1.1
            }, 500, Phaser.Easing.Elastic.Out, !0, 400), this.cupcake.visible = !1, this.onClaimed.dispatch(this)
        }, this)
    }, G.SPDM_MissionPanel.prototype._testBurst = function() {
        for (var t = 0; t < 8; t++) this.state.uiFxLayer.initEffect(game.world.bounds.x + this.reward.worldPosition.x + .5 * this.reward.width, this.reward.worldPosition.y, "burstingCoin")
    }, G.SPDM_MissionPanel.prototype.initWidget = function() {
        if ("active" === this.mission.status && this.mission.missionData.widget) {
            var i = game.make.group();
            this.mission.missionData.widget.forEach(function(t) {
                var e;
                "img" === t.type ? ((e = G.makeImage(0, 0, t.sprite, .5, i)).width = e.height = 55, e.scale.setTo(Math.min(e.scale.x, e.scale.y))) : "txt" === t.type && (e = i.add(new G.Text(0, 0, G.txt(t.txt), t.style || {
                    style: "font-blue",
                    fontSize: 25,
                    lineSpacing: -10
                }, .5, 110, 200, t.multiline, "center"))), t.props && Object.assign(e, t.props)
            }), i.getBannerConfig = function() {
                return this.bannerConfig
            }, i.bannerConfig = {
                bgSprite: "missions_map_banner_yellow_small",
                text: G.txt("Daily")
            }, this.widget = i, G.sb("addSidePanelButtonWidget").dispatch(this.widget)
        }
    }, G.SPDM_MissionPanelBtn = function(t, e, i) {
        this.onTriggered = new Phaser.Signal, G.Button.call(this, t, e, null, function() {
            this.onTriggered.dispatch()
        }, this), this.addedNotification = !1, this.mission = i, this.btnAction = null, this.label = new G.Text(-6, 0, " ", {
            style: "font-white",
            fontSize: 25
        }, [0, .5], 130), this.addChild(this.label), this.onClaimed = new Phaser.Signal, this.onFinished = new Phaser.Signal, this.refresh()
    }, G.SPDM_MissionPanelBtn.prototype = Object.create(G.Button.prototype), G.SPDM_MissionPanelBtn.prototype.refresh = function() {
        switch (this.onTriggered.removeAll(), this.priceLabel && this.priceLabel.destroy(), this.label.visible = !0, this.label.userMaxWidth = 130, this.visible = !0, this.mission.status) {
            case "active":
                this.setAsActive();
                break;
            case "completed":
                this.setAsClaim();
                break;
            case "claimed":
                this.inputEnabled = !1, this.visible = !1
        }
    }, G.SPDM_MissionPanelBtn.prototype.setAsClaim = function() {
        this.changeTexture("btn_chest_gate"), this.label.setText(G.txt("Claim")), this.label.x = 0, this.label.anchor.x = .5, this.IMMEDIATE = !0, this.scale.setTo(.96, 1.04), game.add.tween(this.scale).to({
            x: 1.04,
            y: .96
        }, 800, Phaser.Easing.Sinusoidal.InOut, !0, 0, -1, !0), this.onTriggered.add(function() {
            this.mission.claim(), this.inputEnabled = !1, G.stopTweens(this), game.add.tween(this.scale).to({
                x: 0,
                y: 0
            }, 300, Phaser.Easing.Sinusoidal.Out, !0), this.onClaimed.dispatch()
        }, this)
    }, G.SPDM_MissionPanelBtn.prototype.setAsActive = function() {
        var t = this.mission.getSpecialAction();
        t ? this.setAsSpecial(t) : game.incentivised ? this.setAsAdSkip() : this.visible = !1
    }, G.SPDM_MissionPanelBtn.prototype.setAsAdSkip = function() {
        this.changeTexture("btn_gm_skip_small"), this.label.userMaxWidth = 80;
        var t = this.mission.missionData.adIncreaser || Math.min(this.mission.target, 10);
        this.label.setText("+" + t), this.onTriggered.add(function() {
            G.gameTracking.design("VideoAdWatchMiniMission"), G.platform.showAd(!0, function() {
                G.gameTracking.design("VideoAdWatchCompleteMission"), this.onAdSuccess(t)
            }, function() {
                new G.NoMoreAds
            }, this)
        }, this)
    }, G.SPDM_MissionPanelBtn.prototype.setAsSpecial = function() {
        var t = this.mission.getButtonSettings();
        this.changeTexture(t.sprite), this.label.x = 0, this.label.anchor.x = .5, this.label.setText(G.txt(t.label)), this.onTriggered.add(function() {
            this.mission.getSpecialAction().call(this)
        }, this)
    }, G.SPDM_MissionPanelBtn.prototype.onAdSuccess = function(t) {
        this.mission.increaseCurrent(t)
    }, G.TreasureHunt = G.TreasureHunt || {}, G.TreasureHunt.GameplayGemCounter = function(t, e) {
        Phaser.Group.call(this, game), this.fixedToCamera = !0, this.mainGroup = game.add.group(this), this.mainGroup.name = "mainGroup", this.mainGroup.x = 300, this.shine = G.makeImage(-50, 0, "popup_lighht", .5, this.mainGroup), this.shine.blendMode = 1, this.shine.name = "shine", this.shine.alpha = 0, G.Animations.getShineAnimation().animate(this.game, this.shine), this.bg = G.makeImage(0, 0, "ingame_counter", [1, .5], this.mainGroup), this.bg.scale.setTo(1.15), this.chest = G.makeImage(-36, -7, "Chest_half_full", .5, this.mainGroup), this.chest.scale.setTo(.46), this.amount = t || 0, this.maxAmount = e || 50, this.amountTxt = this.mainGroup.add(new G.Text(-100, 0, "0", {
            style: "font-blue",
            fontSize: 35
        }, .5)), this.showReasons = new G.Reasons, this.showReasons.hasAnyChangedSignal.add(this.onShowReasonChanged, this), G.Utils.cleanUpOnDestroy(this, G.sb("onScreenResize").add(this.onResize, this)), this.onResize()
    }, G.TreasureHunt.GameplayGemCounter.prototype = Object.create(Phaser.Group.prototype), G.TreasureHunt.GameplayGemCounter.ReasonToShow = {
        Gem: "gem",
        OutOfMovesPopUp: "outOfMoves"
    }, G.TreasureHunt.GameplayGemCounter.prototype.onResize = function() {
        this.cameraOffset.x = game.width, this.cameraOffset.y = Math.floor(.875 * game.height)
    }, G.TreasureHunt.GameplayGemCounter.prototype.onShowReasonChanged = function(t) {
        t ? this.showAnim() : this.hideAnim()
    }, G.TreasureHunt.GameplayGemCounter.prototype.showAnim = function() {
        game.add.tween(this.mainGroup).to({
            x: 0
        }, 200, Phaser.Easing.Sinusoidal.Out, !0)
    }, G.TreasureHunt.GameplayGemCounter.prototype.hideAnim = function() {
        game.add.tween(this.mainGroup).to({
            x: 300
        }, 200, Phaser.Easing.Sinusoidal.Out, !0)
    }, G.TreasureHunt.GameplayGemCounter.prototype.show = function(t) {
        t != G.TreasureHunt.GameplayGemCounter.ReasonToShow.OutOfMovesPopUp || this.showReasons.has(t) || game.add.tween(this.shine).to({
            alpha: .5
        }, 300, Phaser.Easing.Sinusoidal.Out, !0), this.showReasons.add(t, !0)
    }, G.TreasureHunt.GameplayGemCounter.prototype.hide = function(t) {
        var e = G.TreasureHunt.GameplayGemCounter.ReasonToShow;
        t === e.OutOfMovesPopUp ? (this.showReasons.remove(t, !0), this.showReasons.has(t) || game.add.tween(this.shine).to({
            alpha: 0
        }, 300, Phaser.Easing.Sinusoidal.Out, !0)) : game.time.events.add(2e3, function() {
            this.showReasons.remove(t, !0)
        }, this)
    }, G.TreasureHunt.GameplayGemCounter.prototype.increaseAmount = function() {
        this.amount !== this.maxAmount && (this.amount++, this.amountTxt.setText(this.amount))
    }, G.TreasureHunt.GameplayGemCounter.prototype.getTargetObject = function() {
        return this.chest
    }, G.TreasureHunt = G.TreasureHunt || {}, G.TreasureHunt.GingyFailCharacter = function() {
        Phaser.Group.call(this, game), this.fixedToCamera = !0, this.gingy = G.makeImage(0, 300, "Cookie_Pirate_Header", [.5, 169 / 185], this), this.gingy.scale.setTo(1.2), this.gingy.name = "gingyCharacter", this.msg = game.add.group(this), this.msg.name = "speakBubble", this.msg.scale.setTo(0), this.msg.position.setTo(50, -90), this.bubble = G.makeImage(0, 0, "info_bubble", 0, this.msg), this.bubble.scale.setTo(1.8, -1.8), this.msgTxt = this.msg.add(new G.Text(75, -72, G.txt("Don’t quit! You’ll lose your treasure!"), {
            style: "font-blue",
            fontSize: 25,
            lineSpacing: -15
        }, .5, "ja" === G.lang ? 150 : 120, 110, !0, "center")), G.sb("onScreenResize").add(this.onResize, this), this.onResize()
    }, G.TreasureHunt.GingyFailCharacter.prototype = Object.create(Phaser.Group.prototype), G.TreasureHunt.GingyFailCharacter.prototype.onResize = function() {
        this.cameraOffset.x = Math.floor(.15 * game.width), this.cameraOffset.y = game.height
    }, G.TreasureHunt.GingyFailCharacter.prototype.show = function() {
        G.Animations.getTHFailGingyAnimationShow().animate(this.game, this)
    }, G.TreasureHunt.GingyFailCharacter.prototype.hide = function() {
        G.Animations.getTHFailGingyAnimationHide().animate(this.game, this)
    }, G.TreasureHunt.THFriendsPanel = function() {
        var i = G.TreasureHunt.treasureHuntMgr,
            s = (G.platform, this);

        function t() {
            if (null !== s.game) {
                var t = i.getInvitedContexts().length,
                    e = i.getInvitesCap();
                s.amountTxt.setText("+" + (t + 1) + "/" + (e + 1)), t === e && (s.plusBtn.inputEnabled = !1, s.plusBtn.alpha = .5)
            }
        }
        Phaser.Group.call(this, game), this.bg = G.makeImage(0, 0, "under_window_panel", .5, this), this.chest = G.makeImage(-200, 5, "th_treasure_opened", .5, this), this.collectTxt = this.add(new G.Text(15, 0, G.txt("Collect more with Friends!"), {
            style: "font-white",
            fontSize: 30
        }, .5, 270)), this.amountTxt = this.add(new G.Text(-150, -15, " ", {
            style: "font-white",
            fontSize: 25
        }, .5)), G.Utils.cleanUpOnDestroy(this, i.onInvitesIncrease.add(t)), this.plusBtn = this.add(new G.Button(210, 0, "btn_plus", function() {
            i.sendInvite()
        }, this)), t()
    }, G.TreasureHunt.THFriendsPanel.prototype = Object.create(Phaser.Group.prototype), G.TreasureHunt.TreasureHuntProgressionPanel = function(e) {
        G.TreasureHunt.treasureHuntMgr;
        var t = G.TreasureHunt.TreasureHuntTutorial,
            i = G.PFEventPanel;
        e = Object.assign({
            progressBar: {
                label: !1,
                overlaySprite: "goalPanel_bar_full"
            },
            sounds: {
                onIncrease: null,
                onComplete: null
            }
        }, e), console.log(e), i.call(this, e), this.bg.changeTexture("under_window_panel"), this.bg.inputEnabled = !1, this.progressBar.position.setTo(-195, 4), this.progressBar.width = 400, this.progressBar.height = 30, this.descTxt = this.add(new G.Text(0, -17, " ", {
            style: "font-white",
            fontSize: 35
        }, .5, 300)), e.valueTarget === e.target && (this.shine = G.makeImage(212, 15, "popup_lighht", .5, this), this.shine.name = "shine", this.shine.alpha = .3, this.shine.blendMode = 1, this.shine.scale.setTo(.5), G.Animations.getShineAnimation().animate(this.game, this)), this.gemIcon = G.makeImage(-218, 8, "gem5_small", .5, this), this.gemIcon.name = "gem", this.chestIcon = G.makeImage(212, 15, "prezent", .5, this), this.chestIcon.scale.setTo(.35), e.tutorial && (this.tutorialBtn = new G.Button(236, -42, "info_button", function() {
            new t
        }, this), this.add(this.tutorialBtn)), this.onValueChanged.add(function(t) {
            Math.floor(n) !== Math.floor(t) && (r(), function() {
                if (a) return;
                a = !0;
                var t = G.Animations.getTreasureHuntGemBounceAnimation();
                t.animate(game, s.gemIcon), t.onComplete.add(function() {
                    a = !1
                })
            }(), t === o ? e.sounds.onComplete && !e.sounds.onComplete.isPlaying && s.config.sounds.onComplete.play() : e.sounds.onIncrease && !e.sounds.onIncrease.isPlaying && e.sounds.onIncrease.play());
            n = t
        });
        var s = this,
            a = !1,
            n = this.valueObj.value,
            o = this.valueObj.target;

        function r() {
            var t = G.txt("Collect [#] Gems").replace("[#]", Math.floor(s.valueObj.value) + "/" + s.valueObj.target);
            s.descTxt.text !== t && s.descTxt.setText(t)
        }
        r()
    }, G.TreasureHunt.TreasureHuntProgressionPanel.prototype = Object.create(G.PFEventPanel.prototype), G.TreasureHunt.TreasureHuntTutorial = function() {
        Phaser.Group.call(this, game), this.fixedToCamera = !0, this.overlay = game.add.graphics(0, 0, this), this.overlay.inputEnabled = !0, this.bg = G.makeImage(0, 0, "th_tutorial_box", .5, this), this.closeBtn = this.add(new G.Button(215, -220, "btn_x", function() {
            this.destroy()
        }, this)), this.howToCollectTxt = this.add(new G.Text(0, -170, G.txt("How to collect Gems?"), {
            style: "font-blue",
            fontSize: 35
        }, .5, 340)), this.descTxt = this.add(new G.Text(0, -100, G.txt("Match next to purple chests to collect what’s inside!"), {
            style: "font-blue",
            fontSize: 30,
            lineSpacing: -15
        }, .5, 400, 150, !0, "center")), this.tutorialImg = G.makeImage(-20, 70, "tutorial_image", .5, this), G.Utils.cleanUpOnDestroy(this, G.sb("onScreenResize").add(this.onResize, this)), this.onResize()
    }, G.TreasureHunt.TreasureHuntTutorial.prototype = Object.create(Phaser.Group.prototype), G.TreasureHunt.TreasureHuntTutorial.prototype.onResize = function() {
        this.cameraOffset.setTo(Math.floor(.5 * game.width), Math.floor(.5 * game.height)), this.overlay.beginFill(0, .5), this.overlay.drawRect(.5 * -game.width, .5 * -game.height, game.width, game.height)
    }, G.TreasureHunt = G.TreasureHunt || {}, G.TreasureHunt.TreasureHuntWindowPanel = function(t) {
        var e = G.CommonObjects.PageScroller;
        Phaser.Group.call(this, game), this.arrowsContainer = game.add.group(this), this.pageScroller = new e({
            width: 500,
            height: 100,
            pageWidth: 550,
            dragThreshold: .3
        }), this.add(this.pageScroller), this.init(t)
    }, G.TreasureHunt.TreasureHuntWindowPanel.prototype = Object.create(Phaser.Group.prototype), G.TreasureHunt.TreasureHuntWindowPanel.prototype.init = function(n) {
        var o, t = G.TreasureHunt.treasureHuntMgr,
            r = G.TreasureHunt.TreasureHuntProgressionPanel;
        G.TreasureHunt.THFriendsPanel;
        t.isEventReadyToStart() || (o = t.getProgressData());
        var h = t.getGeneralEventInfo(),
            l = function() {
                var t = n.collectedGems || 0,
                    e = 0,
                    i = 0,
                    s = h.gemsTarget;
                o && (e = o.gemsCollected - t, i = o.gemsCollected, s = o.gemsTarget, e !== i && game.time.events.add(1e3, function() {
                    null !== l.game && l.showProgress()
                }));
                var a = {
                    tutorial: n.tutorial || !1,
                    value: e,
                    valueTarget: i,
                    target: s,
                    sounds: {
                        onIncrease: G.sfx.pop,
                        onComplete: G.sfx.match_5
                    }
                };
                return new r(a)
            }();
        this.pageScroller.addPage(l)
    }, G.TreasureHunt.TreasureHuntWindowPanel.prototype.addArrows = function() {
        this.leftArrow = new G.Button(-240, 0, "collect_cell_2", function() {
            this.pageScroller.goToPreviousPage()
        }, this), this.leftArrow.angle = 90, this.leftArrow.visible = !1, this.arrowsContainer.add(this.leftArrow), this.rightArrow = new G.Button(240, 0, "collect_cell_2", function() {
            this.pageScroller.goToNextPage()
        }, this), this.rightArrow.angle = -90, this.rightArrow.visible = !0, this.arrowsContainer.add(this.rightArrow), this.pageScroller.onPageIndexChanged.add(function(t, e) {
            this.leftArrow.visible = 0 < t && 0 < e, this.rightArrow.visible = t !== e && 0 < e
        }, this)
    }, G.TreasureHunt = G.TreasureHunt || {}, G.TreasureHunt.TreasureHuntEventPanel = function() {
        Phaser.Group.call(this, game), this.init()
    }, G.TreasureHunt.TreasureHuntEventPanel.prototype = Object.create(Phaser.Group.prototype), G.TreasureHunt.TreasureHuntEventPanel.prototype.init = function() {
        var i = G.TreasureHunt.treasureHuntMgr,
            t = G.Utils,
            s = G.CommonObjects.ClockTimer,
            a = this,
            n = (G.makeImage(0, 0, "mission_title_banner", [.5, 0], a), a.add(new G.Text(0, 19, G.txt("Treasure Hunt"), {
                style: "font-white",
                fontSize: 25
            }, .5, 185)), G.makeImage(0, 30, "treasure_hunt_banner", [.5, 0], a), a.add(new G.Button(92, 150, "btn_gm_green", function() {
                if (i.isEventActive())
                    if (0 == G.saveState.getCurrentLivesNr() && 0 == G.saveState.getUnlimitedLivesSec()) G.sb("pushWindow").dispatch("notEnoughLives");
                    else {
                        var t = i.getTreasureHuntLevelIndex();
                        null !== t && G.sb("pushWindow").dispatch(["level", t])
                    }
                else i.isEventReadyToStart() && G.sb("pushWindow").dispatch("treasureHuntEvent")
            })));
        new Phaser.Signal;
        return n.addTextLabel("font-white", " ", 30), i.isEventActive() ? o() : i.isEventReadyToStart() && e(), t.cleanUpOnDestroy(this, i.onEventStart.add(o)), {
            initEventReadyToPlay: e,
            initEventActive: o
        };

        function e() {
            n.label.setText(G.txt("Join!"))
        }

        function o() {
            n.label.setText(G.txt("Play"));
            var t = a.add(new s(-82, 150)),
                e = i.getProgressData();
            t.setEndDate(e.endDate, !0)
        }
    }, G.TreasureHunt.TreasureHuntEventPanel.prototype.getContentHeight = function() {
        return 180
    }, G.TreasureHunt = G.TreasureHunt || {}, G.TreasureHunt.treasureHuntMgr = function() {
        var e = null,
            i = null,
            s = null,
            a = null,
            n = null,
            o = 0,
            r = null,
            h = null,
            l = null,
            d = null,
            c = new Phaser.Signal,
            t = new Phaser.Signal,
            u = new Phaser.Signal,
            p = new Phaser.Signal,
            g = new Phaser.Signal,
            f = new Phaser.Signal;
        return {
            init: function() {
                e = G.saveState, i = G.json.levels, s = G.json.settings, a = G.Utils.defined(e.getTreasureHuntData(), {
                    gateOpened: !1
                }), n = a.eventInstanceData, e.signals.onGateOpened.addOnce(y);
                var t = G.Utils.defined(s.treasureHuntConfig, {});
                h = G.Utils.defined(t.gemsTarget, 50), d = 864e5 * G.Utils.defined(t.eventDurationDays, 3), l = 864e5 * G.Utils.defined(t.refractorPeriodDays, 1), r = G.Utils.defined(t.invitesCap, 3),
                    function() {
                        if (!n) return;
                        if (n.onTimeEndCalled) return;
                        if (w()) {
                            var t = n.endTime - Date.now() + 10;
                            console.log("TH Delay ", t), setTimeout(e, t)
                        } else e();

                        function e() {
                            g.dispatch(!1), console.log("TH on time end"), n.onTimeEndCalled = !0, C() || p.dispatch(S()), m()
                        }
                    }()
            },
            isFeatureUnlocked: b,
            isEventActive: w,
            isEventReadyToStart: x,
            isEventTurnedOn: v,
            isEventOnCooldown: T,
            startEvent: function() {
                if (!x()) return;
                n = {
                    startTime: Date.now(),
                    endTime: Date.now() + d,
                    gemsCollected: 0,
                    gemsTarget: h,
                    invitedContexts: [],
                    rewardClaimed: !1,
                    newGateLock: !0
                }, a.eventInstanceData = n, t.dispatch(), g.dispatch(!0), m()
            },
            isLevelTreasureHuntActive: P,
            isRewardAvailable: function() {
                if (!n) return !1;
                return !(!C() || n.rewardClaimed)
            },
            markRewardAsClaimed: function() {
                if (!n) return !1;
                n.rewardClaimed = !0, m()
            },
            startLevel: function(t) {
                P(t) && (o = 0)
            },
            failLevel: function(t) {
                o = 0
            },
            completeLevel: function(t) {
                var e = o;
                f.dispatch(t, e), P(t) && (n.gemsCollected = Math.min(n.gemsCollected + o, n.gemsTarget), C() && (n.endTime = Date.now(), u.dispatch(S()), g.dispatch(!1)), m());
                return o = 0, e
            },
            collectGem: function() {
                o++
            },
            getLevelCollectedGems: function() {
                return o
            },
            getProgressData: S,
            getGeneralEventInfo: function() {
                return {
                    gemsTarget: h,
                    duration: d,
                    durationDays: Math.ceil(d / 864e5)
                }
            },
            getInvitesCap: B,
            getTreasureHuntLevelIndex: function() {
                var t = Math.min(i.length - 1, e.getLastPassedLevelNr());
                return P(t) ? t : null
            },
            getInvitedContexts: k,
            addInvitedContext: I,
            sendInvite: function(i) {
                var t = G.platform,
                    e = k();
                if (e.length === r) return;
                t.sendTreasureHuntInvite(function(t, e) {
                    t ? (I(e), i && i(!0)) : i && i(!1)
                }, e)
            },
            onInvitesIncrease: c,
            onEventStart: t,
            onEventCompleted: u,
            onEventExpired: p,
            onEventTurnedOnChange: g,
            onLevelComplete: f
        };

        function m() {
            e.saveTreasureHuntData(a)
        }

        function y() {
            a.gateOpened || (a.gateOpened = !0, m()), n && (n.newGateLock = !1), g.dispatch(v())
        }

        function b() {
            return a.gateOpened
        }

        function v() {
            return w() || x()
        }

        function x() {
            return !w() && (!T() && ((!n || !n.newGateLock) && (t = e.getLastPassedLevelNr(), b() && t < i.length - 40)));
            var t
        }

        function w() {
            return !!n && (Date.now() < n.endTime && n.gemsCollected < n.gemsTarget && !C())
        }

        function T() {
            return !!n && (Date.now() < n.endTime + l && (Date.now() > n.endTime || C()))
        }

        function S() {
            return n ? {
                gemsCollected: n.gemsCollected,
                gemsTarget: n.gemsTarget,
                endDate: n.endTime,
                rewardClaimed: n.rewardClaimed,
                invitedContexts: k()
            } : null
        }

        function P(t) {
            return !!w() && (t === e.getLastPassedLevelNr() || t === i.length - 1)
        }

        function C() {
            return !!n && n.gemsCollected >= n.gemsTarget
        }

        function k() {
            return n ? n.invitedContexts.slice(0, B()) : []
        }

        function I(t) {
            if (!n) return null;
            n.invitedContexts.push(t), c.dispatch(k().length), m()
        }

        function B() {
            return r
        }
    }(), G.ContentArea = function(t, e, i, s) {
        Phaser.Group.call(this, game), this.position.setTo(t, e), this.contentMaxWidth = i, this.contentMaxHeight = s, this.contentWidth = i, this.contentHeight = 0, this.contentGroup = null, this.inputContentObjects = [], this.contentScrollInput = new G.ScrollInput(0, 0, i, s), this.add(this.contentScrollInput), this.scrollBar = new G.ScrollBar(i - 10, 0, s), this.scrollBar.onChange.add(function(t) {
            this.contentGroup && (this.contentGroup.y = Math.min(0, this.contentMaxHeight - this.contentGroup.height) * t)
        }, this), this.add(this.scrollBar), this.gfxMask = game.make.graphics(), this.gfxMask.alpha = 0, this.gfxMask.beginFill(0, 1), this.gfxMask.drawRect(0, 0, i, s), this.add(this.gfxMask), this.scroll = !1, this.scrollXNorm = 0, this.scrollYNorm = 0, game.input.mouse.mouseWheelCallback = this.mouseWheelHandler.bind(this), this.onDestroy.add(function() {
            game.input.mouse.mouseWheelCallback = null
        })
    }, G.ContentArea.prototype = Object.create(Phaser.Group.prototype), G.ContentArea.prototype.mouseWheelHandler = function() {
        this.contentGroup && this.scroll && (0 < game.input.mouse.wheelDelta ? this.contentGroup.y += 45 : this.contentGroup.y -= 45)
    }, G.ContentArea.prototype.update = function() {
        Phaser.Group.prototype.update.call(this), this.contentGroup && this.scroll && (this.contentGroup.y -= this.contentScrollInput.getVelY(), this.updateToBoundries(this.contentGroup)), this.updateButtons(), this.scrollBar.norm = this.scrollYNorm
    }, G.ContentArea.prototype.updateButtons = function() {
        for (var t = this.worldPosition.y, e = 0; e < this.inputContentObjects.length; e++) {
            var i = this.inputContentObjects[e],
                s = i.getBounds();
            i.inputEnabled = s.y > t && s.y + s.height < t + this.contentMaxHeight, i.input.useHandCursor = i.inputEnabled
        }
    }, G.ContentArea.prototype.getInputObjectsFromGroup = function(t, e) {
        e || (e = []);
        for (var i = t.children.length; i--;) {
            var s = t.children[i];
            s instanceof G.Button && e.push(s), 0 < s.children.length && this.getInputObjectsFromGroup(s, e)
        }
        return e
    }, G.ContentArea.prototype.display = function(t) {
        this.contentGroup && (this.contentGroup.mask = null, this.removeChild(this.contentGroup)), this.contentGroup = t, this.add(this.contentGroup), this.inputContentObjects = this.getInputObjectsFromGroup(this.contentGroup), this.contentHeight = Math.min(this.contentGroup.height, this.contentMaxHeight), this.contentScrollInput.resizeArea(this.contentWidth, this.contentHeight), this.contentScrollInput.setVelToZero(), this.updateToBoundries(this.contentGroup), this.scroll = this.contentGroup.height > this.contentMaxHeight, this.scrollBar.visible = this.scroll, this.contentGroup.mask = this.gfxMask
    }, G.ContentArea.prototype.updateToBoundries = function(t) {
        var e = Math.min(0, this.contentMaxHeight - (t.height + (t.additionalHeight || 0)));
        t.y = game.math.clamp(t.y, e, 0), this.scrollYNorm = t.y / e
    }, G.PopUpFlexBg = function() {
        Phaser.Group.call(this, game), G.PopUpFlexBg.texturesInitialized || this._doTextures(), this.pivot.y = 333, this.bottomBg = G.makeImage(0, 666, G.getRT("popup_bg_bottom"), [.5, 1], this), this.topBg = G.makeImage(0, 0, G.getRT("popup_bg_top"), [.5, 0], this)
    }, G.PopUpFlexBg.prototype = Object.create(Phaser.Group.prototype), G.PopUpFlexBg.prototype.changeSize = function(t, e) {
        t = Math.max(70, t), game.tweens.removeFrom(this.bottomBg), e ? (this.bottomBg.y = t + 333, this.bottomBg.height = Math.max(333, t)) : game.add.tween(this.bottomBg).to({
            y: t + 333,
            height: Math.max(333, t)
        }, 300, Phaser.Easing.Sinusoidal.Out, !0)
    }, G.PopUpFlexBg.prototype._doTextures = function() {
        var t = G.makeImage(0, 0, "popup_background_2", 0);
        game.make.renderTexture(582, 333, "popup_bg_top", !0).renderXY(t, 0, 0), game.make.renderTexture(582, 333, "popup_bg_bottom", !0).renderXY(t, 0, -333), t.destroy(), G.PopUpFlexBg.texturesInitialized = !0
    }, G.PopUpTileBg = function() {
        Phaser.Group.call(this, game), this.bgTop = G.makeImage(0, 0, "popup_top", [.5, 0], this), this.bgCenter = game.make.tileSprite(0, this.bgTop.bottom, 582, 392, "ssheet", "popup_center"), this.bgCenter.anchor.x = .5, this.pivot.y = 333, this.add(this.bgCenter), this.bgBottom = G.makeImage(0, this.bgCenter.bottom, "popup_bottom", [.5, 0], this)
    }, G.PopUpTileBg.prototype = Object.create(Phaser.Group.prototype), G.PopUpTileBg.prototype.changeSize = function(t, e) {
        t -= this.bgTop.height + this.bgBottom.height, e ? (this.bgBottom.pivot.y = 0, this.bgCenter.height = t, this.bgBottom.y = this.bgTop.height + t) : (game.add.tween(this.bgCenter).to({
            height: t
        }, 300, Phaser.Easing.Sinusoidal.Out, !0), this.bgBottom.pivot.y = 1, game.add.tween(this.bgBottom).to({
            y: this.bgTop.height + t
        }, 300, Phaser.Easing.Sinusoidal.Out, !0).onComplete.add(function() {
            this.bgBottom.pivot.y = 0
        }, this))
    };
    G.ScrollBar = function(t, e, i) {
        Phaser.Group.call(this, game), this.position.setTo(t, e), this.clickedAndPressed = !1, this.bg = G.makeImage(0, 0, null, 0, this), this.bg.alpha = .2, this.bg.inputEnabled = !0, this.bg.height = i, this.norm = 0, this.bg.events.onInputDown.add(function(t, e) {
            this.clickedAndPressed = !0;
            var i = Math.max(0, e.y - this.bg.worldPosition.y - 100) / (this.bg.height - 200);
            this.norm = i, this.onChange.dispatch(this.norm)
        }, this), this.scrollInd = G.makeImage(0, 0, "scroll_bar", 0, this), this.indMaxY = this.bg.height - this.scrollInd.height, this.onChange = new Phaser.Signal
    }, G.ScrollBar.prototype = Object.create(Phaser.Group.prototype), G.ScrollBar.prototype.update = function() {
        this.scrollInd.y = this.norm * this.indMaxY;
        var t = game.input.activePointer;
        if (this.clickedAndPressed) {
            if (!t.isDown) return void(this.clickedAndPressed = !1);
            t = game.input.activePointer;
            var e = Math.max(0, t.y - this.bg.worldPosition.y - 100) / (this.bg.height - 200);
            this.norm = game.math.clamp(e, 0, 1), this.onChange.dispatch(this.norm)
        }
    }, G.ScrollInput = function(t, e, i, s) {
        G.Image.call(this, t, e, null, 0), this.resizeArea(i, s), this.activePointer = null, this.active = !1, this.inputData = {
            x: null,
            y: null,
            velX: 0,
            velY: 0,
            deltaX: 0,
            deltaY: 0
        }, this.initCustomInput()
    }, G.ScrollInput.prototype = Object.create(G.Image.prototype), G.ScrollInput.prototype.isDuringDrag = function() {
        return this.active
    }, G.ScrollInput.prototype.getVelX = function() {
        return this.inputData.velX
    }, G.ScrollInput.prototype.getVelY = function() {
        return this.inputData.velY
    }, G.ScrollInput.prototype.getDeltaX = function() {
        return this.inputData.deltaX
    }, G.ScrollInput.prototype.getDeltaY = function() {
        return this.inputData.deltaY
    }, G.ScrollInput.prototype.initCustomInput = function(t, e) {
        var i = G.Input.createCustomInputDragHandler();
        i.inputDownSignal.add(this.setVelToZero, this), i.dragStartSignal.add(this.startDragging, this), i.dragStopSignal.add(this.stopDragging, this), i.dragCancelSignal.add(this.stopDragging, this), G.Input.initializeCustomInput(this), this.customInput.addHandler(i)
    }, G.ScrollInput.prototype.startDragging = function(t) {
        this.activePointer = t, this.active = !0, this.inputData.x = t.worldX, this.inputData.y = t.worldY
    }, G.ScrollInput.prototype.stopDragging = function() {
        this.activePointer = null, this.active = !1, this.inputData.deltaX = 0, this.inputData.deltaY = 0
    }, G.ScrollInput.prototype.resizeArea = function(t, e) {
        this.hitArea = new Phaser.Rectangle(0, 0, t, e)
    }, G.ScrollInput.prototype.setVelToZero = function() {
        this.inputData.velX = 0, this.inputData.velY = 0
    }, G.ScrollInput.prototype.update = function() {
        if (this.activePointer)
            if (this.activePointer.isDown) {
                var t = this.inputData.x - this.activePointer.worldX,
                    e = this.inputData.y - this.activePointer.worldY;
                this.inputData.x = this.activePointer.worldX, this.inputData.y = this.activePointer.worldY, this.inputData.deltaX = t, this.inputData.deltaY = e, this.inputData.velX = .8 * t + .2 * this.inputData.velX, this.inputData.velY = .8 * e + .2 * this.inputData.velY
            } else this.stopDragging();
        else this.inputData.velX *= .95, Math.abs(this.inputData.velX) < 1 && (this.inputData.velX = 0), this.inputData.velY *= .95, Math.abs(this.inputData.velY) < 1 && (this.inputData.velY = 0)
    }, G.LifeContentFrame = function(t) {
        Phaser.Group.call(this, game), this.configType = t.type, this.state = game.state.getCurrentState(), this.initialized = !1, this.additionalHeight = 20, this.onInitialized = new Phaser.Signal, this.waitingIcon = new G.WaitingIcon(250, 160), this.add(this.waitingIcon), this.fetchFriends(function(t) {
            this.waitingIcon.destroy(), this.init(t)
        }, this)
    }, G.LifeContentFrame.prototype = Object.create(Phaser.Group.prototype), G.LifeContentFrame.prototype.fetchFriends = function(i, s) {
        sdkHandler.trigger("social.getFriends", {
            callback: function(t, e) {
                if (t) console.log(t);
                else {
                    if (null === this.game) return;
                    e = e.filter(function(t) {
                        return t.name && t.avatar && t.userId
                    }), i && i.call(s, e)
                }
            }
        }, this)
    }, G.LifeContentFrame.prototype.init = function(t) {
        this.initialized = !0, t.forEach(function(t, e) {
            var i = new G.LifeContentFrame.User(t, this.configType);
            i.y = 100 * e, this.add(i)
        }, this), game.time.events.add(1, this.onInitialized.dispatch, this.onInitialized)
    }, G.LifeContentFrame.User = function(t, e) {
        Phaser.Group.call(this, game), this.user = t, this.configType = e, this.btnGfx = "SEND" === e ? "Send_lives_button" : "Request_lives_button", this.resource = "SEND" === e ? "life" : "lifeRequest", this.timeLimitMs = 60 * (G.json.settings.sendResourceLimitsMin[this.resource] || 0) * 1e3, t.avatar ? this.avatar = G.makeExtImage(22, 22, t.avatar, "avatar_m_big", 0, this, !1, function() {
            this.width = this.height = 80
        }) : this.avatar = G.makeImage(22, 22, "avatar_m_big", 0, this), this.frame = G.makeImage(18, 18, "avatar_frame_big", 0, this), this.name = new G.Text(120, 60, t.name.split(" ")[0], {
            fill: "#008aca",
            font: "Lobster",
            fontSize: "30px"
        }, [0, .5], 130), this.add(this.name), this.btn = new G.Button(370, 60, this.btnGfx, "SEND" === this.configType ? this.sendLife : this.requestLife, this), this.btn.addTerm(function() {
            return this.isReady
        }, this), this.add(this.btn), this.label = new G.Text(22, 0, "SEND" == this.configType ? G.txt("Send") : G.txt("Request"), {
            fill: "white",
            font: "Lobster",
            fontSize: "35px"
        }, .5, 140), this.btn.addChild(this.label), this.taskCompleteIcon = G.makeImage(0, 56, "task_complete", .5, this), this.taskCompleteIcon.left = this.name.right + 3, this.taskCompleteIcon.scale.setTo(0), this.timer = new G.TextTimer(22, 0, 0, {
            fill: "#545454",
            font: "Lobster",
            fontSize: "35px"
        }, .5, 140), this.timer.visible = !1, this.btn.addChild(this.timer)
    }, G.LifeContentFrame.User.prototype = Object.create(Phaser.Group.prototype), G.LifeContentFrame.User.prototype.sendLife = function() {
        G.gameTracking.design("SendLivesHeartClicked"), G.saveState.canResourceBeSent(this.user.userId, "life") && G.platform.sendLife(this.user.userId, function(t) {
            t || (G.sb("lifeMsgSent").dispatch(), G.saveState.setResourceSentTimestamp(this.user.userId, "life"), G.gameTracking.design("LifeSentToUser"), game.add.tween(this.taskCompleteIcon.scale).to({
                x: 1,
                y: 1
            }, 400, Phaser.Easing.Elastic.Out, !0))
        }, this)
    }, G.LifeContentFrame.User.prototype.requestLife = function() {
        G.gameTracking.design("RequestLivesHeartClicked"), G.saveState.canResourceBeSent(this.user.userId, "lifeRequest") && G.platform.sendRequestForLife(this.user.userId, function(t) {
            t || (G.saveState.setResourceSentTimestamp(this.user.userId, "lifeRequest"), G.gameTracking.design("LifeRequestedFromUser"), game.add.tween(this.taskCompleteIcon.scale).to({
                x: 1,
                y: 1
            }, 400, Phaser.Easing.Elastic.Out, !0))
        }, this)
    }, G.LifeContentFrame.User.prototype.update = function() {
        if (G.saveState.canResourceBeSent(this.user.userId, this.resource)) this.isReady = !0, this.timer.visible && (this.timer.visible = !1, this.label.visible = !0, G.changeTexture(this.btn, this.btnGfx));
        else if (this.isReady = !1, !this.timer.visible) {
            G.changeTexture(this.btn, this.btnGfx + "_grayscale"), this.timer.visible = !0, this.label.visible = !1;
            var t = G.saveState.getResourceSentTimestamp(this.user.userId, this.resource),
                e = Math.ceil((t + this.timeLimitMs - Date.now()) / 1e3);
            console.log("secLeft", e), this.timer.start(e)
        }
    }, G.Window = function(t) {
        Phaser.Group.call(this, game), this.onClose = new Phaser.Signal, this.buttonsList = [], this.state = game.state.getCurrentState(), t.constructor === Array ? this[t[0]].apply(this, t.slice(1)) : this[t].apply(this, Array.prototype.slice.call(arguments, 1)), this.NOFADEINOUT || (game.add.tween(this.scale).from({
            x: 0
        }, 300, Phaser.Easing.Elastic.Out, !0), game.add.tween(this).from({
            alpha: 0
        }, 200, Phaser.Easing.Sinusoidal.In, !0)), G.sb("onWindowOpened").dispatch(this), G.Utils.cleanUpOnDestroy(this, G.sb("onStateChange").add(this.lockInput, this))
    }, G.Window.prototype = Object.create(Phaser.Group.prototype), G.Window.constructor = G.Window, G.Window.prototype.closeWindow = function(t, e) {
        this.closing || (this.lockInput(), this.closing = !0, this.onClose.dispatch(), this.boosterHighlight && (this.boosterHighlight.inputEnabled = !1, game.add.tween(this.boosterHighlight.shine).to({
            alpha: 0
        }, 800, Phaser.Easing.Sinusoidal.Out, !0).onComplete.add(function() {
            this.boosterHighlight.destroy()
        }, this)), game.add.tween(this.scale).to({
            x: 1.5
        }, 200, Phaser.Easing.Sinusoidal.In, !0), game.add.tween(this).to({
            alpha: 0
        }, 200, Phaser.Easing.Sinusoidal.Out, !0).onComplete.add(function() {
            G.sb("onWindowClosed").dispatch(), this.destroy(), t && t.call(e || !1)
        }, this))
    }, G.Window.prototype.addBackground = function(t) {
        t = t || "popup";
        this.bg = G.makeImage(0, 0, t, .5, this)
    }, G.Window.prototype.addCloseButton = function(t, e, i, s) {
        i = i || !1, s = s || this;
        this.closeButton = new G.Button(t || 250, e || -270, "btn_x", function() {
            this.closeWindow(i, s)
        }, this), this.registerButtons(this.closeButton)
    }, G.Window.prototype.registerButtons = function(t) {
        for (var e = 0; e < arguments.length; e++) this.buttonsList.push(arguments[e]), this.add(arguments[e])
    }, G.Window.prototype.lockInput = function() {
        this.buttonsList.forEach(function(t) {
            t.input.enabled = !1
        })
    }, G.Window.prototype.unlockInput = function() {
        this.buttonsList.forEach(function(t) {
            t.input.enabled = !0, t.input.useHandCursor = !0
        })
    }, G.Window.prototype.makeCoinBar = function(t, e, i) {
        this.coinArea = G.makeImage(0, e, "popup_text_backgr", .5, this), this.coinIco = G.makeImage(t - 130, e, "coin_1", .5, this), this.coinsTxt = new G.Text(0, e, G.saveState.getCoins().toString(), {
            style: "font-blue",
            fontSize: "45px"
        }, .5, 190), this.add(this.coinsTxt), game.incentivised || (this.plusBtn = new G.Button(t + 130, e, "btn_plus", function() {
            this.state.windowLayer.pushWindow(["moreMoney", i]), this.closeWindow()
        }, this), this.registerButtons(this.plusBtn))
    }, G.Window.prototype.buyLives = function() {
        game.incentivised ? this.buyLivesIncentivised() : this.buyLivesNotIncentivised()
    }, G.Window.prototype.buyLivesIncentivised = function() {
        this.addBackground("popup_background_2"), this.closeButton = new G.Button(250, -270, "btn_x", function() {
            this.closeWindow()
        }, this), this.registerButtons(this.closeButton), this.titleTxt = new G.Text(0, -272, G.txt("Not enough Hearts"), {
            style: "font-white",
            fontSize: "60px"
        }, .5, 400), this.add(this.titleTxt), this.preGroup = this.add(game.make.group()), this.heartImg = G.makeImage(0, -100, "icon_video_hearts", [.5, .5], this), this.preGroup.add(this.heartImg), this.watchVideoToGetTxt = new G.Text(0, 45, G.txt("Watch a video to get"), {
            style: "font-blue",
            fontSize: "50px"
        }, .5, 500), this.preGroup.add(this.watchVideoToGetTxt), this.moneyTxt = new G.LabelTextT("+" + G.json.settings.livesForAd + " @heart@", 0, 115, {
            style: "font-blue",
            fontSize: "60px"
        }, .5, 500), this.preGroup.add(this.moneyTxt), this.watchBtn = new G.Button(0, 240, "btn_green", function() {}, this), this.watchBtn.addTextLabel("font-white", G.txt("Watch"), 70), this.registerButtons(this.watchBtn)
    }, G.Window.prototype.buyLivesIncentivised_thanks = function() {
        game.add.tween(this.preGroup).to({
            alpha: 0
        }, 300, Phaser.Easing.Sinusoidal.Out, !0), this.watchBtn.inputEnabled = !1, game.add.tween(this.watchBtn).to({
            alpha: 0
        }, 300, Phaser.Easing.Sinusoidal.Out, !0), this.postGroup = this.add(game.make.group()), this.thanksForWatching = new G.Text(0, -100, G.txt("Thanks for watching!"), {
            style: "font-blue",
            fontSize: "50px"
        }, .5, 500), this.postGroup.add(this.thanksForWatching), this.moneyBg = G.makeImage(0, 25, "popup_bigtext_backgr", [.5, .5], this.postGroup), this.moneyTxt = new G.LabelTextT("+" + G.json.settings.livesForAd + " @heart@", 0, 25, {
            style: "font-blue",
            fontSize: 60
        }, .5, 500), this.postGroup.add(this.moneyTxt), this.postGroup.alpha = 0, game.add.tween(this.postGroup).to({
            alpha: 1
        }, 300, Phaser.Easing.Sinusoidal.Out, !0), this.claimBtn = new G.Button(0, 230, "medium_button_green", function() {
            if ("World" == game.state.current) {
                var t = this.state.uiTargetParticles.createDividedBatch(game.world.bounds.x + this.worldPosition.x, this.worldPosition.y, "heart", this.state.panel.lifeUI.lifeIcon, G.json.settings.livesForAd, 1);
                t.addOnPartFinish(function() {
                    G.saveState.addLife(1)
                }), t.start()
            } else G.saveState.addLife(G.json.settings.livesForAd);
            this.closeWindow()
        }, this), this.claimBtn.addTextLabel("font-white", G.txt("Claim"), 50), this.registerButtons(this.claimBtn), game.add.tween(this.claimBtn).from({
            alpha: 0
        }, 300, Phaser.Easing.Sinusoidal.Out, !0)
    }, G.Window.prototype.buyLivesNotIncentivised = function() {
        this.addBackground("popup_background_2"), this.closeButton = new G.Button(250, -270, "btn_x", function() {
            this.closeWindow()
        }, this), this.registerButtons(this.closeButton), this.titleTxt = new G.Text(0, -272, G.txt("Not enough Hearts"), {
            style: "font-white",
            fontSize: "60px"
        }, .5, 400), this.add(this.titleTxt), this.heartImg = G.makeImage(0, -70, "broken_heart", [.5, .5], this), this.heartImg.scale.setTo(2), this.moneyTxt = new G.LabelTextT("+1 @heart@ = " + G.json.settings.lifePrice + "@coin_1@", 0, 60, {
            style: "font-blue",
            fontSize: "70px"
        }, .5, 500), this.add(this.moneyTxt), this.buyBtn = new G.Button(0, 240, "btn_orange", function() {
            if (G.gameTracking.sink("Coins", "Life", "Map", G.json.settings.lifePrice), G.saveState.changeCoins(-G.json.settings.lifePrice, !0), "World" == game.state.current) {
                var t = this.state.uiTargetParticles.createDividedBatch(game.world.bounds.x + this.worldPosition.x, this.worldPosition.y, "heart", this.state.panel.lifeUI.lifeIcon, 1, 1);
                t.addOnPartFinish(function() {
                    G.saveState.addLife(1)
                }), t.start()
            } else G.saveState.addLife(1);
            this.closeWindow()
        }, this), this.buyBtn.addTextLabel("font-white", G.txt("Buy"), 70), this.registerButtons(this.buyBtn), G.saveState.getCoins() < G.json.settings.lifePrice && (this.buyBtn.alpha = .5, this.buyBtn.inputEnabled = !1)
    }, G.Window.prototype.coinShop = function(t) {
        this.bg = new G.PopUpFlexBg, this.add(this.bg), t = t || {}, this.closeButton = new G.Button(252, -265, "btn_x", function() {
            this.closeWindow()
        }, this), this.registerButtons(this.closeButton), this.closeButton.addTerm(function() {
            return !this.coinShop.wheelGroup.isDuringSpin()
        }, this), this.coinShop = new G.CoinShop(t), this.add(this.coinShop)
    }, G.Window.prototype.daily2 = function() {
        this.y = G.l(-50), this.incentivised = game.incentivised, this.played = 0, this.addBackground("popup_background_2"), this.bg.y = G.l(40), this.banner = G.makeImage(0, -245, "green_banner", .5, this), this.ribbonImg = G.makeImage(0, -168, "gold_wheel_ribbon", .5, this), this.ribbonTxt = new G.Text(0, -10, G.txt("3x higher winnings!"), {
            style: "font-white",
            fontSize: "50px"
        }, .5, 350), this.ribbonImg.scale.setTo(0), this.ribbonImg.addChild(this.ribbonTxt), this.closeButton = new G.Button(260, -230, "btn_x", function() {
            this.wonPrize && (G.gift.applyGift(this.wonPrize), "coin" === this.wonPrize[0] ? G.gameTracking.source("Coins", "Reward", "DailyReward", this.wonPrize[1]) : G.gameTracking.source(G.saveState.nrToBoosterName(this.wonPrize[0][8]), "Reward", "DailyReward", this.wonPrize[1]), this.wonPrize = !1), this.closeWindow()
        }, this), this.registerButtons(this.closeButton), this.dailyTxt = new G.Text(0, -250, G.txt("Prize wheel"), {
            style: "font-white",
            fontSize: "70px"
        }, .5, 350), this.add(this.dailyTxt), this.dailyGame = this.add(new G.DailyWheel(0, 60)), this.giftGroup = this.add(game.make.group()), this.giftGroup.y = 40, this.freeSpinBtn = new G.Button(0, 305, "medium_button_green", function() {
            G.gameTracking.FTUEDesign("FTUX_FirstSpinMade"), this.dailyGame.restart(), this.dailyGame.launch(game.rnd.between(600, 1400)), G.gameTracking.design("DailySpinClicked"), G.sb("wheelSpin").dispatch(), this.closeButton.visible = !1, G.saveState.data.freeSpin = !1, G.saveState.save(), this.freeSpinBtn.visible = !1, this.premiumSpinBtn.visible = !1
        }, this), this.freeSpinBtn.addTextLabel("font-white", G.txt("Spin"), 50), this.add(this.freeSpinBtn), this.daily2addPremiumBtn(), G.saveState.data.freeSpin ? this.changeToRegular() : this.changeToGold(), this.dailyGame.onFinish.add(function(t) {
            game.add.tween(this.dailyGame).to({
                alpha: 0
            }, 300, Phaser.Easing.Sinusoidal.InOut, !0), this.daily2showPrize(t)
        }, this), this.youWinTxt = new G.Text(0, -40, G.txt("You win!"), {
            style: "font-blue",
            fontSize: "60px"
        }, .5, 500), this.add(this.youWinTxt), this.youWinTxt.visible = !1, this.claimButton = new G.Button(0, 260, "medium_button_green", function() {
            this.shareCheckbox && this.shareCheckbox.selected || this.daily2ClaimBtnAction()
        }, this), this.claimButton.addTextLabel("font-white", G.txt("Claim"), 50), this.registerButtons(this.claimButton), this.claimButton.inputEnabled = !1, this.claimButton.visible = !1
    }, G.Window.prototype.daily2adSuccess = function() {
        this.dailyGame.restart(), this.dailyGame.launch(game.rnd.between(600, 1400)), G.gameTracking.design("DailySpinClicked"), G.sb("wheelSpin").dispatch(), this.closeButton.visible = !1, this.freeSpinBtn.visible = !1, this.premiumSpinBtn.visible = !1
    }, G.Window.prototype.daily2addPremiumBtn = function() {
        this.premiumSpinBtn = new G.Button(0, 280, "medium_button_purple", function() {}, this), G.makeImage(-110, 0, "btn-movie-icon", .5, this.premiumSpinBtn), this.premiumSpinBtn.addTextLabel("font-white", G.txt("Spin again"), "40px", 42, 0, 165), this.add(this.premiumSpinBtn)
    }, G.Window.prototype.daily2ClaimBtnAction = function() {
        this.daily2applyPrize(this.wonPrize, !1), this.wonPrize = !1, this.claimButton.inputEnabled = !1
    }, G.Window.prototype.daily2showPrize = function(t) {
        this.youWinTxt.scale.setTo(0), this.youWinTxt.visible = !0, game.add.tween(this.youWinTxt.scale).to({
            x: 1,
            y: 1
        }, 600, Phaser.Easing.Elastic.Out, !0), this.giftGfx = new G.LabelTextT(G.gift.getLabelString(t), 0, 30, {
            style: "font-num-blue",
            fontSize: "110px",
            scaleStroke: !0
        }, .5, 300), this.giftGfx.scale.setTo(0), game.add.tween(this.giftGfx.scale).to({
            x: 1,
            y: 1
        }, 600, Phaser.Easing.Elastic.Out, !0), this.giftGroup.add(this.giftGfx), this.wonPrize = t, game.time.events.add(1e3, function() {
            this.claimButton.alpha = 1, this.claimButton.scale.setTo(0), game.add.tween(this.claimButton.scale).to({
                x: 1,
                y: 1
            }, 600, Phaser.Easing.Elastic.Out, !0).onComplete.add(function() {
                this.closeButton.visible = !0, this.claimButton.inputEnabled = !0, this.claimButton.input.useHandCursor = !0
            }, this), this.claimButton.visible = !0, this.shareCheckbox && (this.shareCheckbox.visible = !0, this.shareCheckbox.alpha = 0, game.add.tween(this.shareCheckbox).to({
                alpha: 1
            }, 600, Phaser.Easing.Elastic.Out, !0).onComplete.add(function() {
                this.shareCheckbox.ignoreChildInput = !1
            }, this))
        }, this)
    }, G.Window.prototype.daily2applyPrize = function(t, e) {
        this.wonPrize = !1, "coin" === t[0] ? (this.state.uiTargetParticles.createCoinBatch(game.world.bounds.x + this.giftGfx.worldPosition.x, this.giftGfx.worldPosition.y, this.state.panel.coinsTxt, t[1]), G.gameTracking.source("Coins", "Reward", "DailyReward", t[1])) : (G.gift.applyGift(t), G.gameTracking.source(G.saveState.nrToBoosterName(t[0][8]), "Reward", "DailyReward")), game.time.events.add(1e3, this.daily2restart, this)
    }, G.Window.prototype.changeToRegular = function() {
        this.freeSpinBtn.visible = !0, this.premiumSpinBtn.visible = !1, 0 < this.ribbonImg.scale.x && (G.stopTweens(this.ribbonImg), game.add.tween(this.ribbonImg.scale).to({
            x: 0,
            y: 0
        }, 200, Phaser.Easing.Cubic.In, !0)), this.dailyGame.changeToRegular()
    }, G.Window.prototype.changeToGold = function() {
        this.freeSpinBtn.visible = !1, this.premiumSpinBtn.visible = !0, this.ribbonImg.scale.x < 1 && (G.stopTweens(this.ribbonImg), game.add.tween(this.ribbonImg.scale).to({
            x: 1,
            y: 1
        }, 500, Phaser.Easing.Elastic.Out, !0)), this.dailyGame.changeToGold()
    }, G.Window.prototype.daily2restart = function() {
        if (!game.incentivised) return this.closeWindow();
        this.shareCheckbox && (this.shareCheckbox.ignoreChildInput = !0, game.add.tween(this.shareCheckbox).to({
            alpha: 0
        }, 300, Phaser.Easing.Sinusoidal.In, !0)), this.claimButton.inputEnabled = !1, game.add.tween(this.claimButton).to({
            alpha: 0
        }, 300, Phaser.Easing.Sinusoidal.In, !0), game.add.tween(this.dailyGame).to({
            alpha: 1
        }, 300, Phaser.Easing.Sinusoidal.InOut, !0, 400).onComplete.add(function() {
            G.saveState.data.freeSpin ? this.changeToRegular() : this.changeToGold()
        }, this), game.add.tween(this.youWinTxt.scale).to({
            x: 0,
            y: 0
        }, 300, Phaser.Easing.Sinusoidal.InOut, !0), game.add.tween(this.giftGroup).to({
            alpha: 0
        }, 300, Phaser.Easing.Sinusoidal.In, !0).onComplete.add(function() {
            this.giftGroup.destroy(), this.giftGroup = this.add(game.make.group()), this.giftGroup.y = 40
        }, this)
    }, G.Window.prototype.daily2makeFirework = function(t, e) {
        var i = game.add.group();
        this.add(i), i.x = G.l(t), i.y = G.l(e);
        for (var s = 0; s < 10; s++) {
            var a = G.makeImage(0, 0, "firework", .5, i),
                n = 36 * (s + .5 * Math.random());
            a.fadeRate = .02 + .02 * Math.random(), a.grav = 4, a.scale.setTo(1.5), a.velX = G.lengthDirX(n, G.l(12), !1), a.velY = G.lengthDirY(n, G.l(12), !1), a.update = function() {
                this.x += this.velX, this.y += this.velY, this.y += this.grav, this.velX *= .97, this.velY *= .97, this.alpha -= this.fadeRate, this.alpha <= 0 && this.destroy()
            }
        }
        return i.update = function() {
            for (var t = this.children.length; t--;) this.children[t].update();
            0 == this.length && this.destroy()
        }, i
    }, G.Window.prototype.dailyChallenge = function(t) {
        this.addBackground("popup_background_2"), this.greenBanner = G.makeImage(0, -295, "orange_banner", .5, this), this.levelTxt = new G.Text(0, -297, G.txt("Daily Challenge"), {
            fontSize: "60px",
            style: "font-white"
        }, .5, 330), this.add(this.levelTxt), this.closeButton = new G.Button(235, -257, "btn_x", function() {
            this.boosters.forEach(function(t) {
                t.signalBinding && t.signalBinding.detach()
            }), "Game" !== game.state.current ? this.closeWindow() : G.sb("onStateChange").dispatch("World")
        }, this), this.registerButtons(this.closeButton), this.addChild(this.closeButton);
        this.stars = [G.makeImage(-100, -150, "star_blank", .5, this), G.makeImage(0, -175, "star_blank", .5, this), G.makeImage(100, -150, "star_blank", .5, this)], this.stars[0].scale.setTo(.8), this.stars[2].scale.setTo(.8), this.taskBg = G.makeImage(0, 5, "popup_bigtext_backgr", .5, this), this.taskTxt = new G.Text(0, -70, G.txt("Task") + ":", {
            style: "font-blue",
            fontSize: "45px"
        }, .5, 380), this.add(this.taskTxt), "collect" == t.goal[0] ? this.makeTaskCollectPanels(5, t) : this.add(new G.Text(0, 5, G.txt("points").toUpperCase() + ": " + t.goal[1], {
            style: "font-blue",
            fontSize: "50px"
        }, .5, 380)), this.buyTxt = new G.Text(0, 90, G.txt("Buy some boosters") + ":", {
            style: "font-blue",
            fontSize: "35px"
        }, .5, 680), this.add(this.buyTxt), this.boosterBg = G.makeImage(0, 170, "popup_bigtext_backgr", .5, this), this.boosters = [new G.UI_StartBoosterButton(-195, 170, 5, 999), new G.UI_StartBoosterButton(0, 170, 7, 999), new G.UI_StartBoosterButton(195, 170, 8, 999)], this.addMultiple(this.boosters), this.continueBtn = new G.Button(0, 300, "btn_orange", function() {
            G.saveState.startChallenge(), G.sb("onDailyChallengeStart").dispatch(), G.sb("onStateChange").dispatch("Game", 999, !1, this.state.startBoosterConfig.getConfigForLevel(999), t)
        }, this), this.continueBtn.pulse(), this.continueBtn.addTextLabel("font-white", G.txt("Continue"), 70), this.registerButtons(this.continueBtn)
    }, G.Window.prototype.dailyMissionMainReward = function() {
        var t = {
            unlimitedLivesMin: 15,
            gifts: {
                cupcake_purple: [
                    ["booster#8", 1],
                    ["booster#4", 1]
                ],
                lolly_purple: [
                    ["booster#7", 1],
                    ["booster#2", 1]
                ],
                donut_purple: [
                    ["booster#1", 1],
                    ["booster#3", 1]
                ],
                icecream_purple: [
                    ["booster#5", 1],
                    ["booster#1", 1]
                ]
            } [G.dailyMissionsMgr.getCollectionIcons().icon],
            gameTrackingItemID: "DM",
            endMsg: G.txt("You got unlimited lives for 15 minutes!"),
            tweensSettings: [{
                x: 10,
                y: -266,
                angle: -3
            }, {
                x: 133,
                y: -499,
                angle: 15
            }, {
                x: -133,
                y: -425,
                angle: -10
            }]
        };
        this.overlayReward(t)
    }, G.Window.prototype.dailyReward = function(t) {
        this.dayNr = game.math.clamp(t, 0, 6), this.y = 0, this.bg = G.makeImage(0, -330, "popup_bg_top", [.5, 0], this), this.bgBottom = G.makeImage(0, -180, "popup_bg_bottom", [.5, 0], this), this.ribbon = G.makeImage(0, -285, "daily_rewards_ribbon", .5, this), this.title = new G.Text(0, -285, G.txt("Daily Reward") + "!", {
            fill: "white",
            font: "Lobster",
            fontSize: "55px"
        }, .5, 400), this.title.padding.x = 10, this.title.setShadow(0, -4, "rgba(175,95,26,1)", 0), this.add(this.title), G.sb("hideMainHighscorePanel").dispatch(), this.dailyReward_showCurrentGift(this.dayNr)
    }, G.Window.prototype.dailyReward_showCurrentGift = function(t) {
        this.currentDay = this.add(new G.DailyRewardCurrentGift(0, -30, t)), this.currentDay.onBoxClicked.add(this.dailyReward_openGift, this), this.openBtn = new G.Button(0, 200, "button_green", this.dailyReward_openGift, this), this.openBtn.addTextLabel("font-white", G.txt("Open"), 40), this.add(this.openBtn)
    }, G.Window.prototype.dailyReward_openGift = function() {
        this.currentDay.showReward(), this.openBtn.visible = !1, this.openBtn.inputEnabled = !1, this.claimBtn = new G.Button(0, 200, "button_green", function() {
            this.currentDay.claimReward(), this.claimBtn.inputEnabled = !1, this.doubleBtn && (this.doubleBtn.inputEnabled = !1, game.add.tween(this.doubleBtn).to({
                alpha: 0
            }, 300, Phaser.Easing.Sinusoidal.Out, !0)), game.add.tween(this.claimBtn).to({
                alpha: 0
            }, 300, Phaser.Easing.Sinusoidal.Out, !0), game.add.tween(this.currentDay).to({
                alpha: 0
            }, 300, Phaser.Easing.Sinusoidal.Out, !0).onComplete.add(this.dailyReward_showGiftWeek, this)
        }, this), this.claimBtn.addTextLabel("font-white", G.txt("Claim"), 40), this.add(this.claimBtn), game.incentivised && this.dailyReward_addDoubleBtn()
    }, G.Window.prototype.dailyReward_addDoubleBtn = function() {
        this.doubleBtn = new G.Button(0, 200, "button_purple", function() {
            G.gameTracking.design("VideoAdWatchDailyReward"), this.currentDay.doubleGift(function() {
                this.doubleBtn.inputEnabled = !1, game.add.tween(this.doubleBtn).to({
                    alpha: 0
                }, 300, Phaser.Easing.Sinusoidal.Out, !0), game.add.tween(this.claimBtn).to({
                    x: 0
                }, 300, Phaser.Easing.Elastic.Out, !0)
            }, this)
        }, this), this.add(this.doubleBtn), this.doubleBtn.doubleTxt = new G.Text(-30, 0, "2x", {
            style: "font-white",
            fontSize: 45
        }, .5), this.doubleBtn.addChild(this.doubleBtn.doubleTxt), this.doubleBtn.movieIcon = G.makeImage(30, 0, "btn-movie-icon", .5, this.doubleBtn), game.add.tween(this.claimBtn).to({
            x: -120
        }, 700, Phaser.Easing.Elastic.Out, !0), game.add.tween(this.doubleBtn).to({
            x: 120
        }, 700, Phaser.Easing.Elastic.Out, !0).onComplete.add(function() {
            this.doubleBtn.inputEnabled = !0, this.doubleBtn.inputEnabled = !0
        }, this)
    }, G.Window.prototype.dailyReward_showGiftWeek = function(t) {
        game.add.tween(this).to({
            y: -70
        }, 300, Phaser.Easing.Sinusoidal.InOut, !0), game.add.tween(this.bgBottom).to({
            y: 25
        }, 300, Phaser.Easing.Sinusoidal.Out, !0), this.week = this.add(new G.DailyRewardWeek(0, 15, this.dayNr)), this.comeBackTxt = this.add(new G.Text(0, 255, G.txt("Come back tomorrow for more rewards!"), {
            fill: "#008aca",
            font: "Lobster",
            fontSize: "30px",
            lineSpacing: -20
        }, .5, 400, null, !0, "center")), this.comeBackTxt.scale.setTo(0), game.add.tween(this.comeBackTxt.scale).to({
            x: 1,
            y: 1
        }, 600, Phaser.Easing.Elastic.Out, !0, 200), this.timerBg = G.makeImage(0, 318, "future_day_box_big", .5, this), this.timerBg.height = 40, this.timerBg.alpha = 0, game.add.tween(this.timerBg).to({
            alpha: 1
        }, 600, Phaser.Easing.Sinusoidal.Out, !0, 600), this.timer = new G.TextTimer(0, 320, 864e5 * G.saveState.data.dailyReward.nextDaily, {
            fill: "#008aca",
            font: "Lobster",
            fontSize: "35px"
        }, .5), this.add(this.timer), this.timer.alpha = 0, game.add.tween(this.timer).to({
            alpha: 1
        }, 600, Phaser.Easing.Sinusoidal.Out, !0, 600), this.coolBtn = new G.Button(0, 405, "button_green", function() {
            this.coolBtn.inputEnabled = !1, game.add.tween(this.coolBtn.scale).to({
                x: 0,
                y: 0
            }, 300, Phaser.Easing.Cubic.In, !0), this.closeWindow(), G.sb("showMainHighscorePanel").dispatch()
        }, this), this.coolBtn.addTextLabel("font-white", G.txt("Cool"), 40), this.coolBtn.scale.setTo(0), game.add.tween(this.coolBtn.scale).to({
            x: 1,
            y: 1
        }, 300, Phaser.Easing.Cubic.Out, !0, 400), this.add(this.coolBtn)
    }, G.Window.prototype.friendBeaten = function(t, e) {
        this.addBackground("popup_background_2"), this.addCloseButton(), this.titleTxt = new G.Text(0, -272, G.txt("Score Beaten!"), {
            style: "font-white",
            fontSize: "60px"
        }, .5, 420), this.add(this.titleTxt), this.arrows = G.makeImage(0, 20, "friend_beaten_bg", .5, this), this.continueBtn = new G.Button(0, 300, "btn_orange", function() {
            G.platform.sendBeatMsg(t, e, function(t) {
                t && this.closeWindow()
            }, this)
        }, this), this.continueBtn.pulse(), this.continueBtn.addTextLabel("font-white", G.txt("Share"), 60), this.registerButtons(this.continueBtn), this.avatar1 = G.makeExtImage(50, -60, t.image || t.avatar, null, 0, this, !1, function() {
            this.width = 63, this.height = 64
        }), this.score1 = this.add(new G.Text(-130, -25, t.score, {
            font: "Lobster",
            fontSize: "50px",
            fill: "white"
        }, [0, .5], 170)), this.score1.padding.x += 10, this.score1.padding.y += 10, this.score1.setShadow(2, 3, "rgba(0,0,0,0.5)", 1), this.avatar2 = G.makeExtImage(-134, 50, e.image || e.avatar, null, 0, this, !1, function() {
            this.width = 63, this.height = 64
        }), this.score2 = this.add(new G.Text(125, 85, e.score, {
            font: "Lobster",
            fontSize: "50px",
            fill: "white"
        }, [1, .5], 170)), this.score2.padding.x += 10, this.score2.padding.y += 10, this.score2.setShadow(2, 3, "rgba(0,0,0,0.5)", 1)
    }, G.Window.prototype.friendOvertaken = function(t) {
        var e = sgSettings.config.user;
        this.addBackground("popup_background_2"), this.addCloseButton(), this.titleTxt = new G.Text(0, -272, G.txt("One step ahead!"), {
            style: "font-white",
            fontSize: "60px"
        }, .5, 420), this.add(this.titleTxt), this.continueBtn = new G.Button(0, 245, "btn_orange", function() {
            G.platform.sendOvertakenMsg(e, t, function(t) {
                t && this.closeWindow()
            }, this)
        }, this), this.continueBtn.pulse(), this.continueBtn.addTextLabel("font-white", G.txt("Share"), 60), this.registerButtons(this.continueBtn), this.avatar1 = G.makeExtImage(-8, -102, e.image || e.avatar, null, 0, this, !1, function() {
            this.width = 114, this.height = 114
        }), this.avatar2 = G.makeExtImage(-140, -75, t.image || t.avatar, null, 0, this, !1, function() {
            this.width = 68, this.height = 68
        }), this.subtitle = this.add(new G.Text(0, 120, G.txt("You've overtaken your friend"), {
            style: "font-blue",
            fontSize: 40
        }, .5, 480)), this.img = G.makeImage(0, -50, "Beat_Map_Position_Asset", .5, this)
    }, G.Window.prototype.gateNew = function(t) {
        console.log("gateNew", t), this.config = t || {};
        var e = this.config.gateData;
        this.config.lastAvatarAnim;
        G.gameTracking.design("NewGate_PopupVisible"), this.gateData = e, this.saveData = G.saveState.getGateData(e.id), this.bg = G.makeImage(0, -320, "popup_bg_top", [.5, 0], this), this.bgBottom = G.makeImage(0, -180, "popup_bg_bottom", [.5, 0], this), this.closeButton = new G.Button(230, -280, "btn_x", function() {
            G.gameTracking.design("NewGate_PopupClose"), this.closeWindow()
        }, this), this.registerButtons(this.closeButton), this.title = this.gateNew_addTitleTimer(0, -270, this.gateData, this.saveData), this.orUnlockNow = this.add(new G.Text(0, -140, G.txt("Or unlock Now"), {
            style: "font-darkBlue",
            fontSize: "35px"
        }, .5, 430)), this.stars = this.gateNew_addStarsPanel(0, -36, this.gateData, this.saveData), this.orTwo = this.add(new G.Text(0, 67, G.txt("or"), {
            style: "font-darkBlue",
            fontSize: "35px"
        }, .5, 430)), this.coins = this.gateNew_addCoinsPanel(0, 178, this.gateData, this.saveData)
    }, G.Window.prototype.gateNew_addTitleTimer = function(t, e, i, s) {
        var a = this.add(game.make.group());
        a.position.setTo(t, e), a.timerBg = G.makeImage(0, 20, "timer_box", .5, a);
        var n = 60 * i.req.timeMinutes - (Date.now() - s.timerStartedAt) / 1e3;
        return a.timer = new G.TextTimer(0, 24, 0, {
            style: "font-white",
            fontSize: "40px"
        }, .5, 400), a.timer.setSecLeft(n), a.timer.start(), a.add(a.timer), a.title = new G.Text(0, -20, G.txt("New levels in"), {
            style: "font-white",
            fontSize: "40px"
        }, .5, 400), a.add(a.title), a
    }, G.Window.prototype.gateNew_addFriendsPanel = function(t, e, i, s, a) {
        var n = this.add(game.make.group());
        return n.position.setTo(t, e), n.bg = G.makeImage(0, 0, "options_box", .5, n), n.avatars = this.gateNew_createAvatars(-150, 0, 195, i, s, a), n.add(n.avatars), n.buyBtn = n.add(new G.Button(105, 0, "Yellow_Button", function() {
            G.gameTracking.design("NewGate_PopupAskFriends"), G.platform.sendRequestForGate(function() {
                G.gameTracking.design("NewGate_PopupAskFriendSent")
            }, this, this.gateData.id)
        }, this)), n.buyBtn.addTerm(function() {
            return !s.open
        }), s.open && (n.buyBtn.inputEnalbed = !1, n.buyBtn.alpha = .5), n.buyBtnLabel = n.buyBtn.addChild(new G.Text(0, -5, G.txt("Ask Friend!"), {
            style: "font-white",
            fontSize: "40px"
        }, .5, Math.floor(.9 * n.buyBtn.width))), n.buyBtn.scale.setTo(.8), n
    }, G.Window.prototype.gateNew_TEST = function(t, e, i) {
        G.Window.prototype.gateNew_createAvatars(t, e, i, 1), G.Window.prototype.gateNew_createAvatars(t, e + 50, i, 2), G.Window.prototype.gateNew_createAvatars(t, e + 100, i, 3), G.Window.prototype.gateNew_createAvatars(t, e + 150, i, 4), G.Window.prototype.gateNew_createAvatars(t, e + 200, i, 5), G.Window.prototype.gateNew_createAvatars(t, e + 250, i, 6), G.Window.prototype.gateNew_createAvatars(t, e + 300, i, 7)
    }, G.Window.prototype.gateNew_createAvatars = function(t, e, i, s, a, n) {
        var o = s.req.invites || 3,
            r = game.make.group();
        r.position.setTo(t, e);
        for (var h = (i - 48 * o) / Math.max(1, o - 1), l = Math.min(70, 48 + h), d = a.invitesList || [], c = a.avatarsList || [], u = null, p = 0; p < o; p++) {
            var g = p * Math.abs(l),
                f = this.gateNew_friendAvatar(g, 0, !1);
            if (r.add(f), d[p]) {
                var m = this.gateNew_friendAvatar(p * Math.abs(l), 0, d[p], c[p]);
                u = m, r.add(m)
            }
        }
        return n && u && (u.width = u.height = 96, u.alpha = 0, game.add.tween(u).to({
            width: 48,
            height: 48,
            alpha: 1
        }, 500, Phaser.Easing.Sinusoidal.Out, !0, 1e3).onComplete.add(function() {
            console.log("^^ onTween complete", a), a.open && game.time.events.add(1e3, this.closeWindow, this)
        }, this)), r
    }, G.Window.prototype.gateNew_friendAvatar = function(t, e, i, s) {
        return i ? s ? G.makeExtImage(t, e, s, "avatar_m", .5, null, !1, function() {
            this.width = this.height = 48
        }) : G.makeImage(t, e, game.rnd.pick(["avatar_f", "avatar_m"]), .5) : G.makeImage(t, e, "avatar_e", .5)
    }, G.Window.prototype.gateNew_addStarsPanel = function(t, e, i, s) {
        var a = G.saveState.getAllStars(),
            n = this.add(game.make.group());
        return n.position.setTo(t, e), n.bg = G.makeImage(0, 0, "options_box", .5, n), n.collectMoreStars = n.add(new G.Text(105, 0, G.txt("Collect more stars!"), {
            style: "font-darkBlue",
            fontSize: "30px",
            lineSpacing: -20
        }, .5, 150, 80, !0, "center")), n.starIcon = G.makeImage(-147, -3, "star", .5, n), n.starIcon.scale.setTo(.6), n.starsAmount = n.add(new G.Text(-100, 0, a + "/" + i.req.stars, {
            font: "Lobster",
            fontSize: "40px",
            fill: "#FFA90F",
            stroke: "#A24A00",
            strokeThickness: 3
        }, [0, .5], 130)), n
    }, G.Window.prototype.gateNew_addCoinsPanel = function(t, e, i, s) {
        var a = this.add(game.make.group());
        return a.position.setTo(t, e), a.bg = G.makeImage(0, 0, "options_box", .5, a), a.coinIcon = G.makeImage(-145, 0, "coin_3", .5, a), a.coinIcon.scale.setTo(.6), a.amount = a.add(new G.Text(-100, 0, "x" + i.req.coins, {
            style: "font-darkBlue",
            fontSize: 40
        }, [0, .5], 130)), a.buyBtn = a.add(new G.Button(105, 0, "Yellow_Button", function() {
            G.gameTracking.design("NewGate_PopupOpenCoinBtn"), G.saveState.isEnoughToBuy(i.req.coins) ? (G.gameTracking.design("GateUnlockCoins", i.id), G.gameTracking.sink("Coins", i.id.toString, "Map", i.req.coins), G.saveState.changeCoins(-1 * i.req.coins), this.config.onOpenCallback && this.config.onOpenCallback(i.id), this.closeWindow()) : game.incentivised ? (G.sb("pushWindow").dispatch(["moreMoney", ["gateNew", this.config]]), this.closeWindow()) : (a.buyBtn.alpha = .5, a.buyBtn.inputEnabled = !1)
        }, this)), a.buyBtn.addTerm(function() {
            return !s.open
        }), s.open && (a.buyBtn.alpha = .5, a.buyBtn.inputEnalbed = !1), a.buyBtnLabel = new G.LabelTextT("$Open$@coin_1@", 0, -5, {
            style: "font-white",
            fontSize: "40px"
        }, .5, Math.floor(.9 * a.buyBtn.width)), a.buyBtn.addChild(a.buyBtnLabel), a.buyBtn.scale.setTo(.8), a
    }, G.Window.prototype.gift = function(t, e) {
        this.addBackground("popup_background_2"), this.giftMakeTitle(t), t && this.giftMakeExplanation(t), this.gift = this.add(new G.GiftBox(0, t ? 60 : 0, !1, e)), this.continueBtn = new G.Button(5, 250, "button_green", function() {
            this.continueBtn.inputEnabled = !1, this.continueBtn.visible = !1, game.add.tween(this.continueBtn).to({
                alpha: 0
            }, 300, Phaser.Easing.Sinusoidal.Out, !0), this.gift.unpack(), this.getItBtn = new G.Button(5, 250, "button_green", function() {
                this.closeWindow()
            }, this), this.getItBtn.addTextLabel("font-white", G.txt("Get it"), 50), this.registerButtons(this.getItBtn)
        }, this), this.continueBtn.addTextLabel("font-white", G.txt("Unpack it"), 50), this.registerButtons(this.continueBtn)
    }, G.Window.prototype.giftMakeTitle = function(t) {
        if ("3stars" === t) {
            this.stars = [], this.starsGroup = game.add.group();
            for (var e = 0; e < 3; e++) this.stars[e] = G.makeImage(60 * e, e % 2 == 0 ? 0 : -20, "star", [0, .5], this.starsGroup), this.stars[e].scale.setTo(.7);
            this.starsGroup.y = G.l(-272), this.titleTxt = new G.Text(0, -272, G.txt("Gift"), {
                style: "font-white",
                fontSize: "60px"
            }, [0, .5], 300), this.starsGroup.x = -.5 * (this.starsGroup.width + this.titleTxt.width + G.l(10)), this.titleTxt.x = this.starsGroup.x + this.starsGroup.width + G.l(10), this.add(this.starsGroup), this.add(this.titleTxt)
        } else this.titleTxt = new G.Text(0, -272, "achievement" == t ? G.txt("Achievement gift") : G.txt("Gift"), {
            style: "font-white",
            fontSize: "60px"
        }, .5, 400), this.add(this.titleTxt)
    }, G.Window.prototype.giftMakeExplanation = function(t) {
        var e = "3stars" == t ? G.txt("Nice job! You earned 3 stars! Enjoy your gift!") : G.txt("Nice job! You won 3 times in a row! Enjoy your gift!");
        this.explanationTxt = new G.Text(0, -130, e, {
            style: "font-blue",
            fontSize: "50px"
        }, .5, 450, 140, !0, "center"), this.add(this.explanationTxt)
    }, G.Window.prototype.giveUp = function(t, e) {
        this.state = game.state.getCurrentState(), t && this.state.windowLayer.pushWindow(t), this.addBackground("popup_background_2"), this.levelTxt = new G.Text(0, -272, "NORMAL" == this.state.mode ? G.txt("Level") + " " + (G.lvlNr + 1) : G.txt("Daily Challenge"), {
            style: "font-white",
            fontSize: "60px"
        }, .5, 440), this.add(this.levelTxt), this.loseProgressTxt = new G.Text(0, -70, G.txt("Your level progress will be lost!"), {
            style: "font-blue",
            fontSize: "45px"
        }, .5, 500, 140, !0, "center"), this.add(this.loseProgressTxt), this.continueBtn = new G.Button(0, 120, "btn_orange", function() {
            this.closeWindow()
        }, this), this.continueBtn.addTextLabel("font-white", G.txt("Continue"), 50), this.registerButtons(this.continueBtn), this.continueBtn.pulse(), this.giveUpBtn = new G.Button(0, 250, "btn_red", function() {
            game.paused = !0, game.paused = !1, G.ALL_LEVELFINISH, G.MYSTERYGIFT && G.saveState.mysteryGift_finishStreak(), G.winsInRow = 0, "CHALLENGE" === this.state.mode ? G.gameTracking.fail("DailyChallenge", this.state.getLevelDimension(), void 0, G.lvl.points) : G.gameTracking.fail(this.state.getGateDimension(), this.state.getLevelDimension(), void 0, G.lvl.points), e && e()
        }, this), this.giveUpBtn.addTextLabel("font-white", G.txt("Give up"), 50), this.registerButtons(this.giveUpBtn), G.LIVES && this.state._removedLifeAtStart && (this.brokenHeart = G.makeImage(-120, 250, "broken_heart", .5, this), this.minusOneTxt = new G.Text(-125, 250, "-1", {
            style: "font-white",
            fontSize: "35px"
        }, .5, 50), this.add(this.minusOneTxt)), this.continueBtn.visible = !1, this.giveUpBtn.visible = !1, this.giveUpBtn.visible = !0, this.continueBtn.visible = !0
    }, G.Window.prototype.globalGoals = function() {
        G.gameTracking.design("MissionWindowVisibleOnMap"), this.addBackground("popup_background_2"), this.addCloseButton(), this.closeButton.terms = [], this.myMissionTxt = new G.Text(0, -290, G.txt("My Missions"), {
            style: "font-white",
            fontSize: "50px"
        }, .5, 400), this.add(this.myMissionTxt), this.completeMissionsTxt = new G.Text(0, -250, G.txt("Complete missions to receive rewards!"), {
            style: "font-white",
            fontSize: "25px"
        }, .5, 400), this.add(this.completeMissionsTxt), this.add(new G.GlobalGoalPanelGroup(0, -140, 340))
    }, G.Window.prototype.highscoreBeaten = function(t) {
        var e = sgSettings.config.user;
        this.addBackground("popup_background_2"), this.addCloseButton(), this.titleTxt = new G.Text(0, -272, G.txt("Highscore Beaten!"), {
            style: "font-white",
            fontSize: "60px"
        }, .5, 420), this.add(this.titleTxt), this.continueBtn = new G.Button(0, 245, "btn_orange", function() {
            G.platform.sendHighscoreBeatMsg(e, t, function(t) {
                t && this.closeWindow()
            }, this)
        }, this), this.continueBtn.pulse(), this.continueBtn.addTextLabel("font-white", G.txt("Share"), 60), this.registerButtons(this.continueBtn), this.avatar1 = G.makeExtImage(-103, -134, e.image || e.avatar, null, 0, this, !1, function() {
            this.width = 98, this.height = 98
        }), this.avatar2 = G.makeExtImage(31, -75, t.image || t.avatar, null, 0, this, !1, function() {
            this.width = 100, this.height = 100
        }), this.subtitle = this.add(new G.Text(0, 120, G.txt("It's your moment to shine"), {
            style: "font-blue",
            fontSize: 40
        }, .5, 480)), this.img = G.makeImage(0, -50, "Beat_Overall_Highscore_asset", .5, this)
    }, G.Window.prototype.level = function(t) {
        var e = G.TreasureHunt.treasureHuntMgr,
            a = G.saveState,
            i = G.TreasureHunt.TreasureHuntWindowPanel,
            s = this;
        void 0 !== t && (G.lvlNr = t, G.lvlData = G.json.levels[t]);
        var n = G.lvlNr;
        game.state.getCurrentState();
        this.addBackground("popup_background_2"), this.blue_banner = G.makeImage(0, -295, G.lvlData && G.lvlData.showAsHard ? "purple_banner" : "blue_banner", .5, this), this.levelTxt = new G.Text(0, -297, G.txt("Level") + " " + (G.lvlNr + 1), {
            style: "font-white",
            fontSize: "60px"
        }, .5, 330), this.add(this.levelTxt), G.lvlData && G.lvlData.showAsHard && (this.hardIcon = G.makeImage(0, -350, "map_point_hard", .5, this), this.hardIcon.scale.setTo(.75), this.hardWarningTxt = new G.Text(0, -250, G.txt("Hard Level"), {
            style: "font-white",
            fontSize: "20px"
        }, .5), this.add(this.hardWarningTxt)), this.closeButton = new G.Button(235, -257, "btn_x", function() {
            "Game" !== game.state.current ? (this.boosters.forEach(function(t) {
                t.signalBinding && t.signalBinding.detach()
            }), this.closeWindow(), G.sb("levelWindowClose").dispatch()) : G.sb("onStateChange").dispatch("World")
        }, this), this.registerButtons(this.closeButton), this.addChild(this.closeButton);
        var o = a.getStars(G.lvlNr);
        this.stars = [G.makeImage(-100, -150, 1 <= o ? "star" : "star_blank", .5, this), G.makeImage(0, -175, 2 <= o ? "star" : "star_blank", .5, this), G.makeImage(100, -150, 3 <= o ? "star" : "star_blank", .5, this)], this.stars[0].scale.setTo(.8), this.stars[2].scale.setTo(.8), this.taskBg = G.makeImage(0, 5, "popup_bigtext_backgr", .5, this), this.taskTxt = new G.Text(0, -70, G.txt("Task") + ":", {
            style: "font-blue",
            fontSize: "45px"
        }, .5, 380), this.add(this.taskTxt), "collect" == G.lvlData.goal[0] ? this.makeTaskCollectPanels(5, G.lvlData) : this.add(new G.Text(0, 5, G.txt("points").toUpperCase() + ": " + G.lvlData.goal[1], {
            style: "font-blue",
            fontSize: "50px"
        }, .5, 380)), this.buyTxt = new G.Text(0, 90, ":", {
            style: "font-blue",
            fontSize: "35px"
        }, .5, 510), this.buyTxt.checkText = function() {
            if (this.alive) {
                var t, e = a.data.boosters,
                    i = 0 < e[5] && 0 < e[7] && 0 < e[8],
                    s = 0 === e[5] && 0 === e[7] && 0 === e[8];
                t = i ? G.txt("Activate boosters") + ":" : s ? G.txt("Buy some boosters") + ":" : G.txt("Buy or activate boosters") + ":", this.text !== t && this.setText(t)
            }
        }, this.buyTxt.checkText(), this.add(this.buyTxt), this.buyTxtBinding = G.sb("onStartBoosterSelectBounce").add(function() {
            G.stopTweens(this.buyTxt), this.buyTxt.checkText(), this.buyTxt.scale.setTo(1), game.add.tween(this.buyTxt.scale).to({
                x: 1.2,
                y: 1.2
            }, 200, Phaser.Easing.Custom.SoftBounce, !0, 0, 0, !0)
        }, this), this.buyTxt.events.onDestroy.add(function() {
            this.buyTxtBinding && this.buyTxtBinding.detach && this.buyTxtBinding.detach()
        }, this), this.boosterBg = G.makeImage(0, 170, "popup_bigtext_backgr", .5, this), this.boosters = [new G.UI_StartBoosterButton(-195, 170, 5, G.lvlNr), new G.UI_StartBoosterButton(0, 170, 7, G.lvlNr), new G.UI_StartBoosterButton(195, 170, 8, G.lvlNr)], this.addMultiple(this.boosters), G.sb("levelWindowOpen").dispatch(G.lvlNr + 1), this.continueBtn = new G.Button(0, 300, "button_green", function() {
            G.sb("onStateChange").dispatch("Game", G.lvlNr, !1, this.state.startBoosterConfig.getConfigForLevel(G.lvlNr))
        }, this), this.continueBtn.pulse(), this.continueBtn.addTextLabel("font-white", G.txt("Continue"), 70), this.registerButtons(this.continueBtn);
        var r, h = !1;
        G.MYSTERYGIFT && a.mysteryGift_isModeReady() && (h = !0, (r = new G.MysteryGiftHeader(n === a.getLastPassedLevelNr())).show(), s.onClose.add(function() {
            r.hide(function() {
                r.destroy()
            })
        }), this.y = "Game" == game.state.current ? 0 : 45), e.isEventActive() && e.isLevelTreasureHuntActive(n) && function() {
            function t() {
                var t = .5 * (game.height - 960) * .5;
                s.treasureHuntWindowPanel.y = 410 + t
            }
            s.blue_banner.changeTexture("Treasure_Hunt_header"), s.treasureHuntWindowPanel = s.add(new i({
                tutorial: !0
            })), s.y = h ? 5 : -35, s.scale.setTo(h ? .92 : 1), t(), G.Utils.cleanUpOnDestroy(s, G.sb("onScreenResize").add(t))
        }()
    }, G.Window.prototype.level_adForBoosterCheck = function() {
        var t = G.saveState.data.boosters,
            e = G.saveState.data.coins,
            i = (G.json.settings.priceOfBooster5, G.json.settings.priceOfBooster7),
            s = G.json.settings.priceOfBooster8,
            a = 0 === G.saveState.data.mysteryGift.streak,
            n = 0 === G.saveState.getStars(G.lvlNr),
            o = 0 === t[5] && 0 === t[7] && 0 === t[8],
            r = e < price && e < i && e < s;
        console.log("streakZero", a), console.log("noStars", n), console.log("noBoosters", o), console.log("noCoins", r), this.level_createAdForBoosterInit()
    }, G.Window.prototype.level_createAdForBoosterInit = function() {
        var t = this.state.startBoosterConfig.getPreLevelAdBoosterNr(G.lvlNr);
        this.adBoostBtn = new G.Button(0, 300, "medium_button_purple", function() {
            this.state.startBoosterConfig.select(G.lvlNr, t), G.saveState.data.boosters[t]++, G.sb("onStateChange").dispatch("Game", G.lvlNr, !1, this.state.startBoosterConfig.getConfigForLevel(G.lvlNr))
        }, this), this.adBoostBtn.boosterImg = G.makeImage(-95, 0, "ui_booster_" + t, .5, this.adBoostBtn), this.adBoostBtn.boosterImg.scale.setTo(.9), this.adBoostBtn.moveIcon = G.makeImage(80, 0, "btn-movie-icon", .5, this.adBoostBtn), this.adBoostBtn.continueTxt = new G.Text(0, 0, G.txt("Continue"), {
            style: "font-white",
            fontSize: 35
        }, .5, 100), this.adBoostBtn.addChild(this.adBoostBtn.continueTxt), this.registerButtons(this.adBoostBtn), this.bringToTop(this.continueBtn), this.continueBtn.stopPulse(), this.adBoostBtn.pulse(), this.continueBtn.inputEnabled = !1, this.adBoostBtn.inputEnabled = !1, game.add.tween(this.adBoostBtn).to({
            x: 125
        }, 500, Phaser.Easing.Elastic.Out, !0), game.add.tween(this.continueBtn).to({
            x: -150
        }, 500, Phaser.Easing.Elastic.Out, !0).onComplete.add(function() {
            this.continueBtn.inputEnabled = !0, this.continueBtn.input.useHandCursor = !0, this.adBoostBtn.inputEnabled = !0, this.adBoostBtn.input.useHandCursor = !0
        }, this)
    }, G.Window.prototype.makeTaskCollectPanels = function(t, e) {
        for (var i = [
                [0],
                [-85, 85],
                [-170, 0, 170],
                [-205, -65, 65, 205]
            ], s = 0, a = e.goal[1].length; s < a; s++) {
            var n = G.json.settings.goals[e.goal[1][s][0]].sprite;
            G.makeImage(i[a - 1][s] - 5, t, n, [1, .5], this).scale.setTo(.8);
            var o = new G.Text(i[a - 1][s] + 65, t, e.goal[1][s][1].toString(), {
                style: "font-blue",
                fontSize: "50px"
            }, [1, .5], 85);
            this.add(o)
        }
    }, G.Window.prototype.levelFailed = function() {
		        let pathArray = window.location.pathname.split('/');
                let newpath = '';
                if (pathArray[1] && pathArray[1] != 'arcade' && pathArray[1] != 'games') {
                   newpath = '/' + pathArray[1];
                }
                scorepost(window.location.protocol + '//' + window.location.hostname + newpath + '/index.php?act=Arcade&do=newscore', {
                  gname : 'CookieCrush3_Origon',
                  gscore: eval(JSON.parse(localStorage.getItem("gmdatastringcc3")).points.join('+'))
                });
        "NORMAL" == this.state.mode && G.ALL_LEVELFINISH, G.MYSTERYGIFT && G.saveState.mysteryGift_finishStreak(G.lvlNr === G.saveState.getLastPassedLevelNr()), "CHALLENGE" === this.state.mode ? G.gameTracking.fail("DailyChallenge", this.state.getLevelDimension(), void 0, G.lvl.points) : G.gameTracking.fail(this.state.getGateDimension(), this.state.getLevelDimension(), void 0, G.lvl.points), this.addBackground("popup_background_2"), this.closeButton = new G.Button(250, -270, "btn_x", function() {
            G.sb("onStateChange").dispatch("World")
        }, this), this.registerButtons(this.closeButton), this.levelTxt = new G.Text(0, -272, "NORMAL" == this.state.mode ? G.txt("Level") + " " + (G.lvlNr + 1) : G.txt("Daily Challenge"), {
            style: "font-white",
            fontSize: "60px"
        }, .5, 380), this.add(this.levelTxt), G.LIVES && "NORMAL" === this.state.mode && this.state._removedLifeAtStart ? this.diamon = G.makeImage(0, -75, "sad_gingy_heart_small", .5, this) : this.diamon = G.makeImage(0, -75, "failed_dimond", .5, this), G.lvl.goalMgr.isPointBased() ? this.add(new G.Text(0, 100, G.txt("points").toUpperCase() + ":\n" + G.lvl.points + "/" + G.lvl.goalMgr.getPointTarget(), {
            style: "font-blue",
            fontSize: "50px"
        }, .5, 380)) : this.makeLevelFailedTaskCollectPanels(95), "NORMAL" === this.state.mode ? (this.retryBtn = new G.Button(5, 250, "btn_orange", function() {
            game.paused = !0, game.paused = !1, G.winsInRow = 0, G.gameTracking.design("LevelRetryButtonClicked"), 0 < G.saveState.getCurrentLivesNr() || 0 < G.saveState.getUnlimitedLivesSec() ? (G.sb("pushWindow").dispatch("level"), this.closeWindow(), G.sb("onStateChange").dispatch("Game", G.lvl.lvlNr, G.debugMode)) : G.sb("onStateChange").dispatch("World")
        }, this), this.retryBtn.addTextLabel("font-white", G.txt("Retry"), 50), this.registerButtons(this.retryBtn)) : (this.continueBtn = new G.Button(0, 230, "btn_green", function() {
            game.paused = !0, game.paused = !1, G.sb("onStateChange").dispatch("World")
        }, this), this.continueBtn.addTextLabel("font-white", G.txt("Continue"), 70), this.registerButtons(this.continueBtn), game.incentivised || (this.retryBtn = this.levelFailed_retryAdButton(140, 230), G.centerElements2([this.continueBtn, this.retryBtn], 30))), this.continueBtn && (this.continueBtn.visible = !1), this.retryBtn && (this.retryBtn.visible = !1), this.closeButton && (this.closeButton.visible = !1), this.continueBtn && (this.continueBtn.visible = !0), this.retryBtn && (this.retryBtn.visible = !0), this.closeButton && (this.closeButton.visible = !0)
    }, G.Window.prototype.makeLevelFailedTaskCollectPanels = function(t) {
        var i = [
            [0],
            [-85, 85],
            [-170, 0, 170],
            [-205, -65, 65, 205]
        ];
        this.taskBg = G.makeImage(0, t, "popup_bigtext_backgr", .5, this), this.panels = [];
        for (var e = G.lvl.goal[1], s = 0, a = e.length; s < a; s++)
            if (0 < this.state.topBar.goalPanel.panels[s].amount) {
                var n = G.json.settings.goals[e[s][0]].sprite,
                    o = G.makeImage(0, t, n, .5, this);
                G.makeImage(70, 0, "task_fail", .5, o), this.panels.push(o)
            } var r = this.panels.length;
        this.panels.forEach(function(t, e) {
            t.x = G.l(i[r - 1][e] - 25)
        })
    }, G.Window.prototype.levelFailed_retryAdSuccess = function() {
        G.sb("pushWindow").dispatch(["dailyChallenge", G.saveState.getDailyChallengeLevel()]), this.closeWindow()
    }, G.Window.prototype.levelFailed_retryAdButton = function(t, e) {
        var i = this.add(game.make.group());
        return i.position.setTo(t, e), i.btn = new G.Button(0, 0, "blue_button", function() {
            G.platform.showAd(!0, this.levelFailed_retryAdSuccess, function() {
                new G.NoMoreAds
            }, this)
        }, this), i.add(i.btn), i.icon = G.makeImage(0, 0, "btn-movie-icon", .5, this), i.add(i.icon), i.text = new G.Text(0, 0, G.txt("Retry"), {
            fill: "white",
            font: "Lobster",
            fontSize: "40px"
        }, .5, 150), i.text.setShadow(2, 3, "rgba(0,0,0,0.5)", 0), i.add(i.text), G.centerElements2([i.icon, i.text], 5, -5), i.btn.width = i.icon.width + i.text.width + 5 + 80, i.btn.scale.x = Math.max(1, i.btn.scale.x), i
    }, G.Window.prototype.lifeReceived = function(t) {
        this.addBackground("popup_background_2"), this.receivedTxt = new G.Text(0, -272, G.txt("You received Lives!"), {
            style: "font-white",
            fontSize: "50px"
        }, .5, 550), this.add(this.receivedTxt), this.bigHeart = G.makeImage(15, 30, "bigheart", .5, this), this.amountTxt = new G.Text(0, 30, "+1", {
            fill: "white",
            font: "Lobster",
            fontSize: "120px",
            stroke: "#720e07",
            strokeThickness: 0
        }, .5, 150), this.add(this.amountTxt), this.youHaveTxt = new G.Text(0, -140, "You have +1 Hearts!", {
            fill: "#008aca",
            font: "Lobster",
            fontSize: "50px"
        }, .5, 470), this.add(this.youHaveTxt), this.claimBtn = new G.Button(0, 245, "button_green", function() {
            G.saveState.addLife(), this.closeWindow()
        }, this), this.claimBtn.addTextLabel("font-white", G.txt("Claim"), 45), this.registerButtons(this.claimBtn)
    }, G.Window.prototype.lifeSentSuccessfully = function(t) {
        this.addBackground("popup_background_2"), this.successTxt = new G.Text(0, -272, G.txt("Success!"), {
            style: "font-white",
            fontSize: "50px"
        }, .5, 550), this.add(this.successTxt), this.bigHeart = G.makeImage(-30, 25, "bigheart", .5, this), this.bigHeart.scale.setTo(.85), this.taskComplete = G.makeImage(66, 73, "task_complete", .5, this), this.taskComplete.scale.setTo(3.2), this.lifeSentTxt = new G.Text(0, -140, G.txt("Lives were successfully sent!"), {
            fill: "#008aca",
            font: "Lobster",
            fontSize: "50px"
        }, .5, 470), this.add(this.lifeSentTxt), this.claimBtn = new G.Button(0, 245, "btn_orange", function() {
            this.closeWindow()
        }, this), this.claimBtn.addTextLabel("font-white", G.txt("Great!"), 45), this.registerButtons(this.claimBtn)
    }, G.Window.prototype.mapChest = function(t) {
        this.addBackground("popup_background_2"), this.gifts = t, this.chest = G.makeImage(0, -35, "chest_open", .5, this), this.congratTxt = new G.Text(0, -272, G.txt("Chest Unlocked"), {
            style: "font-white",
            fontSize: "50px"
        }, .5, 550), this.add(this.congratTxt), this.youReceiveTxt = new G.Text(0, -150, G.txt("You receive") + ":", {
            style: "font-blue",
            fontSize: "50px"
        }, .5, 550), this.add(this.youReceiveTxt), this.giftsLabelGroup = new G.LabelTextT(G.gift.getLabelPackString(t), 0, 120, {
            style: "font-blue",
            fontSize: "45px"
        }, .5, 500), this.add(this.giftsLabelGroup), this.claimBtn = new G.Button(0, 245, "button_green", function() {
            this.gifts.forEach(function(t) {
                "coin" == t[0] ? (G.gameTracking.source("Coins", "Reward", "MapChest", t[1]), this.state.uiTargetParticles.createCoinBatch(game.world.bounds.x + this.chest.worldPosition.x, this.chest.worldPosition.y, this.state.panel.coinsTxt, t[1])) : (G.gameTracking.source("life" === t[0] ? "Life" : G.saveState.nrToBoosterName(t[0][8]), "Reward", "MapChest", t[1]), G.gift.applyGift(t))
            }, this), G.sb("mapChestWindowClosed").dispatch(), this.closeWindow()
        }, this), this.claimBtn.addTextLabel("font-white", G.txt("Claim"), 45), this.registerButtons(this.claimBtn)
    }, G.Window.prototype.mapGift = function(t) {
        this.giftData = G.gift.getGift(), this.addBackground("popup_background_2"), this.addCloseButton(), this.titleTxt = new G.Text(0, -272, G.txt("Gift"), {
            style: "font-white",
            fontSize: "60px"
        }, .5, 300), this.add(this.titleTxt), this.mapGift_claim()
    }, G.Window.prototype.mapGift_watch = function() {
        this.preGroup = this.add(game.make.group()), this.preGroup.y = 40, this.watchGiftImg = G.makeImage(0, -100, "icon_video_gift", [.5, .5], this.preGroup), this.watchVideoToGetTxt = new G.Text(0, 46, G.txt("Watch a video to get"), {
            style: "font-blue",
            fontSize: "50px"
        }, .5, 500), this.preGroup.add(this.watchVideoToGetTxt), this.getGiftTxt = new G.Text(0, 46, G.txt("Watch a video to get"), {
            style: "font-blue",
            fontSize: "50px"
        }, .5, 500), this.preGroup.add(this.getGiftTxt), this.watchBtn = new G.Button(0, 230, "button_play", function() {}, this), this.watchBtn.addTextLabel("font-white", G.txt("Watch"), 55, 30, -4, 260), this.registerButtons(this.watchBtn)
    }, G.Window.prototype.mapGift_claim = function() {
        G.gameTracking.FTUEDesign("FTUX_First3HGiftMade"), this.gift = this.add(new G.GiftBox(0, 0, !1, this.giftData)), this.claimBtn = new G.Button(0, 230, "medium_button_green", function() {
            G.sb("mapGiftCollect").dispatch(), this.claimBtn.visible = !1, G.saveState.data.lastMapGiftOpenTime = Date.now(), this.getItBtn = new G.Button(5, 230, "medium_button_green", function() {
                this.closeWindow()
            }, this), this.getItBtn.addTextLabel("font-white", G.txt("Continue"), 50), this.registerButtons(this.getItBtn), game.incentivised && (this.getItBtn.x = 0, this.doubleBtn = this.mapGift_addDblButton(0, 230, function() {
                G.gameTracking.design("VideoAdWatch3HGIFT")
            }), this.bringToTop(this.getItBtn), this.getItBtn.inputEnabled = !1, this.doubleBtn.inputEnabled = !1, game.add.tween(this.getItBtn).to({
                x: -102
            }, 700, Phaser.Easing.Elastic.Out, !0), game.add.tween(this.doubleBtn).to({
                x: 160
            }, 700, Phaser.Easing.Elastic.Out, !0).onComplete.add(function() {
                this.getItBtn.inputEnabled = !0, this.getItBtn.input.useHandCursor = !0, this.doubleBtn.inputEnabled = !0, this.doubleBtn.input.useHandCursor = !0
            }, this)), this.gift.unpack(), "coin" === this.giftData[0] ? G.gameTracking.source("Coins", "Reward", "FreeGift", this.giftData[1]) : "life" === this.giftData[0] ? G.gameTracking.source("Life", "Reward", "FreeGift", this.giftData[1]) : -1 !== this.giftData[0].indexOf("booster") && G.gameTracking.source(G.saveState.nrToBoosterName(this.giftData[0][8]), "Reward", "FreeGift", this.giftData[1])
        }, this), this.claimBtn.addTextLabel("font-white", G.txt("Claim"), 50), this.registerButtons(this.claimBtn)
    }, G.Window.prototype.mapGift_claimAfterWatch = function() {
        this.watchBtn.inputEnabled = !1, game.add.tween(this.watchBtn).to({
            alpha: 0
        }, 300, Phaser.Easing.Sinusoidal.Out, !0), game.add.tween(this.preGroup).to({
            alpha: 0
        }, 300, Phaser.Easing.Sinusoidal.Out, !0), this.mapGift_claim(), game.add.tween(this.claimBtn).from({
            alpha: 0
        }, 300, Phaser.Easing.Sinusoidal.Out, !0), game.add.tween(this.gift).from({
            alpha: 0
        }, 300, Phaser.Easing.Sinusoidal.Out, !0), this.gift.y = 30, this.thanksForWatching = new G.Text(0, -155, G.txt("Thanks for watching!"), {
            fontSize: "50px",
            style: "font-blue"
        }, .5, 500), this.add(this.thanksForWatching), game.add.tween(this.thanksForWatching).from({
            alpha: 0
        }, 300, Phaser.Easing.Sinusoidal.Out, !0)
    }, G.Window.prototype.mapGift_doubleSuccess = function() {
        this.gift.doubleGift(), this.dblBtn.inputEnabled = !1, game.add.tween(this.dblBtn).to({
            alpha: 0
        }, 300, Phaser.Easing.Sinusoidal.Out, !0), game.add.tween(this.getItBtn).to({
            x: 5
        }, 600, Phaser.Easing.Elastic.Out, !0)
    }, G.Window.prototype.mapGift_addDblButton = function(t, e, i) {
        var s = new G.Button(t, e, "button_purple", function() {
            i && i(), G.platform.showAd(!0, function() {
                this.mapGift_doubleSuccess()
            }, function() {
                new G.NoMoreAds
            }, this)
        }, this);
        return s.doubleTxt = new G.Text(-30, 0, "2x", {
            style: "font-white",
            fontSize: 45
        }, .5), s.addChild(s.doubleTxt), s.movieIcon = G.makeImage(30, 0, "btn-movie-icon", .5, s), this.dblBtn = s, this.registerButtons(s), s
    }, G.Window.prototype.moreMoney = function(t) {
        this.addBackground("popup_background_2"), this.addCloseButton(), t && this.state.windowLayer.pushWindow(t), this.moreCoinsTxt = new G.Text(0, -272, G.txt("Get more coins"), {
            style: "font-white",
            fontSize: "60px"
        }, .5, 400), this.add(this.moreCoinsTxt), this.preGroup = this.add(game.make.group()), this.coinImg = G.makeImage(0, -90, "icon_video_coins", [.5, .5], this.preGroup), this.watchVideoToGetTxt = new G.Text(0, 46, G.txt("Watch a video to get"), {
            style: "font-blue",
            fontSize: "50px"
        }, .5, 500), this.preGroup.add(this.watchVideoToGetTxt), this.moneyTxt = new G.LabelTextT("@coin_1@ " + G.json.settings.coinsForAd, 0, 115, {
            style: "font-blue",
            fontSize: "60px"
        }, .5, 500), this.preGroup.add(this.moneyTxt), this.watchBtn = new G.Button(0, 230, "button_play", function() {
            this.watchBtn.inputEnabled = !1, G.gameTracking.design("VideoAdWatchGetCoins"), AnbycookGP(), G.sfx.music.pause(), this.moreMoney_thanks()
        }, this), this.watchBtn.addTextLabel("font-white", G.txt("Watch"), 55, 30, -4, 260), this.registerButtons(this.watchBtn)
    }, G.Window.prototype.moreMoney_thanks = function() {
        game.add.tween(this.preGroup).to({
            alpha: 0
        }, 300, Phaser.Easing.Sinusoidal.Out, !0), this.watchBtn.inputEnabled = !1, game.add.tween(this.watchBtn).to({
            alpha: 0
        }, 300, Phaser.Easing.Sinusoidal.Out, !0), this.postGroup = this.add(game.make.group()), this.thanksForWatching = new G.Text(0, -100, G.txt("Thanks for watching!"), {
            style: "font-blue",
            fontSize: "50px"
        }, .5, 500), this.postGroup.add(this.thanksForWatching), this.moneyBg = G.makeImage(0, 25, "popup_bigtext_backgr", [.5, .5], this.postGroup), this.moneyTxt = new G.LabelTextT("@coin_1@ " + G.json.settings.coinsForAd, 0, 25, {
            style: "font-blue",
            fontSize: "60px"
        }, .5, 500), this.postGroup.add(this.moneyTxt), this.postGroup.alpha = 0, game.add.tween(this.postGroup).to({
            alpha: 1
        }, 300, Phaser.Easing.Sinusoidal.Out, !0), this.claimBtn = new G.Button(0, 230, "medium_button_green", function() {
            G.gameTracking.source("Coins", "RewardedAd", "World" == game.state.current ? "Map" : "InGame", G.json.settings.coinsForAd), "World" == game.state.current ? this.state.uiTargetParticles.createCoinBatch(game.world.bounds.x + this.moneyTxt.worldPosition.x, this.moneyTxt.worldPosition.y, this.state.panel.coinsTxt, G.json.settings.coinsForAd) : G.saveState.changeCoins(G.json.settings.coinsForAd), this.closeWindow()
        }, this), this.claimBtn.addTextLabel("font-white", G.txt("Claim"), 50), this.registerButtons(this.claimBtn), game.add.tween(this.claimBtn).from({
            alpha: 0
        }, 300, Phaser.Easing.Sinusoidal.Out, !0)
    }, G.Window.prototype.mysteryGiftLevel = function() {
        this.gfx = this.add(game.add.graphics()), this.gfx.beginFill(0, .8), this.gfx.drawRect(.6 * -game.width, -.6 * game.height, 1.2 * game.width, 1.2 * game.height), this.addBackground("popup_background_2"), this.titleTxt = new G.Text(0, -272, G.txt("Mystery Gift Level"), {
            fill: "white",
            font: "Lobster",
            fontSize: "60px"
        }, .5, 520), this.titleTxt.setShadow(2, 4, "rgba(0,0,0,0.5)", 5), this.add(this.titleTxt), this.desc = new G.Text(0, -132, G.txt("Win this level now and get a cool mystery gift!"), {
            fill: "#0089D4",
            font: "Lobster",
            fontSize: "40px",
            stroke: "#0089D4",
            lineSpacing: -15
        }, .5, 460, 120, !0, "center"), this.desc.lineSpacing = -15, this.add(this.desc), this.img = G.makeImage(0, 95, "MysteryGift_Cookie_boosts", .5, this), this.timeEvent = game.time.events.add(3e3, function() {
            this.closeWindow()
        }, this), this.coolBtn = new G.Button(0, 312, "button_green", function() {
            this.timeEvent && game.time.events.remove(this.timeEvent), this.closeWindow()
        }, this), this.coolBtn.addTextLabel("font-white", G.txt("Cool"), 50), this.registerButtons(this.coolBtn)
    }, G.Window.prototype.mysteryGiftStreakIncrese = function() {
        var t;
        this.addBackground("popup_background_2"), this.gifts = G.saveState.mysteryGift_getCurrentGifts(), this.titleTxt = new G.Text(0, -272, G.txt("A Mystery Gift"), {
            fill: "white",
            font: "Lobster",
            fontSize: "60px"
        }, .5, 520), this.titleTxt.setShadow(2, 4, "rgba(0,0,0,0.5)", 5), this.add(this.titleTxt), this.desc = new G.Text(0, -140, G.txt("You won the level with one try! Here is your Mystery Gift!"), {
            fill: "#0089D4",
            font: "Lobster",
            fontSize: "35px",
            stroke: "#0089D4",
            lineSpacing: -15
        }, .5, 460, 120, !0, "center"), this.desc.lineSpacing = -15, this.add(this.desc), t = 1 == this.gifts.length ? G.txt("Next level starts with this booster!") : G.txt("The next level starts with these boosters!") + " " + G.txt("Continue winning with one try to keep your boosters!"), this.desc2 = new G.Text(0, 200, t, {
            fill: "#0089D4",
            font: "Lobster",
            fontSize: "35px",
            stroke: "#0089D4",
            lineSpacing: -15
        }, .5, "ja" === G.lang ? 500 : 460, 120, !0, "center"), this.add(this.desc2), this.coolBtn = new G.Button(0, 312, "Yellow_Button", function() {
            this.closeWindow()
        }, this), this.coolBtn.addTextLabel("font-white", G.txt("Let's Go!"), 50), this.registerButtons(this.coolBtn), 1 === this.gifts.length ? this.mysteryGiftStreakIncrese_addGiftBox(0, 28, this.gifts) : 1 < this.gifts.length && this.mysteryGiftStreakIncrese_addSlots(0, 28, this.gifts)
    }, G.Window.prototype.mysteryGiftStreakIncrese_addGiftBox = function(t, e, i) {
        var s = G.makeImage(t, e, "popup_lighht", .5, this);
        s.update = function() {
            this.angle++
        }, s.alpha = 0;
        var a = this.add(game.make.group());
        a.position.setTo(t, e);
        var n = {
            spiral: "ui_booster_8",
            vertical: "ui_booster_4",
            horizontal: "ui_booster_3",
            cross: "ui_booster_9"
        } [i[0]];
        return a.giftIcon = G.makeImage(0, 0, n, .5, a), a.giftIcon.scale.setTo(0), a.box = G.makeImage(0, 0, "gift", .5, a), game.add.tween(a.box).to({
            width: 1.2 * a.box.width,
            height: 1.2 * a.box.height,
            alpha: 0
        }, 300, Phaser.Easing.Sinusoidal.InOut, !0, 1e3), game.add.tween(s).to({
            alpha: 1
        }, 500, Phaser.Easing.Sinusoidal.Out, !0, 1200), game.add.tween(a.giftIcon.scale).to({
            x: 1,
            y: 1
        }, 700, Phaser.Easing.Elastic.Out, !0, 1200), a
    }, G.Window.prototype.mysteryGiftStreakIncrese_addSlots = function(t, e, i) {
        var s = G.makeImage(t, e, "popup_lighht", .5, this);
        s.update = function() {
            this.angle++
        };
        for (var a = s.alpha = 0; a < 3; a++) this.add(this.mysteryGiftStreakIncrese_addSlot(140 * a - 140, e, i[a], a == i.length - 1)), a == i.length - 1 && s.position.setTo(140 * a - 140, e);
        game.add.tween(s).to({
            alpha: 1
        }, 500, Phaser.Easing.Sinusoidal.Out, !0, 1e3)
    }, G.Window.prototype.mysteryGiftStreakIncrese_addSlot = function(t, e, i, s) {
        var a = {
                spiral: "ui_booster_8",
                vertical: "ui_booster_4",
                horizontal: "ui_booster_3",
                cross: "ui_booster_9"
            } [i],
            n = G.makeImage(t, e, a || "MysteryGift_EmptyTile", .5);
        return s && (n.hiddenPanel = G.makeImage(0, 0, "MysteryGift_EmptyTile", .5, n), game.add.tween(n.hiddenPanel).to({
            width: 1.2 * n.hiddenPanel.width,
            height: 1.2 * n.hiddenPanel.height,
            alpha: 0
        }, 400, Phaser.Easing.Sinusoidal.InOut, !0, 1e3)), n
    }, G.Window.prototype.newsUpdate = function(t) {
        this.gift = ["coin", 500], this.y = -110, this.bg = this.add(new G.PopUpTileBg), this.bg.changeSize(900, !0), this.blue_banner = G.makeImage(0, -295, "blue_banner", .5, this), this.title = new G.Text(0, -297, G.txt("Good News!"), {
            style: "font-white",
            fontSize: "60px"
        }, .5, 330), this.add(this.title), this.star1 = G.makeImage(250, -286, "star", .5, this), this.star1.angle = 29, this.star2 = G.makeImage(-250, -286, "star", .5, this), this.star2.angle = -29, this.gingy = G.makeImage(0, -80, "gate_unlock_pic", .5, this), this.gingy.scale.setTo(.7), this.newFeaturesGroup = this.newsUpdate_addNewFeaturesGroup(0, 80, t.bulletPoints), this.thanksRewardGroup = this.newsUpdate_addThanksRewardGroup(0, 258), G.sb("hideMainHighscorePanel").dispatch()
    }, G.Window.prototype.newsUpdate_claim = function() {
        G.gift.applyGift(this.gift), this.closeWindow(), G.sb("showMainHighscorePanel").dispatch()
    }, G.Window.prototype.newsUpdate_addNewFeaturesGroup = function(t, e, i) {
        var s = game.make.group();
        return s.position.setTo(t, e), s.header = s.add(new G.Text(0, 0, G.txt("New Features"), {
            style: "font-blue",
            fontSize: 45
        }, .5, 500)), i.forEach(function(t, e) {
            s.add(new G.Text(0, 45 + 40 * e, "- " + G.txt(t), {
                style: "font-blue",
                fontSize: 30
            }, .5, 500))
        }), this.add(s), s
    }, G.Window.prototype.newsUpdate_addThanksRewardGroup = function(t, e) {
        var i = game.make.group();
        return i.position.setTo(t, e), i.header = i.add(new G.Text(0, 0, G.txt("...and a small thank you!"), {
            style: "font-blue",
            fontSize: 45
        }, .5, 500)), i.text = i.add(new G.Text(0, 55, G.txt("Thanks for sticking around with us! Have fun with Cookie Crush! - Softgames Team"), {
            style: "font-blue",
            fontSize: 25,
            lineSpacing: -10
        }, .5, 500, 100, !0, "center")), i.rewardBg = G.makeImage(0, 125, "popup_text_backgr", .5, i), i.rewardBg.scale.setTo(1.3), i.reward = i.add(new G.LabelTextT(G.txt("Gift") + ": @*1.2*coin_1@ 500", 0, i.rewardBg.y, {
            style: "font-blue",
            fontSize: 35
        }, .5, 240)), i.add(i.reward), i.claimBtn = i.add(new G.Button(0, 220, "button_green", this.newsUpdate_claim, this)), i.claimBtn.addTextLabel("font-white", G.txt("Claim"), 40), this.add(i), i
    }, G.Window.prototype.notEnoughLives = function() {
        this.addBackground("popup_background_2"), this.banner = G.makeImage(0, -285, "red_banner", .5, this), this.closeBtn = this.addCloseButton(), this.notEnoughHeartsTxt = new G.Text(0, -290, G.txt("Not enough Lives!"), {
            fill: "white",
            font: "Lobster",
            fontSize: "50px"
        }, .5, 360), this.notEnoughHeartsTxt.setShadow(2, 4, "rgba(0,0,0,0.5)", 0), this.add(this.notEnoughHeartsTxt), this.brokenHeart = G.makeImage(0, -40, "broken_heart_big", .5, this), this.btnBuy = this.notEnoughLives_addBuyBtn(0, 175), this.btnAd = this.notEnoughLives_addAdBtn(0, 175), game.incentivised ? this.btnBuy.visible = !1 : this.btnAd.visible = !1
    }, G.Window.prototype.notEnoughLives_addBuyBtn = function(t, e) {
        return this.buyBtn = new G.Button(t, e, "Yellow_Button", function() {
            G.gameTracking.sink("Coins", "Life", "Map", G.json.settings.lifePrice), G.saveState.changeCoins(-G.json.settings.lifePrice, !0), this.notEnoughLives_addLife()
        }, this), this.moneyTxt = new G.LabelTextT(G.json.settings.lifePrice + "@coin_1@", 0, -5, {
            style: "font-white",
            fontSize: "40px"
        }, .5, 150), this.buyBtn.addChild(this.moneyTxt), this.registerButtons(this.buyBtn), G.saveState.getCoins() < G.json.settings.lifePrice && (this.buyBtn.alpha = .5, this.buyBtn.inputEnabled = !1), this.buyBtn
    }, G.Window.prototype.notEnoughLives_adSuccess = function() {
        "World" == game.state.current ? this.notEnoughLives_addLife() : (G.saveState.addLife(G.json.settings.livesForAd), this.closeWindow())
    }, G.Window.prototype.notEnoughLives_addAdBtn = function(t, e) {
        return this.watchBtn = new G.Button(t, e, "Yellow_Button", function() {
            this.watchBtn.inputEnabled = !1, G.gameTracking.design("VideoAdWatchGetLife"), G.platform.showAd(!0, this.notEnoughLives_adSuccess, function() {
                new G.NoMoreAds, this.btnAd.visible = !1, this.btnBuy.visible = !0
            }, this)
        }, this), this.watchBtn.label = G.makeImage(0, -3, "icon_video_hearts", .5, this.watchBtn), this.watchBtn.label.scale.setTo(.35), this.registerButtons(this.watchBtn), this.watchBtn
    }, G.Window.prototype.notEnoughLives_addLife = function() {
        if ("World" == game.state.current) {
            var t = this.state.uiTargetParticles.createDividedBatch(game.world.bounds.x + this.worldPosition.x, this.worldPosition.y, "heart", this.state.panel.lifeUI.lifeIcon, 1, 1);
            t.addOnPartFinish(function() {
                G.saveState.addLife(1)
            }), t.start()
        } else G.saveState.addLife(1);
        this.closeWindow()
    }, G.Window.prototype.outOfMovesIAP = function(t) {
        this.bg = new G.PopUpFlexBg, this.add(this.bg), this.popUpConfig = t || {}, t.position && this.position.copyFrom(t.position), this.outOfMovesResolved = !1, this.onViewChange = new Phaser.Signal, this.closeBtn = this.outOfMovesIAP_addCloseBtn(), this.coinBar = new G.CoinBar(0, -380), this.coinBar.plusBtn.visible = !1, this.add(this.coinBar), this.featuresConfig = {
            failFlow: !0,
            coinTargetObject: this.coinBar
        }, this.failView = this.outOfMovesIAP_addFailView(), this.wheelGroup = new G.CoinShopWheel(this.featuresConfig), this.wheelGroup.alpha = 0, this.wheelGroup.onBoosterWon.add(this.outOfMovesIAP_resolveOutOfMoves, this), this.add(this.wheelGroup), this.currentView = null, this.views = [this.failView, this.wheelGroup], this.failView.movesBtn = this.failView.add(this.outOfMovesIAP_addBuyMovesBtn(0, 240)), this.showView(this.failView)
    }, G.Window.prototype.outOfMovesIAP_addFailView = function() {
        var t = game.make.group();
        return t.titleTxt = new G.Text(0, -272, G.txt("Out of moves!"), {
            style: "font-white",
            fontSize: "60px"
        }, .5, 440), t.add(t.titleTxt), t.info = new G.OutOfMovesInfoPanel(0, -100), t.add(t.info), t.spinBtn = new G.CoinShopSpinBtn(0, 130), t.spinBtn.onClicked.add(function() {
            this.showView(this.wheelGroup)
        }, this), t.add(t.spinBtn), this.add(t), t
    }, G.Window.prototype.outOfMovesIAP_closeWindow = function() {
        this.popUpConfig.closeCallback && this.popUpConfig.closeCallback(), this.outOfMovesResolved || G.sb("pushWindow").dispatch("levelFailed"), this.closeWindow()
    }, G.Window.prototype.outOfMovesIAP_addCloseBtn = function() {
        return this.closeButton = new G.Button(252, -265, "btn_x", function() {
            if (this.currentView === this.failView) {
                if (this.popUpConfig.preCloseCallback && !this.popUpConfig.preCloseCallback()) return;
                this.outOfMovesIAP_closeWindow()
            } else this.showView(this.failView)
        }, this), this.registerButtons(this.closeButton), this.closeButton.addTerm(function() {
            return !this.wheelGroup.isDuringSpin()
        }, this), this.closeButton
    }, G.Window.prototype.outOfMovesIAP_resolveOutOfMoves = function() {
        this.outOfMovesResolved = !0, G.saveState.changeBoosterAmount(5, 1, !0), this.state.startBoosters = [!1, !1, !1, !1, !1, !0], this.state.board.actionManager.newAction("startBoosterInit"), this.outOfMovesIAP_closeWindow()
    }, G.Window.prototype.outOfMovesIAP_addBuyMovesBtn = function(t, e) {
        var i = Math.round(1.1 * G.lvl.getPriceOfExtraMoves()),
            s = new G.Button(t, e, "medium_button_yellow", function() {
                G.saveState.getCoins() >= i ? (G.gameTracking.design("FF_5MovesBuy"), G.saveState.changeCoins(-i), G.sfx.cash_register.play(), this.outOfMovesIAP_resolveOutOfMoves()) : G.IAP && this.showView(this.catalog)
            }, this);
        return s.addTerm(function() {
            return !this.wheelGroup.isDuringSpin()
        }, this), s.orgY = e, s.icon = G.makeImage(-100, 0, "ui_booster_5", .5, s), s.priceLabel = new G.LabelTextT(i + "@coin_1@", 28, 0, {
            style: "font-white",
            fontSize: 50
        }, .5, 160), s.addChild(s.priceLabel), this.add(s), !G.IAP && !game.incentivised && i > G.saveState.data.coins && (s.visible = !1), s
    }, G.Window.prototype.outOfMovesIAP_addIAPMovesBtn = function(t, e, i) {
        G.lvl.getPriceOfExtraMoves();
        var s = new G.Button(t, e, "medium_button_yellow", function() {
            G.platform.buyAndConsumeProduct(i, function(t) {
                G.sfx.cash_register.play(), G.gameTracking.design("009Purchased_FF"), this.outOfMovesIAP_resolveOutOfMoves()
            }, this)
        }, this);
        return s.addTerm(function() {
            return !this.wheelGroup.isDuringSpin()
        }, this), s.orgY = e, s.icon = G.makeImage(-100, 0, "ui_booster_5", .5, s), s.priceLabel = new G.LabelTextT(i.price, 28, 0, {
            style: "font-white",
            fontSize: 50
        }, .5, 160), s.addChild(s.priceLabel), this.add(s), s
    }, G.Window.prototype.showView = function(e) {
        e && this.currentView !== e && (this.currentView = e, this.onViewChange.dispatch(e), this.views.forEach(function(t) {
            t === e ? (t.ignoreChildInput = !1, t.y = 0, game.add.tween(t).to({
                alpha: 1
            }, 300, Phaser.Easing.Sinusoidal.In, !0)) : (t.ignoreChildInput = !0, 0 !== t.alpha ? game.add.tween(t).to({
                alpha: 0
            }, 300, Phaser.Easing.Sinusoidal.In, !0).onComplete.add(function() {
                t.y = -9999
            }) : t.y = -9999)
        }))
    }, G.Window.prototype.overlayReward = function(t) {
        this.state = game.state.getCurrentState(), this.config = t, this.NOFADEINOUT = !0, G.sb("hideMainHighscorePanel").dispatch(), this.inputHandler = G.makeImage(0, 0, null, .5, this), this.inputHandler.inputEnabled = !0, this.inputHandler.hitArea = new Phaser.Rectangle(-2e3, -2e3, 4e3, 4e3), this.inputHandler.events.onInputDown.add(function() {
            console.log("inputHandler clicked")
        }, this), this.shine = this.overlayReward_addShine(0, 100), this.box = this.overlayReward_addBox(10, 100), this.giftsGroup = this.overlayReward_addGiftGroup(0, 200), this.giftsGroup.position = this.box.position, this.box.onOpen.add(function() {
            game.sfx.pop.play(), game.sfx.transition.play(), this.giftsGroup.showGifts(), game.add.tween(this.box).to({
                y: 300
            }, 200, Phaser.Easing.Sinusoidal.Out, !0), game.add.tween(this.shine).to({
                y: 300,
                alpha: .2
            }, 200, Phaser.Easing.Sinusoidal.Out, !0), game.time.events.add(400, function() {
                this.inputHandler.events.onInputDown.addOnce(function() {
                    this.overlayReward_goToLivesPresentation()
                }, this)
            }, this), game.time.events.add(2e3, function() {
                this.overlayReward_goToLivesPresentation()
            }, this)
        }, this)
    }, G.Window.prototype.overlayReward_goToLivesPresentation = function() {
        this.wentToLivesPresentation || (this.wentToLivesPresentation = !0, game.sfx.whoosh.play(), game.add.tween(this.box).to({
            alpha: 0
        }, 300, Phaser.Easing.Sinusoidal.Out, !0), game.add.tween(this.shine).to({
            alpha: 0
        }, 300, Phaser.Easing.Sinusoidal.Out, !0), G.stopTweens(this.giftsGroup.children[1].scale), game.add.tween(this.giftsGroup.children[1].scale).to({
            x: 0,
            y: 0
        }, 500, Phaser.Easing.Sinusoidal.Out, !0), G.stopTweens(this.giftsGroup.children[2].scale), game.add.tween(this.giftsGroup.children[2].scale).to({
            x: 0,
            y: 0
        }, 500, Phaser.Easing.Sinusoidal.Out, !0), G.stopTweens(this.giftsGroup.children[0]), game.add.tween(this.giftsGroup.children[0]).to({
            y: -420
        }, 500, Phaser.Easing.Sinusoidal.Out, !0), this.msgs = this.dailymissiongift_addMsgs(0, 50), game.add.tween(this.msgs).from({
            alpha: 0
        }, 500, Phaser.Easing.Sinusoidal.In, !0))
    }, G.Window.prototype.dailymissiongift_addMsgs = function(t, e) {
        var i = game.make.group();
        return i.position.setTo(t, e), i.congrats = i.add(new G.Text(0, 0, G.txt("Congratulations!"), {
            style: "font-white",
            fontSize: 60
        }, .5, 500)), i.youEarned = i.add(new G.Text(0, 120, this.config.endMsg, {
            style: "font-white",
            fontSize: 40,
            lineSpacing: -10
        }, .5, 500, 200, !0, "center")), i.tapAnywhere = i.add(new G.Text(0, 400, G.txt("Tap anywhere on the screen to continue."), {
            style: "font-white",
            fontSize: 40,
            lineSpacing: -10
        }, .5, 500, 200, !0, "center")), game.add.tween(i.tapAnywhere).to({
            alpha: .2
        }, 500, Phaser.Easing.Sinusoidal.InOut, !0, 0, -1, !0), this.add(i), game.time.events.add(1e3, function() {
            this.inputHandler.events.onInputDown.addOnce(this.overlayReward_finish, this)
        }, this), i
    }, G.Window.prototype.overlayReward_finish = function() {
        game.sfx.pop.play();
        var t = this.state.uiTargetParticles.init(game.world.bounds.x + this.giftsGroup.children[0].worldPosition.x, this.giftsGroup.children[0].worldPosition.y, "heart_unlimited", this.state.panel.lifeUI);
        t.onStart.add(function() {
            game.add.tween(t.scale).from({
                x: 2,
                y: 2
            }, 500, Phaser.Easing.Sinusoidal.Out, !0)
        }), t.onFinish.add(function() {
            G.gift.applyGift(this.config.gifts), G.gift.applyGift(["lifeUnlimited", this.config.unlimitedLivesMin]), this.config.onClaimCallback && this.config.onClaimCallback(), game.sfx.line.play()
        }, this), t.start(), G.sb("showMainHighscorePanel").dispatch(), this.closeWindow()
    }, G.Window.prototype.overlayReward_addShine = function(t, e) {
        var i = game.make.group();
        return i.position.setTo(t, e), i.shine1 = G.makeImage(0, 0, "shine_godrays", .5, i), i.shine1.blendMode = 1, game.add.tween(i.shine1.scale).to({
            x: 1.1,
            y: 1.1
        }, 400, Phaser.Easing.Sinusoidal.InOut, !0, 0, -1, !0), i.shine2 = G.makeImage(0, 0, "shine_godrays", .5, i), i.shine2.blendMode = 1, i.shine2.visible = !1, game.add.tween(i.shine2.scale).to({
            x: 1.1,
            y: 1.1
        }, 500, Phaser.Easing.Sinusoidal.InOut, !0, 0, -1, !0), i.update = function() {
            this.shine1.angle += .25, this.shine2.angle += 1
        }, this.add(i), i
    }, G.Window.prototype.overlayReward_addBox = function(t, e) {
        var i = game.make.group();
        i.position.setTo(t, e);
        var o = G.makeImage(0, 0, "dailymissiongift_opened", .5, i),
            s = G.makeImage(0, -40, "prezent_lid", .5, o);
        return o.inputEnabled = !0, o.input.useHandCursor = !0, i.onOpen = new Phaser.Signal, o.events.onInputDown.add(function() {
                o.inputEnabled = !1, o.opened = !0, i.onOpen.dispatch(), game.add.tween(s).to({
                    alpha: 0
                }, 500, Phaser.Easing.Sinusoidal.Out, !0)
            }),
            function t() {
                if (1 == o.alpha && o.visible && null !== o.game && !o.opened) {
                    var e = game.add.tween(o).to({
                            y: -G.l(15)
                        }, 150, Phaser.Easing.Cubic.Out),
                        i = game.add.tween(o).to({
                            y: 0
                        }, 150, Phaser.Easing.Circular.In);
                    e.chain(i), e.start();
                    var s = game.add.tween(o).to({
                            angle: -3
                        }, 100, Phaser.Easing.Cubic.InOut),
                        a = game.add.tween(o).to({
                            angle: 3
                        }, 170, Phaser.Easing.Sinusoidal.In),
                        n = game.add.tween(o).to({
                            angle: 0
                        }, 30, Phaser.Easing.Cubic.InOut);
                    s.chain(a, n), s.start(), game.time.events.add(1e3, t, this)
                }
            }(), this.add(i), i
    }, G.Window.prototype.overlayReward_addGiftGroup = function(t, e) {
        var i = game.make.group();
        i.position.setTo(t, e);
        var s = this.config.gifts;
        i.gift1 = this.overlayReward_makeGiftIcon(0, 0, ["lifeUnlimited", this.config.unlimitedLivesMin], {
            x: 10,
            y: -266,
            angle: -3,
            delay: 100
        }), i.gift2 = this.overlayReward_makeGiftIcon(0, 0, s[0], {
            x: 133,
            y: -499,
            angle: 15,
            delay: 200
        }), i.gift3 = this.overlayReward_makeGiftIcon(0, 0, s[1], {
            x: -133,
            y: -425,
            angle: -10,
            delay: 300
        });
        s = [i.gift1, i.gift2, i.gift3];
        return i.showGifts = function() {
            s.forEach(function(t) {
                t.show()
            })
        }, i.addMultiple(s), this.add(i), i
    }, G.Window.prototype.overlayReward_makeGiftIcon = function(t, e, i, s) {
        var a = game.make.group();
        if (a.position.setTo(t, e), a.scale.setTo(0), "coin" === i[0]) {
            G.gameTracking.source("Coins", "Reward", this.config.gameTrackingItemId, i[1]), G.makeImage(0, 0, "coin_3", .5, a).scale.setTo(1.2);
            var n = new G.Text(0, 40, "x" + i[1], {
                style: "font-white",
                fontSize: 50
            }, .5);
            a.add(n)
        } else if ("lifeUnlimited" === i[0]) {
            var o;
            G.makeImage(0, 0, "heart_unlimited", .5, a).scale.setTo(2), G.gameTracking.source("LifeU", "Reward", this.config.gameTrackingItemId, i[1]);
            var r = Math.floor(i[1] / 60),
                h = Math.floor(i[1] % 60);
            o = r && h ? r + "h " + h + "min" : r ? r + "h" : h + "min";
            n = new G.Text(0, 40, o, {
                style: "font-white",
                fontSize: 50
            }, .5);
            a.add(n)
        } else {
            G.gameTracking.source("life" === i[0] ? "Life" : G.saveState.nrToBoosterName(i[0][8]), "Reward", this.config.gameTrackingItemId, i[1]), G.makeImage(0, 0, G.gift.getIcon(i), .5, a).scale.setTo(1.5), G.makeImage(40, 40, "booster_ammount", .5, a).scale.setTo(1.5);
            var l = new G.Text(40, 43, i[1].toString(), {
                style: "font-blue",
                fontSize: 45
            }, .5);
            a.add(l)
        }
        return a.show = function() {
            game.add.tween(a.scale).to({
                x: 1,
                y: 1
            }, 500, Phaser.Easing.Elastic.Out, !0), game.add.tween(a).to({
                x: s.x,
                y: s.y,
                angle: s.angle
            }, 2e3, Phaser.Easing.Exponential.Out, !0)
        }, a
    }, G.Window.prototype.overlayReward2 = function(t) {
        var e = G.CommonObjects.DoubleShine;
        this.state = game.state.getCurrentState(), this.config = t, this.NOFADEINOUT = !0, G.sb("hideMainHighscorePanel").dispatch();
        this.add(((i = G.makeImage(0, 0, null, .5)).inputEnabled = !0, i.hitArea = new Phaser.Rectangle(-2e3, -2e3, 4e3, 4e3), i));
        var i, s, a = this.add(new e(0, 100));
        (s = "present" === t.boxType ? function(t, e) {
            var i = game.make.group();
            i.position.setTo(t, e);
            var s = G.makeImage(0, 0, "dailymissiongift_opened", .5, i),
                a = G.makeImage(0, -40, "prezent_lid", .5, s);
            return s.inputEnabled = !0, s.input.useHandCursor = !0, i.onOpen = new Phaser.Signal, s.events.onInputDown.add(function() {
                s.inputEnabled = !1, s.opened = !0, i.onOpen.dispatch(), game.add.tween(a).to({
                    alpha: 0
                }, 500, Phaser.Easing.Sinusoidal.Out, !0)
            }), c(s), i
        }() : function(t, e) {
            var i = game.make.group();
            i.position.setTo(t, e);
            var s = G.makeImage(0, 0, "chest", .5, i);
            return s.scale.setTo(1.7), s.inputEnabled = !0, s.input.useHandCursor = !0, i.onOpen = new Phaser.Signal, s.events.onInputDown.add(function() {
                s.changeTexture("chest_open"), s.inputEnabled = !1, s.opened = !0, i.onOpen.dispatch()
            }), c(s), i
        }(10, 100)).onOpen.add(function() {
            game.sfx.pop.play(), game.sfx.transition.play(), d.showGifts(), game.add.tween(s).to({
                y: 300
            }, 200, Phaser.Easing.Sinusoidal.Out, !0), game.add.tween(a).to({
                y: 300,
                alpha: .2
            }, 200, Phaser.Easing.Sinusoidal.Out, !0)
        }), this.add(s);
        var n, o, r, h, l, d = this.add((n = 0, o = 200, r = t.gifts, h = t.tweensSettings, (l = game.make.group()).position.setTo(n, o), l.gifts = [], r.forEach(function(t, e) {
            var i, s, a, n, o;
            l.gifts.push((s = i = 0, a = t, n = h[e], o = null, (o = "coin" === a[0] ? function(t, e, i) {
                var s = game.make.group();
                s.position.setTo(t, e), G.makeImage(0, 0, "coin_3", .5, s).scale.setTo(1.2);
                var a = new G.Text(0, 40, "x" + i[1], {
                    style: "font-white",
                    fontSize: 50
                }, .5);
                return s.add(a), s
            }(i, s, a) : "lifeUnlimited" === a[0] ? function(t, e, i) {
                var s = game.make.group();
                s.position.setTo(t, e), G.makeImage(0, 0, "heart_unlimited", .5, s).scale.setTo(2);
                var a = G.gift.getUnlimitedLivesTimeLabel(i),
                    n = new G.Text(0, 40, a, {
                        style: "font-white",
                        fontSize: 50
                    }, .5);
                return s.add(n), s
            }(i, s, a) : function(t, e, i) {
                var s = game.make.group();
                s.position.setTo(t, e), G.makeImage(0, 0, G.gift.getIcon(i), .5, s).scale.setTo(1.5), G.makeImage(40, 40, "booster_ammount", .5, s).scale.setTo(1.5);
                var a = new G.Text(40, 43, i[1].toString(), {
                    style: "font-blue",
                    fontSize: 45
                }, .5);
                return s.add(a), s
            }(i, s, a)).scale.setTo(0), o.show = function() {
                game.add.tween(o.scale).to({
                    x: 1,
                    y: 1
                }, 500, Phaser.Easing.Elastic.Out, !0), game.add.tween(o).to({
                    x: n.x,
                    y: n.y,
                    angle: n.angle
                }, 2e3, Phaser.Easing.Exponential.Out, !0)
            }, o))
        }), l.showGifts = function() {
            l.gifts.forEach(function(t) {
                t.show()
            })
        }, l.addMultiple(l.gifts), l));

        function c(t) {
            1 == t.alpha && t.visible && null !== t.game && !t.opened && (G.Animations.getBoxSmallJumpAnimation(game, t).animate(game, t), game.time.events.add(1e3, function() {
                c(t)
            }))
        }
        d.position = s.position
    }, G.Window.prototype.pause = function() {
        this.addBackground("popup_background_2"), this.addCloseButton(), this.pauseTxt = new G.Text(0, -272, G.txt("Pause"), {
            style: "font-white",
            fontSize: "60px"
        }, .5, 440), this.add(this.pauseTxt), this.homeBtn = new G.Button(-180, 80, "btn_home", function() {
            this.state.windowLayer.pushWindow(["giveUp", "pause", function() {
                G.sb("onStateChange").dispatch(G.debugMode ? "EditorWorld" : "World")
            }]), this.closeWindow()
        }, this), this.playBtn = new G.Button(0, 0, "btn_start_goal", function() {
            this.closeWindow()
        }, this), this.soundBtn = new G.SoundBtn(180, 80), this.registerButtons(this.soundBtn, this.homeBtn, this.playBtn)
    }, G.Window.prototype.payloadGift = function(t) {
        this.payloadGift = t, this.giftData = t.giftData || G.gift.getGift(this.payloadGift.type), this.addBackground("popup_background_2"), this.titleTxt = new G.Text(0, -272, G.txt("Gift"), {
            fontSize: "60px",
            style: "font-white"
        }, .5, 300), this.add(this.titleTxt), this.gift = this.add(new G.GiftBox(0, 0, !1, this.giftData)), this.claimBtn = new G.Button(0, 230, "medium_button_green", this.payloadGift_claim, this), this.claimBtn.addTextLabel("font-white", G.txt("Claim"), 50), this.registerButtons(this.claimBtn)
    }, G.Window.prototype.payloadGift_claim = function() {
        G.saveState.markMsgAsRead("payloadGifts", this.payloadGift.id), this.claimBtn.visible = !1, this.getItBtn = new G.Button(0, 230, "medium_button_green", this.closeWindow, this), this.getItBtn.addTextLabel("font-white", G.txt("Claim"), 50), this.registerButtons(this.getItBtn), game.incentivised && (this.doubleBtn = this.mapGift_addDblButton(0, 230, function() {
            G.gameTracking.design("VideoAdWatchPayloadReward")
        }), this.bringToTop(this.getItBtn), this.getItBtn.inputEnabled = !1, this.doubleBtn.inputEnabled = !1, game.add.tween(this.getItBtn).to({
            x: -102
        }, 700, Phaser.Easing.Elastic.Out, !0), game.add.tween(this.doubleBtn).to({
            x: 160
        }, 700, Phaser.Easing.Elastic.Out, !0).onComplete.add(function() {
            this.getItBtn.inputEnabled = !0, this.getItBtn.input.useHandCursor = !0, this.doubleBtn.inputEnabled = !0, this.doubleBtn.input.useHandCursor = !0
        }, this)), this.gift.unpack(), "coin" === this.giftData[0] ? G.gameTracking.source("Coins", "Reward", "PayloadGift", this.giftData[1]) : "life" === this.giftData[0] ? G.gameTracking.source("Life", "Reward", "PayloadGift", this.giftData[1]) : -1 !== this.giftData[0].indexOf("booster") && G.gameTracking.source(G.saveState.nrToBoosterName(this.giftData[0][8]), "Reward", "PayloadGift", this.giftData[1])
    }, G.Window.prototype.popUpTutorial = function(t) {
        this.addBackground("popup_background_2"), this.tutId = t, this.tutData = G.json.tutorials.POPUPTUTORIALS[t].tutorial, this.titleTxt = new G.Text(0, -272, G.txt(this.tutData.title), {
            style: "font-white",
            fontSize: 60
        }, .5, 440), this.add(this.titleTxt), G[this.tutData.module] && (console.log(this.tutData.module), this.module = new G[this.tutData.module], this.add(this.module), this.tutData.modulePos && this.module.position.copyFrom(this.tutData.modulePos)), this.tutData.button && (this.btn = new G.Button(0, 0, this.tutData.button.sprite, function() {
            G.saveState.passPopUpTutorial(this.tutId), this.closeWindow()
        }, this), this.add(this.btn), this.tutData.button.label && this.btn.addTextLabel(this.tutData.button.label.style, G.txt(this.tutData.button.label.text)), this.tutData.button.pos && this.btn.position.copyFrom(this.tutData.button.pos))
    }, G.Window.prototype.requestLives = function(t) {
        this.addBackground("popup_background_2"), this.banner = G.makeImage(0, -285, "red_banner", .5, this), this.heartBig = G.makeImage(0, -290, "bigheart", .5, this), this.heartBig.scale.setTo(.7), this.closeBtn = this.addCloseButton(), this.successTxt = new G.Text(0, -295, G.txt("Request Lives"), {
            fill: "white",
            font: "Lobster",
            fontSize: "50px"
        }, .5, 380), this.successTxt.setShadow(2, 4, "rgba(0,0,0,0.5)", 0), this.add(this.successTxt), this.pickTxt = new G.Text(0, -150, G.txt("Request Lives from a Friend!"), {
            fill: "#008aca",
            font: "Lobster",
            fontSize: "45px"
        }, .5, 470), this.add(this.pickTxt), this.contentArea = new G.ContentArea(-250, -100, 500, 380), this.sendLifeContentFrame = new G.LifeContentFrame({
            type: "REQUEST"
        }), this.contentArea.display(this.sendLifeContentFrame), this.sendLifeContentFrame.onInitialized.add(function() {
            this.contentArea.display(this.sendLifeContentFrame)
        }, this), this.add(this.contentArea)
    }, G.Window.prototype.sendLives = function(t) {
        G.gameTracking.design("SendLivesWindowVisible"), this.addBackground("popup_background_2"), this.banner = G.makeImage(0, -285, "red_banner", .5, this), this.heartBig = G.makeImage(0, -290, "bigheart", .5, this), this.heartBig.scale.setTo(.7), this.closeBtn = this.addCloseButton(), this.successTxt = new G.Text(0, -295, G.txt("Send Lives"), {
            fill: "white",
            font: "Lobster",
            fontSize: "50px"
        }, .5, 380), this.successTxt.setShadow(2, 4, "rgba(0,0,0,0.5)", 0), this.add(this.successTxt), this.pickTxt = new G.Text(0, -150, G.txt("Pick a friend to send a life!"), {
            fill: "#008aca",
            font: "Lobster",
            fontSize: "45px"
        }, .5, 470), this.add(this.pickTxt), this.contentArea = new G.ContentArea(-250, -100, 500, 380), this.sendLifeContentFrame = new G.LifeContentFrame({
            type: "SEND"
        }), this.contentArea.display(this.sendLifeContentFrame), this.sendLifeContentFrame.onInitialized.add(function() {
            this.contentArea.display(this.sendLifeContentFrame)
        }, this), this.add(this.contentArea)
    }, G.Window.prototype.taskSlider = function() {
        this.NOFADEINOUT = !0, this.y = -1.5 * game.height, G.sfx.whoosh_short_1.play(), game.add.tween(this).to({
            y: G.l(-120)
        }, 400, Phaser.Easing.Sinusoidal.Out, !0).onComplete.add(function() {
            game.time.events.add(1e3, G.sfx.whoosh_short_2.play, G.sfx.whoosh_short_2), game.add.tween(this).to({
                y: 1.5 * game.height
            }, 400, Phaser.Easing.Sinusoidal.Out, !0, 1e3).onComplete.add(function() {
                G.sb("onWindowClosed").dispatch(), this.destroy()
            }, this)
        }, this), this.addBackground("task_slider"), this.bg.y = G.l(120), this.taskTxt = new G.Text(0, 45, G.txt("Task") + ":", {
            style: "font-white",
            fontSize: "40px"
        }, .5, 380), this.add(this.taskTxt), G.lvl.goalMgr.isPointBased() ? (this.goal = new G.Text(0, 112, G.txt("points").toUpperCase() + ": " + G.lvl.goalMgr.getPointTarget(), {
            style: "font-blue",
            fontSize: "50px"
        }, .5, 380), this.add(this.goal)) : this.makeTaskCollectPanels(112, G.lvlData)
    }, G.Window.prototype.thanksForHelp = function(t) {
        this.addBackground("popup_background_2"), this.successTxt = new G.Text(0, -272, G.txt("You helped your friend"), {
            style: "font-white",
            fontSize: "50px"
        }, .5, 550), this.add(this.successTxt), this.shineBg = G.makeImage(0, 0, "reward_BG", .5, this), this.thanksBubble = G.makeImage(0, -65, "thanks_bubble", [.5, 1], this), this.thanksTxt = new G.Text(0, -110, G.txt("Thanks :)"), {
            style: "font-white",
            fontSize: 35
        }, .5, 180), this.add(this.thanksTxt), t.senderAvatar && (this.avatar = G.makeExtImage(0, 20, t.senderAvatar, "avatar_m", .5, this, !1, function() {
            this.width = this.height = 142
        }), this.avatar.width = this.avatar.height = 142), this.avatarFrame = G.makeImage(0, 20, "friend_frame", .5, this), this.continueBtn = new G.Button(0, 235, "btn_orange", function() {
            this.closeWindow()
        }, this), this.continueBtn.addTextLabel("font-white", G.txt("Great!"), 45), this.registerButtons(this.continueBtn)
    }, G.Window.prototype.treasureHuntEvent = function() {
        var t = G.Button,
            i = G.Text,
            e = G.PopUpFlexBg,
            s = G.CommonObjects.ClockTimer,
            a = G.centerElements2,
            n = G.TreasureHunt.treasureHuntMgr,
            o = (G.platform, G.TreasureHunt.TreasureHuntWindowPanel),
            r = this;
        this.y = -50;
        var h = this.add(new e);
        h.y = 90, h.changeSize(240, !0);
        l = game.add.group(r), G.makeImage(-64, -233, "Cookie_Pirate_Header", [.5, 1], l), G.makeImage(0, -177, "Treasure_Hunt_header", .5, l), l.add(new i(0, -177, G.txt("Treasure Hunt"), {
            style: "font-white",
            fontSize: 60
        }, .5, 310)), G.makeImage(76, -294, "Chest_Full", .5, l), this.add(new t(253, -196, "btn_x", c, this));
        var l;
        G.sb("hideMainHighscorePanel").dispatch();
        var d = n.getGeneralEventInfo();
        this.add(new s(0, -70)).setEndDate(Date.now() + d.duration);
        ! function() {
            var t = game.add.group(r);
            t.unlockTxt = t.add(new i(0, 0, G.txt("You unlocked a special event!"), {
                style: "font-blue",
                fontSize: 40
            }, .5, 520));
            var e = G.txt("Open [AMOUNT] Treasure Chests in [DAYS_NR] days to get a Cookie Chest!");
            e = (e = e.replace("[AMOUNT]", d.gemsTarget)).replace("[DAYS_NR]", d.durationDays), t.descTxt = t.add(new i(0, 70, e, {
                style: "font-blue",
                fontSize: 25
            }, .5, "ja" === G.lang ? 500 : 450, 100, !0, "center")), t.gem = G.makeImage(-160, 180, "gem5_small", .5, t), t.arrow1 = G.makeImage(-80, 180, "arrow_right", .5, t), t.treasureChest = G.makeImage(0, 180, "Chest_Full", .5, t), t.treasureChest.scale.setTo(.65), t.arrow2 = G.makeImage(80, 180, "arrow_right", .5, t), t.chest = G.makeImage(160, 180, "prezent", .5, t), t.chest.scale.setTo(.75), a([t.gem, t.arrow1, t.treasureChest, t.arrow2, t.chest], 10)
        }();

        function c() {
            G.sb("showMainHighscorePanel").dispatch(), r.closeWindow()
        }
        this.add(new t(0, 320, "medium_button_purple", function() {
            n.isEventReadyToStart() && n.startEvent();
            ! function() {
                var t = n.getTreasureHuntLevelIndex();
                null !== t && G.sb("pushWindow").dispatch(["level", t]);
                c()
            }()
        })).addTextLabel("font-white", G.txt("Play")), this.add(new o({
            tutorial: !0
        })).y = 435
    }, G.Window.prototype.treasureHuntMainReward = function(t) {
        var e = G.TreasureHunt.TreasureHuntProgressionPanel,
            i = G.TreasureHunt.treasureHuntMgr,
            s = (t.lastLevelCollectedGems, i.getProgressData());
        G.sb("hideMainHighscorePanel").dispatch();
        var a = this.add(new e({
                tutorial: !1,
                value: 0,
                valueTarget: s.gemsTarget,
                target: s.gemsTarget,
                sounds: {
                    onIncrease: G.sfx.pop,
                    onComplete: G.sfx.match_5
                }
            })),
            n = {
                unlimitedLivesMin: 60,
                gifts: [
                    ["booster#7", 1],
                    ["booster#8", 1]
                ],
                gameTrackingItemID: "TH",
                endMsg: G.txt("You got unlimited lives for 15 minutes!").replace("15", "60"),
                tweensSettings: [{
                    x: 10,
                    y: -266,
                    angle: -3
                }, {
                    x: 133,
                    y: -499,
                    angle: 15
                }, {
                    x: -133,
                    y: -425,
                    angle: -10
                }],
                onClaimCallback: t.onClaimCallback
            };
        game.add.tween(a.scale).from({
            x: 0,
            y: 0
        }, 1e3, Phaser.Easing.Sinusoidal.Out, !0).onComplete.add(function() {
            a.showProgress()
        }), a.onShowProgressFinish.add(function() {
            game.add.tween(a).to({
                alpha: 0
            }, 300, Phaser.Easing.Sinusoidal.Out, !0).onComplete.add(function() {
                this.overlayReward(n), game.add.tween(this).from({
                    alpha: 0
                }, 300, Phaser.Easing.Sinusoidal.Out, !0)
            }, this)
        }, this)
    }, G.Window.prototype.win = function(t) {
        this.state = game.state.getCurrentState();
        var e = G.TreasureHunt.TreasureHuntWindowPanel,
            s = (t.lvlId, t.lvlIndex),
            i = t.points,
            a = t.mysteryGiftStreakIncrease,
            n = t.treasureHunt ? t.treasureHunt.collectedGems : 0,
            o = this;
        if ("CHALLENGE" !== this.state.mode) {
            var r = G.saveState.getLastPassedLevelNr();
            this.state._removedLifeAtStart && G.saveState.addLife(), G.lvl.resultData || (G.lvl.oldStars = G.saveState.getStars(s), G.lvl.resultData = G.saveState.passLevel(s, Math.max(1, G.lvl.stars), i, !0));
            var h = G.lvl.resultData,
                l = G.lvl.oldStars;
            l < 3 && 3 == h.stars && (G.winsInRow || (G.winsInRow = 0), G.winsInRow++), "CHALLENGE" === this.state.mode ? G.gameTracking.complete("DailyChallenge", this.state.getLevelDimension(), void 0, i) : (G.gameTracking.complete(this.state.getGateDimension(), this.state.getLevelDimension(), void 0, i), 0 === s && (this.state.tut && this.state.tut.skipped ? G.gameTracking.FTUEDesign("FTUX_TutOn_Lvl001C") : G.gameTracking.FTUEDesign("FTUX_TutOff_Lvl001C")), 0 < s && s <= 9 && G.gameTracking.FTUEDesign("FTUX_Lvl0" + G.zeroPad(s + 1) + "C")), this.result = h, this.addBackground("popup_background_2"), this.banner = G.makeImage(0, -295, G.lvlData && G.lvlData.showAsHard ? "purple_banner" : "blue_banner", .5, this);
            var d = h.stars;
            this.levelTxt = new G.Text(0, -297, G.txt("Level") + " " + (s + 1), {
                style: "font-white",
                fontSize: "60px"
            }, .5, 330), this.add(this.levelTxt), G.lvlData && G.lvlData.showAsHard && (this.hardIcon = G.makeImage(0, -350, "map_point_hard", .5, this), this.hardIcon.scale.setTo(.75), this.hardWarningTxt = new G.Text(0, -250, G.txt("Hard Level"), {
                style: "font-white",
                fontSize: "20px"
            }, .5), this.add(this.hardWarningTxt)), this.youWinTxt = new G.Text(0, -70, G.txt("You win!"), {
                style: "font-blue",
                fontSize: "45px"
            }, .5, 530), this.add(this.youWinTxt), this.scoreBg = G.makeImage(20, 20, "popup_text_backgr", .5, this), this.scoreIcon = G.makeImage(-90, 20, "score_icon", .5, this), this.scoreIcon.scale.setTo(1.2), 0 < G.lvl.resultData.reward && (this.coinBg = G.makeImage(20, 120, "popup_text_backgr", .5, this), this.coinIco = G.makeImage(-90, 120, "coin_1", .5, this), this.amountTxt = new G.TextCounter(25, 120, 0, {
                style: "font-blue",
                fontSize: "45px"
            }, .5, 160), this.add(this.amountTxt), game.incentivised && this.win_addDoubleRewardBtn(150, 120, this.amountTxt, h.reward)), this.scoreTxt = new G.Text(32, 20, i.toString(), {
                style: "font-blue",
                fontSize: "45px"
            }, .5, 190), this.add(this.scoreTxt), this.retryBtn = new G.Button(-120, 240, "btn_orange", function() {
                game.paused = !0, game.paused = !1, G.sb("pushWindow").dispatch("level"), this.closeWindow()
            }, this), this.retryBtn.addTextLabel("font-white", G.txt("Retry"), 70), this.add(this.retryBtn), this.continueBtn = new G.Button(120, 240, "btn_green", function() {
                game.paused = !1;
                for (var t = JSON.parse(localStorage.getItem("gmdatastringcc3")).points, e = 0, i = 0; i < 751; i++) void 0 !== t[i] && (e += t[i]);
                try {
                    window.parent.postMessage("comandd|" + e, "*")
                } catch (t) {}
                G.sb("onAllWindowsClosed").add(function() {
                    G.sb("onStateChange").dispatch(G.debugMode ? "EditorWorld" : "World", {
                        lvlNr: s,
                        reward: G.lvl.moneyGained,
                        starImprovement: G.lvl.resultData.starImprovement,
                        mysteryGiftStreakIncrease: a,
                        treasureHuntCollectedGems: n
                    })
                }, this), (2 == s && 0 == l || 3 <= G.winsInRow && Math.random() < G.json.settings.chancesForAchievementGift) && (G.winsInRow = 0, G.sb("pushWindow").dispatch(["gift", "achievement"])), this.closeWindow()
            }, this), this.continueBtn.addTextLabel("font-white", G.txt("Continue"), 70), this.registerButtons(this.continueBtn), this.blankStars = [G.makeImage(-100, -150, "star_blank", .5, this), G.makeImage(0, -175, "star_blank", .5, this), G.makeImage(100, -150, "star_blank", .5, this)], this.blankStars[0].scale.setTo(.8), this.blankStars[2].scale.setTo(.8), this.stars = [G.makeImage(-100, -150, 1 <= d ? "star" : "star_blank", .5, this), G.makeImage(0, -175, 2 <= d ? "star" : "star_blank", .5, this), G.makeImage(100, -150, 3 <= d ? "star" : "star_blank", .5, this)], this.stars[0].scale.setTo(.8), this.stars[2].scale.setTo(.8), this.stars.forEach(function(t, e) {
                if (e + 1 <= d) {
                    var i = t.scale.x;
                    t.scale.setTo(0), game.add.tween(t.scale).to({
                        x: i,
                        y: i
                    }, 300, Phaser.Easing.Bounce.Out, !0, 800 + 200 * e).onStart.add(function() {
                        G.sfx.pop.play(), G.sfx.explosion_subtle.play(), this.add(new G.WinStarPart(t.x, t.y, !0)), this.add(new G.WinStarPart(t.x, t.y, !0)), this.add(new G.WinStarPart(t.x, t.y, !0)), this.add(new G.WinStarPart(t.x, t.y, !0)), this.add(new G.WinStarPart(t.x, t.y, !0))
                    }, this)
                } else t.visible = !1
            }, this), game.time.events.add(1e3, function() {
                0 < h.reward && (G.gameTracking.source("Coins", "Reward", "LevelCompleted", h.reward), G.gameTracking.source("Coins", "Reward", "InGameChest", G.lvl.moneyGainedChest), this.amountTxt.increaseAmount(h.reward))
            }, this), G.sb("onLevelMoneyGain").dispatch(h.reward), 0 != r && 3 !== G.lvl.stars || (this.retryBtn.visible = !1, this.continueBtn.x = 0, this.continueBtn.pulse()), t.treasureHunt && (o.banner.changeTexture("Treasure_Hunt_header"), o.TreasureHuntWindowPanel = o.add(new e({
                tutorial: !0,
                collectedGems: n
            })), o.y = -100, o.TreasureHuntWindowPanel.y = 395), this.continueBtn && (this.continueBtn.visible = !1);
            var c = null;
            this.retryBtn && (c = this.retryBtn.visible, this.retryBtn.visible = !1), this.continueBtn && (this.continueBtn.visible = !0), this.retryBtn && (this.retryBtn.visible = c)
        } else this.winChallenge(t)
    }, G.Window.prototype.win_adSuccess = function(t, e, i) {
        G.lvl.moneyGained += i, e.increaseAmount(i), t.inputEnabled = !1, game.add.tween(t).to({
            alpha: 0
        }, 300, Phaser.Easing.Sinusoidal.In, !0)
    }, G.Window.prototype.win_addDoubleRewardBtn = function(t, e, i, s) {
        var a = new G.Button(t, e, "button_purple", function() {
            G.gameTracking.design("VideoAdWatchx2CoinLvlComplete"), G.platform.showAd(!0, function() {
                this.win_adSuccess(a, i, s)
            }, function() {
                new G.NoMoreAds
            }, this)
        }, this);
        return G.makeImage(35, 0, "btn-movie-icon", .5, a), a.addTextLabel("font-white", "x2", "56px", -35, 0, 100), a.scale.setTo(.75), this.registerButtons(a), a
    }, G.Window.prototype.winChallenge = function() {
        this.addBackground("popup_background_2"), this.banner = G.makeImage(0, -295, "orange_banner", .5, this);
        var s = G.lvl.stars;
        G.saveState.passExtraLevel(s), G.gameTracking.complete("DailyChallenge", G.lvlData.lvlNumber, void 0, G.lvl.points), this.levelTxt = new G.Text(0, -297, G.txt("Daily Challenge"), {
            style: "font-white",
            fontSize: "60px"
        }, .5, 330), this.add(this.levelTxt), this.youWinTxt = new G.Text(0, -70, G.txt("You win!"), {
            style: "font-blue",
            fontSize: "45px"
        }, .5, 530), this.add(this.youWinTxt), this.scoreBg = G.makeImage(20, 20, "popup_text_backgr", .5, this), this.scoreIcon = G.makeImage(-90, 20, "score_icon", .5, this), this.scoreIcon.scale.setTo(1.2);
        var t = G.json.settings.coinsForStar[s - 1];
        0 < t && (this.coinBg = G.makeImage(20, 120, "popup_text_backgr", .5, this), this.coinIco = G.makeImage(-90, 120, "coin_1", .5, this), this.amountTxt = new G.TextCounter(25, 120, 0, {
            style: "font-blue",
            fontSize: "45px"
        }, .5, 160), this.add(this.amountTxt)), this.scoreTxt = new G.Text(32, 20, G.lvl.points.toString(), {
            style: "font-blue",
            fontSize: "45px"
        }, .5, 190), this.add(this.scoreTxt), this.continueBtn = new G.Button(0, 240, "btn_green", function() {
            G.sb("onAllWindowsClosed").add(function() {
                G.sb("onStateChange").dispatch(G.debugMode ? "EditorWorld" : "World", {
                    lvlNr: G.lvl.lvlNr,
                    reward: G.lvl.moneyGained,
                    starImprovement: s,
                    challenge: !0
                })
            }), this.closeWindow()
        }, this), this.continueBtn.addTextLabel("font-white", G.txt("Continue"), 70), this.registerButtons(this.continueBtn), this.blankStars = [G.makeImage(-100, -150, "star_blank", .5, this), G.makeImage(0, -175, "star_blank", .5, this), G.makeImage(100, -150, "star_blank", .5, this)], this.blankStars[0].scale.setTo(.8), this.blankStars[2].scale.setTo(.8), this.stars = [G.makeImage(-100, -150, 1 <= s ? "star" : "star_blank", .5, this), G.makeImage(0, -175, 2 <= s ? "star" : "star_blank", .5, this), G.makeImage(100, -150, 3 <= s ? "star" : "star_blank", .5, this)], this.stars[0].scale.setTo(.8), this.stars[2].scale.setTo(.8), this.stars.forEach(function(t, e) {
            if (e + 1 <= s) {
                var i = t.scale.x;
                t.scale.setTo(0), game.add.tween(t.scale).to({
                    x: i,
                    y: i
                }, 300, Phaser.Easing.Bounce.Out, !0, 800 + 200 * e).onStart.add(function() {
                    G.sfx.pop.play(), G.sfx.explosion_subtle.play(), this.add(new G.WinStarPart(t.x, t.y, !0)), this.add(new G.WinStarPart(t.x, t.y, !0)), this.add(new G.WinStarPart(t.x, t.y, !0)), this.add(new G.WinStarPart(t.x, t.y, !0)), this.add(new G.WinStarPart(t.x, t.y, !0))
                }, this)
            } else t.visible = !1
        }, this), game.time.events.add(1e3, function() {
            0 < t && (G.sb("onLevelMoneyGain").dispatch(t), this.amountTxt.increaseAmount(t))
        }, this)
    }, G.TutorialGrid = function() {
        Phaser.Group.call(this, game)
    }, G.TutorialGrid.prototype = Object.create(Phaser.Group.prototype), G.TutorialGrid.prototype.init = function(t, e, i, s, a) {
        this.removeAll(!0), this.tilesize = i, this.w = t, this.h = e;
        for (var n = 0; n < t; n++)
            for (var o = 0; o < e; o++) {
                var r;
                if ("string" == typeof s ? r = s : Array.isArray(s) && (r = s[(n * e + o) % s.length]), null !== r) {
                    var h = G.makeImage(n * i, o * i, r, .5, this);
                    h.scale.setTo(a || 1), h.cellX = n, h.cellY = o
                }
            }
        this.setCenterPivot()
    }, G.TutorialGrid.prototype.setCenterPivot = function() {
        this.pivot.x = (.5 * this.w - .5) * this.tilesize, this.pivot.y = (.5 * this.h - .5) * this.tilesize
    }, G.TutorialGrid.prototype.getSpriteByCell = function(e, i) {
        return this.children.find(function(t) {
            return t.cellX === e && t.cellY === i
        })
    }, G.TutorialGrid.prototype.getPxPos = function(t, e) {
        return {
            x: this.tilesize * t,
            y: this.tilesize * e
        }
    }, G.WaffleJellyTutorial = function() {
        Phaser.Group.call(this, game), this.tilesize = 90, this.goalIcon = G.makeImage(-15, -172, "dirt_s_1", .5, this), this.goalIcon.scale.setTo(.6), this.goalNumber = new G.Text(32, -170, "1", {
            style: "font-blue",
            fontSize: 40
        }, .5), this.add(this.goalNumber), this.gridBg = new G.TutorialGrid, this.add(this.gridBg), this.waffles = new G.TutorialGrid, this.add(this.waffles), this.gems = new G.TutorialGrid, this.add(this.gems), this.fxPart = new G.FxParticle, this.add(this.fxPart), this.tutHand = G.makeImage(0, 0, "tut_hand", 0, this), this.description = new G.Text(0, 190, " ", {
            style: "font-blue",
            fontSize: 35,
            lineSpacing: -15
        }, .5, 400, 200, !0, "center"), this.add(this.description), this.alpha = 0, this.stepONE()
    }, G.WaffleJellyTutorial.prototype = Object.create(Phaser.Group.prototype), G.WaffleJellyTutorial.prototype.stepONE = function() {
        if (this.game) {
            this.alpha = 0, game.add.tween(this).to({
                alpha: 1
            }, 500, Phaser.Easing.Sinusoidal.In, !0), this.goalNumber.setText("1"), this.description.setText(G.txt("Match on top of a Jelly Waffle to remove it!")), this.gridBg.init(3, 3, this.tilesize, "tut_tile", 1.2);
            var t = [0, 0, 0, 0, 1, 0, 0, 0, 0].map(function(t) {
                return 0 === t ? null : "dirt_s_1"
            });
            this.waffles.init(3, 3, this.tilesize, t, 1.2);
            var e = this.waffles.getSpriteByCell(1, 1),
                i = [3, 3, 1, 4, 3, 4, 1, 4, 1].map(function(t) {
                    return "candy_" + t
                });
            this.gems.init(3, 3, this.tilesize, i, 1.2);
            var s = this.gems.getSpriteByCell(2, 1),
                a = this.gems.getSpriteByCell(1, 1),
                n = this.gems.getPxPos(1, 1),
                o = this.gems.getPxPos(2, 1);
            this.tutHand.pivot.copyFrom(this.gems.pivot), this.tutHand.position.copyFrom(o), game.add.tween(this.tutHand).to(n, 500, Phaser.Easing.Sinusoidal.InOut, !0, 1500), game.add.tween(s).to({
                x: n.x,
                y: n.y
            }, 500, Phaser.Easing.Sinusoidal.InOut, !0, 1500), game.add.tween(s.scale).to({
                x: 1.5,
                y: 1.5
            }, 250, Phaser.Easing.Cubic.InOut, !0, 1500, 0, !0), game.add.tween(a).to({
                x: o.x,
                y: o.y
            }, 500, Phaser.Easing.Sinusoidal.InOut, !0, 1500).onComplete.add(function() {
                e.alpha = 0, this.fxPart.burstInfectionAnim(0, 0), this.fxPart.scale.setTo(1.2), this.goalNumber.setText("0"), game.add.tween(this).to({
                    alpha: 0
                }, 500, Phaser.Easing.Sinusoidal.Out, !0, 2e3).onComplete.add(function() {
                    this.stepTWO()
                }, this)
            }, this)
        }
    }, G.WaffleJellyTutorial.prototype.stepTWO = function() {
        if (this.game) {
            this.goalNumber.setText("1"), this.description.setText(G.txt("If you don't remove any, they will spread!")), this.alpha = 0, game.add.tween(this).to({
                alpha: 1
            }, 500, Phaser.Easing.Sinusoidal.In, !0), this.gridBg.init(3, 3, this.tilesize, "tut_tile", 1.2);
            var t = [0, 0, 0, 0, 1, 1, 0, 0, 0].map(function(t) {
                return 0 === t ? null : "dirt_s_1"
            });
            this.waffles.init(3, 3, this.tilesize, t, 1.2);
            var e = this.waffles.getSpriteByCell(1, 2);
            e.scale.setTo(0);
            var i = [4, 3, 1, 4, 3, 3, 1, 4, 1].map(function(t) {
                return "candy_" + t
            });
            this.gems.init(3, 3, this.tilesize, i, 1.2);
            var s = this.gems.getSpriteByCell(2, 1),
                a = this.gems.getSpriteByCell(2, 0),
                n = this.gems.getPxPos(2, 0),
                o = this.gems.getPxPos(2, 1);
            this.tutHand.pivot.copyFrom(this.gems.pivot), this.tutHand.position.copyFrom(o), game.add.tween(this.tutHand).to(n, 500, Phaser.Easing.Sinusoidal.InOut, !0, 1500), game.add.tween(s).to({
                x: n.x,
                y: n.y
            }, 500, Phaser.Easing.Sinusoidal.InOut, !0, 1500), game.add.tween(s.scale).to({
                x: 1.4,
                y: 1.4
            }, 250, Phaser.Easing.Cubic.InOut, !0, 1500, 0, !0), game.add.tween(a).to({
                x: o.x,
                y: o.y
            }, 500, Phaser.Easing.Sinusoidal.InOut, !0, 1500).onComplete.add(function() {
                game.add.tween(e.scale).to({
                    x: 1.2,
                    y: 1.2
                }, 500, Phaser.Easing.Sinusoidal.Out, !0).onComplete.add(function() {
                    this.goalNumber.setText("2")
                }, this), game.add.tween(this).to({
                    alpha: 0
                }, 500, Phaser.Easing.Sinusoidal.Out, !0, 2e3).onComplete.add(function() {
                    this.stepONE()
                }, this)
            }, this)
        }
    }, G.WorldSidePanel = G.WorldSidePanel || {}, G.WorldSidePanel.NoEvent = function() {
        Phaser.Group.call(this, game), this.bg = G.makeImage(0, 0, "completed_missions_area", [.5, 0], this), this.bg.width = 350, this.bg.height = 80, this.text = this.add(new G.Text(0, 42, G.txt("Thanks for playing!") + "\n" + G.txt("New Events coming soon!"), {
            style: "font-white",
            fontSize: 35,
            lineSpacing: -10
        }, .5, 350, 70, !0, "center"))
    }, G.WorldSidePanel.NoEvent.prototype = Object.create(Phaser.Group.prototype), G.WorldSidePanel.NoEvent.prototype.getContentHeight = function() {
        return 90
    }, G.WorldSidePanel = G.WorldSidePanel || {}, G.WorldSidePanel.Ribbon = function(t, e, i) {
        Phaser.Group.call(this, game), this.position.setTo(t, e), this.ribbon = G.makeImage(0, 10, i.ribbon, [.5, 0], this), this.ribbon.width = 350, this.text = new G.Text(0, 45, i.text, {
            style: "font-white",
            fontSize: 50
        }, .5, 260), this.add(this.text)
    }, G.WorldSidePanel.Ribbon.prototype = Object.create(Phaser.Group.prototype), G.WorldSidePanel.Ribbon.prototype.getContentHeight = function() {
        return 120
    }, G.WorldSidePanel.Ribbon.prototype.show = function(t, e) {
        G.stopTweens(this.ribbon.scale), t ? this.scale.setTo(1) : game.add.tween(this.scale).to({
            x: 1,
            y: 1
        }, 500, Phaser.Easing.Custom.SoftBounce, !0, e || 0)
    }, G.WorldSidePanel.Ribbon.prototype.hide = function(t, e) {
        G.stopTweens(this.ribbon.scale), t ? this.scale.setTo(0) : game.add.tween(this.scale).to({
            x: 0,
            y: 0
        }, 500, Phaser.Easing.Custom.SoftBounce, !0, e || 0)
    }, G.Boot = function(t) {}, G._unconsumedPurchases = [], G.Boot.prototype = {
        init: function() {
            G.extLoader = new G.ExtLoader(game), G.extLoader.crossOrigin = "anonymous", game.state.onStateChange.add(function() {
                game.input.interactiveItems.removeAll()
            }), G.sentWorldMapDesignEvent = !1, G.PRELEVEL_PER_LEVEL_LEADERBOARD = !1, G.ALL_LEVELFINISH = !0, G.PERLEVELHIGHSCORE = !0, G.LIVES = !0, G.sb = G.SignalBox, G.MYSTERYGIFT = !0, G.PERLEVEL_LEADERBOARD = !0, G.GINGY_TUTORIAL = !0, G.lang = "fr", G.Loader.currentConfig = "hd", G.Loader.currentConfigMulti = 1, this.input.maxPointers = 1, this.stage.disableVisibilityChange = !0, this.stage.backgroundColor = 16777215, game.tweens.frameBased = !1, game.time.advancedTiming = !0, this.scale.scaleMode = Phaser.ScaleManager.SHOW_ALL, this.scale.pageAlignHorizontally = !0, this.scale.pageAlignVertically = !0, this.scaleGameSizeUpdate = function() {
                game.state.current;
                var t = window.innerWidth / window.innerHeight,
                    e = game.state.getCurrentState(),
                    i = G.l(640),
                    s = G.l(960),
                    a = i / s;
                e.NOTRESIZABLE || e.NOSCALABLE || (G.horizontal = 1.2 < t, G.horizontal && game.state.current, a < t ? (game.scale.setGameSize(Math.ceil(s * t), s), i = G.l(640), game.world.setBounds(Math.ceil(-.5 * (game.width - i)), 0, game.width, game.height)) : (game.scale.setGameSize(i, Math.ceil(i * (window.innerHeight / window.innerWidth))), i = G.l(640), game.world.setBounds(Math.ceil(-.5 * (game.width - i)), 0, Math.ceil(-.5 * (game.height - s)), game.height)), G.sb("onScreenResize").dispatch(game.width, game.height))
            }, game.resizeGame = this.scaleGameSizeUpdate, this.scale.setResizeCallback(function() {
                G.old_w == window.innerWidth && G.old_h == window.innerHeight || (G.old_w = window.innerWidth, G.old_h = window.innerHeight, game.resizeGame())
            }), game.incentivised = !1, G.BuildEnvironment.production || (game.incentivised = !0), game.resizeGame()
        },
        preload: function() {
            game.plugins.add(PhaserNineSlice.Plugin), G.Loader.loadSFX = function(t) {
                t.forEach(function(t) {
                    game.load.audio(this.removeExt(t), ["assets/sfx/" + this.removeExt(t) + ".ogg", "assets/sfx/" + this.removeExt(t) + ".mp3"])
                }, this)
            }, G.Loader.loadBootAssets()
        },
        create: function() {
            game.canvas.addEventListener("click", function() {
                try {
                    game.sound.context.resume()
                } catch (t) {}
            }), game.resizeGame(), G.overlayBitmap = game.make.bitmapData(256, 256), G.overlayBitmap.fill(255, 0, 0, 1), game.state.start("Preloader")
        },
        enterIncorrectOrientation: function() {
            G.orientated = !1, document.getElementById("orientation").style.display = "block"
        },
        leaveIncorrectOrientation: function() {
            G.orientated = !0, document.getElementById("orientation").style.display = "none"
        }
    }, Phaser.Stage.prototype.visibilityChange = function(t) {
        if ("pagehide" !== t.type && "blur" !== t.type && "pageshow" !== t.type && "focus" !== t.type)
            if (document.hidden || document.mozHidden || document.msHidden || document.webkitHidden || "pause" === t.type) game.sound.mute = !0, game.input.pointers.forEach(function(t) {
                t.active = !1
            });
            else if (G.saveState.data) try {
            var e = G.saveState.data.mute;
            game.paused || (game.sound.mute = e)
        } catch (t) {
            console.log(t)
        } else game.sound.mute = !1;
        else "pagehide" === t.type || "blur" === t.type ? this.game.focusLoss(t) : "pageshow" !== t.type && "focus" !== t.type || this.game.focusGain(t)
    }, G.pad = function(t, e, i) {
        return i = i || "0", (t += "").length >= e ? t : new Array(e - t.length + 1).join(i) + t
    }, Phaser.Text.prototype.updateText = function() {
        this.texture.baseTexture.resolution = this._res, this.context.font = this.style.font;
        var t = this.text; - 1 < this.characterLimitSize && this.characterLimitSize < t.length && (t = this.text.substring(0, this.characterLimitSize) + this.characterLimitSuffix), this.style.wordWrap && (t = this.runWordWrap(this.text));
        var e = t.split(this.splitRegExp),
            i = this.style.tabs,
            s = [],
            a = 0,
            n = this.determineFontProperties(this.style.font),
            o = e.length;
        0 < this.style.maxLines && this.style.maxLines < e.length && (o = this.style.maxLines);
        for (var r = this._charCount = 0; r < o; r++) {
            if (0 === i) {
                var h = this.style.strokeThickness + this.padding.x;
                0 < this.colors.length || 0 < this.strokeColors.length || 0 < this.fontWeights.length || 0 < this.fontStyles.length ? h += this.measureLine(e[r]) : h += this.context.measureText(e[r]).width, this.style.wordWrap && (h -= this.context.measureText(" ").width)
            } else {
                var l = e[r].split(/(?:\t)/);
                h = this.padding.x + this.style.strokeThickness;
                if (Array.isArray(i))
                    for (var d = 0, c = 0; c < l.length; c++) {
                        var u = 0;
                        u = 0 < this.colors.length || 0 < this.strokeColors.length || 0 < this.fontWeights.length || 0 < this.fontStyles.length ? this.measureLine(l[c]) : Math.ceil(this.context.measureText(l[c]).width), 0 < c && (d += i[c - 1]), h = d + u
                    } else
                        for (c = 0; c < l.length; c++) {
                            0 < this.colors.length || 0 < this.strokeColors.length || 0 < this.fontWeights.length || 0 < this.fontStyles.length ? h += this.measureLine(l[c]) : h += Math.ceil(this.context.measureText(l[c]).width), h += this.game.math.snapToCeil(h, i) - h
                        }
            }
            s[r] = Math.ceil(h), a = Math.max(a, s[r])
        }
        this.canvas.width = a * this._res, this.canvas.width % 2 == 1 && (this.canvas.width = this.canvas.width + 1);
        var p, g, f = n.fontSize + this.style.strokeThickness + this.padding.y,
            m = f * o,
            G = this._lineSpacing;
        for (G < 0 && Math.abs(G) > f && (G = -f), 0 !== G && (m += 0 < G ? G * e.length : G * (e.length - 1)), this.canvas.height = m * this._res, this.canvas.height % 2 == 1 && (this.canvas.height = this.canvas.height + 1), this.context.scale(this._res, this._res), navigator.isCocoonJS && this.context.clearRect(0, 0, this.canvas.width, this.canvas.height), this.style.backgroundColor && (this.context.fillStyle = this.style.backgroundColor, this.context.fillRect(0, 0, this.canvas.width, this.canvas.height)), this.context.fillStyle = this.style.fill, this.context.font = this.style.font, this.context.strokeStyle = this.style.stroke, this.context.textBaseline = "alphabetic", this.context.lineWidth = this.style.strokeThickness, this.context.lineCap = "round", this.context.lineJoin = "round", r = this._charCount = 0; r < o; r++) p = this.style.strokeThickness / 2, g = this.style.strokeThickness / 2 + r * f + n.ascent, 0 < r && (g += G * r), "right" === this.style.align ? p += a - s[r] : "center" === this.style.align && (p += (a - s[r]) / 2), this.autoRound && (p = Math.round(p), g = Math.round(g)), 0 < this.colors.length || 0 < this.strokeColors.length || 0 < this.fontWeights.length || 0 < this.fontStyles.length ? this.updateLine(e[r], p, g) : (this.style.stroke && this.style.strokeThickness && (this.updateShadow(this.style.shadowStroke), 0 === i ? this.context.strokeText(e[r], p, g) : this.renderTabLine(e[r], p, g, !1)), this.style.fill && (this.updateShadow(this.style.shadowFill), 0 === i ? this.context.fillText(e[r], p, g) : this.renderTabLine(e[r], p, g, !0)));
        this.updateTexture(), this.dirty = !1
    };
    var saveAs = saveAs || function(r) {
        "use strict";
        if (!(void 0 === r || "undefined" != typeof navigator && /MSIE [1-9]\./.test(navigator.userAgent))) {
            var t = r.document,
                h = function() {
                    return r.URL || r.webkitURL || r
                },
                l = t.createElementNS("http://www.w3.org/1999/xhtml", "a"),
                d = "download" in l,
                c = /constructor/i.test(r.HTMLElement),
                u = function(t) {
                    (r.setImmediate || r.setTimeout)(function() {
                        throw t
                    }, 0)
                },
                p = function(t) {
                    setTimeout(function() {
                        "string" == typeof t ? h().revokeObjectURL(t) : t.remove()
                    }, 4e4)
                },
                g = function(t) {
                    return /^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(t.type) ? new Blob([String.fromCharCode(65279), t], {
                        type: t.type
                    }) : t
                },
                s = function(t, i, e) {
                    e || (t = g(t));
                    var s, a = this,
                        n = "application/octet-stream" === t.type,
                        o = function() {
                            ! function(t, e, i) {
                                for (var s = (e = [].concat(e)).length; s--;) {
                                    var a = t["on" + e[s]];
                                    if ("function" == typeof a) try {
                                        a.call(t, i || t)
                                    } catch (t) {
                                        u(t)
                                    }
                                }
                            }(a, "writestart progress write writeend".split(" "))
                        };
                    if (a.readyState = a.INIT, d) return s = h().createObjectURL(t), void setTimeout(function() {
                        var t, e;
                        l.href = s, l.download = i, t = l, e = new MouseEvent("click"), t.dispatchEvent(e), o(), p(s), a.readyState = a.DONE
                    });
                    ! function() {
                        if (n && c && r.FileReader) {
                            var e = new FileReader;
                            return e.onloadend = function() {
                                var t = e.result;
                                r.location.href = "data:attachment/file" + t.slice(t.search(/[,;]/)), a.readyState = a.DONE, o()
                            }, e.readAsDataURL(t), a.readyState = a.INIT
                        }
                        s || (s = h().createObjectURL(t)), n ? r.location.href = s : r.open(s, "_blank") || (r.location.href = s);
                        a.readyState = a.DONE, o(), p(s)
                    }()
                },
                e = s.prototype;
            return "undefined" != typeof navigator && navigator.msSaveOrOpenBlob ? function(t, e, i) {
                return e = e || t.name || "download", i || (t = g(t)), navigator.msSaveOrOpenBlob(t, e)
            } : (e.abort = function() {}, e.readyState = e.INIT = 0, e.WRITING = 1, e.DONE = 2, e.error = e.onwritestart = e.onprogress = e.onwrite = e.onabort = e.onerror = e.onwriteend = null, function(t, e, i) {
                return new s(t, e || t.name || "download", i)
            })
        }
    }("undefined" != typeof self && self || "undefined" != typeof window && window || this.content);
    "undefined" != typeof module && module.exports ? module.exports.saveAs = saveAs : "undefined" != typeof define && null !== define && null !== define.amd && define([], function() {
        return saveAs
    }), G.Editor = function(t) {
        this.game, this.add, this.camera, this.cache, this.input, this.load, this.math, this.sound, this.stage, this.time, this.tweens, this.state, this.world, this.particles, this.physics, this.rnd
    }, G.Editor.prototype = {
        init: function(t) {
            s = game.state.getCurrentState(), this.EDITOR = !0, this.NOTRESIZABLE = !0, G.lvl = {}, this.lvlIndex = t, this.lvlData = G.json.levels[t], G.lvlNr = t, G.lvl.data = G.json.levels[t], G.lvlData = G.json.levels[t], G.lvl = new G.LvlObject(t, this.lvlData)
        },
        create: function() {
            game.world.setBounds(0, 0, game.width, game.height), game.scale.setGameSize(2e3, 1500), this.txt = game.add.existing(new G.Text(0, 0, "LEVEL " + (G.lvlNr + 1), {
                style: "font-white",
                fontSize: "50px"
            }, 0, 300)), this.board = new G.Board(G.lvlData, G.l(72), !0), this.board.update = function() {}, this.board.actionManager.glowPossibleMoves = function() {}, this.board.position.setTo(50, 150), this.board.boardIce.alpha = .7, this.board.inputController.destroy(), game.input.mouse.mouseWheelCallback = function() {
                this.board.y += -50 * game.input.mouse.wheelDelta
            }.bind(this), this.dropZones = new G.EditorDropZones(this.board, G.lvlData.predefinedDrops), this.sidePanel = new G.EditorSidePanel(900), this.keys = game.input.keyboard.addKeys({
                one: Phaser.Keyboard.ONE,
                two: Phaser.Keyboard.TWO,
                three: Phaser.Keyboard.THREE,
                four: Phaser.Keyboard.FOUR,
                five: Phaser.Keyboard.FIVE,
                six: Phaser.Keyboard.SIX,
                seven: Phaser.Keyboard.SEVEN,
                eight: Phaser.Keyboard.EIGHT,
                nine: Phaser.Keyboard.NINE,
                zero: Phaser.Keyboard.ZERO,
                tilde: Phaser.Keyboard.B,
                z: Phaser.Keyboard.Z,
                x: Phaser.Keyboard.X,
                c: Phaser.Keyboard.C,
                v: Phaser.Keyboard.V,
                b: Phaser.Keyboard.B,
                n: Phaser.Keyboard.N,
                m: Phaser.Keyboard.M,
                l: Phaser.Keyboard.L,
                Q: Phaser.Keyboard.Q,
                W: Phaser.Keyboard.W,
                E: Phaser.Keyboard.E,
                R: Phaser.Keyboard.R,
                T: Phaser.Keyboard.T,
                Y: Phaser.Keyboard.Y,
                U: Phaser.Keyboard.U,
                P: Phaser.Keyboard.P,
                A: Phaser.Keyboard.A,
                S: Phaser.Keyboard.S,
                D: Phaser.Keyboard.D,
                F: Phaser.Keyboard.F,
                G: Phaser.Keyboard.G,
                SPACE: Phaser.Keyboard.SPACEBAR,
                ENTER: Phaser.Keyboard.ENTER
            }), this.keys.one.onDown.add(function() {
                this.dbgChangeCandy("1")
            }, this), this.keys.two.onDown.add(function() {
                this.dbgChangeCandy("2")
            }, this), this.keys.three.onDown.add(function() {
                this.dbgChangeCandy("3")
            }, this), this.keys.four.onDown.add(function() {
                this.dbgChangeCandy("4")
            }, this), this.keys.five.onDown.add(function() {
                this.dbgChangeCandy("5")
            }, this), this.keys.six.onDown.add(function() {
                this.dbgChangeCandy("6")
            }, this), this.keys.seven.onDown.add(function() {
                this.dbgChangeCandy("r")
            }, this), this.keys.eight.onDown.add(function() {
                this.dbgChangeCandy("chest")
            }, this), this.keys.nine.onDown.add(function() {
                this.dbgChangeCandy("goalCandy")
            }, this), this.keys.S.onDown.add(function() {
                this.dbgChangeCandy("infection")
            }, this), this.keys.tilde.onDown.add(function() {
                this.dbgChangeCandyIntoSpecial()
            }, this), this.keys.ENTER.onDown.add(function() {
                var t = document.createElement("canvas");
                t.width = game.canvas.width, t.height = game.canvas.height;
                var e = t.getContext("2d");
                e.rect(0, 0, game.canvas.width, game.canvas.height), e.fillStyle = "#7cd010", e.fill(), e.drawImage(game.canvas, 0, 0), console.log("ENTER"), t.toBlob(function(t) {
                    saveAs(t, (G.lvlNr + 1).toString().padStart(3, "0") + ".png")
                })
            }), this.keys.SPACE.onDown.add(function() {
                for (var t = 0; t < 8; t++)
                    for (var e = 0; e < 8; e++)
                        if (this.board.isCellOnBoard(t, e)) {
                            var i = this.board.getCandy(t, e);
                            i && i.destroy(), this.board.boardCandies.newCandy(t, e, this.board.getRandomThatDoesntMatch(t, e))
                        }
            }, this), this.keys.zero.onDown.add(function() {
                for (var t = 0; t < 10; t++)
                    for (var e = 0; e < 10; e++)
                        if (this.board.isCellOnBoard(t, e)) {
                            var i = this.board.getCandy(t, e);
                            i && i.destroy(), this.board.boardCandies.newCandy(t, e, "r")
                        }
            }, this), this.keys.P.onDown.add(function() {
                var t = this.board.inputController.pointerToCell(game.input.activePointer);
                if (t && this.board.isCellOnBoard(t)) {
                    var e = this.board.getCandy(t[0], t[1]);
                    e && "infection" !== e.candyType && (e.infected ? e.infect() : e.removeInfection())
                }
            }, this), this.keys.A.onDown.add(function() {
                var t = this.board.inputController.pointerToCell(game.input.activePointer);
                if (t && this.board.isCellOnBoard(t)) {
                    var e = this.board.getCandy(t[0], t[1]);
                    e && "infection" !== e.candyType && (e.wrapped ? e.unwrap() : e.wrap())
                }
            }, this), this.keys.D.onDown.add(function() {
                var t = this.board.inputController.pointerToCell(game.input.activePointer);
                if (t && this.board.isCellOnBoard(t)) {
                    var e = this.board.getCandy(t[0], t[1]);
                    e && "infection" !== e.candyType && (e.blocker ? 1 == e.blockerHp ? e.removeBlocker() : e.changeIntoBlocker(e.blockerHp - 1) : e.changeIntoBlocker(3))
                }
            }, this), this.keys.W.onDown.add(function() {
                this.changeHpToken(this.board.boardIce)
            }, this), this.keys.Y.onDown.add(function() {
                var e = this.board.inputController.pointerToCell(game.input.activePointer);
                if (e) {
                    if ("X" == this.board.boardData.get(e[0], e[1])) return this.board.boardData.set(e[0], e[1], null), void this.board.boardBackground.redraw();
                    this.board.boardData.set(e[0], e[1], "X"), this.board.boardBackground.redraw(), this.board.layers.forEach(function(t) {
                        t.grid.get(e[0], e[1]) && t.removeToken(e[0], e[1])
                    }, this)
                }
            }, this), this.keys.U.onDown.add(function() {
                this.changeHpToken(this.board.boardIce)
            }, this), this.keys.E.onDown.add(function() {
                this.changeHpToken(this.board.boardCage)
            }, this), this.keys.R.onDown.add(function() {
                this.changeHpToken(this.board.boardDirt)
            }, this), this.keys.F.onDown.add(function() {
                this.changeHpToken(this.board.boardDirtS)
            }, this), this.keys.G.onDown.add(function() {
                this.changeHpToken(this.board.boardJam)
            }, this), this.keys.T.onDown.add(function() {
                var t = this.board.inputController.pointerToCell(game.input.activePointer);
                t && this.board.getCandy(t[0], t[1]) && this.board.removeCandy(t[0], t[1])
            }, this), this.keys.z.onDown.add(function() {
                this.sidePanel.exportLevel();
                for (var t = G.lvlData.levelData.length, e = G.lvlData.levelData, i = G.Utils.clone(e), s = t % 2 == 0 ? .5 * t : Math.floor(.5 * t), a = 0; a < s; a++) i[a] = G.Utils.clone(e[a]), i[t - (a + 1)] = G.Utils.clone(e[a]);
                G.lvlData.levelData = i, game.state.start("Editor", !0, !1, G.lvlNr)
            }, this), this.keys.x.onDown.add(function() {
                this.sidePanel.exportLevel();
                for (var t = G.lvlData.levelData[0].length, e = G.lvlData.levelData, i = G.Utils.clone(e), s = t % 2 == 0 ? .5 * t : Math.floor(.5 * t), a = 0; a < e.length; a++)
                    for (var n = 0; n < s; n++) i[a][t - (n + 1)] = G.Utils.clone(i[a][n]);
                G.lvlData.levelData = i, game.state.start("Editor", !0, !1, G.lvlNr)
            }, this), this.keys.c.onDown.add(function() {
                var t = this.board.inputController.pointerToCell(game.input.activePointer);
                t && this.board.boardCollectCells.editorChangeCC(t[0], t[1])
            }, this)
        },
        update: function() {},
        changeHpToken: function(t) {
            var e = this.board.inputController.pointerToCell(game.input.activePointer);
            if (e) {
                var i = e[0],
                    s = e[1];
                if (this.board.isCellOnBoard(i, s)) {
                    var a = t.getToken(i, s);
                    if (a) {
                        var n = a.hp;
                        console.log("changeHpToken", n), t.destroyCell(i, s), n < t.config.maxHp && t.createToken(i, s, n + 1)
                    } else console.log("create token"), t.createToken(i, s, 1)
                }
            }
        },
        changeBoardSize: function(e, i) {
            e = game.math.clamp(e, 4, 10), i = game.math.clamp(i, 4, 10);
            var t = this.board.boardData;
            this.board.boardData = new G.GridArray(e, i, null), t.loop(function(t, e, i, s) {
                this.board.boardData.isInGrid(e, i) && "X" == t && this.board.boardData.set(e, i, "X")
            }, this), this.board.boardBackground.redraw(), this.board.layers.forEach(function(s) {
                var t = s.grid;
                s.grid = new G.GridArray(e, i, !1), t.loop(function(t, e, i) {
                    s.grid.isInGrid(e, i) ? s.grid.set(e, i, t) : t && t.destroy && t.destroy()
                })
            }), G.sb("editorChangedBoardSize").dispatch()
        },
        dbgChangeCandy: function(t) {
            var e = this.board.inputController.pointerToCell(game.input.activePointer);
            if (e && this.board.isCellOnBoard(e)) {
                var i = this.board.getCandy(e[0], e[1]);
                i && i.destroy(), this.board.boardCandies.newCandy(e[0], e[1], t)
            }
        },
        dbgChangeCandyIntoSpecial: function(t) {
            var e = this.board.inputController.pointerToCell(game.input.activePointer);
            if (e && this.board.isCellOnBoard(e)) {
                var i = this.board.getCandy(e[0], e[1]);
                if (!i) return;
                var s = i.candyType;
                console.log("candyType", s), !1 === i.specialType ? i.changeInto("horizontal", !0) : "horizontal" === i.specialType ? (i.destroy(), this.board.boardCandies.newCandy(e[0], e[1], s).changeInto("vertical", !0)) : "vertical" === i.specialType ? (i.destroy(), this.board.boardCandies.newCandy(e[0], e[1], s).changeInto("cross", !0)) : "cross" === i.specialType ? (i.destroy(), this.board.boardCandies.newCandy(e[0], e[1], s).changeInto("spiral", !0)) : "spiral" === i.specialType && (i.destroy(), this.board.boardCandies.newCandy(e[0], e[1], "1"))
            }
        },
        render: function() {
            game.debug.text(game.time.fps, 300, 10, "#ff0000");
            var t = this.board.inputController.pointerToCell(game.input.activePointer);
            if (game.debug.text(this.board.inputController.isPointerInRange(game.input.activePointer), 10, 10, "#ff0000"), game.debug.text(t, 10, 40, "#ff0000"), game.debug.text(this.board.isCellOnBoard(this.board.inputController.pointerToCell(game.input.activePointer)), 10, 80, "#ff0000"), t) {
                var e = this.board.getCandy(t[0], t[1]);
                e && game.debug.text(e.candyType, 10, 150, "#ff0000")
            }
        },
        shutdown: function() {
            G.IMMEDIATE = !1, game.input.mouse.mouseWheelCallback = null
        }
    }, G.EditorWorld = function(t) {}, G.EditorWorld.prototype = {
        init: function(t) {
            s = game.state.getCurrentState(), this.NOTRESIZABLE = !0, this.EDITOR = !0, this.lastLvlIndex = null, "object" == typeof t ? this.lastLvlIndex = t.lvlNr : "number" == typeof t && (this.lastLvlIndex = t), this.fillSaveState3Stars(), this.selectedLevels = []
        },
        create: function() {
            game.world.setBounds(0, 0, game.width, game.height), game.scale.setGameSize(2300, 1300), this.map = new G.WorldMap(G.json.settings.mapTiles, [], G.json.levels, !0), this.map.onGateOpen.add(this.openGate, this), this.sidePanel = new G.EditorWorldSidePanel(1400, 10), this.keys = game.input.keyboard.addKeys({
                C: Phaser.Keyboard.C,
                M: Phaser.Keyboard.M,
                CTRL: Phaser.Keyboard.CONTROL
            }), this.cursors = game.input.keyboard.createCursorKeys(), game.input.onDown.add(function(t) {
                var e = Math.floor((t.worldX - this.map.x) * (1 / G.Loader.currentConfigMulti)),
                    i = Math.floor((t.worldY - this.map.y) * (1 / G.Loader.currentConfigMulti));
                this.keys.C.isDown && (this.map.lvlBtnGroup.add(G.makeImage(e, i, "map_point", .5)), G.json.levels.push({
                    mapX: e,
                    mapY: i,
                    moves: 30,
                    rainbowChance: 2,
                    nrOfTypes: 5,
                    goal: ["collect", [
                        ["1", 5],
                        ["2", 5],
                        ["3", 5],
                        ["4", 5]
                    ]],
                    starsReq: [5e3, 7500, 1e4],
                    drops: [],
                    levelData: [
                        [
                            ["1"],
                            ["3"],
                            ["1"],
                            ["4"],
                            ["1"]
                        ],
                        [
                            ["2"],
                            ["3"],
                            ["2"],
                            ["3"],
                            ["4"]
                        ],
                        [
                            ["4"],
                            ["1"],
                            ["2"],
                            ["1"],
                            ["2"]
                        ],
                        [
                            ["1"],
                            ["4"],
                            ["4"],
                            ["3"],
                            ["1"]
                        ],
                        [
                            ["2"],
                            ["1"],
                            ["3"],
                            ["2"],
                            ["4"]
                        ],
                        [
                            ["3"],
                            ["4"],
                            ["1"],
                            ["4"],
                            ["3"]
                        ]
                    ]
                }), this.fillSaveState3Stars(), this.map.refreshButtons()), this.keys.M.isDown && this.moveLevels(e, i)
            }, this), game.input.keyboard.addKey(Phaser.Keyboard.H).onDown.add(function() {
                this.toggleSelectedLevelsDifficulty()
            }), void 0 !== this.lastLvlIndex && (this.map.centerOnLvl(this.lastLvlIndex + 1), this.selectLevel(this.lastLvlIndex))
        },
        selectLevel: function(t) {
            "number" == typeof t ? this.keys.CTRL.isDown ? this.selectedLevels.includes(t) ? this.selectedLevels.splice(this.selectedLevels.indexOf(t), 1) : this.selectedLevels.push(t) : this.selectedLevels.includes(t) ? this.selectedLevels = [] : this.selectedLevels = [t] : Array.isArray(t) ? this.selectedLevels = t : this.selectedLevels = [], this.selectedLevels.sort(function(t, e) {
                return t - e
            }), this.map.refreshButtons(), G.sb("editorLevelSelected").dispatch(), this.sidePanel.refresh()
        },
        toggleSelectedLevelsDifficulty: function() {
            this.selectedLevels.forEach(function(t, e) {
                var i = G.json.levels[t];
                i.showAsHard ? delete i.showAsHard : i.showAsHard = !0
            }), this.map.refreshButtons()
        },
        moveLevels: function(i, s) {
            if (0 !== this.selectedLevels.length) {
                var a = this.selectedLevels.map(function(t, e, i) {
                    var s = G.json.levels[i[0]],
                        a = G.json.levels[t];
                    return {
                        x: a.mapX - s.mapX,
                        y: a.mapY - s.mapY
                    }
                });
                this.selectedLevels.forEach(function(t, e) {
                    G.json.levels[t].mapX = i + a[e].x, G.json.levels[t].mapY = s + a[e].y
                }), this.map.refreshButtons()
            }
        },
        fillSaveState3Stars: function() {
            G.saveState.data.levels = [];
            for (var t = 0; t < G.json.levels.length; t++) G.saveState.data.levels.push(3);
            G.saveState.save()
        },
        openGate: function(t) {
            G.saveState.openGate(t)
        },
        update: function() {
            this.selectedLevels.forEach(function(t) {
                this.cursors.up.isDown && (G.json.levels[t].mapY--, this.map.refreshButtons()), this.cursors.down.isDown && (G.json.levels[t].mapY++, this.map.refreshButtons()), this.cursors.left.isDown && (G.json.levels[t].mapX--, this.map.refreshButtons()), this.cursors.right.isDown && (G.json.levels[t].mapX++, this.map.refreshButtons())
            }, this)
        },
        render: function() {
            game.debug.text(game.time.fps, 10, 10, "#ff0000")
        }
    }, G.ErrorState = function() {}, G.ErrorState.prototype = {
        preload: function() {},
        create: function() {
            this.bg = new G.LevelBg, new G.AnotherTabWindow
        }
    }, G.runGame = function() {
        G.sfx.music.isPlaying || G.sfx.music.play("", 0, 1, !0), G.firstTime ? (G.lvlNr = 0, G.sb("onStateChange").dispatch("Game", 0)) : G.sb("onStateChange").dispatch("World")
    }, G.Game = function(t) {}, G.Game.prototype = {
        init: function(t, e, i, a) {
            this.gameId = game.rnd.uuid(), this._removedLifeAtStart = !1, this.startBoosterConfig = new G.StartBoosterConfig, G.giftStatusIndex = 0, s = game.state.getCurrentState(), a ? (this.lvlIndex = 1e4 + (G.saveState.data.dailyBeaten || 0), G.lvlData = a, this.mode = "CHALLENGE") : (this.lvlIndex = Math.min(G.json.levels.length - 1, t), G.lvlData = G.Utils.clone(G.json.levels[this.lvlIndex]), this.mode = "NORMAL"), this.lvlData = G.lvlData, this.debugMode = e || !1, G.debugMode = this.debugMode, this.startBoosters = i || [], this.flags = {
                mysteryGiftMode: !1,
                mysteryGiftModePeak: !1,
                mysteryBoostersInitialized: !1
            }
        },
        preload: function() {
            G.Helpers.loadShoutouts(G.lang)
        },
        create: function() {
            if (this.sawOutOfMovesAd = !1, game.resizeGame(), G.MYSTERYGIFT && G.saveState.mysteryGift_markLevelBeggining(), "NORMAL" === this.mode && 0 === G.saveState.getUnlimitedLivesSec() && (G.saveState.loseLife(), this._removedLifeAtStart = !0), "CHALLENGE" === this.mode ? G.gameTracking.start("DailyChallenge", this.getLevelDimension()) : G.gameTracking.start(this.getGateDimension(), this.getLevelDimension()), G.gameTracking.design("LevelStart"), this.gameplayController = new G.LvlObject(this.lvlIndex, this.lvlData), G.lvl = this.gameplayController, this.debugMode && game.resizeGame(), this.bg = new G.LevelBg, this.board = new G.Board(G.lvl.data, G.l(72)), this.board.onBoardDeconstructed.add(this.onBoardDeconstructed, this), this.board.onActionQueueEmpty.add(this.onActionQueueEmpty, this), this.topBar = new G.UI_TopBar, this.boosterPanel = new G.UI_BoosterPanel, this.collectableAnimLayer = new G.CollectableAnimLayer(this.board, this.topBar), this.chestLayer = new G.ChestLayer, this.chestLayer.onChestGiftShown.add(this.onChestGiftShown, this), this.UIFxLayer = new G.UIFxLayer, this.fxTopLayer = new G.TopFxLayer(this.board, "fxTop"), this.fxTopLayer.position = this.board.boardCandies.position, this.fxTopLayer.scale = this.board.boardCandies.scale, this.pointsLayer = new G.PointsLayer(this.topBar), this.shoutOuts = new G.UI_ShoutOuts, this.overlay = new G.Overlay, this.windowLayer = new G.WindowLayer, G.TreasureHunt.treasureHuntMgr.isLevelTreasureHuntActive(G.lvlNr) && this.setupTreasureHunt(this.lvlIndex), this.uiTargetParticles = new G.UITargetParticles, this.fadeLayer = new G.FadeLayer, G.MYSTERYGIFT && G.saveState.mysteryGift_isModeReady() && (G.saveState.mysteryGift_getCurrentStreak() < 3 && G.lvl.latestLevel && (this.flags.mysteryGiftModePeak = !0, this.windowLayer.pushWindow("mysteryGiftLevel")), G.sb("onAllWindowsClosed").addOnce(function() {
                    new G.MysteryGiftHeaderInGame(G.lvl.latestLevel)
                })), this.windowLayer.pushWindow("taskSlider"), G.lvlData.tutID && G.json.tutorials[G.lvlData.tutID] && -1 == G.saveState.data.finishedTutorials.indexOf(G.lvlData.tutID)) {
                G.json.tutorials[G.lvlData.tutID];
                G.sb("onAllWindowsClosed").addOnce(function() {
                    G.json.tutorials[G.lvlData.tutID].steps ? this.tut = new G.TutorialNewGingy(G.lvlData.tutID) : this.tut = new G.Tutorial(G.lvlData.tutID)
                }, this), G.sb("onTutorialFinish").addOnce(function() {
                    0 == this.board.actionManager.actionList.length ? this.board.actionManager.newAction("startBoosterInit") : G.sb("actionQueueEmpty").addOnce(function() {
                        this.board.actionManager.newAction("startBoosterInit")
                    }, this)
                }, this), G.sb("onTutorialFinishDisplay").addOnce(function() {
                    G.MYSTERYGIFT && G.saveState.mysteryGift_isModeReady() && new G.MysteryGiftHeaderInGame(G.lvl.latestLevel)
                }, this)
            } else G.sb("onAllWindowsClosed").addOnce(function() {
                this.board.actionManager.newAction("startBoosterInit"), G.MYSTERYGIFT && G.saveState.mysteryGift_isModeReady() && new G.MysteryGiftHeaderInGame(G.lvl.latestLevel)
            }, this);
            G.checkPopUpTutorials(this), this.debugMode && this.debugInit(), game.resizeGame(), 0 < this.lvlIndex && this.lvlIndex <= 9 && G.gameTracking.FTUEDesign("FTUX_Lvl0" + G.zeroPad(this.lvlIndex + 1) + "Start"), "CHALLENGE" !== this.mode && G.gameTracking.start(this.getGateDimension(), this.getLevelDimension()), G.gameTracking.FTUEDesign("GameFieldVis")
        },
        update: function() {
            G.delta(), G.DEBUG && (this.dbgPos = this.board.inputController.pointerToCell(game.input.activePointer))
        },
        shutdown: function() {
            this.treasureHuntGemCounter = null, this.treasureHuntGingyFail = null
        },
        getLevelDimension: function() {
            return "Level" + G.pad(this.lvlIndex + 1, 4)
        },
        getGateDimension: function() {
            return "Gate" + G.pad(G.saveState.checkGateNr(this.lvlIndex), 3)
        },
        onBoardDeconstructed: function() {
            var t = G.TreasureHunt.treasureHuntMgr,
                e = G.saveState;
            G.gameTracking.design("LevelFinished");
            var i = {
                lvlIndex: this.lvlIndex,
                points: this.gameplayController.getPoints()
            };
            if (this.flags.mysteryGiftModePeak) {
                var s = e.mysteryGift_increaseStreak();
                i.mysteryGiftStreakIncrease = s
            }
            if (e.mysteryGift_markLevelFinish(), this.flags.treasureHuntMode) {
                var a = t.completeLevel(this.lvlIndex);
                i.treasureHunt = {
                    collectedGems: a
                }
            }
            this.windowLayer.pushWindow(["win", i])
        },
        onActionQueueEmpty: function() {
            0 == G.lvl.moves && (G.lvl.isGoalAchieved() || this.outOfMoves())
        },
        outOfMoves: function() {
            var t = G.TreasureHunt.GameplayGemCounter,
                e = G.TreasureHunt.treasureHuntMgr;
            if (G.IAP || game.incentivised || G.saveState.getCoins() >= 2 * G.lvl.getPriceOfExtraMoves() || G.saveState.isFreeMoneySpinAvailable()) {
                var i = {};
                if (this.flags.treasureHuntMode && 0 < e.getLevelCollectedGems()) {
                    var s = !(i.position = {
                            x: 0,
                            y: -30
                        }),
                        a = t.ReasonToShow;
                    i.preCloseCallback = function() {
                        return !!s || (s = !0, this.treasureHuntGingyFail.show(), this.treasureHuntGemCounter.show(a.OutOfMovesPopUp), !1)
                    }.bind(this), i.closeCallback = function() {
                        s && (this.treasureHuntGingyFail.hide(), this.treasureHuntGemCounter.hide(a.OutOfMovesPopUp))
                    }.bind(this)
                }
                this.windowLayer.pushWindow(["outOfMovesIAP", i])
            } else this.windowLayer.pushWindow("levelFailed")
        },
        setupTreasureHunt: function(t) {
            var e = G.TreasureHunt.treasureHuntMgr,
                i = G.TreasureHunt.GingyFailCharacter,
                s = G.TreasureHunt.GameplayGemCounter;
            e.startLevel(t);
            var a = e.getProgressData();
            this.treasureHuntGingyFail = new i, this.treasureHuntGemCounter = new s(0, a.gemsTarget), this.flags.treasureHuntMode = !0
        },
        onChestGiftShown: function(t, e) {
            var i = G.TreasureHunt.treasureHuntMgr,
                s = G.TreasureHunt.GameplayGemCounter,
                n = this.uiTargetParticles;
            if ("THGEM" === e[0]) {
                var a = this.treasureHuntGemCounter;
                if (!a) return;
                for (var o = t.getGiftObject(), r = a.getTargetObject(), h = i.getInvitedContexts().length, l = 0; l < h + 1; l++) a.show(s.ReasonToShow.Gem), d(o, r).then(function() {
                    G.sfx.pop.play(), i.collectGem(), a.increaseAmount(), a.hide(s.ReasonToShow.Gem)
                })
            } else G.gift.applyGift(e), "coin" === e[0] && G.sb("coinsFromGameplayChest").dispatch(e[1]);

            function d(s, a) {
                return new Promise(function(t, e) {
                    var i = n.init(game.world.bounds.x + s.worldPosition.x, s.worldPosition.y, "gem5_small", a);
                    i.scale.setTo(s.worldScale.x), i.rotation = s.worldRotation, i.vel.setTo(game.rnd.realInRange(-4, 4), game.rnd.realInRange(-4, 4)), i.onStart.addOnce(function() {
                        game.add.tween(i.scale).to({
                            x: .7,
                            y: .7
                        }, 400, Phaser.Easing.Sinusoidal.In, !0)
                    }), i.onFinish.addOnce(function() {
                        t()
                    }), i.start()
                })
            }
        },
        render: function() {},
        initDebugTools: function() {
            this.bot = new G.BOT(this.board);
            var t = game.input.keyboard.addKeys({
                one: Phaser.Keyboard.ONE,
                two: Phaser.Keyboard.TWO,
                three: Phaser.Keyboard.THREE,
                four: Phaser.Keyboard.FOUR,
                five: Phaser.Keyboard.FIVE,
                six: Phaser.Keyboard.SIX,
                r: Phaser.Keyboard.R
            });
            t.one.onDown.add(function() {
                this.dbgPos = this.board.inputController.pointerToCell(game.input.activePointer), s.board.getCandy(this.dbgPos[0], this.dbgPos[1]).changeInto("1")
            }, this), t.two.onDown.add(function() {
                this.dbgPos = this.board.inputController.pointerToCell(game.input.activePointer), s.board.getCandy(this.dbgPos[0], this.dbgPos[1]).changeInto("2")
            }, this), t.three.onDown.add(function() {
                this.dbgPos = this.board.inputController.pointerToCell(game.input.activePointer), s.board.getCandy(this.dbgPos[0], this.dbgPos[1]).changeInto("3")
            }, this), t.four.onDown.add(function() {
                this.dbgPos = this.board.inputController.pointerToCell(game.input.activePointer), s.board.getCandy(this.dbgPos[0], this.dbgPos[1]).changeInto("4")
            }, this), t.five.onDown.add(function() {
                this.dbgPos = this.board.inputController.pointerToCell(game.input.activePointer), s.board.getCandy(this.dbgPos[0], this.dbgPos[1]).changeInto("5")
            }, this), t.six.onDown.add(function() {
                this.dbgPos = this.board.inputController.pointerToCell(game.input.activePointer), s.board.getCandy(this.dbgPos[0], this.dbgPos[1]).changeInto("6")
            }, this)
        },
        debugInit: function() {
            this.initDebugTools();
            var t = new G.Text(0, 0, "LEVEL " + (this.lvlIndex + 1), {
                style: "font-white",
                fontSize: "30px"
            });
            game.add.existing(t);
            var e = new G.Text(250, 0, "MAP", {
                style: "font-white",
                fontSize: "30px"
            });
            e.inputEnabled = !0, e.input.useHandCursor = !0, e.events.onInputDown.add(function() {
                game.state.start("EditorWorld", !0, !1, G.lvlNr)
            }, this), game.add.existing(e);
            var i = new G.Text(350, 0, "LVL EDIT", {
                style: "font-white",
                fontSize: "30px"
            });
            i.inputEnabled = !0, i.input.useHandCursor = !0, i.events.onInputDown.add(function() {
                game.state.start("Editor", !0, !1, this.lvlIndex)
            }, this), game.add.existing(i);
            var s = new G.Text(500, 0, "PREV", {
                style: "font-white",
                fontSize: "30px"
            });
            s.inputEnabled = !0, s.input.useHandCursor = !0, s.events.onInputDown.add(function() {
                console.log("current: " + G.lvlNr), console.log("prev: " + Math.max(0, this.lvlIndex - 1)), game.state.start("Game", !0, !1, Math.max(0, this.lvlIndex - 1), !0)
            }, this), game.add.existing(s);
            var a = new G.Text(600, 0, "NEXT", {
                style: "font-white",
                fontSize: "30px"
            });
            a.inputEnabled = !0, a.input.useHandCursor = !0, a.events.onInputDown.add(function() {
                console.log("current: " + G.lvlNr), console.log("nextL " + Math.min(G.json.levels.length - 1, this.lvlIndex + 1)), game.state.start("Game", !0, !1, Math.min(G.json.levels.length - 1, this.lvlIndex + 1), !0)
            }, this), game.add.existing(a)
        }
    }, G.debugGoToLevel = function(t) {
        G.saveState.data.levels = [], G.saveState.data.finishedTutorials = [], G.saveState.data.boosters = [null, 30, 30, 30, 30, 30, 30, 30, 30];
        for (var e = 0; e < t; e++) G.saveState.data.levels.push(3);
        game.state.start("Game", !0, !1, t - 1, !0)
    }, G.MapEditor = function(t) {}, G.MapEditor.prototype = {
        init: function() {
            s = game.state.getCurrentState()
        },
        create: function() {
            this.mapGroup = new G.StrObjGroup(.5 * game.width, .5 * game.height, G.json.map), this.gfxHelpLayer = game.add.graphics(), this.gfxHelpLayer.lineStyle(1, 16711680, .5), this.gfxHelpLayer.moveTo(0, 0), this.gfxHelpLayer.lineTo(0, 2e3), this.gfxHelpLayer.moveTo(-600, 0), this.gfxHelpLayer.lineTo(-600, 2e3), this.gfxHelpLayer.moveTo(600, 0), this.gfxHelpLayer.lineTo(600, 2e3), this.modify = new G.Modify, this.modify.addMouseWheel()
        },
        update: function() {
            this.mapGroup.x = game.world.bounds.x + .5 * game.width, this.gfxHelpLayer.x = this.mapGroup.x
        },
        render: function() {}
    }, G.Preloader = function() {}, G.Preloader.prototype = {
        init: function() {},
        preload: function() {
            this.ready = !1, this.load.onFileComplete.add(function(t) {
                console.log("progress:" + t)
            }), G.SGLOGO && (this.softgamesBtn = game.add.button(320, 850, "softgames_logo", function() {}), this.softgamesBtn.anchor.setTo(.5)), G.Loader.loadAssets()
        },
        create: function() {
            G.gameTracking.FTUEDesign("FTUX_LoadingComplete"), G.addTextStyles();
            var n = [null, 0, 0, 0, 0];
            Object.keys(G.json.tutorials).forEach(function(e) {
                var t = G.json.tutorials[e],
                    i = G.json.levels.find(function(t) {
                        return t.tutID == e
                    }),
                    s = G.json.levels.indexOf(i) + 1;
                if (t.steps) {
                    var a = t.steps.find(function(t) {
                        return "booster" === t.type
                    });
                    a && i && (n[a.boosterNr] = s)
                } else t.boosterNr && (n[t.boosterNr] = s)
            }), G.json.settings.boostersUnlock = n, G.json.levels.find(function(t) {
                return t.tutID
            }) || Object.keys(G.json.tutorials).forEach(function(t) {
                G.json.levels[parseInt(t) - 1].tutID = t
            }), G.saveState._initLoadData(), this.processSpecialCandiesJson(), game.resizeGame(), G.runDebugTests(), this.fadeLayer = new G.FadeLayer
        },
        update: function() {
            var t = G.TreasureHunt.treasureHuntMgr;
            if (!this.ready && G.saveState.ready) {
                if (this.ready = !0, t.init(), console.log("game is ready"), window._game_loading_timer) {
                    Date.now(), window._game_loading_timer;
                    window._game_loading_timer = !1
                }
                G.runGame(), G.BuildEnvironment.RAVEN_DSN && Raven.setUserContext({
                    id: userData.userId
                })
            }
        },
        processSpecialCandiesJson: function() {
            G.specialCandies = {
                names: [],
                patterns: [],
                lookUp: {},
                combos: G.json.specialCandies.combos,
                isTypeSpecial: function(t) {
                    return -1 != this.names.indexOf(t)
                },
                getSpecialData: function(t) {
                    return this.lookUp[t]
                }
            }, G.json.specialCandies.candies.forEach(function(t, e, i) {
                G.specialCandies.names.push(t.name), t.patterns && G.specialCandies.patterns.push([t.name, t.patterns]), G.specialCandies.lookUp[t.name] = t
            })
        }
    }, G.TestState = function(t) {
        this.game, this.add, this.camera, this.cache, this.input, this.load, this.math, this.sound, this.stage, this.time, this.tweens, this.state, this.world, this.particles, this.physics, this.rnd
    }, G.TestState.prototype = {
        init: function() {},
        create: function() {
            this.testGroup = game.add.group(), this.testGroup2 = game.add.group(), this.testGroup2.x = 10, this.testGroup2.add(this.testGroup), this.testGroup3 = game.add.group(), this.testGroup3.y = 50, this.testGroup3.add(this.testGroup2), this.testGroup4 = game.add.group(), this.testGroup4.angle = 30, this.testGroup4.add(this.testGroup3);
            for (var t = 0; t < 200; t++) {
                var e = G.makeImage(0, 0, "b_play_big_1", .5);
                e.scale.x = 2, e.dirX = 20 * Math.random() - 10, e.dirY = 20 * Math.random() - 10, e.update = function() {
                    this.x += this.dirX, this.y += this.dirY, this.x < 0 && (this.x = 0, this.dirX *= -1), this.y < 0 && (this.y = 0, this.dirY *= -1), this.x > game.width && (this.x = game.width, this.dirX *= -1), this.y > game.height && (this.y = game.height, this.dirY *= -1)
                }
            }
        },
        update: function() {},
        render: function() {
            game.debug.text(game.time.fps, 300, 10, "#ff0000")
        },
        _createTestInput: function(t) {
            return function(t, e, i) {
                var s = G.makeImage(0, 0, "Map_background_tileable_0", .5);
                s.name = "worldMap", s.scale.setTo(.33, 1), s.left = e, s.top = i, G.Input.initializeCustomInput(s), s.customInput.addHandler((a = s, n = G.Input.createCustomInputDragHandler(), n.dragStartSignal.add(function(t) {
                    h("drag @ " + a.name + ": start", t)
                }), n.dragUpdateSignal.add(function(t) {
                    h("drag @ " + a.name + ": update", t)
                }), n.dragStopSignal.add(function(t) {
                    h("drag @ " + a.name + ": end", t)
                }), n.dragCancelSignal.add(function(t) {
                    h("drag @ " + a.name + ": cancel", t)
                }), n)), s.customInput.addHandler(r(s)), t.add(s);
                var a, n;
                var o = G.makeImage(0, 0, "blue_button", .5);
                o.name = "levelButton", o.x = s.centerX, o.y = s.centerY, G.Input.initializeCustomInput(o), o.customInput.addHandler(r(o)), t.add(o)
            }(t.world, 100, 100), void
            function(t, e, i) {
                var s = G.makeImage(0, 0, "tile_shade", .5);
                s.name = "uiBlocker", s.scale.setTo(3, 3), s.left = e, s.top = i, G.Input.initializeCustomInput(s), s.customInput.addHandler((a = s, n = G.Input.createCustomBlockInputHandler(), n.signal.add(function() {
                    h("block @ " + a.name)
                }), n)), t.add(s);
                var a, n;
                var o = G.makeImage(0, 0, "blue_button", .5);
                o.name = "popupButton", o.x = s.centerX, o.y = s.centerY, G.Input.initializeCustomInput(o), o.customInput.addHandler(r(o)), t.add(o)
            }(t.world, 100, 250);

            function r(t) {
                var e = G.Input.createCustomInputClickHandler();
                return e.downSignal.add(function() {
                    h("click @ " + t.name + ": down")
                }), e.clickSignal.add(function() {
                    h("click @ " + t.name + ": click")
                }), e.cancelSignal.add(function() {
                    h("click @ " + t.name + ": cancel")
                }), e
            }

            function h() {
                console.error.apply(console, ["Input | " + arguments[0]].concat([].slice.call(arguments, 1)))
            }
        }
    }, G.World = function(t) {}, G.World.prototype = {
        init: function(t) {
            G.dailyMissionsMgr.dayCheck(), G.giftStatusIndex = 0, s = game.state.getCurrentState(), this.lastLevelData = t, this.startBoosterConfig = new G.StartBoosterConfig, document.body.style.backgroundColor = "#699519", document.body.style.backgroundImage = "url(img/bg_tile.png)", document.body.style.backgroundRepeat = "repeat", document.body.style.backgroundSize = "300px 300px", G.lvlData = G.json.levels[G.saveState.getLastPassedLevelNr()]
        },
        create: function() {
            if (window._game_loading_timer) {
                var t = Date.now() - window._game_loading_timer;
                window._game_loading_timer = !1, G.gameTracking.design("LoadingComplete", t)
            }
            G.sentWorldMapDesignEvent || (G.gameTracking.design("GameFieldVis"), G.sentWorldMapDesignEvent = !0), game.resizeGame(), G.saveState.increaseMapVisibleCounter(), this.map = new G.WorldMap(G.json.settings.mapTiles, G.json.settings.mapAnimatedElements, G.json.levels), this.map.onGateOpen.add(this.openGate, this);
            var e = G.saveState.getLastPassedLevelNr();
            if (G.json.levels[e] && (this.tutHandGroup = game.add.group(), this.tutHandGroup.position = this.map.position, this.tutHand = new G.MapTutHand(this.map), this.tutHandGroup.add(this.tutHand)), this.panel = new G.UI_MapPanel, this.mapGift = new G.MapGift, this.dailyChallengeIcon = new G.UI_DailyChallengeIcon(855, 300), this.dailyIcon = new G.UI_DailyIcon(855, 140, !G.saveState.data.sawDailyTut), this.uiTargetParticlesBW = new G.UITargetParticles, this.windowLayer = new G.WindowLayer(0, 0), this.windowLayer.resize(), this.fxMapLayer = new G.FxMapLayer, this.worldSidePanel = new G.WorldSidePanel, this.uiFxLayer = new G.UIFxLayer, this.uiTargetParticles = new G.UITargetParticles, this.fadeLayer = new G.FadeLayer, this.checkTreasureHuntReward(), !G.firstTime && !G.checkedDailyReward) {
                G.checkedDailyReward = !0;
                var i = G.saveState.dailyReward_reportVisit();
                null !== i && G.sb("pushWindow").dispatch(["dailyReward", i])
            }
            G.gameTracking.FTUEDesign("FTUX_SagaMapVis")
        },
        update: function() {
            G.delta()
        },
        openGate: function(t) {
            G.json.settings;
            G.saveState.openGate(t), G.TreasureHunt.treasureHuntMgr.isEventReadyToStart() && this.windowLayer.pushWindow("treasureHuntEvent")
        },
        checkNewsPopUp: function() {
            var t = G.json.settings.newsPopUp;
            t && (G.saveState.wasNewsAlreadySeen(t.version) || (this.windowLayer.pushWindow(["newsUpdate", t]), G.saveState.markNewsAsSeen(t.version)))
        },
        checkTreasureHuntReward: function() {
            var t = G.TreasureHunt.treasureHuntMgr,
                e = 0;
            this.lastLevelData && this.lastLevelData.treasureHuntCollectedGems && (e = this.lastLevelData.treasureHuntCollectedGems), t.isRewardAvailable() && this.windowLayer.pushWindow(["treasureHuntMainReward", {
                lastLevelCollectedGems: e,
                onClaimCallback: t.markRewardAsClaimed
            }])
        },
        render: function() {}
    }, G.NineSliceTest = function(c) {
        var u, p, g;
        this.UI = null;
        var f = 0,
            m = 0;
        return {
            init: function() {},
            create: function() {
                this.UI = function() {
                    var t = new Phaser.Group(c);
                    u = new G.Utils.NineSlice.fromJSON("assets/buttons/btn_gm_green", 0, 0, 200, 100), t.add(u), g = new PhaserNineSlice.NineSlice(0, 150, "buttons", "btn_gm_green", 200, 100, G.json["assets/buttons/btn_gm_green"].data), t.add(g), p = new PhaserNineSlice.NineSlice(0, 300, "buttons", "btn_gm_green", 200, 100, {
                        top: 20,
                        bottom: 23,
                        left: 27,
                        right: 28
                    }), t.add(p);
                    for (var e = 0; e < 6; e++) {
                        var i = new PhaserNineSlice.NineSlice(200 * Math.random(), 600 + 200 * Math.random(), "buttons", "btn_gm_green", 200 + Math.floor(50 * Math.random() - 50), 100 + Math.floor(50 * Math.random() - 50), {
                            top: 20,
                            bottom: 23,
                            left: 27,
                            right: 28
                        });
                        t.add(i)
                    }
                    var s, a, n, o, r, h, l, d = (a = function() {
                        var t, e, i;
                        t = u.customComponents.nineSliceComponent.hash, e = PhaserNineSlice.NineSliceCache.instances[t], y(3 === (i = PhaserNineSlice.NineSliceCache.instancesCount[t]), "Instance counter is correct (expected 3, got 3)", "Instance counter is incorrect (expected 3, got " + i + ")!"), g.destroy(), y(2 === (i = PhaserNineSlice.NineSliceCache.instancesCount[t]), "Instance counter is correct (expected 2, got 2)", "Instance counter is incorrect (expected 2, got " + i + ")!"), y(e === p.texture, "Instance is correctly using cache texture", "Instance is using incorrect cache texture"), y(u.texture === p.texture, "Instance is correctly sharing cache texture with other instance", "Instance is using incorrect cache texture"), u.resize(500, 500), y(e !== u.texture, "Resizing has successfully created new cache texture", "Resizing has failed!"), 0 !== f && console.error("Encountered " + f + " errors!"), console.log(m + " tests passed"), d.destroy()
                    }, n = this, (o = 0, r = 400, h = s = "Test Cache", l = 50, s = h = new G.Text(o, r, h, {
                        style: "font-white",
                        fontSize: (l || 50) + "px"
                    })).inputEnabled = !0, s.input.useHandCursor = !0, s.events.onInputDown.add(a, n), s);
                    return t.add(d), t
                }(), this.world.add(this.UI)
            },
            update: function() {},
            render: function() {}
        };

        function y(t, e, i) {
            t ? (console.log(e), m++) : (console.error(i), f++)
        }
    }, G.TestLayoutState = function() {
        return function(t) {
            var s, e = 512,
                i = 512;
            return {
                init: function() {},
                create: function() {
                    var e, t, i;
                    e = this.game, t = G.UI.createUIElement(e, G.json["ui/debug/uiJsonTestParent"]), i = t.rootElement, t.exports.forFirst("placeholder_top_left", function(t) {
                        t.addChild(a(e))
                    }), t.exports.forFirst("placeholder_top_right", function(t) {
                        t.addChild(n(e))
                    }), t.exports.forFirst("placeholder_bottom_left", function(t) {
                        t.addChild(n(e))
                    }), t.exports.forFirst("placeholder_bottom_right", function(t) {
                        t.addChild(a(e))
                    }), s = i, this.world.add(s), o()
                },
                update: function() {
                    e = 512 * r(.75, 1.25, 3e3), i = 512 * r(.75, 1.25, 4500), o()
                },
                render: function() {}
            };

            function a(s) {
                var t = G.UI.createUIElement(s, G.json["ui/debug/uiJsonTest"]);
                return t.exports.forFirst("candy", function(t) {
                    var i, e = (i = 666, {
                        animate: function(t, e) {
                            t.add.tween(e).to({
                                angle: 360
                            }, i, Phaser.Easing.Linear.None, !0, 0, -1)
                        }
                    });
                    e.animate(s, t)
                }), t.exports.forEach("button", function(t, e) {
                    t.onClick.add(function() {
                        console.log("button", e)
                    })
                }), t.exports.forEach("button_close", function(t) {
                    t.onClick.add(function() {
                        console.log("btn close")
                    })
                }), t.rootElement
            }

            function n(t) {
                var e = G.UI.createUIElement(t, G.json["ui/clock"]),
                    i = G.Animations.getClockPointersAnimation();
                return i.animate(t, e.rootElement), e.rootElement
            }

            function o() {
                G.UI.resize(s, e, i)
            }
        };

        function r(t, e, i, s) {
            return G.lerp(t, e, (1 + Math.cos(2 * Math.PI * (Date.now() / i - .5 + (s || 0)))) / 2)
        }
    }(), G.Utils.NineSlice = {}, G.Utils.NineSlice.fromJSON = function(t, e, i, s, a) {
        var n;
        G.json.hasOwnProperty(t) ? "nineslice" !== G.json[t].type ? (console.warn("NineSlice warn - Type of JSON is not nineslice"), n = {
            top: 0,
            right: 0,
            left: 0,
            bottom: 0
        }) : n = G.json[t].data : (console.warn("NineSlice warn - JSON does not exist or is not loaded"), n = {
            top: 0,
            right: 0,
            left: 0,
            bottom: 0
        });
        var o = t.split("/");
        if (o.length < 3) throw new Error("NineSlice error! Path to JSON is invalid!");
        var r = o[o.length - 2],
            h = o[o.length - 1];
        return new PhaserNineSlice.NineSlice(e, i, r, h, s, a, n)
    }, G.Utils.RavenLog = {}, G.Utils.RavenLog.logError = function(t, e) {
        "undefined" != typeof Raven && Raven.isSetup() && Raven.captureMessage(t, e)
    }, window.startGame = function() {
        var t = new Phaser.Game(800, 1100, Phaser.CANVAS, "", null, !0);
        (window.game = t).state.add("Boot", G.Boot), t.state.add("Preloader", G.Preloader), t.state.add("World", G.World), t.state.add("Game", G.Game), t.state.add("Editor", G.Editor), t.state.add("EditorWorld", G.EditorWorld), t.state.add("TitleScreen", G.TitleScreen), t.state.add("TestState", G.TestState), t.state.add("TestLayoutState", G.TestLayoutState), t.state.add("NineSliceTest", G.NineSliceTest), t.state.add("ErrorState", G.ErrorState), t.state.add("MapEditor", G.MapEditor), t.state.start("Boot"), setTimeout(function() {
            "Boot" === t.state._pendingState && t.paused && (t.paused = !1)
        }, 2e3)
    }, window.initGame = function() {
        G.BuildEnvironment.RAVEN_DSN && Raven.config(G.BuildEnvironment.RAVEN_DSN).install(), G.sb = G.SignalBox, window.startGame()
    }, G.ASSETS = {
        spritesheets: ["board", "bursteffects", "buttons", "dailyReward", "effects", "gems", "ginger", "leaderboard", "mapsheet", "ssheet", "treasure-hunt"],
        sfx: ["boom.mp3", "booster.mp3", "brick_break.mp3", "cash_register.mp3", "chain_rattle.mp3", "chest_open.mp3", "chest_open_louder.mp3", "clock_tick.mp3", "coin_collect.mp3", "dirt_break.mp3", "exchange.mp3", "explosion_subtle.mp3", "ice_break_0.mp3", "ice_break_1.mp3", "lightning.mp3", "line.mp3", "match_1.mp3", "match_2.mp3", "match_3.mp3", "match_4.mp3", "match_5.mp3", "music.mp3", "pop.mp3", "stone_impact_1.mp3", "stone_impact_2.mp3", "stone_impact_3.mp3", "transition.mp3", "whoosh.mp3", "whoosh_short_1.mp3", "whoosh_short_2.mp3", "xylophone_positive.mp3", "xylophone_positive2.mp3", "xylophone_positive6.mp3", "xylophone_positive_12.mp3"],
        images: ["Beat_Map_Position_Asset.png", "Beat_Overall_Highscore_asset.png", "BOOT-background_1.jpg", "Map_background_tileable_0.jpg", "Map_background_tileable_1.jpg", "Map_background_tileable_2.jpg", "Map_background_tileable_3.jpg"],
        json: ["assets/buttons/btn_gm_green.json", "languages.json", "levels.json", "settings.json", "specialCandies.json", "tutorials.json", "ui/clock.js"],
        fonts: {}
    }
}();