jf-gamekit 1.1.1 → 1.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/umd/wxSdk.umd.js CHANGED
@@ -1,7 +1,7 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).jfGamekitSDK={})}(this,function(e){"use strict";function t(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function n(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function r(e){for(var r=1;r<arguments.length;r++){var o=null!=arguments[r]?arguments[r]:{};r%2?n(Object(o),!0).forEach(function(n){t(e,n,o[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):n(Object(o)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))})}return e}function o(e){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o(e)}var i,a,u=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"none",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:2e3,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;wx.showToast({title:e,icon:t,duration:n,mask:!0,success:r})},c="wxgame";var s=(a||(a=1,i={md5:function(e){function t(e,t){return e<<t|e>>>32-t}function n(e,t){var n,r,o,i,a;return o=2147483648&e,i=2147483648&t,a=(1073741823&e)+(1073741823&t),(n=1073741824&e)&(r=1073741824&t)?2147483648^a^o^i:n|r?1073741824&a?3221225472^a^o^i:1073741824^a^o^i:a^o^i}function r(e,r,o,i,a,u,c){return e=n(e,n(n(function(e,t,n){return e&t|~e&n}(r,o,i),a),c)),n(t(e,u),r)}function o(e,r,o,i,a,u,c){return e=n(e,n(n(function(e,t,n){return e&n|t&~n}(r,o,i),a),c)),n(t(e,u),r)}function i(e,r,o,i,a,u,c){return e=n(e,n(n(function(e,t,n){return e^t^n}(r,o,i),a),c)),n(t(e,u),r)}function a(e,r,o,i,a,u,c){return e=n(e,n(n(function(e,t,n){return t^(e|~n)}(r,o,i),a),c)),n(t(e,u),r)}function u(e){var t,n="",r="";for(t=0;t<=3;t++)n+=(r="0"+(e>>>8*t&255).toString(16)).substr(r.length-2,2);return n}var c,s,l,f,d,p,v,g,h,m=Array();for(e=function(e){e=e.replace(/\r\n/g,"\n");for(var t="",n=0;n<e.length;n++){var r=e.charCodeAt(n);r<128?t+=String.fromCharCode(r):r>127&&r<2048?(t+=String.fromCharCode(r>>6|192),t+=String.fromCharCode(63&r|128)):(t+=String.fromCharCode(r>>12|224),t+=String.fromCharCode(r>>6&63|128),t+=String.fromCharCode(63&r|128))}return t}(e),m=function(e){for(var t,n=e.length,r=n+8,o=16*((r-r%64)/64+1),i=Array(o-1),a=0,u=0;u<n;)a=u%4*8,i[t=(u-u%4)/4]=i[t]|e.charCodeAt(u)<<a,u++;return a=u%4*8,i[t=(u-u%4)/4]=i[t]|128<<a,i[o-2]=n<<3,i[o-1]=n>>>29,i}(e),p=1732584193,v=4023233417,g=2562383102,h=271733878,c=0;c<m.length;c+=16)s=p,l=v,f=g,d=h,p=r(p,v,g,h,m[c+0],7,3614090360),h=r(h,p,v,g,m[c+1],12,3905402710),g=r(g,h,p,v,m[c+2],17,606105819),v=r(v,g,h,p,m[c+3],22,3250441966),p=r(p,v,g,h,m[c+4],7,4118548399),h=r(h,p,v,g,m[c+5],12,1200080426),g=r(g,h,p,v,m[c+6],17,2821735955),v=r(v,g,h,p,m[c+7],22,4249261313),p=r(p,v,g,h,m[c+8],7,1770035416),h=r(h,p,v,g,m[c+9],12,2336552879),g=r(g,h,p,v,m[c+10],17,4294925233),v=r(v,g,h,p,m[c+11],22,2304563134),p=r(p,v,g,h,m[c+12],7,1804603682),h=r(h,p,v,g,m[c+13],12,4254626195),g=r(g,h,p,v,m[c+14],17,2792965006),p=o(p,v=r(v,g,h,p,m[c+15],22,1236535329),g,h,m[c+1],5,4129170786),h=o(h,p,v,g,m[c+6],9,3225465664),g=o(g,h,p,v,m[c+11],14,643717713),v=o(v,g,h,p,m[c+0],20,3921069994),p=o(p,v,g,h,m[c+5],5,3593408605),h=o(h,p,v,g,m[c+10],9,38016083),g=o(g,h,p,v,m[c+15],14,3634488961),v=o(v,g,h,p,m[c+4],20,3889429448),p=o(p,v,g,h,m[c+9],5,568446438),h=o(h,p,v,g,m[c+14],9,3275163606),g=o(g,h,p,v,m[c+3],14,4107603335),v=o(v,g,h,p,m[c+8],20,1163531501),p=o(p,v,g,h,m[c+13],5,2850285829),h=o(h,p,v,g,m[c+2],9,4243563512),g=o(g,h,p,v,m[c+7],14,1735328473),p=i(p,v=o(v,g,h,p,m[c+12],20,2368359562),g,h,m[c+5],4,4294588738),h=i(h,p,v,g,m[c+8],11,2272392833),g=i(g,h,p,v,m[c+11],16,1839030562),v=i(v,g,h,p,m[c+14],23,4259657740),p=i(p,v,g,h,m[c+1],4,2763975236),h=i(h,p,v,g,m[c+4],11,1272893353),g=i(g,h,p,v,m[c+7],16,4139469664),v=i(v,g,h,p,m[c+10],23,3200236656),p=i(p,v,g,h,m[c+13],4,681279174),h=i(h,p,v,g,m[c+0],11,3936430074),g=i(g,h,p,v,m[c+3],16,3572445317),v=i(v,g,h,p,m[c+6],23,76029189),p=i(p,v,g,h,m[c+9],4,3654602809),h=i(h,p,v,g,m[c+12],11,3873151461),g=i(g,h,p,v,m[c+15],16,530742520),p=a(p,v=i(v,g,h,p,m[c+2],23,3299628645),g,h,m[c+0],6,4096336452),h=a(h,p,v,g,m[c+7],10,1126891415),g=a(g,h,p,v,m[c+14],15,2878612391),v=a(v,g,h,p,m[c+5],21,4237533241),p=a(p,v,g,h,m[c+12],6,1700485571),h=a(h,p,v,g,m[c+3],10,2399980690),g=a(g,h,p,v,m[c+10],15,4293915773),v=a(v,g,h,p,m[c+1],21,2240044497),p=a(p,v,g,h,m[c+8],6,1873313359),h=a(h,p,v,g,m[c+15],10,4264355552),g=a(g,h,p,v,m[c+6],15,2734768916),v=a(v,g,h,p,m[c+13],21,1309151649),p=a(p,v,g,h,m[c+4],6,4149444226),h=a(h,p,v,g,m[c+11],10,3174756917),g=a(g,h,p,v,m[c+2],15,718787259),v=a(v,g,h,p,m[c+9],21,3951481745),p=n(p,s),v=n(v,l),g=n(g,f),h=n(h,d);return(u(p)+u(v)+u(g)+u(h)).toLowerCase()}}),i),l=["event_params"];function f(e){for(var t=Object.keys(e).sort(),n={},r=0;r<t.length;r++){var o=t[r];n[o]=e[o]}return n}function d(e){var t="";for(var n in e){var r="";null!=e[n]?r=e[n]:e[n]="",t+=n+"="+r+"&"}return t=t.slice(0,t.length-1)}function p(e){e.time=parseInt(Date.parse(new Date)/1e3);var t=f(e);return e.sign||(e.sign=s.md5(d(t)+"WvgAUx8i0JeG5aaF")),e}function v(e){var t=e.map(function(e){e.event_params;var t=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],-1===t.indexOf(n)&&{}.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(e,l);return d(f(t))}).join("&");return s.md5(t+"&key=gorkj:aaQTkvGAfLlDCjJo&1bS202401")}function g(e){var t;if("object"===o(e))if(Array.isArray(e))for(var n in t=[],e)t.push(g(e[n]));else if(null===e)t=null;else if(e.constructor===RegExp)t=e;else for(var r in t={},e)t[r]=g(e[r]);else t=e;return t}var h="POST";function m(e,t,n){return new Promise(function(r,o){wx.request({url:"https://page.hurricanegame.cn"+t,method:e,data:e===h?JSON.stringify(n):n,header:{"content-type":"application/json"},success:function(e){200===e.statusCode?e.data.state?r(e.data):o("request interface error"):console.error("Network Error!")}})})}function y(e,t,n){return new Promise(function(r,o){var i=wx.getStorageSync("jfGamekitSSToken"),a={"content-type":"application/json"};if(i)a.Authorization="Bearer ".concat(i);else{var u=JSON.parse(JSON.stringify(n)).body;a.sign=v(u)}wx.request({url:"https://common-set-api.topspinup.com"+t,method:e,data:e===h?JSON.stringify(n):n,header:a,success:function(e){200===e.statusCode?0==e.data.code?r(e.data):o("request interface error"):console.error("Network Error!")}})})}var _={mac:"",imei:"",oaid:"",androidid:"",idfa:"",idfv:"",sdkver:"1.0"},A=0,k=function(){var e={duid:""},t=wx.getStorageSync("duid");if(t)e.duid=t,A=0;else{console.log(A);var n=function(){for(var e="ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678",t="",n=0;n<32;n++)t+=e.charAt(Math.floor(48*Math.random()));return t}();wx.setStorageSync("duid",n),e.duid=n,A=1}return e},S=function(){var e={client:"",brand:"",resolution:"",model:"",sysver:""};try{var t=wx.getSystemInfoSync();e.sysver=t.system,e.resolution=t.screenWidth+"*"+t.screenHeight,e.model=t.model,e.client=t.platform,e.brand=t.brand}catch(e){console.log("【获取设备系统信息失败】",e)}return e},b=function(){return r(r(r(r({},k()),S()),_),{},{install:A,ntype:""})};
1
+ !function(_,m){"object"==typeof exports&&"undefined"!=typeof module?m(exports):"function"==typeof define&&define.amd?define(["exports"],m):m((_="undefined"!=typeof globalThis?globalThis:_||self).jfGamekitSDK={})}(this,function(_){"use strict";function _defineProperty(_,m,g){return(m=function _toPropertyKey(_){var m=function _toPrimitive(_,m){if("object"!=typeof _||!_)return _;var g=_[Symbol.toPrimitive];if(void 0!==g){var y=g.call(_,m||"default");if("object"!=typeof y)return y;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===m?String:Number)(_)}(_,"string");return"symbol"==typeof m?m:m+""}(m))in _?Object.defineProperty(_,m,{value:g,enumerable:!0,configurable:!0,writable:!0}):_[m]=g,_}function ownKeys(_,m){var g=Object.keys(_);if(Object.getOwnPropertySymbols){var y=Object.getOwnPropertySymbols(_);m&&(y=y.filter(function(m){return Object.getOwnPropertyDescriptor(_,m).enumerable})),g.push.apply(g,y)}return g}function _objectSpread2(_){for(var m=1;m<arguments.length;m++){var g=null!=arguments[m]?arguments[m]:{};m%2?ownKeys(Object(g),!0).forEach(function(m){_defineProperty(_,m,g[m])}):Object.getOwnPropertyDescriptors?Object.defineProperties(_,Object.getOwnPropertyDescriptors(g)):ownKeys(Object(g)).forEach(function(m){Object.defineProperty(_,m,Object.getOwnPropertyDescriptor(g,m))})}return _}function _typeof(_){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(_){return typeof _}:function(_){return _&&"function"==typeof Symbol&&_.constructor===Symbol&&_!==Symbol.prototype?"symbol":typeof _},_typeof(_)}var m,g,y=function toast(_){var m=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"none",g=arguments.length>2&&void 0!==arguments[2]?arguments[2]:2e3,y=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;wx.showToast({title:_,icon:m,duration:g,mask:!0,success:y})},S="wxgame";var A=function requireMd5(){return g||(g=1,m={md5:function md5(_){function md5_RotateLeft(_,m){return _<<m|_>>>32-m}function md5_AddUnsigned(_,m){var g,y,S,A,b;return S=2147483648&_,A=2147483648&m,b=(1073741823&_)+(1073741823&m),(g=1073741824&_)&(y=1073741824&m)?2147483648^b^S^A:g|y?1073741824&b?3221225472^b^S^A:1073741824^b^S^A:b^S^A}function md5_FF(_,m,g,y,S,A,b){return _=md5_AddUnsigned(_,md5_AddUnsigned(md5_AddUnsigned(function md5_F(_,m,g){return _&m|~_&g}(m,g,y),S),b)),md5_AddUnsigned(md5_RotateLeft(_,A),m)}function md5_GG(_,m,g,y,S,A,b){return _=md5_AddUnsigned(_,md5_AddUnsigned(md5_AddUnsigned(function md5_G(_,m,g){return _&g|m&~g}(m,g,y),S),b)),md5_AddUnsigned(md5_RotateLeft(_,A),m)}function md5_HH(_,m,g,y,S,A,b){return _=md5_AddUnsigned(_,md5_AddUnsigned(md5_AddUnsigned(function md5_H(_,m,g){return _^m^g}(m,g,y),S),b)),md5_AddUnsigned(md5_RotateLeft(_,A),m)}function md5_II(_,m,g,y,S,A,b){return _=md5_AddUnsigned(_,md5_AddUnsigned(md5_AddUnsigned(function md5_I(_,m,g){return m^(_|~g)}(m,g,y),S),b)),md5_AddUnsigned(md5_RotateLeft(_,A),m)}function md5_WordToHex(_){var m,g="",y="";for(m=0;m<=3;m++)g+=(y="0"+(_>>>8*m&255).toString(16)).substr(y.length-2,2);return g}var m,g,y,S,A,b,k,T,R,w=Array();for(_=function md5_Utf8Encode(_){_=_.replace(/\r\n/g,"\n");for(var m="",g=0;g<_.length;g++){var y=_.charCodeAt(g);y<128?m+=String.fromCharCode(y):y>127&&y<2048?(m+=String.fromCharCode(y>>6|192),m+=String.fromCharCode(63&y|128)):(m+=String.fromCharCode(y>>12|224),m+=String.fromCharCode(y>>6&63|128),m+=String.fromCharCode(63&y|128))}return m}(_),w=function md5_ConvertToWordArray(_){for(var m,g=_.length,y=g+8,S=16*((y-y%64)/64+1),A=Array(S-1),b=0,k=0;k<g;)b=k%4*8,A[m=(k-k%4)/4]=A[m]|_.charCodeAt(k)<<b,k++;return b=k%4*8,A[m=(k-k%4)/4]=A[m]|128<<b,A[S-2]=g<<3,A[S-1]=g>>>29,A}(_),b=1732584193,k=4023233417,T=2562383102,R=271733878,m=0;m<w.length;m+=16)g=b,y=k,S=T,A=R,b=md5_FF(b,k,T,R,w[m+0],7,3614090360),R=md5_FF(R,b,k,T,w[m+1],12,3905402710),T=md5_FF(T,R,b,k,w[m+2],17,606105819),k=md5_FF(k,T,R,b,w[m+3],22,3250441966),b=md5_FF(b,k,T,R,w[m+4],7,4118548399),R=md5_FF(R,b,k,T,w[m+5],12,1200080426),T=md5_FF(T,R,b,k,w[m+6],17,2821735955),k=md5_FF(k,T,R,b,w[m+7],22,4249261313),b=md5_FF(b,k,T,R,w[m+8],7,1770035416),R=md5_FF(R,b,k,T,w[m+9],12,2336552879),T=md5_FF(T,R,b,k,w[m+10],17,4294925233),k=md5_FF(k,T,R,b,w[m+11],22,2304563134),b=md5_FF(b,k,T,R,w[m+12],7,1804603682),R=md5_FF(R,b,k,T,w[m+13],12,4254626195),T=md5_FF(T,R,b,k,w[m+14],17,2792965006),b=md5_GG(b,k=md5_FF(k,T,R,b,w[m+15],22,1236535329),T,R,w[m+1],5,4129170786),R=md5_GG(R,b,k,T,w[m+6],9,3225465664),T=md5_GG(T,R,b,k,w[m+11],14,643717713),k=md5_GG(k,T,R,b,w[m+0],20,3921069994),b=md5_GG(b,k,T,R,w[m+5],5,3593408605),R=md5_GG(R,b,k,T,w[m+10],9,38016083),T=md5_GG(T,R,b,k,w[m+15],14,3634488961),k=md5_GG(k,T,R,b,w[m+4],20,3889429448),b=md5_GG(b,k,T,R,w[m+9],5,568446438),R=md5_GG(R,b,k,T,w[m+14],9,3275163606),T=md5_GG(T,R,b,k,w[m+3],14,4107603335),k=md5_GG(k,T,R,b,w[m+8],20,1163531501),b=md5_GG(b,k,T,R,w[m+13],5,2850285829),R=md5_GG(R,b,k,T,w[m+2],9,4243563512),T=md5_GG(T,R,b,k,w[m+7],14,1735328473),b=md5_HH(b,k=md5_GG(k,T,R,b,w[m+12],20,2368359562),T,R,w[m+5],4,4294588738),R=md5_HH(R,b,k,T,w[m+8],11,2272392833),T=md5_HH(T,R,b,k,w[m+11],16,1839030562),k=md5_HH(k,T,R,b,w[m+14],23,4259657740),b=md5_HH(b,k,T,R,w[m+1],4,2763975236),R=md5_HH(R,b,k,T,w[m+4],11,1272893353),T=md5_HH(T,R,b,k,w[m+7],16,4139469664),k=md5_HH(k,T,R,b,w[m+10],23,3200236656),b=md5_HH(b,k,T,R,w[m+13],4,681279174),R=md5_HH(R,b,k,T,w[m+0],11,3936430074),T=md5_HH(T,R,b,k,w[m+3],16,3572445317),k=md5_HH(k,T,R,b,w[m+6],23,76029189),b=md5_HH(b,k,T,R,w[m+9],4,3654602809),R=md5_HH(R,b,k,T,w[m+12],11,3873151461),T=md5_HH(T,R,b,k,w[m+15],16,530742520),b=md5_II(b,k=md5_HH(k,T,R,b,w[m+2],23,3299628645),T,R,w[m+0],6,4096336452),R=md5_II(R,b,k,T,w[m+7],10,1126891415),T=md5_II(T,R,b,k,w[m+14],15,2878612391),k=md5_II(k,T,R,b,w[m+5],21,4237533241),b=md5_II(b,k,T,R,w[m+12],6,1700485571),R=md5_II(R,b,k,T,w[m+3],10,2399980690),T=md5_II(T,R,b,k,w[m+10],15,4293915773),k=md5_II(k,T,R,b,w[m+1],21,2240044497),b=md5_II(b,k,T,R,w[m+8],6,1873313359),R=md5_II(R,b,k,T,w[m+15],10,4264355552),T=md5_II(T,R,b,k,w[m+6],15,2734768916),k=md5_II(k,T,R,b,w[m+13],21,1309151649),b=md5_II(b,k,T,R,w[m+4],6,4149444226),R=md5_II(R,b,k,T,w[m+11],10,3174756917),T=md5_II(T,R,b,k,w[m+2],15,718787259),k=md5_II(k,T,R,b,w[m+9],21,3951481745),b=md5_AddUnsigned(b,g),k=md5_AddUnsigned(k,y),T=md5_AddUnsigned(T,S),R=md5_AddUnsigned(R,A);return(md5_WordToHex(b)+md5_WordToHex(k)+md5_WordToHex(T)+md5_WordToHex(R)).toLowerCase()}}),m}(),b=["event_params"];function sortObjByKey(_){for(var m=Object.keys(_).sort(),g={},y=0;y<m.length;y++){var S=m[y];g[S]=_[S]}return g}function getReqString(_){var m="";for(var g in _){var y="";null!=_[g]?y=_[g]:_[g]="",m+=g+"="+y+"&"}return m=m.slice(0,m.length-1)}function getReqData(_){_.time=parseInt(Date.parse(new Date)/1e3);var m=sortObjByKey(_);return _.sign||(_.sign=A.md5(getReqString(m)+"WvgAUx8i0JeG5aaF")),_}function getSSReqData(_){var m=_.map(function(_){_.event_params;var m=function _objectWithoutProperties(_,m){if(null==_)return{};var g,y,S=function _objectWithoutPropertiesLoose(_,m){if(null==_)return{};var g={};for(var y in _)if({}.hasOwnProperty.call(_,y)){if(-1!==m.indexOf(y))continue;g[y]=_[y]}return g}(_,m);if(Object.getOwnPropertySymbols){var A=Object.getOwnPropertySymbols(_);for(y=0;y<A.length;y++)g=A[y],-1===m.indexOf(g)&&{}.propertyIsEnumerable.call(_,g)&&(S[g]=_[g])}return S}(_,b);return getReqString(sortObjByKey(m))}).join("&");return A.md5(m+"&key=gorkj:aaQTkvGAfLlDCjJo&1bS202401")}function deepClone(_){var m;if("object"===_typeof(_))if(Array.isArray(_))for(var g in m=[],_)m.push(deepClone(_[g]));else if(null===_)m=null;else if(_.constructor===RegExp)m=_;else for(var y in m={},_)m[y]=deepClone(_[y]);else m=_;return m}var k=function getCurrentFormattedDateTime(){var _=new Date,m=_.getFullYear(),g=String(_.getMonth()+1).padStart(2,"0"),y=String(_.getDate()).padStart(2,"0"),S=String(_.getHours()).padStart(2,"0"),A=String(_.getMinutes()).padStart(2,"0"),b=String(_.getSeconds()).padStart(2,"0");return"".concat(m,"-").concat(g,"-").concat(y," ").concat(S,":").concat(A,":").concat(b)},T="POST";function request(_,m,g){return new Promise(function(y,S){wx.request({url:"https://page.hurricanegame.cn"+m,method:_,data:_===T?JSON.stringify(g):g,header:{"content-type":"application/json"},success:function success(_){200===_.statusCode?_.data.state?y(_.data):S("request interface error"):console.error("Network Error!")}})})}function ssRequest(_,m,g){return new Promise(function(y,S){var A=wx.getStorageSync("jfGamekitSSToken"),b={"content-type":"application/json"};if(A)b.Authorization="Bearer ".concat(A);else{var k=JSON.parse(JSON.stringify(g)).body;b.sign=getSSReqData(k)}wx.request({url:"https://common-set-api.topspinup.com"+m,method:_,data:_===T?JSON.stringify(g):g,header:b,success:function success(_){200===_.statusCode?0==_.data.code?y(_.data):S("request interface error"):console.error("Network Error!")}})})}var R={mac:"",imei:"",oaid:"",androidid:"",idfa:"",idfv:"",sdkver:"1.0"},w=0,I=function generateDuid(){var _={duid:""},m=wx.getStorageSync("duid");if(m)_.duid=m,w=0;else{console.log(w);var g=function generateUuid(){for(var _="ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678",m="",g=0;g<32;g++)m+=_.charAt(Math.floor(48*Math.random()));return m}();wx.setStorageSync("duid",g),_.duid=g,w=1}return _},O=function systemInfo(){var _={client:"",brand:"",resolution:"",model:"",sysver:""};try{var m=wx.getSystemInfoSync();_.sysver=m.system,_.resolution=m.screenWidth+"*"+m.screenHeight,_.model=m.model,_.client=m.platform,_.brand=m.brand}catch(_){console.log("【获取设备系统信息失败】",_)}return _},E=function activeData(){return _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({},I()),O()),R),{},{install:w,ntype:""})};
2
2
  /**
3
3
  * @dn-sdk/minigame v1.5.5
4
4
  * (c) 2025
5
5
  * @license ISC
6
6
  */
7
- function w(e,t,n){return(t=q(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function T(e){return function(e){if(Array.isArray(e))return R(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||O(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function O(e,t){if(e){if("string"==typeof e)return R(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?R(e,t):void 0}}function R(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function E(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&I(e,t)}function I(e,t){return I=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},I(e,t)}function x(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function(){var n,r=P(e);if(t){var o=P(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return C(this,n)}}function C(e,t){if(t&&("object"===L(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return N(e)}function N(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function P(e){return P=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},P(e)}function L(e){return L="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},L(e)}function M(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function D(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,q(r.key),r)}}function j(e,t,n){return t&&D(e.prototype,t),n&&D(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function q(e){var t=function(e){if("object"!==L(e)||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!==L(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"===L(t)?t:String(t)}var U,F,B="LOCAL_ID",V="CLICK_ID",K="QUEUE_LOST_MAP",G="REMOTE_CONFIG",J="REMOTE_COMMON_CONFIG",W="OPENID",H={init:"init",reporting:"reporting",fail:"fail"},Y={maxSdkInstance:4,maxQueueLength:500,actionParamMaxLength:1e4,autoTrack:!0,reportThreshold:5,reportDelay:1,inspectDelay:30,cgiBatchSize:50,requestConcurrency:4,requestTimeout:1e4,signVersion:"1.0",realTimeActionList:["START_APP","REGISTER","PURCHASE"]},Q="JS_RUN_ERROR",z="REQUEST_ERROR",$="REQUEST_CONFIG_ERROR",Z="JS_QUEUE_LOG",X="PROXY_ERROR",ee="QUEUE_LOST_NUM",te="SIGN_ERROR",ne="UNKNOWN",re="TRUE",oe="FALSE",ie="TICKET_INTERVAL_CHANGE",ae=(F=function(e){return"".concat("@dn-sdk/minigame","_").concat("production","_").concat(e)},{getSync:function(e){var t;try{t=wx.getStorageSync(F(e))}catch(e){return console.error("storage get error",e),t}return t},setSync:function(e,t){try{wx.setStorageSync(F(e),t)}catch(e){return console.error("storage set error",e),!1}return!0}}),ue=function(){var e;return function(){if(!e){var t=function(){if(U)return U;try{return U=wx.getSystemInfoSync()}catch(e){return{}}}(),n=t.system,r=void 0===n?"":n,o=(null==r?void 0:r.split(" "))||[],i=function(e){if(!e)return ne;var t=(null==e?void 0:e.toUpperCase())||"";return t.indexOf("ANDROID")>-1?"ANDROID":t.indexOf("IOS")>-1?"IOS":t.indexOf("MAC")>-1?"OSX":t.indexOf("WINDOWS")>-1?"WINDOWS":ne}(o[0]),a=function(e){return!e||e.length<=0?"":2===e.length?e[1]:3===e.length&&"Windows"===e[0]?"".concat(e[1]," ").concat(e[2]):e[e.length-1]}(o);e={benchmark_level:t.benchmarkLevel,device_brand:t.brand,screen_height:Math.floor(t.screenHeight),screen_width:Math.floor(t.screenWidth),wx_lib_version:t.SDKVersion,wx_version:t.version,wx_platform:t.platform,device_model:t.model,os:i,os_version:a}}return e}}(),ce=function(){var e;return function(){try{if(e)return e;e||(e=ae.getSync(B)||""),e||(e=we(),ae.setSync(B,e))}catch(e){}return e}}(),se=function(){var e="unknown",t=!1;return function(){if(!t)try{wx.getNetworkType({success:function(t){e=t.networkType},fail:function(){e="unknown"}}),wx.onNetworkStatusChange(function(t){e=t.networkType}),t=!0}catch(e){}return e}}();se();var le=function(){var e="";return function(){return e||(e=ae.getSync(W)||""),e}}(),fe=function(){var e;return function(){if(e)return e;try{var t=wx.getAccountInfoSync();return Ae(t.miniProgram)?e=t.miniProgram:{}}catch(t){return{}}}}();function de(e){var t=null==e?void 0:e.query;if(!Ae(t))return"";var n="";return t.gdt_vid||[1045,1046,1084].indexOf(null==e?void 0:e.scene)>-1?n="TENCENT":t.clue_token||t.clickid&&t.item_id?n="BYTEDANCE":t.callback&&"kuaishou"===t.ksChannel?n="KUAISHOU":t.bd_vid||t.ai&&t.d&&t.q&&t.c?n="BAIDU":t.uctrackid?n="ALIBABA":(t.trackid||t.imp||[1065,1069,1194].indexOf(null==e?void 0:e.scene)>-1&&(t.callback||t.u))&&(n="OTHERS"),n}function pe(e,t){try{var n=ue(),r=fe(),o={sdk_version:"1.5.5",sdk_name:"@dn-sdk/minigame",device_brand:null==n?void 0:n.device_brand,device_model:null==n?void 0:n.device_model,wx_version:null==n?void 0:n.wx_version,wx_lib_version:null==n?void 0:n.wx_lib_version,wx_platform:null==n?void 0:n.wx_platform,os:null==n?void 0:n.os,os_version:null==n?void 0:n.os_version,local_id:ce(),env_version:null==r?void 0:r.envVersion,appid:null==r?void 0:r.appId},i=Object.assign(o,e);wx.request({url:"https://api.datanexus.qq.com/data-nexus-trace/log",data:i,method:"POST",timeout:Y.requestTimeout,success:function(e){"function"==typeof t&&200===(null==e?void 0:e.statusCode)&&t()}})}catch(n){Me.error(n)}}var ve=function(){function e(){M(this,e)}return j(e,null,[{key:"revise",value:function(e){e>0&&!this.isRevised&&(this.offsetTime=e-Date.now(),this.isRevised=!0)}},{key:"getRevisedcurrentTimeMillis",value:function(){return this.isRevised?Date.now()+this.offsetTime:-1}}]),e}();function ge(e){return new Promise(function(t,n){wx.request({method:"POST",url:"https://api.datanexus.qq.com/data-nexus-config/v1/sdk/config/get",data:e,timeout:Y.requestTimeout,success:function(e){he(e,t,"config/get",n),ye(e)},fail:function(e){me(e,"config/get",n)}})})}function he(e,t,n,r){var o,i,a,u,c=null==e?void 0:e.statusCode,s=null==(o=null==e?void 0:e.data)?void 0:o.code;if(200!==c||0!==s){var l=s;200!==c&&(l="number"==typeof c?-1*c:-888),pe({log_type:$,message:"cgiName: ".concat(n,", statusCode: ").concat(c,", code: ").concat(s,", traceid: ").concat(null==(a=null==e?void 0:e.data)?void 0:a.trace_id),code:l}),null==r||r(null==(u=null==e?void 0:e.data)?void 0:u.data)}else t(null==(i=e.data)?void 0:i.data)}function me(e,t,n){pe({log_type:$,message:"cgiName: ".concat(t," , message: ").concat(null==e?void 0:e.errMsg," "),code:"number"==typeof(null==e?void 0:e.errno)?-1*e.errno:-999}),null==n||n(e)}function ye(e){var t,n=1*(null==(t=null==e?void 0:e.header)?void 0:t["Server-Time"]);n>17266752e5&&ve.revise(n)}ve.offsetTime=0,ve.isRevised=!1;var _e=Object.prototype.toString,Ae=function(e){return"[object Object]"===_e.call(e)},ke=function(e){return"[object Array]"===_e.call(e)},Se=function(e){return"[object Function]"===_e.call(e)},be=(new Date).getTime();function we(){var e=(new Date).getTime(),t=Math.abs(1e3*(e-be));return"xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx".replace(/[xy]/g,function(n){var r=16*Math.random();return e>0?(r=(e+r)%16|0,e=Math.floor(e/16)):(r=(t+r)%16|0,t=Math.floor(t/16)),("x"===n?r:3&r|8).toString(16).replace(/-/g,"")})}var Te=/^v?(?:\d+)(\.(?:[x*]|\d+)(\.(?:[x*]|\d+)(\.(?:[x*]|\d+))?(?:-[\da-z\-]+(?:\.[\da-z\-]+)*)?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i,Oe=function(e){if("string"!=typeof e)throw new TypeError("Invalid argument expected string");if(!Te.test(e))throw new Error("Invalid argument not valid semver ('".concat(e,"' received)"))},Re=function(e){return isNaN(Number(e))?e:Number(e)},Ee=function(e){var t=e.replace(/^v/,"").replace(/\+.*$/,""),n=function(e){return-1===e.indexOf("-")?e.length:e.indexOf("-")}(t),r=t.substring(0,n).split(".");return r.push(t.substring(n+1)),r},Ie=function(e,t){[e,t].forEach(Oe);for(var n=Ee(e),r=Ee(t),o=0;o<Math.max(n.length-1,r.length-1);o++){var i=parseInt(n[o]||"0",10),a=parseInt(r[o]||"0",10);if(i>a)return 1;if(a>i)return-1}var u=n[n.length-1],c=r[r.length-1];if(u&&c)for(var s=u.split(".").map(Re),l=c.split(".").map(Re),f=0;f<Math.max(s.length,l.length);f++){if(void 0===s[f]||"string"==typeof l[f]&&"number"==typeof s[f])return-1;if(void 0===l[f]||"string"==typeof s[f]&&"number"==typeof l[f]||s[f]>l[f])return 1;if(l[f]>s[f])return-1}else if(u||c)return u?-1:1;return 0};function xe(e){return Ce()[e]}function Ce(){return Y}function Ne(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var Pe=function(e){try{return e&&"string"==typeof e?-1===(e=e.replace(/\s/g,"")).indexOf(".")?e:e.split(".").slice(0,2).join("."):""}catch(t){return e}},Le=function(){function e(){M(this,e)}return j(e,null,[{key:"error",value:function(e){for(var t,n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];(t=console).error.apply(t,["".concat("[@dn-sdk/minigame v1.5.5]",": ").concat(e)].concat(r))}},{key:"info",value:function(t){for(var n,r=arguments.length,o=new Array(r>1?r-1:0),i=1;i<r;i++)o[i-1]=arguments[i];e.debug&&(n=console).info.apply(n,["".concat("[@dn-sdk/minigame v1.5.5]",": ").concat(t)].concat(o))}},{key:"log",value:function(t){for(var n,r=arguments.length,o=new Array(r>1?r-1:0),i=1;i<r;i++)o[i-1]=arguments[i];e.debug&&(n=console).log.apply(n,["".concat("[@dn-sdk/minigame v1.5.5]",": ").concat(t)].concat(o))}},{key:"warn",value:function(e){for(var t,n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];(t=console).warn.apply(t,["".concat("[@dn-sdk/minigame v1.5.5]",": ").concat(e)].concat(r))}},{key:"devLog",value:function(t){for(var n,r=arguments.length,o=new Array(r>1?r-1:0),i=1;i<r;i++)o[i-1]=arguments[i];e.isDev&&(n=console).log.apply(n,["".concat("[@dn-sdk/minigame v1.5.5]",": ").concat(t)].concat(o))}}]),e}(),Me=Le;Me.debug=!1,Me.isDev=!1;var De=function(){var e;return function(){if(!e)try{var t=wx.getLaunchOptionsSync(),n=t.query.gdt_vid||"";n?ae.setSync(V,n):n=ae.getSync(V)||"";var r=JSON.stringify(t);r.length>1e4&&(r=JSON.stringify({cut:1,scene:t.scene})),e={source_scene:t.scene,pkg_channel_id:t.query.wxgamepro||"",ad_trace_id:n,launch_options:r,channel:de(t)}}catch(t){e={},Me.log("获取场景值和渠道号失败",t)}return e}}();function je(e,t,n){var r=n.value;return n.value=function(){for(var n=arguments.length,o=new Array(n),i=0;i<n;i++)o[i]=arguments[i];try{return r.apply(this,o)}catch(n){try{Me.error.apply(Me,["calling ".concat(e.constructor.name,".").concat(t," error with arguments")].concat(o)),Me.error(n);var a={log_type:Q,message:"[safeExcutable] ".concat(e.constructor.name,".").concat(t,": ").concat(null==n?void 0:n.message),err_stack:null==n?void 0:n.stack};Se(this.reportLog)?this.reportLog(a):pe(a)}catch(a){}}},n}var qe=Object.defineProperty,Ue=Object.getOwnPropertyDescriptor,Fe=function(e,t,n,r){for(var o,i=r>1?void 0:r?Ue(t,n):t,a=e.length-1;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&qe(t,n,i),i},Be=function(){function e(t){var n=t.userActionSetId,r=t.maxLength,o=void 0===r?500:r;M(this,e),this.lostActionMaps={},this.stack=[],this.localStorageKey="",this.localStorageKey="".concat("QUEUE_ACTIONS","_").concat(null==n?void 0:n.toString()),this.maxLength=o,this.userActionSetId=n,this.setTimeStamp(),this.init()}return j(e,[{key:"getItems",value:function(){return this.stack}},{key:"getStorage",value:function(){var e,t=(null==(e=ae)?void 0:e.getSync(this.localStorageKey))||"[]";return JSON.parse(t)}},{key:"reportLostNum",value:function(){var e=this,t=Object.assign({},this.lostActionMaps),n=[];for(var r in t){var o=null==r?void 0:r.split("_");n.push({queue_lost_session_id:o[0],queue_lost_timestamp:o[1],queue_lost_num:t[r]})}n.length&&(this.setTimeStamp(),n.forEach(function(t){var n=Object.assign({},{user_action_set_id:e.userActionSetId,log_type:ee},t),r=null==t?void 0:t.queue_lost_session_id,o=null==t?void 0:t.queue_lost_timestamp,i="".concat(r,"_").concat(o);pe(n,function(){Ne(e.lostActionMaps,i)&&(delete e.lostActionMaps[i],ae.setSync(K,JSON.stringify(e.lostActionMaps)))})}))}},{key:"getLostMaps",value:function(){return this.lostActionMaps}},{key:"init",value:function(){var e=this,t=this.getStorage(),n=null==t?void 0:t.map(function(e){var t,n;return e.inner_status===(null==(t=H)?void 0:t.reporting)?Object.assign({},e,{inner_status:null==(n=H)?void 0:n.fail,is_retry:!0,retry_count:e.retry_count+1}):e});this.stack=n,this.lostActionMaps=JSON.parse(ae.getSync(K)||"{}"),setTimeout(function(){e.reportLostNum()},1e3)}},{key:"addItem",value:function(e){var t;null==(t=null==this?void 0:this.stack)||t.push(e)}},{key:"removeItems",value:function(e){var t,n=null==(t=null==this?void 0:this.stack)?void 0:t.filter(function(t){return!(null!=e&&e.includes(null==t?void 0:t.action_id))});this.stack=n}},{key:"updateForReportFail",value:function(e){var t;this.stack=null==(t=this.stack)?void 0:t.map(function(t){var n;return null!=e&&e.includes(null==t?void 0:t.action_id)?Object.assign({},t,{inner_status:null==(n=H)?void 0:n.fail,retry_count:t.retry_count+1,is_retry:!0}):t})}},{key:"updateForReporting",value:function(e){var t;this.stack=null==(t=this.stack)?void 0:t.map(function(t){var n;return null!=e&&e.includes(null==t?void 0:t.action_id)?Object.assign({},t,{inner_status:null==(n=H)?void 0:n.reporting}):t})}},{key:"updateAllStack",value:function(e){this.stack=e}},{key:"updateToStorage",value:function(){ae.setSync(this.localStorageKey,JSON.stringify(this.stack))}},{key:"updateLostAction",value:function(e){if(e){var t="".concat(e,"_").concat(this.timeStamp),n=this.lostActionMaps[t]||0;this.lostActionMaps[t]=n+1,ae.setSync(K,JSON.stringify(this.lostActionMaps))}}},{key:"setTimeStamp",value:function(){this.timeStamp=Date.now().toString()}}]),e}();Fe([je],Be.prototype,"getItems",1),Fe([je],Be.prototype,"getStorage",1),Fe([je],Be.prototype,"reportLostNum",1),Fe([je],Be.prototype,"getLostMaps",1),Fe([je],Be.prototype,"init",1),Fe([je],Be.prototype,"addItem",1),Fe([je],Be.prototype,"removeItems",1),Fe([je],Be.prototype,"updateForReportFail",1),Fe([je],Be.prototype,"updateForReporting",1),Fe([je],Be.prototype,"updateAllStack",1),Fe([je],Be.prototype,"updateToStorage",1),Fe([je],Be.prototype,"updateLostAction",1);var Ve=Object.defineProperty,Ke=Object.getOwnPropertyDescriptor,Ge=function(e,t,n,r){for(var o,i=r>1?void 0:r?Ke(t,n):t,a=e.length-1;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&Ve(t,n,i),i},Je=function(){E(t,Be);var e=x(t);function t(n){var r,o=n.userActionSetId,i=n.maxLength,a=void 0===i?500:i,u=n.ogEvents,c=void 0===u?[]:u;return M(this,t),(r=e.call(this,{userActionSetId:o,maxLength:a})).ogEvents=c,r}return j(t,[{key:"getReportableActions",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:100,t=this.getItems(),n=[];return null==t||t.forEach(function(t){var r;(null==n?void 0:n.length)<e&&(null==t?void 0:t.inner_status)!==(null==(r=H)?void 0:r.reporting)&&(null==n||n.push(t))}),n}},{key:"addAction",value:function(e){var t={code:0,message:"成功",actionId:e.action_id},n=this.getItems();if((null==n?void 0:n.length)>=this.maxLength){var r="队列长度超过最大限制".concat(this.maxLength,"条,SDK将按照行为优先级排序,丢弃优先级最低的行为事件");Me.warn(r),pe({user_action_set_id:this.userActionSetId,log_type:Z,message:"队列长度超过限制"});var o=this.sortQueue(e,n);Me.debug&&Me.info("超过".concat(this.maxLength,"条按优先级排序的队列:"),o.concat([]));var i=o.pop();this.updateAllStack(o),this.updateLostAction((null==i?void 0:i.session_id)||""),(null==i?void 0:i.action_id)===e.action_id&&(t={code:103,message:"缓存队列已满,主动丢弃行为"})}else this.addItem(e);return this.updateToStorage(),t}},{key:"removeActions",value:function(e){this.removeItems(e),this.updateToStorage()}},{key:"updateActionsForReportFail",value:function(e){this.updateForReportFail(e),this.updateToStorage()}},{key:"updateActionsForReporting",value:function(e){this.updateForReporting(e),this.updateToStorage()}},{key:"getReportableActionsLength",value:function(){var e=this.getItems().filter(function(e){var t;return(null==e?void 0:e.inner_status)!==(null==(t=H)?void 0:t.reporting)});return null==e?void 0:e.length}},{key:"sortQueue",value:function(e,t){var n=this,r={},o=null==e?void 0:e.action_time,i=t.concat([e]),a=function(e){return r[e.action_id]||(r[e.action_id]=n.caculateWeight(o,e)),r[e.action_id]};return i.sort(function(e,t){return a(t)-a(e)})}},{key:"caculateWeight",value:function(e,t){var n,r=0,o=this.formatWeight(e,null==t?void 0:t.action_time),i=o.ogWeight,a=o.sdkWeight,u=o.userWeight;null!=(n=this.ogEvents)&&n.includes(null==t?void 0:t.action_type)&&(r+=i),null!=t&&t.is_sdk_auto_track?r+=a:r+=u;var c=e-(null==t?void 0:t.action_time)+1;return c>0?r+1/c:r}},{key:"formatWeight",value:function(e,t){var n=1e3,r=10,o=100;return e-t>2592e6&&(n/=100,r/=100,o/=100),{ogWeight:n,sdkWeight:r,userWeight:o}}}]),t}();Ge([je],Je.prototype,"getReportableActions",1),Ge([je],Je.prototype,"addAction",1),Ge([je],Je.prototype,"removeActions",1),Ge([je],Je.prototype,"updateActionsForReportFail",1),Ge([je],Je.prototype,"updateActionsForReporting",1),Ge([je],Je.prototype,"getReportableActionsLength",1),Ge([je],Je.prototype,"sortQueue",1),Ge([je],Je.prototype,"caculateWeight",1),Ge([je],Je.prototype,"formatWeight",1);var We=function(){function e(){M(this,e),this.events={}}return j(e,[{key:"subscribe",value:function(t,n){e.checkCallback(n),ke(this.events[t])?this.events[t].push(n):this.events[t]=[n]}},{key:"once",value:function(t,n){e.checkCallback(n),this.subscribe(this.onceEventName(t),n)}},{key:"unsubscribe",value:function(t,n){e.checkCallback(n),ke(this.events[t])&&(this.events[t]=this.events[t].filter(function(e){return e!==n})),ke(this.events[this.onceEventName(t)])&&(this.events[this.onceEventName(t)]=this.events[this.onceEventName(t)].filter(function(e){return e!==n}))}},{key:"publish",value:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];var o=Date.now();ke(this.events[e])&&this.events[e].forEach(function(e){return e.apply(void 0,[o].concat(n))}),ke(this.events[this.onceEventName(e)])&&(this.events[this.onceEventName(e)].forEach(function(e){return e.apply(void 0,[o].concat(n))}),this.events[this.onceEventName(e)]=[])}},{key:"onceEventName",value:function(e){return"once_event_prefix_".concat(e)}}],[{key:"checkCallback",value:function(t){Se(t)||Me.error(e.ERROR_CALLBACK_IS_NOT_A_FUNCTION)}}]),e}(),He=We;He.ERROR_CALLBACK_IS_NOT_A_FUNCTION="callback 不是函数";var Ye=new He,Qe=["REGISTER","VIEW_CONTENT","ADD_TO_CART","PURCHASE","COMPLETE_ORDER","ADD_TO_WISHLIST","START_APP","CREATE_ROLE","AUTHORIZE","TUTORIAL_FINISH","START_PAY","FINISH_PAY"],ze="START_APP",$e="TICKET",Ze="ENTER_FOREGROUND",Xe="ENTER_BACKGROUND",et="LOGIN",tt="SHARE",nt="TAP_GAME_CLUB",rt="CREATE_GAME_CLUB",ot="JOIN_GAME_ROOM",it="FINISH_PAY",at="START_PAY",ut="ADD_TO_WISHLIST",ct=["REGISTER","START_APP","RE_ACTIVE"],st=["TICKET","ENTER_FOREGROUND","ENTER_BACKGROUND"],lt=function(){function e(){M(this,e),this.channelClaimActionList=ct,this.noClaimActionList=st,this.realTimeActionList=Y.realTimeActionList,this.ticketInterval=60,this.requestTimeout=Y.requestTimeout,this.loadConfig()}return j(e,[{key:"getChannelClaimActionList",value:function(){return this.channelClaimActionList}},{key:"getNoClaimActionList",value:function(){return this.noClaimActionList}},{key:"getRealTimeActionList",value:function(){return this.realTimeActionList}},{key:"getTicketInterval",value:function(){return this.ticketInterval}},{key:"getRequestTimeout",value:function(){return this.requestTimeout}},{key:"loadConfig",value:function(){var e=this;try{if("undefined"==typeof wx)return;var t=ae.getSync(J);t&&this.updateConfig(t),ge({conf_name:"mini_game_sdk_common",conf_key:"config"}).then(function(t){t&&Ae(t)&&(e.updateConfig(t),ae.setSync(J,t))})}catch(t){console.error(t)}}},{key:"updateConfig",value:function(e){e.channelClaimActionList&&ke(e.channelClaimActionList)&&(this.channelClaimActionList=e.channelClaimActionList),e.noClaimActionList&&ke(e.noClaimActionList)&&(this.noClaimActionList=e.noClaimActionList),e.realTimeActionList&&ke(e.realTimeActionList)&&(this.realTimeActionList=e.realTimeActionList),e.ticketInterval&&"number"==typeof e.ticketInterval&&e.ticketInterval>1&&e.ticketInterval!==this.ticketInterval&&(this.ticketInterval=e.ticketInterval,Ye.publish(ie)),e.requestTimeout&&"number"==typeof e.requestTimeout&&e.requestTimeout>5e3&&(this.requestTimeout=e.requestTimeout)}}]),e}(),ft=new lt,dt=ze,pt=$e,vt=Ze,gt=Xe,ht=function(){var e=!1,t=!1,n=!0,r=!0,o=!0,i=!1;return function(){if(!i){i=!0;var a=ae.getSync(G);if((null==a?void 0:a.bg)===re?e=!0:(null==a?void 0:a.bg)===oe&&(e=!1),(null==a?void 0:a.fg)===re?t=!0:(null==a?void 0:a.fg)===oe&&(t=!1),(null==a?void 0:a.st)===re?n=!0:(null==a?void 0:a.st)===oe&&(n=!1),(null==a?void 0:a.ti)===re?r=!0:(null==a?void 0:a.ti)===oe&&(r=!1),Me.devLog("当前缓存开关 bgOn,fgOn,stOn,tiOn:",e,t,n,r),n&&Ye.publish(dt),r){var u=function(){o&&Ye.publish(pt)},c=setInterval(u,1e3*ft.getTicketInterval());Ye.subscribe(ie,function(){c&&clearInterval(c),c=setInterval(u,1e3*ft.getTicketInterval())})}wx.onShow(function(e){if(o=!0,t){var n="";try{(n=JSON.stringify(e)).length>1e4&&(n=JSON.stringify({cut:1,scene:e.scene}))}catch(e){}Ye.publish(vt,{enter_options:n})}}),wx.onHide(function(){o=!1,e&&Ye.publish(gt)})}}}(),mt="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function yt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var _t,At=yt(function(){var e,t=null;function n(e){return!!e&&("object"==L(e)||"function"==typeof e)}function r(e){if(null!==e&&!n(e))throw new TypeError("Object prototype may only be an Object or null: "+e)}var o=Object,i=!(!o.create&&{__proto__:null}instanceof o),a=o.create||(i?function(e){return r(e),{__proto__:e}}:function(e){if(r(e),null===e)throw new SyntaxError("Native Object.create is required to create objects with null prototype");var t=function(){};return t.prototype=e,new t}),u=function(){return null},c=o.getPrototypeOf||([].__proto__===Array.prototype?function(e){var t=e.__proto__;return n(t)?t:null}:u);return e=function(s,l){if(void 0===(this&&this instanceof e?this.constructor:void 0))throw new TypeError("Constructor Proxy requires 'new'");if(!n(s)||!n(l))throw new TypeError("Cannot create proxy with a non-object as target or handler");var f=function(){};t=function(){s=null,f=function(e){throw new TypeError("Cannot perform '".concat(e,"' on a proxy that has been revoked"))}},setTimeout(function(){t=null},0);var d=l;for(var p in l={get:null,set:null,apply:null,construct:null},d){if(!(p in l))throw new TypeError("Proxy polyfill does not support trap '".concat(p,"'"));l[p]=d[p]}"function"==typeof d&&(l.apply=d.apply.bind(d));var v,g=c(s),h=!1,m=!1;"function"==typeof s?(v=function(){var e=this&&this.constructor===v,t=Array.prototype.slice.call(arguments);return f(e?"construct":"apply"),e&&l.construct?l.construct.call(this,s,t):!e&&l.apply?l.apply(s,this,t):e?(t.unshift(s),new(s.bind.apply(s,t))):s.apply(this,t)},h=!0):s instanceof Array?(v=[],m=!0):v=i||null!==g?a(g):{};var y=l.get?function(e){return f("get"),l.get(this,e,v)}:function(e){return f("get"),this[e]},_=l.set?function(e,t){f("set"),l.set(this,e,t,v)}:function(e,t){f("set"),this[e]=t},A=o.getOwnPropertyNames(s),k={};A.forEach(function(e){if(!h&&!m||!(e in v)){var t={enumerable:!!o.getOwnPropertyDescriptor(s,e).enumerable,get:y.bind(s,e),set:_.bind(s,e)};o.defineProperty(v,e,t),k[e]=!0}});var S=!0;if(h||m){var b=o.setPrototypeOf||([].__proto__===Array.prototype?function(e,t){return r(t),e.__proto__=t,e}:u);g&&b(v,g)||(S=!1)}if(l.get||!S)for(var w in s)k[w]||o.defineProperty(v,w,{get:y.bind(s,w)});return o.seal(s),o.seal(v),v},e.revocable=function(n,r){return{proxy:new e(n,r),revoke:t}},e}),kt={};try{_t||(_t=At())}catch(U){Ot(U)}function St(e,t,n,r){try{if(!_t||null==e||!e[t])return;e[t]=new _t(e[t],{apply:function(e,t,o){var i,a;r&&Tt(function(){return r.apply(void 0,T(o))});var u=!!(null!=(i=o[0])&&i.success||null!=(a=o[0])&&a.fail);u&&["success","fail"].forEach(function(e){if(o[0][e])try{o[0][e]=new _t(o[0][e],{apply:function(t,r,i){return Tt(function(){return n.apply(void 0,[e,o[0]].concat(T(i)))}),t.apply(r,i)}})}catch(e){Ot(e)}});var c=e.apply(t,o);return!u&&c&&"[object Promise]"===Object.prototype.toString.call(c)?c.then(function(e){return Tt(function(){return n("success",o[0],e)}),e}).catch(function(e){throw Tt(function(){return n("fail",o[0],e)}),e}):c}})}catch(e){Ot(e)}}function bt(e,t,n){try{if(!_t||null==e||!e[t])return;e[t]=new _t(e[t],{apply:function(e,t,r){var o="function"==typeof r[0];if(o)try{r[0]=new _t(r[0],{apply:function(e,t,r){var o=e.call.apply(e,[t].concat(T(r)));return Tt(function(){return n(o)}),o}})}catch(e){Ot(e)}var i=e.call.apply(e,[t].concat(T(r)));return o||Tt(function(){return n(i)}),i}})}catch(e){Ot(e)}}function wt(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],o=arguments.length>4?arguments[4]:void 0;try{if(!_t||null==e||!e[t])return;e[t]=new _t(e[t],{apply:function(e,i,a){var u=e.call.apply(e,[i].concat(T(a)));return(!n||!kt[t])&&(Tt(function(){return null==o?void 0:o(u)}),r.forEach(function(e){var t=e.eventName,n=e.isAsync,r=e.proxyEvent;n?St(u,t,r):bt(u,t,r)})),n&&(kt[t]=!0),u}})}catch(e){Ot(e)}}function Tt(e){try{e()}catch(e){Ot(e)}}function Ot(e){pe({log_type:X,message:null==e?void 0:e.message,err_stack:null==e?void 0:e.stack})}var Rt=et,Et=ut,It=tt,xt=nt,Ct=rt,Nt=ot,Pt=at,Lt=it,Mt=function(){var e=!1;return function(){e||(e=!0,St(wx,"login",function(e){"success"===e&&Ye.publish(Rt)}),bt(wx,"onAddToFavorites",function(){Ye.publish(Et)}),bt(wx,"onShareTimeline",function(){Ye.publish(It,{target:"TIME_LINE",trigger:"MENU"})}),bt(wx,"onShareAppMessage",function(){Ye.publish(It,{target:"APP_MESSAGE",trigger:"MENU"})}),bt(wx,"shareAppMessage",function(){Ye.publish(It,{target:"APP_MESSAGE",trigger:"BUTTON"})}),wt(wx,"createGameClubButton",!1,[{isAsync:!1,eventName:"onTap",proxyEvent:function(){Ye.publish(xt)}}],function(){Ye.publish(Ct)}),wt(wx,"getGameServerManager",!0,[{isAsync:!0,eventName:"createRoom",proxyEvent:function(e){"success"===e&&Ye.publish("CREATE_GAME_ROOM")}},{isAsync:!0,eventName:"joinRoom",proxyEvent:function(e){"success"===e&&Ye.publish(Nt)}}]),St(wx,"requestMidasPayment",function(e,t){Ye.publish(Lt,{status:"success"===e?"SUCCESS":"FAIL",quantity:(null==t?void 0:t.buyQuantity)||0,mode:(null==t?void 0:t.mode)||"",platform:(null==t?void 0:t.platform)||"",no:(null==t?void 0:t.outTradeNo)||"",payType:"Midas"})},function(e){Ye.publish(Pt,{quantity:(null==e?void 0:e.buyQuantity)||0,mode:(null==e?void 0:e.mode)||"",platform:(null==e?void 0:e.platform)||"",no:(null==e?void 0:e.outTradeNo)||"",payType:"Midas"})}),St(wx,"requestMidasPaymentGameItem",function(e,t){var n=(t||{}).signData;Ye.publish(Lt,{status:"success"===e?"SUCCESS":"FAIL",quantity:(null==n?void 0:n.buyQuantity)||0,mode:(null==n?void 0:n.mode)||"",platform:(null==n?void 0:n.platform)||"",no:(null==n?void 0:n.outTradeNo)||"",p:(null==n?void 0:n.goodsPrice)||0,productId:(null==n?void 0:n.productId)||"",payType:"MidasGameItem"})},function(e){var t=(e||{}).signData;Ye.publish(Pt,{quantity:(null==t?void 0:t.buyQuantity)||0,mode:(null==t?void 0:t.mode)||"",platform:(null==t?void 0:t.platform)||"",no:(null==t?void 0:t.outTradeNo)||"",p:(null==t?void 0:t.goodsPrice)||0,productId:(null==t?void 0:t.productId)||"",payType:"MidasGameItem"})}))}}(),Dt=function(){function e(){M(this,e)}return j(e,null,[{key:"isEmpty",value:function(e){return null==e||"string"==typeof e&&""===e.trim()}},{key:"format",value:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return e.replace(/\${(\d+)}/g,function(e,t){return n[t]})}},{key:"customStringify",value:function(e){var t=[];try{return JSON.stringify(e,function(e,n){if(void 0===n)return"undefined";if("object"==L(n)&&null!==n){if(-1!==t.indexOf(n))return"[Circular]";t.push(n)}return"bigint"==typeof n?n.toString():n})}catch(e){return"[Param Error]"}}}]),e}(),jt=/^([a-zA-Z][a-zA-Z\d_]{0,63})$/i,qt=/^ams_reserved_(.*)/i,Ut=function(){function e(){M(this,e)}return j(e,null,[{key:"validateActionType",value:function(t){return Dt.isEmpty(t)?(Me.error(e.ERROR_ACTION_TYPE_NULL),!1):!!jt.test(t)||(Me.error(e.ERROR_ACTION_TYPE_INVALID),!1)}},{key:"validateActionParam",value:function(t){if(!t)return!0;if(!Ae(t))return Me.error(e.ERROR_ACTION_PARAM_IS_NOT_OBJECT),!1;for(var n in t){if(Dt.isEmpty(n))return Me.error(e.ERROR_ACTION_PARAM_KEY_NULL),!1;if(!jt.test(n))return Me.error(e.ERROR_ACTION_PARAM_KEY_INVALID),!1;qt.test(n)&&Me.warn(e.WARN_ACTION_PARAM_KEY_RESERVED);var r=t[n];if(!e.isValidValue(r))return Me.error(Dt.format(e.ERROR_ACTION_PARAM_VALUE_INVALID,n,r)),!1;if(ke(r)){if(!e.isValidArrayValue(r)){for(var o=0;o<r.length;o++)Me.error(Dt.format(e.ERROR_ACTION_PARAM_VALUE_ARRAY_INVALID,n,Dt.customStringify(r),o,r[o]));return!1}if(!e.checkArrayElementTypes(r))return Me.error(e.ERROR_ACTION_PARAM_VALUE_ARRAY_TYPE_UNUNIQUE),!1}}return!0}},{key:"isValidValue",value:function(e){return null==e||"string"==typeof e||"number"==typeof e||"boolean"==typeof e||ke(e)}},{key:"isValidArrayValue",value:function(e){for(var t=0;t<e.length;t++){var n=e[t];if("string"!=typeof n&&"number"!=typeof n&&"boolean"!=typeof n)return!1}return!0}},{key:"checkArrayElementTypes",value:function(e){if(!e||e.length<=1)return!0;for(var t=L(e[0]),n=1;n<e.length;n++)if(L(e[n])!==t)return!1;return!0}}]),e}(),Ft=Ut;Ft.ERROR_ACTION_TYPE_NULL="在track方法中,action_type参数不能为空!",Ft.ERROR_ACTION_TYPE_INVALID="在track方法中,action_type参数只能包含字母、数字和下划线,且只能以字母开头,长度不能超过64个字符!",Ft.ERROR_ACTION_PARAM_KEY_NULL="在track方法中,action_param参数的key不能为空!",Ft.ERROR_ACTION_PARAM_KEY_INVALID="在track方法中,action_param参数的key只能包含字母、数字和下划线,且不能以数字开头,长度不能超过64个字符!",Ft.WARN_ACTION_PARAM_KEY_RESERVED="SDK内部预留参数的key均以'ams_reserved_'开头,该参数的值会被SDK内部覆盖,请不要使用!",Ft.ERROR_ACTION_PARAM_VALUE_INVALID="在track方法中,action_param参数的value必须是String/Number/Boolean/Array中的一种![key=${0}, value=${1}]",Ft.ERROR_ACTION_PARAM_VALUE_ARRAY_INVALID="在track方法中,如果action_param参数中的某个元素的value是Array,那么这个Array中的每个元素必须是String/Number/Boolean中的一种![key=${0}, value=${1}, 数组的第${2}个元素为${3}]",Ft.ERROR_ACTION_PARAM_VALUE_ARRAY_TYPE_UNUNIQUE="在track方法中,如果action_param参数中的某个元素的value是Array,那么这个Array中所有元素的类型必须是同一种!",Ft.ERROR_ACTION_PARAM_IS_NOT_OBJECT="action_param 参数不是Object";var Bt={exports:{}};!function(e){!function(t){function n(e,t){var n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n}function r(e,t,r,o,i,a){return n(function(e,t){return e<<t|e>>>32-t}(n(n(t,e),n(o,a)),i),r)}function o(e,t,n,o,i,a,u){return r(t&n|~t&o,e,t,i,a,u)}function i(e,t,n,o,i,a,u){return r(t&o|n&~o,e,t,i,a,u)}function a(e,t,n,o,i,a,u){return r(t^n^o,e,t,i,a,u)}function u(e,t,n,o,i,a,u){return r(n^(t|~o),e,t,i,a,u)}function c(e,t){e[t>>5]|=128<<t%32,e[14+(t+64>>>9<<4)]=t;var r,c,s,l,f,d=1732584193,p=-271733879,v=-1732584194,g=271733878;for(r=0;r<e.length;r+=16)c=d,s=p,l=v,f=g,d=o(d,p,v,g,e[r],7,-680876936),g=o(g,d,p,v,e[r+1],12,-389564586),v=o(v,g,d,p,e[r+2],17,606105819),p=o(p,v,g,d,e[r+3],22,-1044525330),d=o(d,p,v,g,e[r+4],7,-176418897),g=o(g,d,p,v,e[r+5],12,1200080426),v=o(v,g,d,p,e[r+6],17,-1473231341),p=o(p,v,g,d,e[r+7],22,-45705983),d=o(d,p,v,g,e[r+8],7,1770035416),g=o(g,d,p,v,e[r+9],12,-1958414417),v=o(v,g,d,p,e[r+10],17,-42063),p=o(p,v,g,d,e[r+11],22,-1990404162),d=o(d,p,v,g,e[r+12],7,1804603682),g=o(g,d,p,v,e[r+13],12,-40341101),v=o(v,g,d,p,e[r+14],17,-1502002290),d=i(d,p=o(p,v,g,d,e[r+15],22,1236535329),v,g,e[r+1],5,-165796510),g=i(g,d,p,v,e[r+6],9,-1069501632),v=i(v,g,d,p,e[r+11],14,643717713),p=i(p,v,g,d,e[r],20,-373897302),d=i(d,p,v,g,e[r+5],5,-701558691),g=i(g,d,p,v,e[r+10],9,38016083),v=i(v,g,d,p,e[r+15],14,-660478335),p=i(p,v,g,d,e[r+4],20,-405537848),d=i(d,p,v,g,e[r+9],5,568446438),g=i(g,d,p,v,e[r+14],9,-1019803690),v=i(v,g,d,p,e[r+3],14,-187363961),p=i(p,v,g,d,e[r+8],20,1163531501),d=i(d,p,v,g,e[r+13],5,-1444681467),g=i(g,d,p,v,e[r+2],9,-51403784),v=i(v,g,d,p,e[r+7],14,1735328473),d=a(d,p=i(p,v,g,d,e[r+12],20,-1926607734),v,g,e[r+5],4,-378558),g=a(g,d,p,v,e[r+8],11,-2022574463),v=a(v,g,d,p,e[r+11],16,1839030562),p=a(p,v,g,d,e[r+14],23,-35309556),d=a(d,p,v,g,e[r+1],4,-1530992060),g=a(g,d,p,v,e[r+4],11,1272893353),v=a(v,g,d,p,e[r+7],16,-155497632),p=a(p,v,g,d,e[r+10],23,-1094730640),d=a(d,p,v,g,e[r+13],4,681279174),g=a(g,d,p,v,e[r],11,-358537222),v=a(v,g,d,p,e[r+3],16,-722521979),p=a(p,v,g,d,e[r+6],23,76029189),d=a(d,p,v,g,e[r+9],4,-640364487),g=a(g,d,p,v,e[r+12],11,-421815835),v=a(v,g,d,p,e[r+15],16,530742520),d=u(d,p=a(p,v,g,d,e[r+2],23,-995338651),v,g,e[r],6,-198630844),g=u(g,d,p,v,e[r+7],10,1126891415),v=u(v,g,d,p,e[r+14],15,-1416354905),p=u(p,v,g,d,e[r+5],21,-57434055),d=u(d,p,v,g,e[r+12],6,1700485571),g=u(g,d,p,v,e[r+3],10,-1894986606),v=u(v,g,d,p,e[r+10],15,-1051523),p=u(p,v,g,d,e[r+1],21,-2054922799),d=u(d,p,v,g,e[r+8],6,1873313359),g=u(g,d,p,v,e[r+15],10,-30611744),v=u(v,g,d,p,e[r+6],15,-1560198380),p=u(p,v,g,d,e[r+13],21,1309151649),d=u(d,p,v,g,e[r+4],6,-145523070),g=u(g,d,p,v,e[r+11],10,-1120210379),v=u(v,g,d,p,e[r+2],15,718787259),p=u(p,v,g,d,e[r+9],21,-343485551),d=n(d,c),p=n(p,s),v=n(v,l),g=n(g,f);return[d,p,v,g]}function s(e){var t,n="",r=32*e.length;for(t=0;t<r;t+=8)n+=String.fromCharCode(e[t>>5]>>>t%32&255);return n}function l(e){var t,n=[];for(n[(e.length>>2)-1]=void 0,t=0;t<n.length;t+=1)n[t]=0;var r=8*e.length;for(t=0;t<r;t+=8)n[t>>5]|=(255&e.charCodeAt(t/8))<<t%32;return n}function f(e){var t,n,r="0123456789abcdef",o="";for(n=0;n<e.length;n+=1)t=e.charCodeAt(n),o+=r.charAt(t>>>4&15)+r.charAt(15&t);return o}function d(e){return unescape(encodeURIComponent(e))}function p(e){return function(e){return s(c(l(e),8*e.length))}(d(e))}function v(e,t){return function(e,t){var n,r,o=l(e),i=[],a=[];for(i[15]=a[15]=void 0,o.length>16&&(o=c(o,8*e.length)),n=0;n<16;n+=1)i[n]=909522486^o[n],a[n]=1549556828^o[n];return r=c(i.concat(l(t)),512+8*t.length),s(c(a.concat(r),640))}(d(e),d(t))}function g(e,t,n){return t?n?v(t,e):function(e,t){return f(v(e,t))}(t,e):n?p(e):function(e){return f(p(e))}(e)}e.exports?e.exports=g:t.md5=g}(mt)}(Bt);var Vt=yt(Bt.exports),Kt="function"==typeof btoa,Gt="function"==typeof Buffer;"function"==typeof TextDecoder&&new TextDecoder;var Jt,Wt="function"==typeof TextEncoder?new TextEncoder:void 0,Ht=Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=");Jt={},Ht.forEach(function(e,t){return Jt[e]=t});var Yt=String.fromCharCode.bind(String);"function"==typeof Uint8Array.from&&Uint8Array.from.bind(Uint8Array);var Qt=Kt?function(e){return btoa(e)}:Gt?function(e){return Buffer.from(e,"binary").toString("base64")}:function(e){for(var t,n,r,o,i="",a=e.length%3,u=0;u<e.length;){if((n=e.charCodeAt(u++))>255||(r=e.charCodeAt(u++))>255||(o=e.charCodeAt(u++))>255)throw new TypeError("invalid character found");i+=Ht[(t=n<<16|r<<8|o)>>18&63]+Ht[t>>12&63]+Ht[t>>6&63]+Ht[63&t]}return a?i.slice(0,a-3)+"===".substring(a):i},zt=Gt?function(e){return Buffer.from(e).toString("base64")}:function(e){for(var t=[],n=0,r=e.length;n<r;n+=4096)t.push(Yt.apply(null,e.subarray(n,n+4096)));return Qt(t.join(""))},$t=function(e){if(e.length<2)return(t=e.charCodeAt(0))<128?e:t<2048?Yt(192|t>>>6)+Yt(128|63&t):Yt(224|t>>>12&15)+Yt(128|t>>>6&63)+Yt(128|63&t);var t=65536+1024*(e.charCodeAt(0)-55296)+(e.charCodeAt(1)-56320);return Yt(240|t>>>18&7)+Yt(128|t>>>12&63)+Yt(128|t>>>6&63)+Yt(128|63&t)},Zt=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,Xt=Gt?function(e){return Buffer.from(e,"utf8").toString("base64")}:Wt?function(e){return zt(Wt.encode(e))}:function(e){return Qt(function(e){return e.replace(Zt,$t)}(e))},en=Object.defineProperty,tn=Object.getOwnPropertyDescriptor,nn=function(e,t,n,r){for(var o,i=r>1?void 0:r?tn(t,n):t,a=e.length-1;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&en(t,n,i),i},rn=function(){function e(t){var n=this;M(this,e),this.cgiBatchSize=Y.cgiBatchSize,this.reportThreshold=Y.reportThreshold,this.reportDelay=Y.reportDelay,this.triggerExecuteSend=function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=[];return function(){for(var o=arguments.length,i=new Array(o),a=0;a<o;a++)i[a]=arguments[a];return clearTimeout(t),t=setTimeout(function(){var t=e.apply(void 0,i);r.forEach(function(e){return e(t)}),r=[]},n),new Promise(function(e){return r.push(e)})}}(function(){n.executeSend()},1e3*this.reportDelay),this.inspectDelay=Y.inspectDelay,this.inspectTimer=void 0,this.isNeedContinueSend=!1,this.getBaseInfo=t.getBaseInfo,this.reportLog=t.reportLog,this.queueManager=t.queueManager,this.configManager=t.configManager,this.onReportComplete=t.onReportComplete,this.onReportFail=t.onReportFail,this.flushSend(),this.startInspectTimer()}return j(e,[{key:"batchSend",value:function(){var e,t=this.queueManager.getReportableActions(this.reportThreshold);if(t.length>=this.reportThreshold)this.executeSend();else{var n=(null==(e=this.configManager)?void 0:e.getRealTimeActionList())||Y.realTimeActionList;t.some(function(e){return n.indexOf(e.action_type)>-1&&!e.is_retry})?this.executeSend():this.triggerExecuteSend()}this.startInspectTimer()}},{key:"flushSend",value:function(){this.executeSend()}},{key:"executeSend",value:function(){var t=this;if(e.currentRequestCount>=e.requestConcurrency)this.isNeedContinueSend=!0;else{this.isNeedContinueSend=!1;var n=(e.requestConcurrency-e.currentRequestCount)*this.cgiBatchSize,r=this.queueManager.getReportableActions(n),o=this.getBaseInfo();if(!o.openid&&!o.unionid&&(Me.warn("请尽快调用 setOpenId 或 setUnionId 方法设置用户ID!"),r=r.filter(function(e){return null==e?void 0:e.ad_trace_id})),!(r.length<=0)){n<this.queueManager.getReportableActionsLength()&&(this.isNeedContinueSend=!0),e.currentRequestCount+=Math.ceil(r.length/this.cgiBatchSize);for(var i=[],a=0;a<r.length;a+=this.cgiBatchSize){var u=this.generateActionReportParams(r.slice(a,a+this.cgiBatchSize));i.push(this.report(u))}Promise.all(i).then(function(e){var n=e.some(function(e){return e>=0});t.isNeedContinueSend&&n&&t.executeSend()}).catch(function(e){Me.error(e),t.reportLog({message:"executeSend catch: ".concat(e.message),log_type:Q,err_stack:e.stack})})}}}},{key:"generateActionReportParams",value:function(e){var t=[],n=[],r=this.getBaseInfo();return e.forEach(function(e){n.push(e.action_id);var r=Object.assign({},e);delete r.inner_status,t.push(r)}),{data:{info:r,actions:t},actionIdList:n}}},{key:"dealSuccessData",value:function(e,t,n){[51001,51003].indexOf(null==e?void 0:e.code)>-1?this.queueManager.updateActionsForReportFail(t):this.queueManager.removeActions(t),0!==(null==e?void 0:e.code)&&(this.reportLog({log_type:z,code:null==e?void 0:e.code,message:"trace_id: ".concat(null==e?void 0:e.trace_id,",msg: ").concat(null==e?void 0:e.message)}),Me.error("上报失败:",e)),this.doTrackCallbackFn(this.onReportComplete,e,n),-1===[0,51001,51003].indexOf(null==e?void 0:e.code)&&this.doTrackCallbackFn(this.onReportFail,e,n)}},{key:"dealFailData",value:function(e,t,n){this.queueManager.updateActionsForReportFail(t),this.reportLog({log_type:z,code:e.code,message:e.message}),Me.error("上报失败:",e),this.doTrackCallbackFn(this.onReportComplete,e,n)}},{key:"report",value:function(t){var n=this,r=t.data,o=t.actionIdList;return this.queueManager.updateActionsForReporting(o),Me.debug&&(Me.info("上报行为类型: ","【".concat(r.actions.map(function(e){return e.action_type}).join("、"),"】")),Me.info("上报请求参数: ",r)),new Promise(function(t){var i,a,u,c,s,l,f,d,p=Date.now();try{var v=function(e){var t="",n=null==e?void 0:e.appid,r=null==e?void 0:e.secret_key,o=null==e?void 0:e.sdk_version,i=null==e?void 0:e.timestamp;if(!(n&&r&&o&&i&&32===r.length))return t;for(var a=Vt(o+n+i),u=0;u<32;u++)t+=u%2==0?r[u]:a[u];return t}({appid:null==(i=null==r?void 0:r.info)?void 0:i.appid,secret_key:null==(a=null==r?void 0:r.info)?void 0:a.secret_key,sdk_version:null==(u=null==r?void 0:r.info)?void 0:u.sdk_version,timestamp:p}),g=function(e){return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?function(e){return e.replace(/=/g,"").replace(/[+\/]/g,function(e){return"+"==e?"-":"_"})}(Xt(e)):Xt(e)}(JSON.stringify(r));f={"Client-Time":p,"Sign-Value":Vt(g+(null==(c=null==r?void 0:r.info)?void 0:c.user_action_set_id)+(null==(s=null==r?void 0:r.info)?void 0:s.secret_key)+v),"Sign-Version":Y.signVersion,"content-type":"text/plain;charset=UTF-8"},d=g}catch(v){f={"Client-Time":p},d=r,n.reportLog({log_type:te,message:"sign error msg: ".concat(null==v?void 0:v.message),err_stack:null==v?void 0:v.stack}),Me.error(v)}wx.request({url:"https://api.datanexus.qq.com/data-nexus-cgi/miniprogram",method:"POST",timeout:(null==(l=n.configManager)?void 0:l.getRequestTimeout())||Y.requestTimeout,header:f,data:d,success:function(i){var a,u;Me.devLog("上报接口返回码:",null==(a=null==i?void 0:i.data)?void 0:a.code);var c=(null==(u=null==i?void 0:i.header)?void 0:u["Server-Time"])||-1;if(ve.revise(c),e.currentRequestCount-=1,200===(null==i?void 0:i.statusCode))return n.dealSuccessData(null==i?void 0:i.data,o,r),void t((null==i?void 0:i.data).code);var s="";try{s="object"==L(null==i?void 0:i.data)?JSON.stringify(null==i?void 0:i.data):null==i?void 0:i.data}catch(e){Me.error(e)}var l={code:"number"==typeof(null==i?void 0:i.statusCode)?-1*i.statusCode:-888,message:"statusCode: ".concat(null==i?void 0:i.statusCode,", data: ").concat(s)};n.dealFailData(l,o,r),t(l.code)},fail:function(i){Me.devLog("上报失败:",i),e.currentRequestCount-=1;var a={code:"number"==typeof(null==i?void 0:i.errno)?-1*i.errno:-999,message:null==i?void 0:i.errMsg};n.dealFailData(a,o,r),t(a.code)}})})}},{key:"startInspectTimer",value:function(){var t=this;clearTimeout(this.inspectTimer),this.inspectTimer=setTimeout(function(){e.currentRequestCount>=e.requestConcurrency&&(e.currentRequestCount=e.requestConcurrency-1),t.executeSend(),t.startInspectTimer()},1e3*this.inspectDelay)}},{key:"doTrackCallbackFn",value:function(e,t,n){if("function"==typeof e)try{for(var r=[],o=0;o<n.actions.length;o++)if(!n.actions[o].is_sdk_auto_track){var i=n.actions[o],a=i.action_type,u=i.action_param,c=i.action_id,s=i.action_time;r.push({action_type:a,action_param:u,action_id:c,action_time:s})}if(r.length){var l=n.info,f=l.user_action_set_id,d=l.appid,p=l.openid,v=l.unionid,g=l.user_unique_id;e({code:null==t?void 0:t.code,message:null==t?void 0:t.message,data:{actions:r,info:{user_action_set_id:f,appid:d,openid:p,unionid:v,user_unique_id:g}}})}}catch(r){Me.error("返回上报回调数据异常:",r)}}}],[{key:"setRequestConcurrency",value:function(t){"number"==typeof t?t<1?Me.error("网络请求最大并发量不能小于1"):t>10?Me.error("网络请求最大并发量不能大于10"):e.requestConcurrency=t:Me.error("网络请求最大并发量需设置为数字")}}]),e}(),on=rn;on.currentRequestCount=0,on.requestConcurrency=Y.requestConcurrency,nn([je],on.prototype,"batchSend",1),nn([je],on.prototype,"flushSend",1),nn([je],on.prototype,"executeSend",1);var an=ze,un=$e,cn=Ze,sn=Xe,ln=et,fn=ut,dn=tt,pn=nt,vn=rt,gn=ot,hn=at,mn=it,yn=function(){function e(){M(this,e)}return j(e,[{key:"install",value:function(e,t){var n=function(t){Ye.subscribe(t,function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(r){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};e.track(t,Object.assign(n||{},o,w(w({},Cn,!0),Nn,r)))}}(t))};n(un),n(an),n(cn),n(sn),"all"===t&&(n(ln),n(fn),n(dn),n(vn),n(pn),n("CREATE_GAME_ROOM"),n(gn),n(hn),n(mn))}}]),e}(),_n=function(){function e(){M(this,e),this.special_method_symbol=Symbol("special_method_symbol")}return j(e,[{key:"onPurchase",value:function(e){return"number"!=typeof e&&Me.warn("付费金额需要为数字"),e<=0&&Me.warn("付费金额需要大于0"),this.wrapTrack("PURCHASE",{value:e})}},{key:"onEnterForeground",value:function(){return this.wrapTrack("ENTER_FOREGROUND")}},{key:"onEnterBackground",value:function(){return this.wrapTrack("ENTER_BACKGROUND")}},{key:"onAppStart",value:function(){return this.wrapTrack("START_APP")}},{key:"onAppQuit",value:function(){return this.wrapTrack("APP_QUIT")}},{key:"onAddToWishlist",value:function(){return this.wrapTrack("ADD_TO_WISHLIST")}},{key:"wrapTrack",value:function(e,t){return this.track(e,Object.assign(t||{},w({},this.special_method_symbol,1)))}}]),e}(),An=function(){E(t,_n);var e=x(t);function t(){return M(this,t),e.apply(this,arguments)}return j(t,[{key:"onRegister",value:function(){return this.wrapTrack("REGISTER")}},{key:"onCreateRole",value:function(e){return e&&"string"!=typeof e&&Me.warn("角色名称需要为字符串"),this.wrapTrack("CREATE_ROLE",e?{name:e}:{})}},{key:"onTutorialFinish",value:function(){return this.wrapTrack("TUTORIAL_FINISH")}}]),t}(),kn="(如果确认无误,请忽略该提示)",Sn=function(){var e=[];return{requestActionList:function(){try{ge({conf_name:"data_nexus_common",conf_key:"action_types"}).then(function(t){ke(t)&&(e=t)})}catch(e){Me.error(e)}},getActionList:function(){return e}}}();function bn(e,t){try{e.is_sdk_auto_track||(function(e){try{var t=Sn.getActionList();if(!t.includes(e)){var n,r=function(e){var t="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!t){if(Array.isArray(e)||(t=O(e))){t&&(e=t);var n=0,r=function(){};return{s:r,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,i=!0,a=!1;return{s:function(){t=t.call(e)},n:function(){var e=t.next();return i=e.done,e},e:function(e){a=!0,o=e},f:function(){try{i||null==t.return||t.return()}finally{if(a)throw o}}}}(t);try{for(r.s();!(n=r.n()).done;){var o=n.value;if(wn(o,e)<=parseInt((.3*o.length).toString())){Me.warn("通过SDK上报的".concat(e,"行为名称可能有误,请检查该行为类型是否为腾讯广告提供的标准行为!").concat(kn));break}}}catch(e){r.e(e)}finally{r.f()}}}catch(t){Me.error(t)}}(e.action_type),"minigame"===t?function(e,t){var n,r,o;try{["PURCHASE","ADD_TO_CART"].includes(e.action_type)&&e.action_param&&Ne(e.action_param,"value")&&("number"!=typeof(null==(n=e.action_param)?void 0:n.value)?Me.warn("通过SDK上报的".concat(e.action_type,"行为携带的金额参数需要为数字!")):(null==(r=e.action_param)?void 0:r.value)<=0?Me.warn("通过SDK上报的".concat(e.action_type,"行为携带的金额参数需要大于0!")):"minigame"===t&&(null==(o=e.action_param)?void 0:o.value)<100&&Me.warn("通过SDK上报的".concat(e.action_type,"行为携带的金额参数可能有误,金额的单位为‘分’,请检查金额是否正确!").concat(kn)))}catch(e){Me.error(e)}}(e,t):"miniprogram"===t&&function(e){try{var t=null==e?void 0:e.action_type,n=(null==e?void 0:e.action_param)||{};"PURCHASE"===t&&Ne(n,"value")&&("number"!=typeof(null==n?void 0:n.value)?Me.warn("通过SDK上报的".concat(t,"行为携带的金额参数需要为数字!")):(null==n?void 0:n.value)<=0&&Me.warn("通过SDK上报的".concat(t,"行为携带的金额参数需要大于0!")))}catch(t){Me.error(t)}}(e))}catch(e){Me.error(e)}}function wn(e,t){try{if(0===e.length)return t.length;if(0===t.length)return e.length;for(var n=[],r=0;r<=t.length;r++)n[r]=[r];for(var o=0;o<=e.length;o++)n[0][o]=o;for(var i=1;i<=t.length;i++)for(var a=1;a<=e.length;a++)t.charAt(i-1)===e.charAt(a-1)?n[i][a]=n[i-1][a-1]:n[i][a]=Math.min(n[i-1][a-1]+1,n[i][a-1]+1,n[i-1][a]+1);return n[t.length][e.length]}catch(n){Me.error(n)}}function Tn(e){try{e&&!/^[a-zA-Z0-9_\-]+$/.test(e)&&Me.warn("通过SDK上报的openid:".concat(e,"可能有误,请检查openid是否正确!").concat(kn))}catch(e){Me.error(e)}}var On,Rn=Object.defineProperty,En=Object.getOwnPropertyDescriptor,In=function(e,t,n,r){for(var o,i=r>1?void 0:r?En(t,n):t,a=e.length-1;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&Rn(t,n,i),i},xn=Symbol("initializedInstance"),Cn=Symbol("autoTrack"),Nn=Symbol("actionTime"),Pn=function(){E(t,An);var e=x(t);function t(n){var r;if(M(this,t),(r=e.call(this)).env="production",r.sdk_version="1.5.5",r.sdk_name="@dn-sdk/minigame",r.deviceInfo={},r.gameInfo={},r.session_id="",r.log_id=0,r.inited=!1,r.initErrMsg="",null==wx||!wx.createCanvas)return r.initErrMsg="不支持非微信小游戏中使用",Me.error(r.initErrMsg),C(r);var o=Ce();if(t[xn].length>=o.maxSdkInstance)return r.initErrMsg="初始化超过上限",Me.error(r.initErrMsg),C(r);var i=function(e){return Ae(e)?(function(e){var t=["user_action_set_id","secret_key","appid","openid","unionid","user_unique_id","auto_track","auto_attr","on_report_fail","on_report_complete"];for(var n in e)t.includes(n)||Me.warn("Invalid property '".concat(n,"' found in config"))}(e),"number"!=typeof e.user_action_set_id?"user_action_set_id 参数需为 number 类型":e.user_action_set_id<=0?"user_action_set_id 参数需大于 0":"string"!=typeof e.secret_key?"secret_key 参数需为 string 类型":""===e.secret_key.trim()?"缺少 secret_key 参数":32!==e.secret_key.length?"secret_key 参数需为 32 位字符串":"string"!=typeof e.appid?"appid 参数需为 string 类型":""!==e.appid.trim()||"缺少 appid"):"初始化参数需为 object 类型"}(n),a=fe();if(!0!==i)return r.initErrMsg=i,Me.error(i),C(r);var u=null==a?void 0:a.appId;if(u&&u!==n.appid)return r.initErrMsg="初始化传入的appid与当前小游戏appid不一致",Me.error(r.initErrMsg),C(r);r.config=n,Ne(n,"auto_track")||(r.config.auto_track=xe("autoTrack")),r.openid=n.openid,r.unionid=n.unionid,r.user_unique_id=n.user_unique_id,r.onReportComplete=n.on_report_complete,r.onReportFail=n.on_report_fail,r.saveValidOpenidToStorage();var c=n.user_action_set_id;return t[xn].includes(c)?(r.initErrMsg="同个数据源[".concat(c,"]只能初始化一次"),Me.error(r.initErrMsg),r.reportLog({log_type:Q,message:r.initErrMsg}),C(r)):(r.reportLog=r.reportLog.bind(N(r)),r.getTrackBaseInfo=r.getTrackBaseInfo.bind(N(r)),r.deviceInfo=ue(),r.gameInfo=De(),r.session_id=we(),r.queueManage=new Je({userActionSetId:c,maxLength:o.maxQueueLength,ogEvents:Qe}),r.actionReporter=new on({getBaseInfo:r.getTrackBaseInfo,reportLog:r.reportLog,queueManager:r.queueManage,configManager:ft,onReportComplete:r.onReportComplete,onReportFail:r.onReportFail}),r.inited=!0,t[xn].push(c),r.useAutoTrack(),r.doReportOnEnterBackground(),"release"===(null==a?void 0:a.envVersion)?(Me.info("初始化成功"),C(r)):(function(e){var t=e.sdk_version,n=e.default_download_url,r=e.fail_handler;ge({conf_name:e.conf_name,conf_key:e.conf_key}).then(function(e){if(Ae(e)){var o=null==e?void 0:e.blackVersions,i=null==e?void 0:e.minVersion,a=null==e?void 0:e.bestVersion,u=null==e?void 0:e.downloadUrl,c=n;return u&&/^https/.test(u)&&(c=u),ke(o)&&(null==o?void 0:o.indexOf(t))>-1?(null==r||r(),void Me.error("初始化失败!当前SDK版本存在兼容问题,请尽快升级至最新版!下载地址:".concat(c))):i&&Ie(t,i)<0?(null==r||r(),void Me.error("初始化失败!当前SDK版本过低,请尽快升级至最新版!下载地址:".concat(c))):(a&&Ie(t,a)<0&&Me.warn("新版本SDK已上线,强烈建议您升级至最新版,尽早享受新特性!下载地址:".concat(c)),void Me.info("初始化成功"))}Me.info("初始化成功")}).catch(function(){Me.info("初始化成功")})}({conf_name:"mini_game_sdk_common",conf_key:"version",sdk_version:r.sdk_version,default_download_url:"https://sr-home-1257214331.cos.ap-guangzhou.myqcloud.com/sdk/dn-sdk-minigame/dn-sdk-minigame.zip",fail_handler:function(){r.inited=!1}}),Sn.requestActionList(),Tn(n.openid),C(r)))}return j(t,[{key:"getInitResult",value:function(){return{inited:this.inited,initErrMsg:this.initErrMsg}}},{key:"track",value:function(e,t){var n,r;if(!this.inited||!this.queueManage)return Me.error("上报失败,请先完成初始化"),{code:100,message:"未完成初始化或重复初始化导致初始化失败,请先完成初始化"};var o=Ft.validateActionType(e),i=Ft.validateActionParam(t);if(o&&i){!this.openid&&!this.unionid&&Me.warn("缺少 openid 或 unionid");var a=xe("actionParamMaxLength");if(JSON.stringify(t||{}).length>a)return Me.error("监测到超过".concat(a,"的上报日志:").concat(e," ").concat(t)),{code:102,message:"action_param 参数过大,不能超过 ".concat(a," 字符")};var u=!(null==t||!t[Cn]),c=this.createAction(e,t||{},u);"release"!==(null==(n=fe())?void 0:n.envVersion)&&bn(c,"minigame");var s=this.queueManage.addAction(c);return null==(r=this.actionReporter)||r.batchSend(),s}return{code:101,message:"action_type 或 action_param 参数错误"}}},{key:"flush",value:function(){var e;null==(e=this.actionReporter)||e.flushSend()}},{key:"setOpenId",value:function(e){var t;if(e&&"string"==typeof e)return this.openid=e,this.gameInfo.ad_trace_id&&!ae.getSync(W)&&Ye.publish("START_APP"),this.flush(),this.saveValidOpenidToStorage(),"release"!==(null==(t=fe())?void 0:t.envVersion)&&Tn(e),{code:0,message:"成功"};var n="openid 格式错误";return Me.error(n),{code:101,message:n}}},{key:"setUnionId",value:function(e){if(e&&"string"==typeof e)return this.unionid=e,this.flush(),{code:0,message:"成功"};var t="unionid 格式错误";return Me.error(t),{code:101,message:t}}},{key:"setUserUniqueId",value:function(e){if(e&&"string"==typeof e)return this.user_unique_id=e,{code:0,message:"成功"};var t="user_unique_id 格式错误";return Me.error(t),{code:101,message:t}}},{key:"doReportOnEnterBackground",value:function(){var e=this;wx.onHide(function(){var t,n;null==(t=e.actionReporter)||t.flushSend(),null==(n=e.queueManage)||n.reportLostNum()})}},{key:"getTrackBaseInfo",value:function(){var e=fe();return Object.assign({},this.deviceInfo,function(e){var t={};return["user_action_set_id","appid","openid","secret_key","user_unique_id","unionid"].forEach(function(n){Ne(e,n)&&(t[n]=e[n])}),t}(this.config),{local_id:ce(),sdk_name:this.sdk_name,sdk_version:this.sdk_version,openid:this.openid||le(),unionid:this.unionid,user_unique_id:this.user_unique_id,inner_param:{app_env_version:e.envVersion,app_version:e.version}})}},{key:"createAction",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];null!=t&&t[Cn]&&delete t[Cn];var r=Date.now();null!=t&&t[Nn]&&(r=null==t?void 0:t[Nn],delete t[Nn]);var o={action_id:we(),action_param:t,action_time:r,action_type:e,is_retry:!1,is_sdk_auto_track:n,retry_count:0,revised_action_time:ve.getRevisedcurrentTimeMillis(),log_id:++this.log_id,session_id:this.session_id,pkg_channel_id:this.gameInfo.pkg_channel_id,source_scene:this.gameInfo.source_scene,network_type:se(),ad_trace_id:this.gameInfo.ad_trace_id,channel:this.getChannelByActionType(e)};return null!=t&&t[this.special_method_symbol]&&(this.addActionInnerParam(o,"is_special_method",!0),delete t[this.special_method_symbol]),ft.getChannelClaimActionList().indexOf(e)>-1&&this.gameInfo.launch_options&&this.addActionInnerParam(o,"launch_options",this.gameInfo.launch_options),o}},{key:"addActionInnerParam",value:function(e,t,n){e.inner_param&&Ae(e.inner_param)?e.inner_param[t]=n:e.inner_param=w({},t,n)}},{key:"getChannelByActionType",value:function(e){var t="";return ft.getChannelClaimActionList().indexOf(e)>-1?t=this.gameInfo.channel||"":ft.getNoClaimActionList().indexOf(e)>-1&&(t="UNKNOWN"),t}},{key:"reportLog",value:function(e){var t,n,r={user_action_set_id:null==(t=this.config)?void 0:t.user_action_set_id,appid:null==(n=this.config)?void 0:n.appid,session_id:this.session_id};pe(Object.assign(r,e))}},{key:"useAutoTrack",value:function(){var e;if(null!=(e=this.config)&&e.auto_track){var t=!0,n=ae.getSync(G);(null==n?void 0:n.ap)===re?t=!0:(null==n?void 0:n.ap)===oe&&(t=!1),"devtools"===ue().wx_platform&&(t=!0),(new yn).install(this,t?"all":"lifecycle"),ht(),t&&Mt(),this.getAutoProxyRemoteConfig()}}},{key:"getAutoProxyRemoteConfig",value:function(){var e,t,n=ue();n.os&&n.os_version&&null!=(e=this.config)&&e.user_action_set_id&&function(e){return new Promise(function(t){wx.request({method:"POST",url:"https://api.datanexus.qq.com/data-nexus-config/v1/sdk/minigame/get",data:e,timeout:Y.requestTimeout,success:function(e){he(e,t,"minigame/get"),ye(e)},fail:function(e){me(e,"minigame/get")}})})}({conf_name:"MG",conf_param:{user_action_set_id:null==(t=this.config)?void 0:t.user_action_set_id,sdk_version:this.sdk_version,os_type:(null==n?void 0:n.os)||"",os_version:Pe(n.os_version),device_brand:(null==n?void 0:n.device_brand)||"",weixin_lib_version:(null==n?void 0:n.wx_lib_version)||"",weixin_version:(null==n?void 0:n.wx_version)||""}}).then(function(e){Ae(e)&&ae.setSync(G,e)})}},{key:"saveValidOpenidToStorage",value:function(){this.openid&&function(e){return/^[a-zA-Z0-9_-]{28,30}$/.test(e)}(this.openid)&&ae.setSync(W,this.openid)}}],[{key:"setRequestConcurrency",value:function(e){on.setRequestConcurrency(e)}},{key:"setDebug",value:function(e){Me.debug=e}}]),t}(),Ln=Pn;Ln[xn]=[],In([je],Ln.prototype,"track",1),In([je,function(e,t,n){var r=n.value;return n.value=function(){if(this.inited){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return r.apply(this,t)}Me.error("上报失败,请先完成初始化")},n}],Ln.prototype,"flush",1),In([je],Ln.prototype,"setOpenId",1),In([je],Ln.prototype,"setUnionId",1),In([je],Ln.prototype,"setUserUniqueId",1),In([je],Ln.prototype,"doReportOnEnterBackground",1),In([je],Ln.prototype,"getTrackBaseInfo",1),In([je],Ln.prototype,"useAutoTrack",1);var Mn=0,Dn={moid:""},jn=!1,qn=JSON.stringify(wx.getLaunchOptionsSync()||""),Un={token:"",uid:"",uname:"",openid:""},Fn={partner_id:"",game_id:"",pkg_name:"",version:""},Bn={doid:"",dsid:"",dsname:"",dext:"",drid:"",drname:"",drlevel:"",dmoney:"",money:""},Vn="wx-adapter sdk >>>>>>>:";wx.hideShareMenu(),wx.onShow(function(e){e.query&&(qn=JSON.stringify(e))});var Kn=function(e){var t=r(r({},k()),_),n=p(r(r(r(r(r({},Bn),Un),Fn),t),{},{launchoption:qn,onshow:qn}));m(h,"/wxgamemds/index/",n).then(function(t){t.state&&(t.data.balance>=e?Jn(""):Gn(t.data,e))}).catch(function(e){console.log(e)})},Gn=function(e,t){wx.requestMidasPayment({mode:"game",env:e.env,offerId:e.offerId,currencyType:e.currencyType,platform:e.platform,buyQuantity:e.buyQuantity,outTradeNo:Dn.moid,success:function(e){On&&On.onPurchase(100*t),Jn(e)},fail:function(e){console.log(e)}})},Jn=function(e){var t;Mn++;var n=r(r({},k()),_);t=p(e?r(r(r(r(r(r({},Bn),Fn),Un),n),Dn),{},{res:JSON.stringify(e),launchoption:qn,onshow:qn}):r(r(r(r(r(r({},Bn),Fn),Un),Dn),n),{},{launchoption:qn,onshow:qn})),m(h,"/wxgamemds/send/",t).then(function(e){console.log(e)}).catch(function(t){console.log(t),Mn<3&&setTimeout(function(){Jn(e)},1e3)})},Wn=function(e){return new Promise(function(t,n){var o=Un||{},i=o.token,a=o.uid,c=o.uname;if(!(jn&&i&&a&&c))return u("未激活或未登录,请重新进入游戏"),n({state:100001,msg:"未激活或未登录,请检查"});var s=p(r(r(r(r(r({},e),Un),Fn),r(r({},k()),_)),{},{launchoption:qn,onshow:qn}));m(h,"/wxgameevent/index/",s).then(function(){t(),On&&("create"===s.event&&On.onCreateRole(s.drname),"levelup"===s.event&&On.track("UPDATE_LEVEL",{level:s.drlevel,power:0}))}).catch(function(e){console.log(e),n({state:100002,msg:"角色上报失败"})})})},Hn=null,Yn=!1,Qn=!1,zn=function(e){return new Promise(function(t,n){if(!jn)return n({state:100001,msg:"上报前请先激活"});if(!Array.isArray(e))return n({state:100002,msg:"入参需要数组,请检查"});if(!e.length)return n({state:100003,msg:"入参不能为数组空,请检查"});var r=e.map(function(e){return{package:c,partner_id:4,game_id:Fn.game_id,event_name:e.event_name,game_name:Fn.game_name,account_id:Un.uid||"",app_version:Fn.version,distinct_id:b().duid,event_params:e.event_params,event_time:(t=new Date,n=t.getFullYear(),r=String(t.getMonth()+1).padStart(2,"0"),o=String(t.getDate()).padStart(2,"0"),i=String(t.getHours()).padStart(2,"0"),a=String(t.getMinutes()).padStart(2,"0"),u=String(t.getSeconds()).padStart(2,"0"),"".concat(n,"-").concat(r,"-").concat(o," ").concat(i,":").concat(a,":").concat(u))};var t,n,r,o,i,a,u});y(h,"/report/batch/event",{body:r}).then(function(){t({state:0,msg:"上报成功!"})}).catch(function(e){n({state:100004,msg:JSON.stringify(e)})})})};e.jf_SSEventReport=zn,e.jf_SSUserPropsReport=function(e){return new Promise(function(t,n){if(!jn)return n({state:100001,msg:"上报前请先激活"});if(!Array.isArray(e))return n({state:100002,msg:"入参需要数组,请检查"});if(!e.length)return n({state:100003,msg:"入参不能为数组空,请检查"});var r=e.map(function(e){return{partner_id:4,game_id:Fn.game_id,distinct_id:b().duid,account_id:Un.uid||"",game_name:Fn.game_name,event_params:e.event_params}});y(h,"/report/batch/attribute",{body:r}).then(function(){t({state:0,msg:"上报成功!"})}).catch(function(e){n({state:100004,msg:JSON.stringify(e)})})})},e.jf_active=function(e){return new Promise(function(t,n){if(!e)return n({state:100001,msg:"激活入参缺失"});if(null==e||!e.wx)return n({state:100002,msg:"激活入参 wx 属性缺失"});var r=e.wx,o=r.game_id,i=r.version,a=r.dn_sdk_id,u=r.dn_secret_key,s=r.game_name;if(!o)return n({state:100003,msg:"激活入参 game_id 属性缺失"});Fn.game_id=o,Fn.game_name=s,Fn.version=i,Fn.pkg_name=c,Fn.partner_id=4,jn=!0,console.log("active 激活成功!"),a&&u&&function(e){var t=e.dn_sdk_id,n=e.dn_secret_key,r=e.app_id,o=(On=new Ln({appid:r,secret_key:n,user_action_set_id:t})).getInitResult();null!=o&&o.inited||console.error("dnSdk init failed: ",o.initErrMsg),On.onAppStart(),wx.onAddToFavorites(function(e){console.log(Vn+"click onAddToFavorites"),On&&On.track("DD_TO_WISHLIST",{type:"default"})}),wx.onShareAppMessage(function(){console.log(Vn+"click onShareAppMessage"),On&&On.track("SHARE",{target:"APP_MESSAGE"})}),wx.onShareTimeline(function(){console.log(Vn+"click onShareTimeline"),On&&On.track("SHARE",{target:"TIME_LINE"})}),console.log(Vn+"广点通初始化成功!")}(wx),t(),zn([{event_name:"game_open",event_params:{}}])})},e.jf_createRewardedVideoAd=function(e){var t=function(){return new Promise(function(t,n){if(Yn)return t();Hn&&(Hn=null),(Hn=wx.createRewardedVideoAd({adUnitId:e})).onError(function(e){Yn=!1,Hn=null,n({state:100004,msg:"广告平台异常",originalErr:e})}),Hn.load().then(function(){console.log("激励视频广告预加载成功"),Yn=!0,t()}).catch(function(e){console.error("激励视频广告预加载失败:",e),Yn=!1,Hn=null,n(e)})})},n=function(){return Qn?Promise.reject({state:100004,msg:"广告正在展示中,请稍后再试"}):Yn?Hn?(Qn=!0,new Promise(function(e,t){Hn.onClose(function(t){console.log("激励视频广告关闭,是否看完:",t.isEnded),e({isEnded:t.isEnded}),Qn=!1,Hn.offClose()}),Hn.show().then(function(){console.log("激励视频广告展示成功")}).catch(function(e){Yn=!1,Qn=!1,t({state:100003,msg:JSON.stringify(e)})})})):Promise.reject({state:100002,msg:"广告实例不存在"}):t().then(n).catch(function(e){return Promise.reject({state:100001,msg:JSON.stringify(e)})})};return{preload:t,show:n}},e.jf_customerService=function(e){wx.openCustomerServiceConversation({success:function(){Wn(r(r({},g(e)),{},{event:"kfclick"}))}})},e.jf_getUserInfo=function(){return new Promise(function(e,t){wx.getSetting({success:function(n){n.authSetting["scope.userInfo"]?wx.getUserInfo({success:function(t){return e(t.userInfo)},fail:function(e){return t({state:100001,msg:JSON.stringify(e)})}}):wx.getUserProfile({desc:"获取用户信息",success:function(t){return e(t.userInfo)},fail:function(e){return t({state:100002,msg:JSON.stringify(e)})}})}})})},e.jf_login=function(){return new Promise(function(e,t){if(!jn)return t({state:100003,msg:"登录前请先激活"});wx.login({success:function(n){var o=p(r(r(r({code:n.code},Fn),b()),{},{launchoption:qn,onshow:qn}));m(h,"/wxgamelogin/initlogin/",o).then(function(n){if(1==n.state){var r=n.data,o=r.token,i=r.uid,a=r.uname,c=r.openid,s=r.show_page;if(Un.token=o,Un.uid=i,Un.uname=a,Un.openid=c,wx.setStorageSync("jfGamekitSSToken",o),e({token:o,uid:i,uname:a,partner_id:4,show_page:s}),console.log(Vn+"登录成功"),c&&On){var l=n||{},f=l.backFlowDay,d=l.isRegisterUser;!function(e){var t=e.openid,n=e.nsSdk,r=e.backFlowDay,o=e.isRegisterUser;n.setOpenId(t),o?n.onRegister():r&&r>=30&&n.track("RE_ACTIVE",{backFlowDay:30})}({openid:c,nsSdk:On,backFlowDay:f,isRegisterUser:d})}zn([{event_name:"account_login",event_params:{}}])}else u(n.msg),t({state:n.state,msg:n.msg})}).catch(function(e){u(e),t({state:100001,msg:e})})},fail:function(e){t({state:100002,msg:e})}})})},e.jf_pay=function(e){return new Promise(function(t,n){var o=Un||{},i=o.token,a=o.uid,c=o.uname;if(!(jn&&i&&a&&c))return u("失败!请先激活登录"),n({state:100001,msg:"未激活或未登录,请重新进入游戏"});wx.showLoading({title:"加载中"});var s=e.dmoney;(Bn=g(e)||{}).money=s;var l=p(r(r(r(r(r({},e),Fn),Un),r(r(r({},k()),S()),_)),{},{money:s,launchoption:qn,onshow:qn}));m(h,"/wxgameorder/index/",l).then(function(e){var r=e||{},o=r.state,i=r.msg,a=r.data,c=void 0===a?{}:a;if(1==o){var l=c.aid,f=c.moid,d=c.thumb_url;Dn.moid=f,1==l?(Kn(s),t({msg:"ok"})):2==l?wx.showModal({title:"支付提示",content:"即将打开充值入口,输入“充值”或点击右下角卡片即可充值。",showCancel:!1,confirmText:"点我充值",success:function(e){e.confirm?wx.openCustomerServiceConversation({sessionFrom:f,sendMessagePath:"/path/index/index?moid="+f,showMessageCard:!0,sendMessageImg:d,success:function(e){console.log("openCustomerServiceConversation success",e),t()},fail:function(e){console.error("openCustomerServiceConversation fail ",e),n({state:100003,msg:"支付失败"})},complete:function(e){console.log("openCustomerServiceConversation compelte: ",f),function(e){var t=b(),n=p({partner_id:Fn.partner_id,pkg_name:Fn.pkg_name,game_id:Fn.game_id,uid:Un.uid,openid:Un.openid,token:Un.token,uname:Un.uname,duid:t.duid,moid:e});m(h,"/wxgameorder/get/",n).then(function(e){1==e.data.status&&On.onPurchase(100*e.data.money)})}(f)}}):(u("用户取消支付"),n({state:100005,msg:"取消支付"}))},fail:function(){u("用户取消支付"),n({state:100006,msg:"支付失败"})}}):(u("失败!设备未识别"),n({state:100004,msg:"支付失败"}))}else u(i),n({state:o,msg:i});wx.hideLoading()}).catch(function(e){u(e),n({state:100002,msg:"支付失败"}),wx.hideLoading()})})},e.jf_profanityCheck=function(e){return new Promise(function(t,n){var o=p(r(r(r(r(r({},e),Fn),Un),b()),{},{launchoption:qn,onshow:qn,partner_id:4}));m(h,"/wxgamesafe/verify/",o).then(function(e){var r=e.data,o=r.code,i=r.msg;1==o?t():n({state:100001,msg:i})}).catch(function(e){n({state:100002,msg:e})})})},e.jf_share=function(e){wx.shareAppMessage(),Wn(r(r({},g(e)),{},{event:"fxclick"}))},e.jf_showInterstitialAd=function(e){return new Promise(function(t,n){var r=!1,o=wx.createInterstitialAd({adUnitId:e});o.onError(function(e){r=!0}),o.load().then(function(){if(!r)return o.show();n({state:100001,msg:"广告加载后发生错误"})}).then(t).catch(function(e){return n({state:100002,msg:JSON.stringify(e)})}),o.onClose(function(e){console.log("广告关闭:",e.isEnded?"正常播放完成":"用户提前关闭")})})},e.jf_trace=Wn,e.jf_tracePageView=function(e){return new Promise(function(t,n){On?(On.track("VIEW_CONTENT",{item:e}),t()):n({state:100001,msg:"上报失败!广点通 sdk 未初始化"})})},Object.defineProperty(e,"__esModule",{value:!0})});
7
+ function t(_,m,g){return(m=v(m))in _?Object.defineProperty(_,m,{value:g,enumerable:!0,configurable:!0,writable:!0}):_[m]=g,_}function e(_){return function(_){if(Array.isArray(_))return r(_)}(_)||function(_){if("undefined"!=typeof Symbol&&null!=_[Symbol.iterator]||null!=_["@@iterator"])return Array.from(_)}(_)||n(_)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function n(_,m){if(_){if("string"==typeof _)return r(_,m);var g=Object.prototype.toString.call(_).slice(8,-1);return"Object"===g&&_.constructor&&(g=_.constructor.name),"Map"===g||"Set"===g?Array.from(_):"Arguments"===g||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(g)?r(_,m):void 0}}function r(_,m){(null==m||m>_.length)&&(m=_.length);for(var g=0,y=new Array(m);g<m;g++)y[g]=_[g];return y}function o(_,m){if("function"!=typeof m&&null!==m)throw new TypeError("Super expression must either be null or a function");_.prototype=Object.create(m&&m.prototype,{constructor:{value:_,writable:!0,configurable:!0}}),Object.defineProperty(_,"prototype",{writable:!1}),m&&i(_,m)}function i(_,m){return i=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(_,m){return _.__proto__=m,_},i(_,m)}function a(_){var m=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(_){return!1}}();return function(){var g,y=s(_);if(m){var S=s(this).constructor;g=Reflect.construct(y,arguments,S)}else g=y.apply(this,arguments);return u(this,g)}}function u(_,m){if(m&&("object"===l(m)||"function"==typeof m))return m;if(void 0!==m)throw new TypeError("Derived constructors may only return object or undefined");return c(_)}function c(_){if(void 0===_)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return _}function s(_){return s=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(_){return _.__proto__||Object.getPrototypeOf(_)},s(_)}function l(_){return l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(_){return typeof _}:function(_){return _&&"function"==typeof Symbol&&_.constructor===Symbol&&_!==Symbol.prototype?"symbol":typeof _},l(_)}function f(_,m){if(!(_ instanceof m))throw new TypeError("Cannot call a class as a function")}function d(_,m){for(var g=0;g<m.length;g++){var y=m[g];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(_,v(y.key),y)}}function p(_,m,g){return m&&d(_.prototype,m),g&&d(_,g),Object.defineProperty(_,"prototype",{writable:!1}),_}function v(_){var m=function(_){if("object"!==l(_)||null===_)return _;var m=_[Symbol.toPrimitive];if(void 0!==m){var g=m.call(_,"string");if("object"!==l(g))return g;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(_)}(_);return"symbol"===l(m)?m:String(m)}var x,C,j="LOCAL_ID",L="CLICK_ID",N="QUEUE_LOST_MAP",P="REMOTE_CONFIG",D="REMOTE_COMMON_CONFIG",M="OPENID",q={init:"init",reporting:"reporting",fail:"fail"},U={maxSdkInstance:4,maxQueueLength:500,actionParamMaxLength:1e4,autoTrack:!0,reportThreshold:5,reportDelay:1,inspectDelay:30,cgiBatchSize:50,requestConcurrency:4,requestTimeout:1e4,signVersion:"1.0",realTimeActionList:["START_APP","REGISTER","PURCHASE"]},F="JS_RUN_ERROR",G="REQUEST_ERROR",H="REQUEST_CONFIG_ERROR",B="JS_QUEUE_LOG",V="PROXY_ERROR",K="QUEUE_LOST_NUM",W="SIGN_ERROR",J="UNKNOWN",Y="TRUE",Q="FALSE",z="TICKET_INTERVAL_CHANGE",$=(C=function(_){return"".concat("@dn-sdk/minigame","_").concat("production","_").concat(_)},{getSync:function(_){var m;try{m=wx.getStorageSync(C(_))}catch(_){return console.error("storage get error",_),m}return m},setSync:function(_,m){try{wx.setStorageSync(C(_),m)}catch(_){return console.error("storage set error",_),!1}return!0}}),Z=function(){var _;return function(){if(!_){var m=function(){if(x)return x;try{return x=wx.getSystemInfoSync()}catch(_){return{}}}(),g=m.system,y=void 0===g?"":g,S=(null==y?void 0:y.split(" "))||[],A=function(_){if(!_)return J;var m=(null==_?void 0:_.toUpperCase())||"";return m.indexOf("ANDROID")>-1?"ANDROID":m.indexOf("IOS")>-1?"IOS":m.indexOf("MAC")>-1?"OSX":m.indexOf("WINDOWS")>-1?"WINDOWS":J}(S[0]),b=function(_){return!_||_.length<=0?"":2===_.length?_[1]:3===_.length&&"Windows"===_[0]?"".concat(_[1]," ").concat(_[2]):_[_.length-1]}(S);_={benchmark_level:m.benchmarkLevel,device_brand:m.brand,screen_height:Math.floor(m.screenHeight),screen_width:Math.floor(m.screenWidth),wx_lib_version:m.SDKVersion,wx_version:m.version,wx_platform:m.platform,device_model:m.model,os:A,os_version:b}}return _}}(),X=function(){var _;return function(){try{if(_)return _;_||(_=$.getSync(j)||""),_||(_=mt(),$.setSync(j,_))}catch(_){}return _}}(),ee=function(){var _="unknown",m=!1;return function(){if(!m)try{wx.getNetworkType({success:function(m){_=m.networkType},fail:function(){_="unknown"}}),wx.onNetworkStatusChange(function(m){_=m.networkType}),m=!0}catch(_){}return _}}();ee();var te=function(){var _="";return function(){return _||(_=$.getSync(M)||""),_}}(),ne=function(){var _;return function(){if(_)return _;try{var m=wx.getAccountInfoSync();return ht(m.miniProgram)?_=m.miniProgram:{}}catch(m){return{}}}}();function ut(_){var m=null==_?void 0:_.query;if(!ht(m))return"";var g="";return m.gdt_vid||[1045,1046,1084].indexOf(null==_?void 0:_.scene)>-1?g="TENCENT":m.clue_token||m.clickid&&m.item_id?g="BYTEDANCE":m.callback&&"kuaishou"===m.ksChannel?g="KUAISHOU":m.bd_vid||m.ai&&m.d&&m.q&&m.c?g="BAIDU":m.uctrackid?g="ALIBABA":(m.trackid||m.imp||[1065,1069,1194].indexOf(null==_?void 0:_.scene)>-1&&(m.callback||m.u))&&(g="OTHERS"),g}function ct(_,m){try{var g=Z(),y=ne(),S={sdk_version:"1.5.5",sdk_name:"@dn-sdk/minigame",device_brand:null==g?void 0:g.device_brand,device_model:null==g?void 0:g.device_model,wx_version:null==g?void 0:g.wx_version,wx_lib_version:null==g?void 0:g.wx_lib_version,wx_platform:null==g?void 0:g.wx_platform,os:null==g?void 0:g.os,os_version:null==g?void 0:g.os_version,local_id:X(),env_version:null==y?void 0:y.envVersion,appid:null==y?void 0:y.appId},A=Object.assign(S,_);wx.request({url:"https://api.datanexus.qq.com/data-nexus-trace/log",data:A,method:"POST",timeout:U.requestTimeout,success:function(_){"function"==typeof m&&200===(null==_?void 0:_.statusCode)&&m()}})}catch(g){ce.error(g)}}var re=function(){function t(){f(this,t)}return p(t,null,[{key:"revise",value:function(_){_>0&&!this.isRevised&&(this.offsetTime=_-Date.now(),this.isRevised=!0)}},{key:"getRevisedcurrentTimeMillis",value:function(){return this.isRevised?Date.now()+this.offsetTime:-1}}]),t}();function lt(_){return new Promise(function(m,g){wx.request({method:"POST",url:"https://api.datanexus.qq.com/data-nexus-config/v1/sdk/config/get",data:_,timeout:U.requestTimeout,success:function(_){ft(_,m,"config/get",g),pt(_)},fail:function(_){dt(_,"config/get",g)}})})}function ft(_,m,g,y){var S,A,b,k,T=null==_?void 0:_.statusCode,R=null==(S=null==_?void 0:_.data)?void 0:S.code;if(200!==T||0!==R){var w=R;200!==T&&(w="number"==typeof T?-1*T:-888),ct({log_type:H,message:"cgiName: ".concat(g,", statusCode: ").concat(T,", code: ").concat(R,", traceid: ").concat(null==(b=null==_?void 0:_.data)?void 0:b.trace_id),code:w}),null==y||y(null==(k=null==_?void 0:_.data)?void 0:k.data)}else m(null==(A=_.data)?void 0:A.data)}function dt(_,m,g){ct({log_type:H,message:"cgiName: ".concat(m," , message: ").concat(null==_?void 0:_.errMsg," "),code:"number"==typeof(null==_?void 0:_.errno)?-1*_.errno:-999}),null==g||g(_)}function pt(_){var m,g=1*(null==(m=null==_?void 0:_.header)?void 0:m["Server-Time"]);g>17266752e5&&re.revise(g)}re.offsetTime=0,re.isRevised=!1;var oe=Object.prototype.toString,ht=function(_){return"[object Object]"===oe.call(_)},_t=function(_){return"[object Array]"===oe.call(_)},yt=function(_){return"[object Function]"===oe.call(_)},ie=(new Date).getTime();function mt(){var _=(new Date).getTime(),m=Math.abs(1e3*(_-ie));return"xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx".replace(/[xy]/g,function(g){var y=16*Math.random();return _>0?(y=(_+y)%16|0,_=Math.floor(_/16)):(y=(m+y)%16|0,m=Math.floor(m/16)),("x"===g?y:3&y|8).toString(16).replace(/-/g,"")})}var ae=/^v?(?:\d+)(\.(?:[x*]|\d+)(\.(?:[x*]|\d+)(\.(?:[x*]|\d+))?(?:-[\da-z\-]+(?:\.[\da-z\-]+)*)?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i,Rt=function(_){if("string"!=typeof _)throw new TypeError("Invalid argument expected string");if(!ae.test(_))throw new Error("Invalid argument not valid semver ('".concat(_,"' received)"))},kt=function(_){return isNaN(Number(_))?_:Number(_)},Tt=function(_){var m=_.replace(/^v/,"").replace(/\+.*$/,""),g=function(_){return-1===_.indexOf("-")?_.length:_.indexOf("-")}(m),y=m.substring(0,g).split(".");return y.push(m.substring(g+1)),y},Et=function(_,m){[_,m].forEach(Rt);for(var g=Tt(_),y=Tt(m),S=0;S<Math.max(g.length-1,y.length-1);S++){var A=parseInt(g[S]||"0",10),b=parseInt(y[S]||"0",10);if(A>b)return 1;if(b>A)return-1}var k=g[g.length-1],T=y[y.length-1];if(k&&T)for(var R=k.split(".").map(kt),w=T.split(".").map(kt),I=0;I<Math.max(R.length,w.length);I++){if(void 0===R[I]||"string"==typeof w[I]&&"number"==typeof R[I])return-1;if(void 0===w[I]||"string"==typeof R[I]&&"number"==typeof w[I]||R[I]>w[I])return 1;if(w[I]>R[I])return-1}else if(k||T)return k?-1:1;return 0};function bt(_){return Ot()[_]}function Ot(){return U}function It(_,m){return Object.prototype.hasOwnProperty.call(_,m)}var wt=function(_){try{return _&&"string"==typeof _?-1===(_=_.replace(/\s/g,"")).indexOf(".")?_:_.split(".").slice(0,2).join("."):""}catch(m){return _}},ue=function(){function t(){f(this,t)}return p(t,null,[{key:"error",value:function(_){for(var m,g=arguments.length,y=new Array(g>1?g-1:0),S=1;S<g;S++)y[S-1]=arguments[S];(m=console).error.apply(m,["".concat("[@dn-sdk/minigame v1.5.5]",": ").concat(_)].concat(y))}},{key:"info",value:function(_){for(var m,g=arguments.length,y=new Array(g>1?g-1:0),S=1;S<g;S++)y[S-1]=arguments[S];t.debug&&(m=console).info.apply(m,["".concat("[@dn-sdk/minigame v1.5.5]",": ").concat(_)].concat(y))}},{key:"log",value:function(_){for(var m,g=arguments.length,y=new Array(g>1?g-1:0),S=1;S<g;S++)y[S-1]=arguments[S];t.debug&&(m=console).log.apply(m,["".concat("[@dn-sdk/minigame v1.5.5]",": ").concat(_)].concat(y))}},{key:"warn",value:function(_){for(var m,g=arguments.length,y=new Array(g>1?g-1:0),S=1;S<g;S++)y[S-1]=arguments[S];(m=console).warn.apply(m,["".concat("[@dn-sdk/minigame v1.5.5]",": ").concat(_)].concat(y))}},{key:"devLog",value:function(_){for(var m,g=arguments.length,y=new Array(g>1?g-1:0),S=1;S<g;S++)y[S-1]=arguments[S];t.isDev&&(m=console).log.apply(m,["".concat("[@dn-sdk/minigame v1.5.5]",": ").concat(_)].concat(y))}}]),t}(),ce=ue;ce.debug=!1,ce.isDev=!1;var se=function(){var _;return function(){if(!_)try{var m=wx.getLaunchOptionsSync(),g=m.query.gdt_vid||"";g?$.setSync(L,g):g=$.getSync(L)||"";var y=JSON.stringify(m);y.length>1e4&&(y=JSON.stringify({cut:1,scene:m.scene})),_={source_scene:m.scene,pkg_channel_id:m.query.wxgamepro||"",ad_trace_id:g,launch_options:y,channel:ut(m)}}catch(m){_={},ce.log("获取场景值和渠道号失败",m)}return _}}();function Lt(_,m,g){var y=g.value;return g.value=function(){for(var g=arguments.length,S=new Array(g),A=0;A<g;A++)S[A]=arguments[A];try{return y.apply(this,S)}catch(g){try{ce.error.apply(ce,["calling ".concat(_.constructor.name,".").concat(m," error with arguments")].concat(S)),ce.error(g);var b={log_type:F,message:"[safeExcutable] ".concat(_.constructor.name,".").concat(m,": ").concat(null==g?void 0:g.message),err_stack:null==g?void 0:g.stack};yt(this.reportLog)?this.reportLog(b):ct(b)}catch(b){}}},g}var le=Object.defineProperty,de=Object.getOwnPropertyDescriptor,qt=function(_,m,g,y){for(var S,A=y>1?void 0:y?de(m,g):m,b=_.length-1;b>=0;b--)(S=_[b])&&(A=(y?S(m,g,A):S(A))||A);return y&&A&&le(m,g,A),A},fe=function(){function t(_){var m=_.userActionSetId,g=_.maxLength,y=void 0===g?500:g;f(this,t),this.lostActionMaps={},this.stack=[],this.localStorageKey="",this.localStorageKey="".concat("QUEUE_ACTIONS","_").concat(null==m?void 0:m.toString()),this.maxLength=y,this.userActionSetId=m,this.setTimeStamp(),this.init()}return p(t,[{key:"getItems",value:function(){return this.stack}},{key:"getStorage",value:function(){var _,m=(null==(_=$)?void 0:_.getSync(this.localStorageKey))||"[]";return JSON.parse(m)}},{key:"reportLostNum",value:function(){var _=this,m=Object.assign({},this.lostActionMaps),g=[];for(var y in m){var S=null==y?void 0:y.split("_");g.push({queue_lost_session_id:S[0],queue_lost_timestamp:S[1],queue_lost_num:m[y]})}g.length&&(this.setTimeStamp(),g.forEach(function(m){var g=Object.assign({},{user_action_set_id:_.userActionSetId,log_type:K},m),y=null==m?void 0:m.queue_lost_session_id,S=null==m?void 0:m.queue_lost_timestamp,A="".concat(y,"_").concat(S);ct(g,function(){It(_.lostActionMaps,A)&&(delete _.lostActionMaps[A],$.setSync(N,JSON.stringify(_.lostActionMaps)))})}))}},{key:"getLostMaps",value:function(){return this.lostActionMaps}},{key:"init",value:function(){var _=this,m=this.getStorage(),g=null==m?void 0:m.map(function(_){var m,g;return _.inner_status===(null==(m=q)?void 0:m.reporting)?Object.assign({},_,{inner_status:null==(g=q)?void 0:g.fail,is_retry:!0,retry_count:_.retry_count+1}):_});this.stack=g,this.lostActionMaps=JSON.parse($.getSync(N)||"{}"),setTimeout(function(){_.reportLostNum()},1e3)}},{key:"addItem",value:function(_){var m;null==(m=null==this?void 0:this.stack)||m.push(_)}},{key:"removeItems",value:function(_){var m,g=null==(m=null==this?void 0:this.stack)?void 0:m.filter(function(m){return!(null!=_&&_.includes(null==m?void 0:m.action_id))});this.stack=g}},{key:"updateForReportFail",value:function(_){var m;this.stack=null==(m=this.stack)?void 0:m.map(function(m){var g;return null!=_&&_.includes(null==m?void 0:m.action_id)?Object.assign({},m,{inner_status:null==(g=q)?void 0:g.fail,retry_count:m.retry_count+1,is_retry:!0}):m})}},{key:"updateForReporting",value:function(_){var m;this.stack=null==(m=this.stack)?void 0:m.map(function(m){var g;return null!=_&&_.includes(null==m?void 0:m.action_id)?Object.assign({},m,{inner_status:null==(g=q)?void 0:g.reporting}):m})}},{key:"updateAllStack",value:function(_){this.stack=_}},{key:"updateToStorage",value:function(){$.setSync(this.localStorageKey,JSON.stringify(this.stack))}},{key:"updateLostAction",value:function(_){if(_){var m="".concat(_,"_").concat(this.timeStamp),g=this.lostActionMaps[m]||0;this.lostActionMaps[m]=g+1,$.setSync(N,JSON.stringify(this.lostActionMaps))}}},{key:"setTimeStamp",value:function(){this.timeStamp=Date.now().toString()}}]),t}();qt([Lt],fe.prototype,"getItems",1),qt([Lt],fe.prototype,"getStorage",1),qt([Lt],fe.prototype,"reportLostNum",1),qt([Lt],fe.prototype,"getLostMaps",1),qt([Lt],fe.prototype,"init",1),qt([Lt],fe.prototype,"addItem",1),qt([Lt],fe.prototype,"removeItems",1),qt([Lt],fe.prototype,"updateForReportFail",1),qt([Lt],fe.prototype,"updateForReporting",1),qt([Lt],fe.prototype,"updateAllStack",1),qt([Lt],fe.prototype,"updateToStorage",1),qt([Lt],fe.prototype,"updateLostAction",1);var pe=Object.defineProperty,ve=Object.getOwnPropertyDescriptor,jt=function(_,m,g,y){for(var S,A=y>1?void 0:y?ve(m,g):m,b=_.length-1;b>=0;b--)(S=_[b])&&(A=(y?S(m,g,A):S(A))||A);return y&&A&&pe(m,g,A),A},_e=function(){o(n,fe);var _=a(n);function n(m){var g,y=m.userActionSetId,S=m.maxLength,A=void 0===S?500:S,b=m.ogEvents,k=void 0===b?[]:b;return f(this,n),(g=_.call(this,{userActionSetId:y,maxLength:A})).ogEvents=k,g}return p(n,[{key:"getReportableActions",value:function(){var _=arguments.length>0&&void 0!==arguments[0]?arguments[0]:100,m=this.getItems(),g=[];return null==m||m.forEach(function(m){var y;(null==g?void 0:g.length)<_&&(null==m?void 0:m.inner_status)!==(null==(y=q)?void 0:y.reporting)&&(null==g||g.push(m))}),g}},{key:"addAction",value:function(_){var m={code:0,message:"成功",actionId:_.action_id},g=this.getItems();if((null==g?void 0:g.length)>=this.maxLength){var y="队列长度超过最大限制".concat(this.maxLength,"条,SDK将按照行为优先级排序,丢弃优先级最低的行为事件");ce.warn(y),ct({user_action_set_id:this.userActionSetId,log_type:B,message:"队列长度超过限制"});var S=this.sortQueue(_,g);ce.debug&&ce.info("超过".concat(this.maxLength,"条按优先级排序的队列:"),S.concat([]));var A=S.pop();this.updateAllStack(S),this.updateLostAction((null==A?void 0:A.session_id)||""),(null==A?void 0:A.action_id)===_.action_id&&(m={code:103,message:"缓存队列已满,主动丢弃行为"})}else this.addItem(_);return this.updateToStorage(),m}},{key:"removeActions",value:function(_){this.removeItems(_),this.updateToStorage()}},{key:"updateActionsForReportFail",value:function(_){this.updateForReportFail(_),this.updateToStorage()}},{key:"updateActionsForReporting",value:function(_){this.updateForReporting(_),this.updateToStorage()}},{key:"getReportableActionsLength",value:function(){var _=this.getItems().filter(function(_){var m;return(null==_?void 0:_.inner_status)!==(null==(m=q)?void 0:m.reporting)});return null==_?void 0:_.length}},{key:"sortQueue",value:function(_,m){var g=this,y={},S=null==_?void 0:_.action_time,A=m.concat([_]),a=function(_){return y[_.action_id]||(y[_.action_id]=g.caculateWeight(S,_)),y[_.action_id]};return A.sort(function(_,m){return a(m)-a(_)})}},{key:"caculateWeight",value:function(_,m){var g,y=0,S=this.formatWeight(_,null==m?void 0:m.action_time),A=S.ogWeight,b=S.sdkWeight,k=S.userWeight;null!=(g=this.ogEvents)&&g.includes(null==m?void 0:m.action_type)&&(y+=A),null!=m&&m.is_sdk_auto_track?y+=b:y+=k;var T=_-(null==m?void 0:m.action_time)+1;return T>0?y+1/T:y}},{key:"formatWeight",value:function(_,m){var g=1e3,y=10,S=100;return _-m>2592e6&&(g/=100,y/=100,S/=100),{ogWeight:g,sdkWeight:y,userWeight:S}}}]),n}();jt([Lt],_e.prototype,"getReportableActions",1),jt([Lt],_e.prototype,"addAction",1),jt([Lt],_e.prototype,"removeActions",1),jt([Lt],_e.prototype,"updateActionsForReportFail",1),jt([Lt],_e.prototype,"updateActionsForReporting",1),jt([Lt],_e.prototype,"getReportableActionsLength",1),jt([Lt],_e.prototype,"sortQueue",1),jt([Lt],_e.prototype,"caculateWeight",1),jt([Lt],_e.prototype,"formatWeight",1);var ge=function(){function t(){f(this,t),this.events={}}return p(t,[{key:"subscribe",value:function(_,m){t.checkCallback(m),_t(this.events[_])?this.events[_].push(m):this.events[_]=[m]}},{key:"once",value:function(_,m){t.checkCallback(m),this.subscribe(this.onceEventName(_),m)}},{key:"unsubscribe",value:function(_,m){t.checkCallback(m),_t(this.events[_])&&(this.events[_]=this.events[_].filter(function(_){return _!==m})),_t(this.events[this.onceEventName(_)])&&(this.events[this.onceEventName(_)]=this.events[this.onceEventName(_)].filter(function(_){return _!==m}))}},{key:"publish",value:function(_){for(var m=arguments.length,g=new Array(m>1?m-1:0),y=1;y<m;y++)g[y-1]=arguments[y];var S=Date.now();_t(this.events[_])&&this.events[_].forEach(function(_){return _.apply(void 0,[S].concat(g))}),_t(this.events[this.onceEventName(_)])&&(this.events[this.onceEventName(_)].forEach(function(_){return _.apply(void 0,[S].concat(g))}),this.events[this.onceEventName(_)]=[])}},{key:"onceEventName",value:function(_){return"once_event_prefix_".concat(_)}}],[{key:"checkCallback",value:function(_){yt(_)||ce.error(t.ERROR_CALLBACK_IS_NOT_A_FUNCTION)}}]),t}(),ye=ge;ye.ERROR_CALLBACK_IS_NOT_A_FUNCTION="callback 不是函数";var Se=new ye,be=["REGISTER","VIEW_CONTENT","ADD_TO_CART","PURCHASE","COMPLETE_ORDER","ADD_TO_WISHLIST","START_APP","CREATE_ROLE","AUTHORIZE","TUTORIAL_FINISH","START_PAY","FINISH_PAY"],we="START_APP",Ie="TICKET",Oe="ENTER_FOREGROUND",Ee="ENTER_BACKGROUND",xe="LOGIN",Ce="SHARE",je="TAP_GAME_CLUB",Le="CREATE_GAME_CLUB",Ne="JOIN_GAME_ROOM",Pe="FINISH_PAY",De="START_PAY",Me="ADD_TO_WISHLIST",qe=["REGISTER","START_APP","RE_ACTIVE"],Ue=["TICKET","ENTER_FOREGROUND","ENTER_BACKGROUND"],Fe=function(){function t(){f(this,t),this.channelClaimActionList=qe,this.noClaimActionList=Ue,this.realTimeActionList=U.realTimeActionList,this.ticketInterval=60,this.requestTimeout=U.requestTimeout,this.loadConfig()}return p(t,[{key:"getChannelClaimActionList",value:function(){return this.channelClaimActionList}},{key:"getNoClaimActionList",value:function(){return this.noClaimActionList}},{key:"getRealTimeActionList",value:function(){return this.realTimeActionList}},{key:"getTicketInterval",value:function(){return this.ticketInterval}},{key:"getRequestTimeout",value:function(){return this.requestTimeout}},{key:"loadConfig",value:function(){var _=this;try{if("undefined"==typeof wx)return;var m=$.getSync(D);m&&this.updateConfig(m),lt({conf_name:"mini_game_sdk_common",conf_key:"config"}).then(function(m){m&&ht(m)&&(_.updateConfig(m),$.setSync(D,m))})}catch(m){console.error(m)}}},{key:"updateConfig",value:function(_){_.channelClaimActionList&&_t(_.channelClaimActionList)&&(this.channelClaimActionList=_.channelClaimActionList),_.noClaimActionList&&_t(_.noClaimActionList)&&(this.noClaimActionList=_.noClaimActionList),_.realTimeActionList&&_t(_.realTimeActionList)&&(this.realTimeActionList=_.realTimeActionList),_.ticketInterval&&"number"==typeof _.ticketInterval&&_.ticketInterval>1&&_.ticketInterval!==this.ticketInterval&&(this.ticketInterval=_.ticketInterval,Se.publish(z)),_.requestTimeout&&"number"==typeof _.requestTimeout&&_.requestTimeout>5e3&&(this.requestTimeout=_.requestTimeout)}}]),t}(),Ge=new Fe,He=we,Be=Ie,Ve=Oe,Ke=Ee,We=function(){var _=!1,m=!1,g=!0,y=!0,S=!0,A=!1;return function(){if(!A){A=!0;var b=$.getSync(P);if((null==b?void 0:b.bg)===Y?_=!0:(null==b?void 0:b.bg)===Q&&(_=!1),(null==b?void 0:b.fg)===Y?m=!0:(null==b?void 0:b.fg)===Q&&(m=!1),(null==b?void 0:b.st)===Y?g=!0:(null==b?void 0:b.st)===Q&&(g=!1),(null==b?void 0:b.ti)===Y?y=!0:(null==b?void 0:b.ti)===Q&&(y=!1),ce.devLog("当前缓存开关 bgOn,fgOn,stOn,tiOn:",_,m,g,y),g&&Se.publish(He),y){var u=function(){S&&Se.publish(Be)},k=setInterval(u,1e3*Ge.getTicketInterval());Se.subscribe(z,function(){k&&clearInterval(k),k=setInterval(u,1e3*Ge.getTicketInterval())})}wx.onShow(function(_){if(S=!0,m){var g="";try{(g=JSON.stringify(_)).length>1e4&&(g=JSON.stringify({cut:1,scene:_.scene}))}catch(_){}Se.publish(Ve,{enter_options:g})}}),wx.onHide(function(){S=!1,_&&Se.publish(Ke)})}}}(),Ye="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function he(_){return _&&_.__esModule&&Object.prototype.hasOwnProperty.call(_,"default")?_.default:_}var Qe,ze=he(function(){var _,m=null;function n(_){return!!_&&("object"==l(_)||"function"==typeof _)}function r(_){if(null!==_&&!n(_))throw new TypeError("Object prototype may only be an Object or null: "+_)}var g=Object,y=!(!g.create&&{__proto__:null}instanceof g),S=g.create||(y?function(_){return r(_),{__proto__:_}}:function(_){if(r(_),null===_)throw new SyntaxError("Native Object.create is required to create objects with null prototype");var e=function(){};return e.prototype=_,new e}),u=function(){return null},A=g.getPrototypeOf||([].__proto__===Array.prototype?function(_){var m=_.__proto__;return n(m)?m:null}:u);return _=function(b,k){if(void 0===(this&&this instanceof _?this.constructor:void 0))throw new TypeError("Constructor Proxy requires 'new'");if(!n(b)||!n(k))throw new TypeError("Cannot create proxy with a non-object as target or handler");var f=function(){};m=function(){b=null,f=function(_){throw new TypeError("Cannot perform '".concat(_,"' on a proxy that has been revoked"))}},setTimeout(function(){m=null},0);var T=k;for(var R in k={get:null,set:null,apply:null,construct:null},T){if(!(R in k))throw new TypeError("Proxy polyfill does not support trap '".concat(R,"'"));k[R]=T[R]}"function"==typeof T&&(k.apply=T.apply.bind(T));var w,I=A(b),O=!1,E=!1;"function"==typeof b?(w=function(){var _=this&&this.constructor===w,m=Array.prototype.slice.call(arguments);return f(_?"construct":"apply"),_&&k.construct?k.construct.call(this,b,m):!_&&k.apply?k.apply(b,this,m):_?(m.unshift(b),new(b.bind.apply(b,m))):b.apply(this,m)},O=!0):b instanceof Array?(w=[],E=!0):w=y||null!==I?S(I):{};var x=k.get?function(_){return f("get"),k.get(this,_,w)}:function(_){return f("get"),this[_]},C=k.set?function(_,m){f("set"),k.set(this,_,m,w)}:function(_,m){f("set"),this[_]=m},j=g.getOwnPropertyNames(b),L={};j.forEach(function(_){if(!O&&!E||!(_ in w)){var m={enumerable:!!g.getOwnPropertyDescriptor(b,_).enumerable,get:x.bind(b,_),set:C.bind(b,_)};g.defineProperty(w,_,m),L[_]=!0}});var N=!0;if(O||E){var P=g.setPrototypeOf||([].__proto__===Array.prototype?function(_,m){return r(m),_.__proto__=m,_}:u);I&&P(w,I)||(N=!1)}if(k.get||!N)for(var D in b)L[D]||g.defineProperty(w,D,{get:x.bind(b,D)});return g.seal(b),g.seal(w),w},_.revocable=function(g,y){return{proxy:new _(g,y),revoke:m}},_}),$e={};try{Qe||(Qe=ze())}catch(x){Te(x)}function me(_,m,g,y){try{if(!Qe||null==_||!_[m])return;_[m]=new Qe(_[m],{apply:function(_,m,S){var A,b;y&&ke(function(){return y.apply(void 0,e(S))});var k=!!(null!=(A=S[0])&&A.success||null!=(b=S[0])&&b.fail);k&&["success","fail"].forEach(function(_){if(S[0][_])try{S[0][_]=new Qe(S[0][_],{apply:function(m,y,A){return ke(function(){return g.apply(void 0,[_,S[0]].concat(e(A)))}),m.apply(y,A)}})}catch(_){Te(_)}});var T=_.apply(m,S);return!k&&T&&"[object Promise]"===Object.prototype.toString.call(T)?T.then(function(_){return ke(function(){return g("success",S[0],_)}),_}).catch(function(_){throw ke(function(){return g("fail",S[0],_)}),_}):T}})}catch(_){Te(_)}}function Ae(_,m,g){try{if(!Qe||null==_||!_[m])return;_[m]=new Qe(_[m],{apply:function(_,m,y){var S="function"==typeof y[0];if(S)try{y[0]=new Qe(y[0],{apply:function(_,m,y){var S=_.call.apply(_,[m].concat(e(y)));return ke(function(){return g(S)}),S}})}catch(_){Te(_)}var A=_.call.apply(_,[m].concat(e(y)));return S||ke(function(){return g(A)}),A}})}catch(_){Te(_)}}function Re(_){var m=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",g=arguments.length>2?arguments[2]:void 0,y=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],S=arguments.length>4?arguments[4]:void 0;try{if(!Qe||null==_||!_[m])return;_[m]=new Qe(_[m],{apply:function(_,A,b){var k=_.call.apply(_,[A].concat(e(b)));return(!g||!$e[m])&&(ke(function(){return null==S?void 0:S(k)}),y.forEach(function(_){var m=_.eventName,g=_.isAsync,y=_.proxyEvent;g?me(k,m,y):Ae(k,m,y)})),g&&($e[m]=!0),k}})}catch(_){Te(_)}}function ke(_){try{_()}catch(_){Te(_)}}function Te(_){ct({log_type:V,message:null==_?void 0:_.message,err_stack:null==_?void 0:_.stack})}var Xe=xe,et=Me,tt=Ce,nt=je,rt=Le,ot=Ne,it=De,at=Pe,st=function(){var _=!1;return function(){_||(_=!0,me(wx,"login",function(_){"success"===_&&Se.publish(Xe)}),Ae(wx,"onAddToFavorites",function(){Se.publish(et)}),Ae(wx,"onShareTimeline",function(){Se.publish(tt,{target:"TIME_LINE",trigger:"MENU"})}),Ae(wx,"onShareAppMessage",function(){Se.publish(tt,{target:"APP_MESSAGE",trigger:"MENU"})}),Ae(wx,"shareAppMessage",function(){Se.publish(tt,{target:"APP_MESSAGE",trigger:"BUTTON"})}),Re(wx,"createGameClubButton",!1,[{isAsync:!1,eventName:"onTap",proxyEvent:function(){Se.publish(nt)}}],function(){Se.publish(rt)}),Re(wx,"getGameServerManager",!0,[{isAsync:!0,eventName:"createRoom",proxyEvent:function(_){"success"===_&&Se.publish("CREATE_GAME_ROOM")}},{isAsync:!0,eventName:"joinRoom",proxyEvent:function(_){"success"===_&&Se.publish(ot)}}]),me(wx,"requestMidasPayment",function(_,m){Se.publish(at,{status:"success"===_?"SUCCESS":"FAIL",quantity:(null==m?void 0:m.buyQuantity)||0,mode:(null==m?void 0:m.mode)||"",platform:(null==m?void 0:m.platform)||"",no:(null==m?void 0:m.outTradeNo)||"",payType:"Midas"})},function(_){Se.publish(it,{quantity:(null==_?void 0:_.buyQuantity)||0,mode:(null==_?void 0:_.mode)||"",platform:(null==_?void 0:_.platform)||"",no:(null==_?void 0:_.outTradeNo)||"",payType:"Midas"})}),me(wx,"requestMidasPaymentGameItem",function(_,m){var g=(m||{}).signData;Se.publish(at,{status:"success"===_?"SUCCESS":"FAIL",quantity:(null==g?void 0:g.buyQuantity)||0,mode:(null==g?void 0:g.mode)||"",platform:(null==g?void 0:g.platform)||"",no:(null==g?void 0:g.outTradeNo)||"",p:(null==g?void 0:g.goodsPrice)||0,productId:(null==g?void 0:g.productId)||"",payType:"MidasGameItem"})},function(_){var m=(_||{}).signData;Se.publish(it,{quantity:(null==m?void 0:m.buyQuantity)||0,mode:(null==m?void 0:m.mode)||"",platform:(null==m?void 0:m.platform)||"",no:(null==m?void 0:m.outTradeNo)||"",p:(null==m?void 0:m.goodsPrice)||0,productId:(null==m?void 0:m.productId)||"",payType:"MidasGameItem"})}))}}(),vt=function(){function t(){f(this,t)}return p(t,null,[{key:"isEmpty",value:function(_){return null==_||"string"==typeof _&&""===_.trim()}},{key:"format",value:function(_){for(var m=arguments.length,g=new Array(m>1?m-1:0),y=1;y<m;y++)g[y-1]=arguments[y];return _.replace(/\${(\d+)}/g,function(_,m){return g[m]})}},{key:"customStringify",value:function(_){var m=[];try{return JSON.stringify(_,function(_,g){if(void 0===g)return"undefined";if("object"==l(g)&&null!==g){if(-1!==m.indexOf(g))return"[Circular]";m.push(g)}return"bigint"==typeof g?g.toString():g})}catch(_){return"[Param Error]"}}}]),t}(),gt=/^([a-zA-Z][a-zA-Z\d_]{0,63})$/i,St=/^ams_reserved_(.*)/i,At=function(){function t(){f(this,t)}return p(t,null,[{key:"validateActionType",value:function(_){return vt.isEmpty(_)?(ce.error(t.ERROR_ACTION_TYPE_NULL),!1):!!gt.test(_)||(ce.error(t.ERROR_ACTION_TYPE_INVALID),!1)}},{key:"validateActionParam",value:function(_){if(!_)return!0;if(!ht(_))return ce.error(t.ERROR_ACTION_PARAM_IS_NOT_OBJECT),!1;for(var m in _){if(vt.isEmpty(m))return ce.error(t.ERROR_ACTION_PARAM_KEY_NULL),!1;if(!gt.test(m))return ce.error(t.ERROR_ACTION_PARAM_KEY_INVALID),!1;St.test(m)&&ce.warn(t.WARN_ACTION_PARAM_KEY_RESERVED);var g=_[m];if(!t.isValidValue(g))return ce.error(vt.format(t.ERROR_ACTION_PARAM_VALUE_INVALID,m,g)),!1;if(_t(g)){if(!t.isValidArrayValue(g)){for(var y=0;y<g.length;y++)ce.error(vt.format(t.ERROR_ACTION_PARAM_VALUE_ARRAY_INVALID,m,vt.customStringify(g),y,g[y]));return!1}if(!t.checkArrayElementTypes(g))return ce.error(t.ERROR_ACTION_PARAM_VALUE_ARRAY_TYPE_UNUNIQUE),!1}}return!0}},{key:"isValidValue",value:function(_){return null==_||"string"==typeof _||"number"==typeof _||"boolean"==typeof _||_t(_)}},{key:"isValidArrayValue",value:function(_){for(var m=0;m<_.length;m++){var g=_[m];if("string"!=typeof g&&"number"!=typeof g&&"boolean"!=typeof g)return!1}return!0}},{key:"checkArrayElementTypes",value:function(_){if(!_||_.length<=1)return!0;for(var m=l(_[0]),g=1;g<_.length;g++)if(l(_[g])!==m)return!1;return!0}}]),t}(),xt=At;xt.ERROR_ACTION_TYPE_NULL="在track方法中,action_type参数不能为空!",xt.ERROR_ACTION_TYPE_INVALID="在track方法中,action_type参数只能包含字母、数字和下划线,且只能以字母开头,长度不能超过64个字符!",xt.ERROR_ACTION_PARAM_KEY_NULL="在track方法中,action_param参数的key不能为空!",xt.ERROR_ACTION_PARAM_KEY_INVALID="在track方法中,action_param参数的key只能包含字母、数字和下划线,且不能以数字开头,长度不能超过64个字符!",xt.WARN_ACTION_PARAM_KEY_RESERVED="SDK内部预留参数的key均以'ams_reserved_'开头,该参数的值会被SDK内部覆盖,请不要使用!",xt.ERROR_ACTION_PARAM_VALUE_INVALID="在track方法中,action_param参数的value必须是String/Number/Boolean/Array中的一种![key=${0}, value=${1}]",xt.ERROR_ACTION_PARAM_VALUE_ARRAY_INVALID="在track方法中,如果action_param参数中的某个元素的value是Array,那么这个Array中的每个元素必须是String/Number/Boolean中的一种![key=${0}, value=${1}, 数组的第${2}个元素为${3}]",xt.ERROR_ACTION_PARAM_VALUE_ARRAY_TYPE_UNUNIQUE="在track方法中,如果action_param参数中的某个元素的value是Array,那么这个Array中所有元素的类型必须是同一种!",xt.ERROR_ACTION_PARAM_IS_NOT_OBJECT="action_param 参数不是Object";var Ct={exports:{}};!function(_){!function(m){function n(_,m){var g=(65535&_)+(65535&m);return(_>>16)+(m>>16)+(g>>16)<<16|65535&g}function r(_,m,g,y,S,A){return n(function(_,m){return _<<m|_>>>32-m}(n(n(m,_),n(y,A)),S),g)}function o(_,m,g,y,S,A,b){return r(m&g|~m&y,_,m,S,A,b)}function i(_,m,g,y,S,A,b){return r(m&y|g&~y,_,m,S,A,b)}function a(_,m,g,y,S,A,b){return r(m^g^y,_,m,S,A,b)}function u(_,m,g,y,S,A,b){return r(g^(m|~y),_,m,S,A,b)}function c(_,m){_[m>>5]|=128<<m%32,_[14+(m+64>>>9<<4)]=m;var g,y,S,A,b,k=1732584193,T=-271733879,R=-1732584194,w=271733878;for(g=0;g<_.length;g+=16)y=k,S=T,A=R,b=w,k=o(k,T,R,w,_[g],7,-680876936),w=o(w,k,T,R,_[g+1],12,-389564586),R=o(R,w,k,T,_[g+2],17,606105819),T=o(T,R,w,k,_[g+3],22,-1044525330),k=o(k,T,R,w,_[g+4],7,-176418897),w=o(w,k,T,R,_[g+5],12,1200080426),R=o(R,w,k,T,_[g+6],17,-1473231341),T=o(T,R,w,k,_[g+7],22,-45705983),k=o(k,T,R,w,_[g+8],7,1770035416),w=o(w,k,T,R,_[g+9],12,-1958414417),R=o(R,w,k,T,_[g+10],17,-42063),T=o(T,R,w,k,_[g+11],22,-1990404162),k=o(k,T,R,w,_[g+12],7,1804603682),w=o(w,k,T,R,_[g+13],12,-40341101),R=o(R,w,k,T,_[g+14],17,-1502002290),k=i(k,T=o(T,R,w,k,_[g+15],22,1236535329),R,w,_[g+1],5,-165796510),w=i(w,k,T,R,_[g+6],9,-1069501632),R=i(R,w,k,T,_[g+11],14,643717713),T=i(T,R,w,k,_[g],20,-373897302),k=i(k,T,R,w,_[g+5],5,-701558691),w=i(w,k,T,R,_[g+10],9,38016083),R=i(R,w,k,T,_[g+15],14,-660478335),T=i(T,R,w,k,_[g+4],20,-405537848),k=i(k,T,R,w,_[g+9],5,568446438),w=i(w,k,T,R,_[g+14],9,-1019803690),R=i(R,w,k,T,_[g+3],14,-187363961),T=i(T,R,w,k,_[g+8],20,1163531501),k=i(k,T,R,w,_[g+13],5,-1444681467),w=i(w,k,T,R,_[g+2],9,-51403784),R=i(R,w,k,T,_[g+7],14,1735328473),k=a(k,T=i(T,R,w,k,_[g+12],20,-1926607734),R,w,_[g+5],4,-378558),w=a(w,k,T,R,_[g+8],11,-2022574463),R=a(R,w,k,T,_[g+11],16,1839030562),T=a(T,R,w,k,_[g+14],23,-35309556),k=a(k,T,R,w,_[g+1],4,-1530992060),w=a(w,k,T,R,_[g+4],11,1272893353),R=a(R,w,k,T,_[g+7],16,-155497632),T=a(T,R,w,k,_[g+10],23,-1094730640),k=a(k,T,R,w,_[g+13],4,681279174),w=a(w,k,T,R,_[g],11,-358537222),R=a(R,w,k,T,_[g+3],16,-722521979),T=a(T,R,w,k,_[g+6],23,76029189),k=a(k,T,R,w,_[g+9],4,-640364487),w=a(w,k,T,R,_[g+12],11,-421815835),R=a(R,w,k,T,_[g+15],16,530742520),k=u(k,T=a(T,R,w,k,_[g+2],23,-995338651),R,w,_[g],6,-198630844),w=u(w,k,T,R,_[g+7],10,1126891415),R=u(R,w,k,T,_[g+14],15,-1416354905),T=u(T,R,w,k,_[g+5],21,-57434055),k=u(k,T,R,w,_[g+12],6,1700485571),w=u(w,k,T,R,_[g+3],10,-1894986606),R=u(R,w,k,T,_[g+10],15,-1051523),T=u(T,R,w,k,_[g+1],21,-2054922799),k=u(k,T,R,w,_[g+8],6,1873313359),w=u(w,k,T,R,_[g+15],10,-30611744),R=u(R,w,k,T,_[g+6],15,-1560198380),T=u(T,R,w,k,_[g+13],21,1309151649),k=u(k,T,R,w,_[g+4],6,-145523070),w=u(w,k,T,R,_[g+11],10,-1120210379),R=u(R,w,k,T,_[g+2],15,718787259),T=u(T,R,w,k,_[g+9],21,-343485551),k=n(k,y),T=n(T,S),R=n(R,A),w=n(w,b);return[k,T,R,w]}function s(_){var m,g="",y=32*_.length;for(m=0;m<y;m+=8)g+=String.fromCharCode(_[m>>5]>>>m%32&255);return g}function l(_){var m,g=[];for(g[(_.length>>2)-1]=void 0,m=0;m<g.length;m+=1)g[m]=0;var y=8*_.length;for(m=0;m<y;m+=8)g[m>>5]|=(255&_.charCodeAt(m/8))<<m%32;return g}function f(_){var m,g,y="0123456789abcdef",S="";for(g=0;g<_.length;g+=1)m=_.charCodeAt(g),S+=y.charAt(m>>>4&15)+y.charAt(15&m);return S}function d(_){return unescape(encodeURIComponent(_))}function p(_){return function(_){return s(c(l(_),8*_.length))}(d(_))}function v(_,m){return function(_,m){var g,y,S=l(_),A=[],b=[];for(A[15]=b[15]=void 0,S.length>16&&(S=c(S,8*_.length)),g=0;g<16;g+=1)A[g]=909522486^S[g],b[g]=1549556828^S[g];return y=c(A.concat(l(m)),512+8*m.length),s(c(b.concat(y),640))}(d(_),d(m))}function h(_,m,g){return m?g?v(m,_):function(_,m){return f(v(_,m))}(m,_):g?p(_):function(_){return f(p(_))}(_)}_.exports?_.exports=h:m.md5=h}(Ye)}(Ct);var Nt=he(Ct.exports),Pt="function"==typeof btoa,Dt="function"==typeof Buffer;"function"==typeof TextDecoder&&new TextDecoder;var Mt,Ut="function"==typeof TextEncoder?new TextEncoder:void 0,Ft=Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=");Mt={},Ft.forEach(function(_,m){return Mt[_]=m});var Gt=String.fromCharCode.bind(String);"function"==typeof Uint8Array.from&&Uint8Array.from.bind(Uint8Array);var Ht=Pt?function(_){return btoa(_)}:Dt?function(_){return Buffer.from(_,"binary").toString("base64")}:function(_){for(var m,g,y,S,A="",b=_.length%3,k=0;k<_.length;){if((g=_.charCodeAt(k++))>255||(y=_.charCodeAt(k++))>255||(S=_.charCodeAt(k++))>255)throw new TypeError("invalid character found");A+=Ft[(m=g<<16|y<<8|S)>>18&63]+Ft[m>>12&63]+Ft[m>>6&63]+Ft[63&m]}return b?A.slice(0,b-3)+"===".substring(b):A},Bt=Dt?function(_){return Buffer.from(_).toString("base64")}:function(_){for(var m=[],g=0,y=_.length;g<y;g+=4096)m.push(Gt.apply(null,_.subarray(g,g+4096)));return Ht(m.join(""))},Je=function(_){if(_.length<2)return(m=_.charCodeAt(0))<128?_:m<2048?Gt(192|m>>>6)+Gt(128|63&m):Gt(224|m>>>12&15)+Gt(128|m>>>6&63)+Gt(128|63&m);var m=65536+1024*(_.charCodeAt(0)-55296)+(_.charCodeAt(1)-56320);return Gt(240|m>>>18&7)+Gt(128|m>>>12&63)+Gt(128|m>>>6&63)+Gt(128|63&m)},Vt=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,Kt=Dt?function(_){return Buffer.from(_,"utf8").toString("base64")}:Ut?function(_){return Bt(Ut.encode(_))}:function(_){return Ht(function(_){return _.replace(Vt,Je)}(_))},Wt=Object.defineProperty,Jt=Object.getOwnPropertyDescriptor,Ze=function(_,m,g,y){for(var S,A=y>1?void 0:y?Jt(m,g):m,b=_.length-1;b>=0;b--)(S=_[b])&&(A=(y?S(m,g,A):S(A))||A);return y&&A&&Wt(m,g,A),A},Yt=function(){function t(_){var m=this;f(this,t),this.cgiBatchSize=U.cgiBatchSize,this.reportThreshold=U.reportThreshold,this.reportDelay=U.reportDelay,this.triggerExecuteSend=function(_){var m,g=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,y=[];return function(){for(var S=arguments.length,A=new Array(S),b=0;b<S;b++)A[b]=arguments[b];return clearTimeout(m),m=setTimeout(function(){var m=_.apply(void 0,A);y.forEach(function(_){return _(m)}),y=[]},g),new Promise(function(_){return y.push(_)})}}(function(){m.executeSend()},1e3*this.reportDelay),this.inspectDelay=U.inspectDelay,this.inspectTimer=void 0,this.isNeedContinueSend=!1,this.getBaseInfo=_.getBaseInfo,this.reportLog=_.reportLog,this.queueManager=_.queueManager,this.configManager=_.configManager,this.onReportComplete=_.onReportComplete,this.onReportFail=_.onReportFail,this.flushSend(),this.startInspectTimer()}return p(t,[{key:"batchSend",value:function(){var _,m=this.queueManager.getReportableActions(this.reportThreshold);if(m.length>=this.reportThreshold)this.executeSend();else{var g=(null==(_=this.configManager)?void 0:_.getRealTimeActionList())||U.realTimeActionList;m.some(function(_){return g.indexOf(_.action_type)>-1&&!_.is_retry})?this.executeSend():this.triggerExecuteSend()}this.startInspectTimer()}},{key:"flushSend",value:function(){this.executeSend()}},{key:"executeSend",value:function(){var _=this;if(t.currentRequestCount>=t.requestConcurrency)this.isNeedContinueSend=!0;else{this.isNeedContinueSend=!1;var m=(t.requestConcurrency-t.currentRequestCount)*this.cgiBatchSize,g=this.queueManager.getReportableActions(m),y=this.getBaseInfo();if(!y.openid&&!y.unionid&&(ce.warn("请尽快调用 setOpenId 或 setUnionId 方法设置用户ID!"),g=g.filter(function(_){return null==_?void 0:_.ad_trace_id})),!(g.length<=0)){m<this.queueManager.getReportableActionsLength()&&(this.isNeedContinueSend=!0),t.currentRequestCount+=Math.ceil(g.length/this.cgiBatchSize);for(var S=[],A=0;A<g.length;A+=this.cgiBatchSize){var b=this.generateActionReportParams(g.slice(A,A+this.cgiBatchSize));S.push(this.report(b))}Promise.all(S).then(function(m){var g=m.some(function(_){return _>=0});_.isNeedContinueSend&&g&&_.executeSend()}).catch(function(m){ce.error(m),_.reportLog({message:"executeSend catch: ".concat(m.message),log_type:F,err_stack:m.stack})})}}}},{key:"generateActionReportParams",value:function(_){var m=[],g=[],y=this.getBaseInfo();return _.forEach(function(_){g.push(_.action_id);var y=Object.assign({},_);delete y.inner_status,m.push(y)}),{data:{info:y,actions:m},actionIdList:g}}},{key:"dealSuccessData",value:function(_,m,g){[51001,51003].indexOf(null==_?void 0:_.code)>-1?this.queueManager.updateActionsForReportFail(m):this.queueManager.removeActions(m),0!==(null==_?void 0:_.code)&&(this.reportLog({log_type:G,code:null==_?void 0:_.code,message:"trace_id: ".concat(null==_?void 0:_.trace_id,",msg: ").concat(null==_?void 0:_.message)}),ce.error("上报失败:",_)),this.doTrackCallbackFn(this.onReportComplete,_,g),-1===[0,51001,51003].indexOf(null==_?void 0:_.code)&&this.doTrackCallbackFn(this.onReportFail,_,g)}},{key:"dealFailData",value:function(_,m,g){this.queueManager.updateActionsForReportFail(m),this.reportLog({log_type:G,code:_.code,message:_.message}),ce.error("上报失败:",_),this.doTrackCallbackFn(this.onReportComplete,_,g)}},{key:"report",value:function(_){var m=this,g=_.data,y=_.actionIdList;return this.queueManager.updateActionsForReporting(y),ce.debug&&(ce.info("上报行为类型: ","【".concat(g.actions.map(function(_){return _.action_type}).join("、"),"】")),ce.info("上报请求参数: ",g)),new Promise(function(_){var S,A,b,k,T,R,w,I,O=Date.now();try{var E=function(_){var m="",g=null==_?void 0:_.appid,y=null==_?void 0:_.secret_key,S=null==_?void 0:_.sdk_version,A=null==_?void 0:_.timestamp;if(!(g&&y&&S&&A&&32===y.length))return m;for(var b=Nt(S+g+A),k=0;k<32;k++)m+=k%2==0?y[k]:b[k];return m}({appid:null==(S=null==g?void 0:g.info)?void 0:S.appid,secret_key:null==(A=null==g?void 0:g.info)?void 0:A.secret_key,sdk_version:null==(b=null==g?void 0:g.info)?void 0:b.sdk_version,timestamp:O}),x=function(_){return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?function(_){return _.replace(/=/g,"").replace(/[+\/]/g,function(_){return"+"==_?"-":"_"})}(Kt(_)):Kt(_)}(JSON.stringify(g));w={"Client-Time":O,"Sign-Value":Nt(x+(null==(k=null==g?void 0:g.info)?void 0:k.user_action_set_id)+(null==(T=null==g?void 0:g.info)?void 0:T.secret_key)+E),"Sign-Version":U.signVersion,"content-type":"text/plain;charset=UTF-8"},I=x}catch(E){w={"Client-Time":O},I=g,m.reportLog({log_type:W,message:"sign error msg: ".concat(null==E?void 0:E.message),err_stack:null==E?void 0:E.stack}),ce.error(E)}wx.request({url:"https://api.datanexus.qq.com/data-nexus-cgi/miniprogram",method:"POST",timeout:(null==(R=m.configManager)?void 0:R.getRequestTimeout())||U.requestTimeout,header:w,data:I,success:function(S){var A,b;ce.devLog("上报接口返回码:",null==(A=null==S?void 0:S.data)?void 0:A.code);var k=(null==(b=null==S?void 0:S.header)?void 0:b["Server-Time"])||-1;if(re.revise(k),t.currentRequestCount-=1,200===(null==S?void 0:S.statusCode))return m.dealSuccessData(null==S?void 0:S.data,y,g),void _((null==S?void 0:S.data).code);var T="";try{T="object"==l(null==S?void 0:S.data)?JSON.stringify(null==S?void 0:S.data):null==S?void 0:S.data}catch(_){ce.error(_)}var R={code:"number"==typeof(null==S?void 0:S.statusCode)?-1*S.statusCode:-888,message:"statusCode: ".concat(null==S?void 0:S.statusCode,", data: ").concat(T)};m.dealFailData(R,y,g),_(R.code)},fail:function(S){ce.devLog("上报失败:",S),t.currentRequestCount-=1;var A={code:"number"==typeof(null==S?void 0:S.errno)?-1*S.errno:-999,message:null==S?void 0:S.errMsg};m.dealFailData(A,y,g),_(A.code)}})})}},{key:"startInspectTimer",value:function(){var _=this;clearTimeout(this.inspectTimer),this.inspectTimer=setTimeout(function(){t.currentRequestCount>=t.requestConcurrency&&(t.currentRequestCount=t.requestConcurrency-1),_.executeSend(),_.startInspectTimer()},1e3*this.inspectDelay)}},{key:"doTrackCallbackFn",value:function(_,m,g){if("function"==typeof _)try{for(var y=[],S=0;S<g.actions.length;S++)if(!g.actions[S].is_sdk_auto_track){var A=g.actions[S],b=A.action_type,k=A.action_param,T=A.action_id,R=A.action_time;y.push({action_type:b,action_param:k,action_id:T,action_time:R})}if(y.length){var w=g.info,I=w.user_action_set_id,O=w.appid,E=w.openid,x=w.unionid,C=w.user_unique_id;_({code:null==m?void 0:m.code,message:null==m?void 0:m.message,data:{actions:y,info:{user_action_set_id:I,appid:O,openid:E,unionid:x,user_unique_id:C}}})}}catch(y){ce.error("返回上报回调数据异常:",y)}}}],[{key:"setRequestConcurrency",value:function(_){"number"==typeof _?_<1?ce.error("网络请求最大并发量不能小于1"):_>10?ce.error("网络请求最大并发量不能大于10"):t.requestConcurrency=_:ce.error("网络请求最大并发量需设置为数字")}}]),t}(),Qt=Yt;Qt.currentRequestCount=0,Qt.requestConcurrency=U.requestConcurrency,Ze([Lt],Qt.prototype,"batchSend",1),Ze([Lt],Qt.prototype,"flushSend",1),Ze([Lt],Qt.prototype,"executeSend",1);var zt=we,$t=Ie,Zt=Oe,Xt=Ee,en=xe,tn=Me,nn=Ce,rn=je,on=Le,an=Ne,un=De,cn=Pe,sn=function(){function e(){f(this,e)}return p(e,[{key:"install",value:function(_,m){var r=function(m){Se.subscribe(m,function(m){var g=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(y){var S=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};_.track(m,Object.assign(g||{},S,t(t({},hn,!0),yn,y)))}}(m))};r($t),r(zt),r(Zt),r(Xt),"all"===m&&(r(en),r(tn),r(nn),r(on),r(rn),r("CREATE_GAME_ROOM"),r(an),r(un),r(cn))}}]),e}(),ln=function(){function e(){f(this,e),this.special_method_symbol=Symbol("special_method_symbol")}return p(e,[{key:"onPurchase",value:function(_){return"number"!=typeof _&&ce.warn("付费金额需要为数字"),_<=0&&ce.warn("付费金额需要大于0"),this.wrapTrack("PURCHASE",{value:_})}},{key:"onEnterForeground",value:function(){return this.wrapTrack("ENTER_FOREGROUND")}},{key:"onEnterBackground",value:function(){return this.wrapTrack("ENTER_BACKGROUND")}},{key:"onAppStart",value:function(){return this.wrapTrack("START_APP")}},{key:"onAppQuit",value:function(){return this.wrapTrack("APP_QUIT")}},{key:"onAddToWishlist",value:function(){return this.wrapTrack("ADD_TO_WISHLIST")}},{key:"wrapTrack",value:function(_,m){return this.track(_,Object.assign(m||{},t({},this.special_method_symbol,1)))}}]),e}(),dn=function(){o(n,ln);var _=a(n);function n(){return f(this,n),_.apply(this,arguments)}return p(n,[{key:"onRegister",value:function(){return this.wrapTrack("REGISTER")}},{key:"onCreateRole",value:function(_){return _&&"string"!=typeof _&&ce.warn("角色名称需要为字符串"),this.wrapTrack("CREATE_ROLE",_?{name:_}:{})}},{key:"onTutorialFinish",value:function(){return this.wrapTrack("TUTORIAL_FINISH")}}]),n}(),fn="(如果确认无误,请忽略该提示)",pn=function(){var _=[];return{requestActionList:function(){try{lt({conf_name:"data_nexus_common",conf_key:"action_types"}).then(function(m){_t(m)&&(_=m)})}catch(_){ce.error(_)}},getActionList:function(){return _}}}();function Rn(_,m){try{_.is_sdk_auto_track||(function(_){try{var m=pn.getActionList();if(!m.includes(_)){var g,y=function(_){var m="undefined"!=typeof Symbol&&_[Symbol.iterator]||_["@@iterator"];if(!m){if(Array.isArray(_)||(m=n(_))){m&&(_=m);var g=0,i=function(){};return{s:i,n:function(){return g>=_.length?{done:!0}:{done:!1,value:_[g++]}},e:function(_){throw _},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var y,S=!0,A=!1;return{s:function(){m=m.call(_)},n:function(){var _=m.next();return S=_.done,_},e:function(_){A=!0,y=_},f:function(){try{S||null==m.return||m.return()}finally{if(A)throw y}}}}(m);try{for(y.s();!(g=y.n()).done;){var S=g.value;if(kn(S,_)<=parseInt((.3*S.length).toString())){ce.warn("通过SDK上报的".concat(_,"行为名称可能有误,请检查该行为类型是否为腾讯广告提供的标准行为!").concat(fn));break}}}catch(_){y.e(_)}finally{y.f()}}}catch(m){ce.error(m)}}(_.action_type),"minigame"===m?function(_,m){var g,y,S;try{["PURCHASE","ADD_TO_CART"].includes(_.action_type)&&_.action_param&&It(_.action_param,"value")&&("number"!=typeof(null==(g=_.action_param)?void 0:g.value)?ce.warn("通过SDK上报的".concat(_.action_type,"行为携带的金额参数需要为数字!")):(null==(y=_.action_param)?void 0:y.value)<=0?ce.warn("通过SDK上报的".concat(_.action_type,"行为携带的金额参数需要大于0!")):"minigame"===m&&(null==(S=_.action_param)?void 0:S.value)<100&&ce.warn("通过SDK上报的".concat(_.action_type,"行为携带的金额参数可能有误,金额的单位为‘分’,请检查金额是否正确!").concat(fn)))}catch(_){ce.error(_)}}(_,m):"miniprogram"===m&&function(_){try{var m=null==_?void 0:_.action_type,g=(null==_?void 0:_.action_param)||{};"PURCHASE"===m&&It(g,"value")&&("number"!=typeof(null==g?void 0:g.value)?ce.warn("通过SDK上报的".concat(m,"行为携带的金额参数需要为数字!")):(null==g?void 0:g.value)<=0&&ce.warn("通过SDK上报的".concat(m,"行为携带的金额参数需要大于0!")))}catch(m){ce.error(m)}}(_))}catch(_){ce.error(_)}}function kn(_,m){try{if(0===_.length)return m.length;if(0===m.length)return _.length;for(var g=[],y=0;y<=m.length;y++)g[y]=[y];for(var S=0;S<=_.length;S++)g[0][S]=S;for(var A=1;A<=m.length;A++)for(var b=1;b<=_.length;b++)m.charAt(A-1)===_.charAt(b-1)?g[A][b]=g[A-1][b-1]:g[A][b]=Math.min(g[A-1][b-1]+1,g[A][b-1]+1,g[A-1][b]+1);return g[m.length][_.length]}catch(g){ce.error(g)}}function Tn(_){try{_&&!/^[a-zA-Z0-9_\-]+$/.test(_)&&ce.warn("通过SDK上报的openid:".concat(_,"可能有误,请检查openid是否正确!").concat(fn))}catch(_){ce.error(_)}}var vn,_n=Object.defineProperty,mn=Object.getOwnPropertyDescriptor,bn=function(_,m,g,y){for(var S,A=y>1?void 0:y?mn(m,g):m,b=_.length-1;b>=0;b--)(S=_[b])&&(A=(y?S(m,g,A):S(A))||A);return y&&A&&_n(m,g,A),A},gn=Symbol("initializedInstance"),hn=Symbol("autoTrack"),yn=Symbol("actionTime"),Sn=function(){o(r,dn);var _=a(r);function r(m){var g;if(f(this,r),(g=_.call(this)).env="production",g.sdk_version="1.5.5",g.sdk_name="@dn-sdk/minigame",g.deviceInfo={},g.gameInfo={},g.session_id="",g.log_id=0,g.inited=!1,g.initErrMsg="",null==wx||!wx.createCanvas)return g.initErrMsg="不支持非微信小游戏中使用",ce.error(g.initErrMsg),u(g);var y=Ot();if(r[gn].length>=y.maxSdkInstance)return g.initErrMsg="初始化超过上限",ce.error(g.initErrMsg),u(g);var S=function(_){return ht(_)?(function(_){var m=["user_action_set_id","secret_key","appid","openid","unionid","user_unique_id","auto_track","auto_attr","on_report_fail","on_report_complete"];for(var g in _)m.includes(g)||ce.warn("Invalid property '".concat(g,"' found in config"))}(_),"number"!=typeof _.user_action_set_id?"user_action_set_id 参数需为 number 类型":_.user_action_set_id<=0?"user_action_set_id 参数需大于 0":"string"!=typeof _.secret_key?"secret_key 参数需为 string 类型":""===_.secret_key.trim()?"缺少 secret_key 参数":32!==_.secret_key.length?"secret_key 参数需为 32 位字符串":"string"!=typeof _.appid?"appid 参数需为 string 类型":""!==_.appid.trim()||"缺少 appid"):"初始化参数需为 object 类型"}(m),A=ne();if(!0!==S)return g.initErrMsg=S,ce.error(S),u(g);var b=null==A?void 0:A.appId;if(b&&b!==m.appid)return g.initErrMsg="初始化传入的appid与当前小游戏appid不一致",ce.error(g.initErrMsg),u(g);g.config=m,It(m,"auto_track")||(g.config.auto_track=bt("autoTrack")),g.openid=m.openid,g.unionid=m.unionid,g.user_unique_id=m.user_unique_id,g.onReportComplete=m.on_report_complete,g.onReportFail=m.on_report_fail,g.saveValidOpenidToStorage();var k=m.user_action_set_id;return r[gn].includes(k)?(g.initErrMsg="同个数据源[".concat(k,"]只能初始化一次"),ce.error(g.initErrMsg),g.reportLog({log_type:F,message:g.initErrMsg}),u(g)):(g.reportLog=g.reportLog.bind(c(g)),g.getTrackBaseInfo=g.getTrackBaseInfo.bind(c(g)),g.deviceInfo=Z(),g.gameInfo=se(),g.session_id=mt(),g.queueManage=new _e({userActionSetId:k,maxLength:y.maxQueueLength,ogEvents:be}),g.actionReporter=new Qt({getBaseInfo:g.getTrackBaseInfo,reportLog:g.reportLog,queueManager:g.queueManage,configManager:Ge,onReportComplete:g.onReportComplete,onReportFail:g.onReportFail}),g.inited=!0,r[gn].push(k),g.useAutoTrack(),g.doReportOnEnterBackground(),"release"===(null==A?void 0:A.envVersion)?(ce.info("初始化成功"),u(g)):(function(_){var m=_.sdk_version,g=_.default_download_url,y=_.fail_handler;lt({conf_name:_.conf_name,conf_key:_.conf_key}).then(function(_){if(ht(_)){var S=null==_?void 0:_.blackVersions,A=null==_?void 0:_.minVersion,b=null==_?void 0:_.bestVersion,k=null==_?void 0:_.downloadUrl,T=g;return k&&/^https/.test(k)&&(T=k),_t(S)&&(null==S?void 0:S.indexOf(m))>-1?(null==y||y(),void ce.error("初始化失败!当前SDK版本存在兼容问题,请尽快升级至最新版!下载地址:".concat(T))):A&&Et(m,A)<0?(null==y||y(),void ce.error("初始化失败!当前SDK版本过低,请尽快升级至最新版!下载地址:".concat(T))):(b&&Et(m,b)<0&&ce.warn("新版本SDK已上线,强烈建议您升级至最新版,尽早享受新特性!下载地址:".concat(T)),void ce.info("初始化成功"))}ce.info("初始化成功")}).catch(function(){ce.info("初始化成功")})}({conf_name:"mini_game_sdk_common",conf_key:"version",sdk_version:g.sdk_version,default_download_url:"https://sr-home-1257214331.cos.ap-guangzhou.myqcloud.com/sdk/dn-sdk-minigame/dn-sdk-minigame.zip",fail_handler:function(){g.inited=!1}}),pn.requestActionList(),Tn(m.openid),u(g)))}return p(r,[{key:"getInitResult",value:function(){return{inited:this.inited,initErrMsg:this.initErrMsg}}},{key:"track",value:function(_,m){var g,y;if(!this.inited||!this.queueManage)return ce.error("上报失败,请先完成初始化"),{code:100,message:"未完成初始化或重复初始化导致初始化失败,请先完成初始化"};var S=xt.validateActionType(_),A=xt.validateActionParam(m);if(S&&A){!this.openid&&!this.unionid&&ce.warn("缺少 openid 或 unionid");var b=bt("actionParamMaxLength");if(JSON.stringify(m||{}).length>b)return ce.error("监测到超过".concat(b,"的上报日志:").concat(_," ").concat(m)),{code:102,message:"action_param 参数过大,不能超过 ".concat(b," 字符")};var k=!(null==m||!m[hn]),T=this.createAction(_,m||{},k);"release"!==(null==(g=ne())?void 0:g.envVersion)&&Rn(T,"minigame");var R=this.queueManage.addAction(T);return null==(y=this.actionReporter)||y.batchSend(),R}return{code:101,message:"action_type 或 action_param 参数错误"}}},{key:"flush",value:function(){var _;null==(_=this.actionReporter)||_.flushSend()}},{key:"setOpenId",value:function(_){var m;if(_&&"string"==typeof _)return this.openid=_,this.gameInfo.ad_trace_id&&!$.getSync(M)&&Se.publish("START_APP"),this.flush(),this.saveValidOpenidToStorage(),"release"!==(null==(m=ne())?void 0:m.envVersion)&&Tn(_),{code:0,message:"成功"};var g="openid 格式错误";return ce.error(g),{code:101,message:g}}},{key:"setUnionId",value:function(_){if(_&&"string"==typeof _)return this.unionid=_,this.flush(),{code:0,message:"成功"};var m="unionid 格式错误";return ce.error(m),{code:101,message:m}}},{key:"setUserUniqueId",value:function(_){if(_&&"string"==typeof _)return this.user_unique_id=_,{code:0,message:"成功"};var m="user_unique_id 格式错误";return ce.error(m),{code:101,message:m}}},{key:"doReportOnEnterBackground",value:function(){var _=this;wx.onHide(function(){var m,g;null==(m=_.actionReporter)||m.flushSend(),null==(g=_.queueManage)||g.reportLostNum()})}},{key:"getTrackBaseInfo",value:function(){var _=ne();return Object.assign({},this.deviceInfo,function(_){var m={};return["user_action_set_id","appid","openid","secret_key","user_unique_id","unionid"].forEach(function(g){It(_,g)&&(m[g]=_[g])}),m}(this.config),{local_id:X(),sdk_name:this.sdk_name,sdk_version:this.sdk_version,openid:this.openid||te(),unionid:this.unionid,user_unique_id:this.user_unique_id,inner_param:{app_env_version:_.envVersion,app_version:_.version}})}},{key:"createAction",value:function(_,m){var g=arguments.length>2&&void 0!==arguments[2]&&arguments[2];null!=m&&m[hn]&&delete m[hn];var y=Date.now();null!=m&&m[yn]&&(y=null==m?void 0:m[yn],delete m[yn]);var S={action_id:mt(),action_param:m,action_time:y,action_type:_,is_retry:!1,is_sdk_auto_track:g,retry_count:0,revised_action_time:re.getRevisedcurrentTimeMillis(),log_id:++this.log_id,session_id:this.session_id,pkg_channel_id:this.gameInfo.pkg_channel_id,source_scene:this.gameInfo.source_scene,network_type:ee(),ad_trace_id:this.gameInfo.ad_trace_id,channel:this.getChannelByActionType(_)};return null!=m&&m[this.special_method_symbol]&&(this.addActionInnerParam(S,"is_special_method",!0),delete m[this.special_method_symbol]),Ge.getChannelClaimActionList().indexOf(_)>-1&&this.gameInfo.launch_options&&this.addActionInnerParam(S,"launch_options",this.gameInfo.launch_options),S}},{key:"addActionInnerParam",value:function(_,m,g){_.inner_param&&ht(_.inner_param)?_.inner_param[m]=g:_.inner_param=t({},m,g)}},{key:"getChannelByActionType",value:function(_){var m="";return Ge.getChannelClaimActionList().indexOf(_)>-1?m=this.gameInfo.channel||"":Ge.getNoClaimActionList().indexOf(_)>-1&&(m="UNKNOWN"),m}},{key:"reportLog",value:function(_){var m,g,y={user_action_set_id:null==(m=this.config)?void 0:m.user_action_set_id,appid:null==(g=this.config)?void 0:g.appid,session_id:this.session_id};ct(Object.assign(y,_))}},{key:"useAutoTrack",value:function(){var _;if(null!=(_=this.config)&&_.auto_track){var m=!0,g=$.getSync(P);(null==g?void 0:g.ap)===Y?m=!0:(null==g?void 0:g.ap)===Q&&(m=!1),"devtools"===Z().wx_platform&&(m=!0),(new sn).install(this,m?"all":"lifecycle"),We(),m&&st(),this.getAutoProxyRemoteConfig()}}},{key:"getAutoProxyRemoteConfig",value:function(){var _,m,g=Z();g.os&&g.os_version&&null!=(_=this.config)&&_.user_action_set_id&&function(_){return new Promise(function(m){wx.request({method:"POST",url:"https://api.datanexus.qq.com/data-nexus-config/v1/sdk/minigame/get",data:_,timeout:U.requestTimeout,success:function(_){ft(_,m,"minigame/get"),pt(_)},fail:function(_){dt(_,"minigame/get")}})})}({conf_name:"MG",conf_param:{user_action_set_id:null==(m=this.config)?void 0:m.user_action_set_id,sdk_version:this.sdk_version,os_type:(null==g?void 0:g.os)||"",os_version:wt(g.os_version),device_brand:(null==g?void 0:g.device_brand)||"",weixin_lib_version:(null==g?void 0:g.wx_lib_version)||"",weixin_version:(null==g?void 0:g.wx_version)||""}}).then(function(_){ht(_)&&$.setSync(P,_)})}},{key:"saveValidOpenidToStorage",value:function(){this.openid&&function(_){return/^[a-zA-Z0-9_-]{28,30}$/.test(_)}(this.openid)&&$.setSync(M,this.openid)}}],[{key:"setRequestConcurrency",value:function(_){Qt.setRequestConcurrency(_)}},{key:"setDebug",value:function(_){ce.debug=_}}]),r}(),An=Sn;An[gn]=[],bn([Lt],An.prototype,"track",1),bn([Lt,function(_,m,g){var y=g.value;return g.value=function(){if(this.inited){for(var _=arguments.length,m=new Array(_),g=0;g<_;g++)m[g]=arguments[g];return y.apply(this,m)}ce.error("上报失败,请先完成初始化")},g}],An.prototype,"flush",1),bn([Lt],An.prototype,"setOpenId",1),bn([Lt],An.prototype,"setUnionId",1),bn([Lt],An.prototype,"setUserUniqueId",1),bn([Lt],An.prototype,"doReportOnEnterBackground",1),bn([Lt],An.prototype,"getTrackBaseInfo",1),bn([Lt],An.prototype,"useAutoTrack",1);var wn=0,In={moid:""},On=!1,En=JSON.stringify(wx.getLaunchOptionsSync()||""),xn={token:"",uid:"",uname:"",openid:""},Cn={partner_id:"",game_id:"",pkg_name:"",version:""},jn={doid:"",dsid:"",dsname:"",dext:"",drid:"",drname:"",drlevel:"",dmoney:"",money:""},Ln="wx-adapter sdk >>>>>>>:";wx.hideShareMenu(),wx.onShow(function(_){_.query&&(En=JSON.stringify(_))});var Nn=function query(_){var m=function queryData(){return _objectSpread2(_objectSpread2({},I()),R)}(),g=getReqData(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({},jn),xn),Cn),m),{},{launchoption:En,onshow:En}));request(T,"/wxgamemds/index/",g).then(function(m){m.state&&(m.data.balance>=_?Dn(""):Pn(m.data,_))}).catch(function(_){console.log(_)})},Pn=function midasPay(_,m){wx.requestMidasPayment({mode:"game",env:_.env,offerId:_.offerId,currencyType:_.currencyType,platform:_.platform,buyQuantity:_.buyQuantity,outTradeNo:In.moid,success:function success(_){vn&&vn.onPurchase(100*m),Dn(_)},fail:function fail(_){console.log(_)}})},Dn=function send(_){var m;wn++;var g=function sendData(){return _objectSpread2(_objectSpread2({},I()),R)}();m=getReqData(_?_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({},jn),Cn),xn),g),In),{},{res:JSON.stringify(_),launchoption:En,onshow:En}):_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({},jn),Cn),xn),In),g),{},{launchoption:En,onshow:En})),request(T,"/wxgamemds/send/",m).then(function(_){console.log(_)}).catch(function(m){console.log(m),wn<3&&setTimeout(function(){Dn(_)},1e3)})},Mn=function jf_trace(_){return new Promise(function(m,g){var S=xn||{},A=S.token,b=S.uid,k=S.uname;if(!(On&&A&&b&&k))return y("未激活或未登录,请重新进入游戏"),g({state:100001,msg:"未激活或未登录,请检查"});var w=getReqData(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({},_),xn),Cn),function eventData(){return _objectSpread2(_objectSpread2({},I()),R)}()),{},{launchoption:En,onshow:En}));request(T,"/wxgameevent/index/",w).then(function(){m(),vn&&("create"===w.event&&vn.onCreateRole(w.drname),"levelup"===w.event&&vn.track("UPDATE_LEVEL",{level:w.drlevel,power:0}))}).catch(function(_){console.log(_),g({state:100002,msg:"角色上报失败"})})})},qn=null,Un=!1,Fn=!1,Gn=function jf_SSEventReport(_){return new Promise(function(m,g){if(!On)return g({state:100001,msg:"上报前请先激活"});if(!Array.isArray(_))return g({state:100002,msg:"入参需要数组,请检查"});if(!_.length)return g({state:100003,msg:"入参不能为数组空,请检查"});var y=_.map(function(_){return{package:S,partner_id:4,game_id:Cn.game_id,event_name:_.event_name,game_name:Cn.game_name,account_id:xn.uid||"",app_version:Cn.version,distinct_id:E().duid,event_params:_.event_params,event_time:k()}});ssRequest(T,"/report/batch/event",{body:y}).then(function(){m({state:0,msg:"上报成功!"})}).catch(function(_){g({state:100004,msg:JSON.stringify(_)})})})};_.jf_SSEventReport=Gn,_.jf_SSUserPropsReport=function jf_SSUserPropsReport(_){return new Promise(function(m,g){if(!On)return g({state:100001,msg:"上报前请先激活"});if(!Array.isArray(_))return g({state:100002,msg:"入参需要数组,请检查"});if(!_.length)return g({state:100003,msg:"入参不能为数组空,请检查"});var y=_.map(function(_){return{partner_id:4,game_id:Cn.game_id,distinct_id:E().duid,account_id:xn.uid||"",game_name:Cn.game_name,event_params:_.event_params}});ssRequest(T,"/report/batch/attribute",{body:y}).then(function(){m({state:0,msg:"上报成功!"})}).catch(function(_){g({state:100004,msg:JSON.stringify(_)})})})},_.jf_active=function jf_active(_){return new Promise(function(m,g){if(!_)return g({state:100001,msg:"激活入参缺失"});if(null==_||!_.wx)return g({state:100002,msg:"激活入参 wx 属性缺失"});var y=_.wx,A=y.game_id,b=y.version,k=y.dn_sdk_id,T=y.dn_secret_key,R=y.game_name;if(!A)return g({state:100003,msg:"激活入参 game_id 属性缺失"});Cn.game_id=A,Cn.game_name=R,Cn.version=b,Cn.pkg_name=S,Cn.partner_id=4,On=!0,console.log("active 激活成功!"),k&&T&&function HandleSDKInit(_){var m=_.dn_sdk_id,g=_.dn_secret_key,y=_.app_id,S=(vn=new An({appid:y,secret_key:g,user_action_set_id:m})).getInitResult();null!=S&&S.inited||console.error("dnSdk init failed: ",S.initErrMsg),vn.onAppStart(),wx.onAddToFavorites(function(_){console.log(Ln+"click onAddToFavorites"),vn&&vn.track("DD_TO_WISHLIST",{type:"default"})}),wx.onShareAppMessage(function(){console.log(Ln+"click onShareAppMessage"),vn&&vn.track("SHARE",{target:"APP_MESSAGE"})}),wx.onShareTimeline(function(){console.log(Ln+"click onShareTimeline"),vn&&vn.track("SHARE",{target:"TIME_LINE"})}),console.log(Ln+"广点通初始化成功!")}(wx),m(),Gn([{event_name:"game_open",event_params:{}}])})},_.jf_createRewardedVideoAd=function jf_createRewardedVideoAd(_){var m=function preload(){return new Promise(function(m,g){if(Un)return m();qn&&(qn=null),(qn=wx.createRewardedVideoAd({adUnitId:_})).onError(function(_){Un=!1,qn=null,g({state:100004,msg:"广告平台异常",originalErr:_})}),qn.load().then(function(){console.log("激励视频广告预加载成功"),Un=!0,m()}).catch(function(_){console.error("激励视频广告预加载失败:",_),Un=!1,qn=null,g(_)})})},g=function show(){return Fn?Promise.reject({state:100004,msg:"广告正在展示中,请稍后再试"}):Un?qn?(Fn=!0,new Promise(function(_,m){qn.onClose(function(m){console.log("激励视频广告关闭,是否看完:",m.isEnded),_({isEnded:m.isEnded}),Fn=!1,qn.offClose();try{m.isEnded&&Mn({event:"motivation_video"}).then(function(){console.log("jf 激励视频看完数据上报成功:>>>>")}).catch(function(){console.log("jf 激励视频看完数据上报失败:>>>>")})}catch(_){}}),qn.show().then(function(){console.log("激励视频广告展示成功")}).catch(function(_){Un=!1,Fn=!1,m({state:100003,msg:JSON.stringify(_)})})})):Promise.reject({state:100002,msg:"广告实例不存在"}):m().then(g).catch(function(_){return Promise.reject({state:100001,msg:JSON.stringify(_)})})};return{preload:m,show:g}},_.jf_customerService=function jf_customerService(_){wx.openCustomerServiceConversation({success:function success(){Mn(_objectSpread2(_objectSpread2({},deepClone(_)),{},{event:"kfclick"}))}})},_.jf_getUserInfo=function jf_getUserInfo(){return new Promise(function(_,m){wx.getSetting({success:function success(g){g.authSetting["scope.userInfo"]?wx.getUserInfo({success:function success(m){return _(m.userInfo)},fail:function fail(_){return m({state:100001,msg:JSON.stringify(_)})}}):wx.getUserProfile({desc:"获取用户信息",success:function success(m){return _(m.userInfo)},fail:function fail(_){return m({state:100002,msg:JSON.stringify(_)})}})}})})},_.jf_login=function jf_login(){return new Promise(function(_,m){if(!On)return m({state:100003,msg:"登录前请先激活"});wx.login({success:function success(g){var S=getReqData(_objectSpread2(_objectSpread2(_objectSpread2({code:g.code},Cn),E()),{},{launchoption:En,onshow:En}));request(T,"/wxgamelogin/initlogin/",S).then(function(g){if(1==g.state){var S=g.data,A=S.token,b=S.uid,k=S.uname,T=S.openid;if(xn.token=A,xn.uid=b,xn.uname=k,xn.openid=T,wx.setStorageSync("jfGamekitSSToken",A),_(_objectSpread2(_objectSpread2({},g.data),{},{partner_id:4})),console.log(Ln+"登录成功"),T&&vn){var R=g||{},w=R.backFlowDay,I=R.isRegisterUser;!function handleLoginTrace(_){var m=_.openid,g=_.nsSdk,y=_.backFlowDay,S=_.isRegisterUser;g.setOpenId(m),S?g.onRegister():y&&y>=30&&g.track("RE_ACTIVE",{backFlowDay:30})}({openid:T,nsSdk:vn,backFlowDay:w,isRegisterUser:I})}Gn([{event_name:"account_login",event_params:{}}])}else y(g.msg),m({state:g.state,msg:g.msg})}).catch(function(_){y(_),m({state:100001,msg:_})})},fail:function fail(_){m({state:100002,msg:_})}})})},_.jf_pay=function jf_pay(_){return new Promise(function(m,g){var S=xn||{},A=S.token,b=S.uid,k=S.uname;if(!(On&&A&&b&&k))return y("失败!请先激活登录"),g({state:100001,msg:"未激活或未登录,请重新进入游戏"});wx.showLoading({title:"加载中"});var w=_.dmoney;(jn=deepClone(_)||{}).money=w;var x=getReqData(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({},_),Cn),xn),function orderData(){return _objectSpread2(_objectSpread2(_objectSpread2({},I()),O()),R)}()),{},{money:w,launchoption:En,onshow:En}));request(T,"/wxgameorder/index/",x).then(function(_){var S=_||{},A=S.state,b=S.msg,k=S.data,R=void 0===k?{}:k;if(1==A){var I=R.aid,O=R.moid,x=R.thumb_url;In.moid=O,1==I?(Nn(w),m({msg:"ok"})):2==I?wx.showModal({title:"支付提示",content:"即将打开充值入口,输入“充值”或点击右下角卡片即可充值。",showCancel:!1,confirmText:"点我充值",success:function success(_){_.confirm?wx.openCustomerServiceConversation({sessionFrom:O,sendMessagePath:"/path/index/index?moid="+O,showMessageCard:!0,sendMessageImg:x,success:function success(_){console.log("openCustomerServiceConversation success",_),m()},fail:function fail(_){console.error("openCustomerServiceConversation fail ",_),g({state:100003,msg:"支付失败"})},complete:function complete(_){console.log("openCustomerServiceConversation compelte: ",O),function onNsSdkPurChase(_){var m=E(),g=getReqData({partner_id:Cn.partner_id,pkg_name:Cn.pkg_name,game_id:Cn.game_id,uid:xn.uid,openid:xn.openid,token:xn.token,uname:xn.uname,duid:m.duid,moid:_});request(T,"/wxgameorder/get/",g).then(function(_){1==_.data.status&&vn.onPurchase(100*_.data.money)})}(O)}}):(y("用户取消支付"),g({state:100005,msg:"取消支付"}))},fail:function fail(){y("用户取消支付"),g({state:100006,msg:"支付失败"})}}):(y("失败!设备未识别"),g({state:100004,msg:"支付失败"}))}else y(b),g({state:A,msg:b});wx.hideLoading()}).catch(function(_){y(_),g({state:100002,msg:"支付失败"}),wx.hideLoading()})})},_.jf_profanityCheck=function jf_profanityCheck(_){return new Promise(function(m,g){var y=getReqData(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({},_),Cn),xn),E()),{},{launchoption:En,onshow:En,partner_id:4}));request(T,"/wxgamesafe/verify/",y).then(function(_){var y=_.data,S=y.code,A=y.msg;1==S?m():g({state:100001,msg:A})}).catch(function(_){g({state:100002,msg:_})})})},_.jf_share=function jf_share(_){wx.shareAppMessage(_),Mn(_objectSpread2(_objectSpread2({},deepClone(_)),{},{event:"fxclick"}))},_.jf_showInterstitialAd=function jf_showInterstitialAd(_){return new Promise(function(m,g){var y=!1,S=wx.createInterstitialAd({adUnitId:_});S.onError(function(_){y=!0}),S.load().then(function(){if(!y)return S.show();g({state:100001,msg:"广告加载后发生错误"})}).then(m).catch(function(_){return g({state:100002,msg:JSON.stringify(_)})}),S.onClose(function(_){console.log("广告关闭:",_.isEnded?"正常播放完成":"用户提前关闭")})})},_.jf_trace=Mn,_.jf_tracePageView=function jf_tracePageView(_){return new Promise(function(m,g){vn?(vn.track("VIEW_CONTENT",{item:_}),m()):g({state:100001,msg:"上报失败!广点通 sdk 未初始化"})})},Object.defineProperty(_,"__esModule",{value:!0})});