moyu.js 77 KB

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