!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).NgLogger=t()}(this,(function(){"use strict";var e=function(){return(e=Object.assign||function(e){for(var t,o=1,n=arguments.length;o<n;o++)for(var i in t=arguments[o])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};var t=function(e,t,o){if(function(e){if("function"!=typeof e)throw TypeError(e+" is not a function!")}(e),void 0===t)return e;switch(o){case 1:return function(o){return e.call(t,o)};case 2:return function(o,n){return e.call(t,o,n)};case 3:return function(o,n,i){return e.call(t,o,n,i)}}return function(){return e.apply(t,arguments)}};function o(e,t){return e(t={exports:{}},t.exports),t.exports}var n=o((function(e){var t=e.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=t)})),i=o((function(e){var t=e.exports={version:"2.6.11"};"number"==typeof __e&&(__e=t)})),r=(i.version,function(e){return"object"==typeof e?null!==e:"function"==typeof e}),a=function(e){if(!r(e))throw TypeError(e+" is not an object!");return e},s=function(e){try{return!!e()}catch(e){return!0}},u=!s((function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})),c=n.document,d=r(c)&&r(c.createElement),p=!u&&!s((function(){return 7!=Object.defineProperty((e="div",d?c.createElement(e):{}),"a",{get:function(){return 7}}).a;var e})),g=Object.defineProperty,f={f:u?Object.defineProperty:function(e,t,o){if(a(e),t=function(e,t){if(!r(e))return e;var o,n;if(t&&"function"==typeof(o=e.toString)&&!r(n=o.call(e)))return n;if("function"==typeof(o=e.valueOf)&&!r(n=o.call(e)))return n;if(!t&&"function"==typeof(o=e.toString)&&!r(n=o.call(e)))return n;throw TypeError("Can't convert object to primitive value")}(t,!0),a(o),p)try{return g(e,t,o)}catch(e){}if("get"in o||"set"in o)throw TypeError("Accessors not supported!");return"value"in o&&(e[t]=o.value),e}},l=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},h=u?function(e,t,o){return f.f(e,t,l(1,o))}:function(e,t,o){return e[t]=o,e},m={}.hasOwnProperty,v=function(e,t){return m.call(e,t)},y=0,b=Math.random(),w=function(e){return"Symbol(".concat(void 0===e?"":e,")_",(++y+b).toString(36))},_=o((function(e){var t=n["__core-js_shared__"]||(n["__core-js_shared__"]={});(e.exports=function(e,o){return t[e]||(t[e]=void 0!==o?o:{})})("versions",[]).push({version:i.version,mode:"global",copyright:"© 2019 Denis Pushkarev (zloirock.ru)"})})),O=_("native-function-to-string",Function.toString),T=o((function(e){var t=w("src"),o=(""+O).split("toString");i.inspectSource=function(e){return O.call(e)},(e.exports=function(e,i,r,a){var s="function"==typeof r;s&&(v(r,"name")||h(r,"name",i)),e[i]!==r&&(s&&(v(r,t)||h(r,t,e[i]?""+e[i]:o.join(String(i)))),e===n?e[i]=r:a?e[i]?e[i]=r:h(e,i,r):(delete e[i],h(e,i,r)))})(Function.prototype,"toString",(function(){return"function"==typeof this&&this[t]||O.call(this)}))})),L=function(e,o,r){var a,s,u,c,d=e&L.F,p=e&L.G,g=e&L.S,f=e&L.P,l=e&L.B,m=p?n:g?n[o]||(n[o]={}):(n[o]||{}).prototype,v=p?i:i[o]||(i[o]={}),y=v.prototype||(v.prototype={});for(a in p&&(r=o),r)u=((s=!d&&m&&void 0!==m[a])?m:r)[a],c=l&&s?t(u,n):f&&"function"==typeof u?t(Function.call,u):u,m&&T(m,a,u,e&L.U),v[a]!=u&&h(v,a,c),f&&y[a]!=u&&(y[a]=u)};n.core=i,L.F=1,L.G=2,L.S=4,L.P=8,L.B=16,L.W=32,L.U=64,L.R=128;var x=L,P=function(e){if(null==e)throw TypeError("Can't call method on  "+e);return e},C=function(e){return Object(P(e))},k=function(e,t,o,n){try{return n?t(a(o)[0],o[1]):t(o)}catch(t){var i=e.return;throw void 0!==i&&a(i.call(e)),t}},S={},M=o((function(e){var t=_("wks"),o=n.Symbol,i="function"==typeof o;(e.exports=function(e){return t[e]||(t[e]=i&&o[e]||(i?o:w)("Symbol."+e))}).store=t})),A=M("iterator"),B=Array.prototype,N=function(e){return void 0!==e&&(S.Array===e||B[A]===e)},D=Math.ceil,E=Math.floor,j=function(e){return isNaN(e=+e)?0:(e>0?E:D)(e)},I=Math.min,R=function(e){return e>0?I(j(e),9007199254740991):0},V=function(e,t,o){t in e?f.f(e,t,l(0,o)):e[t]=o},q={}.toString,G=function(e){return q.call(e).slice(8,-1)},F=M("toStringTag"),U="Arguments"==G(function(){return arguments}()),Q=M("iterator"),$=i.getIteratorMethod=function(e){if(null!=e)return e[Q]||e["@@iterator"]||S[function(e){var t,o,n;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(o=function(e,t){try{return e[t]}catch(e){}}(t=Object(e),F))?o:U?G(t):"Object"==(n=G(t))&&"function"==typeof t.callee?"Arguments":n}(e)]},W=M("iterator"),z=!1;try{var J=[7][W]();J.return=function(){z=!0},Array.from(J,(function(){throw 2}))}catch(e){}x(x.S+x.F*!function(e,t){if(!t&&!z)return!1;var o=!1;try{var n=[7],i=n[W]();i.next=function(){return{done:o=!0}},n[W]=function(){return i},e(n)}catch(e){}return o}((function(e){Array.from(e)})),"Array",{from:function(e){var o,n,i,r,a=C(e),s="function"==typeof this?this:Array,u=arguments.length,c=u>1?arguments[1]:void 0,d=void 0!==c,p=0,g=$(a);if(d&&(c=t(c,u>2?arguments[2]:void 0,2)),null==g||s==Array&&N(g))for(n=new s(o=R(a.length));o>p;p++)V(n,p,d?c(a[p],p):a[p]);else for(r=g.call(a),n=new s;!(i=r.next()).done;p++)V(n,p,d?k(r,c,[i.value,p],!0):i.value);return n.length=p,n}});var H=Object("z").propertyIsEnumerable(0)?Object:function(e){return"String"==G(e)?e.split(""):Object(e)},X=Math.max,K=Math.min,Y=M("unscopables"),Z=Array.prototype;null==Z[Y]&&h(Z,Y,{});var ee,te,oe=(ee=!0,function(e,t,o){var n,i=H(P(e)),r=R(i.length),a=function(e,t){return(e=j(e))<0?X(e+t,0):K(e,t)}(o,r);if(ee&&t!=t){for(;r>a;)if((n=i[a++])!=n)return!0}else for(;r>a;a++)if((ee||a in i)&&i[a]===t)return ee||a||0;return!ee&&-1});x(x.P,"Array",{includes:function(e){return oe(this,e,arguments.length>1?arguments[1]:void 0)}}),te="includes",Z[Y][te]=!0;var ne=this&&this.__assign||function(){return(ne=Object.assign||function(e){for(var t,o=1,n=arguments.length;o<n;o++)for(var i in t=arguments[o])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},ie={path:"/"},re=function(e){return e.replace(/%3B/g,";")},ae=function(e){return e.replace(/;/g,"%3B")};function se(e){for(var t=document.cookie?document.cookie.split("; "):[],o={},n=0;n<t.length;n++){var i=t[n].split("="),r=i.slice(1).join("="),a=re(i[0]).replace(/%3D/g,"=");if(o[a]=re(r),e===a)break}return e?o[e]:o}var ue=window.navigator.userAgent,ce={isAndroid:/Android/i.test(ue),isiOS:/\(i[^;]+;( U;)? CPU.+Mac OS X/.test(ue),isNG:/ninegameclient/i.test(ue),isNGSdk:/ucsdk/i.test(ue),isNGAndroid:/ninegameclient\/android/i.test(ue),isNGiOS:/ninegameclient\/ios/i.test(ue),isUC:/UCBrowser/i.test(ue),isWechat:/MicroMessenger/i.test(ue),isWeiBo:/WeiBo/i.test(ue),isDingTalk:/DingTalk/i.test(ue)};function de(e,t){return void 0===t&&(t={crossOrigin:""}),new Promise((function(o,n){var i=document.getElementsByTagName("head")[0],r=document.createElement("script");r.type="text/javascript","anonymous"!==t.crossOrigin&&"use-credentials"!==t.crossOrigin||(r.crossOrigin=t.crossOrigin),r.src=e,r.onload=function(){o()},r.onerror=function(){n(new Error(e+" 加载失败"))},i.appendChild(r)}))}function pe(e,t,o){void 0===t&&(t=200);var n=!0,i=!0;return"object"==typeof o&&(n="isImmediate"in o?!!o.isImmediate:n,i="isDebounce"in o?!!o.isDebounce:i),function(e,t,o){void 0===t&&(t=200);var n,i,r,a=!0,s=!1,u=0,c=!1;function d(){void 0!==n&&clearTimeout(n)}function p(){u=a?Date.now():0,e.apply(i,r)}function g(){for(var e=[],o=0;o<arguments.length;o++)e[o]=arguments[o];if(!c){var g=Date.now();0===u&&!1===a&&(u=g);var f=g-u;r=e,i=this,d(),f>t?p():(s&&(d(),u=g),n=setTimeout(p,t-f))}}return"object"==typeof o&&(a="isImmediate"in o?!!o.isImmediate:a,s="isDebounce"in o?!!o.isDebounce:s),g.cancel=function(){d(),u=0,c=!0},g}(e,t,{isDebounce:i,isImmediate:n})}var ge=this&&this.__assign||function(){return(ge=Object.assign||function(e){for(var t,o=1,n=arguments.length;o<n;o++)for(var i in t=arguments[o])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},fe=(this&&this.__spreadArrays,{decode:!0,parseArray:!0});function le(e,t){var o={};if(t=ge(ge({},fe),t),"string"!=typeof e)return o;if(!(e=e.trim().replace(/^[?#&]/,"")))return o;for(var n=0,i=e.split("&");n<i.length;n++){var r=i[n].split("="),a=r[0],s=r[1];void 0===s&&(s=null),t.decode&&("string"==typeof a&&(a=decodeURIComponent(a)),"string"==typeof s&&(s=decodeURIComponent(s))),void 0===o[a]?o[a]=s:t.parseArray&&(o[a]=[].concat(o[a],s))}return o}function he(e){var t={urlPart:"",queryPart:"",hashPart:""};if(!e)return t;var o=e.split(""),n=o.indexOf("?"),i=o.indexOf("#");return i>-1&&(t.hashPart=o.splice(i).join("")),n>-1&&(t.queryPart=o.splice(n).join("")),t.urlPart=o.join(""),t}function me(e){return void 0===e&&(e=window.location.href),he(e)}function ve(e,t){return void 0===t&&(t=window.location.href),function(e,t,o){return le(he(t).queryPart,{parseArray:o})[e]}(e,t,!1)}function ye(){return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,(function(e){return(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)}))}function be(t,o,n){var i=e({"Content-Type":"application/x-www-form-urlencoded"},o&&o.header||{});return function(e,t,o,n){var i,r=e;if("get"===t||"GET"===t){var a=(e||"").indexOf("?")>0?"&":"?";for(var s in o||{}){var u=o[s];if("function"==typeof u)throw new Error("[xhr.ajax] param type of `function` is NOT supported");if("object"==typeof u){if("header"!==s)throw new Error("[xhr.ajax] param type of `object` is NOT supported")}else a+=s+"="+(u||"")+"&"}r=e+a.slice(0,a.length-1)}var c=n,d=new XMLHttpRequest;if(d.withCredentials=!0,d.open(t,r),o.header){var p=o.header;for(var g in p)d.setRequestHeader(g,p[g])}if(d.onreadystatechange=function(){4===d.readyState&&200===d.status&&(c&&c(d.responseText),i&&i(d.responseText))},"get"===t||"GET"===t)d.send(d.responseText);else{if("get"!==t&&"GET"!==t)throw new Error("[xhr.ajax] Currently support `get` & `post` ONLY, PR/MR is welcome");d.send(JSON.stringify(o))}return{then:function(e){i=e}}}(t,"get",e(e({},o),{header:i}),n)}var we=/^[\s\S]*.*[^\s][\s\S]*$/i,_e=/WindVane\//i,Oe=/MQQBrowser/i,Te=/QQ\//i,Le=/AliApp\(TB(-PD)?\//i,xe=/SogouMSE\,SogouMobileBrowser/i,Pe=/quark\//i,Ce=/baiduboxapp\//i,ke=/NABar\//i,Se=/^page_(.)+/i;function Me(e){var t={};return Object.keys(e).forEach((function(o){var n=e[o];n&&we.test(n)&&(t[o]=n)})),t}function Ae(e,t,o){void 0===o&&(o=!1);var n=""+e;return!0===o?(Array(t).join("0")+n).slice(-t):(n+Array(t).join("0")).slice(0,t)}function Be(e,t){void 0===t&&(t=0);var o=e.replace(/\./g,"");return Ae(o,t||o.length)}function Ne(e,t){var o=Be(e),n=Be(t),i=Math.max(o.length,n.length),r=Ae(o,i),a=Ae(n,i);return{result:r===a?0:r>a?1:-1,a:r,b:a,maxLen:i}}function De(e,t,o){void 0===t&&(t="info"),void 0===o&&(o="Info"),console.info("["+o+" "+t+"]",e)}var Ee=function(){function t(t){var o=this;void 0===t&&(t={}),this.updateQuene=function(e){var t,n,i,r=o;(t=function(){var t=r.filter;r.$quene=Array.from(r.$root.querySelectorAll(t)),e&&e()},void 0===n&&(n=500),function(){var e=this,o=arguments;clearTimeout(i),i=setTimeout((function(){t.apply(e,o)}),n)})()},this.onDomMutation=function(e){o.info("识别到 dom 节点变化时更新监测列表"),o.updateQuene((function(){o.onViewMutation(),o.onDomMutationCB&&o.onDomMutationCB(e)}))},this.onViewMutation=function(){o.info("为观察列表挂载上监听iObserver");var e=o,t=e.$quene,n=e.iObserver;t&&t.length>0&&(t.every((function(e){return n.observe(e),!0})),o.onViewMutationCB&&o.onViewMutationCB(n))},this.onExposed=function(e,t){var n=e.target,i=o.option,r=i.exposureLeaveTime,a=i.uniqueLabel,s=i.exposureRatioThreshold,u=i.MAPPING,c=Math.min(s,1);if(e.intersectionRatio>=c){var d=n.getAttribute(a);if(n.getAttribute(o.expousedFilterLabel)&&!0===o.$cacheList[d])return o.info("识别到已经监听过的元素停止observer监听"),void t.unobserve(n);o.checkStayinStatus(n,u.stayTag),setTimeout((function(){o.checkStayinStatus(n)===u.stayTag&&(t.unobserve(n),o.$cacheList[d]=!0,n.setAttribute(o.expousedFilterLabel,!0),o.checkStayinStatus(n,u.removeTag),o.onExposedCB&&o.onExposedCB(e))}),r)}else o.checkStayinStatus(n,u.leaveTag)},this.checkStayinStatus=function(e,t){void 0===t&&(t="");var n=o.option.MAPPING,i=n.stayTag,r=n.leaveTag,a=n.removeTag,s=o.expouseStayInFilter,u=t;switch(t){case i:e.setAttribute(s,i);break;case r:e.setAttribute(s,r);break;case a:e.removeAttribute(s);break;default:u=""+e.getAttribute(s)}return u},this.filter=t.filter||"[data-exp]",this.expousedFilterLabel="data-exp-has",this.expouseStayInFilter="data-exp-stayin",this.onDomMutationCB=t.onDomMutationCB||null,this.onViewMutationCB=t.onViewMutationCB||null,this.onInitCb=t.onInitCb||null,this.onExposedCB=t.onExposedCB||null,this.option=e({rootId:t.rootId||"",isDebugMode:t.isDebugMode||!1,loadPolyfill:t.loadPolyfill||!0,mObserverConfig:t.mObserverConfig||{},uniqueLabel:t.uniqueLabel||"data-exp",exposureLeaveTime:t.exposureLeaveTime||800,delayRunTimes:t.delayRunTimes||0,exposureRatioThreshold:t.exposureRatioThreshold||.5,iObserverConfig:t.iObserverConfig||{threshold:[0,.25,.5,.75,1]},MAPPING:{stayTag:"in",leaveTag:"out",removeTag:"unobserve"}},t||{}),this.$cacheList=[],setTimeout((function(){o.$root=o.option.rootId&&o.option.rootId.length?document.getElementById(o.option.rootId):document.body,o.option.loadPolyfill&&o.loadPolyfill()}),0)}return Object.defineProperty(t.prototype,"iObserver",{get:function(){var e,t=this;return e=new IntersectionObserver((function(o){o.forEach((function(o){t.onExposed(o,e)})),setTimeout((function(){t.updateQuene()}),100)}),this.option.iObserverConfig)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"mObserver",{get:function(){var e,t=this;return e=new MutationObserver((function(){t.onDomMutation(e)}))},enumerable:!1,configurable:!0}),t.prototype.start=function(e){var t=this;void 0===e&&(e="组件内部手动调用 start"),setTimeout((function(){t.createObserver().then((function(){t.triggerDomMutation()})),t.onInitCb&&t.onInitCb(t)}),this.option.delayRunTimes),e&&this.info(e)},t.prototype.createObserver=function(){var t=this;return new Promise((function(o){var n=e({childList:!0,subtree:!0,attributes:!1,characterData:!1,attributeOldValue:!1,characterDataOldValue:!1},t.option.mObserverConfig||{});t.info(t.$root,"this.$root"),t.mObserver.observe(t.$root,n),t.info(n,"创建针对 root 下的 dom 变化的监听器 对应配置 ==>"),o()}))},t.prototype.triggerDomMutation=function(){this.info("手动触发 dom 节点变化"),function(e,t,o){void 0===e&&(e="div"),void 0===t&&(t=[]);var n=document.createElement(e),i=o||document.body;t.every((function(e){return n[Object.keys(e)[0]]=Object.values(e)[0],!0})),i.appendChild(n)}("input",[{id:"__viewObserverToggler"},{type:"hidden"}],this.$root)},t.prototype.info=function(e,t){void 0===t&&(t="info"),this.option.isDebugMode&&console.info("[viewObserver "+t+"]",e)},t.prototype.loadPolyfill=function(){var e=this;de("//polyfill.alicdn.com/polyfill.min.js?features=MutationObserver,IntersectionObserver").then((function(){e.info("成功载入 polyfill")}))},t}(),je=function(){function t(t){var o=this;void 0===t&&(t={}),this.onExposedCB=t.onExposedCB||null,this.option=e({rootId:t.rootId||"",filter:t.filter||"[data-exp]",delayRunTimes:t.delayRunTimes||500,expousedFilterLabel:"data-exp-has",uniqueLabel:t.uniqueLabel||"data-exp"},t||{}),this.$cacheList=[],setTimeout((function(){o.$root=o.option.rootId&&o.option.rootId.length?document.getElementById(o.option.rootId):document.body,o.init()}),0)}return t.prototype.onScroll=function(){var e=this;this.updateQuene((function(){e.startObserve()}))},t.prototype.onSrollMutation=function(e){(function(e,t){void 0===t&&(t=.5);var o=e;if(!o)return!1;var n=window.innerWidth||document.documentElement.clientWidth,i=window.innerHeight||document.documentElement.clientHeight,r=o.getBoundingClientRect(),a=r.top,s=r.left+r.width*(1-t),u=a+o.offsetHeight*(1-t);return s<n&&s>=0&&u>0&&u<i})(e)&&this.onExposed(e)},t.prototype.onExposed=function(e){var t=this.option,o=t.expousedFilterLabel,n=t.uniqueLabel,i=e.getAttribute(n);e.getAttribute(o)&&!0===this.$cacheList[i]||(e.setAttribute(o,!0),this.$cacheList[i]=!0,this.onExposedCB&&this.onExposedCB(e))},t.prototype.updateQuene=function(e){var t=this.option.filter,o=this.$root||document.body;this.$quene=Array.from(o.querySelectorAll(t)),e&&e()},t.prototype.startObserve=function(){var e=this;this.$quene.every((function(t){return e.onSrollMutation(t),!0}))},t.prototype.init=function(){var e=this;setTimeout((function(){e.start("初始化时手动调用一次 start")}),this.option.delayRunTimes),window.addEventListener("scroll",pe((function(){e.start()}),500))},t.prototype.start=function(e){void 0===e&&(e=""),e&&De(e,"scrollObserver","NgLogger"),this.onScroll()},t}();var Ie=/\but\/([^\s]+)\s/i,Re=/\bucsdk\/([\d.]+)\b/i,Ve=/\bve\/([^\s]+)\s/i,qe=/\bch\/([^\s]+)\s/i,Ge=/\bwid\/([^\s]+)\s/i,Fe=/\bpageFrom\/([^\s]+)\s/i,Ue=/\bng_preload\/([^\s]+)\s/i,Qe=/\bpGameId\/([^\s]+)\s/i,$e=/[(]([^)]*Build[^)]*)[)]/i,We=/^\s/i;function ze(e){return He(Re,e)}function Je(e){return He(Ve,e)}function He(e,t,o){void 0===o&&(o=1);var n=(t||window.navigator.userAgent).match(e);return n&&n[o]?n[o]:""}var Xe="9.3.4.0",Ke=["time","ucid","ci","csid","ver","packType","androidVersion","targetVersion","packType","model","brand","imei","osid","utdid","umidToken","umid","package_name","platform"],Ye=["ac_action","ac_page","ac_report_time","ac_source","ch","event_id","unique_log_id","ucid","wid","report_time","si","uuid","ut","ve","ac_log_alias","ac_source_display"];function Ze(e){var t=(e||{}).reset,o=void 0!==t&&t;return new Promise((function(e,t){new Promise((function(e,t){window.sdkBase?e():de("//cdn.9game.cn/static/9game/sdk-h5-android/latest/sdkBase.min.js?t="+Math.ceil((new Date).valueOf()/36e4)).then((function(){e()})).catch((function(){t({message:"[sdk.loadBase] window.sdkbase NOT Found."})}))})).then((function(){document.addEventListener("bridgeready",(function(){var n=window;n.sdkBase||t({message:"[sdk.ready] window.sdkBase NOT Found."}),!n.sdkB||o?(n.sdkBase.prototype.fetch=function(e,t,o){var n=this;return new Promise((function(i,r){return n.request(e,t,o,i,r,!0)}))},n.sdkB=new n.sdkBase,e(n.sdkB)):e(n.sdkB)}))})).catch((function(){t({message:"[sdk.ready] catch window.jsbridge NOT Found."})}))}))}function et(t,o,n){var i=window;return n=n||{},new Promise((function(r,a){var s=n.isNewCilent,u=void 0!==s&&s,c=n.isDebugMode,d=void 0!==c&&c;u||a({message:"[sdk.log] 埋点版本不符合."});var p=i.sdkB||new i.sdkBase;p||a({message:"[sdk.log] window.sdkBase NOT Found."});var g=function(e){var t={},o=Ke,n=Ye;Object.keys(e).every((function(n){return o.includes(n)||(t[n]=e[n]),!0}));var i={},r={};Object.keys(t).every((function(e){return n.includes(e)?i[e]=t[e]:r[e]=t[e],!0})),i.args=r,i.ac_page&&(i.page=i.ac_page,delete i.ac_page);return i}(e({ac_action:t},o));p.request(p.servType.STAT,p.actions.STAT_NEW_TECH,g,(function(e){e&&!0===e.success?r():a({message:"[sdk.log] request STAT_NEW_TECH error"}),d&&De(g,"sdk端内通道发送日志 ==> "+JSON.stringify(e),"NgLogger")}),(function(e){a(e),d&&De(g,"sdk端内通道发送日志失败 ==> "+JSON.stringify(e),"NgLogger")}))}))}var tt={newVersionTag:"7.3.6.0",newVersionList:["7.3.2.400","7.3.2.401","7.3.3.500","7.3.3.501","7.3.3.502","7.3.3.503","7.3.3.504","7.3.3.505","7.3.3.506","7.3.3.507","7.3.3.508","7.3.3.509","7.3.4.500","7.3.4.501","7.3.4.502","7.3.4.503","7.3.4.504","7.3.4.505","7.3.4.506","7.3.4.507","7.3.4.508","7.3.4.509","7.3.5.500","7.3.5.501","7.3.5.502","7.3.5.503","7.3.5.504","7.3.5.505","7.3.5.506","7.3.5.507","7.3.5.508","7.3.5.509","7.3.5.510","7.3.5.511","7.3.5.512","7.3.5.513","7.3.5.514","7.3.5.515","7.3.5.516","7.3.5.517","7.3.5.518","7.3.5.519","7.3.5.520","7.3.6.0"],newVersionFilter:["page_start"],commonParams:["ac_source","unique_log_id","ucid","wid","platform","event_id","ac_page"],extendParams:["k1","k2","k3","k4","k5","k6","k7","k8","k9","duration"]};function ot(){return new Promise((function(e,t){new Promise((function(e,t){window.JSBridge?e():de("//cdn.9game.cn/static/9game/app/jsbridge/latest/dist/jsbridge.js?t="+Math.ceil((new Date).valueOf()/36e4)).then((function(){e()})).catch((function(){t({message:"[app.init] window.jsbridge NOT Found."})}))})).then((function(){e()})).catch((function(){t({message:"[app.init] window.jsbridge NOT Found."})}))}))}function nt(t,o,n){void 0===n&&(n={});var i=window.JSBridge;if(i)return new Promise((function(r){var a=n.logVersion,s=void 0===a?"1.0":a,u=n.isNewCilent,c=void 0!==u&&u,d=n.isDebugMode,p=void 0!==d&&d,g=o.ac_page,f=void 0===g?"":g,l=o.bizArgs,h=void 0===l?{}:l,m=function(e,t){var o={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(o[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(o[n[i]]=e[n[i]])}return o}(o,["ac_page","bizArgs"]),v={};Object.keys(h).every((function(e){return tt.commonParams.includes(e)||(v[e]=h[e]),!0}));var y={};Object.keys(m).every((function(e){return!0===tt.commonParams.includes(e)&&(y[e]=m[e]),!0===tt.extendParams.includes(e)&&(v[e]=m[e]),!0}));var b="",w="",_="";if("page_view"===t){var O={page_name:f,biz_args:v},T=i.callNative("NineGameClient","onPageLoadComplete",O);p&&(De("识别到 action 为 page_view 自动触发 onPageLoadComplete 接口 由端下发 page_view 埋点, 运行结果 ==> "+T,"九游端内页: "+(f||"未指定"),"NgLogger"),De(O,"九游端内页: "+(f||"未指定"),"NgLogger"))}else t.indexOf(tt.newVersionFilter)>-1&&c?_="框架打":"2.0"!==s||c?"2.0"===s&&c?(b="bizLog2",w={action:t,args:v,params:y},_=i.callNative("NineGameClient",b,w)):(b="bizLog",w={action:t,params:e(e({},y),v)},_=i.callNative("NineGameClient",b,w)):_="no bizLog2";var L={res:_,message:"sendLog with "+b+": "+t+" ==> res: "+(!0===_?"成功":_||"失败")};p&&(De(""+(L.message||"九游 app 埋点调用异常"),"九游端内页: "+(f||"未指定"),"NgLogger"),De(w,"九游端内页: "+(f||"未指定"),"NgLogger")),r(L)}));console.warn("[app.log] JSBridge NOT Found")}return function(){function t(t){var o=this;this.option=e({pageName:"default",host:"https://play.web.9game.cn",isPerformanceLogger:!0,isRegisterPageView:!0,isPreloadLogger:!1,isExposureLogger:!1,useScrollExposure:!1,useQueryParams:!0,isDebugMode:!1,presetParams:{},exposureLabel:"data-nglogger-exp",exposureOption:{$root:document.body,filter:".nglogger_exp_logger",delayRunTimes:1e3,exposureRatioThreshold:.5,exposureLeaveTime:500}},t||{}),this.commonParams=this.getParams(this.option.presetParams),this.cilentOption={},this.UA=ce,this.startTime=this.getTimeStamp(),this.logService=this.option.service||this.option.host+"/activity/stat/proxy",this.logCacheList={},this.clientInit(),setTimeout((function(){o.info(o.option,"initData"),o.option.isPerformanceLogger&&o.performanceLogger(),o.option.isExposureLogger&&o.initExposureLogger()}),0)}return t.prototype.log=function(t,o,n){var i=this;if(this.option.isPreloadLogger&&this.isPreload())this.info("Escape logger in `preload` case.");else{var r=(n=n||{logVersion:"1.0"}).isForceXhr,a=this.option.isDebugMode,s=this.getTimeStamp(),u=this.getAcReportTime(s),c=this.getDuration(s),d=o&&o.event_id?o.event_id:this.getEventId(t);o&&o.ac_param&&"object"==typeof o.ac_param&&(o.ac_param=JSON.stringify(o.ac_param));var p={},g={};if(!r&&ce.isNGAndroid)p=e(e({},this.commonParams),{ac_report_time:u,duration:c,bizArgs:o,event_id:+d,ac_action:t,report_time:s}),g=Me(p),ot().then((function(){return nt(t,g,e(e({isDebugMode:a},i.cilentOption),n))}));else{if(p=e(e(e(e({},this.commonParams),{ac_report_time:u,duration:c,ac_log_alias:"biz_stat"}),o||{}),{event_id:+d,ac_action:t,report_time:s}),g=Me(p),r||!ce.isNGSdk||"2.0"!==n.logVersion)return this.info(g,"xhr 发送埋点 "+(g.ac_action||"ac_action")+"}"),be(this.logService,g);Ze().then((function(){return et(t,g,e(e({isDebugMode:a},i.cilentOption),n))}))}}},t.prototype.pageReadyLogger=function(e){e&&e.ac_page&&e.ac_page.length&&this.updateCommonParams({ac_page:e.ac_page}),this.log("page_view",e||{})},t.prototype.registerPageView=function(e){e&&e.ac_page&&e.ac_page.length&&this.updateCommonParams({ac_page:e.ac_page}),this.log("page_view",e||{})},t.prototype.setOption=function(e){e.service&&(this.option.service=e.service),null!==e.isPreloadLogger&&(this.option.isPreloadLogger=e.isPreloadLogger)},t.prototype.resetCommonParams=function(t){return this.commonParams=e(e({},this.commonParams),t),this.commonParams},t.prototype.exportCommonParams=function(){return this.commonParams},t.prototype.exportOption=function(){return e(e({},this.option),this.cilentOption)},t.prototype.exportUuid=function(){return ye()},t.prototype.exportUrlPart=function(){var t=me(window.location.href||document.URL),o=t.urlPart||window.location.href||document.URL;return e(e({},t),{urlPart:o})},t.prototype.triggerExposureLogger=function(){this.info("手动触发曝光监听 - 功能已停止")},t.prototype.initExposureLogger=function(){var t=this,o=this.option,n=o.exposureOption,i=o.exposureLabel,r=o.isDebugMode,a=o.useScrollExposure,s=o.exposurelogVersion,u=void 0===s?"2.0":s;this.exposureLogger=function(t,o,n,i){var r;if(void 0===t&&(t={}),void 0===n&&(n=!1),void 0===i&&(i=!1),!0===i)(r=new je({filter:".nglogger_exp_logger",uniqueLabel:"data-nglogger-exp",delayRunTimes:1e3,onExposedCB:function(e){o(e)}})).start();else{var a=e({filter:".nglogger_exp_logger",uniqueLabel:"data-nglogger-exp",delayRunTimes:1e3,exposureRatioThreshold:.45,exposureLeaveTime:500,isDebugMode:n},t);(r=new Ee(e(e({},a),{onExposedCB:function(e){var t=e.target;o(t)}}))).start()}return r}(n,(function(e){var o="1.0"===u?"1.0":"2.0";t.sendLog(e,i,o),t.triggerClickEvent(e)}),r,a)},t.prototype.getTimeStamp=function(){return(new Date).valueOf()},t.prototype.performanceLogger=function(){var e=this,t=this,o=window.performance.timing||{},n=o.fetchStart,i=o.responseEnd,r=void 0===i?this.getTimeStamp():i;if(n&&"number"==typeof n&&(t.info("获取到 fetchStart "+n+" 就更新一下 starttime "+t.startTime+" ","performanceLogger"),this.updateStartTime(n)),this.log("page_t0",{ac_report_time:this.getAcReportTime(r)},{logVersion:"2.0"}),this.log("page_start",{ac_report_time:this.getAcReportTime(r)}),document.addEventListener("DOMContentLoaded",(function(){t.info("通过事件监听 DOMContentLoaded ","performanceLogger"),t.DOMContentLoadedLogger()})),window.addEventListener("load",(function(){e.log("page_loaded",{ac_report_time:e.getAcReportTime()}),e.log("page_t2",{},{logVersion:"2.0"}),t.info("页面资源加载完成检测一下是否已经打了 DOMContentLoaded 埋点","performanceLogger"),t.DOMContentLoadedLogger()})),!0===this.option.isDOMContentLoadedLoggerCheck)var a=setTimeout((function(){clearTimeout(a),clearTimeout(s),t.info("页面加载 1.5s 后再检测一下 DOMContentLoaded 埋点是否已经打了","performanceLogger"),t.DOMContentLoadedLogger()}),1500),s=setTimeout((function(){clearTimeout(s),t.info("页面加载 3s 后再检测一下 DOMContentLoaded 埋点是否已经打了","performanceLogger"),t.DOMContentLoadedLogger()}),3e3)},t.prototype.updateCommonParams=function(t){return this.commonParams=e(e({},this.commonParams),t),this.commonParams},t.prototype.updateCilentOption=function(t){return this.cilentOption=e(e({},this.cilentOption),t),this.cilentOption},t.prototype.updateStartTime=function(e){void 0===e&&(e=this.getTimeStamp()),this.startTime=e},t.prototype.getParams=function(t){var o,n=le(window.location.search),i=n.gameName,r=n.pageFrom,a=n.pullUpFrom,s=i||n.game_name||"",u=this.getPageName(),c=this.getGameId(),d=this.getUuid(),p=this.getUcid(),g=this.getWid(),f=this.getCh(),l=this.getVe(),h=this.getVersion(),m=this.getUtdid(),v=this.getTraceId(),y=this.getSource(),b=this.getPlatform(),w=this.getDevicePackageName(),_=this.getDeviceModel(),O=this.getDeviceBrand(_),T=(window.location.href||document.URL).replace(/\&/gi,"@"),L=me(document.referrer).urlPart||"",x=He(Fe,o)||r||L,P=t||{},C=e({ac_page:u,ac_source:y,ac_f1:x,recent_root:a,game_id:c,game_name:encodeURIComponent(s),unique_log_id:v,ut:m,uuid:d,ucid:p,wid:g,version:h,ve:l,ch:f,k9:T,platform:b,package_name:w,model:_,brand:O},P);return this.option.isPreloadLogger&&(C.isPreloadLogger=1),C},t.prototype.isPreload=function(){return"1"===He(Ue,e);var e},t.prototype.getUuid=function(){var e=se("uuid");if(e)return e;var t=ye();return function(e,t,o){if(!e)return"";o=ne(ne({},ie),o),e=ae(e).replace(/=/g,"%3D"),t=ae(t);var n="";Object.keys(o).forEach((function(e){var t=o[e];if(t&&(n+="; "+e,!0!==t)){if("expires"===e&&"number"==typeof t){var i=new Date(Date.now()+864e5*t).toUTCString();return n+="="+i.split(";")[0]}n+="="+t.split(";")[0]}})),document.cookie=e+"="+t+n}("uuid",t,{expires:18e5}),t},t.prototype.getUcid=function(){return se("ucid")||""},t.prototype.getUtdid=function(){return He(Ie,e);var e},t.prototype.getWid=function(){return He(Ge,e);var e},t.prototype.getCh=function(){return He(qe,e)||ve("ch");var e},t.prototype.getVe=function(){return ze()},t.prototype.getVersion=function(){return Je()},t.prototype.getSource=function(){var e=1005;return ce.isNGSdk?e=1004:ce.isNGAndroid?e=1001:ce.isNGiOS&&(e=1002),e},t.prototype.getTraceId=function(){var e=[this.ram(),this.ram(),this.ram(),this.ram(),this.ram()],t=+new Date;return"".concat(e.join("")).concat(t.toString())},t.prototype.ram=function(){return Math.floor(10*Math.random())},t.prototype.getDeviceModel=function(){return ce.isiOS||ce.isAndroid?ce.isiOS?"iphone":function(e){var t="unknown";try{var o=He($e,e).split(";").find((function(e){return e.indexOf("Build/")>-1})).replace(We,""),n=o.indexOf("Build");t=o.slice(0,n)}catch(e){console.warn(e)}return t}():"pc"},t.prototype.getDeviceBrand=function(e){return e},t.prototype.getPlatform=function(){return ce.isiOS?"ios":ce.isAndroid?"android":"h5"},t.prototype.getDevicePackageName=function(){var t,o=e(e({},this.UA),(t=window.navigator.userAgent,{isTB:Le.test(t)&&_e.test(t),isQQ:t.match(Te),isQQBrowser:t.match(Oe)&&!t.match(Te),isSogou:t.match(xe),isQuark:t.match(Pe),isBd:t.match(Ce)&&!t.match(ke),isBdBar:t.match(ke)&&t.match(Ce)})),n="browser";return o.isNGAndroid?n="ngapp":o.isNGiOS?n="ngappIos":o.isNGSdk?n="ucsdk":o.isUC?n="uc":o.isDingTalk?n="dingding":o.isWechat?n="wechat":o.isWeiBo?n="weibo":o.isTB?n="taobao":o.isQQ?n="qq":o.isQQBrowser?n="qqBrowse":o.isSogou?n="sogou":o.isQuark?n="quark":o.isBd?n="baidu":o.isBdBar&&(n="baiduBar"),n},t.prototype.info=function(e,t){void 0===t&&(t="info"),this.option.isDebugMode&&De(e,t,"NgLogger")},t.prototype.clientInit=function(){var e,t=this,o=this.UA;if(o.isNGSdk){var n=(void 0===e&&(e=Xe),-1!==Ne(ze(),e).result);this.updateCilentOption({isNewCilent:n}),Ze().then((function(e){var o,i;(o=e,i=window,new Promise((function(e,t){var n=o||i.sdkB||new i.sdkBase;n||t({message:"[sdk.init] init window.sdkBase NOT Found."});var r={},a=(n.request(n.servType.COMMON,n.actions.GET_SDK_INFO)||{}).data||{};(a.ex||"").split("|").forEach((function(e){var t=e.indexOf(":");a[e.substring(0,t)]=e.substring(t+1)}));var s=a.si,u=a.utdid;s&&(r.si=s),u&&(r.utdid=u),n.request(n.servType.COMMON,n.actions.GET_CURR_USER,{},(function(t){var o=t&&t.data&&t.data.ucid;o&&(r.ucid=o),e(r)}),(function(){e(r)}))}))).then((function(e){t.updateCommonParams(e)})),n&&(t.log("page_view",{ac_report_time:t.getAcReportTime()},{logVersion:"2.0"}),t.updateLogCache({sdkViewTime:t.getTimeStamp()}),document.addEventListener("onDetachedFromWindow",(function(){var e=t.logCacheList.sdkViewTime||t.startTime,o=t.getTimeStamp()-Math.ceil(e);t.log("page_duration",{duration:o},{logVersion:"2.0"})})),document.addEventListener("onReAttachedToWindow",(function(){var e=t.getTimeStamp();t.log("page_reattached",{ac_report_time:e},{logVersion:"2.0"}),t.updateLogCache({sdkViewTime:e})})))}))}else if(o.isNGAndroid){var i=function(e){return void 0===e&&(e=tt.newVersionTag),-1!==Ne(Je(),e).result}()||function(e){void 0===e&&(e=tt.newVersionList);var t=Je();return e.indexOf(t)>-1}();this.updateCilentOption({isNewCilent:i}),ot().then((function(){var e;t.log("page_app_start",{ac_report_time:t.getAcReportTime()}),(e=window,new Promise((function(t,o){var n=e.JSBridge;n||o({message:"[app.init] window.jsbridge NOT Found."});var i,r=n.callNative("NineGameClient","getAccountInfo");try{i=JSON.parse(r)}catch(e){i=""}t({ucid:i&&i.data&&i.data.ucid?i.data.ucid:""})}))).then((function(e){t.updateCommonParams({ucid:e.ucid}),t.option.isRegisterPageView&&t.registerPageView({ac_report_time:t.getAcReportTime()})}))}))}},t.prototype.getAcReportTime=function(e){return void 0===e&&(e=this.getTimeStamp()),Math.ceil((e-this.startTime)/1e3)},t.prototype.getDuration=function(e){return e=e||this.getTimeStamp(),Math.ceil(e-this.startTime)},t.prototype.getEventId=function(e){var t;if(Se.test(e))t=2001;else switch(e){case"show":t=2201;break;case"click":t=2101;break;default:t=""}return t},t.prototype.getPageName=function(e){return e=e||ve("page_name"),!0===this.option.useQueryParams&&e&&e.length?e:this.option.pageName},t.prototype.getGameId=function(e){var t,o=le(window.location.search)||{};return e=e||o.pGameId||o.gameId||o.game_id||He(Qe,t)||""},t.prototype.updateLogCache=function(t){return void 0===t&&(t={}),this.logCacheList=e(e({},this.logCacheList),t),this.info(this.logCacheList,"updateLogCache"),this.logCacheList},t.prototype.DOMContentLoadedLogger=function(){var e=this.logCacheList;if(!0!==e.DOMContentLoaded){this.info("监听到 DOMContentLoaded 进行首屏打点并且记录 cachelist","DOMContentLoadedLogger");var t={ac_report_time:this.getAcReportTime()};this.log("page_shown",t),this.log("page_t1",{},{logVersion:"2.0"}),e.DOMContentLoaded=!0,this.updateLogCache(e)}else this.info("DOMContentLoaded 已经打过了","DOMContentLoadedLogger")},t.prototype.sendLog=function(e,t,o){void 0===t&&(t="data-nglogger-str"),void 0===o&&(o="2.0");var n,i,r,a=e.getAttribute(t);if(a&&a.length){var s=(n={},i=a.split("|"),r=(i.shift()||"").trim()||"block_show",i.forEach((function(e){var t,o,i=e.split(":");t=i[0]&&i[0].trim()||null,o=i[1]&&i[1].trim()||null,t&&o&&(n[t]=o)})),{action:r,params:n});this.log(s.action,s.params,{logVersion:o})}},t.prototype.triggerClickEvent=function(e){var t=this,o=e.getAttribute("data-nglogger-autoclick"),n=e.getAttribute("data-autoclick-has");o&&!0!==n&&(e.setAttribute("data-autoclick-has",!0),e.addEventListener("click",(function(){t.sendLog(e,"data-nglogger-str")}),!0))},t}()}));
