@apm-insight-web/rangers-site-sdk
Advanced tools
Comparing version 0.2.22 to 0.2.23
@@ -1,1 +0,1 @@ | ||
var RangersSiteSDK=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 r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};function e(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var p=function(){return(p=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function a(e,t){var r={};for(o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(r[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var n=0,o=Object.getOwnPropertySymbols(e);n<o.length;n++)t.indexOf(o[n])<0&&Object.prototype.propertyIsEnumerable.call(e,o[n])&&(r[o[n]]=e[o[n]]);return r}function v(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function h(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),a=[];try{for(;(void 0===t||0<t--)&&!(n=i.next()).done;)a.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a}function s(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(h(arguments[t]));return e}function u(e){return"object"==typeof e&&null!==e&&!c(e)}function r(e){return"[object Object]"===(e=e,Object.prototype.toString.call(e))}function f(e){return"function"==typeof e}function m(e){return"[object String]"===Object.prototype.toString.call(e)}function c(e){return"[object Array]"===Object.prototype.toString.call(e)}function l(e){return"number"==typeof e}function d(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function t(e,t){if(u(e))for(var r in e)d(e,r)&&t.call(null,r,e[r])}function i(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var r={},n=0;n<e.length;)r=function(e,t){var r,n=p({},e);for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&void 0!==t[r]&&(u(t[r])&&b(t[r])?n[r]=y(u(e[r])?e[r]:{},t[r]):c(t[r])?n[r]=t[r].slice():n[r]=t[r]);return n}(r,e[n]),n++;return r}function o(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var r={},n=0;n<e.length;)r=y(r,e[n]),n++;return r}var g=Object.getPrototypeOf?Object.getPrototypeOf({}):null;function b(e){return Object.getPrototypeOf?Object.getPrototypeOf(e)===g:e.constructor===Object}function y(e,t){var r,n=p({},e);for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&void 0!==t[r]&&(u(t[r])&&b(t[r])?n[r]=y(u(e[r])?e[r]:{},t[r]):c(e[r])||c(t[r])?n[r]=function t(e,r){var e=c(e)?e:[];var r=c(r)?r:[];return Array.prototype.concat.call(e,r).map(function(e){return!(e instanceof RegExp)&&(c(e)||u(e)&&b(e))?c(e)?t([],e):y({},e):e})}(e[r],t[r]):n[r]=t[r]);return n}function w(e,t){if(!c(e))return!1;if(0===e.length)return!1;for(var r=0;r<e.length;){if(e[r]===t)return!0;r++}return!1}function S(){if("fetch"in window)try{return new Headers,new Request(""),new Response,1}catch(e){return}}function M(){return!!u(window)}function _(){return M()&&!!u(window.performance)}function P(){return _()&&!!u(window.performance.timing)}function E(){return!!_()&&!!f(window.performance.getEntries)}function T(){return M()&&"function"==typeof window.MutationObserver}function k(){return M()&&"function"==typeof window.PerformanceObserver}function R(){return!!k()&&f(window.PerformanceLongTaskTiming)}function C(){if(!k())return!1;var e=window.PerformanceObserverEntryList;return f(e)&&f(e.prototype.getEntries)}function x(e){var r,e=function(e){if(!u(e))return{};var r={};return t(e,function(e,t){u(t)||c(t)?r[e]=JSON.stringify(t):r[e]=t}),r}(e),e=(r={},t(e,function(e,t){r[encodeURIComponent(e)]=encodeURIComponent(t)}),r),n=[];return t(e,function(e,t){n.push(e+"="+t)}),n.join("&")}function L(e){var t=document.createElement("a");t.href=e;e=t.pathname||"/";return"/"!==e[0]&&(e="/"+e),{href:t.href,protocol:t.protocol.slice(0,-1),hostname:t.hostname,host:t.host,search:t.search,pathname:e,hash:t.hash}}var O=function(e){if(!m(e))return!1;return f(e.toLowerCase)&&(e=e.toLowerCase()),w(["x-tt-token"],e)};function q(){}function j(e){var t="[object String]"===Object.prototype.toString.call(e);return e?t?e.length:ArrayBuffer&&e instanceof ArrayBuffer?e.byteLength:window.Blob&&e instanceof Blob?e.size:e.length||0:0}function H(e){if(!e)return"";if(!f(e.forEach))return"";var r=[];return e.forEach(function(e){var t;c(e)&&e[0]&&!O(e[0])&&(t=e[0],e=e[1]||"",r.push(t+": "+e))}),r.join("\r\n")}function A(e){var t={},r=L(e);return t.ax_protocol=r.protocol,t.ax_domain=r.hostname,t.ax_path=r.pathname,t.ax_url=(r.href||e).split("?")[0],t}function I(e,t){e=L(e),t=L(t);return e.protocol===t.protocol&&e.host===t.host}function D(e,t){var r,n;if(!e||!t)return"";var o=e.split(";"),i={};try{for(var a=v(o),s=a.next();!s.done;s=a.next()){var u=s.value.split("="),c=m(u[0])&&u[0].trim();c&&m(u[1])&&(i[c]=u[1].trim())}}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}return i[t]||""}function F(e){return c(e)&&e.length?function(e){for(var t=[],r=e.length,n=0;n<r;n++){var o=e[n];m(o)?t.push(o.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")):o&&o.source&&t.push(o.source)}return new RegExp(t.join("|"),"i")}(e):null}function B(t,r){f(t)&&(f(window.addEventListener)&&(window.addEventListener("unload",t),window.addEventListener("beforeunload",t),window.addEventListener("pagehide",t)),f(document.addEventListener)&&document.addEventListener("visibilitychange",function(e){f(r)?r(e):"hidden"===document.visibilityState&&t(e)}))}var N=function(e){var t,r;return void 0===e&&(e=window),M()&&null!==(t=e.screen)&&void 0!==t&&t.width&&null!==(r=e.screen)&&void 0!==r&&r.height?e.screen.width+"x"+e.screen.height:"0x0"},J=function(){var e="unknown",t=navigator.connection||navigator.mozConnection||navigator.webkitConnection;return t&&m(t.effectiveType)?t.effectiveType:e};function U(e){return!!e&&Math.random()<Number(e)}var X=(Q.post=function(e,t,r){var n=r&&r.success||q,o=r&&r.fail||q,r=new XMLHttpRequest;r.open("POST",e,!0),r.setRequestHeader("Content-Type","application/json"),r.send(JSON.stringify(t)),r.onload=function(){try{var e;this.responseText?(e=JSON.parse(this.responseText),n(e)):n({})}catch(e){o()}},r.onerror=function(){o()},r.onabort=function(){o()}},Q.get=function(e,t){var r=t&&t.success||q,n=t&&t.fail||q,o=t&&t.getResponse||q,i=t&&t.getResponseText||q,a=new XMLHttpRequest;t&&t.withCredentials&&(a.withCredentials=t.withCredentials),a.open("GET",e),a.send(),a.onload=function(){o(null==this?void 0:this.response),i(this.responseText);try{var e;this.responseText?(e=JSON.parse(this.responseText),r(e)):r({})}catch(e){n()}},a.onerror=function(){n()},a.onabort=function(){n()}},Q.prototype.getCommonParams=function(){return{timestamp:Date.now()}},Q);function Q(e){var t=this;this.postEvent=function(e){e=p(p({},e),t.getCommonParams());Q.post(t.url,e)},this.getEvent=function(e){e=x(p(p({},e),t.getCommonParams())),e=t.url+"?"+e;Q.get(e)},this.getURL=function(){return t.url},this.options=e,this.url=this.options.reportURL}function z(e,t,r){if(void 0===r&&(r="0"),1<r.length)throw new TypeError("expect the length of pad to be 1, but got "+e.length);return e.length>=t?e:""+Array.from({length:t-e.length}).fill(r).join("")+e}function V(e){return e?Math.floor(Math.random()*Math.pow(10,12)).toString(16).substr(0,e):""}var K="x-tt-trace-id",W="x-tt-trace-host",G="x-tt-logid";function $(e,t,r){void 0===r&&(r="01");t=""+z((Date.now()%4294967295).toString(16),8)+function(e){if("number"==typeof e)r=e;else{var t=e.replace(/-/g,"");if(!/^[0-9]+$/.test(t)){if(18<t.length)return"18"+V(18);e=22-t.length-4;return""+z(""+t.length,2)+t+V(e)}r=parseInt(t,10)}var r=22-(t=r.toString(16)).length-4;return""+z(""+t.length,2)+t+V(r)}(e)+("string"==typeof t?V(4):z(t.toString(16),4));return"00-"+t+"-"+t.substr(0,16)+"-"+r}function Y(){var e=function(){for(var e=new Array(16),t=0,r=0;r<16;r++)0==(3&r)&&(t=4294967296*Math.random()),e[r]=t>>>((3&r)<<3)&255;return e}();return e[6]=15&e[6]|64,e[8]=63&e[8]|128,function(e){for(var t=[],r=0;r<256;++r)t[r]=(r+256).toString(16).substr(1);var n=0;return[t[e[n++]],t[e[n++]],t[e[n++]],t[e[n++]],"-",t[e[n++]],t[e[n++]],"-",t[e[n++]],t[e[n++]],"-",t[e[n++]],t[e[n++]],"-",t[e[n++]],t[e[n++]],t[e[n++]],t[e[n++]],t[e[+n]],t[e[15]]].join("")}(e)}function Z(){return f(Date)?Math.round(Date.now()/1e3):0}var ee=.1,te=["/log/sentry/"],re=8e3,ne=4e3;Y(),Y();function oe(e,r){if(!u(e))return{};if(!f(r))return{};var n={};return t(e,function(e,t){r(t)&&(n[e]=t)}),n}function ie(e){var t,r,n,o,i=null;return u(e)&&("timer"===e.type&&(i=u(t=e.event)&&m(t.name)&&l(t.value)?{metrics_type:"timer",event_name:"default",metrics:((r={})[t.name]=t.value,r),category:oe(t.tags,m),timestamp:Z()}:{}),"counter"===e.type&&(i=u(o=e.event)&&m(o.name)&&l(o.value)?{metrics_type:"counter",event_name:"default",metrics:((n={})[o.name]=o.value,n),category:oe(o.tags,m),timestamp:Z()}:{}),"log"===e.type&&(i=u(n=e.event)&&m(n.value)?{metrics_type:"log",event_name:"default",log_content:n.value,log_level:null!==(o=n.level)&&void 0!==o?o:"info",category:oe(n.tags,m),timestamp:Z()}:{}),"custom"===e.type&&(i=u(e=e.event)&&m(e.event_name)?{metrics_type:"custom",event_name:e.event_name,metrics:oe(e.metrics,l),category:oe(e.tags,m),timestamp:Z()}:{})),i}var ae="AjaxMonitor",se=(ue.prototype.setup=function(e){void 0===e&&(e=q),f(XMLHttpRequest)&&(this.callback=e,this.start())},ue.prototype.updateConfig=function(e){this.props=o({},this.props,e)},ue.prototype.start=function(){this.hookXMLHttpRequestOpen(),this.hookXMLHttpRequestSend(),this.hookXMLHttpRequestSetRequestHeader()},ue.prototype.hookXMLHttpRequestSetRequestHeader=function(){var r=XMLHttpRequest.prototype.setRequestHeader||q;XMLHttpRequest.prototype.setRequestHeader=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this._requestHeaders=this._requestHeaders||[],this._requestHeaders.push(e),r.apply(this,e)}},ue.prototype.hookXMLHttpRequestOpen=function(){var o=XMLHttpRequest.prototype.open;XMLHttpRequest.prototype.open=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=e[0],n=e[1];return this._url=n||"",this._method=(null==r?void 0:r.toLowerCase())||"",o.apply(this,e)}},ue.prototype.hookXMLHttpRequestSend=function(){var o=this,i=XMLHttpRequest.prototype.send;XMLHttpRequest.prototype.send=function(){for(var e,t,r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];return o.checkAddTrace(this._url)&&(e=(t=null!==(e=null==o?void 0:o.props.commonParams)&&void 0!==e?e:{}).bid,t=t.web_id,e&&t&&(o.traceId=$(t,e),this.setRequestHeader(K,o.traceId))),o.hookXMLHttpRequestOnreadystatechange.call(this,o),this._start=Date.now(),this._data=null==r?void 0:r[0],i.apply(this,r)}},ue.prototype.checkAddTrace=function(e){var t=null!==(n=this.props.commonParams)&&void 0!==n?n:{},r=t.bid,n=t.web_id,t=(null!==(t=this.props.ajaxMonitorOptions)&&void 0!==t?t:{}).sampleHitTrace,e=I(location.href,e);return r&&n&&t&&e},ue.prototype.collectErrorRequest=function(){var e;return null!==(e=null===(e=this.props.ajaxMonitorOptions)||void 0===e?void 0:e.errorRequestCollect)&&void 0!==e&&e},ue.prototype.hookXMLHttpRequestOnreadystatechange=function(i){var a=this.onreadystatechange,s=this;this.onreadystatechange=function(){for(var e,t,r,n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];if(4===this.readyState&&(t={ev_type:"ajax",ax_status:(this.status||0).toString(),ax_type:s._method,ax_request_header:H(s._requestHeaders||[]),ax_domain:"",ax_duration:0,ax_path:"",ax_protocol:"",ax_response_header:"",ax_size:0,ax_url:""},"function"==typeof this.getAllResponseHeaders&&(t.ax_response_header=function(t){if(m(t)){var e=t.split("\r\n"),r=[];return e.forEach(function(e,t){e&&f(e.split)&&(e=e.split(": "),r.push([e[0],e[1]]))}),H(r)}return u(t)?H(Object.keys(t).map(function(e){return[e,t[e]]})):t}(this.getAllResponseHeaders())),!i.checkAddTrace(s._url)||(r=null!==(r=i.traceId)&&void 0!==r?r:this.getResponseHeader(K))&&(t.trace_id=r,t.trace_host=null!==(e=this.getResponseHeader(W))&&void 0!==e?e:void 0,t.log_id=null!==(e=this.getResponseHeader(G))&&void 0!==e?e:void 0),t.ax_duration=Date.now()-s._start,200===this.status&&(t.ax_size=function(e){var t=0;if(""===e.responseType||"text"===e.responseType)t=j(e.responseText);else if(e.response)t=j(e.response);else try{t=j(e.responseText)}catch(e){t=0}return t}(this)),t=p(p({},t),A(s._url)),i.collectErrorRequest()&&"2"!==t.ax_status[0]&&"3"!==t.ax_status[0]&&(t.ax_request={body:s._data?""+s._data:void 0,search:null===(e=L(s._url))||void 0===e?void 0:e.search,content_type:null===(e=null===(e=s._requestHeaders)||void 0===e?void 0:e.find(function(e){return"content-type"===e[0].toLowerCase()}))||void 0===e?void 0:e[1]}),f(i.callback)&&i.callback({name:i.name,type:"get",event:t})),a)return a.apply(this,n)}},ue.monitorName=ae,ue);function ue(e){this.name=ae,this.callback=q,this.traceId=null,this.props=e}function ce(e){return e instanceof Request}var le="FetchMonitor",pe=(he.prototype.updateConfig=function(e){this.props=o({},this.props,e)},he.prototype.setup=function(e){void 0===e&&(e=q),S()&&(this.callback=e,this.start())},he.prototype.start=function(){S()&&this.hookFetch()},he.prototype.checkAddTrace=function(e){var t=null!==(n=null===(r=this.props)||void 0===r?void 0:r.commonParams)&&void 0!==n?n:{},r=t.bid,n=t.web_id,t=(null!==(t=null===(t=null==this?void 0:this.props)||void 0===t?void 0:t.ajaxMonitorOptions)&&void 0!==t?t:{}).sampleHitTrace,e=I(location.href,e);return r&&n&&t&&e},he.prototype.updateAxRequest=function(e,t,r){var n,o;this.collectErrorRequest()&&"2"!==e.ax_status[0]&&"3"!==e.ax_status[0]&&(o=this.getFetchUrl(t,!0),e.ax_request={body:null===(t=this.getFetchBody(t,r))||void 0===t?void 0:t.toString(),search:!m(o)||null===(n=L(o))||void 0===n?void 0:n.search,content_type:null===(r=null==r?void 0:r.headers)||void 0===r?void 0:r["Content-Type"]})},he.prototype.collectErrorRequest=function(){var e;return null!==(e=null===(e=this.props.ajaxMonitorOptions)||void 0===e?void 0:e.errorRequestCollect)&&void 0!==e&&e},he.prototype.hookFetch=function(){var u=this,c=this,l=window.fetch;window.fetch=function(n,o){void 0===o&&(o={});var i=u.getFetchUrl(n);if(!function(e){if(m(e)){var t=h(e.split(":"),2),e=t[0];return!t[1]||("http"===e||"https"===e)}}(i))return l(n,o);var e=null!==(e=u.props.commonParams)&&void 0!==e?e:{},t=e.bid,r=e.web_id,a=Date.now(),s={ev_type:"ajax"};try{c.checkAddTrace(i)&&(o.headers=new Headers(function(e,t){var r=new Headers;ce(e)&&e.headers&&f(e.headers.forEach)&&e.headers.forEach(function(e,t){r.append(t,e)});t.headers&&new Headers(t.headers).forEach(function(e,t){r.append(t,e)});return r}(n,o)),t&&r&&(s.trace_id=$(t,r),o.headers.append(K,s.trace_id)))}catch(e){}return s.ax_type=u.getFetchMethod(n,o),s=p(p({},s),A(i)),l(n,o).then(function(e){var t,r;return s.ax_status=(e.status||0).toString(),s.ax_duration=Date.now()-a,s.ax_response_header=c.getAllHeaders(e.headers),s.ax_request_header=c.getAllHeaders(o.headers),e.headers&&f(e.headers.has)?(e.headers.has("content-length")?s.ax_size=Number(e.headers.get("content-length"))||0:s.ax_size=0,c.checkAddTrace(i)&&(e.headers.has(W)&&(s.trace_host=null!==(t=e.headers.get(W))&&void 0!==t?t:void 0),e.headers.has(K)&&(s.trace_id=null!==(r=e.headers.get(K))&&void 0!==r?r:void 0),e.headers.has(G)&&(s.log_id=null!==(r=e.headers.get(G))&&void 0!==r?r:void 0))):s.ax_size=0,u.updateAxRequest(s,n,o),f(c.callback)&&c.callback({name:c.name,type:"get",event:s}),e},function(e){return s.ax_status="0",s.ax_size=0,s.ax_duration=Date.now()-a,u.updateAxRequest(s,n,o),f(c.callback)&&c.callback({name:c.name,type:"get",event:s}),Promise.reject(e)})}},he.prototype.getFetchUrl=function(e,t){void 0===t&&(t=!1);var r="",r=ce(e)?e.url:e;return t||(r=m(r)?r.split("?")[0]:r),r},he.prototype.getFetchMethod=function(e,t){t=null!==(t=null==t?void 0:t.method)&&void 0!==t?t:"get";return ce(e)&&(t=null!==(e=e.method)&&void 0!==e?e:t),t.toLowerCase()},he.prototype.getFetchBody=function(e,t){return ce(e)?e.body:null==t?void 0:t.body},he.prototype.getAllHeaders=function(e){if(!e||"function"!=typeof e.forEach)return"";var r=[];return e.forEach(function(e,t){r.push([t,e])}),H(r)},he.monitorName=le,he);function he(e){this.name=le,this.callback=q,this.props=e}var fe="FMPMonitor",me=(de.prototype.setup=function(e){if(M())return T()?void(f(document.querySelector)&&(this.callback=e&&f(e)?e:function(){},this.startTime=Date.now(),this.list=[],f(this.observer.observe)&&this.observer.observe(document,{childList:!0,subtree:!0}))):null},de.prototype.count=function(){var e=Date.now()-this.startTime,t=document.querySelector("body");t?this.list.push({score:this.score(t,1,!1),time:e}):this.list.push({score:0,time:e})},de.prototype.score=function(e,t,r){var n,o=0,i=e.tagName;if("SCRIPT"!==i&&"STYLE"!==i&&"META"!==i&&"HEAD"!==i&&!w((null===(n=this.props)||void 0===n?void 0:n.ignoreTags)||[],i)){i=e.children?e.children.length:0;if(0<i)for(var a=e.children,s=i-1;0<=s;s--)o+=this.score(a[s],t+1,0<o);if(o<=0&&!r){if(!e.getBoundingClientRect||!f(e.getBoundingClientRect))return 0;e=e.getBoundingClientRect();if(!e)return 0;if(e.top>window.innerHeight)return 0;if(e.height<=0)return 0}o+=1+.5*t}return o},de.prototype.getFmpInternal=function(){if(!this.observer)return 0;if(this.disconnect(),!this.list.length)return 0;for(var e,t={time:this.list[0].time,rate:0},r=1;r<this.list.length;r++)this.list[r].time>=this.list[r-1].time&&(e=this.list[r].score-this.list[r-1].score,t.rate<e&&(t={time:this.list[r].time,rate:e}));return t.time},de.prototype.getTimeGap=function(){return P()?this.startTime-performance.timing.navigationStart:0},de.prototype.formatEvent=function(e){return{name:this.name,type:"post",event:{ev_type:"fmp",fmp:e}}},de.monitorName=fe,de);function de(e){var r=this;this.name=fe,this.callback=q,this.disconnect=function(){var e,t;null!==(t=null===(e=r.observer)||void 0===e?void 0:e.disconnect)&&void 0!==t&&t.call(e)},this.getLoadFmp=function(){var e=r.getFmpInternal(),e=e?r.getTimeGap()+e:0,e=r.formatEvent(e);return r.callback(e),e},this.getFmp=function(){var e=r.getFmpInternal(),e=r.formatEvent(e);return r.callback(e),e},this.props=e,this.startTime=Date.now(),this.list=[],this.observer=new MutationObserver(this.count.bind(this))}function ve(){}var ge=!1,be=!1,ye={uniqueId:0,originals:{},proxies:{},patchXMLHTTPRequest:function(i){this.originals.send=XMLHttpRequest.prototype.send,XMLHttpRequest.prototype.send=function(){for(var t=this,e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];var n=ye.uniqueId++;i.beforeCb(n);var o=this.onreadystatechange;return this.onreadystatechange=function(e){null!=o&&o.call(t,e),4===t.readyState&&i.afterCb(n)},ye.originals.send.apply(this,e)},this.proxies.send=XMLHttpRequest.prototype.send},patchFetch:function(o){var i;S()&&(i=window.fetch,this.originals.fetch=i,window.fetch=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return new Promise(function(t,r){var n=ye.uniqueId++;o.beforeCb(n),i.apply(void 0,s(e)).then(function(e){o.afterCb(n),t(e)},function(e){o.afterCb(n,e),r(e)})})},this.proxies.fetch=window.fetch)},observeResourceFetchingMutations:function(a){if(T()){var s=["img","script","iframe","link","audio","video","source"],e=new MutationObserver(function(e){var t,r;try{for(var n=v(e),o=n.next();!o.done;o=n.next()){var i=o.value;("childList"===i.type&&function e(t,r){var n,o;try{for(var i=v(t),a=i.next();!a.done;a=i.next()){var s=a.value;if(r.includes(s.nodeName.toLowerCase())||s.children&&e(s.children,r))return 1}}catch(e){n={error:e}}finally{try{a&&!a.done&&(o=i.return)&&o.call(i)}finally{if(n)throw n.error}}}(i.addedNodes,s)||"attributes"===i.type&&s.includes(i.target.nodeName.toLowerCase()))&&a(i)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}});return e.observe(document,{attributes:!0,childList:!0,subtree:!0,attributeFilter:["href","src"]}),e}},resetOriginals:function(){this.originals.send&&XMLHttpRequest.prototype.send===this.proxies.send&&(ge=!1,XMLHttpRequest.prototype.send=this.originals.send),this.originals.fetch&&fetch===this.proxies.fetch&&(be=!1,window.fetch=this.originals.fetch)}},we="TTIMonitor",Se=(Me.prototype.setup=function(){},Me.prototype.isEnable=function(){return R()&&!!k()&&f(window.PerformanceResourceTiming)&&C()},Me.prototype.registerPerformanceObserver=function(){var s=this;this.performanceObserver=new PerformanceObserver(function(e){var t,r,n=e.getEntries();try{for(var o=v(n),i=o.next();!i.done;i=o.next()){var a=i.value;"resource"===a.entryType&&s.networkRequestFinishedCallback(a),"longtask"===a.entryType&&s.longTaskFinishedCallback(a)}}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}});try{this.performanceObserver.observe({type:"longtask"}),this.performanceObserver.observe({type:"resource",buffered:!0})}catch(e){this.performanceObserver.observe({entryTypes:["longtask","resource"]})}},Me.prototype.unregisterListeners=function(){this.performanceObserver&&this.performanceObserver.disconnect(),this.mutationObserver&&this.mutationObserver.disconnect(),ye.resetOriginals(),this.proxyConfig&&(this.proxyConfig.beforeCb=ve,this.proxyConfig.afterCb=ve)},Me.prototype.rescheduleTimer=function(e){var t=this;this.scheduleTimerTasks&&(this.timerActivationTime>e||(clearTimeout(this.timerId),this.timerId=window.setTimeout(function(){t.checkTTI()},e-performance.now()),this.timerActivationTime=e))},Me.prototype.startSchedulingTimerTasks=function(){this.scheduleTimerTasks=!0;var e=0<this.longTasks.length?this.longTasks[this.longTasks.length-1].end:0,t=this.computeLastKnownNetwork2Busy(this.incompleteRequestStarts,this.networkRequests);this.rescheduleTimer(Math.max(t+5e3,e))},Me.prototype.registerListeners=function(){ge||(ye.patchXMLHTTPRequest(this.proxyConfig),ge=!0),be||(ye.patchFetch(this.proxyConfig),be=!0),this.registerPerformanceObserver(),this.useMutationObserver&&(this.mutationObserver=ye.observeResourceFetchingMutations(this.mutationObserverCallback.bind(this)))},Me.prototype.mutationObserverCallback=function(e){this.rescheduleTimer(performance.now()+5e3)},Me.prototype.beforeJSInitiatedRequestCallback=function(e){this.incompleteJSInitiatedRequestStartTimes[e]=performance.now()},Me.prototype.afterJSInitiatedRequestCallback=function(e){this.incompleteJSInitiatedRequestStartTimes[e]=void 0},Me.prototype.networkRequestFinishedCallback=function(e){this.networkRequests.push({start:e.fetchStart,end:e.responseEnd}),this.rescheduleTimer(this.computeLastKnownNetwork2Busy(this.incompleteRequestStarts,this.networkRequests)+5e3)},Object.defineProperty(Me.prototype,"incompleteRequestStarts",{get:function(){for(var e=Object.keys(this.incompleteJSInitiatedRequestStartTimes),t=[],r=0;r<e.length;r++){var n=this.incompleteJSInitiatedRequestStartTimes[e[r]];"number"==typeof n&&t.push(n)}return t},enumerable:!1,configurable:!0}),Me.prototype.longTaskFinishedCallback=function(e){var t=e.startTime+e.duration;this.longTasks.push({start:e.startTime,end:t}),this.rescheduleTimer(t+5e3)},Me.prototype.checkTTI=function(){var e=this.computeLastKnownNetwork2Busy(this.incompleteRequestStarts,this.networkRequests),t=this.getFirstPaintTime()||performance.timing.domContentLoadedEventEnd-performance.timing.navigationStart,r=this.getMinValue(),n=performance.now();null===r&&this.rescheduleTimer(Math.max(e+5e3,n+1e3));n=this.computeTTI(t,r,e,n,this.longTasks);n?(this.callback&&"function"==typeof this.callback&&this.callback(Math.round(n)),this.disable()):this.rescheduleTimer(performance.now()+1e3)},Me.prototype.getMinValue=function(){if(this.minValue)return this.minValue;if(performance.timing.domContentLoadedEventEnd){var e=performance.timing;return e.domContentLoadedEventEnd-e.navigationStart}return null},Me.prototype.getFirstPaintTime=function(){if("PerformancePaintTiming"in window){var e=performance.getEntriesByType("paint")[0];return e?e.startTime:0}return 0},Me.prototype.disable=function(){clearTimeout(this.timerId),this.scheduleTimerTasks=!1,this.unregisterListeners(),this.snippetObserver&&this.snippetObserver.disconnect(),this.snippetEntries&&this.snippetEntries.splice(0,this.snippetEntries.length)},Me.prototype.computeLastKnownNetwork2Busy=function(e,t){var r,n,o,i;if(2<e.length)return performance.now();var a=[];try{for(var s=v(t),u=s.next();!u.done;u=s.next()){var c=u.value;a.push({timestamp:c.start,type:"requestStart"}),a.push({timestamp:c.end,type:"requestEnd"})}}catch(e){r={error:e}}finally{try{u&&!u.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}try{for(var l=v(e),p=l.next();!p.done;p=l.next()){var h=p.value;a.push({timestamp:h,type:"requestStart"})}}catch(e){o={error:e}}finally{try{p&&!p.done&&(i=l.return)&&i.call(l)}finally{if(o)throw o.error}}a.sort(function(e,t){return e.timestamp-t.timestamp});for(var f=e.length,m=a.length-1;0<=m;m--){var d=a[m];switch(d.type){case"requestStart":f--;break;case"requestEnd":if(2<++f)return d.timestamp;break;default:throw Error("Internal Error: This should never happen")}}return 0},Me.monitorName=we,Me);function Me(e){var t,r,n,o=this;if(this.name=we,this.longTasks=[],this.callback=ve,this.useMutationObserver=!0,this.minValue=null,this.isAsync=0,this.networkRequests=[],this.incompleteJSInitiatedRequestStartTimes={},this.timerActivationTime=-1/0,this.scheduleTimerTasks=!1,this.proxyConfig={beforeCb:this.beforeJSInitiatedRequestCallback.bind(this),afterCb:this.afterJSInitiatedRequestCallback.bind(this)},this.getTTI=function(e){o.callback=e,o.isEnable()?o.startSchedulingTimerTasks():o.callback&&"function"==typeof o.callback&&o.callback()},this.computeTTI=function(e,t,r,n,o){if(n-r<5e3)return null;o=0===o.length?e:o[o.length-1].end;return n-o<5e3?null:Math.max(o,t)},this.isEnable()){if(this.useMutationObserver=!!e.useMutationObserver,this.minValue=null!==(n=e.minValue)&&void 0!==n?n:null,this.isAsync=null!==(n=e.isAsync)&&void 0!==n?n:0,this.snippetEntries=null===(n=null==e?void 0:e.preLongTaskObserver)||void 0===n?void 0:n.precollect,this.snippetObserver=null===(e=null==e?void 0:e.preLongTaskObserver)||void 0===e?void 0:e.observer,!this.isAsync&&this.snippetEntries&&0<this.snippetEntries.length)try{for(var i=v(this.snippetEntries),a=i.next();!a.done;a=i.next()){var s=a.value;"longtask"===s.entryType?this.longTasks.push({start:s.startTime,end:s.startTime+s.duration}):"resource"===s.entryType&&this.networkRequests.push({start:s.fetchStart,end:s.responseEnd})}}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}this.registerListeners()}}function _e(e){try{for(var t,r=e,n=[],o=0,i=0,a=" > ".length;r&&o++<5&&!("html"===(t=function(e){var t,r,n,o,i=e,a=[];if(!i||!i.tagName)return"";a.push(i.tagName.toLowerCase()),i.id&&a.push("#"+i.id);e=i.className;if(e&&m(e))for(t=e.split(/\s+/),o=0;o<t.length;o++)a.push("."+t[o]);var s=["type","name","title","alt"];for(o=0;o<s.length;o++)r=s[o],(n=i.getAttribute(r))&&a.push("["+r+'="'+n+'"]');return a.join("")}(r))||1<o&&80<=i+n.length*a+t.length);)n.push(t),i+=t.length,r=r.parentNode;return n.reverse().join(" > ")}catch(e){return"<unknown>"}}var Pe="FIDMonitor",Ee=(Te.prototype.setup=function(e){var s=this;if(k()&&PerformanceObserver.supportedEntryTypes&&PerformanceObserver.supportedEntryTypes.includes("first-input")&&C()){this.callback=e,this.observer=new PerformanceObserver(function(e,t){var r,n;try{for(var o=v(e.getEntries()),i=o.next();!i.done;i=o.next()){var a=i.value,a=a.processingStart-a.startTime;s.callback({name:s.name,fid:Math.round(a)})}}catch(e){r={error:e}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}t.disconnect()});try{this.observer.observe({type:"first-input",buffered:!0})}catch(e){this.observer.observe({entryTypes:["first-input"]})}}},Te.monitorName=Pe,Te);function Te(){this.name=Pe,this.callback=q}var ke="MPFIDMonitor",Re=(Ce.prototype.setup=function(){var t,e,r,a=this;if(R()&&C()){if(!this.props.isAsync){var n=null!==(r=null===(r=this.props.preLongTaskObserver)||void 0===r?void 0:r.precollect)&&void 0!==r?r:[];if(n&&0<n.length)try{for(var o=v(n),i=o.next();!i.done;i=o.next()){var s=i.value;"longtask"===s.entryType&&this.list.push(s)}}catch(e){t={error:e}}finally{try{i&&!i.done&&(e=o.return)&&e.call(o)}finally{if(t)throw t.error}}}this.observer=new PerformanceObserver(function(e){var t,r;try{for(var n=v(e.getEntries()),o=n.next();!o.done;o=n.next()){var i=o.value;a.list.push(i)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}}),this.observer.observe({entryTypes:["longtask"]})}},Ce.prototype.getMPFID=function(){var t,e;if(R()&&C()){this.observer&&this.observer.disconnect();var r=0;try{for(var n=v(this.list),o=n.next();!o.done;o=n.next()){var i=o.value;r<i.duration&&(r=i.duration)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(t)throw t.error}}return this.formatEvent(Math.round(r))}},Ce.prototype.formatEvent=function(e){return{name:this.name,mpfid:e}},Ce.monitorName=ke,Ce);function Ce(e){this.name=ke,this.list=[],this.props=e}var xe=["xmlhttprequest","fetch"],Le="ResourcePerformanceMonitor",Oe=(qe.prototype.setup=function(e){this.isEnable()&&(this.callback=null!=e?e:q,this.isAsync&&window.performance.clearResourceTimings(),this.observe&&(this.sendResourcePerformance(performance.getEntriesByType("resource")),this.observePerformance()))},qe.prototype.isEnable=function(){return E()&&"function"==typeof performance.clearResourceTimings},qe.prototype.getPerformance=function(){return this.isEnable()?this.buildParams(this.getResources()):this.buildParams([])},qe.prototype.buildParams=function(e){var t=this,r=[];if(e.forEach(function(e){w(xe,e.initiatorType)||f(t.checkIgnore)&&t.checkIgnore(e)||r.push(e)}),r.length)return{name:this.name,type:"post",event:{ev_type:"resource_performance",resources:r}}},qe.prototype.sendResourcePerformance=function(e){e=this.buildParams(e);e&&this.callback(e)},qe.prototype.getResources=function(){return window.performance.getEntriesByType("resource")},qe.prototype.observePerformance=function(){var t=this;k()&&new PerformanceObserver(function(e){e=e.getEntries();e.length&&t.sendResourcePerformance(e)}).observe({entryTypes:["resource"]})},qe.monitorName=Le,qe);function qe(e){var t,r=this;this.name=Le,this.callback=q,this.getResourcePerformance=function(){var e;return null!==(e=r.getPerformance())&&void 0!==e?e:{}},this.isAsync=null!==(t=null==e?void 0:e.isAsync)&&void 0!==t?t:0,this.observe=null!==(t=null==e?void 0:e.observe)&&void 0!==t&&t,this.checkIgnore=null!==(e=null==e?void 0:e.checkIgnore)&&void 0!==e?e:function(){return!1}}var je={ev_type:"perf",isAsync:0,dns:0,tcp:0,request:0,response:0,processing:0,blank:0,domready:0,load:0,has_resource:0,domparse:0,resource:0,ttfb:0,redirect:0,tti:0,upload_reason:"sample",network_type:"",timing:{},navigation_timing:{},navigation:{},resources:[]},He="PerformanceMonitor",Ae=(Ie.prototype.setup=function(e){var t,r=this;P()&&(this.callback=e,t=function(){r.hasLoaded=!0,r.performanceAuto&&(r.perfTimer=setTimeout(function(){r.perfLog()},200))},"complete"!==document.readyState?window.addEventListener("load",function(){setTimeout(function(){t()},0)},!1):t(),this.sendParams=p({},je),this.staticPerformanceMonitor=new Oe,this.staticPerformanceMonitor.setup(),(new Ee).setup(this.hasFID),this.mpfidMonitor=new Re({isAsync:0,preLongTaskObserver:this.props.preLongTaskObserver}),this.mpfidMonitor.setup(),e=null!==(e=this.props.TTIMonitor)&&void 0!==e?e:Se,this.ttiMonitor=new e({isAsync:0,preLongTaskObserver:this.props.preLongTaskObserver}),this.ttiMonitor.setup(),e=this.syncPerfLog.bind(this),B(e))},Ie.prototype.performanceNow=function(){var e;return null!==performance&&void 0!==performance&&performance.now?performance.now():(Date.now?Date.now():+new Date)-(null!==(e=null===(e=performance.timing)||void 0===e?void 0:e.navigationStart)&&void 0!==e?e:0)},Ie.prototype.getBounced=function(){return!this.hasLoaded},Ie.prototype.getPaintTime=function(t){if(E()){var e=performance.getEntriesByType("paint");if(c(e)){e=e.filter(function(e){return e.name===t});return e.length&&e[0]&&u(e[0])&&e[0].startTime||0}}return 0},Ie.monitorName=He,Ie);function Ie(e){var o=this;this.name=He,this.callback=q,this.sendParams=p({},je),this.finalSendParams=this.sendParams,this.hasLoaded=!1,this.initStart=0,this.hasSentInitPerf=!1,this.initFlag=!0,this.performanceAuto=!0,this.send=function(){o.initFlag&&o.hasLoaded&&(o.sendParams.isAsync&&(o.sendParams.load=Math.round(o.performanceNow()-o.initStart)),setTimeout(function(){o.perfLog()},200))},this.initAsync=function(){var e,t;o.hasSentInitPerf&&(o.sendParams=p({},je),o.sendParams.isAsync=1,o.initFlag=!0,o.initStart=o.performanceNow(),o.staticPerformanceMonitor=new Oe({isAsync:1}),o.staticPerformanceMonitor.setup(),o.mpfidMonitor=new Re({isAsync:1,preLongTaskObserver:o.props.preLongTaskObserver}),o.mpfidMonitor.setup(),t=null!==(e=o.props.TTIMonitor)&&void 0!==e?e:Se,o.ttiMonitor=new t({minValue:Math.round(o.performanceNow()),isAsync:1,preLongTaskObserver:o.props.preLongTaskObserver}),o.ttiMonitor.setup(),null!==(t=null===(e=o.fmpMonitor)||void 0===e?void 0:e.setup)&&void 0!==t&&t.call(e,q))},this.stopAutoPerf=function(){o.performanceAuto=!1,clearTimeout(o.perfTimer)},this.getPerformance=function(){return o.finalSendParams.tti||("complete"===document.readyState?o.perfLog():o.perfLog(!0)),o.buildParams(o.finalSendParams)},this.buildParams=function(e){return{name:o.name,type:"post",event:e}},this.perfLog=function(e){if(void 0===e&&(e=!1),P()){if(o.initFlag=!1,o.finalSendParams=p({},o.sendParams),!o.sendParams.isAsync){var t=o.getBounced();if(t)return o.finalSendParams.bounced=t,void o.invokeCallback(0,o.buildParams(o.finalSendParams));o.finalSendParams=p(p({},o.finalSendParams),o.getParams())}var r=o.getStaticResources(),n=o.getFMP(),t=o.getMPFID();r&&(o.finalSendParams.resources=r,o.finalSendParams.has_resource=1),n&&(o.finalSendParams.fmp=Math.round(n)),n&&o.finalSendParams.fcp&&o.finalSendParams.fmp<o.finalSendParams.fcp&&(o.finalSendParams.fmp=o.finalSendParams.fcp),t&&(o.finalSendParams.mpfid=t),f(o.callback)&&(!e&&o.ttiMonitor&&f(o.ttiMonitor.getTTI)?o.ttiMonitor.getTTI(function(e){e&&0<e&&(o.finalSendParams.tti=o.finalSendParams.isAsync?Math.round(e-o.initStart):e),o.invokeCallback(o.finalSendParams.isAsync,o.buildParams(o.finalSendParams))}):o.invokeCallback(o.finalSendParams.isAsync,o.buildParams(o.finalSendParams)))}},this.invokeCallback=function(e,t){if(!e){if(o.hasSentInitPerf)return;o.hasSentInitPerf=!0}o.callback(t)},this.getStaticResources=function(){var e;if(o.staticPerformanceMonitor&&f(o.staticPerformanceMonitor.getResourcePerformance)){var t=o.staticPerformanceMonitor.getResourcePerformance();if(null!==(e=null==t?void 0:t.event)&&void 0!==e&&e.resources)return t.event.resources||[]}},this.getFMP=function(){var e,t;return o.fmpMonitor?(o.fmpMonitor.disconnect(),o.sendParams.isAsync?(null===(e=null==(t=o.fmpMonitor.getFmp())?void 0:t.event)||void 0===e?void 0:e.fmp)||0:f(o.fmpMonitor.getLoadFmp)?1!==o.props.renderType?2===o.props.renderType?o.getPaintTime("first-contentful-paint"):0:null!==(t=null===(t=(t=o.fmpMonitor.getLoadFmp()||{}).event)||void 0===t?void 0:t.fmp)&&void 0!==t?t:0:0):0},this.getMPFID=function(){if(o.mpfidMonitor&&f(o.mpfidMonitor.getMPFID)){var e=o.mpfidMonitor.getMPFID();if(e)return e.mpfid}},this.syncPerfLog=function(){var e,t;o.hasSentInitPerf||(o.perfLog(!0),null!==(t=(e=o.props).report)&&void 0!==t&&t.call(e))},this.hasFID=function(e){o.sendParams.fid=e.fid},this.getParams=function(){if(P()){var e={},t=window.performance.timing;e.dns=t.domainLookupEnd-t.domainLookupStart,e.tcp=t.connectEnd-t.connectStart,e.request=t.responseStart-t.requestStart,e.response=t.responseEnd-t.responseStart,e.processing=t.domComplete-t.domLoading,e.blank=t.responseEnd-t.navigationStart,e.domready=t.domInteractive-t.navigationStart,e.load=t.loadEventEnd-t.navigationStart,t.secureConnectionStart&&(e.ssl=t.connectEnd-t.secureConnectionStart),e.domparse=t.domInteractive-t.responseEnd,e.resource=t.loadEventStart-t.domContentLoadedEventEnd,e.ttfb=t.responseStart-t.requestStart,e.redirect=t.redirectEnd-t.redirectStart;var r=o.getPaintTime("first-paint"),t=o.getPaintTime("first-contentful-paint");r&&(e.fp=Math.round(r)),t&&(e.fcp=Math.round(t));r=function(){if(!E())return null;var e=window.performance.getEntriesByType("navigation");return c(e)&&0!==e.length?e[0]:null}(),t=P()?window.performance.timing:null;return(r||t)&&(e.navigation=null!=r?r:t),t&&(e.timing=t),r&&(e.navigation_timing=r),e}},e.fmpMonitor&&(this.fmpMonitor=e.fmpMonitor);var t=e.performanceAuto;this.performanceAuto=void 0===t||t,this.props=null!=e?e:{}}var De="StaticErrorMonitor",Fe=(Be.prototype.setup=function(e){M()&&(this.callback=e,window.addEventListener("error",this.staticErrorLog.bind(this),!0))},Be.prototype.getSrc=function(e){return"link"===e.tagName.toLowerCase()?Ne(e,"href"):Ne(e,"src")},Be.prototype.getParams=function(e,t){var r={ev_type:"static",st_type:t},t=L(e);r.st_src=e,r.st_protocol=t.protocol,r.st_domain=t.hostname,r.st_path=t.pathname;t=function(e){var t,r=null===(t=null===(n=window.performance)||void 0===n?void 0:n.getEntriesByType)||void 0===t?void 0:t.call(n,"resource"),n=null==r?void 0:r.length;if(!n)return;for(var o=n-1;-1<o;o--){var i=r[o];if(i.name===e)return i}}(t.href);return t&&(r.timing=t),r},Be.monitorName=De,Be);function Be(){var i=this;this.name=De,this.callback=q,this.buildEvent=function(e){var t,r,n=e||window.event||{};try{r=null!==(t=null!==(t=n.target)&&void 0!==t?t:n.srcElement)&&void 0!==t?t:{}}catch(n){return}var o=r.tagName;if(o&&m(o)){o=o.toLowerCase();e=i.getSrc(r);if(e&&e!==window.location.href)return{name:i.name,type:"get",event:i.getParams(e,o)}}},this.staticErrorLog=function(e){e=i.buildEvent(e);e&&i.callback(e)}}function Ne(e,t){var r;return e.getAttribute&&f(e.getAttribute)?null!==(r=e.getAttribute(t))&&void 0!==r?r:"":null!==(t=e[t])&&void 0!==t?t:""}var Je="EmitMonitor",Ue=(Xe.prototype.setup=function(e){this.callback=e||q},Xe.prototype.buildCustomTimeLog=function(e,t,r){return function(e){var t=e.name,r=e.tag,e=e.value;if(t&&e){e={ev_type:"custom",cm_name:t=f(t.toString)?t.toString():"",cm_type:"time",cm_value:e=+e};return r&&(r=f(r.toString)?r.toString():"",e.cm_tag=r),{name:"SentCustomTime",type:"get",event:e}}}({name:e,tag:t,value:r})},Xe.prototype.buildCustomCountLog=function(e,t){return function(e){var t=e.name,e=e.tag;if(t){t={ev_type:"custom",cm_name:t=f(t.toString)?t.toString():"",cm_type:"count"};return e&&(e=f(e.toString)?e.toString():"",t.cm_tag=e),{name:"SentCustomCount",type:"get",event:t}}}({name:e,tag:t})},Xe.prototype.buildEmitSingleEvent=function(e){e=ie(e);if(e&&(!e||e.event_name))return{name:this.name,type:"post",event:{ev_type:"flexible",flexible_data_list:[e]}}},Xe.monitorName=Je,Xe);function Xe(){var o=this;this.name=Je,this.callback=q,this.handOut=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=o.buildEvent.apply(o,s(e));o.callback(r)},this.buildEvent=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if("sendCustomCountLog"===e[0])return o.buildCustomCountLog(e[1],e[2]);if("sendCustomTimeLog"===e[0])return o.buildCustomTimeLog(e[1],e[2],e[3]);if("send"===e[0]){if("count"===e[1])return o.buildCustomCountLog(e[2].category,e[2].action);if("timing"===e[1])return o.buildCustomTimeLog(e[2].category,e[2].action,e[2].value)}if("emit"===e[0]&&e[1]&&e[2]){var r={type:e[1],event:e[2]};return o.buildEmitSingleEvent(r)}},this.send=function(e,t,r){var n=r.action,r=r.value;"count"===e&&o.sendCustomCountLog(t,n),"timing"===e&&o.sendCustomTimeLog(t,n,r)},this.sendCustomTimeLog=function(e,t,r){r=o.buildCustomTimeLog(e,t,r);o.callback(r)},this.sendCustomCountLog=function(e,t){t=o.buildCustomCountLog(e,t);return o.callback(t),t},this.emitEvent=function(e){e=o.buildEmitSingleEvent(e);o.callback(e)}}var Qe="BreadcrumbMonitor",ze=(Ve.prototype.setup=function(){this.instrumentDOM()},Ve.prototype.instrumentDOM=function(){var e;"document"in window&&(e=this,window.document.addEventListener("click",e.domEventHandler("click",e.triggerHandlers.bind(e,"dom")),!1),window.document.addEventListener("keypress",e.keypressEventHandler(e.triggerHandlers.bind(e,"dom")),!1))},Ve.prototype.domEventHandler=function(t,r,n){var o=this;return void 0===n&&(n=!1),function(e){o.keypressTimeout=void 0,e&&o.lastCapturedEvent!==e&&(o.lastCapturedEvent=e,o.debounceTimer&&clearTimeout(o.debounceTimer),n?o.debounceTimer=setTimeout(function(){r({event:e,name:t})}):r({event:e,name:t}))}},Ve.prototype.triggerHandlers=function(e,t){if(e)try{this.domBreadcrumb(t)}catch(e){}},Ve.prototype.keypressEventHandler=function(n){var o=this;return function(e){var t;try{t=e.target}catch(e){return}var r=t&&t.tagName;r&&("INPUT"===r||"TEXTAREA"===r||t.isContentEditable)&&(o.keypressTimeout||o.domEventHandler("input",n)(e),clearTimeout(o.keypressTimeout),o.keypressTimeout=window.setTimeout(function(){o.keypressTimeout=void 0},o.debounceDuration))}},Ve.prototype.domBreadcrumb=function(e){var t;try{t=e.event.target?_e(e.event.target):_e(e.event)}catch(e){t="<unknown>"}0!==t.length&&this.addBreadcrumb({category:"ui."+e.name,message:t})},Ve.monitorName=Qe,Ve);function Ve(e){var n=this;this.name=Qe,this.breadcrumbs=[],this.getBreadcrumbs=function(){return n.breadcrumbs},this.addBreadcrumb=function(e){var t=p(p({},e),{timestamp:(new Date).getTime()}),r=n.maxBreadcrumbs,e=n.breadcrumbs;return n.breadcrumbs=0<=r?s(e,[t]).slice(-r):s(e,[t]),n},this.debounceDuration=1e3,this.debounceTimer=0,this.breadcrumbs=[],this.maxBreadcrumbs=null!==(e=null==e?void 0:e.maxBreadcrumbs)&&void 0!==e?e:20}var Ke={enableCatchGlobalJSError:!0},We="JSExceptionMonitor",Ge=($e.prototype.setup=function(e){M()&&(this.callback=e,this.options.enableCatchGlobalJSError&&(window.addEventListener("error",this.jsErrorLog),window.addEventListener("unhandledrejection",this.jsPromiseRejectionLog)))},$e.prototype.buildEvent=function(e){if(!function(e){switch(Object.prototype.toString.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":return 1;default:return e instanceof Error}}(e)?(r(e)&&(t={message:JSON.stringify(e)}),m(e)&&(t={message:e})):t=e,t){var t={ev_type:"js_exception",exception:this.normalizeError(t),breadcrumbs:null!==(t=null===(t=this.options.breadcrumbMonitor)||void 0===t?void 0:t.getBreadcrumbs())&&void 0!==t?t:[]};return{name:this.name,type:"post",event:t}}},$e.prototype.logError=function(e){e=this.buildEvent(e);e&&this.callback(e)},$e.prototype.getJSError=function(e){e=e.error;if(e)return e},$e.prototype.getJSPromiseRejection=function(e){var t=void 0;try{"reason"in e?t=e.reason:"detail"in e&&"reason"in e.detail&&(t=e.detail.reason)}catch(e){}if(t)return t},$e.prototype.normalizeError=function(e){return{message:e.message,name:e.name,fileName:e.fileName,lineNumber:e.lineNumber,columnNumber:e.columnNumber,stack:e.stack,stacktrace:e.stacktrace,framesToPop:e.framesToPop}},$e.monitorName=We,$e);function $e(e){var t=this;this.name=We,this.callback=q,this.jsErrorLog=function(e){e=t.getJSError(e);e&&t.logError(e)},this.jsPromiseRejectionLog=function(e){e=t.getJSPromiseRejection(e);e&&t.logError(e)},this.options=p(p({},Ke),e)}var Ye=(Ze.prototype.sendEvent=function(e){e=this.getEventToBeSent(e);e&&this.idleSendEvent(e)},Ze.prototype.getEventToBeSent=function(e){e=this._modifyEvent(e);if(this._shouldSend(e))return e},Ze.prototype._modifyEvent=function(e){return e},Ze.prototype._shouldSend=function(e){return!0},Ze.prototype._send=function(e){},Ze.prototype.idleSendEvent=function(e){this._send(e)},Ze);function Ze(){}var et,tt=(e(rt,et=Ye),Object.defineProperty(rt.prototype,"ready",{get:function(){return this.isReady},set:function(e){this.isReady=e,this.isReady&&this._uploadQueue()},enumerable:!1,configurable:!0}),rt.prototype._send=function(e){var t=this,e=this.buildParams(e);null!=e&&(this.reportQueue.push(e),this.isReady&&(this.reportQueue.length>=this.batchReportLength&&this._uploadQueue(),this.batchReportTimeout&&clearTimeout(this.batchReportTimeout),this.batchReportTimeout=setTimeout(function(){t._uploadQueue()},this.batchReportWait)))},rt.prototype._uploadQueue=function(){var e;this.reportQueue.length&&this.ready&&(e={ev_type:"batch",list:this.reportQueue},this.reportQueue=[],this._request({event:e,type:"post"}))},rt.prototype._request=function(e){},rt);function rt(e){var t,r=et.call(this)||this;return r.reportQueue=[],r.isReady=!0,r.batchReportLength=null!==(t=e.maxBatchReportLength)&&void 0!==t?t:10,r.batchReportWait=null!==(e=e.batchReportWait)&&void 0!==e?e:1e3,r.batchReportTimeout=null,r}var nt="RANGERS_WEB_ID";function ot(){var e={flags:{hookPath:!0,hookXHR:!0,hookFetch:!0,enableSizeStats:!0,enableFMP:!0,enablePerformance:!0,enableResourcePerformance:!0,enableStaticError:!0,enableCatchJSError:!0,enableCatchGlobalJSError:!0,enableCatchJSErrorV2:!1,enableCrash:!0,enableMemoryRecord:!0,enableFPSJankTimesMonitor:!0,enableBreadcrumb:!0,hookConsole:!1,hookDom:!0}};return e.monitors={BaseMonitor:{appTypeSetting:{type:0,SPA:"",renderType:0},sampleHit:U(1)},JSErrorMonitor:{enable:!0,webIDHit:!0,sampleRate:1,webIDHitBehavior:!1,sampleHitBehavior:!1,ignoreErrors:[],whitelistUrls:[],blacklistUrls:[],download_link:""},AjaxMonitor:{enable:!0,enableError:!1,webIDHit:!0,sampleHit:U(1),sampleRate:1,sampleHitTrace:!1,ignore:te,abort:!1,whitelistUrls:[],statusCodeSample:{},requestUrlSample:[],errorRequestCollect:!1},PerformanceMonitor:{enable:!0,webIDHit:!0,sampleRate:1,webIDHitStaticResource:!1,sampleHitStaticResource:U(ee),slowSessionTime:re,spaSlowSessionTime:ne,geckoUrls:[],interval:0,checkPoint:[]},StaticErrorMonitor:{enable:!0,webIDHit:!0,sampleRate:1,ignore:te},ResourcePerformanceMonitor:{enable:!0,webIDHit:!0,sampleRate:1},BreadcrumbMonitor:{enable:!0},EmitMonitor:{enable:!0}},e.custom={},e.commonParams={aid:0,pid:"",version:"0.2.22",hostname:window.location.hostname,protocol:window.location.protocol.slice(0,-1),rangers_web_id:ct(Y()),rangers_session_id:Y(),context:{},url:window.location.href,timestamp:Date.now(),screen_resolution:N(),network_type:J()},e}var it,at,st,ut,ct=function(e){return null!==document&&void 0!==document&&document.cookie&&(e=D(document.cookie,nt)),e},lt=(it="/v2/user/webid",at="/v2/user/ssid",st="/v2/event/list",ut=[],["https://mcs.ctobsnssdk.com","https://mcs.itobsnssdk.com","https://mcs.tobsnssdk.com"].forEach(function(t){[it,at,st].forEach(function(e){ut.push(t+e)})}),ut);function pt(e){var t=e.sendParams,e=e.monitorsSetting;if(!t||!u(t)||!t.event)return!1;var r,n,e=e;if("AjaxMonitor"===t.name||"FetchMonitor"===t.name){var o=F(s(["/monitor_browser/collect"],lt)||[]);if(o&&o.test(t.event.ax_url))return!1}return!(null==e||!e.BaseMonitor.sampleHit)&&("AjaxMonitor"===t.name||"FetchMonitor"===t.name?function(e){var r=e.sendParams,t=e.ajaxMonitor;if(!t)return!0;if("2"!==r.event.ax_status[0]&&"3"!==r.event.ax_status[0])return t.enableError;if(!t.enable)return!1;if(!t.webIDHit)return!1;if(!t.sampleHit||!U(t.sampleRate))return!1;if(c(e=t.whitelistUrls)&&0<e.length){var n=F(t.whitelistUrls||[]);return n&&n.test(r.event.ax_url)?!0:!1}if((n=F(t.ignore||[]))&&n.test(r.event.ax_url))return!1;if((n=t.statusCodeSample)&&d(n,r.event.ax_status))return U(n[r.event.ax_status]);if(t=t.requestUrlSample){var o=!1,i=!1;if(t.forEach(function(e){var t;o||null!=(t=F([e.url]))&&t.test(r.event.ax_url)&&(o=!0,i=U(e.sampleRate))}),o)return i}return!0}({sendParams:t,ajaxMonitor:e.AjaxMonitor}):"PerformanceMonitor"===t.name?!(r=(r={performanceMonitor:e.PerformanceMonitor}).performanceMonitor)||!!r.enable&&(!!r.webIDHit&&U(r.sampleRate)):"StaticErrorMonitor"===t.name?(o={sendParams:t,staticErrorMonitor:e.StaticErrorMonitor},r=o.sendParams,!(o=o.staticErrorMonitor)||!!o.enable&&(!!o.webIDHit&&(!!U(o.sampleRate)&&!((o=F(o.ignore||[]))&&o.test(r.event.st_src))))):"JSExceptionMonitor"===t.name?!(n=(n={jsErrorMonitor:e.JSErrorMonitor}).jsErrorMonitor)||!!n.enable&&(!!n.webIDHit&&U(n.sampleRate)):"ResourcePerformanceMonitor"===t.name?!(n=(n={resourcePerformanceMonitor:e.ResourcePerformanceMonitor}).resourcePerformanceMonitor)||!!n.enable&&(!!n.webIDHit&&U(n.sampleRate)):"EmitMonitor"!==t.name||!!{emitMonitor:e.EmitMonitor}.emitMonitor)}function ht(e){var t=e.sendParams,r=e.commonParams,n=e.custom,e=e.breadcrumbMonitor,e=function(e){var t=e.sendParams,r=e.commonParams,n=e.breadcrumbMonitor;if((e={}).ev_type=t.event.ev_type,e.common=r,"PageViewMonitor"===t.name&&e)return e;if(("AjaxMonitor"===t.name||"FetchMonitor"===t.name)&&e){r=t.event,r=(r.ev_type,a(r,["ev_type"]));return e.event=r,e}if("PerformanceMonitor"===t.name&&e){t.event.navigation=t.event.navigation_timing;var o=t.event,o=(o.ev_type,a(o,["ev_type"]));return e.ev_type="performance",e.event={fp:o.fp,fcp:o.fcp,fmp:o.fmp,tti:o.tti,fid:o.fid,mpfid:o.mpfid,isAsync:o.isAsync,timing:o.timing,navigation:o.navigation_timing,bounced:o.bounced},e}if("StaticErrorMonitor"===t.name&&e){e.ev_type="resource_error";o=t.event,o=(o.ev_type,a(o,["ev_type"]));return e.event=o,e}if("ResourcePerformanceMonitor"===t.name&&e){e.ev_type="resource";var i=t.event,i=(i.ev_type,a(i,["ev_type"]));return e.event=i,e}if("JSExceptionMonitor"===t.name&&e){e.ev_type="js_error";i=t.event,i=(i.ev_type,a(i,["ev_type"]));return e.event=i.exception,e.breadcrumbs=null!==(n=null==n?void 0:n.getBreadcrumbs())&&void 0!==n?n:[],e}return"EmitMonitor"===t.name&&e&&(e.ev_type="flexible",e.flexible_data_list=t.event.flexible_data_list),e}({sendParams:t,commonParams:p(p({},null!=r?r:{}),{url:window.location.href}),breadcrumbMonitor:e});return n&&f(n.beforeSend)&&(e=n.beforeSend(e||{})),e}function ft(e){return"https://"+e+"/monitor_browser/collect"}var mt,dt=(e(vt,mt=tt),vt.prototype._shouldSend=function(e){return pt({sendParams:e,monitorsSetting:this.options.monitorsSetting})},vt.prototype._modifyEvent=function(e){return(e=(e={sendParams:e}).sendParams)&&u(e)?e:{}},vt.prototype._request=function(e){var t,r;e&&e.event&&(t=e.type,r=e.event,"beacon"===this.options.reportType&&navigator&&navigator.sendBeacon?(e=JSON.stringify(r),navigator.sendBeacon(this.getReportURL(),e)):this.transport&&("get"!==t?"post"===t&&this.transport.postEvent(r):this.transport.getEvent(r)))},vt.prototype.buildParams=function(e){var t,r=null===(t=null===(t=this.options.monitorsSetting)||void 0===t?void 0:t.BreadcrumbMonitor)||void 0===t||!t.enable||null===(r=this.options.monitors)||void 0===r?void 0:r.BreadcrumbMonitor;return ht({sendParams:e,commonParams:this.options.commonParams,custom:this.options.custom,breadcrumbMonitor:r})},vt.prototype.getReportURL=function(){return this.reportURL},vt);function vt(e){var o=mt.call(this,e)||this;return o.options={},o.setTransport=function(){o.transport=new X({reportURL:o.getReportURL()}),o.preQueue.forEach(function(e){mt.prototype.sendEvent.call(o,e)})},o.updateConfig=function(e){var t,r,n;o.options=(t={previousOptions:o.options,newOptions:e},r=t.previousOptions,n=t.newOptions,(e=p(p({},r),n)).commonParams=i({},null!==(t=r.commonParams)&&void 0!==t?t:{},null!==(t=n.commonParams)&&void 0!==t?t:{}),e.monitorsSetting=i({},null!==(t=r.monitorsSetting)&&void 0!==t?t:{},null!==(t=n.monitorsSetting)&&void 0!==t?t:{}),e.monitors=p(p({},null!==(t=r.monitors)&&void 0!==t?t:{}),null!==(t=n.monitors)&&void 0!==t?t:{}),e.custom=p(p({},null!==(r=r.custom)&&void 0!==r?r:{}),null!==(n=n.custom)&&void 0!==n?n:{}),e)},o.sendEvent=function(e){o.transport?mt.prototype.sendEvent.call(o,e):o.preQueue.push(e)},o.uploadQueue=function(){o._uploadQueue()},o.reportURL=null!==(e=null==e?void 0:e.reportURL)&&void 0!==e?e:"",o.preQueue=[],o}gt.getClientCommonParams=function(r){void 0===r&&(r={});var n={};if(!u(r))return n;var o=["context","pid"];t(r,function(e,t){w(o,e)&&(n[e]=t)});return t({user_unique_id:"rangers_web_id",app_id:"aid"},function(e,t){d(r,e)&&(n[t]=r[e])}),n},gt.getClientFlags=function(e){void 0===e&&(e={});var r={};if(!u(e))return r;var n=["hookPath","hookXHR","hookFetch","enableSizeStats","enableFMP","enablePerformance","enableStaticError","enableCatchJSError","enableCatchJSErrorV2","enableCatchGlobalJSError","enableResourcePerformance","enableCrash","enableMemoryRecord","enableFPSJankTimesMonitor","enableBreadcrumb","hookConsole"];return t(e,function(e,t){w(n,e)&&(r[e]=t)}),r},gt.getClientCustom=function(e){var t={};return e.beforeSend&&f(e.beforeSend)&&(t.beforeSend=e.beforeSend),t},gt.getClientMonitorsSetting=function(e){return e=(t={setting:e}).setting,t={JSErrorMonitor:{},PerformanceMonitor:{},BreadcrumbMonitor:{},StaticErrorMonitor:{},ResourcePerformanceMonitor:{},BaseMonitor:{appTypeSetting:{}},AjaxMonitor:{}},e.ajaxWhitelistUrls&&c(e.ajaxWhitelistUrls)&&(t.AjaxMonitor.whitelistUrls=(t.AjaxMonitor.whitelistUrls||[]).concat(e.ajaxWhitelistUrls)),e.ignoreAjax&&c(e.ignoreAjax)&&(t.AjaxMonitor.ignore=(t.AjaxMonitor.ignore||[]).concat(e.ignoreAjax)),e.ignoreStatic&&c(e.ignoreStatic)&&(t.StaticErrorMonitor.ignore=(t.StaticErrorMonitor.ignore||[]).concat(e.ignoreStatic)),e.ignoreErrors&&c(e.ignoreErrors)&&(t.JSErrorMonitor.ignoreErrors=e.ignoreErrors),e.errorBlacklistUrls&&c(e.errorBlacklistUrls)&&(t.JSErrorMonitor.blacklistUrls=e.errorBlacklistUrls),e.errorWhitelistUrls&&c(e.errorWhitelistUrls)&&(t.JSErrorMonitor.whitelistUrls=e.errorWhitelistUrls),d(e,"sampleRate")&&(t.BaseMonitor.sampleHit=U(e.sampleRate)),t;var t},gt.prototype.configure=function(e){if(u(e)){if(this.userConfig=p(p({},this.userConfig||{}),e||{}),!this.serverDomain){if(!this.userConfig.serverDomain)return void console.error('"serverDomain" must be configured');this.serverDomain=this.userConfig.serverDomain}this.updateCurrentSetting(),this.client?this.updateClientConfig(this.getClientOptions()):this.init()}},gt.prototype.emitEvent=function(e){var t;this.monitors.EmitMonitor&&(t=this.monitors.EmitMonitor).handOut.apply(t,s(e))},gt.prototype.init=function(){var t=this,r=this.getClientOptions();this.client=new dt(r),this.getUserIDFromRangers(function(e){t.finderSetting={user_unique_id:e.user_unique_id},t.updateCurrentSetting(),t.updateClientConfig(r)}),this.sendPageview(),this.setupMonitors(this.setMonitors()),this.getServerSetting()},gt.prototype.getServerSetting=function(){var t=this;if(this.serverSetting)return this.updateCurrentSetting(),void this.afterServerSetting();var e="https://"+this.serverDomain+"/settings/get/web?aid="+this.currentSetting.commonParams.aid;X.get(e,{success:function(e){try{t.serverSetting=e.data,t.updateCurrentSetting(),t.afterServerSetting()}catch(e){t.afterServerSetting()}},fail:function(){t.afterServerSetting()}})},gt.prototype.afterServerSetting=function(){this.updateClientConfig(this.getClientOptions()),this.client.setTransport()},gt.prototype.updateCurrentSetting=function(){var e={commonParams:gt.getClientCommonParams(this.finderSetting),flags:gt.getClientFlags({}),custom:gt.getClientCustom({}),monitors:gt.getClientMonitorsSetting({})},t={commonParams:gt.getClientCommonParams({}),flags:gt.getClientFlags({}),custom:gt.getClientCustom({}),monitors:this.serverSetting?(r=this.serverSetting,n={JSErrorMonitor:{},PerformanceMonitor:{},BreadcrumbMonitor:{},StaticErrorMonitor:{},BaseMonitor:{},ResourcePerformanceMonitor:{},AjaxMonitor:{}},(r=r.setting).jserr&&(n.JSErrorMonitor.enable=r.jserr.enable,n.JSErrorMonitor.webIDHit=U(r.jserr.enable_user_rate),n.JSErrorMonitor.sampleRate=r.jserr.enable_sample_rate),r.performance&&(n.PerformanceMonitor.enable=r.performance.enable,n.PerformanceMonitor.webIDHit=U(r.performance.enable_user_rate),n.PerformanceMonitor.sampleRate=r.performance.enable_sample_rate),r.breadcrumb&&(n.BreadcrumbMonitor.enable=r.breadcrumb.enable),r.static_resource_error&&(n.StaticErrorMonitor.enable=r.static_resource_error.enable),r.static_resource&&(n.ResourcePerformanceMonitor.enable=r.static_resource.enable,n.ResourcePerformanceMonitor.webIDHit=U(r.static_resource.enable_user_rate),n.ResourcePerformanceMonitor.sampleRate=r.static_resource.enable_sample_rate),r.request&&(n.AjaxMonitor.enable=r.request.enable,n.AjaxMonitor.enableError=r.request.enableError,n.AjaxMonitor.webIDHit=U(r.request.enable_user_rate),n.AjaxMonitor.sampleRate=r.request.enable_sample_rate),n):gt.getClientMonitorsSetting({})},r={commonParams:gt.getClientCommonParams(this.userConfig),flags:gt.getClientFlags(this.userConfig),custom:gt.getClientCustom(this.userConfig),monitors:gt.getClientMonitorsSetting(this.userConfig)},n=this.currentSetting;this.currentSetting=o({},this.defaultSetting,t,r,e),this.currentSetting.commonParams.pid=this.currentSetting.commonParams.pid||location.pathname,this.settingEffect(this.currentSetting,n)},gt.prototype.settingEffect=function(e,t){var r;(r=e.commonParams.rangers_web_id)!==D(document.cookie,nt)&&(document.cookie=nt+"="+r+";max-age=7776000;domain="+location.hostname+";path=/"),t.commonParams.pid!==e.commonParams.pid&&this.sendPageview()},gt.prototype.setMonitors=function(){var t,e=this.currentSetting.commonParams,r=e.aid,n=e.rangers_web_id,o=[],i=this.currentSetting.flags,e=new me;return o.push(e),o.push(new Ue),i.enableCatchJSError&&o.push(new Ge),i.hookXHR&&o.push(new se({commonParams:{bid:r+"",web_id:n},ajaxMonitorOptions:this.currentSetting.monitors.AjaxMonitor})),i.hookFetch&&o.push(new pe({commonParams:{bid:r+"",web_id:n},ajaxMonitorOptions:this.currentSetting.monitors.AjaxMonitor})),i.enableStaticError&&o.push(new Fe),i.enablePerformance&&(i.enableFMP?o.push(new Ae({fmpMonitor:e,renderType:1,preLongTaskObserver:{precollect:[],observer:void 0}})):o.push(new Ae({renderType:1,preLongTaskObserver:{precollect:(null===(e=window.RangersSiteSDK.lt)||void 0===e?void 0:e.e)||[],observer:null===(e=window.RangersSiteSDK.lt)||void 0===e?void 0:e.o}}))),i.enableBreadcrumb&&o.push(new ze),i.enableResourcePerformance&&(t=this.serverDomain,o.push(new Oe({observe:!0,checkIgnore:function(e){return e.name===ft(t)||("xmlhttprequest"===e.initiatorType||"fetch"===e.initiatorType||"beacon"===e.initiatorType||"navigation"===e.initiatorType||0===e.decodedBodySize)}}))),o},gt.prototype.setupMonitors=function(e){var t=this;this.client&&this.client.sendEvent&&(e.forEach(function(e){"FMPMonitor"===(t.monitors[e.name]=e).name?e.setup(q):e.setup(null===(e=t.client)||void 0===e?void 0:e.sendEvent)}),this.updateClientConfig({monitors:this.monitors}))},gt.prototype.getUserIDFromRangers=function(t){window.collectEvent&&f(window.collectEvent)&&window.collectEvent("getToken",function(e){t(e)})},gt.prototype.sendPageview=function(){var e;null!==(e=this.client)&&void 0!==e&&e.sendEvent({name:"PageViewMonitor",event:{ev_type:"pageview"},type:"post"})},gt.prototype.getClientOptions=function(){var e=this.currentSetting;return{reportURL:ft(this.serverDomain),monitorsSetting:e.monitors,commonParams:e.commonParams,custom:e.custom}},gt.prototype.uploadClientQueue=function(){var e;null!==(e=this.client)&&void 0!==e&&e.uploadQueue()},gt.prototype.updateClientConfig=function(e){var t;null!==(t=this.client)&&void 0!==t&&t.updateConfig(e)},Ye=gt;function gt(){var r=this;this.version="0.2.22",this.serverDomain="tbm.snssdk.com",this.instance=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];"config"!==e[0]?"emit"!==e[0]?"report"!==e[0]?r.initOnCloseCallback():r.uploadClientQueue():r.emitEvent(e):r.configure(e[1])},this.initOnCloseCallback=function(){B(r.onCloseReport,r.visibilityChange)},this.visibilityChange=function(){"hidden"===document.visibilityState&&r.onCloseReport(),"visible"===document.visibilityState&&r.updateClientReportType("xhr")},this.onCloseReport=function(){r.updateClientReportType("beacon"),r.uploadClientQueue()},this.updateClientReportType=function(e){var t;null!==(t=r.client)&&void 0!==t&&t.updateConfig({reportType:e})},this.userConfig={},this.defaultSetting=ot(),this.currentSetting=this.defaultSetting,this.serverSetting=void 0,this.finderSetting={},this.client=void 0,this.monitors={}}var bt=q;return M()&&(tt=new Ye,bt=tt.instance,null!==(Ye=window.RangersSiteSDK)&&void 0!==Ye&&Ye.q&&(c(Ye=window.RangersSiteSDK.q)&&Ye.forEach(function(e){bt.apply(void 0,s(e))}),delete window.RangersSiteSDK.q),window.RangersSiteSDK=tt.instance),bt}(); | ||
var RangersSiteSDK=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 r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};function e(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var p=function(){return(p=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function a(e,t){var r={};for(o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(r[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var n=0,o=Object.getOwnPropertySymbols(e);n<o.length;n++)t.indexOf(o[n])<0&&Object.prototype.propertyIsEnumerable.call(e,o[n])&&(r[o[n]]=e[o[n]]);return r}function v(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function h(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),a=[];try{for(;(void 0===t||0<t--)&&!(n=i.next()).done;)a.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a}function s(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(h(arguments[t]));return e}function u(e){return"object"==typeof e&&null!==e&&!c(e)}function r(e){return"[object Object]"===(e=e,Object.prototype.toString.call(e))}function f(e){return"function"==typeof e}function m(e){return"[object String]"===Object.prototype.toString.call(e)}function c(e){return"[object Array]"===Object.prototype.toString.call(e)}function l(e){return"number"==typeof e}function d(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function t(e,t){if(u(e))for(var r in e)d(e,r)&&t.call(null,r,e[r])}function i(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var r={},n=0;n<e.length;)r=function(e,t){var r,n=p({},e);for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&void 0!==t[r]&&(u(t[r])&&b(t[r])?n[r]=y(u(e[r])?e[r]:{},t[r]):c(t[r])?n[r]=t[r].slice():n[r]=t[r]);return n}(r,e[n]),n++;return r}function o(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var r={},n=0;n<e.length;)r=y(r,e[n]),n++;return r}var g=Object.getPrototypeOf?Object.getPrototypeOf({}):null;function b(e){return Object.getPrototypeOf?Object.getPrototypeOf(e)===g:e.constructor===Object}function y(e,t){var r,n=p({},e);for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&void 0!==t[r]&&(u(t[r])&&b(t[r])?n[r]=y(u(e[r])?e[r]:{},t[r]):c(e[r])||c(t[r])?n[r]=function t(e,r){var e=c(e)?e:[];var r=c(r)?r:[];return Array.prototype.concat.call(e,r).map(function(e){return!(e instanceof RegExp)&&(c(e)||u(e)&&b(e))?c(e)?t([],e):y({},e):e})}(e[r],t[r]):n[r]=t[r]);return n}function w(e,t){if(!c(e))return!1;if(0===e.length)return!1;for(var r=0;r<e.length;){if(e[r]===t)return!0;r++}return!1}function S(){if("fetch"in window)try{return new Headers,new Request(""),new Response,1}catch(e){return}}function M(){return!!u(window)}function _(){return M()&&!!u(window.performance)}function P(){return _()&&!!u(window.performance.timing)}function E(){return!!_()&&!!f(window.performance.getEntries)}function T(){return M()&&"function"==typeof window.MutationObserver}function k(){return M()&&"function"==typeof window.PerformanceObserver}function R(){return!!k()&&f(window.PerformanceLongTaskTiming)}function C(){if(!k())return!1;var e=window.PerformanceObserverEntryList;return f(e)&&f(e.prototype.getEntries)}function x(e){var r,e=function(e){if(!u(e))return{};var r={};return t(e,function(e,t){u(t)||c(t)?r[e]=JSON.stringify(t):r[e]=t}),r}(e),e=(r={},t(e,function(e,t){r[encodeURIComponent(e)]=encodeURIComponent(t)}),r),n=[];return t(e,function(e,t){n.push(e+"="+t)}),n.join("&")}function L(e){var t=document.createElement("a");t.href=e;e=t.pathname||"/";return"/"!==e[0]&&(e="/"+e),{href:t.href,protocol:t.protocol.slice(0,-1),hostname:t.hostname,host:t.host,search:t.search,pathname:e,hash:t.hash}}var O=function(e){if(!m(e))return!1;return f(e.toLowerCase)&&(e=e.toLowerCase()),w(["x-tt-token"],e)};function q(){}function j(e){var t="[object String]"===Object.prototype.toString.call(e);return e?t?e.length:ArrayBuffer&&e instanceof ArrayBuffer?e.byteLength:window.Blob&&e instanceof Blob?e.size:e.length||0:0}function H(e){if(!e)return"";if(!f(e.forEach))return"";var r=[];return e.forEach(function(e){var t;c(e)&&e[0]&&!O(e[0])&&(t=e[0],e=e[1]||"",r.push(t+": "+e))}),r.join("\r\n")}function A(e){var t={},r=L(e);return t.ax_protocol=r.protocol,t.ax_domain=r.hostname,t.ax_path=r.pathname,t.ax_url=(r.href||e).split("?")[0],t}function I(e,t){e=L(e),t=L(t);return e.protocol===t.protocol&&e.host===t.host}function D(e,t){var r,n;if(!e||!t)return"";var o=e.split(";"),i={};try{for(var a=v(o),s=a.next();!s.done;s=a.next()){var u=s.value.split("="),c=m(u[0])&&u[0].trim();c&&m(u[1])&&(i[c]=u[1].trim())}}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}return i[t]||""}function F(e){return c(e)&&e.length?function(e){for(var t=[],r=e.length,n=0;n<r;n++){var o=e[n];m(o)?t.push(o.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")):o&&o.source&&t.push(o.source)}return new RegExp(t.join("|"),"i")}(e):null}function B(t,r){f(t)&&(f(window.addEventListener)&&(window.addEventListener("unload",t),window.addEventListener("beforeunload",t),window.addEventListener("pagehide",t)),f(document.addEventListener)&&document.addEventListener("visibilitychange",function(e){f(r)?r(e):"hidden"===document.visibilityState&&t(e)}))}var N=function(e){var t,r;return void 0===e&&(e=window),M()&&null!==(t=e.screen)&&void 0!==t&&t.width&&null!==(r=e.screen)&&void 0!==r&&r.height?e.screen.width+"x"+e.screen.height:"0x0"},J=function(){var e="unknown",t=navigator.connection||navigator.mozConnection||navigator.webkitConnection;return t&&m(t.effectiveType)?t.effectiveType:e};function U(e){return!!e&&Math.random()<Number(e)}var X=(Q.post=function(e,t,r){var n=r&&r.success||q,o=r&&r.fail||q,r=new XMLHttpRequest;r.open("POST",e,!0),r.setRequestHeader("Content-Type","application/json"),r.send(JSON.stringify(t)),r.onload=function(){try{var e;this.responseText?(e=JSON.parse(this.responseText),n(e)):n({})}catch(e){o()}},r.onerror=function(){o()},r.onabort=function(){o()}},Q.get=function(e,t){var r=t&&t.success||q,n=t&&t.fail||q,o=t&&t.getResponse||q,i=t&&t.getResponseText||q,a=new XMLHttpRequest;t&&t.withCredentials&&(a.withCredentials=t.withCredentials),a.open("GET",e),a.send(),a.onload=function(){o(null==this?void 0:this.response),i(this.responseText);try{var e;this.responseText?(e=JSON.parse(this.responseText),r(e)):r({})}catch(e){n()}},a.onerror=function(){n()},a.onabort=function(){n()}},Q.prototype.getCommonParams=function(){return{timestamp:Date.now()}},Q);function Q(e){var t=this;this.postEvent=function(e){e=p(p({},e),t.getCommonParams());Q.post(t.url,e)},this.getEvent=function(e){e=x(p(p({},e),t.getCommonParams())),e=t.url+"?"+e;Q.get(e)},this.getURL=function(){return t.url},this.options=e,this.url=this.options.reportURL}function z(e,t,r){if(void 0===r&&(r="0"),1<r.length)throw new TypeError("expect the length of pad to be 1, but got "+e.length);return e.length>=t?e:""+Array.from({length:t-e.length}).fill(r).join("")+e}function V(e){return e?Math.floor(Math.random()*Math.pow(10,12)).toString(16).substr(0,e):""}var K="x-tt-trace-id",W="x-tt-trace-host",G="x-tt-logid";function $(e,t,r){void 0===r&&(r="01");t=""+z((Date.now()%4294967295).toString(16),8)+function(e){if("number"==typeof e)r=e;else{var t=e.replace(/-/g,"");if(!/^[0-9]+$/.test(t)){if(18<t.length)return"18"+V(18);e=22-t.length-4;return""+z(""+t.length,2)+t+V(e)}r=parseInt(t,10)}var r=22-(t=r.toString(16)).length-4;return""+z(""+t.length,2)+t+V(r)}(e)+("string"==typeof t?V(4):z(t.toString(16),4));return"00-"+t+"-"+t.substr(0,16)+"-"+r}function Y(){var e=function(){for(var e=new Array(16),t=0,r=0;r<16;r++)0==(3&r)&&(t=4294967296*Math.random()),e[r]=t>>>((3&r)<<3)&255;return e}();return e[6]=15&e[6]|64,e[8]=63&e[8]|128,function(e){for(var t=[],r=0;r<256;++r)t[r]=(r+256).toString(16).substr(1);var n=0;return[t[e[n++]],t[e[n++]],t[e[n++]],t[e[n++]],"-",t[e[n++]],t[e[n++]],"-",t[e[n++]],t[e[n++]],"-",t[e[n++]],t[e[n++]],"-",t[e[n++]],t[e[n++]],t[e[n++]],t[e[n++]],t[e[+n]],t[e[15]]].join("")}(e)}function Z(){return f(Date)?Math.round(Date.now()/1e3):0}var ee=.1,te=["/log/sentry/"],re=8e3,ne=4e3;Y(),Y();function oe(e,r){if(!u(e))return{};if(!f(r))return{};var n={};return t(e,function(e,t){r(t)&&(n[e]=t)}),n}function ie(e){var t,r,n,o,i=null;return u(e)&&("timer"===e.type&&(i=u(t=e.event)&&m(t.name)&&l(t.value)?{metrics_type:"timer",event_name:"default",metrics:((r={})[t.name]=t.value,r),category:oe(t.tags,m),timestamp:Z()}:{}),"counter"===e.type&&(i=u(o=e.event)&&m(o.name)&&l(o.value)?{metrics_type:"counter",event_name:"default",metrics:((n={})[o.name]=o.value,n),category:oe(o.tags,m),timestamp:Z()}:{}),"log"===e.type&&(i=u(n=e.event)&&m(n.value)?{metrics_type:"log",event_name:"default",log_content:n.value,log_level:null!==(o=n.level)&&void 0!==o?o:"info",category:oe(n.tags,m),timestamp:Z()}:{}),"custom"===e.type&&(i=u(e=e.event)&&m(e.event_name)?{metrics_type:"custom",event_name:e.event_name,metrics:oe(e.metrics,l),category:oe(e.tags,m),timestamp:Z()}:{})),i}var ae="AjaxMonitor",se=(ue.prototype.setup=function(e){void 0===e&&(e=q),f(XMLHttpRequest)&&(this.callback=e,this.start())},ue.prototype.updateConfig=function(e){this.props=o({},this.props,e)},ue.prototype.start=function(){this.hookXMLHttpRequestOpen(),this.hookXMLHttpRequestSend(),this.hookXMLHttpRequestSetRequestHeader()},ue.prototype.hookXMLHttpRequestSetRequestHeader=function(){var r=XMLHttpRequest.prototype.setRequestHeader||q;XMLHttpRequest.prototype.setRequestHeader=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this._requestHeaders=this._requestHeaders||[],this._requestHeaders.push(e),r.apply(this,e)}},ue.prototype.hookXMLHttpRequestOpen=function(){var o=XMLHttpRequest.prototype.open;XMLHttpRequest.prototype.open=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=e[0],n=e[1];return this._url=n||"",this._method=(null==r?void 0:r.toLowerCase())||"",o.apply(this,e)}},ue.prototype.hookXMLHttpRequestSend=function(){var o=this,i=XMLHttpRequest.prototype.send;XMLHttpRequest.prototype.send=function(){for(var e,t,r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];return o.checkAddTrace(this._url)&&(e=(t=null!==(e=null==o?void 0:o.props.commonParams)&&void 0!==e?e:{}).bid,t=t.web_id,e&&t&&(o.traceId=$(t,e),this.setRequestHeader(K,o.traceId))),o.hookXMLHttpRequestOnreadystatechange.call(this,o),this._start=Date.now(),this._data=null==r?void 0:r[0],i.apply(this,r)}},ue.prototype.checkAddTrace=function(e){var t=null!==(n=this.props.commonParams)&&void 0!==n?n:{},r=t.bid,n=t.web_id,t=(null!==(t=this.props.ajaxMonitorOptions)&&void 0!==t?t:{}).sampleHitTrace,e=I(location.href,e);return r&&n&&t&&e},ue.prototype.collectErrorRequest=function(){var e;return null!==(e=null===(e=this.props.ajaxMonitorOptions)||void 0===e?void 0:e.errorRequestCollect)&&void 0!==e&&e},ue.prototype.hookXMLHttpRequestOnreadystatechange=function(i){var a=this.onreadystatechange,s=this;this.onreadystatechange=function(){for(var e,t,r,n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];if(4===this.readyState&&(t={ev_type:"ajax",ax_status:(this.status||0).toString(),ax_type:s._method,ax_request_header:H(s._requestHeaders||[]),ax_domain:"",ax_duration:0,ax_path:"",ax_protocol:"",ax_response_header:"",ax_size:0,ax_url:""},"function"==typeof this.getAllResponseHeaders&&(t.ax_response_header=function(t){if(m(t)){var e=t.split("\r\n"),r=[];return e.forEach(function(e,t){e&&f(e.split)&&(e=e.split(": "),r.push([e[0],e[1]]))}),H(r)}return u(t)?H(Object.keys(t).map(function(e){return[e,t[e]]})):t}(this.getAllResponseHeaders())),!i.checkAddTrace(s._url)||(r=null!==(r=i.traceId)&&void 0!==r?r:this.getResponseHeader(K))&&(t.trace_id=r,t.trace_host=null!==(e=this.getResponseHeader(W))&&void 0!==e?e:void 0,t.log_id=null!==(e=this.getResponseHeader(G))&&void 0!==e?e:void 0),t.ax_duration=Date.now()-s._start,200===this.status&&(t.ax_size=function(e){var t=0;if(""===e.responseType||"text"===e.responseType)t=j(e.responseText);else if(e.response)t=j(e.response);else try{t=j(e.responseText)}catch(e){t=0}return t}(this)),t=p(p({},t),A(s._url)),i.collectErrorRequest()&&"2"!==t.ax_status[0]&&"3"!==t.ax_status[0]&&(t.ax_request={body:s._data?""+s._data:void 0,search:null===(e=L(s._url))||void 0===e?void 0:e.search,content_type:null===(e=null===(e=s._requestHeaders)||void 0===e?void 0:e.find(function(e){return"content-type"===e[0].toLowerCase()}))||void 0===e?void 0:e[1]}),f(i.callback)&&i.callback({name:i.name,type:"get",event:t})),a)return a.apply(this,n)}},ue.monitorName=ae,ue);function ue(e){this.name=ae,this.callback=q,this.traceId=null,this.props=e}function ce(e){return e instanceof Request}var le="FetchMonitor",pe=(he.prototype.updateConfig=function(e){this.props=o({},this.props,e)},he.prototype.setup=function(e){void 0===e&&(e=q),S()&&(this.callback=e,this.start())},he.prototype.start=function(){S()&&this.hookFetch()},he.prototype.checkAddTrace=function(e){var t=null!==(n=null===(r=this.props)||void 0===r?void 0:r.commonParams)&&void 0!==n?n:{},r=t.bid,n=t.web_id,t=(null!==(t=null===(t=null==this?void 0:this.props)||void 0===t?void 0:t.ajaxMonitorOptions)&&void 0!==t?t:{}).sampleHitTrace,e=I(location.href,e);return r&&n&&t&&e},he.prototype.updateAxRequest=function(e,t,r){var n,o;this.collectErrorRequest()&&"2"!==e.ax_status[0]&&"3"!==e.ax_status[0]&&(o=this.getFetchUrl(t,!0),e.ax_request={body:null===(t=this.getFetchBody(t,r))||void 0===t?void 0:t.toString(),search:!m(o)||null===(n=L(o))||void 0===n?void 0:n.search,content_type:null===(r=null==r?void 0:r.headers)||void 0===r?void 0:r["Content-Type"]})},he.prototype.collectErrorRequest=function(){var e;return null!==(e=null===(e=this.props.ajaxMonitorOptions)||void 0===e?void 0:e.errorRequestCollect)&&void 0!==e&&e},he.prototype.hookFetch=function(){var u=this,c=this,l=window.fetch;window.fetch=function(n,o){void 0===o&&(o={});var i=u.getFetchUrl(n);if(!function(e){if(m(e)){var t=h(e.split(":"),2),e=t[0];return!t[1]||("http"===e||"https"===e)}}(i))return l(n,o);var e=null!==(e=u.props.commonParams)&&void 0!==e?e:{},t=e.bid,r=e.web_id,a=Date.now(),s={ev_type:"ajax"};try{c.checkAddTrace(i)&&(o.headers=new Headers(function(e,t){var r=new Headers;ce(e)&&e.headers&&f(e.headers.forEach)&&e.headers.forEach(function(e,t){r.append(t,e)});t.headers&&new Headers(t.headers).forEach(function(e,t){r.append(t,e)});return r}(n,o)),t&&r&&(s.trace_id=$(t,r),o.headers.append(K,s.trace_id)))}catch(e){}return s.ax_type=u.getFetchMethod(n,o),s=p(p({},s),A(i)),l(n,o).then(function(e){var t,r;return s.ax_status=(e.status||0).toString(),s.ax_duration=Date.now()-a,s.ax_response_header=c.getAllHeaders(e.headers),s.ax_request_header=c.getAllHeaders(o.headers),e.headers&&f(e.headers.has)?(e.headers.has("content-length")?s.ax_size=Number(e.headers.get("content-length"))||0:s.ax_size=0,c.checkAddTrace(i)&&(e.headers.has(W)&&(s.trace_host=null!==(t=e.headers.get(W))&&void 0!==t?t:void 0),e.headers.has(K)&&(s.trace_id=null!==(r=e.headers.get(K))&&void 0!==r?r:void 0),e.headers.has(G)&&(s.log_id=null!==(r=e.headers.get(G))&&void 0!==r?r:void 0))):s.ax_size=0,u.updateAxRequest(s,n,o),f(c.callback)&&c.callback({name:c.name,type:"get",event:s}),e},function(e){return s.ax_status="0",s.ax_size=0,s.ax_duration=Date.now()-a,u.updateAxRequest(s,n,o),f(c.callback)&&c.callback({name:c.name,type:"get",event:s}),Promise.reject(e)})}},he.prototype.getFetchUrl=function(e,t){void 0===t&&(t=!1);var r="",r=ce(e)?e.url:e;return t||(r=m(r)?r.split("?")[0]:r),r},he.prototype.getFetchMethod=function(e,t){t=null!==(t=null==t?void 0:t.method)&&void 0!==t?t:"get";return ce(e)&&(t=null!==(e=e.method)&&void 0!==e?e:t),t.toLowerCase()},he.prototype.getFetchBody=function(e,t){return ce(e)?e.body:null==t?void 0:t.body},he.prototype.getAllHeaders=function(e){if(!e||"function"!=typeof e.forEach)return"";var r=[];return e.forEach(function(e,t){r.push([t,e])}),H(r)},he.monitorName=le,he);function he(e){this.name=le,this.callback=q,this.props=e}var fe="FMPMonitor",me=(de.prototype.setup=function(e){if(M())return T()?void(f(document.querySelector)&&(this.callback=e&&f(e)?e:function(){},this.startTime=Date.now(),this.list=[],f(this.observer.observe)&&this.observer.observe(document,{childList:!0,subtree:!0}))):null},de.prototype.count=function(){var e=Date.now()-this.startTime,t=document.querySelector("body");t?this.list.push({score:this.score(t,1,!1),time:e}):this.list.push({score:0,time:e})},de.prototype.score=function(e,t,r){var n,o=0,i=e.tagName;if("SCRIPT"!==i&&"STYLE"!==i&&"META"!==i&&"HEAD"!==i&&!w((null===(n=this.props)||void 0===n?void 0:n.ignoreTags)||[],i)){i=e.children?e.children.length:0;if(0<i)for(var a=e.children,s=i-1;0<=s;s--)o+=this.score(a[s],t+1,0<o);if(o<=0&&!r){if(!e.getBoundingClientRect||!f(e.getBoundingClientRect))return 0;e=e.getBoundingClientRect();if(!e)return 0;if(e.top>window.innerHeight)return 0;if(e.height<=0)return 0}o+=1+.5*t}return o},de.prototype.getFmpInternal=function(){if(!this.observer)return 0;if(this.disconnect(),!this.list.length)return 0;for(var e,t={time:this.list[0].time,rate:0},r=1;r<this.list.length;r++)this.list[r].time>=this.list[r-1].time&&(e=this.list[r].score-this.list[r-1].score,t.rate<e&&(t={time:this.list[r].time,rate:e}));return t.time},de.prototype.getTimeGap=function(){return P()?this.startTime-performance.timing.navigationStart:0},de.prototype.formatEvent=function(e){return{name:this.name,type:"post",event:{ev_type:"fmp",fmp:e}}},de.monitorName=fe,de);function de(e){var r=this;this.name=fe,this.callback=q,this.disconnect=function(){var e,t;null!==(t=null===(e=r.observer)||void 0===e?void 0:e.disconnect)&&void 0!==t&&t.call(e)},this.getLoadFmp=function(){var e=r.getFmpInternal(),e=e?r.getTimeGap()+e:0,e=r.formatEvent(e);return r.callback(e),e},this.getFmp=function(){var e=r.getFmpInternal(),e=r.formatEvent(e);return r.callback(e),e},this.props=e,this.startTime=Date.now(),this.list=[],this.observer=new MutationObserver(this.count.bind(this))}function ve(){}var ge=!1,be=!1,ye={uniqueId:0,originals:{},proxies:{},patchXMLHTTPRequest:function(i){this.originals.send=XMLHttpRequest.prototype.send,XMLHttpRequest.prototype.send=function(){for(var t=this,e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];var n=ye.uniqueId++;i.beforeCb(n);var o=this.onreadystatechange;return this.onreadystatechange=function(e){null!=o&&o.call(t,e),4===t.readyState&&i.afterCb(n)},ye.originals.send.apply(this,e)},this.proxies.send=XMLHttpRequest.prototype.send},patchFetch:function(o){var i;S()&&(i=window.fetch,this.originals.fetch=i,window.fetch=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return new Promise(function(t,r){var n=ye.uniqueId++;o.beforeCb(n),i.apply(void 0,s(e)).then(function(e){o.afterCb(n),t(e)},function(e){o.afterCb(n,e),r(e)})})},this.proxies.fetch=window.fetch)},observeResourceFetchingMutations:function(a){if(T()){var s=["img","script","iframe","link","audio","video","source"],e=new MutationObserver(function(e){var t,r;try{for(var n=v(e),o=n.next();!o.done;o=n.next()){var i=o.value;("childList"===i.type&&function e(t,r){var n,o;try{for(var i=v(t),a=i.next();!a.done;a=i.next()){var s=a.value;if(r.includes(s.nodeName.toLowerCase())||s.children&&e(s.children,r))return 1}}catch(e){n={error:e}}finally{try{a&&!a.done&&(o=i.return)&&o.call(i)}finally{if(n)throw n.error}}}(i.addedNodes,s)||"attributes"===i.type&&s.includes(i.target.nodeName.toLowerCase()))&&a(i)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}});return e.observe(document,{attributes:!0,childList:!0,subtree:!0,attributeFilter:["href","src"]}),e}},resetOriginals:function(){this.originals.send&&XMLHttpRequest.prototype.send===this.proxies.send&&(ge=!1,XMLHttpRequest.prototype.send=this.originals.send),this.originals.fetch&&fetch===this.proxies.fetch&&(be=!1,window.fetch=this.originals.fetch)}},we="TTIMonitor",Se=(Me.prototype.setup=function(){},Me.prototype.isEnable=function(){return R()&&!!k()&&f(window.PerformanceResourceTiming)&&C()},Me.prototype.registerPerformanceObserver=function(){var s=this;this.performanceObserver=new PerformanceObserver(function(e){var t,r,n=e.getEntries();try{for(var o=v(n),i=o.next();!i.done;i=o.next()){var a=i.value;"resource"===a.entryType&&s.networkRequestFinishedCallback(a),"longtask"===a.entryType&&s.longTaskFinishedCallback(a)}}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}});try{this.performanceObserver.observe({type:"longtask"}),this.performanceObserver.observe({type:"resource",buffered:!0})}catch(e){this.performanceObserver.observe({entryTypes:["longtask","resource"]})}},Me.prototype.unregisterListeners=function(){this.performanceObserver&&this.performanceObserver.disconnect(),this.mutationObserver&&this.mutationObserver.disconnect(),ye.resetOriginals(),this.proxyConfig&&(this.proxyConfig.beforeCb=ve,this.proxyConfig.afterCb=ve)},Me.prototype.rescheduleTimer=function(e){var t=this;this.scheduleTimerTasks&&(this.timerActivationTime>e||(clearTimeout(this.timerId),this.timerId=window.setTimeout(function(){t.checkTTI()},e-performance.now()),this.timerActivationTime=e))},Me.prototype.startSchedulingTimerTasks=function(){this.scheduleTimerTasks=!0;var e=0<this.longTasks.length?this.longTasks[this.longTasks.length-1].end:0,t=this.computeLastKnownNetwork2Busy(this.incompleteRequestStarts,this.networkRequests);this.rescheduleTimer(Math.max(t+5e3,e))},Me.prototype.registerListeners=function(){ge||(ye.patchXMLHTTPRequest(this.proxyConfig),ge=!0),be||(ye.patchFetch(this.proxyConfig),be=!0),this.registerPerformanceObserver(),this.useMutationObserver&&(this.mutationObserver=ye.observeResourceFetchingMutations(this.mutationObserverCallback.bind(this)))},Me.prototype.mutationObserverCallback=function(e){this.rescheduleTimer(performance.now()+5e3)},Me.prototype.beforeJSInitiatedRequestCallback=function(e){this.incompleteJSInitiatedRequestStartTimes[e]=performance.now()},Me.prototype.afterJSInitiatedRequestCallback=function(e){this.incompleteJSInitiatedRequestStartTimes[e]=void 0},Me.prototype.networkRequestFinishedCallback=function(e){this.networkRequests.push({start:e.fetchStart,end:e.responseEnd}),this.rescheduleTimer(this.computeLastKnownNetwork2Busy(this.incompleteRequestStarts,this.networkRequests)+5e3)},Object.defineProperty(Me.prototype,"incompleteRequestStarts",{get:function(){for(var e=Object.keys(this.incompleteJSInitiatedRequestStartTimes),t=[],r=0;r<e.length;r++){var n=this.incompleteJSInitiatedRequestStartTimes[e[r]];"number"==typeof n&&t.push(n)}return t},enumerable:!1,configurable:!0}),Me.prototype.longTaskFinishedCallback=function(e){var t=e.startTime+e.duration;this.longTasks.push({start:e.startTime,end:t}),this.rescheduleTimer(t+5e3)},Me.prototype.checkTTI=function(){var e=this.computeLastKnownNetwork2Busy(this.incompleteRequestStarts,this.networkRequests),t=this.getFirstPaintTime()||performance.timing.domContentLoadedEventEnd-performance.timing.navigationStart,r=this.getMinValue(),n=performance.now();null===r&&this.rescheduleTimer(Math.max(e+5e3,n+1e3));n=this.computeTTI(t,r,e,n,this.longTasks);n?(this.callback&&"function"==typeof this.callback&&this.callback(Math.round(n)),this.disable()):this.rescheduleTimer(performance.now()+1e3)},Me.prototype.getMinValue=function(){if(this.minValue)return this.minValue;if(performance.timing.domContentLoadedEventEnd){var e=performance.timing;return e.domContentLoadedEventEnd-e.navigationStart}return null},Me.prototype.getFirstPaintTime=function(){if("PerformancePaintTiming"in window){var e=performance.getEntriesByType("paint")[0];return e?e.startTime:0}return 0},Me.prototype.disable=function(){clearTimeout(this.timerId),this.scheduleTimerTasks=!1,this.unregisterListeners(),this.snippetObserver&&this.snippetObserver.disconnect(),this.snippetEntries&&this.snippetEntries.splice(0,this.snippetEntries.length)},Me.prototype.computeLastKnownNetwork2Busy=function(e,t){var r,n,o,i;if(2<e.length)return performance.now();var a=[];try{for(var s=v(t),u=s.next();!u.done;u=s.next()){var c=u.value;a.push({timestamp:c.start,type:"requestStart"}),a.push({timestamp:c.end,type:"requestEnd"})}}catch(e){r={error:e}}finally{try{u&&!u.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}try{for(var l=v(e),p=l.next();!p.done;p=l.next()){var h=p.value;a.push({timestamp:h,type:"requestStart"})}}catch(e){o={error:e}}finally{try{p&&!p.done&&(i=l.return)&&i.call(l)}finally{if(o)throw o.error}}a.sort(function(e,t){return e.timestamp-t.timestamp});for(var f=e.length,m=a.length-1;0<=m;m--){var d=a[m];switch(d.type){case"requestStart":f--;break;case"requestEnd":if(2<++f)return d.timestamp;break;default:throw Error("Internal Error: This should never happen")}}return 0},Me.monitorName=we,Me);function Me(e){var t,r,n,o=this;if(this.name=we,this.longTasks=[],this.callback=ve,this.useMutationObserver=!0,this.minValue=null,this.isAsync=0,this.networkRequests=[],this.incompleteJSInitiatedRequestStartTimes={},this.timerActivationTime=-1/0,this.scheduleTimerTasks=!1,this.proxyConfig={beforeCb:this.beforeJSInitiatedRequestCallback.bind(this),afterCb:this.afterJSInitiatedRequestCallback.bind(this)},this.getTTI=function(e){o.callback=e,o.isEnable()?o.startSchedulingTimerTasks():o.callback&&"function"==typeof o.callback&&o.callback()},this.computeTTI=function(e,t,r,n,o){if(n-r<5e3)return null;o=0===o.length?e:o[o.length-1].end;return n-o<5e3?null:Math.max(o,t)},this.isEnable()){if(this.useMutationObserver=!!e.useMutationObserver,this.minValue=null!==(n=e.minValue)&&void 0!==n?n:null,this.isAsync=null!==(n=e.isAsync)&&void 0!==n?n:0,this.snippetEntries=null===(n=null==e?void 0:e.preLongTaskObserver)||void 0===n?void 0:n.precollect,this.snippetObserver=null===(e=null==e?void 0:e.preLongTaskObserver)||void 0===e?void 0:e.observer,!this.isAsync&&this.snippetEntries&&0<this.snippetEntries.length)try{for(var i=v(this.snippetEntries),a=i.next();!a.done;a=i.next()){var s=a.value;"longtask"===s.entryType?this.longTasks.push({start:s.startTime,end:s.startTime+s.duration}):"resource"===s.entryType&&this.networkRequests.push({start:s.fetchStart,end:s.responseEnd})}}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}this.registerListeners()}}function _e(e){try{for(var t,r=e,n=[],o=0,i=0,a=" > ".length;r&&o++<5&&!("html"===(t=function(e){var t,r,n,o,i=e,a=[];if(!i||!i.tagName)return"";a.push(i.tagName.toLowerCase()),i.id&&a.push("#"+i.id);e=i.className;if(e&&m(e))for(t=e.split(/\s+/),o=0;o<t.length;o++)a.push("."+t[o]);var s=["type","name","title","alt"];for(o=0;o<s.length;o++)r=s[o],(n=i.getAttribute(r))&&a.push("["+r+'="'+n+'"]');return a.join("")}(r))||1<o&&80<=i+n.length*a+t.length);)n.push(t),i+=t.length,r=r.parentNode;return n.reverse().join(" > ")}catch(e){return"<unknown>"}}var Pe="FIDMonitor",Ee=(Te.prototype.setup=function(e){var s=this;if(k()&&PerformanceObserver.supportedEntryTypes&&PerformanceObserver.supportedEntryTypes.includes("first-input")&&C()){this.callback=e,this.observer=new PerformanceObserver(function(e,t){var r,n;try{for(var o=v(e.getEntries()),i=o.next();!i.done;i=o.next()){var a=i.value,a=a.processingStart-a.startTime;s.callback({name:s.name,fid:Math.round(a)})}}catch(e){r={error:e}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}t.disconnect()});try{this.observer.observe({type:"first-input",buffered:!0})}catch(e){this.observer.observe({entryTypes:["first-input"]})}}},Te.monitorName=Pe,Te);function Te(){this.name=Pe,this.callback=q}var ke="MPFIDMonitor",Re=(Ce.prototype.setup=function(){var t,e,r,a=this;if(R()&&C()){if(!this.props.isAsync){var n=null!==(r=null===(r=this.props.preLongTaskObserver)||void 0===r?void 0:r.precollect)&&void 0!==r?r:[];if(n&&0<n.length)try{for(var o=v(n),i=o.next();!i.done;i=o.next()){var s=i.value;"longtask"===s.entryType&&this.list.push(s)}}catch(e){t={error:e}}finally{try{i&&!i.done&&(e=o.return)&&e.call(o)}finally{if(t)throw t.error}}}this.observer=new PerformanceObserver(function(e){var t,r;try{for(var n=v(e.getEntries()),o=n.next();!o.done;o=n.next()){var i=o.value;a.list.push(i)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}}),this.observer.observe({entryTypes:["longtask"]})}},Ce.prototype.getMPFID=function(){var t,e;if(R()&&C()){this.observer&&this.observer.disconnect();var r=0;try{for(var n=v(this.list),o=n.next();!o.done;o=n.next()){var i=o.value;r<i.duration&&(r=i.duration)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(t)throw t.error}}return this.formatEvent(Math.round(r))}},Ce.prototype.formatEvent=function(e){return{name:this.name,mpfid:e}},Ce.monitorName=ke,Ce);function Ce(e){this.name=ke,this.list=[],this.props=e}var xe=["xmlhttprequest","fetch"],Le="ResourcePerformanceMonitor",Oe=(qe.prototype.setup=function(e){this.isEnable()&&(this.callback=null!=e?e:q,this.isAsync&&window.performance.clearResourceTimings(),this.observe&&(this.sendResourcePerformance(performance.getEntriesByType("resource")),this.observePerformance()))},qe.prototype.isEnable=function(){return E()&&"function"==typeof performance.clearResourceTimings},qe.prototype.getPerformance=function(){return this.isEnable()?this.buildParams(this.getResources()):this.buildParams([])},qe.prototype.buildParams=function(e){var t=this,r=[];if(e.forEach(function(e){w(xe,e.initiatorType)||f(t.checkIgnore)&&t.checkIgnore(e)||r.push(e)}),r.length)return{name:this.name,type:"post",event:{ev_type:"resource_performance",resources:r}}},qe.prototype.sendResourcePerformance=function(e){e=this.buildParams(e);e&&this.callback(e)},qe.prototype.getResources=function(){return window.performance.getEntriesByType("resource")},qe.prototype.observePerformance=function(){var t=this;k()&&new PerformanceObserver(function(e){e=e.getEntries();e.length&&t.sendResourcePerformance(e)}).observe({entryTypes:["resource"]})},qe.monitorName=Le,qe);function qe(e){var t,r=this;this.name=Le,this.callback=q,this.getResourcePerformance=function(){var e;return null!==(e=r.getPerformance())&&void 0!==e?e:{}},this.isAsync=null!==(t=null==e?void 0:e.isAsync)&&void 0!==t?t:0,this.observe=null!==(t=null==e?void 0:e.observe)&&void 0!==t&&t,this.checkIgnore=null!==(e=null==e?void 0:e.checkIgnore)&&void 0!==e?e:function(){return!1}}var je={ev_type:"perf",isAsync:0,dns:0,tcp:0,request:0,response:0,processing:0,blank:0,domready:0,load:0,has_resource:0,domparse:0,resource:0,ttfb:0,redirect:0,tti:0,upload_reason:"sample",network_type:"",timing:{},navigation_timing:{},navigation:{},resources:[]},He="PerformanceMonitor",Ae=(Ie.prototype.setup=function(e){var t,r=this;P()&&(this.callback=e,t=function(){r.hasLoaded=!0,r.performanceAuto&&(r.perfTimer=setTimeout(function(){r.perfLog()},200))},"complete"!==document.readyState?window.addEventListener("load",function(){setTimeout(function(){t()},0)},!1):t(),this.sendParams=p({},je),this.staticPerformanceMonitor=new Oe,this.staticPerformanceMonitor.setup(),(new Ee).setup(this.hasFID),this.mpfidMonitor=new Re({isAsync:0,preLongTaskObserver:this.props.preLongTaskObserver}),this.mpfidMonitor.setup(),e=null!==(e=this.props.TTIMonitor)&&void 0!==e?e:Se,this.ttiMonitor=new e({isAsync:0,preLongTaskObserver:this.props.preLongTaskObserver}),this.ttiMonitor.setup(),e=this.syncPerfLog.bind(this),B(e))},Ie.prototype.performanceNow=function(){var e;return null!==performance&&void 0!==performance&&performance.now?performance.now():(Date.now?Date.now():+new Date)-(null!==(e=null===(e=performance.timing)||void 0===e?void 0:e.navigationStart)&&void 0!==e?e:0)},Ie.prototype.getBounced=function(){return!this.hasLoaded},Ie.prototype.getPaintTime=function(t){if(E()){var e=performance.getEntriesByType("paint");if(c(e)){e=e.filter(function(e){return e.name===t});return e.length&&e[0]&&u(e[0])&&e[0].startTime||0}}return 0},Ie.monitorName=He,Ie);function Ie(e){var o=this;this.name=He,this.callback=q,this.sendParams=p({},je),this.finalSendParams=this.sendParams,this.hasLoaded=!1,this.initStart=0,this.hasSentInitPerf=!1,this.initFlag=!0,this.performanceAuto=!0,this.send=function(){o.initFlag&&o.hasLoaded&&(o.sendParams.isAsync&&(o.sendParams.load=Math.round(o.performanceNow()-o.initStart)),setTimeout(function(){o.perfLog()},200))},this.initAsync=function(){var e,t;o.hasSentInitPerf&&(o.sendParams=p({},je),o.sendParams.isAsync=1,o.initFlag=!0,o.initStart=o.performanceNow(),o.staticPerformanceMonitor=new Oe({isAsync:1}),o.staticPerformanceMonitor.setup(),o.mpfidMonitor=new Re({isAsync:1,preLongTaskObserver:o.props.preLongTaskObserver}),o.mpfidMonitor.setup(),t=null!==(e=o.props.TTIMonitor)&&void 0!==e?e:Se,o.ttiMonitor=new t({minValue:Math.round(o.performanceNow()),isAsync:1,preLongTaskObserver:o.props.preLongTaskObserver}),o.ttiMonitor.setup(),null!==(t=null===(e=o.fmpMonitor)||void 0===e?void 0:e.setup)&&void 0!==t&&t.call(e,q))},this.stopAutoPerf=function(){o.performanceAuto=!1,clearTimeout(o.perfTimer)},this.getPerformance=function(){return o.finalSendParams.tti||("complete"===document.readyState?o.perfLog():o.perfLog(!0)),o.buildParams(o.finalSendParams)},this.buildParams=function(e){return{name:o.name,type:"post",event:e}},this.perfLog=function(e){if(void 0===e&&(e=!1),P()){if(o.initFlag=!1,o.finalSendParams=p({},o.sendParams),!o.sendParams.isAsync){var t=o.getBounced();if(t)return o.finalSendParams.bounced=t,void o.invokeCallback(0,o.buildParams(o.finalSendParams));o.finalSendParams=p(p({},o.finalSendParams),o.getParams())}var r=o.getStaticResources(),n=o.getFMP(),t=o.getMPFID();r&&(o.finalSendParams.resources=r,o.finalSendParams.has_resource=1),n&&(o.finalSendParams.fmp=Math.round(n)),n&&o.finalSendParams.fcp&&o.finalSendParams.fmp<o.finalSendParams.fcp&&(o.finalSendParams.fmp=o.finalSendParams.fcp),t&&(o.finalSendParams.mpfid=t),f(o.callback)&&(!e&&o.ttiMonitor&&f(o.ttiMonitor.getTTI)?o.ttiMonitor.getTTI(function(e){e&&0<e&&(o.finalSendParams.tti=o.finalSendParams.isAsync?Math.round(e-o.initStart):e),o.invokeCallback(o.finalSendParams.isAsync,o.buildParams(o.finalSendParams))}):o.invokeCallback(o.finalSendParams.isAsync,o.buildParams(o.finalSendParams)))}},this.invokeCallback=function(e,t){if(!e){if(o.hasSentInitPerf)return;o.hasSentInitPerf=!0}o.callback(t)},this.getStaticResources=function(){var e;if(o.staticPerformanceMonitor&&f(o.staticPerformanceMonitor.getResourcePerformance)){var t=o.staticPerformanceMonitor.getResourcePerformance();if(null!==(e=null==t?void 0:t.event)&&void 0!==e&&e.resources)return t.event.resources||[]}},this.getFMP=function(){var e,t;return o.fmpMonitor?(o.fmpMonitor.disconnect(),o.sendParams.isAsync?(null===(e=null==(t=o.fmpMonitor.getFmp())?void 0:t.event)||void 0===e?void 0:e.fmp)||0:f(o.fmpMonitor.getLoadFmp)?1!==o.props.renderType?2===o.props.renderType?o.getPaintTime("first-contentful-paint"):0:null!==(t=null===(t=(t=o.fmpMonitor.getLoadFmp()||{}).event)||void 0===t?void 0:t.fmp)&&void 0!==t?t:0:0):0},this.getMPFID=function(){if(o.mpfidMonitor&&f(o.mpfidMonitor.getMPFID)){var e=o.mpfidMonitor.getMPFID();if(e)return e.mpfid}},this.syncPerfLog=function(){var e,t;o.hasSentInitPerf||(o.perfLog(!0),null!==(t=(e=o.props).report)&&void 0!==t&&t.call(e))},this.hasFID=function(e){o.sendParams.fid=e.fid},this.getParams=function(){if(P()){var e={},t=window.performance.timing;e.dns=t.domainLookupEnd-t.domainLookupStart,e.tcp=t.connectEnd-t.connectStart,e.request=t.responseStart-t.requestStart,e.response=t.responseEnd-t.responseStart,e.processing=t.domComplete-t.domLoading,e.blank=t.responseEnd-t.navigationStart,e.domready=t.domInteractive-t.navigationStart,e.load=t.loadEventEnd-t.navigationStart,t.secureConnectionStart&&(e.ssl=t.connectEnd-t.secureConnectionStart),e.domparse=t.domInteractive-t.responseEnd,e.resource=t.loadEventStart-t.domContentLoadedEventEnd,e.ttfb=t.responseStart-t.requestStart,e.redirect=t.redirectEnd-t.redirectStart;var r=o.getPaintTime("first-paint"),t=o.getPaintTime("first-contentful-paint");r&&(e.fp=Math.round(r)),t&&(e.fcp=Math.round(t));r=function(){if(!E())return null;var e=window.performance.getEntriesByType("navigation");return c(e)&&0!==e.length?e[0]:null}(),t=P()?window.performance.timing:null;return(r||t)&&(e.navigation=null!=r?r:t),t&&(e.timing=t),r&&(e.navigation_timing=r),e}},e.fmpMonitor&&(this.fmpMonitor=e.fmpMonitor);var t=e.performanceAuto;this.performanceAuto=void 0===t||t,this.props=null!=e?e:{}}var De="StaticErrorMonitor",Fe=(Be.prototype.setup=function(e){M()&&(this.callback=e,window.addEventListener("error",this.staticErrorLog.bind(this),!0))},Be.prototype.getSrc=function(e){return"link"===e.tagName.toLowerCase()?Ne(e,"href"):Ne(e,"src")},Be.prototype.getParams=function(e,t){var r={ev_type:"static",st_type:t},t=L(e);r.st_src=e,r.st_protocol=t.protocol,r.st_domain=t.hostname,r.st_path=t.pathname;t=function(e){var t,r=null===(t=null===(n=window.performance)||void 0===n?void 0:n.getEntriesByType)||void 0===t?void 0:t.call(n,"resource"),n=null==r?void 0:r.length;if(!n)return;for(var o=n-1;-1<o;o--){var i=r[o];if(i.name===e)return i}}(t.href);return t&&(r.timing=t),r},Be.monitorName=De,Be);function Be(){var i=this;this.name=De,this.callback=q,this.buildEvent=function(e){var t,r,n=e||window.event||{};try{r=null!==(t=null!==(t=n.target)&&void 0!==t?t:n.srcElement)&&void 0!==t?t:{}}catch(n){return}var o=r.tagName;if(o&&m(o)){o=o.toLowerCase();e=i.getSrc(r);if(e&&e!==window.location.href)return{name:i.name,type:"get",event:i.getParams(e,o)}}},this.staticErrorLog=function(e){e=i.buildEvent(e);e&&i.callback(e)}}function Ne(e,t){var r;return e.getAttribute&&f(e.getAttribute)?null!==(r=e.getAttribute(t))&&void 0!==r?r:"":null!==(t=e[t])&&void 0!==t?t:""}var Je="EmitMonitor",Ue=(Xe.prototype.setup=function(e){this.callback=e||q},Xe.prototype.buildCustomTimeLog=function(e,t,r){return function(e){var t=e.name,r=e.tag,e=e.value;if(t&&e){e={ev_type:"custom",cm_name:t=f(t.toString)?t.toString():"",cm_type:"time",cm_value:e=+e};return r&&(r=f(r.toString)?r.toString():"",e.cm_tag=r),{name:"SentCustomTime",type:"get",event:e}}}({name:e,tag:t,value:r})},Xe.prototype.buildCustomCountLog=function(e,t){return function(e){var t=e.name,e=e.tag;if(t){t={ev_type:"custom",cm_name:t=f(t.toString)?t.toString():"",cm_type:"count"};return e&&(e=f(e.toString)?e.toString():"",t.cm_tag=e),{name:"SentCustomCount",type:"get",event:t}}}({name:e,tag:t})},Xe.prototype.buildEmitSingleEvent=function(e){e=ie(e);if(e&&(!e||e.event_name))return{name:this.name,type:"post",event:{ev_type:"flexible",flexible_data_list:[e]}}},Xe.monitorName=Je,Xe);function Xe(){var o=this;this.name=Je,this.callback=q,this.handOut=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=o.buildEvent.apply(o,s(e));o.callback(r)},this.buildEvent=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if("sendCustomCountLog"===e[0])return o.buildCustomCountLog(e[1],e[2]);if("sendCustomTimeLog"===e[0])return o.buildCustomTimeLog(e[1],e[2],e[3]);if("send"===e[0]){if("count"===e[1])return o.buildCustomCountLog(e[2].category,e[2].action);if("timing"===e[1])return o.buildCustomTimeLog(e[2].category,e[2].action,e[2].value)}if("emit"===e[0]&&e[1]&&e[2]){var r={type:e[1],event:e[2]};return o.buildEmitSingleEvent(r)}},this.send=function(e,t,r){var n=r.action,r=r.value;"count"===e&&o.sendCustomCountLog(t,n),"timing"===e&&o.sendCustomTimeLog(t,n,r)},this.sendCustomTimeLog=function(e,t,r){r=o.buildCustomTimeLog(e,t,r);o.callback(r)},this.sendCustomCountLog=function(e,t){t=o.buildCustomCountLog(e,t);return o.callback(t),t},this.emitEvent=function(e){e=o.buildEmitSingleEvent(e);o.callback(e)}}var Qe="BreadcrumbMonitor",ze=(Ve.prototype.setup=function(){this.instrumentDOM()},Ve.prototype.instrumentDOM=function(){var e;"document"in window&&(e=this,window.document.addEventListener("click",e.domEventHandler("click",e.triggerHandlers.bind(e,"dom")),!1),window.document.addEventListener("keypress",e.keypressEventHandler(e.triggerHandlers.bind(e,"dom")),!1))},Ve.prototype.domEventHandler=function(t,r,n){var o=this;return void 0===n&&(n=!1),function(e){o.keypressTimeout=void 0,e&&o.lastCapturedEvent!==e&&(o.lastCapturedEvent=e,o.debounceTimer&&clearTimeout(o.debounceTimer),n?o.debounceTimer=setTimeout(function(){r({event:e,name:t})}):r({event:e,name:t}))}},Ve.prototype.triggerHandlers=function(e,t){if(e)try{this.domBreadcrumb(t)}catch(e){}},Ve.prototype.keypressEventHandler=function(n){var o=this;return function(e){var t;try{t=e.target}catch(e){return}var r=t&&t.tagName;r&&("INPUT"===r||"TEXTAREA"===r||t.isContentEditable)&&(o.keypressTimeout||o.domEventHandler("input",n)(e),clearTimeout(o.keypressTimeout),o.keypressTimeout=window.setTimeout(function(){o.keypressTimeout=void 0},o.debounceDuration))}},Ve.prototype.domBreadcrumb=function(e){var t;try{t=e.event.target?_e(e.event.target):_e(e.event)}catch(e){t="<unknown>"}0!==t.length&&this.addBreadcrumb({category:"ui."+e.name,message:t})},Ve.monitorName=Qe,Ve);function Ve(e){var n=this;this.name=Qe,this.breadcrumbs=[],this.getBreadcrumbs=function(){return n.breadcrumbs},this.addBreadcrumb=function(e){var t=p(p({},e),{timestamp:(new Date).getTime()}),r=n.maxBreadcrumbs,e=n.breadcrumbs;return n.breadcrumbs=0<=r?s(e,[t]).slice(-r):s(e,[t]),n},this.debounceDuration=1e3,this.debounceTimer=0,this.breadcrumbs=[],this.maxBreadcrumbs=null!==(e=null==e?void 0:e.maxBreadcrumbs)&&void 0!==e?e:20}var Ke={enableCatchGlobalJSError:!0},We="JSExceptionMonitor",Ge=($e.prototype.setup=function(e){M()&&(this.callback=e,this.options.enableCatchGlobalJSError&&(window.addEventListener("error",this.jsErrorLog),window.addEventListener("unhandledrejection",this.jsPromiseRejectionLog)))},$e.prototype.buildEvent=function(e){if(!function(e){switch(Object.prototype.toString.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":return 1;default:return e instanceof Error}}(e)?(r(e)&&(t={message:JSON.stringify(e)}),m(e)&&(t={message:e})):t=e,t){var t={ev_type:"js_exception",exception:this.normalizeError(t),breadcrumbs:null!==(t=null===(t=this.options.breadcrumbMonitor)||void 0===t?void 0:t.getBreadcrumbs())&&void 0!==t?t:[]};return{name:this.name,type:"post",event:t}}},$e.prototype.logError=function(e){e=this.buildEvent(e);e&&this.callback(e)},$e.prototype.getJSError=function(e){e=e.error;if(e)return e},$e.prototype.getJSPromiseRejection=function(e){var t=void 0;try{"reason"in e?t=e.reason:"detail"in e&&"reason"in e.detail&&(t=e.detail.reason)}catch(e){}if(t)return t},$e.prototype.normalizeError=function(e){return{message:e.message,name:e.name,fileName:e.fileName,lineNumber:e.lineNumber,columnNumber:e.columnNumber,stack:e.stack,stacktrace:e.stacktrace,framesToPop:e.framesToPop}},$e.monitorName=We,$e);function $e(e){var t=this;this.name=We,this.callback=q,this.jsErrorLog=function(e){e=t.getJSError(e);e&&t.logError(e)},this.jsPromiseRejectionLog=function(e){e=t.getJSPromiseRejection(e);e&&t.logError(e)},this.options=p(p({},Ke),e)}var Ye=(Ze.prototype.sendEvent=function(e){e=this.getEventToBeSent(e);e&&this.idleSendEvent(e)},Ze.prototype.getEventToBeSent=function(e){e=this._modifyEvent(e);if(this._shouldSend(e))return e},Ze.prototype._modifyEvent=function(e){return e},Ze.prototype._shouldSend=function(e){return!0},Ze.prototype._send=function(e){},Ze.prototype.idleSendEvent=function(e){this._send(e)},Ze);function Ze(){}var et,tt=(e(rt,et=Ye),Object.defineProperty(rt.prototype,"ready",{get:function(){return this.isReady},set:function(e){this.isReady=e,this.isReady&&this._uploadQueue()},enumerable:!1,configurable:!0}),rt.prototype._send=function(e){var t=this,e=this.buildParams(e);null!=e&&(this.reportQueue.push(e),this.isReady&&(this.reportQueue.length>=this.batchReportLength&&this._uploadQueue(),this.batchReportTimeout&&clearTimeout(this.batchReportTimeout),this.batchReportTimeout=setTimeout(function(){t._uploadQueue()},this.batchReportWait)))},rt.prototype._uploadQueue=function(){var e;this.reportQueue.length&&this.ready&&(e={ev_type:"batch",list:this.reportQueue},this.reportQueue=[],this._request({event:e,type:"post"}))},rt.prototype._request=function(e){},rt);function rt(e){var t,r=et.call(this)||this;return r.reportQueue=[],r.isReady=!0,r.batchReportLength=null!==(t=e.maxBatchReportLength)&&void 0!==t?t:10,r.batchReportWait=null!==(e=e.batchReportWait)&&void 0!==e?e:1e3,r.batchReportTimeout=null,r}var nt="RANGERS_WEB_ID";function ot(){var e={flags:{hookPath:!0,hookXHR:!0,hookFetch:!0,enableSizeStats:!0,enableFMP:!0,enablePerformance:!0,enableResourcePerformance:!0,enableStaticError:!0,enableCatchJSError:!0,enableCatchGlobalJSError:!0,enableCatchJSErrorV2:!1,enableCrash:!0,enableMemoryRecord:!0,enableFPSJankTimesMonitor:!0,enableBreadcrumb:!0,hookConsole:!1,hookDom:!0}};return e.monitors={BaseMonitor:{appTypeSetting:{type:0,SPA:"",renderType:0},sampleHit:U(1)},JSErrorMonitor:{enable:!0,webIDHit:!0,sampleRate:1,webIDHitBehavior:!1,sampleHitBehavior:!1,ignoreErrors:[],whitelistUrls:[],blacklistUrls:[],download_link:""},AjaxMonitor:{enable:!0,enableError:!1,webIDHit:!0,sampleHit:U(1),sampleRate:1,sampleHitTrace:!1,ignore:te,abort:!1,whitelistUrls:[],statusCodeSample:{},requestUrlSample:[],errorRequestCollect:!1},PerformanceMonitor:{enable:!0,webIDHit:!0,sampleRate:1,webIDHitStaticResource:!1,sampleHitStaticResource:U(ee),slowSessionTime:re,spaSlowSessionTime:ne,geckoUrls:[],interval:0,checkPoint:[]},StaticErrorMonitor:{enable:!0,webIDHit:!0,sampleRate:1,ignore:te},ResourcePerformanceMonitor:{enable:!0,webIDHit:!0,sampleRate:1},BreadcrumbMonitor:{enable:!0},EmitMonitor:{enable:!0}},e.custom={},e.commonParams={aid:0,pid:"",version:"0.2.23",hostname:window.location.hostname,protocol:window.location.protocol.slice(0,-1),rangers_web_id:ct(Y()),rangers_session_id:Y(),context:{},url:window.location.href,timestamp:Date.now(),screen_resolution:N(),network_type:J()},e}var it,at,st,ut,ct=function(e){return null!==document&&void 0!==document&&document.cookie&&(e=D(document.cookie,nt)),e},lt=(it="/v2/user/webid",at="/v2/user/ssid",st="/v2/event/list",ut=[],["https://mcs.ctobsnssdk.com","https://mcs.itobsnssdk.com","https://mcs.tobsnssdk.com"].forEach(function(t){[it,at,st].forEach(function(e){ut.push(t+e)})}),ut);function pt(e){var t=e.sendParams,e=e.monitorsSetting;if(!t||!u(t)||!t.event)return!1;var r,n,e=e;if("AjaxMonitor"===t.name||"FetchMonitor"===t.name){var o=F(s(["/monitor_browser/collect"],lt)||[]);if(o&&o.test(t.event.ax_url))return!1}return!(null==e||!e.BaseMonitor.sampleHit)&&("AjaxMonitor"===t.name||"FetchMonitor"===t.name?function(e){var r=e.sendParams,t=e.ajaxMonitor;if(!t)return!0;if("2"!==r.event.ax_status[0]&&"3"!==r.event.ax_status[0])return t.enableError;if(!t.enable)return!1;if(!t.webIDHit)return!1;if(!t.sampleHit||!U(t.sampleRate))return!1;if(c(e=t.whitelistUrls)&&0<e.length){var n=F(t.whitelistUrls||[]);return n&&n.test(r.event.ax_url)?!0:!1}if((n=F(t.ignore||[]))&&n.test(r.event.ax_url))return!1;if((n=t.statusCodeSample)&&d(n,r.event.ax_status))return U(n[r.event.ax_status]);if(t=t.requestUrlSample){var o=!1,i=!1;if(t.forEach(function(e){var t;o||null!=(t=F([e.url]))&&t.test(r.event.ax_url)&&(o=!0,i=U(e.sampleRate))}),o)return i}return!0}({sendParams:t,ajaxMonitor:e.AjaxMonitor}):"PerformanceMonitor"===t.name?!(r=(r={performanceMonitor:e.PerformanceMonitor}).performanceMonitor)||!!r.enable&&(!!r.webIDHit&&U(r.sampleRate)):"StaticErrorMonitor"===t.name?(o={sendParams:t,staticErrorMonitor:e.StaticErrorMonitor},r=o.sendParams,!(o=o.staticErrorMonitor)||!!o.enable&&(!!o.webIDHit&&(!!U(o.sampleRate)&&!((o=F(o.ignore||[]))&&o.test(r.event.st_src))))):"JSExceptionMonitor"===t.name?!(n=(n={jsErrorMonitor:e.JSErrorMonitor}).jsErrorMonitor)||!!n.enable&&(!!n.webIDHit&&U(n.sampleRate)):"ResourcePerformanceMonitor"===t.name?!(n=(n={resourcePerformanceMonitor:e.ResourcePerformanceMonitor}).resourcePerformanceMonitor)||!!n.enable&&(!!n.webIDHit&&U(n.sampleRate)):"EmitMonitor"!==t.name||!!{emitMonitor:e.EmitMonitor}.emitMonitor)}function ht(e){var t=e.sendParams,r=e.commonParams,n=e.custom,e=e.breadcrumbMonitor,e=function(e){var t=e.sendParams,r=e.commonParams,n=e.breadcrumbMonitor;if((e={}).ev_type=t.event.ev_type,e.common=r,"PageViewMonitor"===t.name&&e)return e;if(("AjaxMonitor"===t.name||"FetchMonitor"===t.name)&&e){r=t.event,r=(r.ev_type,a(r,["ev_type"]));return e.event=r,e}if("PerformanceMonitor"===t.name&&e){t.event.navigation=t.event.navigation_timing;var o=t.event,o=(o.ev_type,a(o,["ev_type"]));return e.ev_type="performance",e.event={fp:o.fp,fcp:o.fcp,fmp:o.fmp,tti:o.tti,fid:o.fid,mpfid:o.mpfid,isAsync:o.isAsync,timing:o.timing,navigation:o.navigation_timing,bounced:o.bounced},e}if("StaticErrorMonitor"===t.name&&e){e.ev_type="resource_error";o=t.event,o=(o.ev_type,a(o,["ev_type"]));return e.event=o,e}if("ResourcePerformanceMonitor"===t.name&&e){e.ev_type="resource";var i=t.event,i=(i.ev_type,a(i,["ev_type"]));return e.event=i,e}if("JSExceptionMonitor"===t.name&&e){e.ev_type="js_error";i=t.event,i=(i.ev_type,a(i,["ev_type"]));return e.event=i.exception,e.breadcrumbs=null!==(n=null==n?void 0:n.getBreadcrumbs())&&void 0!==n?n:[],e}return"EmitMonitor"===t.name&&e&&(e.ev_type="flexible",e.flexible_data_list=t.event.flexible_data_list),e}({sendParams:t,commonParams:p(p({},null!=r?r:{}),{url:window.location.href}),breadcrumbMonitor:e});return n&&f(n.beforeSend)&&(e=n.beforeSend(e||{})),e}function ft(e){return"https://"+e+"/monitor_browser/collect"}var mt,dt=(e(vt,mt=tt),vt.prototype._shouldSend=function(e){return pt({sendParams:e,monitorsSetting:this.options.monitorsSetting})},vt.prototype._modifyEvent=function(e){return(e=(e={sendParams:e}).sendParams)&&u(e)?e:{}},vt.prototype._request=function(e){var t,r;e&&e.event&&(t=e.type,r=e.event,"beacon"===this.options.reportType&&navigator&&navigator.sendBeacon?(e=JSON.stringify(r),navigator.sendBeacon(this.getReportURL(),e)):this.transport&&("get"!==t?"post"===t&&this.transport.postEvent(r):this.transport.getEvent(r)))},vt.prototype.buildParams=function(e){var t,r=null===(t=null===(t=this.options.monitorsSetting)||void 0===t?void 0:t.BreadcrumbMonitor)||void 0===t||!t.enable||null===(r=this.options.monitors)||void 0===r?void 0:r.BreadcrumbMonitor;return ht({sendParams:e,commonParams:this.options.commonParams,custom:this.options.custom,breadcrumbMonitor:r})},vt.prototype.getReportURL=function(){return this.reportURL},vt);function vt(e){var o=mt.call(this,e)||this;return o.options={},o.setTransport=function(){o.transport=new X({reportURL:o.getReportURL()}),o.preQueue.forEach(function(e){mt.prototype.sendEvent.call(o,e)})},o.updateConfig=function(e){var t,r,n;o.options=(t={previousOptions:o.options,newOptions:e},r=t.previousOptions,n=t.newOptions,(e=p(p({},r),n)).commonParams=i({},null!==(t=r.commonParams)&&void 0!==t?t:{},null!==(t=n.commonParams)&&void 0!==t?t:{}),e.monitorsSetting=i({},null!==(t=r.monitorsSetting)&&void 0!==t?t:{},null!==(t=n.monitorsSetting)&&void 0!==t?t:{}),e.monitors=p(p({},null!==(t=r.monitors)&&void 0!==t?t:{}),null!==(t=n.monitors)&&void 0!==t?t:{}),e.custom=p(p({},null!==(r=r.custom)&&void 0!==r?r:{}),null!==(n=n.custom)&&void 0!==n?n:{}),e)},o.sendEvent=function(e){o.transport?mt.prototype.sendEvent.call(o,e):o.preQueue.push(e)},o.uploadQueue=function(){o._uploadQueue()},o.reportURL=null!==(e=null==e?void 0:e.reportURL)&&void 0!==e?e:"",o.preQueue=[],o}gt.getClientCommonParams=function(r){void 0===r&&(r={});var n={};if(!u(r))return n;var o=["context","pid"];t(r,function(e,t){w(o,e)&&(n[e]=t)});return t({user_unique_id:"rangers_web_id",app_id:"aid"},function(e,t){d(r,e)&&(n[t]=r[e])}),n},gt.getClientFlags=function(e){void 0===e&&(e={});var r={};if(!u(e))return r;var n=["hookPath","hookXHR","hookFetch","enableSizeStats","enableFMP","enablePerformance","enableStaticError","enableCatchJSError","enableCatchJSErrorV2","enableCatchGlobalJSError","enableResourcePerformance","enableCrash","enableMemoryRecord","enableFPSJankTimesMonitor","enableBreadcrumb","hookConsole"];return t(e,function(e,t){w(n,e)&&(r[e]=t)}),r},gt.getClientCustom=function(e){var t={};return e.beforeSend&&f(e.beforeSend)&&(t.beforeSend=e.beforeSend),t},gt.getClientMonitorsSetting=function(e){return e=(t={setting:e}).setting,t={JSErrorMonitor:{},PerformanceMonitor:{},BreadcrumbMonitor:{},StaticErrorMonitor:{},ResourcePerformanceMonitor:{},BaseMonitor:{appTypeSetting:{}},AjaxMonitor:{}},e.ajaxWhitelistUrls&&c(e.ajaxWhitelistUrls)&&(t.AjaxMonitor.whitelistUrls=(t.AjaxMonitor.whitelistUrls||[]).concat(e.ajaxWhitelistUrls)),e.ignoreAjax&&c(e.ignoreAjax)&&(t.AjaxMonitor.ignore=(t.AjaxMonitor.ignore||[]).concat(e.ignoreAjax)),e.ignoreStatic&&c(e.ignoreStatic)&&(t.StaticErrorMonitor.ignore=(t.StaticErrorMonitor.ignore||[]).concat(e.ignoreStatic)),e.ignoreErrors&&c(e.ignoreErrors)&&(t.JSErrorMonitor.ignoreErrors=e.ignoreErrors),e.errorBlacklistUrls&&c(e.errorBlacklistUrls)&&(t.JSErrorMonitor.blacklistUrls=e.errorBlacklistUrls),e.errorWhitelistUrls&&c(e.errorWhitelistUrls)&&(t.JSErrorMonitor.whitelistUrls=e.errorWhitelistUrls),d(e,"sampleRate")&&(t.BaseMonitor.sampleHit=U(e.sampleRate)),t;var t},gt.prototype.configure=function(e){if(u(e)){if(this.userConfig=p(p({},this.userConfig||{}),e||{}),!this.serverDomain){if(!this.userConfig.serverDomain)return void console.error('"serverDomain" must be configured');this.serverDomain=this.userConfig.serverDomain}this.updateCurrentSetting(),this.client?this.updateClientConfig(this.getClientOptions()):this.init()}},gt.prototype.emitEvent=function(e){var t;this.monitors.EmitMonitor&&(t=this.monitors.EmitMonitor).handOut.apply(t,s(e))},gt.prototype.init=function(){var t=this,r=this.getClientOptions();this.client=new dt(r),this.getUserIDFromRangers(function(e){t.finderSetting={user_unique_id:e.user_unique_id},t.updateCurrentSetting(),t.updateClientConfig(r)}),this.sendPageview(),this.setupMonitors(this.setMonitors()),this.getServerSetting()},gt.prototype.getServerSetting=function(){var t=this;if(this.serverSetting)return this.updateCurrentSetting(),void this.afterServerSetting();var e="https://"+this.serverDomain+"/settings/get/web?aid="+this.currentSetting.commonParams.aid;X.get(e,{success:function(e){try{t.serverSetting=e.data,t.updateCurrentSetting(),t.afterServerSetting()}catch(e){t.afterServerSetting()}},fail:function(){t.afterServerSetting()}})},gt.prototype.afterServerSetting=function(){this.updateClientConfig(this.getClientOptions()),this.client.setTransport()},gt.prototype.updateCurrentSetting=function(){var e={commonParams:gt.getClientCommonParams(this.finderSetting),flags:gt.getClientFlags({}),custom:gt.getClientCustom({}),monitors:gt.getClientMonitorsSetting({})},t={commonParams:gt.getClientCommonParams({}),flags:gt.getClientFlags({}),custom:gt.getClientCustom({}),monitors:this.serverSetting?(r=this.serverSetting,n={JSErrorMonitor:{},PerformanceMonitor:{},BreadcrumbMonitor:{},StaticErrorMonitor:{},BaseMonitor:{},ResourcePerformanceMonitor:{},AjaxMonitor:{}},(r=r.setting).jserr&&(n.JSErrorMonitor.enable=r.jserr.enable,n.JSErrorMonitor.webIDHit=U(r.jserr.enable_user_rate),n.JSErrorMonitor.sampleRate=r.jserr.enable_sample_rate),r.performance&&(n.PerformanceMonitor.enable=r.performance.enable,n.PerformanceMonitor.webIDHit=U(r.performance.enable_user_rate),n.PerformanceMonitor.sampleRate=r.performance.enable_sample_rate),r.breadcrumb&&(n.BreadcrumbMonitor.enable=r.breadcrumb.enable),r.static_resource_error&&(n.StaticErrorMonitor.enable=r.static_resource_error.enable),r.static_resource&&(n.ResourcePerformanceMonitor.enable=r.static_resource.enable,n.ResourcePerformanceMonitor.webIDHit=U(r.static_resource.enable_user_rate),n.ResourcePerformanceMonitor.sampleRate=r.static_resource.enable_sample_rate),r.request&&(n.AjaxMonitor.enable=r.request.enable,n.AjaxMonitor.enableError=r.request.enableError,n.AjaxMonitor.webIDHit=U(r.request.enable_user_rate),n.AjaxMonitor.sampleRate=r.request.enable_sample_rate),n):gt.getClientMonitorsSetting({})},r={commonParams:gt.getClientCommonParams(this.userConfig),flags:gt.getClientFlags(this.userConfig),custom:gt.getClientCustom(this.userConfig),monitors:gt.getClientMonitorsSetting(this.userConfig)},n=this.currentSetting;this.currentSetting=o({},this.defaultSetting,t,r,e),this.currentSetting.commonParams.pid=this.currentSetting.commonParams.pid||location.pathname,this.settingEffect(this.currentSetting,n)},gt.prototype.settingEffect=function(e,t){var r;(r=e.commonParams.rangers_web_id)!==D(document.cookie,nt)&&(document.cookie=nt+"="+r+";max-age=7776000;domain="+location.hostname+";path=/"),t.commonParams.pid!==e.commonParams.pid&&this.sendPageview()},gt.prototype.setMonitors=function(){var t,e=this.currentSetting.commonParams,r=e.aid,n=e.rangers_web_id,o=[],i=this.currentSetting.flags,e=new me;return o.push(e),o.push(new Ue),i.enableCatchJSError&&o.push(new Ge),i.hookXHR&&o.push(new se({commonParams:{bid:r+"",web_id:n},ajaxMonitorOptions:this.currentSetting.monitors.AjaxMonitor})),i.hookFetch&&o.push(new pe({commonParams:{bid:r+"",web_id:n},ajaxMonitorOptions:this.currentSetting.monitors.AjaxMonitor})),i.enableStaticError&&o.push(new Fe),i.enablePerformance&&(i.enableFMP?o.push(new Ae({fmpMonitor:e,renderType:1,preLongTaskObserver:{precollect:[],observer:void 0}})):o.push(new Ae({renderType:1,preLongTaskObserver:{precollect:(null===(e=window.RangersSiteSDK.lt)||void 0===e?void 0:e.e)||[],observer:null===(e=window.RangersSiteSDK.lt)||void 0===e?void 0:e.o}}))),i.enableBreadcrumb&&o.push(new ze),i.enableResourcePerformance&&(t=this.serverDomain,o.push(new Oe({observe:!0,checkIgnore:function(e){return e.name===ft(t)||("xmlhttprequest"===e.initiatorType||"fetch"===e.initiatorType||"beacon"===e.initiatorType||"navigation"===e.initiatorType||0===e.decodedBodySize)}}))),o},gt.prototype.setupMonitors=function(e){var t=this;this.client&&this.client.sendEvent&&(e.forEach(function(e){"FMPMonitor"===(t.monitors[e.name]=e).name?e.setup(q):e.setup(null===(e=t.client)||void 0===e?void 0:e.sendEvent)}),this.updateClientConfig({monitors:this.monitors}))},gt.prototype.getUserIDFromRangers=function(t){window.collectEvent&&f(window.collectEvent)&&window.collectEvent("getToken",function(e){t(e)})},gt.prototype.sendPageview=function(){var e;null!==(e=this.client)&&void 0!==e&&e.sendEvent({name:"PageViewMonitor",event:{ev_type:"pageview"},type:"post"})},gt.prototype.getClientOptions=function(){var e=this.currentSetting;return{reportURL:ft(this.serverDomain),monitorsSetting:e.monitors,commonParams:e.commonParams,custom:e.custom}},gt.prototype.uploadClientQueue=function(){var e;null!==(e=this.client)&&void 0!==e&&e.uploadQueue()},gt.prototype.updateClientConfig=function(e){var t;null!==(t=this.client)&&void 0!==t&&t.updateConfig(e)},Ye=gt;function gt(){var r=this;this.version="0.2.23",this.serverDomain="tbm.snssdk.com",this.instance=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];"config"!==e[0]?"emit"!==e[0]?"report"!==e[0]?r.initOnCloseCallback():r.uploadClientQueue():r.emitEvent(e):r.configure(e[1])},this.initOnCloseCallback=function(){B(r.onCloseReport,r.visibilityChange)},this.visibilityChange=function(){"hidden"===document.visibilityState&&r.onCloseReport(),"visible"===document.visibilityState&&r.updateClientReportType("xhr")},this.onCloseReport=function(){r.updateClientReportType("beacon"),r.uploadClientQueue()},this.updateClientReportType=function(e){var t;null!==(t=r.client)&&void 0!==t&&t.updateConfig({reportType:e})},this.userConfig={},this.defaultSetting=ot(),this.currentSetting=this.defaultSetting,this.serverSetting=void 0,this.finderSetting={},this.client=void 0,this.monitors={}}var bt=q;return M()&&(tt=new Ye,bt=tt.instance,null!==(Ye=window.RangersSiteSDK)&&void 0!==Ye&&Ye.q&&(c(Ye=window.RangersSiteSDK.q)&&Ye.forEach(function(e){bt.apply(void 0,s(e))}),delete window.RangersSiteSDK.q),window.RangersSiteSDK=tt.instance),bt}(); |
@@ -1,1 +0,1 @@ | ||
var RangersSiteHybridSDK=function(){"use strict";var r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};var p=function(){return(p=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function a(e,t){var r={};for(o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(r[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var n=0,o=Object.getOwnPropertySymbols(e);n<o.length;n++)t.indexOf(o[n])<0&&Object.prototype.propertyIsEnumerable.call(e,o[n])&&(r[o[n]]=e[o[n]]);return r}function v(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function f(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),a=[];try{for(;(void 0===t||0<t--)&&!(n=i.next()).done;)a.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a}function s(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(f(arguments[t]));return e}function c(e){return"object"==typeof e&&null!==e&&!u(e)}function n(e){return"[object Object]"===(e=e,Object.prototype.toString.call(e))}function m(e){return"function"==typeof e}function d(e){return"[object String]"===Object.prototype.toString.call(e)}function u(e){return"[object Array]"===Object.prototype.toString.call(e)}function l(e){return"number"==typeof e}function h(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function t(e,t){if(c(e))for(var r in e)h(e,r)&&t.call(null,r,e[r])}function i(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var r={},n=0;n<e.length;)r=function(e,t){var r,n=p({},e);for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&void 0!==t[r]&&(c(t[r])&&y(t[r])?n[r]=b(c(e[r])?e[r]:{},t[r]):u(t[r])?n[r]=t[r].slice():n[r]=t[r]);return n}(r,e[n]),n++;return r}function o(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var r={},n=0;n<e.length;)r=b(r,e[n]),n++;return r}var g=Object.getPrototypeOf?Object.getPrototypeOf({}):null;function y(e){return Object.getPrototypeOf?Object.getPrototypeOf(e)===g:e.constructor===Object}function b(e,t){var r,n=p({},e);for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&void 0!==t[r]&&(c(t[r])&&y(t[r])?n[r]=b(c(e[r])?e[r]:{},t[r]):u(e[r])||u(t[r])?n[r]=function t(e,r){var e=u(e)?e:[];var r=u(r)?r:[];return Array.prototype.concat.call(e,r).map(function(e){return!(e instanceof RegExp)&&(u(e)||c(e)&&y(e))?u(e)?t([],e):b({},e):e})}(e[r],t[r]):n[r]=t[r]);return n}function w(e,t){if(!u(e))return!1;if(0===e.length)return!1;for(var r=0;r<e.length;){if(e[r]===t)return!0;r++}return!1}function S(){if("fetch"in window)try{return new Headers,new Request(""),new Response,1}catch(e){return}}function M(){return!!c(window)}function e(){return M()&&!!c(window.performance)}function P(){return e()&&!!c(window.performance.timing)}function E(){return!!e()&&!!m(window.performance.getEntries)}function _(){return M()&&"function"==typeof window.MutationObserver}function T(){return M()&&"function"==typeof window.PerformanceObserver}function k(){return!!T()&&m(window.PerformanceLongTaskTiming)}function C(){if(!T())return!1;var e=window.PerformanceObserverEntryList;return m(e)&&m(e.prototype.getEntries)}function x(e){var r,e=function(e){if(!c(e))return{};var r={};return t(e,function(e,t){c(t)||u(t)?r[e]=JSON.stringify(t):r[e]=t}),r}(e),e=(r={},t(e,function(e,t){r[encodeURIComponent(e)]=encodeURIComponent(t)}),r),n=[];return t(e,function(e,t){n.push(e+"="+t)}),n.join("&")}function R(e){var t=document.createElement("a");t.href=e;e=t.pathname||"/";return"/"!==e[0]&&(e="/"+e),{href:t.href,protocol:t.protocol.slice(0,-1),hostname:t.hostname,host:t.host,search:t.search,pathname:e,hash:t.hash}}var L=function(e){if(!d(e))return!1;return m(e.toLowerCase)&&(e=e.toLowerCase()),w(["x-tt-token"],e)};function O(){}function j(e){var t="[object String]"===Object.prototype.toString.call(e);return e?t?e.length:ArrayBuffer&&e instanceof ArrayBuffer?e.byteLength:window.Blob&&e instanceof Blob?e.size:e.length||0:0}function q(e){if(!e)return"";if(!m(e.forEach))return"";var r=[];return e.forEach(function(e){var t;u(e)&&e[0]&&!L(e[0])&&(t=e[0],e=e[1]||"",r.push(t+": "+e))}),r.join("\r\n")}function H(e){var t={},r=R(e);return t.ax_protocol=r.protocol,t.ax_domain=r.hostname,t.ax_path=r.pathname,t.ax_url=(r.href||e).split("?")[0],t}function A(e,t){e=R(e),t=R(t);return e.protocol===t.protocol&&e.host===t.host}function I(e,t){var r,n;if(!e||!t)return"";var o=e.split(";"),i={};try{for(var a=v(o),s=a.next();!s.done;s=a.next()){var c=s.value.split("="),u=d(c[0])&&c[0].trim();u&&d(c[1])&&(i[u]=c[1].trim())}}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}return i[t]||""}function D(e){return u(e)&&e.length?function(e){for(var t=[],r=e.length,n=0;n<r;n++){var o=e[n];d(o)?t.push(o.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")):o&&o.source&&t.push(o.source)}return new RegExp(t.join("|"),"i")}(e):null}function F(t,r){m(t)&&(m(window.addEventListener)&&(window.addEventListener("unload",t),window.addEventListener("beforeunload",t),window.addEventListener("pagehide",t)),m(document.addEventListener)&&document.addEventListener("visibilitychange",function(e){m(r)?r(e):"hidden"===document.visibilityState&&t(e)}))}var B=function(e){var t,r;return void 0===e&&(e=window),M()&&null!==(t=e.screen)&&void 0!==t&&t.width&&null!==(r=e.screen)&&void 0!==r&&r.height?e.screen.width+"x"+e.screen.height:"0x0"},N=function(){var e="unknown",t=navigator.connection||navigator.mozConnection||navigator.webkitConnection;return t&&d(t.effectiveType)?t.effectiveType:e};function J(e){return!!e&&Math.random()<Number(e)}var U=(X.post=function(e,t,r){var n=r&&r.success||O,o=r&&r.fail||O,r=new XMLHttpRequest;r.open("POST",e,!0),r.setRequestHeader("Content-Type","application/json"),r.send(JSON.stringify(t)),r.onload=function(){try{var e;this.responseText?(e=JSON.parse(this.responseText),n(e)):n({})}catch(e){o()}},r.onerror=function(){o()},r.onabort=function(){o()}},X.get=function(e,t){var r=t&&t.success||O,n=t&&t.fail||O,o=t&&t.getResponse||O,i=t&&t.getResponseText||O,a=new XMLHttpRequest;t&&t.withCredentials&&(a.withCredentials=t.withCredentials),a.open("GET",e),a.send(),a.onload=function(){o(null==this?void 0:this.response),i(this.responseText);try{var e;this.responseText?(e=JSON.parse(this.responseText),r(e)):r({})}catch(e){n()}},a.onerror=function(){n()},a.onabort=function(){n()}},X.prototype.getCommonParams=function(){return{timestamp:Date.now()}},X);function X(e){var t=this;this.postEvent=function(e){e=p(p({},e),t.getCommonParams());X.post(t.url,e)},this.getEvent=function(e){e=x(p(p({},e),t.getCommonParams())),e=t.url+"?"+e;X.get(e)},this.getURL=function(){return t.url},this.options=e,this.url=this.options.reportURL}function z(e,t,r){if(void 0===r&&(r="0"),1<r.length)throw new TypeError("expect the length of pad to be 1, but got "+e.length);return e.length>=t?e:""+Array.from({length:t-e.length}).fill(r).join("")+e}function V(e){return e?Math.floor(Math.random()*Math.pow(10,12)).toString(16).substr(0,e):""}var K="x-tt-trace-id",G="x-tt-trace-host",Q="x-tt-logid";function W(e,t,r){void 0===r&&(r="01");t=""+z((Date.now()%4294967295).toString(16),8)+function(e){if("number"==typeof e)r=e;else{var t=e.replace(/-/g,"");if(!/^[0-9]+$/.test(t)){if(18<t.length)return"18"+V(18);e=22-t.length-4;return""+z(""+t.length,2)+t+V(e)}r=parseInt(t,10)}var r=22-(t=r.toString(16)).length-4;return""+z(""+t.length,2)+t+V(r)}(e)+("string"==typeof t?V(4):z(t.toString(16),4));return"00-"+t+"-"+t.substr(0,16)+"-"+r}function $(){var e=function(){for(var e=new Array(16),t=0,r=0;r<16;r++)0==(3&r)&&(t=4294967296*Math.random()),e[r]=t>>>((3&r)<<3)&255;return e}();return e[6]=15&e[6]|64,e[8]=63&e[8]|128,function(e){for(var t=[],r=0;r<256;++r)t[r]=(r+256).toString(16).substr(1);var n=0;return[t[e[n++]],t[e[n++]],t[e[n++]],t[e[n++]],"-",t[e[n++]],t[e[n++]],"-",t[e[n++]],t[e[n++]],"-",t[e[n++]],t[e[n++]],"-",t[e[n++]],t[e[n++]],t[e[n++]],t[e[n++]],t[e[+n]],t[e[15]]].join("")}(e)}function Y(){return m(Date)?Math.round(Date.now()/1e3):0}var Z=.1,ee=["/log/sentry/"],te=8e3,re=4e3;$(),$();function ne(e,r){if(!c(e))return{};if(!m(r))return{};var n={};return t(e,function(e,t){r(t)&&(n[e]=t)}),n}function oe(e){var t,r,n,o,i=null;return c(e)&&("timer"===e.type&&(i=c(t=e.event)&&d(t.name)&&l(t.value)?{metrics_type:"timer",event_name:"default",metrics:((r={})[t.name]=t.value,r),category:ne(t.tags,d),timestamp:Y()}:{}),"counter"===e.type&&(i=c(o=e.event)&&d(o.name)&&l(o.value)?{metrics_type:"counter",event_name:"default",metrics:((n={})[o.name]=o.value,n),category:ne(o.tags,d),timestamp:Y()}:{}),"log"===e.type&&(i=c(n=e.event)&&d(n.value)?{metrics_type:"log",event_name:"default",log_content:n.value,log_level:null!==(o=n.level)&&void 0!==o?o:"info",category:ne(n.tags,d),timestamp:Y()}:{}),"custom"===e.type&&(i=c(e=e.event)&&d(e.event_name)?{metrics_type:"custom",event_name:e.event_name,metrics:ne(e.metrics,l),category:ne(e.tags,d),timestamp:Y()}:{})),i}var ie="AjaxMonitor",ae=(se.prototype.setup=function(e){void 0===e&&(e=O),m(XMLHttpRequest)&&(this.callback=e,this.start())},se.prototype.updateConfig=function(e){this.props=o({},this.props,e)},se.prototype.start=function(){this.hookXMLHttpRequestOpen(),this.hookXMLHttpRequestSend(),this.hookXMLHttpRequestSetRequestHeader()},se.prototype.hookXMLHttpRequestSetRequestHeader=function(){var r=XMLHttpRequest.prototype.setRequestHeader||O;XMLHttpRequest.prototype.setRequestHeader=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this._requestHeaders=this._requestHeaders||[],this._requestHeaders.push(e),r.apply(this,e)}},se.prototype.hookXMLHttpRequestOpen=function(){var o=XMLHttpRequest.prototype.open;XMLHttpRequest.prototype.open=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=e[0],n=e[1];return this._url=n||"",this._method=(null==r?void 0:r.toLowerCase())||"",o.apply(this,e)}},se.prototype.hookXMLHttpRequestSend=function(){var o=this,i=XMLHttpRequest.prototype.send;XMLHttpRequest.prototype.send=function(){for(var e,t,r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];return o.checkAddTrace(this._url)&&(e=(t=null!==(e=null==o?void 0:o.props.commonParams)&&void 0!==e?e:{}).bid,t=t.web_id,e&&t&&(o.traceId=W(t,e),this.setRequestHeader(K,o.traceId))),o.hookXMLHttpRequestOnreadystatechange.call(this,o),this._start=Date.now(),this._data=null==r?void 0:r[0],i.apply(this,r)}},se.prototype.checkAddTrace=function(e){var t=null!==(n=this.props.commonParams)&&void 0!==n?n:{},r=t.bid,n=t.web_id,t=(null!==(t=this.props.ajaxMonitorOptions)&&void 0!==t?t:{}).sampleHitTrace,e=A(location.href,e);return r&&n&&t&&e},se.prototype.collectErrorRequest=function(){var e;return null!==(e=null===(e=this.props.ajaxMonitorOptions)||void 0===e?void 0:e.errorRequestCollect)&&void 0!==e&&e},se.prototype.hookXMLHttpRequestOnreadystatechange=function(i){var a=this.onreadystatechange,s=this;this.onreadystatechange=function(){for(var e,t,r,n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];if(4===this.readyState&&(t={ev_type:"ajax",ax_status:(this.status||0).toString(),ax_type:s._method,ax_request_header:q(s._requestHeaders||[]),ax_domain:"",ax_duration:0,ax_path:"",ax_protocol:"",ax_response_header:"",ax_size:0,ax_url:""},"function"==typeof this.getAllResponseHeaders&&(t.ax_response_header=function(t){if(d(t)){var e=t.split("\r\n"),r=[];return e.forEach(function(e,t){e&&m(e.split)&&(e=e.split(": "),r.push([e[0],e[1]]))}),q(r)}return c(t)?q(Object.keys(t).map(function(e){return[e,t[e]]})):t}(this.getAllResponseHeaders())),!i.checkAddTrace(s._url)||(r=null!==(r=i.traceId)&&void 0!==r?r:this.getResponseHeader(K))&&(t.trace_id=r,t.trace_host=null!==(e=this.getResponseHeader(G))&&void 0!==e?e:void 0,t.log_id=null!==(e=this.getResponseHeader(Q))&&void 0!==e?e:void 0),t.ax_duration=Date.now()-s._start,200===this.status&&(t.ax_size=function(e){var t=0;if(""===e.responseType||"text"===e.responseType)t=j(e.responseText);else if(e.response)t=j(e.response);else try{t=j(e.responseText)}catch(e){t=0}return t}(this)),t=p(p({},t),H(s._url)),i.collectErrorRequest()&&"2"!==t.ax_status[0]&&"3"!==t.ax_status[0]&&(t.ax_request={body:s._data?""+s._data:void 0,search:null===(e=R(s._url))||void 0===e?void 0:e.search,content_type:null===(e=null===(e=s._requestHeaders)||void 0===e?void 0:e.find(function(e){return"content-type"===e[0].toLowerCase()}))||void 0===e?void 0:e[1]}),m(i.callback)&&i.callback({name:i.name,type:"get",event:t})),a)return a.apply(this,n)}},se.monitorName=ie,se);function se(e){this.name=ie,this.callback=O,this.traceId=null,this.props=e}function ce(e){return e instanceof Request}var ue="FetchMonitor",le=(pe.prototype.updateConfig=function(e){this.props=o({},this.props,e)},pe.prototype.setup=function(e){void 0===e&&(e=O),S()&&(this.callback=e,this.start())},pe.prototype.start=function(){S()&&this.hookFetch()},pe.prototype.checkAddTrace=function(e){var t=null!==(n=null===(r=this.props)||void 0===r?void 0:r.commonParams)&&void 0!==n?n:{},r=t.bid,n=t.web_id,t=(null!==(t=null===(t=null==this?void 0:this.props)||void 0===t?void 0:t.ajaxMonitorOptions)&&void 0!==t?t:{}).sampleHitTrace,e=A(location.href,e);return r&&n&&t&&e},pe.prototype.updateAxRequest=function(e,t,r){var n,o;this.collectErrorRequest()&&"2"!==e.ax_status[0]&&"3"!==e.ax_status[0]&&(o=this.getFetchUrl(t,!0),e.ax_request={body:null===(t=this.getFetchBody(t,r))||void 0===t?void 0:t.toString(),search:!d(o)||null===(n=R(o))||void 0===n?void 0:n.search,content_type:null===(r=null==r?void 0:r.headers)||void 0===r?void 0:r["Content-Type"]})},pe.prototype.collectErrorRequest=function(){var e;return null!==(e=null===(e=this.props.ajaxMonitorOptions)||void 0===e?void 0:e.errorRequestCollect)&&void 0!==e&&e},pe.prototype.hookFetch=function(){var c=this,u=this,l=window.fetch;window.fetch=function(n,o){void 0===o&&(o={});var i=c.getFetchUrl(n);if(!function(e){if(d(e)){var t=f(e.split(":"),2),e=t[0];return!t[1]||("http"===e||"https"===e)}}(i))return l(n,o);var e=null!==(e=c.props.commonParams)&&void 0!==e?e:{},t=e.bid,r=e.web_id,a=Date.now(),s={ev_type:"ajax"};try{u.checkAddTrace(i)&&(o.headers=new Headers(function(e,t){var r=new Headers;ce(e)&&e.headers&&m(e.headers.forEach)&&e.headers.forEach(function(e,t){r.append(t,e)});t.headers&&new Headers(t.headers).forEach(function(e,t){r.append(t,e)});return r}(n,o)),t&&r&&(s.trace_id=W(t,r),o.headers.append(K,s.trace_id)))}catch(e){}return s.ax_type=c.getFetchMethod(n,o),s=p(p({},s),H(i)),l(n,o).then(function(e){var t,r;return s.ax_status=(e.status||0).toString(),s.ax_duration=Date.now()-a,s.ax_response_header=u.getAllHeaders(e.headers),s.ax_request_header=u.getAllHeaders(o.headers),e.headers&&m(e.headers.has)?(e.headers.has("content-length")?s.ax_size=Number(e.headers.get("content-length"))||0:s.ax_size=0,u.checkAddTrace(i)&&(e.headers.has(G)&&(s.trace_host=null!==(t=e.headers.get(G))&&void 0!==t?t:void 0),e.headers.has(K)&&(s.trace_id=null!==(r=e.headers.get(K))&&void 0!==r?r:void 0),e.headers.has(Q)&&(s.log_id=null!==(r=e.headers.get(Q))&&void 0!==r?r:void 0))):s.ax_size=0,c.updateAxRequest(s,n,o),m(u.callback)&&u.callback({name:u.name,type:"get",event:s}),e},function(e){return s.ax_status="0",s.ax_size=0,s.ax_duration=Date.now()-a,c.updateAxRequest(s,n,o),m(u.callback)&&u.callback({name:u.name,type:"get",event:s}),Promise.reject(e)})}},pe.prototype.getFetchUrl=function(e,t){void 0===t&&(t=!1);var r="",r=ce(e)?e.url:e;return t||(r=d(r)?r.split("?")[0]:r),r},pe.prototype.getFetchMethod=function(e,t){t=null!==(t=null==t?void 0:t.method)&&void 0!==t?t:"get";return ce(e)&&(t=null!==(e=e.method)&&void 0!==e?e:t),t.toLowerCase()},pe.prototype.getFetchBody=function(e,t){return ce(e)?e.body:null==t?void 0:t.body},pe.prototype.getAllHeaders=function(e){if(!e||"function"!=typeof e.forEach)return"";var r=[];return e.forEach(function(e,t){r.push([t,e])}),q(r)},pe.monitorName=ue,pe);function pe(e){this.name=ue,this.callback=O,this.props=e}var fe="FMPMonitor",me=(de.prototype.setup=function(e){if(M())return _()?void(m(document.querySelector)&&(this.callback=e&&m(e)?e:function(){},this.startTime=Date.now(),this.list=[],m(this.observer.observe)&&this.observer.observe(document,{childList:!0,subtree:!0}))):null},de.prototype.count=function(){var e=Date.now()-this.startTime,t=document.querySelector("body");t?this.list.push({score:this.score(t,1,!1),time:e}):this.list.push({score:0,time:e})},de.prototype.score=function(e,t,r){var n,o=0,i=e.tagName;if("SCRIPT"!==i&&"STYLE"!==i&&"META"!==i&&"HEAD"!==i&&!w((null===(n=this.props)||void 0===n?void 0:n.ignoreTags)||[],i)){i=e.children?e.children.length:0;if(0<i)for(var a=e.children,s=i-1;0<=s;s--)o+=this.score(a[s],t+1,0<o);if(o<=0&&!r){if(!e.getBoundingClientRect||!m(e.getBoundingClientRect))return 0;e=e.getBoundingClientRect();if(!e)return 0;if(e.top>window.innerHeight)return 0;if(e.height<=0)return 0}o+=1+.5*t}return o},de.prototype.getFmpInternal=function(){if(!this.observer)return 0;if(this.disconnect(),!this.list.length)return 0;for(var e,t={time:this.list[0].time,rate:0},r=1;r<this.list.length;r++)this.list[r].time>=this.list[r-1].time&&(e=this.list[r].score-this.list[r-1].score,t.rate<e&&(t={time:this.list[r].time,rate:e}));return t.time},de.prototype.getTimeGap=function(){return P()?this.startTime-performance.timing.navigationStart:0},de.prototype.formatEvent=function(e){return{name:this.name,type:"post",event:{ev_type:"fmp",fmp:e}}},de.monitorName=fe,de);function de(e){var r=this;this.name=fe,this.callback=O,this.disconnect=function(){var e,t;null!==(t=null===(e=r.observer)||void 0===e?void 0:e.disconnect)&&void 0!==t&&t.call(e)},this.getLoadFmp=function(){var e=r.getFmpInternal(),e=e?r.getTimeGap()+e:0,e=r.formatEvent(e);return r.callback(e),e},this.getFmp=function(){var e=r.getFmpInternal(),e=r.formatEvent(e);return r.callback(e),e},this.props=e,this.startTime=Date.now(),this.list=[],this.observer=new MutationObserver(this.count.bind(this))}function he(){}var ve=!1,ge=!1,ye={uniqueId:0,originals:{},proxies:{},patchXMLHTTPRequest:function(i){this.originals.send=XMLHttpRequest.prototype.send,XMLHttpRequest.prototype.send=function(){for(var t=this,e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];var n=ye.uniqueId++;i.beforeCb(n);var o=this.onreadystatechange;return this.onreadystatechange=function(e){null!=o&&o.call(t,e),4===t.readyState&&i.afterCb(n)},ye.originals.send.apply(this,e)},this.proxies.send=XMLHttpRequest.prototype.send},patchFetch:function(o){var i;S()&&(i=window.fetch,this.originals.fetch=i,window.fetch=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return new Promise(function(t,r){var n=ye.uniqueId++;o.beforeCb(n),i.apply(void 0,s(e)).then(function(e){o.afterCb(n),t(e)},function(e){o.afterCb(n,e),r(e)})})},this.proxies.fetch=window.fetch)},observeResourceFetchingMutations:function(a){if(_()){var s=["img","script","iframe","link","audio","video","source"],e=new MutationObserver(function(e){var t,r;try{for(var n=v(e),o=n.next();!o.done;o=n.next()){var i=o.value;("childList"===i.type&&function e(t,r){var n,o;try{for(var i=v(t),a=i.next();!a.done;a=i.next()){var s=a.value;if(r.includes(s.nodeName.toLowerCase())||s.children&&e(s.children,r))return 1}}catch(e){n={error:e}}finally{try{a&&!a.done&&(o=i.return)&&o.call(i)}finally{if(n)throw n.error}}}(i.addedNodes,s)||"attributes"===i.type&&s.includes(i.target.nodeName.toLowerCase()))&&a(i)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}});return e.observe(document,{attributes:!0,childList:!0,subtree:!0,attributeFilter:["href","src"]}),e}},resetOriginals:function(){this.originals.send&&XMLHttpRequest.prototype.send===this.proxies.send&&(ve=!1,XMLHttpRequest.prototype.send=this.originals.send),this.originals.fetch&&fetch===this.proxies.fetch&&(ge=!1,window.fetch=this.originals.fetch)}},be="TTIMonitor",we=(Se.prototype.setup=function(){},Se.prototype.isEnable=function(){return k()&&!!T()&&m(window.PerformanceResourceTiming)&&C()},Se.prototype.registerPerformanceObserver=function(){var s=this;this.performanceObserver=new PerformanceObserver(function(e){var t,r,n=e.getEntries();try{for(var o=v(n),i=o.next();!i.done;i=o.next()){var a=i.value;"resource"===a.entryType&&s.networkRequestFinishedCallback(a),"longtask"===a.entryType&&s.longTaskFinishedCallback(a)}}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}});try{this.performanceObserver.observe({type:"longtask"}),this.performanceObserver.observe({type:"resource",buffered:!0})}catch(e){this.performanceObserver.observe({entryTypes:["longtask","resource"]})}},Se.prototype.unregisterListeners=function(){this.performanceObserver&&this.performanceObserver.disconnect(),this.mutationObserver&&this.mutationObserver.disconnect(),ye.resetOriginals(),this.proxyConfig&&(this.proxyConfig.beforeCb=he,this.proxyConfig.afterCb=he)},Se.prototype.rescheduleTimer=function(e){var t=this;this.scheduleTimerTasks&&(this.timerActivationTime>e||(clearTimeout(this.timerId),this.timerId=window.setTimeout(function(){t.checkTTI()},e-performance.now()),this.timerActivationTime=e))},Se.prototype.startSchedulingTimerTasks=function(){this.scheduleTimerTasks=!0;var e=0<this.longTasks.length?this.longTasks[this.longTasks.length-1].end:0,t=this.computeLastKnownNetwork2Busy(this.incompleteRequestStarts,this.networkRequests);this.rescheduleTimer(Math.max(t+5e3,e))},Se.prototype.registerListeners=function(){ve||(ye.patchXMLHTTPRequest(this.proxyConfig),ve=!0),ge||(ye.patchFetch(this.proxyConfig),ge=!0),this.registerPerformanceObserver(),this.useMutationObserver&&(this.mutationObserver=ye.observeResourceFetchingMutations(this.mutationObserverCallback.bind(this)))},Se.prototype.mutationObserverCallback=function(e){this.rescheduleTimer(performance.now()+5e3)},Se.prototype.beforeJSInitiatedRequestCallback=function(e){this.incompleteJSInitiatedRequestStartTimes[e]=performance.now()},Se.prototype.afterJSInitiatedRequestCallback=function(e){this.incompleteJSInitiatedRequestStartTimes[e]=void 0},Se.prototype.networkRequestFinishedCallback=function(e){this.networkRequests.push({start:e.fetchStart,end:e.responseEnd}),this.rescheduleTimer(this.computeLastKnownNetwork2Busy(this.incompleteRequestStarts,this.networkRequests)+5e3)},Object.defineProperty(Se.prototype,"incompleteRequestStarts",{get:function(){for(var e=Object.keys(this.incompleteJSInitiatedRequestStartTimes),t=[],r=0;r<e.length;r++){var n=this.incompleteJSInitiatedRequestStartTimes[e[r]];"number"==typeof n&&t.push(n)}return t},enumerable:!1,configurable:!0}),Se.prototype.longTaskFinishedCallback=function(e){var t=e.startTime+e.duration;this.longTasks.push({start:e.startTime,end:t}),this.rescheduleTimer(t+5e3)},Se.prototype.checkTTI=function(){var e=this.computeLastKnownNetwork2Busy(this.incompleteRequestStarts,this.networkRequests),t=this.getFirstPaintTime()||performance.timing.domContentLoadedEventEnd-performance.timing.navigationStart,r=this.getMinValue(),n=performance.now();null===r&&this.rescheduleTimer(Math.max(e+5e3,n+1e3));n=this.computeTTI(t,r,e,n,this.longTasks);n?(this.callback&&"function"==typeof this.callback&&this.callback(Math.round(n)),this.disable()):this.rescheduleTimer(performance.now()+1e3)},Se.prototype.getMinValue=function(){if(this.minValue)return this.minValue;if(performance.timing.domContentLoadedEventEnd){var e=performance.timing;return e.domContentLoadedEventEnd-e.navigationStart}return null},Se.prototype.getFirstPaintTime=function(){if("PerformancePaintTiming"in window){var e=performance.getEntriesByType("paint")[0];return e?e.startTime:0}return 0},Se.prototype.disable=function(){clearTimeout(this.timerId),this.scheduleTimerTasks=!1,this.unregisterListeners(),this.snippetObserver&&this.snippetObserver.disconnect(),this.snippetEntries&&this.snippetEntries.splice(0,this.snippetEntries.length)},Se.prototype.computeLastKnownNetwork2Busy=function(e,t){var r,n,o,i;if(2<e.length)return performance.now();var a=[];try{for(var s=v(t),c=s.next();!c.done;c=s.next()){var u=c.value;a.push({timestamp:u.start,type:"requestStart"}),a.push({timestamp:u.end,type:"requestEnd"})}}catch(e){r={error:e}}finally{try{c&&!c.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}try{for(var l=v(e),p=l.next();!p.done;p=l.next()){var f=p.value;a.push({timestamp:f,type:"requestStart"})}}catch(e){o={error:e}}finally{try{p&&!p.done&&(i=l.return)&&i.call(l)}finally{if(o)throw o.error}}a.sort(function(e,t){return e.timestamp-t.timestamp});for(var m=e.length,d=a.length-1;0<=d;d--){var h=a[d];switch(h.type){case"requestStart":m--;break;case"requestEnd":if(2<++m)return h.timestamp;break;default:throw Error("Internal Error: This should never happen")}}return 0},Se.monitorName=be,Se);function Se(e){var t,r,n,o=this;if(this.name=be,this.longTasks=[],this.callback=he,this.useMutationObserver=!0,this.minValue=null,this.isAsync=0,this.networkRequests=[],this.incompleteJSInitiatedRequestStartTimes={},this.timerActivationTime=-1/0,this.scheduleTimerTasks=!1,this.proxyConfig={beforeCb:this.beforeJSInitiatedRequestCallback.bind(this),afterCb:this.afterJSInitiatedRequestCallback.bind(this)},this.getTTI=function(e){o.callback=e,o.isEnable()?o.startSchedulingTimerTasks():o.callback&&"function"==typeof o.callback&&o.callback()},this.computeTTI=function(e,t,r,n,o){if(n-r<5e3)return null;o=0===o.length?e:o[o.length-1].end;return n-o<5e3?null:Math.max(o,t)},this.isEnable()){if(this.useMutationObserver=!!e.useMutationObserver,this.minValue=null!==(n=e.minValue)&&void 0!==n?n:null,this.isAsync=null!==(n=e.isAsync)&&void 0!==n?n:0,this.snippetEntries=null===(n=null==e?void 0:e.preLongTaskObserver)||void 0===n?void 0:n.precollect,this.snippetObserver=null===(e=null==e?void 0:e.preLongTaskObserver)||void 0===e?void 0:e.observer,!this.isAsync&&this.snippetEntries&&0<this.snippetEntries.length)try{for(var i=v(this.snippetEntries),a=i.next();!a.done;a=i.next()){var s=a.value;"longtask"===s.entryType?this.longTasks.push({start:s.startTime,end:s.startTime+s.duration}):"resource"===s.entryType&&this.networkRequests.push({start:s.fetchStart,end:s.responseEnd})}}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}this.registerListeners()}}function Me(e){try{for(var t,r=e,n=[],o=0,i=0,a=" > ".length;r&&o++<5&&!("html"===(t=function(e){var t,r,n,o,i=e,a=[];if(!i||!i.tagName)return"";a.push(i.tagName.toLowerCase()),i.id&&a.push("#"+i.id);e=i.className;if(e&&d(e))for(t=e.split(/\s+/),o=0;o<t.length;o++)a.push("."+t[o]);var s=["type","name","title","alt"];for(o=0;o<s.length;o++)r=s[o],(n=i.getAttribute(r))&&a.push("["+r+'="'+n+'"]');return a.join("")}(r))||1<o&&80<=i+n.length*a+t.length);)n.push(t),i+=t.length,r=r.parentNode;return n.reverse().join(" > ")}catch(e){return"<unknown>"}}var Pe="FIDMonitor",Ee=(_e.prototype.setup=function(e){var s=this;if(T()&&PerformanceObserver.supportedEntryTypes&&PerformanceObserver.supportedEntryTypes.includes("first-input")&&C()){this.callback=e,this.observer=new PerformanceObserver(function(e,t){var r,n;try{for(var o=v(e.getEntries()),i=o.next();!i.done;i=o.next()){var a=i.value,a=a.processingStart-a.startTime;s.callback({name:s.name,fid:Math.round(a)})}}catch(e){r={error:e}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}t.disconnect()});try{this.observer.observe({type:"first-input",buffered:!0})}catch(e){this.observer.observe({entryTypes:["first-input"]})}}},_e.monitorName=Pe,_e);function _e(){this.name=Pe,this.callback=O}var Te="MPFIDMonitor",ke=(Ce.prototype.setup=function(){var t,e,r,a=this;if(k()&&C()){if(!this.props.isAsync){var n=null!==(r=null===(r=this.props.preLongTaskObserver)||void 0===r?void 0:r.precollect)&&void 0!==r?r:[];if(n&&0<n.length)try{for(var o=v(n),i=o.next();!i.done;i=o.next()){var s=i.value;"longtask"===s.entryType&&this.list.push(s)}}catch(e){t={error:e}}finally{try{i&&!i.done&&(e=o.return)&&e.call(o)}finally{if(t)throw t.error}}}this.observer=new PerformanceObserver(function(e){var t,r;try{for(var n=v(e.getEntries()),o=n.next();!o.done;o=n.next()){var i=o.value;a.list.push(i)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}}),this.observer.observe({entryTypes:["longtask"]})}},Ce.prototype.getMPFID=function(){var t,e;if(k()&&C()){this.observer&&this.observer.disconnect();var r=0;try{for(var n=v(this.list),o=n.next();!o.done;o=n.next()){var i=o.value;r<i.duration&&(r=i.duration)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(t)throw t.error}}return this.formatEvent(Math.round(r))}},Ce.prototype.formatEvent=function(e){return{name:this.name,mpfid:e}},Ce.monitorName=Te,Ce);function Ce(e){this.name=Te,this.list=[],this.props=e}var xe=["xmlhttprequest","fetch"],Re="ResourcePerformanceMonitor",Le=(Oe.prototype.setup=function(e){this.isEnable()&&(this.callback=null!=e?e:O,this.isAsync&&window.performance.clearResourceTimings(),this.observe&&(this.sendResourcePerformance(performance.getEntriesByType("resource")),this.observePerformance()))},Oe.prototype.isEnable=function(){return E()&&"function"==typeof performance.clearResourceTimings},Oe.prototype.getPerformance=function(){return this.isEnable()?this.buildParams(this.getResources()):this.buildParams([])},Oe.prototype.buildParams=function(e){var t=this,r=[];if(e.forEach(function(e){w(xe,e.initiatorType)||m(t.checkIgnore)&&t.checkIgnore(e)||r.push(e)}),r.length)return{name:this.name,type:"post",event:{ev_type:"resource_performance",resources:r}}},Oe.prototype.sendResourcePerformance=function(e){e=this.buildParams(e);e&&this.callback(e)},Oe.prototype.getResources=function(){return window.performance.getEntriesByType("resource")},Oe.prototype.observePerformance=function(){var t=this;T()&&new PerformanceObserver(function(e){e=e.getEntries();e.length&&t.sendResourcePerformance(e)}).observe({entryTypes:["resource"]})},Oe.monitorName=Re,Oe);function Oe(e){var t,r=this;this.name=Re,this.callback=O,this.getResourcePerformance=function(){var e;return null!==(e=r.getPerformance())&&void 0!==e?e:{}},this.isAsync=null!==(t=null==e?void 0:e.isAsync)&&void 0!==t?t:0,this.observe=null!==(t=null==e?void 0:e.observe)&&void 0!==t&&t,this.checkIgnore=null!==(e=null==e?void 0:e.checkIgnore)&&void 0!==e?e:function(){return!1}}var je={ev_type:"perf",isAsync:0,dns:0,tcp:0,request:0,response:0,processing:0,blank:0,domready:0,load:0,has_resource:0,domparse:0,resource:0,ttfb:0,redirect:0,tti:0,upload_reason:"sample",network_type:"",timing:{},navigation_timing:{},navigation:{},resources:[]},qe="PerformanceMonitor",He=(Ae.prototype.setup=function(e){var t,r=this;P()&&(this.callback=e,t=function(){r.hasLoaded=!0,r.performanceAuto&&(r.perfTimer=setTimeout(function(){r.perfLog()},200))},"complete"!==document.readyState?window.addEventListener("load",function(){setTimeout(function(){t()},0)},!1):t(),this.sendParams=p({},je),this.staticPerformanceMonitor=new Le,this.staticPerformanceMonitor.setup(),(new Ee).setup(this.hasFID),this.mpfidMonitor=new ke({isAsync:0,preLongTaskObserver:this.props.preLongTaskObserver}),this.mpfidMonitor.setup(),e=null!==(e=this.props.TTIMonitor)&&void 0!==e?e:we,this.ttiMonitor=new e({isAsync:0,preLongTaskObserver:this.props.preLongTaskObserver}),this.ttiMonitor.setup(),e=this.syncPerfLog.bind(this),F(e))},Ae.prototype.performanceNow=function(){var e;return null!==performance&&void 0!==performance&&performance.now?performance.now():(Date.now?Date.now():+new Date)-(null!==(e=null===(e=performance.timing)||void 0===e?void 0:e.navigationStart)&&void 0!==e?e:0)},Ae.prototype.getBounced=function(){return!this.hasLoaded},Ae.prototype.getPaintTime=function(t){if(E()){var e=performance.getEntriesByType("paint");if(u(e)){e=e.filter(function(e){return e.name===t});return e.length&&e[0]&&c(e[0])&&e[0].startTime||0}}return 0},Ae.monitorName=qe,Ae);function Ae(e){var o=this;this.name=qe,this.callback=O,this.sendParams=p({},je),this.finalSendParams=this.sendParams,this.hasLoaded=!1,this.initStart=0,this.hasSentInitPerf=!1,this.initFlag=!0,this.performanceAuto=!0,this.send=function(){o.initFlag&&o.hasLoaded&&(o.sendParams.isAsync&&(o.sendParams.load=Math.round(o.performanceNow()-o.initStart)),setTimeout(function(){o.perfLog()},200))},this.initAsync=function(){var e,t;o.hasSentInitPerf&&(o.sendParams=p({},je),o.sendParams.isAsync=1,o.initFlag=!0,o.initStart=o.performanceNow(),o.staticPerformanceMonitor=new Le({isAsync:1}),o.staticPerformanceMonitor.setup(),o.mpfidMonitor=new ke({isAsync:1,preLongTaskObserver:o.props.preLongTaskObserver}),o.mpfidMonitor.setup(),t=null!==(e=o.props.TTIMonitor)&&void 0!==e?e:we,o.ttiMonitor=new t({minValue:Math.round(o.performanceNow()),isAsync:1,preLongTaskObserver:o.props.preLongTaskObserver}),o.ttiMonitor.setup(),null!==(t=null===(e=o.fmpMonitor)||void 0===e?void 0:e.setup)&&void 0!==t&&t.call(e,O))},this.stopAutoPerf=function(){o.performanceAuto=!1,clearTimeout(o.perfTimer)},this.getPerformance=function(){return o.finalSendParams.tti||("complete"===document.readyState?o.perfLog():o.perfLog(!0)),o.buildParams(o.finalSendParams)},this.buildParams=function(e){return{name:o.name,type:"post",event:e}},this.perfLog=function(e){if(void 0===e&&(e=!1),P()){if(o.initFlag=!1,o.finalSendParams=p({},o.sendParams),!o.sendParams.isAsync){var t=o.getBounced();if(t)return o.finalSendParams.bounced=t,void o.invokeCallback(0,o.buildParams(o.finalSendParams));o.finalSendParams=p(p({},o.finalSendParams),o.getParams())}var r=o.getStaticResources(),n=o.getFMP(),t=o.getMPFID();r&&(o.finalSendParams.resources=r,o.finalSendParams.has_resource=1),n&&(o.finalSendParams.fmp=Math.round(n)),n&&o.finalSendParams.fcp&&o.finalSendParams.fmp<o.finalSendParams.fcp&&(o.finalSendParams.fmp=o.finalSendParams.fcp),t&&(o.finalSendParams.mpfid=t),m(o.callback)&&(!e&&o.ttiMonitor&&m(o.ttiMonitor.getTTI)?o.ttiMonitor.getTTI(function(e){e&&0<e&&(o.finalSendParams.tti=o.finalSendParams.isAsync?Math.round(e-o.initStart):e),o.invokeCallback(o.finalSendParams.isAsync,o.buildParams(o.finalSendParams))}):o.invokeCallback(o.finalSendParams.isAsync,o.buildParams(o.finalSendParams)))}},this.invokeCallback=function(e,t){if(!e){if(o.hasSentInitPerf)return;o.hasSentInitPerf=!0}o.callback(t)},this.getStaticResources=function(){var e;if(o.staticPerformanceMonitor&&m(o.staticPerformanceMonitor.getResourcePerformance)){var t=o.staticPerformanceMonitor.getResourcePerformance();if(null!==(e=null==t?void 0:t.event)&&void 0!==e&&e.resources)return t.event.resources||[]}},this.getFMP=function(){var e,t;return o.fmpMonitor?(o.fmpMonitor.disconnect(),o.sendParams.isAsync?(null===(e=null==(t=o.fmpMonitor.getFmp())?void 0:t.event)||void 0===e?void 0:e.fmp)||0:m(o.fmpMonitor.getLoadFmp)?1!==o.props.renderType?2===o.props.renderType?o.getPaintTime("first-contentful-paint"):0:null!==(t=null===(t=(t=o.fmpMonitor.getLoadFmp()||{}).event)||void 0===t?void 0:t.fmp)&&void 0!==t?t:0:0):0},this.getMPFID=function(){if(o.mpfidMonitor&&m(o.mpfidMonitor.getMPFID)){var e=o.mpfidMonitor.getMPFID();if(e)return e.mpfid}},this.syncPerfLog=function(){var e,t;o.hasSentInitPerf||(o.perfLog(!0),null!==(t=(e=o.props).report)&&void 0!==t&&t.call(e))},this.hasFID=function(e){o.sendParams.fid=e.fid},this.getParams=function(){if(P()){var e={},t=window.performance.timing;e.dns=t.domainLookupEnd-t.domainLookupStart,e.tcp=t.connectEnd-t.connectStart,e.request=t.responseStart-t.requestStart,e.response=t.responseEnd-t.responseStart,e.processing=t.domComplete-t.domLoading,e.blank=t.responseEnd-t.navigationStart,e.domready=t.domInteractive-t.navigationStart,e.load=t.loadEventEnd-t.navigationStart,t.secureConnectionStart&&(e.ssl=t.connectEnd-t.secureConnectionStart),e.domparse=t.domInteractive-t.responseEnd,e.resource=t.loadEventStart-t.domContentLoadedEventEnd,e.ttfb=t.responseStart-t.requestStart,e.redirect=t.redirectEnd-t.redirectStart;var r=o.getPaintTime("first-paint"),t=o.getPaintTime("first-contentful-paint");r&&(e.fp=Math.round(r)),t&&(e.fcp=Math.round(t));r=function(){if(!E())return null;var e=window.performance.getEntriesByType("navigation");return u(e)&&0!==e.length?e[0]:null}(),t=P()?window.performance.timing:null;return(r||t)&&(e.navigation=null!=r?r:t),t&&(e.timing=t),r&&(e.navigation_timing=r),e}},e.fmpMonitor&&(this.fmpMonitor=e.fmpMonitor);var t=e.performanceAuto;this.performanceAuto=void 0===t||t,this.props=null!=e?e:{}}var Ie="StaticErrorMonitor",De=(Fe.prototype.setup=function(e){M()&&(this.callback=e,window.addEventListener("error",this.staticErrorLog.bind(this),!0))},Fe.prototype.getSrc=function(e){return"link"===e.tagName.toLowerCase()?Be(e,"href"):Be(e,"src")},Fe.prototype.getParams=function(e,t){var r={ev_type:"static",st_type:t},t=R(e);r.st_src=e,r.st_protocol=t.protocol,r.st_domain=t.hostname,r.st_path=t.pathname;t=function(e){var t,r=null===(t=null===(n=window.performance)||void 0===n?void 0:n.getEntriesByType)||void 0===t?void 0:t.call(n,"resource"),n=null==r?void 0:r.length;if(!n)return;for(var o=n-1;-1<o;o--){var i=r[o];if(i.name===e)return i}}(t.href);return t&&(r.timing=t),r},Fe.monitorName=Ie,Fe);function Fe(){var i=this;this.name=Ie,this.callback=O,this.buildEvent=function(e){var t,r,n=e||window.event||{};try{r=null!==(t=null!==(t=n.target)&&void 0!==t?t:n.srcElement)&&void 0!==t?t:{}}catch(n){return}var o=r.tagName;if(o&&d(o)){o=o.toLowerCase();e=i.getSrc(r);if(e&&e!==window.location.href)return{name:i.name,type:"get",event:i.getParams(e,o)}}},this.staticErrorLog=function(e){e=i.buildEvent(e);e&&i.callback(e)}}function Be(e,t){var r;return e.getAttribute&&m(e.getAttribute)?null!==(r=e.getAttribute(t))&&void 0!==r?r:"":null!==(t=e[t])&&void 0!==t?t:""}var Ne="EmitMonitor",Je=(Ue.prototype.setup=function(e){this.callback=e||O},Ue.prototype.buildCustomTimeLog=function(e,t,r){return function(e){var t=e.name,r=e.tag,e=e.value;if(t&&e){e={ev_type:"custom",cm_name:t=m(t.toString)?t.toString():"",cm_type:"time",cm_value:e=+e};return r&&(r=m(r.toString)?r.toString():"",e.cm_tag=r),{name:"SentCustomTime",type:"get",event:e}}}({name:e,tag:t,value:r})},Ue.prototype.buildCustomCountLog=function(e,t){return function(e){var t=e.name,e=e.tag;if(t){t={ev_type:"custom",cm_name:t=m(t.toString)?t.toString():"",cm_type:"count"};return e&&(e=m(e.toString)?e.toString():"",t.cm_tag=e),{name:"SentCustomCount",type:"get",event:t}}}({name:e,tag:t})},Ue.prototype.buildEmitSingleEvent=function(e){e=oe(e);if(e&&(!e||e.event_name))return{name:this.name,type:"post",event:{ev_type:"flexible",flexible_data_list:[e]}}},Ue.monitorName=Ne,Ue);function Ue(){var o=this;this.name=Ne,this.callback=O,this.handOut=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=o.buildEvent.apply(o,s(e));o.callback(r)},this.buildEvent=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if("sendCustomCountLog"===e[0])return o.buildCustomCountLog(e[1],e[2]);if("sendCustomTimeLog"===e[0])return o.buildCustomTimeLog(e[1],e[2],e[3]);if("send"===e[0]){if("count"===e[1])return o.buildCustomCountLog(e[2].category,e[2].action);if("timing"===e[1])return o.buildCustomTimeLog(e[2].category,e[2].action,e[2].value)}if("emit"===e[0]&&e[1]&&e[2]){var r={type:e[1],event:e[2]};return o.buildEmitSingleEvent(r)}},this.send=function(e,t,r){var n=r.action,r=r.value;"count"===e&&o.sendCustomCountLog(t,n),"timing"===e&&o.sendCustomTimeLog(t,n,r)},this.sendCustomTimeLog=function(e,t,r){r=o.buildCustomTimeLog(e,t,r);o.callback(r)},this.sendCustomCountLog=function(e,t){t=o.buildCustomCountLog(e,t);return o.callback(t),t},this.emitEvent=function(e){e=o.buildEmitSingleEvent(e);o.callback(e)}}var Xe="BreadcrumbMonitor",ze=(Ve.prototype.setup=function(){this.instrumentDOM()},Ve.prototype.instrumentDOM=function(){var e;"document"in window&&(e=this,window.document.addEventListener("click",e.domEventHandler("click",e.triggerHandlers.bind(e,"dom")),!1),window.document.addEventListener("keypress",e.keypressEventHandler(e.triggerHandlers.bind(e,"dom")),!1))},Ve.prototype.domEventHandler=function(t,r,n){var o=this;return void 0===n&&(n=!1),function(e){o.keypressTimeout=void 0,e&&o.lastCapturedEvent!==e&&(o.lastCapturedEvent=e,o.debounceTimer&&clearTimeout(o.debounceTimer),n?o.debounceTimer=setTimeout(function(){r({event:e,name:t})}):r({event:e,name:t}))}},Ve.prototype.triggerHandlers=function(e,t){if(e)try{this.domBreadcrumb(t)}catch(e){}},Ve.prototype.keypressEventHandler=function(n){var o=this;return function(e){var t;try{t=e.target}catch(e){return}var r=t&&t.tagName;r&&("INPUT"===r||"TEXTAREA"===r||t.isContentEditable)&&(o.keypressTimeout||o.domEventHandler("input",n)(e),clearTimeout(o.keypressTimeout),o.keypressTimeout=window.setTimeout(function(){o.keypressTimeout=void 0},o.debounceDuration))}},Ve.prototype.domBreadcrumb=function(e){var t;try{t=e.event.target?Me(e.event.target):Me(e.event)}catch(e){t="<unknown>"}0!==t.length&&this.addBreadcrumb({category:"ui."+e.name,message:t})},Ve.monitorName=Xe,Ve);function Ve(e){var n=this;this.name=Xe,this.breadcrumbs=[],this.getBreadcrumbs=function(){return n.breadcrumbs},this.addBreadcrumb=function(e){var t=p(p({},e),{timestamp:(new Date).getTime()}),r=n.maxBreadcrumbs,e=n.breadcrumbs;return n.breadcrumbs=0<=r?s(e,[t]).slice(-r):s(e,[t]),n},this.debounceDuration=1e3,this.debounceTimer=0,this.breadcrumbs=[],this.maxBreadcrumbs=null!==(e=null==e?void 0:e.maxBreadcrumbs)&&void 0!==e?e:20}var Ke={enableCatchGlobalJSError:!0},Ge="JSExceptionMonitor",Qe=(We.prototype.setup=function(e){M()&&(this.callback=e,this.options.enableCatchGlobalJSError&&(window.addEventListener("error",this.jsErrorLog),window.addEventListener("unhandledrejection",this.jsPromiseRejectionLog)))},We.prototype.buildEvent=function(e){if(!function(e){switch(Object.prototype.toString.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":return 1;default:return e instanceof Error}}(e)?(n(e)&&(t={message:JSON.stringify(e)}),d(e)&&(t={message:e})):t=e,t){var t={ev_type:"js_exception",exception:this.normalizeError(t),breadcrumbs:null!==(t=null===(t=this.options.breadcrumbMonitor)||void 0===t?void 0:t.getBreadcrumbs())&&void 0!==t?t:[]};return{name:this.name,type:"post",event:t}}},We.prototype.logError=function(e){e=this.buildEvent(e);e&&this.callback(e)},We.prototype.getJSError=function(e){e=e.error;if(e)return e},We.prototype.getJSPromiseRejection=function(e){var t=void 0;try{"reason"in e?t=e.reason:"detail"in e&&"reason"in e.detail&&(t=e.detail.reason)}catch(e){}if(t)return t},We.prototype.normalizeError=function(e){return{message:e.message,name:e.name,fileName:e.fileName,lineNumber:e.lineNumber,columnNumber:e.columnNumber,stack:e.stack,stacktrace:e.stacktrace,framesToPop:e.framesToPop}},We.monitorName=Ge,We);function We(e){var t=this;this.name=Ge,this.callback=O,this.jsErrorLog=function(e){e=t.getJSError(e);e&&t.logError(e)},this.jsPromiseRejectionLog=function(e){e=t.getJSPromiseRejection(e);e&&t.logError(e)},this.options=p(p({},Ke),e)}var $e=(Ye.prototype.sendEvent=function(e){e=this.getEventToBeSent(e);e&&this.idleSendEvent(e)},Ye.prototype.getEventToBeSent=function(e){e=this._modifyEvent(e);if(this._shouldSend(e))return e},Ye.prototype._modifyEvent=function(e){return e},Ye.prototype._shouldSend=function(e){return!0},Ye.prototype._send=function(e){},Ye.prototype.idleSendEvent=function(e){this._send(e)},Ye);function Ye(){}var Ze="RANGERS_WEB_ID";function et(){var e={flags:{hookPath:!0,hookXHR:!0,hookFetch:!0,enableSizeStats:!0,enableFMP:!0,enablePerformance:!0,enableResourcePerformance:!0,enableStaticError:!0,enableCatchJSError:!0,enableCatchGlobalJSError:!0,enableCatchJSErrorV2:!1,enableCrash:!0,enableMemoryRecord:!0,enableFPSJankTimesMonitor:!0,enableBreadcrumb:!0,hookConsole:!1,hookDom:!0}};return e.monitors={BaseMonitor:{appTypeSetting:{type:0,SPA:"",renderType:0},sampleHit:J(1)},JSErrorMonitor:{enable:!0,webIDHit:!0,sampleRate:1,webIDHitBehavior:!1,sampleHitBehavior:!1,ignoreErrors:[],whitelistUrls:[],blacklistUrls:[],download_link:""},AjaxMonitor:{enable:!0,enableError:!1,webIDHit:!0,sampleHit:J(1),sampleRate:1,sampleHitTrace:!1,ignore:ee,abort:!1,whitelistUrls:[],statusCodeSample:{},requestUrlSample:[],errorRequestCollect:!1},PerformanceMonitor:{enable:!0,webIDHit:!0,sampleRate:1,webIDHitStaticResource:!1,sampleHitStaticResource:J(Z),slowSessionTime:te,spaSlowSessionTime:re,geckoUrls:[],interval:0,checkPoint:[]},StaticErrorMonitor:{enable:!0,webIDHit:!0,sampleRate:1,ignore:ee},ResourcePerformanceMonitor:{enable:!0,webIDHit:!0,sampleRate:1},BreadcrumbMonitor:{enable:!0},EmitMonitor:{enable:!0}},e.custom={},e.commonParams={aid:0,pid:"",version:"0.2.22",hostname:window.location.hostname,protocol:window.location.protocol.slice(0,-1),rangers_web_id:it($()),rangers_session_id:$(),context:{},url:window.location.href,timestamp:Date.now(),screen_resolution:B(),network_type:N()},e}var tt,rt,nt,ot,it=function(e){return null!==document&&void 0!==document&&document.cookie&&(e=I(document.cookie,Ze)),e},at=(tt="/v2/user/webid",rt="/v2/user/ssid",nt="/v2/event/list",ot=[],["https://mcs.ctobsnssdk.com","https://mcs.itobsnssdk.com","https://mcs.tobsnssdk.com"].forEach(function(t){[tt,rt,nt].forEach(function(e){ot.push(t+e)})}),ot);function st(e){var t=e.sendParams,e=e.monitorsSetting;if(!t||!c(t)||!t.event)return!1;var r,n,e=e;if("AjaxMonitor"===t.name||"FetchMonitor"===t.name){var o=D(s(["/monitor_browser/collect"],at)||[]);if(o&&o.test(t.event.ax_url))return!1}return!(null==e||!e.BaseMonitor.sampleHit)&&("AjaxMonitor"===t.name||"FetchMonitor"===t.name?function(e){var r=e.sendParams,t=e.ajaxMonitor;if(!t)return!0;if("2"!==r.event.ax_status[0]&&"3"!==r.event.ax_status[0])return t.enableError;if(!t.enable)return!1;if(!t.webIDHit)return!1;if(!t.sampleHit||!J(t.sampleRate))return!1;if(u(e=t.whitelistUrls)&&0<e.length){var n=D(t.whitelistUrls||[]);return n&&n.test(r.event.ax_url)?!0:!1}if((n=D(t.ignore||[]))&&n.test(r.event.ax_url))return!1;if((n=t.statusCodeSample)&&h(n,r.event.ax_status))return J(n[r.event.ax_status]);if(t=t.requestUrlSample){var o=!1,i=!1;if(t.forEach(function(e){var t;o||null!=(t=D([e.url]))&&t.test(r.event.ax_url)&&(o=!0,i=J(e.sampleRate))}),o)return i}return!0}({sendParams:t,ajaxMonitor:e.AjaxMonitor}):"PerformanceMonitor"===t.name?!(r=(r={performanceMonitor:e.PerformanceMonitor}).performanceMonitor)||!!r.enable&&(!!r.webIDHit&&J(r.sampleRate)):"StaticErrorMonitor"===t.name?(o={sendParams:t,staticErrorMonitor:e.StaticErrorMonitor},r=o.sendParams,!(o=o.staticErrorMonitor)||!!o.enable&&(!!o.webIDHit&&(!!J(o.sampleRate)&&!((o=D(o.ignore||[]))&&o.test(r.event.st_src))))):"JSExceptionMonitor"===t.name?!(n=(n={jsErrorMonitor:e.JSErrorMonitor}).jsErrorMonitor)||!!n.enable&&(!!n.webIDHit&&J(n.sampleRate)):"ResourcePerformanceMonitor"===t.name?!(n=(n={resourcePerformanceMonitor:e.ResourcePerformanceMonitor}).resourcePerformanceMonitor)||!!n.enable&&(!!n.webIDHit&&J(n.sampleRate)):"EmitMonitor"!==t.name||!!{emitMonitor:e.EmitMonitor}.emitMonitor)}function ct(e){var t=e.sendParams,r=e.commonParams,n=e.custom,e=e.breadcrumbMonitor,e=function(e){var t=e.sendParams,r=e.commonParams,n=e.breadcrumbMonitor;if((e={}).ev_type=t.event.ev_type,e.common=r,"PageViewMonitor"===t.name&&e)return e;if(("AjaxMonitor"===t.name||"FetchMonitor"===t.name)&&e){r=t.event,r=(r.ev_type,a(r,["ev_type"]));return e.event=r,e}if("PerformanceMonitor"===t.name&&e){t.event.navigation=t.event.navigation_timing;var o=t.event,o=(o.ev_type,a(o,["ev_type"]));return e.ev_type="performance",e.event={fp:o.fp,fcp:o.fcp,fmp:o.fmp,tti:o.tti,fid:o.fid,mpfid:o.mpfid,isAsync:o.isAsync,timing:o.timing,navigation:o.navigation_timing,bounced:o.bounced},e}if("StaticErrorMonitor"===t.name&&e){e.ev_type="resource_error";o=t.event,o=(o.ev_type,a(o,["ev_type"]));return e.event=o,e}if("ResourcePerformanceMonitor"===t.name&&e){e.ev_type="resource";var i=t.event,i=(i.ev_type,a(i,["ev_type"]));return e.event=i,e}if("JSExceptionMonitor"===t.name&&e){e.ev_type="js_error";i=t.event,i=(i.ev_type,a(i,["ev_type"]));return e.event=i.exception,e.breadcrumbs=null!==(n=null==n?void 0:n.getBreadcrumbs())&&void 0!==n?n:[],e}return"EmitMonitor"===t.name&&e&&(e.ev_type="flexible",e.flexible_data_list=t.event.flexible_data_list),e}({sendParams:t,commonParams:p(p({},null!=r?r:{}),{url:window.location.href}),breadcrumbMonitor:e});return n&&m(n.beforeSend)&&(e=n.beforeSend(e||{})),e}function ut(e){return"https://"+e+"/monitor_browser/collect"}var lt,pt,ft,mt={cover:O,accumulate:O,reportDirectly:O,average:O},dt=function(e){var r=this;this.cover=function(e,t){r.log.cover(e,t)},this.accumulate=function(e,t){r.log.accumulate(e,t)},this.reportDirectly=function(e,t){r.log.reportDirectly(e,t)},this.average=function(e,t){r.log.average(e,t)},this.log=null!==(e=e.transport)&&void 0!==e?e:mt},ht=(r(pt=gt,ft=lt=$e),pt.prototype=null===ft?Object.create(ft):(vt.prototype=ft.prototype,new vt),gt.prototype.uploadQueue=function(){},gt.prototype._shouldSend=function(e){return st({sendParams:e,monitorsSetting:this.options.monitorsSetting})},gt.prototype._modifyEvent=function(e){return(e=(e={sendParams:e}).sendParams)&&c(e)?e:{}},gt.prototype.buildParams=function(e){var t,r=null===(t=null===(t=this.options.monitorsSetting)||void 0===t?void 0:t.BreadcrumbMonitor)||void 0===t||!t.enable||null===(r=this.options.monitors)||void 0===r?void 0:r.BreadcrumbMonitor;return ct({sendParams:e,commonParams:this.options.commonParams,custom:this.options.custom,breadcrumbMonitor:r})},gt.prototype._send=function(e){e&&e.event&&e.name&&this.transport&&this.sendByTypes(e)},gt.prototype.sendByTypes=function(e){var t;this.transport&&(t={jsBase:null!==(t=this.options.commonParams)&&void 0!==t?t:{},jsInfo:this.buildParams(e)},"PerformanceMonitor"===e.name&&this.transport.cover(t,t.jsInfo.ev_type),"StaticErrorMonitor"===e.name&&this.transport.reportDirectly(t,t.jsInfo.ev_type),"ResourcePerformanceMonitor"===e.name&&this.transport.reportDirectly(t,t.jsInfo.ev_type),"AjaxMonitor"===e.name&&this.transport.reportDirectly(t,t.jsInfo.ev_type),"FetchMonitor"===e.name&&this.transport.reportDirectly(t,t.jsInfo.ev_type),"JSExceptionMonitor"===e.name&&this.transport.reportDirectly(t,t.jsInfo.ev_type),"PageViewMonitor"===e.name&&this.transport.reportDirectly(t,t.jsInfo.ev_type))},gt);function vt(){this.constructor=pt}function gt(e){var o=lt.call(this)||this;return o.options={},o.setTransport=function(e){o.transport=new dt({transport:e.transport}),o.preQueue.forEach(function(e){lt.prototype.sendEvent.call(o,e)})},o.updateConfig=function(e){var t,r,n;o.options=(t={previousOptions:o.options,newOptions:e},r=t.previousOptions,n=t.newOptions,(e=p(p({},r),n)).commonParams=i({},null!==(t=r.commonParams)&&void 0!==t?t:{},null!==(t=n.commonParams)&&void 0!==t?t:{}),e.monitorsSetting=i({},null!==(t=r.monitorsSetting)&&void 0!==t?t:{},null!==(t=n.monitorsSetting)&&void 0!==t?t:{}),e.monitors=p(p({},null!==(t=r.monitors)&&void 0!==t?t:{}),null!==(t=n.monitors)&&void 0!==t?t:{}),e.custom=p(p({},null!==(r=r.custom)&&void 0!==r?r:{}),null!==(n=n.custom)&&void 0!==n?n:{}),e)},o.sendEvent=function(e){o.transport?lt.prototype.sendEvent.call(o,e):o.preQueue.push(e)},o.getEventToBeSent=function(e){return null!==(e=lt.prototype.getEventToBeSent.call(o,e))&&void 0!==e?e:{}},o.options=e,o.preQueue=[],o}var yt=(bt.getClientCommonParams=function(r){void 0===r&&(r={});var n={};if(!c(r))return n;var o=["context","pid"];t(r,function(e,t){w(o,e)&&(n[e]=t)});return t({user_unique_id:"rangers_web_id",app_id:"aid"},function(e,t){h(r,e)&&(n[t]=r[e])}),n},bt.getClientFlags=function(e){void 0===e&&(e={});var r={};if(!c(e))return r;var n=["hookPath","hookXHR","hookFetch","enableSizeStats","enableFMP","enablePerformance","enableStaticError","enableCatchJSError","enableCatchJSErrorV2","enableCatchGlobalJSError","enableResourcePerformance","enableCrash","enableMemoryRecord","enableFPSJankTimesMonitor","enableBreadcrumb","hookConsole"];return t(e,function(e,t){w(n,e)&&(r[e]=t)}),r},bt.getClientCustom=function(e){var t={};return e.beforeSend&&m(e.beforeSend)&&(t.beforeSend=e.beforeSend),t},bt.getClientMonitorsSetting=function(e){return e=(t={setting:e}).setting,t={JSErrorMonitor:{},PerformanceMonitor:{},BreadcrumbMonitor:{},StaticErrorMonitor:{},ResourcePerformanceMonitor:{},BaseMonitor:{appTypeSetting:{}},AjaxMonitor:{}},e.ajaxWhitelistUrls&&u(e.ajaxWhitelistUrls)&&(t.AjaxMonitor.whitelistUrls=(t.AjaxMonitor.whitelistUrls||[]).concat(e.ajaxWhitelistUrls)),e.ignoreAjax&&u(e.ignoreAjax)&&(t.AjaxMonitor.ignore=(t.AjaxMonitor.ignore||[]).concat(e.ignoreAjax)),e.ignoreStatic&&u(e.ignoreStatic)&&(t.StaticErrorMonitor.ignore=(t.StaticErrorMonitor.ignore||[]).concat(e.ignoreStatic)),e.ignoreErrors&&u(e.ignoreErrors)&&(t.JSErrorMonitor.ignoreErrors=e.ignoreErrors),e.errorBlacklistUrls&&u(e.errorBlacklistUrls)&&(t.JSErrorMonitor.blacklistUrls=e.errorBlacklistUrls),e.errorWhitelistUrls&&u(e.errorWhitelistUrls)&&(t.JSErrorMonitor.whitelistUrls=e.errorWhitelistUrls),h(e,"sampleRate")&&(t.BaseMonitor.sampleHit=J(e.sampleRate)),t;var t},bt.prototype.configure=function(e){if(c(e)){if(this.userConfig=p(p({},this.userConfig||{}),e||{}),!this.serverDomain){if(!this.userConfig.serverDomain)return void console.error('"serverDomain" must be configured');this.serverDomain=this.userConfig.serverDomain}this.updateCurrentSetting(),this.client?this.updateClientConfig(this.getClientOptions()):this.init()}},bt.prototype.emitEvent=function(e){var t;this.monitors.EmitMonitor&&(t=this.monitors.EmitMonitor).handOut.apply(t,s(e))},bt.prototype.init=function(){var e=this.getClientOptions();this.client=new ht(e),this.updateClientConfig(e),this.sendPageview(),this.setupMonitors(this.setMonitors()),this.getServerSetting()},bt.prototype.getServerSetting=function(){var t=this;if(this.serverSetting)return this.updateCurrentSetting(),void this.afterServerSetting();var e="https://"+this.serverDomain+"/settings/get/web?aid="+this.currentSetting.commonParams.aid;U.get(e,{success:function(e){try{t.serverSetting=e.data,t.updateCurrentSetting(),t.afterServerSetting()}catch(e){t.afterServerSetting()}},fail:function(){t.afterServerSetting()}})},bt.prototype.afterServerSetting=function(){this.updateClientConfig(this.getClientOptions()),this.client.setTransport({transport:this.userConfig.transport})},bt.prototype.updateCurrentSetting=function(){var e={commonParams:bt.getClientCommonParams(this.finderSetting),flags:bt.getClientFlags({}),custom:bt.getClientCustom({}),monitors:bt.getClientMonitorsSetting({})},t={commonParams:bt.getClientCommonParams({}),flags:bt.getClientFlags({}),custom:bt.getClientCustom({}),monitors:this.serverSetting?(r=this.serverSetting,n={JSErrorMonitor:{},PerformanceMonitor:{},BreadcrumbMonitor:{},StaticErrorMonitor:{},BaseMonitor:{},ResourcePerformanceMonitor:{},AjaxMonitor:{}},(r=r.setting).jserr&&(n.JSErrorMonitor.enable=r.jserr.enable,n.JSErrorMonitor.webIDHit=J(r.jserr.enable_user_rate),n.JSErrorMonitor.sampleRate=r.jserr.enable_sample_rate),r.performance&&(n.PerformanceMonitor.enable=r.performance.enable,n.PerformanceMonitor.webIDHit=J(r.performance.enable_user_rate),n.PerformanceMonitor.sampleRate=r.performance.enable_sample_rate),r.breadcrumb&&(n.BreadcrumbMonitor.enable=r.breadcrumb.enable),r.static_resource_error&&(n.StaticErrorMonitor.enable=r.static_resource_error.enable),r.static_resource&&(n.ResourcePerformanceMonitor.enable=r.static_resource.enable,n.ResourcePerformanceMonitor.webIDHit=J(r.static_resource.enable_user_rate),n.ResourcePerformanceMonitor.sampleRate=r.static_resource.enable_sample_rate),r.request&&(n.AjaxMonitor.enable=r.request.enable,n.AjaxMonitor.enableError=r.request.enableError,n.AjaxMonitor.webIDHit=J(r.request.enable_user_rate),n.AjaxMonitor.sampleRate=r.request.enable_sample_rate),n):bt.getClientMonitorsSetting({})},r={commonParams:bt.getClientCommonParams(this.userConfig),flags:bt.getClientFlags(this.userConfig),custom:bt.getClientCustom(this.userConfig),monitors:bt.getClientMonitorsSetting(this.userConfig)},n=this.currentSetting;this.currentSetting=o({},this.defaultSetting,t,r,e),this.currentSetting.commonParams.pid=this.currentSetting.commonParams.pid||location.pathname,this.settingEffect(this.currentSetting,n)},bt.prototype.settingEffect=function(e,t){var r;(r=e.commonParams.rangers_web_id)!==I(document.cookie,Ze)&&(document.cookie=Ze+"="+r+";max-age=7776000;domain="+location.hostname+";path=/"),t.commonParams.pid!==e.commonParams.pid&&this.sendPageview()},bt.prototype.setMonitors=function(){var t,e=this.currentSetting.commonParams,r=e.aid,n=e.rangers_web_id,o=[],i=this.currentSetting.flags,e=new me;return o.push(e),o.push(new Je),i.enableCatchJSError&&o.push(new Qe),i.hookXHR&&o.push(new ae({commonParams:{bid:r+"",web_id:n},ajaxMonitorOptions:this.currentSetting.monitors.AjaxMonitor})),i.hookFetch&&o.push(new le({commonParams:{bid:r+"",web_id:n},ajaxMonitorOptions:this.currentSetting.monitors.AjaxMonitor})),i.enableStaticError&&o.push(new De),i.enablePerformance&&(i.enableFMP?o.push(new He({fmpMonitor:e,renderType:1,preLongTaskObserver:{precollect:[],observer:void 0}})):o.push(new He({renderType:1,preLongTaskObserver:{precollect:(null===(e=window.RangersSiteHybridSDK.lt)||void 0===e?void 0:e.e)||[],observer:null===(e=window.RangersSiteHybridSDK.lt)||void 0===e?void 0:e.o}}))),i.enableBreadcrumb&&o.push(new ze),i.enableResourcePerformance&&(t=this.serverDomain,o.push(new Le({observe:!0,checkIgnore:function(e){return e.name===ut(t)||("xmlhttprequest"===e.initiatorType||"fetch"===e.initiatorType||"beacon"===e.initiatorType||"navigation"===e.initiatorType||0===e.decodedBodySize)}}))),o},bt.prototype.setupMonitors=function(e){var t=this;this.client&&this.client.sendEvent&&(e.forEach(function(e){"FMPMonitor"===(t.monitors[e.name]=e).name?e.setup(O):e.setup(null===(e=t.client)||void 0===e?void 0:e.sendEvent)}),this.updateClientConfig({monitors:this.monitors}))},bt.prototype.getUserIDFromRangers=function(t){window.collectEvent&&m(window.collectEvent)&&window.collectEvent("getToken",function(e){t(e)})},bt.prototype.sendPageview=function(){var e;null!==(e=this.client)&&void 0!==e&&e.sendEvent({name:"PageViewMonitor",event:{ev_type:"pageview"},type:"post"})},bt.prototype.getClientOptions=function(){var e=this.currentSetting;return{reportURL:ut(this.serverDomain),monitorsSetting:e.monitors,commonParams:e.commonParams,custom:e.custom}},bt.prototype.uploadClientQueue=function(){var e;null!==(e=this.client)&&void 0!==e&&e.uploadQueue()},bt.prototype.updateClientConfig=function(e){var t;null!==(t=this.client)&&void 0!==t&&t.updateConfig(e)},bt);function bt(){var r=this;this.version="0.2.22",this.serverDomain="tbm.snssdk.com",this.instance=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];"config"!==e[0]?"emit"!==e[0]?"report"!==e[0]?r.initOnCloseCallback():r.uploadClientQueue():r.emitEvent(e):r.configure(e[1])},this.initOnCloseCallback=function(){F(r.onCloseReport,r.visibilityChange)},this.visibilityChange=function(){"hidden"===document.visibilityState&&r.onCloseReport(),"visible"===document.visibilityState&&r.updateClientReportType("xhr")},this.onCloseReport=function(){r.updateClientReportType("beacon"),r.uploadClientQueue()},this.updateClientReportType=function(e){var t;null!==(t=r.client)&&void 0!==t&&t.updateConfig({reportType:e})},this.userConfig={},this.defaultSetting=et(),this.currentSetting=this.defaultSetting,this.serverSetting=void 0,this.finderSetting={},this.client=void 0,this.monitors={}}var wt,St=O;return M()&&(wt=new yt,St=wt.instance,null!==(yt=window.RangersSiteHybridSDK)&&void 0!==yt&&yt.q&&(u(yt=window.RangersSiteHybridSDK.q)&&yt.forEach(function(e){St.apply(void 0,s(e))}),delete window.RangersSiteHybridSDK.q),window.RangersSiteHybridSDK=wt.instance),St}(); | ||
var RangersSiteHybridSDK=function(){"use strict";var r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};var p=function(){return(p=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function a(e,t){var r={};for(o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(r[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var n=0,o=Object.getOwnPropertySymbols(e);n<o.length;n++)t.indexOf(o[n])<0&&Object.prototype.propertyIsEnumerable.call(e,o[n])&&(r[o[n]]=e[o[n]]);return r}function v(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function f(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),a=[];try{for(;(void 0===t||0<t--)&&!(n=i.next()).done;)a.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a}function s(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(f(arguments[t]));return e}function c(e){return"object"==typeof e&&null!==e&&!u(e)}function n(e){return"[object Object]"===(e=e,Object.prototype.toString.call(e))}function m(e){return"function"==typeof e}function d(e){return"[object String]"===Object.prototype.toString.call(e)}function u(e){return"[object Array]"===Object.prototype.toString.call(e)}function l(e){return"number"==typeof e}function h(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function t(e,t){if(c(e))for(var r in e)h(e,r)&&t.call(null,r,e[r])}function i(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var r={},n=0;n<e.length;)r=function(e,t){var r,n=p({},e);for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&void 0!==t[r]&&(c(t[r])&&y(t[r])?n[r]=b(c(e[r])?e[r]:{},t[r]):u(t[r])?n[r]=t[r].slice():n[r]=t[r]);return n}(r,e[n]),n++;return r}function o(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var r={},n=0;n<e.length;)r=b(r,e[n]),n++;return r}var g=Object.getPrototypeOf?Object.getPrototypeOf({}):null;function y(e){return Object.getPrototypeOf?Object.getPrototypeOf(e)===g:e.constructor===Object}function b(e,t){var r,n=p({},e);for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&void 0!==t[r]&&(c(t[r])&&y(t[r])?n[r]=b(c(e[r])?e[r]:{},t[r]):u(e[r])||u(t[r])?n[r]=function t(e,r){var e=u(e)?e:[];var r=u(r)?r:[];return Array.prototype.concat.call(e,r).map(function(e){return!(e instanceof RegExp)&&(u(e)||c(e)&&y(e))?u(e)?t([],e):b({},e):e})}(e[r],t[r]):n[r]=t[r]);return n}function w(e,t){if(!u(e))return!1;if(0===e.length)return!1;for(var r=0;r<e.length;){if(e[r]===t)return!0;r++}return!1}function S(){if("fetch"in window)try{return new Headers,new Request(""),new Response,1}catch(e){return}}function M(){return!!c(window)}function e(){return M()&&!!c(window.performance)}function P(){return e()&&!!c(window.performance.timing)}function E(){return!!e()&&!!m(window.performance.getEntries)}function _(){return M()&&"function"==typeof window.MutationObserver}function T(){return M()&&"function"==typeof window.PerformanceObserver}function k(){return!!T()&&m(window.PerformanceLongTaskTiming)}function C(){if(!T())return!1;var e=window.PerformanceObserverEntryList;return m(e)&&m(e.prototype.getEntries)}function x(e){var r,e=function(e){if(!c(e))return{};var r={};return t(e,function(e,t){c(t)||u(t)?r[e]=JSON.stringify(t):r[e]=t}),r}(e),e=(r={},t(e,function(e,t){r[encodeURIComponent(e)]=encodeURIComponent(t)}),r),n=[];return t(e,function(e,t){n.push(e+"="+t)}),n.join("&")}function R(e){var t=document.createElement("a");t.href=e;e=t.pathname||"/";return"/"!==e[0]&&(e="/"+e),{href:t.href,protocol:t.protocol.slice(0,-1),hostname:t.hostname,host:t.host,search:t.search,pathname:e,hash:t.hash}}var L=function(e){if(!d(e))return!1;return m(e.toLowerCase)&&(e=e.toLowerCase()),w(["x-tt-token"],e)};function O(){}function j(e){var t="[object String]"===Object.prototype.toString.call(e);return e?t?e.length:ArrayBuffer&&e instanceof ArrayBuffer?e.byteLength:window.Blob&&e instanceof Blob?e.size:e.length||0:0}function q(e){if(!e)return"";if(!m(e.forEach))return"";var r=[];return e.forEach(function(e){var t;u(e)&&e[0]&&!L(e[0])&&(t=e[0],e=e[1]||"",r.push(t+": "+e))}),r.join("\r\n")}function H(e){var t={},r=R(e);return t.ax_protocol=r.protocol,t.ax_domain=r.hostname,t.ax_path=r.pathname,t.ax_url=(r.href||e).split("?")[0],t}function A(e,t){e=R(e),t=R(t);return e.protocol===t.protocol&&e.host===t.host}function I(e,t){var r,n;if(!e||!t)return"";var o=e.split(";"),i={};try{for(var a=v(o),s=a.next();!s.done;s=a.next()){var c=s.value.split("="),u=d(c[0])&&c[0].trim();u&&d(c[1])&&(i[u]=c[1].trim())}}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}return i[t]||""}function D(e){return u(e)&&e.length?function(e){for(var t=[],r=e.length,n=0;n<r;n++){var o=e[n];d(o)?t.push(o.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")):o&&o.source&&t.push(o.source)}return new RegExp(t.join("|"),"i")}(e):null}function F(t,r){m(t)&&(m(window.addEventListener)&&(window.addEventListener("unload",t),window.addEventListener("beforeunload",t),window.addEventListener("pagehide",t)),m(document.addEventListener)&&document.addEventListener("visibilitychange",function(e){m(r)?r(e):"hidden"===document.visibilityState&&t(e)}))}var B=function(e){var t,r;return void 0===e&&(e=window),M()&&null!==(t=e.screen)&&void 0!==t&&t.width&&null!==(r=e.screen)&&void 0!==r&&r.height?e.screen.width+"x"+e.screen.height:"0x0"},N=function(){var e="unknown",t=navigator.connection||navigator.mozConnection||navigator.webkitConnection;return t&&d(t.effectiveType)?t.effectiveType:e};function J(e){return!!e&&Math.random()<Number(e)}var U=(X.post=function(e,t,r){var n=r&&r.success||O,o=r&&r.fail||O,r=new XMLHttpRequest;r.open("POST",e,!0),r.setRequestHeader("Content-Type","application/json"),r.send(JSON.stringify(t)),r.onload=function(){try{var e;this.responseText?(e=JSON.parse(this.responseText),n(e)):n({})}catch(e){o()}},r.onerror=function(){o()},r.onabort=function(){o()}},X.get=function(e,t){var r=t&&t.success||O,n=t&&t.fail||O,o=t&&t.getResponse||O,i=t&&t.getResponseText||O,a=new XMLHttpRequest;t&&t.withCredentials&&(a.withCredentials=t.withCredentials),a.open("GET",e),a.send(),a.onload=function(){o(null==this?void 0:this.response),i(this.responseText);try{var e;this.responseText?(e=JSON.parse(this.responseText),r(e)):r({})}catch(e){n()}},a.onerror=function(){n()},a.onabort=function(){n()}},X.prototype.getCommonParams=function(){return{timestamp:Date.now()}},X);function X(e){var t=this;this.postEvent=function(e){e=p(p({},e),t.getCommonParams());X.post(t.url,e)},this.getEvent=function(e){e=x(p(p({},e),t.getCommonParams())),e=t.url+"?"+e;X.get(e)},this.getURL=function(){return t.url},this.options=e,this.url=this.options.reportURL}function z(e,t,r){if(void 0===r&&(r="0"),1<r.length)throw new TypeError("expect the length of pad to be 1, but got "+e.length);return e.length>=t?e:""+Array.from({length:t-e.length}).fill(r).join("")+e}function V(e){return e?Math.floor(Math.random()*Math.pow(10,12)).toString(16).substr(0,e):""}var K="x-tt-trace-id",G="x-tt-trace-host",Q="x-tt-logid";function W(e,t,r){void 0===r&&(r="01");t=""+z((Date.now()%4294967295).toString(16),8)+function(e){if("number"==typeof e)r=e;else{var t=e.replace(/-/g,"");if(!/^[0-9]+$/.test(t)){if(18<t.length)return"18"+V(18);e=22-t.length-4;return""+z(""+t.length,2)+t+V(e)}r=parseInt(t,10)}var r=22-(t=r.toString(16)).length-4;return""+z(""+t.length,2)+t+V(r)}(e)+("string"==typeof t?V(4):z(t.toString(16),4));return"00-"+t+"-"+t.substr(0,16)+"-"+r}function $(){var e=function(){for(var e=new Array(16),t=0,r=0;r<16;r++)0==(3&r)&&(t=4294967296*Math.random()),e[r]=t>>>((3&r)<<3)&255;return e}();return e[6]=15&e[6]|64,e[8]=63&e[8]|128,function(e){for(var t=[],r=0;r<256;++r)t[r]=(r+256).toString(16).substr(1);var n=0;return[t[e[n++]],t[e[n++]],t[e[n++]],t[e[n++]],"-",t[e[n++]],t[e[n++]],"-",t[e[n++]],t[e[n++]],"-",t[e[n++]],t[e[n++]],"-",t[e[n++]],t[e[n++]],t[e[n++]],t[e[n++]],t[e[+n]],t[e[15]]].join("")}(e)}function Y(){return m(Date)?Math.round(Date.now()/1e3):0}var Z=.1,ee=["/log/sentry/"],te=8e3,re=4e3;$(),$();function ne(e,r){if(!c(e))return{};if(!m(r))return{};var n={};return t(e,function(e,t){r(t)&&(n[e]=t)}),n}function oe(e){var t,r,n,o,i=null;return c(e)&&("timer"===e.type&&(i=c(t=e.event)&&d(t.name)&&l(t.value)?{metrics_type:"timer",event_name:"default",metrics:((r={})[t.name]=t.value,r),category:ne(t.tags,d),timestamp:Y()}:{}),"counter"===e.type&&(i=c(o=e.event)&&d(o.name)&&l(o.value)?{metrics_type:"counter",event_name:"default",metrics:((n={})[o.name]=o.value,n),category:ne(o.tags,d),timestamp:Y()}:{}),"log"===e.type&&(i=c(n=e.event)&&d(n.value)?{metrics_type:"log",event_name:"default",log_content:n.value,log_level:null!==(o=n.level)&&void 0!==o?o:"info",category:ne(n.tags,d),timestamp:Y()}:{}),"custom"===e.type&&(i=c(e=e.event)&&d(e.event_name)?{metrics_type:"custom",event_name:e.event_name,metrics:ne(e.metrics,l),category:ne(e.tags,d),timestamp:Y()}:{})),i}var ie="AjaxMonitor",ae=(se.prototype.setup=function(e){void 0===e&&(e=O),m(XMLHttpRequest)&&(this.callback=e,this.start())},se.prototype.updateConfig=function(e){this.props=o({},this.props,e)},se.prototype.start=function(){this.hookXMLHttpRequestOpen(),this.hookXMLHttpRequestSend(),this.hookXMLHttpRequestSetRequestHeader()},se.prototype.hookXMLHttpRequestSetRequestHeader=function(){var r=XMLHttpRequest.prototype.setRequestHeader||O;XMLHttpRequest.prototype.setRequestHeader=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this._requestHeaders=this._requestHeaders||[],this._requestHeaders.push(e),r.apply(this,e)}},se.prototype.hookXMLHttpRequestOpen=function(){var o=XMLHttpRequest.prototype.open;XMLHttpRequest.prototype.open=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=e[0],n=e[1];return this._url=n||"",this._method=(null==r?void 0:r.toLowerCase())||"",o.apply(this,e)}},se.prototype.hookXMLHttpRequestSend=function(){var o=this,i=XMLHttpRequest.prototype.send;XMLHttpRequest.prototype.send=function(){for(var e,t,r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];return o.checkAddTrace(this._url)&&(e=(t=null!==(e=null==o?void 0:o.props.commonParams)&&void 0!==e?e:{}).bid,t=t.web_id,e&&t&&(o.traceId=W(t,e),this.setRequestHeader(K,o.traceId))),o.hookXMLHttpRequestOnreadystatechange.call(this,o),this._start=Date.now(),this._data=null==r?void 0:r[0],i.apply(this,r)}},se.prototype.checkAddTrace=function(e){var t=null!==(n=this.props.commonParams)&&void 0!==n?n:{},r=t.bid,n=t.web_id,t=(null!==(t=this.props.ajaxMonitorOptions)&&void 0!==t?t:{}).sampleHitTrace,e=A(location.href,e);return r&&n&&t&&e},se.prototype.collectErrorRequest=function(){var e;return null!==(e=null===(e=this.props.ajaxMonitorOptions)||void 0===e?void 0:e.errorRequestCollect)&&void 0!==e&&e},se.prototype.hookXMLHttpRequestOnreadystatechange=function(i){var a=this.onreadystatechange,s=this;this.onreadystatechange=function(){for(var e,t,r,n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];if(4===this.readyState&&(t={ev_type:"ajax",ax_status:(this.status||0).toString(),ax_type:s._method,ax_request_header:q(s._requestHeaders||[]),ax_domain:"",ax_duration:0,ax_path:"",ax_protocol:"",ax_response_header:"",ax_size:0,ax_url:""},"function"==typeof this.getAllResponseHeaders&&(t.ax_response_header=function(t){if(d(t)){var e=t.split("\r\n"),r=[];return e.forEach(function(e,t){e&&m(e.split)&&(e=e.split(": "),r.push([e[0],e[1]]))}),q(r)}return c(t)?q(Object.keys(t).map(function(e){return[e,t[e]]})):t}(this.getAllResponseHeaders())),!i.checkAddTrace(s._url)||(r=null!==(r=i.traceId)&&void 0!==r?r:this.getResponseHeader(K))&&(t.trace_id=r,t.trace_host=null!==(e=this.getResponseHeader(G))&&void 0!==e?e:void 0,t.log_id=null!==(e=this.getResponseHeader(Q))&&void 0!==e?e:void 0),t.ax_duration=Date.now()-s._start,200===this.status&&(t.ax_size=function(e){var t=0;if(""===e.responseType||"text"===e.responseType)t=j(e.responseText);else if(e.response)t=j(e.response);else try{t=j(e.responseText)}catch(e){t=0}return t}(this)),t=p(p({},t),H(s._url)),i.collectErrorRequest()&&"2"!==t.ax_status[0]&&"3"!==t.ax_status[0]&&(t.ax_request={body:s._data?""+s._data:void 0,search:null===(e=R(s._url))||void 0===e?void 0:e.search,content_type:null===(e=null===(e=s._requestHeaders)||void 0===e?void 0:e.find(function(e){return"content-type"===e[0].toLowerCase()}))||void 0===e?void 0:e[1]}),m(i.callback)&&i.callback({name:i.name,type:"get",event:t})),a)return a.apply(this,n)}},se.monitorName=ie,se);function se(e){this.name=ie,this.callback=O,this.traceId=null,this.props=e}function ce(e){return e instanceof Request}var ue="FetchMonitor",le=(pe.prototype.updateConfig=function(e){this.props=o({},this.props,e)},pe.prototype.setup=function(e){void 0===e&&(e=O),S()&&(this.callback=e,this.start())},pe.prototype.start=function(){S()&&this.hookFetch()},pe.prototype.checkAddTrace=function(e){var t=null!==(n=null===(r=this.props)||void 0===r?void 0:r.commonParams)&&void 0!==n?n:{},r=t.bid,n=t.web_id,t=(null!==(t=null===(t=null==this?void 0:this.props)||void 0===t?void 0:t.ajaxMonitorOptions)&&void 0!==t?t:{}).sampleHitTrace,e=A(location.href,e);return r&&n&&t&&e},pe.prototype.updateAxRequest=function(e,t,r){var n,o;this.collectErrorRequest()&&"2"!==e.ax_status[0]&&"3"!==e.ax_status[0]&&(o=this.getFetchUrl(t,!0),e.ax_request={body:null===(t=this.getFetchBody(t,r))||void 0===t?void 0:t.toString(),search:!d(o)||null===(n=R(o))||void 0===n?void 0:n.search,content_type:null===(r=null==r?void 0:r.headers)||void 0===r?void 0:r["Content-Type"]})},pe.prototype.collectErrorRequest=function(){var e;return null!==(e=null===(e=this.props.ajaxMonitorOptions)||void 0===e?void 0:e.errorRequestCollect)&&void 0!==e&&e},pe.prototype.hookFetch=function(){var c=this,u=this,l=window.fetch;window.fetch=function(n,o){void 0===o&&(o={});var i=c.getFetchUrl(n);if(!function(e){if(d(e)){var t=f(e.split(":"),2),e=t[0];return!t[1]||("http"===e||"https"===e)}}(i))return l(n,o);var e=null!==(e=c.props.commonParams)&&void 0!==e?e:{},t=e.bid,r=e.web_id,a=Date.now(),s={ev_type:"ajax"};try{u.checkAddTrace(i)&&(o.headers=new Headers(function(e,t){var r=new Headers;ce(e)&&e.headers&&m(e.headers.forEach)&&e.headers.forEach(function(e,t){r.append(t,e)});t.headers&&new Headers(t.headers).forEach(function(e,t){r.append(t,e)});return r}(n,o)),t&&r&&(s.trace_id=W(t,r),o.headers.append(K,s.trace_id)))}catch(e){}return s.ax_type=c.getFetchMethod(n,o),s=p(p({},s),H(i)),l(n,o).then(function(e){var t,r;return s.ax_status=(e.status||0).toString(),s.ax_duration=Date.now()-a,s.ax_response_header=u.getAllHeaders(e.headers),s.ax_request_header=u.getAllHeaders(o.headers),e.headers&&m(e.headers.has)?(e.headers.has("content-length")?s.ax_size=Number(e.headers.get("content-length"))||0:s.ax_size=0,u.checkAddTrace(i)&&(e.headers.has(G)&&(s.trace_host=null!==(t=e.headers.get(G))&&void 0!==t?t:void 0),e.headers.has(K)&&(s.trace_id=null!==(r=e.headers.get(K))&&void 0!==r?r:void 0),e.headers.has(Q)&&(s.log_id=null!==(r=e.headers.get(Q))&&void 0!==r?r:void 0))):s.ax_size=0,c.updateAxRequest(s,n,o),m(u.callback)&&u.callback({name:u.name,type:"get",event:s}),e},function(e){return s.ax_status="0",s.ax_size=0,s.ax_duration=Date.now()-a,c.updateAxRequest(s,n,o),m(u.callback)&&u.callback({name:u.name,type:"get",event:s}),Promise.reject(e)})}},pe.prototype.getFetchUrl=function(e,t){void 0===t&&(t=!1);var r="",r=ce(e)?e.url:e;return t||(r=d(r)?r.split("?")[0]:r),r},pe.prototype.getFetchMethod=function(e,t){t=null!==(t=null==t?void 0:t.method)&&void 0!==t?t:"get";return ce(e)&&(t=null!==(e=e.method)&&void 0!==e?e:t),t.toLowerCase()},pe.prototype.getFetchBody=function(e,t){return ce(e)?e.body:null==t?void 0:t.body},pe.prototype.getAllHeaders=function(e){if(!e||"function"!=typeof e.forEach)return"";var r=[];return e.forEach(function(e,t){r.push([t,e])}),q(r)},pe.monitorName=ue,pe);function pe(e){this.name=ue,this.callback=O,this.props=e}var fe="FMPMonitor",me=(de.prototype.setup=function(e){if(M())return _()?void(m(document.querySelector)&&(this.callback=e&&m(e)?e:function(){},this.startTime=Date.now(),this.list=[],m(this.observer.observe)&&this.observer.observe(document,{childList:!0,subtree:!0}))):null},de.prototype.count=function(){var e=Date.now()-this.startTime,t=document.querySelector("body");t?this.list.push({score:this.score(t,1,!1),time:e}):this.list.push({score:0,time:e})},de.prototype.score=function(e,t,r){var n,o=0,i=e.tagName;if("SCRIPT"!==i&&"STYLE"!==i&&"META"!==i&&"HEAD"!==i&&!w((null===(n=this.props)||void 0===n?void 0:n.ignoreTags)||[],i)){i=e.children?e.children.length:0;if(0<i)for(var a=e.children,s=i-1;0<=s;s--)o+=this.score(a[s],t+1,0<o);if(o<=0&&!r){if(!e.getBoundingClientRect||!m(e.getBoundingClientRect))return 0;e=e.getBoundingClientRect();if(!e)return 0;if(e.top>window.innerHeight)return 0;if(e.height<=0)return 0}o+=1+.5*t}return o},de.prototype.getFmpInternal=function(){if(!this.observer)return 0;if(this.disconnect(),!this.list.length)return 0;for(var e,t={time:this.list[0].time,rate:0},r=1;r<this.list.length;r++)this.list[r].time>=this.list[r-1].time&&(e=this.list[r].score-this.list[r-1].score,t.rate<e&&(t={time:this.list[r].time,rate:e}));return t.time},de.prototype.getTimeGap=function(){return P()?this.startTime-performance.timing.navigationStart:0},de.prototype.formatEvent=function(e){return{name:this.name,type:"post",event:{ev_type:"fmp",fmp:e}}},de.monitorName=fe,de);function de(e){var r=this;this.name=fe,this.callback=O,this.disconnect=function(){var e,t;null!==(t=null===(e=r.observer)||void 0===e?void 0:e.disconnect)&&void 0!==t&&t.call(e)},this.getLoadFmp=function(){var e=r.getFmpInternal(),e=e?r.getTimeGap()+e:0,e=r.formatEvent(e);return r.callback(e),e},this.getFmp=function(){var e=r.getFmpInternal(),e=r.formatEvent(e);return r.callback(e),e},this.props=e,this.startTime=Date.now(),this.list=[],this.observer=new MutationObserver(this.count.bind(this))}function he(){}var ve=!1,ge=!1,ye={uniqueId:0,originals:{},proxies:{},patchXMLHTTPRequest:function(i){this.originals.send=XMLHttpRequest.prototype.send,XMLHttpRequest.prototype.send=function(){for(var t=this,e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];var n=ye.uniqueId++;i.beforeCb(n);var o=this.onreadystatechange;return this.onreadystatechange=function(e){null!=o&&o.call(t,e),4===t.readyState&&i.afterCb(n)},ye.originals.send.apply(this,e)},this.proxies.send=XMLHttpRequest.prototype.send},patchFetch:function(o){var i;S()&&(i=window.fetch,this.originals.fetch=i,window.fetch=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return new Promise(function(t,r){var n=ye.uniqueId++;o.beforeCb(n),i.apply(void 0,s(e)).then(function(e){o.afterCb(n),t(e)},function(e){o.afterCb(n,e),r(e)})})},this.proxies.fetch=window.fetch)},observeResourceFetchingMutations:function(a){if(_()){var s=["img","script","iframe","link","audio","video","source"],e=new MutationObserver(function(e){var t,r;try{for(var n=v(e),o=n.next();!o.done;o=n.next()){var i=o.value;("childList"===i.type&&function e(t,r){var n,o;try{for(var i=v(t),a=i.next();!a.done;a=i.next()){var s=a.value;if(r.includes(s.nodeName.toLowerCase())||s.children&&e(s.children,r))return 1}}catch(e){n={error:e}}finally{try{a&&!a.done&&(o=i.return)&&o.call(i)}finally{if(n)throw n.error}}}(i.addedNodes,s)||"attributes"===i.type&&s.includes(i.target.nodeName.toLowerCase()))&&a(i)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}});return e.observe(document,{attributes:!0,childList:!0,subtree:!0,attributeFilter:["href","src"]}),e}},resetOriginals:function(){this.originals.send&&XMLHttpRequest.prototype.send===this.proxies.send&&(ve=!1,XMLHttpRequest.prototype.send=this.originals.send),this.originals.fetch&&fetch===this.proxies.fetch&&(ge=!1,window.fetch=this.originals.fetch)}},be="TTIMonitor",we=(Se.prototype.setup=function(){},Se.prototype.isEnable=function(){return k()&&!!T()&&m(window.PerformanceResourceTiming)&&C()},Se.prototype.registerPerformanceObserver=function(){var s=this;this.performanceObserver=new PerformanceObserver(function(e){var t,r,n=e.getEntries();try{for(var o=v(n),i=o.next();!i.done;i=o.next()){var a=i.value;"resource"===a.entryType&&s.networkRequestFinishedCallback(a),"longtask"===a.entryType&&s.longTaskFinishedCallback(a)}}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}});try{this.performanceObserver.observe({type:"longtask"}),this.performanceObserver.observe({type:"resource",buffered:!0})}catch(e){this.performanceObserver.observe({entryTypes:["longtask","resource"]})}},Se.prototype.unregisterListeners=function(){this.performanceObserver&&this.performanceObserver.disconnect(),this.mutationObserver&&this.mutationObserver.disconnect(),ye.resetOriginals(),this.proxyConfig&&(this.proxyConfig.beforeCb=he,this.proxyConfig.afterCb=he)},Se.prototype.rescheduleTimer=function(e){var t=this;this.scheduleTimerTasks&&(this.timerActivationTime>e||(clearTimeout(this.timerId),this.timerId=window.setTimeout(function(){t.checkTTI()},e-performance.now()),this.timerActivationTime=e))},Se.prototype.startSchedulingTimerTasks=function(){this.scheduleTimerTasks=!0;var e=0<this.longTasks.length?this.longTasks[this.longTasks.length-1].end:0,t=this.computeLastKnownNetwork2Busy(this.incompleteRequestStarts,this.networkRequests);this.rescheduleTimer(Math.max(t+5e3,e))},Se.prototype.registerListeners=function(){ve||(ye.patchXMLHTTPRequest(this.proxyConfig),ve=!0),ge||(ye.patchFetch(this.proxyConfig),ge=!0),this.registerPerformanceObserver(),this.useMutationObserver&&(this.mutationObserver=ye.observeResourceFetchingMutations(this.mutationObserverCallback.bind(this)))},Se.prototype.mutationObserverCallback=function(e){this.rescheduleTimer(performance.now()+5e3)},Se.prototype.beforeJSInitiatedRequestCallback=function(e){this.incompleteJSInitiatedRequestStartTimes[e]=performance.now()},Se.prototype.afterJSInitiatedRequestCallback=function(e){this.incompleteJSInitiatedRequestStartTimes[e]=void 0},Se.prototype.networkRequestFinishedCallback=function(e){this.networkRequests.push({start:e.fetchStart,end:e.responseEnd}),this.rescheduleTimer(this.computeLastKnownNetwork2Busy(this.incompleteRequestStarts,this.networkRequests)+5e3)},Object.defineProperty(Se.prototype,"incompleteRequestStarts",{get:function(){for(var e=Object.keys(this.incompleteJSInitiatedRequestStartTimes),t=[],r=0;r<e.length;r++){var n=this.incompleteJSInitiatedRequestStartTimes[e[r]];"number"==typeof n&&t.push(n)}return t},enumerable:!1,configurable:!0}),Se.prototype.longTaskFinishedCallback=function(e){var t=e.startTime+e.duration;this.longTasks.push({start:e.startTime,end:t}),this.rescheduleTimer(t+5e3)},Se.prototype.checkTTI=function(){var e=this.computeLastKnownNetwork2Busy(this.incompleteRequestStarts,this.networkRequests),t=this.getFirstPaintTime()||performance.timing.domContentLoadedEventEnd-performance.timing.navigationStart,r=this.getMinValue(),n=performance.now();null===r&&this.rescheduleTimer(Math.max(e+5e3,n+1e3));n=this.computeTTI(t,r,e,n,this.longTasks);n?(this.callback&&"function"==typeof this.callback&&this.callback(Math.round(n)),this.disable()):this.rescheduleTimer(performance.now()+1e3)},Se.prototype.getMinValue=function(){if(this.minValue)return this.minValue;if(performance.timing.domContentLoadedEventEnd){var e=performance.timing;return e.domContentLoadedEventEnd-e.navigationStart}return null},Se.prototype.getFirstPaintTime=function(){if("PerformancePaintTiming"in window){var e=performance.getEntriesByType("paint")[0];return e?e.startTime:0}return 0},Se.prototype.disable=function(){clearTimeout(this.timerId),this.scheduleTimerTasks=!1,this.unregisterListeners(),this.snippetObserver&&this.snippetObserver.disconnect(),this.snippetEntries&&this.snippetEntries.splice(0,this.snippetEntries.length)},Se.prototype.computeLastKnownNetwork2Busy=function(e,t){var r,n,o,i;if(2<e.length)return performance.now();var a=[];try{for(var s=v(t),c=s.next();!c.done;c=s.next()){var u=c.value;a.push({timestamp:u.start,type:"requestStart"}),a.push({timestamp:u.end,type:"requestEnd"})}}catch(e){r={error:e}}finally{try{c&&!c.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}try{for(var l=v(e),p=l.next();!p.done;p=l.next()){var f=p.value;a.push({timestamp:f,type:"requestStart"})}}catch(e){o={error:e}}finally{try{p&&!p.done&&(i=l.return)&&i.call(l)}finally{if(o)throw o.error}}a.sort(function(e,t){return e.timestamp-t.timestamp});for(var m=e.length,d=a.length-1;0<=d;d--){var h=a[d];switch(h.type){case"requestStart":m--;break;case"requestEnd":if(2<++m)return h.timestamp;break;default:throw Error("Internal Error: This should never happen")}}return 0},Se.monitorName=be,Se);function Se(e){var t,r,n,o=this;if(this.name=be,this.longTasks=[],this.callback=he,this.useMutationObserver=!0,this.minValue=null,this.isAsync=0,this.networkRequests=[],this.incompleteJSInitiatedRequestStartTimes={},this.timerActivationTime=-1/0,this.scheduleTimerTasks=!1,this.proxyConfig={beforeCb:this.beforeJSInitiatedRequestCallback.bind(this),afterCb:this.afterJSInitiatedRequestCallback.bind(this)},this.getTTI=function(e){o.callback=e,o.isEnable()?o.startSchedulingTimerTasks():o.callback&&"function"==typeof o.callback&&o.callback()},this.computeTTI=function(e,t,r,n,o){if(n-r<5e3)return null;o=0===o.length?e:o[o.length-1].end;return n-o<5e3?null:Math.max(o,t)},this.isEnable()){if(this.useMutationObserver=!!e.useMutationObserver,this.minValue=null!==(n=e.minValue)&&void 0!==n?n:null,this.isAsync=null!==(n=e.isAsync)&&void 0!==n?n:0,this.snippetEntries=null===(n=null==e?void 0:e.preLongTaskObserver)||void 0===n?void 0:n.precollect,this.snippetObserver=null===(e=null==e?void 0:e.preLongTaskObserver)||void 0===e?void 0:e.observer,!this.isAsync&&this.snippetEntries&&0<this.snippetEntries.length)try{for(var i=v(this.snippetEntries),a=i.next();!a.done;a=i.next()){var s=a.value;"longtask"===s.entryType?this.longTasks.push({start:s.startTime,end:s.startTime+s.duration}):"resource"===s.entryType&&this.networkRequests.push({start:s.fetchStart,end:s.responseEnd})}}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}this.registerListeners()}}function Me(e){try{for(var t,r=e,n=[],o=0,i=0,a=" > ".length;r&&o++<5&&!("html"===(t=function(e){var t,r,n,o,i=e,a=[];if(!i||!i.tagName)return"";a.push(i.tagName.toLowerCase()),i.id&&a.push("#"+i.id);e=i.className;if(e&&d(e))for(t=e.split(/\s+/),o=0;o<t.length;o++)a.push("."+t[o]);var s=["type","name","title","alt"];for(o=0;o<s.length;o++)r=s[o],(n=i.getAttribute(r))&&a.push("["+r+'="'+n+'"]');return a.join("")}(r))||1<o&&80<=i+n.length*a+t.length);)n.push(t),i+=t.length,r=r.parentNode;return n.reverse().join(" > ")}catch(e){return"<unknown>"}}var Pe="FIDMonitor",Ee=(_e.prototype.setup=function(e){var s=this;if(T()&&PerformanceObserver.supportedEntryTypes&&PerformanceObserver.supportedEntryTypes.includes("first-input")&&C()){this.callback=e,this.observer=new PerformanceObserver(function(e,t){var r,n;try{for(var o=v(e.getEntries()),i=o.next();!i.done;i=o.next()){var a=i.value,a=a.processingStart-a.startTime;s.callback({name:s.name,fid:Math.round(a)})}}catch(e){r={error:e}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}t.disconnect()});try{this.observer.observe({type:"first-input",buffered:!0})}catch(e){this.observer.observe({entryTypes:["first-input"]})}}},_e.monitorName=Pe,_e);function _e(){this.name=Pe,this.callback=O}var Te="MPFIDMonitor",ke=(Ce.prototype.setup=function(){var t,e,r,a=this;if(k()&&C()){if(!this.props.isAsync){var n=null!==(r=null===(r=this.props.preLongTaskObserver)||void 0===r?void 0:r.precollect)&&void 0!==r?r:[];if(n&&0<n.length)try{for(var o=v(n),i=o.next();!i.done;i=o.next()){var s=i.value;"longtask"===s.entryType&&this.list.push(s)}}catch(e){t={error:e}}finally{try{i&&!i.done&&(e=o.return)&&e.call(o)}finally{if(t)throw t.error}}}this.observer=new PerformanceObserver(function(e){var t,r;try{for(var n=v(e.getEntries()),o=n.next();!o.done;o=n.next()){var i=o.value;a.list.push(i)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}}),this.observer.observe({entryTypes:["longtask"]})}},Ce.prototype.getMPFID=function(){var t,e;if(k()&&C()){this.observer&&this.observer.disconnect();var r=0;try{for(var n=v(this.list),o=n.next();!o.done;o=n.next()){var i=o.value;r<i.duration&&(r=i.duration)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(t)throw t.error}}return this.formatEvent(Math.round(r))}},Ce.prototype.formatEvent=function(e){return{name:this.name,mpfid:e}},Ce.monitorName=Te,Ce);function Ce(e){this.name=Te,this.list=[],this.props=e}var xe=["xmlhttprequest","fetch"],Re="ResourcePerformanceMonitor",Le=(Oe.prototype.setup=function(e){this.isEnable()&&(this.callback=null!=e?e:O,this.isAsync&&window.performance.clearResourceTimings(),this.observe&&(this.sendResourcePerformance(performance.getEntriesByType("resource")),this.observePerformance()))},Oe.prototype.isEnable=function(){return E()&&"function"==typeof performance.clearResourceTimings},Oe.prototype.getPerformance=function(){return this.isEnable()?this.buildParams(this.getResources()):this.buildParams([])},Oe.prototype.buildParams=function(e){var t=this,r=[];if(e.forEach(function(e){w(xe,e.initiatorType)||m(t.checkIgnore)&&t.checkIgnore(e)||r.push(e)}),r.length)return{name:this.name,type:"post",event:{ev_type:"resource_performance",resources:r}}},Oe.prototype.sendResourcePerformance=function(e){e=this.buildParams(e);e&&this.callback(e)},Oe.prototype.getResources=function(){return window.performance.getEntriesByType("resource")},Oe.prototype.observePerformance=function(){var t=this;T()&&new PerformanceObserver(function(e){e=e.getEntries();e.length&&t.sendResourcePerformance(e)}).observe({entryTypes:["resource"]})},Oe.monitorName=Re,Oe);function Oe(e){var t,r=this;this.name=Re,this.callback=O,this.getResourcePerformance=function(){var e;return null!==(e=r.getPerformance())&&void 0!==e?e:{}},this.isAsync=null!==(t=null==e?void 0:e.isAsync)&&void 0!==t?t:0,this.observe=null!==(t=null==e?void 0:e.observe)&&void 0!==t&&t,this.checkIgnore=null!==(e=null==e?void 0:e.checkIgnore)&&void 0!==e?e:function(){return!1}}var je={ev_type:"perf",isAsync:0,dns:0,tcp:0,request:0,response:0,processing:0,blank:0,domready:0,load:0,has_resource:0,domparse:0,resource:0,ttfb:0,redirect:0,tti:0,upload_reason:"sample",network_type:"",timing:{},navigation_timing:{},navigation:{},resources:[]},qe="PerformanceMonitor",He=(Ae.prototype.setup=function(e){var t,r=this;P()&&(this.callback=e,t=function(){r.hasLoaded=!0,r.performanceAuto&&(r.perfTimer=setTimeout(function(){r.perfLog()},200))},"complete"!==document.readyState?window.addEventListener("load",function(){setTimeout(function(){t()},0)},!1):t(),this.sendParams=p({},je),this.staticPerformanceMonitor=new Le,this.staticPerformanceMonitor.setup(),(new Ee).setup(this.hasFID),this.mpfidMonitor=new ke({isAsync:0,preLongTaskObserver:this.props.preLongTaskObserver}),this.mpfidMonitor.setup(),e=null!==(e=this.props.TTIMonitor)&&void 0!==e?e:we,this.ttiMonitor=new e({isAsync:0,preLongTaskObserver:this.props.preLongTaskObserver}),this.ttiMonitor.setup(),e=this.syncPerfLog.bind(this),F(e))},Ae.prototype.performanceNow=function(){var e;return null!==performance&&void 0!==performance&&performance.now?performance.now():(Date.now?Date.now():+new Date)-(null!==(e=null===(e=performance.timing)||void 0===e?void 0:e.navigationStart)&&void 0!==e?e:0)},Ae.prototype.getBounced=function(){return!this.hasLoaded},Ae.prototype.getPaintTime=function(t){if(E()){var e=performance.getEntriesByType("paint");if(u(e)){e=e.filter(function(e){return e.name===t});return e.length&&e[0]&&c(e[0])&&e[0].startTime||0}}return 0},Ae.monitorName=qe,Ae);function Ae(e){var o=this;this.name=qe,this.callback=O,this.sendParams=p({},je),this.finalSendParams=this.sendParams,this.hasLoaded=!1,this.initStart=0,this.hasSentInitPerf=!1,this.initFlag=!0,this.performanceAuto=!0,this.send=function(){o.initFlag&&o.hasLoaded&&(o.sendParams.isAsync&&(o.sendParams.load=Math.round(o.performanceNow()-o.initStart)),setTimeout(function(){o.perfLog()},200))},this.initAsync=function(){var e,t;o.hasSentInitPerf&&(o.sendParams=p({},je),o.sendParams.isAsync=1,o.initFlag=!0,o.initStart=o.performanceNow(),o.staticPerformanceMonitor=new Le({isAsync:1}),o.staticPerformanceMonitor.setup(),o.mpfidMonitor=new ke({isAsync:1,preLongTaskObserver:o.props.preLongTaskObserver}),o.mpfidMonitor.setup(),t=null!==(e=o.props.TTIMonitor)&&void 0!==e?e:we,o.ttiMonitor=new t({minValue:Math.round(o.performanceNow()),isAsync:1,preLongTaskObserver:o.props.preLongTaskObserver}),o.ttiMonitor.setup(),null!==(t=null===(e=o.fmpMonitor)||void 0===e?void 0:e.setup)&&void 0!==t&&t.call(e,O))},this.stopAutoPerf=function(){o.performanceAuto=!1,clearTimeout(o.perfTimer)},this.getPerformance=function(){return o.finalSendParams.tti||("complete"===document.readyState?o.perfLog():o.perfLog(!0)),o.buildParams(o.finalSendParams)},this.buildParams=function(e){return{name:o.name,type:"post",event:e}},this.perfLog=function(e){if(void 0===e&&(e=!1),P()){if(o.initFlag=!1,o.finalSendParams=p({},o.sendParams),!o.sendParams.isAsync){var t=o.getBounced();if(t)return o.finalSendParams.bounced=t,void o.invokeCallback(0,o.buildParams(o.finalSendParams));o.finalSendParams=p(p({},o.finalSendParams),o.getParams())}var r=o.getStaticResources(),n=o.getFMP(),t=o.getMPFID();r&&(o.finalSendParams.resources=r,o.finalSendParams.has_resource=1),n&&(o.finalSendParams.fmp=Math.round(n)),n&&o.finalSendParams.fcp&&o.finalSendParams.fmp<o.finalSendParams.fcp&&(o.finalSendParams.fmp=o.finalSendParams.fcp),t&&(o.finalSendParams.mpfid=t),m(o.callback)&&(!e&&o.ttiMonitor&&m(o.ttiMonitor.getTTI)?o.ttiMonitor.getTTI(function(e){e&&0<e&&(o.finalSendParams.tti=o.finalSendParams.isAsync?Math.round(e-o.initStart):e),o.invokeCallback(o.finalSendParams.isAsync,o.buildParams(o.finalSendParams))}):o.invokeCallback(o.finalSendParams.isAsync,o.buildParams(o.finalSendParams)))}},this.invokeCallback=function(e,t){if(!e){if(o.hasSentInitPerf)return;o.hasSentInitPerf=!0}o.callback(t)},this.getStaticResources=function(){var e;if(o.staticPerformanceMonitor&&m(o.staticPerformanceMonitor.getResourcePerformance)){var t=o.staticPerformanceMonitor.getResourcePerformance();if(null!==(e=null==t?void 0:t.event)&&void 0!==e&&e.resources)return t.event.resources||[]}},this.getFMP=function(){var e,t;return o.fmpMonitor?(o.fmpMonitor.disconnect(),o.sendParams.isAsync?(null===(e=null==(t=o.fmpMonitor.getFmp())?void 0:t.event)||void 0===e?void 0:e.fmp)||0:m(o.fmpMonitor.getLoadFmp)?1!==o.props.renderType?2===o.props.renderType?o.getPaintTime("first-contentful-paint"):0:null!==(t=null===(t=(t=o.fmpMonitor.getLoadFmp()||{}).event)||void 0===t?void 0:t.fmp)&&void 0!==t?t:0:0):0},this.getMPFID=function(){if(o.mpfidMonitor&&m(o.mpfidMonitor.getMPFID)){var e=o.mpfidMonitor.getMPFID();if(e)return e.mpfid}},this.syncPerfLog=function(){var e,t;o.hasSentInitPerf||(o.perfLog(!0),null!==(t=(e=o.props).report)&&void 0!==t&&t.call(e))},this.hasFID=function(e){o.sendParams.fid=e.fid},this.getParams=function(){if(P()){var e={},t=window.performance.timing;e.dns=t.domainLookupEnd-t.domainLookupStart,e.tcp=t.connectEnd-t.connectStart,e.request=t.responseStart-t.requestStart,e.response=t.responseEnd-t.responseStart,e.processing=t.domComplete-t.domLoading,e.blank=t.responseEnd-t.navigationStart,e.domready=t.domInteractive-t.navigationStart,e.load=t.loadEventEnd-t.navigationStart,t.secureConnectionStart&&(e.ssl=t.connectEnd-t.secureConnectionStart),e.domparse=t.domInteractive-t.responseEnd,e.resource=t.loadEventStart-t.domContentLoadedEventEnd,e.ttfb=t.responseStart-t.requestStart,e.redirect=t.redirectEnd-t.redirectStart;var r=o.getPaintTime("first-paint"),t=o.getPaintTime("first-contentful-paint");r&&(e.fp=Math.round(r)),t&&(e.fcp=Math.round(t));r=function(){if(!E())return null;var e=window.performance.getEntriesByType("navigation");return u(e)&&0!==e.length?e[0]:null}(),t=P()?window.performance.timing:null;return(r||t)&&(e.navigation=null!=r?r:t),t&&(e.timing=t),r&&(e.navigation_timing=r),e}},e.fmpMonitor&&(this.fmpMonitor=e.fmpMonitor);var t=e.performanceAuto;this.performanceAuto=void 0===t||t,this.props=null!=e?e:{}}var Ie="StaticErrorMonitor",De=(Fe.prototype.setup=function(e){M()&&(this.callback=e,window.addEventListener("error",this.staticErrorLog.bind(this),!0))},Fe.prototype.getSrc=function(e){return"link"===e.tagName.toLowerCase()?Be(e,"href"):Be(e,"src")},Fe.prototype.getParams=function(e,t){var r={ev_type:"static",st_type:t},t=R(e);r.st_src=e,r.st_protocol=t.protocol,r.st_domain=t.hostname,r.st_path=t.pathname;t=function(e){var t,r=null===(t=null===(n=window.performance)||void 0===n?void 0:n.getEntriesByType)||void 0===t?void 0:t.call(n,"resource"),n=null==r?void 0:r.length;if(!n)return;for(var o=n-1;-1<o;o--){var i=r[o];if(i.name===e)return i}}(t.href);return t&&(r.timing=t),r},Fe.monitorName=Ie,Fe);function Fe(){var i=this;this.name=Ie,this.callback=O,this.buildEvent=function(e){var t,r,n=e||window.event||{};try{r=null!==(t=null!==(t=n.target)&&void 0!==t?t:n.srcElement)&&void 0!==t?t:{}}catch(n){return}var o=r.tagName;if(o&&d(o)){o=o.toLowerCase();e=i.getSrc(r);if(e&&e!==window.location.href)return{name:i.name,type:"get",event:i.getParams(e,o)}}},this.staticErrorLog=function(e){e=i.buildEvent(e);e&&i.callback(e)}}function Be(e,t){var r;return e.getAttribute&&m(e.getAttribute)?null!==(r=e.getAttribute(t))&&void 0!==r?r:"":null!==(t=e[t])&&void 0!==t?t:""}var Ne="EmitMonitor",Je=(Ue.prototype.setup=function(e){this.callback=e||O},Ue.prototype.buildCustomTimeLog=function(e,t,r){return function(e){var t=e.name,r=e.tag,e=e.value;if(t&&e){e={ev_type:"custom",cm_name:t=m(t.toString)?t.toString():"",cm_type:"time",cm_value:e=+e};return r&&(r=m(r.toString)?r.toString():"",e.cm_tag=r),{name:"SentCustomTime",type:"get",event:e}}}({name:e,tag:t,value:r})},Ue.prototype.buildCustomCountLog=function(e,t){return function(e){var t=e.name,e=e.tag;if(t){t={ev_type:"custom",cm_name:t=m(t.toString)?t.toString():"",cm_type:"count"};return e&&(e=m(e.toString)?e.toString():"",t.cm_tag=e),{name:"SentCustomCount",type:"get",event:t}}}({name:e,tag:t})},Ue.prototype.buildEmitSingleEvent=function(e){e=oe(e);if(e&&(!e||e.event_name))return{name:this.name,type:"post",event:{ev_type:"flexible",flexible_data_list:[e]}}},Ue.monitorName=Ne,Ue);function Ue(){var o=this;this.name=Ne,this.callback=O,this.handOut=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=o.buildEvent.apply(o,s(e));o.callback(r)},this.buildEvent=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if("sendCustomCountLog"===e[0])return o.buildCustomCountLog(e[1],e[2]);if("sendCustomTimeLog"===e[0])return o.buildCustomTimeLog(e[1],e[2],e[3]);if("send"===e[0]){if("count"===e[1])return o.buildCustomCountLog(e[2].category,e[2].action);if("timing"===e[1])return o.buildCustomTimeLog(e[2].category,e[2].action,e[2].value)}if("emit"===e[0]&&e[1]&&e[2]){var r={type:e[1],event:e[2]};return o.buildEmitSingleEvent(r)}},this.send=function(e,t,r){var n=r.action,r=r.value;"count"===e&&o.sendCustomCountLog(t,n),"timing"===e&&o.sendCustomTimeLog(t,n,r)},this.sendCustomTimeLog=function(e,t,r){r=o.buildCustomTimeLog(e,t,r);o.callback(r)},this.sendCustomCountLog=function(e,t){t=o.buildCustomCountLog(e,t);return o.callback(t),t},this.emitEvent=function(e){e=o.buildEmitSingleEvent(e);o.callback(e)}}var Xe="BreadcrumbMonitor",ze=(Ve.prototype.setup=function(){this.instrumentDOM()},Ve.prototype.instrumentDOM=function(){var e;"document"in window&&(e=this,window.document.addEventListener("click",e.domEventHandler("click",e.triggerHandlers.bind(e,"dom")),!1),window.document.addEventListener("keypress",e.keypressEventHandler(e.triggerHandlers.bind(e,"dom")),!1))},Ve.prototype.domEventHandler=function(t,r,n){var o=this;return void 0===n&&(n=!1),function(e){o.keypressTimeout=void 0,e&&o.lastCapturedEvent!==e&&(o.lastCapturedEvent=e,o.debounceTimer&&clearTimeout(o.debounceTimer),n?o.debounceTimer=setTimeout(function(){r({event:e,name:t})}):r({event:e,name:t}))}},Ve.prototype.triggerHandlers=function(e,t){if(e)try{this.domBreadcrumb(t)}catch(e){}},Ve.prototype.keypressEventHandler=function(n){var o=this;return function(e){var t;try{t=e.target}catch(e){return}var r=t&&t.tagName;r&&("INPUT"===r||"TEXTAREA"===r||t.isContentEditable)&&(o.keypressTimeout||o.domEventHandler("input",n)(e),clearTimeout(o.keypressTimeout),o.keypressTimeout=window.setTimeout(function(){o.keypressTimeout=void 0},o.debounceDuration))}},Ve.prototype.domBreadcrumb=function(e){var t;try{t=e.event.target?Me(e.event.target):Me(e.event)}catch(e){t="<unknown>"}0!==t.length&&this.addBreadcrumb({category:"ui."+e.name,message:t})},Ve.monitorName=Xe,Ve);function Ve(e){var n=this;this.name=Xe,this.breadcrumbs=[],this.getBreadcrumbs=function(){return n.breadcrumbs},this.addBreadcrumb=function(e){var t=p(p({},e),{timestamp:(new Date).getTime()}),r=n.maxBreadcrumbs,e=n.breadcrumbs;return n.breadcrumbs=0<=r?s(e,[t]).slice(-r):s(e,[t]),n},this.debounceDuration=1e3,this.debounceTimer=0,this.breadcrumbs=[],this.maxBreadcrumbs=null!==(e=null==e?void 0:e.maxBreadcrumbs)&&void 0!==e?e:20}var Ke={enableCatchGlobalJSError:!0},Ge="JSExceptionMonitor",Qe=(We.prototype.setup=function(e){M()&&(this.callback=e,this.options.enableCatchGlobalJSError&&(window.addEventListener("error",this.jsErrorLog),window.addEventListener("unhandledrejection",this.jsPromiseRejectionLog)))},We.prototype.buildEvent=function(e){if(!function(e){switch(Object.prototype.toString.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":return 1;default:return e instanceof Error}}(e)?(n(e)&&(t={message:JSON.stringify(e)}),d(e)&&(t={message:e})):t=e,t){var t={ev_type:"js_exception",exception:this.normalizeError(t),breadcrumbs:null!==(t=null===(t=this.options.breadcrumbMonitor)||void 0===t?void 0:t.getBreadcrumbs())&&void 0!==t?t:[]};return{name:this.name,type:"post",event:t}}},We.prototype.logError=function(e){e=this.buildEvent(e);e&&this.callback(e)},We.prototype.getJSError=function(e){e=e.error;if(e)return e},We.prototype.getJSPromiseRejection=function(e){var t=void 0;try{"reason"in e?t=e.reason:"detail"in e&&"reason"in e.detail&&(t=e.detail.reason)}catch(e){}if(t)return t},We.prototype.normalizeError=function(e){return{message:e.message,name:e.name,fileName:e.fileName,lineNumber:e.lineNumber,columnNumber:e.columnNumber,stack:e.stack,stacktrace:e.stacktrace,framesToPop:e.framesToPop}},We.monitorName=Ge,We);function We(e){var t=this;this.name=Ge,this.callback=O,this.jsErrorLog=function(e){e=t.getJSError(e);e&&t.logError(e)},this.jsPromiseRejectionLog=function(e){e=t.getJSPromiseRejection(e);e&&t.logError(e)},this.options=p(p({},Ke),e)}var $e=(Ye.prototype.sendEvent=function(e){e=this.getEventToBeSent(e);e&&this.idleSendEvent(e)},Ye.prototype.getEventToBeSent=function(e){e=this._modifyEvent(e);if(this._shouldSend(e))return e},Ye.prototype._modifyEvent=function(e){return e},Ye.prototype._shouldSend=function(e){return!0},Ye.prototype._send=function(e){},Ye.prototype.idleSendEvent=function(e){this._send(e)},Ye);function Ye(){}var Ze="RANGERS_WEB_ID";function et(){var e={flags:{hookPath:!0,hookXHR:!0,hookFetch:!0,enableSizeStats:!0,enableFMP:!0,enablePerformance:!0,enableResourcePerformance:!0,enableStaticError:!0,enableCatchJSError:!0,enableCatchGlobalJSError:!0,enableCatchJSErrorV2:!1,enableCrash:!0,enableMemoryRecord:!0,enableFPSJankTimesMonitor:!0,enableBreadcrumb:!0,hookConsole:!1,hookDom:!0}};return e.monitors={BaseMonitor:{appTypeSetting:{type:0,SPA:"",renderType:0},sampleHit:J(1)},JSErrorMonitor:{enable:!0,webIDHit:!0,sampleRate:1,webIDHitBehavior:!1,sampleHitBehavior:!1,ignoreErrors:[],whitelistUrls:[],blacklistUrls:[],download_link:""},AjaxMonitor:{enable:!0,enableError:!1,webIDHit:!0,sampleHit:J(1),sampleRate:1,sampleHitTrace:!1,ignore:ee,abort:!1,whitelistUrls:[],statusCodeSample:{},requestUrlSample:[],errorRequestCollect:!1},PerformanceMonitor:{enable:!0,webIDHit:!0,sampleRate:1,webIDHitStaticResource:!1,sampleHitStaticResource:J(Z),slowSessionTime:te,spaSlowSessionTime:re,geckoUrls:[],interval:0,checkPoint:[]},StaticErrorMonitor:{enable:!0,webIDHit:!0,sampleRate:1,ignore:ee},ResourcePerformanceMonitor:{enable:!0,webIDHit:!0,sampleRate:1},BreadcrumbMonitor:{enable:!0},EmitMonitor:{enable:!0}},e.custom={},e.commonParams={aid:0,pid:"",version:"0.2.23",hostname:window.location.hostname,protocol:window.location.protocol.slice(0,-1),rangers_web_id:it($()),rangers_session_id:$(),context:{},url:window.location.href,timestamp:Date.now(),screen_resolution:B(),network_type:N()},e}var tt,rt,nt,ot,it=function(e){return null!==document&&void 0!==document&&document.cookie&&(e=I(document.cookie,Ze)),e},at=(tt="/v2/user/webid",rt="/v2/user/ssid",nt="/v2/event/list",ot=[],["https://mcs.ctobsnssdk.com","https://mcs.itobsnssdk.com","https://mcs.tobsnssdk.com"].forEach(function(t){[tt,rt,nt].forEach(function(e){ot.push(t+e)})}),ot);function st(e){var t=e.sendParams,e=e.monitorsSetting;if(!t||!c(t)||!t.event)return!1;var r,n,e=e;if("AjaxMonitor"===t.name||"FetchMonitor"===t.name){var o=D(s(["/monitor_browser/collect"],at)||[]);if(o&&o.test(t.event.ax_url))return!1}return!(null==e||!e.BaseMonitor.sampleHit)&&("AjaxMonitor"===t.name||"FetchMonitor"===t.name?function(e){var r=e.sendParams,t=e.ajaxMonitor;if(!t)return!0;if("2"!==r.event.ax_status[0]&&"3"!==r.event.ax_status[0])return t.enableError;if(!t.enable)return!1;if(!t.webIDHit)return!1;if(!t.sampleHit||!J(t.sampleRate))return!1;if(u(e=t.whitelistUrls)&&0<e.length){var n=D(t.whitelistUrls||[]);return n&&n.test(r.event.ax_url)?!0:!1}if((n=D(t.ignore||[]))&&n.test(r.event.ax_url))return!1;if((n=t.statusCodeSample)&&h(n,r.event.ax_status))return J(n[r.event.ax_status]);if(t=t.requestUrlSample){var o=!1,i=!1;if(t.forEach(function(e){var t;o||null!=(t=D([e.url]))&&t.test(r.event.ax_url)&&(o=!0,i=J(e.sampleRate))}),o)return i}return!0}({sendParams:t,ajaxMonitor:e.AjaxMonitor}):"PerformanceMonitor"===t.name?!(r=(r={performanceMonitor:e.PerformanceMonitor}).performanceMonitor)||!!r.enable&&(!!r.webIDHit&&J(r.sampleRate)):"StaticErrorMonitor"===t.name?(o={sendParams:t,staticErrorMonitor:e.StaticErrorMonitor},r=o.sendParams,!(o=o.staticErrorMonitor)||!!o.enable&&(!!o.webIDHit&&(!!J(o.sampleRate)&&!((o=D(o.ignore||[]))&&o.test(r.event.st_src))))):"JSExceptionMonitor"===t.name?!(n=(n={jsErrorMonitor:e.JSErrorMonitor}).jsErrorMonitor)||!!n.enable&&(!!n.webIDHit&&J(n.sampleRate)):"ResourcePerformanceMonitor"===t.name?!(n=(n={resourcePerformanceMonitor:e.ResourcePerformanceMonitor}).resourcePerformanceMonitor)||!!n.enable&&(!!n.webIDHit&&J(n.sampleRate)):"EmitMonitor"!==t.name||!!{emitMonitor:e.EmitMonitor}.emitMonitor)}function ct(e){var t=e.sendParams,r=e.commonParams,n=e.custom,e=e.breadcrumbMonitor,e=function(e){var t=e.sendParams,r=e.commonParams,n=e.breadcrumbMonitor;if((e={}).ev_type=t.event.ev_type,e.common=r,"PageViewMonitor"===t.name&&e)return e;if(("AjaxMonitor"===t.name||"FetchMonitor"===t.name)&&e){r=t.event,r=(r.ev_type,a(r,["ev_type"]));return e.event=r,e}if("PerformanceMonitor"===t.name&&e){t.event.navigation=t.event.navigation_timing;var o=t.event,o=(o.ev_type,a(o,["ev_type"]));return e.ev_type="performance",e.event={fp:o.fp,fcp:o.fcp,fmp:o.fmp,tti:o.tti,fid:o.fid,mpfid:o.mpfid,isAsync:o.isAsync,timing:o.timing,navigation:o.navigation_timing,bounced:o.bounced},e}if("StaticErrorMonitor"===t.name&&e){e.ev_type="resource_error";o=t.event,o=(o.ev_type,a(o,["ev_type"]));return e.event=o,e}if("ResourcePerformanceMonitor"===t.name&&e){e.ev_type="resource";var i=t.event,i=(i.ev_type,a(i,["ev_type"]));return e.event=i,e}if("JSExceptionMonitor"===t.name&&e){e.ev_type="js_error";i=t.event,i=(i.ev_type,a(i,["ev_type"]));return e.event=i.exception,e.breadcrumbs=null!==(n=null==n?void 0:n.getBreadcrumbs())&&void 0!==n?n:[],e}return"EmitMonitor"===t.name&&e&&(e.ev_type="flexible",e.flexible_data_list=t.event.flexible_data_list),e}({sendParams:t,commonParams:p(p({},null!=r?r:{}),{url:window.location.href}),breadcrumbMonitor:e});return n&&m(n.beforeSend)&&(e=n.beforeSend(e||{})),e}function ut(e){return"https://"+e+"/monitor_browser/collect"}var lt,pt,ft,mt={cover:O,accumulate:O,reportDirectly:O,average:O},dt=function(e){var r=this;this.cover=function(e,t){r.log.cover(e,t)},this.accumulate=function(e,t){r.log.accumulate(e,t)},this.reportDirectly=function(e,t){r.log.reportDirectly(e,t)},this.average=function(e,t){r.log.average(e,t)},this.log=null!==(e=e.transport)&&void 0!==e?e:mt},ht=(r(pt=gt,ft=lt=$e),pt.prototype=null===ft?Object.create(ft):(vt.prototype=ft.prototype,new vt),gt.prototype.uploadQueue=function(){},gt.prototype._shouldSend=function(e){return st({sendParams:e,monitorsSetting:this.options.monitorsSetting})},gt.prototype._modifyEvent=function(e){return(e=(e={sendParams:e}).sendParams)&&c(e)?e:{}},gt.prototype.buildParams=function(e){var t,r=null===(t=null===(t=this.options.monitorsSetting)||void 0===t?void 0:t.BreadcrumbMonitor)||void 0===t||!t.enable||null===(r=this.options.monitors)||void 0===r?void 0:r.BreadcrumbMonitor;return ct({sendParams:e,commonParams:this.options.commonParams,custom:this.options.custom,breadcrumbMonitor:r})},gt.prototype._send=function(e){e&&e.event&&e.name&&this.transport&&this.sendByTypes(e)},gt.prototype.sendByTypes=function(e){var t;this.transport&&(t={jsBase:null!==(t=this.options.commonParams)&&void 0!==t?t:{},jsInfo:this.buildParams(e)},"PerformanceMonitor"===e.name&&this.transport.cover(t,t.jsInfo.ev_type),"StaticErrorMonitor"===e.name&&this.transport.reportDirectly(t,t.jsInfo.ev_type),"ResourcePerformanceMonitor"===e.name&&this.transport.reportDirectly(t,t.jsInfo.ev_type),"AjaxMonitor"===e.name&&this.transport.reportDirectly(t,t.jsInfo.ev_type),"FetchMonitor"===e.name&&this.transport.reportDirectly(t,t.jsInfo.ev_type),"JSExceptionMonitor"===e.name&&this.transport.reportDirectly(t,t.jsInfo.ev_type),"PageViewMonitor"===e.name&&this.transport.reportDirectly(t,t.jsInfo.ev_type))},gt);function vt(){this.constructor=pt}function gt(e){var o=lt.call(this)||this;return o.options={},o.setTransport=function(e){o.transport=new dt({transport:e.transport}),o.preQueue.forEach(function(e){lt.prototype.sendEvent.call(o,e)})},o.updateConfig=function(e){var t,r,n;o.options=(t={previousOptions:o.options,newOptions:e},r=t.previousOptions,n=t.newOptions,(e=p(p({},r),n)).commonParams=i({},null!==(t=r.commonParams)&&void 0!==t?t:{},null!==(t=n.commonParams)&&void 0!==t?t:{}),e.monitorsSetting=i({},null!==(t=r.monitorsSetting)&&void 0!==t?t:{},null!==(t=n.monitorsSetting)&&void 0!==t?t:{}),e.monitors=p(p({},null!==(t=r.monitors)&&void 0!==t?t:{}),null!==(t=n.monitors)&&void 0!==t?t:{}),e.custom=p(p({},null!==(r=r.custom)&&void 0!==r?r:{}),null!==(n=n.custom)&&void 0!==n?n:{}),e)},o.sendEvent=function(e){o.transport?lt.prototype.sendEvent.call(o,e):o.preQueue.push(e)},o.getEventToBeSent=function(e){return null!==(e=lt.prototype.getEventToBeSent.call(o,e))&&void 0!==e?e:{}},o.options=e,o.preQueue=[],o}var yt=(bt.getClientCommonParams=function(r){void 0===r&&(r={});var n={};if(!c(r))return n;var o=["context","pid"];t(r,function(e,t){w(o,e)&&(n[e]=t)});return t({user_unique_id:"rangers_web_id",app_id:"aid"},function(e,t){h(r,e)&&(n[t]=r[e])}),n},bt.getClientFlags=function(e){void 0===e&&(e={});var r={};if(!c(e))return r;var n=["hookPath","hookXHR","hookFetch","enableSizeStats","enableFMP","enablePerformance","enableStaticError","enableCatchJSError","enableCatchJSErrorV2","enableCatchGlobalJSError","enableResourcePerformance","enableCrash","enableMemoryRecord","enableFPSJankTimesMonitor","enableBreadcrumb","hookConsole"];return t(e,function(e,t){w(n,e)&&(r[e]=t)}),r},bt.getClientCustom=function(e){var t={};return e.beforeSend&&m(e.beforeSend)&&(t.beforeSend=e.beforeSend),t},bt.getClientMonitorsSetting=function(e){return e=(t={setting:e}).setting,t={JSErrorMonitor:{},PerformanceMonitor:{},BreadcrumbMonitor:{},StaticErrorMonitor:{},ResourcePerformanceMonitor:{},BaseMonitor:{appTypeSetting:{}},AjaxMonitor:{}},e.ajaxWhitelistUrls&&u(e.ajaxWhitelistUrls)&&(t.AjaxMonitor.whitelistUrls=(t.AjaxMonitor.whitelistUrls||[]).concat(e.ajaxWhitelistUrls)),e.ignoreAjax&&u(e.ignoreAjax)&&(t.AjaxMonitor.ignore=(t.AjaxMonitor.ignore||[]).concat(e.ignoreAjax)),e.ignoreStatic&&u(e.ignoreStatic)&&(t.StaticErrorMonitor.ignore=(t.StaticErrorMonitor.ignore||[]).concat(e.ignoreStatic)),e.ignoreErrors&&u(e.ignoreErrors)&&(t.JSErrorMonitor.ignoreErrors=e.ignoreErrors),e.errorBlacklistUrls&&u(e.errorBlacklistUrls)&&(t.JSErrorMonitor.blacklistUrls=e.errorBlacklistUrls),e.errorWhitelistUrls&&u(e.errorWhitelistUrls)&&(t.JSErrorMonitor.whitelistUrls=e.errorWhitelistUrls),h(e,"sampleRate")&&(t.BaseMonitor.sampleHit=J(e.sampleRate)),t;var t},bt.prototype.configure=function(e){if(c(e)){if(this.userConfig=p(p({},this.userConfig||{}),e||{}),!this.serverDomain){if(!this.userConfig.serverDomain)return void console.error('"serverDomain" must be configured');this.serverDomain=this.userConfig.serverDomain}this.updateCurrentSetting(),this.client?this.updateClientConfig(this.getClientOptions()):this.init()}},bt.prototype.emitEvent=function(e){var t;this.monitors.EmitMonitor&&(t=this.monitors.EmitMonitor).handOut.apply(t,s(e))},bt.prototype.init=function(){var e=this.getClientOptions();this.client=new ht(e),this.updateClientConfig(e),this.sendPageview(),this.setupMonitors(this.setMonitors()),this.getServerSetting()},bt.prototype.getServerSetting=function(){var t=this;if(this.serverSetting)return this.updateCurrentSetting(),void this.afterServerSetting();var e="https://"+this.serverDomain+"/settings/get/web?aid="+this.currentSetting.commonParams.aid;U.get(e,{success:function(e){try{t.serverSetting=e.data,t.updateCurrentSetting(),t.afterServerSetting()}catch(e){t.afterServerSetting()}},fail:function(){t.afterServerSetting()}})},bt.prototype.afterServerSetting=function(){this.updateClientConfig(this.getClientOptions()),this.client.setTransport({transport:this.userConfig.transport})},bt.prototype.updateCurrentSetting=function(){var e={commonParams:bt.getClientCommonParams(this.finderSetting),flags:bt.getClientFlags({}),custom:bt.getClientCustom({}),monitors:bt.getClientMonitorsSetting({})},t={commonParams:bt.getClientCommonParams({}),flags:bt.getClientFlags({}),custom:bt.getClientCustom({}),monitors:this.serverSetting?(r=this.serverSetting,n={JSErrorMonitor:{},PerformanceMonitor:{},BreadcrumbMonitor:{},StaticErrorMonitor:{},BaseMonitor:{},ResourcePerformanceMonitor:{},AjaxMonitor:{}},(r=r.setting).jserr&&(n.JSErrorMonitor.enable=r.jserr.enable,n.JSErrorMonitor.webIDHit=J(r.jserr.enable_user_rate),n.JSErrorMonitor.sampleRate=r.jserr.enable_sample_rate),r.performance&&(n.PerformanceMonitor.enable=r.performance.enable,n.PerformanceMonitor.webIDHit=J(r.performance.enable_user_rate),n.PerformanceMonitor.sampleRate=r.performance.enable_sample_rate),r.breadcrumb&&(n.BreadcrumbMonitor.enable=r.breadcrumb.enable),r.static_resource_error&&(n.StaticErrorMonitor.enable=r.static_resource_error.enable),r.static_resource&&(n.ResourcePerformanceMonitor.enable=r.static_resource.enable,n.ResourcePerformanceMonitor.webIDHit=J(r.static_resource.enable_user_rate),n.ResourcePerformanceMonitor.sampleRate=r.static_resource.enable_sample_rate),r.request&&(n.AjaxMonitor.enable=r.request.enable,n.AjaxMonitor.enableError=r.request.enableError,n.AjaxMonitor.webIDHit=J(r.request.enable_user_rate),n.AjaxMonitor.sampleRate=r.request.enable_sample_rate),n):bt.getClientMonitorsSetting({})},r={commonParams:bt.getClientCommonParams(this.userConfig),flags:bt.getClientFlags(this.userConfig),custom:bt.getClientCustom(this.userConfig),monitors:bt.getClientMonitorsSetting(this.userConfig)},n=this.currentSetting;this.currentSetting=o({},this.defaultSetting,t,r,e),this.currentSetting.commonParams.pid=this.currentSetting.commonParams.pid||location.pathname,this.settingEffect(this.currentSetting,n)},bt.prototype.settingEffect=function(e,t){var r;(r=e.commonParams.rangers_web_id)!==I(document.cookie,Ze)&&(document.cookie=Ze+"="+r+";max-age=7776000;domain="+location.hostname+";path=/"),t.commonParams.pid!==e.commonParams.pid&&this.sendPageview()},bt.prototype.setMonitors=function(){var t,e=this.currentSetting.commonParams,r=e.aid,n=e.rangers_web_id,o=[],i=this.currentSetting.flags,e=new me;return o.push(e),o.push(new Je),i.enableCatchJSError&&o.push(new Qe),i.hookXHR&&o.push(new ae({commonParams:{bid:r+"",web_id:n},ajaxMonitorOptions:this.currentSetting.monitors.AjaxMonitor})),i.hookFetch&&o.push(new le({commonParams:{bid:r+"",web_id:n},ajaxMonitorOptions:this.currentSetting.monitors.AjaxMonitor})),i.enableStaticError&&o.push(new De),i.enablePerformance&&(i.enableFMP?o.push(new He({fmpMonitor:e,renderType:1,preLongTaskObserver:{precollect:[],observer:void 0}})):o.push(new He({renderType:1,preLongTaskObserver:{precollect:(null===(e=window.RangersSiteHybridSDK.lt)||void 0===e?void 0:e.e)||[],observer:null===(e=window.RangersSiteHybridSDK.lt)||void 0===e?void 0:e.o}}))),i.enableBreadcrumb&&o.push(new ze),i.enableResourcePerformance&&(t=this.serverDomain,o.push(new Le({observe:!0,checkIgnore:function(e){return e.name===ut(t)||("xmlhttprequest"===e.initiatorType||"fetch"===e.initiatorType||"beacon"===e.initiatorType||"navigation"===e.initiatorType||0===e.decodedBodySize)}}))),o},bt.prototype.setupMonitors=function(e){var t=this;this.client&&this.client.sendEvent&&(e.forEach(function(e){"FMPMonitor"===(t.monitors[e.name]=e).name?e.setup(O):e.setup(null===(e=t.client)||void 0===e?void 0:e.sendEvent)}),this.updateClientConfig({monitors:this.monitors}))},bt.prototype.getUserIDFromRangers=function(t){window.collectEvent&&m(window.collectEvent)&&window.collectEvent("getToken",function(e){t(e)})},bt.prototype.sendPageview=function(){var e;null!==(e=this.client)&&void 0!==e&&e.sendEvent({name:"PageViewMonitor",event:{ev_type:"pageview"},type:"post"})},bt.prototype.getClientOptions=function(){var e=this.currentSetting;return{reportURL:ut(this.serverDomain),monitorsSetting:e.monitors,commonParams:e.commonParams,custom:e.custom}},bt.prototype.uploadClientQueue=function(){var e;null!==(e=this.client)&&void 0!==e&&e.uploadQueue()},bt.prototype.updateClientConfig=function(e){var t;null!==(t=this.client)&&void 0!==t&&t.updateConfig(e)},bt);function bt(){var r=this;this.version="0.2.23",this.serverDomain="tbm.snssdk.com",this.instance=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];"config"!==e[0]?"emit"!==e[0]?"report"!==e[0]?r.initOnCloseCallback():r.uploadClientQueue():r.emitEvent(e):r.configure(e[1])},this.initOnCloseCallback=function(){F(r.onCloseReport,r.visibilityChange)},this.visibilityChange=function(){"hidden"===document.visibilityState&&r.onCloseReport(),"visible"===document.visibilityState&&r.updateClientReportType("xhr")},this.onCloseReport=function(){r.updateClientReportType("beacon"),r.uploadClientQueue()},this.updateClientReportType=function(e){var t;null!==(t=r.client)&&void 0!==t&&t.updateConfig({reportType:e})},this.userConfig={},this.defaultSetting=et(),this.currentSetting=this.defaultSetting,this.serverSetting=void 0,this.finderSetting={},this.client=void 0,this.monitors={}}var wt,St=O;return M()&&(wt=new yt,St=wt.instance,null!==(yt=window.RangersSiteHybridSDK)&&void 0!==yt&&yt.q&&(u(yt=window.RangersSiteHybridSDK.q)&&yt.forEach(function(e){St.apply(void 0,s(e))}),delete window.RangersSiteHybridSDK.q),window.RangersSiteHybridSDK=wt.instance),St}(); |
{ | ||
"name": "@apm-insight-web/rangers-site-sdk", | ||
"version": "0.2.22", | ||
"version": "0.2.23", | ||
"main": "cn/index.cjs.js", | ||
@@ -13,4 +13,4 @@ "module": "cn/index.esm.js", | ||
"@slardar/polyfill": "0.1.4", | ||
"@slardar/sdk": "3.6.14", | ||
"@slardar/sdk-core": "3.6.11", | ||
"@slardar/sdk": "3.6.15", | ||
"@slardar/sdk-core": "3.6.12", | ||
"@slardar/types": "3.5.8" | ||
@@ -22,3 +22,3 @@ }, | ||
}, | ||
"gitHead": "8e88fff562d88330175267c244542242bffd279c" | ||
"gitHead": "5bfdef2865d5880a665b726de5ee0383aea94f5e" | ||
} |
@@ -1,1 +0,1 @@ | ||
var RangersSiteSDK=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 r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};function e(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var p=function(){return(p=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function a(e,t){var r={};for(o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(r[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var n=0,o=Object.getOwnPropertySymbols(e);n<o.length;n++)t.indexOf(o[n])<0&&Object.prototype.propertyIsEnumerable.call(e,o[n])&&(r[o[n]]=e[o[n]]);return r}function v(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function h(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),a=[];try{for(;(void 0===t||0<t--)&&!(n=i.next()).done;)a.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a}function s(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(h(arguments[t]));return e}function u(e){return"object"==typeof e&&null!==e&&!c(e)}function r(e){return"[object Object]"===(e=e,Object.prototype.toString.call(e))}function f(e){return"function"==typeof e}function m(e){return"[object String]"===Object.prototype.toString.call(e)}function c(e){return"[object Array]"===Object.prototype.toString.call(e)}function l(e){return"number"==typeof e}function d(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function t(e,t){if(u(e))for(var r in e)d(e,r)&&t.call(null,r,e[r])}function i(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var r={},n=0;n<e.length;)r=function(e,t){var r,n=p({},e);for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&void 0!==t[r]&&(u(t[r])&&b(t[r])?n[r]=y(u(e[r])?e[r]:{},t[r]):c(t[r])?n[r]=t[r].slice():n[r]=t[r]);return n}(r,e[n]),n++;return r}function o(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var r={},n=0;n<e.length;)r=y(r,e[n]),n++;return r}var g=Object.getPrototypeOf?Object.getPrototypeOf({}):null;function b(e){return Object.getPrototypeOf?Object.getPrototypeOf(e)===g:e.constructor===Object}function y(e,t){var r,n=p({},e);for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&void 0!==t[r]&&(u(t[r])&&b(t[r])?n[r]=y(u(e[r])?e[r]:{},t[r]):c(e[r])||c(t[r])?n[r]=function t(e,r){var e=c(e)?e:[];var r=c(r)?r:[];return Array.prototype.concat.call(e,r).map(function(e){return!(e instanceof RegExp)&&(c(e)||u(e)&&b(e))?c(e)?t([],e):y({},e):e})}(e[r],t[r]):n[r]=t[r]);return n}function w(e,t){if(!c(e))return!1;if(0===e.length)return!1;for(var r=0;r<e.length;){if(e[r]===t)return!0;r++}return!1}function S(){if("fetch"in window)try{return new Headers,new Request(""),new Response,1}catch(e){return}}function M(){return!!u(window)}function _(){return M()&&!!u(window.performance)}function P(){return _()&&!!u(window.performance.timing)}function E(){return!!_()&&!!f(window.performance.getEntries)}function T(){return M()&&"function"==typeof window.MutationObserver}function k(){return M()&&"function"==typeof window.PerformanceObserver}function R(){return!!k()&&f(window.PerformanceLongTaskTiming)}function C(){if(!k())return!1;var e=window.PerformanceObserverEntryList;return f(e)&&f(e.prototype.getEntries)}function x(e){var r,e=function(e){if(!u(e))return{};var r={};return t(e,function(e,t){u(t)||c(t)?r[e]=JSON.stringify(t):r[e]=t}),r}(e),e=(r={},t(e,function(e,t){r[encodeURIComponent(e)]=encodeURIComponent(t)}),r),n=[];return t(e,function(e,t){n.push(e+"="+t)}),n.join("&")}function L(e){var t=document.createElement("a");t.href=e;e=t.pathname||"/";return"/"!==e[0]&&(e="/"+e),{href:t.href,protocol:t.protocol.slice(0,-1),hostname:t.hostname,host:t.host,search:t.search,pathname:e,hash:t.hash}}var O=function(e){if(!m(e))return!1;return f(e.toLowerCase)&&(e=e.toLowerCase()),w(["x-tt-token"],e)};function q(){}function j(e){var t="[object String]"===Object.prototype.toString.call(e);return e?t?e.length:ArrayBuffer&&e instanceof ArrayBuffer?e.byteLength:window.Blob&&e instanceof Blob?e.size:e.length||0:0}function H(e){if(!e)return"";if(!f(e.forEach))return"";var r=[];return e.forEach(function(e){var t;c(e)&&e[0]&&!O(e[0])&&(t=e[0],e=e[1]||"",r.push(t+": "+e))}),r.join("\r\n")}function A(e){var t={},r=L(e);return t.ax_protocol=r.protocol,t.ax_domain=r.hostname,t.ax_path=r.pathname,t.ax_url=(r.href||e).split("?")[0],t}function I(e,t){e=L(e),t=L(t);return e.protocol===t.protocol&&e.host===t.host}function D(e,t){var r,n;if(!e||!t)return"";var o=e.split(";"),i={};try{for(var a=v(o),s=a.next();!s.done;s=a.next()){var u=s.value.split("="),c=m(u[0])&&u[0].trim();c&&m(u[1])&&(i[c]=u[1].trim())}}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}return i[t]||""}function F(e){return c(e)&&e.length?function(e){for(var t=[],r=e.length,n=0;n<r;n++){var o=e[n];m(o)?t.push(o.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")):o&&o.source&&t.push(o.source)}return new RegExp(t.join("|"),"i")}(e):null}function B(t,r){f(t)&&(f(window.addEventListener)&&(window.addEventListener("unload",t),window.addEventListener("beforeunload",t),window.addEventListener("pagehide",t)),f(document.addEventListener)&&document.addEventListener("visibilitychange",function(e){f(r)?r(e):"hidden"===document.visibilityState&&t(e)}))}var N=function(e){var t,r;return void 0===e&&(e=window),M()&&null!==(t=e.screen)&&void 0!==t&&t.width&&null!==(r=e.screen)&&void 0!==r&&r.height?e.screen.width+"x"+e.screen.height:"0x0"},J=function(){var e="unknown",t=navigator.connection||navigator.mozConnection||navigator.webkitConnection;return t&&m(t.effectiveType)?t.effectiveType:e};function U(e){return!!e&&Math.random()<Number(e)}var X=(Q.post=function(e,t,r){var n=r&&r.success||q,o=r&&r.fail||q,r=new XMLHttpRequest;r.open("POST",e,!0),r.setRequestHeader("Content-Type","application/json"),r.send(JSON.stringify(t)),r.onload=function(){try{var e;this.responseText?(e=JSON.parse(this.responseText),n(e)):n({})}catch(e){o()}},r.onerror=function(){o()},r.onabort=function(){o()}},Q.get=function(e,t){var r=t&&t.success||q,n=t&&t.fail||q,o=t&&t.getResponse||q,i=t&&t.getResponseText||q,a=new XMLHttpRequest;t&&t.withCredentials&&(a.withCredentials=t.withCredentials),a.open("GET",e),a.send(),a.onload=function(){o(null==this?void 0:this.response),i(this.responseText);try{var e;this.responseText?(e=JSON.parse(this.responseText),r(e)):r({})}catch(e){n()}},a.onerror=function(){n()},a.onabort=function(){n()}},Q.prototype.getCommonParams=function(){return{timestamp:Date.now()}},Q);function Q(e){var t=this;this.postEvent=function(e){e=p(p({},e),t.getCommonParams());Q.post(t.url,e)},this.getEvent=function(e){e=x(p(p({},e),t.getCommonParams())),e=t.url+"?"+e;Q.get(e)},this.getURL=function(){return t.url},this.options=e,this.url=this.options.reportURL}function z(e,t,r){if(void 0===r&&(r="0"),1<r.length)throw new TypeError("expect the length of pad to be 1, but got "+e.length);return e.length>=t?e:""+Array.from({length:t-e.length}).fill(r).join("")+e}function V(e){return e?Math.floor(Math.random()*Math.pow(10,12)).toString(16).substr(0,e):""}var K="x-tt-trace-id",W="x-tt-trace-host",G="x-tt-logid";function $(e,t,r){void 0===r&&(r="01");t=""+z((Date.now()%4294967295).toString(16),8)+function(e){if("number"==typeof e)r=e;else{var t=e.replace(/-/g,"");if(!/^[0-9]+$/.test(t)){if(18<t.length)return"18"+V(18);e=22-t.length-4;return""+z(""+t.length,2)+t+V(e)}r=parseInt(t,10)}var r=22-(t=r.toString(16)).length-4;return""+z(""+t.length,2)+t+V(r)}(e)+("string"==typeof t?V(4):z(t.toString(16),4));return"00-"+t+"-"+t.substr(0,16)+"-"+r}function Y(){var e=function(){for(var e=new Array(16),t=0,r=0;r<16;r++)0==(3&r)&&(t=4294967296*Math.random()),e[r]=t>>>((3&r)<<3)&255;return e}();return e[6]=15&e[6]|64,e[8]=63&e[8]|128,function(e){for(var t=[],r=0;r<256;++r)t[r]=(r+256).toString(16).substr(1);var n=0;return[t[e[n++]],t[e[n++]],t[e[n++]],t[e[n++]],"-",t[e[n++]],t[e[n++]],"-",t[e[n++]],t[e[n++]],"-",t[e[n++]],t[e[n++]],"-",t[e[n++]],t[e[n++]],t[e[n++]],t[e[n++]],t[e[+n]],t[e[15]]].join("")}(e)}function Z(){return f(Date)?Math.round(Date.now()/1e3):0}var ee=.1,te=["/log/sentry/"],re=8e3,ne=4e3;Y(),Y();function oe(e,r){if(!u(e))return{};if(!f(r))return{};var n={};return t(e,function(e,t){r(t)&&(n[e]=t)}),n}function ie(e){var t,r,n,o,i=null;return u(e)&&("timer"===e.type&&(i=u(t=e.event)&&m(t.name)&&l(t.value)?{metrics_type:"timer",event_name:"default",metrics:((r={})[t.name]=t.value,r),category:oe(t.tags,m),timestamp:Z()}:{}),"counter"===e.type&&(i=u(o=e.event)&&m(o.name)&&l(o.value)?{metrics_type:"counter",event_name:"default",metrics:((n={})[o.name]=o.value,n),category:oe(o.tags,m),timestamp:Z()}:{}),"log"===e.type&&(i=u(n=e.event)&&m(n.value)?{metrics_type:"log",event_name:"default",log_content:n.value,log_level:null!==(o=n.level)&&void 0!==o?o:"info",category:oe(n.tags,m),timestamp:Z()}:{}),"custom"===e.type&&(i=u(e=e.event)&&m(e.event_name)?{metrics_type:"custom",event_name:e.event_name,metrics:oe(e.metrics,l),category:oe(e.tags,m),timestamp:Z()}:{})),i}var ae="AjaxMonitor",se=(ue.prototype.setup=function(e){void 0===e&&(e=q),f(XMLHttpRequest)&&(this.callback=e,this.start())},ue.prototype.updateConfig=function(e){this.props=o({},this.props,e)},ue.prototype.start=function(){this.hookXMLHttpRequestOpen(),this.hookXMLHttpRequestSend(),this.hookXMLHttpRequestSetRequestHeader()},ue.prototype.hookXMLHttpRequestSetRequestHeader=function(){var r=XMLHttpRequest.prototype.setRequestHeader||q;XMLHttpRequest.prototype.setRequestHeader=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this._requestHeaders=this._requestHeaders||[],this._requestHeaders.push(e),r.apply(this,e)}},ue.prototype.hookXMLHttpRequestOpen=function(){var o=XMLHttpRequest.prototype.open;XMLHttpRequest.prototype.open=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=e[0],n=e[1];return this._url=n||"",this._method=(null==r?void 0:r.toLowerCase())||"",o.apply(this,e)}},ue.prototype.hookXMLHttpRequestSend=function(){var o=this,i=XMLHttpRequest.prototype.send;XMLHttpRequest.prototype.send=function(){for(var e,t,r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];return o.checkAddTrace(this._url)&&(e=(t=null!==(e=null==o?void 0:o.props.commonParams)&&void 0!==e?e:{}).bid,t=t.web_id,e&&t&&(o.traceId=$(t,e),this.setRequestHeader(K,o.traceId))),o.hookXMLHttpRequestOnreadystatechange.call(this,o),this._start=Date.now(),this._data=null==r?void 0:r[0],i.apply(this,r)}},ue.prototype.checkAddTrace=function(e){var t=null!==(n=this.props.commonParams)&&void 0!==n?n:{},r=t.bid,n=t.web_id,t=(null!==(t=this.props.ajaxMonitorOptions)&&void 0!==t?t:{}).sampleHitTrace,e=I(location.href,e);return r&&n&&t&&e},ue.prototype.collectErrorRequest=function(){var e;return null!==(e=null===(e=this.props.ajaxMonitorOptions)||void 0===e?void 0:e.errorRequestCollect)&&void 0!==e&&e},ue.prototype.hookXMLHttpRequestOnreadystatechange=function(i){var a=this.onreadystatechange,s=this;this.onreadystatechange=function(){for(var e,t,r,n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];if(4===this.readyState&&(t={ev_type:"ajax",ax_status:(this.status||0).toString(),ax_type:s._method,ax_request_header:H(s._requestHeaders||[]),ax_domain:"",ax_duration:0,ax_path:"",ax_protocol:"",ax_response_header:"",ax_size:0,ax_url:""},"function"==typeof this.getAllResponseHeaders&&(t.ax_response_header=function(t){if(m(t)){var e=t.split("\r\n"),r=[];return e.forEach(function(e,t){e&&f(e.split)&&(e=e.split(": "),r.push([e[0],e[1]]))}),H(r)}return u(t)?H(Object.keys(t).map(function(e){return[e,t[e]]})):t}(this.getAllResponseHeaders())),!i.checkAddTrace(s._url)||(r=null!==(r=i.traceId)&&void 0!==r?r:this.getResponseHeader(K))&&(t.trace_id=r,t.trace_host=null!==(e=this.getResponseHeader(W))&&void 0!==e?e:void 0,t.log_id=null!==(e=this.getResponseHeader(G))&&void 0!==e?e:void 0),t.ax_duration=Date.now()-s._start,200===this.status&&(t.ax_size=function(e){var t=0;if(""===e.responseType||"text"===e.responseType)t=j(e.responseText);else if(e.response)t=j(e.response);else try{t=j(e.responseText)}catch(e){t=0}return t}(this)),t=p(p({},t),A(s._url)),i.collectErrorRequest()&&"2"!==t.ax_status[0]&&"3"!==t.ax_status[0]&&(t.ax_request={body:s._data?""+s._data:void 0,search:null===(e=L(s._url))||void 0===e?void 0:e.search,content_type:null===(e=null===(e=s._requestHeaders)||void 0===e?void 0:e.find(function(e){return"content-type"===e[0].toLowerCase()}))||void 0===e?void 0:e[1]}),f(i.callback)&&i.callback({name:i.name,type:"get",event:t})),a)return a.apply(this,n)}},ue.monitorName=ae,ue);function ue(e){this.name=ae,this.callback=q,this.traceId=null,this.props=e}function ce(e){return e instanceof Request}var le="FetchMonitor",pe=(he.prototype.updateConfig=function(e){this.props=o({},this.props,e)},he.prototype.setup=function(e){void 0===e&&(e=q),S()&&(this.callback=e,this.start())},he.prototype.start=function(){S()&&this.hookFetch()},he.prototype.checkAddTrace=function(e){var t=null!==(n=null===(r=this.props)||void 0===r?void 0:r.commonParams)&&void 0!==n?n:{},r=t.bid,n=t.web_id,t=(null!==(t=null===(t=null==this?void 0:this.props)||void 0===t?void 0:t.ajaxMonitorOptions)&&void 0!==t?t:{}).sampleHitTrace,e=I(location.href,e);return r&&n&&t&&e},he.prototype.updateAxRequest=function(e,t,r){var n,o;this.collectErrorRequest()&&"2"!==e.ax_status[0]&&"3"!==e.ax_status[0]&&(o=this.getFetchUrl(t,!0),e.ax_request={body:null===(t=this.getFetchBody(t,r))||void 0===t?void 0:t.toString(),search:!m(o)||null===(n=L(o))||void 0===n?void 0:n.search,content_type:null===(r=null==r?void 0:r.headers)||void 0===r?void 0:r["Content-Type"]})},he.prototype.collectErrorRequest=function(){var e;return null!==(e=null===(e=this.props.ajaxMonitorOptions)||void 0===e?void 0:e.errorRequestCollect)&&void 0!==e&&e},he.prototype.hookFetch=function(){var u=this,c=this,l=window.fetch;window.fetch=function(n,o){void 0===o&&(o={});var i=u.getFetchUrl(n);if(!function(e){if(m(e)){var t=h(e.split(":"),2),e=t[0];return!t[1]||("http"===e||"https"===e)}}(i))return l(n,o);var e=null!==(e=u.props.commonParams)&&void 0!==e?e:{},t=e.bid,r=e.web_id,a=Date.now(),s={ev_type:"ajax"};try{c.checkAddTrace(i)&&(o.headers=new Headers(function(e,t){var r=new Headers;ce(e)&&e.headers&&f(e.headers.forEach)&&e.headers.forEach(function(e,t){r.append(t,e)});t.headers&&new Headers(t.headers).forEach(function(e,t){r.append(t,e)});return r}(n,o)),t&&r&&(s.trace_id=$(t,r),o.headers.append(K,s.trace_id)))}catch(e){}return s.ax_type=u.getFetchMethod(n,o),s=p(p({},s),A(i)),l(n,o).then(function(e){var t,r;return s.ax_status=(e.status||0).toString(),s.ax_duration=Date.now()-a,s.ax_response_header=c.getAllHeaders(e.headers),s.ax_request_header=c.getAllHeaders(o.headers),e.headers&&f(e.headers.has)?(e.headers.has("content-length")?s.ax_size=Number(e.headers.get("content-length"))||0:s.ax_size=0,c.checkAddTrace(i)&&(e.headers.has(W)&&(s.trace_host=null!==(t=e.headers.get(W))&&void 0!==t?t:void 0),e.headers.has(K)&&(s.trace_id=null!==(r=e.headers.get(K))&&void 0!==r?r:void 0),e.headers.has(G)&&(s.log_id=null!==(r=e.headers.get(G))&&void 0!==r?r:void 0))):s.ax_size=0,u.updateAxRequest(s,n,o),f(c.callback)&&c.callback({name:c.name,type:"get",event:s}),e},function(e){return s.ax_status="0",s.ax_size=0,s.ax_duration=Date.now()-a,u.updateAxRequest(s,n,o),f(c.callback)&&c.callback({name:c.name,type:"get",event:s}),Promise.reject(e)})}},he.prototype.getFetchUrl=function(e,t){void 0===t&&(t=!1);var r="",r=ce(e)?e.url:e;return t||(r=m(r)?r.split("?")[0]:r),r},he.prototype.getFetchMethod=function(e,t){t=null!==(t=null==t?void 0:t.method)&&void 0!==t?t:"get";return ce(e)&&(t=null!==(e=e.method)&&void 0!==e?e:t),t.toLowerCase()},he.prototype.getFetchBody=function(e,t){return ce(e)?e.body:null==t?void 0:t.body},he.prototype.getAllHeaders=function(e){if(!e||"function"!=typeof e.forEach)return"";var r=[];return e.forEach(function(e,t){r.push([t,e])}),H(r)},he.monitorName=le,he);function he(e){this.name=le,this.callback=q,this.props=e}var fe="FMPMonitor",me=(de.prototype.setup=function(e){if(M())return T()?void(f(document.querySelector)&&(this.callback=e&&f(e)?e:function(){},this.startTime=Date.now(),this.list=[],f(this.observer.observe)&&this.observer.observe(document,{childList:!0,subtree:!0}))):null},de.prototype.count=function(){var e=Date.now()-this.startTime,t=document.querySelector("body");t?this.list.push({score:this.score(t,1,!1),time:e}):this.list.push({score:0,time:e})},de.prototype.score=function(e,t,r){var n,o=0,i=e.tagName;if("SCRIPT"!==i&&"STYLE"!==i&&"META"!==i&&"HEAD"!==i&&!w((null===(n=this.props)||void 0===n?void 0:n.ignoreTags)||[],i)){i=e.children?e.children.length:0;if(0<i)for(var a=e.children,s=i-1;0<=s;s--)o+=this.score(a[s],t+1,0<o);if(o<=0&&!r){if(!e.getBoundingClientRect||!f(e.getBoundingClientRect))return 0;e=e.getBoundingClientRect();if(!e)return 0;if(e.top>window.innerHeight)return 0;if(e.height<=0)return 0}o+=1+.5*t}return o},de.prototype.getFmpInternal=function(){if(!this.observer)return 0;if(this.disconnect(),!this.list.length)return 0;for(var e,t={time:this.list[0].time,rate:0},r=1;r<this.list.length;r++)this.list[r].time>=this.list[r-1].time&&(e=this.list[r].score-this.list[r-1].score,t.rate<e&&(t={time:this.list[r].time,rate:e}));return t.time},de.prototype.getTimeGap=function(){return P()?this.startTime-performance.timing.navigationStart:0},de.prototype.formatEvent=function(e){return{name:this.name,type:"post",event:{ev_type:"fmp",fmp:e}}},de.monitorName=fe,de);function de(e){var r=this;this.name=fe,this.callback=q,this.disconnect=function(){var e,t;null!==(t=null===(e=r.observer)||void 0===e?void 0:e.disconnect)&&void 0!==t&&t.call(e)},this.getLoadFmp=function(){var e=r.getFmpInternal(),e=e?r.getTimeGap()+e:0,e=r.formatEvent(e);return r.callback(e),e},this.getFmp=function(){var e=r.getFmpInternal(),e=r.formatEvent(e);return r.callback(e),e},this.props=e,this.startTime=Date.now(),this.list=[],this.observer=new MutationObserver(this.count.bind(this))}function ve(){}var ge=!1,be=!1,ye={uniqueId:0,originals:{},proxies:{},patchXMLHTTPRequest:function(i){this.originals.send=XMLHttpRequest.prototype.send,XMLHttpRequest.prototype.send=function(){for(var t=this,e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];var n=ye.uniqueId++;i.beforeCb(n);var o=this.onreadystatechange;return this.onreadystatechange=function(e){null!=o&&o.call(t,e),4===t.readyState&&i.afterCb(n)},ye.originals.send.apply(this,e)},this.proxies.send=XMLHttpRequest.prototype.send},patchFetch:function(o){var i;S()&&(i=window.fetch,this.originals.fetch=i,window.fetch=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return new Promise(function(t,r){var n=ye.uniqueId++;o.beforeCb(n),i.apply(void 0,s(e)).then(function(e){o.afterCb(n),t(e)},function(e){o.afterCb(n,e),r(e)})})},this.proxies.fetch=window.fetch)},observeResourceFetchingMutations:function(a){if(T()){var s=["img","script","iframe","link","audio","video","source"],e=new MutationObserver(function(e){var t,r;try{for(var n=v(e),o=n.next();!o.done;o=n.next()){var i=o.value;("childList"===i.type&&function e(t,r){var n,o;try{for(var i=v(t),a=i.next();!a.done;a=i.next()){var s=a.value;if(r.includes(s.nodeName.toLowerCase())||s.children&&e(s.children,r))return 1}}catch(e){n={error:e}}finally{try{a&&!a.done&&(o=i.return)&&o.call(i)}finally{if(n)throw n.error}}}(i.addedNodes,s)||"attributes"===i.type&&s.includes(i.target.nodeName.toLowerCase()))&&a(i)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}});return e.observe(document,{attributes:!0,childList:!0,subtree:!0,attributeFilter:["href","src"]}),e}},resetOriginals:function(){this.originals.send&&XMLHttpRequest.prototype.send===this.proxies.send&&(ge=!1,XMLHttpRequest.prototype.send=this.originals.send),this.originals.fetch&&fetch===this.proxies.fetch&&(be=!1,window.fetch=this.originals.fetch)}},we="TTIMonitor",Se=(Me.prototype.setup=function(){},Me.prototype.isEnable=function(){return R()&&!!k()&&f(window.PerformanceResourceTiming)&&C()},Me.prototype.registerPerformanceObserver=function(){var s=this;this.performanceObserver=new PerformanceObserver(function(e){var t,r,n=e.getEntries();try{for(var o=v(n),i=o.next();!i.done;i=o.next()){var a=i.value;"resource"===a.entryType&&s.networkRequestFinishedCallback(a),"longtask"===a.entryType&&s.longTaskFinishedCallback(a)}}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}});try{this.performanceObserver.observe({type:"longtask"}),this.performanceObserver.observe({type:"resource",buffered:!0})}catch(e){this.performanceObserver.observe({entryTypes:["longtask","resource"]})}},Me.prototype.unregisterListeners=function(){this.performanceObserver&&this.performanceObserver.disconnect(),this.mutationObserver&&this.mutationObserver.disconnect(),ye.resetOriginals(),this.proxyConfig&&(this.proxyConfig.beforeCb=ve,this.proxyConfig.afterCb=ve)},Me.prototype.rescheduleTimer=function(e){var t=this;this.scheduleTimerTasks&&(this.timerActivationTime>e||(clearTimeout(this.timerId),this.timerId=window.setTimeout(function(){t.checkTTI()},e-performance.now()),this.timerActivationTime=e))},Me.prototype.startSchedulingTimerTasks=function(){this.scheduleTimerTasks=!0;var e=0<this.longTasks.length?this.longTasks[this.longTasks.length-1].end:0,t=this.computeLastKnownNetwork2Busy(this.incompleteRequestStarts,this.networkRequests);this.rescheduleTimer(Math.max(t+5e3,e))},Me.prototype.registerListeners=function(){ge||(ye.patchXMLHTTPRequest(this.proxyConfig),ge=!0),be||(ye.patchFetch(this.proxyConfig),be=!0),this.registerPerformanceObserver(),this.useMutationObserver&&(this.mutationObserver=ye.observeResourceFetchingMutations(this.mutationObserverCallback.bind(this)))},Me.prototype.mutationObserverCallback=function(e){this.rescheduleTimer(performance.now()+5e3)},Me.prototype.beforeJSInitiatedRequestCallback=function(e){this.incompleteJSInitiatedRequestStartTimes[e]=performance.now()},Me.prototype.afterJSInitiatedRequestCallback=function(e){this.incompleteJSInitiatedRequestStartTimes[e]=void 0},Me.prototype.networkRequestFinishedCallback=function(e){this.networkRequests.push({start:e.fetchStart,end:e.responseEnd}),this.rescheduleTimer(this.computeLastKnownNetwork2Busy(this.incompleteRequestStarts,this.networkRequests)+5e3)},Object.defineProperty(Me.prototype,"incompleteRequestStarts",{get:function(){for(var e=Object.keys(this.incompleteJSInitiatedRequestStartTimes),t=[],r=0;r<e.length;r++){var n=this.incompleteJSInitiatedRequestStartTimes[e[r]];"number"==typeof n&&t.push(n)}return t},enumerable:!1,configurable:!0}),Me.prototype.longTaskFinishedCallback=function(e){var t=e.startTime+e.duration;this.longTasks.push({start:e.startTime,end:t}),this.rescheduleTimer(t+5e3)},Me.prototype.checkTTI=function(){var e=this.computeLastKnownNetwork2Busy(this.incompleteRequestStarts,this.networkRequests),t=this.getFirstPaintTime()||performance.timing.domContentLoadedEventEnd-performance.timing.navigationStart,r=this.getMinValue(),n=performance.now();null===r&&this.rescheduleTimer(Math.max(e+5e3,n+1e3));n=this.computeTTI(t,r,e,n,this.longTasks);n?(this.callback&&"function"==typeof this.callback&&this.callback(Math.round(n)),this.disable()):this.rescheduleTimer(performance.now()+1e3)},Me.prototype.getMinValue=function(){if(this.minValue)return this.minValue;if(performance.timing.domContentLoadedEventEnd){var e=performance.timing;return e.domContentLoadedEventEnd-e.navigationStart}return null},Me.prototype.getFirstPaintTime=function(){if("PerformancePaintTiming"in window){var e=performance.getEntriesByType("paint")[0];return e?e.startTime:0}return 0},Me.prototype.disable=function(){clearTimeout(this.timerId),this.scheduleTimerTasks=!1,this.unregisterListeners(),this.snippetObserver&&this.snippetObserver.disconnect(),this.snippetEntries&&this.snippetEntries.splice(0,this.snippetEntries.length)},Me.prototype.computeLastKnownNetwork2Busy=function(e,t){var r,n,o,i;if(2<e.length)return performance.now();var a=[];try{for(var s=v(t),u=s.next();!u.done;u=s.next()){var c=u.value;a.push({timestamp:c.start,type:"requestStart"}),a.push({timestamp:c.end,type:"requestEnd"})}}catch(e){r={error:e}}finally{try{u&&!u.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}try{for(var l=v(e),p=l.next();!p.done;p=l.next()){var h=p.value;a.push({timestamp:h,type:"requestStart"})}}catch(e){o={error:e}}finally{try{p&&!p.done&&(i=l.return)&&i.call(l)}finally{if(o)throw o.error}}a.sort(function(e,t){return e.timestamp-t.timestamp});for(var f=e.length,m=a.length-1;0<=m;m--){var d=a[m];switch(d.type){case"requestStart":f--;break;case"requestEnd":if(2<++f)return d.timestamp;break;default:throw Error("Internal Error: This should never happen")}}return 0},Me.monitorName=we,Me);function Me(e){var t,r,n,o=this;if(this.name=we,this.longTasks=[],this.callback=ve,this.useMutationObserver=!0,this.minValue=null,this.isAsync=0,this.networkRequests=[],this.incompleteJSInitiatedRequestStartTimes={},this.timerActivationTime=-1/0,this.scheduleTimerTasks=!1,this.proxyConfig={beforeCb:this.beforeJSInitiatedRequestCallback.bind(this),afterCb:this.afterJSInitiatedRequestCallback.bind(this)},this.getTTI=function(e){o.callback=e,o.isEnable()?o.startSchedulingTimerTasks():o.callback&&"function"==typeof o.callback&&o.callback()},this.computeTTI=function(e,t,r,n,o){if(n-r<5e3)return null;o=0===o.length?e:o[o.length-1].end;return n-o<5e3?null:Math.max(o,t)},this.isEnable()){if(this.useMutationObserver=!!e.useMutationObserver,this.minValue=null!==(n=e.minValue)&&void 0!==n?n:null,this.isAsync=null!==(n=e.isAsync)&&void 0!==n?n:0,this.snippetEntries=null===(n=null==e?void 0:e.preLongTaskObserver)||void 0===n?void 0:n.precollect,this.snippetObserver=null===(e=null==e?void 0:e.preLongTaskObserver)||void 0===e?void 0:e.observer,!this.isAsync&&this.snippetEntries&&0<this.snippetEntries.length)try{for(var i=v(this.snippetEntries),a=i.next();!a.done;a=i.next()){var s=a.value;"longtask"===s.entryType?this.longTasks.push({start:s.startTime,end:s.startTime+s.duration}):"resource"===s.entryType&&this.networkRequests.push({start:s.fetchStart,end:s.responseEnd})}}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}this.registerListeners()}}function _e(e){try{for(var t,r=e,n=[],o=0,i=0,a=" > ".length;r&&o++<5&&!("html"===(t=function(e){var t,r,n,o,i=e,a=[];if(!i||!i.tagName)return"";a.push(i.tagName.toLowerCase()),i.id&&a.push("#"+i.id);e=i.className;if(e&&m(e))for(t=e.split(/\s+/),o=0;o<t.length;o++)a.push("."+t[o]);var s=["type","name","title","alt"];for(o=0;o<s.length;o++)r=s[o],(n=i.getAttribute(r))&&a.push("["+r+'="'+n+'"]');return a.join("")}(r))||1<o&&80<=i+n.length*a+t.length);)n.push(t),i+=t.length,r=r.parentNode;return n.reverse().join(" > ")}catch(e){return"<unknown>"}}var Pe="FIDMonitor",Ee=(Te.prototype.setup=function(e){var s=this;if(k()&&PerformanceObserver.supportedEntryTypes&&PerformanceObserver.supportedEntryTypes.includes("first-input")&&C()){this.callback=e,this.observer=new PerformanceObserver(function(e,t){var r,n;try{for(var o=v(e.getEntries()),i=o.next();!i.done;i=o.next()){var a=i.value,a=a.processingStart-a.startTime;s.callback({name:s.name,fid:Math.round(a)})}}catch(e){r={error:e}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}t.disconnect()});try{this.observer.observe({type:"first-input",buffered:!0})}catch(e){this.observer.observe({entryTypes:["first-input"]})}}},Te.monitorName=Pe,Te);function Te(){this.name=Pe,this.callback=q}var ke="MPFIDMonitor",Re=(Ce.prototype.setup=function(){var t,e,r,a=this;if(R()&&C()){if(!this.props.isAsync){var n=null!==(r=null===(r=this.props.preLongTaskObserver)||void 0===r?void 0:r.precollect)&&void 0!==r?r:[];if(n&&0<n.length)try{for(var o=v(n),i=o.next();!i.done;i=o.next()){var s=i.value;"longtask"===s.entryType&&this.list.push(s)}}catch(e){t={error:e}}finally{try{i&&!i.done&&(e=o.return)&&e.call(o)}finally{if(t)throw t.error}}}this.observer=new PerformanceObserver(function(e){var t,r;try{for(var n=v(e.getEntries()),o=n.next();!o.done;o=n.next()){var i=o.value;a.list.push(i)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}}),this.observer.observe({entryTypes:["longtask"]})}},Ce.prototype.getMPFID=function(){var t,e;if(R()&&C()){this.observer&&this.observer.disconnect();var r=0;try{for(var n=v(this.list),o=n.next();!o.done;o=n.next()){var i=o.value;r<i.duration&&(r=i.duration)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(t)throw t.error}}return this.formatEvent(Math.round(r))}},Ce.prototype.formatEvent=function(e){return{name:this.name,mpfid:e}},Ce.monitorName=ke,Ce);function Ce(e){this.name=ke,this.list=[],this.props=e}var xe=["xmlhttprequest","fetch"],Le="ResourcePerformanceMonitor",Oe=(qe.prototype.setup=function(e){this.isEnable()&&(this.callback=null!=e?e:q,this.isAsync&&window.performance.clearResourceTimings(),this.observe&&(this.sendResourcePerformance(performance.getEntriesByType("resource")),this.observePerformance()))},qe.prototype.isEnable=function(){return E()&&"function"==typeof performance.clearResourceTimings},qe.prototype.getPerformance=function(){return this.isEnable()?this.buildParams(this.getResources()):this.buildParams([])},qe.prototype.buildParams=function(e){var t=this,r=[];if(e.forEach(function(e){w(xe,e.initiatorType)||f(t.checkIgnore)&&t.checkIgnore(e)||r.push(e)}),r.length)return{name:this.name,type:"post",event:{ev_type:"resource_performance",resources:r}}},qe.prototype.sendResourcePerformance=function(e){e=this.buildParams(e);e&&this.callback(e)},qe.prototype.getResources=function(){return window.performance.getEntriesByType("resource")},qe.prototype.observePerformance=function(){var t=this;k()&&new PerformanceObserver(function(e){e=e.getEntries();e.length&&t.sendResourcePerformance(e)}).observe({entryTypes:["resource"]})},qe.monitorName=Le,qe);function qe(e){var t,r=this;this.name=Le,this.callback=q,this.getResourcePerformance=function(){var e;return null!==(e=r.getPerformance())&&void 0!==e?e:{}},this.isAsync=null!==(t=null==e?void 0:e.isAsync)&&void 0!==t?t:0,this.observe=null!==(t=null==e?void 0:e.observe)&&void 0!==t&&t,this.checkIgnore=null!==(e=null==e?void 0:e.checkIgnore)&&void 0!==e?e:function(){return!1}}var je={ev_type:"perf",isAsync:0,dns:0,tcp:0,request:0,response:0,processing:0,blank:0,domready:0,load:0,has_resource:0,domparse:0,resource:0,ttfb:0,redirect:0,tti:0,upload_reason:"sample",network_type:"",timing:{},navigation_timing:{},navigation:{},resources:[]},He="PerformanceMonitor",Ae=(Ie.prototype.setup=function(e){var t,r=this;P()&&(this.callback=e,t=function(){r.hasLoaded=!0,r.performanceAuto&&(r.perfTimer=setTimeout(function(){r.perfLog()},200))},"complete"!==document.readyState?window.addEventListener("load",function(){setTimeout(function(){t()},0)},!1):t(),this.sendParams=p({},je),this.staticPerformanceMonitor=new Oe,this.staticPerformanceMonitor.setup(),(new Ee).setup(this.hasFID),this.mpfidMonitor=new Re({isAsync:0,preLongTaskObserver:this.props.preLongTaskObserver}),this.mpfidMonitor.setup(),e=null!==(e=this.props.TTIMonitor)&&void 0!==e?e:Se,this.ttiMonitor=new e({isAsync:0,preLongTaskObserver:this.props.preLongTaskObserver}),this.ttiMonitor.setup(),e=this.syncPerfLog.bind(this),B(e))},Ie.prototype.performanceNow=function(){var e;return null!==performance&&void 0!==performance&&performance.now?performance.now():(Date.now?Date.now():+new Date)-(null!==(e=null===(e=performance.timing)||void 0===e?void 0:e.navigationStart)&&void 0!==e?e:0)},Ie.prototype.getBounced=function(){return!this.hasLoaded},Ie.prototype.getPaintTime=function(t){if(E()){var e=performance.getEntriesByType("paint");if(c(e)){e=e.filter(function(e){return e.name===t});return e.length&&e[0]&&u(e[0])&&e[0].startTime||0}}return 0},Ie.monitorName=He,Ie);function Ie(e){var o=this;this.name=He,this.callback=q,this.sendParams=p({},je),this.finalSendParams=this.sendParams,this.hasLoaded=!1,this.initStart=0,this.hasSentInitPerf=!1,this.initFlag=!0,this.performanceAuto=!0,this.send=function(){o.initFlag&&o.hasLoaded&&(o.sendParams.isAsync&&(o.sendParams.load=Math.round(o.performanceNow()-o.initStart)),setTimeout(function(){o.perfLog()},200))},this.initAsync=function(){var e,t;o.hasSentInitPerf&&(o.sendParams=p({},je),o.sendParams.isAsync=1,o.initFlag=!0,o.initStart=o.performanceNow(),o.staticPerformanceMonitor=new Oe({isAsync:1}),o.staticPerformanceMonitor.setup(),o.mpfidMonitor=new Re({isAsync:1,preLongTaskObserver:o.props.preLongTaskObserver}),o.mpfidMonitor.setup(),t=null!==(e=o.props.TTIMonitor)&&void 0!==e?e:Se,o.ttiMonitor=new t({minValue:Math.round(o.performanceNow()),isAsync:1,preLongTaskObserver:o.props.preLongTaskObserver}),o.ttiMonitor.setup(),null!==(t=null===(e=o.fmpMonitor)||void 0===e?void 0:e.setup)&&void 0!==t&&t.call(e,q))},this.stopAutoPerf=function(){o.performanceAuto=!1,clearTimeout(o.perfTimer)},this.getPerformance=function(){return o.finalSendParams.tti||("complete"===document.readyState?o.perfLog():o.perfLog(!0)),o.buildParams(o.finalSendParams)},this.buildParams=function(e){return{name:o.name,type:"post",event:e}},this.perfLog=function(e){if(void 0===e&&(e=!1),P()){if(o.initFlag=!1,o.finalSendParams=p({},o.sendParams),!o.sendParams.isAsync){var t=o.getBounced();if(t)return o.finalSendParams.bounced=t,void o.invokeCallback(0,o.buildParams(o.finalSendParams));o.finalSendParams=p(p({},o.finalSendParams),o.getParams())}var r=o.getStaticResources(),n=o.getFMP(),t=o.getMPFID();r&&(o.finalSendParams.resources=r,o.finalSendParams.has_resource=1),n&&(o.finalSendParams.fmp=Math.round(n)),n&&o.finalSendParams.fcp&&o.finalSendParams.fmp<o.finalSendParams.fcp&&(o.finalSendParams.fmp=o.finalSendParams.fcp),t&&(o.finalSendParams.mpfid=t),f(o.callback)&&(!e&&o.ttiMonitor&&f(o.ttiMonitor.getTTI)?o.ttiMonitor.getTTI(function(e){e&&0<e&&(o.finalSendParams.tti=o.finalSendParams.isAsync?Math.round(e-o.initStart):e),o.invokeCallback(o.finalSendParams.isAsync,o.buildParams(o.finalSendParams))}):o.invokeCallback(o.finalSendParams.isAsync,o.buildParams(o.finalSendParams)))}},this.invokeCallback=function(e,t){if(!e){if(o.hasSentInitPerf)return;o.hasSentInitPerf=!0}o.callback(t)},this.getStaticResources=function(){var e;if(o.staticPerformanceMonitor&&f(o.staticPerformanceMonitor.getResourcePerformance)){var t=o.staticPerformanceMonitor.getResourcePerformance();if(null!==(e=null==t?void 0:t.event)&&void 0!==e&&e.resources)return t.event.resources||[]}},this.getFMP=function(){var e,t;return o.fmpMonitor?(o.fmpMonitor.disconnect(),o.sendParams.isAsync?(null===(e=null==(t=o.fmpMonitor.getFmp())?void 0:t.event)||void 0===e?void 0:e.fmp)||0:f(o.fmpMonitor.getLoadFmp)?1!==o.props.renderType?2===o.props.renderType?o.getPaintTime("first-contentful-paint"):0:null!==(t=null===(t=(t=o.fmpMonitor.getLoadFmp()||{}).event)||void 0===t?void 0:t.fmp)&&void 0!==t?t:0:0):0},this.getMPFID=function(){if(o.mpfidMonitor&&f(o.mpfidMonitor.getMPFID)){var e=o.mpfidMonitor.getMPFID();if(e)return e.mpfid}},this.syncPerfLog=function(){var e,t;o.hasSentInitPerf||(o.perfLog(!0),null!==(t=(e=o.props).report)&&void 0!==t&&t.call(e))},this.hasFID=function(e){o.sendParams.fid=e.fid},this.getParams=function(){if(P()){var e={},t=window.performance.timing;e.dns=t.domainLookupEnd-t.domainLookupStart,e.tcp=t.connectEnd-t.connectStart,e.request=t.responseStart-t.requestStart,e.response=t.responseEnd-t.responseStart,e.processing=t.domComplete-t.domLoading,e.blank=t.responseEnd-t.navigationStart,e.domready=t.domInteractive-t.navigationStart,e.load=t.loadEventEnd-t.navigationStart,t.secureConnectionStart&&(e.ssl=t.connectEnd-t.secureConnectionStart),e.domparse=t.domInteractive-t.responseEnd,e.resource=t.loadEventStart-t.domContentLoadedEventEnd,e.ttfb=t.responseStart-t.requestStart,e.redirect=t.redirectEnd-t.redirectStart;var r=o.getPaintTime("first-paint"),t=o.getPaintTime("first-contentful-paint");r&&(e.fp=Math.round(r)),t&&(e.fcp=Math.round(t));r=function(){if(!E())return null;var e=window.performance.getEntriesByType("navigation");return c(e)&&0!==e.length?e[0]:null}(),t=P()?window.performance.timing:null;return(r||t)&&(e.navigation=null!=r?r:t),t&&(e.timing=t),r&&(e.navigation_timing=r),e}},e.fmpMonitor&&(this.fmpMonitor=e.fmpMonitor);var t=e.performanceAuto;this.performanceAuto=void 0===t||t,this.props=null!=e?e:{}}var De="StaticErrorMonitor",Fe=(Be.prototype.setup=function(e){M()&&(this.callback=e,window.addEventListener("error",this.staticErrorLog.bind(this),!0))},Be.prototype.getSrc=function(e){return"link"===e.tagName.toLowerCase()?Ne(e,"href"):Ne(e,"src")},Be.prototype.getParams=function(e,t){var r={ev_type:"static",st_type:t},t=L(e);r.st_src=e,r.st_protocol=t.protocol,r.st_domain=t.hostname,r.st_path=t.pathname;t=function(e){var t,r=null===(t=null===(n=window.performance)||void 0===n?void 0:n.getEntriesByType)||void 0===t?void 0:t.call(n,"resource"),n=null==r?void 0:r.length;if(!n)return;for(var o=n-1;-1<o;o--){var i=r[o];if(i.name===e)return i}}(t.href);return t&&(r.timing=t),r},Be.monitorName=De,Be);function Be(){var i=this;this.name=De,this.callback=q,this.buildEvent=function(e){var t,r,n=e||window.event||{};try{r=null!==(t=null!==(t=n.target)&&void 0!==t?t:n.srcElement)&&void 0!==t?t:{}}catch(n){return}var o=r.tagName;if(o&&m(o)){o=o.toLowerCase();e=i.getSrc(r);if(e&&e!==window.location.href)return{name:i.name,type:"get",event:i.getParams(e,o)}}},this.staticErrorLog=function(e){e=i.buildEvent(e);e&&i.callback(e)}}function Ne(e,t){var r;return e.getAttribute&&f(e.getAttribute)?null!==(r=e.getAttribute(t))&&void 0!==r?r:"":null!==(t=e[t])&&void 0!==t?t:""}var Je="EmitMonitor",Ue=(Xe.prototype.setup=function(e){this.callback=e||q},Xe.prototype.buildCustomTimeLog=function(e,t,r){return function(e){var t=e.name,r=e.tag,e=e.value;if(t&&e){e={ev_type:"custom",cm_name:t=f(t.toString)?t.toString():"",cm_type:"time",cm_value:e=+e};return r&&(r=f(r.toString)?r.toString():"",e.cm_tag=r),{name:"SentCustomTime",type:"get",event:e}}}({name:e,tag:t,value:r})},Xe.prototype.buildCustomCountLog=function(e,t){return function(e){var t=e.name,e=e.tag;if(t){t={ev_type:"custom",cm_name:t=f(t.toString)?t.toString():"",cm_type:"count"};return e&&(e=f(e.toString)?e.toString():"",t.cm_tag=e),{name:"SentCustomCount",type:"get",event:t}}}({name:e,tag:t})},Xe.prototype.buildEmitSingleEvent=function(e){e=ie(e);if(e&&(!e||e.event_name))return{name:this.name,type:"post",event:{ev_type:"flexible",flexible_data_list:[e]}}},Xe.monitorName=Je,Xe);function Xe(){var o=this;this.name=Je,this.callback=q,this.handOut=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=o.buildEvent.apply(o,s(e));o.callback(r)},this.buildEvent=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if("sendCustomCountLog"===e[0])return o.buildCustomCountLog(e[1],e[2]);if("sendCustomTimeLog"===e[0])return o.buildCustomTimeLog(e[1],e[2],e[3]);if("send"===e[0]){if("count"===e[1])return o.buildCustomCountLog(e[2].category,e[2].action);if("timing"===e[1])return o.buildCustomTimeLog(e[2].category,e[2].action,e[2].value)}if("emit"===e[0]&&e[1]&&e[2]){var r={type:e[1],event:e[2]};return o.buildEmitSingleEvent(r)}},this.send=function(e,t,r){var n=r.action,r=r.value;"count"===e&&o.sendCustomCountLog(t,n),"timing"===e&&o.sendCustomTimeLog(t,n,r)},this.sendCustomTimeLog=function(e,t,r){r=o.buildCustomTimeLog(e,t,r);o.callback(r)},this.sendCustomCountLog=function(e,t){t=o.buildCustomCountLog(e,t);return o.callback(t),t},this.emitEvent=function(e){e=o.buildEmitSingleEvent(e);o.callback(e)}}var Qe="BreadcrumbMonitor",ze=(Ve.prototype.setup=function(){this.instrumentDOM()},Ve.prototype.instrumentDOM=function(){var e;"document"in window&&(e=this,window.document.addEventListener("click",e.domEventHandler("click",e.triggerHandlers.bind(e,"dom")),!1),window.document.addEventListener("keypress",e.keypressEventHandler(e.triggerHandlers.bind(e,"dom")),!1))},Ve.prototype.domEventHandler=function(t,r,n){var o=this;return void 0===n&&(n=!1),function(e){o.keypressTimeout=void 0,e&&o.lastCapturedEvent!==e&&(o.lastCapturedEvent=e,o.debounceTimer&&clearTimeout(o.debounceTimer),n?o.debounceTimer=setTimeout(function(){r({event:e,name:t})}):r({event:e,name:t}))}},Ve.prototype.triggerHandlers=function(e,t){if(e)try{this.domBreadcrumb(t)}catch(e){}},Ve.prototype.keypressEventHandler=function(n){var o=this;return function(e){var t;try{t=e.target}catch(e){return}var r=t&&t.tagName;r&&("INPUT"===r||"TEXTAREA"===r||t.isContentEditable)&&(o.keypressTimeout||o.domEventHandler("input",n)(e),clearTimeout(o.keypressTimeout),o.keypressTimeout=window.setTimeout(function(){o.keypressTimeout=void 0},o.debounceDuration))}},Ve.prototype.domBreadcrumb=function(e){var t;try{t=e.event.target?_e(e.event.target):_e(e.event)}catch(e){t="<unknown>"}0!==t.length&&this.addBreadcrumb({category:"ui."+e.name,message:t})},Ve.monitorName=Qe,Ve);function Ve(e){var n=this;this.name=Qe,this.breadcrumbs=[],this.getBreadcrumbs=function(){return n.breadcrumbs},this.addBreadcrumb=function(e){var t=p(p({},e),{timestamp:(new Date).getTime()}),r=n.maxBreadcrumbs,e=n.breadcrumbs;return n.breadcrumbs=0<=r?s(e,[t]).slice(-r):s(e,[t]),n},this.debounceDuration=1e3,this.debounceTimer=0,this.breadcrumbs=[],this.maxBreadcrumbs=null!==(e=null==e?void 0:e.maxBreadcrumbs)&&void 0!==e?e:20}var Ke={enableCatchGlobalJSError:!0},We="JSExceptionMonitor",Ge=($e.prototype.setup=function(e){M()&&(this.callback=e,this.options.enableCatchGlobalJSError&&(window.addEventListener("error",this.jsErrorLog),window.addEventListener("unhandledrejection",this.jsPromiseRejectionLog)))},$e.prototype.buildEvent=function(e){if(!function(e){switch(Object.prototype.toString.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":return 1;default:return e instanceof Error}}(e)?(r(e)&&(t={message:JSON.stringify(e)}),m(e)&&(t={message:e})):t=e,t){var t={ev_type:"js_exception",exception:this.normalizeError(t),breadcrumbs:null!==(t=null===(t=this.options.breadcrumbMonitor)||void 0===t?void 0:t.getBreadcrumbs())&&void 0!==t?t:[]};return{name:this.name,type:"post",event:t}}},$e.prototype.logError=function(e){e=this.buildEvent(e);e&&this.callback(e)},$e.prototype.getJSError=function(e){e=e.error;if(e)return e},$e.prototype.getJSPromiseRejection=function(e){var t=void 0;try{"reason"in e?t=e.reason:"detail"in e&&"reason"in e.detail&&(t=e.detail.reason)}catch(e){}if(t)return t},$e.prototype.normalizeError=function(e){return{message:e.message,name:e.name,fileName:e.fileName,lineNumber:e.lineNumber,columnNumber:e.columnNumber,stack:e.stack,stacktrace:e.stacktrace,framesToPop:e.framesToPop}},$e.monitorName=We,$e);function $e(e){var t=this;this.name=We,this.callback=q,this.jsErrorLog=function(e){e=t.getJSError(e);e&&t.logError(e)},this.jsPromiseRejectionLog=function(e){e=t.getJSPromiseRejection(e);e&&t.logError(e)},this.options=p(p({},Ke),e)}var Ye=(Ze.prototype.sendEvent=function(e){e=this.getEventToBeSent(e);e&&this.idleSendEvent(e)},Ze.prototype.getEventToBeSent=function(e){e=this._modifyEvent(e);if(this._shouldSend(e))return e},Ze.prototype._modifyEvent=function(e){return e},Ze.prototype._shouldSend=function(e){return!0},Ze.prototype._send=function(e){},Ze.prototype.idleSendEvent=function(e){this._send(e)},Ze);function Ze(){}var et,tt=(e(rt,et=Ye),Object.defineProperty(rt.prototype,"ready",{get:function(){return this.isReady},set:function(e){this.isReady=e,this.isReady&&this._uploadQueue()},enumerable:!1,configurable:!0}),rt.prototype._send=function(e){var t=this,e=this.buildParams(e);null!=e&&(this.reportQueue.push(e),this.isReady&&(this.reportQueue.length>=this.batchReportLength&&this._uploadQueue(),this.batchReportTimeout&&clearTimeout(this.batchReportTimeout),this.batchReportTimeout=setTimeout(function(){t._uploadQueue()},this.batchReportWait)))},rt.prototype._uploadQueue=function(){var e;this.reportQueue.length&&this.ready&&(e={ev_type:"batch",list:this.reportQueue},this.reportQueue=[],this._request({event:e,type:"post"}))},rt.prototype._request=function(e){},rt);function rt(e){var t,r=et.call(this)||this;return r.reportQueue=[],r.isReady=!0,r.batchReportLength=null!==(t=e.maxBatchReportLength)&&void 0!==t?t:10,r.batchReportWait=null!==(e=e.batchReportWait)&&void 0!==e?e:1e3,r.batchReportTimeout=null,r}var nt="RANGERS_WEB_ID";function ot(){var e={flags:{hookPath:!0,hookXHR:!0,hookFetch:!0,enableSizeStats:!0,enableFMP:!0,enablePerformance:!0,enableResourcePerformance:!0,enableStaticError:!0,enableCatchJSError:!0,enableCatchGlobalJSError:!0,enableCatchJSErrorV2:!1,enableCrash:!0,enableMemoryRecord:!0,enableFPSJankTimesMonitor:!0,enableBreadcrumb:!0,hookConsole:!1,hookDom:!0}};return e.monitors={BaseMonitor:{appTypeSetting:{type:0,SPA:"",renderType:0},sampleHit:U(1)},JSErrorMonitor:{enable:!0,webIDHit:!0,sampleRate:1,webIDHitBehavior:!1,sampleHitBehavior:!1,ignoreErrors:[],whitelistUrls:[],blacklistUrls:[],download_link:""},AjaxMonitor:{enable:!0,enableError:!1,webIDHit:!0,sampleHit:U(1),sampleRate:1,sampleHitTrace:!1,ignore:te,abort:!1,whitelistUrls:[],statusCodeSample:{},requestUrlSample:[],errorRequestCollect:!1},PerformanceMonitor:{enable:!0,webIDHit:!0,sampleRate:1,webIDHitStaticResource:!1,sampleHitStaticResource:U(ee),slowSessionTime:re,spaSlowSessionTime:ne,geckoUrls:[],interval:0,checkPoint:[]},StaticErrorMonitor:{enable:!0,webIDHit:!0,sampleRate:1,ignore:te},ResourcePerformanceMonitor:{enable:!0,webIDHit:!0,sampleRate:1},BreadcrumbMonitor:{enable:!0},EmitMonitor:{enable:!0}},e.custom={},e.commonParams={aid:0,pid:"",version:"0.2.22",hostname:window.location.hostname,protocol:window.location.protocol.slice(0,-1),rangers_web_id:ct(Y()),rangers_session_id:Y(),context:{},url:window.location.href,timestamp:Date.now(),screen_resolution:N(),network_type:J()},e}var it,at,st,ut,ct=function(e){return null!==document&&void 0!==document&&document.cookie&&(e=D(document.cookie,nt)),e},lt=(it="/v2/user/webid",at="/v2/user/ssid",st="/v2/event/list",ut=[],["https://mcs.ctobsnssdk.com","https://mcs.itobsnssdk.com","https://mcs.tobsnssdk.com"].forEach(function(t){[it,at,st].forEach(function(e){ut.push(t+e)})}),ut);function pt(e){var t=e.sendParams,e=e.monitorsSetting;if(!t||!u(t)||!t.event)return!1;var r,n,e=e;if("AjaxMonitor"===t.name||"FetchMonitor"===t.name){var o=F(s(["/monitor_browser/collect"],lt)||[]);if(o&&o.test(t.event.ax_url))return!1}return!(null==e||!e.BaseMonitor.sampleHit)&&("AjaxMonitor"===t.name||"FetchMonitor"===t.name?function(e){var r=e.sendParams,t=e.ajaxMonitor;if(!t)return!0;if("2"!==r.event.ax_status[0]&&"3"!==r.event.ax_status[0])return t.enableError;if(!t.enable)return!1;if(!t.webIDHit)return!1;if(!t.sampleHit||!U(t.sampleRate))return!1;if(c(e=t.whitelistUrls)&&0<e.length){var n=F(t.whitelistUrls||[]);return n&&n.test(r.event.ax_url)?!0:!1}if((n=F(t.ignore||[]))&&n.test(r.event.ax_url))return!1;if((n=t.statusCodeSample)&&d(n,r.event.ax_status))return U(n[r.event.ax_status]);if(t=t.requestUrlSample){var o=!1,i=!1;if(t.forEach(function(e){var t;o||null!=(t=F([e.url]))&&t.test(r.event.ax_url)&&(o=!0,i=U(e.sampleRate))}),o)return i}return!0}({sendParams:t,ajaxMonitor:e.AjaxMonitor}):"PerformanceMonitor"===t.name?!(r=(r={performanceMonitor:e.PerformanceMonitor}).performanceMonitor)||!!r.enable&&(!!r.webIDHit&&U(r.sampleRate)):"StaticErrorMonitor"===t.name?(o={sendParams:t,staticErrorMonitor:e.StaticErrorMonitor},r=o.sendParams,!(o=o.staticErrorMonitor)||!!o.enable&&(!!o.webIDHit&&(!!U(o.sampleRate)&&!((o=F(o.ignore||[]))&&o.test(r.event.st_src))))):"JSExceptionMonitor"===t.name?!(n=(n={jsErrorMonitor:e.JSErrorMonitor}).jsErrorMonitor)||!!n.enable&&(!!n.webIDHit&&U(n.sampleRate)):"ResourcePerformanceMonitor"===t.name?!(n=(n={resourcePerformanceMonitor:e.ResourcePerformanceMonitor}).resourcePerformanceMonitor)||!!n.enable&&(!!n.webIDHit&&U(n.sampleRate)):"EmitMonitor"!==t.name||!!{emitMonitor:e.EmitMonitor}.emitMonitor)}function ht(e){var t=e.sendParams,r=e.commonParams,n=e.custom,e=e.breadcrumbMonitor,e=function(e){var t=e.sendParams,r=e.commonParams,n=e.breadcrumbMonitor;if((e={}).ev_type=t.event.ev_type,e.common=r,"PageViewMonitor"===t.name&&e)return e;if(("AjaxMonitor"===t.name||"FetchMonitor"===t.name)&&e){r=t.event,r=(r.ev_type,a(r,["ev_type"]));return e.event=r,e}if("PerformanceMonitor"===t.name&&e){t.event.navigation=t.event.navigation_timing;var o=t.event,o=(o.ev_type,a(o,["ev_type"]));return e.ev_type="performance",e.event={fp:o.fp,fcp:o.fcp,fmp:o.fmp,tti:o.tti,fid:o.fid,mpfid:o.mpfid,isAsync:o.isAsync,timing:o.timing,navigation:o.navigation_timing,bounced:o.bounced},e}if("StaticErrorMonitor"===t.name&&e){e.ev_type="resource_error";o=t.event,o=(o.ev_type,a(o,["ev_type"]));return e.event=o,e}if("ResourcePerformanceMonitor"===t.name&&e){e.ev_type="resource";var i=t.event,i=(i.ev_type,a(i,["ev_type"]));return e.event=i,e}if("JSExceptionMonitor"===t.name&&e){e.ev_type="js_error";i=t.event,i=(i.ev_type,a(i,["ev_type"]));return e.event=i.exception,e.breadcrumbs=null!==(n=null==n?void 0:n.getBreadcrumbs())&&void 0!==n?n:[],e}return"EmitMonitor"===t.name&&e&&(e.ev_type="flexible",e.flexible_data_list=t.event.flexible_data_list),e}({sendParams:t,commonParams:p(p({},null!=r?r:{}),{url:window.location.href}),breadcrumbMonitor:e});return n&&f(n.beforeSend)&&(e=n.beforeSend(e||{})),e}function ft(e){return"https://"+e+"/monitor_browser/collect"}var mt,dt=(e(vt,mt=tt),vt.prototype._shouldSend=function(e){return pt({sendParams:e,monitorsSetting:this.options.monitorsSetting})},vt.prototype._modifyEvent=function(e){return(e=(e={sendParams:e}).sendParams)&&u(e)?e:{}},vt.prototype._request=function(e){var t,r;e&&e.event&&(t=e.type,r=e.event,"beacon"===this.options.reportType&&navigator&&navigator.sendBeacon?(e=JSON.stringify(r),navigator.sendBeacon(this.getReportURL(),e)):this.transport&&("get"!==t?"post"===t&&this.transport.postEvent(r):this.transport.getEvent(r)))},vt.prototype.buildParams=function(e){var t,r=null===(t=null===(t=this.options.monitorsSetting)||void 0===t?void 0:t.BreadcrumbMonitor)||void 0===t||!t.enable||null===(r=this.options.monitors)||void 0===r?void 0:r.BreadcrumbMonitor;return ht({sendParams:e,commonParams:this.options.commonParams,custom:this.options.custom,breadcrumbMonitor:r})},vt.prototype.getReportURL=function(){return this.reportURL},vt);function vt(e){var o=mt.call(this,e)||this;return o.options={},o.setTransport=function(){o.transport=new X({reportURL:o.getReportURL()}),o.preQueue.forEach(function(e){mt.prototype.sendEvent.call(o,e)})},o.updateConfig=function(e){var t,r,n;o.options=(t={previousOptions:o.options,newOptions:e},r=t.previousOptions,n=t.newOptions,(e=p(p({},r),n)).commonParams=i({},null!==(t=r.commonParams)&&void 0!==t?t:{},null!==(t=n.commonParams)&&void 0!==t?t:{}),e.monitorsSetting=i({},null!==(t=r.monitorsSetting)&&void 0!==t?t:{},null!==(t=n.monitorsSetting)&&void 0!==t?t:{}),e.monitors=p(p({},null!==(t=r.monitors)&&void 0!==t?t:{}),null!==(t=n.monitors)&&void 0!==t?t:{}),e.custom=p(p({},null!==(r=r.custom)&&void 0!==r?r:{}),null!==(n=n.custom)&&void 0!==n?n:{}),e)},o.sendEvent=function(e){o.transport?mt.prototype.sendEvent.call(o,e):o.preQueue.push(e)},o.uploadQueue=function(){o._uploadQueue()},o.reportURL=null!==(e=null==e?void 0:e.reportURL)&&void 0!==e?e:"",o.preQueue=[],o}gt.getClientCommonParams=function(r){void 0===r&&(r={});var n={};if(!u(r))return n;var o=["context","pid"];t(r,function(e,t){w(o,e)&&(n[e]=t)});return t({user_unique_id:"rangers_web_id",app_id:"aid"},function(e,t){d(r,e)&&(n[t]=r[e])}),n},gt.getClientFlags=function(e){void 0===e&&(e={});var r={};if(!u(e))return r;var n=["hookPath","hookXHR","hookFetch","enableSizeStats","enableFMP","enablePerformance","enableStaticError","enableCatchJSError","enableCatchJSErrorV2","enableCatchGlobalJSError","enableResourcePerformance","enableCrash","enableMemoryRecord","enableFPSJankTimesMonitor","enableBreadcrumb","hookConsole"];return t(e,function(e,t){w(n,e)&&(r[e]=t)}),r},gt.getClientCustom=function(e){var t={};return e.beforeSend&&f(e.beforeSend)&&(t.beforeSend=e.beforeSend),t},gt.getClientMonitorsSetting=function(e){return e=(t={setting:e}).setting,t={JSErrorMonitor:{},PerformanceMonitor:{},BreadcrumbMonitor:{},StaticErrorMonitor:{},ResourcePerformanceMonitor:{},BaseMonitor:{appTypeSetting:{}},AjaxMonitor:{}},e.ajaxWhitelistUrls&&c(e.ajaxWhitelistUrls)&&(t.AjaxMonitor.whitelistUrls=(t.AjaxMonitor.whitelistUrls||[]).concat(e.ajaxWhitelistUrls)),e.ignoreAjax&&c(e.ignoreAjax)&&(t.AjaxMonitor.ignore=(t.AjaxMonitor.ignore||[]).concat(e.ignoreAjax)),e.ignoreStatic&&c(e.ignoreStatic)&&(t.StaticErrorMonitor.ignore=(t.StaticErrorMonitor.ignore||[]).concat(e.ignoreStatic)),e.ignoreErrors&&c(e.ignoreErrors)&&(t.JSErrorMonitor.ignoreErrors=e.ignoreErrors),e.errorBlacklistUrls&&c(e.errorBlacklistUrls)&&(t.JSErrorMonitor.blacklistUrls=e.errorBlacklistUrls),e.errorWhitelistUrls&&c(e.errorWhitelistUrls)&&(t.JSErrorMonitor.whitelistUrls=e.errorWhitelistUrls),d(e,"sampleRate")&&(t.BaseMonitor.sampleHit=U(e.sampleRate)),t;var t},gt.prototype.configure=function(e){if(u(e)){if(this.userConfig=p(p({},this.userConfig||{}),e||{}),!this.serverDomain){if(!this.userConfig.serverDomain)return void console.error('"serverDomain" must be configured');this.serverDomain=this.userConfig.serverDomain}this.updateCurrentSetting(),this.client?this.updateClientConfig(this.getClientOptions()):this.init()}},gt.prototype.emitEvent=function(e){var t;this.monitors.EmitMonitor&&(t=this.monitors.EmitMonitor).handOut.apply(t,s(e))},gt.prototype.init=function(){var t=this,r=this.getClientOptions();this.client=new dt(r),this.getUserIDFromRangers(function(e){t.finderSetting={user_unique_id:e.user_unique_id},t.updateCurrentSetting(),t.updateClientConfig(r)}),this.sendPageview(),this.setupMonitors(this.setMonitors()),this.getServerSetting()},gt.prototype.getServerSetting=function(){var t=this;if(this.serverSetting)return this.updateCurrentSetting(),void this.afterServerSetting();var e="https://"+this.serverDomain+"/settings/get/web?aid="+this.currentSetting.commonParams.aid;X.get(e,{success:function(e){try{t.serverSetting=e.data,t.updateCurrentSetting(),t.afterServerSetting()}catch(e){t.afterServerSetting()}},fail:function(){t.afterServerSetting()}})},gt.prototype.afterServerSetting=function(){this.updateClientConfig(this.getClientOptions()),this.client.setTransport()},gt.prototype.updateCurrentSetting=function(){var e={commonParams:gt.getClientCommonParams(this.finderSetting),flags:gt.getClientFlags({}),custom:gt.getClientCustom({}),monitors:gt.getClientMonitorsSetting({})},t={commonParams:gt.getClientCommonParams({}),flags:gt.getClientFlags({}),custom:gt.getClientCustom({}),monitors:this.serverSetting?(r=this.serverSetting,n={JSErrorMonitor:{},PerformanceMonitor:{},BreadcrumbMonitor:{},StaticErrorMonitor:{},BaseMonitor:{},ResourcePerformanceMonitor:{},AjaxMonitor:{}},(r=r.setting).jserr&&(n.JSErrorMonitor.enable=r.jserr.enable,n.JSErrorMonitor.webIDHit=U(r.jserr.enable_user_rate),n.JSErrorMonitor.sampleRate=r.jserr.enable_sample_rate),r.performance&&(n.PerformanceMonitor.enable=r.performance.enable,n.PerformanceMonitor.webIDHit=U(r.performance.enable_user_rate),n.PerformanceMonitor.sampleRate=r.performance.enable_sample_rate),r.breadcrumb&&(n.BreadcrumbMonitor.enable=r.breadcrumb.enable),r.static_resource_error&&(n.StaticErrorMonitor.enable=r.static_resource_error.enable),r.static_resource&&(n.ResourcePerformanceMonitor.enable=r.static_resource.enable,n.ResourcePerformanceMonitor.webIDHit=U(r.static_resource.enable_user_rate),n.ResourcePerformanceMonitor.sampleRate=r.static_resource.enable_sample_rate),r.request&&(n.AjaxMonitor.enable=r.request.enable,n.AjaxMonitor.enableError=r.request.enableError,n.AjaxMonitor.webIDHit=U(r.request.enable_user_rate),n.AjaxMonitor.sampleRate=r.request.enable_sample_rate),n):gt.getClientMonitorsSetting({})},r={commonParams:gt.getClientCommonParams(this.userConfig),flags:gt.getClientFlags(this.userConfig),custom:gt.getClientCustom(this.userConfig),monitors:gt.getClientMonitorsSetting(this.userConfig)},n=this.currentSetting;this.currentSetting=o({},this.defaultSetting,t,r,e),this.currentSetting.commonParams.pid=this.currentSetting.commonParams.pid||location.pathname,this.settingEffect(this.currentSetting,n)},gt.prototype.settingEffect=function(e,t){var r;(r=e.commonParams.rangers_web_id)!==D(document.cookie,nt)&&(document.cookie=nt+"="+r+";max-age=7776000;domain="+location.hostname+";path=/"),t.commonParams.pid!==e.commonParams.pid&&this.sendPageview()},gt.prototype.setMonitors=function(){var t,e=this.currentSetting.commonParams,r=e.aid,n=e.rangers_web_id,o=[],i=this.currentSetting.flags,e=new me;return o.push(e),o.push(new Ue),i.enableCatchJSError&&o.push(new Ge),i.hookXHR&&o.push(new se({commonParams:{bid:r+"",web_id:n},ajaxMonitorOptions:this.currentSetting.monitors.AjaxMonitor})),i.hookFetch&&o.push(new pe({commonParams:{bid:r+"",web_id:n},ajaxMonitorOptions:this.currentSetting.monitors.AjaxMonitor})),i.enableStaticError&&o.push(new Fe),i.enablePerformance&&(i.enableFMP?o.push(new Ae({fmpMonitor:e,renderType:1,preLongTaskObserver:{precollect:[],observer:void 0}})):o.push(new Ae({renderType:1,preLongTaskObserver:{precollect:(null===(e=window.RangersSiteSDK.lt)||void 0===e?void 0:e.e)||[],observer:null===(e=window.RangersSiteSDK.lt)||void 0===e?void 0:e.o}}))),i.enableBreadcrumb&&o.push(new ze),i.enableResourcePerformance&&(t=this.serverDomain,o.push(new Oe({observe:!0,checkIgnore:function(e){return e.name===ft(t)||("xmlhttprequest"===e.initiatorType||"fetch"===e.initiatorType||"beacon"===e.initiatorType||"navigation"===e.initiatorType||0===e.decodedBodySize)}}))),o},gt.prototype.setupMonitors=function(e){var t=this;this.client&&this.client.sendEvent&&(e.forEach(function(e){"FMPMonitor"===(t.monitors[e.name]=e).name?e.setup(q):e.setup(null===(e=t.client)||void 0===e?void 0:e.sendEvent)}),this.updateClientConfig({monitors:this.monitors}))},gt.prototype.getUserIDFromRangers=function(t){window.collectEvent&&f(window.collectEvent)&&window.collectEvent("getToken",function(e){t(e)})},gt.prototype.sendPageview=function(){var e;null!==(e=this.client)&&void 0!==e&&e.sendEvent({name:"PageViewMonitor",event:{ev_type:"pageview"},type:"post"})},gt.prototype.getClientOptions=function(){var e=this.currentSetting;return{reportURL:ft(this.serverDomain),monitorsSetting:e.monitors,commonParams:e.commonParams,custom:e.custom}},gt.prototype.uploadClientQueue=function(){var e;null!==(e=this.client)&&void 0!==e&&e.uploadQueue()},gt.prototype.updateClientConfig=function(e){var t;null!==(t=this.client)&&void 0!==t&&t.updateConfig(e)},Ye=gt;function gt(){var r=this;this.version="0.2.22",this.serverDomain="",this.instance=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];"config"!==e[0]?"emit"!==e[0]?"report"!==e[0]?r.initOnCloseCallback():r.uploadClientQueue():r.emitEvent(e):r.configure(e[1])},this.initOnCloseCallback=function(){B(r.onCloseReport,r.visibilityChange)},this.visibilityChange=function(){"hidden"===document.visibilityState&&r.onCloseReport(),"visible"===document.visibilityState&&r.updateClientReportType("xhr")},this.onCloseReport=function(){r.updateClientReportType("beacon"),r.uploadClientQueue()},this.updateClientReportType=function(e){var t;null!==(t=r.client)&&void 0!==t&&t.updateConfig({reportType:e})},this.userConfig={},this.defaultSetting=ot(),this.currentSetting=this.defaultSetting,this.serverSetting=void 0,this.finderSetting={},this.client=void 0,this.monitors={}}var bt=q;return M()&&(tt=new Ye,bt=tt.instance,null!==(Ye=window.RangersSiteSDK)&&void 0!==Ye&&Ye.q&&(c(Ye=window.RangersSiteSDK.q)&&Ye.forEach(function(e){bt.apply(void 0,s(e))}),delete window.RangersSiteSDK.q),window.RangersSiteSDK=tt.instance),bt}(); | ||
var RangersSiteSDK=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 r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};function e(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var p=function(){return(p=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function a(e,t){var r={};for(o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(r[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var n=0,o=Object.getOwnPropertySymbols(e);n<o.length;n++)t.indexOf(o[n])<0&&Object.prototype.propertyIsEnumerable.call(e,o[n])&&(r[o[n]]=e[o[n]]);return r}function v(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function h(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),a=[];try{for(;(void 0===t||0<t--)&&!(n=i.next()).done;)a.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a}function s(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(h(arguments[t]));return e}function u(e){return"object"==typeof e&&null!==e&&!c(e)}function r(e){return"[object Object]"===(e=e,Object.prototype.toString.call(e))}function f(e){return"function"==typeof e}function m(e){return"[object String]"===Object.prototype.toString.call(e)}function c(e){return"[object Array]"===Object.prototype.toString.call(e)}function l(e){return"number"==typeof e}function d(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function t(e,t){if(u(e))for(var r in e)d(e,r)&&t.call(null,r,e[r])}function i(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var r={},n=0;n<e.length;)r=function(e,t){var r,n=p({},e);for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&void 0!==t[r]&&(u(t[r])&&b(t[r])?n[r]=y(u(e[r])?e[r]:{},t[r]):c(t[r])?n[r]=t[r].slice():n[r]=t[r]);return n}(r,e[n]),n++;return r}function o(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var r={},n=0;n<e.length;)r=y(r,e[n]),n++;return r}var g=Object.getPrototypeOf?Object.getPrototypeOf({}):null;function b(e){return Object.getPrototypeOf?Object.getPrototypeOf(e)===g:e.constructor===Object}function y(e,t){var r,n=p({},e);for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&void 0!==t[r]&&(u(t[r])&&b(t[r])?n[r]=y(u(e[r])?e[r]:{},t[r]):c(e[r])||c(t[r])?n[r]=function t(e,r){var e=c(e)?e:[];var r=c(r)?r:[];return Array.prototype.concat.call(e,r).map(function(e){return!(e instanceof RegExp)&&(c(e)||u(e)&&b(e))?c(e)?t([],e):y({},e):e})}(e[r],t[r]):n[r]=t[r]);return n}function w(e,t){if(!c(e))return!1;if(0===e.length)return!1;for(var r=0;r<e.length;){if(e[r]===t)return!0;r++}return!1}function S(){if("fetch"in window)try{return new Headers,new Request(""),new Response,1}catch(e){return}}function M(){return!!u(window)}function _(){return M()&&!!u(window.performance)}function P(){return _()&&!!u(window.performance.timing)}function E(){return!!_()&&!!f(window.performance.getEntries)}function T(){return M()&&"function"==typeof window.MutationObserver}function k(){return M()&&"function"==typeof window.PerformanceObserver}function R(){return!!k()&&f(window.PerformanceLongTaskTiming)}function C(){if(!k())return!1;var e=window.PerformanceObserverEntryList;return f(e)&&f(e.prototype.getEntries)}function x(e){var r,e=function(e){if(!u(e))return{};var r={};return t(e,function(e,t){u(t)||c(t)?r[e]=JSON.stringify(t):r[e]=t}),r}(e),e=(r={},t(e,function(e,t){r[encodeURIComponent(e)]=encodeURIComponent(t)}),r),n=[];return t(e,function(e,t){n.push(e+"="+t)}),n.join("&")}function L(e){var t=document.createElement("a");t.href=e;e=t.pathname||"/";return"/"!==e[0]&&(e="/"+e),{href:t.href,protocol:t.protocol.slice(0,-1),hostname:t.hostname,host:t.host,search:t.search,pathname:e,hash:t.hash}}var O=function(e){if(!m(e))return!1;return f(e.toLowerCase)&&(e=e.toLowerCase()),w(["x-tt-token"],e)};function q(){}function j(e){var t="[object String]"===Object.prototype.toString.call(e);return e?t?e.length:ArrayBuffer&&e instanceof ArrayBuffer?e.byteLength:window.Blob&&e instanceof Blob?e.size:e.length||0:0}function H(e){if(!e)return"";if(!f(e.forEach))return"";var r=[];return e.forEach(function(e){var t;c(e)&&e[0]&&!O(e[0])&&(t=e[0],e=e[1]||"",r.push(t+": "+e))}),r.join("\r\n")}function A(e){var t={},r=L(e);return t.ax_protocol=r.protocol,t.ax_domain=r.hostname,t.ax_path=r.pathname,t.ax_url=(r.href||e).split("?")[0],t}function I(e,t){e=L(e),t=L(t);return e.protocol===t.protocol&&e.host===t.host}function D(e,t){var r,n;if(!e||!t)return"";var o=e.split(";"),i={};try{for(var a=v(o),s=a.next();!s.done;s=a.next()){var u=s.value.split("="),c=m(u[0])&&u[0].trim();c&&m(u[1])&&(i[c]=u[1].trim())}}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}return i[t]||""}function F(e){return c(e)&&e.length?function(e){for(var t=[],r=e.length,n=0;n<r;n++){var o=e[n];m(o)?t.push(o.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")):o&&o.source&&t.push(o.source)}return new RegExp(t.join("|"),"i")}(e):null}function B(t,r){f(t)&&(f(window.addEventListener)&&(window.addEventListener("unload",t),window.addEventListener("beforeunload",t),window.addEventListener("pagehide",t)),f(document.addEventListener)&&document.addEventListener("visibilitychange",function(e){f(r)?r(e):"hidden"===document.visibilityState&&t(e)}))}var N=function(e){var t,r;return void 0===e&&(e=window),M()&&null!==(t=e.screen)&&void 0!==t&&t.width&&null!==(r=e.screen)&&void 0!==r&&r.height?e.screen.width+"x"+e.screen.height:"0x0"},J=function(){var e="unknown",t=navigator.connection||navigator.mozConnection||navigator.webkitConnection;return t&&m(t.effectiveType)?t.effectiveType:e};function U(e){return!!e&&Math.random()<Number(e)}var X=(Q.post=function(e,t,r){var n=r&&r.success||q,o=r&&r.fail||q,r=new XMLHttpRequest;r.open("POST",e,!0),r.setRequestHeader("Content-Type","application/json"),r.send(JSON.stringify(t)),r.onload=function(){try{var e;this.responseText?(e=JSON.parse(this.responseText),n(e)):n({})}catch(e){o()}},r.onerror=function(){o()},r.onabort=function(){o()}},Q.get=function(e,t){var r=t&&t.success||q,n=t&&t.fail||q,o=t&&t.getResponse||q,i=t&&t.getResponseText||q,a=new XMLHttpRequest;t&&t.withCredentials&&(a.withCredentials=t.withCredentials),a.open("GET",e),a.send(),a.onload=function(){o(null==this?void 0:this.response),i(this.responseText);try{var e;this.responseText?(e=JSON.parse(this.responseText),r(e)):r({})}catch(e){n()}},a.onerror=function(){n()},a.onabort=function(){n()}},Q.prototype.getCommonParams=function(){return{timestamp:Date.now()}},Q);function Q(e){var t=this;this.postEvent=function(e){e=p(p({},e),t.getCommonParams());Q.post(t.url,e)},this.getEvent=function(e){e=x(p(p({},e),t.getCommonParams())),e=t.url+"?"+e;Q.get(e)},this.getURL=function(){return t.url},this.options=e,this.url=this.options.reportURL}function z(e,t,r){if(void 0===r&&(r="0"),1<r.length)throw new TypeError("expect the length of pad to be 1, but got "+e.length);return e.length>=t?e:""+Array.from({length:t-e.length}).fill(r).join("")+e}function V(e){return e?Math.floor(Math.random()*Math.pow(10,12)).toString(16).substr(0,e):""}var K="x-tt-trace-id",W="x-tt-trace-host",G="x-tt-logid";function $(e,t,r){void 0===r&&(r="01");t=""+z((Date.now()%4294967295).toString(16),8)+function(e){if("number"==typeof e)r=e;else{var t=e.replace(/-/g,"");if(!/^[0-9]+$/.test(t)){if(18<t.length)return"18"+V(18);e=22-t.length-4;return""+z(""+t.length,2)+t+V(e)}r=parseInt(t,10)}var r=22-(t=r.toString(16)).length-4;return""+z(""+t.length,2)+t+V(r)}(e)+("string"==typeof t?V(4):z(t.toString(16),4));return"00-"+t+"-"+t.substr(0,16)+"-"+r}function Y(){var e=function(){for(var e=new Array(16),t=0,r=0;r<16;r++)0==(3&r)&&(t=4294967296*Math.random()),e[r]=t>>>((3&r)<<3)&255;return e}();return e[6]=15&e[6]|64,e[8]=63&e[8]|128,function(e){for(var t=[],r=0;r<256;++r)t[r]=(r+256).toString(16).substr(1);var n=0;return[t[e[n++]],t[e[n++]],t[e[n++]],t[e[n++]],"-",t[e[n++]],t[e[n++]],"-",t[e[n++]],t[e[n++]],"-",t[e[n++]],t[e[n++]],"-",t[e[n++]],t[e[n++]],t[e[n++]],t[e[n++]],t[e[+n]],t[e[15]]].join("")}(e)}function Z(){return f(Date)?Math.round(Date.now()/1e3):0}var ee=.1,te=["/log/sentry/"],re=8e3,ne=4e3;Y(),Y();function oe(e,r){if(!u(e))return{};if(!f(r))return{};var n={};return t(e,function(e,t){r(t)&&(n[e]=t)}),n}function ie(e){var t,r,n,o,i=null;return u(e)&&("timer"===e.type&&(i=u(t=e.event)&&m(t.name)&&l(t.value)?{metrics_type:"timer",event_name:"default",metrics:((r={})[t.name]=t.value,r),category:oe(t.tags,m),timestamp:Z()}:{}),"counter"===e.type&&(i=u(o=e.event)&&m(o.name)&&l(o.value)?{metrics_type:"counter",event_name:"default",metrics:((n={})[o.name]=o.value,n),category:oe(o.tags,m),timestamp:Z()}:{}),"log"===e.type&&(i=u(n=e.event)&&m(n.value)?{metrics_type:"log",event_name:"default",log_content:n.value,log_level:null!==(o=n.level)&&void 0!==o?o:"info",category:oe(n.tags,m),timestamp:Z()}:{}),"custom"===e.type&&(i=u(e=e.event)&&m(e.event_name)?{metrics_type:"custom",event_name:e.event_name,metrics:oe(e.metrics,l),category:oe(e.tags,m),timestamp:Z()}:{})),i}var ae="AjaxMonitor",se=(ue.prototype.setup=function(e){void 0===e&&(e=q),f(XMLHttpRequest)&&(this.callback=e,this.start())},ue.prototype.updateConfig=function(e){this.props=o({},this.props,e)},ue.prototype.start=function(){this.hookXMLHttpRequestOpen(),this.hookXMLHttpRequestSend(),this.hookXMLHttpRequestSetRequestHeader()},ue.prototype.hookXMLHttpRequestSetRequestHeader=function(){var r=XMLHttpRequest.prototype.setRequestHeader||q;XMLHttpRequest.prototype.setRequestHeader=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this._requestHeaders=this._requestHeaders||[],this._requestHeaders.push(e),r.apply(this,e)}},ue.prototype.hookXMLHttpRequestOpen=function(){var o=XMLHttpRequest.prototype.open;XMLHttpRequest.prototype.open=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=e[0],n=e[1];return this._url=n||"",this._method=(null==r?void 0:r.toLowerCase())||"",o.apply(this,e)}},ue.prototype.hookXMLHttpRequestSend=function(){var o=this,i=XMLHttpRequest.prototype.send;XMLHttpRequest.prototype.send=function(){for(var e,t,r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];return o.checkAddTrace(this._url)&&(e=(t=null!==(e=null==o?void 0:o.props.commonParams)&&void 0!==e?e:{}).bid,t=t.web_id,e&&t&&(o.traceId=$(t,e),this.setRequestHeader(K,o.traceId))),o.hookXMLHttpRequestOnreadystatechange.call(this,o),this._start=Date.now(),this._data=null==r?void 0:r[0],i.apply(this,r)}},ue.prototype.checkAddTrace=function(e){var t=null!==(n=this.props.commonParams)&&void 0!==n?n:{},r=t.bid,n=t.web_id,t=(null!==(t=this.props.ajaxMonitorOptions)&&void 0!==t?t:{}).sampleHitTrace,e=I(location.href,e);return r&&n&&t&&e},ue.prototype.collectErrorRequest=function(){var e;return null!==(e=null===(e=this.props.ajaxMonitorOptions)||void 0===e?void 0:e.errorRequestCollect)&&void 0!==e&&e},ue.prototype.hookXMLHttpRequestOnreadystatechange=function(i){var a=this.onreadystatechange,s=this;this.onreadystatechange=function(){for(var e,t,r,n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];if(4===this.readyState&&(t={ev_type:"ajax",ax_status:(this.status||0).toString(),ax_type:s._method,ax_request_header:H(s._requestHeaders||[]),ax_domain:"",ax_duration:0,ax_path:"",ax_protocol:"",ax_response_header:"",ax_size:0,ax_url:""},"function"==typeof this.getAllResponseHeaders&&(t.ax_response_header=function(t){if(m(t)){var e=t.split("\r\n"),r=[];return e.forEach(function(e,t){e&&f(e.split)&&(e=e.split(": "),r.push([e[0],e[1]]))}),H(r)}return u(t)?H(Object.keys(t).map(function(e){return[e,t[e]]})):t}(this.getAllResponseHeaders())),!i.checkAddTrace(s._url)||(r=null!==(r=i.traceId)&&void 0!==r?r:this.getResponseHeader(K))&&(t.trace_id=r,t.trace_host=null!==(e=this.getResponseHeader(W))&&void 0!==e?e:void 0,t.log_id=null!==(e=this.getResponseHeader(G))&&void 0!==e?e:void 0),t.ax_duration=Date.now()-s._start,200===this.status&&(t.ax_size=function(e){var t=0;if(""===e.responseType||"text"===e.responseType)t=j(e.responseText);else if(e.response)t=j(e.response);else try{t=j(e.responseText)}catch(e){t=0}return t}(this)),t=p(p({},t),A(s._url)),i.collectErrorRequest()&&"2"!==t.ax_status[0]&&"3"!==t.ax_status[0]&&(t.ax_request={body:s._data?""+s._data:void 0,search:null===(e=L(s._url))||void 0===e?void 0:e.search,content_type:null===(e=null===(e=s._requestHeaders)||void 0===e?void 0:e.find(function(e){return"content-type"===e[0].toLowerCase()}))||void 0===e?void 0:e[1]}),f(i.callback)&&i.callback({name:i.name,type:"get",event:t})),a)return a.apply(this,n)}},ue.monitorName=ae,ue);function ue(e){this.name=ae,this.callback=q,this.traceId=null,this.props=e}function ce(e){return e instanceof Request}var le="FetchMonitor",pe=(he.prototype.updateConfig=function(e){this.props=o({},this.props,e)},he.prototype.setup=function(e){void 0===e&&(e=q),S()&&(this.callback=e,this.start())},he.prototype.start=function(){S()&&this.hookFetch()},he.prototype.checkAddTrace=function(e){var t=null!==(n=null===(r=this.props)||void 0===r?void 0:r.commonParams)&&void 0!==n?n:{},r=t.bid,n=t.web_id,t=(null!==(t=null===(t=null==this?void 0:this.props)||void 0===t?void 0:t.ajaxMonitorOptions)&&void 0!==t?t:{}).sampleHitTrace,e=I(location.href,e);return r&&n&&t&&e},he.prototype.updateAxRequest=function(e,t,r){var n,o;this.collectErrorRequest()&&"2"!==e.ax_status[0]&&"3"!==e.ax_status[0]&&(o=this.getFetchUrl(t,!0),e.ax_request={body:null===(t=this.getFetchBody(t,r))||void 0===t?void 0:t.toString(),search:!m(o)||null===(n=L(o))||void 0===n?void 0:n.search,content_type:null===(r=null==r?void 0:r.headers)||void 0===r?void 0:r["Content-Type"]})},he.prototype.collectErrorRequest=function(){var e;return null!==(e=null===(e=this.props.ajaxMonitorOptions)||void 0===e?void 0:e.errorRequestCollect)&&void 0!==e&&e},he.prototype.hookFetch=function(){var u=this,c=this,l=window.fetch;window.fetch=function(n,o){void 0===o&&(o={});var i=u.getFetchUrl(n);if(!function(e){if(m(e)){var t=h(e.split(":"),2),e=t[0];return!t[1]||("http"===e||"https"===e)}}(i))return l(n,o);var e=null!==(e=u.props.commonParams)&&void 0!==e?e:{},t=e.bid,r=e.web_id,a=Date.now(),s={ev_type:"ajax"};try{c.checkAddTrace(i)&&(o.headers=new Headers(function(e,t){var r=new Headers;ce(e)&&e.headers&&f(e.headers.forEach)&&e.headers.forEach(function(e,t){r.append(t,e)});t.headers&&new Headers(t.headers).forEach(function(e,t){r.append(t,e)});return r}(n,o)),t&&r&&(s.trace_id=$(t,r),o.headers.append(K,s.trace_id)))}catch(e){}return s.ax_type=u.getFetchMethod(n,o),s=p(p({},s),A(i)),l(n,o).then(function(e){var t,r;return s.ax_status=(e.status||0).toString(),s.ax_duration=Date.now()-a,s.ax_response_header=c.getAllHeaders(e.headers),s.ax_request_header=c.getAllHeaders(o.headers),e.headers&&f(e.headers.has)?(e.headers.has("content-length")?s.ax_size=Number(e.headers.get("content-length"))||0:s.ax_size=0,c.checkAddTrace(i)&&(e.headers.has(W)&&(s.trace_host=null!==(t=e.headers.get(W))&&void 0!==t?t:void 0),e.headers.has(K)&&(s.trace_id=null!==(r=e.headers.get(K))&&void 0!==r?r:void 0),e.headers.has(G)&&(s.log_id=null!==(r=e.headers.get(G))&&void 0!==r?r:void 0))):s.ax_size=0,u.updateAxRequest(s,n,o),f(c.callback)&&c.callback({name:c.name,type:"get",event:s}),e},function(e){return s.ax_status="0",s.ax_size=0,s.ax_duration=Date.now()-a,u.updateAxRequest(s,n,o),f(c.callback)&&c.callback({name:c.name,type:"get",event:s}),Promise.reject(e)})}},he.prototype.getFetchUrl=function(e,t){void 0===t&&(t=!1);var r="",r=ce(e)?e.url:e;return t||(r=m(r)?r.split("?")[0]:r),r},he.prototype.getFetchMethod=function(e,t){t=null!==(t=null==t?void 0:t.method)&&void 0!==t?t:"get";return ce(e)&&(t=null!==(e=e.method)&&void 0!==e?e:t),t.toLowerCase()},he.prototype.getFetchBody=function(e,t){return ce(e)?e.body:null==t?void 0:t.body},he.prototype.getAllHeaders=function(e){if(!e||"function"!=typeof e.forEach)return"";var r=[];return e.forEach(function(e,t){r.push([t,e])}),H(r)},he.monitorName=le,he);function he(e){this.name=le,this.callback=q,this.props=e}var fe="FMPMonitor",me=(de.prototype.setup=function(e){if(M())return T()?void(f(document.querySelector)&&(this.callback=e&&f(e)?e:function(){},this.startTime=Date.now(),this.list=[],f(this.observer.observe)&&this.observer.observe(document,{childList:!0,subtree:!0}))):null},de.prototype.count=function(){var e=Date.now()-this.startTime,t=document.querySelector("body");t?this.list.push({score:this.score(t,1,!1),time:e}):this.list.push({score:0,time:e})},de.prototype.score=function(e,t,r){var n,o=0,i=e.tagName;if("SCRIPT"!==i&&"STYLE"!==i&&"META"!==i&&"HEAD"!==i&&!w((null===(n=this.props)||void 0===n?void 0:n.ignoreTags)||[],i)){i=e.children?e.children.length:0;if(0<i)for(var a=e.children,s=i-1;0<=s;s--)o+=this.score(a[s],t+1,0<o);if(o<=0&&!r){if(!e.getBoundingClientRect||!f(e.getBoundingClientRect))return 0;e=e.getBoundingClientRect();if(!e)return 0;if(e.top>window.innerHeight)return 0;if(e.height<=0)return 0}o+=1+.5*t}return o},de.prototype.getFmpInternal=function(){if(!this.observer)return 0;if(this.disconnect(),!this.list.length)return 0;for(var e,t={time:this.list[0].time,rate:0},r=1;r<this.list.length;r++)this.list[r].time>=this.list[r-1].time&&(e=this.list[r].score-this.list[r-1].score,t.rate<e&&(t={time:this.list[r].time,rate:e}));return t.time},de.prototype.getTimeGap=function(){return P()?this.startTime-performance.timing.navigationStart:0},de.prototype.formatEvent=function(e){return{name:this.name,type:"post",event:{ev_type:"fmp",fmp:e}}},de.monitorName=fe,de);function de(e){var r=this;this.name=fe,this.callback=q,this.disconnect=function(){var e,t;null!==(t=null===(e=r.observer)||void 0===e?void 0:e.disconnect)&&void 0!==t&&t.call(e)},this.getLoadFmp=function(){var e=r.getFmpInternal(),e=e?r.getTimeGap()+e:0,e=r.formatEvent(e);return r.callback(e),e},this.getFmp=function(){var e=r.getFmpInternal(),e=r.formatEvent(e);return r.callback(e),e},this.props=e,this.startTime=Date.now(),this.list=[],this.observer=new MutationObserver(this.count.bind(this))}function ve(){}var ge=!1,be=!1,ye={uniqueId:0,originals:{},proxies:{},patchXMLHTTPRequest:function(i){this.originals.send=XMLHttpRequest.prototype.send,XMLHttpRequest.prototype.send=function(){for(var t=this,e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];var n=ye.uniqueId++;i.beforeCb(n);var o=this.onreadystatechange;return this.onreadystatechange=function(e){null!=o&&o.call(t,e),4===t.readyState&&i.afterCb(n)},ye.originals.send.apply(this,e)},this.proxies.send=XMLHttpRequest.prototype.send},patchFetch:function(o){var i;S()&&(i=window.fetch,this.originals.fetch=i,window.fetch=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return new Promise(function(t,r){var n=ye.uniqueId++;o.beforeCb(n),i.apply(void 0,s(e)).then(function(e){o.afterCb(n),t(e)},function(e){o.afterCb(n,e),r(e)})})},this.proxies.fetch=window.fetch)},observeResourceFetchingMutations:function(a){if(T()){var s=["img","script","iframe","link","audio","video","source"],e=new MutationObserver(function(e){var t,r;try{for(var n=v(e),o=n.next();!o.done;o=n.next()){var i=o.value;("childList"===i.type&&function e(t,r){var n,o;try{for(var i=v(t),a=i.next();!a.done;a=i.next()){var s=a.value;if(r.includes(s.nodeName.toLowerCase())||s.children&&e(s.children,r))return 1}}catch(e){n={error:e}}finally{try{a&&!a.done&&(o=i.return)&&o.call(i)}finally{if(n)throw n.error}}}(i.addedNodes,s)||"attributes"===i.type&&s.includes(i.target.nodeName.toLowerCase()))&&a(i)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}});return e.observe(document,{attributes:!0,childList:!0,subtree:!0,attributeFilter:["href","src"]}),e}},resetOriginals:function(){this.originals.send&&XMLHttpRequest.prototype.send===this.proxies.send&&(ge=!1,XMLHttpRequest.prototype.send=this.originals.send),this.originals.fetch&&fetch===this.proxies.fetch&&(be=!1,window.fetch=this.originals.fetch)}},we="TTIMonitor",Se=(Me.prototype.setup=function(){},Me.prototype.isEnable=function(){return R()&&!!k()&&f(window.PerformanceResourceTiming)&&C()},Me.prototype.registerPerformanceObserver=function(){var s=this;this.performanceObserver=new PerformanceObserver(function(e){var t,r,n=e.getEntries();try{for(var o=v(n),i=o.next();!i.done;i=o.next()){var a=i.value;"resource"===a.entryType&&s.networkRequestFinishedCallback(a),"longtask"===a.entryType&&s.longTaskFinishedCallback(a)}}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}});try{this.performanceObserver.observe({type:"longtask"}),this.performanceObserver.observe({type:"resource",buffered:!0})}catch(e){this.performanceObserver.observe({entryTypes:["longtask","resource"]})}},Me.prototype.unregisterListeners=function(){this.performanceObserver&&this.performanceObserver.disconnect(),this.mutationObserver&&this.mutationObserver.disconnect(),ye.resetOriginals(),this.proxyConfig&&(this.proxyConfig.beforeCb=ve,this.proxyConfig.afterCb=ve)},Me.prototype.rescheduleTimer=function(e){var t=this;this.scheduleTimerTasks&&(this.timerActivationTime>e||(clearTimeout(this.timerId),this.timerId=window.setTimeout(function(){t.checkTTI()},e-performance.now()),this.timerActivationTime=e))},Me.prototype.startSchedulingTimerTasks=function(){this.scheduleTimerTasks=!0;var e=0<this.longTasks.length?this.longTasks[this.longTasks.length-1].end:0,t=this.computeLastKnownNetwork2Busy(this.incompleteRequestStarts,this.networkRequests);this.rescheduleTimer(Math.max(t+5e3,e))},Me.prototype.registerListeners=function(){ge||(ye.patchXMLHTTPRequest(this.proxyConfig),ge=!0),be||(ye.patchFetch(this.proxyConfig),be=!0),this.registerPerformanceObserver(),this.useMutationObserver&&(this.mutationObserver=ye.observeResourceFetchingMutations(this.mutationObserverCallback.bind(this)))},Me.prototype.mutationObserverCallback=function(e){this.rescheduleTimer(performance.now()+5e3)},Me.prototype.beforeJSInitiatedRequestCallback=function(e){this.incompleteJSInitiatedRequestStartTimes[e]=performance.now()},Me.prototype.afterJSInitiatedRequestCallback=function(e){this.incompleteJSInitiatedRequestStartTimes[e]=void 0},Me.prototype.networkRequestFinishedCallback=function(e){this.networkRequests.push({start:e.fetchStart,end:e.responseEnd}),this.rescheduleTimer(this.computeLastKnownNetwork2Busy(this.incompleteRequestStarts,this.networkRequests)+5e3)},Object.defineProperty(Me.prototype,"incompleteRequestStarts",{get:function(){for(var e=Object.keys(this.incompleteJSInitiatedRequestStartTimes),t=[],r=0;r<e.length;r++){var n=this.incompleteJSInitiatedRequestStartTimes[e[r]];"number"==typeof n&&t.push(n)}return t},enumerable:!1,configurable:!0}),Me.prototype.longTaskFinishedCallback=function(e){var t=e.startTime+e.duration;this.longTasks.push({start:e.startTime,end:t}),this.rescheduleTimer(t+5e3)},Me.prototype.checkTTI=function(){var e=this.computeLastKnownNetwork2Busy(this.incompleteRequestStarts,this.networkRequests),t=this.getFirstPaintTime()||performance.timing.domContentLoadedEventEnd-performance.timing.navigationStart,r=this.getMinValue(),n=performance.now();null===r&&this.rescheduleTimer(Math.max(e+5e3,n+1e3));n=this.computeTTI(t,r,e,n,this.longTasks);n?(this.callback&&"function"==typeof this.callback&&this.callback(Math.round(n)),this.disable()):this.rescheduleTimer(performance.now()+1e3)},Me.prototype.getMinValue=function(){if(this.minValue)return this.minValue;if(performance.timing.domContentLoadedEventEnd){var e=performance.timing;return e.domContentLoadedEventEnd-e.navigationStart}return null},Me.prototype.getFirstPaintTime=function(){if("PerformancePaintTiming"in window){var e=performance.getEntriesByType("paint")[0];return e?e.startTime:0}return 0},Me.prototype.disable=function(){clearTimeout(this.timerId),this.scheduleTimerTasks=!1,this.unregisterListeners(),this.snippetObserver&&this.snippetObserver.disconnect(),this.snippetEntries&&this.snippetEntries.splice(0,this.snippetEntries.length)},Me.prototype.computeLastKnownNetwork2Busy=function(e,t){var r,n,o,i;if(2<e.length)return performance.now();var a=[];try{for(var s=v(t),u=s.next();!u.done;u=s.next()){var c=u.value;a.push({timestamp:c.start,type:"requestStart"}),a.push({timestamp:c.end,type:"requestEnd"})}}catch(e){r={error:e}}finally{try{u&&!u.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}try{for(var l=v(e),p=l.next();!p.done;p=l.next()){var h=p.value;a.push({timestamp:h,type:"requestStart"})}}catch(e){o={error:e}}finally{try{p&&!p.done&&(i=l.return)&&i.call(l)}finally{if(o)throw o.error}}a.sort(function(e,t){return e.timestamp-t.timestamp});for(var f=e.length,m=a.length-1;0<=m;m--){var d=a[m];switch(d.type){case"requestStart":f--;break;case"requestEnd":if(2<++f)return d.timestamp;break;default:throw Error("Internal Error: This should never happen")}}return 0},Me.monitorName=we,Me);function Me(e){var t,r,n,o=this;if(this.name=we,this.longTasks=[],this.callback=ve,this.useMutationObserver=!0,this.minValue=null,this.isAsync=0,this.networkRequests=[],this.incompleteJSInitiatedRequestStartTimes={},this.timerActivationTime=-1/0,this.scheduleTimerTasks=!1,this.proxyConfig={beforeCb:this.beforeJSInitiatedRequestCallback.bind(this),afterCb:this.afterJSInitiatedRequestCallback.bind(this)},this.getTTI=function(e){o.callback=e,o.isEnable()?o.startSchedulingTimerTasks():o.callback&&"function"==typeof o.callback&&o.callback()},this.computeTTI=function(e,t,r,n,o){if(n-r<5e3)return null;o=0===o.length?e:o[o.length-1].end;return n-o<5e3?null:Math.max(o,t)},this.isEnable()){if(this.useMutationObserver=!!e.useMutationObserver,this.minValue=null!==(n=e.minValue)&&void 0!==n?n:null,this.isAsync=null!==(n=e.isAsync)&&void 0!==n?n:0,this.snippetEntries=null===(n=null==e?void 0:e.preLongTaskObserver)||void 0===n?void 0:n.precollect,this.snippetObserver=null===(e=null==e?void 0:e.preLongTaskObserver)||void 0===e?void 0:e.observer,!this.isAsync&&this.snippetEntries&&0<this.snippetEntries.length)try{for(var i=v(this.snippetEntries),a=i.next();!a.done;a=i.next()){var s=a.value;"longtask"===s.entryType?this.longTasks.push({start:s.startTime,end:s.startTime+s.duration}):"resource"===s.entryType&&this.networkRequests.push({start:s.fetchStart,end:s.responseEnd})}}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}this.registerListeners()}}function _e(e){try{for(var t,r=e,n=[],o=0,i=0,a=" > ".length;r&&o++<5&&!("html"===(t=function(e){var t,r,n,o,i=e,a=[];if(!i||!i.tagName)return"";a.push(i.tagName.toLowerCase()),i.id&&a.push("#"+i.id);e=i.className;if(e&&m(e))for(t=e.split(/\s+/),o=0;o<t.length;o++)a.push("."+t[o]);var s=["type","name","title","alt"];for(o=0;o<s.length;o++)r=s[o],(n=i.getAttribute(r))&&a.push("["+r+'="'+n+'"]');return a.join("")}(r))||1<o&&80<=i+n.length*a+t.length);)n.push(t),i+=t.length,r=r.parentNode;return n.reverse().join(" > ")}catch(e){return"<unknown>"}}var Pe="FIDMonitor",Ee=(Te.prototype.setup=function(e){var s=this;if(k()&&PerformanceObserver.supportedEntryTypes&&PerformanceObserver.supportedEntryTypes.includes("first-input")&&C()){this.callback=e,this.observer=new PerformanceObserver(function(e,t){var r,n;try{for(var o=v(e.getEntries()),i=o.next();!i.done;i=o.next()){var a=i.value,a=a.processingStart-a.startTime;s.callback({name:s.name,fid:Math.round(a)})}}catch(e){r={error:e}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}t.disconnect()});try{this.observer.observe({type:"first-input",buffered:!0})}catch(e){this.observer.observe({entryTypes:["first-input"]})}}},Te.monitorName=Pe,Te);function Te(){this.name=Pe,this.callback=q}var ke="MPFIDMonitor",Re=(Ce.prototype.setup=function(){var t,e,r,a=this;if(R()&&C()){if(!this.props.isAsync){var n=null!==(r=null===(r=this.props.preLongTaskObserver)||void 0===r?void 0:r.precollect)&&void 0!==r?r:[];if(n&&0<n.length)try{for(var o=v(n),i=o.next();!i.done;i=o.next()){var s=i.value;"longtask"===s.entryType&&this.list.push(s)}}catch(e){t={error:e}}finally{try{i&&!i.done&&(e=o.return)&&e.call(o)}finally{if(t)throw t.error}}}this.observer=new PerformanceObserver(function(e){var t,r;try{for(var n=v(e.getEntries()),o=n.next();!o.done;o=n.next()){var i=o.value;a.list.push(i)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}}),this.observer.observe({entryTypes:["longtask"]})}},Ce.prototype.getMPFID=function(){var t,e;if(R()&&C()){this.observer&&this.observer.disconnect();var r=0;try{for(var n=v(this.list),o=n.next();!o.done;o=n.next()){var i=o.value;r<i.duration&&(r=i.duration)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(t)throw t.error}}return this.formatEvent(Math.round(r))}},Ce.prototype.formatEvent=function(e){return{name:this.name,mpfid:e}},Ce.monitorName=ke,Ce);function Ce(e){this.name=ke,this.list=[],this.props=e}var xe=["xmlhttprequest","fetch"],Le="ResourcePerformanceMonitor",Oe=(qe.prototype.setup=function(e){this.isEnable()&&(this.callback=null!=e?e:q,this.isAsync&&window.performance.clearResourceTimings(),this.observe&&(this.sendResourcePerformance(performance.getEntriesByType("resource")),this.observePerformance()))},qe.prototype.isEnable=function(){return E()&&"function"==typeof performance.clearResourceTimings},qe.prototype.getPerformance=function(){return this.isEnable()?this.buildParams(this.getResources()):this.buildParams([])},qe.prototype.buildParams=function(e){var t=this,r=[];if(e.forEach(function(e){w(xe,e.initiatorType)||f(t.checkIgnore)&&t.checkIgnore(e)||r.push(e)}),r.length)return{name:this.name,type:"post",event:{ev_type:"resource_performance",resources:r}}},qe.prototype.sendResourcePerformance=function(e){e=this.buildParams(e);e&&this.callback(e)},qe.prototype.getResources=function(){return window.performance.getEntriesByType("resource")},qe.prototype.observePerformance=function(){var t=this;k()&&new PerformanceObserver(function(e){e=e.getEntries();e.length&&t.sendResourcePerformance(e)}).observe({entryTypes:["resource"]})},qe.monitorName=Le,qe);function qe(e){var t,r=this;this.name=Le,this.callback=q,this.getResourcePerformance=function(){var e;return null!==(e=r.getPerformance())&&void 0!==e?e:{}},this.isAsync=null!==(t=null==e?void 0:e.isAsync)&&void 0!==t?t:0,this.observe=null!==(t=null==e?void 0:e.observe)&&void 0!==t&&t,this.checkIgnore=null!==(e=null==e?void 0:e.checkIgnore)&&void 0!==e?e:function(){return!1}}var je={ev_type:"perf",isAsync:0,dns:0,tcp:0,request:0,response:0,processing:0,blank:0,domready:0,load:0,has_resource:0,domparse:0,resource:0,ttfb:0,redirect:0,tti:0,upload_reason:"sample",network_type:"",timing:{},navigation_timing:{},navigation:{},resources:[]},He="PerformanceMonitor",Ae=(Ie.prototype.setup=function(e){var t,r=this;P()&&(this.callback=e,t=function(){r.hasLoaded=!0,r.performanceAuto&&(r.perfTimer=setTimeout(function(){r.perfLog()},200))},"complete"!==document.readyState?window.addEventListener("load",function(){setTimeout(function(){t()},0)},!1):t(),this.sendParams=p({},je),this.staticPerformanceMonitor=new Oe,this.staticPerformanceMonitor.setup(),(new Ee).setup(this.hasFID),this.mpfidMonitor=new Re({isAsync:0,preLongTaskObserver:this.props.preLongTaskObserver}),this.mpfidMonitor.setup(),e=null!==(e=this.props.TTIMonitor)&&void 0!==e?e:Se,this.ttiMonitor=new e({isAsync:0,preLongTaskObserver:this.props.preLongTaskObserver}),this.ttiMonitor.setup(),e=this.syncPerfLog.bind(this),B(e))},Ie.prototype.performanceNow=function(){var e;return null!==performance&&void 0!==performance&&performance.now?performance.now():(Date.now?Date.now():+new Date)-(null!==(e=null===(e=performance.timing)||void 0===e?void 0:e.navigationStart)&&void 0!==e?e:0)},Ie.prototype.getBounced=function(){return!this.hasLoaded},Ie.prototype.getPaintTime=function(t){if(E()){var e=performance.getEntriesByType("paint");if(c(e)){e=e.filter(function(e){return e.name===t});return e.length&&e[0]&&u(e[0])&&e[0].startTime||0}}return 0},Ie.monitorName=He,Ie);function Ie(e){var o=this;this.name=He,this.callback=q,this.sendParams=p({},je),this.finalSendParams=this.sendParams,this.hasLoaded=!1,this.initStart=0,this.hasSentInitPerf=!1,this.initFlag=!0,this.performanceAuto=!0,this.send=function(){o.initFlag&&o.hasLoaded&&(o.sendParams.isAsync&&(o.sendParams.load=Math.round(o.performanceNow()-o.initStart)),setTimeout(function(){o.perfLog()},200))},this.initAsync=function(){var e,t;o.hasSentInitPerf&&(o.sendParams=p({},je),o.sendParams.isAsync=1,o.initFlag=!0,o.initStart=o.performanceNow(),o.staticPerformanceMonitor=new Oe({isAsync:1}),o.staticPerformanceMonitor.setup(),o.mpfidMonitor=new Re({isAsync:1,preLongTaskObserver:o.props.preLongTaskObserver}),o.mpfidMonitor.setup(),t=null!==(e=o.props.TTIMonitor)&&void 0!==e?e:Se,o.ttiMonitor=new t({minValue:Math.round(o.performanceNow()),isAsync:1,preLongTaskObserver:o.props.preLongTaskObserver}),o.ttiMonitor.setup(),null!==(t=null===(e=o.fmpMonitor)||void 0===e?void 0:e.setup)&&void 0!==t&&t.call(e,q))},this.stopAutoPerf=function(){o.performanceAuto=!1,clearTimeout(o.perfTimer)},this.getPerformance=function(){return o.finalSendParams.tti||("complete"===document.readyState?o.perfLog():o.perfLog(!0)),o.buildParams(o.finalSendParams)},this.buildParams=function(e){return{name:o.name,type:"post",event:e}},this.perfLog=function(e){if(void 0===e&&(e=!1),P()){if(o.initFlag=!1,o.finalSendParams=p({},o.sendParams),!o.sendParams.isAsync){var t=o.getBounced();if(t)return o.finalSendParams.bounced=t,void o.invokeCallback(0,o.buildParams(o.finalSendParams));o.finalSendParams=p(p({},o.finalSendParams),o.getParams())}var r=o.getStaticResources(),n=o.getFMP(),t=o.getMPFID();r&&(o.finalSendParams.resources=r,o.finalSendParams.has_resource=1),n&&(o.finalSendParams.fmp=Math.round(n)),n&&o.finalSendParams.fcp&&o.finalSendParams.fmp<o.finalSendParams.fcp&&(o.finalSendParams.fmp=o.finalSendParams.fcp),t&&(o.finalSendParams.mpfid=t),f(o.callback)&&(!e&&o.ttiMonitor&&f(o.ttiMonitor.getTTI)?o.ttiMonitor.getTTI(function(e){e&&0<e&&(o.finalSendParams.tti=o.finalSendParams.isAsync?Math.round(e-o.initStart):e),o.invokeCallback(o.finalSendParams.isAsync,o.buildParams(o.finalSendParams))}):o.invokeCallback(o.finalSendParams.isAsync,o.buildParams(o.finalSendParams)))}},this.invokeCallback=function(e,t){if(!e){if(o.hasSentInitPerf)return;o.hasSentInitPerf=!0}o.callback(t)},this.getStaticResources=function(){var e;if(o.staticPerformanceMonitor&&f(o.staticPerformanceMonitor.getResourcePerformance)){var t=o.staticPerformanceMonitor.getResourcePerformance();if(null!==(e=null==t?void 0:t.event)&&void 0!==e&&e.resources)return t.event.resources||[]}},this.getFMP=function(){var e,t;return o.fmpMonitor?(o.fmpMonitor.disconnect(),o.sendParams.isAsync?(null===(e=null==(t=o.fmpMonitor.getFmp())?void 0:t.event)||void 0===e?void 0:e.fmp)||0:f(o.fmpMonitor.getLoadFmp)?1!==o.props.renderType?2===o.props.renderType?o.getPaintTime("first-contentful-paint"):0:null!==(t=null===(t=(t=o.fmpMonitor.getLoadFmp()||{}).event)||void 0===t?void 0:t.fmp)&&void 0!==t?t:0:0):0},this.getMPFID=function(){if(o.mpfidMonitor&&f(o.mpfidMonitor.getMPFID)){var e=o.mpfidMonitor.getMPFID();if(e)return e.mpfid}},this.syncPerfLog=function(){var e,t;o.hasSentInitPerf||(o.perfLog(!0),null!==(t=(e=o.props).report)&&void 0!==t&&t.call(e))},this.hasFID=function(e){o.sendParams.fid=e.fid},this.getParams=function(){if(P()){var e={},t=window.performance.timing;e.dns=t.domainLookupEnd-t.domainLookupStart,e.tcp=t.connectEnd-t.connectStart,e.request=t.responseStart-t.requestStart,e.response=t.responseEnd-t.responseStart,e.processing=t.domComplete-t.domLoading,e.blank=t.responseEnd-t.navigationStart,e.domready=t.domInteractive-t.navigationStart,e.load=t.loadEventEnd-t.navigationStart,t.secureConnectionStart&&(e.ssl=t.connectEnd-t.secureConnectionStart),e.domparse=t.domInteractive-t.responseEnd,e.resource=t.loadEventStart-t.domContentLoadedEventEnd,e.ttfb=t.responseStart-t.requestStart,e.redirect=t.redirectEnd-t.redirectStart;var r=o.getPaintTime("first-paint"),t=o.getPaintTime("first-contentful-paint");r&&(e.fp=Math.round(r)),t&&(e.fcp=Math.round(t));r=function(){if(!E())return null;var e=window.performance.getEntriesByType("navigation");return c(e)&&0!==e.length?e[0]:null}(),t=P()?window.performance.timing:null;return(r||t)&&(e.navigation=null!=r?r:t),t&&(e.timing=t),r&&(e.navigation_timing=r),e}},e.fmpMonitor&&(this.fmpMonitor=e.fmpMonitor);var t=e.performanceAuto;this.performanceAuto=void 0===t||t,this.props=null!=e?e:{}}var De="StaticErrorMonitor",Fe=(Be.prototype.setup=function(e){M()&&(this.callback=e,window.addEventListener("error",this.staticErrorLog.bind(this),!0))},Be.prototype.getSrc=function(e){return"link"===e.tagName.toLowerCase()?Ne(e,"href"):Ne(e,"src")},Be.prototype.getParams=function(e,t){var r={ev_type:"static",st_type:t},t=L(e);r.st_src=e,r.st_protocol=t.protocol,r.st_domain=t.hostname,r.st_path=t.pathname;t=function(e){var t,r=null===(t=null===(n=window.performance)||void 0===n?void 0:n.getEntriesByType)||void 0===t?void 0:t.call(n,"resource"),n=null==r?void 0:r.length;if(!n)return;for(var o=n-1;-1<o;o--){var i=r[o];if(i.name===e)return i}}(t.href);return t&&(r.timing=t),r},Be.monitorName=De,Be);function Be(){var i=this;this.name=De,this.callback=q,this.buildEvent=function(e){var t,r,n=e||window.event||{};try{r=null!==(t=null!==(t=n.target)&&void 0!==t?t:n.srcElement)&&void 0!==t?t:{}}catch(n){return}var o=r.tagName;if(o&&m(o)){o=o.toLowerCase();e=i.getSrc(r);if(e&&e!==window.location.href)return{name:i.name,type:"get",event:i.getParams(e,o)}}},this.staticErrorLog=function(e){e=i.buildEvent(e);e&&i.callback(e)}}function Ne(e,t){var r;return e.getAttribute&&f(e.getAttribute)?null!==(r=e.getAttribute(t))&&void 0!==r?r:"":null!==(t=e[t])&&void 0!==t?t:""}var Je="EmitMonitor",Ue=(Xe.prototype.setup=function(e){this.callback=e||q},Xe.prototype.buildCustomTimeLog=function(e,t,r){return function(e){var t=e.name,r=e.tag,e=e.value;if(t&&e){e={ev_type:"custom",cm_name:t=f(t.toString)?t.toString():"",cm_type:"time",cm_value:e=+e};return r&&(r=f(r.toString)?r.toString():"",e.cm_tag=r),{name:"SentCustomTime",type:"get",event:e}}}({name:e,tag:t,value:r})},Xe.prototype.buildCustomCountLog=function(e,t){return function(e){var t=e.name,e=e.tag;if(t){t={ev_type:"custom",cm_name:t=f(t.toString)?t.toString():"",cm_type:"count"};return e&&(e=f(e.toString)?e.toString():"",t.cm_tag=e),{name:"SentCustomCount",type:"get",event:t}}}({name:e,tag:t})},Xe.prototype.buildEmitSingleEvent=function(e){e=ie(e);if(e&&(!e||e.event_name))return{name:this.name,type:"post",event:{ev_type:"flexible",flexible_data_list:[e]}}},Xe.monitorName=Je,Xe);function Xe(){var o=this;this.name=Je,this.callback=q,this.handOut=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=o.buildEvent.apply(o,s(e));o.callback(r)},this.buildEvent=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if("sendCustomCountLog"===e[0])return o.buildCustomCountLog(e[1],e[2]);if("sendCustomTimeLog"===e[0])return o.buildCustomTimeLog(e[1],e[2],e[3]);if("send"===e[0]){if("count"===e[1])return o.buildCustomCountLog(e[2].category,e[2].action);if("timing"===e[1])return o.buildCustomTimeLog(e[2].category,e[2].action,e[2].value)}if("emit"===e[0]&&e[1]&&e[2]){var r={type:e[1],event:e[2]};return o.buildEmitSingleEvent(r)}},this.send=function(e,t,r){var n=r.action,r=r.value;"count"===e&&o.sendCustomCountLog(t,n),"timing"===e&&o.sendCustomTimeLog(t,n,r)},this.sendCustomTimeLog=function(e,t,r){r=o.buildCustomTimeLog(e,t,r);o.callback(r)},this.sendCustomCountLog=function(e,t){t=o.buildCustomCountLog(e,t);return o.callback(t),t},this.emitEvent=function(e){e=o.buildEmitSingleEvent(e);o.callback(e)}}var Qe="BreadcrumbMonitor",ze=(Ve.prototype.setup=function(){this.instrumentDOM()},Ve.prototype.instrumentDOM=function(){var e;"document"in window&&(e=this,window.document.addEventListener("click",e.domEventHandler("click",e.triggerHandlers.bind(e,"dom")),!1),window.document.addEventListener("keypress",e.keypressEventHandler(e.triggerHandlers.bind(e,"dom")),!1))},Ve.prototype.domEventHandler=function(t,r,n){var o=this;return void 0===n&&(n=!1),function(e){o.keypressTimeout=void 0,e&&o.lastCapturedEvent!==e&&(o.lastCapturedEvent=e,o.debounceTimer&&clearTimeout(o.debounceTimer),n?o.debounceTimer=setTimeout(function(){r({event:e,name:t})}):r({event:e,name:t}))}},Ve.prototype.triggerHandlers=function(e,t){if(e)try{this.domBreadcrumb(t)}catch(e){}},Ve.prototype.keypressEventHandler=function(n){var o=this;return function(e){var t;try{t=e.target}catch(e){return}var r=t&&t.tagName;r&&("INPUT"===r||"TEXTAREA"===r||t.isContentEditable)&&(o.keypressTimeout||o.domEventHandler("input",n)(e),clearTimeout(o.keypressTimeout),o.keypressTimeout=window.setTimeout(function(){o.keypressTimeout=void 0},o.debounceDuration))}},Ve.prototype.domBreadcrumb=function(e){var t;try{t=e.event.target?_e(e.event.target):_e(e.event)}catch(e){t="<unknown>"}0!==t.length&&this.addBreadcrumb({category:"ui."+e.name,message:t})},Ve.monitorName=Qe,Ve);function Ve(e){var n=this;this.name=Qe,this.breadcrumbs=[],this.getBreadcrumbs=function(){return n.breadcrumbs},this.addBreadcrumb=function(e){var t=p(p({},e),{timestamp:(new Date).getTime()}),r=n.maxBreadcrumbs,e=n.breadcrumbs;return n.breadcrumbs=0<=r?s(e,[t]).slice(-r):s(e,[t]),n},this.debounceDuration=1e3,this.debounceTimer=0,this.breadcrumbs=[],this.maxBreadcrumbs=null!==(e=null==e?void 0:e.maxBreadcrumbs)&&void 0!==e?e:20}var Ke={enableCatchGlobalJSError:!0},We="JSExceptionMonitor",Ge=($e.prototype.setup=function(e){M()&&(this.callback=e,this.options.enableCatchGlobalJSError&&(window.addEventListener("error",this.jsErrorLog),window.addEventListener("unhandledrejection",this.jsPromiseRejectionLog)))},$e.prototype.buildEvent=function(e){if(!function(e){switch(Object.prototype.toString.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":return 1;default:return e instanceof Error}}(e)?(r(e)&&(t={message:JSON.stringify(e)}),m(e)&&(t={message:e})):t=e,t){var t={ev_type:"js_exception",exception:this.normalizeError(t),breadcrumbs:null!==(t=null===(t=this.options.breadcrumbMonitor)||void 0===t?void 0:t.getBreadcrumbs())&&void 0!==t?t:[]};return{name:this.name,type:"post",event:t}}},$e.prototype.logError=function(e){e=this.buildEvent(e);e&&this.callback(e)},$e.prototype.getJSError=function(e){e=e.error;if(e)return e},$e.prototype.getJSPromiseRejection=function(e){var t=void 0;try{"reason"in e?t=e.reason:"detail"in e&&"reason"in e.detail&&(t=e.detail.reason)}catch(e){}if(t)return t},$e.prototype.normalizeError=function(e){return{message:e.message,name:e.name,fileName:e.fileName,lineNumber:e.lineNumber,columnNumber:e.columnNumber,stack:e.stack,stacktrace:e.stacktrace,framesToPop:e.framesToPop}},$e.monitorName=We,$e);function $e(e){var t=this;this.name=We,this.callback=q,this.jsErrorLog=function(e){e=t.getJSError(e);e&&t.logError(e)},this.jsPromiseRejectionLog=function(e){e=t.getJSPromiseRejection(e);e&&t.logError(e)},this.options=p(p({},Ke),e)}var Ye=(Ze.prototype.sendEvent=function(e){e=this.getEventToBeSent(e);e&&this.idleSendEvent(e)},Ze.prototype.getEventToBeSent=function(e){e=this._modifyEvent(e);if(this._shouldSend(e))return e},Ze.prototype._modifyEvent=function(e){return e},Ze.prototype._shouldSend=function(e){return!0},Ze.prototype._send=function(e){},Ze.prototype.idleSendEvent=function(e){this._send(e)},Ze);function Ze(){}var et,tt=(e(rt,et=Ye),Object.defineProperty(rt.prototype,"ready",{get:function(){return this.isReady},set:function(e){this.isReady=e,this.isReady&&this._uploadQueue()},enumerable:!1,configurable:!0}),rt.prototype._send=function(e){var t=this,e=this.buildParams(e);null!=e&&(this.reportQueue.push(e),this.isReady&&(this.reportQueue.length>=this.batchReportLength&&this._uploadQueue(),this.batchReportTimeout&&clearTimeout(this.batchReportTimeout),this.batchReportTimeout=setTimeout(function(){t._uploadQueue()},this.batchReportWait)))},rt.prototype._uploadQueue=function(){var e;this.reportQueue.length&&this.ready&&(e={ev_type:"batch",list:this.reportQueue},this.reportQueue=[],this._request({event:e,type:"post"}))},rt.prototype._request=function(e){},rt);function rt(e){var t,r=et.call(this)||this;return r.reportQueue=[],r.isReady=!0,r.batchReportLength=null!==(t=e.maxBatchReportLength)&&void 0!==t?t:10,r.batchReportWait=null!==(e=e.batchReportWait)&&void 0!==e?e:1e3,r.batchReportTimeout=null,r}var nt="RANGERS_WEB_ID";function ot(){var e={flags:{hookPath:!0,hookXHR:!0,hookFetch:!0,enableSizeStats:!0,enableFMP:!0,enablePerformance:!0,enableResourcePerformance:!0,enableStaticError:!0,enableCatchJSError:!0,enableCatchGlobalJSError:!0,enableCatchJSErrorV2:!1,enableCrash:!0,enableMemoryRecord:!0,enableFPSJankTimesMonitor:!0,enableBreadcrumb:!0,hookConsole:!1,hookDom:!0}};return e.monitors={BaseMonitor:{appTypeSetting:{type:0,SPA:"",renderType:0},sampleHit:U(1)},JSErrorMonitor:{enable:!0,webIDHit:!0,sampleRate:1,webIDHitBehavior:!1,sampleHitBehavior:!1,ignoreErrors:[],whitelistUrls:[],blacklistUrls:[],download_link:""},AjaxMonitor:{enable:!0,enableError:!1,webIDHit:!0,sampleHit:U(1),sampleRate:1,sampleHitTrace:!1,ignore:te,abort:!1,whitelistUrls:[],statusCodeSample:{},requestUrlSample:[],errorRequestCollect:!1},PerformanceMonitor:{enable:!0,webIDHit:!0,sampleRate:1,webIDHitStaticResource:!1,sampleHitStaticResource:U(ee),slowSessionTime:re,spaSlowSessionTime:ne,geckoUrls:[],interval:0,checkPoint:[]},StaticErrorMonitor:{enable:!0,webIDHit:!0,sampleRate:1,ignore:te},ResourcePerformanceMonitor:{enable:!0,webIDHit:!0,sampleRate:1},BreadcrumbMonitor:{enable:!0},EmitMonitor:{enable:!0}},e.custom={},e.commonParams={aid:0,pid:"",version:"0.2.23",hostname:window.location.hostname,protocol:window.location.protocol.slice(0,-1),rangers_web_id:ct(Y()),rangers_session_id:Y(),context:{},url:window.location.href,timestamp:Date.now(),screen_resolution:N(),network_type:J()},e}var it,at,st,ut,ct=function(e){return null!==document&&void 0!==document&&document.cookie&&(e=D(document.cookie,nt)),e},lt=(it="/v2/user/webid",at="/v2/user/ssid",st="/v2/event/list",ut=[],["https://mcs.ctobsnssdk.com","https://mcs.itobsnssdk.com","https://mcs.tobsnssdk.com"].forEach(function(t){[it,at,st].forEach(function(e){ut.push(t+e)})}),ut);function pt(e){var t=e.sendParams,e=e.monitorsSetting;if(!t||!u(t)||!t.event)return!1;var r,n,e=e;if("AjaxMonitor"===t.name||"FetchMonitor"===t.name){var o=F(s(["/monitor_browser/collect"],lt)||[]);if(o&&o.test(t.event.ax_url))return!1}return!(null==e||!e.BaseMonitor.sampleHit)&&("AjaxMonitor"===t.name||"FetchMonitor"===t.name?function(e){var r=e.sendParams,t=e.ajaxMonitor;if(!t)return!0;if("2"!==r.event.ax_status[0]&&"3"!==r.event.ax_status[0])return t.enableError;if(!t.enable)return!1;if(!t.webIDHit)return!1;if(!t.sampleHit||!U(t.sampleRate))return!1;if(c(e=t.whitelistUrls)&&0<e.length){var n=F(t.whitelistUrls||[]);return n&&n.test(r.event.ax_url)?!0:!1}if((n=F(t.ignore||[]))&&n.test(r.event.ax_url))return!1;if((n=t.statusCodeSample)&&d(n,r.event.ax_status))return U(n[r.event.ax_status]);if(t=t.requestUrlSample){var o=!1,i=!1;if(t.forEach(function(e){var t;o||null!=(t=F([e.url]))&&t.test(r.event.ax_url)&&(o=!0,i=U(e.sampleRate))}),o)return i}return!0}({sendParams:t,ajaxMonitor:e.AjaxMonitor}):"PerformanceMonitor"===t.name?!(r=(r={performanceMonitor:e.PerformanceMonitor}).performanceMonitor)||!!r.enable&&(!!r.webIDHit&&U(r.sampleRate)):"StaticErrorMonitor"===t.name?(o={sendParams:t,staticErrorMonitor:e.StaticErrorMonitor},r=o.sendParams,!(o=o.staticErrorMonitor)||!!o.enable&&(!!o.webIDHit&&(!!U(o.sampleRate)&&!((o=F(o.ignore||[]))&&o.test(r.event.st_src))))):"JSExceptionMonitor"===t.name?!(n=(n={jsErrorMonitor:e.JSErrorMonitor}).jsErrorMonitor)||!!n.enable&&(!!n.webIDHit&&U(n.sampleRate)):"ResourcePerformanceMonitor"===t.name?!(n=(n={resourcePerformanceMonitor:e.ResourcePerformanceMonitor}).resourcePerformanceMonitor)||!!n.enable&&(!!n.webIDHit&&U(n.sampleRate)):"EmitMonitor"!==t.name||!!{emitMonitor:e.EmitMonitor}.emitMonitor)}function ht(e){var t=e.sendParams,r=e.commonParams,n=e.custom,e=e.breadcrumbMonitor,e=function(e){var t=e.sendParams,r=e.commonParams,n=e.breadcrumbMonitor;if((e={}).ev_type=t.event.ev_type,e.common=r,"PageViewMonitor"===t.name&&e)return e;if(("AjaxMonitor"===t.name||"FetchMonitor"===t.name)&&e){r=t.event,r=(r.ev_type,a(r,["ev_type"]));return e.event=r,e}if("PerformanceMonitor"===t.name&&e){t.event.navigation=t.event.navigation_timing;var o=t.event,o=(o.ev_type,a(o,["ev_type"]));return e.ev_type="performance",e.event={fp:o.fp,fcp:o.fcp,fmp:o.fmp,tti:o.tti,fid:o.fid,mpfid:o.mpfid,isAsync:o.isAsync,timing:o.timing,navigation:o.navigation_timing,bounced:o.bounced},e}if("StaticErrorMonitor"===t.name&&e){e.ev_type="resource_error";o=t.event,o=(o.ev_type,a(o,["ev_type"]));return e.event=o,e}if("ResourcePerformanceMonitor"===t.name&&e){e.ev_type="resource";var i=t.event,i=(i.ev_type,a(i,["ev_type"]));return e.event=i,e}if("JSExceptionMonitor"===t.name&&e){e.ev_type="js_error";i=t.event,i=(i.ev_type,a(i,["ev_type"]));return e.event=i.exception,e.breadcrumbs=null!==(n=null==n?void 0:n.getBreadcrumbs())&&void 0!==n?n:[],e}return"EmitMonitor"===t.name&&e&&(e.ev_type="flexible",e.flexible_data_list=t.event.flexible_data_list),e}({sendParams:t,commonParams:p(p({},null!=r?r:{}),{url:window.location.href}),breadcrumbMonitor:e});return n&&f(n.beforeSend)&&(e=n.beforeSend(e||{})),e}function ft(e){return"https://"+e+"/monitor_browser/collect"}var mt,dt=(e(vt,mt=tt),vt.prototype._shouldSend=function(e){return pt({sendParams:e,monitorsSetting:this.options.monitorsSetting})},vt.prototype._modifyEvent=function(e){return(e=(e={sendParams:e}).sendParams)&&u(e)?e:{}},vt.prototype._request=function(e){var t,r;e&&e.event&&(t=e.type,r=e.event,"beacon"===this.options.reportType&&navigator&&navigator.sendBeacon?(e=JSON.stringify(r),navigator.sendBeacon(this.getReportURL(),e)):this.transport&&("get"!==t?"post"===t&&this.transport.postEvent(r):this.transport.getEvent(r)))},vt.prototype.buildParams=function(e){var t,r=null===(t=null===(t=this.options.monitorsSetting)||void 0===t?void 0:t.BreadcrumbMonitor)||void 0===t||!t.enable||null===(r=this.options.monitors)||void 0===r?void 0:r.BreadcrumbMonitor;return ht({sendParams:e,commonParams:this.options.commonParams,custom:this.options.custom,breadcrumbMonitor:r})},vt.prototype.getReportURL=function(){return this.reportURL},vt);function vt(e){var o=mt.call(this,e)||this;return o.options={},o.setTransport=function(){o.transport=new X({reportURL:o.getReportURL()}),o.preQueue.forEach(function(e){mt.prototype.sendEvent.call(o,e)})},o.updateConfig=function(e){var t,r,n;o.options=(t={previousOptions:o.options,newOptions:e},r=t.previousOptions,n=t.newOptions,(e=p(p({},r),n)).commonParams=i({},null!==(t=r.commonParams)&&void 0!==t?t:{},null!==(t=n.commonParams)&&void 0!==t?t:{}),e.monitorsSetting=i({},null!==(t=r.monitorsSetting)&&void 0!==t?t:{},null!==(t=n.monitorsSetting)&&void 0!==t?t:{}),e.monitors=p(p({},null!==(t=r.monitors)&&void 0!==t?t:{}),null!==(t=n.monitors)&&void 0!==t?t:{}),e.custom=p(p({},null!==(r=r.custom)&&void 0!==r?r:{}),null!==(n=n.custom)&&void 0!==n?n:{}),e)},o.sendEvent=function(e){o.transport?mt.prototype.sendEvent.call(o,e):o.preQueue.push(e)},o.uploadQueue=function(){o._uploadQueue()},o.reportURL=null!==(e=null==e?void 0:e.reportURL)&&void 0!==e?e:"",o.preQueue=[],o}gt.getClientCommonParams=function(r){void 0===r&&(r={});var n={};if(!u(r))return n;var o=["context","pid"];t(r,function(e,t){w(o,e)&&(n[e]=t)});return t({user_unique_id:"rangers_web_id",app_id:"aid"},function(e,t){d(r,e)&&(n[t]=r[e])}),n},gt.getClientFlags=function(e){void 0===e&&(e={});var r={};if(!u(e))return r;var n=["hookPath","hookXHR","hookFetch","enableSizeStats","enableFMP","enablePerformance","enableStaticError","enableCatchJSError","enableCatchJSErrorV2","enableCatchGlobalJSError","enableResourcePerformance","enableCrash","enableMemoryRecord","enableFPSJankTimesMonitor","enableBreadcrumb","hookConsole"];return t(e,function(e,t){w(n,e)&&(r[e]=t)}),r},gt.getClientCustom=function(e){var t={};return e.beforeSend&&f(e.beforeSend)&&(t.beforeSend=e.beforeSend),t},gt.getClientMonitorsSetting=function(e){return e=(t={setting:e}).setting,t={JSErrorMonitor:{},PerformanceMonitor:{},BreadcrumbMonitor:{},StaticErrorMonitor:{},ResourcePerformanceMonitor:{},BaseMonitor:{appTypeSetting:{}},AjaxMonitor:{}},e.ajaxWhitelistUrls&&c(e.ajaxWhitelistUrls)&&(t.AjaxMonitor.whitelistUrls=(t.AjaxMonitor.whitelistUrls||[]).concat(e.ajaxWhitelistUrls)),e.ignoreAjax&&c(e.ignoreAjax)&&(t.AjaxMonitor.ignore=(t.AjaxMonitor.ignore||[]).concat(e.ignoreAjax)),e.ignoreStatic&&c(e.ignoreStatic)&&(t.StaticErrorMonitor.ignore=(t.StaticErrorMonitor.ignore||[]).concat(e.ignoreStatic)),e.ignoreErrors&&c(e.ignoreErrors)&&(t.JSErrorMonitor.ignoreErrors=e.ignoreErrors),e.errorBlacklistUrls&&c(e.errorBlacklistUrls)&&(t.JSErrorMonitor.blacklistUrls=e.errorBlacklistUrls),e.errorWhitelistUrls&&c(e.errorWhitelistUrls)&&(t.JSErrorMonitor.whitelistUrls=e.errorWhitelistUrls),d(e,"sampleRate")&&(t.BaseMonitor.sampleHit=U(e.sampleRate)),t;var t},gt.prototype.configure=function(e){if(u(e)){if(this.userConfig=p(p({},this.userConfig||{}),e||{}),!this.serverDomain){if(!this.userConfig.serverDomain)return void console.error('"serverDomain" must be configured');this.serverDomain=this.userConfig.serverDomain}this.updateCurrentSetting(),this.client?this.updateClientConfig(this.getClientOptions()):this.init()}},gt.prototype.emitEvent=function(e){var t;this.monitors.EmitMonitor&&(t=this.monitors.EmitMonitor).handOut.apply(t,s(e))},gt.prototype.init=function(){var t=this,r=this.getClientOptions();this.client=new dt(r),this.getUserIDFromRangers(function(e){t.finderSetting={user_unique_id:e.user_unique_id},t.updateCurrentSetting(),t.updateClientConfig(r)}),this.sendPageview(),this.setupMonitors(this.setMonitors()),this.getServerSetting()},gt.prototype.getServerSetting=function(){var t=this;if(this.serverSetting)return this.updateCurrentSetting(),void this.afterServerSetting();var e="https://"+this.serverDomain+"/settings/get/web?aid="+this.currentSetting.commonParams.aid;X.get(e,{success:function(e){try{t.serverSetting=e.data,t.updateCurrentSetting(),t.afterServerSetting()}catch(e){t.afterServerSetting()}},fail:function(){t.afterServerSetting()}})},gt.prototype.afterServerSetting=function(){this.updateClientConfig(this.getClientOptions()),this.client.setTransport()},gt.prototype.updateCurrentSetting=function(){var e={commonParams:gt.getClientCommonParams(this.finderSetting),flags:gt.getClientFlags({}),custom:gt.getClientCustom({}),monitors:gt.getClientMonitorsSetting({})},t={commonParams:gt.getClientCommonParams({}),flags:gt.getClientFlags({}),custom:gt.getClientCustom({}),monitors:this.serverSetting?(r=this.serverSetting,n={JSErrorMonitor:{},PerformanceMonitor:{},BreadcrumbMonitor:{},StaticErrorMonitor:{},BaseMonitor:{},ResourcePerformanceMonitor:{},AjaxMonitor:{}},(r=r.setting).jserr&&(n.JSErrorMonitor.enable=r.jserr.enable,n.JSErrorMonitor.webIDHit=U(r.jserr.enable_user_rate),n.JSErrorMonitor.sampleRate=r.jserr.enable_sample_rate),r.performance&&(n.PerformanceMonitor.enable=r.performance.enable,n.PerformanceMonitor.webIDHit=U(r.performance.enable_user_rate),n.PerformanceMonitor.sampleRate=r.performance.enable_sample_rate),r.breadcrumb&&(n.BreadcrumbMonitor.enable=r.breadcrumb.enable),r.static_resource_error&&(n.StaticErrorMonitor.enable=r.static_resource_error.enable),r.static_resource&&(n.ResourcePerformanceMonitor.enable=r.static_resource.enable,n.ResourcePerformanceMonitor.webIDHit=U(r.static_resource.enable_user_rate),n.ResourcePerformanceMonitor.sampleRate=r.static_resource.enable_sample_rate),r.request&&(n.AjaxMonitor.enable=r.request.enable,n.AjaxMonitor.enableError=r.request.enableError,n.AjaxMonitor.webIDHit=U(r.request.enable_user_rate),n.AjaxMonitor.sampleRate=r.request.enable_sample_rate),n):gt.getClientMonitorsSetting({})},r={commonParams:gt.getClientCommonParams(this.userConfig),flags:gt.getClientFlags(this.userConfig),custom:gt.getClientCustom(this.userConfig),monitors:gt.getClientMonitorsSetting(this.userConfig)},n=this.currentSetting;this.currentSetting=o({},this.defaultSetting,t,r,e),this.currentSetting.commonParams.pid=this.currentSetting.commonParams.pid||location.pathname,this.settingEffect(this.currentSetting,n)},gt.prototype.settingEffect=function(e,t){var r;(r=e.commonParams.rangers_web_id)!==D(document.cookie,nt)&&(document.cookie=nt+"="+r+";max-age=7776000;domain="+location.hostname+";path=/"),t.commonParams.pid!==e.commonParams.pid&&this.sendPageview()},gt.prototype.setMonitors=function(){var t,e=this.currentSetting.commonParams,r=e.aid,n=e.rangers_web_id,o=[],i=this.currentSetting.flags,e=new me;return o.push(e),o.push(new Ue),i.enableCatchJSError&&o.push(new Ge),i.hookXHR&&o.push(new se({commonParams:{bid:r+"",web_id:n},ajaxMonitorOptions:this.currentSetting.monitors.AjaxMonitor})),i.hookFetch&&o.push(new pe({commonParams:{bid:r+"",web_id:n},ajaxMonitorOptions:this.currentSetting.monitors.AjaxMonitor})),i.enableStaticError&&o.push(new Fe),i.enablePerformance&&(i.enableFMP?o.push(new Ae({fmpMonitor:e,renderType:1,preLongTaskObserver:{precollect:[],observer:void 0}})):o.push(new Ae({renderType:1,preLongTaskObserver:{precollect:(null===(e=window.RangersSiteSDK.lt)||void 0===e?void 0:e.e)||[],observer:null===(e=window.RangersSiteSDK.lt)||void 0===e?void 0:e.o}}))),i.enableBreadcrumb&&o.push(new ze),i.enableResourcePerformance&&(t=this.serverDomain,o.push(new Oe({observe:!0,checkIgnore:function(e){return e.name===ft(t)||("xmlhttprequest"===e.initiatorType||"fetch"===e.initiatorType||"beacon"===e.initiatorType||"navigation"===e.initiatorType||0===e.decodedBodySize)}}))),o},gt.prototype.setupMonitors=function(e){var t=this;this.client&&this.client.sendEvent&&(e.forEach(function(e){"FMPMonitor"===(t.monitors[e.name]=e).name?e.setup(q):e.setup(null===(e=t.client)||void 0===e?void 0:e.sendEvent)}),this.updateClientConfig({monitors:this.monitors}))},gt.prototype.getUserIDFromRangers=function(t){window.collectEvent&&f(window.collectEvent)&&window.collectEvent("getToken",function(e){t(e)})},gt.prototype.sendPageview=function(){var e;null!==(e=this.client)&&void 0!==e&&e.sendEvent({name:"PageViewMonitor",event:{ev_type:"pageview"},type:"post"})},gt.prototype.getClientOptions=function(){var e=this.currentSetting;return{reportURL:ft(this.serverDomain),monitorsSetting:e.monitors,commonParams:e.commonParams,custom:e.custom}},gt.prototype.uploadClientQueue=function(){var e;null!==(e=this.client)&&void 0!==e&&e.uploadQueue()},gt.prototype.updateClientConfig=function(e){var t;null!==(t=this.client)&&void 0!==t&&t.updateConfig(e)},Ye=gt;function gt(){var r=this;this.version="0.2.23",this.serverDomain="",this.instance=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];"config"!==e[0]?"emit"!==e[0]?"report"!==e[0]?r.initOnCloseCallback():r.uploadClientQueue():r.emitEvent(e):r.configure(e[1])},this.initOnCloseCallback=function(){B(r.onCloseReport,r.visibilityChange)},this.visibilityChange=function(){"hidden"===document.visibilityState&&r.onCloseReport(),"visible"===document.visibilityState&&r.updateClientReportType("xhr")},this.onCloseReport=function(){r.updateClientReportType("beacon"),r.uploadClientQueue()},this.updateClientReportType=function(e){var t;null!==(t=r.client)&&void 0!==t&&t.updateConfig({reportType:e})},this.userConfig={},this.defaultSetting=ot(),this.currentSetting=this.defaultSetting,this.serverSetting=void 0,this.finderSetting={},this.client=void 0,this.monitors={}}var bt=q;return M()&&(tt=new Ye,bt=tt.instance,null!==(Ye=window.RangersSiteSDK)&&void 0!==Ye&&Ye.q&&(c(Ye=window.RangersSiteSDK.q)&&Ye.forEach(function(e){bt.apply(void 0,s(e))}),delete window.RangersSiteSDK.q),window.RangersSiteSDK=tt.instance),bt}(); |
@@ -1,1 +0,1 @@ | ||
var RangersSiteHybridSDK=function(){"use strict";var r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};var p=function(){return(p=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function a(e,t){var r={};for(o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(r[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var n=0,o=Object.getOwnPropertySymbols(e);n<o.length;n++)t.indexOf(o[n])<0&&Object.prototype.propertyIsEnumerable.call(e,o[n])&&(r[o[n]]=e[o[n]]);return r}function v(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function f(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),a=[];try{for(;(void 0===t||0<t--)&&!(n=i.next()).done;)a.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a}function s(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(f(arguments[t]));return e}function c(e){return"object"==typeof e&&null!==e&&!u(e)}function n(e){return"[object Object]"===(e=e,Object.prototype.toString.call(e))}function m(e){return"function"==typeof e}function d(e){return"[object String]"===Object.prototype.toString.call(e)}function u(e){return"[object Array]"===Object.prototype.toString.call(e)}function l(e){return"number"==typeof e}function h(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function t(e,t){if(c(e))for(var r in e)h(e,r)&&t.call(null,r,e[r])}function i(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var r={},n=0;n<e.length;)r=function(e,t){var r,n=p({},e);for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&void 0!==t[r]&&(c(t[r])&&y(t[r])?n[r]=b(c(e[r])?e[r]:{},t[r]):u(t[r])?n[r]=t[r].slice():n[r]=t[r]);return n}(r,e[n]),n++;return r}function o(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var r={},n=0;n<e.length;)r=b(r,e[n]),n++;return r}var g=Object.getPrototypeOf?Object.getPrototypeOf({}):null;function y(e){return Object.getPrototypeOf?Object.getPrototypeOf(e)===g:e.constructor===Object}function b(e,t){var r,n=p({},e);for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&void 0!==t[r]&&(c(t[r])&&y(t[r])?n[r]=b(c(e[r])?e[r]:{},t[r]):u(e[r])||u(t[r])?n[r]=function t(e,r){var e=u(e)?e:[];var r=u(r)?r:[];return Array.prototype.concat.call(e,r).map(function(e){return!(e instanceof RegExp)&&(u(e)||c(e)&&y(e))?u(e)?t([],e):b({},e):e})}(e[r],t[r]):n[r]=t[r]);return n}function w(e,t){if(!u(e))return!1;if(0===e.length)return!1;for(var r=0;r<e.length;){if(e[r]===t)return!0;r++}return!1}function S(){if("fetch"in window)try{return new Headers,new Request(""),new Response,1}catch(e){return}}function M(){return!!c(window)}function e(){return M()&&!!c(window.performance)}function P(){return e()&&!!c(window.performance.timing)}function E(){return!!e()&&!!m(window.performance.getEntries)}function _(){return M()&&"function"==typeof window.MutationObserver}function T(){return M()&&"function"==typeof window.PerformanceObserver}function k(){return!!T()&&m(window.PerformanceLongTaskTiming)}function C(){if(!T())return!1;var e=window.PerformanceObserverEntryList;return m(e)&&m(e.prototype.getEntries)}function x(e){var r,e=function(e){if(!c(e))return{};var r={};return t(e,function(e,t){c(t)||u(t)?r[e]=JSON.stringify(t):r[e]=t}),r}(e),e=(r={},t(e,function(e,t){r[encodeURIComponent(e)]=encodeURIComponent(t)}),r),n=[];return t(e,function(e,t){n.push(e+"="+t)}),n.join("&")}function R(e){var t=document.createElement("a");t.href=e;e=t.pathname||"/";return"/"!==e[0]&&(e="/"+e),{href:t.href,protocol:t.protocol.slice(0,-1),hostname:t.hostname,host:t.host,search:t.search,pathname:e,hash:t.hash}}var L=function(e){if(!d(e))return!1;return m(e.toLowerCase)&&(e=e.toLowerCase()),w(["x-tt-token"],e)};function O(){}function j(e){var t="[object String]"===Object.prototype.toString.call(e);return e?t?e.length:ArrayBuffer&&e instanceof ArrayBuffer?e.byteLength:window.Blob&&e instanceof Blob?e.size:e.length||0:0}function q(e){if(!e)return"";if(!m(e.forEach))return"";var r=[];return e.forEach(function(e){var t;u(e)&&e[0]&&!L(e[0])&&(t=e[0],e=e[1]||"",r.push(t+": "+e))}),r.join("\r\n")}function H(e){var t={},r=R(e);return t.ax_protocol=r.protocol,t.ax_domain=r.hostname,t.ax_path=r.pathname,t.ax_url=(r.href||e).split("?")[0],t}function A(e,t){e=R(e),t=R(t);return e.protocol===t.protocol&&e.host===t.host}function I(e,t){var r,n;if(!e||!t)return"";var o=e.split(";"),i={};try{for(var a=v(o),s=a.next();!s.done;s=a.next()){var c=s.value.split("="),u=d(c[0])&&c[0].trim();u&&d(c[1])&&(i[u]=c[1].trim())}}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}return i[t]||""}function D(e){return u(e)&&e.length?function(e){for(var t=[],r=e.length,n=0;n<r;n++){var o=e[n];d(o)?t.push(o.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")):o&&o.source&&t.push(o.source)}return new RegExp(t.join("|"),"i")}(e):null}function F(t,r){m(t)&&(m(window.addEventListener)&&(window.addEventListener("unload",t),window.addEventListener("beforeunload",t),window.addEventListener("pagehide",t)),m(document.addEventListener)&&document.addEventListener("visibilitychange",function(e){m(r)?r(e):"hidden"===document.visibilityState&&t(e)}))}var B=function(e){var t,r;return void 0===e&&(e=window),M()&&null!==(t=e.screen)&&void 0!==t&&t.width&&null!==(r=e.screen)&&void 0!==r&&r.height?e.screen.width+"x"+e.screen.height:"0x0"},N=function(){var e="unknown",t=navigator.connection||navigator.mozConnection||navigator.webkitConnection;return t&&d(t.effectiveType)?t.effectiveType:e};function J(e){return!!e&&Math.random()<Number(e)}var U=(X.post=function(e,t,r){var n=r&&r.success||O,o=r&&r.fail||O,r=new XMLHttpRequest;r.open("POST",e,!0),r.setRequestHeader("Content-Type","application/json"),r.send(JSON.stringify(t)),r.onload=function(){try{var e;this.responseText?(e=JSON.parse(this.responseText),n(e)):n({})}catch(e){o()}},r.onerror=function(){o()},r.onabort=function(){o()}},X.get=function(e,t){var r=t&&t.success||O,n=t&&t.fail||O,o=t&&t.getResponse||O,i=t&&t.getResponseText||O,a=new XMLHttpRequest;t&&t.withCredentials&&(a.withCredentials=t.withCredentials),a.open("GET",e),a.send(),a.onload=function(){o(null==this?void 0:this.response),i(this.responseText);try{var e;this.responseText?(e=JSON.parse(this.responseText),r(e)):r({})}catch(e){n()}},a.onerror=function(){n()},a.onabort=function(){n()}},X.prototype.getCommonParams=function(){return{timestamp:Date.now()}},X);function X(e){var t=this;this.postEvent=function(e){e=p(p({},e),t.getCommonParams());X.post(t.url,e)},this.getEvent=function(e){e=x(p(p({},e),t.getCommonParams())),e=t.url+"?"+e;X.get(e)},this.getURL=function(){return t.url},this.options=e,this.url=this.options.reportURL}function z(e,t,r){if(void 0===r&&(r="0"),1<r.length)throw new TypeError("expect the length of pad to be 1, but got "+e.length);return e.length>=t?e:""+Array.from({length:t-e.length}).fill(r).join("")+e}function V(e){return e?Math.floor(Math.random()*Math.pow(10,12)).toString(16).substr(0,e):""}var K="x-tt-trace-id",G="x-tt-trace-host",Q="x-tt-logid";function W(e,t,r){void 0===r&&(r="01");t=""+z((Date.now()%4294967295).toString(16),8)+function(e){if("number"==typeof e)r=e;else{var t=e.replace(/-/g,"");if(!/^[0-9]+$/.test(t)){if(18<t.length)return"18"+V(18);e=22-t.length-4;return""+z(""+t.length,2)+t+V(e)}r=parseInt(t,10)}var r=22-(t=r.toString(16)).length-4;return""+z(""+t.length,2)+t+V(r)}(e)+("string"==typeof t?V(4):z(t.toString(16),4));return"00-"+t+"-"+t.substr(0,16)+"-"+r}function $(){var e=function(){for(var e=new Array(16),t=0,r=0;r<16;r++)0==(3&r)&&(t=4294967296*Math.random()),e[r]=t>>>((3&r)<<3)&255;return e}();return e[6]=15&e[6]|64,e[8]=63&e[8]|128,function(e){for(var t=[],r=0;r<256;++r)t[r]=(r+256).toString(16).substr(1);var n=0;return[t[e[n++]],t[e[n++]],t[e[n++]],t[e[n++]],"-",t[e[n++]],t[e[n++]],"-",t[e[n++]],t[e[n++]],"-",t[e[n++]],t[e[n++]],"-",t[e[n++]],t[e[n++]],t[e[n++]],t[e[n++]],t[e[+n]],t[e[15]]].join("")}(e)}function Y(){return m(Date)?Math.round(Date.now()/1e3):0}var Z=.1,ee=["/log/sentry/"],te=8e3,re=4e3;$(),$();function ne(e,r){if(!c(e))return{};if(!m(r))return{};var n={};return t(e,function(e,t){r(t)&&(n[e]=t)}),n}function oe(e){var t,r,n,o,i=null;return c(e)&&("timer"===e.type&&(i=c(t=e.event)&&d(t.name)&&l(t.value)?{metrics_type:"timer",event_name:"default",metrics:((r={})[t.name]=t.value,r),category:ne(t.tags,d),timestamp:Y()}:{}),"counter"===e.type&&(i=c(o=e.event)&&d(o.name)&&l(o.value)?{metrics_type:"counter",event_name:"default",metrics:((n={})[o.name]=o.value,n),category:ne(o.tags,d),timestamp:Y()}:{}),"log"===e.type&&(i=c(n=e.event)&&d(n.value)?{metrics_type:"log",event_name:"default",log_content:n.value,log_level:null!==(o=n.level)&&void 0!==o?o:"info",category:ne(n.tags,d),timestamp:Y()}:{}),"custom"===e.type&&(i=c(e=e.event)&&d(e.event_name)?{metrics_type:"custom",event_name:e.event_name,metrics:ne(e.metrics,l),category:ne(e.tags,d),timestamp:Y()}:{})),i}var ie="AjaxMonitor",ae=(se.prototype.setup=function(e){void 0===e&&(e=O),m(XMLHttpRequest)&&(this.callback=e,this.start())},se.prototype.updateConfig=function(e){this.props=o({},this.props,e)},se.prototype.start=function(){this.hookXMLHttpRequestOpen(),this.hookXMLHttpRequestSend(),this.hookXMLHttpRequestSetRequestHeader()},se.prototype.hookXMLHttpRequestSetRequestHeader=function(){var r=XMLHttpRequest.prototype.setRequestHeader||O;XMLHttpRequest.prototype.setRequestHeader=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this._requestHeaders=this._requestHeaders||[],this._requestHeaders.push(e),r.apply(this,e)}},se.prototype.hookXMLHttpRequestOpen=function(){var o=XMLHttpRequest.prototype.open;XMLHttpRequest.prototype.open=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=e[0],n=e[1];return this._url=n||"",this._method=(null==r?void 0:r.toLowerCase())||"",o.apply(this,e)}},se.prototype.hookXMLHttpRequestSend=function(){var o=this,i=XMLHttpRequest.prototype.send;XMLHttpRequest.prototype.send=function(){for(var e,t,r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];return o.checkAddTrace(this._url)&&(e=(t=null!==(e=null==o?void 0:o.props.commonParams)&&void 0!==e?e:{}).bid,t=t.web_id,e&&t&&(o.traceId=W(t,e),this.setRequestHeader(K,o.traceId))),o.hookXMLHttpRequestOnreadystatechange.call(this,o),this._start=Date.now(),this._data=null==r?void 0:r[0],i.apply(this,r)}},se.prototype.checkAddTrace=function(e){var t=null!==(n=this.props.commonParams)&&void 0!==n?n:{},r=t.bid,n=t.web_id,t=(null!==(t=this.props.ajaxMonitorOptions)&&void 0!==t?t:{}).sampleHitTrace,e=A(location.href,e);return r&&n&&t&&e},se.prototype.collectErrorRequest=function(){var e;return null!==(e=null===(e=this.props.ajaxMonitorOptions)||void 0===e?void 0:e.errorRequestCollect)&&void 0!==e&&e},se.prototype.hookXMLHttpRequestOnreadystatechange=function(i){var a=this.onreadystatechange,s=this;this.onreadystatechange=function(){for(var e,t,r,n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];if(4===this.readyState&&(t={ev_type:"ajax",ax_status:(this.status||0).toString(),ax_type:s._method,ax_request_header:q(s._requestHeaders||[]),ax_domain:"",ax_duration:0,ax_path:"",ax_protocol:"",ax_response_header:"",ax_size:0,ax_url:""},"function"==typeof this.getAllResponseHeaders&&(t.ax_response_header=function(t){if(d(t)){var e=t.split("\r\n"),r=[];return e.forEach(function(e,t){e&&m(e.split)&&(e=e.split(": "),r.push([e[0],e[1]]))}),q(r)}return c(t)?q(Object.keys(t).map(function(e){return[e,t[e]]})):t}(this.getAllResponseHeaders())),!i.checkAddTrace(s._url)||(r=null!==(r=i.traceId)&&void 0!==r?r:this.getResponseHeader(K))&&(t.trace_id=r,t.trace_host=null!==(e=this.getResponseHeader(G))&&void 0!==e?e:void 0,t.log_id=null!==(e=this.getResponseHeader(Q))&&void 0!==e?e:void 0),t.ax_duration=Date.now()-s._start,200===this.status&&(t.ax_size=function(e){var t=0;if(""===e.responseType||"text"===e.responseType)t=j(e.responseText);else if(e.response)t=j(e.response);else try{t=j(e.responseText)}catch(e){t=0}return t}(this)),t=p(p({},t),H(s._url)),i.collectErrorRequest()&&"2"!==t.ax_status[0]&&"3"!==t.ax_status[0]&&(t.ax_request={body:s._data?""+s._data:void 0,search:null===(e=R(s._url))||void 0===e?void 0:e.search,content_type:null===(e=null===(e=s._requestHeaders)||void 0===e?void 0:e.find(function(e){return"content-type"===e[0].toLowerCase()}))||void 0===e?void 0:e[1]}),m(i.callback)&&i.callback({name:i.name,type:"get",event:t})),a)return a.apply(this,n)}},se.monitorName=ie,se);function se(e){this.name=ie,this.callback=O,this.traceId=null,this.props=e}function ce(e){return e instanceof Request}var ue="FetchMonitor",le=(pe.prototype.updateConfig=function(e){this.props=o({},this.props,e)},pe.prototype.setup=function(e){void 0===e&&(e=O),S()&&(this.callback=e,this.start())},pe.prototype.start=function(){S()&&this.hookFetch()},pe.prototype.checkAddTrace=function(e){var t=null!==(n=null===(r=this.props)||void 0===r?void 0:r.commonParams)&&void 0!==n?n:{},r=t.bid,n=t.web_id,t=(null!==(t=null===(t=null==this?void 0:this.props)||void 0===t?void 0:t.ajaxMonitorOptions)&&void 0!==t?t:{}).sampleHitTrace,e=A(location.href,e);return r&&n&&t&&e},pe.prototype.updateAxRequest=function(e,t,r){var n,o;this.collectErrorRequest()&&"2"!==e.ax_status[0]&&"3"!==e.ax_status[0]&&(o=this.getFetchUrl(t,!0),e.ax_request={body:null===(t=this.getFetchBody(t,r))||void 0===t?void 0:t.toString(),search:!d(o)||null===(n=R(o))||void 0===n?void 0:n.search,content_type:null===(r=null==r?void 0:r.headers)||void 0===r?void 0:r["Content-Type"]})},pe.prototype.collectErrorRequest=function(){var e;return null!==(e=null===(e=this.props.ajaxMonitorOptions)||void 0===e?void 0:e.errorRequestCollect)&&void 0!==e&&e},pe.prototype.hookFetch=function(){var c=this,u=this,l=window.fetch;window.fetch=function(n,o){void 0===o&&(o={});var i=c.getFetchUrl(n);if(!function(e){if(d(e)){var t=f(e.split(":"),2),e=t[0];return!t[1]||("http"===e||"https"===e)}}(i))return l(n,o);var e=null!==(e=c.props.commonParams)&&void 0!==e?e:{},t=e.bid,r=e.web_id,a=Date.now(),s={ev_type:"ajax"};try{u.checkAddTrace(i)&&(o.headers=new Headers(function(e,t){var r=new Headers;ce(e)&&e.headers&&m(e.headers.forEach)&&e.headers.forEach(function(e,t){r.append(t,e)});t.headers&&new Headers(t.headers).forEach(function(e,t){r.append(t,e)});return r}(n,o)),t&&r&&(s.trace_id=W(t,r),o.headers.append(K,s.trace_id)))}catch(e){}return s.ax_type=c.getFetchMethod(n,o),s=p(p({},s),H(i)),l(n,o).then(function(e){var t,r;return s.ax_status=(e.status||0).toString(),s.ax_duration=Date.now()-a,s.ax_response_header=u.getAllHeaders(e.headers),s.ax_request_header=u.getAllHeaders(o.headers),e.headers&&m(e.headers.has)?(e.headers.has("content-length")?s.ax_size=Number(e.headers.get("content-length"))||0:s.ax_size=0,u.checkAddTrace(i)&&(e.headers.has(G)&&(s.trace_host=null!==(t=e.headers.get(G))&&void 0!==t?t:void 0),e.headers.has(K)&&(s.trace_id=null!==(r=e.headers.get(K))&&void 0!==r?r:void 0),e.headers.has(Q)&&(s.log_id=null!==(r=e.headers.get(Q))&&void 0!==r?r:void 0))):s.ax_size=0,c.updateAxRequest(s,n,o),m(u.callback)&&u.callback({name:u.name,type:"get",event:s}),e},function(e){return s.ax_status="0",s.ax_size=0,s.ax_duration=Date.now()-a,c.updateAxRequest(s,n,o),m(u.callback)&&u.callback({name:u.name,type:"get",event:s}),Promise.reject(e)})}},pe.prototype.getFetchUrl=function(e,t){void 0===t&&(t=!1);var r="",r=ce(e)?e.url:e;return t||(r=d(r)?r.split("?")[0]:r),r},pe.prototype.getFetchMethod=function(e,t){t=null!==(t=null==t?void 0:t.method)&&void 0!==t?t:"get";return ce(e)&&(t=null!==(e=e.method)&&void 0!==e?e:t),t.toLowerCase()},pe.prototype.getFetchBody=function(e,t){return ce(e)?e.body:null==t?void 0:t.body},pe.prototype.getAllHeaders=function(e){if(!e||"function"!=typeof e.forEach)return"";var r=[];return e.forEach(function(e,t){r.push([t,e])}),q(r)},pe.monitorName=ue,pe);function pe(e){this.name=ue,this.callback=O,this.props=e}var fe="FMPMonitor",me=(de.prototype.setup=function(e){if(M())return _()?void(m(document.querySelector)&&(this.callback=e&&m(e)?e:function(){},this.startTime=Date.now(),this.list=[],m(this.observer.observe)&&this.observer.observe(document,{childList:!0,subtree:!0}))):null},de.prototype.count=function(){var e=Date.now()-this.startTime,t=document.querySelector("body");t?this.list.push({score:this.score(t,1,!1),time:e}):this.list.push({score:0,time:e})},de.prototype.score=function(e,t,r){var n,o=0,i=e.tagName;if("SCRIPT"!==i&&"STYLE"!==i&&"META"!==i&&"HEAD"!==i&&!w((null===(n=this.props)||void 0===n?void 0:n.ignoreTags)||[],i)){i=e.children?e.children.length:0;if(0<i)for(var a=e.children,s=i-1;0<=s;s--)o+=this.score(a[s],t+1,0<o);if(o<=0&&!r){if(!e.getBoundingClientRect||!m(e.getBoundingClientRect))return 0;e=e.getBoundingClientRect();if(!e)return 0;if(e.top>window.innerHeight)return 0;if(e.height<=0)return 0}o+=1+.5*t}return o},de.prototype.getFmpInternal=function(){if(!this.observer)return 0;if(this.disconnect(),!this.list.length)return 0;for(var e,t={time:this.list[0].time,rate:0},r=1;r<this.list.length;r++)this.list[r].time>=this.list[r-1].time&&(e=this.list[r].score-this.list[r-1].score,t.rate<e&&(t={time:this.list[r].time,rate:e}));return t.time},de.prototype.getTimeGap=function(){return P()?this.startTime-performance.timing.navigationStart:0},de.prototype.formatEvent=function(e){return{name:this.name,type:"post",event:{ev_type:"fmp",fmp:e}}},de.monitorName=fe,de);function de(e){var r=this;this.name=fe,this.callback=O,this.disconnect=function(){var e,t;null!==(t=null===(e=r.observer)||void 0===e?void 0:e.disconnect)&&void 0!==t&&t.call(e)},this.getLoadFmp=function(){var e=r.getFmpInternal(),e=e?r.getTimeGap()+e:0,e=r.formatEvent(e);return r.callback(e),e},this.getFmp=function(){var e=r.getFmpInternal(),e=r.formatEvent(e);return r.callback(e),e},this.props=e,this.startTime=Date.now(),this.list=[],this.observer=new MutationObserver(this.count.bind(this))}function he(){}var ve=!1,ge=!1,ye={uniqueId:0,originals:{},proxies:{},patchXMLHTTPRequest:function(i){this.originals.send=XMLHttpRequest.prototype.send,XMLHttpRequest.prototype.send=function(){for(var t=this,e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];var n=ye.uniqueId++;i.beforeCb(n);var o=this.onreadystatechange;return this.onreadystatechange=function(e){null!=o&&o.call(t,e),4===t.readyState&&i.afterCb(n)},ye.originals.send.apply(this,e)},this.proxies.send=XMLHttpRequest.prototype.send},patchFetch:function(o){var i;S()&&(i=window.fetch,this.originals.fetch=i,window.fetch=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return new Promise(function(t,r){var n=ye.uniqueId++;o.beforeCb(n),i.apply(void 0,s(e)).then(function(e){o.afterCb(n),t(e)},function(e){o.afterCb(n,e),r(e)})})},this.proxies.fetch=window.fetch)},observeResourceFetchingMutations:function(a){if(_()){var s=["img","script","iframe","link","audio","video","source"],e=new MutationObserver(function(e){var t,r;try{for(var n=v(e),o=n.next();!o.done;o=n.next()){var i=o.value;("childList"===i.type&&function e(t,r){var n,o;try{for(var i=v(t),a=i.next();!a.done;a=i.next()){var s=a.value;if(r.includes(s.nodeName.toLowerCase())||s.children&&e(s.children,r))return 1}}catch(e){n={error:e}}finally{try{a&&!a.done&&(o=i.return)&&o.call(i)}finally{if(n)throw n.error}}}(i.addedNodes,s)||"attributes"===i.type&&s.includes(i.target.nodeName.toLowerCase()))&&a(i)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}});return e.observe(document,{attributes:!0,childList:!0,subtree:!0,attributeFilter:["href","src"]}),e}},resetOriginals:function(){this.originals.send&&XMLHttpRequest.prototype.send===this.proxies.send&&(ve=!1,XMLHttpRequest.prototype.send=this.originals.send),this.originals.fetch&&fetch===this.proxies.fetch&&(ge=!1,window.fetch=this.originals.fetch)}},be="TTIMonitor",we=(Se.prototype.setup=function(){},Se.prototype.isEnable=function(){return k()&&!!T()&&m(window.PerformanceResourceTiming)&&C()},Se.prototype.registerPerformanceObserver=function(){var s=this;this.performanceObserver=new PerformanceObserver(function(e){var t,r,n=e.getEntries();try{for(var o=v(n),i=o.next();!i.done;i=o.next()){var a=i.value;"resource"===a.entryType&&s.networkRequestFinishedCallback(a),"longtask"===a.entryType&&s.longTaskFinishedCallback(a)}}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}});try{this.performanceObserver.observe({type:"longtask"}),this.performanceObserver.observe({type:"resource",buffered:!0})}catch(e){this.performanceObserver.observe({entryTypes:["longtask","resource"]})}},Se.prototype.unregisterListeners=function(){this.performanceObserver&&this.performanceObserver.disconnect(),this.mutationObserver&&this.mutationObserver.disconnect(),ye.resetOriginals(),this.proxyConfig&&(this.proxyConfig.beforeCb=he,this.proxyConfig.afterCb=he)},Se.prototype.rescheduleTimer=function(e){var t=this;this.scheduleTimerTasks&&(this.timerActivationTime>e||(clearTimeout(this.timerId),this.timerId=window.setTimeout(function(){t.checkTTI()},e-performance.now()),this.timerActivationTime=e))},Se.prototype.startSchedulingTimerTasks=function(){this.scheduleTimerTasks=!0;var e=0<this.longTasks.length?this.longTasks[this.longTasks.length-1].end:0,t=this.computeLastKnownNetwork2Busy(this.incompleteRequestStarts,this.networkRequests);this.rescheduleTimer(Math.max(t+5e3,e))},Se.prototype.registerListeners=function(){ve||(ye.patchXMLHTTPRequest(this.proxyConfig),ve=!0),ge||(ye.patchFetch(this.proxyConfig),ge=!0),this.registerPerformanceObserver(),this.useMutationObserver&&(this.mutationObserver=ye.observeResourceFetchingMutations(this.mutationObserverCallback.bind(this)))},Se.prototype.mutationObserverCallback=function(e){this.rescheduleTimer(performance.now()+5e3)},Se.prototype.beforeJSInitiatedRequestCallback=function(e){this.incompleteJSInitiatedRequestStartTimes[e]=performance.now()},Se.prototype.afterJSInitiatedRequestCallback=function(e){this.incompleteJSInitiatedRequestStartTimes[e]=void 0},Se.prototype.networkRequestFinishedCallback=function(e){this.networkRequests.push({start:e.fetchStart,end:e.responseEnd}),this.rescheduleTimer(this.computeLastKnownNetwork2Busy(this.incompleteRequestStarts,this.networkRequests)+5e3)},Object.defineProperty(Se.prototype,"incompleteRequestStarts",{get:function(){for(var e=Object.keys(this.incompleteJSInitiatedRequestStartTimes),t=[],r=0;r<e.length;r++){var n=this.incompleteJSInitiatedRequestStartTimes[e[r]];"number"==typeof n&&t.push(n)}return t},enumerable:!1,configurable:!0}),Se.prototype.longTaskFinishedCallback=function(e){var t=e.startTime+e.duration;this.longTasks.push({start:e.startTime,end:t}),this.rescheduleTimer(t+5e3)},Se.prototype.checkTTI=function(){var e=this.computeLastKnownNetwork2Busy(this.incompleteRequestStarts,this.networkRequests),t=this.getFirstPaintTime()||performance.timing.domContentLoadedEventEnd-performance.timing.navigationStart,r=this.getMinValue(),n=performance.now();null===r&&this.rescheduleTimer(Math.max(e+5e3,n+1e3));n=this.computeTTI(t,r,e,n,this.longTasks);n?(this.callback&&"function"==typeof this.callback&&this.callback(Math.round(n)),this.disable()):this.rescheduleTimer(performance.now()+1e3)},Se.prototype.getMinValue=function(){if(this.minValue)return this.minValue;if(performance.timing.domContentLoadedEventEnd){var e=performance.timing;return e.domContentLoadedEventEnd-e.navigationStart}return null},Se.prototype.getFirstPaintTime=function(){if("PerformancePaintTiming"in window){var e=performance.getEntriesByType("paint")[0];return e?e.startTime:0}return 0},Se.prototype.disable=function(){clearTimeout(this.timerId),this.scheduleTimerTasks=!1,this.unregisterListeners(),this.snippetObserver&&this.snippetObserver.disconnect(),this.snippetEntries&&this.snippetEntries.splice(0,this.snippetEntries.length)},Se.prototype.computeLastKnownNetwork2Busy=function(e,t){var r,n,o,i;if(2<e.length)return performance.now();var a=[];try{for(var s=v(t),c=s.next();!c.done;c=s.next()){var u=c.value;a.push({timestamp:u.start,type:"requestStart"}),a.push({timestamp:u.end,type:"requestEnd"})}}catch(e){r={error:e}}finally{try{c&&!c.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}try{for(var l=v(e),p=l.next();!p.done;p=l.next()){var f=p.value;a.push({timestamp:f,type:"requestStart"})}}catch(e){o={error:e}}finally{try{p&&!p.done&&(i=l.return)&&i.call(l)}finally{if(o)throw o.error}}a.sort(function(e,t){return e.timestamp-t.timestamp});for(var m=e.length,d=a.length-1;0<=d;d--){var h=a[d];switch(h.type){case"requestStart":m--;break;case"requestEnd":if(2<++m)return h.timestamp;break;default:throw Error("Internal Error: This should never happen")}}return 0},Se.monitorName=be,Se);function Se(e){var t,r,n,o=this;if(this.name=be,this.longTasks=[],this.callback=he,this.useMutationObserver=!0,this.minValue=null,this.isAsync=0,this.networkRequests=[],this.incompleteJSInitiatedRequestStartTimes={},this.timerActivationTime=-1/0,this.scheduleTimerTasks=!1,this.proxyConfig={beforeCb:this.beforeJSInitiatedRequestCallback.bind(this),afterCb:this.afterJSInitiatedRequestCallback.bind(this)},this.getTTI=function(e){o.callback=e,o.isEnable()?o.startSchedulingTimerTasks():o.callback&&"function"==typeof o.callback&&o.callback()},this.computeTTI=function(e,t,r,n,o){if(n-r<5e3)return null;o=0===o.length?e:o[o.length-1].end;return n-o<5e3?null:Math.max(o,t)},this.isEnable()){if(this.useMutationObserver=!!e.useMutationObserver,this.minValue=null!==(n=e.minValue)&&void 0!==n?n:null,this.isAsync=null!==(n=e.isAsync)&&void 0!==n?n:0,this.snippetEntries=null===(n=null==e?void 0:e.preLongTaskObserver)||void 0===n?void 0:n.precollect,this.snippetObserver=null===(e=null==e?void 0:e.preLongTaskObserver)||void 0===e?void 0:e.observer,!this.isAsync&&this.snippetEntries&&0<this.snippetEntries.length)try{for(var i=v(this.snippetEntries),a=i.next();!a.done;a=i.next()){var s=a.value;"longtask"===s.entryType?this.longTasks.push({start:s.startTime,end:s.startTime+s.duration}):"resource"===s.entryType&&this.networkRequests.push({start:s.fetchStart,end:s.responseEnd})}}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}this.registerListeners()}}function Me(e){try{for(var t,r=e,n=[],o=0,i=0,a=" > ".length;r&&o++<5&&!("html"===(t=function(e){var t,r,n,o,i=e,a=[];if(!i||!i.tagName)return"";a.push(i.tagName.toLowerCase()),i.id&&a.push("#"+i.id);e=i.className;if(e&&d(e))for(t=e.split(/\s+/),o=0;o<t.length;o++)a.push("."+t[o]);var s=["type","name","title","alt"];for(o=0;o<s.length;o++)r=s[o],(n=i.getAttribute(r))&&a.push("["+r+'="'+n+'"]');return a.join("")}(r))||1<o&&80<=i+n.length*a+t.length);)n.push(t),i+=t.length,r=r.parentNode;return n.reverse().join(" > ")}catch(e){return"<unknown>"}}var Pe="FIDMonitor",Ee=(_e.prototype.setup=function(e){var s=this;if(T()&&PerformanceObserver.supportedEntryTypes&&PerformanceObserver.supportedEntryTypes.includes("first-input")&&C()){this.callback=e,this.observer=new PerformanceObserver(function(e,t){var r,n;try{for(var o=v(e.getEntries()),i=o.next();!i.done;i=o.next()){var a=i.value,a=a.processingStart-a.startTime;s.callback({name:s.name,fid:Math.round(a)})}}catch(e){r={error:e}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}t.disconnect()});try{this.observer.observe({type:"first-input",buffered:!0})}catch(e){this.observer.observe({entryTypes:["first-input"]})}}},_e.monitorName=Pe,_e);function _e(){this.name=Pe,this.callback=O}var Te="MPFIDMonitor",ke=(Ce.prototype.setup=function(){var t,e,r,a=this;if(k()&&C()){if(!this.props.isAsync){var n=null!==(r=null===(r=this.props.preLongTaskObserver)||void 0===r?void 0:r.precollect)&&void 0!==r?r:[];if(n&&0<n.length)try{for(var o=v(n),i=o.next();!i.done;i=o.next()){var s=i.value;"longtask"===s.entryType&&this.list.push(s)}}catch(e){t={error:e}}finally{try{i&&!i.done&&(e=o.return)&&e.call(o)}finally{if(t)throw t.error}}}this.observer=new PerformanceObserver(function(e){var t,r;try{for(var n=v(e.getEntries()),o=n.next();!o.done;o=n.next()){var i=o.value;a.list.push(i)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}}),this.observer.observe({entryTypes:["longtask"]})}},Ce.prototype.getMPFID=function(){var t,e;if(k()&&C()){this.observer&&this.observer.disconnect();var r=0;try{for(var n=v(this.list),o=n.next();!o.done;o=n.next()){var i=o.value;r<i.duration&&(r=i.duration)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(t)throw t.error}}return this.formatEvent(Math.round(r))}},Ce.prototype.formatEvent=function(e){return{name:this.name,mpfid:e}},Ce.monitorName=Te,Ce);function Ce(e){this.name=Te,this.list=[],this.props=e}var xe=["xmlhttprequest","fetch"],Re="ResourcePerformanceMonitor",Le=(Oe.prototype.setup=function(e){this.isEnable()&&(this.callback=null!=e?e:O,this.isAsync&&window.performance.clearResourceTimings(),this.observe&&(this.sendResourcePerformance(performance.getEntriesByType("resource")),this.observePerformance()))},Oe.prototype.isEnable=function(){return E()&&"function"==typeof performance.clearResourceTimings},Oe.prototype.getPerformance=function(){return this.isEnable()?this.buildParams(this.getResources()):this.buildParams([])},Oe.prototype.buildParams=function(e){var t=this,r=[];if(e.forEach(function(e){w(xe,e.initiatorType)||m(t.checkIgnore)&&t.checkIgnore(e)||r.push(e)}),r.length)return{name:this.name,type:"post",event:{ev_type:"resource_performance",resources:r}}},Oe.prototype.sendResourcePerformance=function(e){e=this.buildParams(e);e&&this.callback(e)},Oe.prototype.getResources=function(){return window.performance.getEntriesByType("resource")},Oe.prototype.observePerformance=function(){var t=this;T()&&new PerformanceObserver(function(e){e=e.getEntries();e.length&&t.sendResourcePerformance(e)}).observe({entryTypes:["resource"]})},Oe.monitorName=Re,Oe);function Oe(e){var t,r=this;this.name=Re,this.callback=O,this.getResourcePerformance=function(){var e;return null!==(e=r.getPerformance())&&void 0!==e?e:{}},this.isAsync=null!==(t=null==e?void 0:e.isAsync)&&void 0!==t?t:0,this.observe=null!==(t=null==e?void 0:e.observe)&&void 0!==t&&t,this.checkIgnore=null!==(e=null==e?void 0:e.checkIgnore)&&void 0!==e?e:function(){return!1}}var je={ev_type:"perf",isAsync:0,dns:0,tcp:0,request:0,response:0,processing:0,blank:0,domready:0,load:0,has_resource:0,domparse:0,resource:0,ttfb:0,redirect:0,tti:0,upload_reason:"sample",network_type:"",timing:{},navigation_timing:{},navigation:{},resources:[]},qe="PerformanceMonitor",He=(Ae.prototype.setup=function(e){var t,r=this;P()&&(this.callback=e,t=function(){r.hasLoaded=!0,r.performanceAuto&&(r.perfTimer=setTimeout(function(){r.perfLog()},200))},"complete"!==document.readyState?window.addEventListener("load",function(){setTimeout(function(){t()},0)},!1):t(),this.sendParams=p({},je),this.staticPerformanceMonitor=new Le,this.staticPerformanceMonitor.setup(),(new Ee).setup(this.hasFID),this.mpfidMonitor=new ke({isAsync:0,preLongTaskObserver:this.props.preLongTaskObserver}),this.mpfidMonitor.setup(),e=null!==(e=this.props.TTIMonitor)&&void 0!==e?e:we,this.ttiMonitor=new e({isAsync:0,preLongTaskObserver:this.props.preLongTaskObserver}),this.ttiMonitor.setup(),e=this.syncPerfLog.bind(this),F(e))},Ae.prototype.performanceNow=function(){var e;return null!==performance&&void 0!==performance&&performance.now?performance.now():(Date.now?Date.now():+new Date)-(null!==(e=null===(e=performance.timing)||void 0===e?void 0:e.navigationStart)&&void 0!==e?e:0)},Ae.prototype.getBounced=function(){return!this.hasLoaded},Ae.prototype.getPaintTime=function(t){if(E()){var e=performance.getEntriesByType("paint");if(u(e)){e=e.filter(function(e){return e.name===t});return e.length&&e[0]&&c(e[0])&&e[0].startTime||0}}return 0},Ae.monitorName=qe,Ae);function Ae(e){var o=this;this.name=qe,this.callback=O,this.sendParams=p({},je),this.finalSendParams=this.sendParams,this.hasLoaded=!1,this.initStart=0,this.hasSentInitPerf=!1,this.initFlag=!0,this.performanceAuto=!0,this.send=function(){o.initFlag&&o.hasLoaded&&(o.sendParams.isAsync&&(o.sendParams.load=Math.round(o.performanceNow()-o.initStart)),setTimeout(function(){o.perfLog()},200))},this.initAsync=function(){var e,t;o.hasSentInitPerf&&(o.sendParams=p({},je),o.sendParams.isAsync=1,o.initFlag=!0,o.initStart=o.performanceNow(),o.staticPerformanceMonitor=new Le({isAsync:1}),o.staticPerformanceMonitor.setup(),o.mpfidMonitor=new ke({isAsync:1,preLongTaskObserver:o.props.preLongTaskObserver}),o.mpfidMonitor.setup(),t=null!==(e=o.props.TTIMonitor)&&void 0!==e?e:we,o.ttiMonitor=new t({minValue:Math.round(o.performanceNow()),isAsync:1,preLongTaskObserver:o.props.preLongTaskObserver}),o.ttiMonitor.setup(),null!==(t=null===(e=o.fmpMonitor)||void 0===e?void 0:e.setup)&&void 0!==t&&t.call(e,O))},this.stopAutoPerf=function(){o.performanceAuto=!1,clearTimeout(o.perfTimer)},this.getPerformance=function(){return o.finalSendParams.tti||("complete"===document.readyState?o.perfLog():o.perfLog(!0)),o.buildParams(o.finalSendParams)},this.buildParams=function(e){return{name:o.name,type:"post",event:e}},this.perfLog=function(e){if(void 0===e&&(e=!1),P()){if(o.initFlag=!1,o.finalSendParams=p({},o.sendParams),!o.sendParams.isAsync){var t=o.getBounced();if(t)return o.finalSendParams.bounced=t,void o.invokeCallback(0,o.buildParams(o.finalSendParams));o.finalSendParams=p(p({},o.finalSendParams),o.getParams())}var r=o.getStaticResources(),n=o.getFMP(),t=o.getMPFID();r&&(o.finalSendParams.resources=r,o.finalSendParams.has_resource=1),n&&(o.finalSendParams.fmp=Math.round(n)),n&&o.finalSendParams.fcp&&o.finalSendParams.fmp<o.finalSendParams.fcp&&(o.finalSendParams.fmp=o.finalSendParams.fcp),t&&(o.finalSendParams.mpfid=t),m(o.callback)&&(!e&&o.ttiMonitor&&m(o.ttiMonitor.getTTI)?o.ttiMonitor.getTTI(function(e){e&&0<e&&(o.finalSendParams.tti=o.finalSendParams.isAsync?Math.round(e-o.initStart):e),o.invokeCallback(o.finalSendParams.isAsync,o.buildParams(o.finalSendParams))}):o.invokeCallback(o.finalSendParams.isAsync,o.buildParams(o.finalSendParams)))}},this.invokeCallback=function(e,t){if(!e){if(o.hasSentInitPerf)return;o.hasSentInitPerf=!0}o.callback(t)},this.getStaticResources=function(){var e;if(o.staticPerformanceMonitor&&m(o.staticPerformanceMonitor.getResourcePerformance)){var t=o.staticPerformanceMonitor.getResourcePerformance();if(null!==(e=null==t?void 0:t.event)&&void 0!==e&&e.resources)return t.event.resources||[]}},this.getFMP=function(){var e,t;return o.fmpMonitor?(o.fmpMonitor.disconnect(),o.sendParams.isAsync?(null===(e=null==(t=o.fmpMonitor.getFmp())?void 0:t.event)||void 0===e?void 0:e.fmp)||0:m(o.fmpMonitor.getLoadFmp)?1!==o.props.renderType?2===o.props.renderType?o.getPaintTime("first-contentful-paint"):0:null!==(t=null===(t=(t=o.fmpMonitor.getLoadFmp()||{}).event)||void 0===t?void 0:t.fmp)&&void 0!==t?t:0:0):0},this.getMPFID=function(){if(o.mpfidMonitor&&m(o.mpfidMonitor.getMPFID)){var e=o.mpfidMonitor.getMPFID();if(e)return e.mpfid}},this.syncPerfLog=function(){var e,t;o.hasSentInitPerf||(o.perfLog(!0),null!==(t=(e=o.props).report)&&void 0!==t&&t.call(e))},this.hasFID=function(e){o.sendParams.fid=e.fid},this.getParams=function(){if(P()){var e={},t=window.performance.timing;e.dns=t.domainLookupEnd-t.domainLookupStart,e.tcp=t.connectEnd-t.connectStart,e.request=t.responseStart-t.requestStart,e.response=t.responseEnd-t.responseStart,e.processing=t.domComplete-t.domLoading,e.blank=t.responseEnd-t.navigationStart,e.domready=t.domInteractive-t.navigationStart,e.load=t.loadEventEnd-t.navigationStart,t.secureConnectionStart&&(e.ssl=t.connectEnd-t.secureConnectionStart),e.domparse=t.domInteractive-t.responseEnd,e.resource=t.loadEventStart-t.domContentLoadedEventEnd,e.ttfb=t.responseStart-t.requestStart,e.redirect=t.redirectEnd-t.redirectStart;var r=o.getPaintTime("first-paint"),t=o.getPaintTime("first-contentful-paint");r&&(e.fp=Math.round(r)),t&&(e.fcp=Math.round(t));r=function(){if(!E())return null;var e=window.performance.getEntriesByType("navigation");return u(e)&&0!==e.length?e[0]:null}(),t=P()?window.performance.timing:null;return(r||t)&&(e.navigation=null!=r?r:t),t&&(e.timing=t),r&&(e.navigation_timing=r),e}},e.fmpMonitor&&(this.fmpMonitor=e.fmpMonitor);var t=e.performanceAuto;this.performanceAuto=void 0===t||t,this.props=null!=e?e:{}}var Ie="StaticErrorMonitor",De=(Fe.prototype.setup=function(e){M()&&(this.callback=e,window.addEventListener("error",this.staticErrorLog.bind(this),!0))},Fe.prototype.getSrc=function(e){return"link"===e.tagName.toLowerCase()?Be(e,"href"):Be(e,"src")},Fe.prototype.getParams=function(e,t){var r={ev_type:"static",st_type:t},t=R(e);r.st_src=e,r.st_protocol=t.protocol,r.st_domain=t.hostname,r.st_path=t.pathname;t=function(e){var t,r=null===(t=null===(n=window.performance)||void 0===n?void 0:n.getEntriesByType)||void 0===t?void 0:t.call(n,"resource"),n=null==r?void 0:r.length;if(!n)return;for(var o=n-1;-1<o;o--){var i=r[o];if(i.name===e)return i}}(t.href);return t&&(r.timing=t),r},Fe.monitorName=Ie,Fe);function Fe(){var i=this;this.name=Ie,this.callback=O,this.buildEvent=function(e){var t,r,n=e||window.event||{};try{r=null!==(t=null!==(t=n.target)&&void 0!==t?t:n.srcElement)&&void 0!==t?t:{}}catch(n){return}var o=r.tagName;if(o&&d(o)){o=o.toLowerCase();e=i.getSrc(r);if(e&&e!==window.location.href)return{name:i.name,type:"get",event:i.getParams(e,o)}}},this.staticErrorLog=function(e){e=i.buildEvent(e);e&&i.callback(e)}}function Be(e,t){var r;return e.getAttribute&&m(e.getAttribute)?null!==(r=e.getAttribute(t))&&void 0!==r?r:"":null!==(t=e[t])&&void 0!==t?t:""}var Ne="EmitMonitor",Je=(Ue.prototype.setup=function(e){this.callback=e||O},Ue.prototype.buildCustomTimeLog=function(e,t,r){return function(e){var t=e.name,r=e.tag,e=e.value;if(t&&e){e={ev_type:"custom",cm_name:t=m(t.toString)?t.toString():"",cm_type:"time",cm_value:e=+e};return r&&(r=m(r.toString)?r.toString():"",e.cm_tag=r),{name:"SentCustomTime",type:"get",event:e}}}({name:e,tag:t,value:r})},Ue.prototype.buildCustomCountLog=function(e,t){return function(e){var t=e.name,e=e.tag;if(t){t={ev_type:"custom",cm_name:t=m(t.toString)?t.toString():"",cm_type:"count"};return e&&(e=m(e.toString)?e.toString():"",t.cm_tag=e),{name:"SentCustomCount",type:"get",event:t}}}({name:e,tag:t})},Ue.prototype.buildEmitSingleEvent=function(e){e=oe(e);if(e&&(!e||e.event_name))return{name:this.name,type:"post",event:{ev_type:"flexible",flexible_data_list:[e]}}},Ue.monitorName=Ne,Ue);function Ue(){var o=this;this.name=Ne,this.callback=O,this.handOut=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=o.buildEvent.apply(o,s(e));o.callback(r)},this.buildEvent=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if("sendCustomCountLog"===e[0])return o.buildCustomCountLog(e[1],e[2]);if("sendCustomTimeLog"===e[0])return o.buildCustomTimeLog(e[1],e[2],e[3]);if("send"===e[0]){if("count"===e[1])return o.buildCustomCountLog(e[2].category,e[2].action);if("timing"===e[1])return o.buildCustomTimeLog(e[2].category,e[2].action,e[2].value)}if("emit"===e[0]&&e[1]&&e[2]){var r={type:e[1],event:e[2]};return o.buildEmitSingleEvent(r)}},this.send=function(e,t,r){var n=r.action,r=r.value;"count"===e&&o.sendCustomCountLog(t,n),"timing"===e&&o.sendCustomTimeLog(t,n,r)},this.sendCustomTimeLog=function(e,t,r){r=o.buildCustomTimeLog(e,t,r);o.callback(r)},this.sendCustomCountLog=function(e,t){t=o.buildCustomCountLog(e,t);return o.callback(t),t},this.emitEvent=function(e){e=o.buildEmitSingleEvent(e);o.callback(e)}}var Xe="BreadcrumbMonitor",ze=(Ve.prototype.setup=function(){this.instrumentDOM()},Ve.prototype.instrumentDOM=function(){var e;"document"in window&&(e=this,window.document.addEventListener("click",e.domEventHandler("click",e.triggerHandlers.bind(e,"dom")),!1),window.document.addEventListener("keypress",e.keypressEventHandler(e.triggerHandlers.bind(e,"dom")),!1))},Ve.prototype.domEventHandler=function(t,r,n){var o=this;return void 0===n&&(n=!1),function(e){o.keypressTimeout=void 0,e&&o.lastCapturedEvent!==e&&(o.lastCapturedEvent=e,o.debounceTimer&&clearTimeout(o.debounceTimer),n?o.debounceTimer=setTimeout(function(){r({event:e,name:t})}):r({event:e,name:t}))}},Ve.prototype.triggerHandlers=function(e,t){if(e)try{this.domBreadcrumb(t)}catch(e){}},Ve.prototype.keypressEventHandler=function(n){var o=this;return function(e){var t;try{t=e.target}catch(e){return}var r=t&&t.tagName;r&&("INPUT"===r||"TEXTAREA"===r||t.isContentEditable)&&(o.keypressTimeout||o.domEventHandler("input",n)(e),clearTimeout(o.keypressTimeout),o.keypressTimeout=window.setTimeout(function(){o.keypressTimeout=void 0},o.debounceDuration))}},Ve.prototype.domBreadcrumb=function(e){var t;try{t=e.event.target?Me(e.event.target):Me(e.event)}catch(e){t="<unknown>"}0!==t.length&&this.addBreadcrumb({category:"ui."+e.name,message:t})},Ve.monitorName=Xe,Ve);function Ve(e){var n=this;this.name=Xe,this.breadcrumbs=[],this.getBreadcrumbs=function(){return n.breadcrumbs},this.addBreadcrumb=function(e){var t=p(p({},e),{timestamp:(new Date).getTime()}),r=n.maxBreadcrumbs,e=n.breadcrumbs;return n.breadcrumbs=0<=r?s(e,[t]).slice(-r):s(e,[t]),n},this.debounceDuration=1e3,this.debounceTimer=0,this.breadcrumbs=[],this.maxBreadcrumbs=null!==(e=null==e?void 0:e.maxBreadcrumbs)&&void 0!==e?e:20}var Ke={enableCatchGlobalJSError:!0},Ge="JSExceptionMonitor",Qe=(We.prototype.setup=function(e){M()&&(this.callback=e,this.options.enableCatchGlobalJSError&&(window.addEventListener("error",this.jsErrorLog),window.addEventListener("unhandledrejection",this.jsPromiseRejectionLog)))},We.prototype.buildEvent=function(e){if(!function(e){switch(Object.prototype.toString.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":return 1;default:return e instanceof Error}}(e)?(n(e)&&(t={message:JSON.stringify(e)}),d(e)&&(t={message:e})):t=e,t){var t={ev_type:"js_exception",exception:this.normalizeError(t),breadcrumbs:null!==(t=null===(t=this.options.breadcrumbMonitor)||void 0===t?void 0:t.getBreadcrumbs())&&void 0!==t?t:[]};return{name:this.name,type:"post",event:t}}},We.prototype.logError=function(e){e=this.buildEvent(e);e&&this.callback(e)},We.prototype.getJSError=function(e){e=e.error;if(e)return e},We.prototype.getJSPromiseRejection=function(e){var t=void 0;try{"reason"in e?t=e.reason:"detail"in e&&"reason"in e.detail&&(t=e.detail.reason)}catch(e){}if(t)return t},We.prototype.normalizeError=function(e){return{message:e.message,name:e.name,fileName:e.fileName,lineNumber:e.lineNumber,columnNumber:e.columnNumber,stack:e.stack,stacktrace:e.stacktrace,framesToPop:e.framesToPop}},We.monitorName=Ge,We);function We(e){var t=this;this.name=Ge,this.callback=O,this.jsErrorLog=function(e){e=t.getJSError(e);e&&t.logError(e)},this.jsPromiseRejectionLog=function(e){e=t.getJSPromiseRejection(e);e&&t.logError(e)},this.options=p(p({},Ke),e)}var $e=(Ye.prototype.sendEvent=function(e){e=this.getEventToBeSent(e);e&&this.idleSendEvent(e)},Ye.prototype.getEventToBeSent=function(e){e=this._modifyEvent(e);if(this._shouldSend(e))return e},Ye.prototype._modifyEvent=function(e){return e},Ye.prototype._shouldSend=function(e){return!0},Ye.prototype._send=function(e){},Ye.prototype.idleSendEvent=function(e){this._send(e)},Ye);function Ye(){}var Ze="RANGERS_WEB_ID";function et(){var e={flags:{hookPath:!0,hookXHR:!0,hookFetch:!0,enableSizeStats:!0,enableFMP:!0,enablePerformance:!0,enableResourcePerformance:!0,enableStaticError:!0,enableCatchJSError:!0,enableCatchGlobalJSError:!0,enableCatchJSErrorV2:!1,enableCrash:!0,enableMemoryRecord:!0,enableFPSJankTimesMonitor:!0,enableBreadcrumb:!0,hookConsole:!1,hookDom:!0}};return e.monitors={BaseMonitor:{appTypeSetting:{type:0,SPA:"",renderType:0},sampleHit:J(1)},JSErrorMonitor:{enable:!0,webIDHit:!0,sampleRate:1,webIDHitBehavior:!1,sampleHitBehavior:!1,ignoreErrors:[],whitelistUrls:[],blacklistUrls:[],download_link:""},AjaxMonitor:{enable:!0,enableError:!1,webIDHit:!0,sampleHit:J(1),sampleRate:1,sampleHitTrace:!1,ignore:ee,abort:!1,whitelistUrls:[],statusCodeSample:{},requestUrlSample:[],errorRequestCollect:!1},PerformanceMonitor:{enable:!0,webIDHit:!0,sampleRate:1,webIDHitStaticResource:!1,sampleHitStaticResource:J(Z),slowSessionTime:te,spaSlowSessionTime:re,geckoUrls:[],interval:0,checkPoint:[]},StaticErrorMonitor:{enable:!0,webIDHit:!0,sampleRate:1,ignore:ee},ResourcePerformanceMonitor:{enable:!0,webIDHit:!0,sampleRate:1},BreadcrumbMonitor:{enable:!0},EmitMonitor:{enable:!0}},e.custom={},e.commonParams={aid:0,pid:"",version:"0.2.22",hostname:window.location.hostname,protocol:window.location.protocol.slice(0,-1),rangers_web_id:it($()),rangers_session_id:$(),context:{},url:window.location.href,timestamp:Date.now(),screen_resolution:B(),network_type:N()},e}var tt,rt,nt,ot,it=function(e){return null!==document&&void 0!==document&&document.cookie&&(e=I(document.cookie,Ze)),e},at=(tt="/v2/user/webid",rt="/v2/user/ssid",nt="/v2/event/list",ot=[],["https://mcs.ctobsnssdk.com","https://mcs.itobsnssdk.com","https://mcs.tobsnssdk.com"].forEach(function(t){[tt,rt,nt].forEach(function(e){ot.push(t+e)})}),ot);function st(e){var t=e.sendParams,e=e.monitorsSetting;if(!t||!c(t)||!t.event)return!1;var r,n,e=e;if("AjaxMonitor"===t.name||"FetchMonitor"===t.name){var o=D(s(["/monitor_browser/collect"],at)||[]);if(o&&o.test(t.event.ax_url))return!1}return!(null==e||!e.BaseMonitor.sampleHit)&&("AjaxMonitor"===t.name||"FetchMonitor"===t.name?function(e){var r=e.sendParams,t=e.ajaxMonitor;if(!t)return!0;if("2"!==r.event.ax_status[0]&&"3"!==r.event.ax_status[0])return t.enableError;if(!t.enable)return!1;if(!t.webIDHit)return!1;if(!t.sampleHit||!J(t.sampleRate))return!1;if(u(e=t.whitelistUrls)&&0<e.length){var n=D(t.whitelistUrls||[]);return n&&n.test(r.event.ax_url)?!0:!1}if((n=D(t.ignore||[]))&&n.test(r.event.ax_url))return!1;if((n=t.statusCodeSample)&&h(n,r.event.ax_status))return J(n[r.event.ax_status]);if(t=t.requestUrlSample){var o=!1,i=!1;if(t.forEach(function(e){var t;o||null!=(t=D([e.url]))&&t.test(r.event.ax_url)&&(o=!0,i=J(e.sampleRate))}),o)return i}return!0}({sendParams:t,ajaxMonitor:e.AjaxMonitor}):"PerformanceMonitor"===t.name?!(r=(r={performanceMonitor:e.PerformanceMonitor}).performanceMonitor)||!!r.enable&&(!!r.webIDHit&&J(r.sampleRate)):"StaticErrorMonitor"===t.name?(o={sendParams:t,staticErrorMonitor:e.StaticErrorMonitor},r=o.sendParams,!(o=o.staticErrorMonitor)||!!o.enable&&(!!o.webIDHit&&(!!J(o.sampleRate)&&!((o=D(o.ignore||[]))&&o.test(r.event.st_src))))):"JSExceptionMonitor"===t.name?!(n=(n={jsErrorMonitor:e.JSErrorMonitor}).jsErrorMonitor)||!!n.enable&&(!!n.webIDHit&&J(n.sampleRate)):"ResourcePerformanceMonitor"===t.name?!(n=(n={resourcePerformanceMonitor:e.ResourcePerformanceMonitor}).resourcePerformanceMonitor)||!!n.enable&&(!!n.webIDHit&&J(n.sampleRate)):"EmitMonitor"!==t.name||!!{emitMonitor:e.EmitMonitor}.emitMonitor)}function ct(e){var t=e.sendParams,r=e.commonParams,n=e.custom,e=e.breadcrumbMonitor,e=function(e){var t=e.sendParams,r=e.commonParams,n=e.breadcrumbMonitor;if((e={}).ev_type=t.event.ev_type,e.common=r,"PageViewMonitor"===t.name&&e)return e;if(("AjaxMonitor"===t.name||"FetchMonitor"===t.name)&&e){r=t.event,r=(r.ev_type,a(r,["ev_type"]));return e.event=r,e}if("PerformanceMonitor"===t.name&&e){t.event.navigation=t.event.navigation_timing;var o=t.event,o=(o.ev_type,a(o,["ev_type"]));return e.ev_type="performance",e.event={fp:o.fp,fcp:o.fcp,fmp:o.fmp,tti:o.tti,fid:o.fid,mpfid:o.mpfid,isAsync:o.isAsync,timing:o.timing,navigation:o.navigation_timing,bounced:o.bounced},e}if("StaticErrorMonitor"===t.name&&e){e.ev_type="resource_error";o=t.event,o=(o.ev_type,a(o,["ev_type"]));return e.event=o,e}if("ResourcePerformanceMonitor"===t.name&&e){e.ev_type="resource";var i=t.event,i=(i.ev_type,a(i,["ev_type"]));return e.event=i,e}if("JSExceptionMonitor"===t.name&&e){e.ev_type="js_error";i=t.event,i=(i.ev_type,a(i,["ev_type"]));return e.event=i.exception,e.breadcrumbs=null!==(n=null==n?void 0:n.getBreadcrumbs())&&void 0!==n?n:[],e}return"EmitMonitor"===t.name&&e&&(e.ev_type="flexible",e.flexible_data_list=t.event.flexible_data_list),e}({sendParams:t,commonParams:p(p({},null!=r?r:{}),{url:window.location.href}),breadcrumbMonitor:e});return n&&m(n.beforeSend)&&(e=n.beforeSend(e||{})),e}function ut(e){return"https://"+e+"/monitor_browser/collect"}var lt,pt,ft,mt={cover:O,accumulate:O,reportDirectly:O,average:O},dt=function(e){var r=this;this.cover=function(e,t){r.log.cover(e,t)},this.accumulate=function(e,t){r.log.accumulate(e,t)},this.reportDirectly=function(e,t){r.log.reportDirectly(e,t)},this.average=function(e,t){r.log.average(e,t)},this.log=null!==(e=e.transport)&&void 0!==e?e:mt},ht=(r(pt=gt,ft=lt=$e),pt.prototype=null===ft?Object.create(ft):(vt.prototype=ft.prototype,new vt),gt.prototype.uploadQueue=function(){},gt.prototype._shouldSend=function(e){return st({sendParams:e,monitorsSetting:this.options.monitorsSetting})},gt.prototype._modifyEvent=function(e){return(e=(e={sendParams:e}).sendParams)&&c(e)?e:{}},gt.prototype.buildParams=function(e){var t,r=null===(t=null===(t=this.options.monitorsSetting)||void 0===t?void 0:t.BreadcrumbMonitor)||void 0===t||!t.enable||null===(r=this.options.monitors)||void 0===r?void 0:r.BreadcrumbMonitor;return ct({sendParams:e,commonParams:this.options.commonParams,custom:this.options.custom,breadcrumbMonitor:r})},gt.prototype._send=function(e){e&&e.event&&e.name&&this.transport&&this.sendByTypes(e)},gt.prototype.sendByTypes=function(e){var t;this.transport&&(t={jsBase:null!==(t=this.options.commonParams)&&void 0!==t?t:{},jsInfo:this.buildParams(e)},"PerformanceMonitor"===e.name&&this.transport.cover(t,t.jsInfo.ev_type),"StaticErrorMonitor"===e.name&&this.transport.reportDirectly(t,t.jsInfo.ev_type),"ResourcePerformanceMonitor"===e.name&&this.transport.reportDirectly(t,t.jsInfo.ev_type),"AjaxMonitor"===e.name&&this.transport.reportDirectly(t,t.jsInfo.ev_type),"FetchMonitor"===e.name&&this.transport.reportDirectly(t,t.jsInfo.ev_type),"JSExceptionMonitor"===e.name&&this.transport.reportDirectly(t,t.jsInfo.ev_type),"PageViewMonitor"===e.name&&this.transport.reportDirectly(t,t.jsInfo.ev_type))},gt);function vt(){this.constructor=pt}function gt(e){var o=lt.call(this)||this;return o.options={},o.setTransport=function(e){o.transport=new dt({transport:e.transport}),o.preQueue.forEach(function(e){lt.prototype.sendEvent.call(o,e)})},o.updateConfig=function(e){var t,r,n;o.options=(t={previousOptions:o.options,newOptions:e},r=t.previousOptions,n=t.newOptions,(e=p(p({},r),n)).commonParams=i({},null!==(t=r.commonParams)&&void 0!==t?t:{},null!==(t=n.commonParams)&&void 0!==t?t:{}),e.monitorsSetting=i({},null!==(t=r.monitorsSetting)&&void 0!==t?t:{},null!==(t=n.monitorsSetting)&&void 0!==t?t:{}),e.monitors=p(p({},null!==(t=r.monitors)&&void 0!==t?t:{}),null!==(t=n.monitors)&&void 0!==t?t:{}),e.custom=p(p({},null!==(r=r.custom)&&void 0!==r?r:{}),null!==(n=n.custom)&&void 0!==n?n:{}),e)},o.sendEvent=function(e){o.transport?lt.prototype.sendEvent.call(o,e):o.preQueue.push(e)},o.getEventToBeSent=function(e){return null!==(e=lt.prototype.getEventToBeSent.call(o,e))&&void 0!==e?e:{}},o.options=e,o.preQueue=[],o}var yt=(bt.getClientCommonParams=function(r){void 0===r&&(r={});var n={};if(!c(r))return n;var o=["context","pid"];t(r,function(e,t){w(o,e)&&(n[e]=t)});return t({user_unique_id:"rangers_web_id",app_id:"aid"},function(e,t){h(r,e)&&(n[t]=r[e])}),n},bt.getClientFlags=function(e){void 0===e&&(e={});var r={};if(!c(e))return r;var n=["hookPath","hookXHR","hookFetch","enableSizeStats","enableFMP","enablePerformance","enableStaticError","enableCatchJSError","enableCatchJSErrorV2","enableCatchGlobalJSError","enableResourcePerformance","enableCrash","enableMemoryRecord","enableFPSJankTimesMonitor","enableBreadcrumb","hookConsole"];return t(e,function(e,t){w(n,e)&&(r[e]=t)}),r},bt.getClientCustom=function(e){var t={};return e.beforeSend&&m(e.beforeSend)&&(t.beforeSend=e.beforeSend),t},bt.getClientMonitorsSetting=function(e){return e=(t={setting:e}).setting,t={JSErrorMonitor:{},PerformanceMonitor:{},BreadcrumbMonitor:{},StaticErrorMonitor:{},ResourcePerformanceMonitor:{},BaseMonitor:{appTypeSetting:{}},AjaxMonitor:{}},e.ajaxWhitelistUrls&&u(e.ajaxWhitelistUrls)&&(t.AjaxMonitor.whitelistUrls=(t.AjaxMonitor.whitelistUrls||[]).concat(e.ajaxWhitelistUrls)),e.ignoreAjax&&u(e.ignoreAjax)&&(t.AjaxMonitor.ignore=(t.AjaxMonitor.ignore||[]).concat(e.ignoreAjax)),e.ignoreStatic&&u(e.ignoreStatic)&&(t.StaticErrorMonitor.ignore=(t.StaticErrorMonitor.ignore||[]).concat(e.ignoreStatic)),e.ignoreErrors&&u(e.ignoreErrors)&&(t.JSErrorMonitor.ignoreErrors=e.ignoreErrors),e.errorBlacklistUrls&&u(e.errorBlacklistUrls)&&(t.JSErrorMonitor.blacklistUrls=e.errorBlacklistUrls),e.errorWhitelistUrls&&u(e.errorWhitelistUrls)&&(t.JSErrorMonitor.whitelistUrls=e.errorWhitelistUrls),h(e,"sampleRate")&&(t.BaseMonitor.sampleHit=J(e.sampleRate)),t;var t},bt.prototype.configure=function(e){if(c(e)){if(this.userConfig=p(p({},this.userConfig||{}),e||{}),!this.serverDomain){if(!this.userConfig.serverDomain)return void console.error('"serverDomain" must be configured');this.serverDomain=this.userConfig.serverDomain}this.updateCurrentSetting(),this.client?this.updateClientConfig(this.getClientOptions()):this.init()}},bt.prototype.emitEvent=function(e){var t;this.monitors.EmitMonitor&&(t=this.monitors.EmitMonitor).handOut.apply(t,s(e))},bt.prototype.init=function(){var e=this.getClientOptions();this.client=new ht(e),this.updateClientConfig(e),this.sendPageview(),this.setupMonitors(this.setMonitors()),this.getServerSetting()},bt.prototype.getServerSetting=function(){var t=this;if(this.serverSetting)return this.updateCurrentSetting(),void this.afterServerSetting();var e="https://"+this.serverDomain+"/settings/get/web?aid="+this.currentSetting.commonParams.aid;U.get(e,{success:function(e){try{t.serverSetting=e.data,t.updateCurrentSetting(),t.afterServerSetting()}catch(e){t.afterServerSetting()}},fail:function(){t.afterServerSetting()}})},bt.prototype.afterServerSetting=function(){this.updateClientConfig(this.getClientOptions()),this.client.setTransport({transport:this.userConfig.transport})},bt.prototype.updateCurrentSetting=function(){var e={commonParams:bt.getClientCommonParams(this.finderSetting),flags:bt.getClientFlags({}),custom:bt.getClientCustom({}),monitors:bt.getClientMonitorsSetting({})},t={commonParams:bt.getClientCommonParams({}),flags:bt.getClientFlags({}),custom:bt.getClientCustom({}),monitors:this.serverSetting?(r=this.serverSetting,n={JSErrorMonitor:{},PerformanceMonitor:{},BreadcrumbMonitor:{},StaticErrorMonitor:{},BaseMonitor:{},ResourcePerformanceMonitor:{},AjaxMonitor:{}},(r=r.setting).jserr&&(n.JSErrorMonitor.enable=r.jserr.enable,n.JSErrorMonitor.webIDHit=J(r.jserr.enable_user_rate),n.JSErrorMonitor.sampleRate=r.jserr.enable_sample_rate),r.performance&&(n.PerformanceMonitor.enable=r.performance.enable,n.PerformanceMonitor.webIDHit=J(r.performance.enable_user_rate),n.PerformanceMonitor.sampleRate=r.performance.enable_sample_rate),r.breadcrumb&&(n.BreadcrumbMonitor.enable=r.breadcrumb.enable),r.static_resource_error&&(n.StaticErrorMonitor.enable=r.static_resource_error.enable),r.static_resource&&(n.ResourcePerformanceMonitor.enable=r.static_resource.enable,n.ResourcePerformanceMonitor.webIDHit=J(r.static_resource.enable_user_rate),n.ResourcePerformanceMonitor.sampleRate=r.static_resource.enable_sample_rate),r.request&&(n.AjaxMonitor.enable=r.request.enable,n.AjaxMonitor.enableError=r.request.enableError,n.AjaxMonitor.webIDHit=J(r.request.enable_user_rate),n.AjaxMonitor.sampleRate=r.request.enable_sample_rate),n):bt.getClientMonitorsSetting({})},r={commonParams:bt.getClientCommonParams(this.userConfig),flags:bt.getClientFlags(this.userConfig),custom:bt.getClientCustom(this.userConfig),monitors:bt.getClientMonitorsSetting(this.userConfig)},n=this.currentSetting;this.currentSetting=o({},this.defaultSetting,t,r,e),this.currentSetting.commonParams.pid=this.currentSetting.commonParams.pid||location.pathname,this.settingEffect(this.currentSetting,n)},bt.prototype.settingEffect=function(e,t){var r;(r=e.commonParams.rangers_web_id)!==I(document.cookie,Ze)&&(document.cookie=Ze+"="+r+";max-age=7776000;domain="+location.hostname+";path=/"),t.commonParams.pid!==e.commonParams.pid&&this.sendPageview()},bt.prototype.setMonitors=function(){var t,e=this.currentSetting.commonParams,r=e.aid,n=e.rangers_web_id,o=[],i=this.currentSetting.flags,e=new me;return o.push(e),o.push(new Je),i.enableCatchJSError&&o.push(new Qe),i.hookXHR&&o.push(new ae({commonParams:{bid:r+"",web_id:n},ajaxMonitorOptions:this.currentSetting.monitors.AjaxMonitor})),i.hookFetch&&o.push(new le({commonParams:{bid:r+"",web_id:n},ajaxMonitorOptions:this.currentSetting.monitors.AjaxMonitor})),i.enableStaticError&&o.push(new De),i.enablePerformance&&(i.enableFMP?o.push(new He({fmpMonitor:e,renderType:1,preLongTaskObserver:{precollect:[],observer:void 0}})):o.push(new He({renderType:1,preLongTaskObserver:{precollect:(null===(e=window.RangersSiteHybridSDK.lt)||void 0===e?void 0:e.e)||[],observer:null===(e=window.RangersSiteHybridSDK.lt)||void 0===e?void 0:e.o}}))),i.enableBreadcrumb&&o.push(new ze),i.enableResourcePerformance&&(t=this.serverDomain,o.push(new Le({observe:!0,checkIgnore:function(e){return e.name===ut(t)||("xmlhttprequest"===e.initiatorType||"fetch"===e.initiatorType||"beacon"===e.initiatorType||"navigation"===e.initiatorType||0===e.decodedBodySize)}}))),o},bt.prototype.setupMonitors=function(e){var t=this;this.client&&this.client.sendEvent&&(e.forEach(function(e){"FMPMonitor"===(t.monitors[e.name]=e).name?e.setup(O):e.setup(null===(e=t.client)||void 0===e?void 0:e.sendEvent)}),this.updateClientConfig({monitors:this.monitors}))},bt.prototype.getUserIDFromRangers=function(t){window.collectEvent&&m(window.collectEvent)&&window.collectEvent("getToken",function(e){t(e)})},bt.prototype.sendPageview=function(){var e;null!==(e=this.client)&&void 0!==e&&e.sendEvent({name:"PageViewMonitor",event:{ev_type:"pageview"},type:"post"})},bt.prototype.getClientOptions=function(){var e=this.currentSetting;return{reportURL:ut(this.serverDomain),monitorsSetting:e.monitors,commonParams:e.commonParams,custom:e.custom}},bt.prototype.uploadClientQueue=function(){var e;null!==(e=this.client)&&void 0!==e&&e.uploadQueue()},bt.prototype.updateClientConfig=function(e){var t;null!==(t=this.client)&&void 0!==t&&t.updateConfig(e)},bt);function bt(){var r=this;this.version="0.2.22",this.serverDomain="",this.instance=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];"config"!==e[0]?"emit"!==e[0]?"report"!==e[0]?r.initOnCloseCallback():r.uploadClientQueue():r.emitEvent(e):r.configure(e[1])},this.initOnCloseCallback=function(){F(r.onCloseReport,r.visibilityChange)},this.visibilityChange=function(){"hidden"===document.visibilityState&&r.onCloseReport(),"visible"===document.visibilityState&&r.updateClientReportType("xhr")},this.onCloseReport=function(){r.updateClientReportType("beacon"),r.uploadClientQueue()},this.updateClientReportType=function(e){var t;null!==(t=r.client)&&void 0!==t&&t.updateConfig({reportType:e})},this.userConfig={},this.defaultSetting=et(),this.currentSetting=this.defaultSetting,this.serverSetting=void 0,this.finderSetting={},this.client=void 0,this.monitors={}}var wt,St=O;return M()&&(wt=new yt,St=wt.instance,null!==(yt=window.RangersSiteHybridSDK)&&void 0!==yt&&yt.q&&(u(yt=window.RangersSiteHybridSDK.q)&&yt.forEach(function(e){St.apply(void 0,s(e))}),delete window.RangersSiteHybridSDK.q),window.RangersSiteHybridSDK=wt.instance),St}(); | ||
var RangersSiteHybridSDK=function(){"use strict";var r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};var p=function(){return(p=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function a(e,t){var r={};for(o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(r[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var n=0,o=Object.getOwnPropertySymbols(e);n<o.length;n++)t.indexOf(o[n])<0&&Object.prototype.propertyIsEnumerable.call(e,o[n])&&(r[o[n]]=e[o[n]]);return r}function v(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function f(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),a=[];try{for(;(void 0===t||0<t--)&&!(n=i.next()).done;)a.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a}function s(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(f(arguments[t]));return e}function c(e){return"object"==typeof e&&null!==e&&!u(e)}function n(e){return"[object Object]"===(e=e,Object.prototype.toString.call(e))}function m(e){return"function"==typeof e}function d(e){return"[object String]"===Object.prototype.toString.call(e)}function u(e){return"[object Array]"===Object.prototype.toString.call(e)}function l(e){return"number"==typeof e}function h(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function t(e,t){if(c(e))for(var r in e)h(e,r)&&t.call(null,r,e[r])}function i(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var r={},n=0;n<e.length;)r=function(e,t){var r,n=p({},e);for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&void 0!==t[r]&&(c(t[r])&&y(t[r])?n[r]=b(c(e[r])?e[r]:{},t[r]):u(t[r])?n[r]=t[r].slice():n[r]=t[r]);return n}(r,e[n]),n++;return r}function o(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var r={},n=0;n<e.length;)r=b(r,e[n]),n++;return r}var g=Object.getPrototypeOf?Object.getPrototypeOf({}):null;function y(e){return Object.getPrototypeOf?Object.getPrototypeOf(e)===g:e.constructor===Object}function b(e,t){var r,n=p({},e);for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&void 0!==t[r]&&(c(t[r])&&y(t[r])?n[r]=b(c(e[r])?e[r]:{},t[r]):u(e[r])||u(t[r])?n[r]=function t(e,r){var e=u(e)?e:[];var r=u(r)?r:[];return Array.prototype.concat.call(e,r).map(function(e){return!(e instanceof RegExp)&&(u(e)||c(e)&&y(e))?u(e)?t([],e):b({},e):e})}(e[r],t[r]):n[r]=t[r]);return n}function w(e,t){if(!u(e))return!1;if(0===e.length)return!1;for(var r=0;r<e.length;){if(e[r]===t)return!0;r++}return!1}function S(){if("fetch"in window)try{return new Headers,new Request(""),new Response,1}catch(e){return}}function M(){return!!c(window)}function e(){return M()&&!!c(window.performance)}function P(){return e()&&!!c(window.performance.timing)}function E(){return!!e()&&!!m(window.performance.getEntries)}function _(){return M()&&"function"==typeof window.MutationObserver}function T(){return M()&&"function"==typeof window.PerformanceObserver}function k(){return!!T()&&m(window.PerformanceLongTaskTiming)}function C(){if(!T())return!1;var e=window.PerformanceObserverEntryList;return m(e)&&m(e.prototype.getEntries)}function x(e){var r,e=function(e){if(!c(e))return{};var r={};return t(e,function(e,t){c(t)||u(t)?r[e]=JSON.stringify(t):r[e]=t}),r}(e),e=(r={},t(e,function(e,t){r[encodeURIComponent(e)]=encodeURIComponent(t)}),r),n=[];return t(e,function(e,t){n.push(e+"="+t)}),n.join("&")}function R(e){var t=document.createElement("a");t.href=e;e=t.pathname||"/";return"/"!==e[0]&&(e="/"+e),{href:t.href,protocol:t.protocol.slice(0,-1),hostname:t.hostname,host:t.host,search:t.search,pathname:e,hash:t.hash}}var L=function(e){if(!d(e))return!1;return m(e.toLowerCase)&&(e=e.toLowerCase()),w(["x-tt-token"],e)};function O(){}function j(e){var t="[object String]"===Object.prototype.toString.call(e);return e?t?e.length:ArrayBuffer&&e instanceof ArrayBuffer?e.byteLength:window.Blob&&e instanceof Blob?e.size:e.length||0:0}function q(e){if(!e)return"";if(!m(e.forEach))return"";var r=[];return e.forEach(function(e){var t;u(e)&&e[0]&&!L(e[0])&&(t=e[0],e=e[1]||"",r.push(t+": "+e))}),r.join("\r\n")}function H(e){var t={},r=R(e);return t.ax_protocol=r.protocol,t.ax_domain=r.hostname,t.ax_path=r.pathname,t.ax_url=(r.href||e).split("?")[0],t}function A(e,t){e=R(e),t=R(t);return e.protocol===t.protocol&&e.host===t.host}function I(e,t){var r,n;if(!e||!t)return"";var o=e.split(";"),i={};try{for(var a=v(o),s=a.next();!s.done;s=a.next()){var c=s.value.split("="),u=d(c[0])&&c[0].trim();u&&d(c[1])&&(i[u]=c[1].trim())}}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}return i[t]||""}function D(e){return u(e)&&e.length?function(e){for(var t=[],r=e.length,n=0;n<r;n++){var o=e[n];d(o)?t.push(o.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")):o&&o.source&&t.push(o.source)}return new RegExp(t.join("|"),"i")}(e):null}function F(t,r){m(t)&&(m(window.addEventListener)&&(window.addEventListener("unload",t),window.addEventListener("beforeunload",t),window.addEventListener("pagehide",t)),m(document.addEventListener)&&document.addEventListener("visibilitychange",function(e){m(r)?r(e):"hidden"===document.visibilityState&&t(e)}))}var B=function(e){var t,r;return void 0===e&&(e=window),M()&&null!==(t=e.screen)&&void 0!==t&&t.width&&null!==(r=e.screen)&&void 0!==r&&r.height?e.screen.width+"x"+e.screen.height:"0x0"},N=function(){var e="unknown",t=navigator.connection||navigator.mozConnection||navigator.webkitConnection;return t&&d(t.effectiveType)?t.effectiveType:e};function J(e){return!!e&&Math.random()<Number(e)}var U=(X.post=function(e,t,r){var n=r&&r.success||O,o=r&&r.fail||O,r=new XMLHttpRequest;r.open("POST",e,!0),r.setRequestHeader("Content-Type","application/json"),r.send(JSON.stringify(t)),r.onload=function(){try{var e;this.responseText?(e=JSON.parse(this.responseText),n(e)):n({})}catch(e){o()}},r.onerror=function(){o()},r.onabort=function(){o()}},X.get=function(e,t){var r=t&&t.success||O,n=t&&t.fail||O,o=t&&t.getResponse||O,i=t&&t.getResponseText||O,a=new XMLHttpRequest;t&&t.withCredentials&&(a.withCredentials=t.withCredentials),a.open("GET",e),a.send(),a.onload=function(){o(null==this?void 0:this.response),i(this.responseText);try{var e;this.responseText?(e=JSON.parse(this.responseText),r(e)):r({})}catch(e){n()}},a.onerror=function(){n()},a.onabort=function(){n()}},X.prototype.getCommonParams=function(){return{timestamp:Date.now()}},X);function X(e){var t=this;this.postEvent=function(e){e=p(p({},e),t.getCommonParams());X.post(t.url,e)},this.getEvent=function(e){e=x(p(p({},e),t.getCommonParams())),e=t.url+"?"+e;X.get(e)},this.getURL=function(){return t.url},this.options=e,this.url=this.options.reportURL}function z(e,t,r){if(void 0===r&&(r="0"),1<r.length)throw new TypeError("expect the length of pad to be 1, but got "+e.length);return e.length>=t?e:""+Array.from({length:t-e.length}).fill(r).join("")+e}function V(e){return e?Math.floor(Math.random()*Math.pow(10,12)).toString(16).substr(0,e):""}var K="x-tt-trace-id",G="x-tt-trace-host",Q="x-tt-logid";function W(e,t,r){void 0===r&&(r="01");t=""+z((Date.now()%4294967295).toString(16),8)+function(e){if("number"==typeof e)r=e;else{var t=e.replace(/-/g,"");if(!/^[0-9]+$/.test(t)){if(18<t.length)return"18"+V(18);e=22-t.length-4;return""+z(""+t.length,2)+t+V(e)}r=parseInt(t,10)}var r=22-(t=r.toString(16)).length-4;return""+z(""+t.length,2)+t+V(r)}(e)+("string"==typeof t?V(4):z(t.toString(16),4));return"00-"+t+"-"+t.substr(0,16)+"-"+r}function $(){var e=function(){for(var e=new Array(16),t=0,r=0;r<16;r++)0==(3&r)&&(t=4294967296*Math.random()),e[r]=t>>>((3&r)<<3)&255;return e}();return e[6]=15&e[6]|64,e[8]=63&e[8]|128,function(e){for(var t=[],r=0;r<256;++r)t[r]=(r+256).toString(16).substr(1);var n=0;return[t[e[n++]],t[e[n++]],t[e[n++]],t[e[n++]],"-",t[e[n++]],t[e[n++]],"-",t[e[n++]],t[e[n++]],"-",t[e[n++]],t[e[n++]],"-",t[e[n++]],t[e[n++]],t[e[n++]],t[e[n++]],t[e[+n]],t[e[15]]].join("")}(e)}function Y(){return m(Date)?Math.round(Date.now()/1e3):0}var Z=.1,ee=["/log/sentry/"],te=8e3,re=4e3;$(),$();function ne(e,r){if(!c(e))return{};if(!m(r))return{};var n={};return t(e,function(e,t){r(t)&&(n[e]=t)}),n}function oe(e){var t,r,n,o,i=null;return c(e)&&("timer"===e.type&&(i=c(t=e.event)&&d(t.name)&&l(t.value)?{metrics_type:"timer",event_name:"default",metrics:((r={})[t.name]=t.value,r),category:ne(t.tags,d),timestamp:Y()}:{}),"counter"===e.type&&(i=c(o=e.event)&&d(o.name)&&l(o.value)?{metrics_type:"counter",event_name:"default",metrics:((n={})[o.name]=o.value,n),category:ne(o.tags,d),timestamp:Y()}:{}),"log"===e.type&&(i=c(n=e.event)&&d(n.value)?{metrics_type:"log",event_name:"default",log_content:n.value,log_level:null!==(o=n.level)&&void 0!==o?o:"info",category:ne(n.tags,d),timestamp:Y()}:{}),"custom"===e.type&&(i=c(e=e.event)&&d(e.event_name)?{metrics_type:"custom",event_name:e.event_name,metrics:ne(e.metrics,l),category:ne(e.tags,d),timestamp:Y()}:{})),i}var ie="AjaxMonitor",ae=(se.prototype.setup=function(e){void 0===e&&(e=O),m(XMLHttpRequest)&&(this.callback=e,this.start())},se.prototype.updateConfig=function(e){this.props=o({},this.props,e)},se.prototype.start=function(){this.hookXMLHttpRequestOpen(),this.hookXMLHttpRequestSend(),this.hookXMLHttpRequestSetRequestHeader()},se.prototype.hookXMLHttpRequestSetRequestHeader=function(){var r=XMLHttpRequest.prototype.setRequestHeader||O;XMLHttpRequest.prototype.setRequestHeader=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this._requestHeaders=this._requestHeaders||[],this._requestHeaders.push(e),r.apply(this,e)}},se.prototype.hookXMLHttpRequestOpen=function(){var o=XMLHttpRequest.prototype.open;XMLHttpRequest.prototype.open=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=e[0],n=e[1];return this._url=n||"",this._method=(null==r?void 0:r.toLowerCase())||"",o.apply(this,e)}},se.prototype.hookXMLHttpRequestSend=function(){var o=this,i=XMLHttpRequest.prototype.send;XMLHttpRequest.prototype.send=function(){for(var e,t,r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];return o.checkAddTrace(this._url)&&(e=(t=null!==(e=null==o?void 0:o.props.commonParams)&&void 0!==e?e:{}).bid,t=t.web_id,e&&t&&(o.traceId=W(t,e),this.setRequestHeader(K,o.traceId))),o.hookXMLHttpRequestOnreadystatechange.call(this,o),this._start=Date.now(),this._data=null==r?void 0:r[0],i.apply(this,r)}},se.prototype.checkAddTrace=function(e){var t=null!==(n=this.props.commonParams)&&void 0!==n?n:{},r=t.bid,n=t.web_id,t=(null!==(t=this.props.ajaxMonitorOptions)&&void 0!==t?t:{}).sampleHitTrace,e=A(location.href,e);return r&&n&&t&&e},se.prototype.collectErrorRequest=function(){var e;return null!==(e=null===(e=this.props.ajaxMonitorOptions)||void 0===e?void 0:e.errorRequestCollect)&&void 0!==e&&e},se.prototype.hookXMLHttpRequestOnreadystatechange=function(i){var a=this.onreadystatechange,s=this;this.onreadystatechange=function(){for(var e,t,r,n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];if(4===this.readyState&&(t={ev_type:"ajax",ax_status:(this.status||0).toString(),ax_type:s._method,ax_request_header:q(s._requestHeaders||[]),ax_domain:"",ax_duration:0,ax_path:"",ax_protocol:"",ax_response_header:"",ax_size:0,ax_url:""},"function"==typeof this.getAllResponseHeaders&&(t.ax_response_header=function(t){if(d(t)){var e=t.split("\r\n"),r=[];return e.forEach(function(e,t){e&&m(e.split)&&(e=e.split(": "),r.push([e[0],e[1]]))}),q(r)}return c(t)?q(Object.keys(t).map(function(e){return[e,t[e]]})):t}(this.getAllResponseHeaders())),!i.checkAddTrace(s._url)||(r=null!==(r=i.traceId)&&void 0!==r?r:this.getResponseHeader(K))&&(t.trace_id=r,t.trace_host=null!==(e=this.getResponseHeader(G))&&void 0!==e?e:void 0,t.log_id=null!==(e=this.getResponseHeader(Q))&&void 0!==e?e:void 0),t.ax_duration=Date.now()-s._start,200===this.status&&(t.ax_size=function(e){var t=0;if(""===e.responseType||"text"===e.responseType)t=j(e.responseText);else if(e.response)t=j(e.response);else try{t=j(e.responseText)}catch(e){t=0}return t}(this)),t=p(p({},t),H(s._url)),i.collectErrorRequest()&&"2"!==t.ax_status[0]&&"3"!==t.ax_status[0]&&(t.ax_request={body:s._data?""+s._data:void 0,search:null===(e=R(s._url))||void 0===e?void 0:e.search,content_type:null===(e=null===(e=s._requestHeaders)||void 0===e?void 0:e.find(function(e){return"content-type"===e[0].toLowerCase()}))||void 0===e?void 0:e[1]}),m(i.callback)&&i.callback({name:i.name,type:"get",event:t})),a)return a.apply(this,n)}},se.monitorName=ie,se);function se(e){this.name=ie,this.callback=O,this.traceId=null,this.props=e}function ce(e){return e instanceof Request}var ue="FetchMonitor",le=(pe.prototype.updateConfig=function(e){this.props=o({},this.props,e)},pe.prototype.setup=function(e){void 0===e&&(e=O),S()&&(this.callback=e,this.start())},pe.prototype.start=function(){S()&&this.hookFetch()},pe.prototype.checkAddTrace=function(e){var t=null!==(n=null===(r=this.props)||void 0===r?void 0:r.commonParams)&&void 0!==n?n:{},r=t.bid,n=t.web_id,t=(null!==(t=null===(t=null==this?void 0:this.props)||void 0===t?void 0:t.ajaxMonitorOptions)&&void 0!==t?t:{}).sampleHitTrace,e=A(location.href,e);return r&&n&&t&&e},pe.prototype.updateAxRequest=function(e,t,r){var n,o;this.collectErrorRequest()&&"2"!==e.ax_status[0]&&"3"!==e.ax_status[0]&&(o=this.getFetchUrl(t,!0),e.ax_request={body:null===(t=this.getFetchBody(t,r))||void 0===t?void 0:t.toString(),search:!d(o)||null===(n=R(o))||void 0===n?void 0:n.search,content_type:null===(r=null==r?void 0:r.headers)||void 0===r?void 0:r["Content-Type"]})},pe.prototype.collectErrorRequest=function(){var e;return null!==(e=null===(e=this.props.ajaxMonitorOptions)||void 0===e?void 0:e.errorRequestCollect)&&void 0!==e&&e},pe.prototype.hookFetch=function(){var c=this,u=this,l=window.fetch;window.fetch=function(n,o){void 0===o&&(o={});var i=c.getFetchUrl(n);if(!function(e){if(d(e)){var t=f(e.split(":"),2),e=t[0];return!t[1]||("http"===e||"https"===e)}}(i))return l(n,o);var e=null!==(e=c.props.commonParams)&&void 0!==e?e:{},t=e.bid,r=e.web_id,a=Date.now(),s={ev_type:"ajax"};try{u.checkAddTrace(i)&&(o.headers=new Headers(function(e,t){var r=new Headers;ce(e)&&e.headers&&m(e.headers.forEach)&&e.headers.forEach(function(e,t){r.append(t,e)});t.headers&&new Headers(t.headers).forEach(function(e,t){r.append(t,e)});return r}(n,o)),t&&r&&(s.trace_id=W(t,r),o.headers.append(K,s.trace_id)))}catch(e){}return s.ax_type=c.getFetchMethod(n,o),s=p(p({},s),H(i)),l(n,o).then(function(e){var t,r;return s.ax_status=(e.status||0).toString(),s.ax_duration=Date.now()-a,s.ax_response_header=u.getAllHeaders(e.headers),s.ax_request_header=u.getAllHeaders(o.headers),e.headers&&m(e.headers.has)?(e.headers.has("content-length")?s.ax_size=Number(e.headers.get("content-length"))||0:s.ax_size=0,u.checkAddTrace(i)&&(e.headers.has(G)&&(s.trace_host=null!==(t=e.headers.get(G))&&void 0!==t?t:void 0),e.headers.has(K)&&(s.trace_id=null!==(r=e.headers.get(K))&&void 0!==r?r:void 0),e.headers.has(Q)&&(s.log_id=null!==(r=e.headers.get(Q))&&void 0!==r?r:void 0))):s.ax_size=0,c.updateAxRequest(s,n,o),m(u.callback)&&u.callback({name:u.name,type:"get",event:s}),e},function(e){return s.ax_status="0",s.ax_size=0,s.ax_duration=Date.now()-a,c.updateAxRequest(s,n,o),m(u.callback)&&u.callback({name:u.name,type:"get",event:s}),Promise.reject(e)})}},pe.prototype.getFetchUrl=function(e,t){void 0===t&&(t=!1);var r="",r=ce(e)?e.url:e;return t||(r=d(r)?r.split("?")[0]:r),r},pe.prototype.getFetchMethod=function(e,t){t=null!==(t=null==t?void 0:t.method)&&void 0!==t?t:"get";return ce(e)&&(t=null!==(e=e.method)&&void 0!==e?e:t),t.toLowerCase()},pe.prototype.getFetchBody=function(e,t){return ce(e)?e.body:null==t?void 0:t.body},pe.prototype.getAllHeaders=function(e){if(!e||"function"!=typeof e.forEach)return"";var r=[];return e.forEach(function(e,t){r.push([t,e])}),q(r)},pe.monitorName=ue,pe);function pe(e){this.name=ue,this.callback=O,this.props=e}var fe="FMPMonitor",me=(de.prototype.setup=function(e){if(M())return _()?void(m(document.querySelector)&&(this.callback=e&&m(e)?e:function(){},this.startTime=Date.now(),this.list=[],m(this.observer.observe)&&this.observer.observe(document,{childList:!0,subtree:!0}))):null},de.prototype.count=function(){var e=Date.now()-this.startTime,t=document.querySelector("body");t?this.list.push({score:this.score(t,1,!1),time:e}):this.list.push({score:0,time:e})},de.prototype.score=function(e,t,r){var n,o=0,i=e.tagName;if("SCRIPT"!==i&&"STYLE"!==i&&"META"!==i&&"HEAD"!==i&&!w((null===(n=this.props)||void 0===n?void 0:n.ignoreTags)||[],i)){i=e.children?e.children.length:0;if(0<i)for(var a=e.children,s=i-1;0<=s;s--)o+=this.score(a[s],t+1,0<o);if(o<=0&&!r){if(!e.getBoundingClientRect||!m(e.getBoundingClientRect))return 0;e=e.getBoundingClientRect();if(!e)return 0;if(e.top>window.innerHeight)return 0;if(e.height<=0)return 0}o+=1+.5*t}return o},de.prototype.getFmpInternal=function(){if(!this.observer)return 0;if(this.disconnect(),!this.list.length)return 0;for(var e,t={time:this.list[0].time,rate:0},r=1;r<this.list.length;r++)this.list[r].time>=this.list[r-1].time&&(e=this.list[r].score-this.list[r-1].score,t.rate<e&&(t={time:this.list[r].time,rate:e}));return t.time},de.prototype.getTimeGap=function(){return P()?this.startTime-performance.timing.navigationStart:0},de.prototype.formatEvent=function(e){return{name:this.name,type:"post",event:{ev_type:"fmp",fmp:e}}},de.monitorName=fe,de);function de(e){var r=this;this.name=fe,this.callback=O,this.disconnect=function(){var e,t;null!==(t=null===(e=r.observer)||void 0===e?void 0:e.disconnect)&&void 0!==t&&t.call(e)},this.getLoadFmp=function(){var e=r.getFmpInternal(),e=e?r.getTimeGap()+e:0,e=r.formatEvent(e);return r.callback(e),e},this.getFmp=function(){var e=r.getFmpInternal(),e=r.formatEvent(e);return r.callback(e),e},this.props=e,this.startTime=Date.now(),this.list=[],this.observer=new MutationObserver(this.count.bind(this))}function he(){}var ve=!1,ge=!1,ye={uniqueId:0,originals:{},proxies:{},patchXMLHTTPRequest:function(i){this.originals.send=XMLHttpRequest.prototype.send,XMLHttpRequest.prototype.send=function(){for(var t=this,e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];var n=ye.uniqueId++;i.beforeCb(n);var o=this.onreadystatechange;return this.onreadystatechange=function(e){null!=o&&o.call(t,e),4===t.readyState&&i.afterCb(n)},ye.originals.send.apply(this,e)},this.proxies.send=XMLHttpRequest.prototype.send},patchFetch:function(o){var i;S()&&(i=window.fetch,this.originals.fetch=i,window.fetch=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return new Promise(function(t,r){var n=ye.uniqueId++;o.beforeCb(n),i.apply(void 0,s(e)).then(function(e){o.afterCb(n),t(e)},function(e){o.afterCb(n,e),r(e)})})},this.proxies.fetch=window.fetch)},observeResourceFetchingMutations:function(a){if(_()){var s=["img","script","iframe","link","audio","video","source"],e=new MutationObserver(function(e){var t,r;try{for(var n=v(e),o=n.next();!o.done;o=n.next()){var i=o.value;("childList"===i.type&&function e(t,r){var n,o;try{for(var i=v(t),a=i.next();!a.done;a=i.next()){var s=a.value;if(r.includes(s.nodeName.toLowerCase())||s.children&&e(s.children,r))return 1}}catch(e){n={error:e}}finally{try{a&&!a.done&&(o=i.return)&&o.call(i)}finally{if(n)throw n.error}}}(i.addedNodes,s)||"attributes"===i.type&&s.includes(i.target.nodeName.toLowerCase()))&&a(i)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}});return e.observe(document,{attributes:!0,childList:!0,subtree:!0,attributeFilter:["href","src"]}),e}},resetOriginals:function(){this.originals.send&&XMLHttpRequest.prototype.send===this.proxies.send&&(ve=!1,XMLHttpRequest.prototype.send=this.originals.send),this.originals.fetch&&fetch===this.proxies.fetch&&(ge=!1,window.fetch=this.originals.fetch)}},be="TTIMonitor",we=(Se.prototype.setup=function(){},Se.prototype.isEnable=function(){return k()&&!!T()&&m(window.PerformanceResourceTiming)&&C()},Se.prototype.registerPerformanceObserver=function(){var s=this;this.performanceObserver=new PerformanceObserver(function(e){var t,r,n=e.getEntries();try{for(var o=v(n),i=o.next();!i.done;i=o.next()){var a=i.value;"resource"===a.entryType&&s.networkRequestFinishedCallback(a),"longtask"===a.entryType&&s.longTaskFinishedCallback(a)}}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}});try{this.performanceObserver.observe({type:"longtask"}),this.performanceObserver.observe({type:"resource",buffered:!0})}catch(e){this.performanceObserver.observe({entryTypes:["longtask","resource"]})}},Se.prototype.unregisterListeners=function(){this.performanceObserver&&this.performanceObserver.disconnect(),this.mutationObserver&&this.mutationObserver.disconnect(),ye.resetOriginals(),this.proxyConfig&&(this.proxyConfig.beforeCb=he,this.proxyConfig.afterCb=he)},Se.prototype.rescheduleTimer=function(e){var t=this;this.scheduleTimerTasks&&(this.timerActivationTime>e||(clearTimeout(this.timerId),this.timerId=window.setTimeout(function(){t.checkTTI()},e-performance.now()),this.timerActivationTime=e))},Se.prototype.startSchedulingTimerTasks=function(){this.scheduleTimerTasks=!0;var e=0<this.longTasks.length?this.longTasks[this.longTasks.length-1].end:0,t=this.computeLastKnownNetwork2Busy(this.incompleteRequestStarts,this.networkRequests);this.rescheduleTimer(Math.max(t+5e3,e))},Se.prototype.registerListeners=function(){ve||(ye.patchXMLHTTPRequest(this.proxyConfig),ve=!0),ge||(ye.patchFetch(this.proxyConfig),ge=!0),this.registerPerformanceObserver(),this.useMutationObserver&&(this.mutationObserver=ye.observeResourceFetchingMutations(this.mutationObserverCallback.bind(this)))},Se.prototype.mutationObserverCallback=function(e){this.rescheduleTimer(performance.now()+5e3)},Se.prototype.beforeJSInitiatedRequestCallback=function(e){this.incompleteJSInitiatedRequestStartTimes[e]=performance.now()},Se.prototype.afterJSInitiatedRequestCallback=function(e){this.incompleteJSInitiatedRequestStartTimes[e]=void 0},Se.prototype.networkRequestFinishedCallback=function(e){this.networkRequests.push({start:e.fetchStart,end:e.responseEnd}),this.rescheduleTimer(this.computeLastKnownNetwork2Busy(this.incompleteRequestStarts,this.networkRequests)+5e3)},Object.defineProperty(Se.prototype,"incompleteRequestStarts",{get:function(){for(var e=Object.keys(this.incompleteJSInitiatedRequestStartTimes),t=[],r=0;r<e.length;r++){var n=this.incompleteJSInitiatedRequestStartTimes[e[r]];"number"==typeof n&&t.push(n)}return t},enumerable:!1,configurable:!0}),Se.prototype.longTaskFinishedCallback=function(e){var t=e.startTime+e.duration;this.longTasks.push({start:e.startTime,end:t}),this.rescheduleTimer(t+5e3)},Se.prototype.checkTTI=function(){var e=this.computeLastKnownNetwork2Busy(this.incompleteRequestStarts,this.networkRequests),t=this.getFirstPaintTime()||performance.timing.domContentLoadedEventEnd-performance.timing.navigationStart,r=this.getMinValue(),n=performance.now();null===r&&this.rescheduleTimer(Math.max(e+5e3,n+1e3));n=this.computeTTI(t,r,e,n,this.longTasks);n?(this.callback&&"function"==typeof this.callback&&this.callback(Math.round(n)),this.disable()):this.rescheduleTimer(performance.now()+1e3)},Se.prototype.getMinValue=function(){if(this.minValue)return this.minValue;if(performance.timing.domContentLoadedEventEnd){var e=performance.timing;return e.domContentLoadedEventEnd-e.navigationStart}return null},Se.prototype.getFirstPaintTime=function(){if("PerformancePaintTiming"in window){var e=performance.getEntriesByType("paint")[0];return e?e.startTime:0}return 0},Se.prototype.disable=function(){clearTimeout(this.timerId),this.scheduleTimerTasks=!1,this.unregisterListeners(),this.snippetObserver&&this.snippetObserver.disconnect(),this.snippetEntries&&this.snippetEntries.splice(0,this.snippetEntries.length)},Se.prototype.computeLastKnownNetwork2Busy=function(e,t){var r,n,o,i;if(2<e.length)return performance.now();var a=[];try{for(var s=v(t),c=s.next();!c.done;c=s.next()){var u=c.value;a.push({timestamp:u.start,type:"requestStart"}),a.push({timestamp:u.end,type:"requestEnd"})}}catch(e){r={error:e}}finally{try{c&&!c.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}try{for(var l=v(e),p=l.next();!p.done;p=l.next()){var f=p.value;a.push({timestamp:f,type:"requestStart"})}}catch(e){o={error:e}}finally{try{p&&!p.done&&(i=l.return)&&i.call(l)}finally{if(o)throw o.error}}a.sort(function(e,t){return e.timestamp-t.timestamp});for(var m=e.length,d=a.length-1;0<=d;d--){var h=a[d];switch(h.type){case"requestStart":m--;break;case"requestEnd":if(2<++m)return h.timestamp;break;default:throw Error("Internal Error: This should never happen")}}return 0},Se.monitorName=be,Se);function Se(e){var t,r,n,o=this;if(this.name=be,this.longTasks=[],this.callback=he,this.useMutationObserver=!0,this.minValue=null,this.isAsync=0,this.networkRequests=[],this.incompleteJSInitiatedRequestStartTimes={},this.timerActivationTime=-1/0,this.scheduleTimerTasks=!1,this.proxyConfig={beforeCb:this.beforeJSInitiatedRequestCallback.bind(this),afterCb:this.afterJSInitiatedRequestCallback.bind(this)},this.getTTI=function(e){o.callback=e,o.isEnable()?o.startSchedulingTimerTasks():o.callback&&"function"==typeof o.callback&&o.callback()},this.computeTTI=function(e,t,r,n,o){if(n-r<5e3)return null;o=0===o.length?e:o[o.length-1].end;return n-o<5e3?null:Math.max(o,t)},this.isEnable()){if(this.useMutationObserver=!!e.useMutationObserver,this.minValue=null!==(n=e.minValue)&&void 0!==n?n:null,this.isAsync=null!==(n=e.isAsync)&&void 0!==n?n:0,this.snippetEntries=null===(n=null==e?void 0:e.preLongTaskObserver)||void 0===n?void 0:n.precollect,this.snippetObserver=null===(e=null==e?void 0:e.preLongTaskObserver)||void 0===e?void 0:e.observer,!this.isAsync&&this.snippetEntries&&0<this.snippetEntries.length)try{for(var i=v(this.snippetEntries),a=i.next();!a.done;a=i.next()){var s=a.value;"longtask"===s.entryType?this.longTasks.push({start:s.startTime,end:s.startTime+s.duration}):"resource"===s.entryType&&this.networkRequests.push({start:s.fetchStart,end:s.responseEnd})}}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}this.registerListeners()}}function Me(e){try{for(var t,r=e,n=[],o=0,i=0,a=" > ".length;r&&o++<5&&!("html"===(t=function(e){var t,r,n,o,i=e,a=[];if(!i||!i.tagName)return"";a.push(i.tagName.toLowerCase()),i.id&&a.push("#"+i.id);e=i.className;if(e&&d(e))for(t=e.split(/\s+/),o=0;o<t.length;o++)a.push("."+t[o]);var s=["type","name","title","alt"];for(o=0;o<s.length;o++)r=s[o],(n=i.getAttribute(r))&&a.push("["+r+'="'+n+'"]');return a.join("")}(r))||1<o&&80<=i+n.length*a+t.length);)n.push(t),i+=t.length,r=r.parentNode;return n.reverse().join(" > ")}catch(e){return"<unknown>"}}var Pe="FIDMonitor",Ee=(_e.prototype.setup=function(e){var s=this;if(T()&&PerformanceObserver.supportedEntryTypes&&PerformanceObserver.supportedEntryTypes.includes("first-input")&&C()){this.callback=e,this.observer=new PerformanceObserver(function(e,t){var r,n;try{for(var o=v(e.getEntries()),i=o.next();!i.done;i=o.next()){var a=i.value,a=a.processingStart-a.startTime;s.callback({name:s.name,fid:Math.round(a)})}}catch(e){r={error:e}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}t.disconnect()});try{this.observer.observe({type:"first-input",buffered:!0})}catch(e){this.observer.observe({entryTypes:["first-input"]})}}},_e.monitorName=Pe,_e);function _e(){this.name=Pe,this.callback=O}var Te="MPFIDMonitor",ke=(Ce.prototype.setup=function(){var t,e,r,a=this;if(k()&&C()){if(!this.props.isAsync){var n=null!==(r=null===(r=this.props.preLongTaskObserver)||void 0===r?void 0:r.precollect)&&void 0!==r?r:[];if(n&&0<n.length)try{for(var o=v(n),i=o.next();!i.done;i=o.next()){var s=i.value;"longtask"===s.entryType&&this.list.push(s)}}catch(e){t={error:e}}finally{try{i&&!i.done&&(e=o.return)&&e.call(o)}finally{if(t)throw t.error}}}this.observer=new PerformanceObserver(function(e){var t,r;try{for(var n=v(e.getEntries()),o=n.next();!o.done;o=n.next()){var i=o.value;a.list.push(i)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}}),this.observer.observe({entryTypes:["longtask"]})}},Ce.prototype.getMPFID=function(){var t,e;if(k()&&C()){this.observer&&this.observer.disconnect();var r=0;try{for(var n=v(this.list),o=n.next();!o.done;o=n.next()){var i=o.value;r<i.duration&&(r=i.duration)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(t)throw t.error}}return this.formatEvent(Math.round(r))}},Ce.prototype.formatEvent=function(e){return{name:this.name,mpfid:e}},Ce.monitorName=Te,Ce);function Ce(e){this.name=Te,this.list=[],this.props=e}var xe=["xmlhttprequest","fetch"],Re="ResourcePerformanceMonitor",Le=(Oe.prototype.setup=function(e){this.isEnable()&&(this.callback=null!=e?e:O,this.isAsync&&window.performance.clearResourceTimings(),this.observe&&(this.sendResourcePerformance(performance.getEntriesByType("resource")),this.observePerformance()))},Oe.prototype.isEnable=function(){return E()&&"function"==typeof performance.clearResourceTimings},Oe.prototype.getPerformance=function(){return this.isEnable()?this.buildParams(this.getResources()):this.buildParams([])},Oe.prototype.buildParams=function(e){var t=this,r=[];if(e.forEach(function(e){w(xe,e.initiatorType)||m(t.checkIgnore)&&t.checkIgnore(e)||r.push(e)}),r.length)return{name:this.name,type:"post",event:{ev_type:"resource_performance",resources:r}}},Oe.prototype.sendResourcePerformance=function(e){e=this.buildParams(e);e&&this.callback(e)},Oe.prototype.getResources=function(){return window.performance.getEntriesByType("resource")},Oe.prototype.observePerformance=function(){var t=this;T()&&new PerformanceObserver(function(e){e=e.getEntries();e.length&&t.sendResourcePerformance(e)}).observe({entryTypes:["resource"]})},Oe.monitorName=Re,Oe);function Oe(e){var t,r=this;this.name=Re,this.callback=O,this.getResourcePerformance=function(){var e;return null!==(e=r.getPerformance())&&void 0!==e?e:{}},this.isAsync=null!==(t=null==e?void 0:e.isAsync)&&void 0!==t?t:0,this.observe=null!==(t=null==e?void 0:e.observe)&&void 0!==t&&t,this.checkIgnore=null!==(e=null==e?void 0:e.checkIgnore)&&void 0!==e?e:function(){return!1}}var je={ev_type:"perf",isAsync:0,dns:0,tcp:0,request:0,response:0,processing:0,blank:0,domready:0,load:0,has_resource:0,domparse:0,resource:0,ttfb:0,redirect:0,tti:0,upload_reason:"sample",network_type:"",timing:{},navigation_timing:{},navigation:{},resources:[]},qe="PerformanceMonitor",He=(Ae.prototype.setup=function(e){var t,r=this;P()&&(this.callback=e,t=function(){r.hasLoaded=!0,r.performanceAuto&&(r.perfTimer=setTimeout(function(){r.perfLog()},200))},"complete"!==document.readyState?window.addEventListener("load",function(){setTimeout(function(){t()},0)},!1):t(),this.sendParams=p({},je),this.staticPerformanceMonitor=new Le,this.staticPerformanceMonitor.setup(),(new Ee).setup(this.hasFID),this.mpfidMonitor=new ke({isAsync:0,preLongTaskObserver:this.props.preLongTaskObserver}),this.mpfidMonitor.setup(),e=null!==(e=this.props.TTIMonitor)&&void 0!==e?e:we,this.ttiMonitor=new e({isAsync:0,preLongTaskObserver:this.props.preLongTaskObserver}),this.ttiMonitor.setup(),e=this.syncPerfLog.bind(this),F(e))},Ae.prototype.performanceNow=function(){var e;return null!==performance&&void 0!==performance&&performance.now?performance.now():(Date.now?Date.now():+new Date)-(null!==(e=null===(e=performance.timing)||void 0===e?void 0:e.navigationStart)&&void 0!==e?e:0)},Ae.prototype.getBounced=function(){return!this.hasLoaded},Ae.prototype.getPaintTime=function(t){if(E()){var e=performance.getEntriesByType("paint");if(u(e)){e=e.filter(function(e){return e.name===t});return e.length&&e[0]&&c(e[0])&&e[0].startTime||0}}return 0},Ae.monitorName=qe,Ae);function Ae(e){var o=this;this.name=qe,this.callback=O,this.sendParams=p({},je),this.finalSendParams=this.sendParams,this.hasLoaded=!1,this.initStart=0,this.hasSentInitPerf=!1,this.initFlag=!0,this.performanceAuto=!0,this.send=function(){o.initFlag&&o.hasLoaded&&(o.sendParams.isAsync&&(o.sendParams.load=Math.round(o.performanceNow()-o.initStart)),setTimeout(function(){o.perfLog()},200))},this.initAsync=function(){var e,t;o.hasSentInitPerf&&(o.sendParams=p({},je),o.sendParams.isAsync=1,o.initFlag=!0,o.initStart=o.performanceNow(),o.staticPerformanceMonitor=new Le({isAsync:1}),o.staticPerformanceMonitor.setup(),o.mpfidMonitor=new ke({isAsync:1,preLongTaskObserver:o.props.preLongTaskObserver}),o.mpfidMonitor.setup(),t=null!==(e=o.props.TTIMonitor)&&void 0!==e?e:we,o.ttiMonitor=new t({minValue:Math.round(o.performanceNow()),isAsync:1,preLongTaskObserver:o.props.preLongTaskObserver}),o.ttiMonitor.setup(),null!==(t=null===(e=o.fmpMonitor)||void 0===e?void 0:e.setup)&&void 0!==t&&t.call(e,O))},this.stopAutoPerf=function(){o.performanceAuto=!1,clearTimeout(o.perfTimer)},this.getPerformance=function(){return o.finalSendParams.tti||("complete"===document.readyState?o.perfLog():o.perfLog(!0)),o.buildParams(o.finalSendParams)},this.buildParams=function(e){return{name:o.name,type:"post",event:e}},this.perfLog=function(e){if(void 0===e&&(e=!1),P()){if(o.initFlag=!1,o.finalSendParams=p({},o.sendParams),!o.sendParams.isAsync){var t=o.getBounced();if(t)return o.finalSendParams.bounced=t,void o.invokeCallback(0,o.buildParams(o.finalSendParams));o.finalSendParams=p(p({},o.finalSendParams),o.getParams())}var r=o.getStaticResources(),n=o.getFMP(),t=o.getMPFID();r&&(o.finalSendParams.resources=r,o.finalSendParams.has_resource=1),n&&(o.finalSendParams.fmp=Math.round(n)),n&&o.finalSendParams.fcp&&o.finalSendParams.fmp<o.finalSendParams.fcp&&(o.finalSendParams.fmp=o.finalSendParams.fcp),t&&(o.finalSendParams.mpfid=t),m(o.callback)&&(!e&&o.ttiMonitor&&m(o.ttiMonitor.getTTI)?o.ttiMonitor.getTTI(function(e){e&&0<e&&(o.finalSendParams.tti=o.finalSendParams.isAsync?Math.round(e-o.initStart):e),o.invokeCallback(o.finalSendParams.isAsync,o.buildParams(o.finalSendParams))}):o.invokeCallback(o.finalSendParams.isAsync,o.buildParams(o.finalSendParams)))}},this.invokeCallback=function(e,t){if(!e){if(o.hasSentInitPerf)return;o.hasSentInitPerf=!0}o.callback(t)},this.getStaticResources=function(){var e;if(o.staticPerformanceMonitor&&m(o.staticPerformanceMonitor.getResourcePerformance)){var t=o.staticPerformanceMonitor.getResourcePerformance();if(null!==(e=null==t?void 0:t.event)&&void 0!==e&&e.resources)return t.event.resources||[]}},this.getFMP=function(){var e,t;return o.fmpMonitor?(o.fmpMonitor.disconnect(),o.sendParams.isAsync?(null===(e=null==(t=o.fmpMonitor.getFmp())?void 0:t.event)||void 0===e?void 0:e.fmp)||0:m(o.fmpMonitor.getLoadFmp)?1!==o.props.renderType?2===o.props.renderType?o.getPaintTime("first-contentful-paint"):0:null!==(t=null===(t=(t=o.fmpMonitor.getLoadFmp()||{}).event)||void 0===t?void 0:t.fmp)&&void 0!==t?t:0:0):0},this.getMPFID=function(){if(o.mpfidMonitor&&m(o.mpfidMonitor.getMPFID)){var e=o.mpfidMonitor.getMPFID();if(e)return e.mpfid}},this.syncPerfLog=function(){var e,t;o.hasSentInitPerf||(o.perfLog(!0),null!==(t=(e=o.props).report)&&void 0!==t&&t.call(e))},this.hasFID=function(e){o.sendParams.fid=e.fid},this.getParams=function(){if(P()){var e={},t=window.performance.timing;e.dns=t.domainLookupEnd-t.domainLookupStart,e.tcp=t.connectEnd-t.connectStart,e.request=t.responseStart-t.requestStart,e.response=t.responseEnd-t.responseStart,e.processing=t.domComplete-t.domLoading,e.blank=t.responseEnd-t.navigationStart,e.domready=t.domInteractive-t.navigationStart,e.load=t.loadEventEnd-t.navigationStart,t.secureConnectionStart&&(e.ssl=t.connectEnd-t.secureConnectionStart),e.domparse=t.domInteractive-t.responseEnd,e.resource=t.loadEventStart-t.domContentLoadedEventEnd,e.ttfb=t.responseStart-t.requestStart,e.redirect=t.redirectEnd-t.redirectStart;var r=o.getPaintTime("first-paint"),t=o.getPaintTime("first-contentful-paint");r&&(e.fp=Math.round(r)),t&&(e.fcp=Math.round(t));r=function(){if(!E())return null;var e=window.performance.getEntriesByType("navigation");return u(e)&&0!==e.length?e[0]:null}(),t=P()?window.performance.timing:null;return(r||t)&&(e.navigation=null!=r?r:t),t&&(e.timing=t),r&&(e.navigation_timing=r),e}},e.fmpMonitor&&(this.fmpMonitor=e.fmpMonitor);var t=e.performanceAuto;this.performanceAuto=void 0===t||t,this.props=null!=e?e:{}}var Ie="StaticErrorMonitor",De=(Fe.prototype.setup=function(e){M()&&(this.callback=e,window.addEventListener("error",this.staticErrorLog.bind(this),!0))},Fe.prototype.getSrc=function(e){return"link"===e.tagName.toLowerCase()?Be(e,"href"):Be(e,"src")},Fe.prototype.getParams=function(e,t){var r={ev_type:"static",st_type:t},t=R(e);r.st_src=e,r.st_protocol=t.protocol,r.st_domain=t.hostname,r.st_path=t.pathname;t=function(e){var t,r=null===(t=null===(n=window.performance)||void 0===n?void 0:n.getEntriesByType)||void 0===t?void 0:t.call(n,"resource"),n=null==r?void 0:r.length;if(!n)return;for(var o=n-1;-1<o;o--){var i=r[o];if(i.name===e)return i}}(t.href);return t&&(r.timing=t),r},Fe.monitorName=Ie,Fe);function Fe(){var i=this;this.name=Ie,this.callback=O,this.buildEvent=function(e){var t,r,n=e||window.event||{};try{r=null!==(t=null!==(t=n.target)&&void 0!==t?t:n.srcElement)&&void 0!==t?t:{}}catch(n){return}var o=r.tagName;if(o&&d(o)){o=o.toLowerCase();e=i.getSrc(r);if(e&&e!==window.location.href)return{name:i.name,type:"get",event:i.getParams(e,o)}}},this.staticErrorLog=function(e){e=i.buildEvent(e);e&&i.callback(e)}}function Be(e,t){var r;return e.getAttribute&&m(e.getAttribute)?null!==(r=e.getAttribute(t))&&void 0!==r?r:"":null!==(t=e[t])&&void 0!==t?t:""}var Ne="EmitMonitor",Je=(Ue.prototype.setup=function(e){this.callback=e||O},Ue.prototype.buildCustomTimeLog=function(e,t,r){return function(e){var t=e.name,r=e.tag,e=e.value;if(t&&e){e={ev_type:"custom",cm_name:t=m(t.toString)?t.toString():"",cm_type:"time",cm_value:e=+e};return r&&(r=m(r.toString)?r.toString():"",e.cm_tag=r),{name:"SentCustomTime",type:"get",event:e}}}({name:e,tag:t,value:r})},Ue.prototype.buildCustomCountLog=function(e,t){return function(e){var t=e.name,e=e.tag;if(t){t={ev_type:"custom",cm_name:t=m(t.toString)?t.toString():"",cm_type:"count"};return e&&(e=m(e.toString)?e.toString():"",t.cm_tag=e),{name:"SentCustomCount",type:"get",event:t}}}({name:e,tag:t})},Ue.prototype.buildEmitSingleEvent=function(e){e=oe(e);if(e&&(!e||e.event_name))return{name:this.name,type:"post",event:{ev_type:"flexible",flexible_data_list:[e]}}},Ue.monitorName=Ne,Ue);function Ue(){var o=this;this.name=Ne,this.callback=O,this.handOut=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=o.buildEvent.apply(o,s(e));o.callback(r)},this.buildEvent=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if("sendCustomCountLog"===e[0])return o.buildCustomCountLog(e[1],e[2]);if("sendCustomTimeLog"===e[0])return o.buildCustomTimeLog(e[1],e[2],e[3]);if("send"===e[0]){if("count"===e[1])return o.buildCustomCountLog(e[2].category,e[2].action);if("timing"===e[1])return o.buildCustomTimeLog(e[2].category,e[2].action,e[2].value)}if("emit"===e[0]&&e[1]&&e[2]){var r={type:e[1],event:e[2]};return o.buildEmitSingleEvent(r)}},this.send=function(e,t,r){var n=r.action,r=r.value;"count"===e&&o.sendCustomCountLog(t,n),"timing"===e&&o.sendCustomTimeLog(t,n,r)},this.sendCustomTimeLog=function(e,t,r){r=o.buildCustomTimeLog(e,t,r);o.callback(r)},this.sendCustomCountLog=function(e,t){t=o.buildCustomCountLog(e,t);return o.callback(t),t},this.emitEvent=function(e){e=o.buildEmitSingleEvent(e);o.callback(e)}}var Xe="BreadcrumbMonitor",ze=(Ve.prototype.setup=function(){this.instrumentDOM()},Ve.prototype.instrumentDOM=function(){var e;"document"in window&&(e=this,window.document.addEventListener("click",e.domEventHandler("click",e.triggerHandlers.bind(e,"dom")),!1),window.document.addEventListener("keypress",e.keypressEventHandler(e.triggerHandlers.bind(e,"dom")),!1))},Ve.prototype.domEventHandler=function(t,r,n){var o=this;return void 0===n&&(n=!1),function(e){o.keypressTimeout=void 0,e&&o.lastCapturedEvent!==e&&(o.lastCapturedEvent=e,o.debounceTimer&&clearTimeout(o.debounceTimer),n?o.debounceTimer=setTimeout(function(){r({event:e,name:t})}):r({event:e,name:t}))}},Ve.prototype.triggerHandlers=function(e,t){if(e)try{this.domBreadcrumb(t)}catch(e){}},Ve.prototype.keypressEventHandler=function(n){var o=this;return function(e){var t;try{t=e.target}catch(e){return}var r=t&&t.tagName;r&&("INPUT"===r||"TEXTAREA"===r||t.isContentEditable)&&(o.keypressTimeout||o.domEventHandler("input",n)(e),clearTimeout(o.keypressTimeout),o.keypressTimeout=window.setTimeout(function(){o.keypressTimeout=void 0},o.debounceDuration))}},Ve.prototype.domBreadcrumb=function(e){var t;try{t=e.event.target?Me(e.event.target):Me(e.event)}catch(e){t="<unknown>"}0!==t.length&&this.addBreadcrumb({category:"ui."+e.name,message:t})},Ve.monitorName=Xe,Ve);function Ve(e){var n=this;this.name=Xe,this.breadcrumbs=[],this.getBreadcrumbs=function(){return n.breadcrumbs},this.addBreadcrumb=function(e){var t=p(p({},e),{timestamp:(new Date).getTime()}),r=n.maxBreadcrumbs,e=n.breadcrumbs;return n.breadcrumbs=0<=r?s(e,[t]).slice(-r):s(e,[t]),n},this.debounceDuration=1e3,this.debounceTimer=0,this.breadcrumbs=[],this.maxBreadcrumbs=null!==(e=null==e?void 0:e.maxBreadcrumbs)&&void 0!==e?e:20}var Ke={enableCatchGlobalJSError:!0},Ge="JSExceptionMonitor",Qe=(We.prototype.setup=function(e){M()&&(this.callback=e,this.options.enableCatchGlobalJSError&&(window.addEventListener("error",this.jsErrorLog),window.addEventListener("unhandledrejection",this.jsPromiseRejectionLog)))},We.prototype.buildEvent=function(e){if(!function(e){switch(Object.prototype.toString.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":return 1;default:return e instanceof Error}}(e)?(n(e)&&(t={message:JSON.stringify(e)}),d(e)&&(t={message:e})):t=e,t){var t={ev_type:"js_exception",exception:this.normalizeError(t),breadcrumbs:null!==(t=null===(t=this.options.breadcrumbMonitor)||void 0===t?void 0:t.getBreadcrumbs())&&void 0!==t?t:[]};return{name:this.name,type:"post",event:t}}},We.prototype.logError=function(e){e=this.buildEvent(e);e&&this.callback(e)},We.prototype.getJSError=function(e){e=e.error;if(e)return e},We.prototype.getJSPromiseRejection=function(e){var t=void 0;try{"reason"in e?t=e.reason:"detail"in e&&"reason"in e.detail&&(t=e.detail.reason)}catch(e){}if(t)return t},We.prototype.normalizeError=function(e){return{message:e.message,name:e.name,fileName:e.fileName,lineNumber:e.lineNumber,columnNumber:e.columnNumber,stack:e.stack,stacktrace:e.stacktrace,framesToPop:e.framesToPop}},We.monitorName=Ge,We);function We(e){var t=this;this.name=Ge,this.callback=O,this.jsErrorLog=function(e){e=t.getJSError(e);e&&t.logError(e)},this.jsPromiseRejectionLog=function(e){e=t.getJSPromiseRejection(e);e&&t.logError(e)},this.options=p(p({},Ke),e)}var $e=(Ye.prototype.sendEvent=function(e){e=this.getEventToBeSent(e);e&&this.idleSendEvent(e)},Ye.prototype.getEventToBeSent=function(e){e=this._modifyEvent(e);if(this._shouldSend(e))return e},Ye.prototype._modifyEvent=function(e){return e},Ye.prototype._shouldSend=function(e){return!0},Ye.prototype._send=function(e){},Ye.prototype.idleSendEvent=function(e){this._send(e)},Ye);function Ye(){}var Ze="RANGERS_WEB_ID";function et(){var e={flags:{hookPath:!0,hookXHR:!0,hookFetch:!0,enableSizeStats:!0,enableFMP:!0,enablePerformance:!0,enableResourcePerformance:!0,enableStaticError:!0,enableCatchJSError:!0,enableCatchGlobalJSError:!0,enableCatchJSErrorV2:!1,enableCrash:!0,enableMemoryRecord:!0,enableFPSJankTimesMonitor:!0,enableBreadcrumb:!0,hookConsole:!1,hookDom:!0}};return e.monitors={BaseMonitor:{appTypeSetting:{type:0,SPA:"",renderType:0},sampleHit:J(1)},JSErrorMonitor:{enable:!0,webIDHit:!0,sampleRate:1,webIDHitBehavior:!1,sampleHitBehavior:!1,ignoreErrors:[],whitelistUrls:[],blacklistUrls:[],download_link:""},AjaxMonitor:{enable:!0,enableError:!1,webIDHit:!0,sampleHit:J(1),sampleRate:1,sampleHitTrace:!1,ignore:ee,abort:!1,whitelistUrls:[],statusCodeSample:{},requestUrlSample:[],errorRequestCollect:!1},PerformanceMonitor:{enable:!0,webIDHit:!0,sampleRate:1,webIDHitStaticResource:!1,sampleHitStaticResource:J(Z),slowSessionTime:te,spaSlowSessionTime:re,geckoUrls:[],interval:0,checkPoint:[]},StaticErrorMonitor:{enable:!0,webIDHit:!0,sampleRate:1,ignore:ee},ResourcePerformanceMonitor:{enable:!0,webIDHit:!0,sampleRate:1},BreadcrumbMonitor:{enable:!0},EmitMonitor:{enable:!0}},e.custom={},e.commonParams={aid:0,pid:"",version:"0.2.23",hostname:window.location.hostname,protocol:window.location.protocol.slice(0,-1),rangers_web_id:it($()),rangers_session_id:$(),context:{},url:window.location.href,timestamp:Date.now(),screen_resolution:B(),network_type:N()},e}var tt,rt,nt,ot,it=function(e){return null!==document&&void 0!==document&&document.cookie&&(e=I(document.cookie,Ze)),e},at=(tt="/v2/user/webid",rt="/v2/user/ssid",nt="/v2/event/list",ot=[],["https://mcs.ctobsnssdk.com","https://mcs.itobsnssdk.com","https://mcs.tobsnssdk.com"].forEach(function(t){[tt,rt,nt].forEach(function(e){ot.push(t+e)})}),ot);function st(e){var t=e.sendParams,e=e.monitorsSetting;if(!t||!c(t)||!t.event)return!1;var r,n,e=e;if("AjaxMonitor"===t.name||"FetchMonitor"===t.name){var o=D(s(["/monitor_browser/collect"],at)||[]);if(o&&o.test(t.event.ax_url))return!1}return!(null==e||!e.BaseMonitor.sampleHit)&&("AjaxMonitor"===t.name||"FetchMonitor"===t.name?function(e){var r=e.sendParams,t=e.ajaxMonitor;if(!t)return!0;if("2"!==r.event.ax_status[0]&&"3"!==r.event.ax_status[0])return t.enableError;if(!t.enable)return!1;if(!t.webIDHit)return!1;if(!t.sampleHit||!J(t.sampleRate))return!1;if(u(e=t.whitelistUrls)&&0<e.length){var n=D(t.whitelistUrls||[]);return n&&n.test(r.event.ax_url)?!0:!1}if((n=D(t.ignore||[]))&&n.test(r.event.ax_url))return!1;if((n=t.statusCodeSample)&&h(n,r.event.ax_status))return J(n[r.event.ax_status]);if(t=t.requestUrlSample){var o=!1,i=!1;if(t.forEach(function(e){var t;o||null!=(t=D([e.url]))&&t.test(r.event.ax_url)&&(o=!0,i=J(e.sampleRate))}),o)return i}return!0}({sendParams:t,ajaxMonitor:e.AjaxMonitor}):"PerformanceMonitor"===t.name?!(r=(r={performanceMonitor:e.PerformanceMonitor}).performanceMonitor)||!!r.enable&&(!!r.webIDHit&&J(r.sampleRate)):"StaticErrorMonitor"===t.name?(o={sendParams:t,staticErrorMonitor:e.StaticErrorMonitor},r=o.sendParams,!(o=o.staticErrorMonitor)||!!o.enable&&(!!o.webIDHit&&(!!J(o.sampleRate)&&!((o=D(o.ignore||[]))&&o.test(r.event.st_src))))):"JSExceptionMonitor"===t.name?!(n=(n={jsErrorMonitor:e.JSErrorMonitor}).jsErrorMonitor)||!!n.enable&&(!!n.webIDHit&&J(n.sampleRate)):"ResourcePerformanceMonitor"===t.name?!(n=(n={resourcePerformanceMonitor:e.ResourcePerformanceMonitor}).resourcePerformanceMonitor)||!!n.enable&&(!!n.webIDHit&&J(n.sampleRate)):"EmitMonitor"!==t.name||!!{emitMonitor:e.EmitMonitor}.emitMonitor)}function ct(e){var t=e.sendParams,r=e.commonParams,n=e.custom,e=e.breadcrumbMonitor,e=function(e){var t=e.sendParams,r=e.commonParams,n=e.breadcrumbMonitor;if((e={}).ev_type=t.event.ev_type,e.common=r,"PageViewMonitor"===t.name&&e)return e;if(("AjaxMonitor"===t.name||"FetchMonitor"===t.name)&&e){r=t.event,r=(r.ev_type,a(r,["ev_type"]));return e.event=r,e}if("PerformanceMonitor"===t.name&&e){t.event.navigation=t.event.navigation_timing;var o=t.event,o=(o.ev_type,a(o,["ev_type"]));return e.ev_type="performance",e.event={fp:o.fp,fcp:o.fcp,fmp:o.fmp,tti:o.tti,fid:o.fid,mpfid:o.mpfid,isAsync:o.isAsync,timing:o.timing,navigation:o.navigation_timing,bounced:o.bounced},e}if("StaticErrorMonitor"===t.name&&e){e.ev_type="resource_error";o=t.event,o=(o.ev_type,a(o,["ev_type"]));return e.event=o,e}if("ResourcePerformanceMonitor"===t.name&&e){e.ev_type="resource";var i=t.event,i=(i.ev_type,a(i,["ev_type"]));return e.event=i,e}if("JSExceptionMonitor"===t.name&&e){e.ev_type="js_error";i=t.event,i=(i.ev_type,a(i,["ev_type"]));return e.event=i.exception,e.breadcrumbs=null!==(n=null==n?void 0:n.getBreadcrumbs())&&void 0!==n?n:[],e}return"EmitMonitor"===t.name&&e&&(e.ev_type="flexible",e.flexible_data_list=t.event.flexible_data_list),e}({sendParams:t,commonParams:p(p({},null!=r?r:{}),{url:window.location.href}),breadcrumbMonitor:e});return n&&m(n.beforeSend)&&(e=n.beforeSend(e||{})),e}function ut(e){return"https://"+e+"/monitor_browser/collect"}var lt,pt,ft,mt={cover:O,accumulate:O,reportDirectly:O,average:O},dt=function(e){var r=this;this.cover=function(e,t){r.log.cover(e,t)},this.accumulate=function(e,t){r.log.accumulate(e,t)},this.reportDirectly=function(e,t){r.log.reportDirectly(e,t)},this.average=function(e,t){r.log.average(e,t)},this.log=null!==(e=e.transport)&&void 0!==e?e:mt},ht=(r(pt=gt,ft=lt=$e),pt.prototype=null===ft?Object.create(ft):(vt.prototype=ft.prototype,new vt),gt.prototype.uploadQueue=function(){},gt.prototype._shouldSend=function(e){return st({sendParams:e,monitorsSetting:this.options.monitorsSetting})},gt.prototype._modifyEvent=function(e){return(e=(e={sendParams:e}).sendParams)&&c(e)?e:{}},gt.prototype.buildParams=function(e){var t,r=null===(t=null===(t=this.options.monitorsSetting)||void 0===t?void 0:t.BreadcrumbMonitor)||void 0===t||!t.enable||null===(r=this.options.monitors)||void 0===r?void 0:r.BreadcrumbMonitor;return ct({sendParams:e,commonParams:this.options.commonParams,custom:this.options.custom,breadcrumbMonitor:r})},gt.prototype._send=function(e){e&&e.event&&e.name&&this.transport&&this.sendByTypes(e)},gt.prototype.sendByTypes=function(e){var t;this.transport&&(t={jsBase:null!==(t=this.options.commonParams)&&void 0!==t?t:{},jsInfo:this.buildParams(e)},"PerformanceMonitor"===e.name&&this.transport.cover(t,t.jsInfo.ev_type),"StaticErrorMonitor"===e.name&&this.transport.reportDirectly(t,t.jsInfo.ev_type),"ResourcePerformanceMonitor"===e.name&&this.transport.reportDirectly(t,t.jsInfo.ev_type),"AjaxMonitor"===e.name&&this.transport.reportDirectly(t,t.jsInfo.ev_type),"FetchMonitor"===e.name&&this.transport.reportDirectly(t,t.jsInfo.ev_type),"JSExceptionMonitor"===e.name&&this.transport.reportDirectly(t,t.jsInfo.ev_type),"PageViewMonitor"===e.name&&this.transport.reportDirectly(t,t.jsInfo.ev_type))},gt);function vt(){this.constructor=pt}function gt(e){var o=lt.call(this)||this;return o.options={},o.setTransport=function(e){o.transport=new dt({transport:e.transport}),o.preQueue.forEach(function(e){lt.prototype.sendEvent.call(o,e)})},o.updateConfig=function(e){var t,r,n;o.options=(t={previousOptions:o.options,newOptions:e},r=t.previousOptions,n=t.newOptions,(e=p(p({},r),n)).commonParams=i({},null!==(t=r.commonParams)&&void 0!==t?t:{},null!==(t=n.commonParams)&&void 0!==t?t:{}),e.monitorsSetting=i({},null!==(t=r.monitorsSetting)&&void 0!==t?t:{},null!==(t=n.monitorsSetting)&&void 0!==t?t:{}),e.monitors=p(p({},null!==(t=r.monitors)&&void 0!==t?t:{}),null!==(t=n.monitors)&&void 0!==t?t:{}),e.custom=p(p({},null!==(r=r.custom)&&void 0!==r?r:{}),null!==(n=n.custom)&&void 0!==n?n:{}),e)},o.sendEvent=function(e){o.transport?lt.prototype.sendEvent.call(o,e):o.preQueue.push(e)},o.getEventToBeSent=function(e){return null!==(e=lt.prototype.getEventToBeSent.call(o,e))&&void 0!==e?e:{}},o.options=e,o.preQueue=[],o}var yt=(bt.getClientCommonParams=function(r){void 0===r&&(r={});var n={};if(!c(r))return n;var o=["context","pid"];t(r,function(e,t){w(o,e)&&(n[e]=t)});return t({user_unique_id:"rangers_web_id",app_id:"aid"},function(e,t){h(r,e)&&(n[t]=r[e])}),n},bt.getClientFlags=function(e){void 0===e&&(e={});var r={};if(!c(e))return r;var n=["hookPath","hookXHR","hookFetch","enableSizeStats","enableFMP","enablePerformance","enableStaticError","enableCatchJSError","enableCatchJSErrorV2","enableCatchGlobalJSError","enableResourcePerformance","enableCrash","enableMemoryRecord","enableFPSJankTimesMonitor","enableBreadcrumb","hookConsole"];return t(e,function(e,t){w(n,e)&&(r[e]=t)}),r},bt.getClientCustom=function(e){var t={};return e.beforeSend&&m(e.beforeSend)&&(t.beforeSend=e.beforeSend),t},bt.getClientMonitorsSetting=function(e){return e=(t={setting:e}).setting,t={JSErrorMonitor:{},PerformanceMonitor:{},BreadcrumbMonitor:{},StaticErrorMonitor:{},ResourcePerformanceMonitor:{},BaseMonitor:{appTypeSetting:{}},AjaxMonitor:{}},e.ajaxWhitelistUrls&&u(e.ajaxWhitelistUrls)&&(t.AjaxMonitor.whitelistUrls=(t.AjaxMonitor.whitelistUrls||[]).concat(e.ajaxWhitelistUrls)),e.ignoreAjax&&u(e.ignoreAjax)&&(t.AjaxMonitor.ignore=(t.AjaxMonitor.ignore||[]).concat(e.ignoreAjax)),e.ignoreStatic&&u(e.ignoreStatic)&&(t.StaticErrorMonitor.ignore=(t.StaticErrorMonitor.ignore||[]).concat(e.ignoreStatic)),e.ignoreErrors&&u(e.ignoreErrors)&&(t.JSErrorMonitor.ignoreErrors=e.ignoreErrors),e.errorBlacklistUrls&&u(e.errorBlacklistUrls)&&(t.JSErrorMonitor.blacklistUrls=e.errorBlacklistUrls),e.errorWhitelistUrls&&u(e.errorWhitelistUrls)&&(t.JSErrorMonitor.whitelistUrls=e.errorWhitelistUrls),h(e,"sampleRate")&&(t.BaseMonitor.sampleHit=J(e.sampleRate)),t;var t},bt.prototype.configure=function(e){if(c(e)){if(this.userConfig=p(p({},this.userConfig||{}),e||{}),!this.serverDomain){if(!this.userConfig.serverDomain)return void console.error('"serverDomain" must be configured');this.serverDomain=this.userConfig.serverDomain}this.updateCurrentSetting(),this.client?this.updateClientConfig(this.getClientOptions()):this.init()}},bt.prototype.emitEvent=function(e){var t;this.monitors.EmitMonitor&&(t=this.monitors.EmitMonitor).handOut.apply(t,s(e))},bt.prototype.init=function(){var e=this.getClientOptions();this.client=new ht(e),this.updateClientConfig(e),this.sendPageview(),this.setupMonitors(this.setMonitors()),this.getServerSetting()},bt.prototype.getServerSetting=function(){var t=this;if(this.serverSetting)return this.updateCurrentSetting(),void this.afterServerSetting();var e="https://"+this.serverDomain+"/settings/get/web?aid="+this.currentSetting.commonParams.aid;U.get(e,{success:function(e){try{t.serverSetting=e.data,t.updateCurrentSetting(),t.afterServerSetting()}catch(e){t.afterServerSetting()}},fail:function(){t.afterServerSetting()}})},bt.prototype.afterServerSetting=function(){this.updateClientConfig(this.getClientOptions()),this.client.setTransport({transport:this.userConfig.transport})},bt.prototype.updateCurrentSetting=function(){var e={commonParams:bt.getClientCommonParams(this.finderSetting),flags:bt.getClientFlags({}),custom:bt.getClientCustom({}),monitors:bt.getClientMonitorsSetting({})},t={commonParams:bt.getClientCommonParams({}),flags:bt.getClientFlags({}),custom:bt.getClientCustom({}),monitors:this.serverSetting?(r=this.serverSetting,n={JSErrorMonitor:{},PerformanceMonitor:{},BreadcrumbMonitor:{},StaticErrorMonitor:{},BaseMonitor:{},ResourcePerformanceMonitor:{},AjaxMonitor:{}},(r=r.setting).jserr&&(n.JSErrorMonitor.enable=r.jserr.enable,n.JSErrorMonitor.webIDHit=J(r.jserr.enable_user_rate),n.JSErrorMonitor.sampleRate=r.jserr.enable_sample_rate),r.performance&&(n.PerformanceMonitor.enable=r.performance.enable,n.PerformanceMonitor.webIDHit=J(r.performance.enable_user_rate),n.PerformanceMonitor.sampleRate=r.performance.enable_sample_rate),r.breadcrumb&&(n.BreadcrumbMonitor.enable=r.breadcrumb.enable),r.static_resource_error&&(n.StaticErrorMonitor.enable=r.static_resource_error.enable),r.static_resource&&(n.ResourcePerformanceMonitor.enable=r.static_resource.enable,n.ResourcePerformanceMonitor.webIDHit=J(r.static_resource.enable_user_rate),n.ResourcePerformanceMonitor.sampleRate=r.static_resource.enable_sample_rate),r.request&&(n.AjaxMonitor.enable=r.request.enable,n.AjaxMonitor.enableError=r.request.enableError,n.AjaxMonitor.webIDHit=J(r.request.enable_user_rate),n.AjaxMonitor.sampleRate=r.request.enable_sample_rate),n):bt.getClientMonitorsSetting({})},r={commonParams:bt.getClientCommonParams(this.userConfig),flags:bt.getClientFlags(this.userConfig),custom:bt.getClientCustom(this.userConfig),monitors:bt.getClientMonitorsSetting(this.userConfig)},n=this.currentSetting;this.currentSetting=o({},this.defaultSetting,t,r,e),this.currentSetting.commonParams.pid=this.currentSetting.commonParams.pid||location.pathname,this.settingEffect(this.currentSetting,n)},bt.prototype.settingEffect=function(e,t){var r;(r=e.commonParams.rangers_web_id)!==I(document.cookie,Ze)&&(document.cookie=Ze+"="+r+";max-age=7776000;domain="+location.hostname+";path=/"),t.commonParams.pid!==e.commonParams.pid&&this.sendPageview()},bt.prototype.setMonitors=function(){var t,e=this.currentSetting.commonParams,r=e.aid,n=e.rangers_web_id,o=[],i=this.currentSetting.flags,e=new me;return o.push(e),o.push(new Je),i.enableCatchJSError&&o.push(new Qe),i.hookXHR&&o.push(new ae({commonParams:{bid:r+"",web_id:n},ajaxMonitorOptions:this.currentSetting.monitors.AjaxMonitor})),i.hookFetch&&o.push(new le({commonParams:{bid:r+"",web_id:n},ajaxMonitorOptions:this.currentSetting.monitors.AjaxMonitor})),i.enableStaticError&&o.push(new De),i.enablePerformance&&(i.enableFMP?o.push(new He({fmpMonitor:e,renderType:1,preLongTaskObserver:{precollect:[],observer:void 0}})):o.push(new He({renderType:1,preLongTaskObserver:{precollect:(null===(e=window.RangersSiteHybridSDK.lt)||void 0===e?void 0:e.e)||[],observer:null===(e=window.RangersSiteHybridSDK.lt)||void 0===e?void 0:e.o}}))),i.enableBreadcrumb&&o.push(new ze),i.enableResourcePerformance&&(t=this.serverDomain,o.push(new Le({observe:!0,checkIgnore:function(e){return e.name===ut(t)||("xmlhttprequest"===e.initiatorType||"fetch"===e.initiatorType||"beacon"===e.initiatorType||"navigation"===e.initiatorType||0===e.decodedBodySize)}}))),o},bt.prototype.setupMonitors=function(e){var t=this;this.client&&this.client.sendEvent&&(e.forEach(function(e){"FMPMonitor"===(t.monitors[e.name]=e).name?e.setup(O):e.setup(null===(e=t.client)||void 0===e?void 0:e.sendEvent)}),this.updateClientConfig({monitors:this.monitors}))},bt.prototype.getUserIDFromRangers=function(t){window.collectEvent&&m(window.collectEvent)&&window.collectEvent("getToken",function(e){t(e)})},bt.prototype.sendPageview=function(){var e;null!==(e=this.client)&&void 0!==e&&e.sendEvent({name:"PageViewMonitor",event:{ev_type:"pageview"},type:"post"})},bt.prototype.getClientOptions=function(){var e=this.currentSetting;return{reportURL:ut(this.serverDomain),monitorsSetting:e.monitors,commonParams:e.commonParams,custom:e.custom}},bt.prototype.uploadClientQueue=function(){var e;null!==(e=this.client)&&void 0!==e&&e.uploadQueue()},bt.prototype.updateClientConfig=function(e){var t;null!==(t=this.client)&&void 0!==t&&t.updateConfig(e)},bt);function bt(){var r=this;this.version="0.2.23",this.serverDomain="",this.instance=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];"config"!==e[0]?"emit"!==e[0]?"report"!==e[0]?r.initOnCloseCallback():r.uploadClientQueue():r.emitEvent(e):r.configure(e[1])},this.initOnCloseCallback=function(){F(r.onCloseReport,r.visibilityChange)},this.visibilityChange=function(){"hidden"===document.visibilityState&&r.onCloseReport(),"visible"===document.visibilityState&&r.updateClientReportType("xhr")},this.onCloseReport=function(){r.updateClientReportType("beacon"),r.uploadClientQueue()},this.updateClientReportType=function(e){var t;null!==(t=r.client)&&void 0!==t&&t.updateConfig({reportType:e})},this.userConfig={},this.defaultSetting=et(),this.currentSetting=this.defaultSetting,this.serverSetting=void 0,this.finderSetting={},this.client=void 0,this.monitors={}}var wt,St=O;return M()&&(wt=new yt,St=wt.instance,null!==(yt=window.RangersSiteHybridSDK)&&void 0!==yt&&yt.q&&(u(yt=window.RangersSiteHybridSDK.q)&&yt.forEach(function(e){St.apply(void 0,s(e))}),delete window.RangersSiteHybridSDK.q),window.RangersSiteHybridSDK=wt.instance),St}(); |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package