moyu.js 76 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208
  1. ! function() {
  2. "use strict";
  3. class t {
  4. static getHost() {
  5. if (this.myHost.length > 1) return this.myHost;
  6. this.myHost = "ht" + this.url + ":" + this.line + "/";
  7. for (let t of this.apiArry) this.myHost += t;
  8. return this.myHost += "cn/", this.myHost
  9. }
  10. static init(t) {
  11. if (t)
  12. for (const e in t) {
  13. let s = t[e];
  14. void 0 !== this[e] && (this[e] = s)
  15. }
  16. }
  17. static getUrl(t, e) {
  18. let s = this.getHost();
  19. return t && (s += t), e && (s += e), s
  20. }
  21. static getTagro(t) {
  22. if (this.tangro.length < 2) {
  23. this.tangro = "ht" + this.url + ":" + this.line + "/";
  24. for (let t of this.urlArry) this.tangro += t;
  25. this.tangro += "cn/"
  26. }
  27. return this.tangro + t
  28. }
  29. }
  30. 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."];
  31. class e {
  32. constructor() {
  33. this.hKey = "Ht", this.hKey += "tp"
  34. }
  35. static get Inst() {
  36. return this._instance || (this._instance = new e), this._instance
  37. }
  38. sendPost(t, e, s) {
  39. this.sendMsg(t, e, s, "POST")
  40. }
  41. sendGet(t, e) {
  42. this.sendMsg(t, null, e, "GET")
  43. }
  44. sendMsg(t, e, s, i) {
  45. let a = null,
  46. n = window,
  47. r = n["XML" + this.hKey + "Request"];
  48. 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);
  49. a.onload = function() {
  50. if (200 == a.status) {
  51. if (a.responseText && "" != a.responseText) {
  52. let t;
  53. try {
  54. t = JSON.parse(a.responseText)
  55. } catch (t) {
  56. console.error(a.responseText)
  57. }
  58. s && s(t)
  59. }
  60. } else console.log("request fail" + a.status)
  61. }, a.open(i, t, !0), "POST" == i ? (a.setRequestHeader("Content-Type", "application/json; charset=UTF-8"), a.send(JSON.stringify(e))) : a.send()
  62. }
  63. encodeUTF8(t) {
  64. var e, s, i, a = [];
  65. 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)));
  66. return a
  67. }
  68. sha1(t) {
  69. var e, s, i, a = new Uint8Array(this.encodeUTF8(t)),
  70. n = 16 + (a.length + 8 >>> 6 << 4);
  71. 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);
  72. t[a.length >> 2] |= 128 << 24 - 8 * (3 & a.length), t[n - 1] = a.length << 3;
  73. var r = [],
  74. o = [function() {
  75. return l[1] & l[2] | ~l[1] & l[3]
  76. }, function() {
  77. return l[1] ^ l[2] ^ l[3]
  78. }, function() {
  79. return l[1] & l[2] | l[1] & l[3] | l[2] & l[3]
  80. }, function() {
  81. return l[1] ^ l[2] ^ l[3]
  82. }],
  83. h = function(t, e) {
  84. return t << e | t >>> 32 - e
  85. },
  86. d = [1518500249, 1859775393, -1894007588, -899497514],
  87. l = [1732584193, -271733879, null, null, -1009589776];
  88. for (l[2] = ~l[0], l[3] = ~l[1], e = 0; e < t.length; e += 16) {
  89. var p = l.slice(0);
  90. 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);
  91. for (s = 0; s < 5; s++) l[s] = l[s] + p[s] | 0
  92. }
  93. i = new DataView(new Uint32Array(l).buffer);
  94. for (let t = 0; t < 5; t++) l[t] = i.getUint32(t << 2);
  95. return Array.prototype.map.call(new Uint8Array(new Uint32Array(l).buffer), function(t) {
  96. return (t < 16 ? "0" : "") + t.toString(16)
  97. }).join("")
  98. }
  99. signature_gen(t, e) {
  100. var s = new Array;
  101. Object.keys(e).sort().map(t => {
  102. s.push(e[t])
  103. });
  104. var i = s.join("") + t;
  105. return this.sha1(i)
  106. }
  107. codeMsg(t, e, s = !1) {
  108. 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;
  109. let i = "";
  110. for (const t in e) {
  111. let s = e[t];
  112. i.length > 0 && (i += "&"), i += t + "=" + s
  113. }
  114. return i
  115. }
  116. }
  117. e._instance = null;
  118. class s {
  119. constructor() {
  120. this.soundMax = 3, this.soundMap = {}, this.isMute = !1
  121. }
  122. static get Inst() {
  123. return this._instance || (this._instance = new s), this._instance
  124. }
  125. setPlat(t) {
  126. t && (this.plat = t, this.soundMap = {})
  127. }
  128. playMusic(t, e = !0) {
  129. 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())
  130. }
  131. disAudio(t) {
  132. let e = !1;
  133. return this.isMute && (e = !0), t && "" != t || (e = !0), this.plat || (e = !0), e && this.platLog("不能播放声音,静音?路径?,平台允许?"), e
  134. }
  135. pauseMusic(t) {
  136. this.stopAudio(t)
  137. }
  138. stopMusic() {
  139. this.platMusic && this.platMusic.stop()
  140. }
  141. mute(t) {
  142. this.isMute = t, this.stopAudio(t)
  143. }
  144. stopAudio(t) {
  145. this.platMusic ? t ? this.platMusic.stop() : this.platMusic.play() : t || this.musicPlayed || !this.musicPath || this.playMusic(this.musicPath)
  146. }
  147. stopSound(t) {
  148. let e = this.soundMap[t];
  149. if (e) {
  150. for (let t = 0; t < e.length; t++) {
  151. let s = e[t];
  152. s && s.stop()
  153. }
  154. this.audio && "path" == this.audio.src && (this.audio.stop(), this.audio && (this.audio.destroy(), this.audio = null))
  155. }
  156. }
  157. playSound(t, e = !1) {
  158. if (this.disAudio(t)) return;
  159. let s = this.soundMap[t];
  160. null == s && (s = []);
  161. let i = null;
  162. s.length > this.soundMax ? (i = s.pop()).stop() : i = this.createAudio(t, e), i && (i.play(), s.push(i), this.soundMap[t] = s)
  163. }
  164. playAudioWithEnd(t, e) {
  165. this.disAudio(t) || (this.audio = this.createAudio(t, !1), this.audio && (this.audio.play(), this.audio.onEnded ? this.audio.onEnded(() => {
  166. e && e(), this.audio && (this.audio.destroy(), this.audio = null)
  167. }) : this.platLog("未检测到平台有音频结束回调")))
  168. }
  169. createAudio(t, e) {
  170. let s = this.plat.createAudio();
  171. if (!s) return this.platLog("该平台创建音频失败"), null;
  172. s.autoplay = !0, s.loop = e, s.obeyMuteSwitch && (s.obeyMuteSwitch = !1), s.src = t
  173. }
  174. platLog(e) {
  175. t.debug && (console.log("moyusdk log:"), console.log(e))
  176. }
  177. destroy() {
  178. this.audio && this.audio.destroy()
  179. }
  180. }
  181. s._instance = null;
  182. class i {
  183. constructor() {
  184. this.zeroTime = 16094304e5, this.timeSpan = 0, this.sending = !1, this.weekNum = 0
  185. }
  186. static get Inst() {
  187. return this._instance || (this._instance = new i), this._instance
  188. }
  189. getNetTime(s) {
  190. if (t.realTime && !this.sending) {
  191. let i = t.getUrl("tool/timestamp");
  192. this.sending = !0, e.Inst.sendGet(i, t => {
  193. if (t) {
  194. let e = t.timestamp;
  195. this.setTimeSpan(e)
  196. }
  197. s && s(), this.sending = !1
  198. })
  199. } else s && s()
  200. }
  201. setTimeSpan(t) {
  202. let e = Number(t),
  203. s = this.getTime();
  204. e && e > 0 && (this.timeSpan = s - e)
  205. }
  206. getTime(t = !1) {
  207. let e = (new Date).getTime() - this.timeSpan;
  208. return e < 999999999999 && (e *= 10), t ? Math.floor(.001 * e) : e
  209. }
  210. getDate(t = 0, e = !0) {
  211. t < 1 && (t = this.getTime());
  212. let s = new Date(Number(t));
  213. return e ? 1e4 * s.getUTCFullYear() + 100 * (s.getUTCMonth() + 1) + s.getUTCDate() : s.getFullYear() + "/" + (s.getMonth() + 1) + "/" + s.getDate()
  214. }
  215. getWeek() {
  216. let t = this.getTime();
  217. return new Date(Number(t)).getDay()
  218. }
  219. getWeekNum() {
  220. let t = this.getTime() - this.zeroTime,
  221. e = Math.ceil(t / 864e5);
  222. return this.weekNum = Math.ceil((e - 3) / 7), this.weekNum % 52
  223. }
  224. }
  225. i._instance = null;
  226. class a {
  227. constructor() {
  228. 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]
  229. }
  230. }
  231. class n {
  232. safe_add(t, e) {
  233. var s = (65535 & t) + (65535 & e);
  234. return (t >> 16) + (e >> 16) + (s >> 16) << 16 | 65535 & s
  235. }
  236. rol(t, e) {
  237. return t << e | t >>> 32 - e
  238. }
  239. cmn(t, e, s, i, a, n) {
  240. return this.safe_add(this.rol(this.safe_add(this.safe_add(e, t), this.safe_add(i, n)), a), s)
  241. }
  242. ff(t, e, s, i, a, n, r) {
  243. return this.cmn(e & s | ~e & i, t, e, a, n, r)
  244. }
  245. gg(t, e, s, i, a, n, r) {
  246. return this.cmn(e & i | s & ~i, t, e, a, n, r)
  247. }
  248. hh(t, e, s, i, a, n, r) {
  249. return this.cmn(e ^ s ^ i, t, e, a, n, r)
  250. }
  251. ii(t, e, s, i, a, n, r) {
  252. return this.cmn(s ^ (e | ~i), t, e, a, n, r)
  253. }
  254. coreMD5(t) {
  255. for (var e = 1732584193, s = -271733879, i = -1732584194, a = 271733878, n = 0; n < t.length; n += 16) {
  256. var r = e,
  257. o = s,
  258. h = i,
  259. d = a;
  260. 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)
  261. }
  262. return [e, s, i, a]
  263. }
  264. binl2hex(t) {
  265. 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);
  266. return e
  267. }
  268. binl2b64(t) {
  269. 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);
  270. return e
  271. }
  272. str2binl(t) {
  273. for (var e = 1 + (t.length + 8 >> 6), s = new Array(16 * e), i = 0; i < 16 * e; i++) s[i] = 0;
  274. for (i = 0; i < t.length; i++) s[i >> 2] |= (255 & t.charCodeAt(i)) << i % 4 * 8;
  275. return s[i >> 2] |= 128 << i % 4 * 8, s[16 * e - 2] = 8 * t.length, s
  276. }
  277. strw2binl(t) {
  278. for (var e = 1 + (t.length + 4 >> 5), s = new Array(16 * e), i = 0; i < 16 * e; i++) s[i] = 0;
  279. for (i = 0; i < t.length; i++) s[i >> 1] |= t.charCodeAt(i) << i % 2 * 16;
  280. return s[i >> 1] |= 128 << i % 2 * 16, s[16 * e - 2] = 16 * t.length, s
  281. }
  282. hexMD5(t) {
  283. return this.binl2hex(this.coreMD5(this.str2binl(t)))
  284. }
  285. hexMD5w(t) {
  286. return this.binl2hex(this.coreMD5(this.strw2binl(t)))
  287. }
  288. b64MD5(t) {
  289. return this.binl2b64(this.coreMD5(this.str2binl(t)))
  290. }
  291. b64MD5w(t) {
  292. return this.binl2b64(this.coreMD5(this.strw2binl(t)))
  293. }
  294. calcMD5(t) {
  295. return this.binl2hex(this.coreMD5(this.str2binl(t)))
  296. }
  297. }
  298. class r {
  299. constructor() {
  300. this.id = "", this.title = "", this.desc = "", this.btnTxt = "", this.icon = "", this.image = ""
  301. }
  302. }
  303. var o, h;
  304. ! function(t) {
  305. t.total = "total", t.month = "month", t.week = "week", t.day = "day"
  306. }(o || (o = {}));
  307. class d {
  308. constructor() {
  309. 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 = ""
  310. }
  311. }! function(t) {
  312. 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"
  313. }(h || (h = {}));
  314. class l {
  315. constructor() {
  316. 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
  317. }
  318. saveData(t) {
  319. let e = {};
  320. for (let t in this) e[t.toString()] = this[t];
  321. localStorage.setItem("moyudata_" + t, JSON.stringify(e))
  322. }
  323. getData(t) {
  324. let e = localStorage.getItem("moyudata_" + t);
  325. if (e) {
  326. let t = JSON.parse(e);
  327. if (t)
  328. for (let e in this) {
  329. let s = t[e.toString()];
  330. null != s && (this[e] = s)
  331. }
  332. }
  333. }
  334. clear(t) {
  335. localStorage.removeItem("moyudata_" + t)
  336. }
  337. }
  338. class p {
  339. constructor() {
  340. 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 = ""
  341. }
  342. static get Inst() {
  343. return null == p._instance && (p._instance = new p), p._instance
  344. }
  345. init(e) {
  346. 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) {
  347. let e = this.getRandStr(15);
  348. this.data.headIcon = t.getTagro("headimg/0.jpg"), this.data.userId = "my" + this.myId + e, this.data.nickName = "pla2yer_" + e, this.data.loginCount = 1, this.data.createTime = this.getTime()
  349. } else this.data.loginCount++;
  350. 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)
  351. }
  352. initFCM(t) {
  353. t && this.moyuUser.age < 18 && this.moyuUser.realCode.length > 1 ? (this.fcmActive = !0, setInterval(() => {
  354. this.data.gameTime > 0 && (this.data.gameTime -= 1, this.saveData())
  355. }, 6e4)) : this.fcmActive = !1
  356. }
  357. setGameTime(s = !1) {
  358. let a = i.Inst.getDate();
  359. if (a > this.data.fcmDate || s) {
  360. if (this.data.fcmDate = a, this.data.age < 18) {
  361. let s = (new Date).getDay();
  362. this.data.gameTime = s > 0 && s < 5 ? 0 : 60;
  363. let i = t.getUrl("tool/holiday");
  364. e.Inst.sendGet(i, t => {
  365. t && 0 == t.code && t.data && 0 != t.data.type && (this.data.gameTime = 60)
  366. })
  367. } else this.data.gameTime = 9999;
  368. this.saveData()
  369. }
  370. }
  371. getRandStr(t) {
  372. 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"],
  373. s = "";
  374. for (let i = 0; i < t; i++) s += e[this.getRandom(0, e.length)];
  375. return s
  376. }
  377. getRandom(t, e) {
  378. var s = e - t,
  379. i = Math.random() * s;
  380. return Math.floor(i) + t
  381. }
  382. saveData() {
  383. this.data && this.data.saveData(this.myId)
  384. }
  385. getRankUser() {
  386. return {
  387. userId: this.moyuUser.userId,
  388. nickName: this.moyuUser.nickName,
  389. headIcon: this.moyuUser.headIcon
  390. }
  391. }
  392. saveSeverData(s, i) {
  393. let a = this.moyuUser.openId;
  394. if (null != i && i.length >= 10 && (a = i), !a || a.length < 10) return void this.platError(11111, "存储错误,检查唯一id");
  395. let n = this.platType < 10 ? "0" + this.platType : this.platType.toString(),
  396. r = {
  397. uid: this.myId + n + "00" + a,
  398. userData: JSON.stringify(s)
  399. },
  400. o = t.getUrl("app-user-data/save");
  401. e.Inst.sendPost(o, r, t => {
  402. t && 0 == t.code ? this.platLog("数据已保存") : this.platError(11112, t)
  403. })
  404. }
  405. getSeverData(s, i) {
  406. let a = this.moyuUser.openId;
  407. if (null != i && i.length >= 10 && (a = i), !a || a.length < 10) return void this.platError(11113, "错误的id");
  408. let n = this.platType < 10 ? "0" + this.platType : this.platType.toString(),
  409. r = this.myId + n + "00" + a,
  410. o = t.getUrl("app-user-data/get", "?uid=" + r);
  411. e.Inst.sendGet(o, t => {
  412. t && 0 == t.code ? s && s(JSON.parse(t.data.userData)) : (this.platLog("未获取到数据", t), s && s(null))
  413. })
  414. }
  415. onVideoDone(t) {
  416. t ? p.Inst.data.adScusNum++ : p.Inst.data.adFailNum++, this.moyuUser.videoCount = [this.data.adScusNum, this.data.adFailNum], this.saveData()
  417. }
  418. onRealName(t, e) {
  419. this.moyuUser.realName = this.data.realName = t, this.moyuUser.realCode = this.data.realCode = e;
  420. let s = i.Inst.getDate(),
  421. a = Number(e.substring(6, 14)),
  422. n = Math.floor((s - a) / 1e4);
  423. this.moyuUser.age = this.data.age = n, this.initFCM(!0), this.setGameTime(!0), this.saveData()
  424. }
  425. clearData() {
  426. this.data && this.data.clear(this.myId)
  427. }
  428. initUser(t, e = 0) {
  429. if (t) {
  430. switch (this.platType) {
  431. case h.tt:
  432. case h.wx:
  433. this.moyuUser.nickName = t.userInfo.nickName, this.moyuUser.headIcon = t.userInfo.avatarUrl, this.setCity(t.userInfo.city), this.moyuUser.gender = t.userInfo.gender;
  434. break;
  435. case h.op:
  436. 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));
  437. break;
  438. case h.vv:
  439. this.moyuUser.nickName = t.nickName, this.moyuUser.headIcon = t.smallAvatar, this.moyuUser.gender = t.gender;
  440. break;
  441. case h.mz:
  442. this.moyuUser.nickName = t.nickname, this.moyuUser.headIcon = t.icon, this.moyuUser.openId = t.uid;
  443. break;
  444. case h.ks:
  445. 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);
  446. break;
  447. case h.xmApk:
  448. "string" == typeof t && (this.moyuUser.nickName = t);
  449. break;
  450. case h.f399:
  451. this.moyuUser.headIcon = t.icon, this.moyuUser.nickName = t.userName, this.moyuUser.openId = t.uId;
  452. break;
  453. default:
  454. console.log("该平台没有用户信息")
  455. }
  456. 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()
  457. }
  458. }
  459. setAge(t) {
  460. null == t ? this.moyuUser.age = 0 : t instanceof String && (this.moyuUser.age = Number(t)), this.moyuUser.age < 0 && (this.moyuUser.age = 0)
  461. }
  462. setCity(t) {
  463. t ? this.moyuUser.city.length < 1 && (this.moyuUser.city = t) : this.moyuUser.city = ""
  464. }
  465. isGameBit(t) {
  466. return 0 == this.gameBit || ((t = Number(t)) & this.gameBit) == t
  467. }
  468. showTip(t) {
  469. this.onTipCall && this.onTipCall(t)
  470. }
  471. platLog(...e) {
  472. if (t.debug) {
  473. console.log("moyusdk log:");
  474. for (const t of e) console.log(t)
  475. }
  476. }
  477. platError(t, e) {
  478. console.error("moyusdk error:" + t), e && console.error(e)
  479. }
  480. onShow(t = !0) {
  481. 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)
  482. }
  483. pauseMusic(t) {
  484. s.Inst.pauseMusic(t)
  485. }
  486. onConnected(t) {
  487. t ? (i.Inst.getNetTime(), this.showTip(20021)) : this.showTip(20022), this.platLog("net changed:", t)
  488. }
  489. getTime() {
  490. return i.Inst.getTime()
  491. }
  492. isNewDay() {
  493. let t = i.Inst.getDate();
  494. return t > this.data.curDate && (this.data.curDate = t, this.saveData(), !0)
  495. }
  496. isNewWeek() {
  497. return i.Inst.getWeekNum(), i.Inst.weekNum > this.data.curWeek && (this.data.curWeek = i.Inst.weekNum, this.saveData(), !0)
  498. }
  499. onBannerHide() {
  500. this.bannerClose || (this.platLog("banner 广告背关闭/隐藏"), this.showTip(20111))
  501. }
  502. onNativeLoad(t) {
  503. if (t) {
  504. let e = t.icon;
  505. this.nativeInfo.id = t.adId, this.nativeInfo.title = t.title, this.nativeInfo.btnTxt = t.clickBtnTxt, this.nativeInfo.desc = t.desc;
  506. let s = t.imgUrlList[0];
  507. s && s.length > 0 && (this.nativeInfo.image = s), e && e.length > 0 && (this.nativeInfo.icon = e)
  508. } else this.nativeInfo.icon = "", this.nativeInfo.image = "";
  509. this.onNativeCall && this.onNativeCall(), this.onNativeCall = null
  510. }
  511. getUserInfo(t) {}
  512. oppoSign(t, e, s, i, a) {
  513. let r = {
  514. appKey: t,
  515. appSecret: e,
  516. pkgName: s,
  517. timeStamp: a,
  518. token: i
  519. },
  520. o = "";
  521. for (const t in r) {
  522. let e = r[t];
  523. o.length > 0 && (o += "&"), o += t + "=" + e
  524. }
  525. return (new n).hexMD5(o).toUpperCase()
  526. }
  527. signMap(t) {
  528. var e = new Array;
  529. return Object.keys(t).sort().map(s => {
  530. e.push(t[s])
  531. }), e.join("")
  532. }
  533. }
  534. p._instance = null;
  535. let u = p.Inst;
  536. class c {
  537. constructor() {
  538. 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
  539. }
  540. init() {
  541. if (!this.sdk) return void u.platError(10001, "Platform super");
  542. this.sdk.onShow && this.sdk.onShow(t => {
  543. u.onShow(!0)
  544. }), this.sdk.onHide && this.sdk.onHide(t => {
  545. u.onShow(!1)
  546. });
  547. let t = null;
  548. this.sdk.getLaunchOptionsSync && (t = this.sdk.getLaunchOptionsSync()), t && (u.platOptions = t), this.subLoader = this.sdk.loadSubpackage
  549. }
  550. initApp(t) {}
  551. initAds() {
  552. if (!this.sdk || !this.sdk.getSystemInfoSync) return;
  553. let e = this.sdk.getSystemInfoSync(),
  554. s = t.bannerW = e.windowWidth;
  555. t.bannerW > 1440 && (t.bannerW = 1440), t.bannerH = s / 6.7
  556. }
  557. initUser(t, e = !1) {
  558. t && t()
  559. }
  560. getOpenId(t) {}
  561. getLocation(t) {
  562. t && t()
  563. }
  564. userAgree(t) {}
  565. onAdMsg(t) {}
  566. onUserInfo(t) {
  567. this.userCall && this.userCall()
  568. }
  569. showMoreGame() {}
  570. createAudio() {
  571. if (this.sdk.createInnerAudioContext) return this.sdk.createInnerAudioContext();
  572. u.platLog("audio is null")
  573. }
  574. setWH() {
  575. let t = this.sdk.getSystemInfoSync && this.sdk.getSystemInfoSync();
  576. t && (u.platWidth = t.screenWidth ? t.screenWidth : 750, u.platHeight = t.screenHeight ? t.screenHeight : 1334)
  577. }
  578. exit() {}
  579. addLnk(t) {
  580. t && t()
  581. }
  582. focus(t) {}
  583. shareGame(t, e, s) {}
  584. recordeGame(t, e) {}
  585. recordPause(t) {}
  586. recordeStart() {}
  587. recordeEnd(t) {
  588. t && t()
  589. }
  590. showBlock(t) {}
  591. showBox() {}
  592. sendDataEvent(t, e) {}
  593. toVideoView(t) {}
  594. vibrate(t) {
  595. this.sdk && (t && this.sdk.vibrateLong ? this.sdk.vibrateLong() : this.sdk.vibrateShort && this.sdk.vibrateShort())
  596. }
  597. showVideoAd(t) {
  598. 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")
  599. }
  600. initVideoAd(t) {
  601. this.voidId(t) || (this.videoId = t, u.videoAd = this.sdk.createRewardedVideoAd({
  602. adUnitId: this.videoId
  603. }), u.videoAd.onError(t => {
  604. 3 != this.videoType && (u.hasAd = !1), u.videoErro = !0, u.platError(10201, t)
  605. }), u.videoAd.onLoad && u.videoAd.onLoad(() => {
  606. u.hasAd = !0, u.videoErro = !1, u.platLog("videoAd onLoad"), 2 == this.videoType && u.videoAd.show()
  607. }), u.videoAd.onClose(t => {
  608. if (u.hasAd = 3 == this.videoType, 2 == this.videoType) setTimeout(() => {
  609. this.adCall && this.adCall(!0), this.adCall = null
  610. }, 500);
  611. else {
  612. let e = !1;
  613. (t && t.isEnded || void 0 === t) && (e = !0), this.adCall && this.adCall(e), this.adCall = null, 1 == this.videoType && u.videoAd.load()
  614. }
  615. }), 1 == this.videoType && u.videoAd.load(), u.platLog("videoAd inited"))
  616. }
  617. showBannerAd(t) {
  618. u.bannerAd ? t ? u.bannerAd.show() : u.bannerAd.hide() : this.voidId(this.bannerId) || u.platLog("bannerAd is null")
  619. }
  620. initBannerAd(e, s = 30) {
  621. if (this.voidId(e)) return;
  622. this.bannerId = e;
  623. let i = this.sdk.getSystemInfoSync(),
  624. a = i.windowHeight,
  625. n = i.windowHeight,
  626. r = {};
  627. r = 1 == this.bannerType ? {
  628. adUnitId: this.bannerId,
  629. style: {
  630. left: a / 2 - t.bannerW / 2,
  631. top: n - t.bannerH,
  632. width: t.bannerW,
  633. height: t.bannerH
  634. }
  635. } : {
  636. adUnitId: this.bannerId,
  637. adIntervals: s,
  638. style: {
  639. left: a / 2 - t.bannerW / 2,
  640. top: n - t.bannerH
  641. }
  642. }, u.bannerAd = this.sdk.createBannerAd(r), u.bannerAd.onError(t => {
  643. u.platError(10211, t)
  644. }), u.bannerAd.onLoad(() => {
  645. this.setBannerPos(), u.bannerShow ? 0 == this.bannerType && u.bannerAd.show() : u.bannerAd.hide()
  646. }), u.bannerAd.onClose && u.bannerAd.onClose(function() {
  647. u.onBannerHide()
  648. }), u.bannerAd.onHide && u.bannerAd.onHide(function() {
  649. u.onBannerHide()
  650. }), u.platLog("BannerAd inited")
  651. }
  652. setBannerPos() {
  653. if (!u.bannerAd || !u.bannerAd.style) return void u.platLog("banner or style is null");
  654. let e = this.sdk.getSystemInfoSync(),
  655. s = e.windowWidth,
  656. i = e.windowHeight,
  657. a = u.bannerAd.style,
  658. n = t.bannerPy * i;
  659. 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
  660. }
  661. initInsertAd(t) {
  662. this.voidId(t) || (this.insertId = t, u.insertAd = this.sdk.createInterstitialAd({
  663. adUnitId: this.insertId
  664. }), u.insertAd && (u.insertAd.onError(t => {
  665. u.platError(10221, t)
  666. }), u.insertAd.onLoad && u.insertAd.onLoad(() => {
  667. 1 == this.insertType && u.insertAd.show()
  668. }), u.platLog("InsertAd inited")))
  669. }
  670. showInsertAd(t) {
  671. u.insertAd ? 0 == this.insertType ? u.insertAd.show() : 1 == this.insertType ? u.insertAd.load() : 2 == this.insertType && u.insertAd.show().catch(t => {
  672. u.platError(10221, t)
  673. }) : this.voidId(this.insertId) || u.platLog("InsertAd is null")
  674. }
  675. initCustomAd(t, e, s, i) {
  676. if (this.voidId(t)) return;
  677. let a = this.customAd[t];
  678. a && (a.destroy(), this.customAd[t] = null), i < 30 && (i = 30), (e > 1 || s > 1) && u.platLog("CustomAd位置不合理");
  679. let n = this.sdk.getSystemInfoSync(),
  680. r = n.screenWidth * e,
  681. o = n.screenHeight * s,
  682. h = this.sdk.createCustomAd({
  683. adUnitId: t,
  684. adIntervals: i,
  685. style: {
  686. left: r,
  687. top: o
  688. }
  689. });
  690. h.onError(t => {
  691. u.platError(10241, t)
  692. }), h.onLoad(() => {
  693. u.platLog(t + "CustomAd onload")
  694. }), this.customAd[t] = h
  695. }
  696. showCustomAd(t, e) {
  697. let s = this.customAd[t];
  698. s ? e ? s.show() : s.hide() : this.voidId(t) || u.platLog("CustomAd is null")
  699. }
  700. reportNative(t) {
  701. if (!u.nativeAd) return;
  702. let e = u.nativeInfo.id;
  703. u.platLog("reportNative:" + t, e), !e || e.length < 1 || (1 == t ? u.nativeAd.reportAdShow({
  704. adId: e
  705. }) : u.nativeAd.reportAdClick({
  706. adId: e
  707. }))
  708. }
  709. getNativeAd(t) {
  710. u.onNativeCall = t, u.nativeAd ? u.nativeAd.load() : this.setNative()
  711. }
  712. setNative(t = !1) {
  713. if (this.nativeId.length < 2) return;
  714. let e = this.nativeId.split(",");
  715. this.nativeIdx < 0 ? this.nativeIdx = u.getRandom(0, e.length) : (this.nativeIdx++, this.nativeIdx >= e.length && (this.nativeIdx = 0));
  716. let s = e[this.nativeIdx];
  717. t ? setTimeout(() => {
  718. this.initNative(s)
  719. }, 5e3) : this.initNative(s)
  720. }
  721. initNative(t) {
  722. this.voidId(t) || (u.nativeAd && u.nativeAd.destroy(), u.nativeAd = this.sdk.createNativeAd({
  723. adUnitId: t
  724. }), u.nativeAd && (u.nativeAd.onError(t => {
  725. this.setNative(!0), u.onNativeLoad(null), u.platError(10231, t)
  726. }), u.nativeAd.onLoad(function(t) {
  727. let e = t.adList.pop();
  728. u.platLog("native onload"), u.onNativeLoad(e), u.nativeAd.reportAdShow({
  729. adId: u.nativeInfo.id
  730. })
  731. }), u.nativeAd.load()))
  732. }
  733. voidId(t) {
  734. return null == t || t.length < 2
  735. }
  736. }
  737. class g extends c {
  738. constructor() {
  739. super(...arguments), this.recordStop = !0, this.appOptions = [{
  740. appId: "tt7c920a2fe3a914da",
  741. query: "k=v",
  742. extraData: {}
  743. }, {
  744. appId: "tt84e2f25f1bda296b",
  745. query: "k=v",
  746. extraData: {}
  747. }], this.url1 = "/gate.snssdk.c", this.url2 = "ht"
  748. }
  749. init() {
  750. if (this.sdk = window.tt, this.sdk) {
  751. this.subLoader = this.sdk.loadSubpackage;
  752. var e = this.sdk.getLaunchOptionsSync();
  753. e && (p.Inst.platOptions = e), this.sdk.login({
  754. success(e) {
  755. p.Inst.platCode = e.code, window.tt.onTouchEnd(() => {
  756. t.realName || window.tt.authenticateRealName({
  757. complete() {
  758. p.Inst.platLog("实名认证"), t.realName = !0
  759. }
  760. })
  761. })
  762. },
  763. fail(t) {
  764. p.Inst.platError(10011, t)
  765. }
  766. }), this.sdk.getSystemInfo({
  767. success(t) {
  768. p.Inst.platName = t.appName, "Douyin" != t.appName && "douyin_lite" != t.appName || (p.Inst.isDouyin = !0)
  769. }
  770. }), this.initRecoder(), this.sdk.checkShortcut && this.sdk.checkShortcut({
  771. success: function(t) {
  772. p.Inst.hasShortCut = t.status.exist
  773. },
  774. fail: function(t) {
  775. p.Inst.platLog("Shortcut失败", t), p.Inst.hasShortCut = !0
  776. }
  777. }), this.sdk.onShareAppMessage(e => {
  778. const s = {
  779. title: t.shareTitle,
  780. imageUrl: t.shareImg,
  781. extra: {},
  782. query: t.shareQuery,
  783. success(t) {
  784. p.Inst.platLog("分享成功", t)
  785. },
  786. fail(t) {
  787. p.Inst.platLog("分享失败", t), p.Inst.showTip(20301)
  788. }
  789. },
  790. i = Object.assign({
  791. channel: e.channel
  792. }, s);
  793. return i.extra = {
  794. withVideoId: !0,
  795. videoTopics: t.shareTag,
  796. hashtag_list: t.shareTag,
  797. videoTag: p.Inst.getTime()
  798. }, i
  799. }), super.init()
  800. } else p.Inst.platError(10001)
  801. }
  802. initAds() {
  803. this.sdk && (this.videoType = 3, p.Inst.hasAd = !0, this.initVideoAd(t.ttVideoId), this.initBannerAd(t.ttBannerId), this.initInsertAd(t.ttInsertId))
  804. }
  805. getLocation(t) {
  806. this.sdk && this.sdk.getLocation({
  807. success(e) {
  808. t && t(e)
  809. },
  810. fail(t) {
  811. p.Inst.platLog("getLocation失败", t)
  812. }
  813. })
  814. }
  815. showMoreGame() {
  816. "ios" !== this.sdk.getSystemInfoSync().platform ? this.sdk.showMoreGamesModal({
  817. appLaunchOptions: this.appOptions,
  818. success(t) {
  819. p.Inst.platLog("success", t.errMsg)
  820. },
  821. fail(t) {
  822. p.Inst.platLog("fail", t.errMsg)
  823. }
  824. }) : this.sdk.showToast({
  825. title: " iOS不支持"
  826. })
  827. }
  828. getOpenId() {}
  829. initUser(t, e) {
  830. this.sdk ? (this.sdk.getSetting({
  831. success: s => {
  832. let i = s.authSetting["scope.userInfo"];
  833. void 0 === i ? this.getUserInfo(t) : i ? this.getUserInfo(t) : e ? this.sdk.openSetting({
  834. success: e => {
  835. e.authSetting["scope.userInfo"] ? this.getUserInfo(t) : t()
  836. },
  837. fail: e => {
  838. p.Inst.platLog("openSetting 失败", e), t()
  839. }
  840. }) : t()
  841. },
  842. fail: e => {
  843. p.Inst.platLog("getSetting 失败", e), t()
  844. }
  845. }), p.Inst.moyuUser.openId.length < 1 && p.Inst.appSecret.length > 0 && this.getOpenId()) : t && t()
  846. }
  847. getUserInfo(t) {
  848. this.sdk.getUserInfo({
  849. success: e => {
  850. p.Inst.initUser(e), t(!0)
  851. },
  852. fail: e => {
  853. p.Inst.platLog("getUserInfo 失败", e), t()
  854. }
  855. })
  856. }
  857. recordeGame(t, e) {
  858. "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({
  859. duration: t,
  860. isMarkOpen: !0,
  861. locLeft: 0,
  862. locTop: 0,
  863. frameRate: 30
  864. })) : p.Inst.platError(10401, "recorder is null"))
  865. }
  866. recordPause(t) {
  867. "devtools" != p.Inst.platName && this.recorder && (t ? this.recorder.pause() : this.recorder.resume())
  868. }
  869. recordeEnd(t) {
  870. p.Inst.onRecordCall = t, this.recorder && this.recorder.stop()
  871. }
  872. addLnk(t) {
  873. this.sdk ? this.sdk.addShortcut({
  874. success: function(e) {
  875. p.Inst.hasShortCut = !0, t && t()
  876. },
  877. fail: function(t) {
  878. p.Inst.hasShortCut = !1
  879. }
  880. }) : t && t(!0)
  881. }
  882. focus(t) {
  883. this.sdk.openAwemeUserProfile(), t && t(!0)
  884. }
  885. shareGame(e, s, i) {
  886. 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({
  887. channel: "video",
  888. title: t.shareTitle,
  889. desc: t.shareTitle + "-视频分享",
  890. imageUrl: s,
  891. templateId: t.shareId,
  892. query: i,
  893. extra: {
  894. videoPath: p.Inst.shareMp4,
  895. videoTag: t.shareTitle,
  896. videoTopics: t.shareTag,
  897. hashtag_list: t.shareTag,
  898. video_title: t.shareTitle
  899. },
  900. success(t) {
  901. p.Inst.platLog("分享视频成功", t), e(!0)
  902. },
  903. fail(t) {
  904. p.Inst.platLog("分享视频失败", t), p.Inst.showTip(20301), e(!1)
  905. }
  906. })) : (p.Inst.platLog("普通分享"), this.sdk.shareAppMessage({
  907. templateId: "",
  908. title: t.shareTitle,
  909. desc: t.shareTitle + "-分享",
  910. imageUrl: s,
  911. query: i,
  912. success() {
  913. p.Inst.platLog("分享成功"), e(!0)
  914. },
  915. fail(t) {
  916. p.Inst.platLog("分享失败"), p.Inst.showTip(20301)
  917. }
  918. })))
  919. }
  920. initRecoder() {
  921. this.sdk.getSystemInfo({
  922. success: t => {
  923. this.recorder = this.sdk.getGameRecorderManager(), this.recorder.onStart(t => {
  924. p.Inst.platLog("record start"), this.recordStop = !1
  925. }), this.recorder.onStop(t => {
  926. 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({
  927. path: t.videoPath,
  928. timeRange: [this.recordTime, 0],
  929. success(t) {
  930. p.Inst.platLog("clipVideo:" + t.videoPath), p.Inst.shareMp4 = t.videoPath, p.Inst.onRecordCall && p.Inst.onRecordCall()
  931. },
  932. fail(t) {
  933. p.Inst.platLog("裁剪出错,使用未裁剪视频", t), p.Inst.onRecordCall && p.Inst.onRecordCall()
  934. }
  935. }) : p.Inst.onRecordCall && p.Inst.onRecordCall())
  936. })
  937. },
  938. fail(t) {
  939. p.Inst.platLog("record fail", t)
  940. }
  941. })
  942. }
  943. getVideoList(t, e, s) {
  944. if (!this.sdk) return;
  945. let i = () => {
  946. this.sdk.request({
  947. url: this.url2 + "tps:/" + this.url1 + "om/developer/api/get_top_video_ids_by_like",
  948. method: "POST",
  949. data: {
  950. app_id: t,
  951. number_of_top: 100,
  952. tag: "",
  953. access_token: p.Inst.token,
  954. rank_type: "month"
  955. },
  956. success: t => {
  957. p.Inst.platLog("视频获取成功"), s && s(t)
  958. },
  959. fail: t => {
  960. p.Inst.platLog("视频获取失败", t)
  961. }
  962. })
  963. };
  964. p.Inst.token.length < 1 ? this.getToken(t, e, () => {
  965. i()
  966. }) : i()
  967. }
  968. getToken(t, e, s) {}
  969. toVideoView(t) {
  970. t.length < 2 || this.sdk.navigateToVideoView({
  971. videoId: t,
  972. success: t => {},
  973. fail: t => {
  974. p.Inst.platLog("toVideoView fail:", t), 1006 === t.errCode && this.sdk.showToast({
  975. title: "something wrong with your network"
  976. })
  977. }
  978. })
  979. }
  980. }
  981. class m extends c {
  982. init() {
  983. this.sdk || (this.sdk = window.qg), this.sdk ? (this.subLoader = this.sdk.loadSubpackage, this.sdk.getLaunchOptionsSync().referrerInfo, this.sdk.hasShortcutInstalled({
  984. success: function(t) {
  985. 0 == t && (p.Inst.hasShortCut = !1)
  986. },
  987. fail: function(t) {
  988. p.Inst.hasShortCut = !1, p.Inst.platLog("ShortCut出错", t)
  989. }
  990. }), super.init()) : p.Inst.platError(10001)
  991. }
  992. initAds() {
  993. this.videoType = 1, this.insertType = 1, t.bannerW = 900, t.bannerH = 300, this.initVideoAd(t.opVideoId), this.initBannerAd(t.opBannerId), this.nativeId = t.opNativeId
  994. }
  995. initBannerAd(e, s = 30) {
  996. super.initBannerAd(e, s), p.Inst.bannerAd && p.Inst.bannerAd.bannerAd.onResize(e => {
  997. t.bannerH = e.height, t.bannerW = e.width, this.setBannerPos()
  998. })
  999. }
  1000. addLnk(t) {
  1001. this.sdk && this.sdk.installShortcut({
  1002. success: function() {
  1003. p.Inst.platLog("ShortCut成功"), p.Inst.hasShortCut = !0, t && t()
  1004. },
  1005. fail: function(t) {
  1006. p.Inst.platError(10301, t)
  1007. }
  1008. })
  1009. }
  1010. initUser(t) {
  1011. this.sdk.login({
  1012. success: function(e) {
  1013. p.Inst.platCode = e.data.token, p.Inst.appSecret.length > 1 ? p.Inst.getUserInfo(t) : (p.Inst.initUser(e.data), t && t(!0))
  1014. },
  1015. fail: function(t) {
  1016. p.Inst.platError(10011, t)
  1017. }
  1018. })
  1019. }
  1020. }
  1021. let I = p.Inst;
  1022. class f extends c {
  1023. init() {
  1024. this.sdk || (this.sdk = window.qg), this.sdk ? (this.subLoader = this.sdk.loadSubpackage, this.sdk.hasShortcutInstalled({
  1025. success: function(t) {
  1026. I.hasShortCut = !!t
  1027. }
  1028. }), super.init()) : I.platError(10001)
  1029. }
  1030. initAds() {
  1031. super.initAds(), this.insertId = t.vvInsertId, this.initVideoAd(t.vvVideoId), this.initBannerAd(t.vvBannerId), this.nativeId = t.vvNativeId
  1032. }
  1033. initUser(t) {
  1034. this.sdk && this.sdk.getSystemInfoSync().platformVersionCode >= 1063 && this.sdk.getUserInfo().then(e => {
  1035. e.data && (I.initUser(e.data), t(!0))
  1036. }, e => {
  1037. I.platLog("userinfo失败", e), t(!1)
  1038. })
  1039. }
  1040. addLnk(t) {
  1041. this.sdk && this.sdk.installShortcut({
  1042. success: function() {
  1043. I.platLog("ShortCut成功"), I.hasShortCut = !0, t && t()
  1044. },
  1045. fail: function(t) {
  1046. I.platError(10301, t), I.hasShortCut = !1
  1047. }
  1048. })
  1049. }
  1050. initBannerAd(t, e = 30) {
  1051. this.bannerId = t, this.bannerId.length < 2 || (I.bannerAd = this.sdk.createBannerAd({
  1052. posId: this.bannerId,
  1053. adIntervals: e,
  1054. style: {}
  1055. }), I.bannerAd.onError(t => {
  1056. I.platError(10211, t)
  1057. }), I.bannerAd.onLoad(() => {
  1058. I.bannerShow ? I.bannerAd.show() : I.bannerAd.hide()
  1059. }), I.bannerAd.onClose(function() {
  1060. I.onBannerHide()
  1061. }))
  1062. }
  1063. initInsertAd() {
  1064. this.insertId.length < 1 || (I.insertAd = this.sdk.createInterstitialAd({
  1065. posId: this.insertId
  1066. }), I.insertAd && (I.insertAd.onError(t => {
  1067. I.platError(10221, t)
  1068. }), I.insertAd.onLoad(() => {
  1069. I.insertAd.show()
  1070. }), I.insertAd.onClose(() => {
  1071. I.insertAd = null
  1072. }), I.insertAd.load()))
  1073. }
  1074. showInsertAd() {
  1075. I.insertAd ? I.insertAd.load() : this.initInsertAd()
  1076. }
  1077. }
  1078. class y {
  1079. static get Inst() {
  1080. return null == y._instance && (y._instance = new y), y._instance
  1081. }
  1082. init(s, i) {
  1083. let a = p.Inst.platVersion % 2,
  1084. n = {
  1085. appKey: p.Inst.myId,
  1086. platform: s,
  1087. settingIndex: a
  1088. },
  1089. r = e.Inst.codeMsg(p.Inst.myKey, n),
  1090. o = t.getUrl("app/setting-get-new?", r);
  1091. e.Inst.sendGet(o, e => {
  1092. let s = p.Inst;
  1093. if (e && 0 == e.code && e.data) {
  1094. let i = JSON.parse(e.data.settingData),
  1095. a = JSON.parse(e.data.testData),
  1096. n = JSON.parse(e.data.onlineData),
  1097. r = null == i.status ? e.data.status : i.status;
  1098. 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)
  1099. for (let t in i.config) s.gameConfig[t] = i.config[t];
  1100. (!s.gameConfig || s.gameConfig.length < 1) && (s.gameConfig = null), s.setCity(e.data.cityName), t.init(i.ads)
  1101. } else e && s.platError(10010, e);
  1102. i && i()
  1103. })
  1104. }
  1105. }
  1106. y._instance = null;
  1107. class k extends c {
  1108. constructor() {
  1109. super(...arguments), this.shared = !1, this.shareTime = 0
  1110. }
  1111. init() {
  1112. if (this.sdk = window.wx, !this.sdk) return void p.Inst.platError(10001);
  1113. this.insertType = 2, this.subLoader = this.sdk.loadSubpackage, this.sdk.showShareMenu({
  1114. withShareTicket: !0,
  1115. menus: ["shareAppMessage", "shareTimeline"]
  1116. }), this.sdk.onShow(t => {
  1117. p.Inst.onShow(!0), this.onShare()
  1118. }), this.sdk.onHide(t => {
  1119. p.Inst.onShow(!1)
  1120. });
  1121. let t = null;
  1122. this.sdk.getLaunchOptionsSync && (t = this.sdk.getLaunchOptionsSync()), t && (p.Inst.platOptions = t)
  1123. }
  1124. initAds() {
  1125. this.initVideoAd(t.wxVideoId), this.initBannerAd(t.wxBannerId), this.initInsertAd(t.wxInsertId)
  1126. }
  1127. initUser(t, e) {
  1128. this.sdk ? (this.sdk.login({
  1129. success(t) {
  1130. p.Inst.platCode = t.code
  1131. },
  1132. fail(t) {
  1133. p.Inst.platError(10011, t)
  1134. }
  1135. }), this.sdk.getSetting({
  1136. success: s => {
  1137. let i = s.authSetting["scope.userInfo"];
  1138. void 0 === i ? (p.Inst.platLog("微信授权请使用createWXUserBtn"), t()) : i ? this.getUserInfo(t) : e ? (p.Inst.platLog("授权设置请求"), this.sdk.openSetting({
  1139. success: e => {
  1140. e.authSetting["scope.userInfo"] ? this.getUserInfo(t) : t()
  1141. },
  1142. fail: e => {
  1143. p.Inst.platLog("openSetting 失败", e), t()
  1144. }
  1145. })) : t()
  1146. },
  1147. fail: e => {
  1148. p.Inst.platLog("getSetting 失败", e), t()
  1149. }
  1150. }), p.Inst.moyuUser.openId.length < 1 && p.Inst.appSecret.length > 0 && this.getOpenId()) : t && t()
  1151. }
  1152. getUserInfo(t) {
  1153. this.sdk.getUserInfo({
  1154. success: e => {
  1155. p.Inst.initUser(e), t(!0)
  1156. },
  1157. fail: e => {
  1158. p.Inst.platLog("getUserInfo 失败", e), t()
  1159. }
  1160. })
  1161. }
  1162. getOpenId() {}
  1163. onShare() {
  1164. this.shared || (this.shared = !0, this.shareCall && (p.Inst.getTime() - this.shareTime < 3100 ? this.shareCall(!1) : this.shareCall(!0)))
  1165. }
  1166. shareGame(e, s, i) {
  1167. 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({
  1168. title: t.shareTitle,
  1169. imageUrl: s,
  1170. query: i,
  1171. imageUrlId: t.shareId
  1172. })) : e && e()
  1173. }
  1174. }
  1175. class v {
  1176. constructor() {
  1177. this.appid = 100, this.isMask = !1, this.isLegal = !0, this.imgId = "", this.waitTime = 60
  1178. }
  1179. static get Inst() {
  1180. return this.instance || (this.instance = new v), this.instance
  1181. }
  1182. init(t) {
  1183. this.appid = t;
  1184. let e = location.href.lastIndexOf("=");
  1185. e < 0 || (this.imgId = location.href.substring(e + 1, location.href.length), !this.imgId || this.imgId.length < 1 || this.getData(() => {
  1186. this.isLegal || this.isMask || this.imgId.length < 1 || this.waitTime < 1 || setTimeout(() => {
  1187. this.waitTime > 0 && this.createInfo()
  1188. }, 1e3 * this.waitTime)
  1189. }))
  1190. }
  1191. createInfo() {
  1192. let e = new Image;
  1193. e.src = t.getTagro("issuer/" + this.imgId + ".jpg"), e.style.position = "absolute", e.style.zIndex = "999";
  1194. let s = document.body.clientWidth,
  1195. i = document.body.clientHeight,
  1196. a = i > 500 ? 500 : i,
  1197. n = .6 * a;
  1198. 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 = (() => {
  1199. var r = new Image;
  1200. 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 => {
  1201. e.hidden = !0, r.hidden = !0
  1202. })
  1203. })
  1204. }
  1205. getData(s) {
  1206. let i = e.Inst.codeMsg("bc48cbce46946057", {
  1207. appKey: 100,
  1208. platform: "web",
  1209. settingIndex: 0
  1210. }),
  1211. a = t.getUrl("app/setting-get-new?", i);
  1212. e.Inst.sendGet(a, t => {
  1213. if (t && 0 == t.code && t.data) {
  1214. let e = JSON.parse(t.data.settingData),
  1215. s = !t.data.security.status;
  1216. if (this.isLegal = e.legals.indexOf(this.appid) >= 0, this.isMask = s && e.masks.indexOf(this.appid) >= 0, this.waitTime = e.time, e.apps) {
  1217. let t = "app" + this.appid,
  1218. s = e.apps[t];
  1219. if (s && s.length > 1) {
  1220. this.waitTime = s[0];
  1221. let t = e[s[1]];
  1222. t && t.indexOf(this.imgId) < 0 && (this.imgId = "")
  1223. } else e.imgs ? e.imgs.indexOf(this.imgId) < 0 && (this.imgId = "") : this.imgId = ""
  1224. }
  1225. }
  1226. s && s()
  1227. })
  1228. }
  1229. destroy() {
  1230. this.waitTime = 0
  1231. }
  1232. }
  1233. class A extends c {
  1234. constructor() {
  1235. super(...arguments), this.shared = !1, this.shareTime = 0
  1236. }
  1237. init() {
  1238. if (this.sdk = window.qq, this.sdk) {
  1239. if (this.subLoader = this.sdk.loadSubpackage, this.sdk.onShow(t => {
  1240. p.Inst.onShow(!0), this.onShare()
  1241. }), this.sdk.onHide(t => {
  1242. p.Inst.onShow(!1)
  1243. }), this.sdk.getLaunchOptionsSync) {
  1244. let t = this.sdk.getLaunchOptionsSync();
  1245. p.Inst.platOptions = t
  1246. }
  1247. this.sdk.showShareMenu({
  1248. withShareTicket: !0,
  1249. menus: ["shareAppMessage", "shareTimeline"]
  1250. }), this.sdk.onShareAppMessage(() => ({
  1251. title: t.shareTitle,
  1252. imageUrl: t.shareImg
  1253. }))
  1254. } else p.Inst.platError(10001)
  1255. }
  1256. initAds() {
  1257. 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)
  1258. }
  1259. initUser(t, e) {
  1260. this.sdk.login({
  1261. success(t) {
  1262. p.Inst.platCode = t.code
  1263. },
  1264. fail(t) {
  1265. p.Inst.platError(10011, t)
  1266. }
  1267. }), this.sdk.getSetting({
  1268. success: s => {
  1269. let i = s.authSetting["scope.userInfo"];
  1270. void 0 === i ? this.getUserInfo(t) : i ? this.getUserInfo(t) : e ? this.sdk.openSetting({
  1271. success: e => {
  1272. e.authSetting["scope.userInfo"] ? this.getUserInfo(t) : t()
  1273. },
  1274. fail: e => {
  1275. p.Inst.platLog("openSetting 失败", e), t()
  1276. }
  1277. }) : t()
  1278. },
  1279. fail: e => {
  1280. p.Inst.platLog("getSetting 失败", e), t()
  1281. }
  1282. }), p.Inst.moyuUser.openId.length < 1 && p.Inst.appSecret.length > 0 && this.getOpenId()
  1283. }
  1284. getUserInfo(t) {
  1285. this.sdk.getUserInfo({
  1286. success: e => {
  1287. p.Inst.initUser(e), t(!0)
  1288. },
  1289. fail: e => {
  1290. p.Inst.platLog("getUserInfo 失败", e), t()
  1291. }
  1292. })
  1293. }
  1294. getOpenId() {}
  1295. onShare() {
  1296. this.shared || (this.shared = !0, this.shareCall && (p.Inst.getTime() - this.shareTime < 3100 ? this.shareCall(!1) : this.shareCall(!0)))
  1297. }
  1298. shareGame(e, s, i) {
  1299. 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({
  1300. title: t.shareTitle,
  1301. imageUrl: s,
  1302. query: i
  1303. })) : e && e()
  1304. }
  1305. initBox() {
  1306. this.boxId.length < 1 || (p.Inst.boxAd = this.sdk.createAppBox({
  1307. adUnitId: this.boxId
  1308. }), p.Inst.boxAd && p.Inst.boxAd.load())
  1309. }
  1310. initBlock() {
  1311. if (this.blockId.length < 1) return;
  1312. let t = this.sdk.getSystemInfoSync(),
  1313. e = (t.windowWidth, t.windowHeight);
  1314. if (this.sdk.createBlockAd) {
  1315. if (p.Inst.blockAd = this.sdk.createBlockAd({
  1316. size: 5,
  1317. adUnitId: this.blockId,
  1318. orientation: "landscape",
  1319. style: {
  1320. left: 12,
  1321. top: e - 100
  1322. }
  1323. }), !p.Inst.blockAd || !p.Inst.blockAd.onError) return p.Inst.platLog("blockAd is null"), void(p.Inst.blockAd = null);
  1324. p.Inst.blockAd.onError(t => {
  1325. p.Inst.platError(10241, t)
  1326. }), p.Inst.blockAd.onLoad(() => {
  1327. p.Inst.platLog("blockAd onLoad show"), p.Inst.blockAd.show()
  1328. })
  1329. }
  1330. }
  1331. showBox() {
  1332. p.Inst.boxAd && p.Inst.boxAd.show()
  1333. }
  1334. showBlock(t) {
  1335. p.Inst.blockAd && (p.Inst.blockAd.hide(), p.Inst.blockAd.destroy(), p.Inst.blockAd = null), t && this.initBlock()
  1336. }
  1337. createCash(t, e) {}
  1338. }
  1339. class w extends c {
  1340. constructor() {
  1341. super(...arguments), this.recordDelta = 0, this.recordloop = !1
  1342. }
  1343. init() {
  1344. this.sdk = window.ks, this.sdk ? (this.subLoader = this.sdk.loadSubpackage, this.initRecoder(), this.sdk.login({
  1345. success(t) {},
  1346. fail(t) {
  1347. p.Inst.platLog("ks login fail", t)
  1348. }
  1349. }), this.sdk.getAPKShortcutInstallStatus(t => {
  1350. -10005 === t.code ? p.Inst.platLog("当前环境不支持") : 1 === t.code && (t.installed || (p.Inst.hasShortCut = !1))
  1351. }), super.init()) : p.Inst.platError(10001)
  1352. }
  1353. addLnk(t) {
  1354. this.sdk.saveAPKShortcut(e => {
  1355. -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))
  1356. })
  1357. }
  1358. focus(t) {
  1359. this.sdk.openUserProfile({
  1360. accountType: "MiniGameOfficialAccount",
  1361. callback: e => {
  1362. 1 == e.errorCode ? p.Inst.canFocus = !1 : p.Inst.platLog("关注失败", e), t && t(1 == e.errorCode)
  1363. }
  1364. })
  1365. }
  1366. initUser(t) {
  1367. this.sdk.getSetting({
  1368. success: e => {
  1369. let s = e["scope.userInfo"];
  1370. void 0 === s ? this.sdk.authorize({
  1371. scope: "scope.userInfo",
  1372. success: e => {
  1373. this.getUserInfo(t)
  1374. },
  1375. fail: e => {
  1376. p.Inst.platLog("userinfo失败: ", e), t && t()
  1377. }
  1378. }) : s && this.getUserInfo(t)
  1379. },
  1380. fail: e => {
  1381. p.Inst.platLog("getSetting 失败", e), t && t()
  1382. }
  1383. })
  1384. }
  1385. getUserInfo(t) {
  1386. this.sdk.getUserInfo({
  1387. success: e => {
  1388. p.Inst.initUser(e), t(!0)
  1389. },
  1390. fail: e => {
  1391. p.Inst.platLog("getUserInfo 失败", e), t()
  1392. }
  1393. })
  1394. }
  1395. initAds() {
  1396. this.videoType = 3, p.Inst.hasAd = !0, this.initVideoAd(t.ksVideoId), this.initInsertAd(t.ksInsertId)
  1397. }
  1398. recordeGame(t, e) {
  1399. "devtools" != p.Inst.platName && (p.Inst.shareMp4 = "", this.recordloop = !1, this.recorder && this.recorder.abort(), this.doRecord())
  1400. }
  1401. recordPause(t) {
  1402. "devtools" != p.Inst.platName && this.recorder && (t ? this.recorder.pause() : this.recorder.resume())
  1403. }
  1404. doRecord() {
  1405. this.recorder ? (this.recordDelta = p.Inst.getTime(), p.Inst.platLog("recordeGame", this.recordDelta), this.recorder.start()) : p.Inst.platError(10401, "recorder is null")
  1406. }
  1407. recordeEnd(t) {
  1408. 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());
  1409. this.recordloop = !1, this.recordDelta = 0, this.recorder && this.recorder.stop()
  1410. }
  1411. shareGame(e, s) {
  1412. null == s && (s = t.shareQuery), p.Inst.shareMp4 && this.recorder ? (p.Inst.platLog("视频分享"), this.recorder.publishVideo({
  1413. video: p.Inst.shareMp4,
  1414. mouldId: t.shareId,
  1415. query: s,
  1416. callback: t => {
  1417. if (null != t && null != t) return p.Inst.platLog("分享失败: ", JSON.stringify(t)), void e();
  1418. p.Inst.platLog("分享成功"), e && e(!0)
  1419. }
  1420. })) : p.Inst.platLog("无法分享:", p.Inst.shareMp4)
  1421. }
  1422. initRecoder() {
  1423. this.recorder = this.sdk.getGameRecorder(), this.recorder.on("start", () => {}), this.recorder.on("error", t => {
  1424. p.Inst.platLog("recorder error", t)
  1425. }), this.recorder.on("stop", t => {
  1426. t && t.videoID ? (p.Inst.platLog("record stop", t.videoID), p.Inst.shareMp4 = t.videoID, this.recordCall && this.recordCall(), this.recordloop && setTimeout(() => {
  1427. this.doRecord()
  1428. }, 1e3)) : p.Inst.platLog("录制失败")
  1429. })
  1430. }
  1431. }
  1432. class T extends c {
  1433. init() {
  1434. this.sdk = window.qg, this.sdk ? super.init() : p.Inst.platError(10001)
  1435. }
  1436. initAds() {
  1437. 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))
  1438. }
  1439. initUser(t) {
  1440. this.sdk.login({
  1441. success: e => {
  1442. p.Inst.initUser(e), t(!0)
  1443. },
  1444. fail: e => {
  1445. p.Inst.platLog("mz授权失败", e), t()
  1446. }
  1447. })
  1448. }
  1449. }
  1450. class b extends c {
  1451. init() {
  1452. this.sdk = window.qg, this.sdk ? super.init() : p.Inst.platError(10001)
  1453. }
  1454. initAds() {
  1455. this.videoType = 1, this.insertType = 1, this.initVideoAd(t.hwVideoId), this.initBannerAd(t.hwBannerId), this.initInsertAd(t.hwInsertId)
  1456. }
  1457. }
  1458. class S extends c {
  1459. constructor() {
  1460. super(...arguments), this.adNum = 1, this.canAd = !0
  1461. }
  1462. init() {
  1463. this.sdk = window.h5api, this.sdk || p.Inst.platError(10001)
  1464. }
  1465. shareGame(t) {
  1466. this.sdk.share(), t && t()
  1467. }
  1468. showMoreGame() {
  1469. this.sdk.showRecommend()
  1470. }
  1471. showVideoAd(t) {
  1472. this.adCall = t, this.sdk.canPlayAd(t => {
  1473. this.canAd = t.canPlayAd, this.adNum = t.remain, p.Inst.showTip(20200 + this.adNum), this.adNum > 0 || this.canAd ? this.sdk.playAd(t => {
  1474. 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))
  1475. }) : this.adNum < 1 && (this.adCall && this.adCall(!0), this.adCall = null)
  1476. })
  1477. }
  1478. }
  1479. class L extends c {
  1480. init() {
  1481. let t = window.conchConfig;
  1482. if (null == t) return void this.error(10001);
  1483. var e = t.getOS();
  1484. let s = window.PlatformClass;
  1485. 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)
  1486. }
  1487. initApp(t) {
  1488. this.sdk.call("initApp", t)
  1489. }
  1490. initUser(t) {
  1491. this.userCall = t, this.sdk.call("initUser")
  1492. }
  1493. showMoreGame() {
  1494. this.sdk.call("showMoreGame")
  1495. }
  1496. showVideoAd(t) {
  1497. this.adCall = t, this.sdk.call("showVideoAd")
  1498. }
  1499. showInsertAd(t) {
  1500. this.sdk.call("showInsertAd", t)
  1501. }
  1502. showBannerAd(t) {
  1503. this.sdk.call("showBannerAd", t)
  1504. }
  1505. vibrate(t = !0) {
  1506. this.sdk.call("vibrate", t)
  1507. }
  1508. userAgree(t) {
  1509. this.sdk.call("userAgree", t)
  1510. }
  1511. exit() {
  1512. this.sdk.call("exit")
  1513. }
  1514. onAdMsg(t) {
  1515. 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)
  1516. }
  1517. onUserInfo(t) {
  1518. p.Inst.platLog("onUserInfo"), p.Inst.initUser(t), this.userCall && this.userCall()
  1519. }
  1520. log(...t) {
  1521. p.Inst.platLog(t)
  1522. }
  1523. error(t) {
  1524. p.Inst.platError(t)
  1525. }
  1526. }
  1527. var U;
  1528. ! function(t) {
  1529. t.adDataId = "AdStatis", t.gameLogin = "GameLogin", t.gameStart = "GameStart", t.gameEnd = "GameEnd"
  1530. }(U || (U = {}));
  1531. let C = p.Inst,
  1532. M = i.Inst,
  1533. N = e.Inst;
  1534. class V {
  1535. constructor() {
  1536. 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
  1537. }
  1538. static get Inst() {
  1539. return this.instance || (this.instance = new V), this.instance
  1540. }
  1541. init(e, i, a, n = !1) {
  1542. if (C.platType = 0, C.myId = 0, C.myKey = "", e) {
  1543. 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;
  1544. let s = e.ads ? e.ads : null;
  1545. t.init(s)
  1546. } else console.log("本地测试:" + this.platMarks[0]);
  1547. if (C.platType > this.platMarks.length || C.platType < 0) return void console.error("参数不合法:" + C.platType);
  1548. switch (C.init(n), C.platType) {
  1549. case h.tt:
  1550. this.platform = new g;
  1551. break;
  1552. case h.op:
  1553. this.platform = new m;
  1554. break;
  1555. case h.vv:
  1556. this.platform = new f;
  1557. break;
  1558. case h.mz:
  1559. this.platform = new T;
  1560. break;
  1561. case h.wx:
  1562. this.platform = new k;
  1563. break;
  1564. case h.qq:
  1565. this.platform = new A;
  1566. break;
  1567. case h.hw:
  1568. this.platform = new b;
  1569. break;
  1570. case h.f399:
  1571. this.platform = new S;
  1572. break;
  1573. case h.ks:
  1574. this.platform = new w;
  1575. break;
  1576. case h.csj:
  1577. case h.hwkb:
  1578. case h.t33:
  1579. case h.mmy:
  1580. case h.xmApk:
  1581. case h.vvApk:
  1582. case h.opApk:
  1583. case h.ios:
  1584. case h.hhw:
  1585. case h.f399Apk:
  1586. case h.ttApk:
  1587. case h.a233:
  1588. this.platform = new L
  1589. }
  1590. let r = this.platMarks[C.platType];
  1591. this.platform ? (C.platLog("平台初始化:" + r), this.platform.init()) : C.onShow(), C.myId > 0 && C.myKey.length > 1 ? y.Inst.init(r, () => {
  1592. this.platform && this.platform.initAds(), 1 == (1 & C.markBit) && this.sendEvent(U.gameLogin), a && a.apply(i)
  1593. }) : this.isVoidPlat || this.platform.initAds(), v.Inst.init(C.myId), s.Inst.setPlat(this.platform), C.data.authUser && this.platform && setTimeout(() => {
  1594. this.lastInsertTime = C.getTime() + 1e4, this.platform && this.platform.initUser(t => {
  1595. t ? (this.authDone = !0, C.platLog("获取到已授权用户")) : (this.authDone = !1, C.platLog("用户可能已设置拒绝"), C.data.authUser = !1, C.saveData())
  1596. })
  1597. }, 2e3)
  1598. }
  1599. initApp(t) {
  1600. this.isVoidPlat || this.platform.initApp(t)
  1601. }
  1602. initTargoApp(t, e) {
  1603. this.targoData.appid = t, this.targoData.key = e
  1604. }
  1605. exit() {
  1606. this.isVoidPlat || (C.platType > 10 ? this.platform.exit() : this.platform.sdk.exitApplication && this.platform.sdk.exitApplication({}))
  1607. }
  1608. initFCM(t) {
  1609. C.initFCM(t)
  1610. }
  1611. get gameTime() {
  1612. if (C.fcmActive) {
  1613. let t = new Date;
  1614. return 20 != t.getHours() ? 0 : (t = null, C.data.gameTime)
  1615. }
  1616. return 9999
  1617. }
  1618. get isRealName() {
  1619. return this.getUserInfo().realCode.length > 1
  1620. }
  1621. get needRealName() {
  1622. return !!this.isPlat(h.ttApk) && !this.isRealName
  1623. }
  1624. authenticate(e, s, i) {
  1625. if (!this.isName(e) || !this.isID(s)) return void(i && i(!1));
  1626. if (!(C.realName ? C.getRandom(0, 100) < C.realName : this.isLegal) || this.isVoidPlat) return C.onRealName(e, s), void(i && i(!0));
  1627. let a = t.getUrl("real-info/enter"),
  1628. n = this.getUserInfo(),
  1629. r = {
  1630. appKey: C.myId,
  1631. userId: n.userId,
  1632. numberId: s,
  1633. realName: e
  1634. },
  1635. o = N.codeMsg(C.myKey, r, !0);
  1636. N.sendPost(a, o, t => {
  1637. let a = !1;
  1638. t && 0 == t.code && "ok" == t.data && (C.onRealName(e, s), a = !0), i && i(a)
  1639. })
  1640. }
  1641. isName(t) {
  1642. if (t.length < 2 || t.length > 4) return !1;
  1643. let e = new RegExp("^[一-鿿]+$"),
  1644. s = !0;
  1645. return e.test(t) || (s = !1), e = null, s
  1646. }
  1647. isID(t) {
  1648. if (18 != t.length) return !1;
  1649. let e = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2],
  1650. s = 0;
  1651. for (let i = 0; i < t.length - 1; i++) {
  1652. let a = t.substring(i, i + 1),
  1653. n = Number(a);
  1654. if (Number.isNaN(n)) return !1;
  1655. s += n * e[i]
  1656. }
  1657. return t.substring(t.length - 1, t.length).toUpperCase() == [1, 0, "X", 9, 8, 7, 6, 5, 4, 3, 2][s % 11].toString()
  1658. }
  1659. onGameStart(t) {
  1660. 2 == (2 & C.markBit) && this.sendEvent(U.gameStart, {
  1661. id: t
  1662. })
  1663. }
  1664. onGameEnd(t, e = 0) {
  1665. 2 == (2 & C.markBit) && this.sendEvent(U.gameEnd, {
  1666. id: t,
  1667. res: e
  1668. }), C.getTime() - this.lastVideoTime > 3e4 && C.getRandom(0, 100) < C.autoAd && this.showVideoAd(() => {}, 0)
  1669. }
  1670. needRealTime(e = !0) {
  1671. t.realTime = e, M.getNetTime()
  1672. }
  1673. getTime(t = !1) {
  1674. return M.getTime(t)
  1675. }
  1676. isNewDay(t, e) {
  1677. if (0 == M.timeSpan) M.getNetTime(() => {
  1678. let s = C.isNewDay();
  1679. e && e.apply(t, [s])
  1680. });
  1681. else {
  1682. let s = C.isNewDay();
  1683. e && e.apply(t, [s])
  1684. }
  1685. }
  1686. isNewWeek(t, e) {
  1687. if (0 == M.timeSpan) M.getNetTime(() => {
  1688. let s = C.isNewWeek();
  1689. e.apply(t, [s])
  1690. });
  1691. else {
  1692. let s = C.isNewWeek();
  1693. e.apply(t, [s])
  1694. }
  1695. }
  1696. getDate(t = 0, e = !0) {
  1697. return M.getDate(t, e)
  1698. }
  1699. getWeek() {
  1700. return M.getWeek()
  1701. }
  1702. getWeekNum() {
  1703. return M.getWeekNum()
  1704. }
  1705. getPlatSize() {
  1706. return this.isVoidPlat ? (C.platWidth = 750, C.platHeight = 1334) : this.platform.setWH(), {
  1707. width: C.platWidth,
  1708. height: C.platHeight
  1709. }
  1710. }
  1711. userAgree(t) {
  1712. this.isVoidPlat || this.platform.userAgree(t)
  1713. }
  1714. onSetting(t, e) {
  1715. this.isVibrat = e, s.Inst.mute(!t)
  1716. }
  1717. showMoreGame() {
  1718. this.isVoidPlat || this.platform.showMoreGame()
  1719. }
  1720. onMoyuAdBack(t) {
  1721. C.platLog("onMoyuAdBack:", t);
  1722. let e = V.Inst.platform;
  1723. e && e.onAdMsg(t)
  1724. }
  1725. onMoyuUserBack(t) {
  1726. let e = V.Inst.platform;
  1727. e && e.onUserInfo(t)
  1728. }
  1729. onTargoBack(e) {
  1730. let s = V.Inst.targoData.appid;
  1731. if (!s || s.length < 2 || !e) return void console.error("targo appid is null");
  1732. let i = V.Inst.targoData.key,
  1733. a = JSON.parse(e);
  1734. a.appId = s, (!a.deviceId || a.deviceId < 5) && (a.deviceId = C.moyuUser.userId);
  1735. let n = N.codeMsg(i, a, !0),
  1736. r = t.getTagro("v3/app/launch").replace("mygame1", "click");
  1737. N.sendPost(r, n, t => {
  1738. t && 0 == t.code ? C.platLog("targoapp send done") : console.error("targoapp send erro", t)
  1739. })
  1740. }
  1741. showVideoAd(t, e = 0, s, i) {
  1742. let a = C.getTime();
  1743. if (a - this.lastVideoTime < 1e3) return C.platLog("video请求太频繁"), void C.showTip(20100);
  1744. if (this.lastVideoTime = a, this.isVoidPlat) C.platLog("本地广告测试,直接返回成功"), t && (s ? t.apply(s) : t());
  1745. else {
  1746. if (C.videoErro && this.isWx) return C.platLog("分享代替视频"), void this.shareGame(e => {
  1747. e ? t && (s ? t.apply(s) : t()) : i && (s ? i.apply(s) : i())
  1748. });
  1749. C.videoCount += 1, this.lastInsertTime = a, C.platLog("展示视频广告"), 4 == (4 & C.markBit) && this.sendEvent(U.adDataId, {
  1750. type: e,
  1751. result: 0
  1752. }), this.platform.showVideoAd(a => {
  1753. a ? t && (s ? t.apply(s) : t()) : i && (s ? i.apply(s) : i()), C.onVideoDone(a), 4 == (4 & C.markBit) && this.sendEvent(U.adDataId, {
  1754. type: e,
  1755. result: a ? 1 : 2
  1756. })
  1757. })
  1758. }
  1759. }
  1760. upRankData(e, s, i = !1, a = !1, n, r) {
  1761. if (!(a || this.hasUserInfo && C.moyuUser.isAuth)) return void C.platLog("未授权暂不上传");
  1762. if (Math.floor(e / 100) != C.myId) return void C.platError(11301, "rankid不合法");
  1763. if (C.data.minScore > s && !i) return;
  1764. let o = C.getRankUser(),
  1765. h = {
  1766. user: o,
  1767. data: n
  1768. },
  1769. d = r || o.userId,
  1770. l = t.getUrl("rank/push"),
  1771. p = {
  1772. rankId: e,
  1773. userId: d,
  1774. rankScore: s,
  1775. userData: JSON.stringify(h)
  1776. };
  1777. N.sendPost(l, p, t => {
  1778. t && 0 == t.code ? (C.platLog("rank上传成功"), C.data.minScore = s) : C.platLog("rank上传失败", t)
  1779. })
  1780. }
  1781. getRankList(e, s, i, a = !1) {
  1782. let n = e.rankId;
  1783. if (n && Math.floor(n / 100) == C.myId)
  1784. if (this.rankList.length < 1 || a) {
  1785. let a = t.getUrl("rank/list");
  1786. N.sendPost(a, e, t => {
  1787. 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])
  1788. })
  1789. } else i && i.apply(s, [this.rankList]);
  1790. else C.platError(11301, "rankid不合法")
  1791. }
  1792. getGameList(e, s) {
  1793. if (this.gameList.length < 1) {
  1794. let i = "";
  1795. if (this.isTT) i = t.getUrl("recommend/get");
  1796. else {
  1797. if (!this.isWx) return void C.platError(11201, "该平台没有推荐列表");
  1798. i = t.getUrl("recommend/wechat-get")
  1799. }
  1800. N.sendGet(i, t => {
  1801. if (t) {
  1802. let e = t.data.recommendList;
  1803. for (let t = 0; t < e.length; t++) {
  1804. let s = e[t];
  1805. if (C.gameBit < 1 || (C.gameBit & s.group) == s.group) {
  1806. let t = {
  1807. myId: s.appKey,
  1808. type: s.type,
  1809. name: s.name,
  1810. icon: s.icon,
  1811. banner: s.banner,
  1812. appId: s.wx_app_id ? s.wx_app_id : "",
  1813. videoId: s.videoid ? s.videoid : "",
  1814. launchNum: s.launch_num
  1815. };
  1816. this.gameList.push(t)
  1817. }
  1818. }
  1819. }
  1820. s && s.apply(e, [this.gameList])
  1821. })
  1822. } else s && s.apply(e, [this.gameList]);
  1823. C.platLog("获取推荐列表")
  1824. }
  1825. saveServerData(t, e) {
  1826. C.saveSeverData(t, e)
  1827. }
  1828. getServerData(t, e, s) {
  1829. C.getSeverData(s => {
  1830. t && (e ? t.apply(e, [s]) : t(s))
  1831. }, s)
  1832. }
  1833. reportNative(t = 2) {
  1834. this.isVoidPlat || (this.platform.reportNative(t), C.platLog("原生上报" + t))
  1835. }
  1836. getNativeAd(t, e) {
  1837. this.isVoidPlat ? e && e.apply(t, [C.nativeInfo]) : (this.platform.getNativeAd(() => {
  1838. e && e.apply(t, [C.nativeInfo])
  1839. }), C.platLog("获取原生ad"))
  1840. }
  1841. loadSubRes(t, e) {
  1842. let s = this.platform;
  1843. return new Promise(function(i) {
  1844. s && s.subLoader || (C.platLog("平台无分包"), i(!0));
  1845. var a = s.subLoader({
  1846. name: t,
  1847. success: function() {
  1848. C.platLog(t + "完成"), i(!0)
  1849. },
  1850. fail: function(t) {
  1851. C.platError(10121, t), i(!1)
  1852. }
  1853. });
  1854. e && a.onProgressUpdate(function(t) {
  1855. let s = t.progress > 1 ? .01 * t.progress : t.progress;
  1856. e(s)
  1857. })
  1858. })
  1859. }
  1860. setShareInfo(e, s, i, a, n) {
  1861. 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)
  1862. }
  1863. addLnk(t, e) {
  1864. this.isVoidPlat || (this.platform && !C.hasShortCut ? this.platform.addLnk(() => {
  1865. t && (e ? t.apply(e) : t())
  1866. }) : t && (e ? t.apply(e) : t()))
  1867. }
  1868. get canFocus() {
  1869. return !this.isVoidPlat && (this.isDouyin ? C.canFocus = !C.data.focused : this.isKs && this.platform.sdk.checkFollowState({
  1870. accountType: "CPServiceAccount",
  1871. callback: t => {
  1872. -10005 === t.errorCode ? C.canFocus = !1 : C.canFocus = !t.hasFollow
  1873. }
  1874. }), C.canFocus)
  1875. }
  1876. focus(t, e) {
  1877. this.isVoidPlat || (this.canFocus ? (C.platLog("发起关注"), this.platform.focus(s => {
  1878. s && (C.data.focused = !0, C.saveData()), t && (e ? t.apply(e, [s]) : t(s))
  1879. })) : C.platLog("不能关注,通过canFocus()获取当前能否关注?"))
  1880. }
  1881. shareGame(e, s, i, a, n) {
  1882. this.isVoidPlat ? e && (s ? e.apply(s) : e()) : (C.platLog("分享调用"), (null == t.shareTitle || t.shareTitle.length < 1) && C.platError(10311, "分享标题为空,可能会拒审"), this.platform.shareGame(t => {
  1883. e && (s ? e.apply(s, [t]) : e(t)), t && (this.recordTime = 0)
  1884. }, a, n))
  1885. }
  1886. canShare() {
  1887. 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
  1888. }
  1889. set shareVideo(t) {
  1890. C.shareMp4 = t
  1891. }
  1892. get shareVideo() {
  1893. return C.shareMp4
  1894. }
  1895. recordGame(t, e = !1) {
  1896. 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))
  1897. }
  1898. recordPause(t) {
  1899. if (this.isVoidPlat) return;
  1900. if (this.recordIsPause == t) return;
  1901. this.recordIsPause = t;
  1902. let e = this.getTime();
  1903. t && (this.recordTime += e - this.recordMark), this.recordMark = e, this.platform.recordPause(t)
  1904. }
  1905. recordEnd(t, e) {
  1906. if (this.isVoidPlat) return C.platLog("测试录屏完成"), void(e && e.apply(t));
  1907. let s = this.getTime();
  1908. this.recordTime += s - this.recordMark, this.platform.recordeEnd(() => {
  1909. e && e.apply(t, [C.shareMp4])
  1910. })
  1911. }
  1912. get isVoidPlat() {
  1913. return !this.platform || !this.platform.sdk
  1914. }
  1915. initUser(t, e, s = !1, i, a, n) {
  1916. 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(() => {
  1917. this.authDone = C.moyuUser.isAuth, e && e.apply(t, [C.moyuUser])
  1918. }, s), C.platLog("初始化个人信息"))
  1919. }
  1920. createWXUserBtn(t, e, s, i, a, n) {
  1921. if (this.isVoidPlat || this.authDone || !this.isWx) return null;
  1922. let r = this.platform.sdk.getSystemInfoSync(),
  1923. o = r.windowWidth * t - .5 * s,
  1924. h = r.windowHeight * e - .5 * i,
  1925. d = this.platform.sdk.createUserInfoButton({
  1926. type: "image",
  1927. image: a,
  1928. style: {
  1929. left: o,
  1930. top: h,
  1931. width: s,
  1932. height: i,
  1933. lineHeight: 40,
  1934. backgroundColor: "",
  1935. color: "",
  1936. textAlign: "center",
  1937. fontSize: 16,
  1938. borderRadius: 4
  1939. }
  1940. });
  1941. return d.onTap(t => {
  1942. "getUserInfo:ok" == t.errMsg ? (C.initUser(t), n && n()) : C.platLog("授权失败"), this.authDone = !0, d.destroy()
  1943. }), d
  1944. }
  1945. getSystemInfo() {
  1946. if (!this.isVoidPlat && this.platform.sdk.getSystemInfo) return this.platform.sdk.getSystemInfoSync()
  1947. }
  1948. createClubBtn(t, e) {
  1949. return this.isVoidPlat ? null : this.platform.sdk.createGameClubButton({
  1950. type: "image",
  1951. image: e,
  1952. icon: "green",
  1953. style: t
  1954. })
  1955. }
  1956. getUserInfo() {
  1957. return C.moyuUser
  1958. }
  1959. clearData() {
  1960. C.clearData()
  1961. }
  1962. sendDataEvent(t, e) {
  1963. 8 == (8 & C.markBit) ? this.sendEvent(t, e) : C.platError(11102, "自定义打点未激活")
  1964. }
  1965. sendEvent(e, s) {
  1966. if (C.myId < 1) return void C.platError(11102, "应用id错误");
  1967. if (this.isVoidPlat) return void C.platLog(11101, "测试环境,不打点");
  1968. if (s) {
  1969. let t = 0;
  1970. for (const e in s)
  1971. if (++t > 2) return void C.platError(11101, "打点数据格式错误")
  1972. } else s = {};
  1973. let i = t.getUrl("event/push"),
  1974. a = {
  1975. appKey: C.myId,
  1976. eventKey: e,
  1977. platformKey: this.platMarks[C.platType],
  1978. userId: C.moyuUser.userId,
  1979. eventParams: JSON.stringify(s)
  1980. };
  1981. N.codeMsg(C.myKey, a), N.sendPost(i, a, t => {
  1982. t && 0 == t.code ? C.platLog("打点成功:" + e) : C.platLog("打点失败", t)
  1983. })
  1984. }
  1985. getLocation(t, e) {
  1986. this.isVoidPlat || this.platform.getLocation(s => {
  1987. t && (e ? t.apply(e, s) : t(s))
  1988. })
  1989. }
  1990. playVideo(t) {
  1991. this.isVoidPlat || this.platform.toVideoView(t)
  1992. }
  1993. getRandom(t, e) {
  1994. return C.getRandom(t, e)
  1995. }
  1996. getRandString(t) {
  1997. return C.getRandStr(t)
  1998. }
  1999. setOnTipCall(t, e) {
  2000. C.onTipCall = (s => {
  2001. t && (e ? t.apply(e, [s]) : t(s))
  2002. })
  2003. }
  2004. playAudioWithEnd(t, e, i) {
  2005. this.isVoidPlat || s.Inst.playAudioWithEnd(i, () => {
  2006. e && e.apply(t)
  2007. })
  2008. }
  2009. playSound(t, e = !1) {
  2010. this.isVoidPlat || s.Inst.playSound(t, e)
  2011. }
  2012. stopSound(t) {
  2013. this.isVoidPlat || s.Inst.stopSound(t)
  2014. }
  2015. stopMusic() {
  2016. this.isVoidPlat || s.Inst.stopMusic()
  2017. }
  2018. pauseMusic(t) {
  2019. this.isVoidPlat || s.Inst.pauseMusic(t)
  2020. }
  2021. playMusic(t) {
  2022. this.isVoidPlat || s.Inst.playMusic(t)
  2023. }
  2024. mute(t) {
  2025. this.isVoidPlat || s.Inst.mute(t)
  2026. }
  2027. createAudio() {
  2028. return this.isVoidPlat ? null : this.platform.createAudio()
  2029. }
  2030. sendPost(t, e, s) {
  2031. N.sendPost(t, e, s)
  2032. }
  2033. sendGet(t, e) {
  2034. N.sendGet(t, e)
  2035. }
  2036. get platData() {
  2037. return C.gameData
  2038. }
  2039. get platConfig() {
  2040. return C.gameConfig
  2041. }
  2042. getLaunchOptions() {
  2043. return C.platOptions
  2044. }
  2045. get isLegal() {
  2046. return C.isLegal || C.isMasked
  2047. }
  2048. set isLegal(t) {
  2049. C.isLegal = t
  2050. }
  2051. get isMasked() {
  2052. return C.isMasked
  2053. }
  2054. get isDouyin() {
  2055. return C.isDouyin
  2056. }
  2057. get hasShortCut() {
  2058. return C.hasShortCut
  2059. }
  2060. get hasShadow() {
  2061. return this.isTT
  2062. }
  2063. get isNeedPlatAudio() {
  2064. return !1
  2065. }
  2066. get platType() {
  2067. return C.platType
  2068. }
  2069. isPlat(t) {
  2070. return t == C.platType
  2071. }
  2072. get isWx() {
  2073. return h.wx == C.platType
  2074. }
  2075. get isQq() {
  2076. return h.qq == C.platType
  2077. }
  2078. get isWeb() {
  2079. return h.web == C.platType
  2080. }
  2081. get isXMApk() {
  2082. return h.xmApk == C.platType
  2083. }
  2084. get isF399() {
  2085. return h.f399 == C.platType
  2086. }
  2087. get isVivo() {
  2088. return h.vv == C.platType
  2089. }
  2090. get isOppo() {
  2091. return h.op == C.platType
  2092. }
  2093. get isTT() {
  2094. return h.tt == C.platType
  2095. }
  2096. get isTTApk() {
  2097. return h.ttApk == C.platType
  2098. }
  2099. get isMZ() {
  2100. return h.mz == C.platType
  2101. }
  2102. get isT33() {
  2103. return h.t33 == C.platType
  2104. }
  2105. get isMmy() {
  2106. return h.mmy == C.platType
  2107. }
  2108. get isKs() {
  2109. return h.ks == C.platType
  2110. }
  2111. get isHw() {
  2112. return h.hw == C.platType
  2113. }
  2114. get isVVApk() {
  2115. return h.vvApk == C.platType
  2116. }
  2117. get isOPApk() {
  2118. return this.isPlat(h.opApk)
  2119. }
  2120. get isIos() {
  2121. return h.ios == C.platType
  2122. }
  2123. get hasUserInfo() {
  2124. return this.isTT || this.isWx || this.isQq || this.isVivo || this.isOppo || this.isKs || this.isMZ
  2125. }
  2126. get isNeedOgg() {
  2127. return C.platType > 10
  2128. }
  2129. get hasAgree() {
  2130. return !this.isIos && (this.isOppo || this.isVivo || C.platType > 10)
  2131. }
  2132. vibration(t = 100) {
  2133. if (this.isVibrat && !this.onVibrat)
  2134. if (this.onVibrat = !0, setTimeout(() => {
  2135. this.onVibrat = !1
  2136. }, this.vibratTime), this.isVoidPlat) {
  2137. if (!navigator || navigator.vibrate) return;
  2138. navigator.vibrate = navigator.vibrate || navigator.webkitVibrate || navigator.mozVibrate || navigator.msVibrate, navigator.vibrate && navigator.vibrate(t)
  2139. } else this.platform.vibrate(t >= 400)
  2140. }
  2141. waitNext() {
  2142. return new Promise(function(t) {
  2143. requestAnimationFrame(() => {
  2144. t()
  2145. })
  2146. })
  2147. }
  2148. waitFrames(t) {
  2149. return new Promise(function(e) {
  2150. let s = t + 1,
  2151. i = !0;
  2152. setInterval(() => {
  2153. i && (i = !1, --s < 1 ? e() : requestAnimationFrame(() => {
  2154. i = !0
  2155. }))
  2156. }, 8)
  2157. })
  2158. }
  2159. waitSeconds(t) {
  2160. return new Promise(function(e) {
  2161. setTimeout(() => {
  2162. e()
  2163. }, 1e3 * t)
  2164. })
  2165. }
  2166. initVideoAd(t) {
  2167. this.isVoidPlat || this.platform.initVideoAd(t)
  2168. }
  2169. initBannerAd(e, s = 30, i = .5, a = 1) {
  2170. this.isVoidPlat || (t.bannerPx = i, t.bannerPy = a, this.platform.initBannerAd(e, s))
  2171. }
  2172. setBannerPos(e = .5, s = 1) {
  2173. this.isVoidPlat || (t.bannerPx = e, t.bannerPy = s, this.platform.setBannerPos(), C.platLog("banner调整"))
  2174. }
  2175. showBannerAd(t) {
  2176. this.isVoidPlat || C.bannerShow != t && (this.platform.showBannerAd(t), C.bannerShow = t, C.bannerClose = !t, C.platLog("banner:" + t))
  2177. }
  2178. showBlock(t) {
  2179. this.isVoidPlat || this.platform.showBlock(t)
  2180. }
  2181. showBox() {
  2182. this.isVoidPlat || this.platform.showBox()
  2183. }
  2184. initCustomAd(t, e, s, i = 30) {
  2185. this.isVoidPlat || this.platform.initCustomAd(t, e, s, i)
  2186. }
  2187. showCustomAd(t, e) {
  2188. this.isVoidPlat || this.platform.showCustomAd(t, e)
  2189. }
  2190. initInsertAd(t) {
  2191. this.isVoidPlat || this.platform.initInsertAd(t)
  2192. }
  2193. showInsertAd(t = 0, e = 0, s = "") {
  2194. if (this.isVoidPlat) return;
  2195. let i = C.getTime(),
  2196. a = i - this.lastInsertTime;
  2197. if (a < e) return C.platLog("插屏间隔太短:" + a), void C.showTip(20122);
  2198. (!s || s.length < 1) && (this.lastInsertTime = i), t > 100 ? setTimeout(() => {
  2199. this.platform.showInsertAd(s)
  2200. }, t) : this.platform.showInsertAd(s), C.platLog("插屏显示")
  2201. }
  2202. }
  2203. window.Moyu = V.Inst, window.MoyuPlat = h, window.MoyuUser = a, window.MoyuRankType = o, window.MoyuCfg = class {
  2204. constructor() {
  2205. this.myId = 0, this.myKey = "", this.plat = h.web, this.version = 0, this.ads = null, this.ads = new d
  2206. }
  2207. }, window.MoyuAds = d, window.MoyuNative = r
  2208. }();