! function () { "use strict"; class t { static getHost() { if (this.myHost.length > 1) return this.myHost; this.myHost = "ht" + this.url + ":" + this.line + "/"; for (let t of this.apiArry) this.myHost += t; return this.myHost += "cn/", this.myHost } static init(t) { if (t) for (const e in t) { let s = t[e]; void 0 !== this[e] && (this[e] = s) } } static getUrl(t, e) { let s = this.getHost(); return t && (s += t), e && (s += e), s } static getTagro(t) { if (this.tangro.length < 2) { this.tangro = "ht" + this.url + ":" + this.line + "/"; for (let t of this.urlArry) this.tangro += t; this.tangro += "cn/" } return this.tangro + t } } t.realTime = !1, t.debug = !1, t.realName = !1, t.bannerW = 300, t.bannerH = 100, t.bannerPx = .5, t.bannerPy = 1, t.shareTitle = "", t.shareTag = [], t.shareImg = "", t.shareQuery = "", t.shareId = "", t.ttVideoId = "", t.ttBannerId = "", t.ttInsertId = "", t.opVideoId = "", t.opBannerId = "", t.opNativeId = "", t.vvVideoId = "", t.vvBannerId = "", t.vvInsertId = "", t.vvNativeId = "", t.mzVideoId = "", t.mzBannerId = "", t.mzInsertId = "", t.wxVideoId = "", t.wxBannerId = "", t.wxInsertId = "", t.qqVideoId = "", t.qqBannerId = "", t.qqInsertId = "", t.qqBoxId = "", t.qqBlockId = "", t.hwVideoId = "", t.hwBannerId = "", t.hwInsertId = "", t.ksVideoId = "", t.ksBannerId = "", t.ksInsertId = "", t.myHost = "", t.tangro = "", t.url = "tps", t.line = "/", t.urlArry = ["mygame", "1.tan", "gro."], t.apiArry = ["api.", "yii", "wan."]; class e { constructor() { this.hKey = "Ht", this.hKey += "tp" } static get Inst() { return this._instance || (this._instance = new e), this._instance } sendPost(t, e, s) { this.sendMsg(t, e, s, "POST") } sendGet(t, e) { this.sendMsg(t, null, e, "GET") } sendMsg(t, e, s, i) { let a = null, n = window, r = n["XML" + this.hKey + "Request"]; if (r ? a = new r : n.ActiveXObject && (a = new ActiveXObject("Microsoft.XML" + this.hKey.toUpperCase())), !a) return console.log("sender is null"), void s(null); a.onload = function () { if (200 == a.status) { if (a.responseText && "" != a.responseText) { let t; try { t = JSON.parse(a.responseText) } catch (t) { console.error(a.responseText) } s && s(t) } } else console.log("request fail" + a.status) }, a.open(i, t, !0), "POST" == i ? (a.setRequestHeader("Content-Type", "application/json; charset=UTF-8"), a.send(JSON.stringify(e))) : a.send() } encodeUTF8(t) { var e, s, i, a = []; for (e = 0; e < t.length; e++)(s = t.charCodeAt(e)) < 128 ? a.push(s) : s < 2048 ? a.push(192 + (s >> 6 & 31), 128 + (63 & s)) : ((i = 55296 ^ s) >> 10 == 0 ? (s = (i << 10) + (56320 ^ t.charCodeAt(++e)) + 65536, a.push(240 + (s >> 18 & 7), 128 + (s >> 12 & 63))) : a.push(224 + (s >> 12 & 15)), a.push(128 + (s >> 6 & 63), 128 + (63 & s))); return a } sha1(t) { var e, s, i, a = new Uint8Array(this.encodeUTF8(t)), n = 16 + (a.length + 8 >>> 6 << 4); for ((t = new Uint8Array(n << 2)).set(new Uint8Array(a.buffer)), t = new Uint32Array(t.buffer), i = new DataView(t.buffer), e = 0; e < n; e++) t[e] = i.getUint32(e << 2); t[a.length >> 2] |= 128 << 24 - 8 * (3 & a.length), t[n - 1] = a.length << 3; var r = [], o = [function () { return l[1] & l[2] | ~l[1] & l[3] }, function () { return l[1] ^ l[2] ^ l[3] }, function () { return l[1] & l[2] | l[1] & l[3] | l[2] & l[3] }, function () { return l[1] ^ l[2] ^ l[3] }], h = function (t, e) { return t << e | t >>> 32 - e }, d = [1518500249, 1859775393, -1894007588, -899497514], l = [1732584193, -271733879, null, null, -1009589776]; for (l[2] = ~l[0], l[3] = ~l[1], e = 0; e < t.length; e += 16) { var p = l.slice(0); for (s = 0; s < 80; s++) r[s] = s < 16 ? t[e + s] : h(r[s - 3] ^ r[s - 8] ^ r[s - 14] ^ r[s - 16], 1), i = h(l[0], 5) + o[s / 20 | 0]() + l[4] + r[s] + d[s / 20 | 0] | 0, l[1] = h(l[1], 30), l.pop(), l.unshift(i); for (s = 0; s < 5; s++) l[s] = l[s] + p[s] | 0 } i = new DataView(new Uint32Array(l).buffer); for (let t = 0; t < 5; t++) l[t] = i.getUint32(t << 2); return Array.prototype.map.call(new Uint8Array(new Uint32Array(l).buffer), function (t) { return (t < 16 ? "0" : "") + t.toString(16) }).join("") } signature_gen(t, e) { var s = new Array; Object.keys(e).sort().map(t => { s.push(e[t]) }); var i = s.join("") + t; return this.sha1(i) } codeMsg(t, e, s = !1) { if (e.timestamp = e.timestamp || (new Date).getTime(), e.nonce = e.nonce || Math.round(Math.random()), e.sign = this.signature_gen(t, e), s) return e; let i = ""; for (const t in e) { let s = e[t]; i.length > 0 && (i += "&"), i += t + "=" + s } return i } } e._instance = null; class s { constructor() { this.soundMax = 3, this.soundMap = {}, this.isMute = !1 } static get Inst() { return this._instance || (this._instance = new s), this._instance } setPlat(t) { t && (this.plat = t, this.soundMap = {}) } playMusic(t, e = !0) { this.musicPath = t, this.disAudio(t) || (this.platMusic && this.platMusic.destroy(), this.musicPlayed = !0, this.platMusic = this.createAudio(t, !0), this.platMusic && this.platMusic.play()) } disAudio(t) { let e = !1; return this.isMute && (e = !0), t && "" != t || (e = !0), this.plat || (e = !0), e && this.platLog("不能播放声音,静音?路径?,平台允许?"), e } pauseMusic(t) { this.stopAudio(t) } stopMusic() { this.platMusic && this.platMusic.stop() } mute(t) { this.isMute = t, this.stopAudio(t) } stopAudio(t) { this.platMusic ? t ? this.platMusic.stop() : this.platMusic.play() : t || this.musicPlayed || !this.musicPath || this.playMusic(this.musicPath) } stopSound(t) { let e = this.soundMap[t]; if (e) { for (let t = 0; t < e.length; t++) { let s = e[t]; s && s.stop() } this.audio && "path" == this.audio.src && (this.audio.stop(), this.audio && (this.audio.destroy(), this.audio = null)) } } playSound(t, e = !1) { if (this.disAudio(t)) return; let s = this.soundMap[t]; null == s && (s = []); let i = null; s.length > this.soundMax ? (i = s.pop()).stop() : i = this.createAudio(t, e), i && (i.play(), s.push(i), this.soundMap[t] = s) } playAudioWithEnd(t, e) { this.disAudio(t) || (this.audio = this.createAudio(t, !1), this.audio && (this.audio.play(), this.audio.onEnded ? this.audio.onEnded(() => { e && e(), this.audio && (this.audio.destroy(), this.audio = null) }) : this.platLog("未检测到平台有音频结束回调"))) } createAudio(t, e) { let s = this.plat.createAudio(); if (!s) return this.platLog("该平台创建音频失败"), null; s.autoplay = !0, s.loop = e, s.obeyMuteSwitch && (s.obeyMuteSwitch = !1), s.src = t } platLog(e) { t.debug && (console.log("moyusdk log:"), console.log(e)) } destroy() { this.audio && this.audio.destroy() } } s._instance = null; class i { constructor() { this.zeroTime = 16094304e5, this.timeSpan = 0, this.sending = !1, this.weekNum = 0 } static get Inst() { return this._instance || (this._instance = new i), this._instance } getNetTime(s) { if (t.realTime && !this.sending) { let i = t.getUrl("tool/timestamp"); this.sending = !0, e.Inst.sendGet(i, t => { if (t) { let e = t.timestamp; this.setTimeSpan(e) } s && s(), this.sending = !1 }) } else s && s() } setTimeSpan(t) { let e = Number(t), s = this.getTime(); e && e > 0 && (this.timeSpan = s - e) } getTime(t = !1) { let e = (new Date).getTime() - this.timeSpan; return e < 999999999999 && (e *= 10), t ? Math.floor(.001 * e) : e } getDate(t = 0, e = !0) { t < 1 && (t = this.getTime()); let s = new Date(Number(t)); return e ? 1e4 * s.getUTCFullYear() + 100 * (s.getUTCMonth() + 1) + s.getUTCDate() : s.getFullYear() + "/" + (s.getMonth() + 1) + "/" + s.getDate() } getWeek() { let t = this.getTime(); return new Date(Number(t)).getDay() } getWeekNum() { let t = this.getTime() - this.zeroTime, e = Math.ceil(t / 864e5); return this.weekNum = Math.ceil((e - 3) / 7), this.weekNum % 52 } } i._instance = null; class a { constructor() { this.isAuth = !1, this.realName = "", this.realCode = "", this.userId = "", this.openId = "", this.nickName = "", this.headIcon = "", this.gender = 0, this.city = "", this.age = 0, this.loginCount = 0, this.videoCount = [0, 0] } } class n { safe_add(t, e) { var s = (65535 & t) + (65535 & e); return (t >> 16) + (e >> 16) + (s >> 16) << 16 | 65535 & s } rol(t, e) { return t << e | t >>> 32 - e } cmn(t, e, s, i, a, n) { return this.safe_add(this.rol(this.safe_add(this.safe_add(e, t), this.safe_add(i, n)), a), s) } ff(t, e, s, i, a, n, r) { return this.cmn(e & s | ~e & i, t, e, a, n, r) } gg(t, e, s, i, a, n, r) { return this.cmn(e & i | s & ~i, t, e, a, n, r) } hh(t, e, s, i, a, n, r) { return this.cmn(e ^ s ^ i, t, e, a, n, r) } ii(t, e, s, i, a, n, r) { return this.cmn(s ^ (e | ~i), t, e, a, n, r) } coreMD5(t) { for (var e = 1732584193, s = -271733879, i = -1732584194, a = 271733878, n = 0; n < t.length; n += 16) { var r = e, o = s, h = i, d = a; e = this.ff(e, s, i, a, t[n + 0], 7, -680876936), a = this.ff(a, e, s, i, t[n + 1], 12, -389564586), i = this.ff(i, a, e, s, t[n + 2], 17, 606105819), s = this.ff(s, i, a, e, t[n + 3], 22, -1044525330), e = this.ff(e, s, i, a, t[n + 4], 7, -176418897), a = this.ff(a, e, s, i, t[n + 5], 12, 1200080426), i = this.ff(i, a, e, s, t[n + 6], 17, -1473231341), s = this.ff(s, i, a, e, t[n + 7], 22, -45705983), e = this.ff(e, s, i, a, t[n + 8], 7, 1770035416), a = this.ff(a, e, s, i, t[n + 9], 12, -1958414417), i = this.ff(i, a, e, s, t[n + 10], 17, -42063), s = this.ff(s, i, a, e, t[n + 11], 22, -1990404162), e = this.ff(e, s, i, a, t[n + 12], 7, 1804603682), a = this.ff(a, e, s, i, t[n + 13], 12, -40341101), i = this.ff(i, a, e, s, t[n + 14], 17, -1502002290), s = this.ff(s, i, a, e, t[n + 15], 22, 1236535329), e = this.gg(e, s, i, a, t[n + 1], 5, -165796510), a = this.gg(a, e, s, i, t[n + 6], 9, -1069501632), i = this.gg(i, a, e, s, t[n + 11], 14, 643717713), s = this.gg(s, i, a, e, t[n + 0], 20, -373897302), e = this.gg(e, s, i, a, t[n + 5], 5, -701558691), a = this.gg(a, e, s, i, t[n + 10], 9, 38016083), i = this.gg(i, a, e, s, t[n + 15], 14, -660478335), s = this.gg(s, i, a, e, t[n + 4], 20, -405537848), e = this.gg(e, s, i, a, t[n + 9], 5, 568446438), a = this.gg(a, e, s, i, t[n + 14], 9, -1019803690), i = this.gg(i, a, e, s, t[n + 3], 14, -187363961), s = this.gg(s, i, a, e, t[n + 8], 20, 1163531501), e = this.gg(e, s, i, a, t[n + 13], 5, -1444681467), a = this.gg(a, e, s, i, t[n + 2], 9, -51403784), i = this.gg(i, a, e, s, t[n + 7], 14, 1735328473), s = this.gg(s, i, a, e, t[n + 12], 20, -1926607734), e = this.hh(e, s, i, a, t[n + 5], 4, -378558), a = this.hh(a, e, s, i, t[n + 8], 11, -2022574463), i = this.hh(i, a, e, s, t[n + 11], 16, 1839030562), s = this.hh(s, i, a, e, t[n + 14], 23, -35309556), e = this.hh(e, s, i, a, t[n + 1], 4, -1530992060), a = this.hh(a, e, s, i, t[n + 4], 11, 1272893353), i = this.hh(i, a, e, s, t[n + 7], 16, -155497632), s = this.hh(s, i, a, e, t[n + 10], 23, -1094730640), e = this.hh(e, s, i, a, t[n + 13], 4, 681279174), a = this.hh(a, e, s, i, t[n + 0], 11, -358537222), i = this.hh(i, a, e, s, t[n + 3], 16, -722521979), s = this.hh(s, i, a, e, t[n + 6], 23, 76029189), e = this.hh(e, s, i, a, t[n + 9], 4, -640364487), a = this.hh(a, e, s, i, t[n + 12], 11, -421815835), i = this.hh(i, a, e, s, t[n + 15], 16, 530742520), s = this.hh(s, i, a, e, t[n + 2], 23, -995338651), e = this.ii(e, s, i, a, t[n + 0], 6, -198630844), a = this.ii(a, e, s, i, t[n + 7], 10, 1126891415), i = this.ii(i, a, e, s, t[n + 14], 15, -1416354905), s = this.ii(s, i, a, e, t[n + 5], 21, -57434055), e = this.ii(e, s, i, a, t[n + 12], 6, 1700485571), a = this.ii(a, e, s, i, t[n + 3], 10, -1894986606), i = this.ii(i, a, e, s, t[n + 10], 15, -1051523), s = this.ii(s, i, a, e, t[n + 1], 21, -2054922799), e = this.ii(e, s, i, a, t[n + 8], 6, 1873313359), a = this.ii(a, e, s, i, t[n + 15], 10, -30611744), i = this.ii(i, a, e, s, t[n + 6], 15, -1560198380), s = this.ii(s, i, a, e, t[n + 13], 21, 1309151649), e = this.ii(e, s, i, a, t[n + 4], 6, -145523070), a = this.ii(a, e, s, i, t[n + 11], 10, -1120210379), i = this.ii(i, a, e, s, t[n + 2], 15, 718787259), s = this.ii(s, i, a, e, t[n + 9], 21, -343485551), e = this.safe_add(e, r), s = this.safe_add(s, o), i = this.safe_add(i, h), a = this.safe_add(a, d) } return [e, s, i, a] } binl2hex(t) { for (var e = "", s = 0; s < 4 * t.length; s++) e += "0123456789abcdef".charAt(t[s >> 2] >> s % 4 * 8 + 4 & 15) + "0123456789abcdef".charAt(t[s >> 2] >> s % 4 * 8 & 15); return e } binl2b64(t) { for (var e = "", s = 0; s < 32 * t.length; s += 6) e += "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(t[s >> 5] << s % 32 & 63 | t[s >> 6] >> 32 - s % 32 & 63); return e } str2binl(t) { for (var e = 1 + (t.length + 8 >> 6), s = new Array(16 * e), i = 0; i < 16 * e; i++) s[i] = 0; for (i = 0; i < t.length; i++) s[i >> 2] |= (255 & t.charCodeAt(i)) << i % 4 * 8; return s[i >> 2] |= 128 << i % 4 * 8, s[16 * e - 2] = 8 * t.length, s } strw2binl(t) { for (var e = 1 + (t.length + 4 >> 5), s = new Array(16 * e), i = 0; i < 16 * e; i++) s[i] = 0; for (i = 0; i < t.length; i++) s[i >> 1] |= t.charCodeAt(i) << i % 2 * 16; return s[i >> 1] |= 128 << i % 2 * 16, s[16 * e - 2] = 16 * t.length, s } hexMD5(t) { return this.binl2hex(this.coreMD5(this.str2binl(t))) } hexMD5w(t) { return this.binl2hex(this.coreMD5(this.strw2binl(t))) } b64MD5(t) { return this.binl2b64(this.coreMD5(this.str2binl(t))) } b64MD5w(t) { return this.binl2b64(this.coreMD5(this.strw2binl(t))) } calcMD5(t) { return this.binl2hex(this.coreMD5(this.str2binl(t))) } } class r { constructor() { this.id = "", this.title = "", this.desc = "", this.btnTxt = "", this.icon = "", this.image = "" } } var o, h; ! function (t) { t.total = "total", t.month = "month", t.week = "week", t.day = "day" }(o || (o = {})); class d { constructor() { this.ttVideoId = "", this.ttBannerId = "", this.ttInsertId = "", this.opVideoId = "", this.opBannerId = "", this.opNativeId = "", this.vvVideoId = "", this.vvBannerId = "", this.vvInsertId = "", this.vvNativeId = "", this.mzVideoId = "", this.mzBannerId = "", this.mzInsertId = "", this.wxVideoId = "", this.wxBannerId = "", this.wxInsertId = "", this.qqVideoId = "", this.qqBannerId = "", this.qqInsertId = "", this.qqBoxId = "", this.qqBlockId = "", this.hwVideoId = "", this.hwBannerId = "", this.hwInsertId = "", this.ksVideoId = "", this.ksBannerId = "", this.ksInsertId = "" } } ! function (t) { t[t.web = 0] = "web", t[t.tt = 1] = "tt", t[t.op = 2] = "op", t[t.vv = 3] = "vv", t[t.mz = 4] = "mz", t[t.wx = 5] = "wx", t[t.qq = 6] = "qq", t[t.f399 = 7] = "f399", t[t.ks = 8] = "ks", t[t.hw = 9] = "hw", t[t.xm = 10] = "xm", t[t.csj = 11] = "csj", t[t.mmy = 12] = "mmy", t[t.xmApk = 13] = "xmApk", t[t.vvApk = 14] = "vvApk", t[t.ios = 15] = "ios", t[t.t33 = 16] = "t33", t[t.hwkb = 17] = "hwkb", t[t.opApk = 18] = "opApk", t[t.hhw = 19] = "hhw", t[t.f399Apk = 20] = "f399Apk", t[t.ttApk = 21] = "ttApk", t[t.a233 = 22] = "a233" }(h || (h = {})); class l { constructor() { this.authUser = !1, this.userId = "", this.realName = "", this.realCode = "", this.age = 0, this.nickName = "", this.headIcon = "", this.openId = "", this.focused = !1, this.curDate = 0, this.curWeek = 0, this.createTime = 0, this.gameTime = 999, this.fcmDate = 0, this.minScore = 0, this.loginCount = 0, this.adScusNum = 0, this.adFailNum = 0 } saveData(t) { console.log('zh: saveData ' + t); let e = {}; for (let t in this) e[t.toString()] = this[t]; localStorage.setItem("moyudata_" + t, JSON.stringify(e)) } getData(t) { let e = localStorage.getItem("moyudata_" + t); if (e) { let t = JSON.parse(e); if (t) for (let e in this) { let s = t[e.toString()]; null != s && (this[e] = s) } } } clear(t) { localStorage.removeItem("moyudata_" + t) } } class p { constructor() { this.platName = "", this.platVersion = 0, this.isDouyin = !1, this.isQq3002 = !1, this.hasShortCut = !0, this.canFocus = !1, this.realName = 0, this.isLegal = !0, this.isMasked = !1, this.autoAd = 0, this.videoCount = 0, this.gameBit = 0, this.markBit = 0, this.appId = "", this.appSecret = "", this.platCode = "", this.pkgName = "", this.token = "", this.fcmActive = !1, this.hasAd = !1, this.videoErro = !1, this.bannerClose = !1, this.bannerShow = !1, this.platWidth = 750, this.platHeight = 1334, this.adTime = 0, this.hideTime = 0, this.myId = 0, this.myKey = "" } static get Inst() { return null == p._instance && (p._instance = new p), p._instance } init(e) { if (t.debug = e, this.moyuUser = new a, this.data = new l, this.nativeInfo = new r, this.data.getData(this.myId), this.data.userId.length < 2) { let e = this.getRandStr(5); //zh:用户默认昵称 this.data.headIcon = t.getTagro("headimg/0.jpg"); this.data.userId = "my" + this.myId + e; this.data.nickName = "player_" + e; this.data.loginCount = 1; this.data.createTime = this.getTime(); } else this.data.loginCount++; this.moyuUser.loginCount = this.data.loginCount, this.moyuUser.userId = this.data.userId, this.moyuUser.nickName = this.data.nickName, this.moyuUser.headIcon = this.data.headIcon, this.moyuUser.openId = this.data.openId, this.moyuUser.createTime = this.data.createTime, this.moyuUser.videoCount = [this.data.adScusNum, this.data.adFailNum], this.moyuUser.realName = this.data.realName, this.moyuUser.realCode = this.data.realCode, this.moyuUser.age = this.data.age, this.setGameTime(), this.data.saveData(this.myId) } initFCM(t) { t && this.moyuUser.age < 18 && this.moyuUser.realCode.length > 1 ? (this.fcmActive = !0, setInterval(() => { this.data.gameTime > 0 && (this.data.gameTime -= 1, this.saveData()) }, 6e4)) : this.fcmActive = !1 } setGameTime(s = !1) { let a = i.Inst.getDate(); if (a > this.data.fcmDate || s) { if (this.data.fcmDate = a, this.data.age < 18) { let s = (new Date).getDay(); this.data.gameTime = s > 0 && s < 5 ? 0 : 60; let i = t.getUrl("tool/holiday"); e.Inst.sendGet(i, t => { t && 0 == t.code && t.data && 0 != t.data.type && (this.data.gameTime = 60) }) } else this.data.gameTime = 9999; this.saveData() } } getRandStr(t) { let e = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"], s = ""; for (let i = 0; i < t; i++) { s += e[this.getRandom(0, e.length)] } return s } getRandom(t, e) { var s = e - t, i = Math.random() * s; return Math.floor(i) + t } saveData() { this.data && this.data.saveData(this.myId) } getRankUser() { return { userId: this.moyuUser.userId, nickName: this.moyuUser.nickName, headIcon: this.moyuUser.headIcon } } saveSeverData(s, i) { let a = this.moyuUser.openId; if (null != i && i.length >= 10 && (a = i), !a || a.length < 10) return void this.platError(11111, "存储错误,检查唯一id"); let n = this.platType < 10 ? "0" + this.platType : this.platType.toString(), r = { uid: this.myId + n + "00" + a, userData: JSON.stringify(s) }, o = t.getUrl("app-user-data/save"); e.Inst.sendPost(o, r, t => { t && 0 == t.code ? this.platLog("数据已保存") : this.platError(11112, t) }) } getSeverData(s, i) { let a = this.moyuUser.openId; if (null != i && i.length >= 10 && (a = i), !a || a.length < 10) return void this.platError(11113, "错误的id"); let n = this.platType < 10 ? "0" + this.platType : this.platType.toString(), r = this.myId + n + "00" + a, o = t.getUrl("app-user-data/get", "?uid=" + r); e.Inst.sendGet(o, t => { t && 0 == t.code ? s && s(JSON.parse(t.data.userData)) : (this.platLog("未获取到数据", t), s && s(null)) }) } onVideoDone(t) { t ? p.Inst.data.adScusNum++ : p.Inst.data.adFailNum++, this.moyuUser.videoCount = [this.data.adScusNum, this.data.adFailNum], this.saveData() } onRealName(t, e) { this.moyuUser.realName = this.data.realName = t, this.moyuUser.realCode = this.data.realCode = e; let s = i.Inst.getDate(), a = Number(e.substring(6, 14)), n = Math.floor((s - a) / 1e4); this.moyuUser.age = this.data.age = n, this.initFCM(!0), this.setGameTime(!0), this.saveData() } clearData() { this.data && this.data.clear(this.myId) } initUser(t, e = 0) { if (t) { switch (this.platType) { case h.tt: case h.wx: this.moyuUser.nickName = t.userInfo.nickName, this.moyuUser.headIcon = t.userInfo.avatarUrl, this.setCity(t.userInfo.city), this.moyuUser.gender = t.userInfo.gender; break; case h.op: 0 == e ? (this.moyuUser.openId = t.uid, this.moyuUser.nickName = t.nickName, this.moyuUser.headIcon = t.avatar, this.moyuUser.gender = "M" == t.sex ? 1 : "F" == t.sex ? 2 : 0, this.setAge(t.age)) : (this.moyuUser.openId = t.userInfo.userId, this.moyuUser.nickName = t.userInfo.userName, this.moyuUser.headIcon = t.userInfo.avatar, this.setCity(t.userInfo.location), this.moyuUser.gender = "M" == t.userInfo.sex ? 1 : "F" == t.userInfo.sex ? 2 : 0, this.setAge(t.userInfo.age)); break; case h.vv: this.moyuUser.nickName = t.nickName, this.moyuUser.headIcon = t.smallAvatar, this.moyuUser.gender = t.gender; break; case h.mz: this.moyuUser.nickName = t.nickname, this.moyuUser.headIcon = t.icon, this.moyuUser.openId = t.uid; break; case h.ks: this.moyuUser.nickName = t.userName, this.moyuUser.headIcon = t.userHead, this.moyuUser.openId = t.unionID, this.setCity(t.userCity), this.moyuUser.gender = "M" == t.gender ? 1 : "F" == t.gender ? 2 : 0, this.setAge(t.age); break; case h.xmApk: "string" == typeof t && (this.moyuUser.nickName = t); break; case h.f399: this.moyuUser.headIcon = t.icon, this.moyuUser.nickName = t.userName, this.moyuUser.openId = t.uId; break; default: console.log("zh:该平台没有用户信息") } this.moyuUser.userId = this.data.userId, this.moyuUser.isAuth = !0, this.data.authUser = !0, this.data.openId = this.moyuUser.openId, this.data.nickName = this.moyuUser.nickName, this.data.headIcon = this.moyuUser.headIcon, this.saveData() } } setAge(t) { null == t ? this.moyuUser.age = 0 : t instanceof String && (this.moyuUser.age = Number(t)), this.moyuUser.age < 0 && (this.moyuUser.age = 0) } setCity(t) { t ? this.moyuUser.city.length < 1 && (this.moyuUser.city = t) : this.moyuUser.city = "" } isGameBit(t) { if (0 == this.gameBit) return !0; return ((t = Number(t)) & this.gameBit) == t } showTip(t) { this.onTipCall && this.onTipCall(t) } platLog(...e) { if (t.debug) { console.log("moyusdk log:"); for (const t of e) console.log(t) } } platError(t, e) { console.error("moyusdk error:" + t), e && console.error(e) } onShow(t = !0) { t ? (this.platLog("plat onShow"), Math.abs(i.Inst.getTime() - this.hideTime) > 6e5 && i.Inst.getNetTime()) : (this.hideTime = i.Inst.getTime(), this.platLog("plat onHide")), this.pauseMusic(!t), this.showTip(t ? 20011 : 20012) } pauseMusic(t) { s.Inst.pauseMusic(t) } onConnected(t) { t ? (i.Inst.getNetTime(), this.showTip(20021)) : this.showTip(20022), this.platLog("net changed:", t) } getTime() { return i.Inst.getTime() } isNewDay() { let t = i.Inst.getDate(); return t > this.data.curDate && (this.data.curDate = t, this.saveData(), !0) } isNewWeek() { return i.Inst.getWeekNum(), i.Inst.weekNum > this.data.curWeek && (this.data.curWeek = i.Inst.weekNum, this.saveData(), !0) } onBannerHide() { this.bannerClose || (this.platLog("banner 广告背关闭/隐藏"), this.showTip(20111)) } onNativeLoad(t) { if (t) { let e = t.icon; this.nativeInfo.id = t.adId, this.nativeInfo.title = t.title, this.nativeInfo.btnTxt = t.clickBtnTxt, this.nativeInfo.desc = t.desc; let s = t.imgUrlList[0]; s && s.length > 0 && (this.nativeInfo.image = s), e && e.length > 0 && (this.nativeInfo.icon = e) } else this.nativeInfo.icon = "", this.nativeInfo.image = ""; this.onNativeCall && this.onNativeCall(), this.onNativeCall = null } getUserInfo(t) { } oppoSign(t, e, s, i, a) { let r = { appKey: t, appSecret: e, pkgName: s, timeStamp: a, token: i }, o = ""; for (const t in r) { let e = r[t]; o.length > 0 && (o += "&"), o += t + "=" + e } return (new n).hexMD5(o).toUpperCase() } signMap(t) { var e = new Array; return Object.keys(t).sort().map(s => { e.push(t[s]) }), e.join("") } } p._instance = null; let u = p.Inst; class c { constructor() { this.videoId = "", this.bannerId = "", this.insertId = "", this.nativeId = "", this.boxId = "", this.blockId = "", this.customAd = {}, this.videoType = 0, this.bannerType = 0, this.insertType = 0, this.nativeIdx = -1 } init() { if (!this.sdk) return void u.platError(10001, "Platform super"); this.sdk.onShow && this.sdk.onShow(t => { u.onShow(!0) }), this.sdk.onHide && this.sdk.onHide(t => { u.onShow(!1) }); let t = null; this.sdk.getLaunchOptionsSync && (t = this.sdk.getLaunchOptionsSync()), t && (u.platOptions = t), this.subLoader = this.sdk.loadSubpackage } initApp(t) { } initAds() { if (!this.sdk || !this.sdk.getSystemInfoSync) return; let e = this.sdk.getSystemInfoSync(), s = t.bannerW = e.windowWidth; t.bannerW > 1440 && (t.bannerW = 1440), t.bannerH = s / 6.7 } initUser(t, e = !1) { t && t() } getOpenId(t) { } getLocation(t) { t && t() } userAgree(t) { } onAdMsg(t) { } onUserInfo(t) { this.userCall && this.userCall() } showMoreGame() { } createAudio() { if (this.sdk.createInnerAudioContext) return this.sdk.createInnerAudioContext(); u.platLog("audio is null") } setWH() { let t = this.sdk.getSystemInfoSync && this.sdk.getSystemInfoSync(); t && (u.platWidth = t.screenWidth ? t.screenWidth : 750, u.platHeight = t.screenHeight ? t.screenHeight : 1334) } exit() { } addLnk(t) { t && t() } focus(t) { } shareGame(t, e, s) { } recordeGame(t, e) { } recordPause(t) { } recordeStart() { } recordeEnd(t) { t && t() } showBlock(t) { } showBox() { } sendDataEvent(t, e) { } toVideoView(t) { } vibrate(t) { this.sdk && (t && this.sdk.vibrateLong ? this.sdk.vibrateLong() : this.sdk.vibrateShort && this.sdk.vibrateShort()) } showVideoAd(t) { this.adCall = t, u.videoAd ? u.hasAd ? (u.platLog("videoAd show"), u.videoAd.show()) : (2 != this.videoType && u.showTip(20102), u.videoAd.load()) : this.voidId(this.videoId) ? t && t(!0) : u.platLog("videoAd is null") } initVideoAd(t) { this.voidId(t) || (this.videoId = t, u.videoAd = this.sdk.createRewardedVideoAd({ adUnitId: this.videoId }), u.videoAd.onError(t => { 3 != this.videoType && (u.hasAd = !1), u.videoErro = !0, u.platError(10201, t) }), u.videoAd.onLoad && u.videoAd.onLoad(() => { u.hasAd = !0, u.videoErro = !1, u.platLog("videoAd onLoad"), 2 == this.videoType && u.videoAd.show() }), u.videoAd.onClose(t => { if (u.hasAd = 3 == this.videoType, 2 == this.videoType) setTimeout(() => { this.adCall && this.adCall(!0), this.adCall = null }, 500); else { let e = !1; (t && t.isEnded || void 0 === t) && (e = !0), this.adCall && this.adCall(e), this.adCall = null, 1 == this.videoType && u.videoAd.load() } }), 1 == this.videoType && u.videoAd.load(), u.platLog("videoAd inited")) } showBannerAd(t) { u.bannerAd ? t ? u.bannerAd.show() : u.bannerAd.hide() : this.voidId(this.bannerId) || u.platLog("bannerAd is null") } initBannerAd(e, s = 30) { if (this.voidId(e)) return; this.bannerId = e; let i = this.sdk.getSystemInfoSync(), a = i.windowHeight, n = i.windowHeight, r = {}; r = 1 == this.bannerType ? { adUnitId: this.bannerId, style: { left: a / 2 - t.bannerW / 2, top: n - t.bannerH, width: t.bannerW, height: t.bannerH } } : { adUnitId: this.bannerId, adIntervals: s, style: { left: a / 2 - t.bannerW / 2, top: n - t.bannerH } }, u.bannerAd = this.sdk.createBannerAd(r), u.bannerAd.onError(t => { u.platError(10211, t) }), u.bannerAd.onLoad(() => { this.setBannerPos(), u.bannerShow ? 0 == this.bannerType && u.bannerAd.show() : u.bannerAd.hide() }), u.bannerAd.onClose && u.bannerAd.onClose(function () { u.onBannerHide() }), u.bannerAd.onHide && u.bannerAd.onHide(function () { u.onBannerHide() }), u.platLog("BannerAd inited") } setBannerPos() { if (!u.bannerAd || !u.bannerAd.style) return void u.platLog("banner or style is null"); let e = this.sdk.getSystemInfoSync(), s = e.windowWidth, i = e.windowHeight, a = u.bannerAd.style, n = t.bannerPy * i; n = n < t.bannerH ? 0 : n > i - t.bannerH ? i - t.bannerH : t.bannerPy * i - t.bannerH / 2, a.width && (a.width = t.bannerW), a.height && (a.height = t.bannerH), a.left = t.bannerPx * s - .5 * t.bannerW, a.top = n, u.bannerAd.style = a } initInsertAd(t) { this.voidId(t) || (this.insertId = t, u.insertAd = this.sdk.createInterstitialAd({ adUnitId: this.insertId }), u.insertAd && (u.insertAd.onError(t => { u.platError(10221, t) }), u.insertAd.onLoad && u.insertAd.onLoad(() => { 1 == this.insertType && u.insertAd.show() }), u.platLog("InsertAd inited"))) } showInsertAd(t) { u.insertAd ? 0 == this.insertType ? u.insertAd.show() : 1 == this.insertType ? u.insertAd.load() : 2 == this.insertType && u.insertAd.show().catch(t => { u.platError(10221, t) }) : this.voidId(this.insertId) || u.platLog("InsertAd is null") } initCustomAd(t, e, s, i) { if (this.voidId(t)) return; let a = this.customAd[t]; a && (a.destroy(), this.customAd[t] = null), i < 30 && (i = 30), (e > 1 || s > 1) && u.platLog("CustomAd位置不合理"); let n = this.sdk.getSystemInfoSync(), r = n.screenWidth * e, o = n.screenHeight * s, h = this.sdk.createCustomAd({ adUnitId: t, adIntervals: i, style: { left: r, top: o } }); h.onError(t => { u.platError(10241, t) }), h.onLoad(() => { u.platLog(t + "CustomAd onload") }), this.customAd[t] = h } showCustomAd(t, e) { let s = this.customAd[t]; s ? e ? s.show() : s.hide() : this.voidId(t) || u.platLog("CustomAd is null") } reportNative(t) { if (!u.nativeAd) return; let e = u.nativeInfo.id; u.platLog("reportNative:" + t, e), !e || e.length < 1 || (1 == t ? u.nativeAd.reportAdShow({ adId: e }) : u.nativeAd.reportAdClick({ adId: e })) } getNativeAd(t) { u.onNativeCall = t, u.nativeAd ? u.nativeAd.load() : this.setNative() } setNative(t = !1) { if (this.nativeId.length < 2) return; let e = this.nativeId.split(","); this.nativeIdx < 0 ? this.nativeIdx = u.getRandom(0, e.length) : (this.nativeIdx++, this.nativeIdx >= e.length && (this.nativeIdx = 0)); let s = e[this.nativeIdx]; t ? setTimeout(() => { this.initNative(s) }, 5e3) : this.initNative(s) } initNative(t) { this.voidId(t) || (u.nativeAd && u.nativeAd.destroy(), u.nativeAd = this.sdk.createNativeAd({ adUnitId: t }), u.nativeAd && (u.nativeAd.onError(t => { this.setNative(!0), u.onNativeLoad(null), u.platError(10231, t) }), u.nativeAd.onLoad(function (t) { let e = t.adList.pop(); u.platLog("native onload"), u.onNativeLoad(e), u.nativeAd.reportAdShow({ adId: u.nativeInfo.id }) }), u.nativeAd.load())) } voidId(t) { return null == t || t.length < 2 } } class g extends c { constructor() { super(...arguments), this.recordStop = !0, this.appOptions = [{ appId: "tt7c920a2fe3a914da", query: "k=v", extraData: {} }, { appId: "tt84e2f25f1bda296b", query: "k=v", extraData: {} }], this.url1 = "/gate.snssdk.c", this.url2 = "ht" } init() { if (this.sdk = window.tt, this.sdk) { this.subLoader = this.sdk.loadSubpackage; var e = this.sdk.getLaunchOptionsSync(); e && (p.Inst.platOptions = e), this.sdk.login({ success(e) { p.Inst.platCode = e.code, window.tt.onTouchEnd(() => { t.realName || window.tt.authenticateRealName({ complete() { p.Inst.platLog("实名认证"), t.realName = !0 } }) }) }, fail(t) { p.Inst.platError(10011, t) } }), this.sdk.getSystemInfo({ success(t) { p.Inst.platName = t.appName, "Douyin" != t.appName && "douyin_lite" != t.appName || (p.Inst.isDouyin = !0) } }), this.initRecoder(), this.sdk.checkShortcut && this.sdk.checkShortcut({ success: function (t) { p.Inst.hasShortCut = t.status.exist }, fail: function (t) { p.Inst.platLog("Shortcut失败", t), p.Inst.hasShortCut = !0 } }), this.sdk.onShareAppMessage(e => { const s = { title: t.shareTitle, imageUrl: t.shareImg, extra: {}, query: t.shareQuery, success(t) { p.Inst.platLog("分享成功", t) }, fail(t) { p.Inst.platLog("分享失败", t), p.Inst.showTip(20301) } }, i = Object.assign({ channel: e.channel }, s); return i.extra = { withVideoId: !0, videoTopics: t.shareTag, hashtag_list: t.shareTag, videoTag: p.Inst.getTime() }, i }), super.init() } else p.Inst.platError(10001) } initAds() { this.sdk && (this.videoType = 3, p.Inst.hasAd = !0, this.initVideoAd(t.ttVideoId), this.initBannerAd(t.ttBannerId), this.initInsertAd(t.ttInsertId)) } getLocation(t) { this.sdk && this.sdk.getLocation({ success(e) { t && t(e) }, fail(t) { p.Inst.platLog("getLocation失败", t) } }) } showMoreGame() { "ios" !== this.sdk.getSystemInfoSync().platform ? this.sdk.showMoreGamesModal({ appLaunchOptions: this.appOptions, success(t) { p.Inst.platLog("success", t.errMsg) }, fail(t) { p.Inst.platLog("fail", t.errMsg) } }) : this.sdk.showToast({ title: " iOS不支持" }) } getOpenId() { } initUser(t, e) { this.sdk ? (this.sdk.getSetting({ success: s => { let i = s.authSetting["scope.userInfo"]; void 0 === i ? this.getUserInfo(t) : i ? this.getUserInfo(t) : e ? this.sdk.openSetting({ success: e => { e.authSetting["scope.userInfo"] ? this.getUserInfo(t) : t() }, fail: e => { p.Inst.platLog("openSetting 失败", e), t() } }) : t() }, fail: e => { p.Inst.platLog("getSetting 失败", e), t() } }), p.Inst.moyuUser.openId.length < 1 && p.Inst.appSecret.length > 0 && this.getOpenId()) : t && t() } getUserInfo(t) { this.sdk.getUserInfo({ success: e => { p.Inst.initUser(e), t(!0) }, fail: e => { p.Inst.platLog("getUserInfo 失败", e), t() } }) } recordeGame(t, e) { "devtools" != p.Inst.platName && (p.Inst.shareMp4 = "", this.recordTime = t, this.recordClip = e, e && (t = 300), p.Inst.onRecordCall = null, this.recorder ? (this.recordStop || (this.recordStop = !0, p.Inst.platLog("上一次录屏没结束,注意检查逻辑")), p.Inst.platLog("recordGame"), this.recorder.start({ duration: t, isMarkOpen: !0, locLeft: 0, locTop: 0, frameRate: 30 })) : p.Inst.platError(10401, "recorder is null")) } recordPause(t) { "devtools" != p.Inst.platName && this.recorder && (t ? this.recorder.pause() : this.recorder.resume()) } recordeEnd(t) { p.Inst.onRecordCall = t, this.recorder && this.recorder.stop() } addLnk(t) { this.sdk ? this.sdk.addShortcut({ success: function (e) { p.Inst.hasShortCut = !0, t && t() }, fail: function (t) { p.Inst.hasShortCut = !1 } }) : t && t(!0) } focus(t) { this.sdk.openAwemeUserProfile(), t && t(!0) } shareGame(e, s, i) { this.sdk && (null == s && (s = t.shareImg), null == i && (i = t.shareQuery), p.Inst.shareMp4 && p.Inst.shareMp4.length > 0 ? (p.Inst.platLog("视频分享"), this.sdk.shareAppMessage({ channel: "video", title: t.shareTitle, desc: t.shareTitle + "-视频分享", imageUrl: s, templateId: t.shareId, query: i, extra: { videoPath: p.Inst.shareMp4, videoTag: t.shareTitle, videoTopics: t.shareTag, hashtag_list: t.shareTag, video_title: t.shareTitle }, success(t) { p.Inst.platLog("分享视频成功", t), e(!0) }, fail(t) { p.Inst.platLog("分享视频失败", t), p.Inst.showTip(20301), e(!1) } })) : (p.Inst.platLog("普通分享"), this.sdk.shareAppMessage({ templateId: "", title: t.shareTitle, desc: t.shareTitle + "-分享", imageUrl: s, query: i, success() { p.Inst.platLog("分享成功"), e(!0) }, fail(t) { p.Inst.platLog("分享失败"), p.Inst.showTip(20301) } }))) } initRecoder() { this.sdk.getSystemInfo({ success: t => { this.recorder = this.sdk.getGameRecorderManager(), this.recorder.onStart(t => { p.Inst.platLog("record start"), this.recordStop = !1 }), this.recorder.onStop(t => { this.recordStop ? p.Inst.platLog("已结束过了") : (this.recordStop = !0, p.Inst.shareMp4 = t.videoPath, p.Inst.platLog("record stop:" + t.videoPath), this.recordClip ? this.recorder.clipVideo({ path: t.videoPath, timeRange: [this.recordTime, 0], success(t) { p.Inst.platLog("clipVideo:" + t.videoPath), p.Inst.shareMp4 = t.videoPath, p.Inst.onRecordCall && p.Inst.onRecordCall() }, fail(t) { p.Inst.platLog("裁剪出错,使用未裁剪视频", t), p.Inst.onRecordCall && p.Inst.onRecordCall() } }) : p.Inst.onRecordCall && p.Inst.onRecordCall()) }) }, fail(t) { p.Inst.platLog("record fail", t) } }) } getVideoList(t, e, s) { if (!this.sdk) return; let i = () => { this.sdk.request({ url: this.url2 + "tps:/" + this.url1 + "om/developer/api/get_top_video_ids_by_like", method: "POST", data: { app_id: t, number_of_top: 100, tag: "", access_token: p.Inst.token, rank_type: "month" }, success: t => { p.Inst.platLog("视频获取成功"), s && s(t) }, fail: t => { p.Inst.platLog("视频获取失败", t) } }) }; p.Inst.token.length < 1 ? this.getToken(t, e, () => { i() }) : i() } getToken(t, e, s) { } toVideoView(t) { t.length < 2 || this.sdk.navigateToVideoView({ videoId: t, success: t => { }, fail: t => { p.Inst.platLog("toVideoView fail:", t), 1006 === t.errCode && this.sdk.showToast({ title: "something wrong with your network" }) } }) } } class m extends c { init() { if (this.sdk || (this.sdk = window.qg), !this.sdk) return void p.Inst.platError(10001); this.subLoader = this.sdk.loadSubpackage, this.sdk.getLaunchOptionsSync().referrerInfo, this.sdk.hasShortcutInstalled({ success: function (t) { 0 == t && (p.Inst.hasShortCut = !1) }, fail: function (t) { p.Inst.hasShortCut = !1, p.Inst.platLog("ShortCut出错", t) } }), super.init() } initAds() { this.videoType = 1, this.insertType = 1, t.bannerW = 900, t.bannerH = 300, this.initVideoAd(t.opVideoId), this.initBannerAd(t.opBannerId), this.nativeId = t.opNativeId } initBannerAd(e, s = 30) { super.initBannerAd(e, s), p.Inst.bannerAd && p.Inst.bannerAd.bannerAd.onResize(e => { t.bannerH = e.height, t.bannerW = e.width, this.setBannerPos() }) } addLnk(t) { this.sdk && this.sdk.installShortcut({ success: function () { p.Inst.platLog("ShortCut成功"), p.Inst.hasShortCut = !0, t && t() }, fail: function (t) { p.Inst.platError(10301, t) } }) } initUser(t) { this.sdk.login({ success: function (e) { p.Inst.platCode = e.data.token, p.Inst.appSecret.length > 1 ? p.Inst.getUserInfo(t) : (p.Inst.initUser(e.data), t && t(!0)) }, fail: function (t) { p.Inst.platError(10011, t) } }) } } let I = p.Inst; class f extends c { init() { this.sdk || (this.sdk = window.qg), this.sdk ? (this.subLoader = this.sdk.loadSubpackage, this.sdk.hasShortcutInstalled({ success: function (t) { I.hasShortCut = !!t } }), super.init()) : I.platError(10001) } initAds() { super.initAds(), this.insertId = t.vvInsertId, this.initVideoAd(t.vvVideoId), this.initBannerAd(t.vvBannerId), this.nativeId = t.vvNativeId } initUser(t) { this.sdk && this.sdk.getSystemInfoSync().platformVersionCode >= 1063 && this.sdk.getUserInfo().then(e => { e.data && (I.initUser(e.data), t(!0)) }, e => { I.platLog("userinfo失败", e), t(!1) }) } addLnk(t) { this.sdk && this.sdk.installShortcut({ success: function () { I.platLog("ShortCut成功"), I.hasShortCut = !0, t && t() }, fail: function (t) { I.platError(10301, t), I.hasShortCut = !1 } }) } initBannerAd(t, e = 30) { this.bannerId = t, this.bannerId.length < 2 || (I.bannerAd = this.sdk.createBannerAd({ posId: this.bannerId, adIntervals: e, style: {} }), I.bannerAd.onError(t => { I.platError(10211, t) }), I.bannerAd.onLoad(() => { I.bannerShow ? I.bannerAd.show() : I.bannerAd.hide() }), I.bannerAd.onClose(function () { I.onBannerHide() })) } initInsertAd() { this.insertId.length < 1 || (I.insertAd = this.sdk.createInterstitialAd({ posId: this.insertId }), I.insertAd && (I.insertAd.onError(t => { I.platError(10221, t) }), I.insertAd.onLoad(() => { I.insertAd.show() }), I.insertAd.onClose(() => { I.insertAd = null }), I.insertAd.load())) } showInsertAd() { I.insertAd ? I.insertAd.load() : this.initInsertAd() } } class y { static get Inst() { return null == y._instance && (y._instance = new y), y._instance } init(s, i) { let a = p.Inst.platVersion % 2, n = { appKey: p.Inst.myId, platform: s, settingIndex: a }, r = e.Inst.codeMsg(p.Inst.myKey, n), o = t.getUrl("app/setting-get-new?", r); e.Inst.sendGet(o, e => { let s = p.Inst; if (e && 0 == e.code && e.data) { let i = JSON.parse(e.data.settingData), a = JSON.parse(e.data.testData), n = JSON.parse(e.data.onlineData), r = null == i.status ? e.data.status : i.status; if (s.realName = null == i.realname ? 0 : i.realname, s.isLegal = r < 2, s.isMasked = !(r > 2) && !e.data.security.status, s.gameBit = i.gameBit, s.markBit = i.markBit, s.gameData = i.data, s.autoAd = null == i.autoAd ? 0 : i.autoAd, s.gameConfig = s.isLegal || s.isMasked ? a : n, i.config) for (let t in i.config) s.gameConfig[t] = i.config[t]; (!s.gameConfig || s.gameConfig.length < 1) && (s.gameConfig = null), s.setCity(e.data.cityName), t.init(i.ads) } else e && s.platError(10010, e); i && i() }) } } y._instance = null; class k extends c { constructor() { super(...arguments), this.shared = !1, this.shareTime = 0 } init() { if (this.sdk = window.wx, !this.sdk) return void p.Inst.platError(10001); this.insertType = 2, this.subLoader = this.sdk.loadSubpackage, this.sdk.showShareMenu({ withShareTicket: !0, menus: ["shareAppMessage", "shareTimeline"] }), this.sdk.onShow(t => { p.Inst.onShow(!0), this.onShare() }), this.sdk.onHide(t => { p.Inst.onShow(!1) }); let t = null; this.sdk.getLaunchOptionsSync && (t = this.sdk.getLaunchOptionsSync()), t && (p.Inst.platOptions = t) } initAds() { this.initVideoAd(t.wxVideoId), this.initBannerAd(t.wxBannerId), this.initInsertAd(t.wxInsertId) } initUser(t, e) { this.sdk ? (this.sdk.login({ success(t) { p.Inst.platCode = t.code }, fail(t) { p.Inst.platError(10011, t) } }), this.sdk.getSetting({ success: s => { let i = s.authSetting["scope.userInfo"]; void 0 === i ? (p.Inst.platLog("微信授权请使用createWXUserBtn"), t()) : i ? this.getUserInfo(t) : e ? (p.Inst.platLog("授权设置请求"), this.sdk.openSetting({ success: e => { e.authSetting["scope.userInfo"] ? this.getUserInfo(t) : t() }, fail: e => { p.Inst.platLog("openSetting 失败", e), t() } })) : t() }, fail: e => { p.Inst.platLog("getSetting 失败", e), t() } }), p.Inst.moyuUser.openId.length < 1 && p.Inst.appSecret.length > 0 && this.getOpenId()) : t && t() } getUserInfo(t) { this.sdk.getUserInfo({ success: e => { p.Inst.initUser(e), t(!0) }, fail: e => { p.Inst.platLog("getUserInfo 失败", e), t() } }) } getOpenId() { } onShare() { this.shared || (this.shared = !0, this.shareCall && (p.Inst.getTime() - this.shareTime < 3100 ? this.shareCall(!1) : this.shareCall(!0))) } shareGame(e, s, i) { this.sdk ? (this.shareCall = e, null == s && (s = t.shareImg), null == i && (i = t.shareQuery), this.shared = !1, this.shareTime = p.Inst.getTime(), this.sdk.shareAppMessage({ title: t.shareTitle, imageUrl: s, query: i, imageUrlId: t.shareId })) : e && e() } } class v { constructor() { this.appid = 100, this.isMask = !1, this.isLegal = !0, this.imgId = "", this.waitTime = 60 } static get Inst() { return this.instance || (this.instance = new v), this.instance } init(t) { this.appid = t; let e = location.href.lastIndexOf("="); e < 0 || (this.imgId = location.href.substring(e + 1, location.href.length), !this.imgId || this.imgId.length < 1 || this.getData(() => { this.isLegal || this.isMask || this.imgId.length < 1 || this.waitTime < 1 || setTimeout(() => { this.waitTime > 0 && this.createInfo() }, 1e3 * this.waitTime) })) } createInfo() { let e = new Image; e.src = t.getTagro("issuer/" + this.imgId + ".jpg"), e.style.position = "absolute", e.style.zIndex = "999"; let s = document.body.clientWidth, i = document.body.clientHeight, a = i > 500 ? 500 : i, n = .6 * a; e.width = n, e.height = a, document.body.appendChild(e), e.style.top = (.5 * i - a / 2).toString(), e.style.left = (s / 2 - n / 2).toString(), e.onload = (() => { var r = new Image; r.src = t.getTagro("issuer/close.png"), r.style.position = "absolute", r.style.zIndex = "1000", r.width = 36, r.height = 36, r.style.top = (.5 * i - a / 2).toString(), r.style.left = (s / 2 + n / 2 - 36).toString(), document.body.appendChild(r), r.onclick = (t => { e.hidden = !0, r.hidden = !0 }) }) } getData(s) { let i = e.Inst.codeMsg("bc48cbce46946057", { appKey: 100, platform: "web", settingIndex: 0 }), a = t.getUrl("app/setting-get-new?", i); e.Inst.sendGet(a, t => { if (t && 0 == t.code && t.data) { let e = JSON.parse(t.data.settingData), s = !t.data.security.status; if (this.isLegal = e.legals.indexOf(this.appid) >= 0, this.isMask = s && e.masks.indexOf(this.appid) >= 0, this.waitTime = e.time, e.apps) { let t = "app" + this.appid, s = e.apps[t]; if (s && s.length > 1) { this.waitTime = s[0]; let t = e[s[1]]; t && t.indexOf(this.imgId) < 0 && (this.imgId = "") } else e.imgs ? e.imgs.indexOf(this.imgId) < 0 && (this.imgId = "") : this.imgId = "" } } s && s() }) } destroy() { this.waitTime = 0 } } class A extends c { constructor() { super(...arguments), this.shared = !1, this.shareTime = 0 } init() { if (this.sdk = window.qq, this.sdk) { if (this.subLoader = this.sdk.loadSubpackage, this.sdk.onShow(t => { p.Inst.onShow(!0), this.onShare() }), this.sdk.onHide(t => { p.Inst.onShow(!1) }), this.sdk.getLaunchOptionsSync) { let t = this.sdk.getLaunchOptionsSync(); p.Inst.platOptions = t } this.sdk.showShareMenu({ withShareTicket: !0, menus: ["shareAppMessage", "shareTimeline"] }), this.sdk.onShareAppMessage(() => ({ title: t.shareTitle, imageUrl: t.shareImg })) } else p.Inst.platError(10001) } initAds() { this.videoId = t.qqVideoId, this.bannerId = t.qqBannerId, this.insertId = t.qqInsertId, this.boxId = t.qqBoxId, this.blockId = t.qqBlockId, this.initVideoAd(t.qqVideoId), this.initBannerAd(t.qqBannerId), this.initInsertAd(t.qqInsertId) } initUser(t, e) { this.sdk.login({ success(t) { p.Inst.platCode = t.code }, fail(t) { p.Inst.platError(10011, t) } }), this.sdk.getSetting({ success: s => { let i = s.authSetting["scope.userInfo"]; void 0 === i ? this.getUserInfo(t) : i ? this.getUserInfo(t) : e ? this.sdk.openSetting({ success: e => { e.authSetting["scope.userInfo"] ? this.getUserInfo(t) : t() }, fail: e => { p.Inst.platLog("openSetting 失败", e), t() } }) : t() }, fail: e => { p.Inst.platLog("getSetting 失败", e), t() } }), p.Inst.moyuUser.openId.length < 1 && p.Inst.appSecret.length > 0 && this.getOpenId() } getUserInfo(t) { this.sdk.getUserInfo({ success: e => { p.Inst.initUser(e), t(!0) }, fail: e => { p.Inst.platLog("getUserInfo 失败", e), t() } }) } getOpenId() { } onShare() { this.shared || (this.shared = !0, this.shareCall && (p.Inst.getTime() - this.shareTime < 3100 ? this.shareCall(!1) : this.shareCall(!0))) } shareGame(e, s, i) { this.sdk ? (this.shareCall = e, null == s && (s = t.shareImg), null == i && (i = t.shareQuery), this.shared = !1, this.shareTime = p.Inst.getTime(), this.sdk.shareAppMessage({ title: t.shareTitle, imageUrl: s, query: i })) : e && e() } initBox() { this.boxId.length < 1 || (p.Inst.boxAd = this.sdk.createAppBox({ adUnitId: this.boxId }), p.Inst.boxAd && p.Inst.boxAd.load()) } initBlock() { if (this.blockId.length < 1) return; let t = this.sdk.getSystemInfoSync(), e = (t.windowWidth, t.windowHeight); if (this.sdk.createBlockAd) { if (p.Inst.blockAd = this.sdk.createBlockAd({ size: 5, adUnitId: this.blockId, orientation: "landscape", style: { left: 12, top: e - 100 } }), !p.Inst.blockAd || !p.Inst.blockAd.onError) return p.Inst.platLog("blockAd is null"), void (p.Inst.blockAd = null); p.Inst.blockAd.onError(t => { p.Inst.platError(10241, t) }), p.Inst.blockAd.onLoad(() => { p.Inst.platLog("blockAd onLoad show"), p.Inst.blockAd.show() }) } } showBox() { p.Inst.boxAd && p.Inst.boxAd.show() } showBlock(t) { p.Inst.blockAd && (p.Inst.blockAd.hide(), p.Inst.blockAd.destroy(), p.Inst.blockAd = null), t && this.initBlock() } createCash(t, e) { } } class w extends c { constructor() { super(...arguments), this.recordDelta = 0, this.recordloop = !1 } init() { this.sdk = window.ks, this.sdk ? (this.subLoader = this.sdk.loadSubpackage, this.initRecoder(), this.sdk.login({ success(t) { }, fail(t) { p.Inst.platLog("ks login fail", t) } }), this.sdk.getAPKShortcutInstallStatus(t => { -10005 === t.code ? p.Inst.platLog("当前环境不支持") : 1 === t.code && (t.installed || (p.Inst.hasShortCut = !1)) }), super.init()) : p.Inst.platError(10001) } addLnk(t) { this.sdk.saveAPKShortcut(e => { -10005 === e.code ? p.Inst.hasShortCut = !0 : 1 === e.code ? (p.Inst.hasShortCut = !0, p.Inst.platLog("Shortcut成功"), t && t()) : (p.Inst.hasShortCut = !1, p.Inst.platError(10301, e)) }) } focus(t) { this.sdk.openUserProfile({ accountType: "MiniGameOfficialAccount", callback: e => { 1 == e.errorCode ? p.Inst.canFocus = !1 : p.Inst.platLog("关注失败", e), t && t(1 == e.errorCode) } }) } initUser(t) { this.sdk.getSetting({ success: e => { let s = e["scope.userInfo"]; void 0 === s ? this.sdk.authorize({ scope: "scope.userInfo", success: e => { this.getUserInfo(t) }, fail: e => { p.Inst.platLog("userinfo失败: ", e), t && t() } }) : s && this.getUserInfo(t) }, fail: e => { p.Inst.platLog("getSetting 失败", e), t && t() } }) } getUserInfo(t) { this.sdk.getUserInfo({ success: e => { p.Inst.initUser(e), t(!0) }, fail: e => { p.Inst.platLog("getUserInfo 失败", e), t() } }) } initAds() { this.videoType = 3, p.Inst.hasAd = !0, this.initVideoAd(t.ksVideoId), this.initInsertAd(t.ksInsertId) } recordeGame(t, e) { "devtools" != p.Inst.platName && (p.Inst.shareMp4 = "", this.recordloop = !1, this.recorder && this.recorder.abort(), this.doRecord()) } recordPause(t) { "devtools" != p.Inst.platName && this.recorder && (t ? this.recorder.pause() : this.recorder.resume()) } doRecord() { this.recorder ? (this.recordDelta = p.Inst.getTime(), p.Inst.platLog("recordeGame", this.recordDelta), this.recorder.start()) : p.Inst.platError(10401, "recorder is null") } recordeEnd(t) { if (this.recordCall = t, this.recordloop && p.Inst.shareMp4.length > 0 && p.Inst.getTime() - this.recordDelta < 5e3) return this.recordDelta = 0, this.recordloop = !1, this.recordCall && this.recordCall(), void (this.recorder && this.recorder.pause()); this.recordloop = !1, this.recordDelta = 0, this.recorder && this.recorder.stop() } shareGame(e, s) { null == s && (s = t.shareQuery), p.Inst.shareMp4 && this.recorder ? (p.Inst.platLog("视频分享"), this.recorder.publishVideo({ video: p.Inst.shareMp4, mouldId: t.shareId, query: s, callback: t => { if (null != t && null != t) return p.Inst.platLog("分享失败: ", JSON.stringify(t)), void e(); p.Inst.platLog("分享成功"), e && e(!0) } })) : p.Inst.platLog("无法分享:", p.Inst.shareMp4) } initRecoder() { this.recorder = this.sdk.getGameRecorder(), this.recorder.on("start", () => { }), this.recorder.on("error", t => { p.Inst.platLog("recorder error", t) }), this.recorder.on("stop", t => { t && t.videoID ? (p.Inst.platLog("record stop", t.videoID), p.Inst.shareMp4 = t.videoID, this.recordCall && this.recordCall(), this.recordloop && setTimeout(() => { this.doRecord() }, 1e3)) : p.Inst.platLog("录制失败") }) } } class T extends c { init() { this.sdk = window.qg, this.sdk ? super.init() : p.Inst.platError(10001) } initAds() { this.sdk && (super.initAds(), this.videoType = 2, this.insertType = 1, this.bannerType = 1, this.initVideoAd(t.mzVideoId), this.initBannerAd(t.mzBannerId), this.initInsertAd(t.mzInsertId)) } initUser(t) { this.sdk.login({ success: e => { p.Inst.initUser(e), t(!0) }, fail: e => { p.Inst.platLog("mz授权失败", e), t() } }) } } class b extends c { init() { this.sdk = window.qg, this.sdk ? super.init() : p.Inst.platError(10001) } initAds() { this.videoType = 1, this.insertType = 1, this.initVideoAd(t.hwVideoId), this.initBannerAd(t.hwBannerId), this.initInsertAd(t.hwInsertId) } } class S extends c { constructor() { super(...arguments), this.adNum = 1, this.canAd = !0 } init() { this.sdk = window.h5api, this.sdk || p.Inst.platError(10001) } shareGame(t) { this.sdk.share(), t && t() } showMoreGame() { this.sdk.showRecommend() } showVideoAd(t) { this.adCall = t, this.sdk.canPlayAd(t => { this.canAd = t.canPlayAd, this.adNum = t.remain, p.Inst.showTip(20200 + this.adNum), this.adNum > 0 || this.canAd ? this.sdk.playAd(t => { p.Inst.platLog("4399H5ad:" + t.code + " " + t.message), 1e4 === t.code || (10001 === t.code ? (this.adCall && this.adCall(!0), this.adCall = null) : p.Inst.showTip(20110)) }) : this.adNum < 1 && (this.adCall && this.adCall(!0), this.adCall = null) }) } } class L extends c { init() { let t = window.conchConfig; if (null == t) return void this.error(10001); var e = t.getOS(); let s = window.PlatformClass; s ? ("Conch-ios" == e ? this.sdk = s.createClass("ViewController") : "Conch-android" == e && (this.sdk = s.createClass("demo.MainActivity")), this.sdk || this.error(10002)) : this.error(10001) } initApp(t) { this.sdk.call("initApp", t) } initUser(t) { this.userCall = t, this.sdk.call("initUser") } showMoreGame() { this.sdk.call("showMoreGame") } showVideoAd(t) { this.adCall = t, this.sdk.call("showVideoAd") } showInsertAd(t) { this.sdk.call("showInsertAd", t) } showBannerAd(t) { this.sdk.call("showBannerAd", t) } vibrate(t = !0) { this.sdk.call("vibrate", t) } userAgree(t) { this.sdk.call("userAgree", t) } exit() { this.sdk.call("exit") } onAdMsg(t) { p.Inst.platLog("onAdMsg", t), "0" == t ? this.adCall && this.adCall(!0) : "1" == t ? p.Inst.showTip(20101) : "2" == t ? p.Inst.showTip(20102) : p.Inst.showTip(20103) } onUserInfo(t) { p.Inst.platLog("onUserInfo"), p.Inst.initUser(t), this.userCall && this.userCall() } log(...t) { p.Inst.platLog(t) } error(t) { p.Inst.platError(t) } } var U; ! function (t) { t.adDataId = "AdStatis", t.gameLogin = "GameLogin", t.gameStart = "GameStart", t.gameEnd = "GameEnd" }(U || (U = {})); let C = p.Inst, M = i.Inst, N = e.Inst; class V { constructor() { this.isVibrat = !0, this.onVibrat = !1, this.vibratTime = 1e3, this.lastInsertTime = 0, this.recordTime = 0, this.recordMark = 0, this.recordIsPause = !1, this.lastVideoTime = 0, this.platMarks = ["web", "tt", "op", "vv", "mz", "wx", "qq", "f399", "ks", "hw", "xm", "csj", "mmy", "xmapk", "vvapk", "ios", "233", "hwkb", "opapk", "hhw", "f399apk", "ttapk", "a233"], this.authDone = !1, this.targoData = {}, this.gameList = [], this.rankList = [], window.onMoyuAdBack = this.onMoyuAdBack, window.onMoyuUserBack = this.onMoyuUserBack, window.onTargoBack = this.onTargoBack } static get Inst() { return this.instance || (this.instance = new V), this.instance } init(e, i, a, n = !1) { if (C.platType = 0, C.myId = 0, C.myKey = "", e) { C.myId = e.myId ? e.myId : 0, C.myKey = e.myKey ? e.myKey : "", C.platType = e.plat ? e.plat : 0, C.platVersion = e.version ? Math.ceil(e.version) : 0; let s = e.ads ? e.ads : null; t.init(s) } else console.log("本地测试:" + this.platMarks[0]); if (C.platType > this.platMarks.length || C.platType < 0) return void console.error("参数不合法:" + C.platType); switch (C.init(n), C.platType) { case h.tt: this.platform = new g; break; case h.op: this.platform = new m; break; case h.vv: this.platform = new f; break; case h.mz: this.platform = new T; break; case h.wx: this.platform = new k; break; case h.qq: this.platform = new A; break; case h.hw: this.platform = new b; break; case h.f399: this.platform = new S; break; case h.ks: this.platform = new w; break; case h.csj: case h.hwkb: case h.t33: case h.mmy: case h.xmApk: case h.vvApk: case h.opApk: case h.ios: case h.hhw: case h.f399Apk: case h.ttApk: case h.a233: this.platform = new L } let r = this.platMarks[C.platType]; this.platform ? (C.platLog("平台初始化:" + r), this.platform.init()) : C.onShow(), C.myId > 0 && C.myKey.length > 1 ? y.Inst.init(r, () => { this.platform && this.platform.initAds(), 1 == (1 & C.markBit) && this.sendEvent(U.gameLogin), a && a.apply(i) }) : this.isVoidPlat || this.platform.initAds(), v.Inst.init(C.myId), s.Inst.setPlat(this.platform), C.data.authUser && this.platform && setTimeout(() => { this.lastInsertTime = C.getTime() + 1e4, this.platform && this.platform.initUser(t => { t ? (this.authDone = !0, C.platLog("获取到已授权用户")) : (this.authDone = !1, C.platLog("用户可能已设置拒绝"), C.data.authUser = !1, C.saveData()) }) }, 2e3) } initApp(t) { this.isVoidPlat || this.platform.initApp(t) } initTargoApp(t, e) { this.targoData.appid = t, this.targoData.key = e } exit() { this.isVoidPlat || (C.platType > 10 ? this.platform.exit() : this.platform.sdk.exitApplication && this.platform.sdk.exitApplication({})) } initFCM(t) { C.initFCM(t) } get gameTime() { if (C.fcmActive) { let t = new Date; return 20 != t.getHours() ? 0 : (t = null, C.data.gameTime) } return 9999 } get isRealName() { return this.getUserInfo().realCode.length > 1 } get needRealName() { return !!this.isPlat(h.ttApk) && !this.isRealName } authenticate(e, s, i) { if (!this.isName(e) || !this.isID(s)) return void (i && i(!1)); if (!(C.realName ? C.getRandom(0, 100) < C.realName : this.isLegal) || this.isVoidPlat) return C.onRealName(e, s), void (i && i(!0)); let a = t.getUrl("real-info/enter"), n = this.getUserInfo(), r = { appKey: C.myId, userId: n.userId, numberId: s, realName: e }, o = N.codeMsg(C.myKey, r, !0); N.sendPost(a, o, t => { let a = !1; t && 0 == t.code && "ok" == t.data && (C.onRealName(e, s), a = !0), i && i(a) }) } isName(t) { if (t.length < 2 || t.length > 4) return !1; let e = new RegExp("^[一-鿿]+$"), s = !0; return e.test(t) || (s = !1), e = null, s } isID(t) { if (18 != t.length) return !1; let e = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2], s = 0; for (let i = 0; i < t.length - 1; i++) { let a = t.substring(i, i + 1), n = Number(a); if (Number.isNaN(n)) return !1; s += n * e[i] } return t.substring(t.length - 1, t.length).toUpperCase() == [1, 0, "X", 9, 8, 7, 6, 5, 4, 3, 2][s % 11].toString() } onGameStart(t) { 2 == (2 & C.markBit) && this.sendEvent(U.gameStart, { id: t }) } onGameEnd(t, e = 0) { 2 == (2 & C.markBit) && this.sendEvent(U.gameEnd, { id: t, res: e }), C.getTime() - this.lastVideoTime > 3e4 && C.getRandom(0, 100) < C.autoAd && this.showVideoAd(() => { }, 0) } needRealTime(e = !0) { t.realTime = e, M.getNetTime() } getTime(t = !1) { return M.getTime(t) } isNewDay(t, e) { if (0 == M.timeSpan) M.getNetTime(() => { let s = C.isNewDay(); e && e.apply(t, [s]) }); else { let s = C.isNewDay(); e && e.apply(t, [s]) } } isNewWeek(t, e) { if (0 == M.timeSpan) M.getNetTime(() => { let s = C.isNewWeek(); e.apply(t, [s]) }); else { let s = C.isNewWeek(); e.apply(t, [s]) } } getDate(t = 0, e = !0) { return M.getDate(t, e) } getWeek() { return M.getWeek() } getWeekNum() { return M.getWeekNum() } getPlatSize() { return this.isVoidPlat ? (C.platWidth = 750, C.platHeight = 1334) : this.platform.setWH(), { width: C.platWidth, height: C.platHeight } } userAgree(t) { this.isVoidPlat || this.platform.userAgree(t) } onSetting(t, e) { this.isVibrat = e, s.Inst.mute(!t) } showMoreGame() { this.isVoidPlat || this.platform.showMoreGame() } onMoyuAdBack(t) { C.platLog("onMoyuAdBack:", t); let e = V.Inst.platform; e && e.onAdMsg(t) } onMoyuUserBack(t) { let e = V.Inst.platform; e && e.onUserInfo(t) } onTargoBack(e) { let s = V.Inst.targoData.appid; if (!s || s.length < 2 || !e) return void console.error("targo appid is null"); let i = V.Inst.targoData.key, a = JSON.parse(e); a.appId = s, (!a.deviceId || a.deviceId < 5) && (a.deviceId = C.moyuUser.userId); let n = N.codeMsg(i, a, !0), r = t.getTagro("v3/app/launch").replace("mygame1", "click"); N.sendPost(r, n, t => { t && 0 == t.code ? C.platLog("targoapp send done") : console.error("targoapp send erro", t) }) } showVideoAd(t, e = 0, s, i) { let a = C.getTime(); if (a - this.lastVideoTime < 1e3) return C.platLog("video请求太频繁"), void C.showTip(20100); if (this.lastVideoTime = a, this.isVoidPlat) C.platLog("本地广告测试,直接返回成功"), t && (s ? t.apply(s) : t()); else { if (C.videoErro && this.isWx) return C.platLog("分享代替视频"), void this.shareGame(e => { e ? t && (s ? t.apply(s) : t()) : i && (s ? i.apply(s) : i()) }); C.videoCount += 1, this.lastInsertTime = a, C.platLog("展示视频广告"), 4 == (4 & C.markBit) && this.sendEvent(U.adDataId, { type: e, result: 0 }), this.platform.showVideoAd(a => { a ? t && (s ? t.apply(s) : t()) : i && (s ? i.apply(s) : i()), C.onVideoDone(a), 4 == (4 & C.markBit) && this.sendEvent(U.adDataId, { type: e, result: a ? 1 : 2 }) }) } } upRankData(e, s, i = !1, a = !1, n, r) { if (!(a || this.hasUserInfo && C.moyuUser.isAuth)) return void C.platLog("未授权暂不上传"); if (Math.floor(e / 100) != C.myId) return void C.platError(11301, "rankid不合法"); if (C.data.minScore > s && !i) return; let o = C.getRankUser(), h = { user: o, data: n }, d = r || o.userId, l = t.getUrl("rank/push"), p = { rankId: e, userId: d, rankScore: s, userData: JSON.stringify(h) }; N.sendPost(l, p, t => { t && 0 == t.code ? (C.platLog("rank上传成功"), C.data.minScore = s) : C.platLog("rank上传失败", t) }) } getRankList(e, s, i, a = !1) { let n = e.rankId; if (n && Math.floor(n / 100) == C.myId) if (this.rankList.length < 1 || a) { let a = t.getUrl("rank/list"); N.sendPost(a, e, t => { t && 0 == t.code ? (t.data.lastScore > C.data.minScore && (C.data.minScore = t.data.lastScore), this.rankList = t.data.list) : C.platLog("rank获取失败", t), i && i.apply(s, [this.rankList]) }) } else i && i.apply(s, [this.rankList]); else C.platError(11301, "rankid不合法") } getGameList(e, s) { if (this.gameList.length < 1) { let i = ""; if (this.isTT) i = t.getUrl("recommend/get"); else { if (!this.isWx) return void C.platError(11201, "该平台没有推荐列表"); i = t.getUrl("recommend/wechat-get") } N.sendGet(i, t => { if (t) { let e = t.data.recommendList; for (let t = 0; t < e.length; t++) { let s = e[t]; if (C.gameBit < 1 || (C.gameBit & s.group) == s.group) { let t = { myId: s.appKey, type: s.type, name: s.name, icon: s.icon, banner: s.banner, appId: s.wx_app_id ? s.wx_app_id : "", videoId: s.videoid ? s.videoid : "", launchNum: s.launch_num }; this.gameList.push(t) } } } s && s.apply(e, [this.gameList]) }) } else s && s.apply(e, [this.gameList]); C.platLog("获取推荐列表") } saveServerData(t, e) { C.saveSeverData(t, e) } getServerData(t, e, s) { C.getSeverData(s => { t && (e ? t.apply(e, [s]) : t(s)) }, s) } reportNative(t = 2) { this.isVoidPlat || (this.platform.reportNative(t), C.platLog("原生上报" + t)) } getNativeAd(t, e) { this.isVoidPlat ? e && e.apply(t, [C.nativeInfo]) : (this.platform.getNativeAd(() => { e && e.apply(t, [C.nativeInfo]) }), C.platLog("获取原生ad")) } loadSubRes(t, e) { let s = this.platform; return new Promise(function (i) { s && s.subLoader || (C.platLog("平台无分包"), i(!0)); var a = s.subLoader({ name: t, success: function () { C.platLog(t + "完成"), i(!0) }, fail: function (t) { C.platError(10121, t), i(!1) } }); e && a.onProgressUpdate(function (t) { let s = t.progress > 1 ? .01 * t.progress : t.progress; e(s) }) }) } setShareInfo(e, s, i, a, n) { t.shareTitle = e, s && s.length > 0 && (t.shareTag = s), a && a.length > 1 && (t.shareImg = a), n && n.length > 1 && (t.shareQuery = n), i && i.length > 1 && (t.shareId = i) } addLnk(t, e) { this.isVoidPlat || (this.platform && !C.hasShortCut ? this.platform.addLnk(() => { t && (e ? t.apply(e) : t()) }) : t && (e ? t.apply(e) : t())) } get canFocus() { return !this.isVoidPlat && (this.isDouyin ? C.canFocus = !C.data.focused : this.isKs && this.platform.sdk.checkFollowState({ accountType: "CPServiceAccount", callback: t => { -10005 === t.errorCode ? C.canFocus = !1 : C.canFocus = !t.hasFollow } }), C.canFocus) } focus(t, e) { this.isVoidPlat || (this.canFocus ? (C.platLog("发起关注"), this.platform.focus(s => { s && (C.data.focused = !0, C.saveData()), t && (e ? t.apply(e, [s]) : t(s)) })) : C.platLog("不能关注,通过canFocus()获取当前能否关注?")) } shareGame(e, s, i, a, n) { this.isVoidPlat ? e && (s ? e.apply(s) : e()) : (C.platLog("分享调用"), (null == t.shareTitle || t.shareTitle.length < 1) && C.platError(10311, "分享标题为空,可能会拒审"), this.platform.shareGame(t => { e && (s ? e.apply(s, [t]) : e(t)), t && (this.recordTime = 0) }, a, n)) } canShare() { return this.isQq || this.isWx || this.isTT || this.isKs || this.isF399 ? this.isTT || this.isKs ? null == C.shareMp4 || C.shareMp4.length < 1 ? 2 : this.recordTime < 4e3 ? 3 : 101 : 1 : 0 } set shareVideo(t) { C.shareMp4 = t } get shareVideo() { return C.shareMp4 } recordGame(t, e = !1) { this.isVoidPlat || (t > 300 ? t = 300 : t < 5 && (C.platLog("录屏时间太短"), t = 5), this.recordTime = 0, this.recordIsPause = !1, this.recordMark = this.getTime(), this.platform.recordeGame(t, e)) } recordPause(t) { if (this.isVoidPlat) return; if (this.recordIsPause == t) return; this.recordIsPause = t; let e = this.getTime(); t && (this.recordTime += e - this.recordMark), this.recordMark = e, this.platform.recordPause(t) } recordEnd(t, e) { if (this.isVoidPlat) return C.platLog("测试录屏完成"), void (e && e.apply(t)); let s = this.getTime(); this.recordTime += s - this.recordMark, this.platform.recordeEnd(() => { e && e.apply(t, [C.shareMp4]) }) } get isVoidPlat() { return !this.platform || !this.platform.sdk } initUser(t, e, s = !1, i, a, n) { C.pkgName = n || "", C.appId = i || "", C.appSecret = a || "", s = !C.isLegal && s, this.authDone || this.isVoidPlat || !this.hasUserInfo || C.moyuUser.isAuth && (!a || a.length < 5 || C.moyuUser.openId.length > 1) ? e && e.apply(t, [C.moyuUser]) : (this.platform.initUser(() => { this.authDone = C.moyuUser.isAuth, e && e.apply(t, [C.moyuUser]) }, s), C.platLog("初始化个人信息")) } createWXUserBtn(t, e, s, i, a, n) { if (this.isVoidPlat || this.authDone || !this.isWx) return null; let r = this.platform.sdk.getSystemInfoSync(), o = r.windowWidth * t - .5 * s, h = r.windowHeight * e - .5 * i, d = this.platform.sdk.createUserInfoButton({ type: "image", image: a, style: { left: o, top: h, width: s, height: i, lineHeight: 40, backgroundColor: "", color: "", textAlign: "center", fontSize: 16, borderRadius: 4 } }); return d.onTap(t => { "getUserInfo:ok" == t.errMsg ? (C.initUser(t), n && n()) : C.platLog("授权失败"), this.authDone = !0, d.destroy() }), d } getSystemInfo() { if (!this.isVoidPlat && this.platform.sdk.getSystemInfo) return this.platform.sdk.getSystemInfoSync() } createClubBtn(t, e) { if (this.isVoidPlat) return null; return this.platform.sdk.createGameClubButton({ type: "image", image: e, icon: "green", style: t }) } getUserInfo() { return C.moyuUser } clearData() { C.clearData() } sendDataEvent(t, e) { 8 == (8 & C.markBit) ? this.sendEvent(t, e) : C.platError(11102, "自定义打点未激活") } sendEvent(e, s) { if (C.myId < 1) return void C.platError(11102, "应用id错误"); if (this.isVoidPlat) return void C.platLog(11101, "测试环境,不打点"); if (s) { let t = 0; for (const e in s) if (++t > 2) return void C.platError(11101, "打点数据格式错误") } else s = {}; let i = t.getUrl("event/push"), a = { appKey: C.myId, eventKey: e, platformKey: this.platMarks[C.platType], userId: C.moyuUser.userId, eventParams: JSON.stringify(s) }; N.codeMsg(C.myKey, a), N.sendPost(i, a, t => { t && 0 == t.code ? C.platLog("打点成功:" + e) : C.platLog("打点失败", t) }) } getLocation(t, e) { this.isVoidPlat || this.platform.getLocation(s => { t && (e ? t.apply(e, s) : t(s)) }) } playVideo(t) { this.isVoidPlat || this.platform.toVideoView(t) } getRandom(t, e) { return C.getRandom(t, e) } getRandString(t) { return C.getRandStr(t) } setOnTipCall(t, e) { C.onTipCall = (s => { t && (e ? t.apply(e, [s]) : t(s)) }) } playAudioWithEnd(t, e, i) { this.isVoidPlat || s.Inst.playAudioWithEnd(i, () => { e && e.apply(t) }) } playSound(t, e = !1) { this.isVoidPlat || s.Inst.playSound(t, e) } stopSound(t) { this.isVoidPlat || s.Inst.stopSound(t) } stopMusic() { this.isVoidPlat || s.Inst.stopMusic() } pauseMusic(t) { this.isVoidPlat || s.Inst.pauseMusic(t) } playMusic(t) { this.isVoidPlat || s.Inst.playMusic(t) } mute(t) { this.isVoidPlat || s.Inst.mute(t) } createAudio() { return this.isVoidPlat ? null : this.platform.createAudio() } sendPost(t, e, s) { N.sendPost(t, e, s) } sendGet(t, e) { N.sendGet(t, e) } get platData() { return C.gameData } get platConfig() { return C.gameConfig } getLaunchOptions() { return C.platOptions } get isLegal() { return C.isLegal || C.isMasked } set isLegal(t) { C.isLegal = t } get isMasked() { return C.isMasked } get isDouyin() { return C.isDouyin } get hasShortCut() { return C.hasShortCut } get hasShadow() { return this.isTT } get isNeedPlatAudio() { return !1 } get platType() { return C.platType } isPlat(t) { return t == C.platType } get isWx() { return h.wx == C.platType } get isQq() { return h.qq == C.platType } get isWeb() { return h.web == C.platType } get isXMApk() { return h.xmApk == C.platType } get isF399() { return h.f399 == C.platType } get isVivo() { return h.vv == C.platType } get isOppo() { return h.op == C.platType } get isTT() { return h.tt == C.platType } get isTTApk() { return h.ttApk == C.platType } get isMZ() { return h.mz == C.platType } get isT33() { return h.t33 == C.platType } get isMmy() { return h.mmy == C.platType } get isKs() { return h.ks == C.platType } get isHw() { return h.hw == C.platType } get isVVApk() { return h.vvApk == C.platType } get isOPApk() { return this.isPlat(h.opApk) } get isIos() { return h.ios == C.platType } get hasUserInfo() { return this.isTT || this.isWx || this.isQq || this.isVivo || this.isOppo || this.isKs || this.isMZ } get isNeedOgg() { return C.platType > 10 } get hasAgree() { return !this.isIos && (this.isOppo || this.isVivo || C.platType > 10) } vibration(t = 100) { if (this.isVibrat && !this.onVibrat) if (this.onVibrat = !0, setTimeout(() => { this.onVibrat = !1 }, this.vibratTime), this.isVoidPlat) { if (!navigator || navigator.vibrate) return; navigator.vibrate = navigator.vibrate || navigator.webkitVibrate || navigator.mozVibrate || navigator.msVibrate, navigator.vibrate && navigator.vibrate(t) } else this.platform.vibrate(t >= 400) } waitNext() { return new Promise(function (t) { requestAnimationFrame(() => { t() }) }) } waitFrames(t) { return new Promise(function (e) { let s = t + 1, i = !0; setInterval(() => { i && (i = !1, --s < 1 ? e() : requestAnimationFrame(() => { i = !0 })) }, 8) }) } waitSeconds(t) { return new Promise(function (e) { setTimeout(() => { e() }, 1e3 * t) }) } initVideoAd(t) { this.isVoidPlat || this.platform.initVideoAd(t) } initBannerAd(e, s = 30, i = .5, a = 1) { this.isVoidPlat || (t.bannerPx = i, t.bannerPy = a, this.platform.initBannerAd(e, s)) } setBannerPos(e = .5, s = 1) { this.isVoidPlat || (t.bannerPx = e, t.bannerPy = s, this.platform.setBannerPos(), C.platLog("banner调整")) } showBannerAd(t) { this.isVoidPlat || C.bannerShow != t && (this.platform.showBannerAd(t), C.bannerShow = t, C.bannerClose = !t, C.platLog("banner:" + t)) } showBlock(t) { this.isVoidPlat || this.platform.showBlock(t) } showBox() { this.isVoidPlat || this.platform.showBox() } initCustomAd(t, e, s, i = 30) { this.isVoidPlat || this.platform.initCustomAd(t, e, s, i) } showCustomAd(t, e) { this.isVoidPlat || this.platform.showCustomAd(t, e) } initInsertAd(t) { this.isVoidPlat || this.platform.initInsertAd(t) } showInsertAd(t = 0, e = 0, s = "") { if (this.isVoidPlat) return; let i = C.getTime(), a = i - this.lastInsertTime; if (a < e) return C.platLog("插屏间隔太短:" + a), void C.showTip(20122); (!s || s.length < 1) && (this.lastInsertTime = i), t > 100 ? setTimeout(() => { this.platform.showInsertAd(s) }, t) : this.platform.showInsertAd(s), C.platLog("插屏显示") } } window.Moyu = V.Inst, window.MoyuPlat = h, window.MoyuUser = a, window.MoyuRankType = o, window.MoyuCfg = class { constructor() { this.myId = 0, this.myKey = "", this.plat = h.web, this.version = 0, this.ads = null, this.ads = new d } }, window.MoyuAds = d, window.MoyuNative = r }();