var _interopRequireDefault = arequire("../@babel/runtime/helpers/interopRequireDefault");

var _get2 = _interopRequireDefault(arequire("../@babel/runtime/helpers/get"));

var _assertThisInitialized2 = _interopRequireDefault(arequire("../@babel/runtime/helpers/assertThisInitialized"));

var _possibleConstructorReturn2 = _interopRequireDefault(arequire("../@babel/runtime/helpers/possibleConstructorReturn"));

var _getPrototypeOf2 = _interopRequireDefault(arequire("../@babel/runtime/helpers/getPrototypeOf"));

var _inherits2 = _interopRequireDefault(arequire("../@babel/runtime/helpers/inherits"));

var _classCallCheck2 = _interopRequireDefault(arequire("../@babel/runtime/helpers/classCallCheck"));

var _createClass2 = _interopRequireDefault(arequire("../@babel/runtime/helpers/createClass"));

function _createSuper(Derived) {
    return function() {
        var Super = (0, _getPrototypeOf2.default)(Derived), result;
        if (_isNativeReflectConstruct()) {
            var NewTarget = (0, _getPrototypeOf2.default)(this).constructor;
            result = Reflect.construct(Super, arguments, NewTarget);
        } else {
            result = Super.apply(this, arguments);
        }
        return (0, _possibleConstructorReturn2.default)(this, result);
    };
}

function _isNativeReflectConstruct() {
    if (typeof Reflect === "undefined" || !Reflect.construct) return false;
    if (Reflect.construct.sham) return false;
    if (typeof Proxy === "function") return true;
    try {
        Date.prototype.toString.call(Reflect.construct(Date, [], function() {}));
        return true;
    } catch (e) {
        return false;
    }
}

window.wxMiniGame = function(e, t) {
    "use strict";
    var i = /* */ function() {
        function i() {
            (0, _classCallCheck2.default)(this, i);
        }
        (0, _createClass2.default)(i, null, [ {
            key: "isLocalNativeFile",
            value: function isLocalNativeFile(e) {
                for (var t = 0, i = l.nativefiles.length; t < i; t++) {
                    if (-1 != e.indexOf(l.nativefiles[t])) return !0;
                }
                return !1;
            }
        }, {
            key: "getFileInfo",
            value: function getFileInfo(e) {
                var t = e, a = i.fakeObj[t];
                return null == a ? null : a;
            }
        }, {
            key: "read",
            value: function read(e) {
                var a = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "utf8";
                var n = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
                var s = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : "";
                var o = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : !1;
                var r = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : "";
                var l;
                l = "" == s || -1 == s.indexOf("http://") && -1 == s.indexOf("https://") ? e : i.getFileNativePath(e), 
                l = t.URL.getAdptedFilePath(l), i.fs.readFile({
                    filePath: l,
                    encoding: a,
                    success: function success(e) {
                        null != n && n.runWith([ 0, e ]);
                    },
                    fail: function fail(e) {
                        e && "" != s ? i.downFiles(s, a, n, s, o, r) : null != n && n.runWith([ 1 ]);
                    }
                });
            }
        }, {
            key: "downFiles",
            value: function downFiles(e) {
                var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "utf8";
                var a = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
                var n = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : "";
                var s = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : !1;
                var o = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : "";
                var r = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : !0;
                i.wxdown({
                    url: e,
                    success: function success(l) {
                        200 === l.statusCode ? i.readFile(l.tempFilePath, t, a, n, s, o, r) : 403 === l.statusCode ? null != a && a.runWith([ 0, e ]) : null != a && a.runWith([ 1, l ]);
                    },
                    fail: function fail(e) {
                        null != a && a.runWith([ 1, e ]);
                    }
                }).onProgressUpdate(function(e) {
                    null != a && a.runWith([ 2, e.progress ]);
                });
            }
        }, {
            key: "readFile",
            value: function readFile(e) {
                var a = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "utf8";
                var n = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
                var s = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : "";
                var o = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : !1;
                var r = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : "";
                var d = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : !0;
                e = t.URL.getAdptedFilePath(e), i.fs.readFile({
                    filePath: e,
                    encoding: a,
                    success: function success(t) {
                        (-1 != e.indexOf("http://") || -1 != e.indexOf("https://")) && (l.autoCacheFile || o) ? (null != n && n.runWith([ 0, t ]), 
                        i.copyFile(e, s, null, a, d)) : null != n && n.runWith([ 0, t ]);
                    },
                    fail: function fail(e) {
                        e && null != n && n.runWith([ 1, e ]);
                    }
                });
            }
        }, {
            key: "downOtherFiles",
            value: function downOtherFiles(e) {
                var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
                var a = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "";
                var n = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : !1;
                var s = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : !0;
                i.wxdown({
                    url: e,
                    success: function success(e) {
                        200 === e.statusCode ? (l.autoCacheFile || n) && -1 == a.indexOf("qlogo.cn") && -1 == a.indexOf(".php") ? (null != t && t.runWith([ 0, e.tempFilePath ]), 
                        i.copyFile(e.tempFilePath, a, null, "", s)) : null != t && t.runWith([ 0, e.tempFilePath ]) : null != t && t.runWith([ 1, e ]);
                    },
                    fail: function fail(e) {
                        null != t && t.runWith([ 1, e ]);
                    }
                });
            }
        }, {
            key: "downLoadFile",
            value: function downLoadFile(e) {
                var a = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
                var n = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
                var s = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : "utf8";
                window.navigator.userAgent.indexOf("MiniGame") < 0 ? t.Laya.loader.load(e, n) : a == t.Loader.IMAGE || a == t.Loader.SOUND ? i.downOtherFiles(e, n, e, !0, !1) : i.downFiles(e, s, n, e, !0, a, !1);
            }
        }, {
            key: "copyFile",
            value: function copyFile(e, a, n) {
                var s = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : "";
                var o = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : !0;
                var r = e.split("/"), d = r[r.length - 1], u = a, c = i.getFileInfo(a), h = i.getFileNativePath(d);
                i.fakeObj[u] = {
                    md5: d,
                    readyUrl: a,
                    size: 0,
                    times: t.Browser.now(),
                    encoding: s
                };
                var f = i.getCacheUseSize();
                c ? c.readyUrl != a ? i.fs.getFileInfo({
                    filePath: e,
                    success: function success(t) {
                        o && f + 4194304 + t.size >= 52428800 && (t.size > l.minClearSize && (l.minClearSize = t.size), 
                        i.onClearCacheRes()), i.deleteFile(e, a, n, s, t.size);
                    },
                    fail: function fail(e) {
                        null != n && n.runWith([ 1, e ]);
                    }
                }) : null != n && n.runWith([ 0 ]) : i.fs.getFileInfo({
                    filePath: e,
                    success: function success(t) {
                        o && f + 4194304 + t.size >= 52428800 && (t.size > l.minClearSize && (l.minClearSize = t.size), 
                        i.onClearCacheRes()), i.fs.copyFile({
                            srcPath: e,
                            destPath: h,
                            success: function success(e) {
                                i.onSaveFile(a, d, !0, s, n, t.size);
                            },
                            fail: function fail(e) {
                                null != n && n.runWith([ 1, e ]);
                            }
                        });
                    },
                    fail: function fail(e) {
                        null != n && n.runWith([ 1, e ]);
                    }
                });
            }
        }, {
            key: "onClearCacheRes",
            value: function onClearCacheRes() {
                var e = l.minClearSize, t = [];
                for (var a in i.filesListObj) {
                    "fileUsedSize" != a && t.push(i.filesListObj[a]);
                }
                i.sortOn(t, "times", i.NUMERIC);
                for (var n = 0, s = 1, o = t.length; s < o; s++) {
                    var r = t[s];
                    if (n >= e) break;
                    n += r.size, i.deleteFile("", r.readyUrl);
                }
            }
        }, {
            key: "sortOn",
            value: function sortOn(e, t) {
                var a = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
                return a == i.NUMERIC ? e.sort(function(e, i) {
                    return e[t] - i[t];
                }) : a == (i.NUMERIC | i.DESCENDING) ? e.sort(function(e, i) {
                    return i[t] - e[t];
                }) : e.sort(function(e, i) {
                    return e[t] - i[t];
                });
            }
        }, {
            key: "getFileNativePath",
            value: function getFileNativePath(e) {
                return i.fileNativeDir + "/" + e;
            }
        }, {
            key: "deleteFile",
            value: function deleteFile(e) {
                var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
                var a = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
                var n = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : "";
                var s = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
                var o = i.getFileInfo(t), r = i.getFileNativePath(o.md5), l = "" != e;
                i.onSaveFile(t, e, l, n, a, s), i.fs.unlink({
                    filePath: r,
                    success: function success(t) {
                        if ("" != e) {
                            var n = i.getFileNativePath(e);
                            i.fs.copyFile({
                                srcPath: e,
                                destPath: n,
                                success: function success(e) {},
                                fail: function fail(e) {
                                    null != a && a.runWith([ 1, e ]);
                                }
                            });
                        }
                    },
                    fail: function fail(e) {}
                });
            }
        }, {
            key: "deleteAll",
            value: function deleteAll() {
                var e = [];
                for (var t in i.filesListObj) {
                    "fileUsedSize" != t && e.push(i.filesListObj[t]);
                }
                for (var a = 1, n = e.length; a < n; a++) {
                    var s = e[a];
                    i.deleteFile("", s.readyUrl);
                }
                i.filesListObj && i.filesListObj.fileUsedSize && (i.filesListObj.fileUsedSize = 0), 
                i.writeFilesList("", JSON.stringify({}), !1);
            }
        }, {
            key: "onSaveFile",
            value: function onSaveFile(e, a) {
                var n = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : !0;
                var s = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : "";
                var o = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
                var r = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
                var l = e;
                if (null == i.filesListObj.fileUsedSize && (i.filesListObj.fileUsedSize = 0), n) {
                    i.getFileNativePath(a);
                    i.filesListObj[l] = {
                        md5: a,
                        readyUrl: e,
                        size: r,
                        times: t.Browser.now(),
                        encoding: s
                    }, i.filesListObj.fileUsedSize = parseInt(i.filesListObj.fileUsedSize) + r, i.writeFilesList(l, JSON.stringify(i.filesListObj), !0), 
                    null != o && o.runWith([ 0 ]);
                } else if (i.filesListObj[l]) {
                    var d = parseInt(i.filesListObj[l].size);
                    i.filesListObj.fileUsedSize = parseInt(i.filesListObj.fileUsedSize) - d, delete i.filesListObj[l], 
                    i.writeFilesList(l, JSON.stringify(i.filesListObj), !1), null != o && o.runWith([ 0 ]);
                }
            }
        }, {
            key: "writeFilesList",
            value: function writeFilesList(e, t, a) {
                var n = i.fileNativeDir + "/" + i.fileListName;
                i.fs.writeFile({
                    filePath: n,
                    encoding: "utf8",
                    data: t,
                    success: function success(e) {},
                    fail: function fail(e) {}
                }), !l.isZiYu && l.isPosMsgYu && l.window.wx.postMessage({
                    url: e,
                    data: i.filesListObj[e],
                    isLoad: "filenative",
                    isAdd: a
                });
            }
        }, {
            key: "getCacheUseSize",
            value: function getCacheUseSize() {
                return i.filesListObj && i.filesListObj.fileUsedSize ? i.filesListObj.fileUsedSize : 0;
            }
        }, {
            key: "existDir",
            value: function existDir(e, t) {
                i.fs.mkdir({
                    dirPath: e,
                    success: function success(e) {
                        null != t && t.runWith([ 0, {
                            data: JSON.stringify({})
                        } ]);
                    },
                    fail: function fail(e) {
                        -1 != e.errMsg.indexOf("file already exists") ? i.readSync(i.fileListName, "utf8", t) : null != t && t.runWith([ 1, e ]);
                    }
                });
            }
        }, {
            key: "readSync",
            value: function readSync(e) {
                var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "utf8";
                var a = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
                var n = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : "";
                var s, o = i.getFileNativePath(e);
                try {
                    s = i.fs.readFileSync(o, t), null != a && a.runWith([ 0, {
                        data: s
                    } ]);
                } catch (e) {
                    null != a && a.runWith([ 1 ]);
                }
            }
        }, {
            key: "setNativeFileDir",
            value: function setNativeFileDir(e) {
                i.fileNativeDir = l.window.wx.env.USER_DATA_PATH + e;
            }
        } ]);
        return i;
    }();
    i.fs = window.wx.getFileSystemManager(), i.wxdown = window.wx.downloadFile, i.filesListObj = {}, 
    i.fakeObj = {}, i.fileListName = "layaairfiles.txt", i.ziyuFileData = {}, i.ziyuFileTextureData = {}, 
    i.loadPath = "", i.DESCENDING = 2, i.NUMERIC = 16;
    var a = /* */ function(_t$SoundChannel) {
        (0, _inherits2.default)(a, _t$SoundChannel);
        var _super = _createSuper(a);
        function a(e, t) {
            var _this;
            (0, _classCallCheck2.default)(this, a);
            _this = _super.call(this), _this._audio = e, _this._miniSound = t, _this._onEnd = a.bindToThis(_this.__onEnd, (0, 
            _assertThisInitialized2.default)(_this)), e.onEnded(_this._onEnd);
            return _this;
        }
        (0, _createClass2.default)(a, [ {
            key: "__onEnd",
            value: function __onEnd() {
                if (1 == this.loops) return this.completeHandler && (t.Laya.systemTimer.once(10, this, this.__runComplete, [ this.completeHandler ], !1), 
                this.completeHandler = null), this.stop(), void this.event(t.Event.COMPLETE);
                this.loops > 0 && this.loops--, this.startTime = 0, this.play();
            }
        }, {
            key: "play",
            value: function play() {
                this.isStopped = !1, t.SoundManager.addChannel(this), this._audio.play();
            }
        }, {
            key: "stop",
            value: function stop() {
                this.isStopped = !0, t.SoundManager.removeChannel(this), this.completeHandler = null, 
                this._audio && (this._audio.stop(), this.loop || (this._audio.offEnded(null), this._miniSound.dispose(), 
                this._audio = null, this._miniSound = null, this._onEnd = null));
            }
        }, {
            key: "pause",
            value: function pause() {
                this.isStopped = !0, this._audio.pause();
            }
        }, {
            key: "resume",
            value: function resume() {
                this._audio && (this.isStopped = !1, t.SoundManager.addChannel(this), this._audio.play());
            }
        }, {
            key: "startTime",
            set: function set(e) {
                this._audio && (this._audio.startTime = e);
            }
        }, {
            key: "autoplay",
            set: function set(e) {
                this._audio.autoplay = e;
            },
            get: function get() {
                return this._audio.autoplay;
            }
        }, {
            key: "position",
            get: function get() {
                return this._audio ? this._audio.currentTime : 0;
            }
        }, {
            key: "duration",
            get: function get() {
                return this._audio ? this._audio.duration : 0;
            }
        }, {
            key: "loop",
            get: function get() {
                return this._audio.loop;
            },
            set: function set(e) {
                this._audio.loop = e;
            }
        }, {
            key: "volume",
            set: function set(e) {
                this._audio && (this._audio.volume = e);
            },
            get: function get() {
                return this._audio ? this._audio.volume : 1;
            }
        } ], [ {
            key: "bindToThis",
            value: function bindToThis(e, t) {
                return e.bind(t);
            }
        } ]);
        return a;
    }(t.SoundChannel);
    var n = /* */ function(_t$EventDispatcher) {
        (0, _inherits2.default)(n, _t$EventDispatcher);
        var _super2 = _createSuper(n);
        function n() {
            var _this2;
            (0, _classCallCheck2.default)(this, n);
            _this2 = _super2.call(this), _this2.loaded = !1;
            return _this2;
        }
        (0, _createClass2.default)(n, [ {
            key: "load",
            value: function load(e) {
                if (n._musicAudio || (n._musicAudio = n._createSound()), i.isLocalNativeFile(e)) {
                    if (-1 != e.indexOf("http://") || -1 != e.indexOf("https://")) if ("" != i.loadPath) e = e.split(i.loadPath)[1]; else {
                        var a = "" != t.URL.rootPath ? t.URL.rootPath : t.URL._basePath;
                        "" != a && (e = e.split(a)[1]);
                    }
                } else e = t.URL.formatURL(e);
                if (this.url = e, this.readyUrl = e, n._audioCache[this.readyUrl]) this.event(t.Event.COMPLETE); else if (l.autoCacheFile && i.getFileInfo(e)) this.onDownLoadCallBack(e, 0); else if (l.autoCacheFile) {
                    if (i.isLocalNativeFile(e)) {
                        var s = e;
                        if ("" != (a = "" != t.URL.rootPath ? t.URL.rootPath : t.URL._basePath) && (e = e.split(a)[1]), 
                        e || (e = s), l.subNativeFiles && 0 == l.subNativeheads.length) for (var o in l.subNativeFiles) {
                            var r = l.subNativeFiles[o];
                            l.subNativeheads = l.subNativeheads.concat(r);
                            for (var d = 0; d < r.length; d++) {
                                l.subMaps[r[d]] = o + "/" + r[d];
                            }
                        }
                        if (l.subNativeFiles && -1 != e.indexOf("/")) {
                            var u = e.split("/")[0] + "/";
                            if (u && -1 != l.subNativeheads.indexOf(u)) {
                                var c = l.subMaps[u];
                                e = e.replace(u, c);
                            }
                        }
                        this.onDownLoadCallBack(e, 0);
                    } else !i.isLocalNativeFile(e) && -1 == e.indexOf("http://") && -1 == e.indexOf("https://") || -1 != e.indexOf("http://usr/") ? this.onDownLoadCallBack(e, 0) : i.downOtherFiles(e, t.Handler.create(this, this.onDownLoadCallBack, [ e ]), e);
                } else this.onDownLoadCallBack(e, 0);
            }
        }, {
            key: "onDownLoadCallBack",
            value: function onDownLoadCallBack(e, a) {
                var s = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
                if (a) this.event(t.Event.ERROR); else {
                    var o;
                    if (l.autoCacheFile) {
                        if (s) o = s; else if (i.isLocalNativeFile(e)) {
                            var r = "" != t.URL.rootPath ? t.URL.rootPath : t.URL._basePath, d = e;
                            "" == r || -1 == e.indexOf("http://") && -1 == e.indexOf("https://") || (o = e.split(r)[1]), 
                            o || (o = d);
                        } else {
                            var u = i.getFileInfo(e);
                            if (u && u.md5) {
                                var c = u.md5;
                                o = i.getFileNativePath(c);
                            } else o = e;
                        }
                        this.url != t.SoundManager._bgMusic ? (this._sound = n._createSound(), this._sound.src = this.url = o) : (this._sound = n._musicAudio, 
                        this._sound.src = this.url = o);
                    } else this.url != t.SoundManager._bgMusic ? (this._sound = n._createSound(), this._sound.src = e) : (this._sound = n._musicAudio, 
                    this._sound.src = e);
                    this._sound.onCanplay(n.bindToThis(this.onCanPlay, this)), this._sound.onError(n.bindToThis(this.onError, this));
                }
            }
        }, {
            key: "onError",
            value: function onError(e) {
                try {
                    console.log("-----1---------------minisound-----id:" + n._id), console.log(e);
                } catch (e) {
                    console.log("-----2---------------minisound-----id:" + n._id), console.log(e);
                }
                this.event(t.Event.ERROR), this._sound.offError(null);
            }
        }, {
            key: "onCanPlay",
            value: function onCanPlay() {
                this.loaded = !0, this.event(t.Event.COMPLETE), this._sound && this._sound.offCanplay(null);
            }
        }, {
            key: "play",
            value: function play() {
                var e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
                var s = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
                var o;
                if (this.url == t.SoundManager._bgMusic ? (n._musicAudio || (n._musicAudio = n._createSound()), 
                o = n._musicAudio) : o = n._audioCache[this.readyUrl] ? n._audioCache[this.readyUrl]._sound : n._createSound(), 
                !o) return null;
                if (l.autoCacheFile && i.getFileInfo(this.url)) {
                    var r = i.getFileInfo(this.url).md5;
                    o.src = this.url = i.getFileNativePath(r);
                } else o.src = this.url;
                var d = new a(o, this);
                return d.url = this.url, d.loops = s, d.loop = 0 === s, d.startTime = e, d.play(), 
                t.SoundManager.addChannel(d), d;
            }
        }, {
            key: "dispose",
            value: function dispose() {
                var e = n._audioCache[this.readyUrl];
                e && (e.src = "", e._sound && (e._sound.destroy(), e._sound = null, e = null), delete n._audioCache[this.readyUrl]), 
                this._sound && (this._sound.destroy(), this._sound = null, this.readyUrl = this.url = null);
            }
        }, {
            key: "duration",
            get: function get() {
                return this._sound.duration;
            }
        } ], [ {
            key: "_createSound",
            value: function _createSound() {
                return n._id++, l.window.wx.createInnerAudioContext();
            }
        }, {
            key: "bindToThis",
            value: function bindToThis(e, t) {
                return e.bind(t);
            }
        } ]);
        return n;
    }(t.EventDispatcher);
    n._id = 0, n._audioCache = {};
    var s = /* */ function() {
        function s() {
            (0, _classCallCheck2.default)(this, s);
        }
        (0, _createClass2.default)(s, null, [ {
            key: "_createInputElement",
            value: function _createInputElement() {
                t.Input._initInput(t.Input.area = t.Browser.createElement("textarea")), t.Input._initInput(t.Input.input = t.Browser.createElement("input")), 
                t.Input.inputContainer = t.Browser.createElement("div"), t.Input.inputContainer.style.position = "absolute", 
                t.Input.inputContainer.style.zIndex = 1e5, t.Browser.container.appendChild(t.Input.inputContainer), 
                t.Laya.stage.on("resize", null, s._onStageResize), l.window.wx.onWindowResize && l.window.wx.onWindowResize(function(e) {}), 
                t.SoundManager._soundClass = n, t.SoundManager._musicClass = n;
                var e = l.systemInfo.model, i = l.systemInfo.system;
                -1 != e.indexOf("iPhone") && (t.Browser.onIPhone = !0, t.Browser.onIOS = !0, t.Browser.onIPad = !0, 
                t.Browser.onAndroid = !1), -1 == i.indexOf("Android") && -1 == i.indexOf("Adr") || (t.Browser.onAndroid = !0, 
                t.Browser.onIPhone = !1, t.Browser.onIOS = !1, t.Browser.onIPad = !1);
            }
        }, {
            key: "_onStageResize",
            value: function _onStageResize() {
                t.Laya.stage._canvasTransform.identity().scale(t.Browser.width / t.Render.canvas.width / t.Browser.pixelRatio, t.Browser.height / t.Render.canvas.height / t.Browser.pixelRatio);
            }
        }, {
            key: "wxinputFocus",
            value: function wxinputFocus(e) {
                var i = t.Input.inputElement.target;
                i && !i.editable || (l.window.wx.offKeyboardConfirm(), l.window.wx.offKeyboardInput(), 
                l.window.wx.showKeyboard({
                    defaultValue: i.text,
                    maxLength: i.maxChars,
                    multiple: i.multiline,
                    confirmHold: !0,
                    confirmType: i.confirmType || "done",
                    success: function success(e) {},
                    fail: function fail(e) {}
                }), l.window.wx.onKeyboardConfirm(function(e) {
                    var a = e ? e.value : "";
                    i._restrictPattern && (a = a.replace(/\u2006|\x27/g, ""), i._restrictPattern.test(a) && (a = a.replace(i._restrictPattern, ""))), 
                    i.text = a, i.event(t.Event.INPUT), s.inputEnter(), i.event("confirm");
                }), l.window.wx.onKeyboardInput(function(e) {
                    var a = e ? e.value : "";
                    i.multiline || -1 == a.indexOf("\n") ? (i._restrictPattern && (a = a.replace(/\u2006|\x27/g, ""), 
                    i._restrictPattern.test(a) && (a = a.replace(i._restrictPattern, ""))), i.text = a, 
                    i.event(t.Event.INPUT)) : s.inputEnter();
                }));
            }
        }, {
            key: "inputEnter",
            value: function inputEnter() {
                t.Input.inputElement.target.focus = !1;
            }
        }, {
            key: "wxinputblur",
            value: function wxinputblur() {
                s.hideKeyboard();
            }
        }, {
            key: "hideKeyboard",
            value: function hideKeyboard() {
                l.window.wx.offKeyboardConfirm(), l.window.wx.offKeyboardInput(), l.window.wx.hideKeyboard({
                    success: function success(e) {
                        console.log("隐藏键盘");
                    },
                    fail: function fail(e) {
                        console.log("隐藏键盘出错:" + (e ? e.errMsg : ""));
                    }
                });
            }
        } ]);
        return s;
    }();
    var o = /* */ function(_t$EventDispatcher2) {
        (0, _inherits2.default)(o, _t$EventDispatcher2);
        var _super3 = _createSuper(o);
        function o() {
            (0, _classCallCheck2.default)(this, o);
            return _super3.call(this);
        }
        (0, _createClass2.default)(o, [ {
            key: "_loadResourceFilter",
            value: function _loadResourceFilter(e, a) {
                if (-1 == a.indexOf(l.window.wx.env.USER_DATA_PATH) && (-1 != a.indexOf("http://") || -1 != a.indexOf("https://"))) if ("" != i.loadPath) a = a.split(i.loadPath)[1]; else {
                    var n = "" != t.URL.rootPath ? t.URL.rootPath : t.URL._basePath, s = a;
                    "" != n && (a = a.split(n)[1]), a || (a = s);
                }
                if (l.subNativeFiles && 0 == l.subNativeheads.length) for (var r in l.subNativeFiles) {
                    var d = l.subNativeFiles[r];
                    l.subNativeheads = l.subNativeheads.concat(d);
                    for (var u = 0; u < d.length; u++) {
                        l.subMaps[d[u]] = r + "/" + d[u];
                    }
                }
                if (l.subNativeFiles && -1 != a.indexOf("/")) {
                    var c = a.split("/")[0] + "/";
                    if (c && -1 != l.subNativeheads.indexOf(c)) {
                        var h = l.subMaps[c];
                        a = a.replace(c, h);
                    }
                }
                switch (e) {
                  case t.Loader.IMAGE:
                  case "htmlimage":
                  case "nativeimage":
                    o._transformImgUrl(a, e, this);
                    break;

                  case t.Loader.SOUND:
                    this._loadSound(a);
                    break;

                  default:
                    this._loadResource(e, a);
                }
            }
        }, {
            key: "_loadSound",
            value: function _loadSound(e) {
                var a;
                if (i.isLocalNativeFile(e)) {
                    var n = "" != t.URL.rootPath ? t.URL.rootPath : t.URL._basePath, s = e;
                    "" == n || -1 == e.indexOf("http://") && -1 == e.indexOf("https://") || (a = e.split(n)[1]), 
                    a || (a = s), o.onDownLoadCallBack(e, this, 0);
                } else {
                    var r = t.URL.formatURL(e);
                    !i.isLocalNativeFile(e) && -1 == r.indexOf("http://") && -1 == r.indexOf("https://") || -1 != r.indexOf(l.window.wx.env.USER_DATA_PATH) ? o.onDownLoadCallBack(e, this, 0) : i.downOtherFiles(encodeURI(r), t.Handler.create(o, o.onDownLoadCallBack, [ r, this ]), r);
                }
            }
        }, {
            key: "_loadHttpRequestWhat",
            value: function _loadHttpRequestWhat(e, a) {
                var n = l.getUrlEncode(e, a);
                if (t.Loader.preLoadedMap[e]) this.onLoaded(t.Loader.preLoadedMap[e]); else {
                    var s = t.URL.formatURL(e);
                    if (i.isLocalNativeFile(e) || i.getFileInfo(s) || -1 != e.indexOf(l.window.wx.env.USER_DATA_PATH) || -1 == s.indexOf("http://") && -1 == s.indexOf("https://") || l.AutoCacheDownFile) {
                        var r = i.getFileInfo(t.URL.formatURL(e));
                        r ? (r.encoding = null == r.encoding ? "utf8" : r.encoding, i.readFile(i.getFileNativePath(r.md5), n, new t.Handler(o, o.onReadNativeCallBack, [ e, a, this ]), e)) : "image" == this.type || "htmlimage" == this.type ? this._transformUrl(e, a) : a != t.Loader.IMAGE && (-1 == s.indexOf("http://") && -1 == s.indexOf("https://") || i.isLocalNativeFile(e)) ? i.readFile(e, n, new t.Handler(o, o.onReadNativeCallBack, [ e, a, this ]), e) : i.downFiles(s, n, new t.Handler(o, o.onReadNativeCallBack, [ e, a, this ]), s, !0);
                    } else this._loadHttpRequest(s, a, this, this.onLoaded, this, this.onProgress, this, this.onError);
                }
            }
        } ], [ {
            key: "onDownLoadCallBack",
            value: function onDownLoadCallBack(e, a, n) {
                var s = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
                if (n) a.event(t.Event.ERROR, "Load sound failed"); else {
                    var o;
                    if (l.autoCacheFile) if (s) o = s; else if (i.isLocalNativeFile(e)) {
                        var r = "" != t.URL.rootPath ? t.URL.rootPath : t.URL._basePath, d = e;
                        "" == r || -1 == e.indexOf("http://") && -1 == e.indexOf("https://") || (o = e.split(r)[1]), 
                        o || (o = d);
                    } else {
                        var u = i.getFileInfo(e);
                        if (u && u.md5) {
                            var c = u.md5;
                            o = i.getFileNativePath(c);
                        } else o = e;
                    }
                    e = o;
                    var h = new t.SoundManager._soundClass();
                    h.load(e), a.onLoaded(h);
                }
            }
        }, {
            key: "bindToThis",
            value: function bindToThis(e, t) {
                return e.bind(t);
            }
        }, {
            key: "onReadNativeCallBack",
            value: function onReadNativeCallBack(e) {
                var i = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
                var a = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
                var n = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
                var s = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
                var o;
                n ? 1 == n && a._loadHttpRequest(e, i, a, a.onLoaded, a, a.onProgress, a, a.onError) : (o = i == t.Loader.JSON || i == t.Loader.ATLAS || i == t.Loader.PREFAB || i == t.Loader.PLF ? l.getJson(s.data) : i == t.Loader.XML ? t.Utils.parseXMLFromString(s.data) : s.data, 
                !l.isZiYu && l.isPosMsgYu && i != t.Loader.BUFFER && l.window.wx.postMessage({
                    url: e,
                    data: o,
                    isLoad: "filedata"
                }), a.onLoaded(o));
            }
        }, {
            key: "_transformImgUrl",
            value: function _transformImgUrl(e, a, n) {
                if (l.isZiYu) n._loadImage(e, !1); else if (i.isLocalNativeFile(e)) n._loadImage(e, !1); else if (i.isLocalNativeFile(e) || i.getFileInfo(t.URL.formatURL(e))) o.onCreateImage(e, n); else {
                    var s = t.URL.formatURL(e);
                    -1 != e.indexOf(l.window.wx.env.USER_DATA_PATH) || -1 == s.indexOf("http://") && -1 == s.indexOf("https://") ? n._loadImage(e) : l.isZiYu ? n._loadImage(e) : i.downOtherFiles(s, new t.Handler(o, o.onDownImgCallBack, [ e, n ]), s);
                }
            }
        }, {
            key: "onDownImgCallBack",
            value: function onDownImgCallBack(e, t, i) {
                var a = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : "";
                i ? t.onError(null) : o.onCreateImage(e, t, !1, a);
            }
        }, {
            key: "onCreateImage",
            value: function onCreateImage(e, a) {
                var n = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : !1;
                var s = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : "";
                var o;
                if (l.autoCacheFile) {
                    if (n) {
                        if (l.isZiYu) {
                            var r = t.URL.formatURL(e);
                            o = i.ziyuFileTextureData[r] ? i.ziyuFileTextureData[r] : e;
                        } else o = e;
                    } else if ("" != s) o = s; else {
                        var d = i.getFileInfo(t.URL.formatURL(e)).md5;
                        o = i.getFileNativePath(d);
                    }
                } else o = n ? e : s;
                a._loadImage(o, !1);
            }
        } ]);
        return o;
    }(t.EventDispatcher);
    var r = /* */ function() {
        function r() {
            (0, _classCallCheck2.default)(this, r);
        }
        (0, _createClass2.default)(r, null, [ {
            key: "__init__",
            value: function __init__() {
                r.items = r;
            }
        }, {
            key: "setItem",
            value: function setItem(e, t) {
                try {
                    l.window.wx.setStorageSync(e, t);
                } catch (i) {
                    l.window.wx.setStorage({
                        key: e,
                        data: t
                    });
                }
            }
        }, {
            key: "getItem",
            value: function getItem(e) {
                return l.window.wx.getStorageSync(e);
            }
        }, {
            key: "setJSON",
            value: function setJSON(e, t) {
                r.setItem(e, t);
            }
        }, {
            key: "getJSON",
            value: function getJSON(e) {
                return r.getItem(e);
            }
        }, {
            key: "removeItem",
            value: function removeItem(e) {
                l.window.wx.removeStorageSync(e);
            }
        }, {
            key: "clear",
            value: function clear() {
                l.window.wx.clearStorageSync();
            }
        }, {
            key: "getStorageInfoSync",
            value: function getStorageInfoSync() {
                try {
                    var e = l.window.wx.getStorageInfoSync();
                    return console.log(e.keys), console.log(e.currentSize), console.log(e.limitSize), 
                    e;
                } catch (e) {}
                return null;
            }
        } ]);
        return r;
    }();
    r.support = !0;
    var l = /* */ function() {
        function l() {
            (0, _classCallCheck2.default)(this, l);
        }
        (0, _createClass2.default)(l, null, [ {
            key: "getJson",
            value: function getJson(e) {
                return JSON.parse(e);
            }
        }, {
            key: "enable",
            value: function enable() {
                l.init(t.Laya.isWXPosMsg, t.Laya.isWXOpenDataContext);
            }
        }, {
            key: "init",
            value: function init() {
                var e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : !1;
                var a = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
                l._inited || (l._inited = !0, l.window = window, l.window.hasOwnProperty("wx") && (l.window.navigator.userAgent.indexOf("MiniGame") < 0 || (l.isZiYu = a, 
                l.isPosMsgYu = e, l.EnvConfig = {}, l.isZiYu || (i.setNativeFileDir("/layaairGame"), 
                i.existDir(i.fileNativeDir, t.Handler.create(l, l.onMkdirCallBack))), l.systemInfo = l.window.wx.getSystemInfoSync(), 
                l.window.focus = function() {}, t.Laya._getUrlPath = function() {
                    return "";
                }, l.window.logtime = function(e) {}, l.window.alertTimeLog = function(e) {}, l.window.resetShareInfo = function() {}, 
                l.window.CanvasRenderingContext2D = function() {}, l.window.CanvasRenderingContext2D.prototype = l.window.wx.createCanvas().getContext("2d").__proto__, 
                l.window.document.body.appendChild = function() {}, l.EnvConfig.pixelRatioInt = 0, 
                t.Browser._pixelRatio = l.pixelRatio(), l._preCreateElement = t.Browser.createElement, 
                t.Browser.createElement = l.createElement, t.RunDriver.createShaderCondition = l.createShaderCondition, 
                t.Utils.parseXMLFromString = l.parseXMLFromString, t.Input._createInputElement = s._createInputElement, 
                t.Loader.prototype._loadResourceFilter = o.prototype._loadResourceFilter, t.Loader.prototype._loadSound = o.prototype._loadSound, 
                t.Loader.prototype._loadHttpRequestWhat = o.prototype._loadHttpRequestWhat, t.LocalStorage._baseClass = r, 
                r.__init__(), l.window.wx.onMessage && l.window.wx.onMessage(l._onMessage))));
            }
        }, {
            key: "_onMessage",
            value: function _onMessage(e) {
                switch (e.type) {
                  case "changeMatrix":
                    t.Laya.stage.transform.identity(), t.Laya.stage._width = e.w, t.Laya.stage._height = e.h, 
                    t.Laya.stage._canvasTransform = new t.Matrix(e.a, e.b, e.c, e.d, e.tx, e.ty);
                    break;

                  case "display":
                    t.Laya.stage.frameRate = e.rate || t.Stage.FRAME_FAST;
                    break;

                  case "undisplay":
                    t.Laya.stage.frameRate = t.Stage.FRAME_SLEEP;
                }
                "opendatacontext" == e.isLoad ? e.url && (i.ziyuFileData[e.url] = e.atlasdata, i.ziyuFileTextureData[e.imgReadyUrl] = e.imgNativeUrl) : "openJsondatacontext" == e.isLoad ? e.url && (i.ziyuFileData[e.url] = e.atlasdata) : "openJsondatacontextPic" == e.isLoad && (i.ziyuFileTextureData[e.imgReadyUrl] = e.imgNativeUrl);
            }
        }, {
            key: "getUrlEncode",
            value: function getUrlEncode(e, t) {
                return "arraybuffer" == t ? "" : "utf8";
            }
        }, {
            key: "downLoadFile",
            value: function downLoadFile(e) {
                var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
                var a = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
                var n = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : "utf8";
                i.getFileInfo(e) ? null != a && a.runWith([ 0 ]) : i.downLoadFile(e, t, a, n);
            }
        }, {
            key: "remove",
            value: function remove(e) {
                var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
                i.deleteFile("", e, t, "", 0);
            }
        }, {
            key: "removeAll",
            value: function removeAll() {
                i.deleteAll();
            }
        }, {
            key: "hasNativeFile",
            value: function hasNativeFile(e) {
                return i.isLocalNativeFile(e);
            }
        }, {
            key: "getFileInfo",
            value: function getFileInfo(e) {
                return i.getFileInfo(e);
            }
        }, {
            key: "getFileList",
            value: function getFileList() {
                return i.filesListObj;
            }
        }, {
            key: "exitMiniProgram",
            value: function exitMiniProgram() {
                l.window.wx.exitMiniProgram();
            }
        }, {
            key: "onMkdirCallBack",
            value: function onMkdirCallBack(e, t) {
                e ? i.fakeObj = i.filesListObj = {} : (i.filesListObj = JSON.parse(t.data), i.fakeObj = i.filesListObj || {}), 
                i.fs.readdir({
                    dirPath: i.fileNativeDir,
                    success: function success(e) {
                        var t = {};
                        for (var _e in i.filesListObj) {
                            "fileUsedSize" != _e && (t[i.filesListObj[_e].md5] = !0);
                        }
                        var a, n = e.files;
                        for (var _e2 = 0, _o = n.length; _e2 < _o; _e2++) {
                            if ((a = n[_e2]) != i.fileListName) {
                                var s = i.getFileNativePath(a);
                                t[s] || t[a] || i.fs.unlink({
                                    filePath: s,
                                    success: function success(e) {
                                        console.log("删除无引用的磁盘文件:" + a);
                                    }
                                });
                            }
                        }
                    }
                });
            }
        }, {
            key: "pixelRatio",
            value: function pixelRatio() {
                if (!l.EnvConfig.pixelRatioInt) try {
                    return l.EnvConfig.pixelRatioInt = l.systemInfo.pixelRatio, l.systemInfo.pixelRatio;
                } catch (e) {}
                return l.EnvConfig.pixelRatioInt;
            }
        }, {
            key: "createElement",
            value: function createElement(e) {
                var t;
                if ("canvas" == e) return 1 == l.idx ? l.isZiYu ? (t = l.window.sharedCanvas).style = {} : t = l.window.canvas : t = l.window.wx.createCanvas(), 
                l.idx++, t;
                if ("textarea" == e || "input" == e) return l.onCreateInput(e);
                if ("div" == e) {
                    var i = l._preCreateElement(e);
                    return i.contains = function(e) {
                        return null;
                    }, i.removeChild = function(e) {}, i;
                }
                return l._preCreateElement(e);
            }
        }, {
            key: "onCreateInput",
            value: function onCreateInput(e) {
                var t = l._preCreateElement(e);
                return t.focus = s.wxinputFocus, t.blur = s.wxinputblur, t.style = {}, t.value = 0, 
                t.parentElement = {}, t.placeholder = {}, t.type = {}, t.setColor = function(e) {}, 
                t.setType = function(e) {}, t.setFontFace = function(e) {}, t.addEventListener = function(e) {}, 
                t.contains = function(e) {
                    return null;
                }, t.removeChild = function(e) {}, t;
            }
        }, {
            key: "createShaderCondition",
            value: function createShaderCondition(e) {
                return function() {
                    return this[e.replace("this.", "")];
                };
            }
        }, {
            key: "sendAtlasToOpenDataContext",
            value: function sendAtlasToOpenDataContext(e) {
                if (!l.isZiYu) {
                    var i = t.Loader.getRes(t.URL.formatURL(e));
                    if (!i) throw "传递的url没有获取到对应的图集数据信息，请确保图集已经过！";
                    i.meta.image.split(",");
                    if (i.meta && i.meta.image) for (var a = i.meta.image.split(","), n = e.indexOf("/") >= 0 ? "/" : "\\", s = e.lastIndexOf(n), o = s >= 0 ? e.substr(0, s + 1) : "", r = 0, d = a.length; r < d; r++) {
                        a[r] = o + a[r];
                    } else a = [ e.replace(".json", ".png") ];
                    for (r = 0; r < a.length; r++) {
                        var u = a[r];
                        l.postInfoToContext(t.Laya.URL.formatURL(e), t.Laya.URL.formatURL(u), i);
                    }
                }
            }
        }, {
            key: "postInfoToContext",
            value: function postInfoToContext(e, a, n) {
                var s = {
                    frames: n.frames,
                    meta: n.meta
                }, o = a, r = i.getFileInfo(t.URL.formatURL(a));
                if (r) var d = r.md5, u = i.getFileNativePath(d); else u = o;
                if (!u) throw "获取图集的磁盘url路径不存在！";
                l.window.wx.postMessage({
                    url: e,
                    atlasdata: s,
                    imgNativeUrl: u,
                    imgReadyUrl: o,
                    isLoad: "opendatacontext"
                });
            }
        }, {
            key: "sendSinglePicToOpenDataContext",
            value: function sendSinglePicToOpenDataContext(e) {
                var a = t.URL.formatURL(e), n = i.getFileInfo(a);
                if (n) {
                    var s = n.md5, o = i.getFileNativePath(s);
                    e = a;
                } else o = e;
                if (!o) throw "获取图集的磁盘url路径不存在！";
                e = t.Laya.URL.formatURL(e), l.window.wx.postMessage({
                    url: e,
                    imgNativeUrl: o,
                    imgReadyUrl: e,
                    isLoad: "openJsondatacontextPic"
                });
            }
        }, {
            key: "sendJsonDataToDataContext",
            value: function sendJsonDataToDataContext(e) {
                if (!l.isZiYu) {
                    e = t.Laya.URL.formatURL(e);
                    var i = t.Loader.getRes(e);
                    if (!i) throw "传递的url没有获取到对应的图集数据信息，请确保图集已经过！";
                    l.window.wx.postMessage({
                        url: e,
                        atlasdata: i,
                        isLoad: "openJsondatacontext"
                    });
                }
            }
        } ]);
        return l;
    }();
    l._inited = !1, l.autoCacheFile = !0, l.minClearSize = 5242880, l.nativefiles = [ "layaNativeDir", "wxlocal" ], 
    l.subNativeFiles = [], l.subNativeheads = [], l.subMaps = [], l.AutoCacheDownFile = !1, 
    l.parseXMLFromString = function(e) {
        var t;
        e = e.replace(/>\s+</g, "><");
        try {
            t = new l.window.Parser.DOMParser().parseFromString(e, "text/xml");
        } catch (e) {
            throw "需要引入xml解析库文件";
        }
        return t;
    }, l.idx = 1;
    var d = /* */ function(_t$EventDispatcher3) {
        (0, _inherits2.default)(d, _t$EventDispatcher3);
        var _super4 = _createSuper(d);
        function d() {
            (0, _classCallCheck2.default)(this, d);
            return _super4.call(this);
        }
        (0, _createClass2.default)(d, [ {
            key: "on",
            value: function on(e, t, i) {
                var a = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
                return (0, _get2.default)((0, _getPrototypeOf2.default)(d.prototype), "on", this).call(this, e, t, i, a), 
                d.startListen(this.onDeviceOrientationChange), this;
            }
        }, {
            key: "off",
            value: function off(e, t, i) {
                var a = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : !1;
                return this.hasListener(e) || d.stopListen(), (0, _get2.default)((0, _getPrototypeOf2.default)(d.prototype), "off", this).call(this, e, t, i, a);
            }
        } ], [ {
            key: "__init__",
            value: function __init__() {
                try {
                    var e;
                    if (!(e = t.Accelerator)) return;
                    e.prototype.on = d.prototype.on, e.prototype.off = d.prototype.off;
                } catch (e) {}
            }
        }, {
            key: "startListen",
            value: function startListen(e) {
                if (d._callBack = e, !d._isListening) {
                    d._isListening = !0;
                    try {
                        l.window.wx.onAccelerometerChange(d.onAccelerometerChange);
                    } catch (e) {}
                }
            }
        }, {
            key: "stopListen",
            value: function stopListen() {
                d._isListening = !1;
                try {
                    l.window.wx.stopAccelerometer({});
                } catch (e) {}
            }
        }, {
            key: "onAccelerometerChange",
            value: function onAccelerometerChange(e) {
                var t;
                (t = {}).acceleration = e, t.accelerationIncludingGravity = e, t.rotationRate = {}, 
                null != d._callBack && d._callBack(t);
            }
        } ]);
        return d;
    }(t.EventDispatcher);
    d._isListening = !1;
    var u = /* */ function() {
        function u() {
            (0, _classCallCheck2.default)(this, u);
        }
        (0, _createClass2.default)(u, [ {
            key: "_loadImage",
            value: function _loadImage(e) {
                if (l.isZiYu) u.onCreateImage(e, this, !0); else {
                    var a;
                    if (i.isLocalNativeFile(e)) {
                        if (-1 == e.indexOf(l.window.wx.env.USER_DATA_PATH) && (-1 != e.indexOf("http://") || -1 != e.indexOf("https://"))) if ("" != i.loadPath) e = e.split(i.loadPath)[1]; else {
                            var n = "" != t.URL.rootPath ? t.URL.rootPath : t.URL._basePath, s = e;
                            "" != n && (e = e.split(n)[1]), e || (e = s);
                        }
                        if (l.subNativeFiles && 0 == l.subNativeheads.length) for (var o in l.subNativeFiles) {
                            var r = l.subNativeFiles[o];
                            l.subNativeheads = l.subNativeheads.concat(r);
                            for (var d = 0; d < r.length; d++) {
                                l.subMaps[r[d]] = o + "/" + r[d];
                            }
                        }
                        if (l.subNativeFiles && -1 != e.indexOf("/")) {
                            var c = e.split("/")[0] + "/";
                            if (c && -1 != l.subNativeheads.indexOf(c)) {
                                var h = l.subMaps[c];
                                e = e.replace(c, h);
                            }
                        }
                    } else a = !0, e = t.URL.formatURL(e);
                    i.getFileInfo(e) ? u.onCreateImage(e, this, !a) : -1 != e.indexOf(l.window.wx.env.USER_DATA_PATH) || -1 == e.indexOf("http://") && -1 == e.indexOf("https://") ? u.onCreateImage(e, this, !0) : l.isZiYu ? u.onCreateImage(e, this, !0) : i.downOtherFiles(e, new t.Handler(u, u.onDownImgCallBack, [ e, this ]), e);
                }
            }
        } ], [ {
            key: "onDownImgCallBack",
            value: function onDownImgCallBack(e, t, i) {
                var a = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : "";
                i ? t.onError(null) : u.onCreateImage(e, t, !1, a);
            }
        }, {
            key: "onCreateImage",
            value: function onCreateImage(e, a) {
                var n = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : !1;
                var s = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : "";
                var o, r;
                if (l.autoCacheFile) {
                    if (n) {
                        if (l.isZiYu) {
                            var d = t.URL.formatURL(e);
                            o = i.ziyuFileTextureData[d] ? i.ziyuFileTextureData[d] : e;
                        } else o = e;
                    } else if ("" != s) o = s; else {
                        var u = i.getFileInfo(e).md5;
                        o = i.getFileNativePath(u);
                    }
                } else o = n ? e : s;
                function clear() {
                    var e = a._imgCache[o];
                    e && (e.onload = null, e.onerror = null, delete a._imgCache[o]);
                }
                null == a._imgCache && (a._imgCache = {});
                var c = function c() {
                    clear(), delete i.fakeObj[e], delete i.filesListObj[e], a.event(t.Event.ERROR, "Load image failed");
                };
                if ("nativeimage" == a._type) {
                    var h = function h() {
                        clear(), a.onLoaded(r);
                    };
                    (r = new t.Browser.window.Image()).crossOrigin = "", r.onload = h, r.onerror = c, 
                    r.src = o, a._imgCache[o] = r;
                } else {
                    var f = new t.Browser.window.Image();
                    h = function h() {
                        (r = t.HTMLImage.create(f.width, f.height)).loadImageSource(f, !0), r._setCreateURL(o), 
                        clear(), a.onLoaded(r);
                    }, f.crossOrigin = "", f.onload = h, f.onerror = c, f.src = o, a._imgCache[o] = f;
                }
            }
        } ]);
        return u;
    }();
    var c = /* */ function() {
        function c() {
            (0, _classCallCheck2.default)(this, c);
        }
        (0, _createClass2.default)(c, null, [ {
            key: "__init__",
            value: function __init__() {
                l.window.navigator.geolocation.getCurrentPosition = c.getCurrentPosition, l.window.navigator.geolocation.watchPosition = c.watchPosition, 
                l.window.navigator.geolocation.clearWatch = c.clearWatch;
            }
        }, {
            key: "getCurrentPosition",
            value: function getCurrentPosition() {
                var e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
                var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
                var i = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
                var a;
                (a = {}).success = function(t) {
                    null != e && e(t);
                }, a.fail = t, l.window.wx.getLocation(a);
            }
        }, {
            key: "watchPosition",
            value: function watchPosition() {
                var e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
                var i = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
                var a = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
                var n;
                return c._curID++, (n = {}).success = e, n.error = i, c._watchDic[c._curID] = n, 
                t.Laya.systemTimer.loop(1e3, null, c._myLoop), c._curID;
            }
        }, {
            key: "clearWatch",
            value: function clearWatch(e) {
                delete c._watchDic[e], c._hasWatch() || t.Laya.systemTimer.clear(null, c._myLoop);
            }
        }, {
            key: "_hasWatch",
            value: function _hasWatch() {
                var e;
                for (e in c._watchDic) {
                    if (c._watchDic[e]) return !0;
                }
                return !1;
            }
        }, {
            key: "_myLoop",
            value: function _myLoop() {
                c.getCurrentPosition(c._mySuccess, c._myError);
            }
        }, {
            key: "_mySuccess",
            value: function _mySuccess(e) {
                var i, a = {};
                for (i in a.coords = e, a.timestamp = t.Browser.now(), c._watchDic) {
                    c._watchDic[i].success && c._watchDic[i].success(a);
                }
            }
        }, {
            key: "_myError",
            value: function _myError(e) {
                var t;
                for (t in c._watchDic) {
                    c._watchDic[t].error && c._watchDic[t].error(e);
                }
            }
        } ]);
        return c;
    }();
    c._watchDic = {}, c._curID = 0;
    e.MiniAccelerator = d, e.MiniAdpter = l, e.MiniFileMgr = i, e.MiniImage = u, e.MiniInput = s, 
    e.MiniLoader = o, e.MiniLocalStorage = r, e.MiniLocation = c, e.MiniSound = n, e.MiniSoundChannel = a, 
    e.MiniVideo = /* */ function() {
        function _class() {
            var e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 320;
            var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 240;
            (0, _classCallCheck2.default)(this, _class);
            this.videoend = !1, this.videourl = "", this.videoElement = l.window.wx.createVideo({
                width: e,
                height: t,
                autoplay: !0
            });
        }
        (0, _createClass2.default)(_class, [ {
            key: "on",
            value: function on(e, t, i) {
                "loadedmetadata" == e ? (this.onPlayFunc = i.bind(t), this.videoElement.onPlay = this.onPlayFunction.bind(this)) : "ended" == e && (this.onEndedFunC = i.bind(t), 
                this.videoElement.onEnded = this.onEndedFunction.bind(this)), this.videoElement.onTimeUpdate = this.onTimeUpdateFunc.bind(this);
            }
        }, {
            key: "onTimeUpdateFunc",
            value: function onTimeUpdateFunc(e) {
                this.position = e.position, this._duration = e.duration;
            }
        }, {
            key: "onPlayFunction",
            value: function onPlayFunction() {
                this.videoElement && (this.videoElement.readyState = 200), console.log("=====视频加载完成========"), 
                null != this.onPlayFunc && this.onPlayFunc();
            }
        }, {
            key: "onEndedFunction",
            value: function onEndedFunction() {
                this.videoElement && (this.videoend = !0, console.log("=====视频播放完毕========"), null != this.onEndedFunC && this.onEndedFunC());
            }
        }, {
            key: "off",
            value: function off(e, t, i) {
                "loadedmetadata" == e ? (this.onPlayFunc = i.bind(t), this.videoElement.offPlay = this.onPlayFunction.bind(this)) : "ended" == e && (this.onEndedFunC = i.bind(t), 
                this.videoElement.offEnded = this.onEndedFunction.bind(this));
            }
        }, {
            key: "load",
            value: function load(e) {
                this.videoElement && (this.videoElement.src = e);
            }
        }, {
            key: "play",
            value: function play() {
                this.videoElement && (this.videoend = !1, this.videoElement.play());
            }
        }, {
            key: "pause",
            value: function pause() {
                this.videoElement && (this.videoend = !0, this.videoElement.pause());
            }
        }, {
            key: "size",
            value: function size(e, t) {
                this.videoElement && (this.videoElement.width = e, this.videoElement.height = t);
            }
        }, {
            key: "destroy",
            value: function destroy() {
                this.videoElement && this.videoElement.destroy(), this.videoElement = null, this.onEndedFunC = null, 
                this.onPlayFunc = null, this.videoend = !1, this.videourl = null;
            }
        }, {
            key: "reload",
            value: function reload() {
                this.videoElement && (this.videoElement.src = this.videourl);
            }
        }, {
            key: "duration",
            get: function get() {
                return this._duration;
            }
        }, {
            key: "currentTime",
            get: function get() {
                return this.videoElement ? this.videoElement.initialTime : 0;
            },
            set: function set(e) {
                this.videoElement && (this.videoElement.initialTime = e);
            }
        }, {
            key: "videoWidth",
            get: function get() {
                return this.videoElement ? this.videoElement.width : 0;
            }
        }, {
            key: "videoHeight",
            get: function get() {
                return this.videoElement ? this.videoElement.height : 0;
            }
        }, {
            key: "ended",
            get: function get() {
                return this.videoend;
            }
        }, {
            key: "loop",
            get: function get() {
                return !!this.videoElement && this.videoElement.loop;
            },
            set: function set(e) {
                this.videoElement && (this.videoElement.loop = e);
            }
        }, {
            key: "playbackRate",
            get: function get() {
                return this.videoElement ? this.videoElement.playbackRate : 0;
            },
            set: function set(e) {
                this.videoElement && (this.videoElement.playbackRate = e);
            }
        }, {
            key: "muted",
            get: function get() {
                return !!this.videoElement && this.videoElement.muted;
            },
            set: function set(e) {
                this.videoElement && (this.videoElement.muted = e);
            }
        }, {
            key: "paused",
            get: function get() {
                return !!this.videoElement && this.videoElement.paused;
            }
        }, {
            key: "x",
            get: function get() {
                return this.videoElement ? this.videoElement.x : 0;
            },
            set: function set(e) {
                this.videoElement && (this.videoElement.x = e);
            }
        }, {
            key: "y",
            get: function get() {
                return this.videoElement ? this.videoElement.y : 0;
            },
            set: function set(e) {
                this.videoElement && (this.videoElement.y = e);
            }
        }, {
            key: "currentSrc",
            get: function get() {
                return this.videoElement.src;
            }
        } ], [ {
            key: "__init__",
            value: function __init__() {}
        } ]);
        return _class;
    }();
};