Socket
Socket
Sign inDemoInstall

@intlsdk/report

Package Overview
Dependencies
5
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.3.0 to 1.4.0

2

dist/index.es.js

@@ -1,1 +0,1 @@

var n,t,e,r,o,s,i=Object.defineProperty,a=Object.getOwnPropertySymbols,c=Object.prototype.hasOwnProperty,u=Object.prototype.propertyIsEnumerable,p=(n,t,e)=>t in n?i(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,d=(n,t)=>{for(var e in t||(t={}))c.call(t,e)&&p(n,e,t[e]);if(a)for(var e of a(t))u.call(t,e)&&p(n,e,t[e]);return n},h=(n,t)=>{var e={};for(var r in n)c.call(n,r)&&t.indexOf(r)<0&&(e[r]=n[r]);if(null!=n&&a)for(var r of a(n))t.indexOf(r)<0&&u.call(n,r)&&(e[r]=n[r]);return e};function f(n,t=!1){return(t?Object.keys(n).sort():Object.keys(n)).map((t=>{return`${t}=${e=n[t],(["number","string","boolean"].includes(typeof e)?String(e):"").replace(/=/g,"%3d").replace(/\|/g,"%7C").replace(/&/g,"%26").replace(/\n/g,"%0D")}`;var e})).join("&")}function l(){return Math.round(Date.now()/1e3)}function m(){const{navigator:n}=window,t=n.connection||n.mozConnection||n.webkitConnection;return t&&(t.type||t.effectiveType)}function g(){try{const{performance:n}=window;return Math.round(n.memory.totalJSHeapSize/1024/1024)||0}catch(n){return 0}}function y(){try{return window.navigator.platform}catch(n){return""}}(t=n||(n={}))[t.Android=1]="Android",t[t.iOS=2]="iOS",t[t.Web=3]="Web",t[t.Linux=4]="Linux",t[t.Windows=5]="Windows",t[t.Nintendo=6]="Nintendo",t[t.Mac=7]="Mac",t[t.Playstation=8]="Playstation",t[t.XBox=9]="XBox",(r=e||(e={}))[r.Guest=3]="Guest",r[r.Facebook=4]="Facebook",r[r.GameCenter=5]="GameCenter",r[r.GooglePlay=6]="GooglePlay",r[r.Twitter=9]="Twitter",r[r.Garena=10]="Garena",r[r.Nintendo=13]="Nintendo",r[r.Line=14]="Line",r[r.Apple=15]="Apple",r[r.Kwai=17]="Kwai",r[r.XBox=20]="XBox",r[r.Steam=21]="Steam",r[r.Playstation=22]="Playstation",r[r.Epic=24]="Epic",r[r.Discord=26]="Discord",r[r.PlayStation5=27]="PlayStation5",r[r.Twitch=28]="Twitch",r[r.FacebookInstantGame=29]="FacebookInstantGame",r[r.DMM=30]="DMM",(s=o||(o={}))[s.Client=0]="Client",s[s.Server=1]="Server";var v,_,b={exports:{}},w={exports:{}};v="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",_={rotl:function(n,t){return n<<t|n>>>32-t},rotr:function(n,t){return n<<32-t|n>>>t},endian:function(n){if(n.constructor==Number)return 16711935&_.rotl(n,8)|4278255360&_.rotl(n,24);for(var t=0;t<n.length;t++)n[t]=_.endian(n[t]);return n},randomBytes:function(n){for(var t=[];n>0;n--)t.push(Math.floor(256*Math.random()));return t},bytesToWords:function(n){for(var t=[],e=0,r=0;e<n.length;e++,r+=8)t[r>>>5]|=n[e]<<24-r%32;return t},wordsToBytes:function(n){for(var t=[],e=0;e<32*n.length;e+=8)t.push(n[e>>>5]>>>24-e%32&255);return t},bytesToHex:function(n){for(var t=[],e=0;e<n.length;e++)t.push((n[e]>>>4).toString(16)),t.push((15&n[e]).toString(16));return t.join("")},hexToBytes:function(n){for(var t=[],e=0;e<n.length;e+=2)t.push(parseInt(n.substr(e,2),16));return t},bytesToBase64:function(n){for(var t=[],e=0;e<n.length;e+=3)for(var r=n[e]<<16|n[e+1]<<8|n[e+2],o=0;o<4;o++)8*e+6*o<=8*n.length?t.push(v.charAt(r>>>6*(3-o)&63)):t.push("=");return t.join("")},base64ToBytes:function(n){n=n.replace(/[^A-Z0-9+\/]/gi,"");for(var t=[],e=0,r=0;e<n.length;r=++e%4)0!=r&&t.push((v.indexOf(n.charAt(e-1))&Math.pow(2,-2*r+8)-1)<<2*r|v.indexOf(n.charAt(e))>>>6-2*r);return t}},w.exports=_;var T={utf8:{stringToBytes:function(n){return T.bin.stringToBytes(unescape(encodeURIComponent(n)))},bytesToString:function(n){return decodeURIComponent(escape(T.bin.bytesToString(n)))}},bin:{stringToBytes:function(n){for(var t=[],e=0;e<n.length;e++)t.push(255&n.charCodeAt(e));return t},bytesToString:function(n){for(var t=[],e=0;e<n.length;e++)t.push(String.fromCharCode(n[e]));return t.join("")}}},S=T,I=function(n){return null!=n&&(O(n)||function(n){return"function"==typeof n.readFloatLE&&"function"==typeof n.slice&&O(n.slice(0,0))}(n)||!!n._isBuffer)};function O(n){return!!n.constructor&&"function"==typeof n.constructor.isBuffer&&n.constructor.isBuffer(n)}!function(){var n=w.exports,t=S.utf8,e=I,r=S.bin,o=function(s,i){s.constructor==String?s=i&&"binary"===i.encoding?r.stringToBytes(s):t.stringToBytes(s):e(s)?s=Array.prototype.slice.call(s,0):Array.isArray(s)||s.constructor===Uint8Array||(s=s.toString());for(var a=n.bytesToWords(s),c=8*s.length,u=1732584193,p=-271733879,d=-1732584194,h=271733878,f=0;f<a.length;f++)a[f]=16711935&(a[f]<<8|a[f]>>>24)|4278255360&(a[f]<<24|a[f]>>>8);a[c>>>5]|=128<<c%32,a[14+(c+64>>>9<<4)]=c;var l=o._ff,m=o._gg,g=o._hh,y=o._ii;for(f=0;f<a.length;f+=16){var v=u,_=p,b=d,w=h;u=l(u,p,d,h,a[f+0],7,-680876936),h=l(h,u,p,d,a[f+1],12,-389564586),d=l(d,h,u,p,a[f+2],17,606105819),p=l(p,d,h,u,a[f+3],22,-1044525330),u=l(u,p,d,h,a[f+4],7,-176418897),h=l(h,u,p,d,a[f+5],12,1200080426),d=l(d,h,u,p,a[f+6],17,-1473231341),p=l(p,d,h,u,a[f+7],22,-45705983),u=l(u,p,d,h,a[f+8],7,1770035416),h=l(h,u,p,d,a[f+9],12,-1958414417),d=l(d,h,u,p,a[f+10],17,-42063),p=l(p,d,h,u,a[f+11],22,-1990404162),u=l(u,p,d,h,a[f+12],7,1804603682),h=l(h,u,p,d,a[f+13],12,-40341101),d=l(d,h,u,p,a[f+14],17,-1502002290),u=m(u,p=l(p,d,h,u,a[f+15],22,1236535329),d,h,a[f+1],5,-165796510),h=m(h,u,p,d,a[f+6],9,-1069501632),d=m(d,h,u,p,a[f+11],14,643717713),p=m(p,d,h,u,a[f+0],20,-373897302),u=m(u,p,d,h,a[f+5],5,-701558691),h=m(h,u,p,d,a[f+10],9,38016083),d=m(d,h,u,p,a[f+15],14,-660478335),p=m(p,d,h,u,a[f+4],20,-405537848),u=m(u,p,d,h,a[f+9],5,568446438),h=m(h,u,p,d,a[f+14],9,-1019803690),d=m(d,h,u,p,a[f+3],14,-187363961),p=m(p,d,h,u,a[f+8],20,1163531501),u=m(u,p,d,h,a[f+13],5,-1444681467),h=m(h,u,p,d,a[f+2],9,-51403784),d=m(d,h,u,p,a[f+7],14,1735328473),u=g(u,p=m(p,d,h,u,a[f+12],20,-1926607734),d,h,a[f+5],4,-378558),h=g(h,u,p,d,a[f+8],11,-2022574463),d=g(d,h,u,p,a[f+11],16,1839030562),p=g(p,d,h,u,a[f+14],23,-35309556),u=g(u,p,d,h,a[f+1],4,-1530992060),h=g(h,u,p,d,a[f+4],11,1272893353),d=g(d,h,u,p,a[f+7],16,-155497632),p=g(p,d,h,u,a[f+10],23,-1094730640),u=g(u,p,d,h,a[f+13],4,681279174),h=g(h,u,p,d,a[f+0],11,-358537222),d=g(d,h,u,p,a[f+3],16,-722521979),p=g(p,d,h,u,a[f+6],23,76029189),u=g(u,p,d,h,a[f+9],4,-640364487),h=g(h,u,p,d,a[f+12],11,-421815835),d=g(d,h,u,p,a[f+15],16,530742520),u=y(u,p=g(p,d,h,u,a[f+2],23,-995338651),d,h,a[f+0],6,-198630844),h=y(h,u,p,d,a[f+7],10,1126891415),d=y(d,h,u,p,a[f+14],15,-1416354905),p=y(p,d,h,u,a[f+5],21,-57434055),u=y(u,p,d,h,a[f+12],6,1700485571),h=y(h,u,p,d,a[f+3],10,-1894986606),d=y(d,h,u,p,a[f+10],15,-1051523),p=y(p,d,h,u,a[f+1],21,-2054922799),u=y(u,p,d,h,a[f+8],6,1873313359),h=y(h,u,p,d,a[f+15],10,-30611744),d=y(d,h,u,p,a[f+6],15,-1560198380),p=y(p,d,h,u,a[f+13],21,1309151649),u=y(u,p,d,h,a[f+4],6,-145523070),h=y(h,u,p,d,a[f+11],10,-1120210379),d=y(d,h,u,p,a[f+2],15,718787259),p=y(p,d,h,u,a[f+9],21,-343485551),u=u+v>>>0,p=p+_>>>0,d=d+b>>>0,h=h+w>>>0}return n.endian([u,p,d,h])};o._ff=function(n,t,e,r,o,s,i){var a=n+(t&e|~t&r)+(o>>>0)+i;return(a<<s|a>>>32-s)+t},o._gg=function(n,t,e,r,o,s,i){var a=n+(t&r|e&~r)+(o>>>0)+i;return(a<<s|a>>>32-s)+t},o._hh=function(n,t,e,r,o,s,i){var a=n+(t^e^r)+(o>>>0)+i;return(a<<s|a>>>32-s)+t},o._ii=function(n,t,e,r,o,s,i){var a=n+(e^(t|~r))+(o>>>0)+i;return(a<<s|a>>>32-s)+t},o._blocksize=16,o._digestsize=16,b.exports=function(t,e){if(null==t)throw new Error("Illegal argument "+t);var s=n.wordsToBytes(o(t,e));return e&&e.asBytes?s:e&&e.asString?r.bytesToString(s):n.bytesToHex(s)}}();var x=b.exports;function j(n,t,e={}){return new Promise(((r,o)=>{const s=new XMLHttpRequest;s.open("POST",n),s.onreadystatechange=()=>{if(s.readyState===s.DONE)if(200===s.status){const n="string"==typeof s.response?function(n,t={}){try{return JSON.parse(n)}catch(e){return console.warn(`Failed to parse json: ${n}`,e),t}}(s.response):s.response;0!==n.ret?o(new Error(n.msg||`Response Error Code: ${n.ret}`)):r(n)}else o(new Error(`HTTP Error: ${s.status}`))},s.responseType="json",Object.keys(e).forEach((n=>{s.setRequestHeader(n,e[n])})),s.send(t)}))}async function B(n,t,e,r,o,s={}){const{os:i,gameId:a,channelId:c,source:u,sdkVersion:p,seq:d,ts:h}=r,l={os:i,gameid:a,channelid:c,source:u,sdk_version:p,seq:d,ts:h},m=function(n,t,e={},r=""){const o=f(e,!0);return x(`${t}?${o}${r}${n}`)}(n,e,l,o);Object.assign(l,{sig:m});const g=f(l);return await j(`${t}${e}?${g}`,o,s)}function C(){return`----WebKitFormBoundary${function(n){const t="abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNOPQRSTUVWXYZ1234567890",e=t.length,r=[];for(let o=n;o>0;--o)r.push(t[Math.round(Math.random()*(e-1))]);return r.join("")}(16)}`}async function $(n,t,e,r,o){const s=JSON.stringify(function(n){const t=n,{sessionId:e,appVersion:r}=t,o=h(t,["sessionId","appVersion"]);return d({session_id:e,app_version:r},o)}(r)),i=o.map(k).join("\n"),{headers:a,body:c}=function(n,t){const e=C();return{headers:{"Content-Type":`multipart/form-data; boundary=${e}`},body:`--${e}\nContent-Disposition: form-data; name="meta"\n\n${n}\n--${e}\nContent-Disposition: form-data; name="log"; filename="kvlog"\nContent-Type: text/plain\n\n${t}\n--${e}--\n`.split("\n").join("\r\n")}}(s,i);return await B(n,t,"/v2/dr/kv",e,c,a)}function k(n){const t=n,{eventName:e,srcId:r}=t,o=h(t,["eventName","srcId"]);return`${["insight",r,e].join("_")}|${f(o)}`}class A{constructor(){this.options={os:n.Web,source:o.Client,sdkVersion:"1.3.0"},this.seq=0,this.initialized=!1,this.caches=[]}async init(n){try{this.initialized=!1,Object.assign(this.options,n);const{sigKey:t,env:e}=this.options,r=await async function(n,t,e){return(await B(n,t,"/v2/dr/getsid",e,"{}")).session_id}(t,this.envToUrl(e),this.params);return Object.assign(this.options,{sessionId:r}),this.initialized=!0,this.reportEvents({eventName:"start",srcId:1}),this.caches.length>0&&(this.reportEvents(this.caches),this.caches.length=0),r}catch(t){return console.warn("init report error",t),t}}extend(n){Object.assign(this.options,n)}reportEvents(n){try{if(!this.initialized)return void(Array.isArray(n)?this.caches=this.caches.concat(n):this.caches.push(n));const{sigKey:t,env:e}=this.options,r=Array.isArray(n)?n:[n];return $(t,this.envToUrl(e),this.params,this.meta,this.mergeCommonKV(r))}catch(t){return console.warn("reportEvents error",t),t}}envToUrl(n){return n.includes("//")?n:`https://${n}.intlgame.com`}mergeCommonKV(n){const{os:t,gameId:e,channelId:r,sdkVersion:o,appVersion:s,openId:i}=this.options;return n.map((n=>{const{eventName:a,srcId:c}=n;return d({comm_c_gameid:e,comm_c_client_source:c,comm_c_event_name:a,comm_c_os:t,comm_c_create_ts:l(),comm_c_app_version:s,comm_c_device_model:window.navigator.userAgent,comm_c_device_brand:window.navigator.vendor,comm_c_screen_width:window.screen.width,comm_c_screen_height:window.screen.height,comm_c_sdk_version:o,comm_c_network_type:m(),comm_c_ram_total:g(),comm_c_rom_total:g(),comm_c_cpu_name:y(),comm_c_openid:i,comm_c_channelid:r},n)}))}get meta(){const{sessionId:n,appVersion:t}=this.options;return{sessionId:n,appVersion:t,ts:l()}}get params(){const{os:n,gameId:t,channelId:e,source:r,sdkVersion:o}=this.options;return this.seq+=1,{os:n,gameId:t,channelId:e,source:r,sdkVersion:o,seq:this.seq,ts:l()}}}var E=new A;export{e as Channel,A as IntlgameReport,n as OS,o as Source,E as default};
var n,t,e,r,o,s,i=Object.defineProperty,a=Object.getOwnPropertySymbols,c=Object.prototype.hasOwnProperty,u=Object.prototype.propertyIsEnumerable,d=(n,t,e)=>t in n?i(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,p=(n,t)=>{for(var e in t||(t={}))c.call(t,e)&&d(n,e,t[e]);if(a)for(var e of a(t))u.call(t,e)&&d(n,e,t[e]);return n},h=(n,t)=>{var e={};for(var r in n)c.call(n,r)&&t.indexOf(r)<0&&(e[r]=n[r]);if(null!=n&&a)for(var r of a(n))t.indexOf(r)<0&&u.call(n,r)&&(e[r]=n[r]);return e};function f(n,t=!1){return(t?Object.keys(n).sort():Object.keys(n)).map((t=>{return`${t}=${e=n[t],(["number","string","boolean"].includes(typeof e)?String(e):"").replace(/=/g,"%3d").replace(/\|/g,"%7C").replace(/&/g,"%26").replace(/\n/g,"%0D")}`;var e})).join("&")}function l(){return Math.round(Date.now()/1e3)}function m(){const{navigator:n}=window,t=n.connection||n.mozConnection||n.webkitConnection;return t&&(t.type||t.effectiveType)}function g(){try{const{performance:n}=window;return Math.round(n.memory.totalJSHeapSize/1024/1024)||0}catch(n){return 0}}function y(){try{return window.navigator.platform}catch(n){return""}}(t=n||(n={}))[t.Android=1]="Android",t[t.iOS=2]="iOS",t[t.Web=3]="Web",t[t.Linux=4]="Linux",t[t.Windows=5]="Windows",t[t.Nintendo=6]="Nintendo",t[t.Mac=7]="Mac",t[t.Playstation=8]="Playstation",t[t.XBox=9]="XBox",(r=e||(e={}))[r.Guest=3]="Guest",r[r.Facebook=4]="Facebook",r[r.GameCenter=5]="GameCenter",r[r.GooglePlay=6]="GooglePlay",r[r.Twitter=9]="Twitter",r[r.Garena=10]="Garena",r[r.Nintendo=13]="Nintendo",r[r.Line=14]="Line",r[r.Apple=15]="Apple",r[r.Kwai=17]="Kwai",r[r.XBox=20]="XBox",r[r.Steam=21]="Steam",r[r.Playstation=22]="Playstation",r[r.Epic=24]="Epic",r[r.Discord=26]="Discord",r[r.PlayStation5=27]="PlayStation5",r[r.Twitch=28]="Twitch",r[r.FacebookInstantGame=29]="FacebookInstantGame",r[r.DMM=30]="DMM",(s=o||(o={}))[s.Client=0]="Client",s[s.Server=1]="Server";var v,_,b={exports:{}},w={exports:{}};v="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",_={rotl:function(n,t){return n<<t|n>>>32-t},rotr:function(n,t){return n<<32-t|n>>>t},endian:function(n){if(n.constructor==Number)return 16711935&_.rotl(n,8)|4278255360&_.rotl(n,24);for(var t=0;t<n.length;t++)n[t]=_.endian(n[t]);return n},randomBytes:function(n){for(var t=[];n>0;n--)t.push(Math.floor(256*Math.random()));return t},bytesToWords:function(n){for(var t=[],e=0,r=0;e<n.length;e++,r+=8)t[r>>>5]|=n[e]<<24-r%32;return t},wordsToBytes:function(n){for(var t=[],e=0;e<32*n.length;e+=8)t.push(n[e>>>5]>>>24-e%32&255);return t},bytesToHex:function(n){for(var t=[],e=0;e<n.length;e++)t.push((n[e]>>>4).toString(16)),t.push((15&n[e]).toString(16));return t.join("")},hexToBytes:function(n){for(var t=[],e=0;e<n.length;e+=2)t.push(parseInt(n.substr(e,2),16));return t},bytesToBase64:function(n){for(var t=[],e=0;e<n.length;e+=3)for(var r=n[e]<<16|n[e+1]<<8|n[e+2],o=0;o<4;o++)8*e+6*o<=8*n.length?t.push(v.charAt(r>>>6*(3-o)&63)):t.push("=");return t.join("")},base64ToBytes:function(n){n=n.replace(/[^A-Z0-9+\/]/gi,"");for(var t=[],e=0,r=0;e<n.length;r=++e%4)0!=r&&t.push((v.indexOf(n.charAt(e-1))&Math.pow(2,-2*r+8)-1)<<2*r|v.indexOf(n.charAt(e))>>>6-2*r);return t}},w.exports=_;var T={utf8:{stringToBytes:function(n){return T.bin.stringToBytes(unescape(encodeURIComponent(n)))},bytesToString:function(n){return decodeURIComponent(escape(T.bin.bytesToString(n)))}},bin:{stringToBytes:function(n){for(var t=[],e=0;e<n.length;e++)t.push(255&n.charCodeAt(e));return t},bytesToString:function(n){for(var t=[],e=0;e<n.length;e++)t.push(String.fromCharCode(n[e]));return t.join("")}}},S=T,I=function(n){return null!=n&&(O(n)||function(n){return"function"==typeof n.readFloatLE&&"function"==typeof n.slice&&O(n.slice(0,0))}(n)||!!n._isBuffer)};function O(n){return!!n.constructor&&"function"==typeof n.constructor.isBuffer&&n.constructor.isBuffer(n)}!function(){var n=w.exports,t=S.utf8,e=I,r=S.bin,o=function(s,i){s.constructor==String?s=i&&"binary"===i.encoding?r.stringToBytes(s):t.stringToBytes(s):e(s)?s=Array.prototype.slice.call(s,0):Array.isArray(s)||s.constructor===Uint8Array||(s=s.toString());for(var a=n.bytesToWords(s),c=8*s.length,u=1732584193,d=-271733879,p=-1732584194,h=271733878,f=0;f<a.length;f++)a[f]=16711935&(a[f]<<8|a[f]>>>24)|4278255360&(a[f]<<24|a[f]>>>8);a[c>>>5]|=128<<c%32,a[14+(c+64>>>9<<4)]=c;var l=o._ff,m=o._gg,g=o._hh,y=o._ii;for(f=0;f<a.length;f+=16){var v=u,_=d,b=p,w=h;u=l(u,d,p,h,a[f+0],7,-680876936),h=l(h,u,d,p,a[f+1],12,-389564586),p=l(p,h,u,d,a[f+2],17,606105819),d=l(d,p,h,u,a[f+3],22,-1044525330),u=l(u,d,p,h,a[f+4],7,-176418897),h=l(h,u,d,p,a[f+5],12,1200080426),p=l(p,h,u,d,a[f+6],17,-1473231341),d=l(d,p,h,u,a[f+7],22,-45705983),u=l(u,d,p,h,a[f+8],7,1770035416),h=l(h,u,d,p,a[f+9],12,-1958414417),p=l(p,h,u,d,a[f+10],17,-42063),d=l(d,p,h,u,a[f+11],22,-1990404162),u=l(u,d,p,h,a[f+12],7,1804603682),h=l(h,u,d,p,a[f+13],12,-40341101),p=l(p,h,u,d,a[f+14],17,-1502002290),u=m(u,d=l(d,p,h,u,a[f+15],22,1236535329),p,h,a[f+1],5,-165796510),h=m(h,u,d,p,a[f+6],9,-1069501632),p=m(p,h,u,d,a[f+11],14,643717713),d=m(d,p,h,u,a[f+0],20,-373897302),u=m(u,d,p,h,a[f+5],5,-701558691),h=m(h,u,d,p,a[f+10],9,38016083),p=m(p,h,u,d,a[f+15],14,-660478335),d=m(d,p,h,u,a[f+4],20,-405537848),u=m(u,d,p,h,a[f+9],5,568446438),h=m(h,u,d,p,a[f+14],9,-1019803690),p=m(p,h,u,d,a[f+3],14,-187363961),d=m(d,p,h,u,a[f+8],20,1163531501),u=m(u,d,p,h,a[f+13],5,-1444681467),h=m(h,u,d,p,a[f+2],9,-51403784),p=m(p,h,u,d,a[f+7],14,1735328473),u=g(u,d=m(d,p,h,u,a[f+12],20,-1926607734),p,h,a[f+5],4,-378558),h=g(h,u,d,p,a[f+8],11,-2022574463),p=g(p,h,u,d,a[f+11],16,1839030562),d=g(d,p,h,u,a[f+14],23,-35309556),u=g(u,d,p,h,a[f+1],4,-1530992060),h=g(h,u,d,p,a[f+4],11,1272893353),p=g(p,h,u,d,a[f+7],16,-155497632),d=g(d,p,h,u,a[f+10],23,-1094730640),u=g(u,d,p,h,a[f+13],4,681279174),h=g(h,u,d,p,a[f+0],11,-358537222),p=g(p,h,u,d,a[f+3],16,-722521979),d=g(d,p,h,u,a[f+6],23,76029189),u=g(u,d,p,h,a[f+9],4,-640364487),h=g(h,u,d,p,a[f+12],11,-421815835),p=g(p,h,u,d,a[f+15],16,530742520),u=y(u,d=g(d,p,h,u,a[f+2],23,-995338651),p,h,a[f+0],6,-198630844),h=y(h,u,d,p,a[f+7],10,1126891415),p=y(p,h,u,d,a[f+14],15,-1416354905),d=y(d,p,h,u,a[f+5],21,-57434055),u=y(u,d,p,h,a[f+12],6,1700485571),h=y(h,u,d,p,a[f+3],10,-1894986606),p=y(p,h,u,d,a[f+10],15,-1051523),d=y(d,p,h,u,a[f+1],21,-2054922799),u=y(u,d,p,h,a[f+8],6,1873313359),h=y(h,u,d,p,a[f+15],10,-30611744),p=y(p,h,u,d,a[f+6],15,-1560198380),d=y(d,p,h,u,a[f+13],21,1309151649),u=y(u,d,p,h,a[f+4],6,-145523070),h=y(h,u,d,p,a[f+11],10,-1120210379),p=y(p,h,u,d,a[f+2],15,718787259),d=y(d,p,h,u,a[f+9],21,-343485551),u=u+v>>>0,d=d+_>>>0,p=p+b>>>0,h=h+w>>>0}return n.endian([u,d,p,h])};o._ff=function(n,t,e,r,o,s,i){var a=n+(t&e|~t&r)+(o>>>0)+i;return(a<<s|a>>>32-s)+t},o._gg=function(n,t,e,r,o,s,i){var a=n+(t&r|e&~r)+(o>>>0)+i;return(a<<s|a>>>32-s)+t},o._hh=function(n,t,e,r,o,s,i){var a=n+(t^e^r)+(o>>>0)+i;return(a<<s|a>>>32-s)+t},o._ii=function(n,t,e,r,o,s,i){var a=n+(e^(t|~r))+(o>>>0)+i;return(a<<s|a>>>32-s)+t},o._blocksize=16,o._digestsize=16,b.exports=function(t,e){if(null==t)throw new Error("Illegal argument "+t);var s=n.wordsToBytes(o(t,e));return e&&e.asBytes?s:e&&e.asString?r.bytesToString(s):n.bytesToHex(s)}}();var x=b.exports;function j(n,t,e={}){return new Promise(((r,o)=>{const s=new XMLHttpRequest;s.open("POST",n),s.onreadystatechange=()=>{if(s.readyState===s.DONE)if(200===s.status){const n="string"==typeof s.response?function(n,t={}){try{return JSON.parse(n)}catch(e){return console.warn(`Failed to parse json: ${n}`,e),t}}(s.response):s.response;0!==n.ret?o(new Error(n.msg||`Response Error Code: ${n.ret}`)):r(n)}else o(new Error(`HTTP Error: ${s.status}`))},s.responseType="json",Object.keys(e).forEach((n=>{s.setRequestHeader(n,e[n])})),s.send(t)}))}async function B(n,t,e,r,o,s={}){const{os:i,gameId:a,channelId:c,source:u,sdkVersion:d,seq:p,ts:h}=r,l={os:i,gameid:a,channelid:c,source:u,sdk_version:d,seq:p,ts:h},m=function(n,t,e={},r=""){const o=f(e,!0);return x(`${t}?${o}${r}${n}`)}(n,e,l,o);Object.assign(l,{sig:m});const g=f(l);return await j(`${t}${e}?${g}`,o,s)}function C(){return`----WebKitFormBoundary${function(n){const t="abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNOPQRSTUVWXYZ1234567890",e=t.length,r=[];for(let o=n;o>0;--o)r.push(t[Math.round(Math.random()*(e-1))]);return r.join("")}(16)}`}async function $(n,t,e,r,o){const s=JSON.stringify(function(n){const t=n,{sessionId:e,appVersion:r}=t,o=h(t,["sessionId","appVersion"]);return p({session_id:e,app_version:r},o)}(r)),i=o.map(k).join("\n"),{headers:a,body:c}=function(n,t){const e=C();return{headers:{"Content-Type":`multipart/form-data; boundary=${e}`},body:`--${e}\nContent-Disposition: form-data; name="meta"\n\n${n}\n--${e}\nContent-Disposition: form-data; name="log"; filename="kvlog"\nContent-Type: text/plain\n\n${t}\n--${e}--\n`.split("\n").join("\r\n")}}(s,i);return await B(n,t,"/v2/dr/kv",e,c,a)}function k(n){const t=n,{eventName:e,srcId:r}=t,o=h(t,["eventName","srcId"]);return`${["insight",r,e].join("_")}|${f(o)}`}class A{constructor(){this.options={os:n.Web,source:o.Client,sdkVersion:"1.4.0"},this.seq=0,this.initialized=!1,this.caches=[]}async init(n){try{this.initialized=!1,Object.assign(this.options,n);const{sigKey:t,env:e}=this.options,r=await async function(n,t,e){return(await B(n,t,"/v2/dr/getsid",e,"{}")).session_id}(t,this.envToUrl(e),this.params);return Object.assign(this.options,{sessionId:r}),this.initialized=!0,this.reportEvents({eventName:"start",srcId:1}),this.caches.length>0&&(this.reportEvents(this.caches),this.caches.length=0),r}catch(t){return console.warn("init report error",t),t}}extend(n){Object.assign(this.options,n)}reportEvents(n){try{if(!this.initialized)return void(Array.isArray(n)?this.caches=this.caches.concat(n):this.caches.push(n));const{sigKey:t,env:e}=this.options,r=Array.isArray(n)?n:[n];return $(t,this.envToUrl(e),this.params,this.meta,this.mergeCommonKV(r))}catch(t){return console.warn("reportEvents error",t),t}}envToUrl(n){return n.includes("//")?n:`https://${n}-dr.intlgame.com`}mergeCommonKV(n){const{os:t,gameId:e,channelId:r,sdkVersion:o,appVersion:s,openId:i}=this.options;return n.map((n=>{const{eventName:a,srcId:c}=n;return p({comm_c_gameid:e,comm_c_client_source:c,comm_c_event_name:a,comm_c_os:t,comm_c_create_ts:l(),comm_c_app_version:s,comm_c_device_model:window.navigator.userAgent,comm_c_device_brand:window.navigator.vendor,comm_c_screen_width:window.screen.width,comm_c_screen_height:window.screen.height,comm_c_sdk_version:o,comm_c_network_type:m(),comm_c_ram_total:g(),comm_c_rom_total:g(),comm_c_cpu_name:y(),comm_c_openid:i,comm_c_channelid:r},n)}))}get meta(){const{sessionId:n,appVersion:t}=this.options;return{sessionId:n,appVersion:t,ts:l()}}get params(){const{os:n,gameId:t,channelId:e,source:r,sdkVersion:o}=this.options;return this.seq+=1,{os:n,gameId:t,channelId:e,source:r,sdkVersion:o,seq:this.seq,ts:l()}}}var E=new A;export{e as Channel,A as IntlgameReport,n as OS,o as Source,E as default};

@@ -1,1 +0,1 @@

var __defProp=Object.defineProperty,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,n,t)=>n in e?__defProp(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t,__spreadValues=(e,n)=>{for(var t in n||(n={}))__hasOwnProp.call(n,t)&&__defNormalProp(e,t,n[t]);if(__getOwnPropSymbols)for(var t of __getOwnPropSymbols(n))__propIsEnum.call(n,t)&&__defNormalProp(e,t,n[t]);return e},__objRest=(e,n)=>{var t={};for(var r in e)__hasOwnProp.call(e,r)&&n.indexOf(r)<0&&(t[r]=e[r]);if(null!=e&&__getOwnPropSymbols)for(var r of __getOwnPropSymbols(e))n.indexOf(r)<0&&__propIsEnum.call(e,r)&&(t[r]=e[r]);return t};!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).IntlgameReport={})}(this,(function(e){"use strict";var n,t,r;function o(e,n=!1){return(n?Object.keys(e).sort():Object.keys(e)).map((n=>{return`${n}=${t=e[n],(["number","string","boolean"].includes(typeof t)?String(t):"").replace(/=/g,"%3d").replace(/\|/g,"%7C").replace(/&/g,"%26").replace(/\n/g,"%0D")}`;var t})).join("&")}function s(){return Math.round(Date.now()/1e3)}function i(){const{navigator:e}=window,n=e.connection||e.mozConnection||e.webkitConnection;return n&&(n.type||n.effectiveType)}function a(){try{const{performance:e}=window;return Math.round(e.memory.totalJSHeapSize/1024/1024)||0}catch(e){return 0}}function c(){try{return window.navigator.platform}catch(e){return""}}e.OS=void 0,(n=e.OS||(e.OS={}))[n.Android=1]="Android",n[n.iOS=2]="iOS",n[n.Web=3]="Web",n[n.Linux=4]="Linux",n[n.Windows=5]="Windows",n[n.Nintendo=6]="Nintendo",n[n.Mac=7]="Mac",n[n.Playstation=8]="Playstation",n[n.XBox=9]="XBox",e.Channel=void 0,(t=e.Channel||(e.Channel={}))[t.Guest=3]="Guest",t[t.Facebook=4]="Facebook",t[t.GameCenter=5]="GameCenter",t[t.GooglePlay=6]="GooglePlay",t[t.Twitter=9]="Twitter",t[t.Garena=10]="Garena",t[t.Nintendo=13]="Nintendo",t[t.Line=14]="Line",t[t.Apple=15]="Apple",t[t.Kwai=17]="Kwai",t[t.XBox=20]="XBox",t[t.Steam=21]="Steam",t[t.Playstation=22]="Playstation",t[t.Epic=24]="Epic",t[t.Discord=26]="Discord",t[t.PlayStation5=27]="PlayStation5",t[t.Twitch=28]="Twitch",t[t.FacebookInstantGame=29]="FacebookInstantGame",t[t.DMM=30]="DMM",e.Source=void 0,(r=e.Source||(e.Source={}))[r.Client=0]="Client",r[r.Server=1]="Server";var u,p,d={exports:{}},l={exports:{}};u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",p={rotl:function(e,n){return e<<n|e>>>32-n},rotr:function(e,n){return e<<32-n|e>>>n},endian:function(e){if(e.constructor==Number)return 16711935&p.rotl(e,8)|4278255360&p.rotl(e,24);for(var n=0;n<e.length;n++)e[n]=p.endian(e[n]);return e},randomBytes:function(e){for(var n=[];e>0;e--)n.push(Math.floor(256*Math.random()));return n},bytesToWords:function(e){for(var n=[],t=0,r=0;t<e.length;t++,r+=8)n[r>>>5]|=e[t]<<24-r%32;return n},wordsToBytes:function(e){for(var n=[],t=0;t<32*e.length;t+=8)n.push(e[t>>>5]>>>24-t%32&255);return n},bytesToHex:function(e){for(var n=[],t=0;t<e.length;t++)n.push((e[t]>>>4).toString(16)),n.push((15&e[t]).toString(16));return n.join("")},hexToBytes:function(e){for(var n=[],t=0;t<e.length;t+=2)n.push(parseInt(e.substr(t,2),16));return n},bytesToBase64:function(e){for(var n=[],t=0;t<e.length;t+=3)for(var r=e[t]<<16|e[t+1]<<8|e[t+2],o=0;o<4;o++)8*t+6*o<=8*e.length?n.push(u.charAt(r>>>6*(3-o)&63)):n.push("=");return n.join("")},base64ToBytes:function(e){e=e.replace(/[^A-Z0-9+\/]/gi,"");for(var n=[],t=0,r=0;t<e.length;r=++t%4)0!=r&&n.push((u.indexOf(e.charAt(t-1))&Math.pow(2,-2*r+8)-1)<<2*r|u.indexOf(e.charAt(t))>>>6-2*r);return n}},l.exports=p;var f={utf8:{stringToBytes:function(e){return f.bin.stringToBytes(unescape(encodeURIComponent(e)))},bytesToString:function(e){return decodeURIComponent(escape(f.bin.bytesToString(e)))}},bin:{stringToBytes:function(e){for(var n=[],t=0;t<e.length;t++)n.push(255&e.charCodeAt(t));return n},bytesToString:function(e){for(var n=[],t=0;t<e.length;t++)n.push(String.fromCharCode(e[t]));return n.join("")}}},h=f,m=function(e){return null!=e&&(_(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&_(e.slice(0,0))}(e)||!!e._isBuffer)};function _(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}!function(){var e=l.exports,n=h.utf8,t=m,r=h.bin,o=function(s,i){s.constructor==String?s=i&&"binary"===i.encoding?r.stringToBytes(s):n.stringToBytes(s):t(s)?s=Array.prototype.slice.call(s,0):Array.isArray(s)||s.constructor===Uint8Array||(s=s.toString());for(var a=e.bytesToWords(s),c=8*s.length,u=1732584193,p=-271733879,d=-1732584194,l=271733878,f=0;f<a.length;f++)a[f]=16711935&(a[f]<<8|a[f]>>>24)|4278255360&(a[f]<<24|a[f]>>>8);a[c>>>5]|=128<<c%32,a[14+(c+64>>>9<<4)]=c;var h=o._ff,m=o._gg,_=o._hh,g=o._ii;for(f=0;f<a.length;f+=16){var y=u,v=p,b=d,w=l;u=h(u,p,d,l,a[f+0],7,-680876936),l=h(l,u,p,d,a[f+1],12,-389564586),d=h(d,l,u,p,a[f+2],17,606105819),p=h(p,d,l,u,a[f+3],22,-1044525330),u=h(u,p,d,l,a[f+4],7,-176418897),l=h(l,u,p,d,a[f+5],12,1200080426),d=h(d,l,u,p,a[f+6],17,-1473231341),p=h(p,d,l,u,a[f+7],22,-45705983),u=h(u,p,d,l,a[f+8],7,1770035416),l=h(l,u,p,d,a[f+9],12,-1958414417),d=h(d,l,u,p,a[f+10],17,-42063),p=h(p,d,l,u,a[f+11],22,-1990404162),u=h(u,p,d,l,a[f+12],7,1804603682),l=h(l,u,p,d,a[f+13],12,-40341101),d=h(d,l,u,p,a[f+14],17,-1502002290),u=m(u,p=h(p,d,l,u,a[f+15],22,1236535329),d,l,a[f+1],5,-165796510),l=m(l,u,p,d,a[f+6],9,-1069501632),d=m(d,l,u,p,a[f+11],14,643717713),p=m(p,d,l,u,a[f+0],20,-373897302),u=m(u,p,d,l,a[f+5],5,-701558691),l=m(l,u,p,d,a[f+10],9,38016083),d=m(d,l,u,p,a[f+15],14,-660478335),p=m(p,d,l,u,a[f+4],20,-405537848),u=m(u,p,d,l,a[f+9],5,568446438),l=m(l,u,p,d,a[f+14],9,-1019803690),d=m(d,l,u,p,a[f+3],14,-187363961),p=m(p,d,l,u,a[f+8],20,1163531501),u=m(u,p,d,l,a[f+13],5,-1444681467),l=m(l,u,p,d,a[f+2],9,-51403784),d=m(d,l,u,p,a[f+7],14,1735328473),u=_(u,p=m(p,d,l,u,a[f+12],20,-1926607734),d,l,a[f+5],4,-378558),l=_(l,u,p,d,a[f+8],11,-2022574463),d=_(d,l,u,p,a[f+11],16,1839030562),p=_(p,d,l,u,a[f+14],23,-35309556),u=_(u,p,d,l,a[f+1],4,-1530992060),l=_(l,u,p,d,a[f+4],11,1272893353),d=_(d,l,u,p,a[f+7],16,-155497632),p=_(p,d,l,u,a[f+10],23,-1094730640),u=_(u,p,d,l,a[f+13],4,681279174),l=_(l,u,p,d,a[f+0],11,-358537222),d=_(d,l,u,p,a[f+3],16,-722521979),p=_(p,d,l,u,a[f+6],23,76029189),u=_(u,p,d,l,a[f+9],4,-640364487),l=_(l,u,p,d,a[f+12],11,-421815835),d=_(d,l,u,p,a[f+15],16,530742520),u=g(u,p=_(p,d,l,u,a[f+2],23,-995338651),d,l,a[f+0],6,-198630844),l=g(l,u,p,d,a[f+7],10,1126891415),d=g(d,l,u,p,a[f+14],15,-1416354905),p=g(p,d,l,u,a[f+5],21,-57434055),u=g(u,p,d,l,a[f+12],6,1700485571),l=g(l,u,p,d,a[f+3],10,-1894986606),d=g(d,l,u,p,a[f+10],15,-1051523),p=g(p,d,l,u,a[f+1],21,-2054922799),u=g(u,p,d,l,a[f+8],6,1873313359),l=g(l,u,p,d,a[f+15],10,-30611744),d=g(d,l,u,p,a[f+6],15,-1560198380),p=g(p,d,l,u,a[f+13],21,1309151649),u=g(u,p,d,l,a[f+4],6,-145523070),l=g(l,u,p,d,a[f+11],10,-1120210379),d=g(d,l,u,p,a[f+2],15,718787259),p=g(p,d,l,u,a[f+9],21,-343485551),u=u+y>>>0,p=p+v>>>0,d=d+b>>>0,l=l+w>>>0}return e.endian([u,p,d,l])};o._ff=function(e,n,t,r,o,s,i){var a=e+(n&t|~n&r)+(o>>>0)+i;return(a<<s|a>>>32-s)+n},o._gg=function(e,n,t,r,o,s,i){var a=e+(n&r|t&~r)+(o>>>0)+i;return(a<<s|a>>>32-s)+n},o._hh=function(e,n,t,r,o,s,i){var a=e+(n^t^r)+(o>>>0)+i;return(a<<s|a>>>32-s)+n},o._ii=function(e,n,t,r,o,s,i){var a=e+(t^(n|~r))+(o>>>0)+i;return(a<<s|a>>>32-s)+n},o._blocksize=16,o._digestsize=16,d.exports=function(n,t){if(null==n)throw new Error("Illegal argument "+n);var s=e.wordsToBytes(o(n,t));return t&&t.asBytes?s:t&&t.asString?r.bytesToString(s):e.bytesToHex(s)}}();var g=d.exports;function y(e,n,t={}){return new Promise(((r,o)=>{const s=new XMLHttpRequest;s.open("POST",e),s.onreadystatechange=()=>{if(s.readyState===s.DONE)if(200===s.status){const e="string"==typeof s.response?function(e,n={}){try{return JSON.parse(e)}catch(t){return console.warn(`Failed to parse json: ${e}`,t),n}}(s.response):s.response;0!==e.ret?o(new Error(e.msg||`Response Error Code: ${e.ret}`)):r(e)}else o(new Error(`HTTP Error: ${s.status}`))},s.responseType="json",Object.keys(t).forEach((e=>{s.setRequestHeader(e,t[e])})),s.send(n)}))}async function v(e,n,t,r,s,i={}){const{os:a,gameId:c,channelId:u,source:p,sdkVersion:d,seq:l,ts:f}=r,h={os:a,gameid:c,channelid:u,source:p,sdk_version:d,seq:l,ts:f},m=function(e,n,t={},r=""){const s=o(t,!0);return g(`${n}?${s}${r}${e}`)}(e,t,h,s);Object.assign(h,{sig:m});const _=o(h);return await y(`${n}${t}?${_}`,s,i)}function b(){return`----WebKitFormBoundary${function(e){const n="abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNOPQRSTUVWXYZ1234567890",t=n.length,r=[];for(let o=e;o>0;--o)r.push(n[Math.round(Math.random()*(t-1))]);return r.join("")}(16)}`}async function w(e,n,t,r,o){const s=JSON.stringify(function(e){const n=e,{sessionId:t,appVersion:r}=n,o=__objRest(n,["sessionId","appVersion"]);return __spreadValues({session_id:t,app_version:r},o)}(r)),i=o.map(S).join("\n"),{headers:a,body:c}=function(e,n){const t=b();return{headers:{"Content-Type":`multipart/form-data; boundary=${t}`},body:`--${t}\nContent-Disposition: form-data; name="meta"\n\n${e}\n--${t}\nContent-Disposition: form-data; name="log"; filename="kvlog"\nContent-Type: text/plain\n\n${n}\n--${t}--\n`.split("\n").join("\r\n")}}(s,i);return await v(e,n,"/v2/dr/kv",t,c,a)}function S(e){const n=e,{eventName:t,srcId:r}=n,s=__objRest(n,["eventName","srcId"]);return`${["insight",r,t].join("_")}|${o(s)}`}class O{constructor(){this.options={os:e.OS.Web,source:e.Source.Client,sdkVersion:"1.3.0"},this.seq=0,this.initialized=!1,this.caches=[]}async init(e){try{this.initialized=!1,Object.assign(this.options,e);const{sigKey:n,env:t}=this.options,r=await async function(e,n,t){return(await v(e,n,"/v2/dr/getsid",t,"{}")).session_id}(n,this.envToUrl(t),this.params);return Object.assign(this.options,{sessionId:r}),this.initialized=!0,this.reportEvents({eventName:"start",srcId:1}),this.caches.length>0&&(this.reportEvents(this.caches),this.caches.length=0),r}catch(n){return console.warn("init report error",n),n}}extend(e){Object.assign(this.options,e)}reportEvents(e){try{if(!this.initialized)return void(Array.isArray(e)?this.caches=this.caches.concat(e):this.caches.push(e));const{sigKey:n,env:t}=this.options,r=Array.isArray(e)?e:[e];return w(n,this.envToUrl(t),this.params,this.meta,this.mergeCommonKV(r))}catch(n){return console.warn("reportEvents error",n),n}}envToUrl(e){return e.includes("//")?e:`https://${e}.intlgame.com`}mergeCommonKV(e){const{os:n,gameId:t,channelId:r,sdkVersion:o,appVersion:u,openId:p}=this.options;return e.map((e=>{const{eventName:d,srcId:l}=e;return __spreadValues({comm_c_gameid:t,comm_c_client_source:l,comm_c_event_name:d,comm_c_os:n,comm_c_create_ts:s(),comm_c_app_version:u,comm_c_device_model:window.navigator.userAgent,comm_c_device_brand:window.navigator.vendor,comm_c_screen_width:window.screen.width,comm_c_screen_height:window.screen.height,comm_c_sdk_version:o,comm_c_network_type:i(),comm_c_ram_total:a(),comm_c_rom_total:a(),comm_c_cpu_name:c(),comm_c_openid:p,comm_c_channelid:r},e)}))}get meta(){const{sessionId:e,appVersion:n}=this.options;return{sessionId:e,appVersion:n,ts:s()}}get params(){const{os:e,gameId:n,channelId:t,source:r,sdkVersion:o}=this.options;return this.seq+=1,{os:e,gameId:n,channelId:t,source:r,sdkVersion:o,seq:this.seq,ts:s()}}}var T=new O;e.IntlgameReport=O,e.default=T,Object.defineProperty(e,"__esModule",{value:!0}),e[Symbol.toStringTag]="Module"}));
var __defProp=Object.defineProperty,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,n,t)=>n in e?__defProp(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t,__spreadValues=(e,n)=>{for(var t in n||(n={}))__hasOwnProp.call(n,t)&&__defNormalProp(e,t,n[t]);if(__getOwnPropSymbols)for(var t of __getOwnPropSymbols(n))__propIsEnum.call(n,t)&&__defNormalProp(e,t,n[t]);return e},__objRest=(e,n)=>{var t={};for(var r in e)__hasOwnProp.call(e,r)&&n.indexOf(r)<0&&(t[r]=e[r]);if(null!=e&&__getOwnPropSymbols)for(var r of __getOwnPropSymbols(e))n.indexOf(r)<0&&__propIsEnum.call(e,r)&&(t[r]=e[r]);return t};!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).IntlgameReport={})}(this,(function(e){"use strict";var n,t,r;function o(e,n=!1){return(n?Object.keys(e).sort():Object.keys(e)).map((n=>{return`${n}=${t=e[n],(["number","string","boolean"].includes(typeof t)?String(t):"").replace(/=/g,"%3d").replace(/\|/g,"%7C").replace(/&/g,"%26").replace(/\n/g,"%0D")}`;var t})).join("&")}function s(){return Math.round(Date.now()/1e3)}function i(){const{navigator:e}=window,n=e.connection||e.mozConnection||e.webkitConnection;return n&&(n.type||n.effectiveType)}function a(){try{const{performance:e}=window;return Math.round(e.memory.totalJSHeapSize/1024/1024)||0}catch(e){return 0}}function c(){try{return window.navigator.platform}catch(e){return""}}e.OS=void 0,(n=e.OS||(e.OS={}))[n.Android=1]="Android",n[n.iOS=2]="iOS",n[n.Web=3]="Web",n[n.Linux=4]="Linux",n[n.Windows=5]="Windows",n[n.Nintendo=6]="Nintendo",n[n.Mac=7]="Mac",n[n.Playstation=8]="Playstation",n[n.XBox=9]="XBox",e.Channel=void 0,(t=e.Channel||(e.Channel={}))[t.Guest=3]="Guest",t[t.Facebook=4]="Facebook",t[t.GameCenter=5]="GameCenter",t[t.GooglePlay=6]="GooglePlay",t[t.Twitter=9]="Twitter",t[t.Garena=10]="Garena",t[t.Nintendo=13]="Nintendo",t[t.Line=14]="Line",t[t.Apple=15]="Apple",t[t.Kwai=17]="Kwai",t[t.XBox=20]="XBox",t[t.Steam=21]="Steam",t[t.Playstation=22]="Playstation",t[t.Epic=24]="Epic",t[t.Discord=26]="Discord",t[t.PlayStation5=27]="PlayStation5",t[t.Twitch=28]="Twitch",t[t.FacebookInstantGame=29]="FacebookInstantGame",t[t.DMM=30]="DMM",e.Source=void 0,(r=e.Source||(e.Source={}))[r.Client=0]="Client",r[r.Server=1]="Server";var u,p,d={exports:{}},l={exports:{}};u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",p={rotl:function(e,n){return e<<n|e>>>32-n},rotr:function(e,n){return e<<32-n|e>>>n},endian:function(e){if(e.constructor==Number)return 16711935&p.rotl(e,8)|4278255360&p.rotl(e,24);for(var n=0;n<e.length;n++)e[n]=p.endian(e[n]);return e},randomBytes:function(e){for(var n=[];e>0;e--)n.push(Math.floor(256*Math.random()));return n},bytesToWords:function(e){for(var n=[],t=0,r=0;t<e.length;t++,r+=8)n[r>>>5]|=e[t]<<24-r%32;return n},wordsToBytes:function(e){for(var n=[],t=0;t<32*e.length;t+=8)n.push(e[t>>>5]>>>24-t%32&255);return n},bytesToHex:function(e){for(var n=[],t=0;t<e.length;t++)n.push((e[t]>>>4).toString(16)),n.push((15&e[t]).toString(16));return n.join("")},hexToBytes:function(e){for(var n=[],t=0;t<e.length;t+=2)n.push(parseInt(e.substr(t,2),16));return n},bytesToBase64:function(e){for(var n=[],t=0;t<e.length;t+=3)for(var r=e[t]<<16|e[t+1]<<8|e[t+2],o=0;o<4;o++)8*t+6*o<=8*e.length?n.push(u.charAt(r>>>6*(3-o)&63)):n.push("=");return n.join("")},base64ToBytes:function(e){e=e.replace(/[^A-Z0-9+\/]/gi,"");for(var n=[],t=0,r=0;t<e.length;r=++t%4)0!=r&&n.push((u.indexOf(e.charAt(t-1))&Math.pow(2,-2*r+8)-1)<<2*r|u.indexOf(e.charAt(t))>>>6-2*r);return n}},l.exports=p;var f={utf8:{stringToBytes:function(e){return f.bin.stringToBytes(unescape(encodeURIComponent(e)))},bytesToString:function(e){return decodeURIComponent(escape(f.bin.bytesToString(e)))}},bin:{stringToBytes:function(e){for(var n=[],t=0;t<e.length;t++)n.push(255&e.charCodeAt(t));return n},bytesToString:function(e){for(var n=[],t=0;t<e.length;t++)n.push(String.fromCharCode(e[t]));return n.join("")}}},h=f,m=function(e){return null!=e&&(_(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&_(e.slice(0,0))}(e)||!!e._isBuffer)};function _(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}!function(){var e=l.exports,n=h.utf8,t=m,r=h.bin,o=function(s,i){s.constructor==String?s=i&&"binary"===i.encoding?r.stringToBytes(s):n.stringToBytes(s):t(s)?s=Array.prototype.slice.call(s,0):Array.isArray(s)||s.constructor===Uint8Array||(s=s.toString());for(var a=e.bytesToWords(s),c=8*s.length,u=1732584193,p=-271733879,d=-1732584194,l=271733878,f=0;f<a.length;f++)a[f]=16711935&(a[f]<<8|a[f]>>>24)|4278255360&(a[f]<<24|a[f]>>>8);a[c>>>5]|=128<<c%32,a[14+(c+64>>>9<<4)]=c;var h=o._ff,m=o._gg,_=o._hh,g=o._ii;for(f=0;f<a.length;f+=16){var y=u,v=p,b=d,w=l;u=h(u,p,d,l,a[f+0],7,-680876936),l=h(l,u,p,d,a[f+1],12,-389564586),d=h(d,l,u,p,a[f+2],17,606105819),p=h(p,d,l,u,a[f+3],22,-1044525330),u=h(u,p,d,l,a[f+4],7,-176418897),l=h(l,u,p,d,a[f+5],12,1200080426),d=h(d,l,u,p,a[f+6],17,-1473231341),p=h(p,d,l,u,a[f+7],22,-45705983),u=h(u,p,d,l,a[f+8],7,1770035416),l=h(l,u,p,d,a[f+9],12,-1958414417),d=h(d,l,u,p,a[f+10],17,-42063),p=h(p,d,l,u,a[f+11],22,-1990404162),u=h(u,p,d,l,a[f+12],7,1804603682),l=h(l,u,p,d,a[f+13],12,-40341101),d=h(d,l,u,p,a[f+14],17,-1502002290),u=m(u,p=h(p,d,l,u,a[f+15],22,1236535329),d,l,a[f+1],5,-165796510),l=m(l,u,p,d,a[f+6],9,-1069501632),d=m(d,l,u,p,a[f+11],14,643717713),p=m(p,d,l,u,a[f+0],20,-373897302),u=m(u,p,d,l,a[f+5],5,-701558691),l=m(l,u,p,d,a[f+10],9,38016083),d=m(d,l,u,p,a[f+15],14,-660478335),p=m(p,d,l,u,a[f+4],20,-405537848),u=m(u,p,d,l,a[f+9],5,568446438),l=m(l,u,p,d,a[f+14],9,-1019803690),d=m(d,l,u,p,a[f+3],14,-187363961),p=m(p,d,l,u,a[f+8],20,1163531501),u=m(u,p,d,l,a[f+13],5,-1444681467),l=m(l,u,p,d,a[f+2],9,-51403784),d=m(d,l,u,p,a[f+7],14,1735328473),u=_(u,p=m(p,d,l,u,a[f+12],20,-1926607734),d,l,a[f+5],4,-378558),l=_(l,u,p,d,a[f+8],11,-2022574463),d=_(d,l,u,p,a[f+11],16,1839030562),p=_(p,d,l,u,a[f+14],23,-35309556),u=_(u,p,d,l,a[f+1],4,-1530992060),l=_(l,u,p,d,a[f+4],11,1272893353),d=_(d,l,u,p,a[f+7],16,-155497632),p=_(p,d,l,u,a[f+10],23,-1094730640),u=_(u,p,d,l,a[f+13],4,681279174),l=_(l,u,p,d,a[f+0],11,-358537222),d=_(d,l,u,p,a[f+3],16,-722521979),p=_(p,d,l,u,a[f+6],23,76029189),u=_(u,p,d,l,a[f+9],4,-640364487),l=_(l,u,p,d,a[f+12],11,-421815835),d=_(d,l,u,p,a[f+15],16,530742520),u=g(u,p=_(p,d,l,u,a[f+2],23,-995338651),d,l,a[f+0],6,-198630844),l=g(l,u,p,d,a[f+7],10,1126891415),d=g(d,l,u,p,a[f+14],15,-1416354905),p=g(p,d,l,u,a[f+5],21,-57434055),u=g(u,p,d,l,a[f+12],6,1700485571),l=g(l,u,p,d,a[f+3],10,-1894986606),d=g(d,l,u,p,a[f+10],15,-1051523),p=g(p,d,l,u,a[f+1],21,-2054922799),u=g(u,p,d,l,a[f+8],6,1873313359),l=g(l,u,p,d,a[f+15],10,-30611744),d=g(d,l,u,p,a[f+6],15,-1560198380),p=g(p,d,l,u,a[f+13],21,1309151649),u=g(u,p,d,l,a[f+4],6,-145523070),l=g(l,u,p,d,a[f+11],10,-1120210379),d=g(d,l,u,p,a[f+2],15,718787259),p=g(p,d,l,u,a[f+9],21,-343485551),u=u+y>>>0,p=p+v>>>0,d=d+b>>>0,l=l+w>>>0}return e.endian([u,p,d,l])};o._ff=function(e,n,t,r,o,s,i){var a=e+(n&t|~n&r)+(o>>>0)+i;return(a<<s|a>>>32-s)+n},o._gg=function(e,n,t,r,o,s,i){var a=e+(n&r|t&~r)+(o>>>0)+i;return(a<<s|a>>>32-s)+n},o._hh=function(e,n,t,r,o,s,i){var a=e+(n^t^r)+(o>>>0)+i;return(a<<s|a>>>32-s)+n},o._ii=function(e,n,t,r,o,s,i){var a=e+(t^(n|~r))+(o>>>0)+i;return(a<<s|a>>>32-s)+n},o._blocksize=16,o._digestsize=16,d.exports=function(n,t){if(null==n)throw new Error("Illegal argument "+n);var s=e.wordsToBytes(o(n,t));return t&&t.asBytes?s:t&&t.asString?r.bytesToString(s):e.bytesToHex(s)}}();var g=d.exports;function y(e,n,t={}){return new Promise(((r,o)=>{const s=new XMLHttpRequest;s.open("POST",e),s.onreadystatechange=()=>{if(s.readyState===s.DONE)if(200===s.status){const e="string"==typeof s.response?function(e,n={}){try{return JSON.parse(e)}catch(t){return console.warn(`Failed to parse json: ${e}`,t),n}}(s.response):s.response;0!==e.ret?o(new Error(e.msg||`Response Error Code: ${e.ret}`)):r(e)}else o(new Error(`HTTP Error: ${s.status}`))},s.responseType="json",Object.keys(t).forEach((e=>{s.setRequestHeader(e,t[e])})),s.send(n)}))}async function v(e,n,t,r,s,i={}){const{os:a,gameId:c,channelId:u,source:p,sdkVersion:d,seq:l,ts:f}=r,h={os:a,gameid:c,channelid:u,source:p,sdk_version:d,seq:l,ts:f},m=function(e,n,t={},r=""){const s=o(t,!0);return g(`${n}?${s}${r}${e}`)}(e,t,h,s);Object.assign(h,{sig:m});const _=o(h);return await y(`${n}${t}?${_}`,s,i)}function b(){return`----WebKitFormBoundary${function(e){const n="abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNOPQRSTUVWXYZ1234567890",t=n.length,r=[];for(let o=e;o>0;--o)r.push(n[Math.round(Math.random()*(t-1))]);return r.join("")}(16)}`}async function w(e,n,t,r,o){const s=JSON.stringify(function(e){const n=e,{sessionId:t,appVersion:r}=n,o=__objRest(n,["sessionId","appVersion"]);return __spreadValues({session_id:t,app_version:r},o)}(r)),i=o.map(S).join("\n"),{headers:a,body:c}=function(e,n){const t=b();return{headers:{"Content-Type":`multipart/form-data; boundary=${t}`},body:`--${t}\nContent-Disposition: form-data; name="meta"\n\n${e}\n--${t}\nContent-Disposition: form-data; name="log"; filename="kvlog"\nContent-Type: text/plain\n\n${n}\n--${t}--\n`.split("\n").join("\r\n")}}(s,i);return await v(e,n,"/v2/dr/kv",t,c,a)}function S(e){const n=e,{eventName:t,srcId:r}=n,s=__objRest(n,["eventName","srcId"]);return`${["insight",r,t].join("_")}|${o(s)}`}class O{constructor(){this.options={os:e.OS.Web,source:e.Source.Client,sdkVersion:"1.4.0"},this.seq=0,this.initialized=!1,this.caches=[]}async init(e){try{this.initialized=!1,Object.assign(this.options,e);const{sigKey:n,env:t}=this.options,r=await async function(e,n,t){return(await v(e,n,"/v2/dr/getsid",t,"{}")).session_id}(n,this.envToUrl(t),this.params);return Object.assign(this.options,{sessionId:r}),this.initialized=!0,this.reportEvents({eventName:"start",srcId:1}),this.caches.length>0&&(this.reportEvents(this.caches),this.caches.length=0),r}catch(n){return console.warn("init report error",n),n}}extend(e){Object.assign(this.options,e)}reportEvents(e){try{if(!this.initialized)return void(Array.isArray(e)?this.caches=this.caches.concat(e):this.caches.push(e));const{sigKey:n,env:t}=this.options,r=Array.isArray(e)?e:[e];return w(n,this.envToUrl(t),this.params,this.meta,this.mergeCommonKV(r))}catch(n){return console.warn("reportEvents error",n),n}}envToUrl(e){return e.includes("//")?e:`https://${e}-dr.intlgame.com`}mergeCommonKV(e){const{os:n,gameId:t,channelId:r,sdkVersion:o,appVersion:u,openId:p}=this.options;return e.map((e=>{const{eventName:d,srcId:l}=e;return __spreadValues({comm_c_gameid:t,comm_c_client_source:l,comm_c_event_name:d,comm_c_os:n,comm_c_create_ts:s(),comm_c_app_version:u,comm_c_device_model:window.navigator.userAgent,comm_c_device_brand:window.navigator.vendor,comm_c_screen_width:window.screen.width,comm_c_screen_height:window.screen.height,comm_c_sdk_version:o,comm_c_network_type:i(),comm_c_ram_total:a(),comm_c_rom_total:a(),comm_c_cpu_name:c(),comm_c_openid:p,comm_c_channelid:r},e)}))}get meta(){const{sessionId:e,appVersion:n}=this.options;return{sessionId:e,appVersion:n,ts:s()}}get params(){const{os:e,gameId:n,channelId:t,source:r,sdkVersion:o}=this.options;return this.seq+=1,{os:e,gameId:n,channelId:t,source:r,sdkVersion:o,seq:this.seq,ts:s()}}}var T=new O;e.IntlgameReport=O,e.default=T,Object.defineProperty(e,"__esModule",{value:!0}),e[Symbol.toStringTag]="Module"}));
{
"name": "@intlsdk/report",
"version": "1.3.0",
"version": "1.4.0",
"main": "dist/index.umd.js",

@@ -36,3 +36,3 @@ "module": "dist/index.es.js",

},
"gitHead": "0f5b477659c0a010c546f511ff84bef4086c74e1"
"gitHead": "470343710f6843983aa8a1dda1f0f3ce3c806110"
}

@@ -10,5 +10,5 @@ # SDK 数据上报

Report.init({
env: 'test', // 环境或后台域名
env: 'sg', // 环境或后台域名,详见【env参数】
gameId: 11, // INTL 分配的游戏 ID
sigKey: 'sigkey', // SDK_KEY
sigKey: 'xxx', // SDK_KEY
channelId: Channel.Guest, // 登录渠道 ID

@@ -27,4 +27,3 @@ appVersion: '1.2.3', // 业务应用版本号

// 以下为其他自定义字段,详见tlog文档
foo: 11,
bar: 12,
ret_code: 0,
});

@@ -38,4 +37,3 @@

// 以下为其他自定义字段,详见tlog文档
foo: 11,
bar: 12,
ret_code: 0,
},

@@ -46,6 +44,26 @@ {

// 以下为其他自定义字段,详见tlog文档
foo: 'abc',
bar: '123',
ret_code: 0,
},
]);
```
## env 参数
> `env`参数兼容 2 种写法:`区域标识简写`和`完整url前缀`,满足`https://{env}-dr.intlgame.com`格式的域名都可以使用`区域标识简写`方式
### 区域标识简写
- `sg` 新加坡,与`https://sg-dr.intlgame.com`(完整 url 前缀)等效,下同
- `na` 北美(azure)
- `mos` 俄罗斯
- `jp` 日本
- `eu` 欧洲
- `aws-na` 北美
- `sa` 南美
- `lonelyfish` lonelyfish 现网独立集群
- `us` 硅谷(腾讯云)
- `in` 印度
### 完整 url 前缀
> 任意 url 域名前缀,必须含`https://`,示例:`https://sg-dr.intlgame.com`,与`sg`(区域标识简写)等效

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc