Socket
Socket
Sign inDemoInstall

@intlsdk/report

Package Overview
Dependencies
5
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.2.4 to 1.3.0

dist/src/interface.d.ts

2

dist/index.es.js

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

var t=Object.defineProperty,e=Object.getOwnPropertySymbols,o=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable,i=(e,o,n)=>o in e?t(e,o,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[o]=n,r={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,o="~";function n(){}function i(t,e,o){this.fn=t,this.context=e,this.once=o||!1}function r(t,e,n,r,s){if("function"!=typeof n)throw new TypeError("The listener must be a function");var h=new i(n,r||t,s),c=o?o+e:e;return t._events[c]?t._events[c].fn?t._events[c]=[t._events[c],h]:t._events[c].push(h):(t._events[c]=h,t._eventsCount++),t}function s(t,e){0==--t._eventsCount?t._events=new n:delete t._events[e]}function h(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(o=!1)),h.prototype.eventNames=function(){var t,n,i=[];if(0===this._eventsCount)return i;for(n in t=this._events)e.call(t,n)&&i.push(o?n.slice(1):n);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(t)):i},h.prototype.listeners=function(t){var e=o?o+t:t,n=this._events[e];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,r=n.length,s=new Array(r);i<r;i++)s[i]=n[i].fn;return s},h.prototype.listenerCount=function(t){var e=o?o+t:t,n=this._events[e];return n?n.fn?1:n.length:0},h.prototype.emit=function(t,e,n,i,r,s){var h=o?o+t:t;if(!this._events[h])return!1;var c,a,u=this._events[h],l=arguments.length;if(u.fn){switch(u.once&&this.removeListener(t,u.fn,void 0,!0),l){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,e),!0;case 3:return u.fn.call(u.context,e,n),!0;case 4:return u.fn.call(u.context,e,n,i),!0;case 5:return u.fn.call(u.context,e,n,i,r),!0;case 6:return u.fn.call(u.context,e,n,i,r,s),!0}for(a=1,c=new Array(l-1);a<l;a++)c[a-1]=arguments[a];u.fn.apply(u.context,c)}else{var p,f=u.length;for(a=0;a<f;a++)switch(u[a].once&&this.removeListener(t,u[a].fn,void 0,!0),l){case 1:u[a].fn.call(u[a].context);break;case 2:u[a].fn.call(u[a].context,e);break;case 3:u[a].fn.call(u[a].context,e,n);break;case 4:u[a].fn.call(u[a].context,e,n,i);break;default:if(!c)for(p=1,c=new Array(l-1);p<l;p++)c[p-1]=arguments[p];u[a].fn.apply(u[a].context,c)}}return!0},h.prototype.on=function(t,e,o){return r(this,t,e,o,!1)},h.prototype.once=function(t,e,o){return r(this,t,e,o,!0)},h.prototype.removeListener=function(t,e,n,i){var r=o?o+t:t;if(!this._events[r])return this;if(!e)return s(this,r),this;var h=this._events[r];if(h.fn)h.fn!==e||i&&!h.once||n&&h.context!==n||s(this,r);else{for(var c=0,a=[],u=h.length;c<u;c++)(h[c].fn!==e||i&&!h[c].once||n&&h[c].context!==n)&&a.push(h[c]);a.length?this._events[r]=1===a.length?a[0]:a:s(this,r)}return this},h.prototype.removeAllListeners=function(t){var e;return t?(e=o?o+t:t,this._events[e]&&s(this,e)):(this._events=new n,this._eventsCount=0),this},h.prototype.off=h.prototype.removeListener,h.prototype.addListener=h.prototype.on,h.prefixed=o,h.EventEmitter=h,t.exports=h}(r);var s=r.exports;function h(t){const e="abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNOPQRSTUVWXYZ1234567890",o=e.length,n=[];for(let i=t;i>0;--i)n.push(e[Math.round(Math.random()*(o-1))]);return n.join("")}const c=navigator.userAgent,a={isH5:/(Android|iPhone|iPad|iPod|iOS|Windows Phone)/i.test(c),isQQ:/\b(V1_AND_SQI?_([\d.]+))|(.*? QQ\/([\d.]+))/.test(c),isQQPA:/.*? PA QQ\/([\d.]+)/.test(c),isWX:/\bMicroMessenger\/([\d.]+)/.test(c),isCloudGame:/\bCloudGame/.test(c),isiOS:/(iPad|iPhone|iPod).*? (IPad)?/.test(c),isAndroid:/\bandroid/i.test(c),isOppoBrowser:/\bOppoBrowser/i.test(c),isOnePlusBrowser:/\bOnePlusBrowser/i.test(c),isHeyTapBrowser:/\bHeyTapBrowser/i.test(c),isLieBaoBrowser:/\bLieBaoFast/i.test(c),isHuaweiBrowser:/\bHuaweiBrowser/i.test(c),isQQBrowser:/\bMQQBrowser/.test(c),isFirefox:/\bFirefox/i.test(c),isEdge:/\bEdge\//.test(c),isIE:/\bTrident\//.test(c),isQzone:/\bQzone/.test(c),isQQLive:/\bQQLiveBrowser/.test(c),isWeiBo:/\bWeibo/i.test(c),isMacOS:"MacIntel"===navigator.platform,isChrome:/\bChrome/.test(c),isWeTalk:/\bWeTalk\/([\d.]+)/.test(c),isWxWork:/\bwxwork\/([\d.]+)/.test(c),isNGA:/\bNga_Official\/([\d.]+)/.test(c),isNanJi:/\bcom\.tencent\.southpole\.appstore\/NanJi/.test(c),isSmobaGameHelper:/\bsmobagamehelper/.test(c),isSafari:!1,isPC:!1,iOSVersion:"",qqVersion:"",wxWorkVersion:"",tbsVersion:"",qqBrowserVersion:"",xwebVersion:"",chromeVersion:"",isMiniProgram:!1};a.isSafari=/\bSafari/.test(c)&&!a.isChrome,a.isPC=!a.isH5,a.isAndroid&&a.isiOS&&(a.isiOS=!1);const u=navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/);u&&(a.iOSVersion=`${parseInt(u[1],10)}.${parseInt(u[2],10)}.${parseInt(u[3]||"0",10)}`);const l=c.match(/\bQQ\/([\d.]+)/);l&&([,a.qqVersion]=l);const p=c.match(/\bwxwork\/([\d.]+)/);p&&([,a.wxWorkVersion]=p);const f=c.match(/\bTBS\/([\d.]+)/);f&&([,a.tbsVersion]=f);const d=c.match(/\bMQQBrowser\/([\d.]+)/);d&&([,a.qqBrowserVersion]=d);const g=c.match(/\bXWEB\/([\d.]+)/);g&&([,a.xwebVersion]=g);const m=c.match(/\bChrome\/([\d]+)/);m&&([,a.chromeVersion]=m);const v=()=>{a.isMiniProgram="miniprogram"===window.__wxjs_environment};v(),!a.isWX||window.WeixinJSBridge&&window.WeixinJSBridge.invoke||document.addEventListener("WeixinJSBridgeReady",v,!1);const b=!(a.isiOS&&a.isQQ);class w extends s{constructor(t={}){super(),this.options=Object.assign({sessionId:"",module:"web",uin:h(16),uploadThreshold:30,showConsole:!0},t),this.seq=0,this.logs=[]}init(t={}){Object.assign(this.options,t);const{sessionId:e,module:o,uin:n,extraInfo:i}=this.options,r={"@timestamp":(new Date).toISOString(),type:"pre-init",sid:e,module:o,url:location.href,user:{uin:n},extraInfo:i};this.logs.push(r)}setOptions(t={}){Object.assign(this.options,t)}log(t,...e){try{this.options.showConsole&&console.log(...e);const{sessionId:o,module:n,uin:i}=this.options,r={type:t,"@timestamp":(new Date).toISOString(),sid:o,module:n,uin:i,seq:this.seq+=1};this.logs.push(r),this.checkAndAutoUpload()}catch(o){console.warn("[Logger]error",o)}}checkAndAutoUpload(){const{uploadThreshold:t}=this.options;t&&this.logs.length>=t&&this.upload()}upload(t=!1){if(!this.logs.length)return;const{url:e}=this.options;this.xhr(this.logs,e,t),this.logs=[]}xhr(t={},e,o){if(b){if(navigator.sendBeacon(e,JSON.stringify(t)))return;console.warn("navigator.sendBeacon error, use xhr instead.")}const n=new XMLHttpRequest;n.open("POST",e,!o),n.send(JSON.stringify(t))}}!function(){if("object"==typeof window)if("IntersectionObserver"in window&&"IntersectionObserverEntry"in window&&"intersectionRatio"in window.IntersectionObserverEntry.prototype)"isIntersecting"in window.IntersectionObserverEntry.prototype||Object.defineProperty(window.IntersectionObserverEntry.prototype,"isIntersecting",{get:function(){return this.intersectionRatio>0}});else{var t=function(t){for(var e=window.document,o=i(e);o;)o=i(e=o.ownerDocument);return e}(),e=[],o=null,n=null;s.prototype.THROTTLE_TIMEOUT=100,s.prototype.POLL_INTERVAL=null,s.prototype.USE_MUTATION_OBSERVER=!0,s._setupCrossOriginUpdater=function(){return o||(o=function(t,o){n=t&&o?l(t,o):{top:0,bottom:0,left:0,right:0,width:0,height:0},e.forEach((function(t){t._checkForIntersections()}))}),o},s._resetCrossOriginUpdater=function(){o=null,n=null},s.prototype.observe=function(t){if(!this._observationTargets.some((function(e){return e.element==t}))){if(!t||1!=t.nodeType)throw new Error("target must be an Element");this._registerInstance(),this._observationTargets.push({element:t,entry:null}),this._monitorIntersections(t.ownerDocument),this._checkForIntersections()}},s.prototype.unobserve=function(t){this._observationTargets=this._observationTargets.filter((function(e){return e.element!=t})),this._unmonitorIntersections(t.ownerDocument),0==this._observationTargets.length&&this._unregisterInstance()},s.prototype.disconnect=function(){this._observationTargets=[],this._unmonitorAllIntersections(),this._unregisterInstance()},s.prototype.takeRecords=function(){var t=this._queuedEntries.slice();return this._queuedEntries=[],t},s.prototype._initThresholds=function(t){var e=t||[0];return Array.isArray(e)||(e=[e]),e.sort().filter((function(t,e,o){if("number"!=typeof t||isNaN(t)||t<0||t>1)throw new Error("threshold must be a number between 0 and 1 inclusively");return t!==o[e-1]}))},s.prototype._parseRootMargin=function(t){var e=(t||"0px").split(/\s+/).map((function(t){var e=/^(-?\d*\.?\d+)(px|%)$/.exec(t);if(!e)throw new Error("rootMargin must be specified in pixels or percent");return{value:parseFloat(e[1]),unit:e[2]}}));return e[1]=e[1]||e[0],e[2]=e[2]||e[0],e[3]=e[3]||e[1],e},s.prototype._monitorIntersections=function(e){var o=e.defaultView;if(o&&-1==this._monitoringDocuments.indexOf(e)){var n=this._checkForIntersections,r=null,s=null;this.POLL_INTERVAL?r=o.setInterval(n,this.POLL_INTERVAL):(h(o,"resize",n,!0),h(e,"scroll",n,!0),this.USE_MUTATION_OBSERVER&&"MutationObserver"in o&&(s=new o.MutationObserver(n)).observe(e,{attributes:!0,childList:!0,characterData:!0,subtree:!0})),this._monitoringDocuments.push(e),this._monitoringUnsubscribes.push((function(){var t=e.defaultView;t&&(r&&t.clearInterval(r),c(t,"resize",n,!0)),c(e,"scroll",n,!0),s&&s.disconnect()}));var a=this.root&&(this.root.ownerDocument||this.root)||t;if(e!=a){var u=i(e);u&&this._monitorIntersections(u.ownerDocument)}}},s.prototype._unmonitorIntersections=function(e){var o=this._monitoringDocuments.indexOf(e);if(-1!=o){var n=this.root&&(this.root.ownerDocument||this.root)||t;if(!this._observationTargets.some((function(t){var o=t.element.ownerDocument;if(o==e)return!0;for(;o&&o!=n;){var r=i(o);if((o=r&&r.ownerDocument)==e)return!0}return!1}))){var r=this._monitoringUnsubscribes[o];if(this._monitoringDocuments.splice(o,1),this._monitoringUnsubscribes.splice(o,1),r(),e!=n){var s=i(e);s&&this._unmonitorIntersections(s.ownerDocument)}}}},s.prototype._unmonitorAllIntersections=function(){var t=this._monitoringUnsubscribes.slice(0);this._monitoringDocuments.length=0,this._monitoringUnsubscribes.length=0;for(var e=0;e<t.length;e++)t[e]()},s.prototype._checkForIntersections=function(){if(this.root||!o||n){var t=this._rootIsInDom(),e=t?this._getRootRect():{top:0,bottom:0,left:0,right:0,width:0,height:0};this._observationTargets.forEach((function(n){var i=n.element,s=a(i),h=this._rootContainsTarget(i),c=n.entry,u=t&&h&&this._computeTargetAndRootIntersection(i,s,e),l=null;this._rootContainsTarget(i)?o&&!this.root||(l=e):l={top:0,bottom:0,left:0,right:0,width:0,height:0};var p=n.entry=new r({time:window.performance&&performance.now&&performance.now(),target:i,boundingClientRect:s,rootBounds:l,intersectionRect:u});c?t&&h?this._hasCrossedThreshold(c,p)&&this._queuedEntries.push(p):c&&c.isIntersecting&&this._queuedEntries.push(p):this._queuedEntries.push(p)}),this),this._queuedEntries.length&&this._callback(this.takeRecords(),this)}},s.prototype._computeTargetAndRootIntersection=function(e,i,r){if("none"!=window.getComputedStyle(e).display){for(var s,h,c,u,p,d,g,m,v=i,b=f(e),w=!1;!w&&b;){var _=null,y=1==b.nodeType?window.getComputedStyle(b):{};if("none"==y.display)return null;if(b==this.root||9==b.nodeType)if(w=!0,b==this.root||b==t)o&&!this.root?!n||0==n.width&&0==n.height?(b=null,_=null,v=null):_=n:_=r;else{var O=f(b),I=O&&a(O),x=O&&this._computeTargetAndRootIntersection(O,I,r);I&&x?(b=O,_=l(I,x)):(b=null,v=null)}else{var T=b.ownerDocument;b!=T.body&&b!=T.documentElement&&"visible"!=y.overflow&&(_=a(b))}if(_&&(s=_,h=v,c=void 0,u=void 0,p=void 0,d=void 0,g=void 0,m=void 0,c=Math.max(s.top,h.top),u=Math.min(s.bottom,h.bottom),p=Math.max(s.left,h.left),d=Math.min(s.right,h.right),m=u-c,v=(g=d-p)>=0&&m>=0&&{top:c,bottom:u,left:p,right:d,width:g,height:m}||null),!v)break;b=b&&f(b)}return v}},s.prototype._getRootRect=function(){var e;if(this.root&&!d(this.root))e=a(this.root);else{var o=d(this.root)?this.root:t,n=o.documentElement,i=o.body;e={top:0,left:0,right:n.clientWidth||i.clientWidth,width:n.clientWidth||i.clientWidth,bottom:n.clientHeight||i.clientHeight,height:n.clientHeight||i.clientHeight}}return this._expandRectByRootMargin(e)},s.prototype._expandRectByRootMargin=function(t){var e=this._rootMarginValues.map((function(e,o){return"px"==e.unit?e.value:e.value*(o%2?t.width:t.height)/100})),o={top:t.top-e[0],right:t.right+e[1],bottom:t.bottom+e[2],left:t.left-e[3]};return o.width=o.right-o.left,o.height=o.bottom-o.top,o},s.prototype._hasCrossedThreshold=function(t,e){var o=t&&t.isIntersecting?t.intersectionRatio||0:-1,n=e.isIntersecting?e.intersectionRatio||0:-1;if(o!==n)for(var i=0;i<this.thresholds.length;i++){var r=this.thresholds[i];if(r==o||r==n||r<o!=r<n)return!0}},s.prototype._rootIsInDom=function(){return!this.root||p(t,this.root)},s.prototype._rootContainsTarget=function(e){var o=this.root&&(this.root.ownerDocument||this.root)||t;return p(o,e)&&(!this.root||o==e.ownerDocument)},s.prototype._registerInstance=function(){e.indexOf(this)<0&&e.push(this)},s.prototype._unregisterInstance=function(){var t=e.indexOf(this);-1!=t&&e.splice(t,1)},window.IntersectionObserver=s,window.IntersectionObserverEntry=r}function i(t){try{return t.defaultView&&t.defaultView.frameElement||null}catch(e){return null}}function r(t){this.time=t.time,this.target=t.target,this.rootBounds=u(t.rootBounds),this.boundingClientRect=u(t.boundingClientRect),this.intersectionRect=u(t.intersectionRect||{top:0,bottom:0,left:0,right:0,width:0,height:0}),this.isIntersecting=!!t.intersectionRect;var e=this.boundingClientRect,o=e.width*e.height,n=this.intersectionRect,i=n.width*n.height;this.intersectionRatio=o?Number((i/o).toFixed(4)):this.isIntersecting?1:0}function s(t,e){var o,n,i,r=e||{};if("function"!=typeof t)throw new Error("callback must be a function");if(r.root&&1!=r.root.nodeType&&9!=r.root.nodeType)throw new Error("root must be a Document or Element");this._checkForIntersections=(o=this._checkForIntersections.bind(this),n=this.THROTTLE_TIMEOUT,i=null,function(){i||(i=setTimeout((function(){o(),i=null}),n))}),this._callback=t,this._observationTargets=[],this._queuedEntries=[],this._rootMarginValues=this._parseRootMargin(r.rootMargin),this.thresholds=this._initThresholds(r.threshold),this.root=r.root||null,this.rootMargin=this._rootMarginValues.map((function(t){return t.value+t.unit})).join(" "),this._monitoringDocuments=[],this._monitoringUnsubscribes=[]}function h(t,e,o,n){"function"==typeof t.addEventListener?t.addEventListener(e,o,n||!1):"function"==typeof t.attachEvent&&t.attachEvent("on"+e,o)}function c(t,e,o,n){"function"==typeof t.removeEventListener?t.removeEventListener(e,o,n||!1):"function"==typeof t.detatchEvent&&t.detatchEvent("on"+e,o)}function a(t){var e;try{e=t.getBoundingClientRect()}catch(o){}return e?(e.width&&e.height||(e={top:e.top,right:e.right,bottom:e.bottom,left:e.left,width:e.right-e.left,height:e.bottom-e.top}),e):{top:0,bottom:0,left:0,right:0,width:0,height:0}}function u(t){return!t||"x"in t?t:{top:t.top,y:t.top,bottom:t.bottom,left:t.left,x:t.left,right:t.right,width:t.width,height:t.height}}function l(t,e){var o=e.top-t.top,n=e.left-t.left;return{top:o,left:n,height:e.height,width:e.width,bottom:o+e.height,right:n+e.width}}function p(t,e){for(var o=e;o;){if(o==t)return!0;o=f(o)}return!1}function f(e){var o=e.parentNode;return 9==e.nodeType&&e!=t?i(e):(o&&o.assignedSlot&&(o=o.assignedSlot.parentNode),o&&11==o.nodeType&&o.host?o.host:o)}function d(t){return t&&9===t.nodeType}}();class _ extends s{constructor({threshold:t=.5}={}){super(),this.reportDataMap=new WeakMap,this.observer=new IntersectionObserver((t=>{t.forEach((t=>{if(t.isIntersecting&&t.target){this.observer.unobserve(t.target);const e=this.reportDataMap.get(t.target);e&&(this.reportDataMap.delete(t.target),this.report(e))}}))}),{threshold:t})}add({el:t,data:e}){console.log("add",t,e),this.reportDataMap.set(t,e),this.observer.observe(t)}remove({el:t}){this.reportDataMap.delete(t),this.observer.unobserve(t)}report(t){console.log("TrackExposure report",t)}}class y extends s{constructor(t={}){super(),this.options=((t,r)=>{for(var s in r||(r={}))o.call(r,s)&&i(t,s,r[s]);if(e)for(var s of e(r))n.call(r,s)&&i(t,s,r[s]);return t})({},t),this.logger=new w(this.options),this.logger.init({url:"http://localhost:3001"}),this.logger.log("pv",{name:"cody",sex:"man"},{extra:123}),this.logger.upload(),this.exposure=new _(this.options),console.log(this.exposure,this.logger)}setOptions(t={}){Object.assign(this.options,t)}getAid(){console.log("getAid")}report(){console.log("report")}onBeforeRequest(){console.log("onBeforeRequest")}beforeReport(){console.log("beforeReport")}onReport(){console.log("onReport")}}export{y as default};
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};

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

var __defProp=Object.defineProperty,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(t,e,o)=>e in t?__defProp(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,__spreadValues=(t,e)=>{for(var o in e||(e={}))__hasOwnProp.call(e,o)&&__defNormalProp(t,o,e[o]);if(__getOwnPropSymbols)for(var o of __getOwnPropSymbols(e))__propIsEnum.call(e,o)&&__defNormalProp(t,o,e[o]);return t};!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).IntlgameReport=e()}(this,(function(){"use strict";var t={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,o="~";function n(){}function r(t,e,o){this.fn=t,this.context=e,this.once=o||!1}function i(t,e,n,i,s){if("function"!=typeof n)throw new TypeError("The listener must be a function");var h=new r(n,i||t,s),a=o?o+e:e;return t._events[a]?t._events[a].fn?t._events[a]=[t._events[a],h]:t._events[a].push(h):(t._events[a]=h,t._eventsCount++),t}function s(t,e){0==--t._eventsCount?t._events=new n:delete t._events[e]}function h(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(o=!1)),h.prototype.eventNames=function(){var t,n,r=[];if(0===this._eventsCount)return r;for(n in t=this._events)e.call(t,n)&&r.push(o?n.slice(1):n);return Object.getOwnPropertySymbols?r.concat(Object.getOwnPropertySymbols(t)):r},h.prototype.listeners=function(t){var e=o?o+t:t,n=this._events[e];if(!n)return[];if(n.fn)return[n.fn];for(var r=0,i=n.length,s=new Array(i);r<i;r++)s[r]=n[r].fn;return s},h.prototype.listenerCount=function(t){var e=o?o+t:t,n=this._events[e];return n?n.fn?1:n.length:0},h.prototype.emit=function(t,e,n,r,i,s){var h=o?o+t:t;if(!this._events[h])return!1;var a,c,u=this._events[h],l=arguments.length;if(u.fn){switch(u.once&&this.removeListener(t,u.fn,void 0,!0),l){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,e),!0;case 3:return u.fn.call(u.context,e,n),!0;case 4:return u.fn.call(u.context,e,n,r),!0;case 5:return u.fn.call(u.context,e,n,r,i),!0;case 6:return u.fn.call(u.context,e,n,r,i,s),!0}for(c=1,a=new Array(l-1);c<l;c++)a[c-1]=arguments[c];u.fn.apply(u.context,a)}else{var p,f=u.length;for(c=0;c<f;c++)switch(u[c].once&&this.removeListener(t,u[c].fn,void 0,!0),l){case 1:u[c].fn.call(u[c].context);break;case 2:u[c].fn.call(u[c].context,e);break;case 3:u[c].fn.call(u[c].context,e,n);break;case 4:u[c].fn.call(u[c].context,e,n,r);break;default:if(!a)for(p=1,a=new Array(l-1);p<l;p++)a[p-1]=arguments[p];u[c].fn.apply(u[c].context,a)}}return!0},h.prototype.on=function(t,e,o){return i(this,t,e,o,!1)},h.prototype.once=function(t,e,o){return i(this,t,e,o,!0)},h.prototype.removeListener=function(t,e,n,r){var i=o?o+t:t;if(!this._events[i])return this;if(!e)return s(this,i),this;var h=this._events[i];if(h.fn)h.fn!==e||r&&!h.once||n&&h.context!==n||s(this,i);else{for(var a=0,c=[],u=h.length;a<u;a++)(h[a].fn!==e||r&&!h[a].once||n&&h[a].context!==n)&&c.push(h[a]);c.length?this._events[i]=1===c.length?c[0]:c:s(this,i)}return this},h.prototype.removeAllListeners=function(t){var e;return t?(e=o?o+t:t,this._events[e]&&s(this,e)):(this._events=new n,this._eventsCount=0),this},h.prototype.off=h.prototype.removeListener,h.prototype.addListener=h.prototype.on,h.prefixed=o,h.EventEmitter=h,t.exports=h}(t);var e=t.exports;function o(t){const e="abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNOPQRSTUVWXYZ1234567890",o=e.length,n=[];for(let r=t;r>0;--r)n.push(e[Math.round(Math.random()*(o-1))]);return n.join("")}const n=navigator.userAgent,r={isH5:/(Android|iPhone|iPad|iPod|iOS|Windows Phone)/i.test(n),isQQ:/\b(V1_AND_SQI?_([\d.]+))|(.*? QQ\/([\d.]+))/.test(n),isQQPA:/.*? PA QQ\/([\d.]+)/.test(n),isWX:/\bMicroMessenger\/([\d.]+)/.test(n),isCloudGame:/\bCloudGame/.test(n),isiOS:/(iPad|iPhone|iPod).*? (IPad)?/.test(n),isAndroid:/\bandroid/i.test(n),isOppoBrowser:/\bOppoBrowser/i.test(n),isOnePlusBrowser:/\bOnePlusBrowser/i.test(n),isHeyTapBrowser:/\bHeyTapBrowser/i.test(n),isLieBaoBrowser:/\bLieBaoFast/i.test(n),isHuaweiBrowser:/\bHuaweiBrowser/i.test(n),isQQBrowser:/\bMQQBrowser/.test(n),isFirefox:/\bFirefox/i.test(n),isEdge:/\bEdge\//.test(n),isIE:/\bTrident\//.test(n),isQzone:/\bQzone/.test(n),isQQLive:/\bQQLiveBrowser/.test(n),isWeiBo:/\bWeibo/i.test(n),isMacOS:"MacIntel"===navigator.platform,isChrome:/\bChrome/.test(n),isWeTalk:/\bWeTalk\/([\d.]+)/.test(n),isWxWork:/\bwxwork\/([\d.]+)/.test(n),isNGA:/\bNga_Official\/([\d.]+)/.test(n),isNanJi:/\bcom\.tencent\.southpole\.appstore\/NanJi/.test(n),isSmobaGameHelper:/\bsmobagamehelper/.test(n),isSafari:!1,isPC:!1,iOSVersion:"",qqVersion:"",wxWorkVersion:"",tbsVersion:"",qqBrowserVersion:"",xwebVersion:"",chromeVersion:"",isMiniProgram:!1};r.isSafari=/\bSafari/.test(n)&&!r.isChrome,r.isPC=!r.isH5,r.isAndroid&&r.isiOS&&(r.isiOS=!1);const i=navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/);i&&(r.iOSVersion=`${parseInt(i[1],10)}.${parseInt(i[2],10)}.${parseInt(i[3]||"0",10)}`);const s=n.match(/\bQQ\/([\d.]+)/);s&&([,r.qqVersion]=s);const h=n.match(/\bwxwork\/([\d.]+)/);h&&([,r.wxWorkVersion]=h);const a=n.match(/\bTBS\/([\d.]+)/);a&&([,r.tbsVersion]=a);const c=n.match(/\bMQQBrowser\/([\d.]+)/);c&&([,r.qqBrowserVersion]=c);const u=n.match(/\bXWEB\/([\d.]+)/);u&&([,r.xwebVersion]=u);const l=n.match(/\bChrome\/([\d]+)/);l&&([,r.chromeVersion]=l);const p=()=>{r.isMiniProgram="miniprogram"===window.__wxjs_environment};p(),!r.isWX||window.WeixinJSBridge&&window.WeixinJSBridge.invoke||document.addEventListener("WeixinJSBridgeReady",p,!1);const f=!(r.isiOS&&r.isQQ);class d extends e{constructor(t={}){super(),this.options=Object.assign({sessionId:"",module:"web",uin:o(16),uploadThreshold:30,showConsole:!0},t),this.seq=0,this.logs=[]}init(t={}){Object.assign(this.options,t);const{sessionId:e,module:o,uin:n,extraInfo:r}=this.options,i={"@timestamp":(new Date).toISOString(),type:"pre-init",sid:e,module:o,url:location.href,user:{uin:n},extraInfo:r};this.logs.push(i)}setOptions(t={}){Object.assign(this.options,t)}log(t,...e){try{this.options.showConsole&&console.log(...e);const{sessionId:o,module:n,uin:r}=this.options,i={type:t,"@timestamp":(new Date).toISOString(),sid:o,module:n,uin:r,seq:this.seq+=1};this.logs.push(i),this.checkAndAutoUpload()}catch(o){console.warn("[Logger]error",o)}}checkAndAutoUpload(){const{uploadThreshold:t}=this.options;t&&this.logs.length>=t&&this.upload()}upload(t=!1){if(!this.logs.length)return;const{url:e}=this.options;this.xhr(this.logs,e,t),this.logs=[]}xhr(t={},e,o){if(f){if(navigator.sendBeacon(e,JSON.stringify(t)))return;console.warn("navigator.sendBeacon error, use xhr instead.")}const n=new XMLHttpRequest;n.open("POST",e,!o),n.send(JSON.stringify(t))}}!function(){if("object"==typeof window)if("IntersectionObserver"in window&&"IntersectionObserverEntry"in window&&"intersectionRatio"in window.IntersectionObserverEntry.prototype)"isIntersecting"in window.IntersectionObserverEntry.prototype||Object.defineProperty(window.IntersectionObserverEntry.prototype,"isIntersecting",{get:function(){return this.intersectionRatio>0}});else{var t=function(t){for(var e=window.document,o=r(e);o;)o=r(e=o.ownerDocument);return e}(),e=[],o=null,n=null;s.prototype.THROTTLE_TIMEOUT=100,s.prototype.POLL_INTERVAL=null,s.prototype.USE_MUTATION_OBSERVER=!0,s._setupCrossOriginUpdater=function(){return o||(o=function(t,o){n=t&&o?l(t,o):{top:0,bottom:0,left:0,right:0,width:0,height:0},e.forEach((function(t){t._checkForIntersections()}))}),o},s._resetCrossOriginUpdater=function(){o=null,n=null},s.prototype.observe=function(t){if(!this._observationTargets.some((function(e){return e.element==t}))){if(!t||1!=t.nodeType)throw new Error("target must be an Element");this._registerInstance(),this._observationTargets.push({element:t,entry:null}),this._monitorIntersections(t.ownerDocument),this._checkForIntersections()}},s.prototype.unobserve=function(t){this._observationTargets=this._observationTargets.filter((function(e){return e.element!=t})),this._unmonitorIntersections(t.ownerDocument),0==this._observationTargets.length&&this._unregisterInstance()},s.prototype.disconnect=function(){this._observationTargets=[],this._unmonitorAllIntersections(),this._unregisterInstance()},s.prototype.takeRecords=function(){var t=this._queuedEntries.slice();return this._queuedEntries=[],t},s.prototype._initThresholds=function(t){var e=t||[0];return Array.isArray(e)||(e=[e]),e.sort().filter((function(t,e,o){if("number"!=typeof t||isNaN(t)||t<0||t>1)throw new Error("threshold must be a number between 0 and 1 inclusively");return t!==o[e-1]}))},s.prototype._parseRootMargin=function(t){var e=(t||"0px").split(/\s+/).map((function(t){var e=/^(-?\d*\.?\d+)(px|%)$/.exec(t);if(!e)throw new Error("rootMargin must be specified in pixels or percent");return{value:parseFloat(e[1]),unit:e[2]}}));return e[1]=e[1]||e[0],e[2]=e[2]||e[0],e[3]=e[3]||e[1],e},s.prototype._monitorIntersections=function(e){var o=e.defaultView;if(o&&-1==this._monitoringDocuments.indexOf(e)){var n=this._checkForIntersections,i=null,s=null;this.POLL_INTERVAL?i=o.setInterval(n,this.POLL_INTERVAL):(h(o,"resize",n,!0),h(e,"scroll",n,!0),this.USE_MUTATION_OBSERVER&&"MutationObserver"in o&&(s=new o.MutationObserver(n)).observe(e,{attributes:!0,childList:!0,characterData:!0,subtree:!0})),this._monitoringDocuments.push(e),this._monitoringUnsubscribes.push((function(){var t=e.defaultView;t&&(i&&t.clearInterval(i),a(t,"resize",n,!0)),a(e,"scroll",n,!0),s&&s.disconnect()}));var c=this.root&&(this.root.ownerDocument||this.root)||t;if(e!=c){var u=r(e);u&&this._monitorIntersections(u.ownerDocument)}}},s.prototype._unmonitorIntersections=function(e){var o=this._monitoringDocuments.indexOf(e);if(-1!=o){var n=this.root&&(this.root.ownerDocument||this.root)||t;if(!this._observationTargets.some((function(t){var o=t.element.ownerDocument;if(o==e)return!0;for(;o&&o!=n;){var i=r(o);if((o=i&&i.ownerDocument)==e)return!0}return!1}))){var i=this._monitoringUnsubscribes[o];if(this._monitoringDocuments.splice(o,1),this._monitoringUnsubscribes.splice(o,1),i(),e!=n){var s=r(e);s&&this._unmonitorIntersections(s.ownerDocument)}}}},s.prototype._unmonitorAllIntersections=function(){var t=this._monitoringUnsubscribes.slice(0);this._monitoringDocuments.length=0,this._monitoringUnsubscribes.length=0;for(var e=0;e<t.length;e++)t[e]()},s.prototype._checkForIntersections=function(){if(this.root||!o||n){var t=this._rootIsInDom(),e=t?this._getRootRect():{top:0,bottom:0,left:0,right:0,width:0,height:0};this._observationTargets.forEach((function(n){var r=n.element,s=c(r),h=this._rootContainsTarget(r),a=n.entry,u=t&&h&&this._computeTargetAndRootIntersection(r,s,e),l=null;this._rootContainsTarget(r)?o&&!this.root||(l=e):l={top:0,bottom:0,left:0,right:0,width:0,height:0};var p=n.entry=new i({time:window.performance&&performance.now&&performance.now(),target:r,boundingClientRect:s,rootBounds:l,intersectionRect:u});a?t&&h?this._hasCrossedThreshold(a,p)&&this._queuedEntries.push(p):a&&a.isIntersecting&&this._queuedEntries.push(p):this._queuedEntries.push(p)}),this),this._queuedEntries.length&&this._callback(this.takeRecords(),this)}},s.prototype._computeTargetAndRootIntersection=function(e,r,i){if("none"!=window.getComputedStyle(e).display){for(var s,h,a,u,p,d,g,m,v=r,b=f(e),_=!1;!_&&b;){var w=null,y=1==b.nodeType?window.getComputedStyle(b):{};if("none"==y.display)return null;if(b==this.root||9==b.nodeType)if(_=!0,b==this.root||b==t)o&&!this.root?!n||0==n.width&&0==n.height?(b=null,w=null,v=null):w=n:w=i;else{var O=f(b),I=O&&c(O),x=O&&this._computeTargetAndRootIntersection(O,I,i);I&&x?(b=O,w=l(I,x)):(b=null,v=null)}else{var T=b.ownerDocument;b!=T.body&&b!=T.documentElement&&"visible"!=y.overflow&&(w=c(b))}if(w&&(s=w,h=v,a=void 0,u=void 0,p=void 0,d=void 0,g=void 0,m=void 0,a=Math.max(s.top,h.top),u=Math.min(s.bottom,h.bottom),p=Math.max(s.left,h.left),d=Math.min(s.right,h.right),m=u-a,v=(g=d-p)>=0&&m>=0&&{top:a,bottom:u,left:p,right:d,width:g,height:m}||null),!v)break;b=b&&f(b)}return v}},s.prototype._getRootRect=function(){var e;if(this.root&&!d(this.root))e=c(this.root);else{var o=d(this.root)?this.root:t,n=o.documentElement,r=o.body;e={top:0,left:0,right:n.clientWidth||r.clientWidth,width:n.clientWidth||r.clientWidth,bottom:n.clientHeight||r.clientHeight,height:n.clientHeight||r.clientHeight}}return this._expandRectByRootMargin(e)},s.prototype._expandRectByRootMargin=function(t){var e=this._rootMarginValues.map((function(e,o){return"px"==e.unit?e.value:e.value*(o%2?t.width:t.height)/100})),o={top:t.top-e[0],right:t.right+e[1],bottom:t.bottom+e[2],left:t.left-e[3]};return o.width=o.right-o.left,o.height=o.bottom-o.top,o},s.prototype._hasCrossedThreshold=function(t,e){var o=t&&t.isIntersecting?t.intersectionRatio||0:-1,n=e.isIntersecting?e.intersectionRatio||0:-1;if(o!==n)for(var r=0;r<this.thresholds.length;r++){var i=this.thresholds[r];if(i==o||i==n||i<o!=i<n)return!0}},s.prototype._rootIsInDom=function(){return!this.root||p(t,this.root)},s.prototype._rootContainsTarget=function(e){var o=this.root&&(this.root.ownerDocument||this.root)||t;return p(o,e)&&(!this.root||o==e.ownerDocument)},s.prototype._registerInstance=function(){e.indexOf(this)<0&&e.push(this)},s.prototype._unregisterInstance=function(){var t=e.indexOf(this);-1!=t&&e.splice(t,1)},window.IntersectionObserver=s,window.IntersectionObserverEntry=i}function r(t){try{return t.defaultView&&t.defaultView.frameElement||null}catch(e){return null}}function i(t){this.time=t.time,this.target=t.target,this.rootBounds=u(t.rootBounds),this.boundingClientRect=u(t.boundingClientRect),this.intersectionRect=u(t.intersectionRect||{top:0,bottom:0,left:0,right:0,width:0,height:0}),this.isIntersecting=!!t.intersectionRect;var e=this.boundingClientRect,o=e.width*e.height,n=this.intersectionRect,r=n.width*n.height;this.intersectionRatio=o?Number((r/o).toFixed(4)):this.isIntersecting?1:0}function s(t,e){var o,n,r,i=e||{};if("function"!=typeof t)throw new Error("callback must be a function");if(i.root&&1!=i.root.nodeType&&9!=i.root.nodeType)throw new Error("root must be a Document or Element");this._checkForIntersections=(o=this._checkForIntersections.bind(this),n=this.THROTTLE_TIMEOUT,r=null,function(){r||(r=setTimeout((function(){o(),r=null}),n))}),this._callback=t,this._observationTargets=[],this._queuedEntries=[],this._rootMarginValues=this._parseRootMargin(i.rootMargin),this.thresholds=this._initThresholds(i.threshold),this.root=i.root||null,this.rootMargin=this._rootMarginValues.map((function(t){return t.value+t.unit})).join(" "),this._monitoringDocuments=[],this._monitoringUnsubscribes=[]}function h(t,e,o,n){"function"==typeof t.addEventListener?t.addEventListener(e,o,n||!1):"function"==typeof t.attachEvent&&t.attachEvent("on"+e,o)}function a(t,e,o,n){"function"==typeof t.removeEventListener?t.removeEventListener(e,o,n||!1):"function"==typeof t.detatchEvent&&t.detatchEvent("on"+e,o)}function c(t){var e;try{e=t.getBoundingClientRect()}catch(o){}return e?(e.width&&e.height||(e={top:e.top,right:e.right,bottom:e.bottom,left:e.left,width:e.right-e.left,height:e.bottom-e.top}),e):{top:0,bottom:0,left:0,right:0,width:0,height:0}}function u(t){return!t||"x"in t?t:{top:t.top,y:t.top,bottom:t.bottom,left:t.left,x:t.left,right:t.right,width:t.width,height:t.height}}function l(t,e){var o=e.top-t.top,n=e.left-t.left;return{top:o,left:n,height:e.height,width:e.width,bottom:o+e.height,right:n+e.width}}function p(t,e){for(var o=e;o;){if(o==t)return!0;o=f(o)}return!1}function f(e){var o=e.parentNode;return 9==e.nodeType&&e!=t?r(e):(o&&o.assignedSlot&&(o=o.assignedSlot.parentNode),o&&11==o.nodeType&&o.host?o.host:o)}function d(t){return t&&9===t.nodeType}}();class g extends e{constructor({threshold:t=.5}={}){super(),this.reportDataMap=new WeakMap,this.observer=new IntersectionObserver((t=>{t.forEach((t=>{if(t.isIntersecting&&t.target){this.observer.unobserve(t.target);const e=this.reportDataMap.get(t.target);e&&(this.reportDataMap.delete(t.target),this.report(e))}}))}),{threshold:t})}add({el:t,data:e}){console.log("add",t,e),this.reportDataMap.set(t,e),this.observer.observe(t)}remove({el:t}){this.reportDataMap.delete(t),this.observer.unobserve(t)}report(t){console.log("TrackExposure report",t)}}return class extends e{constructor(t={}){super(),this.options=__spreadValues({},t),this.logger=new d(this.options),this.logger.init({url:"http://localhost:3001"}),this.logger.log("pv",{name:"cody",sex:"man"},{extra:123}),this.logger.upload(),this.exposure=new g(this.options),console.log(this.exposure,this.logger)}setOptions(t={}){Object.assign(this.options,t)}getAid(){console.log("getAid")}report(){console.log("report")}onBeforeRequest(){console.log("onBeforeRequest")}beforeReport(){console.log("beforeReport")}onReport(){console.log("onReport")}}}));
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"}));

@@ -1,14 +0,17 @@

import EventEmitter from 'eventemitter3';
import Exposure from './libs/exposure';
export default class Report extends EventEmitter {
exposure: Exposure;
import type { Options, ExtendOptions, Event } from './interface';
export * from './interface';
export declare class IntlgameReport {
private options;
private logger;
constructor(options?: {});
setOptions(options?: {}): void;
getAid(): void;
report(): void;
onBeforeRequest(): void;
beforeReport(): void;
onReport(): void;
private seq;
private initialized;
private caches;
init(options: Options): Promise<any>;
extend(options: ExtendOptions): void;
reportEvents(events: Event | Event[]): any;
private envToUrl;
private mergeCommonKV;
private get meta();
private get params();
}
declare const _default: IntlgameReport;
export default _default;
{
"name": "@intlsdk/report",
"version": "1.2.4",
"version": "1.3.0",
"main": "dist/index.umd.js",

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

"dependencies": {
"axios": "^0.21.1",
"eventemitter3": "^4.0.7",
"intersection-observer": "^0.12.0",
"md5": "^2.3.0",
"preact": "^10.5.13"

@@ -39,3 +37,3 @@ },

},
"gitHead": "e58b7c71dd600786bcef225e254746d413963cfe"
"gitHead": "0f5b477659c0a010c546f511ff84bef4086c74e1"
}
# SDK 数据上报
## 使用方法
## Getting Started
### 初始化
```ts
import Report from '@intlsdk/report';
import Report, { Channel } from '@intlsdk/report';
const report = new Report({
id: 'pGUVFTCZyewxxxxx', // 项目key
uin: 'xxx', // 用户唯一 ID(可选)
// 初始化(获取session_id并自动上报start事件)
Report.init({
env: 'test', // 环境或后台域名
gameId: 11, // INTL 分配的游戏 ID
sigKey: 'sigkey', // SDK_KEY
channelId: Channel.Guest, // 登录渠道 ID
appVersion: '1.2.3', // 业务应用版本号
openId: 'clzhu', // 用户ID
});
```
### 上报类型
// 扩展选项(不生成session_id)
Report.extend({ openId: 'clzhu' });
#### 主动上报
// 上报kv数据(兼容数组方式批量上报,详见下方示例)
Report.reportEvents({
srcId: 1000, // 数据源ID
eventName: 'monitor', // 事件名称
// 以下为其他自定义字段,详见tlog文档
foo: 11,
bar: 12,
});
初始化 SDK 会主动上报 `PV/UV` 等信息
#### 自动上报
```ts
report.report(`Your Message`);
// 批量上报kv数据
Report.reportEvents([
{
srcId: 1000, // 数据源ID
eventName: 'monitor', // 事件名称
// 以下为其他自定义字段,详见tlog文档
foo: 11,
bar: 12,
},
{
srcId: 1000, // 数据源ID
eventName: 'http', // 事件名称
// 以下为其他自定义字段,详见tlog文档
foo: 'abc',
bar: '123',
},
]);
```

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