UNPKG

@quick-game/cli

Version:

Command line interface for rapid qg development

1,428 lines (1,425 loc) 605 kB
"use strict"; require("@babel/runtime/helpers/Objectvalues"), require("@babel/runtime/helpers/Arrayincludes"), require("@babel/runtime/helpers/Objectentries"); var e = require("@babel/runtime/helpers/assertThisInitialized"), t = require("@babel/runtime/helpers/createForOfIteratorHelper"), n = require("@babel/runtime/helpers/regeneratorRuntime"), i = require("@babel/runtime/helpers/construct"), a = require("@babel/runtime/helpers/inherits"), r = require("@babel/runtime/helpers/createSuper"), o = require("@babel/runtime/helpers/typeof"), s = require("@babel/runtime/helpers/slicedToArray"), u = require("@babel/runtime/helpers/classCallCheck"), c = require("@babel/runtime/helpers/createClass"), l = require("@babel/runtime/helpers/defineProperty"); !(function () { var h = { 388: function (e, t, n) { var i, a, r; n.d(t, { QD: function () { return a; }, C2: function () { return r; }, ZP: function () { return h; }, Mi: function () { return f; }, }), (function (e) { (e.STRING = "STRING"), (e.LONGLONG = "LONGLONG"), (e.UINT = "UINT"), (e.INT = "INT"); })(a || (a = {})), (function (e) { (e.SvrReport = "SvrReport"), (e.KvStat = "KvStat"); })(r || (r = {})); var o = (l((i = {}), a.STRING, function (e) { return "string" == typeof e && e.length <= 1024; }), l(i, a.LONGLONG, function (e) { return "number" == typeof e && Math.floor(e) === e; }), l(i, a.UINT, function (e) { return "number" == typeof e && Math.floor(e) === e && e >= 0; }), l(i, a.INT, function (e) { return "number" == typeof e && Math.floor(e) === e; }), i), h = (function () { function e(t) { var n = t.logid, i = t.schemas, a = void 0 === i ? {} : i, r = t.base, o = t.debug, s = void 0 !== o && o, c = t.namespace, l = void 0 === c ? "" : c, h = t.skipValidateInProdEnv, d = void 0 === h || h; u(this, e), (this.debug = !1), (this.base = {}), (this.namespace = ""), (this.skipValidateInProdEnv = !0), (this.asyncGetBase = function () { return Promise.resolve({}); }), (this.logid = n), (this.schemas = a), r && this.setBase(r), (this.debug = s), (this.skipValidateInProdEnv = d), (this.namespace = l ? " ".concat(l, " ") : " "); } return ( c(e, [ { key: "setBase", value: function (e) { this.validate(e), (this.base = Object.assign( Object.assign({}, this.base), e )); }, }, { key: "validate", value: function (e) { if ( (this.debug || !this.skipValidateInProdEnv) && Object.keys(this.schemas).length ) for ( var t = 0, n = Object.entries(e); t < n.length; t++ ) { var i = s(n[t], 2), a = i[0], r = i[1]; if (void 0 !== r) { var o = this.schemas[a]; o ? this.validateColumn(o, r) || console.error( "[minigamefe" .concat( this.namespace, "SchemaValidator]: logid " ) .concat(this.logid, ": ") .concat(a, " should be ") .concat(o, ", but now ") .concat(r) ) : console.warn( "[minigamefe" .concat( this.namespace, "SchemaValidator]: logid" ) .concat(this.logid, ": ") .concat(a, " 缺少类型定义") ); } } }, }, { key: "validateColumn", value: function (e, t) { return o[e](t); }, }, ]), e ); })(), d = ""; function f(e, t, n) { d ? e && e(d) : (t({ success: function (t) { (d = t.networkType), e && e(d); }, }), n(function (t) { (d = t.networkType), t.isConnected || (d = "none"), e && e(d); })); } }, 512: function (e, t, n) { function i() {} function a() { for ( var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 20, t = arguments.length > 1 ? arguments[1] : void 0, n = (t ? "" : "!#%()*+,-./:;=?@[]^_`{|}~") + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", i = n.length, a = [], r = 0; r < e; r++ ) a[r] = n.charAt(Math.random() * i); return a.join(""); } function r(e, t) { if ("string" != typeof e || "string" != typeof t) return "string" != typeof e && "string" != typeof t ? 0 : "string" != typeof e ? 1 : -1; for ( var n = e.split("."), i = t.split("."), a = Math.max(n.length, i.length); n.length < a; ) n.push("0"); for (; i.length < a; ) i.push("0"); for (var r = 0; r < a; r++) { var o = parseInt(n[r], 10), s = parseInt(i[r], 10); if (o > s) return 1; if (o < s) return -1; } return 0; } function u(e) { return "number" == typeof e && isFinite(e); } function c(e) { for ( var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0, n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 0, i = arguments.length, a = new Array(i > 3 ? i - 3 : 0), r = 3; r < i; r++ ) a[r - 3] = arguments[r]; return new Promise(function (i, r) { !(function t() { var o = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 0; e.apply(null, [].concat(a, [o])) .then(i) .catch(function (e) { o > 0 ? setTimeout(function () { t(o - 1); }, n) : r(e); }); })(t); }); } function l(e) { return e .then(function (e) { return [null, e]; }) .catch(function (e) { return [e, null]; }); } function h(e) { var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : "yyyy-MM-dd"; if (!e) return ""; for ( var n = t, i = 10 === String(e).toString().length ? new Date(1e3 * e) : new Date(e), a = { "y+": i.getFullYear(), "M+": i.getMonth() + 1, "d+": i.getDate(), "h+": i.getHours(), "m+": i.getMinutes(), "s+": i.getSeconds(), "q+": Math.floor((i.getMonth() + 3) / 3), "S+": i.getMilliseconds(), }, r = function () { var e = s(u[o], 2), t = e[0], i = e[1], a = new RegExp("(".concat(t, ")")); if (a.test(n)) { var r = n.match(a), c = s(r, 1)[0]; n = n.replace(a, function () { return "00".concat(i).slice(-"".concat(c).length); }); } }, o = 0, u = Object.entries(a); o < u.length; o++ ) r(); return n; } function d(e) { if (null == e) return !0; if ("boolean" == typeof e) return !1; if ("number" == typeof e) return !e; if (e instanceof Error) return "" === e.message; switch (Object.prototype.toString.call(e)) { case "[object String]": case "[object Array]": return !e.length; case "[object File]": case "[object Map]": case "[object Set]": return !e.size; case "[object Object]": return !Object.keys(e).length; } return !1; } function f(e) { return "[object String]" === Object.prototype.toString.call(e); } function g(e) { return "[object Object]" === Object.prototype.toString.call(e); } function p(e) { return e && "[object Function]" === Object.prototype.toString.call(e); } function m(e) { return void 0 === e; } function v(e) { var t = e; try { "object" == o(e) && (t = "string" == typeof e.errMsg ? e.errMsg : "string" == typeof e.errmsg ? e.errmsg : "string" == typeof e.message ? e.message : JSON.stringify(e)); } catch (e) { console.error(e); } return t; } function y(e, t, n) { if (!n) return e; var i = e, a = new RegExp("([?&])".concat(t, "=.*?(&|$)"), "i"); if (i.match(a)) return i.replace(a, "$1".concat(t, "=").concat(n, "$2")); var r = -1 !== i.indexOf("?") ? "&" : "?", o = i.split("#"); return ( (i = "".concat(o[0] + r + t, "=").concat(n)), o[1] && (i += "#".concat(o[1])), i ); } n.d(t, { YP: function () { return i; }, hQ: function () { return a; }, yC: function () { return r; }, hj: function () { return u; }, gj: function () { return c; }, zI: function () { return l; }, p6: function () { return h; }, xb: function () { return d; }, HD: function () { return f; }, Kn: function () { return g; }, mf: function () { return p; }, o8: function () { return m; }, bV: function () { return v; }, vr: function () { return y; }, }); }, 580: function (e, t, n) { var i, a, r, o, s; n.d(t, { t4: function () { return i; }, tE: function () { return r; }, dg: function () { return o; }, vm: function () { return s; }, }), (function (e) { (e.devtools = "devtools"), (e.android = "android"), (e.ios = "ios"), (e.windows = "windows"), (e.mac = "mac"); })(i || (i = {})), (function (e) { (e.portrait = "portrait"), (e.landscape = "landscape"), (e.landscapeLeft = "landscapeLeft"), (e.landscapeRight = "landscapeRight"); })(a || (a = {})), (function (e) { (e.DEVELOP = "develop"), (e.TRIAL = "trial"), (e.RELEASE = "release"); })(r || (r = {})), (function (e) { (e[(e.release = 1)] = "release"), (e[(e.develop = 2)] = "develop"), (e[(e.trial = 3)] = "trial"); })(o || (o = {})), (function (e) { (e[(e.Android = 0)] = "Android"), (e[(e.IOSJscore = 1)] = "IOSJscore"), (e[(e.IOSWK = 2)] = "IOSWK"), (e[(e.UnKnow = 3)] = "UnKnow"), (e[(e.PC = 4)] = "PC"), (e[(e.Devtools = 5)] = "Devtools"), (e[(e.IPadJscore = 6)] = "IPadJscore"), (e[(e.IPadWK = 7)] = "IPadWK"); })(s || (s = {})); }, 662: function (e, t, n) { n.d(t, { Z: function () { return A; }, }); var i, a, r, o, s, u = n(512), c = n(974), l = n(580), h = !("undefined" == typeof pluginEnv), d = "undefined" != typeof wx && "undefined" != typeof Page, f = !("undefined" == typeof wx || d) || h, g = !1, p = !1, m = !1, v = !1, y = !1, S = !1, T = !1, b = !1, w = l.vm.UnKnow, C = "", E = ""; if (f || d) { if (h) { var k = pluginEnv.customEnv; k && k.customEnv && (pluginEnv.customEnv = k.customEnv), (s = "undefined" != typeof wx ? wx : {}), (a = pluginEnv.customEnv && pluginEnv.customEnv.wx ? pluginEnv.customEnv.wx : s); } else a = wx; if (a) { try { if ( ((r = a.getSystemInfoSync() || {}), (w = (0, c.$)(r)), r.platform === l.t4.devtools ? (m = !0) : r.platform === l.t4.ios ? ((g = !0), (T = !!(null === n.g || void 0 === n.g ? void 0 : n.g.isIOSHighPerformanceMode))) : r.platform === l.t4.android ? (p = !0) : r.platform === l.t4.windows ? (y = !0) : r.platform === l.t4.mac && (S = !0), (y || S) && (v = !0), r.model.indexOf("iPad") > -1 && (b = !0), (0, u.yC)(r.SDKVersion, "2.24.4") >= 0 && (null == s ? void 0 : s.getAccountInfoSync)) ) try { var I = (s.getAccountInfoSync() || {}).plugin, P = void 0 === I ? {} : I; (C = P.appId), (E = P.version); } catch (e) { console.log(e); } } catch (e) { console.error(e), (r = {}); } try { o = a.getAccountInfoSync() || {}; } catch (e) { console.error(e), (o = {}); } } else (r = {}), (o = {}); } else (a = {}), (r = {}), (o = {}); var R = { isMiniGamePlugin: h, isMiniGame: f, isMiniProgram: d, isIOS: g, isAndroid: p, isDevtools: m, isWindows: y, isMac: S, isPC: v, isWK: T, isIPad: b, systemInfo: r, accountInfo: o, wx: a, runtimeType: w, pluginWx: s, pluginAppId: C, pluginVersion: E, }; null === (i = a.onDeviceOrientationChange) || void 0 === i || i.call(a, function () { R.systemInfo = a.getSystemInfoSync() || {}; }), h && (R.pluginEnv = pluginEnv); var A = R; }, 835: function (e, t, n) { n.d(t, { Z: function () { return h; }, }); var i = n(512), s = n(388), l = n(580), h = (function (e) { a(n, e); var t = r(n); function n(e) { var i, a = e.reportFunc, r = e.logid, o = e.schemas, c = void 0 === o ? {} : o, l = e.base, h = e.reportType, d = e.asyncGetBase, f = void 0 === d ? function () { return Promise.resolve({}); } : d, g = e.debug, p = e.namespace, m = void 0 === p ? "" : p, v = e.skipValidateInProdEnv, y = void 0 === v || v; return ( u(this, n), ((i = t.call(this, { logid: r, schemas: c, base: l, debug: g, namespace: m, skipValidateInProdEnv: y, })).reportType = s.C2.SvrReport), (i.asyncGetBase = f), a || console.error( "[minigamefe".concat( i.namespace, "GameTransferReport]: 未传入上报函数。" ) ), (i.reportFunc = a), void 0 !== h && (i.reportType = h), i ); } return ( c(n, [ { key: "setKvStatBase", value: function (e, t) { if (this.reportType === s.C2.KvStat) { var n = (e.system || "").split(" "); Object.assign(this.schemas, { DeviceModel: s.QD.STRING, DeviceBrand: s.QD.STRING, OsName: s.QD.STRING, OsVersion: s.QD.STRING, LanguageVersion: s.QD.STRING, Count: s.QD.UINT, AppId: s.QD.STRING, AppVersion: s.QD.UINT, AppState: s.QD.UINT, }), this.setBase({ DeviceModel: e.model || "", DeviceBrand: e.brand || "", OsName: n[0] || "", OsVersion: n[1] || "", LanguageVersion: e.language || "", Count: 1, }), (null == t ? void 0 : t.miniProgram) && this.setBase({ AppState: l.dg[t.miniProgram.envVersion] || l.dg.release, AppId: t.miniProgram.appId, AppVersion: 0, }); } }, }, { key: "send", value: function (e, t) { var n = this; if ( this.reportFunc && "function" == typeof this.reportFunc ) { var a, r = [], u = this.logid; (a = Array.isArray(e) ? e : [e]), this.asyncGetBase().then(function (e) { n.setBase(e), a.forEach(function (e) { var t = Object.assign( Object.assign({}, n.base), e ); if ( (t.ExternInfo && "object" == o(t.ExternInfo) && n.schemas.ExternInfo === s.QD.STRING && (t.ExternInfo = encodeURIComponent( JSON.stringify(t.ExternInfo) )), n.validate(t), n.reportType === s.C2.KvStat) ) { var i = Math.floor(Date.now() / 1e3); Object.assign(t, { StartTime: i, EndTime: i }); } var a = { log_id: n.logid, custom_data: t }; r.push(a), n.debug && console.log( "[minigamefe" .concat( n.namespace, "GameTransferReport]: " ) .concat(u, ","), t ); }); var c = { report_list: r }; n.reportFunc({ req_path: "comm_datareport", json_data: JSON.stringify(c), success: function () { t && t(u, JSON.stringify(c)); }, fail: function (e) { console.error(e), t && t(u, (0, i.bV)(e)); }, }); }); } else console.error( "[minigamefe GameTransferReport]: 未传入上报函数!!!" ); }, }, ]), n ); })(s.ZP); }, 54: function (e, t, n) { n.d(t, { Z: function () { return s; }, }); var i = n(388), o = { 19283: "GameComponent", 19335: "GameWhatsNew", 20285: "MidasFriendPayment", 21494: "WXGameWASMLaunchClose", 21493: "WXGameWASMLaunchException", 21492: "WXGameWASMLaunchTime", 21898: "GameLifeMiniGameCardAction", 20267: "GameAdsSkipCard", }, s = (function (e) { a(n, e); var t = r(n); function n(e) { var i, a = e.reportFunc, r = e.logid, s = e.protocolParams, c = e.schemas, l = e.base, h = e.asyncGetBase, d = void 0 === h ? function () { return Promise.resolve({}); } : h, f = e.debug, g = e.namespace, p = void 0 === g ? "" : g, m = e.skipValidateInProdEnv, v = void 0 === m || m; u(this, n); var y = r; return ( "number" == typeof r && o[r] && ((y = o[r]), f && console.warn( "[minigamefe" .concat( p ? " ".concat(p, " ") : " ", "KeyValueReporter]: logid " ) .concat(r, " auto map to ") .concat(y, "!") )), ((i = t.call(this, { logid: y, schemas: c, base: l, debug: f, namespace: p, skipValidateInProdEnv: v, })).asyncGetBase = d), a || console.error( "[minigamefe".concat( i.namespace, "KeyValueReporter]: 未传入上报函数。" ) ), (i.reportFunc = a || function () {}), (i.protocolParams = s), (i.sendCbk = null), i ); } return ( c(n, [ { key: "send", value: function (e, t) { var n, i = this; (n = Array.isArray(e) ? e : [e]), this.asyncGetBase().then(function (e) { i.setBase(e), n.forEach(function (e) { var n = Object.assign(Object.assign({}, i.base), e); i.validate(n); var a = []; i.protocolParams.forEach(function (e) { var t = void 0 !== n[e] ? n[e] : ""; a.push(t); }), i.reportFunc({ key: i.logid, value: a.map(encodeURIComponent).join(","), immediately: !0, }); var r = t || i.sendCbk; r && r(i.logid, a.map(encodeURIComponent).join(",")), i.debug && (n.IsError ? console.error : console.log)( "[minigamefe" .concat(i.namespace, "keyValueReport]: ") .concat(i.logid), n ); }); }); }, }, ]), n ); })(i.ZP); }, 865: function (e, t, n) { n.r(t), n.d(t, { default: function () { return te; }, }); var i = {}; n.r(i), n.d(i, { navigateToMiniProgram: function () { return h; }, }); var l = n(662); function h(e) { l.Z.wx.navigateToMiniProgram && (l.Z.pluginEnv && l.Z.pluginEnv.navigateToMiniProgramDirectly ? l.Z.pluginEnv.navigateToMiniProgramDirectly({ appId: e }) : l.Z.wx.navigateToMiniProgram({ appId: e })); } JSON.parse; var d, f = JSON.stringify, g = (Object.keys, String), p = "object", m = function (e, t) { return t; }, v = function (e, t, n) { var i = g(t.push(n) - 1); return e.set(n, i), i; }; !(function (e) { (e.log = "log"), (e.info = "info"), (e.warn = "warn"), (e.error = "error"); })(d || (d = {})); var y, S, T, b, w = (function () { function e(t) { var n = t.reportFunc, i = t.base, a = t.debug, r = t.delimiter, o = t.namespace; u(this, e), (this.reportFunc = null), (this.debug = !1), (this.base = {}), (this.delimiter = " "), (this.namespace = ""), n ? ((this.reportFunc = n), i && this.setBase(i), (this.debug = !!a), r && (this.delimiter = r), (this.namespace = o ? " ".concat(o, " ") : " ")) : console.error("[minigamefe XLog]: 未传入上报函数。"); } return ( c(e, [ { key: "setBase", value: function (e) { this.base = Object.assign(Object.assign({}, this.base), e); }, }, { key: "log", value: function () { for ( var e = arguments.length, t = new Array(e), n = 0; n < e; n++ ) t[n] = arguments[n]; this.report(d.log, t); }, }, { key: "info", value: function () { for ( var e = arguments.length, t = new Array(e), n = 0; n < e; n++ ) t[n] = arguments[n]; this.report(d.info, t); }, }, { key: "warn", value: function () { for ( var e = arguments.length, t = new Array(e), n = 0; n < e; n++ ) t[n] = arguments[n]; this.report(d.warn, t); }, }, { key: "error", value: function () { for ( var e = arguments.length, t = new Array(e), n = 0; n < e; n++ ) t[n] = arguments[n]; this.report(d.error, t); }, }, { key: "getLogStr", value: function (e, t) { var n, i = this; if (!this.reportFunc) return ( console.error( "[minigamefe".concat( this.namespace, "XLog]: 未传入上报函数。" ) ), "" ); if (!t) return ""; var a = ""; t.forEach(function (e) { a.length > 0 && (a += i.delimiter); var t = e; "object" == o(t) && (t = t instanceof TypeError ? t.message : (function (e, t, n) { for ( var i = t && o(t) === p ? function (e, n) { return "" === e || -1 < t.indexOf(e) ? n : void 0; } : t || m, a = new Map(), r = [], s = [], u = +v(a, r, i.call({ "": e }, "", e)), c = !u; u < r.length; ) (c = !0), (s[u] = f(r[u++], l, n)); return "[" + s.join(",") + "]"; function l(e, t) { if (c) return (c = !c), t; var n = i.call(this, e, t); switch (o(n)) { case p: if (null === n) return n; case "string": return a.get(n) || v(a, r, n); } return n; } })(t)), (a += "".concat(String(t).trim())); }); var r = "[minigamefe" .concat(this.namespace, "XLog]: ") .concat( JSON.stringify( Object.assign(Object.assign({}, this.base), { type: e, content: a, }) ) ); return ( this.debug && (null === (n = console[e]) || void 0 === n || n.call(console, r)), r ); }, }, { key: "report", value: function (e, t) { var n = this.reportFunc; if (n) if (n[e] && "function" == typeof n[e]) { var i = this.getLogStr(e, t); i && n[e](i); } else console.error( "[minigamefe".concat( this.namespace, "XLog]: 传入的上报函数格式不对。" ) ); else console.error( "[minigamefe".concat( this.namespace, "XLog]: 未传入上报函数。" ) ); }, }, ]), e ); })(), C = n(512); !(function (e) { (e[(e.Front = 1)] = "Front"), (e[(e.Background = 2)] = "Background"); })(y || (y = {})), (function (e) { (e[(e.Default = 0)] = "Default"), (e[(e.GameTransfer = 1)] = "GameTransfer"), (e[(e.Request = 2)] = "Request"), (e[(e.DownloadFile = 3)] = "DownloadFile"), (e[(e.CgiSpeedMeasure = 4)] = "CgiSpeedMeasure"), (e[(e.BadJs = 5)] = "BadJs"), (e[(e.Init = 6)] = "Init"), (e[(e.CostTime = 7)] = "CostTime"), (e[(e.Error = 8)] = "Error"), (e[(e.UploadFile = 9)] = "UploadFile"), (e[(e.Login = 10)] = "Login"); })(S || (S = {})), (function (e) { (e[(e.Info = 101)] = "Info"), (e[(e.Warn = 102)] = "Warn"), (e[(e.Error = 103)] = "Error"); })(T || (T = {})), (function (e) { (e.GameTransferReport = "GameTransferReport"), (e.KeyValueReport = "KeyValueReport"), (e.WxRequestReport = "WxRequestReport"); })(b || (b = {})); var E, k, I = Object.values(S).filter(function (e) { return (0, C.hj)(e); }), P = new ((function () { function e() { u(this, e), (this.options = { debug: !1, logReport: !1, qualityReportType: b.KeyValueReport, pluginAppId: "", pluginVersion: "", xlogName: "minigamefe", }); } return ( c(e, [ { key: "set", value: function (e) { Object.assign(this.options, e); }, }, { key: "get", value: function (e) { return this.options[e]; }, }, ]), e ); })())(), R = (function () { function e(t) { u(this, e), (this.identifier = "".concat( P.get("pluginAppId") || l.Z.pluginAppId, "/plugin.js" )), (this.quality = t), this.init(); } return ( c(e, [ { key: "init", value: function () { var e, t, n = this; null === (t = null === (e = l.Z.wx) || void 0 === e ? void 0 : e.onError) || void 0 === t || t.call(e, function (e) { n.processError(e.message); }); }, }, { key: "processError", value: function (e) { var t; if (e.indexOf(this.identifier) > -1) { var n = e.split("\n"), i = n[0], a = null === (t = n[2]) || void 0 === t ? void 0 : t.split(":")[0]; this.quality.innerReport({ Type: S.BadJs, Target: i, CostTime: 0, Result: e, CustomKey1: a, }); } }, }, ]), e ); })(), A = n(279); !(function (e) { (e.GAMETRANSFER_IS_NOT_EXIST = "gameTransfer is not exist"), (e.REQUEST_IS_NOT_EXIST = "request is not exist"), (e.UPLOADFILE_IS_NOT_EXIST = "uploadFile is not exist"), (e.LOGIN_IS_NOT_EXIST = "login is not exist"), (e.URL_IS_EMPTY = "request url is empty."), (e.HEADER_INVALID = "request header is invalid"), (e.METHOD_IS_NOT_EXIST = "method is not exist"); })(E || (E = {})); var L = (function (e) { a(n, e); var t = r(n); function n() { return u(this, n), t.apply(this, arguments); } return c(n); })(A.TinyEmitter); !(function (e) { (e.login = "login"), (e.gameTransfer = "gameTransfer"), (e.request = "request"), (e.uploadFile = "uploadFile"), (e.downloadFile = "downloadFile"); })(k || (k = {})); var D = { QualityReportType: b, RequestRejectType: E, ReportType: S, PluginReportType: T, }, M = n(835), x = n(54), F = "https://game.weixin.qq.com", _ = "minigamefe_session_id", O = n(388), N = n(580), W = (function (e) { a(n, e); var t = r(n); function n(e) { var i, a = e.reportFunc, r = e.logid, o = e.schemas, s = void 0 === o ? {} : o, c = e.base, l = e.debug, h = e.namespace, d = e.asyncGetBase, f = void 0 === d ? function () { return Promise.resolve({}); } : d, g = e.reportType, p = e.skipValidateInProdEnv, m = void 0 === p || p; return ( u(this, n), ((i = t.call(this, { logid: r, schemas: s, base: c, debug: l, namespace: h, skipValidateInProdEnv: m, })).reportType = O.C2.SvrReport), (i.reportFunc = a), a || console.error( "[minigamefe".concat( i.namespace, "RequestReport]: 未传入上报函数。" ) ), (i.asyncGetBase = f), void 0 !== g && (i.reportType = g), i ); } return ( c(n, [ { key: "setKvStatBase", value: function (e, t) { if (this.reportType === O.C2.KvStat) { var n = (e.system || "").split(" "); Object.assign(this.schemas, { DeviceModel: O.QD.STRING, DeviceBrand: O.QD.STRING, OsName: O.QD.STRING, OsVersion: O.QD.STRING, LanguageVersion: O.QD.STRING, Count: O.QD.UINT, AppId: O.QD.STRING, AppVersion: O.QD.UINT, AppState: O.QD.UINT, }), this.setBase({ DeviceModel: e.model || "", DeviceBrand: e.brand || "", OsName: n[0] || "", OsVersion: n[1] || "", LanguageVersion: e.language || "", Count: 1, }), (null == t ? void 0 : t.miniProgram) && this.setBase({ AppState: N.dg[t.miniProgram.envVersion] || N.dg.release, AppId: t.miniProgram.appId, AppVersion: 0, }); } }, }, { key: "send", value: function (e, t) { var n = this; if ( this.reportFunc && "function" == typeof this.reportFunc ) { var i, a = [], r = this.logid; (i = Array.isArray(e) ? e : [e]), this.asyncGetBase().then(function (e) { var o; n.setBase(e), i.forEach(function (e) { var t = Object.assign( Object.assign({}, n.base), e ); n.validate(t); var i = { log_id: r, custom_data: t }; a.push(i); }); var s = JSON.stringify({ report_list: a }); n.debug && (o = console).log.apply( o, [ "[minigamefe" .concat(n.namespace, "RequestReport]: ") .concat(r), ].concat(a) ), n.reportFunc({ url: "".concat(F, "/cgi-bin/comm/datareport"), method: "POST", header: { "content-type": "application/x-www-form-urlencoded", }, data: s, success: function () { t && t(r, JSON.stringify(s)); }, fail: function (e) { console.error(e), t && t(r, (0, C.bV)(e)); }, }); }); } else console.error( "[minigamefe RequestReport]: 未传入上报函数!!!" ); }, }, ]), n ); })(O.ZP), U = [ "BenchmarkLevel", "NetworkType", "RuntimeType", "PluginAppId", "PluginVersion", "Scene", "SDKVersion", "IsVisible", "Type", "Target", "Params", "Result", "CostTime", "ExternInfo", "CustomKey1", "CustomKey2", "CustomKey3", "IsError", "FELibVersion", ], B = { BenchmarkLevel: O.QD.UINT, NetworkType: O.QD.STRING, RuntimeType: O.QD.UINT, PluginAppId: O.QD.STRING, PluginVersion: O.QD.STRING, Scene: O.QD.UINT, SDKVersion: O.QD.STRING, IsVisible: O.QD.UINT, Type: O.QD.UINT, Target: O.QD.STRING, Params: O.QD.STRING, Result: O.QD.STRING, CostTime: O.QD.UINT, ExternInfo: O.QD.STRING, CustomKey1: O.QD.STRING, CustomKey2: O.QD.STRING, CustomKey3: O.QD.STRING, IsError: O.QD.UINT, FELibVersion: O.QD.STRING, }, G = n(974), V = "1.1.47"; function z(e, t) { var n = e || ""; if ((0, C.Kn)(n)) try { n = JSON.stringify(n); } catch (e) { console.error("[minigamefe stringify error]: ".concat(e)), (n = ""); } else n = String(n); return ( n.length && n.length >= 1024 && ((n = ""), console.warn( "[minigamefe stringify warning]: ".concat( t, " 上报长度超过1024, 已置空" ) )), n ); } var j = (function () { function e(t) { var n, i; u(this, e), (this.benchmarkLevel = 0), (this.network = ""),