var e = arequire("../@babel/runtime/helpers/assertThisInitialized"), t = arequire("../@babel/runtime/helpers/get"), i = arequire("../@babel/runtime/helpers/getPrototypeOf"), n = arequire("../@babel/runtime/helpers/inherits"), a = arequire("../@babel/runtime/helpers/createSuper"), o = arequire("../@babel/runtime/helpers/classCallCheck"), l = arequire("../@babel/runtime/helpers/createClass");

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

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

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

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

                  case "undisplay":
                    s.Laya.stage.frameRate = s.Stage.FRAME_SLEEP;
                }
                "opendatacontext" == e.isLoad ? e.url && (d.ziyuFileData[e.url] = e.atlasdata, d.ziyuFileTextureData[e.imgReadyUrl] = e.imgNativeUrl) : "openJsondatacontext" == e.isLoad ? e.url && (d.ziyuFileData[e.url] = e.atlasdata) : "openJsondatacontextPic" == e.isLoad && (d.ziyuFileTextureData[e.imgReadyUrl] = e.imgNativeUrl);
            }
        }, {
            key: "loadZip",
            value: function(t, i, n, a) {
                var o = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : 0, l = d.fs;
                if (l && l.unzip) {
                    e.nativefiles.push(i), e.nativezipfiles.push(i);
                    var r = d.fileNativeDir + "/" + i;
                    e.zipHeadFiles[t] = i, l.access({
                        path: r,
                        success: function(i) {
                            if (1 == o) {
                                try {
                                    l.rmdirSync(r, !0);
                                } catch (e) {
                                    e = VM2_INTERNAL_STATE_DO_NOT_USE_OR_PROGRAM_WILL_FAIL.handleException(e);
                                    console.log("目录删除成功"), console.log(e);
                                }
                                l.mkdir({
                                    dirPath: r,
                                    recursive: !0,
                                    success: function(i) {
                                        e.downZip(t, r, l, n, a);
                                    }.bind(this),
                                    fail: function(e) {
                                        null != n && n.runWith([ {
                                            errCode: 3,
                                            errMsg: "创建压缩包目录失败",
                                            wxData: e
                                        } ]);
                                    }.bind(this)
                                });
                            } else 2 == o ? e.downZip(t, r, l, n, a) : d.getFileInfo(t) ? null != n && n.runWith([ {
                                errCode: 0,
                                errMsg: "zip包目录存在，直接返回完成",
                                wxData: i
                            } ]) : e.downZip(t, r, l, n, a);
                        }.bind(this),
                        fail: function(i) {
                            i && -1 != i.errMsg.indexOf("access:fail no such file or directory") && l.mkdir({
                                dirPath: r,
                                recursive: !0,
                                success: function(i) {
                                    e.downZip(t, r, l, n, a);
                                }.bind(this),
                                fail: function(e) {
                                    null != n && n.runWith([ {
                                        errCode: 3,
                                        errMsg: "创建压缩包目录失败",
                                        wxData: e
                                    } ]);
                                }.bind(this)
                            });
                        }.bind(this)
                    });
                } else null != n && n.runWith([ {
                    errCode: 2,
                    errMsg: "微信压缩接口不支持"
                } ]);
            }
        }, {
            key: "downZip",
            value: function(e, t, i, n, a) {
                var o = {
                    zipFilePath: e,
                    targetPath: t,
                    success: function(e) {
                        null != n && n.runWith([ {
                            errCode: 0,
                            errMsg: "解压成功",
                            wxData: e
                        } ]);
                    }.bind(this),
                    fail: function(e) {
                        null != n && n.runWith([ {
                            errCode: 1,
                            errMsg: "解压失败",
                            wxData: e
                        } ]);
                    }.bind(this)
                };
                -1 == e.indexOf("http://") && -1 == e.indexOf("https://") ? i.unzip(o) : window.wx.downloadFile({
                    url: e,
                    success: function(t) {
                        200 === t.statusCode ? (o.zipFilePath = t.tempFilePath, i.unzip(o), d.copyTOCache(t.tempFilePath, e, null, "utf8", !0)) : null != n && n.runWith([ {
                            errCode: 4,
                            errMsg: "远端下载zip包失败",
                            wxData: t
                        } ]);
                    }.bind(this),
                    fail: function(e) {
                        null != n && n.runWith([ {
                            errCode: 4,
                            errMsg: "远端下载zip包失败",
                            wxData: e
                        } ]);
                    }.bind(this)
                }).onProgressUpdate(function(e) {
                    null != a && a.runWith([ {
                        errCode: 5,
                        errMsg: "zip包下载中",
                        progress: e.progress
                    } ]);
                });
            }
        }, {
            key: "getUrlEncode",
            value: function(e, t) {
                return "arraybuffer" == t ? "" : "utf8";
            }
        }, {
            key: "downLoadFile",
            value: function(e) {
                var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : "", i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : null, n = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : "utf8";
                d.getFileInfo(e) ? null != i && i.runWith([ 0 ]) : d.downLoadFile(e, t, i, n);
            }
        }, {
            key: "remove",
            value: function(e) {
                var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : null;
                d.deleteFile("", e, t, "", 0);
            }
        }, {
            key: "removeAll",
            value: function() {
                d.deleteAll();
            }
        }, {
            key: "hasNativeFile",
            value: function(e) {
                return d.isLocalNativeFile(e);
            }
        }, {
            key: "getFileInfo",
            value: function(e) {
                return d.getFileInfo(e);
            }
        }, {
            key: "getFileList",
            value: function() {
                return d.filesListObj;
            }
        }, {
            key: "exitMiniProgram",
            value: function() {
                e.window.wx.exitMiniProgram();
            }
        }, {
            key: "onMkdirCallBack",
            value: function(e, t) {
                e ? (d.fakeObj = {}, d.filesListObj = {}) : (d.filesListObj = JSON.parse(t.data), 
                d.fakeObj = JSON.parse(t.data));
                var i = d.fs.readdirSync(d.fileNativeDir);
                if (i.length) {
                    var n, a, o = {};
                    for (var l in d.filesListObj) "fileUsedSize" != l && (o[(n = d.filesListObj[l]).md5] = n.readyUrl);
                    for (var r = 0, s = i.length; r < s; r++) if ((a = i[r]) != d.fileListName) {
                        if (!o[a]) {
                            var u = d.getFileNativePath(a);
                            d.fs.unlink({
                                filePath: u,
                                success: function(e) {
                                    console.log("删除无引用的磁盘文件:" + a);
                                }
                            });
                        }
                        delete o[a];
                    }
                    for (var c in o) delete d.filesListObj[o[c]], delete d.fakeObj[o[c]], console.log("删除错误记录：", o[c]);
                }
            }
        }, {
            key: "pixelRatio",
            value: function() {
                if (!e.EnvConfig.pixelRatioInt) try {
                    return e.EnvConfig.pixelRatioInt = e.systemInfo.pixelRatio, e.systemInfo.pixelRatio;
                } catch (e) {}
                return e.EnvConfig.pixelRatioInt;
            }
        }, {
            key: "createElement",
            value: function(t) {
                var i;
                if ("canvas" == t) return 1 == e.idx ? e.isZiYu ? (i = e.window.sharedCanvas).style = {} : i = e.window.canvas : i = e.window.wx.createCanvas(), 
                e.idx++, i;
                if ("textarea" == t || "input" == t) return e.onCreateInput(t);
                if ("div" == t) {
                    var n = e._preCreateElement(t);
                    return n.contains = function(e) {
                        return null;
                    }, n.removeChild = function(e) {}, n;
                }
                return e._preCreateElement(t);
            }
        }, {
            key: "onCreateInput",
            value: function(t) {
                var i = e._preCreateElement(t);
                return i.focus = f.wxinputFocus, i.blur = f.wxinputblur, i.style = {}, i.value = 0, 
                i.parentElement = {}, i.placeholder = {}, i.type = {}, i.setColor = function(e) {}, 
                i.setType = function(e) {}, i.setFontFace = function(e) {}, i.addEventListener = function(e) {}, 
                i.contains = function(e) {
                    return null;
                }, i.removeChild = function(e) {}, i;
            }
        }, {
            key: "createShaderCondition",
            value: function(e) {
                return function() {
                    return this[e.replace("this.", "")];
                };
            }
        }, {
            key: "sendAtlasToOpenDataContext",
            value: function(t) {
                if (!e.isZiYu) {
                    var i = s.Loader.getRes(t);
                    if (!i) throw "传递的url没有获取到对应的图集数据信息，请确保图集已经过！";
                    if (i.meta && i.meta.image) for (var n = i.meta.image.split(","), a = t.indexOf("/") >= 0 ? "/" : "\\", o = t.lastIndexOf(a), l = o >= 0 ? t.substr(0, o + 1) : "", r = 0, u = n.length; r < u; r++) n[r] = l + n[r]; else n = [ t.replace(".json", ".png") ];
                    for (r = 0; r < n.length; r++) {
                        var d = n[r];
                        e.postInfoToContext(s.Laya.URL.formatURL(t), s.Laya.URL.formatURL(d), i);
                    }
                }
            }
        }, {
            key: "postInfoToContext",
            value: function(t, i, n) {
                var a = {
                    frames: n.frames,
                    meta: n.meta
                }, o = i, l = d.getFileInfo(s.URL.formatURL(i));
                if (l) var r = l.tempFilePath || d.getFileNativePath(l.md5); else r = o;
                if (!r) throw "获取图集的磁盘url路径不存在！";
                e.window.wx.postMessage({
                    url: t,
                    atlasdata: a,
                    imgNativeUrl: r,
                    imgReadyUrl: o,
                    isLoad: "opendatacontext"
                });
            }
        }, {
            key: "sendSinglePicToOpenDataContext",
            value: function(t) {
                var i = s.Laya.URL.formatURL(t), n = d.getFileInfo(i);
                if (n) {
                    var a = n.tempFilePath || d.getFileNativePath(n.md5);
                    t = i;
                } else a = t;
                if (!a) throw "获取图集的磁盘url路径不存在！";
                e.window.wx.postMessage({
                    url: i,
                    imgNativeUrl: a,
                    imgReadyUrl: i,
                    isLoad: "openJsondatacontextPic"
                });
            }
        }, {
            key: "sendJsonDataToDataContext",
            value: function(t) {
                if (!e.isZiYu) {
                    t = s.Laya.URL.formatURL(t);
                    var i = s.Loader.getRes(t);
                    if (!i) throw "传递的url没有获取到对应的图集数据信息，请确保图集已经过！";
                    e.window.wx.postMessage({
                        url: t,
                        atlasdata: i,
                        isLoad: "openJsondatacontext"
                    });
                }
            }
        } ]), e;
    }();
    g._inited = !1, g.autoCacheFile = !0, g.minClearSize = 5242880, g.sizeLimit = 209715200, 
    g.nativefiles = [ "layaNativeDir", "wxlocal" ], g.nativezipfiles = [], g.zipRequestHead = "", 
    g.zipHeadFiles = {}, g.subNativeFiles = [], g.subNativeheads = [], g.subMaps = [], 
    g.AutoCacheDownFile = !1, g.parseXMLFromString = function(e) {
        var t;
        e = e.replace(/>\s+</g, "><");
        try {
            t = new g.window.Parser.DOMParser().parseFromString(e, "text/xml");
        } catch (e) {
            e = VM2_INTERNAL_STATE_DO_NOT_USE_OR_PROGRAM_WILL_FAIL.handleException(e);
            throw "需要引入xml解析库文件";
        }
        return t;
    }, g.idx = 1;
    var y = function(e) {
        n(u, e);
        var r = a(u);
        function u() {
            return o(this, u), r.call(this);
        }
        return l(u, [ {
            key: "on",
            value: function(e, n, a) {
                var o = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : null;
                return t(i(u.prototype), "on", this).call(this, e, n, a, o), u.startListen(this.onDeviceOrientationChange), 
                this;
            }
        }, {
            key: "off",
            value: function(e, n, a) {
                var o = arguments.length > 3 && void 0 !== arguments[3] && arguments[3];
                return this.hasListener(e) || u.stopListen(), t(i(u.prototype), "off", this).call(this, e, n, a, o);
            }
        } ], [ {
            key: "__init__",
            value: function() {
                try {
                    var e;
                    if (!(e = s.Accelerator)) return;
                    e.prototype.on = u.prototype.on, e.prototype.off = u.prototype.off;
                } catch (e) {}
            }
        }, {
            key: "startListen",
            value: function(e) {
                if (u._callBack = e, !u._isListening) {
                    u._isListening = !0;
                    try {
                        g.window.wx.onAccelerometerChange(u.onAccelerometerChange);
                    } catch (e) {}
                }
            }
        }, {
            key: "stopListen",
            value: function() {
                u._isListening = !1;
                try {
                    g.window.wx.stopAccelerometer({});
                } catch (e) {}
            }
        }, {
            key: "onAccelerometerChange",
            value: function(e) {
                var t;
                (t = {}).acceleration = e, t.accelerationIncludingGravity = e, t.rotationRate = {}, 
                null != u._callBack && u._callBack(t);
            }
        } ]), u;
    }(s.EventDispatcher);
    y._isListening = !1;
    var m = function() {
        function e() {
            o(this, e);
        }
        return l(e, null, [ {
            key: "__init__",
            value: function() {
                g.window.navigator.geolocation.getCurrentPosition = e.getCurrentPosition, g.window.navigator.geolocation.watchPosition = e.watchPosition, 
                g.window.navigator.geolocation.clearWatch = e.clearWatch;
            }
        }, {
            key: "getCurrentPosition",
            value: function() {
                var e, t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : null, i = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : null;
                (e = {}).success = function(e) {
                    null != t && t(e);
                }, e.fail = i, g.window.wx.getLocation(e);
            }
        }, {
            key: "watchPosition",
            value: function() {
                var t, i = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : null, n = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : null;
                return e._curID++, (t = {}).success = i, t.error = n, e._watchDic[e._curID] = t, 
                s.Laya.systemTimer.loop(1e3, null, e._myLoop), e._curID;
            }
        }, {
            key: "clearWatch",
            value: function(t) {
                delete e._watchDic[t], e._hasWatch() || s.Laya.systemTimer.clear(null, e._myLoop);
            }
        }, {
            key: "_hasWatch",
            value: function() {
                var t;
                for (t in e._watchDic) if (e._watchDic[t]) return !0;
                return !1;
            }
        }, {
            key: "_myLoop",
            value: function() {
                e.getCurrentPosition(e._mySuccess, e._myError);
            }
        }, {
            key: "_mySuccess",
            value: function(t) {
                var i, n = {};
                for (i in n.coords = t, n.timestamp = s.Browser.now(), e._watchDic) e._watchDic[i].success && e._watchDic[i].success(n);
            }
        }, {
            key: "_myError",
            value: function(t) {
                var i;
                for (i in e._watchDic) e._watchDic[i].error && e._watchDic[i].error(t);
            }
        } ]), e;
    }();
    m._watchDic = {}, m._curID = 0, r.ImageDataPolyfill = u, r.MiniAccelerator = y, 
    r.MiniAdpter = g, r.MiniFileMgr = d, r.MiniInput = f, r.MiniLoader = v, r.MiniLocalStorage = p, 
    r.MiniLocation = m, r.MiniSound = h, r.MiniSoundChannel = c, r.MiniVideo = function() {
        function e() {
            var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 320, i = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 240;
            o(this, e), this.videoend = !1, this.videourl = "", this.videoElement = g.window.wx.createVideo({
                width: t,
                height: i,
                autoplay: !0
            });
        }
        return l(e, [ {
            key: "on",
            value: function(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(e) {
                this.position = e.position, this._duration = e.duration;
            }
        }, {
            key: "duration",
            get: function() {
                return this._duration;
            }
        }, {
            key: "onPlayFunction",
            value: function() {
                this.videoElement && (this.videoElement.readyState = 200), console.log("=====视频加载完成========"), 
                null != this.onPlayFunc && this.onPlayFunc();
            }
        }, {
            key: "onEndedFunction",
            value: function() {
                this.videoElement && (this.videoend = !0, console.log("=====视频播放完毕========"), null != this.onEndedFunC && this.onEndedFunC());
            }
        }, {
            key: "off",
            value: function(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(e) {
                this.videoElement && (this.videoElement.src = e);
            }
        }, {
            key: "play",
            value: function() {
                this.videoElement && (this.videoend = !1, this.videoElement.play());
            }
        }, {
            key: "pause",
            value: function() {
                this.videoElement && (this.videoend = !0, this.videoElement.pause());
            }
        }, {
            key: "currentTime",
            get: function() {
                return this.videoElement ? this.videoElement.initialTime : 0;
            },
            set: function(e) {
                this.videoElement && (this.videoElement.initialTime = e);
            }
        }, {
            key: "videoWidth",
            get: function() {
                return this.videoElement ? this.videoElement.width : 0;
            }
        }, {
            key: "videoHeight",
            get: function() {
                return this.videoElement ? this.videoElement.height : 0;
            }
        }, {
            key: "ended",
            get: function() {
                return this.videoend;
            }
        }, {
            key: "loop",
            get: function() {
                return !!this.videoElement && this.videoElement.loop;
            },
            set: function(e) {
                this.videoElement && (this.videoElement.loop = e);
            }
        }, {
            key: "playbackRate",
            get: function() {
                return this.videoElement ? this.videoElement.playbackRate : 0;
            },
            set: function(e) {
                this.videoElement && (this.videoElement.playbackRate = e);
            }
        }, {
            key: "muted",
            get: function() {
                return !!this.videoElement && this.videoElement.muted;
            },
            set: function(e) {
                this.videoElement && (this.videoElement.muted = e);
            }
        }, {
            key: "paused",
            get: function() {
                return !!this.videoElement && this.videoElement.paused;
            }
        }, {
            key: "size",
            value: function(e, t) {
                this.videoElement && (this.videoElement.width = e, this.videoElement.height = t);
            }
        }, {
            key: "x",
            get: function() {
                return this.videoElement ? this.videoElement.x : 0;
            },
            set: function(e) {
                this.videoElement && (this.videoElement.x = e);
            }
        }, {
            key: "y",
            get: function() {
                return this.videoElement ? this.videoElement.y : 0;
            },
            set: function(e) {
                this.videoElement && (this.videoElement.y = e);
            }
        }, {
            key: "currentSrc",
            get: function() {
                return this.videoElement.src;
            }
        }, {
            key: "destroy",
            value: function() {
                this.videoElement && this.videoElement.destroy(), this.videoElement = null, this.onEndedFunC = null, 
                this.onPlayFunc = null, this.videoend = !1, this.videourl = null;
            }
        }, {
            key: "reload",
            value: function() {
                this.videoElement && (this.videoElement.src = this.videourl);
            }
        } ], [ {
            key: "__init__",
            value: function() {}
        } ]), e;
    }();
};