var itraceFlowPlugin=function(){"use strict";function t(e,n){return t=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},t(e,n)}var e;(e={}).ZH="cn",e.QUARK="quark",e.INTL="intl",function(t){t[t.JSERR=1]="JSERR",t[t.API=2]="API",t[t.PERF=3]="PERF",t[t.RESERR=4]="RESERR",t[t.PVUV=5]="PVUV",t[t.BKPG=6]="BKPG",t[t.LONGTASK=8]="LONGTASK",t[t.INPD=15]="INPD",t[t.NODERES=16]="NODERES",t[t.PGERROR=17]="PGERROR",t[t.BLOCK=18]="BLOCK",t[t.PERFNEXT=1e3]="PERFNEXT",t[t.MAINDOC=1e5]="MAINDOC",t[t.RESTIMING=100001]="RESTIMING"}({}),function(t){t.JSERR="jserr",t.API="api",t.PERF="jsfsperf",t.RESERR="resloadfail",t.PVUV="flow",t.BKPG="bkpg",t.CUSTOM="jssdkidx",t.INPD="inputdelay",t.LONGTASK="longtask",t.NODERES="nodres",t.PGERROR="pgerror",t.BLOCK="h5block"}({});var n=function(t){t=t||{},this.id=t.id,this.sampleRate=t.sampleRate,this.forceEnable=t.forceEnable},o=window.history||{},i=window.document,r="historystatechange",a=function(t,e){var n;void 0!==window.CustomEvent?n=new CustomEvent(t,{detail:e}):((n=i.createEvent("HTMLEvents")).initEvent(t,!1,!0),n.detail=e),window.dispatchEvent(n)};function c(t){return"string"==typeof t?t.replace(/^(https?:)?\/\//,"").replace(/\?.*$/,""):""}function s(t){return(t?c(t.replace(/^#\/?/,"")):"")||"[index]"}function u(t,e,n,o){return t.addEventListener?t.addEventListener(e,function i(r){o&&t.removeEventListener(e,i,!1),n.call(t,r)},!1):t.attachEvent&&t.attachEvent("on"+e,function i(r){o&&t.detachEvent("on"+e,i),n.call(t,r)}),this}function E(t,e,n){return n?(t.removeEventListener?t.removeEventListener(e,n):t.detachEvent&&t.detachEvent(e,n),this):this}function l(t){var e=o[t];"function"==typeof e&&(o[t]=function(t,n,i){var s=location.href,u=e.call(o,t,n,i);if("string"!=typeof i)return u;if(i===s)return u;try{var E=s.split("#"),l=i.split("#"),p=c(E[0]),d=c(l[0]),f=E[1]&&E[1].replace(/^\/?(.*)/,"$1"),R=l[1]&&l[1].replace(/^\/?(.*)/,"$1");p!==d?a(r,d):f!==R&&a(r,R)}catch(t){}return u},o[t].toString=t+"() { [native code] }")}var p=function(e){function n(t){return e.call(this,t)||this}return function(e,n){e.prototype=Object.create(n.prototype),e.prototype.constructor=e,t(e,n)}(n,e),n.prototype.init=function(t){var e,n;t.immediatePV||t.reportFlow(),t.spa&&(e=function(){s(location.hash)&&(t.resetSession(),t.reportFlow(),a("wpkpgchange",void 0))},n=function(e){s(e.detail)&&(t.resetSession(),t.reportFlow(),a("wpkpgchange",void 0))},u(window,"hashchange",e),u(window,"historystatechange",n),l("pushState"),l("replaceState")),u(window,"beforeunload",function(){E(window,"load"),E(window,"hashchange"),E(window,"historystatechange"),e=n=null})},n}(n);return p.pluginId="iTraceFlowPlugin",p}();
var itracePerfPlugin=function(){"use strict";function e(t,n){return e=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},e(t,n)}!function(e){e.ZH="cn",e.QUARK="quark",e.INTL="intl"}({});var t=function(e){return e[e.JSERR=1]="JSERR",e[e.API=2]="API",e[e.PERF=3]="PERF",e[e.RESERR=4]="RESERR",e[e.PVUV=5]="PVUV",e[e.BKPG=6]="BKPG",e[e.LONGTASK=8]="LONGTASK",e[e.INPD=15]="INPD",e[e.NODERES=16]="NODERES",e[e.PGERROR=17]="PGERROR",e[e.BLOCK=18]="BLOCK",e[e.PERFNEXT=1e3]="PERFNEXT",e[e.MAINDOC=1e5]="MAINDOC",e[e.RESTIMING=100001]="RESTIMING",e}({});!function(e){e.JSERR="jserr",e.API="api",e.PERF="jsfsperf",e.RESERR="resloadfail",e.PVUV="flow",e.BKPG="bkpg",e.CUSTOM="jssdkidx",e.INPD="inputdelay",e.LONGTASK="longtask",e.NODERES="nodres",e.PGERROR="pgerror",e.BLOCK="h5block"}({});var n=function(e){e=e||{},this.id=e.id,this.sampleRate=e.sampleRate,this.forceEnable=e.forceEnable};function r(e){return"[object Array]"==={}.toString.call(e)}function i(){for(var e=arguments.length<=0?void 0:arguments[0],t=1,n=arguments.length;t<n;t++){var r=t<0||arguments.length<=t?void 0:arguments[t];for(var i in r)p(r,i)&&(e[i]=r[i])}return e}function o(e,t,n,r,i){void 0===r&&(r=!1),void 0===i&&(i=!1),e.addEventListener?e.addEventListener(t,function o(a){i&&e.removeEventListener(t,o,r),n.call(this,a)},r):e.attachEvent&&e.attachEvent("on"+t,function o(a){i&&e.detachEvent(t,o,r),n.call(this,a)})}!function(e){e.ZH="cn",e.QUARK="quark",e.INTL="intl"}({}),function(e){e[e.JSERR=1]="JSERR",e[e.API=2]="API",e[e.PERF=3]="PERF",e[e.RESERR=4]="RESERR",e[e.PVUV=5]="PVUV",e[e.BKPG=6]="BKPG",e[e.LONGTASK=8]="LONGTASK",e[e.INPD=15]="INPD",e[e.NODERES=16]="NODERES",e[e.PGERROR=17]="PGERROR",e[e.BLOCK=18]="BLOCK",e[e.PERFNEXT=1e3]="PERFNEXT",e[e.MAINDOC=1e5]="MAINDOC",e[e.RESTIMING=100001]="RESTIMING"}({}),function(e){e.JSERR="jserr",e.API="api",e.PERF="jsfsperf",e.RESERR="resloadfail",e.PVUV="flow",e.BKPG="bkpg",e.CUSTOM="jssdkidx",e.INPD="inputdelay",e.LONGTASK="longtask",e.NODERES="nodres",e.PGERROR="pgerror",e.BLOCK="h5block"}({});var a="undefined"!=typeof navigator?(navigator.userAgent||"").toLowerCase():"";function s(){return a.indexOf("quark/")>-1}var c,l,u,f,p=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},d=function(e){var t=e.nodeName;return 1===e.nodeType?t.toLowerCase():t.toUpperCase().replace(/^#/,"")},v=function(e,t){var n="";try{for(;e&&9!==e.nodeType;){var r=e,i=r.id?"#"+r.id:d(r)+(r.className&&r.className.trim().length?"."+r.className.trim().replace(/\s+/g,"."):"");if(n.length+i.length>(t||100)-1)return n||i;if(n=n?i+">"+n:i,r.id)break;e=r.parentNode}}catch(e){}return n},h=-1,m=function(e){addEventListener("pageshow",function(t){t.persisted&&(h=t.timeStamp,e(t))},!0)},g=function(){return window.performance&&performance.getEntriesByType&&performance.getEntriesByType("navigation")[0]},b=function(){var e=g();return e&&e.activationStart||0},w=function(e,t){var n=g(),r="navigate";return h>=0?r="back-forward-cache":n&&(document.prerendering||b()>0?r="prerender":document.wasDiscarded?r="restore":n.type&&(r=n.type.replace(/_/g,"-"))),{name:e,value:void 0===t?-1:t,rating:"good",delta:0,entries:[],id:"v3-".concat(Date.now(),"-").concat(Math.floor(8999999999999*Math.random())+1e12),navigationType:r}},E=function(e,t,n){try{if(PerformanceObserver.supportedEntryTypes.includes(e)){var r=new PerformanceObserver(function(e){Promise.resolve().then(function(){t(e.getEntries())})});return r.observe(Object.assign({type:e,buffered:!0},n||{})),r}}catch(e){}},y=function(e,t,n,r){var i,o;return function(a){t.value>=0&&(a||r)&&((o=t.value-(i||0))||void 0===i)&&(i=t.value,t.delta=o,t.rating=function(e,t){return e>t[1]?"poor":e>t[0]?"needs-improvement":"good"}(t.value,n),e(t))}},_=function(e){requestAnimationFrame(function(){return requestAnimationFrame(function(){return e()})})},P=function(e){var t=function(t){"pagehide"!==t.type&&"hidden"!==document.visibilityState||e(t)};addEventListener("visibilitychange",t,!0),addEventListener("pagehide",t,!0)},S=function(e){var t=!1;return function(n){t||(e(n),t=!0)}},T=-1,R=function(){return"hidden"!==document.visibilityState||document.prerendering?1/0:0},L=function(e){"hidden"===document.visibilityState&&T>-1&&(T="visibilitychange"===e.type?e.timeStamp:0,V())},C=function(){addEventListener("visibilitychange",L,!0),addEventListener("prerenderingchange",L,!0)},V=function(){removeEventListener("visibilitychange",L,!0),removeEventListener("prerenderingchange",L,!0)},O=function(){return T<0&&(T=R(),C(),m(function(){setTimeout(function(){T=R(),C()},0)})),{get firstHiddenTime(){return T}}},I=function(e){document.prerendering?addEventListener("prerenderingchange",function(){return e()},!0):e()},N=[1800,3e3],k=function(e,t){t=t||{},I(function(){var n,r=O(),i=w("FCP"),o=E("paint",function(e){e.forEach(function(e){"first-contentful-paint"===e.name&&(o.disconnect(),e.startTime<r.firstHiddenTime&&(i.value=Math.max(e.startTime-b(),0),i.entries.push(e),n(!0)))})});o&&(n=y(e,i,N,t.reportAllChanges),m(function(r){i=w("FCP"),n=y(e,i,N,t.reportAllChanges),_(function(){i.value=performance.now()-r.timeStamp,n(!0)})}))})},F={passive:!0,capture:!0},A=new Date,D=function(e,t){c||(c=t,l=e,u=new Date,j(removeEventListener),B())},B=function(){if(l>=0&&l<u-A){var e={entryType:"first-input",name:c.type,target:c.target,cancelable:c.cancelable,startTime:c.timeStamp,processingStart:c.timeStamp+l};f.forEach(function(t){t(e)}),f=[]}},G=function(e){if(e.cancelable){var t=(e.timeStamp>1e12?new Date:performance.now())-e.timeStamp;"pointerdown"==e.type?function(e,t){var n=function(){D(e,t),i()},r=function(){i()},i=function(){removeEventListener("pointerup",n,F),removeEventListener("pointercancel",r,F)};addEventListener("pointerup",n,F),addEventListener("pointercancel",r,F)}(t,e):D(t,e)}},j=function(e){["mousedown","keydown","touchstart","pointerdown"].forEach(function(t){return e(t,G,F)})},K=[100,300],x=function(e){var t=e;if(!t)return!1;for(;t;){if("true"===t.getAttribute("ignore-lcp"))return!0;t=t.parentElement}return!1};function M(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}var W=function(){function e(){var t,n,r,i=arguments.length>0&&void 0!==arguments[0]&&arguments[0];!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),t=this,r=void 0,(n=M(n="debug"))in t?Object.defineProperty(t,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[n]=r,this.debug=i}var t,n;return t=e,n=[{key:"info",value:function(){var e;this.debug&&(e=console).info.apply(e,arguments)}},{key:"warn",value:function(){var e;this.debug&&(e=console).warn.apply(e,arguments)}}],n&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,M(r.key),r)}}(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),e}(),U=[2500,4e3],q={},H=function(e,t){var n=!1,r=!1;k(function(){if(!n){n=!0;var t,i,o={name:"CLS",value:0,entries:[],rating:"good",id:"",delta:0,navigationType:"navigate"},a=0,s=[],c=function(e){e.forEach(function(e){if(!e.hadRecentInput){var t=s[0],n=s[s.length-1];a&&e.startTime-n.startTime<1e3&&e.startTime-t.startTime<5e3?(a+=e.value,s.push(e)):(a=e.value,s=[e])}}),a>o.value&&(o.value=a,o.entries=s)},l=function(e,t){if("function"==typeof PerformanceObserver){var n=new PerformanceObserver(function(e){Promise.resolve().then(function(){t(e.getEntries())})});return n.observe({type:e,buffered:!0}),n}}("layout-shift",c),u=function(){r||(r=!0,function(e){if(e.entries.length){var t=e.entries.reduce(function(e,t){return e&&e.value>t.value?e:t});if(t&&t.sources&&t.sources.length){var n=(r=t.sources).find(function(e){return e.node&&1===e.node.nodeType})||r[0];if(n)return void(e.attribution={largestShiftTarget:v(n.node),largestShiftTime:t.startTime,largestShiftValue:t.value,largestShiftSource:n,largestShiftEntry:t})}}var r;e.attribution={}}(o),e(o))};l&&(t=function(){c(l.takeRecords()),u(),l.disconnect()},i=function(e){"pagehide"!==e.type&&"hidden"!==document.visibilityState||t(e)},addEventListener("visibilitychange",i,!0),addEventListener("pagehide",i,!0),["keydown","click"].forEach(function(e){window.addEventListener(e,function(){r||(c(l.takeRecords()),u(),l.disconnect())},{once:!0,capture:!0})}))}})};function J(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return z(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?z(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function z(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var Q=["navigationStart","unloadEventStart","unloadEventEnd","redirectStart","redirectEnd","fetchStart","domainLookupStart","domainLookupEnd","connectStart","secureConnectionStart","connectEnd","requestStart","responseStart","responseEnd","domLoading","domInteractive","domContentLoadedEventStart","domContentLoadedEventEnd","domComplete","loadEventStart","loadEventEnd","msFirstPaint"],X=["navigate","reload","back_forward"],Z=function(n){function u(e){var t;(t=n.call(this,e)||this).reporter=null,t.autoCollecting=!1,t.pluginVer="2.1.16",t.webVitals={};return t.opts=i({collectResTiming:!1,manual:!1,minLoadTiming:3e3,maxLoadTiming:8e3,minLoadSpr:.05,maxLoadSpr:1,enableLCP:!1},e),t}!function(t,n){t.prototype=Object.create(n.prototype),t.prototype.constructor=t,e(t,n)}(u,n);var p=u.prototype;return p.init=function(e){var t=this,n=this;n.reporter=e,n.reporter.print("perf manual option",n.opts.manual),this._initQuarkPCBV(),n.opts.manual&&!e.__customPerfCache__?(n.reporter.print("overwrite reportPerf"),e.reportPerf=function(t){return n.reportPerf(t),e}):(n.reporter.print("auto collect perfData maunal = "+n.opts.manual+" perCache = ",e.__customPerfCache__),n.autoCollectTimingData()),this.opts.enableLCP&&(this.initWebVitalsCollect(),o(window,"pagehide",function(){t._reportPerfLog(!0)}))},p._initQuarkPCBV=function(){var e=this;try{var t;"object"==typeof window.chrome&&"function"==typeof(null==(t=window.chrome.quarkAppPrivate)?void 0:t.isFirstUserVisibleWebContents)&&window.chrome.quarkAppPrivate.isFirstUserVisibleWebContents(function(t){e._qkPCFirstWebPage=t?1:0})}catch(e){}},p._hadCollectedWebVitals=function(){var e=this;if(!this.opts.enableLCP)return!0;var t=function(t){return!e.webVitals["has"+t]||void 0!==e.webVitals[""+t.toLocaleLowerCase()]};return t("Fcp")&&t("Lcp")&&t("Cls")&&t("Fid")},p.initWebVitalsCollect=function(){var e=this;if(this.webVitals.hasFcp=this._browserSupportsEnty("paint"),this.webVitals.hasLcp=this._browserSupportsEnty("largest-contentful-paint"),this.webVitals.hasCls=this._browserSupportsEnty("layout-shift"),this.webVitals.hasFid=this._browserSupportsEnty("first-input"),this.webVitals.hasFcp){for(var t,n=J(performance.getEntriesByType("paint"));!(t=n()).done;){var i=t.value;if("first-contentful-paint"===i.name){this.webVitals.fcp=i.startTime,this._reportPerfLog();break}}k(function(t){e.webVitals.fcp=t.delta,e._reportPerfLog()})}if(this.webVitals.hasFid&&function(e,t){t=t||{},I(function(){var n,r=O(),i=w("FID"),o=function(e){e.startTime<r.firstHiddenTime&&(i.value=e.processingStart-e.startTime,i.entries.push(e),n(!0))},a=function(e){e.forEach(o)},s=E("first-input",a);n=y(e,i,K,t.reportAllChanges),s&&P(S(function(){a(s.takeRecords()),s.disconnect()})),s&&m(function(){var r;i=w("FID"),n=y(e,i,K,t.reportAllChanges),f=[],l=-1,c=null,j(addEventListener),r=o,f.push(r),B()})})}(function(t){e.webVitals.fid=t.delta,e._reportPerfLog()}),this.webVitals.hasLcp){var o=!1;try{o="function"==typeof this.opts.enableLcpNodeIgnore?this.opts.enableLcpNodeIgnore():this.opts.enableLcpNodeIgnore}catch(e){}!function(e,t){var n,r=new W(null===(n=t=t||{})||void 0===n?void 0:n.debug);I(function(){var n,i=O(),o=w("LCP"),a=function(e){var a;if(null!==(a=t)&&void 0!==a&&a.enableFilter){r.warn("the ignore lcp option is true");for(var s=e.length;s>0;s--){var c=e[s-1];if(!x(c.element)){c.startTime<i.firstHiddenTime&&(o.value=c.startTime-b(),o.entries=[c],n());break}r.warn("hit rules,this lcp entry will be ignored",c)}}else{var l=e[e.length-1];l&&l.startTime<i.firstHiddenTime&&(o.value=Math.max(l.startTime-b(),0),o.entries=[l],n())}},s=E("largest-contentful-paint",a);if(s){n=y(e,o,U,t.reportAllChanges);var c=S(function(){q[o.id]||(a(s.takeRecords()),s.disconnect(),q[o.id]=!0,n(!0))});["keydown","click"].forEach(function(e){addEventListener(e,function(){return setTimeout(c,0)},{once:!0,capture:!0})}),P(c),m(function(r){o=w("LCP"),n=y(e,o,U,t.reportAllChanges),_(function(){o.value=performance.now()-r.timeStamp,q[o.id]=!0,n(!0)})})}})}(function(t){if(e.webVitals.lcp=t.delta,r(t.entries)&&t.entries.length>0){var n=t.entries[t.entries.length-1];e.webVitals.lcpElement=v(n.element),e.webVitals.lcpNav=t.navigationType}e._reportPerfLog()},{enableFilter:o,debug:this.reporter.debug})}this.webVitals.hasCls&&H(function(t){e.webVitals.cls=t.value,e.webVitals.clsElement=t.attribution.largestShiftTarget,e._reportPerfLog()})},p._getWebVitals=function(){return{wl_fcp:this._getIndFromWebVitals("fcp"),wl_fid:this._getIndFromWebVitals("fid"),wl_lcp:this._getIndFromWebVitals("lcp"),wl_cls:this._getIndFromWebVitals("cls"),w_lcp_ele:this.webVitals.lcpElement,w_lcp_navt:this.webVitals.lcpNav,w_cls_ele:this.webVitals.clsElement}},p._getIndFromWebVitals=function(e){var t=this.webVitals[e];if(t&&!(t>6e4))return["fid","cls"].includes(e)?parseFloat(t.toFixed(4)):Math.floor(t)},p.reportPerf=function(e){this.reporter._hasReportPerfData?this.reporter.print("do not repeat report performance data"):(this.reporter.print("manual performance data"),this.reporter.__customPerfCache__=e,this.autoCollectTimingData())},p.autoCollectTimingData=function(){var e,t=this;if(!this.autoCollecting){this.autoCollecting=!0;var n=function(){var e=setTimeout(function(){t.collectNavigationTimingData(),clearTimeout(e)},0)},r=null==(e=this.reporter._sdkEnv)?void 0:e.isPrerender;!function(e){var t;return void 0===e&&(e={}),e.isPrerender?"compass"===e.prerenderType?"object"==typeof(null==(t=window)?void 0:t.prerenderCommitEvent)&&"prerendercommit"===window.prerenderCommitEvent.type:e.hasPrerenderCommit:"complete"===document.readyState}(this.reporter._sdkEnv)?function(e,t){o(window,t?"wpkpageforeground":"load",function(n){t&&"complete"!==document.readyState?o(window,"load",function(t){e.call(null,t)},!1,!0):e.call(null,n)},!1,!0)}(n,r):n()}},p.collectNavigationTimingData=function(){var e=window.performance;if(e){var n,o=e.getEntriesByType?e.getEntriesByType("navigation"):[];if(r(o)&&o.length>0?(n=o[0])._ver=2:(n=e.timing)&&(n._ver=1),n&&function(e){return"object"==typeof e}(n)){var c=i(this.calcNormalStageTime(n),this.calcKeyStageTime(n));for(var l in c)if(void 0===c[l]||null===c[l]||c[l]<0||c[l]>6e4)return void this.reporter.print(l+" 指标无效或超过临界值，本次性能数据丢弃");var u=i(c,this.calcExtData(n,e),{category:t.PERF,sampleRate:this.sampleRate,pluginVer:this.pluginVer});this.opts.manual&&this.reporter.__customPerfCache__&&(u=i(u,this.reporter.__customPerfCache__),this.reporter.__customPerfCache__=null),this.webVitals.oldPerf=u,this._reportPerfLog(),(this.opts.collectResTiming||s()||a.indexOf("ucbrowser/")>-1)&&!this.reporter._hasCollectResTiming&&this._handleBadPerfTiming(u)}else this.reporter.print("没有timing对象,本次不采集性能数据")}},p._reportPerfLog=function(e){if(void 0===e&&(e=!1),this.webVitals.oldPerf)if(e||this._hadCollectedWebVitals()){var t=i(this.webVitals.oldPerf,this._getWebVitals());if(a.indexOf("quarkpc/")>-1)t.w_bv=this._qkPCFirstWebPage;else if(s()&&/(iphone|ipad|ipod|ios)/i.test(a)){var n;t.w_bv=(null==(n=window)||null==(n=n.__quark)?void 0:n.app_w_first_render)||0}this.reporter._hasReportPerfData=!0,this.reporter.report(i(this.webVitals.oldPerf,this._getWebVitals())),this.webVitals={}}else this.reporter.print("no lcp fcp yet");else this.reporter.print("no perf log yet")},p.calcNormalStageTime=function(e){return this.calculateInd(e,{w_unload:[1,2],w_redirect:[3,4],w_appcache:[5,6],w_dns:[6,7],w_tcp:[8,10],w_ssl:[9,10],w_ttfb:[5,12],w_n_rve:[5,13],w_contentdownload:[12,13],w_domparsing:[13,15],w_res:[17,19]})},p.calcKeyStageTime=function(e){return this.calculateInd(e,{w_firstbyte:[5,12],w_tti:[5,15],w_domready:[5,17],w_load:[5,19],w_total:[5,20]})},p.calculateInd=function(e,t){var n,r,i={},o=e._ver||1;for(var a in t){n=e[Q[t[a][0]]],r=e[Q[t[a][1]]],(2===o?n>=0:n>0)&&r>0&&(i[a]=parseFloat((r-n).toFixed(2)))}return i},p.calcExtData=function(e,t){var n,r=t.navigation||{},i=null,o=null,a=null;return 1===e._ver?n=X[r.type]||"other":2===e._ver&&(i=e.encodedBodySize,o=e.decodedBodySize,a=e.transferSize,n=e.type),{w_enbdsize:i,w_debdsize:o,w_transize:a,w_navtype:n}},p._handleBadPerfTiming=function(e){var n=0;e.w_load&&e.w_load>=(this.opts.minLoadTiming||3e3)&&e.w_load<=(this.opts.maxLoadTiming||8e3)?n=this.opts.minLoadSpr||.05:e.w_load&&e.w_load>(this.opts.maxLoadTiming||8e3)&&(n=this.opts.maxLoadSpr||1),n&&performance&&"function"==typeof performance.getEntriesByType&&(this.reporter.report({category:t.RESTIMING,sampleRate:n,bl1:JSON.stringify(performance.getEntriesByType("resource")),bl2:performance.timeOrigin||performance.timing.fetchStart,_forcePost:!0}),this.reporter._hasCollectResTiming=!0)},p._browserSupportsEnty=function(e){var t;return("first-input"!==e||"PerformanceEventTiming"in window)&&(("event"!==e||!self.PerformanceEventTiming||"interactionId"in PerformanceEventTiming.prototype)&&(null==(t=window.PerformanceObserver)||null==(t=t.supportedEntryTypes)?void 0:t.includes(e)))},u}(n);return Z.pluginId="iTracePerfPlugin",Z}();
var itraceResourcePlugin=function(){"use strict";function e(t,r){return e=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},e(t,r)}var t;(t={}).ZH="cn",t.QUARK="quark",t.INTL="intl";var r=function(e){return e[e.JSERR=1]="JSERR",e[e.API=2]="API",e[e.PERF=3]="PERF",e[e.RESERR=4]="RESERR",e[e.PVUV=5]="PVUV",e[e.BKPG=6]="BKPG",e[e.LONGTASK=8]="LONGTASK",e[e.INPD=15]="INPD",e[e.NODERES=16]="NODERES",e[e.PGERROR=17]="PGERROR",e[e.BLOCK=18]="BLOCK",e[e.PERFNEXT=1e3]="PERFNEXT",e[e.MAINDOC=1e5]="MAINDOC",e[e.RESTIMING=100001]="RESTIMING",e}({});!function(e){e.JSERR="jserr",e.API="api",e.PERF="jsfsperf",e.RESERR="resloadfail",e.PVUV="flow",e.BKPG="bkpg",e.CUSTOM="jssdkidx",e.INPD="inputdelay",e.LONGTASK="longtask",e.NODERES="nodres",e.PGERROR="pgerror",e.BLOCK="h5block"}({});var n=function(e){e=e||{},this.id=e.id,this.sampleRate=e.sampleRate,this.forceEnable=e.forceEnable};!function(e){e.ZH="cn",e.QUARK="quark",e.INTL="intl"}({}),function(e){e[e.JSERR=1]="JSERR",e[e.API=2]="API",e[e.PERF=3]="PERF",e[e.RESERR=4]="RESERR",e[e.PVUV=5]="PVUV",e[e.BKPG=6]="BKPG",e[e.LONGTASK=8]="LONGTASK",e[e.INPD=15]="INPD",e[e.NODERES=16]="NODERES",e[e.PGERROR=17]="PGERROR",e[e.BLOCK=18]="BLOCK",e[e.PERFNEXT=1e3]="PERFNEXT",e[e.MAINDOC=1e5]="MAINDOC",e[e.RESTIMING=100001]="RESTIMING"}({}),function(e){e.JSERR="jserr",e.API="api",e.PERF="jsfsperf",e.RESERR="resloadfail",e.PVUV="flow",e.BKPG="bkpg",e.CUSTOM="jssdkidx",e.INPD="inputdelay",e.LONGTASK="longtask",e.NODERES="nodres",e.PGERROR="pgerror",e.BLOCK="h5block"}({}),"undefined"!=typeof navigator&&(navigator.userAgent||"").toLowerCase();var a=function(t){function n(e){var r;return(r=t.call(this,e)||this).reporter=null,r.pluginVer="2.0.4",r}!function(t,r){t.prototype=Object.create(r.prototype),t.prototype.constructor=t,e(t,r)}(n,t);var a=n.prototype;return a.init=function(e){this.listenResourceError(),this.reporter=e},a.getDomPath=function(e,t){var r=e.id?"#"+e.id:"",n="";e.className&&"string"==typeof e.className&&(n="."+e.className.split(" ").join("."));var a=e.tagName.toLowerCase();return e.parentNode&&e.parentNode.tagName&&t-1!=0?this.getDomPath(e.parentNode,t-1)+" > "+a.toLowerCase()+r+n:a+r+n},a.tagNameToType=function(e){var t=-1;switch(e.tagName.toLowerCase()){case"img":t=1;break;case"link":e.rel&&"stylesheet"===e.rel.toLowerCase()&&(t=2);break;case"script":t=3;break;case"video":t=11}return t},a.listenResourceError=function(){var e=this;!function(e,t,r,n,a){void 0===n&&(n=!1),void 0===a&&(a=!1),e.addEventListener?e.addEventListener(t,function o(i){a&&e.removeEventListener(t,o,n),r.call(this,i)},n):e.attachEvent&&e.attachEvent("on"+t,function o(i){a&&e.detachEvent(t,o,n),r.call(this,i)})}(window,"error",function(t){if(!function(e){var t=e.target;return!(t&&t.tagName)||e.message||e.filename||e.lineno||e.colno}(t)){var n=t.target.src||t.target.href;n===window.location.href&&(n="empty src");var a,o=e.tagNameToType(t.target);11===o&&t.target.error&&(a=t.target.error.code);var i={msg:n+" 加载失败",w_res:n,w_type:o,w_err:a,w_xpath:e.getDomPath(t.target,5),category:r.RESERR,sampleRate:e.sampleRate,pluginVer:e.pluginVer};e.reporter.report(i)}},!0,!1)},n}(n);return a.pluginId="iTraceResourcePlugin",a}();
var itraceInterfacePlugin=function(){"use strict";function e(t,r){return e=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},e(t,r)}var t;(t={}).ZH="cn",t.QUARK="quark",t.INTL="intl";var r=function(e){return e[e.JSERR=1]="JSERR",e[e.API=2]="API",e[e.PERF=3]="PERF",e[e.RESERR=4]="RESERR",e[e.PVUV=5]="PVUV",e[e.BKPG=6]="BKPG",e[e.LONGTASK=8]="LONGTASK",e[e.INPD=15]="INPD",e[e.NODERES=16]="NODERES",e[e.PGERROR=17]="PGERROR",e[e.BLOCK=18]="BLOCK",e[e.PERFNEXT=1e3]="PERFNEXT",e[e.MAINDOC=1e5]="MAINDOC",e[e.RESTIMING=100001]="RESTIMING",e}({});!function(e){e.JSERR="jserr",e.API="api",e.PERF="jsfsperf",e.RESERR="resloadfail",e.PVUV="flow",e.BKPG="bkpg",e.CUSTOM="jssdkidx",e.INPD="inputdelay",e.LONGTASK="longtask",e.NODERES="nodres",e.PGERROR="pgerror",e.BLOCK="h5block"}({});var n=function(e){e=e||{},this.id=e.id,this.sampleRate=e.sampleRate,this.forceEnable=e.forceEnable};function o(){for(var e=arguments.length<=0?void 0:arguments[0],t=1,r=arguments.length;t<r;t++){var n=t<0||arguments.length<=t?void 0:arguments[t];for(var o in n)a(n,o)&&(e[o]=n[o])}return e}function s(e,t){for(var r,n=e.length,o=0;o<n;o++)r=e[o],t.call(this,r,o,e)}!function(e){e.ZH="cn",e.QUARK="quark",e.INTL="intl"}({}),function(e){e[e.JSERR=1]="JSERR",e[e.API=2]="API",e[e.PERF=3]="PERF",e[e.RESERR=4]="RESERR",e[e.PVUV=5]="PVUV",e[e.BKPG=6]="BKPG",e[e.LONGTASK=8]="LONGTASK",e[e.INPD=15]="INPD",e[e.NODERES=16]="NODERES",e[e.PGERROR=17]="PGERROR",e[e.BLOCK=18]="BLOCK",e[e.PERFNEXT=1e3]="PERFNEXT",e[e.MAINDOC=1e5]="MAINDOC",e[e.RESTIMING=100001]="RESTIMING"}({}),function(e){e.JSERR="jserr",e.API="api",e.PERF="jsfsperf",e.RESERR="resloadfail",e.PVUV="flow",e.BKPG="bkpg",e.CUSTOM="jssdkidx",e.INPD="inputdelay",e.LONGTASK="longtask",e.NODERES="nodres",e.PGERROR="pgerror",e.BLOCK="h5block"}({}),"undefined"!=typeof navigator&&(navigator.userAgent||"").toLowerCase();var a=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};function i(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return p(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?p(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function p(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}var c=/(text)|(json)|(xml)/,d=location.origin,l=function(e){return!e||(0===e.indexOf(d)||!/^(\/\/|http:|https:).*/.test(e))},u=function(t){function n(e){var r;return(r=t.call(this,e)||this).pluginVer="2.1.13",r.opts=e,r.opts.enableXHR=!1!==e.enableXHR,r.opts.enableFetch=!1!==e.enableFetch,r.opts.enableMtop=!0===e.enableMtop,r.opts.enableTrace=!0===e.enableTrace,r}!function(t,r){t.prototype=Object.create(r.prototype),t.prototype.constructor=t,e(t,r)}(n,t);var a=n.prototype;return a.init=function(e){this.reporter=e,this.opts.enableXHR&&this.hookXHR(),this.opts.enableFetch&&this.hookFetch(),this.opts.enableMtop&&this.hookMtop(),this.opts.enableCorsTrace=this.opts.enableCorsTrace||function(){return!1},this.opts.requestHeaders=o(this.opts.requestHeaders||{},{"x-wpk-reqid":function(){return function(e){var t=Date.now();"undefined"!=typeof window&&window.performance&&"function"==typeof window.performance.now&&(t+=performance.now());var r="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var r=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"===e?r:11&r).toString(16)});return!1===e?r.replace(/-/g,""):r}(!1)},"x-wpk-bid":function(){return e.bid}})},a.hookXHR=function(){var e=this,t=window.XMLHttpRequest.prototype,r=t.open,n=t.send,o=t.setRequestHeader;t.open=function(t,n){this.__reqCtx__={method:t||"GET",url:n||"",start:Date.now(),headers:{}};var o=[].slice.call(arguments);r.apply(this,o);var a=this;e.opts.enableTrace&&(l(n)||e.opts.enableCorsTrace&&e.opts.enableCorsTrace(n))?(e.reporter.print("shoot the trace rule, setting req header",n),s(Object.getOwnPropertyNames(e.opts.requestHeaders),function(t){var r=e.opts.requestHeaders[t]();a.setRequestHeader(t,r)})):e.reporter.print("not shoot the trace rule, setting req header",n)},t.setRequestHeader=function(e,t){var r=[].slice.call(arguments);o.apply(this,r),this.__reqCtx__&&(this.__reqCtx__.headers||(this.__reqCtx__.headers={}),this.__reqCtx__.headers[e]=t)},t.send=function(t){var r=this;function o(){if(!r.__reqCtx__||4===r.readyState)try{var n=Date.now(),o=(r.responseURL||e.transReqUrl(r.__reqCtx__.url)).split("?"),s=o[0],a=o[1]||"",i=e.opts.withReqBody&&"GET"!==r.__reqCtx__.method.toUpperCase()&&t?JSON.stringify(t):void 0,p=e.opts.withReqHeader&&(r.__reqCtx__.headers||{}),d=e.transferXhrRspHeader(r.getAllResponseHeaders())||{},l=r.getResponseHeader("Content-Type")||"",u=e.opts.withRespBody&&c.test(l)?e._readXhrResponseAsStr(r):void 0,h=n-r.__reqCtx__.start;e.sendData({w_res:s,w_param:a,w_method:r.__reqCtx__.method,w_rc:r.status,w_rt:h,w_body:i,w_resp:u,w_hd:JSON.stringify(p),w_trace_reqid:d&&d["x-wpk-reqid"]||p&&p["x-wpk-reqid"]||void 0,w_rshd:e.opts.withRespHeader?JSON.stringify(d):null,w_trace_serverid:d["x-wpk-serverid"]||void 0,w_type:16,msg:e.isReqSuccess(r.status)?void 0:r.statusText})}catch(t){e.reportPluginError(t)}}if("onreadystatechange"in r&&"function"==typeof r.onreadystatechange){var s=r.onreadystatechange;r.onreadystatechange=function(){var e=[].slice.call(arguments);o.apply(this,e),s.apply(this,e)}}else r.onreadystatechange=o;var a=[].slice.call(arguments);return n.apply(this,a)}},a._readXhrResponseAsStr=function(e){try{if(["text",""].includes(e.responseType))return e.responseText;if("arraybuffer"===e.responseType)return new TextDecoder("utf-8").decode(e.response)}catch(e){this.reporter.print("response as string error",e)}},a.hookFetch=function(){var e=this,t="undefined"!=typeof window?window:"object"==typeof self&&self instanceof WorkerGlobalScope?self:null;if(null!==t){var r=t.fetch;t.fetch=function(n,o){var a,i,p,d,u,h=Date.now(),f=!1;if("string"==typeof n)p=n,i=(null==(u=o)||null==(u=u.method)?void 0:u.toUpperCase())||"GET";else if(n instanceof URL){var R;p=n.toString(),i=(null==(R=o)||null==(R=R.method)?void 0:R.toUpperCase())||"GET"}else{var w;p=n.url||"",i=(null==(w=n.method)?void 0:w.toUpperCase())||"GET",f=!0}e.opts.enableTrace&&(l(p)||e.opts.enableCorsTrace&&e.opts.enableCorsTrace(p))?(e.reporter.print("shoot the trace rule, setting req header",p),f?d=n.headers:(void 0===o?o={headers:new Headers}:void 0===o.headers&&(o.headers=new Headers),d=o.headers),s(Object.getOwnPropertyNames(e.opts.requestHeaders),function(t){"function"==typeof d.set?d.set(t,e.opts.requestHeaders[t]()):d[t]=e.opts.requestHeaders[t]()})):e.reporter.print("not shoot the trace rule, setting req header",p),e.opts.withReqHeader&&!d&&(d=f?n.headers:"object"==typeof o?o.headers:void 0);var y={};try{if(d instanceof Headers)d.forEach(function(e,t){y[t]=e});else if(d&&"object"==typeof d)for(var g=0,_=Object.entries(d);g<_.length;g++){var v=_[g];y[v[0]]=v[1]}}catch(t){e.reporter.print(t),e.reporter.reportJSError(t,{bid:"itrace-next",msg:"fetch api header error"})}var x=e.opts.withReqBody&&null!=(a=o)&&a.body?JSON.stringify(o.body):void 0;return r.call(t,n,o).then(function(t){try{var r=e.transferFetchRespHeaders(t.headers)||{},n=e.buildFetchBaseLog(t.url||p,i,t.status,h,y,x,t.statusText,r),o=(t.headers.get("content-type")||"").toLowerCase();c.test(o)&&e.opts.withRespBody?t.clone().text().then(function(t){n.w_resp=t||"",e.sendData(n)}):e.sendData(n)}catch(t){e.reportPluginError(t)}return t}).catch(function(t){var r=e.buildFetchBaseLog(p,i,-1,h,y,x,t.message,void 0);throw e.sendData(r),t})}}else this.reporter.print("global this is null ignore hook fetch")},a.buildFetchBaseLog=function(e,t,r,n,o,s,a,i){var p=Date.now(),c=this.transReqUrl(e).split("?"),d=c.length>1?c[1]:"",l=c[0],u=this.opts.withReqHeader?o:void 0;return{w_res:l,w_param:d,w_body:s,w_method:t,w_rc:r,w_rt:p-n,w_hd:JSON.stringify(u),w_trace_reqid:i&&i["x-wpk-reqid"]||o&&o["x-wpk-reqid"]||void 0,w_rshd:this.opts.withRespHeader?JSON.stringify(i):void 0,w_trace_serverid:i&&i["x-wpk-serverid"]||void 0,w_type:17,msg:a}},a.transReqUrl=function(e){try{if(e.startsWith("/"))return new URL(e,location.href).href}catch(e){}return e},a.hookMtop=function(){var e,t=this;null!=(e=window)&&null!=(e=e.lib)&&null!=(e=e.mtop)&&e.middlewares&&(this.reporter.print("init mtop middlewares"),window.lib.mtop.middlewares.push(function(e){var r=this.params,n=this.options,o=Date.now();return e().then(function(){try{if(t.opts.enableXHR&&n.H5Request&&(n.getJSON||n.postJSON))return;var e=n.retJson||{},s=Date.now()-o,a=e.code||200,i=r.type,p=r.api,c=function(e){var t=[];for(var r in e)t.push(r+"="+e[r]);return t.join("&")}(n.querystring),d=t.opts.withReqBody&&n.postdata&&n.postdata.data?JSON.stringify(n.postdata.data):null,l=t.opts.withRespBody?JSON.stringify(e.data||{}):void 0,u="",h=e.ret;h instanceof Array&&(h=h.join(",")),-1===h.indexOf("SUCCESS")&&(u=h);var f={w_res:p,w_param:c,w_body:d,w_method:i,w_rc:a,w_rt:s,w_resp:l,w_type:100,msg:u};t.sendData(f)}catch(e){t.reportPluginError(e)}})}))},a.sendData=function(e){var t=e.w_res||"",n=e.w_rt||0;!0!==this.opts.onlyForTrace?this.whiteList(t)&&n<121e3?(o(e,{category:r.API,sampleRate:this.opts.sampleRate,pluginVer:this.pluginVer}),this.reporter.report(e)):this.reporter.print("api addr in black list or rt over limit ignore this log item"):this.reporter.print("in uccore. ignore this interface log item")},a.transferXhrRspHeader=function(e){try{var t=function(e){return e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}(e||"").split(/[\r\n]+/);if(t.length>0){var r={};return s(t,function(e){var t=e.split(": "),n=t.shift()||"";r[n]=t.join(": ")}),r}}catch(e){}},a.transferFetchRespHeaders=function(e){try{if(!e)return{};for(var t,r={},n=i(e);!(t=n()).done;){var o=t.value;r[o[0]]=o[1]}return r}catch(e){return{}}},a.isReqSuccess=function(e){return e>=200&&e<=299},a.reportPluginError=function(e){},a.whiteList=function(e){return-1===e.indexOf("//arms-retcode")&&-1===e.indexOf("//retcode.taobao.com")&&-1===e.indexOf("aliyuncs.com/r.png")&&-1===e.indexOf("//mdap.alipay.com/loggw")&&-1===e.indexOf("//wpk-gateway")&&-1===e.indexOf("//px.wpk.quark.cn")&&-1===e.indexOf("//px.ucweb.com")&&-1===e.indexOf("//px.effirst.com")&&-1===e.indexOf("//px-intl.ucweb.com")&&-1===e.indexOf("//gm.mmstat.com/arms.1.1")&&-1===e.indexOf("//gm.mmstat.com/arms.1.2")&&-1===e.indexOf("//g.alicdn.com/alilog")&&-1===e.indexOf("//log.m.sm.cn/0.gif")},n}(n);return u.pluginId="iTraceInterfacePlugin",u}();
var itraceJserrorPlugin=function(){"use strict";function r(e,n){return r=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,e){return r.__proto__=e,r},r(e,n)}var e;(e={}).ZH="cn",e.QUARK="quark",e.INTL="intl";var n=function(r){return r[r.JSERR=1]="JSERR",r[r.API=2]="API",r[r.PERF=3]="PERF",r[r.RESERR=4]="RESERR",r[r.PVUV=5]="PVUV",r[r.BKPG=6]="BKPG",r[r.LONGTASK=8]="LONGTASK",r[r.INPD=15]="INPD",r[r.NODERES=16]="NODERES",r[r.PGERROR=17]="PGERROR",r[r.BLOCK=18]="BLOCK",r[r.PERFNEXT=1e3]="PERFNEXT",r[r.MAINDOC=1e5]="MAINDOC",r[r.RESTIMING=100001]="RESTIMING",r}({});!function(r){r.JSERR="jserr",r.API="api",r.PERF="jsfsperf",r.RESERR="resloadfail",r.PVUV="flow",r.BKPG="bkpg",r.CUSTOM="jssdkidx",r.INPD="inputdelay",r.LONGTASK="longtask",r.NODERES="nodres",r.PGERROR="pgerror",r.BLOCK="h5block"}({});var t=function(r){r=r||{},this.id=r.id,this.sampleRate=r.sampleRate,this.forceEnable=r.forceEnable};function o(){for(var r=arguments.length<=0?void 0:arguments[0],e=1,n=arguments.length;e<n;e++){var t=e<0||arguments.length<=e?void 0:arguments[e];for(var o in t)l(t,o)&&(r[o]=t[o])}return r}function i(r,e,n,t,o){void 0===t&&(t=!1),void 0===o&&(o=!1),r.addEventListener?r.addEventListener(e,function i(a){o&&r.removeEventListener(e,i,t),n.call(this,a)},t):r.attachEvent&&r.attachEvent("on"+e,function i(a){o&&r.detachEvent(e,i,t),n.call(this,a)})}function a(){return"undefined"!=typeof window?window:"object"==typeof self&&self instanceof WorkerGlobalScope?self:null}!function(r){r.ZH="cn",r.QUARK="quark",r.INTL="intl"}({}),function(r){r[r.JSERR=1]="JSERR",r[r.API=2]="API",r[r.PERF=3]="PERF",r[r.RESERR=4]="RESERR",r[r.PVUV=5]="PVUV",r[r.BKPG=6]="BKPG",r[r.LONGTASK=8]="LONGTASK",r[r.INPD=15]="INPD",r[r.NODERES=16]="NODERES",r[r.PGERROR=17]="PGERROR",r[r.BLOCK=18]="BLOCK",r[r.PERFNEXT=1e3]="PERFNEXT",r[r.MAINDOC=1e5]="MAINDOC",r[r.RESTIMING=100001]="RESTIMING"}({}),function(r){r.JSERR="jserr",r.API="api",r.PERF="jsfsperf",r.RESERR="resloadfail",r.PVUV="flow",r.BKPG="bkpg",r.CUSTOM="jssdkidx",r.INPD="inputdelay",r.LONGTASK="longtask",r.NODERES="nodres",r.PGERROR="pgerror",r.BLOCK="h5block"}({}),"undefined"!=typeof navigator&&(navigator.userAgent||"").toLowerCase();var l=function(r,e){return Object.prototype.hasOwnProperty.call(r,e)},s=function(e){function t(r){var n;return(n=e.call(this,r)||this).reporter=null,n.pluginVer="2.0.10",n.ignoreScriptError=!1!==r.ignoreScriptError,n}!function(e,n){e.prototype=Object.create(n.prototype),e.prototype.constructor=e,r(e,n)}(t,e);var l=t.prototype;return l.init=function(r){this.reporter=r,this.listenError(),this.listenUnHandleRejection()},l.listenError=function(){var r=this,e=a();null!==e?i(e,"error",function(e){if(function(r){var e=r.target;return!(e&&e.tagName)||r.message||r.filename||r.lineno||r.colno}(e)){var n=e.message||"unknown",t=e.error||{};if("script error."===n.toLowerCase()){if(r.ignoreScriptError)return;n="Script error",t={}}r.reportError(n,e.filename,e.lineno,e.colno,t)}}):this.reporter.print("global this is null ignore jserror plugin")},l.listenUnHandleRejection=function(){var r=this,e=a();null!==e?i(e,"unhandledrejection",function(e){var n=e.type;"string"==typeof e.reason?n=e.reason:e.reason&&"object"==typeof e.reason&&e.reason.message&&(n=e.reason.message),r.reportError(n,null,null,null,e.reason||e.type,{evtType:"unhandledrejection"})}):this.reporter.print("global this is null ignore jserror plugin")},l.reportError=function(r,e,t,i,a,l){if(null!=a){var s=(a.stack||"").split("\n");s.shift();var R={w_msg:r,w_file:e,w_col:i,w_line:t,stack:s.join("\n"),error:a};l&&o(R,l),o(R,{category:n.JSERR,sampleRate:this.sampleRate,pluginVer:this.pluginVer}),this.reporter.report(R)}},t}(t);return s.pluginId="iTraceJSErrorPlugin",s}();
var itraceBlankPlugin=function(){"use strict";function e(){return e=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},e.apply(null,arguments)}function t(e,r){return t=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},t(e,r)}var r;(r={}).ZH="cn",r.QUARK="quark",r.INTL="intl";var n=function(e){return e[e.JSERR=1]="JSERR",e[e.API=2]="API",e[e.PERF=3]="PERF",e[e.RESERR=4]="RESERR",e[e.PVUV=5]="PVUV",e[e.BKPG=6]="BKPG",e[e.LONGTASK=8]="LONGTASK",e[e.INPD=15]="INPD",e[e.NODERES=16]="NODERES",e[e.PGERROR=17]="PGERROR",e[e.BLOCK=18]="BLOCK",e[e.PERFNEXT=1e3]="PERFNEXT",e[e.MAINDOC=1e5]="MAINDOC",e[e.RESTIMING=100001]="RESTIMING",e}({});!function(e){e.JSERR="jserr",e.API="api",e.PERF="jsfsperf",e.RESERR="resloadfail",e.PVUV="flow",e.BKPG="bkpg",e.CUSTOM="jssdkidx",e.INPD="inputdelay",e.LONGTASK="longtask",e.NODERES="nodres",e.PGERROR="pgerror",e.BLOCK="h5block"}({});var o=function(e){e=e||{},this.id=e.id,this.sampleRate=e.sampleRate,this.forceEnable=e.forceEnable};function i(){return i=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},i.apply(null,arguments)}function a(e){return"function"==typeof e}function c(){for(var e=arguments.length<=0?void 0:arguments[0],t=1,r=arguments.length;t<r;t++){var n=t<0||arguments.length<=t?void 0:arguments[t];for(var o in n)s(n,o)&&(e[o]=n[o])}return e}function l(e,t,r,n,o){void 0===n&&(n=!1),void 0===o&&(o=!1),e.addEventListener?e.addEventListener(t,function i(a){o&&e.removeEventListener(t,i,n),r.call(this,a)},n):e.attachEvent&&e.attachEvent("on"+t,function i(a){o&&e.detachEvent(t,i,n),r.call(this,a)})}!function(e){e.ZH="cn",e.QUARK="quark",e.INTL="intl"}({}),function(e){e[e.JSERR=1]="JSERR",e[e.API=2]="API",e[e.PERF=3]="PERF",e[e.RESERR=4]="RESERR",e[e.PVUV=5]="PVUV",e[e.BKPG=6]="BKPG",e[e.LONGTASK=8]="LONGTASK",e[e.INPD=15]="INPD",e[e.NODERES=16]="NODERES",e[e.PGERROR=17]="PGERROR",e[e.BLOCK=18]="BLOCK",e[e.PERFNEXT=1e3]="PERFNEXT",e[e.MAINDOC=1e5]="MAINDOC",e[e.RESTIMING=100001]="RESTIMING"}({}),function(e){e.JSERR="jserr",e.API="api",e.PERF="jsfsperf",e.RESERR="resloadfail",e.PVUV="flow",e.BKPG="bkpg",e.CUSTOM="jssdkidx",e.INPD="inputdelay",e.LONGTASK="longtask",e.NODERES="nodres",e.PGERROR="pgerror",e.BLOCK="h5block"}({}),"undefined"!=typeof navigator&&(navigator.userAgent||"").toLowerCase();var s=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},p=function(e,t){if(!e)return"e";var r=window.getComputedStyle(e);return"0px"===r.width||"0px"===r.height||"none"===r.display||"hidden"===r.visibility||"0"===r.opacity||e.getBoundingClientRect().top>t?"e":-1!==["VIDEO","AUDIO","IMG","BUTTON","TEXTAREA","RADIO","CHECKBOX","SELECT","IFRAME","CANVAS","SVG"].indexOf(e.nodeName)||"none"!==r.backgroundImage?"v":"rgba(0, 0, 0, 0)"!==r.backgroundColor||"0px"!==r.borderWidth||"none"!==r.boxShadow?"ve":"oc"};var u=function(r){function o(e){var t;(t=r.call(this,e)||this).reporter=null,t.pluginVer="2.3.0";return t.opts=c({maxDepth:8,minElements:10,startCheckingTime:5e3},e),t}!function(e,r){e.prototype=Object.create(r.prototype),e.prototype.constructor=e,t(e,r)}(o,r);var s=o.prototype;return s.init=function(e){var t,r,n,o=this,c=this;c.reporter=e;try{if(c.opts.ignorePageUrls&&a(c.opts.ignorePageUrls)&&c.opts.ignorePageUrls(location))return void c.reporter.print("current url is in ignore list, skip blank check");this.reporter.detectBlank=function(e){o._checkBlank(e)}}catch(e){this.reporter.print(e)}if(null!=(t=this.reporter._sdkEnv)&&t.iOSNBCheck)return function(e,t,r,n){var o;if("function"==typeof(null==(o=window)||null==(o=o.ucapi)?void 0:o.invoke)){var a=i({},t,{success:r,fail:n});window.ucapi.invoke(e,a)}else n&&n("ucapi is not exist")}("webMonitor.setConfig",{startCheckingTime:this.opts.startCheckingTime,frmId:this.reporter._frmId,sampleRate:this.opts.sampleRate,w_rel:this.reporter.rel,uid:this.reporter.uid}),void this.reporter.print("blank check will be performed by client");var s=null==(r=this.reporter._sdkEnv)?void 0:r.isPrerender;!function(e){var t;return void 0===e&&(e={}),e.isPrerender?"compass"===e.prerenderType?"object"==typeof(null==(t=window)?void 0:t.prerenderCommitEvent)&&"prerendercommit"===window.prerenderCommitEvent.type:e.hasPrerenderCommit:"complete"===document.readyState}(this.reporter._sdkEnv)?function(e,t){l(window,t?"wpkpageforeground":"load",function(r){t&&"complete"!==document.readyState?l(window,"load",function(t){e.call(null,t)},!1,!0):e.call(null,r)},!1,!0)}(function(){c._onloadBlankCheck()},s):c._onloadBlankCheck(),null!=(n=this.opts.spaOption)&&n.enable&&l(window,"wpkpgchange",function(){o.reporter.print("spa page change blank detect"),c._routeChangeBlankCheck()})},s._onloadBlankCheck=function(){var e=this;this.onLoadDetectTimer=setTimeout(function(){try{e._checkBlank()}catch(t){e.reporter.print("bkpg checking oops: ",t)}e.onLoadDetectTimer=null},e.opts.startCheckingTime)},s._routeChangeBlankCheck=function(){var t,r=this;this.onLoadDetectTimer&&(clearTimeout(this.onLoadDetectTimer),r.reporter.print("page changed cancel the blank detect after onload")),this.pageChangeDetectTimer&&clearTimeout(this.pageChangeDetectTimer),this.pageChangeDetectTimer=setTimeout(function(){try{var t,n=e({},r.opts);n.rootDom=(null==(t=n.spaOption)?void 0:t.rootDom)||n.rootDom,r._checkBlank(n)}catch(e){r.reporter.print("bkpg checking oops: ",e)}r.pageChangeDetectTimer=null},(null==(t=r.opts.spaOption)?void 0:t.startCheckingTime)||3e3)},s._checkBlank=function(t){var r=this,o=t||r.opts,i=document.body;o.rootNode?i=o.rootNode:o.rootDom&&(i="function"==typeof o.rootDom?o.rootDom():o.rootDom);var c,l,s,u,d,h,f,E,g={deepestLayer:0,hasAtLeastOneVisibleNode:!1,total:0,invisible:0,visibleEmpty:0,occupy:0,domDSL:[]},m={},R=-1,v=Date.now();if(i){var k=function(e){return e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}(i.innerText);if(k)c=o.minTextLength||0,l=k,c&&c>0&&l&&c>l.split("").length?R=105:function(e,t){return function(e,t){for(var r,n=0,o=e.length;n<o;n++)if(r=e[n],t.call(this,r))return!0;return!1}(e,function(e){return e===t})}(o.keyNoteText||[],k)&&(R=102);else{var y=function(e,t){var r=[];try{for(var n=0,o=e.length;n<o;n++)t.call(this,e[n],n,e)&&r.push(e[n]);return r}catch(e){}return e}(Array.prototype.slice.call(i.children),function(e){return-1===["STYLE","SCRIPT","LINK"].indexOf(e.nodeName)});s=y,u=o.maxDepth||8,d=o.minElements||4,f=!0,E=function(e,t){var r=Array.prototype.slice.call(e),n=window.innerHeight;for(t>h.deepestLayer&&(h.deepestLayer=t);r.length&&f;){var o=r.shift();h.total++;var i=p(o,n);if(h.domDSL.push({tag:o.tagName,layer:t,cls:o.className,isEmpty:"e"===i||"oc"===i}),"e"!==i){if("v"===i){h.hasAtLeastOneVisibleNode=!0,f=!1;break}if("ve"===i&&(h.visibleEmpty++,d&&h.visibleEmpty>d)){f=!1;break}"oc"===i&&h.occupy++,t<=u&&o.children.length&&E(o.children,t+1)}else h.invisible++}},(h={deepestLayer:0,hasAtLeastOneVisibleNode:!1,total:0,invisible:0,visibleEmpty:0,occupy:0,domDSL:[]}).deepestLayer=1,E(s,1),!(g=h).hasAtLeastOneVisibleNode&&g.visibleEmpty<(o.minElements||4)&&(R=101,m={wl_ven:g.visibleEmpty,wl_ocn:g.occupy})}}else R=103;var O=Date.now()-v;r.reporter.print("节点总数："+g.total+", 最大层深："+g.deepestLayer+", 耗时："+O);var b={w_fp:-1};if(R>=0){r.reporter.print("检测到白屏，白屏类型："+R),b=e({w_fp:R,w_dsl:JSON.stringify(g.domDSL),w_depth:g.deepestLayer,w_domcnt:g.total,wl_dcost:O},m),r.sendData(b);var P=document.documentElement.innerHTML||"";P.length<=1e5&&r.reporter.report({category:n.MAINDOC,sampleRate:1,bl1:P,_forcePost:!0}),r.reporter._hasCollectResTiming||(r.reporter.report({category:n.RESTIMING,bl1:JSON.stringify(performance.getEntriesByType("resource")),bl2:performance.timeOrigin||performance.timing.fetchStart,_forcePost:!0}),r.reporter._hasCollectResTiming=!0)}try{o.callback&&a(o.callback)&&o.callback(b)}catch(e){this.reporter.print("blank callback error",e)}},s.sendData=function(e){c(e,{category:n.BKPG,sampleRate:this.sampleRate,pluginVer:this.pluginVer}),this.reporter.report(e)},o}(o);return u.pluginId="iTraceBlankPlugin",u}();
