
!function (r) {
    // var e = arequire("../@babel/runtime/helpers/typeof"),
    //     t = arequire("../@babel/runtime/helpers/get"),
    //     n = arequire("../@babel/runtime/helpers/getPrototypeOf"),
    //     o = arequire("../@babel/runtime/helpers/createClass"),
    //     i = arequire("../@babel/runtime/helpers/classCallCheck"),
    //     s = arequire("../@babel/runtime/helpers/inherits"),
    //     a = arequire("../@babel/runtime/helpers/createSuper");

    //#region 折叠代码
    Array.prototype.includes || Object.defineProperty(Array.prototype, "includes", {
        value: function (r, e) {
            if (null == this) throw new TypeError('"this" is null or not defined');
            var t = Object(this), n = t.length >>> 0;
            if (0 == n) return !1;
            for (var i, o, a = 0 | e, u = Math.max(0 <= a ? a : n - Math.abs(a), 0); u < n;) {
                if ((i = t[u]) === (o = r) || "number" == typeof i && "number" == typeof o && isNaN(i) && isNaN(o)) return !0;
                u++;
            }
            return !1;
        }
    });

    function _arrayLikeToArray2(r, a) {
        (null == a || a > r.length) && (a = r.length);
        for (var e = 0, n = new Array(a); e < a; e++) n[e] = r[e];
        return n;
    }

    function _arrayWithHoles2(r) {
        if (Array.isArray(r)) return r;
    }

    function _arrayWithoutHoles2(r) {
        if (Array.isArray(r)) return _arrayLikeToArray2(r);
    }

    function _assertThisInitialized2(e) {
        if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
        return e;
    }

    function _classCallCheck2(a, l) {
        if (!(a instanceof l)) throw new TypeError("Cannot call a class as a function");
    }

    function _construct2(t, e, r) {
        return _isNativeReflectConstruct2() ? /**/_construct2 = Reflect.construct : /**/_construct2 = function (t, e, r) {
            var o = [null];
            o.push.apply(o, e);
            var c = new (Function.bind.apply(t, o))();
            return r && _setPrototypeOf2(c, r.prototype), c;
        }, _construct2.apply(null, arguments);
    }

    function _defineProperties2(e, r) {
        for (var t = 0; t < r.length; t++) {
            var n = r[t];
            n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0),
                Object.defineProperty(e, n.key, n);
        }
    }

    function _createClass2(e, r, t) {
        return r && _defineProperties2(e.prototype, r), t && _defineProperties2(e, t), e;
    }

    function _createForOfIteratorHelper2(r, e) {
        var t;
        if ("undefined" == typeof Symbol || null == r[Symbol.iterator]) {
            if (Array.isArray(r) || (t = _unsupportedIterableToArray2(r)) || e && r && "number" == typeof r.length) {
                t && (r = t);
                var n = 0, o = function () { };
                return {
                    s: o,
                    n: function () {
                        return n >= r.length ? {
                            done: !0
                        } : {
                            done: !1,
                            value: r[n++]
                        };
                    },
                    e: function (r) {
                        throw r;
                    },
                    f: o
                };
            }
            throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
        }
        var a, u = !0, i = !1;
        return {
            s: function () {
                t = r[Symbol.iterator]();
            },
            n: function () {
                var r = t.next();
                return u = r.done, r;
            },
            e: function (r) {
                i = !0, a = r;
            },
            f: function () {
                try {
                    u || null == t.return || t.return();
                } finally {
                    if (i) throw a;
                }
            }
        };
    }

    function _createSuper2(t) {
        var e = _isNativeReflectConstruct2();
        return function () {
            var r, o = _getPrototypeOf2(t);
            if (e) {
                var s = _getPrototypeOf2(this).constructor;
                r = Reflect.construct(o, arguments, s);
            } else r = o.apply(this, arguments);
            return _possibleConstructorReturn2(this, r);
        };
    }

    function _defineProperty2(e, r, n) {
        return r in e ? Object.defineProperty(e, r, {
            value: n,
            enumerable: !0,
            configurable: !0,
            writable: !0
        }) : e[r] = n, e;
    }

    function _get2(e, t, r) {
        return "undefined" != typeof Reflect && Reflect.get ? /**/_get2 = Reflect.get : /**/_get2 = function (e, t, r) {
            var o = _superPropBase2(e, t);
            if (o) {
                var u = Object.getOwnPropertyDescriptor(o, t);
                return u.get ? u.get.call(r) : u.value;
            }
        }, _get2(e, t, r || e);
    }

    function _getPrototypeOf2(t) {
        return /**/_getPrototypeOf2 = Object.setPrototypeOf ? Object.getPrototypeOf : function (t) {
            return t.__proto__ || Object.getPrototypeOf(t);
        }, _getPrototypeOf2(t);
    }

    function _inherits2(e, t) {
        if ("function" != typeof t && null !== t) throw new TypeError("Super expression must either be null or a function");
        e.prototype = Object.create(t && t.prototype, {
            constructor: {
                value: e,
                writable: !0,
                configurable: !0
            }
        }), t && _setPrototypeOf2(e, t);
    }

    function _interopRequireDefault(e) {
        return e && e.__esModule ? e : {
            default: e
        };
    }

    function _isNativeReflectConstruct2() {
        if ("undefined" == typeof Reflect || !Reflect.construct) return !1;
        if (Reflect.construct.sham) return !1;
        if ("function" == typeof Proxy) return !0;
        try {
            return Date.prototype.toString.call(Reflect.construct(Date, [], function () { })),
                !0;
        } catch (t) {
            return !1;
        }
    }

    function _iterableToArray2(r) {
        if ("undefined" != typeof Symbol && Symbol.iterator in Object(r)) return Array.from(r);
    }

    function _iterableToArrayLimit2(r, t) {
        if ("undefined" != typeof Symbol && Symbol.iterator in Object(r)) {
            var e = [], i = !0, o = !1, l = void 0;
            try {
                for (var n, a = r[Symbol.iterator](); !(i = (n = a.next()).done) && (e.push(n.value),
                    !t || e.length !== t); i = !0);
            } catch (r) {
                o = !0, l = r;
            } finally {
                try {
                    i || null == a.return || a.return();
                } finally {
                    if (o) throw l;
                }
            }
            return e;
        }
    }

    function _nonIterableRest2() {
        throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
    }

    function _nonIterableSpread2() {
        throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
    }

    function _possibleConstructorReturn2(e, t) {
        return !t || "object" !== _typeof2(t) && "function" != typeof t ? _assertThisInitialized2(e) : t;
    }

    function set(e, r, t, i) {
        return (set = "undefined" != typeof Reflect && Reflect.set ? Reflect.set : function (e, r, t, i) {
            var n, o = _superPropBase2(e, r);
            if (o) {
                if ((n = Object.getOwnPropertyDescriptor(o, r)).set) return n.set.call(i, t), !0;
                if (!n.writable) return !1;
            }
            if (n = Object.getOwnPropertyDescriptor(i, r)) {
                if (!n.writable) return !1;
                n.value = t, Object.defineProperty(i, r, n);
            } else _defineProperty2(i, r, t);
            return !0;
        })(e, r, t, i);
    }

    function _set2(e, r, t, i, n) {
        if (!set(e, r, t, i || e) && n) throw new Error("failed to set property");
        return t;
    }

    function _setPrototypeOf2(t, o) {
        return /**/_setPrototypeOf2 = Object.setPrototypeOf || function (t, o) {
            return t.__proto__ = o, t;
        }, _setPrototypeOf2(t, o);
    }

    function _slicedToArray2(r, e) {
        return _arrayWithHoles2(r) || _iterableToArrayLimit2(r, e) || _unsupportedIterableToArray2(r, e) || _nonIterableRest2();
    }

    function _superPropBase2(e, r) {
        for (; !Object.prototype.hasOwnProperty.call(e, r) && null !== (e = _getPrototypeOf2(e)););
        return e;
    }

    function _toConsumableArray2(r) {
        return _arrayWithoutHoles2(r) || _iterableToArray2(r) || _unsupportedIterableToArray2(r) || nonIterableSpread();
    }

    function _typeof2(o) {
        return "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? /**/_typeof2 = function (o) {
            return typeof o;
        } : /**/_typeof2 = function (o) {
            return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
        }, _typeof2(o);
    }

    function _unsupportedIterableToArray2(r, e) {
        if (r) {
            if ("string" == typeof r) return _arrayLikeToArray2(r, e);
            var t = Object.prototype.toString.call(r).slice(8, -1);
            return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray2(r, e) : void 0;
        }
    }

    var _regeneratorRequire;

    !function (t) {
        "use strict";
        _regeneratorRequire = {}
        var r, e = Object.prototype, n = e.hasOwnProperty, o = "function" == typeof Symbol ? Symbol :
            {}, i = o.iterator || "@@iterator", a = o.asyncIterator || "@@asyncIterator",
            c = o.toStringTag || "@@toStringTag", u = "object" == typeof module,
            h = t.regeneratorRuntime;
        if (h) u && (_regeneratorRequire = h);
        else {
            (h = t.regeneratorRuntime = _regeneratorRequire).wrap = w;
            var f = "suspendedStart", s = "suspendedYield", l = "executing", p = "completed", y = {}, v = {};
            v[i] = function () {
                return this;
            };
            var d = Object.getPrototypeOf, g = d && d(d(P([])));
            g && g !== e && n.call(g, i) && (v = g);
            var m = b.prototype = x.prototype = Object.create(v);
            E.prototype = m.constructor = b, b.constructor = E, b[c] = E.displayName = "GeneratorFunction",
                h.isGeneratorFunction = function (t) {
                    var r = "function" == typeof t && t.constructor;
                    return !!r && (r === E || "GeneratorFunction" === (r.displayName || r.name));
                }, h.mark = function (t) {
                    return Object.setPrototypeOf ? Object.setPrototypeOf(t, b) : (t.__proto__ = b, c in t || (t[c] = "GeneratorFunction")),
                        t.prototype = Object.create(m), t;
                }, h.awrap = function (t) {
                    return {
                        __await: t
                    };
                }, _(j.prototype), j.prototype[a] = function () {
                    return this;
                }, h.AsyncIterator = j, h.async = function (t, r, e, n) {
                    var o = new j(w(t, r, e, n));
                    return h.isGeneratorFunction(r) ? o : o.next().then(function (t) {
                        return t.done ? t.value : o.next();
                    });
                }, _(m), m[c] = "Generator", m[i] = function () {
                    return this;
                }, m.toString = function () {
                    return "[object Generator]";
                }, h.keys = function (t) {
                    var r = [];
                    for (var e in t) r.push(e);
                    return r.reverse(), function e() {
                        for (; r.length;) {
                            var n = r.pop();
                            if (n in t) return e.value = n, e.done = !1, e;
                        }
                        return e.done = !0, e;
                    };
                }, h.values = P, N.prototype = {
                    constructor: N,
                    reset: function (t) {
                        if (this.prev = 0, this.next = 0, this.sent = this._sent = r, this.done = !1, this.delegate = null,
                            this.method = "next", this.arg = r, this.tryEntries.forEach(G), !t) for (var e in this) "t" === e.charAt(0) && n.call(this, e) && !isNaN(+e.slice(1)) && (this[e] = r);
                    },
                    stop: function () {
                        this.done = !0;
                        var t = this.tryEntries[0].completion;
                        if ("throw" === t.type) throw t.arg;
                        return this.rval;
                    },
                    dispatchException: function (t) {
                        if (this.done) throw t;
                        var e = this;
                        function o(n, o) {
                            return c.type = "throw", c.arg = t, e.next = n, o && (e.method = "next", e.arg = r),
                                !!o;
                        }
                        for (var i = this.tryEntries.length - 1; i >= 0; --i) {
                            var a = this.tryEntries[i], c = a.completion;
                            if ("root" === a.tryLoc) return o("end");
                            if (a.tryLoc <= this.prev) {
                                var u = n.call(a, "catchLoc"), h = n.call(a, "finallyLoc");
                                if (u && h) {
                                    if (this.prev < a.catchLoc) return o(a.catchLoc, !0);
                                    if (this.prev < a.finallyLoc) return o(a.finallyLoc);
                                } else if (u) {
                                    if (this.prev < a.catchLoc) return o(a.catchLoc, !0);
                                } else {
                                    if (!h) throw new Error("try statement without catch or finally");
                                    if (this.prev < a.finallyLoc) return o(a.finallyLoc);
                                }
                            }
                        }
                    },
                    abrupt: function (t, r) {
                        for (var e = this.tryEntries.length - 1; e >= 0; --e) {
                            var o = this.tryEntries[e];
                            if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) {
                                var i = o;
                                break;
                            }
                        }
                        i && ("break" === t || "continue" === t) && i.tryLoc <= r && r <= i.finallyLoc && (i = null);
                        var a = i ? i.completion : {};
                        return a.type = t, a.arg = r, i ? (this.method = "next", this.next = i.finallyLoc,
                            y) : this.complete(a);
                    },
                    complete: function (t, r) {
                        if ("throw" === t.type) throw t.arg;
                        return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg,
                            this.method = "return", this.next = "end") : "normal" === t.type && r && (this.next = r),
                            y;
                    },
                    finish: function (t) {
                        for (var r = this.tryEntries.length - 1; r >= 0; --r) {
                            var e = this.tryEntries[r];
                            if (e.finallyLoc === t) return this.complete(e.completion, e.afterLoc), G(e), y;
                        }
                    },
                    catch: function (t) {
                        for (var r = this.tryEntries.length - 1; r >= 0; --r) {
                            var e = this.tryEntries[r];
                            if (e.tryLoc === t) {
                                var n = e.completion;
                                if ("throw" === n.type) {
                                    var o = n.arg;
                                    G(e);
                                }
                                return o;
                            }
                        }
                        throw new Error("illegal catch attempt");
                    },
                    delegateYield: function (t, e, n) {
                        return this.delegate = {
                            iterator: P(t),
                            resultName: e,
                            nextLoc: n
                        }, "next" === this.method && (this.arg = r), y;
                    }
                };
        }
        function w(t, r, e, n) {
            var o = r && r.prototype instanceof x ? r : x, i = Object.create(o.prototype), a = new N(n || []);
            return i._invoke = function (t, r, e) {
                var n = f;
                return function (o, i) {
                    if (n === l) throw new Error("Generator is already running");
                    if (n === p) {
                        if ("throw" === o) throw i;
                        return F();
                    }
                    for (e.method = o, e.arg = i; ;) {
                        var a = e.delegate;
                        if (a) {
                            var c = O(a, e);
                            if (c) {
                                if (c === y) continue;
                                return c;
                            }
                        }
                        if ("next" === e.method) e.sent = e._sent = e.arg; else if ("throw" === e.method) {
                            if (n === f) throw n = p, e.arg;
                            e.dispatchException(e.arg);
                        } else "return" === e.method && e.abrupt("return", e.arg);
                        n = l;
                        var u = L(t, r, e);
                        if ("normal" === u.type) {
                            if (n = e.done ? p : s, u.arg === y) continue;
                            return {
                                value: u.arg,
                                done: e.done
                            };
                        }
                        "throw" === u.type && (n = p, e.method = "throw", e.arg = u.arg);
                    }
                };
            }(t, e, a), i;
        }
        function L(t, r, e) {
            try {
                return {
                    type: "normal",
                    arg: t.call(r, e)
                };
            } catch (t) {
                return {
                    type: "throw",
                    arg: t
                };
            }
        }
        function x() { }
        function E() { }
        function b() { }
        function _(t) {
            ["next", "throw", "return"].forEach(function (r) {
                t[r] = function (t) {
                    return this._invoke(r, t);
                };
            });
        }
        function j(t) {
            var r;
            this._invoke = function (e, o) {
                function i() {
                    return new Promise(function (r, i) {
                        !function r(e, o, i, a) {
                            var c = L(t[e], t, o);
                            if ("throw" !== c.type) {
                                var u = c.arg, h = u.value;
                                return h && "object" == typeof h && n.call(h, "__await") ? Promise.resolve(h.__await).then(function (t) {
                                    r("next", t, i, a);
                                }, function (t) {
                                    r("throw", t, i, a);
                                }) : Promise.resolve(h).then(function (t) {
                                    u.value = t, i(u);
                                }, function (t) {
                                    return r("throw", t, i, a);
                                });
                            }
                            a(c.arg);
                        }(e, o, r, i);
                    });
                }
                return r = r ? r.then(i, i) : i();
            };
        }
        function O(t, e) {
            var n = t.iterator[e.method];
            if (n === r) {
                if (e.delegate = null, "throw" === e.method) {
                    if (t.iterator.return && (e.method = "return", e.arg = r, O(t, e), "throw" === e.method)) return y;
                    e.method = "throw", e.arg = new TypeError("The iterator does not provide a 'throw' method");
                }
                return y;
            }
            var o = L(n, t.iterator, e.arg);
            if ("throw" === o.type) return e.method = "throw", e.arg = o.arg, e.delegate = null,
                y;
            var i = o.arg;
            return i ? i.done ? (e[t.resultName] = i.value, e.next = t.nextLoc, "return" !== e.method && (e.method = "next",
                e.arg = r), e.delegate = null, y) : i : (e.method = "throw", e.arg = new TypeError("iterator result is not an object"),
                    e.delegate = null, y);
        }
        function k(t) {
            var r = {
                tryLoc: t[0]
            };
            1 in t && (r.catchLoc = t[1]), 2 in t && (r.finallyLoc = t[2], r.afterLoc = t[3]),
                this.tryEntries.push(r);
        }
        function G(t) {
            var r = t.completion || {};
            r.type = "normal", delete r.arg, t.completion = r;
        }
        function N(t) {
            this.tryEntries = [{
                tryLoc: "root"
            }], t.forEach(k, this), this.reset(!0);
        }
        function P(t) {
            if (t) {
                var e = t[i];
                if (e) return e.call(t);
                if ("function" == typeof t.next) return t;
                if (!isNaN(t.length)) {
                    var o = -1, a = function e() {
                        for (; ++o < t.length;) if (n.call(t, o)) return e.value = t[o], e.done = !1, e;
                        return e.value = r, e.done = !0, e;
                    };
                    return a.next = a;
                }
            }
            return {
                next: F
            };
        }
        function F() {
            return {
                value: r,
                done: !0
            };
        }
    }(function () {
        return this || "object" == typeof self && self;
    });

    var _regenerator = _interopRequireDefault(_regeneratorRequire);
    //#endregion

    var e = _typeof2,
        t = _get2,
        n = _getPrototypeOf2,
        o = _createClass2,
        i = _classCallCheck2,
        s = _inherits2,
        a = _createSuper2;

    var h = Object.freeze({
        __proto__: null
    }), u = function (e) {
        s(n, e);
        var t = a(n);
        function n() {
            var e;
            return i(this, n), (e = t.apply(this, arguments)).IsDebug = !1, e.AppID = "", e.APIVersion = "1.0.1",
                e.GameId = "847", e.VideoAdPos = "adunit-6babf2b6fe995de9", e.BannerAdPos = "adunit-ec41b38708383771",
                e.CustomAdPos = ["adunit-2965bbc49e487c89", "adunit-b646144c8db0e09d", "adunit-e7577d6c61083f4e"],
                e.Scene = [1005, 1006, 1007, 1008, 1011, 1012, 1013, 1014, 1017, 1020, 1023, 1024, 1025, 1030, 1031, 1032, 1036, 1042, 1044, 1047, 1048, 1049, 1053, 1102, 1129],
                e.shareImgIds = [{
                    url: "https://mmocgame.qpic.cn/wechatgame/UBpdRoXnpwHkz6kbKLiadPfKxvFrapyj3ibXAsctrUAgtL5pFIgUrAVtJpBBh0dMUb/0",
                    id: "1BqRasaJQ1uqH3pTwLOdNA=="
                }, {
                    url: "https://mmocgame.qpic.cn/wechatgame/UBpdRoXnpwEImgibEqwhVKys0OOHNJ20orBTQhkU2NgVMIYuyrWQ5tOGjCeEyZp8y/0",
                    id: "is7pcX2hQzejv/avk0qhvA=="
                }, {
                    url: "https://mmocgame.qpic.cn/wechatgame/UBpdRoXnpwEE6XsEOU7GkD0QAPAvt9lsApicLLXRt4YTmViczIlzkSmiajQu9sdooas/0",
                    id: "0DN6dI3cQZWzS3ylAP8+YA=="
                }], e;
        }
        return o(n);
    }(TY.LayaCore.API.SDK.SDKConfigBase), l = function (r) {
        s(u, r);
        var h = a(u);
        function u() {
            var e;
            return i(this, u), (e = h.apply(this, arguments))._isRateTime = null, e;
        }
        return o(u, [{
            key: "IsRateTime",
            get: function () {
                return this._isRateTime;
            }
        }, {
            key: "init",
            value: function (e, o, i) {
                var s = this;
                t(n(u.prototype), "init", this).call(this, e, function () {
                    s.isRateTime(), o && o();
                }, i);
            }
        }, {
            key: "setOpenIdByCode",
            value: function (e, t) {
                TY.LayaCore.Server.GameServer.getWxOpenId(e, function (e) {
                    console.log("获取openId:", e), null != e ? (TY.LayaCore.Server.GameServer.openId = e.openid,
                        t && t(e.openid)) : t && t(null);
                });
            }
        }, {
            key: "isRateTime",
            value: function () {
                var t = TY.LayaCore.SDKModel.getAdRate("time");
                console.log("res", t, e(t));
                var n = t.split("-"), o = +n[0].split(":")[0], i = +n[0].split(":")[1], s = +n[1].split(":")[0], a = +n[1].split(":")[1], r = new Date().getHours(), h = new Date().getMinutes();
                100 * r + h > 100 * o + i && 100 * r + h < 100 * s + a && (this._isRateTime = !0);
            }
        }]), u;
    }(TY.LayaCore.API.SDK.SDKModelBase), c = function (e) {
        s(h, e);
        var r = a(h);
        function h() {
            return i(this, h), r.apply(this, arguments);
        }
        return o(h, [{
            key: "UIPack",
            get: function () {
                return "WXSDK";
            }
        }, {
            key: "UICom",
            get: function () {
                return h.UIResName;
            }
        }, {
            key: "onShown",
            value: function () {
                t(n(h.prototype), "onShown", this).call(this), console.log("显示原生模板广告背景");
            }
        }, {
            key: "onHide",
            value: function () {
                t(n(h.prototype), "onHide", this).call(this), console.log("关闭原生模板广告背景"), h.callback && (h.callback(),
                    h.callback = null);
            }
        }, {
            key: "onInit",
            value: function () {
                t(n(h.prototype), "onInit", this).call(this), this.btnClose = this.contentPane.getChild("btnClose").asButton,
                    this.btnClose.onClick(this, this.onClose);
            }
        }, {
            key: "onClose",
            value: function () {
                this.hide();
            }
        }], [{
            key: "UIResName",
            get: function () {
                return "CustomADUI";
            }
        }, {
            key: "ResUrl",
            get: function () {
                return "ui://WXSDK/CustomADUI";
            }
        }, {
            key: "show",
            value: function (e) {
                h.callback = e, TY.LayaCore.UI.show(this.ResUrl);
            }
        }, {
            key: "hide",
            value: function () {
                TY.LayaCore.UI.hide(this.ResUrl);
            }
        }]), h;
    }(TY.LayaCore.Services.UIBase), d = function (e) {
        s(h, e);
        var r = a(h);
        function h() {
            var e;
            return i(this, h), (e = r.apply(this, arguments)).reduceVal = 1, e.isShowAded = !1,
                e.addProgressVal = 5, e.min = 30, e.max = 70, e.delayHideBanner = 2, e;
        }
        return o(h, [{
            key: "UIPack",
            get: function () {
                return "WXSDK";
            }
        }, {
            key: "UICom",
            get: function () {
                return h.UIResName;
            }
        }, {
            key: "onShown",
            value: function () {
                t(n(h.prototype), "onShown", this).call(this), this.triggerNum = TY.Utils.random(this.max, this.min),
                    this.progress.value = 0, this.isShowAded = !1, this.reduceTask = new TY.Task.LoopTask(this.onReduce.bind(this), .1),
                    this.reduceTask.run(TY.LayaCore.Services.StandardSchedulers.standardScheduler);
            }
        }, {
            key: "onHide",
            value: function () {
                t(n(h.prototype), "onHide", this).call(this), h.callback && (h.callback(), h.callback = null),
                    this.reduceTask.stop();
            }
        }, {
            key: "onInit",
            value: function () {
                t(n(h.prototype), "onInit", this).call(this), this.progress = this.contentPane.getChild("progress").asProgress,
                    this.btnFastClick = this.contentPane.getChild("btnFastClick").asButton, this.btnFastClick.onClick(this, this.onFastClicked);
            }
        }, {
            key: "onReduce",
            value: function () {
                this.progress.value >= 100 || (this.progress.value -= this.reduceVal, this.progress.value <= 0 && (this.progress.value = 0),
                    this.refreshProgressState());
            }
        }, {
            key: "refreshProgressState",
            value: function () {
                0 == this.progress.value ? this.progress.getChild("bar").visible = !1 : this.progress.getChild("bar").visible = !0;
            }
        }, {
            key: "onFastClicked",
            value: function () {
                var e = this;
                this.progress.value += this.addProgressVal, this.progress.value > 100 && (this.progress.value = 100),
                    this.refreshProgressState(), this.progress.value > this.triggerNum && !this.isShowAded && (TY.LayaCore.SDK.showVideo(function () {
                        e.giveReward(), e.hide();
                    }, function () {
                        e.hide();
                    }), this.isShowAded = !0);
            }
        }, {
            key: "giveReward",
            value: function () { }
        }], [{
            key: "UIResName",
            get: function () {
                return "FastClickStartUI";
            }
        }, {
            key: "ResUrl",
            get: function () {
                return "ui://WXSDK/FastClickStartUI";
            }
        }, {
            key: "show",
            value: function (e) {
                h.callback = e, TY.LayaCore.UI.show(this.ResUrl);
            }
        }, {
            key: "hide",
            value: function () {
                TY.LayaCore.UI.hide(this.ResUrl);
            }
        }]), h;
    }(TY.LayaCore.Services.UIBase), f = function (e) {
        s(h, e);
        var r = a(h);
        function h() {
            return i(this, h), r.apply(this, arguments);
        }
        return o(h, [{
            key: "UIPack",
            get: function () {
                return "WXSDK";
            }
        }, {
            key: "UICom",
            get: function () {
                return h.UIResName;
            }
        }, {
            key: "onShown",
            value: function () {
                t(n(h.prototype), "onShown", this).call(this);
            }
        }, {
            key: "onHide",
            value: function () {
                t(n(h.prototype), "onHide", this).call(this), h.callback && (h.callback(), h.callback = null);
            }
        }, {
            key: "onInit",
            value: function () {
                t(n(h.prototype), "onInit", this).call(this), this.btnOpenBox = this.contentPane.getChild("btnOpenBox").asButton,
                    this.btnOpenBox.onClick(this, this.onOpenBoxClicked);
            }
        }, {
            key: "onOpenBoxClicked",
            value: function () {
                var e = this;
                TY.LayaCore.SDK.showVideo(function () {
                    e.giveReward(), e.hide();
                }, function () {
                    e.hide();
                });
            }
        }, {
            key: "giveReward",
            value: function () { }
        }], [{
            key: "UIResName",
            get: function () {
                return "FastClickOverUI";
            }
        }, {
            key: "ResUrl",
            get: function () {
                return "ui://WXSDK/FastClickOverUI";
            }
        }, {
            key: "show",
            value: function (e) {
                h.callback = e, TY.LayaCore.UI.show(this.ResUrl);
            }
        }, {
            key: "hide",
            value: function () {
                TY.LayaCore.UI.hide(this.ResUrl);
            }
        }]), h;
    }(TY.LayaCore.Services.UIBase), y = o(function e() {
        i(this, e), this.ui = [d, f, c];
    }), w = function () {
        function e(t) {
            i(this, e), this.loaded = !1, this.posId = t;
        }
        return o(e, [{
            key: "SysInfo",
            get: function () {
                return null == this.sysInfo && (this.sysInfo = wx.getSystemInfoSync()), this.sysInfo;
            }
        }, {
            key: "createAd",
            value: function (e) {
                var t = this;
                this.loaded = !1, wx.createCustomAd && (this.width ? this.customAd = wx.createCustomAd({
                    adUnitId: this.posId,
                    style: {
                        left: this.left,
                        top: this.top,
                        width: this.width,
                        fixed: !0
                    }
                }) : this.customAd = wx.createCustomAd({
                    adUnitId: this.posId,
                    style: {
                        left: this.left,
                        top: this.top,
                        fixed: !0
                    }
                }), this.customAd.onError(function (e) {
                    console.log("原生模板广告创建失败:", e, t.posId), t.onClose();
                }), this.customAd.onLoad(function () {
                    console.log("原生模板广告加载成功:", t.posId), t.loaded = !0, e && t.customAd.show().then(function () {
                        t.onShown(), console.log("进入加载");
                    });
                }), this.customAd.onClose(function () {
                    t.createAd(!1), t.onClose();
                }));
            }
        }, {
            key: "onShown",
            value: function () {
                this.onShownHandler && (this.onShownHandler(), this.onShownHandler = null), console.log("原生模板广告展示完成");
            }
        }, {
            key: "onClose",
            value: function () {
                this.onCloseHandler && (this.onCloseHandler(), this.onCloseHandler = null), console.error("关闭原生模板广告");
            }
        }, {
            key: "show",
            value: function (e, t, n, o, i) {
                var s = this;
                window.wx && wx.createCustomAd ? (this.onShownHandler = o, this.onCloseHandler = i,
                    this.left != e || this.top != t || this.width != n ? (this.left = e, this.top = t,
                        this.width = n, this.destroy(), console.log("更换位置  重新创建"), this.createAd(!0)) : this.loaded ? (console.error("原生模板广告加载成功  开始显示"),
                            this.customAd.show().then(function () {
                                s.onShown();
                            })) : (console.log("加载原生模板广告兵显示"), this.createAd(!0))) : console.log("应该不回走");
            }
        }, {
            key: "destroy",
            value: function () {
                this.customAd && this.customAd.destroy();
            }
        }, {
            key: "hide",
            value: function () {
                this.customAd && (this.customAd.hide(), this.destroy(), this.createAd(!1)), this.onClose();
            }
        }]), e;
    }(), g = o(function e() {
        i(this, e);
    });
    g.IWXSDK = "IWXSDK", g.IWXSDKModel = "IWXSDKModel", g.IWXSDKConfig = "IWXSDKConfig",
        g.IWXView = "IWXView";
    var p = function (e) {
        s(h, e);
        var r = a(h);
        function h() {
            return i(this, h), r.apply(this, arguments);
        }
        return o(h, null, [{
            key: "that",
            get: function () {
                return t(n(h), "getThat", this).call(this);
            }
        }]), h;
    }(TY.Facade);
    p.serviceName = g.IWXSDKConfig;
    var v = function () {
        function e() {
            i(this, e);
        }
        return o(e, null, [{
            key: "createBanner",
            value: function () {
                var e = this, t = arguments.length > 0 && void 0 !== arguments[0] && arguments[0];
                if (wx.createBannerAd) {
                    var n, o, i, s = this.SysInfo.windowWidth, a = this.SysInfo.windowHeight;
                    if (s > a) {
                        var r = s / 3, h = 300, u = 72;
                        r < h ? (r = h, n = (s - h) / 2, o = a - u) : (n = r, o = a - u / h * r), i = r;
                    } else n = 0, o = a - s / 16 * 4, i = s;
                    this.mADBanner = wx.createBannerAd({
                        adUnitId: p.that.BannerAdPos,
                        style: {
                            left: n,
                            top: o,
                            width: i
                        }
                    }), this.mADBanner.onResize(function (t) {
                        e.mADBanner.style.top = e.SysInfo.windowHeight - e.mADBanner.style.realHeight - 10,
                            e.mADBanner.style.left = (e.SysInfo.windowWidth - e.mADBanner.style.realWidth) / 2;
                    }), this.mADBanner.onError(function (e) {
                        console.log("banner 广告错误" + JSON.stringify(e));
                    }), t && new TY.Task.DelayTask(.1, function () {
                        e.mADBanner.show();
                    }).run(TY.LayaCore.Services.StandardSchedulers.standardScheduler);
                }
            }
        }, {
            key: "destroy",
            value: function () {
                this.mADBanner && (this.mADBanner.destroy(), this.mADBanner = null);
            }
        }, {
            key: "reCreateBanner",
            value: function (e) {
                var t = this;
                this.destroy(), new TY.Task.DelayTask(.2, function () {
                    t.createBanner(e);
                }).run(TY.LayaCore.Services.StandardSchedulers.standardScheduler);
            }
        }, {
            key: "showBanner",
            value: function () {
                this.mADBanner && (this.mADBanner.show(), this.refreshFlag = !0);
            }
        }, {
            key: "hideBanner",
            value: function () {
                this.mADBanner && (this.mADBanner.hide(), this.refreshFlag = !1, this.reCreateBanner(!1));
            }
        }, {
            key: "SysInfo",
            get: function () {
                return null == this.sysInfo && (this.sysInfo = wx.getSystemInfoSync()), this.sysInfo;
            }
        }, {
            key: "RefreshFlag",
            set: function (e) {
                this.refreshFlag = e;
            }
        }, {
            key: "BannerRateKey",
            get: function () {
                return "banner";
            }
        }, {
            key: "bannerRefreshTaskStart",
            value: function () {
                TY.LayaCore.SDKModel.isPingbi || 0 == TY.LayaCore.SDKModel.getAdRate(this.BannerRateKey) || (this.showBannerTask && this.showBannerTask.stop(),
                    this.showBannerTask = new TY.Task.DelayTask(TY.LayaCore.SDKModel.getAdRate(this.BannerRateKey), this.showBannerTaskLoop.bind(this)),
                    this.showBannerTask.run(TY.LayaCore.Services.StandardSchedulers.standardScheduler));
            }
        }, {
            key: "showBannerTaskLoop",
            value: function () {
                this.bannerRefreshTaskStart(), this.refreshFlag ? this.reCreateBanner(!0) : this.reCreateBanner(!1);
            }
        }]), e;
    }();
    v.refreshFlag = !1;
    var S = function () {
        function e() {
            i(this, e);
        }
        return o(e, null, [{
            key: "createVideo",
            value: function () {
                wx.createRewardedVideoAd && (this.mVideoAd = wx.createRewardedVideoAd({
                    adUnitId: p.that.VideoAdPos
                }), this.loaded = !1, this.mVideoAd.onError(function (e) {
                    console.log("激励视频加载失败:", e);
                }), this.mVideoAd.onLoad(function () {
                    e.loaded = !0;
                }), this.mVideoAd.onClose(function (t) {
                    e.onCloseVideo(t);
                }));
            }
        }, {
            key: "show",
            value: function (e, t) {
                var n = this;
                window.wx ? (this.onReward = e, this.onClose = t, this.loaded ? this.mVideoAd.show().then(function () {
                    n.onShown();
                }) : this.mVideoAd.load().then(function () {
                    n.mVideoAd.show().then(function () {
                        n.onShown();
                    });
                })) : e && (e(), e = null);
            }
        }, {
            key: "onShown",
            value: function () {
                this.beforeMusicVol = TY.LayaCore.Sound.musicVolume, this.beforeSoundVol = TY.LayaCore.Sound.soundVolume,
                    TY.LayaCore.Sound.musicVolume = 0, TY.LayaCore.Sound.soundVolume = 0;
            }
        }, {
            key: "onCloseVideo",
            value: function (e) {
                e && e.isEnded ? this.onReward && (this.onReward(), this.onReward = null) : this.onClose && (this.onClose(),
                    this.onClose = null), this.onReward = null, this.onClose = null, this.loaded = !1,
                    TY.LayaCore.Sound.musicVolume = this.beforeMusicVol, TY.LayaCore.Sound.soundVolume = this.beforeSoundVol;
            }
        }]), e;
    }();
    S.loaded = !1, S.beforeMusicVol = 1, S.beforeSoundVol = 1;
    var k = function (e) {
        s(h, e);
        var r = a(h);
        function h() {
            return i(this, h), r.apply(this, arguments);
        }
        return o(h, null, [{
            key: "that",
            get: function () {
                return t(n(h), "getThat", this).call(this);
            }
        }, {
            key: "IsRateTime",
            get: function () {
                return this.that.IsRateTime;
            }
        }, {
            key: "setOpenIdByCode",
            value: function (e, t) {
                this.that.setOpenIdByCode(e, t);
            }
        }]), h;
    }(TY.Facade);
    k.serviceName = g.IWXSDKModel;
    var m = function (e) {
        s(n, e);
        var t = a(n);
        function n() {
            var e;
            return i(this, n), (e = t.apply(this, arguments)).channel = TY.LayaCore.API.SDK.SDKChannel.MP,
                e.customAD = [], e;
        }
        return o(n, [{
            key: "init",
            value: function (e) {
                var t = this, n = "";
                if (window.wx && (n = wx.getLaunchOptionsSync().query.channel_id), this.sdkModel && this.sdkModel.init(TY.LayaCore.Server.GameServer.createOpenId(), function () {
                    e && e(), t.getLaunchOptions(), t.showShareMenu(), t.login();
                }, n), window.wx) {
                    S.createVideo(), v.createBanner(!1);
                    for (var o = p.that.CustomAdPos, i = 0; i < o.length; i++) this.customAD.push(new w(p.that.CustomAdPos[i]));
                }
            }
        }, {
            key: "login",
            value: function (e) {
                window.wx ? wx.login({
                    success: function (t) {
                        t.code ? k.setOpenIdByCode(t.code, function (t) {
                            var n = wx.getLaunchOptionsSync().query.channel_id;
                            null != t ? (console.log("获取openId成功:", t, n), wx.uma.trackEvent("loginsuccess"),
                                wx.uma.setOpenid(t)) : console.log("获取openId失败:", n), e && e();
                        }) : (console.log("登录失败！success:" + t.errMsg), e && e());
                    },
                    fail: function () {
                        console.log("登录失败！fail"), e && e();
                    },
                    complete: function () { }
                }) : e && e();
            }
        }, {
            key: "SysInfo",
            get: function () {
                return null == this.sysInfo && (this.sysInfo = wx.getSystemInfoSync()), this.sysInfo;
            }
        }, {
            key: "windowWidth",
            get: function () {
                if (window.wx) return this.SysInfo.windowWidth;
            }
        }, {
            key: "windowHeight",
            get: function () {
                if (window.wx) return this.SysInfo.windowHeight;
            }
        }, {
            key: "getLaunchOptions",
            value: function () {
                if (window.wx && (console.log("场景屏蔽:", TY.LayaCore.SDKModel.getAdRate("wudian")),
                    1 == TY.LayaCore.SDKModel.getAdRate("wudian"))) {
                    var e = wx.getLaunchOptionsSync();
                    if (e) {
                        var t = e.scene;
                        -1 != p.that.Scene.findIndex(function (e) {
                            return e == t;
                        }) && TY.LayaCore.SDKModel.setPingbi(!0);
                    } else console.log("获取启动参数失败");
                }
            }
        }, {
            key: "showVideo",
            value: function (e, t) {
                p.that.IsDebug ? e && e() : S.show(e, t);
            }
        }, {
            key: "showBanner",
            value: function (e) {
                v.showBanner();
            }
        }, {
            key: "hideBanner",
            value: function () {
                v.hideBanner();
            }
        }, {
            key: "showCustomAD",
            value: function (e, t, n, o, i, s) {
                this.customAD[e] && this.customAD[e].show(t, n, o, i, s);
            }
        }, {
            key: "hideCustomAD",
            value: function (e) {
                this.customAD[e] && this.customAD[e].hide();
            }
        }, {
            key: "showShareMenu",
            value: function () {
                if (window.wx) {
                    wx.showShareMenu({
                        withShareTicket: !0,
                        menus: ["shareAppMessage"]
                    });
                    var e = p.that.shareImgIds[1e3 * Math.random() % p.that.shareImgIds.length | 0];
                    wx.uma.onShareAppMessage(function () {
                        return {
                            imageUrl: e.url,
                            imageUrlId: e.id
                        };
                    });
                }
            }
        }]), n;
    }(TY.LayaCore.API.SDK.SDKMgrBase), C = function (e) {
        s(h, e);
        var r = a(h);
        function h() {
            return i(this, h), r.apply(this, arguments);
        }
        return o(h, null, [{
            key: "that",
            get: function () {
                return t(n(h), "getThat", this).call(this);
            }
        }, {
            key: "showCustomAD",
            value: function (e, t, n, o, i, s) {
                this.that.showCustomAD(e, t, n, o, i, s);
            }
        }, {
            key: "hideCustomAD",
            value: function (e) {
                this.that.hideCustomAD(e);
            }
        }, {
            key: "SysInfo",
            get: function () {
                return this.that.SysInfo;
            }
        }, {
            key: "windowWidth",
            get: function () {
                return this.that.windowWidth;
            }
        }, {
            key: "windowHeight",
            get: function () {
                return this.that.windowHeight;
            }
        }]), h;
    }(TY.Facade);
    C.serviceName = g.IWXSDK;
    var I = function (e) {
        s(h, e);
        var r = a(h);
        function h() {
            return i(this, h), r.apply(this, arguments);
        }
        return o(h, [{
            key: "register",
            value: function () {
                t(n(h.prototype), "register", this).call(this), TY.App.singleton(g.IWXSDK, m).alias(TY.LayaCore.API.ServiceType.ISDK);
            }
        }]), h;
    }(TY.ServiceProvider), A = function (e) {
        s(h, e);
        var r = a(h);
        function h(e) {
            var t;
            return i(this, h), (t = r.call(this)).sdkcfg = e, t;
        }
        return o(h, [{
            key: "register",
            value: function () {
                t(n(h.prototype), "register", this).call(this), TY.App.singleton(g.IWXSDKConfig, this.sdkcfg).alias(TY.LayaCore.API.ServiceType.ISDKConfig);
            }
        }]), h;
    }(TY.ServiceProvider), D = function (e) {
        s(h, e);
        var r = a(h);
        function h() {
            return i(this, h), r.apply(this, arguments);
        }
        return o(h, [{
            key: "register",
            value: function () {
                t(n(h.prototype), "register", this).call(this), TY.App.singleton(g.IWXSDKModel, l).alias(TY.LayaCore.API.ServiceType.ISDKModel);
            }
        }]), h;
    }(TY.ServiceProvider);
    r.ADBanner = v, r.ADCustom = w, r.ADVideo = S, r.API = h, r.CustomADUI = c, r.FastClickOverUI = f,
        r.FastClickStartUI = d, r.ProviderWXSDK = I, r.ProviderWXSDKConfig = A, r.ProviderWXSDKModel = D,
        r.SDK = C, r.SDKConfig = p, r.SDKConfigBase = u, r.SDKMgr = m, r.SDKModel = k, r.ServicesType = g,
        r.WXDKViewBase = y, r.WXSDKModel = l, Object.defineProperty(r, "__esModule", {
            value: !0
        });
}(window.TY.WXSDK = window.TY.WXSDK || {});