/** * =========================================================================== * aegis-weex-sdk@1.36.4 (c) 2023 TencentCloud Real User Monitoring. * Author pumpkincai. * Last Release Time Mon Mar 27 2023 10:32:39 GMT+0800 (China Standard Time). * Released under the MIT License. * Thanks for supporting RUM & Aegis! * =========================================================================== **/ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).Aegis=t()}(this,function(){"use strict";var n=function(e,t){return(n=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}))(e,t)},u=function(){return(u=Object.assign||function(e){for(var t,n=1,o=arguments.length;nl[0]&&t[1]=o||n.sendNow&&0n)return E[o]||T(o),!1;i[e]=1+~~i[e],P[o]=i}return!0}))}),(p=this.lifeCycle.emit,d=this.config,function(e,t){var n,o=d.logCreated;return"function"==typeof o?(n=e.filter(function(e){return!1!==o(e)}),p("beforeWrite",n),t(n)):(p("beforeWrite",e),t(e))}),(f=this,setTimeout(function(){var e=f.config.pvUrl,n=void 0===e?"":e,e="undefined"!=typeof location?(null===location||void 0===location?void 0:location.pathname)+(null===location||void 0===location?void 0:location.hash):void 0;n&&e!==f.originFireUrl&&(f.sendPipeline([function(e,t){t({url:n,type:O.PV})}],O.PV)(null),e)&&location&&(f.originFireUrl=e)},100),function(e,t){t(e)}),(c=a=l=!1,u=[],(s=this).lifeCycle.on("onConfigChange",function(){r&&clearTimeout(r),r=setTimeout(function(){var e,n;!c&&s.config&&(c=!0,e=s.config.whiteListUrl,(n=void 0===e?"":e)&&s.sendPipeline([function(e,t){t({url:n,type:O.WHITE_LIST,success:function(e){a=!0;try{var t=e.data||JSON.parse(e),n=t.retcode,o=t.result,i=void 0===o?{}:o,r=(0===n&&(l=i.is_in_white_list,s.isWhiteList=l,0<=i.rate)&&i.rate<=1&&(s.config.random=i.rate,s.isGetSample=!1),s.isWhiteList&&u.length?Z(s)(u.splice(0),function(){}):!s.isWhiteList&&u.length&&(u.length=0),s.config.onWhitelist);"function"==typeof r&&r(l)}catch(e){}},fail:function(){a=!0}})}],O.WHITE_LIST)(null),c=!1)},s.config.uin?50:500)}),s.lifeCycle.on("destroy",function(){u.length=0}),function(e,t){var n;l||null!=(n=null==(n=s.config)?void 0:n.api)&&n.reportRequest?t(e.concat(u.splice(0)).map(function(e){return Y(e),e})):(n=e.filter(function(e){return e.level!==b.INFO&&e.level!==b.API_RESPONSE?(Y(e),!0):(a||(u.push(e),200<=u.length&&(u.length=200)),!1)})).length&&t(n)}),function(e,t){try{var n=JSON.parse(JSON.stringify(e)),o=(g.lifeCycle.emit("beforeReport",n),g.config.beforeReport);(e="function"==typeof o?e.filter(function(e){return!1!==o(e)}):e).length&&t(e)}catch(e){}},Z(this)]),this.eventPipeline=y([m(this,10),(i=this,function(e){i.sendPipeline([function(e,t){var n=e.map(function(e){return{name:e.name,ext1:e.ext1||i.config.ext1||"",ext2:e.ext2||i.config.ext2||"",ext3:e.ext3||i.config.ext3||""}});t({url:i.config.eventUrl+"?payload="+encodeURIComponent(JSON.stringify(n)),type:O.EVENT,log:e})}],O.EVENT)(e)})]),this.timeMap={},this.failRequestCount=0,this.customTimePipeline=y([m(this,10),(o=this,function(e){return o.sendPipeline([function(e,t){t({url:o.config.customTimeUrl+"?payload="+encodeURIComponent(JSON.stringify({custom:e})),type:O.CUSTOM,log:e})}],O.CUSTOM)(e)})]),this.config=(t=this.config,void 0===(e=e.hostUrl)&&(e="https://aegis.qq.com"),t.url=t.url||e+"/collect",t.offlineUrl=t.offlineUrl||e+"/offline",t.whiteListUrl=t.whiteListUrl||e+"/collect/whitelist",t.pvUrl=t.pvUrl||e+"/collect/pv",t.eventUrl=t.eventUrl||e+"/collect/events",t.speedUrl=t.speedUrl||e+"/speed",t.customTimeUrl=t.customTimeUrl||e+"/speed/custom",t.performanceUrl=t.performanceUrl||e+"/speed/performance",t.webVitalsUrl=t.webVitalsUrl||e+"/speed/webvitals",t.setDataReportUrl=t.SetDataReportUrl||e+"/speed/miniProgramData",t),N.instances.push(this)}return r.use(oe),r.use(L),r.use(S),r});