Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@apmplus/web

Package Overview
Dependencies
Maintainers
2
Versions
57
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@apmplus/web - npm Package Compare versions

Comparing version 2.0.4 to 2.0.5-alpha.0

cn/bridge.ios.2.0.5-alpha.0.cn.js

2

cn/browser.cn.js

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

!function(){"use strict";var u,g=function(){return(g=Object.assign||function(n){for(var e,t=1,r=arguments.length;t<r;t++)for(var o in e=arguments[t])Object.prototype.hasOwnProperty.call(e,o)&&(n[o]=e[o]);return n}).apply(this,arguments)};function I(n,e){var t="function"==typeof Symbol&&n[Symbol.iterator];if(!t)return n;var r,o,i=t.call(n),u=[];try{for(;(void 0===e||0<e--)&&!(r=i.next()).done;)u.push(r.value)}catch(n){o={error:n}}finally{try{r&&!r.done&&(t=i.return)&&t.call(i)}finally{if(o)throw o.error}}return u}function y(n,e,t){if(t||2===arguments.length)for(var r,o=0,i=e.length;o<i;o++)!r&&o in e||((r=r||Array.prototype.slice.call(e,0,o))[o]=e[o]);return n.concat(r||Array.prototype.slice.call(e))}"undefined"==typeof Element||Element.prototype.addEventListener||(u=[],Hr=function(n,e){for(var t=0;t<u.length;){var r=u[t];if(r.object===this&&r.type===n&&r.listener===e){"DOMContentLoaded"===n?this.detachEvent("onreadystatechange",r.wrapper):this.detachEvent("on"+n,r.wrapper),u.splice(t,1);break}++t}},Element.prototype.addEventListener=zr=function(n,e){function t(n){n.target=n.srcElement,n.currentTarget=i,void 0!==e.handleEvent?e.handleEvent(n):e.call(i,n)}var r,o,i=this;"DOMContentLoaded"===n?(r=function(n){"complete"===document.readyState&&t(n)},document.attachEvent("onreadystatechange",r),u.push({object:this,type:n,listener:e,wrapper:r}),"complete"===document.readyState&&((o=new window.Event).srcElement=window,r(o))):(this.attachEvent("on"+n,t),u.push({object:this,type:n,listener:e,wrapper:t}))},Element.prototype.removeEventListener=Hr,HTMLDocument&&!HTMLDocument.prototype.addEventListener&&(HTMLDocument.prototype.addEventListener=zr,HTMLDocument.prototype.removeEventListener=Hr),Window&&!Window.prototype.addEventListener&&(Window.prototype.addEventListener=zr,Window.prototype.removeEventListener=Hr));function v(n){return JSON.stringify({ev_type:"batch",list:n})}var b=["init","start","config","beforeDestroy","provide","beforeReport","report","beforeBuild","build","beforeSend","send","beforeConfig"],w=function(){return{}};function E(n){return n}function _(n){return"object"==typeof n&&null!==n}var e=Object.prototype;function i(n){if(_(n)){if("function"!=typeof Object.getPrototypeOf)return"[object Object]"===e.toString.call(n);n=Object.getPrototypeOf(n);return n===e||null===n}}function a(n){return"[object Array]"===e.toString.call(n)}function S(n){return"function"==typeof n}function c(n){return"number"==typeof n}function x(n){return"string"==typeof n}function o(n){return"undefined"!=typeof Event&&function(n,e){try{return n instanceof e}catch(n){return}}(n,Event)}function d(n,e){var t,r,o=g({},n);for(t in e)r=t,Object.prototype.hasOwnProperty.call(e,r)&&void 0!==e[t]&&(_(e[t])&&i(e[t])?o[t]=d(_(n[t])?n[t]:{},e[t]):a(e[t])&&a(n[t])?o[t]=function e(n,t){n=a(n)?n:[];t=a(t)?t:[];return Array.prototype.concat.call(n,t).map(function(n){return n instanceof RegExp?n:_(n)&&i(n)?d({},n):a(n)?e([],n):n})}(n[t],e[t]):o[t]=e[t]);return o}function T(n,e){if(!a(n))return!1;if(0===n.length)return!1;for(var t=0;t<n.length;){if(n[t]===e)return!0;t++}return!1}function L(n,e){if(!a(n))return n;var t=n.indexOf(e);if(0<=t){e=n.slice();return e.splice(t,1),e}return n}function l(n,e,t){for(var r,o=(e=I(e.split(".")))[0],i=e.slice(1);n&&0<i.length;)n=n[o],o=(r=I(i))[0],i=r.slice(1);if(n)return t(n,o)}function p(n){return a(n)&&n.length?function(n){for(var e=[],t=n.length,r=0;r<t;r++){var o=n[r];x(o)?e.push(o.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")):o&&o.source&&e.push(o.source)}return new RegExp(e.join("|"),"i")}(n):null}function f(n){try{return x(n)?n:JSON.stringify(n)}catch(n){return"[FAILED_TO_STRINGIFY]:"+String(n)}}function h(i,u,a,c){return void 0===c&&(c=!0),function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];if(!i)return w;var t=i[u],r=a.apply(void 0,y([t],I(n),!1)),o=r;return S(o)&&c&&(o=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];try{return r.apply(this,e)}catch(n){return S(t)&&t.apply(this,e)}}),i[u]=o,function(n){n||(o===i[u]?i[u]=t:r=t)}}}function s(i,u,a){return function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];if(!i)return w;var t=i[u],r=a.apply(void 0,y([t],I(n),!1)),o=r;return S(o)&&(o=function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];return r.apply(this,n)}),i[u]=o,function(){o===i[u]?i[u]=t:r=t}}}function R(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];console.warn.apply(console,y(["[SDK]",Date.now(),(""+r++).padStart(8," ")],I(n),!1))}function j(r){return function(n){for(var e=n,t=0;t<r.length&&e;t++)try{e=r[t](e)}catch(n){m(n)}return e}}var t=0,m=function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];console.error.apply(console,y(["[SDK]",Date.now(),(""+t++).padStart(8," ")],I(n),!1))},r=0,k=function(n){return Math.random()<Number(n)},C=function(n,e){return n<Number(e)};function D(){var n=function(){for(var n=new Array(16),e=0,t=0;t<16;t++)0==(3&t)&&(e=4294967296*Math.random()),n[t]=e>>>((3&t)<<3)&255;return n}();return n[6]=15&n[6]|64,n[8]=63&n[8]|128,function(n){for(var e=[],t=0;t<256;++t)e[t]=(t+256).toString(16).substr(1);var r=0,o=e;return[o[n[r++]],o[n[r++]],o[n[r++]],o[n[r++]],"-",o[n[r++]],o[n[r++]],"-",o[n[r++]],o[n[r++]],"-",o[n[r++]],o[n[r++]],"-",o[n[r++]],o[n[r++]],o[n[r++]],o[n[r++]],o[n[+r]],o[n[15]]].join("")}(n)}function O(r,n){var e=[];try{e=n.reduce(function(n,e){try{var t=e(r);"function"==typeof t&&n.push(t)}catch(n){}return n},[])}catch(n){}return function(n){return O(n,e)}}function q(n,e,t){t=M(t);try{n(t.next,t.attach),e&&t.complete(e)}catch(n){}return[t.subscribe,t.unsubscribe]}var M=function(n){function e(n){a=L(a,n),f||s()}var t,r,o,i,u,a=[],c=[],f=!1,s=(r=function(){return a.length},o=function(){f=!0,t&&t[0](),c.forEach(function(n){return n()}),c.length=0,t=void 0},-1===(i=n=void(u=0)===n?3e5:n)?w:function(){if(r())return u&&clearTimeout(u),void(u=0);0===u&&(u=setTimeout(o,i))});return{next:function(n){return O(n,a)},complete:function(n){c.push(n)},attach:function(n,e){t=[n,e]},subscribe:function(n){if(f)throw new Error("Observer is closed");return a.push(n),t&&t[1]&&t[1](n),s(),function(){return e(n)}},unsubscribe:e}};var A=function(n){var t,r,o,e=(t={},r={},o={set:function(n,e){return t[n]=e,r[n]=f(e),o},merge:function(e){return t=g(g({},t),e),Object.keys(e).forEach(function(n){r[n]=f(e[n])}),o},delete:function(n){return delete t[n],delete r[n],o},clear:function(){return t={},r={},o},get:function(n){return r[n]},toString:function(){return g({},r)}});n.provide("context",e),n.on("report",function(n){return n.extra||(n.extra={}),n.extra.context=e.toString(),n})},N=function(a,c,t){function f(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];var t=n[0];if(t){var r=t.split(".")[0];if(r in f)return i=f,u=t,o=[].slice.call(n,1),l(i,u,function(n,e){if(n&&e in n&&S(n[e]))try{return n[e].apply(n,o)}catch(n){return}});var o,i=s[r]||[],u=null!==(u=null==c?void 0:c(a))&&void 0!==u?u:{};i.push(y([u],I(n),!1)),void(s[r]=i)}}var n,s={};for(n in h(a,"provide",function(t){return function(n,e){f[n]=e,t.call(a,n,e)}})(),a)Object.prototype.hasOwnProperty.call(a,n)&&(f[n]=a[n]);return a.on("provide",function(n){s[n]&&(s[n].forEach(function(n){var e=I(n),n=e[0],e=e.slice(1);null!=t&&t(a,n,e)}),s[n]=null)}),f};function B(n,e){return n.initSubject(e)}function H(n,e,t){var e=I(e,2),r=e[0],e=e[1],o=n.privateSubject||{};return o[r]||(o[r]=q(e,function(){o[r]=void 0},t)),o[r]}function P(){if("object"==typeof window&&_(window))return window}function U(){if("object"==typeof document&&_(document))return document}function W(){if(P()&&_(window.performance))return window.performance}function X(){if("function"==typeof XMLHttpRequest&&S(XMLHttpRequest))return XMLHttpRequest}function z(){if(P()&&S(window.MutationObserver))return window.MutationObserver}function F(){if(P()&&S(window.PerformanceObserver))return window.PerformanceObserver}function G(){var n=function(){if(P()&&"navigator"in window)return window.navigator}();if(n)return n.connection||n.mozConnection||n.webkitConnection}var Y=function(n){if(n)return n.__SLARDAR_REGISTRY__||(n.__SLARDAR_REGISTRY__={Slardar:{plugins:[],errors:[],subject:{}}}),n.__SLARDAR_REGISTRY__.Slardar},J=function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];var t=Y(P());t&&(t.errors||(t.errors=[]),t.errors.push(n))},$=function(n,e){var t=n&&new n(e);return[function(n,e){t&&n&&t.observe(n,e)},function(){return t&&t.disconnect()}]},V=function(t){var n=t&&t.timing||void 0;return[n,function(){return t&&t.now?t.now():(Date.now?Date.now():+new Date)-(n&&n.navigationStart||0)},function(n){var e=(t||{}).getEntriesByType;return S(e)&&e.call(t,n)||[]},function(){var n=(t||{}).clearResourceTimings;S(n)&&n.call(t)},function(n){var e=(t||{}).getEntriesByName;return S(e)&&e.call(t,n)||[]}]},K=function(t,o,e,i){var r=t&&new t(function(n,r){n.getEntries?n.getEntries().forEach(function(n,e,t){return o(n,e,t,r)}):i&&i(),e&&r.disconnect()});return[function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];if(!t||!r)return i&&i();try{e.forEach(function(n){-1<t.supportedEntryTypes.indexOf(n)&&r.observe({type:n,buffered:!1})})}catch(n){try{r.observe({entryTypes:e})}catch(n){return i&&i()}}},function(){return r&&r.disconnect()}]},Q=function(n,e,t,r){void 0===e&&(e={}),void 0===r&&(r=[]);try{var o=n.apply(void 0,y([],I(r),!1));return o&&o(e,t)||[]}catch(n){return J(n),[]}},Z=function(e){return e.requestIdleCallback||function(n){return e.setTimeout(n,1)}},nn=function(){return Date.now()};function en(n){var e=U();if(!e||!n)return"";e=e.createElement("a");return e.href=n,e.href}function tn(n){var e=U();if(!e||!n)return{url:n,protocol:"",domain:"",query:"",path:"",hash:""};e=e.createElement("a");e.href=n;n=e.pathname||"/";return"/"!==n[0]&&(n="/"+n),{url:e.href,protocol:e.protocol.slice(0,-1),domain:e.hostname,query:e.search.substring(1),path:n,hash:e.hash}}function rn(){var n=P()&&P()&&window.location;return null==n?void 0:n.href}var on=function(n){var e={url:rn(),timestamp:nn()},t=n.config();return null!=t&&t.pid&&(e.pid=t.pid),null!=n&&n.context&&(e.context=n.context.toString()),e},un=function(t,r){return function(n){function e(n){return n.overrides=r,n}t.on("report",e),n(),t.off("report",e)}};function an(n){try{for(var e,t=n,r=[],o=0,i=0,u=" > ".length;t&&o++<5&&!("html"===(e=function(n){var e,t,r,o,i=n,u=[];if(!i||!i.tagName)return"";u.push(i.tagName.toLowerCase()),i.id&&u.push("#"+i.id);n=i.className;if(n&&x(n))for(e=n.split(/\s+/),o=0;o<e.length;o++)u.push("."+e[o]);var a=["type","name","title","alt"];for(o=0;o<a.length;o++)t=a[o],(r=i.getAttribute(t))&&u.push("["+t+'="'+r+'"]');return u.join("")}(t))||1<o&&80<=i+r.length*u+e.length);)r.push(e),i+=e.length,t=t.parentNode;return r.reverse().join(" > ")}catch(n){return"<unknown>"}}function cn(o){function i(e,t){var r;return function(n){u=void 0,n&&r!==n&&t({event:r=n,name:e})}}var u;return[i,function(r){return function(n){var e;try{e=n.target}catch(n){return}var t=e&&e.tagName;t&&("INPUT"===t||"TEXTAREA"===t||e.isContentEditable)&&(u||i("input",r)(n),clearTimeout(u),u=window.setTimeout(function(){u=void 0},o))}}]}function fn(e,t){return function(n){if(t)try{e(n)}catch(n){}}}function sn(n,e){return _(n)?g(g({},e),n):!!n&&e}function ln(r){return function(){for(var n,e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return n=I(e,2),this._method=n[0],this._url=n[1],r.apply(this,e)}}function dn(o){return function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];this._reqHeaders=this._reqHeaders||{};var t=I(n,2),r=t[0],t=t[1];return this._reqHeaders[r]=t,o&&o.apply(this,n)}}function pn(i,u){return function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];this._start=nn(),this._data=null==n?void 0:n[0];var r,o,t=u([this._method,this._url,this._start,this]);return o=t,s(r=this,"onreadystatechange",function(t){return function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];return 4===this.readyState&&o(r),t&&t.apply(this,n)}})(),i.apply(this,n)}}function vn(r,o){return function(n,e){var t=o([n,e=void 0===e?{}:e]),e=r(n,e);return e.then(function(n){t(n)},function(){t(void 0)}),e}}function hn(n,e,t){return n=I(Ln(n,e),3),e=n[1],n=n[2],e(t),n}function mn(){var n=window.crypto||window.msCrypto;if(void 0!==n&&n.getRandomValues){var e=new Uint16Array(8);n.getRandomValues(e);n=function(n){for(var e=n.toString(16);e.length<4;)e="0"+e;return e};return n(e[0])+n(e[1])+n(e[2])+n(e[3])+n(e[4])+n(e[5])+n(e[6])+n(e[7])}return"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx".replace(/[x]/g,function(){return(16*Math.random()|0).toString(16)})}function gn(n,e){return!!(n=p(n||[]))&&n.test(e)}function yn(n,e){return!(!n||!e)&&(On.test(n)||qn.test(e))}var bn=function(e){var t=!1;return[function(n){t||(t=!0,e&&e(n))}]},wn=function(n){var e,t=P();t&&(e=I(bn(n),1)[0],["unload","beforeunload","pagehide"].forEach(function(n){t.addEventListener(n,e)}))},En="xhr_0",_n=function(r){return function(n,e){var t;r&&((t=[]).push(s(r,"open",ln)()),t.push(s(r,"setRequestHeader",dn)()),t.push(s(r,"send",pn)(n)),e(function(){t.forEach(function(n){return n()})}))}},Sn=["fetch_0",function(n,e){var t,r=P();r&&fetch&&((t=[]).push(s(r,"fetch",vn)(n)),e(function(){t.forEach(function(n){return n()})}))}],xn=["resource"],Tn=["longtask"],Ln=function(e,o,t){var r=e&&new e(function(n,r){n.getEntries?n.getEntries().forEach(function(n,e,t){return o(n,e,t,r)}):t&&t()});return[function(n){if(!e||!r)return t&&t();try{r.observe({entryTypes:n})}catch(n){return t&&t()}},function(n){if(!e||!r)return t&&t();try{r.observe({type:n,buffered:!0})}catch(n){return t&&t()}r.observe({type:n,buffered:!1})},function(){return r&&r.disconnect()}]},Rn=function(n,e,t){n=I(Ln(n,e),3),e=n[0],n=n[2];return e(t),n},jn=["longtask_0",function(n,e){var t=F();t&&e(Rn(t,n,Tn))}],kn=["resource_0",function(n,e){var t=F();t&&e(Rn(t,n,xn))}],Cn={sampleRate:1,origins:[]},Dn=function(n,r){var o=sn(n,Cn);if(o&&k(o.sampleRate))return function(n,e){var t=o.origins;t.length&&Boolean(n.match(new RegExp(t.join("|"))))&&(e("x-rum-traceparent","00-"+mn()+"-"+mn().substring(16)+"-01"),e("x-rum-tracestate",r))}},On=new RegExp("(cookie|auth|jwt|token|key|ticket|secret|credential|session|password)","i"),qn=new RegExp("(bearer|session)","i"),In=function(a,n,e,c){var t=I(e,2),e=t[0],f=t[1],s=c.setTraceHeader,l=c.ignoreUrls,d=c.hookCbAtReq;n.push(e[0](function(n){var e=I(n,4);e[0];n=e[1];e[2];var t=e[3];if(gn(l,n))return w;s&&s(n,function(n,e){return t.setRequestHeader(n,e)});var r=d(a),o=en(n),i=void 0,u=f()[0](function(n){o!==n.name||i||(i=n)});return function(n){var e=function(n,e){var t=n._method,r=n._reqHeaders,o=n._url,i=n._start,u=n._data,a,c={api:"xhr",request:{url:en(o),method:(t||"").toLowerCase(),headers:r&&An(r),timestamp:i},response:{status:n.status||0,is_custom_error:false,timestamp:nn()},duration:nn()-i};if(typeof n.getAllResponseHeaders==="function")c.response.headers=Mn(n.getAllResponseHeaders());var f=c.response.status,s=e.collectBodyOnError,l=e.extraExtractor;try{var d=l===null||l===void 0?void 0:l(n.response,c);d&&(c.extra=d);d&&(c.response.is_custom_error=true);if(s&&f>=400){c.request.body=u?""+u:undefined;c.response.body=n.response?""+n.response:undefined}}catch(n){}return c}(n,c);setTimeout(function(){i&&(e.response.timing=i),r&&r({ev_type:"http",payload:e}),u()},100)}}))};function Mn(n){return x(n)&&n?n.split("\r\n").reduce(function(n,e){var t;return x(e)&&(e=(t=I(e.split(": "),2))[0],t=t[1],yn(e,t)||(n[e.toLowerCase()]=t)),n},{}):{}}function An(t){return Object.keys(t).reduce(function(n,e){return yn(e,t[e])||(n[e.toLowerCase()]=t[e]),n},{})}function Nn(n,e,t){e=null===(n=n.config())||void 0===n?void 0:n.plugins[e];return sn(e,t)}var Bn=function(e,t){var n=e.config(),r={url:rn(),pid:n.pid,view_id:n.viewId};return function(n){e.report(g(g({},n),{overrides:g(g({},r),t&&t(n)||{})}))}},Hn="ajax",Pn={autoWrap:!0,hookCbAtReq:E,ignoreUrls:[],collectBodyOnError:!1},Un=function(r){return function(e){if(!e)return e;var n=r.config(),t={url:rn(),pid:n.pid,view_id:n.viewId,context:null===(n=r.context)||void 0===n?void 0:n.toString()};return function(n){e(g(g({},n),{overrides:g(g({},t),{timestamp:n.payload.request.timestamp})}))}}};var Wn=function(f){if(f=void 0===f?U():f)return function(n,e){var t,r=n.maxBreadcrumbs,o=n.onAddBreadcrumb,i=n.onMaxBreadcrumbs,u=n.dom,a=I(cn(100),2),n=a[0],a=a[1],r=I(function(e,t,r){void 0===e&&(e=20),void 0===t&&(t=E),void 0===r&&(r=function(n,e){return n.slice(-e)});var o=[];return[function(){return o},function(n){t(n)&&(n=g(g({},n),{timestamp:n.timestamp||nn()}),o=0<=e&&o.length+1>e?r(y(y([],I(o),!1),[n],!1),e):y(y([],I(o),!1),[n],!1))}]}(r,o,i),2),o=r[0],i=r[1],r=(t=i,function(n){var e;try{e=n.event.target?an(n.event.target):an(n.event)}catch(n){e="<unknown>"}0!==e.length&&t({type:"dom",category:"ui."+n.name,message:e})}),c=[];u&&(c.push(n("click",fn(r,"dom"))),c.push(a(fn(r,"dom"))),f.addEventListener("click",c[0]),f.addEventListener("keypress",c[1]));return[o,i,function(){f.removeEventListener("click",c[0]),f.removeEventListener("keypress",c[1])}]}},Xn="breadcrumb",zn={maxBreadcrumbs:20,dom:!0};var Fn=function(t,n,e,l){var r=I(e,2),e=r[0],o=r[1],d=l.setTraceHeader,p=l.ignoreUrls,v=l.hookCbAtReq,h=window.Headers,m=window.Request;m&&h&&n.push(e[0](function(n){var n=I(n,2),i=n[0],u=n[1],e=en(i instanceof m?i.url:i);if(!function(n){if(!x(n))return false;var e=I(n.split(":"),2),t=e[0],r;return!e[1]||t==="http"||t==="https"}(e)||gn(p,e))return w;d&&d(e,function(n,e){return function(n,e,t,r,o,i){var u;if(Gn(t,o))t.headers.set(n,e);else if(r.headers instanceof i)r.headers.set(n,e);else r.headers=g(g({},r.headers),(u={},u[n]=e,u))}(n,e,i,u,m,h)});var a=v(t),c=nn(),f=void 0,s=o()[0](function(n){e!==n.name||f||(f=n)});return function(n){var e,t,r=function(n,e,t,r,o,i,u){var a,c,f={api:"fetch",request:{method:Yn(n,e,r),timestamp:u,url:en(n instanceof r?n.url:n),headers:Jn(o,n.headers,e.headers)},response:{status:t&&t.status||0,is_custom_error:false,timestamp:nn()},duration:nn()-u},s=i.collectBodyOnError,l=i.extraExtractor;if(t)try{f.response.headers=Jn(o,t.headers);try{l&&t.clone().json().then(function(n){var e=l(n,f);if(e){f.extra=e;f.response.is_custom_error=true}}).catch(w)}catch(n){}if(s&&t.status>=400)f.request.body=(a=$n(n,e,r))===null||a===void 0?void 0:a.toString()}catch(n){}else s&&(f.request.body=(c=$n(n,e,r))===null||c===void 0?void 0:c.toString());return f}(i,u,n,m,h,l,c),o=(t=!(e=function(n){f&&(n.response.timing=f),a&&a({ev_type:"http",payload:n}),s()}),function(n){t||(t=!0,e(n))});setTimeout(function(){o(r)},1e3)}}))},Gn=function(n,e){return n instanceof e},Yn=function(n,e,t){e=e&&e.method||"get";return(e=Gn(n,t)?n.method||e:e).toLowerCase()},Jn=function(e){for(var n=[],t=1;t<arguments.length;t++)n[t-1]=arguments[t];try{return n.reduce(function(t,n){return new e(n||{}).forEach(function(n,e){return!yn(e,n)&&(t[e]=n)}),t},{})}catch(n){return{}}},$n=function(n,e,t){return Gn(n,t)?n.body:null==e?void 0:e.body},Vn="fetch",Kn={autoWrap:!0,hookCbAtReq:E,ignoreUrls:[],collectBodyOnError:!1};function Qn(n){var e,t,r;return!function(n){switch(Object.prototype.toString.call(n)){case"[object Error]":case"[object Exception]":case"[object DOMError]":case"[object DOMException]":return 1;default:return n instanceof Error}}(n)?(i(n)||o(n)||x(n))&&(e={message:f(n)}):(r=ae,e=(t=n)&&_(t)?r.reduce(function(n,e){return n[e]=t[e],n},{}):t),e}function Zn(n){return Qn(n.error)}function ne(n){var e;try{var t=void 0;if("reason"in n?t=n.reason:"detail"in n&&"reason"in n.detail&&(t=n.detail.reason),t){var r=Qn(t);return g(g({},r),{name:null!==(e=r&&r.name)&&void 0!==e?e:"UnhandledRejection"})}}catch(n){}}function ee(n){return"[object ErrorEvent]"===Object.prototype.toString.call(n)?Zn(n):("[object PromiseRejectionEvent]"===Object.prototype.toString.call(n)?ne:Qn)(n)}function te(o,e,n){function u(n,t){if(!S(n))return n;var r={type:"capture-global",data:g({},t)},e=n._w_||(n._w_=function(){try{return(n.handleEvent&&S(n.handleEvent)?n.handleEvent:n).apply(this,[].map.call(arguments,function(n){return u(n,t)}))}catch(n){var e=Qn(n);throw e&&o({error:e,source:r}),n}});return e._hook_=!0,e}void 0===e&&(e=P()),void 0===n&&(n=X());var t=[];return e&&t.push.apply(t,y([],I(fe.filter(function(n){return e[n]}).map(function(o){return h(e,o,function(r){return function(n){for(var e=[],t=1;t<arguments.length;t++)e[t-1]=arguments[t];return r&&r.call.apply(r,y([this,u(n,{function:o})],I(e),!1))}},!1)()})),!1)),n&&n.prototype&&t.push(h(n.prototype,"send",function(r){return function(){for(var e=this,n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];return se.filter(function(n){return e[n]&&!e[n]._hook_}).forEach(function(n){e[n]=u(e[n],{function:n})}),r.apply(this,n)}},!1)()),ce.forEach(function(i){var n=e[i]&&e[i].prototype;n&&n[le]&&(t.push(h(n,le,function(o){return function(n,e,t){try{var r=e.handleEvent;S(r)&&(e.handleEvent=u(r,{function:"handleEvent",target:i}))}catch(n){}return o&&o.call(this,n,u(e,{function:le,target:i}),t)}},!1)()),t.push(h(n,"removeEventListener",function(r){return function(n,e,t){return null!=e&&e._w_&&r.call(this,n,e._w_,t),r.call(this,n,e,t)}},!1)()))}),t}function re(n,e){return n&&e&&n===e}function oe(){var r;return function(n){try{if(t=r,!(!(e=n)||!t)&&!(!re(e.message,t.message)||!re(e.stack,t.stack)))return void(r=n)}catch(n){J(n)}var e,t;return r=n}}var ie=["err_0",function(n,e){var t=P();t&&(t.addEventListener("error",n,!0),e(function(){t.removeEventListener("error",n,!0)}))}],ue=["perr_0",function(n,e){var t=P();t&&(t.addEventListener("unhandledrejection",n,!0),e(function(){t.removeEventListener("unhandledrejection",n,!0)}))}],ae=["name","message","stack","filename","lineno","colno"],ce=["EventTarget","Window","Node","ApplicationCache","ChannelMergerNode","EventSource","FileReader","HTMLUnknownElement","IDBDatabase","IDBRequest","IDBTransaction","MessagePort","Notification","SVGElementInstance","Screen","TextTrack","TextTrackCue","TextTrackList","WebSocket","Worker","XMLHttpRequest","XMLHttpRequestEventTarget","XMLHttpRequestUpload"],fe=["setTimeout","setInterval","requestAnimationFrame","requestIdleCallback"],se=["onload","onerror","onprogress","onreadystatechange"],le="addEventListener",de=function(o,n,e,t){function r(n){var e=n.error,t=n.extra,r=n.react,n=n.source;!(e=f?l(e):e)||s&&s.test(e.message)||o({ev_type:"js_error",payload:{error:e,breadcrumbs:[],extra:t,react:r,source:n}})}var i=I(e,2),u=i[0],a=i[1],c=t.ignoreErrors,e=t.onerror,i=t.onunhandledrejection,f=t.dedupe,t=t.captureGlobalAsync,s=p(c),l=oe();return e&&n.push(u[0](function(n){return r({error:Zn(n),source:{type:"onerror"}})})),i&&n.push(a[0](function(n){return r({error:ne(n),source:{type:"onunhandledrejection"}})})),t&&n.push.apply(n,y([],I(te(r)),!1)),function(n,e,t){return r({error:ee(n),extra:e,react:t,source:{type:"manual"}})}},pe="jsError",ve={ignoreErrors:[],onerror:!0,onunhandledrejection:!0,captureGlobalAsync:!1,dedupe:!0};function he(n){return{pid:n.pid,view_id:n.viewId,url:rn()}}var me="view_0",ge=function(o){return function(t,n){function e(n){var e;n.viewId&&n.viewId!==(null===(e=o.config())||void 0===e?void 0:e.viewId)&&(t(r),r=he(n))}var r=he(o.config());o.on("beforeConfig",e),n(function(){o.off("beforeConfig",e)})}},ye="f_view_0",be=function(r){return function(n,e){var t=he(r.config());e(w,function(n){t&&n(t)})}},we=["hash_0",function(n,e){var t,r=P();r&&(r.addEventListener("hashchange",t=function(){return n(location.href)},!0),e(function(){return r.removeEventListener("hashchange",t,!0)}))}],Ee=["history_0",function(n,e){var t,r,o,i=P()&&window.history;i&&(r=function(){return n(location.href)},(t=[]).push(h(i,"pushState",o=function(t){return function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];try{t.apply(i,n)}finally{r()}}})(),h(i,"replaceState",o)()),window.addEventListener("popstate",r,!0),t.push(function(){return window.removeEventListener("popstate",r,!0)}),e(function(){t.forEach(function(n){return n()})}))}],_e=function(n){return"manual"===n},Se=function(n,e,t,r){var o,i,u,a,c,f,s,l=r.sendInit,d=r.initPid,p=r.routeMode,v=r.extractPid,r=r.onPidUpdate,h=_e(p)?function(){return""}:(o=p,function(n){var e;return"hash"===o?(null===(e=tn(n).hash)||void 0===e?void 0:e.replace(/^#/,""))||"/":tn(n).path}),m=v||function(){},r=I(function(r,n,e,o){var i=e,u=n;o&&o(n);return[function(n,e,t){"user_set"!==n&&e!==i?(i=e,u=null!=t?t:i,o&&o(u),r(n,u)):"user_set"===n&&e!==u&&(u=e,o&&o(u),r(n,u))},function(){n&&r("init",n)}]}((a=n,function(n,e){a({ev_type:"pageview",payload:{pid:e,source:n}})}),d||(i=location.href,null!==(u=m(i))&&void 0!==u?u:h(i)),h(location.href),r),2),g=r[0],r=r[1];return _e(p)||(c=I((f=function(n,e){return g(n,h(e),m(e))},s="",[function(n,e){e!==s&&f(n,s=e)}]),1)[0],t.length&&t.forEach(function(n){return e.push(n[0](function(n){return c(p,n)}))})),l&&r(),[g.bind(null,"user_set")]},xe="pageview",Te={sendInit:!0,routeMode:"history"};var Le=["hidden_0",function(n,e){var t,r,o=P(),i=U();o&&i&&(t=function(){"hidden"===i.visibilityState&&n()},addEventListener("visibilitychange",t,!0),r=Z(o),e(function(){removeEventListener("visibilitychange",t,!0)},function(n){"hidden"===i.visibilityState&&r(function(){n()})}))}],Re=["load_0",function(n,e){var t,r,o=P(),i=U();o&&i&&(o.addEventListener("load",t=function(){setTimeout(function(){n()},0)},!1),r=Z(o),e(function(){o.removeEventListener("load",t,!1)},function(n){"complete"===i.readyState&&r(function(){n()})}))}],je=["unload_0",function(n,e){var t,r,o,i=P();i&&(t=I(bn(n),1)[0],o=function(){t()},(r=["unload","beforeunload","pagehide"]).forEach(function(n){i.addEventListener(n,o)}),e(function(){r.forEach(function(n){i.removeEventListener(n,o)})}))}],ke=["xmlhttprequest","fetch","beacon"],Ce=function(t,r,n,e){var o,i,u,a,c=I(n,2),n=c[0],f=c[1],s=W();s&&(c=e.ignoreUrls,o=e.slowSessionThreshold,i=e.ignoreTypes,u=p(c),a=function(n,e){void 0===e&&(e=!1),T(i||ke,n.initiatorType)||u&&u.test(n.name)||(n={ev_type:"resource",payload:n},e&&(n.extra={sample_rate:1}),t(n))},r.push(n[0](function(){var n=I(V(s),3),e=n[0],n=n[2],t=function(){if(!e)return!1;var n=e.loadEventEnd-e.navigationStart;return o<n}();n("resource").forEach(function(n){return a(n,t)}),r.push(f()[0](function(n){a(n)}))})))},De="resource",Oe={ignoreUrls:[],slowSessionThreshold:4e3};function qe(n){return n="link"===(e=n).tagName.toLowerCase()?"href":"src",S(e.getAttribute)?e.getAttribute(n)||"":e[n]||"";var e}var Ie=function(i,n,e,t){var r=I(e,1)[0],o=P();if(o){var u=t.ignoreUrls,e=t.includeUrls,a=t.dedupe,c=p(e),f=p(u),s=I(V(W()),5)[4],l=void 0,d=function(n){var e,t,r,o=location&&location.href;o&&n.url===o||c&&!c.test(n.url)||f&&f.test(n.url)||n.url&&(a&&n.url===l||(l=n.url,t=s,r=(e=n).url,o=n.tagName,e=n.xpath,r=en(r),t=t(r)[0],t={type:o.toLowerCase(),url:r,xpath:e,timing:t},i({ev_type:"resource_error",payload:t})))};return n.push(r[0](function(n){n=n||o.event;!n||(n=function(n){var e=n.target||n.srcElement;if(e){n=e.tagName;if(n&&x(n))return{url:qe(e),tagName:n}}}(n))&&d(n)})),d}},Me="resourceError",Ae={includeUrls:[],ignoreUrls:[],dedupe:!0};function Ne(e){function t(n){n<o||!r||(u(),i=window.setTimeout(r,n-e()),o=n)}var r,o=-1/0,i=void 0,u=function(){return window.clearTimeout(i)};return[function(n,e){r=n,t(e)},function(){u(),r=void 0},t]}function Be(n,t){var r=["img","script","iframe","link","audio","video","source"],e=(n=I($(n,function(n){for(var e=0;e<n.length;e++)("childList"===n[e].type&&function n(e,t){for(var r=0;r<e.length;r++)if(T(t,e[r].nodeName.toLowerCase())||e[r].children&&n(e[r].children,t))return 1}(n[e].addedNodes,r)||"attributes"===n[e].type&&T(r,n[e].target.nodeName.toLowerCase()))&&t(n[e])}),2))[0];return[function(){return e(document,{attributes:!0,childList:!0,subtree:!0,attributeFilter:["href","src"]})},n[1]]}function He(n){var n=(e=n||{}).domContentLoadedEventEnd,e=e.navigationStart;return n?n-(void 0===e?0:e):null}function Pe(n,e){var t=n.startTime,r=n.duration;n.start=t,n.end=t+r,e.push(n)}function Ue(d,n,p){var v=(n=I(n,5))[0],h=n[1],m=n[2],g=n[3],y=n[4];return function(t,n){var r,o=[],i=[],e=I([r={},function(n,e){return r[n]=e},function(n){return delete r[n]}],3),u=e[0],a=e[1],c=e[2];p.forEach(function(n){n.entryType===Tn[0]&&Pe(n,o)});var f=0;d.push(v[0](function(n){if("get"!==(I(n,1)[0]||"").toLowerCase())return w;var e=f+=1;return a(e,nn()),function(){c(e)}})),d.push(h[0](function(n){var e=I(n,2),n=e[0],e=e[1];if(!window.Request||"get"!==Yn(n,e,window.Request))return w;var t=f+=1;return a(t,nn()),function(){c(t)}}));var s=I(y&&Be(y,function(){return t(n()+5e3)})||[],2),e=s[0],s=s[1];e&&e();function l(){return function(n,e,t){if(2<n.length)return t();for(var r=[],o=0;o<e.length;o++)r.push([e[o].start,0],[e[o].end,1]);for(o=0;o<n.length;o++)r.push([n[o],0]);r.sort(function(n,e){return n[0]-e[0]});for(var i=n.length,o=r.length-1;0<=o;o--){var u=I(r[o],2),a=u[0];switch(u[1]){case 0:i--;break;case 1:if(2<++i)return a}}return 0}(function(n){for(var e=Object.keys(n),t=[],r=0;r<e.length;r++){var o=n[e[r]];"number"==typeof o&&t.push(o)}return t}(u),i,n)}return s&&d.push(s),d.push(m[0](function(n){Pe(n,o);var e=n.startTime,n=n.duration;t(e+n+5e3)})),d.push(g[0](function(n){var e=n.fetchStart,n=n.responseEnd;i.push({start:e,end:n}),t(l()+5e3)})),d.push(function(){o.length=0,i.length=0}),[o,l]}}var We={isSupport:!0,isPolyfill:!1,isBounced:!1,isCustom:!1,type:"perf"},Xe=function(n,e){return g({name:n,value:e},We)},ze="performance",Fe={entries:[],observer:void 0},Ge="performance",Ye="performance_longtask",Je=function(e,t,r){var o=!1;return function(n){r.length&&r.forEach(function(n){n()}),r.length=0,o||(o=!0,t&&t(e(n)))}},$e=function(n,e){return{ev_type:Ge,payload:n,overrides:e}},Ve=function(e){var t=0,r=Xe("spa_load",0);return[function(){t=nn()},function(){var n;n=nn()-t,r.value=n,e&&e($e(r)),t=0}]},Ke="first-contentful-paint",Qe="first-paint",Ze="paint",nt=function(e,n,t,r,o){var i=I(o,2),u=i[0],a=i[1],o=F(),i=W(),c=Xe(n,0),f=Je($e,t,r);if(!i||!o)return c.isSupport=!1,void f(c);function s(n){n=n.startTime,c.value=n,f(c)}i=(0,I(V(i),5)[4])(e)[0];i?s(i):(r.push(Rn(o,function(n){n.name===e&&s(n)},[Ze])),r.push(u[0](function(){c.isSupport=!1,f(c)})),r.push(a[0](function(){c.isBounced=!0,f(c)})))},et=["fp",function(n,e,t){return nt(Qe,"fp",n,e,t)}],tt=["fcp",function(n,e,t){return nt(Ke,"fcp",n,e,t)}],rt=function(n,e,t,r){var o=I(t,5),i=o[0],u=o[1],a=o[2],c=o[3],t=o[4],f=Xe("tti",0),s=Je($e,n,e),o=W(),n=r||{},r=n.entries,l=void 0===r?[]:r,d=n.observer;if(e.push(function(){d&&d.disconnect(),l.length=0}),!window||!XMLHttpRequest||!o||!PerformanceObserver||PerformanceObserver.supportedEntryTypes&&!T(PerformanceObserver.supportedEntryTypes||[],Tn[0]))return f.isSupport=!1,void s(f);var r=I(V(o),5),p=r[0],v=r[1],h=r[4],n=I(Ne(v),3),o=n[0],r=n[1],m=n[2],c=I(Ue(e,[i,u,a,c,z()],l)(m,v),2),g=c[0],y=c[1];e.push(r);function b(n){var e=h(Ke)[0];if(!(e=function(n,e,t,r,o){if(r-t<5e3)return null;o=0===o.length?n:o[o.length-1].end;return r-o<5e3?null:Math.max(o,e)}((e?e.startTime:He(p))||0,He(p)||0,y(),v(),g)))return m(v()+1e3);n(e)}function w(n){f.value=n,s(f)}r=g[g.length-1];o(function(){return b(w)},Math.max(y()+5e3,r?r.end:0)),e.push(t[0](function(){f.isSupport=!1,s(f)}))},ot="tti";function it(n,t,e,r){if(!n||-1<r.indexOf(n.tagName))return 0;var o=n.children;if((o=[].slice.call(void 0===o?[]:o).reduceRight(function(n,e){return n+it(e,t+1,0<n,r)},0))<=0&&!e){if(!S(n.getBoundingClientRect))return 0;e=n.getBoundingClientRect()||{},n=e.top,e=e.height;if(n>window.innerHeight||e<=0)return 0}return o+1+.5*t}var ut=["SCRIPT","STYLE","META","HEAD"],at=function(n,e,t){var r=I(t,1)[0],o=U(),i=z(),u=W(),a=u&&u.timing&&u.timing.navigationStart||void 0,c=Xe("fmp",0),f=Je($e,n,e);if(!o||!i||!a)return c.isSupport=!1,void f(c);function s(){return m.push({time:nn()-h,score:it(o&&o.body,1,!1,ut)})}function l(n){void 0===n&&(n=0);var e,t=(t=(e=I(void 0===(t=m)?[]:t))[0],(e=e.slice(1))&&e.reduce(function(n,e){var t=I(n,2),r=t[0],n=t[1],t=e.score-r.score;return[e,e.time>=r.time&&n.rate<t?{time:e.time,rate:t}:n]},[t,{time:null==t?void 0:t.time,rate:0}])[1].time||0);c.value=t?t+n:0,f(c),m.length=0}var d,p,v,h=nn(),m=[],g=function(){if(P()&&"requestAnimationFrame"in window)return window.requestAnimationFrame}(),t=function(){if(P()&&"cancelAnimationFrame"in window)return window.cancelAnimationFrame}(),y=I((u=o,n=t,t=!0,p=!S(g=g)||t&&u&&u.hidden?function(n){return n(0),0}:g,v=S(n)?n:w,[function(n){d&&v(d),d=p(n)},p,v]),1)[0],n=I($(i,function(){return y(s)}),2),i=n[0],n=n[1],b=h-(a||0);i(o,{subtree:!0,childList:!0}),e.push(n),e.push(r[0](function(){setTimeout(function(){l(b)},200)}))},ct="fmp",ft={renderType:"CSR"};function st(k,C,D,O,q){if(void 0===k&&(k=P()),void 0===C&&(C=U()),void 0===D&&(D=F()),void 0===O&&(O=z()),void 0===q&&(q=W()),C&&k)return function(n,e){var t,r,o,i,u,a,c=n.threshold,f=n.screenshot,s=n.rootSelector,l=n.autoDetect,d=n.ssUrl,p=n.quality,v=n.mask,h=n.partialShot,m=Z(k),g=I(V(q),2)[1],y=0,b=!1,w=function(n){t&&e&&e({ev_type:"blank_screen",payload:{timestamp:t[0],score:t[1],screenshot:n,error:r}})},E=(i=function(){t&&!b&&(b=!0,x(),f?Et({cb:w,screenshotUrl:d,window:k,document:C,mask:v,partialShot:h,quality:p,rootSelector:s}):w())},function(){u||(a=nn(),u=k.setTimeout(function(){u=0,a<y||i()},g()>pt?ht:vt))});wn(function(){!b&&r&&w()});function _(){o&&clearTimeout(o),o=k.setTimeout(function(){m(function(){k.requestAnimationFrame(function(){var n=s?C.querySelector(s):C.body;n&&((n=wt(n,0,0,c))<c?(t=[nn(),n],E()):t=void 0)})})},1e3)}var S,x=function(){clearTimeout(o),L&&L(),j&&j()},n=I($(O,_),2),T=n[0],L=n[1],n=I(K(D,function(n,e,t){return o&&1<t.length&&_()}),2),R=n[0],j=n[1];return l&&(S=function(){var n;T(null===(n=U())||void 0===n?void 0:n.body,{subtree:!0,childList:!0}),R("longtask","resource"),_()},n=P(),l=U(),n&&l&&("loading"!==l.readyState?S():n.addEventListener("DOMContentLoaded",function(){setTimeout(function(){S()},0)},!1))),[x,function(n){b||yt(n)||(y=nn(),r&&y-r.timestamp>mt&&(r=void 0),r=bt(r,n))},_]}}var lt=["SCRIPT","STYLE","META","HEAD"],dt=["js_error","http","resource_error"],pt=1e4,vt=8e3,ht=2e3,mt=1e4,gt=["performance","performance_longtask","performance_timing","custom"],yt=function(n){return~gt.indexOf(n.ev_type)},bt=function(n,e){if(-1===dt.indexOf(e.ev_type))return n;if("http"===e.ev_type&&e.payload.response.status<400)return n;if(n&&dt.indexOf(n.type)<dt.indexOf(e.ev_type))return n;var t="";switch(e.ev_type){case"js_error":t=e.payload.error.message;break;case"http":t=e.payload.request.url;break;case"resource_error":t=e.payload.url}return{type:e.ev_type,message:t,timestamp:nn()}},wt=function(t,r,n,o,i){if(void 0===r&&(r=0),void 0===n&&(n=0),void 0===o&&(o=1.5),void 0===i&&(i=lt),!t||-1<i.indexOf(t.tagName)||o<=n||4<r)return n;var e=function(){if(!r)return 0;var n=t.getBoundingClientRect(),e=n.top,n=n.height;return e>innerHeight||n<=0?0:1/Math.pow(2,r-1)}();return[].reduceRight.call(t.children,function(n,e){return wt(e,r+1,n,o,i)},n+e)},Et=function(n){var e=n.cb,t=n.screenshotUrl,r=n.window,o=n.document,i=n.mask,u=n.partialShot,a=n.quality,c=n.rootSelector;if(P()&&"Promise"in window&&Promise&&r&&o){if(r.html2canvas)return f();n=o.createElement("script");n.src=t,null!==(t=o.head)&&void 0!==t&&t.appendChild(n),n.onload=f}function f(){Z(r)(function(){r.html2canvas&&r.html2canvas(u&&c&&o.querySelector(c)||o.body,{scale:360/r.innerWidth,mask:i}).then(function(n){e(n.toDataURL("image/jpeg",a))})})}},_t="blankScreen";var St={autoDetect:!0,threshold:1.5,screenshot:!0,ssUrl:"https://apm.volccdn.com/mars-web/apmplus/web/html2canvas.min.js",mask:!1,partialShot:!1,quality:.1};function n(n,e){var o,i,u;i=St,u=e,(o=n).on("init",function(){var n,e,t,r=Nn(o,_t,i)||sn(u,i);r&&(r=I(Q(st,r,o.report.bind(o)),3),n=r[0],e=r[1],r=r[2],o.on("report",t=function(n){return e(n),n}),o.on("beforeDestroy",function(){n(),o.off("report",t)}),o.provide("detectBlankScreen",r))})}var xt=["keydown","click"],Tt=["lcp",function(n,e,t){var r=I(t,2),o=r[0],t=r[1],r=F(),i=Xe("lcp",0),u=Je($e,n,e);if(!r)return i.isSupport=!1,void u(i);e.push(hn(r,function(n){n=n.startTime;i.value=n},"largest-contentful-paint"));function a(){u(i)}xt.forEach(function(n){window.addEventListener(n,a,!0),e.push(function(){window.removeEventListener(n,a,!0)})}),e.push(o[0](function(){i.isSupport=!1,u(i)})),e.push(t[0](function(){i.isBounced=!0,u(i)}))}],Lt="first-input",Rt=["fid",function(n,e){var t=F(),r=W(),o=Xe("fid",0),i=Je($e,n,e);if(!r||!t)return o.isSupport=!1,void i(o);n=function(n){var e=n.processingStart,n=n.startTime;o.value=e-n,i(o)},r=(0,I(V(r),3)[2])(Lt)[0];r?n(r):e.push(Rn(t,n,[Lt]))}],jt=["cls",function(n,e,t){var r,o=I(t,3),i=o[0],u=o[1],t=o[2],o=F(),a=Xe("cls",0),c=(r=n,function(n,e){r($e(n,e))});if(!o)return a.isSupport=!1,void c(a);var f,s,n=I((f=0,s=[],[function(){f=0},function(n,e){var t,r;e.hadRecentInput||(t=s[0],r=s[s.length-1],f&&e.startTime-r<1e3&&e.startTime-t<5e3?(f+=e.value,s.push(e.startTime)):(f=e.value,s=[e.startTime]),n(f))}]),2),l=n[0],n=n[1].bind(null,function(n){n>a.value&&(a.value=n)});e.push(hn(o,n,"layout-shift")),e.push(i[0](l)),e.push(t[0](function(n){c(a,n),l(),a=Xe("cls",0)})),e.push(u[0](function(){c(a)}))}],kt=["longtask",function(e,n,t){t=I(t,3)[2];n.push(t[0](function(n){e({ev_type:Ye,payload:{type:"perf",longtasks:[n]}})}))}],Ct=["timing",function(n,e,t){var r=I(t,2),t=r[0],r=r[1],o=W(),i=I(V(o),3)[2],u=Je(function(n){return{ev_type:"performance_timing",payload:{isBounced:n,timing:o&&o.timing||void 0,navigation_timing:i("navigation")[0]}}},n,e);e.push(t[0](function(){u(!1)})),e.push(r[0](function(){u(!0)}))}],Dt=["mpfid",function(n,e,t){var r=I(t,3),o=r[0],t=r[2],r=F(),i=W(),u=Xe("mpfid",0),a=[],c=Je($e,n,e);if(!r)return u.isSupport=!1,void c(u);e.push(t[0](function(n){a.push(n)}));function f(){var n=(0,I(V(i),5)[4])(Ke)[0],r=n&&n.startTime||0;u.value=a.reduce(function(n,e){var t=e.duration,e=e.startTime;return n<t&&r<e?t:n},0),a.length=0,c(u)}e.push(o[0](function(){setTimeout(f,200)}))}];var Ot="custom",qt=function(n){if(n&&_(n)&&n.name&&x(n.name)){var e={name:n.name,type:"event"};if("metrics"in n&&_(n.metrics)){var t=n.metrics,r={};for(o in t)c(t[o])&&(r[o]=t[o]);e.metrics=r}if("categories"in n&&_(n.categories)){var o,i=n.categories,u={};for(o in i)u[o]=f(i[o]);e.categories=u}return e}},It=function(n){if(n&&_(n)&&n.content&&x(n.content)){var e={content:f(n.content),type:"log",level:"info"};if("level"in n&&(e.level=n.level),"extra"in n&&_(n.extra)){var t,r=n.extra,o={},i={};for(t in r)c(r[t])?o[t]=r[t]:i[t]=f(r[t]);e.metrics=o,e.categories=i}return e}};function Mt(n){return(null==n?void 0:n.effectiveType)||(null==n?void 0:n.type)||""}function At(n,e){var t=n.common||{};return t.sample_rate=e,n.common=t,n}function Nt(n,e,t,r,o){return n?(i=o(r,e),function(){return i}):function(){return t(e)};var i}function Bt(n,e,t,r){if(void 0===(n=l(n,e,function(n,e){return n[e]})))return!1;var o,e="boolean"==typeof n?"bool":c(n)?"number":"string";return function(n,e,t){switch(t){case"eq":return T(e,n);case"neq":return!T(e,n);case"gt":return n>e[0];case"gte":return n>=e[0];case"lt":return n<e[0];case"lte":return n<=e[0];case"regex":return Boolean(n.match(new RegExp(e.join("|"))));case"not_regex":return!n.match(new RegExp(e.join("|")));default:return!1}}(n,(o=e,r.map(function(n){switch(o){case"number":return Number(n);case"boolean":return"1"===n;default:return String(n)}})),t)}function Ht(e,n){try{return"rule"===n.type?Bt(e,n.field,n.op,n.values):"and"===n.type?n.children.every(function(n){return Ht(e,n)}):n.children.some(function(n){return Ht(e,n)})}catch(n){return J(n),!1}}function Pt(){var t=P();return t&&t.navigator.sendBeacon?{get:function(){},post:function(n,e){t.navigator.sendBeacon(n,e)}}:{get:w,post:w}}function Ut(n,e,t){var r=e.url,o=e.data,i=e.success,u=void 0===i?w:i,a=void 0===(i=e.fail)?w:i,c=void 0===(i=e.getResponseText)?w:i,e=void 0!==(e=e.withCredentials)&&e;(t=new t).withCredentials=e,t.open(n,r,!0),t.setRequestHeader("Content-Type","application/json"),t.onload=function(){null!=c&&c(this.responseText);try{var n;this.responseText?(n=JSON.parse(this.responseText),u(n)):u({})}catch(n){a(n)}},t.onerror=function(){a(new Error("Network request failed"))},t.onabort=function(){a(new Error("Network request aborted"))},t.send(o)}var Wt=function(n){var e=G(),t=Mt(e);e&&(e.onchange=function(){t=Mt(e)}),n.on("report",function(n){return g(g({},n),{extra:g(g({},n.extra||{}),{network_type:t})})})},Xt=function(n,e,t,r){if(!e)return E;var o=e.sample_rate,i=e.include_users,u=e.sample_granularity,a=e.rules,e=e.r,e=void 0===e?Math.random():e;if(T(i,n))return function(n){return At(n,1)};var c,f,s,l,d,p,v,u="session"===u,h=Nt(u,o,t,e,r),m=(c=a,f=u,s=o,l=t,d=e,p=r,v={},Object.keys(c).forEach(function(n){var e=c[n],t=e.enable,r=e.sample_rate,e=e.conditional_sample_rules;t?(v[n]={enable:t,sample_rate:r,effectiveSampleRate:r*s,hit:Nt(f,r,l,d,p)},e&&(v[n].conditional_hit_rules=e.map(function(n){var e=n.sample_rate,n=n.filter;return{sample_rate:e,hit:Nt(f,e,l,d,p),effectiveSampleRate:e*s,filter:n}}))):v[n]={enable:t,hit:function(){return!1},sample_rate:0,effectiveSampleRate:0}}),v);return function(n){if(!h())return!1;if(!(n.ev_type in m))return At(n,o);if(!m[n.ev_type].enable)return!1;if(null!==(e=n.common)&&void 0!==e&&e.sample_rate)return n;var e=m[n.ev_type],t=e.conditional_hit_rules;if(t)for(var r=0;r<t.length;r++)if(Ht(n,t[r].filter))return!!t[r].hit()&&At(n,t[r].effectiveSampleRate);return!!e.hit()&&At(n,e.effectiveSampleRate)}};function zt(n){var e,t,r,o,i,u,a,c,f,s=(r=(e=n).transport,o=n.endpoint,i=n.size,u=void 0===i?10:i,a=void 0===(e=n.wait)?1e3:e,c=[],f=0,{getSize:function(){return u},getWait:function(){return a},setSize:function(n){u=n},setWait:function(n){a=n},getEndpoint:function(){return o},setEndpoint:function(n){o=n},send:function(n){c.push(n),c.length>=u&&l.call(this),clearTimeout(f),f=setTimeout(l.bind(this),a)},flush:function(){clearTimeout(f),l.call(this)},getBatchData:function(){return c.length?v(c):""},clear:function(){clearTimeout(f),c=[]},fail:function(n){t=n}});function l(){var e;c.length&&(e=this.getBatchData(),r.post({url:o,data:e,fail:function(n){t&&t(n,e)}}),c=[])}function d(n){p.post(s.getEndpoint(),v([n]))}var p=Pt();return wn(function(){var n=s.getBatchData();n&&(p.post(s.getEndpoint(),n),s.clear()),s.send=d}),s}var Ft={build:function(n){return{ev_type:n.ev_type,payload:n.payload,common:g(g({},n.extra||{}),n.overrides||{})}}};function Gt(n){var e,t=n.plugins||{};for(e in t)t[e]&&!_(t[e])&&(t[e]={});return g(g({},n),{plugins:t})}function Yt(n){return _(n)&&"aid"in n}function Jt(n){return g({},n)}function $t(){var n=P(),e=U();if(n&&e)return(null===(e=null===(e=null===(e=function(){if(!document)return null;if(document.currentScript)return document.currentScript;try{throw new Error}catch(n){var e=0,t=/at\s+(.*)\s+\((.*):(\d*):(\d*)\)/i.exec(n.stack),r=t&&t[2]||!1,o=t&&t[3]||0,i=document.location.href.replace(document.location.hash,""),u="",a=document.getElementsByTagName("script");for(r===i&&(t=document.documentElement.outerHTML,o=new RegExp("(?:[^\\n]+?\\n){0,"+(o-2)+"}[^<]*<script>([\\d\\D]*?)<\\/script>[\\d\\D]*","i"),u=t.replace(o,"$1").trim());e<a.length;e++){if("interactive"===a[e].readyState)return a[e];if(a[e].src===r)return a[e];if(r===i&&a[e].innerHTML&&a[e].innerHTML.trim()===u)return a[e]}return null}}())||void 0===e?void 0:e.getAttribute("src"))||void 0===e?void 0:e.match(/globalName=(.+)$/))||void 0===e?void 0:e[1])||Zt}function Vt(n){return"APMPLUS"+n}function Kt(n){return function(n){try{var e=localStorage.getItem(n),t=e;return t=e&&"string"==typeof e?JSON.parse(e):t}catch(n){return}}(Vt(n))||{userId:D(),deviceId:D(),r:Math.random()}}function Qt(n){var e=n.aid,t=n.userId,r=n.deviceId,n=n.sample;!function(n,e){try{var t="string"==typeof e?e:JSON.stringify(e);localStorage.setItem(n,t)}catch(n){}}(Vt(e),{userId:t,deviceId:r,r:n.r})}var Zt="APM_PLUS_WEB",nr="/settings/get/webpro",er="/monitor_web/collect",tr=[er,nr,"/monitor_browser/collect"],rr={sample_rate:1,include_users:[],sample_granularity:"session",rules:{}},or=20,ir=function(n,e){return void 0===e&&(e=er),(n&&0<=n.indexOf("//")?"":"https://")+n+e},ur=D,ar=function(e){var o,i,u,a=e,c={},f=w,t=w;return{getConfig:function(){return a},setConfig:function(n){var e,t,r;return c=g(g({},c),n||{}),s(),o||(o=n,a.useLocalConfig?(u={},f()):i?l():(e=a.transport,t=a.domain,n=a.aid,r=function(n){i=n,l()},e.get({withCredentials:!0,url:function(n,e){return void 0===e&&(e=nr),(n&&0<=n.indexOf("//")?"":"https://")+n+e}(t)+"?aid="+n,success:function(n){r(n.data||{})},fail:function(){r()}}))),a},onChange:function(n){t=n},onReady:function(n){f=function(){!function(){e.userId!==a.userId&&(e.sample.r=Math.random(),s());Qt(a)}(),n()},u&&f()}};function s(){var n=g(g(g({},e),u||{}),c);n.plugins=function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];for(var t={},r=0;r<n.length;)t=d(t,n[r++]);return t}(e.plugins,(null==u?void 0:u.plugins)||{},c.plugins||{}),n.sample=cr(cr(e.sample,null==u?void 0:u.sample),c.sample),a=n,t()}function l(){u=function(n){if(!n)return{};var e=n.sample,t=n.timestamp,r=n.status;if(!e)return{};var o=e.sample_rate,n=e.sample_granularity;return{sample:{include_users:e.include_users,sample_rate:r&&4===r?0:o,sample_granularity:n,rules:e.rules.reduce(function(n,e){var t=e.name,r=e.enable,o=e.sample_rate,e=e.conditional_sample_rules;return n[t]={enable:r,sample_rate:o,conditional_sample_rules:e},n},{})},serverTimestamp:t}}(i),s(),f()}};function cr(r,o){if(!r||!o)return r||o;var n=g(g({},r),o);return n.include_users=y(y([],I(r.include_users||[]),!1),I(o.include_users||[]),!1),n.rules=y(y([],I(Object.keys(r.rules||{})),!1),I(Object.keys(o.rules||{})),!1).reduce(function(n,e){var t;return e in n||(e in(r.rules||{})&&e in(o.rules||{})?(n[e]=g(g({},r.rules[e]),o.rules[e]),n[e].conditional_sample_rules=y(y([],I(r.rules[e].conditional_sample_rules||[]),!1),I(o.rules[e].conditional_sample_rules||[]),!1)):n[e]=(null===(t=r.rules)||void 0===t?void 0:t[e])||(null===(t=o.rules)||void 0===t?void 0:t[e])),n},{}),n}var fr,sr,lr,dr,pr,vr,hr,mr,gr,yr,br,wr,Er,_r,Sr,xr,Tr,Lr,Rr=function(n){n.on("report",function(n){return e=n,n={url:rn(),timestamp:Date.now()},g(g({},e),{extra:g(g({},n),e.extra||{})});var e})},jr={sri:"reportSri",st:"reportResourceError",err:"captureException"},kr=function(n){return Object.keys(n).reduce(function(n,e){return n[e]=[],n},{})},Cr=function(t){return Object.keys(t).reduce(function(n,e){return n[t[e]]=e,n},{})},Dr=function(o,i,u){return function(n,e,t,r){void 0===t&&(t=Date.now()),void 0===r&&(r=location.href);r=g(g({},on(o)),{url:r,timestamp:t});i[n]&&(o[u[n]]?un(o,r)(function(){o[u[n]](e)}):null!==(t=i[n])&&void 0!==t&&t.push([e,r]))}},Or=function(r,e,o){return function(t){var n;t in o&&(null!==(n=e[o[t]])&&void 0!==n&&n.forEach(function(n){var n=I(n,2),e=n[0],n=n[1];un(r,n)(function(){r[t](e)})}),e[o[t]]=null)}},qr=function(t){var r,o=!1;t.on("init",function(){r=(new Date).getTime(),t.on("config",function(){var n,e=null===(n=t.config())||void 0===n?void 0:n.serverTimestamp;isNaN(e)||Number(e)<=0||o||(o=!0,(n=(new Date).getTime())-r<700&&e&&(n=e-(n+r)/2,!isNaN(n)&&(0<n||n<-6e5)&&t.set({offset:n})))})})},Ir=function(r){r.on("beforeBuild",function(n){return e=n,t=r.config(),(n={}).aid=t.aid,n.pid=t.pid,n.view_id=t.viewId,n.user_id=t.userId,g(g({},e),{extra:g(g({},n),e.extra||{})});var e,t})},Mr=function(c){c.on("start",function(){var t,n=c.config(),e=n.deviceId,r=n.sessionId,o=n.release,i=n.env,u=n.offset,a=n.aid,n=n.token,a={did:e,sid:r,release:o,env:i,sname:Zt,sversion:"2.0.4",soffset:u||0,biz_id:a,x_auth_token:n},n=c.getSender();n.setEndpoint(n.getEndpoint()+(_(t=a)?Object.keys(t).reduce(function(n,e){return n+="&"+e+"="+t[e]},"").replace("&","?"):""))})},Ar=function(n){var e,n=Kt(n.aid);return{aid:0,pid:"",token:"",viewId:"__"+Date.now(),userId:n.userId,deviceId:n.deviceId,sessionId:ur(),domain:"apmplus.volces.com",plugins:{ajax:{ignoreUrls:tr},fetch:{ignoreUrls:tr},breadcrumb:{},pageview:{},jsError:{},resource:{},resourceError:{},performance:{},tti:{},fmp:{},blankScreen:!1},release:"",env:"production",sample:g(g({},rr),{r:n.r}),transport:(e=X())?{get:function(n){Ut("GET",n,e)},post:function(n){Ut("POST",n,e)}}:{get:w,post:w}}},Nr=(Lr=function(n){var e=void 0===n?{}:n,t=e.createSender,n=e.builder,e=e.createDefaultConfig,r=function(n){var t,r,e=n.builder,o=n.createSender,i=n.createDefaultConfig,u=n.createConfigManager,a=n.userConfigNormalizer,c=n.initConfigNormalizer,f=n.validateInitConfig,s={};b.forEach(function(n){return s[n]=[]});var l=!1,d=!1,p=!1,v=[],h=[],m={getBuilder:function(){return e},getSender:function(){return t},getPreStartQueue:function(){return v},init:function(n){if(l)R("already inited");else{if(!(n&&_(n)&&f(n)))throw new Error("invalid InitConfig, init failed");var e=i(n);if(!e)throw new Error("defaultConfig missing");n=c(n);if((r=u(e)).setConfig(n),r.onChange(function(){g("config")}),!(t=o(r.getConfig())))throw new Error("sender missing");g("init",l=!0)}},set:function(n){l&&n&&_(n)&&(g("beforeConfig",!1,n),null!=r&&r.setConfig(n))},config:function(n){if(l)return n&&_(n)&&(g("beforeConfig",!1,n),null!=r&&r.setConfig(a(n))),null==r?void 0:r.getConfig()},provide:function(n,e){T(h,n)?R("cannot provide "+n+", reserved"):(m[n]=e,g("provide",!1,n))},start:function(){var e=this;l&&(d||null!=r&&r.onReady(function(){g("start",d=!0),v.forEach(function(n){return e.build(n)}),v=[]}))},report:function(n){n&&(!(n=j(s.beforeReport)(n))||(n=j(s.report)(n))&&(d?this.build(n):v.push(n)))},build:function(n){!d||(n=j(s.beforeBuild)(n))&&(!(n=e.build(n))||(n=j(s.build)(n))&&this.send(n))},send:function(n){!d||(n=j(s.beforeSend)(n))&&(t.send(n),g("send",!1,n))},destroy:function(){g("beforeDestroy",p=!0)},on:function(n,e){"init"===n&&l||"start"===n&&d||"beforeDestroy"===n&&p?e():s[n]&&s[n].push(e)},off:function(n,e){s[n]&&(s[n]=L(s[n],e))}},h=Object.keys(m);return m;function g(n,e){void 0===e&&(e=!1);for(var t=[],r=2;r<arguments.length;r++)t[r-2]=arguments[r];s[n].forEach(function(n){try{n.apply(void 0,y([],I(t),!1))}catch(n){}}),e&&(s[n].length=0)}}({validateInitConfig:Yt,initConfigNormalizer:Gt,userConfigNormalizer:Jt,createSender:void 0===t?function(n){return zt({size:or,endpoint:ir(n.domain),transport:n.transport})}:t,builder:void 0===n?Ft:n,createDefaultConfig:void 0===e?Ar:e,createConfigManager:ar});A(r);var o,n=Y(P());e=r,n=n&&n.subject,o=n||{},e.provide("initSubject",function(n){var n=I(n,2),e=n[0],n=n[1];return o[e]||(o[e]=q(n,function(){o[e]=void 0})),o[e]}),e.provide("getSubject",function(n){return o[n]}),e.provide("privateSubject",{}),qr(r),Ir(r),Rr(r),Wt(r),Mr(r);var i,e=N(r,on,function(n,e,t){return un(n,e)(function(){var n=I(t),e=n[0],n=n.slice(1);r[e].apply(r,y([],I(n),!1))})});return(i=e).on("init",function(){var e=[],n=i.config();n&&n.integrations&&n.integrations.forEach(function(n){T(e,n.name)||(e.push(n.name),n.setup(i),n.tearDown&&i.on("beforeDestroy",n.tearDown))})}),e}(fr=void 0===fr?{}:fr),(sr=Lr).on("start",function(){var n=sr.config(),e=n.userId,n=n.sample;n&&0===n.sample_rate&&sr.destroy();n=Xt(e,n,k,C);sr.on("build",n)}),lr=Lr,pr=kr(dr=void 0===dr?jr:dr),fr=Cr(dr),vr=Dr(lr,pr,dr),null!==(dr=lr.p)&&void 0!==dr&&dr.a&&"observe"in lr.p.a&&lr.p.a.observe(function(n){var e=I(n,5);e[0];var t=e[1],r=e[2],n=e[3],e=e[4];vr(t,r,n,e)}),lr.on("init",function(){var n;null!==(n=lr.p)&&void 0!==n&&n.a.forEach(function(n){var e=I(n,5);e[0];var t=e[1],r=e[2],n=e[3],e=e[4];vr(t,r,n,e)}),lr.p&&lr.p.a&&(lr.p.a.length=0)}),lr.provide("precollect",vr),lr.on("provide",Or(lr,pr,fr)),(hr=Lr).provide("sendEvent",function(n){n=qt(n);n&&hr.report({ev_type:Ot,payload:n,extra:{timestamp:nn()}})}),hr.provide("sendLog",function(n){n=It(n);n&&hr.report({ev_type:Ot,payload:n,extra:{timestamp:nn()}})}),(mr=Lr).on("init",function(){var n,e,t,r=Nn(mr,xe,Te);r&&location&&(n=[],e=r.routeMode,t=I(Se(mr.report.bind(mr),n,_e(e)?[]:[mr.initSubject(we),mr.initSubject(Ee)],g(g({},r),{initPid:null===(r=mr.config())||void 0===r?void 0:r.pid,onPidUpdate:function(n){mr.set({pid:n,viewId:n+"_"+nn(),actionId:void 0})}})),1)[0],H(mr,[ye,be(mr)],-1),mr.on("config",function(){t(mr.config().pid)}),mr.on("beforeDestroy",function(){n.forEach(function(n){return n()})}),mr.provide("sendPageview",t))}),(gr=Lr).on("init",function(){var n,e=Nn(gr,Hn,Pn);e&&(n=[],(e=g(g({},e),{hookCbAtReq:Un(gr),setTraceHeader:Dn(e.trace,"app_id="+(null===(e=gr.config())||void 0===e?void 0:e.aid)+",origin=web")})).autoWrap&&In(gr.report.bind(gr),n,[B(gr,[En,_n(XMLHttpRequest&&XMLHttpRequest.prototype)]),function(){return B(gr,kn)}],e),gr.on("beforeDestroy",function(){n.forEach(function(n){return n()})}))}),(yr=Lr).on("init",function(){var n,e=Nn(yr,Vn,Kn);e&&(n=[],(e=g(g({},e),{hookCbAtReq:Un(yr),setTraceHeader:Dn(e.trace,"app_id="+(null===(e=yr.config())||void 0===e?void 0:e.aid)+",origin=web")})).autoWrap&&Fn(yr.report.bind(yr),n,[B(yr,Sn),function(){return B(yr,kn)}],e),yr.on("beforeDestroy",function(){n.forEach(function(n){return n()})}))}),(br=Lr).on("init",function(){var n;Nn(br,ot,{})&&(n=[],rt(Bn(br),n,[B(br,[En,_n(XMLHttpRequest&&XMLHttpRequest.prototype)]),B(br,Sn),B(br,jn),B(br,kn),H(br,[me,ge(br)])],br.pp),br.on("beforeDestroy",function(){n.forEach(function(n){return n()})}))}),(wr=Lr).on("init",function(){var n,e,t,r=Nn(wr,ct,ft);r&&(n=[],e=B(wr,Re),"SSR"===r.renderType?(t=B(wr,Le),r=B(wr,je),nt(Qe,ct,Bn(wr),n,[t,r])):at(Bn(wr),n,[e]),wr.on("beforeDestroy",function(){n.forEach(function(n){return n()})}))}),(Er=Lr).on("init",function(){var e,n,t=Nn(Er,Xn,zn);t&&(t=(n=I(Q(Wn,t,w),3))[0],e=n[1],n=n[2],Er.on("report",function(n){return"http"===n.ev_type&&e({type:"http",category:n.payload.api,message:"",data:{method:n.payload.request.method,url:n.payload.request.url,status_code:String(n.payload.response.status)},timestamp:n.payload.request.timestamp}),n}),Er.on("beforeDestroy",n),Er.provide("getBreadcrumbs",t),Er.provide("addBreadcrumb",e))}),(_r=Lr).on("init",function(){window.removeEventListener("error",_r.pcErr,!0),window.removeEventListener("unhandledrejection",_r.pcRej,!0);var n,e=Nn(_r,pe,ve);e&&(e=de(function(n){_r.getBreadcrumbs&&(n.payload.breadcrumbs=_r.getBreadcrumbs()),_r.report(n)},n=[],[B(_r,ie),B(_r,ue)],e),_r.on("beforeDestroy",function(){n.forEach(function(n){return n()})}),_r.provide("captureException",e))}),(Sr=Lr).on("init",function(){var n=Sr.pp||Fe;null!==(f=n.observer)&&void 0!==f&&f.disconnect();var e,t,r,o,i,u,a,c,f,s,l=Nn(Sr,ze,{});l&&(e=B(Sr,Le),t=B(Sr,je),r=B(Sr,Re),o=B(Sr,jn),i=[],u=void 0,H(Sr,[ye,be(Sr)],-1)[0](function(n){u=n})(),a=function(n){n=n.ev_type===Ge&&n.payload.name===jt[0]||n.ev_type===Ye?n:g(g({},n),{overrides:u});Sr.report(n)},c=H(Sr,[me,ge(Sr)]),[et,tt,Tt,Rt,jt].forEach(function(n){!1!==l[n[0]]&&(n[1](a,n=[],[e,t,c]),i.push(n))}),[kt,Ct,Dt].forEach(function(n){!1!==l[n[0]]&&(n[1](a,n=[],[r,t,o]),i.push(n))}),f=(s=I(Ve(Sr.report.bind(Sr)),2))[0],s=s[1],Sr.provide("performanceInit",f),Sr.provide("performanceSend",s),n.entries.length=0,Sr.provide("sendCustomPerfMetric",function(n){n=g(g(g({},We),n),{isCustom:!0});Sr.report($e(n))}),Sr.on("beforeDestroy",function(){i.reduce(function(n,e){return n.concat(e)},[]).forEach(function(n){return n()}),i.length=0}))}),(xr=Lr).on("init",function(){var n,e=Nn(xr,Me,Ae);e&&(n=[],e=Ie(xr.report.bind(xr),n,[B(xr,ie)],e),xr.on("beforeDestroy",function(){n.forEach(function(n){return n()})}),e&&xr.provide("reportResourceError",e))}),(Tr=Lr).on("init",function(){var n,e=Nn(Tr,De,Oe);e&&(n=[],Ce(Tr.report.bind(Tr),n,[B(Tr,Re),function(){return B(Tr,kn)}],e),Tr.on("beforeDestroy",function(){n.forEach(function(n){return n()})}))}),n(Lr),Lr),Br=function(){var n=P(),e=$t();if(n&&e)return n[e]}();Br&&["p","pp","pcErr","pcRej"].forEach(function(n){Nr.provide(n,Br[n])});var Hr,Pr,Ur,Wr,Xr=P(),zr=$t();Xr&&zr&&(Hr=(null==(Hr=Xr[zr])?void 0:Hr.q)||[],Xr[zr]=Nr,Hr.forEach(function(n){var e,t;t=n,n=g(g({},on(e=Nr)),{url:t.pop(),timestamp:t.pop()}),un(e,n)(function(){e.apply(void 0,y([],I(t),!1))})}),Hr.length=0,Nr.p&&("observe"in Nr.p.a&&console.warn("global precollect queue already updated"),Nr.p.a=(Ur=Nr.p.a,Wr=[],Ur.observe=function(n){Wr.push(n)},Ur.push=function(){for(var n,e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e.forEach(function(e){Wr.forEach(function(n){return n(e)})}),(n=[].push).call.apply(n,y([Ur],I(e),!1))},Ur),(Pr=Nr.precollect)&&Nr.provide("precollect",function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];return Nr.p.a.push(y(["precollect"],I(n),!1)),Pr.apply(void 0,y([],I(n),!1))})))}();
!function(){"use strict";var u,m=function(){return(m=Object.assign||function(n){for(var e,t=1,r=arguments.length;t<r;t++)for(var o in e=arguments[t])Object.prototype.hasOwnProperty.call(e,o)&&(n[o]=e[o]);return n}).apply(this,arguments)};function k(n,e){var t="function"==typeof Symbol&&n[Symbol.iterator];if(!t)return n;var r,o,i=t.call(n),u=[];try{for(;(void 0===e||0<e--)&&!(r=i.next()).done;)u.push(r.value)}catch(n){o={error:n}}finally{try{r&&!r.done&&(t=i.return)&&t.call(i)}finally{if(o)throw o.error}}return u}function y(n,e,t){if(t||2===arguments.length)for(var r,o=0,i=e.length;o<i;o++)!r&&o in e||((r=r||Array.prototype.slice.call(e,0,o))[o]=e[o]);return n.concat(r||Array.prototype.slice.call(e))}"undefined"==typeof Element||Element.prototype.addEventListener||(u=[],Hr=function(n,e){for(var t=0;t<u.length;){var r=u[t];if(r.object===this&&r.type===n&&r.listener===e){"DOMContentLoaded"===n?this.detachEvent("onreadystatechange",r.wrapper):this.detachEvent("on"+n,r.wrapper),u.splice(t,1);break}++t}},Element.prototype.addEventListener=zr=function(n,e){function t(n){n.target=n.srcElement,n.currentTarget=i,void 0!==e.handleEvent?e.handleEvent(n):e.call(i,n)}var r,o,i=this;"DOMContentLoaded"===n?(r=function(n){"complete"===document.readyState&&t(n)},document.attachEvent("onreadystatechange",r),u.push({object:this,type:n,listener:e,wrapper:r}),"complete"===document.readyState&&((o=new window.Event).srcElement=window,r(o))):(this.attachEvent("on"+n,t),u.push({object:this,type:n,listener:e,wrapper:t}))},Element.prototype.removeEventListener=Hr,HTMLDocument&&!HTMLDocument.prototype.addEventListener&&(HTMLDocument.prototype.addEventListener=zr,HTMLDocument.prototype.removeEventListener=Hr),Window&&!Window.prototype.addEventListener&&(Window.prototype.addEventListener=zr,Window.prototype.removeEventListener=Hr));function v(n){return JSON.stringify({ev_type:"batch",list:n})}var b=["init","start","config","beforeDestroy","provide","beforeReport","report","beforeBuild","build","beforeSend","send","beforeConfig"],E=function(){return{}};function g(n){return n}function w(n){return"object"==typeof n&&null!==n}var e=Object.prototype;function i(n){if(w(n)){if("function"!=typeof Object.getPrototypeOf)return"[object Object]"===e.toString.call(n);n=Object.getPrototypeOf(n);return n===e||null===n}}function a(n){return"[object Array]"===e.toString.call(n)}function _(n){return"function"==typeof n}function c(n){return"number"==typeof n}function x(n){return"string"==typeof n}function o(n){return"undefined"!=typeof Event&&function(n,e){try{return n instanceof e}catch(n){return}}(n,Event)}function d(n,e){var t,r,o=m({},n);for(t in e)r=t,Object.prototype.hasOwnProperty.call(e,r)&&void 0!==e[t]&&(w(e[t])&&i(e[t])?o[t]=d(w(n[t])?n[t]:{},e[t]):a(e[t])&&a(n[t])?o[t]=function e(n,t){n=a(n)?n:[];t=a(t)?t:[];return Array.prototype.concat.call(n,t).map(function(n){return n instanceof RegExp?n:w(n)&&i(n)?d({},n):a(n)?e([],n):n})}(n[t],e[t]):o[t]=e[t]);return o}function S(n,e){if(!a(n))return!1;if(0===n.length)return!1;for(var t=0;t<n.length;){if(n[t]===e)return!0;t++}return!1}function T(n,e){if(!a(n))return n;var t=n.indexOf(e);if(0<=t){e=n.slice();return e.splice(t,1),e}return n}function l(n,e,t){for(var r,o=(e=k(e.split(".")))[0],i=e.slice(1);n&&0<i.length;)n=n[o],o=(r=k(i))[0],i=r.slice(1);if(n)return t(n,o)}function p(n){return a(n)&&n.length?function(n){for(var e=[],t=n.length,r=0;r<t;r++){var o=n[r];x(o)?e.push(o.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")):o&&o.source&&e.push(o.source)}return new RegExp(e.join("|"),"i")}(n):null}function f(n){try{return x(n)?n:JSON.stringify(n)}catch(n){return"[FAILED_TO_STRINGIFY]:"+String(n)}}function h(i,u,a,c){return void 0===c&&(c=!0),function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];if(!i)return E;var t=i[u],r=a.apply(void 0,y([t],k(n),!1)),o=r;return _(o)&&c&&(o=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];try{return r.apply(this,e)}catch(n){return _(t)&&t.apply(this,e)}}),i[u]=o,function(n){n||(o===i[u]?i[u]=t:r=t)}}}function s(i,u,a){return function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];if(!i)return E;var t=i[u],r=a.apply(void 0,y([t],k(n),!1)),o=r;return _(o)&&(o=function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];return r.apply(this,n)}),i[u]=o,function(){o===i[u]?i[u]=t:r=t}}}function L(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];console.warn.apply(console,y(["[SDK]",Date.now(),(""+r++).padStart(8," ")],k(n),!1))}function R(r){return function(n){for(var e=n,t=0;t<r.length&&e;t++)try{e=r[t](e)}catch(n){j(n)}return e}}var t=0,j=function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];console.error.apply(console,y(["[SDK]",Date.now(),(""+t++).padStart(8," ")],k(n),!1))},r=0,C=function(n){return Math.random()<Number(n)},D=function(n,e){return n<Number(e)};function O(){var n=function(){for(var n=new Array(16),e=0,t=0;t<16;t++)0==(3&t)&&(e=4294967296*Math.random()),n[t]=e>>>((3&t)<<3)&255;return n}();return n[6]=15&n[6]|64,n[8]=63&n[8]|128,function(n){for(var e=[],t=0;t<256;++t)e[t]=(t+256).toString(16).substr(1);var r=0,o=e;return[o[n[r++]],o[n[r++]],o[n[r++]],o[n[r++]],"-",o[n[r++]],o[n[r++]],"-",o[n[r++]],o[n[r++]],"-",o[n[r++]],o[n[r++]],"-",o[n[r++]],o[n[r++]],o[n[r++]],o[n[r++]],o[n[+r]],o[n[15]]].join("")}(n)}function q(r,n){var e=[];try{e=n.reduce(function(n,e){try{var t=e(r);"function"==typeof t&&n.push(t)}catch(n){}return n},[])}catch(n){}return function(n){return q(n,e)}}function I(n,e,t){t=M(t);try{n(t.next,t.attach),e&&t.complete(e)}catch(n){}return[t.subscribe,t.unsubscribe]}var M=function(n){function e(n){a=T(a,n),f||s()}var t,r,o,i,u,a=[],c=[],f=!1,s=(r=function(){return a.length},o=function(){f=!0,t&&t[0](),c.forEach(function(n){return n()}),c.length=0,t=void 0},-1===(i=n=void(u=0)===n?3e5:n)?E:function(){if(r())return u&&clearTimeout(u),void(u=0);0===u&&(u=setTimeout(o,i))});return{next:function(n){return q(n,a)},complete:function(n){c.push(n)},attach:function(n,e){t=[n,e]},subscribe:function(n){if(f)throw new Error("Observer is closed");return a.push(n),t&&t[1]&&t[1](n),s(),function(){return e(n)}},unsubscribe:e}};var A=function(n){var t,r,o,e=(t={},r={},o={set:function(n,e){return t[n]=e,r[n]=f(e),o},merge:function(e){return t=m(m({},t),e),Object.keys(e).forEach(function(n){r[n]=f(e[n])}),o},delete:function(n){return delete t[n],delete r[n],o},clear:function(){return t={},r={},o},get:function(n){return r[n]},toString:function(){return m({},r)}});n.provide("context",e),n.on("report",function(n){return n.extra||(n.extra={}),n.extra.context=e.toString(),n})},N=function(a,c,t){function f(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];var t=n[0];if(t){var r=t.split(".")[0];if(r in f)return i=f,u=t,o=[].slice.call(n,1),l(i,u,function(n,e){if(n&&e in n&&_(n[e]))try{return n[e].apply(n,o)}catch(n){return}});var o,i=s[r]||[],u=null!==(u=null==c?void 0:c(a))&&void 0!==u?u:{};i.push(y([u],k(n),!1)),void(s[r]=i)}}var n,s={};for(n in h(a,"provide",function(t){return function(n,e){f[n]=e,t.call(a,n,e)}})(),a)Object.prototype.hasOwnProperty.call(a,n)&&(f[n]=a[n]);return a.on("provide",function(n){s[n]&&(s[n].forEach(function(n){var e=k(n),n=e[0],e=e.slice(1);null!=t&&t(a,n,e)}),s[n]=null)}),f};function B(n,e){return n.initSubject(e)}function H(n,e,t){var e=k(e,2),r=e[0],e=e[1],o=n.privateSubject||{};return o[r]||(o[r]=I(e,function(){o[r]=void 0},t)),o[r]}var P=function(){return Date.now()};function U(){if("object"==typeof window&&w(window))return window}function W(){if("object"==typeof document&&w(document))return document}function X(){if(U()&&w(window.performance))return window.performance}function z(){if("function"==typeof XMLHttpRequest&&_(XMLHttpRequest))return XMLHttpRequest}function F(){if(U()&&_(window.MutationObserver))return window.MutationObserver}function G(){if(U()&&_(window.PerformanceObserver))return window.PerformanceObserver}function Y(){var n=function(){if(U()&&"navigator"in window)return window.navigator}();if(n)return n.connection||n.mozConnection||n.webkitConnection}function J(n){var e=W();if(!e||!n)return"";e=e.createElement("a");return e.href=n,e.href}function $(n){var e=W();if(!e||!n)return{url:n,protocol:"",domain:"",query:"",path:"",hash:""};e=e.createElement("a");e.href=n;n=e.pathname||"/";return"/"!==n[0]&&(n="/"+n),{url:e.href,protocol:e.protocol.slice(0,-1),domain:e.hostname,query:e.search.substring(1),path:n,hash:e.hash}}function V(){var n=U()&&U()&&window.location;return null==n?void 0:n.href}function K(n){return{pid:n.pid,view_id:n.viewId,url:V()}}function Q(n){var e=n.config();return(e=K(e)).context=n.context?n.context.toString():{},e}function Z(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];var t=un(U());t&&(t.errors||(t.errors=[]),t.errors.push(n))}var nn=function(e,n){void 0===n&&(n=!1);var t=Q(e);return n&&(t.timestamp=P()),function(n){e.report(m(m({},n),{overrides:t}))}},en="view_0",tn=function(o){return function(t,n){function e(n){var e;n.viewId&&n.viewId!==(null===(e=o.config())||void 0===e?void 0:e.viewId)&&(t(r),r=m(m({},Q(o)),K(n)))}var r=Q(o);o.on("beforeConfig",e),n(function(){o.off("beforeConfig",e)})}},rn="f_view_0",on=function(r){return function(n,e){var t=Q(r);e(E,function(n){t&&n(t)})}},un=function(n){if(n)return n.__SLARDAR_REGISTRY__||(n.__SLARDAR_REGISTRY__={Slardar:{plugins:[],errors:[],subject:{}}}),n.__SLARDAR_REGISTRY__.Slardar},an=function(n,e){var t=n&&new n(e);return[function(n,e){t&&n&&t.observe(n,e)},function(){return t&&t.disconnect()}]},cn=function(t){var n=t&&t.timing||void 0;return[n,function(){return t&&t.now?t.now():(Date.now?Date.now():+new Date)-(n&&n.navigationStart||0)},function(n){var e=(t||{}).getEntriesByType;return _(e)&&e.call(t,n)||[]},function(){var n=(t||{}).clearResourceTimings;_(n)&&n.call(t)},function(n){var e=(t||{}).getEntriesByName;return _(e)&&e.call(t,n)||[]}]},fn=function(n,e,t,r){void 0===e&&(e={}),void 0===r&&(r=[]);try{var o=n.apply(void 0,y([],k(r),!1));return o&&o(e,t)||[]}catch(n){return Z(n),[]}},sn=function(e){return e.requestIdleCallback||function(n){return e.setTimeout(n,1)}},ln=function(n){var e={url:V(),timestamp:P()},t=n.config();return null!=t&&t.pid&&(e.pid=t.pid),null!=n&&n.context&&(e.context=n.context.toString()),e},dn=function(t,r){return function(n){function e(n){return n.overrides=r,n}t.on("report",e),n(),t.off("report",e)}};function pn(n){try{for(var e,t=n,r=[],o=0,i=0,u=" > ".length;t&&o++<5&&!("html"===(e=function(n){var e,t,r,o,i=n,u=[];if(!i||!i.tagName)return"";u.push(i.tagName.toLowerCase()),i.id&&u.push("#"+i.id);n=i.className;if(n&&x(n))for(e=n.split(/\s+/),o=0;o<e.length;o++)u.push("."+e[o]);var a=["type","name","title","alt"];for(o=0;o<a.length;o++)t=a[o],(r=i.getAttribute(t))&&u.push("["+t+'="'+r+'"]');return u.join("")}(t))||1<o&&80<=i+r.length*u+e.length);)r.push(e),i+=e.length,t=t.parentNode;return r.reverse().join(" > ")}catch(n){return"<unknown>"}}function vn(o){function i(e,t){var r;return function(n){u=void 0,n&&r!==n&&t({event:r=n,name:e})}}var u;return[i,function(r){return function(n){var e;try{e=n.target}catch(n){return}var t=e&&e.tagName;t&&("INPUT"===t||"TEXTAREA"===t||e.isContentEditable)&&(u||i("input",r)(n),clearTimeout(u),u=window.setTimeout(function(){u=void 0},o))}}]}function hn(e,t){return function(n){if(t)try{e(n)}catch(n){}}}function mn(n){var e,t=U();t&&(e=k(Ln(n),1)[0],["unload","beforeunload","pagehide"].forEach(function(n){t.addEventListener(n,e)}))}function gn(n,e){return w(n)?m(m({},e),n):!!n&&e}function yn(r){return function(){for(var n,e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return n=k(e,2),this._method=n[0],this._url=n[1],r.apply(this,e)}}function bn(o){return function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];this._reqHeaders=this._reqHeaders||{};var t=k(n,2),r=t[0],t=t[1];return this._reqHeaders[r]=t,o&&o.apply(this,n)}}function wn(i,u){return function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];this._start=P(),this._data=null==n?void 0:n[0];var r,o,t=u([this._method,this._url,this._start,this]);return o=t,s(r=this,"onreadystatechange",function(t){return function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];return 4===this.readyState&&o(r),t&&t.apply(this,n)}})(),i.apply(this,n)}}function En(r,o){return function(n,e){var t=o([n,e=void 0===e?{}:e]),e=r(n,e);return e.then(function(n){t(n)},function(){t(void 0)}),e}}function _n(n,e,t){return n=k(On(n,e),3),e=n[1],n=n[2],e(t),n}function xn(){var n=window.crypto||window.msCrypto;if(void 0!==n&&n.getRandomValues){var e=new Uint16Array(8);n.getRandomValues(e);n=function(n){for(var e=n.toString(16);e.length<4;)e="0"+e;return e};return n(e[0])+n(e[1])+n(e[2])+n(e[3])+n(e[4])+n(e[5])+n(e[6])+n(e[7])}return"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx".replace(/[x]/g,function(){return(16*Math.random()|0).toString(16)})}function Sn(n,e){return!!(n=p(n||[]))&&n.test(e)}function Tn(n,e){return!(!n||!e)&&(Bn.test(n)||Hn.test(e))}var Ln=function(e){var t=!1;return[function(n){t||(t=!0,e&&e(n))}]},Rn="xhr_0",jn=function(r){return function(n,e){var t;r&&((t=[]).push(s(r,"open",yn)()),t.push(s(r,"setRequestHeader",bn)()),t.push(s(r,"send",wn)(n)),e(function(){t.forEach(function(n){return n()})}))}},Cn=["fetch_0",function(n,e){var t,r=U();r&&fetch&&((t=[]).push(s(r,"fetch",En)(n)),e(function(){t.forEach(function(n){return n()})}))}],kn=["resource"],Dn=["longtask"],On=function(e,o,t){var r=e&&new e(function(n,r){n.getEntries?n.getEntries().forEach(function(n,e,t){return o(n,e,t,r)}):t&&t()});return[function(n){if(!e||!r)return t&&t();try{r.observe({entryTypes:n})}catch(n){return t&&t()}},function(n){if(!e||!r)return t&&t();try{r.observe({type:n,buffered:!0})}catch(n){return t&&t()}r.observe({type:n,buffered:!1})},function(){return r&&r.disconnect()}]},qn=function(n,e,t){n=k(On(n,e),3),e=n[0],n=n[2];return e(t),n},In=["longtask_0",function(n,e){var t=G();t&&e(qn(t,n,Dn))}],Mn=["resource_0",function(n,e){var t=G();t&&e(qn(t,n,kn))}],An={sampleRate:1,origins:[]},Nn=function(n,r){var o=gn(n,An);if(o&&C(o.sampleRate))return function(n,e){var t=o.origins;t.length&&Boolean(n.match(new RegExp(t.join("|"))))&&(e("x-rum-traceparent","00-"+xn()+"-"+xn().substring(16)+"-01"),e("x-rum-tracestate",r))}},Bn=new RegExp("(cookie|auth|jwt|token|key|ticket|secret|credential|session|password)","i"),Hn=new RegExp("(bearer|session)","i"),Pn=function(n,e,a){var t=k(e,2),e=t[0],c=t[1],f=a.setTraceHeader,s=a.ignoreUrls,l=a.setContextAtReq;n.push(e[0](function(n){var e=k(n,4);e[0];n=e[1];e[2];var t=e[3];if(Sn(s,n))return E;f&&f(n,function(n,e){return t.setRequestHeader(n,e)});var r=l(),o=J(n),i=void 0,u=c()[0](function(n){o!==n.name||i||(i=n)});return function(n){var e=function(n,e){var t=n._method,r=n._reqHeaders,o=n._url,i=n._start,u=n._data,a,c={api:"xhr",request:{url:J(o),method:(t||"").toLowerCase(),headers:r&&Wn(r),timestamp:i},response:{status:n.status||0,is_custom_error:false,timestamp:P()},duration:P()-i};if(typeof n.getAllResponseHeaders==="function")c.response.headers=Un(n.getAllResponseHeaders());var f=c.response.status,s=e.collectBodyOnError,l=e.extraExtractor;try{var d=l===null||l===void 0?void 0:l(n.response,c);d&&(c.extra=d);d&&(c.response.is_custom_error=true);if(s&&f>=400){c.request.body=u?""+u:undefined;c.response.body=n.response?""+n.response:undefined}}catch(n){}return c}(n,a);setTimeout(function(){i&&(e.response.timing=i),r&&r({ev_type:"http",payload:e}),u()},100)}}))};function Un(n){return x(n)&&n?n.split("\r\n").reduce(function(n,e){var t;return x(e)&&(e=(t=k(e.split(": "),2))[0],t=t[1],Tn(e,t)||(n[e.toLowerCase()]=t)),n},{}):{}}function Wn(t){return Object.keys(t).reduce(function(n,e){return Tn(e,t[e])||(n[e.toLowerCase()]=t[e]),n},{})}function Xn(n,e,t){e=null===(n=n.config())||void 0===n?void 0:n.plugins[e];return gn(e,t)}var zn="ajax",Fn={autoWrap:!0,setContextAtReq:function(){return g},ignoreUrls:[],collectBodyOnError:!1};var Gn=function(f){if(f=void 0===f?W():f)return function(n,e){var t,r=n.maxBreadcrumbs,o=n.onAddBreadcrumb,i=n.onMaxBreadcrumbs,u=n.dom,a=k(vn(100),2),n=a[0],a=a[1],r=k(function(e,t,r){void 0===e&&(e=20),void 0===t&&(t=g),void 0===r&&(r=function(n,e){return n.slice(-e)});var o=[];return[function(){return o},function(n){t(n)&&(n=m(m({},n),{timestamp:n.timestamp||P()}),o=0<=e&&o.length+1>e?r(y(y([],k(o),!1),[n],!1),e):y(y([],k(o),!1),[n],!1))}]}(r,o,i),2),o=r[0],i=r[1],r=(t=i,function(n){var e;try{e=n.event.target?pn(n.event.target):pn(n.event)}catch(n){e="<unknown>"}0!==e.length&&t({type:"dom",category:"ui."+n.name,message:e})}),c=[];u&&(c.push(n("click",hn(r,"dom"))),c.push(a(hn(r,"dom"))),f.addEventListener("click",c[0]),f.addEventListener("keypress",c[1]));return[o,i,function(){f.removeEventListener("click",c[0]),f.removeEventListener("keypress",c[1])}]}},Yn="breadcrumb",Jn={maxBreadcrumbs:20,dom:!0};var $n=function(n,e,l){var t=k(e,2),e=t[0],r=t[1],o=l.setTraceHeader,d=l.ignoreUrls,p=l.setContextAtReq,v=window.Headers,h=window.Request;h&&v&&n.push(e[0](function(n){var n=k(n,2),i=n[0],u=n[1],e=J(i instanceof h?i.url:i);if(!function(n){if(!x(n))return false;var e=k(n.split(":"),2),t=e[0],r;return!e[1]||t==="http"||t==="https"}(e)||Sn(d,e))return E;o&&o(e,function(n,e){return function(n,e,t,r,o,i){var u;if(Vn(t,o))t.headers.set(n,e);else if(r.headers instanceof i)r.headers.set(n,e);else r.headers=m(m({},r.headers),(u={},u[n]=e,u))}(n,e,i,u,h,v)});var a=p(),c=P(),f=void 0,s=r()[0](function(n){e!==n.name||f||(f=n)});return function(n){var e,t,r=function(n,e,t,r,o,i,u){var a,c,f={api:"fetch",request:{method:Kn(n,e,r),timestamp:u,url:J(n instanceof r?n.url:n),headers:Qn(o,n.headers,e.headers)},response:{status:t&&t.status||0,is_custom_error:false,timestamp:P()},duration:P()-u},s=i.collectBodyOnError,l=i.extraExtractor;if(t)try{f.response.headers=Qn(o,t.headers);try{l&&t.clone().json().then(function(n){var e=l(n,f);if(e){f.extra=e;f.response.is_custom_error=true}}).catch(E)}catch(n){}if(s&&t.status>=400)f.request.body=(a=Zn(n,e,r))===null||a===void 0?void 0:a.toString()}catch(n){}else s&&(f.request.body=(c=Zn(n,e,r))===null||c===void 0?void 0:c.toString());return f}(i,u,n,h,v,l,c),o=(t=!(e=function(n){f&&(n.response.timing=f),a&&a({ev_type:"http",payload:n}),s()}),function(n){t||(t=!0,e(n))});setTimeout(function(){o(r)},1e3)}}))},Vn=function(n,e){return n instanceof e},Kn=function(n,e,t){e=e&&e.method||"get";return(e=Vn(n,t)?n.method||e:e).toLowerCase()},Qn=function(e){for(var n=[],t=1;t<arguments.length;t++)n[t-1]=arguments[t];try{return n.reduce(function(t,n){return new e(n||{}).forEach(function(n,e){return!Tn(e,n)&&(t[e]=n)}),t},{})}catch(n){return{}}},Zn=function(n,e,t){return Vn(n,t)?n.body:null==e?void 0:e.body},ne="fetch",ee={autoWrap:!0,setContextAtReq:function(){return g},ignoreUrls:[],collectBodyOnError:!1};function te(n){var e,t,r;return!function(n){switch(Object.prototype.toString.call(n)){case"[object Error]":case"[object Exception]":case"[object DOMError]":case"[object DOMException]":return 1;default:return n instanceof Error}}(n)?(i(n)||o(n)||x(n))&&(e={message:f(n)}):(r=le,e=(t=n)&&w(t)?r.reduce(function(n,e){return n[e]=t[e],n},{}):t),e}function re(n){return te(n.error)}function oe(n){var e;try{var t=void 0;if("reason"in n?t=n.reason:"detail"in n&&"reason"in n.detail&&(t=n.detail.reason),t){var r=te(t);return m(m({},r),{name:null!==(e=r&&r.name)&&void 0!==e?e:"UnhandledRejection"})}}catch(n){}}function ie(n){return"[object ErrorEvent]"===Object.prototype.toString.call(n)?re(n):("[object PromiseRejectionEvent]"===Object.prototype.toString.call(n)?oe:te)(n)}function ue(o,e,n){function u(n,t){if(!_(n))return n;var r={type:"capture-global",data:m({},t)},e=n._w_||(n._w_=function(){try{return(n.handleEvent&&_(n.handleEvent)?n.handleEvent:n).apply(this,[].map.call(arguments,function(n){return u(n,t)}))}catch(n){var e=te(n);throw e&&o({error:e,source:r}),n}});return e._hook_=!0,e}void 0===e&&(e=U()),void 0===n&&(n=z());var t=[];return e&&t.push.apply(t,y([],k(pe.filter(function(n){return e[n]}).map(function(o){return h(e,o,function(r){return function(n){for(var e=[],t=1;t<arguments.length;t++)e[t-1]=arguments[t];return r&&r.call.apply(r,y([this,u(n,{function:o})],k(e),!1))}},!1)()})),!1)),n&&n.prototype&&t.push(h(n.prototype,"send",function(r){return function(){for(var e=this,n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];return ve.filter(function(n){return e[n]&&!e[n]._hook_}).forEach(function(n){e[n]=u(e[n],{function:n})}),r.apply(this,n)}},!1)()),de.forEach(function(i){var n=e[i]&&e[i].prototype;n&&n[he]&&(t.push(h(n,he,function(o){return function(n,e,t){try{var r=e.handleEvent;_(r)&&(e.handleEvent=u(r,{function:"handleEvent",target:i}))}catch(n){}return o&&o.call(this,n,u(e,{function:he,target:i}),t)}},!1)()),t.push(h(n,"removeEventListener",function(r){return function(n,e,t){return null!=e&&e._w_&&r.call(this,n,e._w_,t),r.call(this,n,e,t)}},!1)()))}),t}function ae(n,e){return n&&e&&n===e}function ce(){var r;return function(n){try{if(t=r,!(!(e=n)||!t)&&!(!ae(e.message,t.message)||!ae(e.stack,t.stack)))return void(r=n)}catch(n){Z(n)}var e,t;return r=n}}var fe=["err_0",function(n,e){var t=U();t&&(t.addEventListener("error",n,!0),e(function(){t.removeEventListener("error",n,!0)}))}],se=["perr_0",function(n,e){var t=U();t&&(t.addEventListener("unhandledrejection",n,!0),e(function(){t.removeEventListener("unhandledrejection",n,!0)}))}],le=["name","message","stack","filename","lineno","colno"],de=["EventTarget","Window","Node","ApplicationCache","ChannelMergerNode","EventSource","FileReader","HTMLUnknownElement","IDBDatabase","IDBRequest","IDBTransaction","MessagePort","Notification","SVGElementInstance","Screen","TextTrack","TextTrackCue","TextTrackList","WebSocket","Worker","XMLHttpRequest","XMLHttpRequestEventTarget","XMLHttpRequestUpload"],pe=["setTimeout","setInterval","requestAnimationFrame","requestIdleCallback"],ve=["onload","onerror","onprogress","onreadystatechange"],he="addEventListener",me=function(o,n,e,t){function r(n){var e=n.error,t=n.extra,r=n.react,n=n.source;!(e=f?l(e):e)||!e.message||s&&s.test(e.message)||o({ev_type:"js_error",payload:{error:e,breadcrumbs:[],extra:t,react:r,source:n}})}var i=k(e,2),u=i[0],a=i[1],c=t.ignoreErrors,e=t.onerror,i=t.onunhandledrejection,f=t.dedupe,t=t.captureGlobalAsync,s=p(c),l=ce();return e&&n.push(u[0](function(n){return r({error:re(n),source:{type:"onerror"}})})),i&&n.push(a[0](function(n){return r({error:oe(n),source:{type:"onunhandledrejection"}})})),t&&n.push.apply(n,y([],k(ue(r)),!1)),function(n,e,t){return r({error:ie(n),extra:e,react:t,source:{type:"manual"}})}},ge="jsError",ye={ignoreErrors:[],onerror:!0,onunhandledrejection:!0,captureGlobalAsync:!1,dedupe:!0};var be=["hash_0",function(n,e){var t,r=U();r&&(r.addEventListener("hashchange",t=function(){return n(location.href)},!0),e(function(){return r.removeEventListener("hashchange",t,!0)}))}],we=["history_0",function(n,e){var t,r,o,i=U()&&window.history;i&&(r=function(){return n(location.href)},(t=[]).push(h(i,"pushState",o=function(t){return function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];try{t.apply(i,n)}finally{r()}}})(),h(i,"replaceState",o)()),window.addEventListener("popstate",r,!0),t.push(function(){return window.removeEventListener("popstate",r,!0)}),e(function(){t.forEach(function(n){return n()})}))}],Ee=function(n){return"manual"===n},_e=function(n,e,t,r){var o,i,u,a,c,f,s,l=r.sendInit,d=r.initPid,p=r.routeMode,v=r.extractPid,r=r.onPidUpdate,h=Ee(p)?function(){return""}:(o=p,function(n){var e;return"hash"===o?(null===(e=$(n).hash)||void 0===e?void 0:e.replace(/^#/,""))||"/":$(n).path}),m=v||function(){},r=k(function(r,n,e,o){var i=e,u=n;o&&o(n);return[function(n,e,t){"user_set"!==n&&e!==i?(i=e,u=null!=t?t:i,o&&o(u),r(n,u)):"user_set"===n&&e!==u&&(u=e,o&&o(u),r(n,u))},function(){n&&r("init",n)}]}((a=n,function(n,e){a({ev_type:"pageview",payload:{pid:e,source:n}})}),d||(i=location.href,null!==(u=m(i))&&void 0!==u?u:h(i)),h(location.href),r),2),g=r[0],r=r[1];return Ee(p)||(c=k((f=function(n,e){return g(n,h(e),m(e))},s="",[function(n,e){e!==s&&f(n,s=e)}]),1)[0],t.length&&t.forEach(function(n){return e.push(n[0](function(n){return c(p,n)}))})),l&&r(),[g.bind(null,"user_set")]},xe="pageview",Se={sendInit:!0,routeMode:"history"};var Te=["hidden_0",function(n,e){var t,r,o=U(),i=W();o&&i&&(t=function(){"hidden"===i.visibilityState&&n()},addEventListener("visibilitychange",t,!0),r=sn(o),e(function(){removeEventListener("visibilitychange",t,!0)},function(n){"hidden"===i.visibilityState&&r(function(){n()})}))}],Le=["load_0",function(n,e){var t,r,o=U(),i=W();o&&i&&(o.addEventListener("load",t=function(){setTimeout(function(){n()},0)},!1),r=sn(o),e(function(){o.removeEventListener("load",t,!1)},function(n){"complete"===i.readyState&&r(function(){n()})}))}],Re=["unload_0",function(n,e){var t,r,o,i=U();i&&(t=k(Ln(n),1)[0],o=function(){t()},(r=["unload","beforeunload","pagehide"]).forEach(function(n){i.addEventListener(n,o)}),e(function(){r.forEach(function(n){i.removeEventListener(n,o)})}))}],je=["domLoad_0",function(n,e){var t,r,o=U(),i=W();o&&i&&(o.addEventListener("DOMContentLoaded",t=function(){setTimeout(function(){n()},0)},!1),r=sn(o),e(function(){o.removeEventListener("DOMContentLoaded",t,!1)},function(n){"complete"===i.readyState&&r(function(){n()})}))}],Ce=["xmlhttprequest","fetch","beacon"],ke=function(t,r,n,e){var o,i,u,a,c=k(n,2),n=c[0],f=c[1],s=X();s&&(c=e.ignoreUrls,o=e.slowSessionThreshold,i=e.ignoreTypes,u=p(c),a=function(n,e){void 0===e&&(e=!1),S(i||Ce,n.initiatorType)||u&&u.test(n.name)||(n={ev_type:"resource",payload:n},e&&(n.extra={sample_rate:1}),t(n))},r.push(n[0](function(){var n=k(cn(s),3),e=n[0],n=n[2],t=function(){if(!e)return!1;var n=e.loadEventEnd-e.navigationStart;return o<n}();n("resource").forEach(function(n){return a(n,t)}),r.push(f()[0](function(n){a(n)}))})))},De="resource",Oe={ignoreUrls:[],slowSessionThreshold:4e3};function qe(n){return n="link"===(e=n).tagName.toLowerCase()?"href":"src",_(e.getAttribute)?e.getAttribute(n)||"":e[n]||"";var e}var Ie=function(i,n,e,t){var r=k(e,1)[0],o=U();if(o){var u=t.ignoreUrls,e=t.includeUrls,a=t.dedupe,c=p(e),f=p(u),s=k(cn(X()),5)[4],l=void 0,d=function(n){var e,t,r,o=location&&location.href;o&&n.url===o||c&&!c.test(n.url)||f&&f.test(n.url)||n.url&&(a&&n.url===l||(l=n.url,t=s,r=(e=n).url,o=n.tagName,e=n.xpath,r=J(r),t=t(r)[0],t={type:o.toLowerCase(),url:r,xpath:e,timing:t},i({ev_type:"resource_error",payload:t})))};return n.push(r[0](function(n){n=n||o.event;!n||(n=function(n){var e=n.target||n.srcElement;if(e){n=e.tagName;if(n&&x(n))return{url:qe(e),tagName:n}}}(n))&&d(n)})),d}},Me="resourceError",Ae={includeUrls:[],ignoreUrls:[],dedupe:!0};function Ne(e){function t(n){n<o||!r||(u(),i=window.setTimeout(r,n-e()),o=n)}var r,o=-1/0,i=void 0,u=function(){return window.clearTimeout(i)};return[function(n,e){r=n,t(e)},function(){u(),r=void 0},t]}function Be(n,t){var r=["img","script","iframe","link","audio","video","source"],e=(n=k(an(n,function(n){for(var e=0;e<n.length;e++)("childList"===n[e].type&&function n(e,t){for(var r=0;r<e.length;r++)if(S(t,e[r].nodeName.toLowerCase())||e[r].children&&n(e[r].children,t))return 1}(n[e].addedNodes,r)||"attributes"===n[e].type&&S(r,n[e].target.nodeName.toLowerCase()))&&t(n[e])}),2))[0];return[function(){return e(document,{attributes:!0,childList:!0,subtree:!0,attributeFilter:["href","src"]})},n[1]]}function He(n){var n=(e=n||{}).domContentLoadedEventEnd,e=e.navigationStart;return n?n-(void 0===e?0:e):null}function Pe(n,e){var t=n.startTime,r=n.duration;n.start=t,n.end=t+r,e.push(n)}function Ue(d,n,p){var v=(n=k(n,5))[0],h=n[1],m=n[2],g=n[3],y=n[4];return function(t,n){var r,o=[],i=[],e=k([r={},function(n,e){return r[n]=e},function(n){return delete r[n]}],3),u=e[0],a=e[1],c=e[2];p.forEach(function(n){n.entryType===Dn[0]&&Pe(n,o)});var f=0;d.push(v[0](function(n){if("get"!==(k(n,1)[0]||"").toLowerCase())return E;var e=f+=1;return a(e,P()),function(){c(e)}})),d.push(h[0](function(n){var e=k(n,2),n=e[0],e=e[1];if(!window.Request||"get"!==Kn(n,e,window.Request))return E;var t=f+=1;return a(t,P()),function(){c(t)}}));var s=k(y&&Be(y,function(){return t(n()+5e3)})||[],2),e=s[0],s=s[1];e&&e();function l(){return function(n,e,t){if(2<n.length)return t();for(var r=[],o=0;o<e.length;o++)r.push([e[o].start,0],[e[o].end,1]);for(o=0;o<n.length;o++)r.push([n[o],0]);r.sort(function(n,e){return n[0]-e[0]});for(var i=n.length,o=r.length-1;0<=o;o--){var u=k(r[o],2),a=u[0];switch(u[1]){case 0:i--;break;case 1:if(2<++i)return a}}return 0}(function(n){for(var e=Object.keys(n),t=[],r=0;r<e.length;r++){var o=n[e[r]];"number"==typeof o&&t.push(o)}return t}(u),i,n)}return s&&d.push(s),d.push(m[0](function(n){Pe(n,o);var e=n.startTime,n=n.duration;t(e+n+5e3)})),d.push(g[0](function(n){var e=n.fetchStart,n=n.responseEnd;i.push({start:e,end:n}),t(l()+5e3)})),d.push(function(){o.length=0,i.length=0}),[o,l]}}var We={isSupport:!0,isPolyfill:!1,isBounced:!1,isCustom:!1,type:"perf"},Xe=function(n,e){return m({name:n,value:e},We)},ze="performance",Fe={entries:[],observer:void 0},Ge="performance",Ye="performance_longtask",Je=function(e,t,r){var o=!1;return function(n){r.length&&r.forEach(function(n){n()}),r.length=0,o||(o=!0,t&&t(e(n)))}},$e=function(n,e){return{ev_type:Ge,payload:n,overrides:e}},Ve=function(e){var t=0,r=Xe("spa_load",0);return[function(){t=P()},function(){var n;n=P()-t,r.value=n,e&&e($e(r)),t=0}]},Ke="first-contentful-paint",Qe="first-paint",Ze="paint",nt=function(e,n,t,r,o){var i=k(o,2),u=i[0],a=i[1],o=G(),i=X(),c=Xe(n,0),f=Je($e,t,r);if(!i||!o)return c.isSupport=!1,void f(c);function s(n){n=n.startTime,c.value=n,f(c)}i=(0,k(cn(i),5)[4])(e)[0];i?s(i):(r.push(qn(o,function(n){n.name===e&&s(n)},[Ze])),r.push(u[0](function(){c.isSupport=!1,f(c)})),r.push(a[0](function(){c.isBounced=!0,f(c)})))},et=["fp",function(n,e,t){return nt(Qe,"fp",n,e,t)}],tt=["fcp",function(n,e,t){return nt(Ke,"fcp",n,e,t)}],rt=function(n,e,t,r){var o=k(t,5),i=o[0],u=o[1],a=o[2],c=o[3],t=o[4],f=Xe("tti",0),s=Je($e,n,e),o=X(),n=r||{},r=n.entries,l=void 0===r?[]:r,d=n.observer;if(e.push(function(){d&&d.disconnect(),l.length=0}),!window||!XMLHttpRequest||!o||!PerformanceObserver||PerformanceObserver.supportedEntryTypes&&!S(PerformanceObserver.supportedEntryTypes||[],Dn[0]))return f.isSupport=!1,void s(f);var r=k(cn(o),5),p=r[0],v=r[1],h=r[4],n=k(Ne(v),3),o=n[0],r=n[1],m=n[2],c=k(Ue(e,[i,u,a,c,F()],l)(m,v),2),g=c[0],y=c[1];e.push(r);function b(n){var e=h(Ke)[0];if(!(e=function(n,e,t,r,o){if(r-t<5e3)return null;o=0===o.length?n:o[o.length-1].end;return r-o<5e3?null:Math.max(o,e)}((e?e.startTime:He(p))||0,He(p)||0,y(),v(),g)))return m(v()+1e3);n(e)}function w(n){f.value=n,s(f)}r=g[g.length-1];o(function(){return b(w)},Math.max(y()+5e3,r?r.end:0)),e.push(t[0](function(){f.isSupport=!1,s(f)}))},ot="tti";function it(n,t,e,r){if(!n||-1<r.indexOf(n.tagName))return 0;var o=n.children;if((o=[].slice.call(void 0===o?[]:o).reduceRight(function(n,e){return n+it(e,t+1,0<n,r)},0))<=0&&!e){if(!_(n.getBoundingClientRect))return 0;e=n.getBoundingClientRect()||{},n=e.top,e=e.height;if(n>window.innerHeight||e<=0)return 0}return o+1+.5*t}var ut=["SCRIPT","STYLE","META","HEAD"],at=function(n,e,t){var r=k(t,2),o=r[0],i=r[1],u=W(),a=F(),c=X(),f=c&&c.timing&&c.timing.navigationStart||void 0,s=Xe("fmp",0),l=Je($e,n,e);if(!u||!a||!f)return s.isSupport=!1,void l(s);function d(){return y.push({time:P()-g,score:it(u&&u.body,1,!1,ut)})}function p(n){void 0===n&&(n=0);var e,t=(t=(e=k(void 0===(t=y)?[]:t))[0],(e=e.slice(1))&&e.reduce(function(n,e){var t=k(n,2),r=t[0],n=t[1],t=e.score-r.score;return[e,e.time>=r.time&&n.rate<t?{time:e.time,rate:t}:n]},[t,{time:null==t?void 0:t.time,rate:0}])[1].time||0);s.value=t?t+n:0,l(s),y.length=0}var v,h,m,g=P(),y=[],t=function(){if(U()&&"requestAnimationFrame"in window)return window.requestAnimationFrame}(),r=function(){if(U()&&"cancelAnimationFrame"in window)return window.cancelAnimationFrame}(),b=k((c=u,n=r,r=!0,h=!_(t=t)||r&&c&&c.hidden?function(n){return n(0),0}:t,m=_(n)?n:E,[function(n){v&&m(v),v=h(n)},h,m]),1)[0],n=k(an(a,function(){return b(d)}),2),a=n[0],n=n[1],w=g-(f||0);a(u,{subtree:!0,childList:!0}),e.push(n),e.push(i[0](function(){s.isSupport=!1,l(s)})),e.push(o[0](function(){setTimeout(function(){p(w)},200)}))},ct="fmp",ft={renderType:"CSR"};var st=["SCRIPT","STYLE","META","HEAD"],lt=["js_error","http","resource_error"],dt=1e4,pt=8e3,vt=2e3,ht=1e4,mt=["performance","performance_longtask","performance_timing","custom"],gt=function(n){return~mt.indexOf(n.ev_type)},yt=function(n,e){if(-1===lt.indexOf(e.ev_type))return n;if("http"===e.ev_type&&e.payload.response.status<400)return n;if(n&&lt.indexOf(n.type)<lt.indexOf(e.ev_type))return n;var t="";switch(e.ev_type){case"js_error":t=e.payload.error.message;break;case"http":t=e.payload.request.url;break;case"resource_error":t=e.payload.url}return{type:e.ev_type,message:t,timestamp:P()}},bt=function(t,r,n,o,i){if(void 0===r&&(r=0),void 0===n&&(n=0),void 0===o&&(o=1.5),void 0===i&&(i=st),!t||-1<i.indexOf(t.tagName)||o<=n||4<r)return n;var e=function(){if(!r)return 0;var n=t.getBoundingClientRect(),e=n.top,n=n.height;return e>innerHeight||n<=0?0:1/Math.pow(2,r-1)}();return[].reduceRight.call(t.children,function(n,e){return bt(e,r+1,n,o,i)},n+e)},wt=function(n){var e=n.cb,t=n.screenshotUrl,r=n.window,o=n.document,i=n.mask,u=n.partialShot,a=n.quality,c=n.rootSelector;if(U()&&"Promise"in window&&Promise&&r&&o){if(r.html2canvas)return f();n=o.createElement("script");n.src=t,null!==(t=o.head)&&void 0!==t&&t.appendChild(n),n.onload=f}function f(){sn(r)(function(){r.html2canvas&&r.html2canvas(u&&c&&o.querySelector(c)||o.body,{scale:360/r.innerWidth,mask:i}).then(function(n){e("data:image"===(n=n.toDataURL("image/jpeg",a)).slice(0,10)?n:function(n,e){void 0===n&&(n=192);void 0===e&&(e=108);var t=document.createElement("canvas");t.width=n,t.height=e;var r=t.getContext("2d");r&&(r.fillStyle="#ffffff",r.fillRect(0,0,n,e));return t.toDataURL("image/jpeg")}())})})}};function Et(e,r,n,t){function o(n){u&&e({ev_type:"blank_screen",payload:{timestamp:u[0],score:u[1],screenshot:n,error:a}})}function i(){c&&clearTimeout(c),c=x.setTimeout(function(){T(function(){x.requestAnimationFrame(function(){var n=g?S.querySelector(g):S.body;n&&((n=bt(n,0,0,h))<h?(u=[P(),n],C()):u=void 0)})})},1e3)}var u,a,c,f,s,l,d=(y=k(n,4))[0],p=y[1],v=y[2],n=y[3],h=t.threshold,m=t.screenshot,g=t.rootSelector,y=t.autoDetect,b=t.ssUrl,w=t.quality,E=t.mask,_=t.partialShot,x=U(),S=W(),T=sn(x),L=k(cn(performance),2)[1],R=0,j=!1,C=(f=function(){u&&!j&&(j=!0,r.forEach(function(n){return n()}),r.length=0,m?wt({cb:o,screenshotUrl:b,window:x,document:S,mask:E,partialShot:_,quality:w,rootSelector:g}):o())},function(){s||(l=P(),s=x.setTimeout(function(){s=0,(l<R?i:f)()},L()>dt?vt:pt))});return r.push(n[0](function(){!j&&a&&o()})),y&&r.push(d[0](function(){var n=k(an(F(),i),2),e=n[0],t=n[1];r.push(function(){clearTimeout(c),t&&t()}),e(null===(e=W())||void 0===e?void 0:e.body,{subtree:!0,childList:!0}),r.push(p()[0](function(){c&&i()})),r.push(v()[0](function(){c&&i()})),i()})),[function(n){j||gt(n)||(R=P(),a&&R-a.timestamp>ht&&(a=void 0),a=yt(a,n))},i]}var _t="blankScreen";var xt={autoDetect:!0,threshold:1.5,screenshot:!0,ssUrl:"https://apm.volccdn.com/mars-web/apmplus/web/html2canvas.min.js",mask:!1,partialShot:!1,quality:.1};function n(n,e){var i,u,a;u=xt,a=e,(i=n).on("init",function(){var n,e,t,r=W(),o=U();r&&o&&((o=Xn(i,_t,u)||gn(a,u))&&(n=[],o=k(Et(i.report.bind(i),n,[B(i,je),function(){return B(i,In)},function(){return B(i,Mn)},B(i,Re)],o),2),e=o[0],o=o[1],i.on("report",t=function(n){return e(n),n}),i.on("beforeDestroy",function(){n.forEach(function(n){return n()}),i.off("report",t)}),i.provide("detectBlankScreen",o)))})}var St=["keydown","click"],Tt=["lcp",function(n,e,t){var r=k(t,2),o=r[0],t=r[1],r=G(),i=Xe("lcp",0),u=Je($e,n,e);if(!r)return i.isSupport=!1,void u(i);e.push(_n(r,function(n){n=n.startTime;i.value=n},"largest-contentful-paint"));function a(){u(i)}St.forEach(function(n){window.addEventListener(n,a,!0),e.push(function(){window.removeEventListener(n,a,!0)})}),e.push(o[0](function(){i.isSupport=!1,u(i)})),e.push(t[0](function(){i.isBounced=!0,u(i)}))}],Lt="first-input",Rt=["fid",function(n,e){var t=G(),r=X(),o=Xe("fid",0),i=Je($e,n,e);if(!r||!t)return o.isSupport=!1,void i(o);n=function(n){var e=n.processingStart,n=n.startTime;o.value=e-n,i(o)},r=(0,k(cn(r),3)[2])(Lt)[0];r?n(r):e.push(qn(t,n,[Lt]))}],jt=["cls",function(n,e,t){var r,o=k(t,3),i=o[0],u=o[1],t=o[2],o=G(),a=Xe("cls",0),c=(r=n,function(n,e){r($e(n,e))});if(!o)return a.isSupport=!1,void c(a);var f,s,n=k((f=0,s=[],[function(){f=0},function(n,e){var t,r;e.hadRecentInput||(t=s[0],r=s[s.length-1],f&&e.startTime-r<1e3&&e.startTime-t<5e3?(f+=e.value,s.push(e.startTime)):(f=e.value,s=[e.startTime]),n(f))}]),2),l=n[0],n=n[1].bind(null,function(n){n>a.value&&(a.value=n)});e.push(_n(o,n,"layout-shift")),e.push(i[0](l)),e.push(t[0](function(n){c(a,n),l(),a=Xe("cls",0)})),e.push(u[0](function(){c(a)}))}],Ct=["longtask",function(e,n,t){t=k(t,3)[2];n.push(t[0](function(n){e({ev_type:Ye,payload:{type:"perf",longtasks:[n]}})}))}],kt=["timing",function(n,e,t){var r=k(t,2),t=r[0],r=r[1],o=X(),i=k(cn(o),3)[2],u=Je(function(n){return{ev_type:"performance_timing",payload:{isBounced:n,timing:o&&o.timing||void 0,navigation_timing:i("navigation")[0]}}},n,e);e.push(t[0](function(){u(!1)})),e.push(r[0](function(){u(!0)}))}],Dt=["mpfid",function(n,e,t){var r=k(t,3),o=r[0],t=r[2],r=G(),i=X(),u=Xe("mpfid",0),a=[],c=Je($e,n,e);if(!r)return u.isSupport=!1,void c(u);e.push(t[0](function(n){a.push(n)}));function f(){var n=(0,k(cn(i),5)[4])(Ke)[0],r=n&&n.startTime||0;u.value=a.reduce(function(n,e){var t=e.duration,e=e.startTime;return n<t&&r<e?t:n},0),a.length=0,c(u)}e.push(o[0](function(){setTimeout(f,200)}))}];var Ot="custom",qt=function(n){if(n&&w(n)&&n.name&&x(n.name)){var e={name:n.name,type:"event"};if("metrics"in n&&w(n.metrics)){var t=n.metrics,r={};for(o in t)c(t[o])&&(r[o]=t[o]);e.metrics=r}if("categories"in n&&w(n.categories)){var o,i=n.categories,u={};for(o in i)u[o]=f(i[o]);e.categories=u}return e}},It=function(n){if(n&&w(n)&&n.content&&x(n.content)){var e={content:f(n.content),type:"log",level:"info"};if("level"in n&&(e.level=n.level),"extra"in n&&w(n.extra)){var t,r=n.extra,o={},i={};for(t in r)c(r[t])?o[t]=r[t]:i[t]=f(r[t]);e.metrics=o,e.categories=i}return e}};function Mt(n){return(null==n?void 0:n.effectiveType)||(null==n?void 0:n.type)||""}function At(n,e){var t=n.common||{};return t.sample_rate=e,n.common=t,n}function Nt(n,e,t,r,o){return n?(i=o(r,e),function(){return i}):function(){return t(e)};var i}function Bt(n,e,t,r){if(void 0===(n=l(n,e,function(n,e){return n[e]})))return!1;var o,e="boolean"==typeof n?"bool":c(n)?"number":"string";return function(n,e,t){switch(t){case"eq":return S(e,n);case"neq":return!S(e,n);case"gt":return n>e[0];case"gte":return n>=e[0];case"lt":return n<e[0];case"lte":return n<=e[0];case"regex":return Boolean(n.match(new RegExp(e.join("|"))));case"not_regex":return!n.match(new RegExp(e.join("|")));default:return!1}}(n,(o=e,r.map(function(n){switch(o){case"number":return Number(n);case"boolean":return"1"===n;default:return String(n)}})),t)}function Ht(e,n){try{return"rule"===n.type?Bt(e,n.field,n.op,n.values):"and"===n.type?n.children.every(function(n){return Ht(e,n)}):n.children.some(function(n){return Ht(e,n)})}catch(n){return Z(n),!1}}function Pt(){var t=U();return t&&t.navigator.sendBeacon?{get:function(){},post:function(n,e){t.navigator.sendBeacon(n,e)}}:{get:E,post:E}}function Ut(n,e,t){var r=e.url,o=e.data,i=e.success,u=void 0===i?E:i,a=void 0===(i=e.fail)?E:i,c=void 0===(i=e.getResponseText)?E:i,e=void 0!==(e=e.withCredentials)&&e;(t=new t).withCredentials=e,t.open(n,r,!0),t.setRequestHeader("Content-Type","application/json"),t.onload=function(){null!=c&&c(this.responseText);try{var n;this.responseText?(n=JSON.parse(this.responseText),u(n)):u({})}catch(n){a(n)}},t.onerror=function(){a(new Error("Network request failed"))},t.onabort=function(){a(new Error("Network request aborted"))},t.send(o)}var Wt=function(n){var e=Y(),t=Mt(e);e&&(e.onchange=function(){t=Mt(e)}),n.on("report",function(n){return m(m({},n),{extra:m(m({},n.extra||{}),{network_type:t})})})},Xt=function(n,e,t,r){if(!e)return g;var o=e.sample_rate,i=e.include_users,u=e.sample_granularity,a=e.rules,e=e.r,e=void 0===e?Math.random():e;if(S(i,n))return function(n){return At(n,1)};var c,f,s,l,d,p,v,u="session"===u,h=Nt(u,o,t,e,r),m=(c=a,f=u,s=o,l=t,d=e,p=r,v={},Object.keys(c).forEach(function(n){var e=c[n],t=e.enable,r=e.sample_rate,e=e.conditional_sample_rules;t?(v[n]={enable:t,sample_rate:r,effectiveSampleRate:r*s,hit:Nt(f,r,l,d,p)},e&&(v[n].conditional_hit_rules=e.map(function(n){var e=n.sample_rate,n=n.filter;return{sample_rate:e,hit:Nt(f,e,l,d,p),effectiveSampleRate:e*s,filter:n}}))):v[n]={enable:t,hit:function(){return!1},sample_rate:0,effectiveSampleRate:0}}),v);return function(n){if(!h())return!1;if(!(n.ev_type in m))return At(n,o);if(!m[n.ev_type].enable)return!1;if(null!==(e=n.common)&&void 0!==e&&e.sample_rate)return n;var e=m[n.ev_type],t=e.conditional_hit_rules;if(t)for(var r=0;r<t.length;r++)if(Ht(n,t[r].filter))return!!t[r].hit()&&At(n,t[r].effectiveSampleRate);return!!e.hit()&&At(n,e.effectiveSampleRate)}};function zt(n){var e,t,r,o,i,u,a,c,f,s=(r=(e=n).transport,o=n.endpoint,i=n.size,u=void 0===i?10:i,a=void 0===(e=n.wait)?1e3:e,c=[],f=0,{getSize:function(){return u},getWait:function(){return a},setSize:function(n){u=n},setWait:function(n){a=n},getEndpoint:function(){return o},setEndpoint:function(n){o=n},send:function(n){c.push(n),c.length>=u&&l.call(this),clearTimeout(f),f=setTimeout(l.bind(this),a)},flush:function(){clearTimeout(f),l.call(this)},getBatchData:function(){return c.length?v(c):""},clear:function(){clearTimeout(f),c=[]},fail:function(n){t=n}});function l(){var e;c.length&&(e=this.getBatchData(),r.post({url:o,data:e,fail:function(n){t&&t(n,e)}}),c=[])}function d(n){p.post(s.getEndpoint(),v([n]))}var p=Pt();return mn(function(){var n=s.getBatchData();n&&(p.post(s.getEndpoint(),n),s.clear()),s.send=d}),s}var Ft={build:function(n){return{ev_type:n.ev_type,payload:n.payload,common:m(m({},n.extra||{}),n.overrides||{})}}};function Gt(n){var e,t=n.plugins||{};for(e in t)t[e]&&!w(t[e])&&(t[e]={});return m(m({},n),{plugins:t})}function Yt(n){return w(n)&&"aid"in n}function Jt(n){return m({},n)}function $t(){var n=U(),e=W();if(n&&e)return(null===(e=null===(e=null===(e=function(){if(!document)return null;if(document.currentScript)return document.currentScript;try{throw new Error}catch(n){var e=0,t=/at\s+(.*)\s+\((.*):(\d*):(\d*)\)/i.exec(n.stack),r=t&&t[2]||!1,o=t&&t[3]||0,i=document.location.href.replace(document.location.hash,""),u="",a=document.getElementsByTagName("script");for(r===i&&(t=document.documentElement.outerHTML,o=new RegExp("(?:[^\\n]+?\\n){0,"+(o-2)+"}[^<]*<script>([\\d\\D]*?)<\\/script>[\\d\\D]*","i"),u=t.replace(o,"$1").trim());e<a.length;e++){if("interactive"===a[e].readyState)return a[e];if(a[e].src===r)return a[e];if(r===i&&a[e].innerHTML&&a[e].innerHTML.trim()===u)return a[e]}return null}}())||void 0===e?void 0:e.getAttribute("src"))||void 0===e?void 0:e.match(/globalName=(.+)$/))||void 0===e?void 0:e[1])||Zt}function Vt(n){return"APMPLUS"+n}function Kt(n){return function(n){try{var e=localStorage.getItem(n),t=e;return t=e&&"string"==typeof e?JSON.parse(e):t}catch(n){return}}(Vt(n))||{userId:O(),deviceId:O(),r:Math.random()}}function Qt(n){var e=n.aid,t=n.userId,r=n.deviceId,n=n.sample;!function(n,e){try{var t="string"==typeof e?e:JSON.stringify(e);localStorage.setItem(n,t)}catch(n){}}(Vt(e),{userId:t,deviceId:r,r:n.r})}var Zt="APM_PLUS_WEB",nr="/settings/get/webpro",er="/monitor_web/collect",tr=[er,nr,"/monitor_browser/collect"],rr={sample_rate:1,include_users:[],sample_granularity:"session",rules:{}},or=20,ir=function(n,e){return void 0===e&&(e=er),(n&&0<=n.indexOf("//")?"":"https://")+n+e},ur=O,ar=function(e){var o,i,u,a=e,c={},f=E,t=E;return{getConfig:function(){return a},setConfig:function(n){var e,t,r;return c=m(m({},c),n||{}),s(),o||(o=n,a.useLocalConfig?(u={},f()):i?l():(e=a.transport,t=a.domain,n=a.aid,r=function(n){i=n,l()},e.get({withCredentials:!0,url:function(n,e){return void 0===e&&(e=nr),(n&&0<=n.indexOf("//")?"":"https://")+n+e}(t)+"?aid="+n,success:function(n){r(n.data||{})},fail:function(){r()}}))),a},onChange:function(n){t=n},onReady:function(n){f=function(){!function(){e.userId!==a.userId&&(e.sample.r=Math.random(),s());Qt(a)}(),n()},u&&f()}};function s(){var n=m(m(m({},e),u||{}),c);n.plugins=function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];for(var t={},r=0;r<n.length;)t=d(t,n[r++]);return t}(e.plugins,(null==u?void 0:u.plugins)||{},c.plugins||{}),n.sample=cr(cr(e.sample,null==u?void 0:u.sample),c.sample),a=n,t()}function l(){u=function(n){if(!n)return{};var e=n.sample,t=n.timestamp,r=n.status;if(!e)return{};var o=e.sample_rate,n=e.sample_granularity;return{sample:{include_users:e.include_users,sample_rate:r&&4===r?0:o,sample_granularity:n,rules:e.rules.reduce(function(n,e){var t=e.name,r=e.enable,o=e.sample_rate,e=e.conditional_sample_rules;return n[t]={enable:r,sample_rate:o,conditional_sample_rules:e},n},{})},serverTimestamp:t}}(i),s(),f()}};function cr(r,o){if(!r||!o)return r||o;var n=m(m({},r),o);return n.include_users=y(y([],k(r.include_users||[]),!1),k(o.include_users||[]),!1),n.rules=y(y([],k(Object.keys(r.rules||{})),!1),k(Object.keys(o.rules||{})),!1).reduce(function(n,e){var t;return e in n||(e in(r.rules||{})&&e in(o.rules||{})?(n[e]=m(m({},r.rules[e]),o.rules[e]),n[e].conditional_sample_rules=y(y([],k(r.rules[e].conditional_sample_rules||[]),!1),k(o.rules[e].conditional_sample_rules||[]),!1)):n[e]=(null===(t=r.rules)||void 0===t?void 0:t[e])||(null===(t=o.rules)||void 0===t?void 0:t[e])),n},{}),n}var fr,sr,lr,dr,pr,vr,hr,mr,gr,yr,br,wr,Er,_r,xr,Sr,Tr,Lr,Rr=function(n){n.on("report",function(n){return e=n,n={url:V(),timestamp:Date.now()},m(m({},e),{extra:m(m({},n),e.extra||{})});var e})},jr={sri:"reportSri",st:"reportResourceError",err:"captureException"},Cr=function(n){return Object.keys(n).reduce(function(n,e){return n[e]=[],n},{})},kr=function(t){return Object.keys(t).reduce(function(n,e){return n[t[e]]=e,n},{})},Dr=function(o,i,u){return function(n,e,t,r){void 0===t&&(t=Date.now()),void 0===r&&(r=location.href);r=m(m({},ln(o)),{url:r,timestamp:t});i[n]&&(o[u[n]]?dn(o,r)(function(){o[u[n]](e)}):null!==(t=i[n])&&void 0!==t&&t.push([e,r]))}},Or=function(r,e,o){return function(t){var n;t in o&&(null!==(n=e[o[t]])&&void 0!==n&&n.forEach(function(n){var n=k(n,2),e=n[0],n=n[1];dn(r,n)(function(){r[t](e)})}),e[o[t]]=null)}},qr=function(t){var r,o=!1;t.on("init",function(){r=(new Date).getTime(),t.on("config",function(){var n,e=null===(n=t.config())||void 0===n?void 0:n.serverTimestamp;isNaN(e)||Number(e)<=0||o||(o=!0,(n=(new Date).getTime())-r<700&&e&&(n=e-(n+r)/2,!isNaN(n)&&(0<n||n<-6e5)&&t.set({offset:n})))})})},Ir=function(r){r.on("beforeBuild",function(n){return e=n,t=r.config(),(n={}).aid=t.aid,n.pid=t.pid,n.view_id=t.viewId,n.user_id=t.userId,m(m({},e),{extra:m(m({},n),e.extra||{})});var e,t})},Mr=function(c){c.on("start",function(){var t,n=c.config(),e=n.deviceId,r=n.sessionId,o=n.release,i=n.env,u=n.offset,a=n.aid,n=n.token,a={did:e,sid:r,release:o,env:i,sname:Zt,sversion:"2.0.5-alpha.0",soffset:u||0,biz_id:a,x_auth_token:n},n=c.getSender();n.setEndpoint(n.getEndpoint()+(w(t=a)?Object.keys(t).reduce(function(n,e){return n+="&"+e+"="+t[e]},"").replace("&","?"):""))})},Ar=function(n){var e,n=Kt(n.aid);return{aid:0,pid:"",token:"",viewId:"__"+Date.now(),userId:n.userId,deviceId:n.deviceId,sessionId:ur(),domain:"apmplus.volces.com",plugins:{ajax:{ignoreUrls:tr},fetch:{ignoreUrls:tr},breadcrumb:{},pageview:{},jsError:{},resource:{},resourceError:{},performance:{},tti:{},fmp:{},blankScreen:!1},release:"",env:"production",sample:m(m({},rr),{r:n.r}),transport:(e=z())?{get:function(n){Ut("GET",n,e)},post:function(n){Ut("POST",n,e)}}:{get:E,post:E}}},Nr=(Lr=function(n){var e=void 0===n?{}:n,t=e.createSender,n=e.builder,e=e.createDefaultConfig,r=function(n){var t,r,e=n.builder,o=n.createSender,i=n.createDefaultConfig,u=n.createConfigManager,a=n.userConfigNormalizer,c=n.initConfigNormalizer,f=n.validateInitConfig,s={};b.forEach(function(n){return s[n]=[]});var l=!1,d=!1,p=!1,v=[],h=[],m={getBuilder:function(){return e},getSender:function(){return t},getPreStartQueue:function(){return v},init:function(n){if(l)L("already inited");else{if(!(n&&w(n)&&f(n)))throw new Error("invalid InitConfig, init failed");var e=i(n);if(!e)throw new Error("defaultConfig missing");n=c(n);if((r=u(e)).setConfig(n),r.onChange(function(){g("config")}),!(t=o(r.getConfig())))throw new Error("sender missing");g("init",l=!0)}},set:function(n){l&&n&&w(n)&&(g("beforeConfig",!1,n),null!=r&&r.setConfig(n))},config:function(n){if(l)return n&&w(n)&&(g("beforeConfig",!1,n),null!=r&&r.setConfig(a(n))),null==r?void 0:r.getConfig()},provide:function(n,e){S(h,n)?L("cannot provide "+n+", reserved"):(m[n]=e,g("provide",!1,n))},start:function(){var e=this;l&&(d||null!=r&&r.onReady(function(){g("start",d=!0),v.forEach(function(n){return e.build(n)}),v=[]}))},report:function(n){n&&(!(n=R(s.beforeReport)(n))||(n=R(s.report)(n))&&(d?this.build(n):v.push(n)))},build:function(n){!d||(n=R(s.beforeBuild)(n))&&(!(n=e.build(n))||(n=R(s.build)(n))&&this.send(n))},send:function(n){!d||(n=R(s.beforeSend)(n))&&(t.send(n),g("send",!1,n))},destroy:function(){g("beforeDestroy",p=!0)},on:function(n,e){"init"===n&&l||"start"===n&&d||"beforeDestroy"===n&&p?e():s[n]&&s[n].push(e)},off:function(n,e){s[n]&&(s[n]=T(s[n],e))}},h=Object.keys(m);return m;function g(n,e){void 0===e&&(e=!1);for(var t=[],r=2;r<arguments.length;r++)t[r-2]=arguments[r];s[n].forEach(function(n){try{n.apply(void 0,y([],k(t),!1))}catch(n){}}),e&&(s[n].length=0)}}({validateInitConfig:Yt,initConfigNormalizer:Gt,userConfigNormalizer:Jt,createSender:void 0===t?function(n){return zt({size:or,endpoint:ir(n.domain),transport:n.transport})}:t,builder:void 0===n?Ft:n,createDefaultConfig:void 0===e?Ar:e,createConfigManager:ar});A(r);var o,n=un(U());e=r,n=n&&n.subject,o=n||{},e.provide("initSubject",function(n){var n=k(n,2),e=n[0],n=n[1];return o[e]||(o[e]=I(n,function(){o[e]=void 0})),o[e]}),e.provide("getSubject",function(n){return o[n]}),e.provide("privateSubject",{}),qr(r),Ir(r),Rr(r),Wt(r),Mr(r);var i,e=N(r,ln,function(n,e,t){return dn(n,e)(function(){var n=k(t),e=n[0],n=n.slice(1);r[e].apply(r,y([],k(n),!1))})});return(i=e).on("init",function(){var e=[],n=i.config();n&&n.integrations&&n.integrations.forEach(function(n){S(e,n.name)||(e.push(n.name),n.setup(i),n.tearDown&&i.on("beforeDestroy",n.tearDown))})}),e}(fr=void 0===fr?{}:fr),(sr=Lr).on("start",function(){var n=sr.config(),e=n.userId,n=n.sample;n&&0===n.sample_rate&&sr.destroy();n=Xt(e,n,C,D);sr.on("build",n)}),lr=Lr,pr=Cr(dr=void 0===dr?jr:dr),fr=kr(dr),vr=Dr(lr,pr,dr),null!==(dr=lr.p)&&void 0!==dr&&dr.a&&"observe"in lr.p.a&&lr.p.a.observe(function(n){var e=k(n,5);e[0];var t=e[1],r=e[2],n=e[3],e=e[4];vr(t,r,n,e)}),lr.on("init",function(){var n;null!==(n=lr.p)&&void 0!==n&&n.a.forEach(function(n){var e=k(n,5);e[0];var t=e[1],r=e[2],n=e[3],e=e[4];vr(t,r,n,e)}),lr.p&&lr.p.a&&(lr.p.a.length=0)}),lr.provide("precollect",vr),lr.on("provide",Or(lr,pr,fr)),(hr=Lr).provide("sendEvent",function(n){n=qt(n);n&&hr.report({ev_type:Ot,payload:n,extra:{timestamp:P()}})}),hr.provide("sendLog",function(n){n=It(n);n&&hr.report({ev_type:Ot,payload:n,extra:{timestamp:P()}})}),(mr=Lr).on("init",function(){var n,e,t,r=Xn(mr,xe,Se);r&&location&&(n=[],e=r.routeMode,t=k(_e(mr.report.bind(mr),n,Ee(e)?[]:[mr.initSubject(be),mr.initSubject(we)],m(m({},r),{initPid:null===(r=mr.config())||void 0===r?void 0:r.pid,onPidUpdate:function(n){mr.set({pid:n,viewId:n+"_"+P(),actionId:void 0})}})),1)[0],H(mr,[rn,on(mr)],-1),mr.on("config",function(){t(mr.config().pid)}),mr.on("beforeDestroy",function(){n.forEach(function(n){return n()})}),mr.provide("sendPageview",t))}),(gr=Lr).on("init",function(){var n,e=Xn(gr,zn,Fn);e&&(n=[],(e=m(m({},e),{setContextAtReq:function(){return nn(gr,!0)},setTraceHeader:Nn(e.trace,"app_id="+(null===(e=gr.config())||void 0===e?void 0:e.aid)+",origin=web")})).autoWrap&&Pn(n,[B(gr,[Rn,jn(XMLHttpRequest&&XMLHttpRequest.prototype)]),function(){return B(gr,Mn)}],e),gr.on("beforeDestroy",function(){n.forEach(function(n){return n()})}))}),(yr=Lr).on("init",function(){var n,e=Xn(yr,ne,ee);e&&(n=[],(e=m(m({},e),{setContextAtReq:function(){return nn(yr,!0)},setTraceHeader:Nn(e.trace,"app_id="+(null===(e=yr.config())||void 0===e?void 0:e.aid)+",origin=web")})).autoWrap&&$n(n,[B(yr,Cn),function(){return B(yr,Mn)}],e),yr.on("beforeDestroy",function(){n.forEach(function(n){return n()})}))}),(br=Lr).on("init",function(){var n;Xn(br,ot,{})&&(n=[],rt(nn(br),n,[B(br,[Rn,jn(XMLHttpRequest&&XMLHttpRequest.prototype)]),B(br,Cn),B(br,In),B(br,Mn),H(br,[en,tn(br)])],br.pp),br.on("beforeDestroy",function(){n.forEach(function(n){return n()})}))}),(wr=Lr).on("init",function(){var n,e,t=Xn(wr,ct,ft);t&&(n=[],e=B(wr,Le),"SSR"===t.renderType?nt(Qe,ct,nn(wr),n,[B(wr,Te),B(wr,Re)]):at(nn(wr),n,[e,H(wr,[en,tn(wr)])]),wr.on("beforeDestroy",function(){n.forEach(function(n){return n()})}))}),(Er=Lr).on("init",function(){var e,n,t=Xn(Er,Yn,Jn);t&&(t=(n=k(fn(Gn,t,E),3))[0],e=n[1],n=n[2],Er.on("report",function(n){return"http"===n.ev_type&&e({type:"http",category:n.payload.api,message:"",data:{method:n.payload.request.method,url:n.payload.request.url,status_code:String(n.payload.response.status)},timestamp:n.payload.request.timestamp}),n}),Er.on("beforeDestroy",n),Er.provide("getBreadcrumbs",t),Er.provide("addBreadcrumb",e))}),(_r=Lr).on("init",function(){window.removeEventListener("error",_r.pcErr,!0),window.removeEventListener("unhandledrejection",_r.pcRej,!0);var n,e=Xn(_r,ge,ye);e&&(e=me(function(n){_r.getBreadcrumbs&&(n.payload.breadcrumbs=_r.getBreadcrumbs()),_r.report(n)},n=[],[B(_r,fe),B(_r,se)],e),_r.on("beforeDestroy",function(){n.forEach(function(n){return n()})}),_r.provide("captureException",e))}),(xr=Lr).on("init",function(){var n=xr.pp||Fe;null!==(f=n.observer)&&void 0!==f&&f.disconnect();var e,t,r,o,i,u,a,c,f,s,l=Xn(xr,ze,{});l&&(e=B(xr,Te),t=B(xr,Re),r=B(xr,Le),o=B(xr,In),i=[],u=void 0,H(xr,[rn,on(xr)],-1)[0](function(n){u=n})(),a=function(n){n=n.ev_type===Ge&&n.payload.name===jt[0]||n.ev_type===Ye?n:m(m({},n),{overrides:u});xr.report(n)},c=H(xr,[en,tn(xr)]),[et,tt,Tt,Rt,jt].forEach(function(n){!1!==l[n[0]]&&(n[1](a,n=[],[e,t,c]),i.push(n))}),[Ct,kt,Dt].forEach(function(n){!1!==l[n[0]]&&(n[1](a,n=[],[r,t,o]),i.push(n))}),f=(s=k(Ve(xr.report.bind(xr)),2))[0],s=s[1],xr.provide("performanceInit",f),xr.provide("performanceSend",s),n.entries.length=0,xr.provide("sendCustomPerfMetric",function(n){n=m(m(m({},We),n),{isCustom:!0});xr.report($e(n))}),xr.on("beforeDestroy",function(){i.reduce(function(n,e){return n.concat(e)},[]).forEach(function(n){return n()}),i.length=0}))}),(Sr=Lr).on("init",function(){var n,e=Xn(Sr,Me,Ae);e&&(n=[],e=Ie(Sr.report.bind(Sr),n,[B(Sr,fe)],e),Sr.on("beforeDestroy",function(){n.forEach(function(n){return n()})}),e&&Sr.provide("reportResourceError",e))}),(Tr=Lr).on("init",function(){var n,e=Xn(Tr,De,Oe);e&&(n=[],ke(Tr.report.bind(Tr),n,[B(Tr,Le),function(){return B(Tr,Mn)}],e),Tr.on("beforeDestroy",function(){n.forEach(function(n){return n()})}))}),n(Lr),Lr),Br=function(){var n=U(),e=$t();if(n&&e)return n[e]}();Br&&["p","pp","pcErr","pcRej"].forEach(function(n){Nr.provide(n,Br[n])});var Hr,Pr,Ur,Wr,Xr=U(),zr=$t();Xr&&zr&&(Hr=(null==(Hr=Xr[zr])?void 0:Hr.q)||[],Xr[zr]=Nr,Hr.forEach(function(n){var e,t;t=n,n=m(m({},ln(e=Nr)),{url:t.pop(),timestamp:t.pop()}),dn(e,n)(function(){e.apply(void 0,y([],k(t),!1))})}),Hr.length=0,Nr.p&&("observe"in Nr.p.a&&console.warn("global precollect queue already updated"),Nr.p.a=(Ur=Nr.p.a,Wr=[],Ur.observe=function(n){Wr.push(n)},Ur.push=function(){for(var n,e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e.forEach(function(e){Wr.forEach(function(n){return n(e)})}),(n=[].push).call.apply(n,y([Ur],k(e),!1))},Ur),(Pr=Nr.precollect)&&Nr.provide("precollect",function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];return Nr.p.a.push(y(["precollect"],k(n),!1)),Pr.apply(void 0,y([],k(n),!1))})))}();

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

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var REPORT_DOMAIN="apmplus.volces.com",SETTINGS_DOMAIN=REPORT_DOMAIN,SDK_VERSION="2.0.4",SDK_NAME="APM_PLUS_WEB",SETTINGS_PATH="/settings/get/webpro",BATCH_REPORT_PATH="/monitor_web/collect",STORAGE_PREFIX="APMPLUS",DEFAULT_IGNORE_PATHS=[BATCH_REPORT_PATH,SETTINGS_PATH,"/monitor_browser/collect"],DEFAULT_SAMPLE_CONFIG={sample_rate:1,include_users:[],sample_granularity:"session",rules:{}},DEFAULT_SENDER_SIZE=20;exports.BATCH_REPORT_PATH=BATCH_REPORT_PATH,exports.DEFAULT_IGNORE_PATHS=DEFAULT_IGNORE_PATHS,exports.DEFAULT_SAMPLE_CONFIG=DEFAULT_SAMPLE_CONFIG,exports.DEFAULT_SENDER_SIZE=DEFAULT_SENDER_SIZE,exports.REPORT_DOMAIN=REPORT_DOMAIN,exports.SDK_NAME=SDK_NAME,exports.SDK_VERSION=SDK_VERSION,exports.SETTINGS_DOMAIN=SETTINGS_DOMAIN,exports.SETTINGS_PATH=SETTINGS_PATH,exports.STORAGE_PREFIX=STORAGE_PREFIX;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var REPORT_DOMAIN="apmplus.volces.com",SETTINGS_DOMAIN=REPORT_DOMAIN,SDK_VERSION="2.0.5-alpha.0",SDK_NAME="APM_PLUS_WEB",SETTINGS_PATH="/settings/get/webpro",BATCH_REPORT_PATH="/monitor_web/collect",STORAGE_PREFIX="APMPLUS",DEFAULT_IGNORE_PATHS=[BATCH_REPORT_PATH,SETTINGS_PATH,"/monitor_browser/collect"],DEFAULT_SAMPLE_CONFIG={sample_rate:1,include_users:[],sample_granularity:"session",rules:{}},DEFAULT_SENDER_SIZE=20;exports.BATCH_REPORT_PATH=BATCH_REPORT_PATH,exports.DEFAULT_IGNORE_PATHS=DEFAULT_IGNORE_PATHS,exports.DEFAULT_SAMPLE_CONFIG=DEFAULT_SAMPLE_CONFIG,exports.DEFAULT_SENDER_SIZE=DEFAULT_SENDER_SIZE,exports.REPORT_DOMAIN=REPORT_DOMAIN,exports.SDK_NAME=SDK_NAME,exports.SDK_VERSION=SDK_VERSION,exports.SETTINGS_DOMAIN=SETTINGS_DOMAIN,exports.SETTINGS_PATH=SETTINGS_PATH,exports.STORAGE_PREFIX=STORAGE_PREFIX;

@@ -672,6 +672,5 @@ declare type ReportEventFromClient<C extends AnyClient> = C extends {

declare type Cb = (ev: HttpReport) => void;
interface AjaxMonitorConfig {
autoWrap?: boolean;
hookCbAtReq: (t: Cb | undefined) => Cb | undefined;
setContextAtReq: () => (ev: HttpReport) => void;
ignoreUrls: (string | RegExp)[];

@@ -678,0 +677,0 @@ collectBodyOnError: boolean;

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

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var __assign=function(){return(__assign=Object.assign||function(e){for(var n,r=1,t=arguments.length;r<t;r++)for(var o in n=arguments[r])Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o]);return e}).apply(this,arguments)};function __read(e,n){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var t,o,i=r.call(e),a=[];try{for(;(void 0===n||0<n--)&&!(t=i.next()).done;)a.push(t.value)}catch(e){o={error:e}}finally{try{t&&!t.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a}function __spreadArray(e,n,r){if(r||2===arguments.length)for(var t,o=0,i=n.length;o<i;o++)!t&&o in n||((t=t||Array.prototype.slice.call(n,0,o))[o]=n[o]);return e.concat(t||Array.prototype.slice.call(n))}var DEFAULT_SIZE=10,DEFAULT_WAIT=1e3,stringifyBatch=function(e){return JSON.stringify({ev_type:"batch",list:e})};function createBatchSender(e){var r,t=e.transport,o=e.endpoint,n=e.size,i=void 0===n?DEFAULT_SIZE:n,e=e.wait,a=void 0===e?DEFAULT_WAIT:e,u=[],s=0;function c(){var n;u.length&&(n=this.getBatchData(),t.post({url:o,data:n,fail:function(e){r&&r(e,n)}}),u=[])}return{getSize:function(){return i},getWait:function(){return a},setSize:function(e){i=e},setWait:function(e){a=e},getEndpoint:function(){return o},setEndpoint:function(e){o=e},send:function(e){u.push(e),u.length>=i&&c.call(this),clearTimeout(s),s=setTimeout(c.bind(this),a)},flush:function(){clearTimeout(s),c.call(this)},getBatchData:function(){return u.length?stringifyBatch(u):""},clear:function(){clearTimeout(s),u=[]},fail:function(e){r=e}}}var EVENTS=["init","start","config","beforeDestroy","provide","beforeReport","report","beforeBuild","build","beforeSend","send","beforeConfig"],noop=function(){return{}};function isObject(e){return"object"==typeof e&&null!==e}var objProto=Object.prototype;function isPlainObject(e){if(isObject(e)){if("function"!=typeof Object.getPrototypeOf)return"[object Object]"===objProto.toString.call(e);e=Object.getPrototypeOf(e);return e===objProto||null===e}return!1}function isArray(e){return"[object Array]"===objProto.toString.call(e)}function isFunction(e){return"function"==typeof e}function isString(e){return"string"==typeof e}function hasKey(e,n){return Object.prototype.hasOwnProperty.call(e,n)}function mergeDeepConcatArray(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];for(var r={},t=0;t<e.length;)r=_mergeDeepMergeArray(r,e[t++]);return r}function _mergeDeepMergeArray(e,n){var r,t=__assign({},e);for(r in n)hasKey(n,r)&&void 0!==n[r]&&(isObject(n[r])&&isPlainObject(n[r])?t[r]=_mergeDeepMergeArray(isObject(e[r])?e[r]:{},n[r]):isArray(n[r])&&isArray(e[r])?t[r]=_mergeDeepArray(e[r],n[r]):t[r]=n[r]);return t}function _mergeDeepArray(e,n){e=isArray(e)?e:[],n=isArray(n)?n:[];return Array.prototype.concat.call(e,n).map(function(e){return e instanceof RegExp?e:isObject(e)&&isPlainObject(e)?_mergeDeepMergeArray({},e):isArray(e)?_mergeDeepArray([],e):e})}function arrayIncludes(e,n){if(!isArray(e))return!1;if(0===e.length)return!1;for(var r=0;r<e.length;){if(e[r]===n)return!0;r++}return!1}var arrayRemove=function(e,n){if(!isArray(e))return e;var r=e.indexOf(n);if(0<=r){n=e.slice();return n.splice(r,1),n}return e},safeVisit=function(e,n,r){for(var t,n=__read(n.split(".")),o=n[0],i=n.slice(1);e&&0<i.length;)e=e[o],o=(t=__read(i))[0],i=t.slice(1);if(e)return r(e,o)},safeCall=function(e,n,r){return safeVisit(e,n,function(e,n){if(e&&n in e&&isFunction(e[n]))try{return e[n].apply(e,r)}catch(e){return}})};function safeStringify(e){try{return isString(e)?e:JSON.stringify(e)}catch(e){return"[FAILED_TO_STRINGIFY]:"+String(e)}}var joinQueryWithMap=function(r){return isObject(r)?Object.keys(r).reduce(function(e,n){return e+="&"+n+"="+r[n]},"").replace("&","?"):""};function createContextAgent(){var r={},t={},o={set:function(e,n){return r[e]=n,t[e]=safeStringify(n),o},merge:function(n){return r=__assign(__assign({},r),n),Object.keys(n).forEach(function(e){t[e]=safeStringify(n[e])}),o},delete:function(e){return delete r[e],delete t[e],o},clear:function(){return r={},t={},o},get:function(e){return t[e]},toString:function(){return __assign({},t)}};return o}var hookObjectProperty=function(i,a,u,s){return void 0===s&&(s=!0),function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];if(!i)return noop;var r=i[a],t=u.apply(void 0,__spreadArray([r],__read(e),!1)),o=t;return isFunction(o)&&s&&(o=function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];try{return t.apply(this,n)}catch(e){return isFunction(r)&&r.apply(this,n)}}),i[a]=o,function(e){e||(o===i[a]?i[a]=r:t=r)}}},errCount=0,error=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];console.error.apply(console,__spreadArray(["[SDK]",Date.now(),(""+errCount++).padStart(8," ")],__read(e),!1))},warnCount=0,warn=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];console.warn.apply(console,__spreadArray(["[SDK]",Date.now(),(""+warnCount++).padStart(8," ")],__read(e),!1))},runProcessors=function(t){return function(e){for(var n=e,r=0;r<t.length&&n;r++)try{n=t[r](n)}catch(e){error(e)}return n}};function mathRNG(){for(var e=new Array(16),n=0,r=0;r<16;r++)0==(3&r)&&(n=4294967296*Math.random()),e[r]=n>>>((3&r)<<3)&255;return e}function bytesToUuid(e){for(var n=[],r=0;r<256;++r)n[r]=(r+256).toString(16).substr(1);var t=0,o=n;return[o[e[t++]],o[e[t++]],o[e[t++]],o[e[t++]],"-",o[e[t++]],o[e[t++]],"-",o[e[t++]],o[e[t++]],"-",o[e[t++]],o[e[t++]],"-",o[e[t++]],o[e[t++]],o[e[t++]],o[e[t++]],o[e[+t]],o[e[15]]].join("")}function uuid(){var e=mathRNG();return e[6]=15&e[6]|64,e[8]=63&e[8]|128,bytesToUuid(e)}var BUFFER_TIME=3e5,applyBufferTimer=function(e,n,r){var t=0;return-1===r?noop:function(){if(e())return t&&clearTimeout(t),void(t=0);0===t&&(t=setTimeout(n,r))}},nextLink=function(t,e){var n=[];try{n=e.reduce(function(e,n){try{var r=n(t);"function"==typeof r&&e.push(r)}catch(e){}return e},[])}catch(e){}return function(e){return nextLink(e,n)}},toObservable=function(e){function n(e){t=arrayRemove(t,e),i||a()}var r,t=[],o=[],i=!1,a=applyBufferTimer(function(){return!!t.length},function(){i=!0,r&&r[0](),o.forEach(function(e){return e()}),o.length=0,r=void 0},e=void 0===e?BUFFER_TIME:e);return{next:function(e){return nextLink(e,t)},complete:function(e){o.push(e)},attach:function(e,n){r=[e,n]},subscribe:function(e){if(i)throw new Error("Observer is closed");return t.push(e),r&&r[1]&&r[1](e),a(),function(){return n(e)}},unsubscribe:n}},createSafeObserver=function(e,n,r){r=toObservable(r);try{e(r.next,r.attach),n&&r.complete(n)}catch(e){}return[r.subscribe,r.unsubscribe]};function createClient(e){var r,t,n=e.builder,o=e.createSender,i=e.createDefaultConfig,a=e.createConfigManager,u=e.userConfigNormalizer,s=e.initConfigNormalizer,c=e.validateInitConfig,f={};EVENTS.forEach(function(e){return f[e]=[]});var l=!1,g=!1,d=!1,p=[],_=[],v={getBuilder:function(){return n},getSender:function(){return r},getPreStartQueue:function(){return p},init:function(e){if(l)warn("already inited");else{if(!(e&&isObject(e)&&c(e)))throw new Error("invalid InitConfig, init failed");var n=i(e);if(!n)throw new Error("defaultConfig missing");e=s(e);if((t=a(n)).setConfig(e),t.onChange(function(){y("config")}),!(r=o(t.getConfig())))throw new Error("sender missing");y("init",l=!0)}},set:function(e){l&&e&&isObject(e)&&(y("beforeConfig",!1,e),null!=t&&t.setConfig(e))},config:function(e){if(l)return e&&isObject(e)&&(y("beforeConfig",!1,e),null!=t&&t.setConfig(u(e))),null==t?void 0:t.getConfig()},provide:function(e,n){arrayIncludes(_,e)?warn("cannot provide "+e+", reserved"):(v[e]=n,y("provide",!1,e))},start:function(){var n=this;l&&(g||null!=t&&t.onReady(function(){y("start",g=!0),p.forEach(function(e){return n.build(e)}),p=[]}))},report:function(e){e&&(!(e=runProcessors(f.beforeReport)(e))||(e=runProcessors(f.report)(e))&&(g?this.build(e):p.push(e)))},build:function(e){!g||(e=runProcessors(f.beforeBuild)(e))&&(!(e=n.build(e))||(e=runProcessors(f.build)(e))&&this.send(e))},send:function(e){!g||(e=runProcessors(f.beforeSend)(e))&&(r.send(e),y("send",!1,e))},destroy:function(){y("beforeDestroy",d=!0)},on:function(e,n){"init"===e&&l||"start"===e&&g||"beforeDestroy"===e&&d?n():f[e]&&f[e].push(n)},off:function(e,n){f[e]&&(f[e]=arrayRemove(f[e],n))}},_=Object.keys(v);return v;function y(e,n){void 0===n&&(n=!1);for(var r=[],t=2;t<arguments.length;t++)r[t-2]=arguments[t];f[e].forEach(function(e){try{e.apply(void 0,__spreadArray([],__read(r),!1))}catch(e){}}),n&&(f[e].length=0)}}var ContextPlugin=function(e){var n=createContextAgent();e.provide("context",n),e.on("report",function(e){return e.extra||(e.extra={}),e.extra.context=n.toString(),e})},withCommandArray=function(i,a,r){function u(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];if(o=e[0]){var r=o.split(".")[0];if(r in u)return safeCall(u,o,[].slice.call(e,1));var t=s[r]||[],o=null!==(o=null==a?void 0:a(i))&&void 0!==o?o:{};t.push(__spreadArray([o],__read(e),!1)),void(s[r]=t)}}var e,s={};for(e in hookObjectProperty(i,"provide",function(r){return function(e,n){u[e]=n,r.call(i,e,n)}})(),i)Object.prototype.hasOwnProperty.call(i,e)&&(u[e]=i[e]);return i.on("provide",function(e){s[e]&&(s[e].forEach(function(e){var n=__read(e),e=n[0],n=n.slice(1);null!=r&&r(i,e,n)}),s[e]=null)}),u};function IntegrationPlugin(r){r.on("init",function(){var n=[],e=r.config();e&&e.integrations&&e.integrations.forEach(function(e){arrayIncludes(n,e.name)||(n.push(e.name),e.setup(r),e.tearDown&&r.on("beforeDestroy",e.tearDown))})})}function SubjectPlugin(e,n){var r=n||{};e.provide("initSubject",function(e){var e=__read(e,2),n=e[0],e=e[1];return r[n]||(r[n]=createSafeObserver(e,function(){r[n]=void 0})),r[n]}),e.provide("getSubject",function(e){return r[e]}),e.provide("privateSubject",{})}function getDefaultBrowser(){if("object"==typeof window&&isObject(window))return window}function getDefaultLocation(){return getDefaultBrowser()&&window.location}function getDefaultXMLHttpRequest(){if("function"==typeof XMLHttpRequest&&isFunction(XMLHttpRequest))return XMLHttpRequest}function getDefaultNavigator(){if(getDefaultBrowser()&&"navigator"in window)return window.navigator}function getDefaultNetworkInformation(){var e=getDefaultNavigator();if(e)return e.connection||e.mozConnection||e.webkitConnection}var getGlobalRegistry=function(e){if(e)return e.__SLARDAR_REGISTRY__||(e.__SLARDAR_REGISTRY__={Slardar:{plugins:[],errors:[],subject:{}}}),e.__SLARDAR_REGISTRY__.Slardar},now=function(){return Date.now()};function getLocationUrl(){var e=getDefaultBrowser()&&getDefaultLocation();return null==e?void 0:e.href}var captureCurrentContext=function(e){var n={url:getLocationUrl(),timestamp:now()},r=e.config();return null!=r&&r.pid&&(n.pid=r.pid),null!=e&&e.context&&(n.context=e.context.toString()),n},syncReportWithCapturedContext=function(r,t){return function(e){function n(e){return e.overrides=t,e}r.on("report",n),e(),r.off("report",n)}},invokeCallbackOnce=function(n){var r=!1;return[function(e){r||(r=!0,n&&n(e))}]},onPageUnload=function(e){var n,r=getDefaultBrowser();r&&(n=__read(invokeCallbackOnce(e),1)[0],["unload","beforeunload","pagehide"].forEach(function(e){r.addEventListener(e,n)}))},getStorageItem=function(e){try{var n=localStorage.getItem(e),r=n;return r=n&&"string"==typeof n?JSON.parse(n):r}catch(e){return}},setStorageItem=function(e,n){try{var r="string"==typeof n?n:JSON.stringify(n);localStorage.setItem(e,r)}catch(e){}};function getNetworkType(e){return(null==e?void 0:e.effectiveType)||(null==e?void 0:e.type)||""}var InjectNetworkTypePlugin=function(e){var n=getDefaultNetworkInformation(),r=getNetworkType(n);n&&(n.onchange=function(){r=getNetworkType(n)}),e.on("report",function(e){return __assign(__assign({},e),{extra:__assign(__assign({},e.extra||{}),{network_type:r})})})},getBeaconTransport=function(){var r=getDefaultBrowser();return r&&r.navigator.sendBeacon?{get:function(){},post:function(e,n){r.navigator.sendBeacon(e,n)}}:{get:noop,post:noop}},request=function(e,n,r){var t=n.url,o=n.data,i=n.success,a=void 0===i?noop:i,i=n.fail,u=void 0===i?noop:i,i=n.getResponseText,s=void 0===i?noop:i,n=n.withCredentials,n=void 0!==n&&n,r=new r;r.withCredentials=n,r.open(e,t,!0),r.setRequestHeader("Content-Type","application/json"),r.onload=function(){null!=s&&s(this.responseText);try{var e;this.responseText?(e=JSON.parse(this.responseText),a(e)):a({})}catch(e){u(e)}},r.onerror=function(){u(new Error("Network request failed"))},r.onabort=function(){u(new Error("Network request aborted"))},r.send(o)},getXhrTransport=function(){var n=getDefaultXMLHttpRequest();return n?{get:function(e){request("GET",e,n)},post:function(e){request("POST",e,n)}}:{get:noop,post:noop}};function createBrowserSender(e){function n(e){t.post(r.getEndpoint(),stringifyBatch([e]))}var r=createBatchSender(e),t=getBeaconTransport();return onPageUnload(function(){var e=r.getBatchData();e&&(t.post(r.getEndpoint(),e),r.clear()),r.send=n}),r}var browserBuilder={build:function(e){return{ev_type:e.ev_type,payload:e.payload,common:__assign(__assign({},e.extra||{}),e.overrides||{})}}};function normalizeInitConfig(e){var n,r=e.plugins||{};for(n in r)r[n]&&!isObject(r[n])&&(r[n]={});return __assign(__assign({},e),{plugins:r})}function validateInitConfig(e){return isObject(e)&&"aid"in e}function normalizeUserConfig(e){return __assign({},e)}function parseServerConfig(e){if(!e)return{};var n=e.sample,r=e.timestamp,t=e.status;if(!n)return{};var o=n.sample_rate,e=n.sample_granularity;return{sample:{include_users:n.include_users,sample_rate:t&&4===t?0:o,sample_granularity:e,rules:n.rules.reduce(function(e,n){var r=n.name,t=n.enable,o=n.sample_rate,n=n.conditional_sample_rules;return e[r]={enable:t,sample_rate:o,conditional_sample_rules:n},e},{})},serverTimestamp:r}}var REPORT_DOMAIN="apmplus.volces.com",SDK_VERSION="2.0.4",SDK_NAME="APM_PLUS_WEB",SETTINGS_PATH="/settings/get/webpro",BATCH_REPORT_PATH="/monitor_web/collect",STORAGE_PREFIX="APMPLUS",DEFAULT_IGNORE_PATHS=[BATCH_REPORT_PATH,SETTINGS_PATH,"/monitor_browser/collect"],DEFAULT_SAMPLE_CONFIG={sample_rate:1,include_users:[],sample_granularity:"session",rules:{}},DEFAULT_SENDER_SIZE=20,getReportUrl=function(e,n){return void 0===n&&(n=BATCH_REPORT_PATH),(e&&0<=e.indexOf("//")?"":"https://")+e+n},getSettingsUrl=function(e,n){return void 0===n&&(n=SETTINGS_PATH),(e&&0<=e.indexOf("//")?"":"https://")+e+n},getViewId=function(e){return e+"_"+Date.now()},getDefaultSessionId=function(){return uuid()},getStorageKey=function(e){return STORAGE_PREFIX+e},getStoreInfo=function(e){e=getStorageKey(e);return getStorageItem(e)||{userId:uuid(),deviceId:uuid(),r:Math.random()}},saveStoreInfo=function(e){var n=e.aid,r=e.userId,t=e.deviceId,e=e.sample,n=getStorageKey(n);setStorageItem(n,{userId:r,deviceId:t,r:e.r})},createBrowserConfigManager=function(n){var r,t,o,i=n,a={},u=noop,s=noop;return{getConfig:function(){return i},setConfig:function(e){return a=__assign(__assign({},a),e||{}),c(),r||(r=e,i.useLocalConfig?(o={},u()):t?f():getServerConfig(i.transport,i.domain,i.aid,function(e){t=e,f()})),i},onChange:function(e){s=e},onReady:function(e){u=function(){!function(){n.userId!==i.userId&&(n.sample.r=Math.random(),c());saveStoreInfo(i)}(),e()},o&&u()}};function c(){var e=__assign(__assign(__assign({},n),o||{}),a);e.plugins=mergeDeepConcatArray(n.plugins,(null==o?void 0:o.plugins)||{},a.plugins||{}),e.sample=mergeSampleConfig(mergeSampleConfig(n.sample,null==o?void 0:o.sample),a.sample),i=e,s()}function f(){o=parseServerConfig(t),c(),u()}};function getServerConfig(e,n,r,t){e.get({withCredentials:!0,url:getSettingsUrl(n)+"?aid="+r,success:function(e){t(e.data||{})},fail:function(){t()}})}function mergeSampleConfig(t,o){if(!t||!o)return t||o;var e=__assign(__assign({},t),o);return e.include_users=__spreadArray(__spreadArray([],__read(t.include_users||[]),!1),__read(o.include_users||[]),!1),e.rules=__spreadArray(__spreadArray([],__read(Object.keys(t.rules||{})),!1),__read(Object.keys(o.rules||{})),!1).reduce(function(e,n){var r;return n in e||(n in(t.rules||{})&&n in(o.rules||{})?(e[n]=__assign(__assign({},t.rules[n]),o.rules[n]),e[n].conditional_sample_rules=__spreadArray(__spreadArray([],__read(t.rules[n].conditional_sample_rules||[]),!1),__read(o.rules[n].conditional_sample_rules||[]),!1)):e[n]=(null===(r=t.rules)||void 0===r?void 0:r[n])||(null===(r=o.rules)||void 0===r?void 0:r[n])),e},{}),e}var addEnvToSendEvent=function(e){var n={url:getLocationUrl(),timestamp:Date.now()};return __assign(__assign({},e),{extra:__assign(__assign({},n),e.extra||{})})},InjectEnvPlugin=function(e){e.on("report",function(e){return addEnvToSendEvent(e)})},MAX_RTT=700,TimeCalibrationPlugin=function(r){var t,o=!1;r.on("init",function(){t=(new Date).getTime(),r.on("config",function(){var e,n=null===(e=r.config())||void 0===e?void 0:e.serverTimestamp;isNaN(n)||Number(n)<=0||o||(o=!0,(e=(new Date).getTime())-t<MAX_RTT&&n&&(e=n-(e+t)/2,!isNaN(e)&&(0<e||e<-6e5)&&r.set({offset:e})))})})},addConfigToReportEvent=function(e,n){var r={};return r.aid=n.aid,r.pid=n.pid,r.view_id=n.viewId,r.user_id=n.userId,__assign(__assign({},e),{extra:__assign(__assign({},r),e.extra||{})})},InjectConfigPlugin=function(n){n.on("beforeBuild",function(e){return addConfigToReportEvent(e,n.config())})},InjectQueryPlugin=function(u){u.on("start",function(){var e=u.config(),n=e.deviceId,r=e.sessionId,t=e.release,o=e.env,i=e.offset,a=e.aid,e=e.token,a={did:n,sid:r,release:t,env:o,sname:SDK_NAME,sversion:SDK_VERSION,soffset:i||0,biz_id:a,x_auth_token:e},e=u.getSender();e.setEndpoint(e.getEndpoint()+joinQueryWithMap(a))})},getDefaultConfig=function(e){e=getStoreInfo(e.aid);return{aid:0,pid:"",token:"",viewId:getViewId("_"),userId:e.userId,deviceId:e.deviceId,sessionId:getDefaultSessionId(),domain:REPORT_DOMAIN,plugins:{ajax:{ignoreUrls:DEFAULT_IGNORE_PATHS},fetch:{ignoreUrls:DEFAULT_IGNORE_PATHS},breadcrumb:{},pageview:{},jsError:{},resource:{},resourceError:{},performance:{},tti:{},fmp:{},blankScreen:!1},release:"",env:"production",sample:__assign(__assign({},DEFAULT_SAMPLE_CONFIG),{r:e.r}),transport:getXhrTransport()}},createMinimalBrowserClient=function(e){var n=void 0===e?{}:e,r=n.createSender,e=n.builder,n=n.createDefaultConfig,t=createClient({validateInitConfig:validateInitConfig,initConfigNormalizer:normalizeInitConfig,userConfigNormalizer:normalizeUserConfig,createSender:void 0===r?function(e){return createBrowserSender({size:DEFAULT_SENDER_SIZE,endpoint:getReportUrl(e.domain),transport:e.transport})}:r,builder:void 0===e?browserBuilder:e,createDefaultConfig:void 0===n?getDefaultConfig:n,createConfigManager:createBrowserConfigManager});ContextPlugin(t);n=getGlobalRegistry(getDefaultBrowser());SubjectPlugin(t,n&&n.subject),TimeCalibrationPlugin(t),InjectConfigPlugin(t),InjectEnvPlugin(t),InjectNetworkTypePlugin(t),InjectQueryPlugin(t);n=withCommandArray(t,captureCurrentContext,function(e,n,r){return syncReportWithCapturedContext(e,n)(function(){var e=__read(r),n=e[0],e=e.slice(1);t[n].apply(t,__spreadArray([],__read(e),!1))})});return IntegrationPlugin(n),n};exports.createMinimalBrowserClient=createMinimalBrowserClient,exports.getDefaultConfig=getDefaultConfig;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var __assign=function(){return(__assign=Object.assign||function(e){for(var n,r=1,t=arguments.length;r<t;r++)for(var o in n=arguments[r])Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o]);return e}).apply(this,arguments)};function __read(e,n){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var t,o,i=r.call(e),a=[];try{for(;(void 0===n||0<n--)&&!(t=i.next()).done;)a.push(t.value)}catch(e){o={error:e}}finally{try{t&&!t.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a}function __spreadArray(e,n,r){if(r||2===arguments.length)for(var t,o=0,i=n.length;o<i;o++)!t&&o in n||((t=t||Array.prototype.slice.call(n,0,o))[o]=n[o]);return e.concat(t||Array.prototype.slice.call(n))}var DEFAULT_SIZE=10,DEFAULT_WAIT=1e3,stringifyBatch=function(e){return JSON.stringify({ev_type:"batch",list:e})};function createBatchSender(e){var r,t=e.transport,o=e.endpoint,n=e.size,i=void 0===n?DEFAULT_SIZE:n,e=e.wait,a=void 0===e?DEFAULT_WAIT:e,u=[],s=0;function c(){var n;u.length&&(n=this.getBatchData(),t.post({url:o,data:n,fail:function(e){r&&r(e,n)}}),u=[])}return{getSize:function(){return i},getWait:function(){return a},setSize:function(e){i=e},setWait:function(e){a=e},getEndpoint:function(){return o},setEndpoint:function(e){o=e},send:function(e){u.push(e),u.length>=i&&c.call(this),clearTimeout(s),s=setTimeout(c.bind(this),a)},flush:function(){clearTimeout(s),c.call(this)},getBatchData:function(){return u.length?stringifyBatch(u):""},clear:function(){clearTimeout(s),u=[]},fail:function(e){r=e}}}var EVENTS=["init","start","config","beforeDestroy","provide","beforeReport","report","beforeBuild","build","beforeSend","send","beforeConfig"],noop=function(){return{}};function isObject(e){return"object"==typeof e&&null!==e}var objProto=Object.prototype;function isPlainObject(e){if(isObject(e)){if("function"!=typeof Object.getPrototypeOf)return"[object Object]"===objProto.toString.call(e);e=Object.getPrototypeOf(e);return e===objProto||null===e}return!1}function isArray(e){return"[object Array]"===objProto.toString.call(e)}function isFunction(e){return"function"==typeof e}function isString(e){return"string"==typeof e}function hasKey(e,n){return Object.prototype.hasOwnProperty.call(e,n)}function mergeDeepConcatArray(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];for(var r={},t=0;t<e.length;)r=_mergeDeepMergeArray(r,e[t++]);return r}function _mergeDeepMergeArray(e,n){var r,t=__assign({},e);for(r in n)hasKey(n,r)&&void 0!==n[r]&&(isObject(n[r])&&isPlainObject(n[r])?t[r]=_mergeDeepMergeArray(isObject(e[r])?e[r]:{},n[r]):isArray(n[r])&&isArray(e[r])?t[r]=_mergeDeepArray(e[r],n[r]):t[r]=n[r]);return t}function _mergeDeepArray(e,n){e=isArray(e)?e:[],n=isArray(n)?n:[];return Array.prototype.concat.call(e,n).map(function(e){return e instanceof RegExp?e:isObject(e)&&isPlainObject(e)?_mergeDeepMergeArray({},e):isArray(e)?_mergeDeepArray([],e):e})}function arrayIncludes(e,n){if(!isArray(e))return!1;if(0===e.length)return!1;for(var r=0;r<e.length;){if(e[r]===n)return!0;r++}return!1}var arrayRemove=function(e,n){if(!isArray(e))return e;var r=e.indexOf(n);if(0<=r){n=e.slice();return n.splice(r,1),n}return e},safeVisit=function(e,n,r){for(var t,n=__read(n.split(".")),o=n[0],i=n.slice(1);e&&0<i.length;)e=e[o],o=(t=__read(i))[0],i=t.slice(1);if(e)return r(e,o)},safeCall=function(e,n,r){return safeVisit(e,n,function(e,n){if(e&&n in e&&isFunction(e[n]))try{return e[n].apply(e,r)}catch(e){return}})};function safeStringify(e){try{return isString(e)?e:JSON.stringify(e)}catch(e){return"[FAILED_TO_STRINGIFY]:"+String(e)}}var joinQueryWithMap=function(r){return isObject(r)?Object.keys(r).reduce(function(e,n){return e+="&"+n+"="+r[n]},"").replace("&","?"):""};function createContextAgent(){var r={},t={},o={set:function(e,n){return r[e]=n,t[e]=safeStringify(n),o},merge:function(n){return r=__assign(__assign({},r),n),Object.keys(n).forEach(function(e){t[e]=safeStringify(n[e])}),o},delete:function(e){return delete r[e],delete t[e],o},clear:function(){return r={},t={},o},get:function(e){return t[e]},toString:function(){return __assign({},t)}};return o}var hookObjectProperty=function(i,a,u,s){return void 0===s&&(s=!0),function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];if(!i)return noop;var r=i[a],t=u.apply(void 0,__spreadArray([r],__read(e),!1)),o=t;return isFunction(o)&&s&&(o=function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];try{return t.apply(this,n)}catch(e){return isFunction(r)&&r.apply(this,n)}}),i[a]=o,function(e){e||(o===i[a]?i[a]=r:t=r)}}},errCount=0,error=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];console.error.apply(console,__spreadArray(["[SDK]",Date.now(),(""+errCount++).padStart(8," ")],__read(e),!1))},warnCount=0,warn=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];console.warn.apply(console,__spreadArray(["[SDK]",Date.now(),(""+warnCount++).padStart(8," ")],__read(e),!1))},runProcessors=function(t){return function(e){for(var n=e,r=0;r<t.length&&n;r++)try{n=t[r](n)}catch(e){error(e)}return n}};function mathRNG(){for(var e=new Array(16),n=0,r=0;r<16;r++)0==(3&r)&&(n=4294967296*Math.random()),e[r]=n>>>((3&r)<<3)&255;return e}function bytesToUuid(e){for(var n=[],r=0;r<256;++r)n[r]=(r+256).toString(16).substr(1);var t=0,o=n;return[o[e[t++]],o[e[t++]],o[e[t++]],o[e[t++]],"-",o[e[t++]],o[e[t++]],"-",o[e[t++]],o[e[t++]],"-",o[e[t++]],o[e[t++]],"-",o[e[t++]],o[e[t++]],o[e[t++]],o[e[t++]],o[e[+t]],o[e[15]]].join("")}function uuid(){var e=mathRNG();return e[6]=15&e[6]|64,e[8]=63&e[8]|128,bytesToUuid(e)}var BUFFER_TIME=3e5,applyBufferTimer=function(e,n,r){var t=0;return-1===r?noop:function(){if(e())return t&&clearTimeout(t),void(t=0);0===t&&(t=setTimeout(n,r))}},nextLink=function(t,e){var n=[];try{n=e.reduce(function(e,n){try{var r=n(t);"function"==typeof r&&e.push(r)}catch(e){}return e},[])}catch(e){}return function(e){return nextLink(e,n)}},toObservable=function(e){function n(e){t=arrayRemove(t,e),i||a()}var r,t=[],o=[],i=!1,a=applyBufferTimer(function(){return!!t.length},function(){i=!0,r&&r[0](),o.forEach(function(e){return e()}),o.length=0,r=void 0},e=void 0===e?BUFFER_TIME:e);return{next:function(e){return nextLink(e,t)},complete:function(e){o.push(e)},attach:function(e,n){r=[e,n]},subscribe:function(e){if(i)throw new Error("Observer is closed");return t.push(e),r&&r[1]&&r[1](e),a(),function(){return n(e)}},unsubscribe:n}},createSafeObserver=function(e,n,r){r=toObservable(r);try{e(r.next,r.attach),n&&r.complete(n)}catch(e){}return[r.subscribe,r.unsubscribe]};function createClient(e){var r,t,n=e.builder,o=e.createSender,i=e.createDefaultConfig,a=e.createConfigManager,u=e.userConfigNormalizer,s=e.initConfigNormalizer,c=e.validateInitConfig,f={};EVENTS.forEach(function(e){return f[e]=[]});var l=!1,g=!1,d=!1,p=[],_=[],v={getBuilder:function(){return n},getSender:function(){return r},getPreStartQueue:function(){return p},init:function(e){if(l)warn("already inited");else{if(!(e&&isObject(e)&&c(e)))throw new Error("invalid InitConfig, init failed");var n=i(e);if(!n)throw new Error("defaultConfig missing");e=s(e);if((t=a(n)).setConfig(e),t.onChange(function(){y("config")}),!(r=o(t.getConfig())))throw new Error("sender missing");y("init",l=!0)}},set:function(e){l&&e&&isObject(e)&&(y("beforeConfig",!1,e),null!=t&&t.setConfig(e))},config:function(e){if(l)return e&&isObject(e)&&(y("beforeConfig",!1,e),null!=t&&t.setConfig(u(e))),null==t?void 0:t.getConfig()},provide:function(e,n){arrayIncludes(_,e)?warn("cannot provide "+e+", reserved"):(v[e]=n,y("provide",!1,e))},start:function(){var n=this;l&&(g||null!=t&&t.onReady(function(){y("start",g=!0),p.forEach(function(e){return n.build(e)}),p=[]}))},report:function(e){e&&(!(e=runProcessors(f.beforeReport)(e))||(e=runProcessors(f.report)(e))&&(g?this.build(e):p.push(e)))},build:function(e){!g||(e=runProcessors(f.beforeBuild)(e))&&(!(e=n.build(e))||(e=runProcessors(f.build)(e))&&this.send(e))},send:function(e){!g||(e=runProcessors(f.beforeSend)(e))&&(r.send(e),y("send",!1,e))},destroy:function(){y("beforeDestroy",d=!0)},on:function(e,n){"init"===e&&l||"start"===e&&g||"beforeDestroy"===e&&d?n():f[e]&&f[e].push(n)},off:function(e,n){f[e]&&(f[e]=arrayRemove(f[e],n))}},_=Object.keys(v);return v;function y(e,n){void 0===n&&(n=!1);for(var r=[],t=2;t<arguments.length;t++)r[t-2]=arguments[t];f[e].forEach(function(e){try{e.apply(void 0,__spreadArray([],__read(r),!1))}catch(e){}}),n&&(f[e].length=0)}}var ContextPlugin=function(e){var n=createContextAgent();e.provide("context",n),e.on("report",function(e){return e.extra||(e.extra={}),e.extra.context=n.toString(),e})},withCommandArray=function(i,a,r){function u(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];if(o=e[0]){var r=o.split(".")[0];if(r in u)return safeCall(u,o,[].slice.call(e,1));var t=s[r]||[],o=null!==(o=null==a?void 0:a(i))&&void 0!==o?o:{};t.push(__spreadArray([o],__read(e),!1)),void(s[r]=t)}}var e,s={};for(e in hookObjectProperty(i,"provide",function(r){return function(e,n){u[e]=n,r.call(i,e,n)}})(),i)Object.prototype.hasOwnProperty.call(i,e)&&(u[e]=i[e]);return i.on("provide",function(e){s[e]&&(s[e].forEach(function(e){var n=__read(e),e=n[0],n=n.slice(1);null!=r&&r(i,e,n)}),s[e]=null)}),u};function IntegrationPlugin(r){r.on("init",function(){var n=[],e=r.config();e&&e.integrations&&e.integrations.forEach(function(e){arrayIncludes(n,e.name)||(n.push(e.name),e.setup(r),e.tearDown&&r.on("beforeDestroy",e.tearDown))})})}function SubjectPlugin(e,n){var r=n||{};e.provide("initSubject",function(e){var e=__read(e,2),n=e[0],e=e[1];return r[n]||(r[n]=createSafeObserver(e,function(){r[n]=void 0})),r[n]}),e.provide("getSubject",function(e){return r[e]}),e.provide("privateSubject",{})}var now=function(){return Date.now()};function getDefaultBrowser(){if("object"==typeof window&&isObject(window))return window}function getDefaultLocation(){return getDefaultBrowser()&&window.location}function getDefaultXMLHttpRequest(){if("function"==typeof XMLHttpRequest&&isFunction(XMLHttpRequest))return XMLHttpRequest}function getDefaultNavigator(){if(getDefaultBrowser()&&"navigator"in window)return window.navigator}function getDefaultNetworkInformation(){var e=getDefaultNavigator();if(e)return e.connection||e.mozConnection||e.webkitConnection}function getLocationUrl(){var e=getDefaultBrowser()&&getDefaultLocation();return null==e?void 0:e.href}var getGlobalRegistry=function(e){if(e)return e.__SLARDAR_REGISTRY__||(e.__SLARDAR_REGISTRY__={Slardar:{plugins:[],errors:[],subject:{}}}),e.__SLARDAR_REGISTRY__.Slardar},captureCurrentContext=function(e){var n={url:getLocationUrl(),timestamp:now()},r=e.config();return null!=r&&r.pid&&(n.pid=r.pid),null!=e&&e.context&&(n.context=e.context.toString()),n},syncReportWithCapturedContext=function(r,t){return function(e){function n(e){return e.overrides=t,e}r.on("report",n),e(),r.off("report",n)}},invokeCallbackOnce=function(n){var r=!1;return[function(e){r||(r=!0,n&&n(e))}]},onPageUnload=function(e){var n,r=getDefaultBrowser();r&&(n=__read(invokeCallbackOnce(e),1)[0],["unload","beforeunload","pagehide"].forEach(function(e){r.addEventListener(e,n)}))},getStorageItem=function(e){try{var n=localStorage.getItem(e),r=n;return r=n&&"string"==typeof n?JSON.parse(n):r}catch(e){return}},setStorageItem=function(e,n){try{var r="string"==typeof n?n:JSON.stringify(n);localStorage.setItem(e,r)}catch(e){}};function getNetworkType(e){return(null==e?void 0:e.effectiveType)||(null==e?void 0:e.type)||""}var InjectNetworkTypePlugin=function(e){var n=getDefaultNetworkInformation(),r=getNetworkType(n);n&&(n.onchange=function(){r=getNetworkType(n)}),e.on("report",function(e){return __assign(__assign({},e),{extra:__assign(__assign({},e.extra||{}),{network_type:r})})})},getBeaconTransport=function(){var r=getDefaultBrowser();return r&&r.navigator.sendBeacon?{get:function(){},post:function(e,n){r.navigator.sendBeacon(e,n)}}:{get:noop,post:noop}},request=function(e,n,r){var t=n.url,o=n.data,i=n.success,a=void 0===i?noop:i,i=n.fail,u=void 0===i?noop:i,i=n.getResponseText,s=void 0===i?noop:i,n=n.withCredentials,n=void 0!==n&&n,r=new r;r.withCredentials=n,r.open(e,t,!0),r.setRequestHeader("Content-Type","application/json"),r.onload=function(){null!=s&&s(this.responseText);try{var e;this.responseText?(e=JSON.parse(this.responseText),a(e)):a({})}catch(e){u(e)}},r.onerror=function(){u(new Error("Network request failed"))},r.onabort=function(){u(new Error("Network request aborted"))},r.send(o)},getXhrTransport=function(){var n=getDefaultXMLHttpRequest();return n?{get:function(e){request("GET",e,n)},post:function(e){request("POST",e,n)}}:{get:noop,post:noop}};function createBrowserSender(e){function n(e){t.post(r.getEndpoint(),stringifyBatch([e]))}var r=createBatchSender(e),t=getBeaconTransport();return onPageUnload(function(){var e=r.getBatchData();e&&(t.post(r.getEndpoint(),e),r.clear()),r.send=n}),r}var browserBuilder={build:function(e){return{ev_type:e.ev_type,payload:e.payload,common:__assign(__assign({},e.extra||{}),e.overrides||{})}}};function normalizeInitConfig(e){var n,r=e.plugins||{};for(n in r)r[n]&&!isObject(r[n])&&(r[n]={});return __assign(__assign({},e),{plugins:r})}function validateInitConfig(e){return isObject(e)&&"aid"in e}function normalizeUserConfig(e){return __assign({},e)}function parseServerConfig(e){if(!e)return{};var n=e.sample,r=e.timestamp,t=e.status;if(!n)return{};var o=n.sample_rate,e=n.sample_granularity;return{sample:{include_users:n.include_users,sample_rate:t&&4===t?0:o,sample_granularity:e,rules:n.rules.reduce(function(e,n){var r=n.name,t=n.enable,o=n.sample_rate,n=n.conditional_sample_rules;return e[r]={enable:t,sample_rate:o,conditional_sample_rules:n},e},{})},serverTimestamp:r}}var REPORT_DOMAIN="apmplus.volces.com",SDK_VERSION="2.0.5-alpha.0",SDK_NAME="APM_PLUS_WEB",SETTINGS_PATH="/settings/get/webpro",BATCH_REPORT_PATH="/monitor_web/collect",STORAGE_PREFIX="APMPLUS",DEFAULT_IGNORE_PATHS=[BATCH_REPORT_PATH,SETTINGS_PATH,"/monitor_browser/collect"],DEFAULT_SAMPLE_CONFIG={sample_rate:1,include_users:[],sample_granularity:"session",rules:{}},DEFAULT_SENDER_SIZE=20,getReportUrl=function(e,n){return void 0===n&&(n=BATCH_REPORT_PATH),(e&&0<=e.indexOf("//")?"":"https://")+e+n},getSettingsUrl=function(e,n){return void 0===n&&(n=SETTINGS_PATH),(e&&0<=e.indexOf("//")?"":"https://")+e+n},getViewId=function(e){return e+"_"+Date.now()},getDefaultSessionId=function(){return uuid()},getStorageKey=function(e){return STORAGE_PREFIX+e},getStoreInfo=function(e){e=getStorageKey(e);return getStorageItem(e)||{userId:uuid(),deviceId:uuid(),r:Math.random()}},saveStoreInfo=function(e){var n=e.aid,r=e.userId,t=e.deviceId,e=e.sample,n=getStorageKey(n);setStorageItem(n,{userId:r,deviceId:t,r:e.r})},createBrowserConfigManager=function(n){var r,t,o,i=n,a={},u=noop,s=noop;return{getConfig:function(){return i},setConfig:function(e){return a=__assign(__assign({},a),e||{}),c(),r||(r=e,i.useLocalConfig?(o={},u()):t?f():getServerConfig(i.transport,i.domain,i.aid,function(e){t=e,f()})),i},onChange:function(e){s=e},onReady:function(e){u=function(){!function(){n.userId!==i.userId&&(n.sample.r=Math.random(),c());saveStoreInfo(i)}(),e()},o&&u()}};function c(){var e=__assign(__assign(__assign({},n),o||{}),a);e.plugins=mergeDeepConcatArray(n.plugins,(null==o?void 0:o.plugins)||{},a.plugins||{}),e.sample=mergeSampleConfig(mergeSampleConfig(n.sample,null==o?void 0:o.sample),a.sample),i=e,s()}function f(){o=parseServerConfig(t),c(),u()}};function getServerConfig(e,n,r,t){e.get({withCredentials:!0,url:getSettingsUrl(n)+"?aid="+r,success:function(e){t(e.data||{})},fail:function(){t()}})}function mergeSampleConfig(t,o){if(!t||!o)return t||o;var e=__assign(__assign({},t),o);return e.include_users=__spreadArray(__spreadArray([],__read(t.include_users||[]),!1),__read(o.include_users||[]),!1),e.rules=__spreadArray(__spreadArray([],__read(Object.keys(t.rules||{})),!1),__read(Object.keys(o.rules||{})),!1).reduce(function(e,n){var r;return n in e||(n in(t.rules||{})&&n in(o.rules||{})?(e[n]=__assign(__assign({},t.rules[n]),o.rules[n]),e[n].conditional_sample_rules=__spreadArray(__spreadArray([],__read(t.rules[n].conditional_sample_rules||[]),!1),__read(o.rules[n].conditional_sample_rules||[]),!1)):e[n]=(null===(r=t.rules)||void 0===r?void 0:r[n])||(null===(r=o.rules)||void 0===r?void 0:r[n])),e},{}),e}var addEnvToSendEvent=function(e){var n={url:getLocationUrl(),timestamp:Date.now()};return __assign(__assign({},e),{extra:__assign(__assign({},n),e.extra||{})})},InjectEnvPlugin=function(e){e.on("report",function(e){return addEnvToSendEvent(e)})},MAX_RTT=700,TimeCalibrationPlugin=function(r){var t,o=!1;r.on("init",function(){t=(new Date).getTime(),r.on("config",function(){var e,n=null===(e=r.config())||void 0===e?void 0:e.serverTimestamp;isNaN(n)||Number(n)<=0||o||(o=!0,(e=(new Date).getTime())-t<MAX_RTT&&n&&(e=n-(e+t)/2,!isNaN(e)&&(0<e||e<-6e5)&&r.set({offset:e})))})})},addConfigToReportEvent=function(e,n){var r={};return r.aid=n.aid,r.pid=n.pid,r.view_id=n.viewId,r.user_id=n.userId,__assign(__assign({},e),{extra:__assign(__assign({},r),e.extra||{})})},InjectConfigPlugin=function(n){n.on("beforeBuild",function(e){return addConfigToReportEvent(e,n.config())})},InjectQueryPlugin=function(u){u.on("start",function(){var e=u.config(),n=e.deviceId,r=e.sessionId,t=e.release,o=e.env,i=e.offset,a=e.aid,e=e.token,a={did:n,sid:r,release:t,env:o,sname:SDK_NAME,sversion:SDK_VERSION,soffset:i||0,biz_id:a,x_auth_token:e},e=u.getSender();e.setEndpoint(e.getEndpoint()+joinQueryWithMap(a))})},getDefaultConfig=function(e){e=getStoreInfo(e.aid);return{aid:0,pid:"",token:"",viewId:getViewId("_"),userId:e.userId,deviceId:e.deviceId,sessionId:getDefaultSessionId(),domain:REPORT_DOMAIN,plugins:{ajax:{ignoreUrls:DEFAULT_IGNORE_PATHS},fetch:{ignoreUrls:DEFAULT_IGNORE_PATHS},breadcrumb:{},pageview:{},jsError:{},resource:{},resourceError:{},performance:{},tti:{},fmp:{},blankScreen:!1},release:"",env:"production",sample:__assign(__assign({},DEFAULT_SAMPLE_CONFIG),{r:e.r}),transport:getXhrTransport()}},createMinimalBrowserClient=function(e){var n=void 0===e?{}:e,r=n.createSender,e=n.builder,n=n.createDefaultConfig,t=createClient({validateInitConfig:validateInitConfig,initConfigNormalizer:normalizeInitConfig,userConfigNormalizer:normalizeUserConfig,createSender:void 0===r?function(e){return createBrowserSender({size:DEFAULT_SENDER_SIZE,endpoint:getReportUrl(e.domain),transport:e.transport})}:r,builder:void 0===e?browserBuilder:e,createDefaultConfig:void 0===n?getDefaultConfig:n,createConfigManager:createBrowserConfigManager});ContextPlugin(t);n=getGlobalRegistry(getDefaultBrowser());SubjectPlugin(t,n&&n.subject),TimeCalibrationPlugin(t),InjectConfigPlugin(t),InjectEnvPlugin(t),InjectNetworkTypePlugin(t),InjectQueryPlugin(t);n=withCommandArray(t,captureCurrentContext,function(e,n,r){return syncReportWithCapturedContext(e,n)(function(){var e=__read(r),n=e[0],e=e.slice(1);t[n].apply(t,__spreadArray([],__read(e),!1))})});return IntegrationPlugin(n),n};exports.createMinimalBrowserClient=createMinimalBrowserClient,exports.getDefaultConfig=getDefaultConfig;

@@ -660,6 +660,5 @@ declare type ReportEventFromClient<C extends AnyClient> = C extends {

declare type Cb = (ev: HttpReport) => void;
interface AjaxMonitorConfig {
autoWrap?: boolean;
hookCbAtReq: (t: Cb | undefined) => Cb | undefined;
setContextAtReq: () => (ev: HttpReport) => void;
ignoreUrls: (string | RegExp)[];

@@ -666,0 +665,0 @@ collectBodyOnError: boolean;

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

var __assign=function(){return(__assign=Object.assign||function(e){for(var n,r=1,t=arguments.length;r<t;r++)for(var o in n=arguments[r])Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o]);return e}).apply(this,arguments)};function __read(e,n){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var t,o,i=r.call(e),a=[];try{for(;(void 0===n||0<n--)&&!(t=i.next()).done;)a.push(t.value)}catch(e){o={error:e}}finally{try{t&&!t.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a}function __spreadArray(e,n,r){if(r||2===arguments.length)for(var t,o=0,i=n.length;o<i;o++)!t&&o in n||((t=t||Array.prototype.slice.call(n,0,o))[o]=n[o]);return e.concat(t||Array.prototype.slice.call(n))}var DEFAULT_SIZE=10,DEFAULT_WAIT=1e3,stringifyBatch=function(e){return JSON.stringify({ev_type:"batch",list:e})};function createBatchSender(e){var r,t=e.transport,o=e.endpoint,n=e.size,i=void 0===n?DEFAULT_SIZE:n,e=e.wait,a=void 0===e?DEFAULT_WAIT:e,u=[],s=0;function c(){var n;u.length&&(n=this.getBatchData(),t.post({url:o,data:n,fail:function(e){r&&r(e,n)}}),u=[])}return{getSize:function(){return i},getWait:function(){return a},setSize:function(e){i=e},setWait:function(e){a=e},getEndpoint:function(){return o},setEndpoint:function(e){o=e},send:function(e){u.push(e),u.length>=i&&c.call(this),clearTimeout(s),s=setTimeout(c.bind(this),a)},flush:function(){clearTimeout(s),c.call(this)},getBatchData:function(){return u.length?stringifyBatch(u):""},clear:function(){clearTimeout(s),u=[]},fail:function(e){r=e}}}var EVENTS=["init","start","config","beforeDestroy","provide","beforeReport","report","beforeBuild","build","beforeSend","send","beforeConfig"],noop=function(){return{}};function isObject(e){return"object"==typeof e&&null!==e}var objProto=Object.prototype;function isPlainObject(e){if(isObject(e)){if("function"!=typeof Object.getPrototypeOf)return"[object Object]"===objProto.toString.call(e);e=Object.getPrototypeOf(e);return e===objProto||null===e}return!1}function isArray(e){return"[object Array]"===objProto.toString.call(e)}function isFunction(e){return"function"==typeof e}function isString(e){return"string"==typeof e}function hasKey(e,n){return Object.prototype.hasOwnProperty.call(e,n)}function mergeDeepConcatArray(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];for(var r={},t=0;t<e.length;)r=_mergeDeepMergeArray(r,e[t++]);return r}function _mergeDeepMergeArray(e,n){var r,t=__assign({},e);for(r in n)hasKey(n,r)&&void 0!==n[r]&&(isObject(n[r])&&isPlainObject(n[r])?t[r]=_mergeDeepMergeArray(isObject(e[r])?e[r]:{},n[r]):isArray(n[r])&&isArray(e[r])?t[r]=_mergeDeepArray(e[r],n[r]):t[r]=n[r]);return t}function _mergeDeepArray(e,n){e=isArray(e)?e:[],n=isArray(n)?n:[];return Array.prototype.concat.call(e,n).map(function(e){return e instanceof RegExp?e:isObject(e)&&isPlainObject(e)?_mergeDeepMergeArray({},e):isArray(e)?_mergeDeepArray([],e):e})}function arrayIncludes(e,n){if(!isArray(e))return!1;if(0===e.length)return!1;for(var r=0;r<e.length;){if(e[r]===n)return!0;r++}return!1}var arrayRemove=function(e,n){if(!isArray(e))return e;var r=e.indexOf(n);if(0<=r){n=e.slice();return n.splice(r,1),n}return e},safeVisit=function(e,n,r){for(var t,n=__read(n.split(".")),o=n[0],i=n.slice(1);e&&0<i.length;)e=e[o],o=(t=__read(i))[0],i=t.slice(1);if(e)return r(e,o)},safeCall=function(e,n,r){return safeVisit(e,n,function(e,n){if(e&&n in e&&isFunction(e[n]))try{return e[n].apply(e,r)}catch(e){return}})};function safeStringify(e){try{return isString(e)?e:JSON.stringify(e)}catch(e){return"[FAILED_TO_STRINGIFY]:"+String(e)}}var joinQueryWithMap=function(r){return isObject(r)?Object.keys(r).reduce(function(e,n){return e+="&"+n+"="+r[n]},"").replace("&","?"):""};function createContextAgent(){var r={},t={},o={set:function(e,n){return r[e]=n,t[e]=safeStringify(n),o},merge:function(n){return r=__assign(__assign({},r),n),Object.keys(n).forEach(function(e){t[e]=safeStringify(n[e])}),o},delete:function(e){return delete r[e],delete t[e],o},clear:function(){return r={},t={},o},get:function(e){return t[e]},toString:function(){return __assign({},t)}};return o}var hookObjectProperty=function(i,a,u,s){return void 0===s&&(s=!0),function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];if(!i)return noop;var r=i[a],t=u.apply(void 0,__spreadArray([r],__read(e),!1)),o=t;return isFunction(o)&&s&&(o=function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];try{return t.apply(this,n)}catch(e){return isFunction(r)&&r.apply(this,n)}}),i[a]=o,function(e){e||(o===i[a]?i[a]=r:t=r)}}},errCount=0,error=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];console.error.apply(console,__spreadArray(["[SDK]",Date.now(),(""+errCount++).padStart(8," ")],__read(e),!1))},warnCount=0,warn=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];console.warn.apply(console,__spreadArray(["[SDK]",Date.now(),(""+warnCount++).padStart(8," ")],__read(e),!1))},runProcessors=function(t){return function(e){for(var n=e,r=0;r<t.length&&n;r++)try{n=t[r](n)}catch(e){error(e)}return n}};function mathRNG(){for(var e=new Array(16),n=0,r=0;r<16;r++)0==(3&r)&&(n=4294967296*Math.random()),e[r]=n>>>((3&r)<<3)&255;return e}function bytesToUuid(e){for(var n=[],r=0;r<256;++r)n[r]=(r+256).toString(16).substr(1);var t=0,o=n;return[o[e[t++]],o[e[t++]],o[e[t++]],o[e[t++]],"-",o[e[t++]],o[e[t++]],"-",o[e[t++]],o[e[t++]],"-",o[e[t++]],o[e[t++]],"-",o[e[t++]],o[e[t++]],o[e[t++]],o[e[t++]],o[e[+t]],o[e[15]]].join("")}function uuid(){var e=mathRNG();return e[6]=15&e[6]|64,e[8]=63&e[8]|128,bytesToUuid(e)}var BUFFER_TIME=3e5,applyBufferTimer=function(e,n,r){var t=0;return-1===r?noop:function(){if(e())return t&&clearTimeout(t),void(t=0);0===t&&(t=setTimeout(n,r))}},nextLink=function(t,e){var n=[];try{n=e.reduce(function(e,n){try{var r=n(t);"function"==typeof r&&e.push(r)}catch(e){}return e},[])}catch(e){}return function(e){return nextLink(e,n)}},toObservable=function(e){function n(e){t=arrayRemove(t,e),i||a()}var r,t=[],o=[],i=!1,a=applyBufferTimer(function(){return!!t.length},function(){i=!0,r&&r[0](),o.forEach(function(e){return e()}),o.length=0,r=void 0},e=void 0===e?BUFFER_TIME:e);return{next:function(e){return nextLink(e,t)},complete:function(e){o.push(e)},attach:function(e,n){r=[e,n]},subscribe:function(e){if(i)throw new Error("Observer is closed");return t.push(e),r&&r[1]&&r[1](e),a(),function(){return n(e)}},unsubscribe:n}},createSafeObserver=function(e,n,r){r=toObservable(r);try{e(r.next,r.attach),n&&r.complete(n)}catch(e){}return[r.subscribe,r.unsubscribe]};function createClient(e){var r,t,n=e.builder,o=e.createSender,i=e.createDefaultConfig,a=e.createConfigManager,u=e.userConfigNormalizer,s=e.initConfigNormalizer,c=e.validateInitConfig,f={};EVENTS.forEach(function(e){return f[e]=[]});var l=!1,g=!1,d=!1,p=[],_=[],v={getBuilder:function(){return n},getSender:function(){return r},getPreStartQueue:function(){return p},init:function(e){if(l)warn("already inited");else{if(!(e&&isObject(e)&&c(e)))throw new Error("invalid InitConfig, init failed");var n=i(e);if(!n)throw new Error("defaultConfig missing");e=s(e);if((t=a(n)).setConfig(e),t.onChange(function(){y("config")}),!(r=o(t.getConfig())))throw new Error("sender missing");y("init",l=!0)}},set:function(e){l&&e&&isObject(e)&&(y("beforeConfig",!1,e),null!=t&&t.setConfig(e))},config:function(e){if(l)return e&&isObject(e)&&(y("beforeConfig",!1,e),null!=t&&t.setConfig(u(e))),null==t?void 0:t.getConfig()},provide:function(e,n){arrayIncludes(_,e)?warn("cannot provide "+e+", reserved"):(v[e]=n,y("provide",!1,e))},start:function(){var n=this;l&&(g||null!=t&&t.onReady(function(){y("start",g=!0),p.forEach(function(e){return n.build(e)}),p=[]}))},report:function(e){e&&(!(e=runProcessors(f.beforeReport)(e))||(e=runProcessors(f.report)(e))&&(g?this.build(e):p.push(e)))},build:function(e){!g||(e=runProcessors(f.beforeBuild)(e))&&(!(e=n.build(e))||(e=runProcessors(f.build)(e))&&this.send(e))},send:function(e){!g||(e=runProcessors(f.beforeSend)(e))&&(r.send(e),y("send",!1,e))},destroy:function(){y("beforeDestroy",d=!0)},on:function(e,n){"init"===e&&l||"start"===e&&g||"beforeDestroy"===e&&d?n():f[e]&&f[e].push(n)},off:function(e,n){f[e]&&(f[e]=arrayRemove(f[e],n))}},_=Object.keys(v);return v;function y(e,n){void 0===n&&(n=!1);for(var r=[],t=2;t<arguments.length;t++)r[t-2]=arguments[t];f[e].forEach(function(e){try{e.apply(void 0,__spreadArray([],__read(r),!1))}catch(e){}}),n&&(f[e].length=0)}}var ContextPlugin=function(e){var n=createContextAgent();e.provide("context",n),e.on("report",function(e){return e.extra||(e.extra={}),e.extra.context=n.toString(),e})},withCommandArray=function(i,a,r){function u(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];if(o=e[0]){var r=o.split(".")[0];if(r in u)return safeCall(u,o,[].slice.call(e,1));var t=s[r]||[],o=null!==(o=null==a?void 0:a(i))&&void 0!==o?o:{};t.push(__spreadArray([o],__read(e),!1)),void(s[r]=t)}}var e,s={};for(e in hookObjectProperty(i,"provide",function(r){return function(e,n){u[e]=n,r.call(i,e,n)}})(),i)Object.prototype.hasOwnProperty.call(i,e)&&(u[e]=i[e]);return i.on("provide",function(e){s[e]&&(s[e].forEach(function(e){var n=__read(e),e=n[0],n=n.slice(1);null!=r&&r(i,e,n)}),s[e]=null)}),u};function IntegrationPlugin(r){r.on("init",function(){var n=[],e=r.config();e&&e.integrations&&e.integrations.forEach(function(e){arrayIncludes(n,e.name)||(n.push(e.name),e.setup(r),e.tearDown&&r.on("beforeDestroy",e.tearDown))})})}function SubjectPlugin(e,n){var r=n||{};e.provide("initSubject",function(e){var e=__read(e,2),n=e[0],e=e[1];return r[n]||(r[n]=createSafeObserver(e,function(){r[n]=void 0})),r[n]}),e.provide("getSubject",function(e){return r[e]}),e.provide("privateSubject",{})}function getDefaultBrowser(){if("object"==typeof window&&isObject(window))return window}function getDefaultLocation(){return getDefaultBrowser()&&window.location}function getDefaultXMLHttpRequest(){if("function"==typeof XMLHttpRequest&&isFunction(XMLHttpRequest))return XMLHttpRequest}function getDefaultNavigator(){if(getDefaultBrowser()&&"navigator"in window)return window.navigator}function getDefaultNetworkInformation(){var e=getDefaultNavigator();if(e)return e.connection||e.mozConnection||e.webkitConnection}var getGlobalRegistry=function(e){if(e)return e.__SLARDAR_REGISTRY__||(e.__SLARDAR_REGISTRY__={Slardar:{plugins:[],errors:[],subject:{}}}),e.__SLARDAR_REGISTRY__.Slardar},now=function(){return Date.now()};function getLocationUrl(){var e=getDefaultBrowser()&&getDefaultLocation();return null==e?void 0:e.href}var captureCurrentContext=function(e){var n={url:getLocationUrl(),timestamp:now()},r=e.config();return null!=r&&r.pid&&(n.pid=r.pid),null!=e&&e.context&&(n.context=e.context.toString()),n},syncReportWithCapturedContext=function(r,t){return function(e){function n(e){return e.overrides=t,e}r.on("report",n),e(),r.off("report",n)}},invokeCallbackOnce=function(n){var r=!1;return[function(e){r||(r=!0,n&&n(e))}]},onPageUnload=function(e){var n,r=getDefaultBrowser();r&&(n=__read(invokeCallbackOnce(e),1)[0],["unload","beforeunload","pagehide"].forEach(function(e){r.addEventListener(e,n)}))},getStorageItem=function(e){try{var n=localStorage.getItem(e),r=n;return r=n&&"string"==typeof n?JSON.parse(n):r}catch(e){return}},setStorageItem=function(e,n){try{var r="string"==typeof n?n:JSON.stringify(n);localStorage.setItem(e,r)}catch(e){}};function getNetworkType(e){return(null==e?void 0:e.effectiveType)||(null==e?void 0:e.type)||""}var InjectNetworkTypePlugin=function(e){var n=getDefaultNetworkInformation(),r=getNetworkType(n);n&&(n.onchange=function(){r=getNetworkType(n)}),e.on("report",function(e){return __assign(__assign({},e),{extra:__assign(__assign({},e.extra||{}),{network_type:r})})})},getBeaconTransport=function(){var r=getDefaultBrowser();return r&&r.navigator.sendBeacon?{get:function(){},post:function(e,n){r.navigator.sendBeacon(e,n)}}:{get:noop,post:noop}},request=function(e,n,r){var t=n.url,o=n.data,i=n.success,a=void 0===i?noop:i,i=n.fail,u=void 0===i?noop:i,i=n.getResponseText,s=void 0===i?noop:i,n=n.withCredentials,n=void 0!==n&&n,r=new r;r.withCredentials=n,r.open(e,t,!0),r.setRequestHeader("Content-Type","application/json"),r.onload=function(){null!=s&&s(this.responseText);try{var e;this.responseText?(e=JSON.parse(this.responseText),a(e)):a({})}catch(e){u(e)}},r.onerror=function(){u(new Error("Network request failed"))},r.onabort=function(){u(new Error("Network request aborted"))},r.send(o)},getXhrTransport=function(){var n=getDefaultXMLHttpRequest();return n?{get:function(e){request("GET",e,n)},post:function(e){request("POST",e,n)}}:{get:noop,post:noop}};function createBrowserSender(e){function n(e){t.post(r.getEndpoint(),stringifyBatch([e]))}var r=createBatchSender(e),t=getBeaconTransport();return onPageUnload(function(){var e=r.getBatchData();e&&(t.post(r.getEndpoint(),e),r.clear()),r.send=n}),r}var browserBuilder={build:function(e){return{ev_type:e.ev_type,payload:e.payload,common:__assign(__assign({},e.extra||{}),e.overrides||{})}}};function normalizeInitConfig(e){var n,r=e.plugins||{};for(n in r)r[n]&&!isObject(r[n])&&(r[n]={});return __assign(__assign({},e),{plugins:r})}function validateInitConfig(e){return isObject(e)&&"aid"in e}function normalizeUserConfig(e){return __assign({},e)}function parseServerConfig(e){if(!e)return{};var n=e.sample,r=e.timestamp,t=e.status;if(!n)return{};var o=n.sample_rate,e=n.sample_granularity;return{sample:{include_users:n.include_users,sample_rate:t&&4===t?0:o,sample_granularity:e,rules:n.rules.reduce(function(e,n){var r=n.name,t=n.enable,o=n.sample_rate,n=n.conditional_sample_rules;return e[r]={enable:t,sample_rate:o,conditional_sample_rules:n},e},{})},serverTimestamp:r}}var REPORT_DOMAIN="apmplus.volces.com",SDK_VERSION="2.0.4",SDK_NAME="APM_PLUS_WEB",SETTINGS_PATH="/settings/get/webpro",BATCH_REPORT_PATH="/monitor_web/collect",STORAGE_PREFIX="APMPLUS",DEFAULT_IGNORE_PATHS=[BATCH_REPORT_PATH,SETTINGS_PATH,"/monitor_browser/collect"],DEFAULT_SAMPLE_CONFIG={sample_rate:1,include_users:[],sample_granularity:"session",rules:{}},DEFAULT_SENDER_SIZE=20,getReportUrl=function(e,n){return void 0===n&&(n=BATCH_REPORT_PATH),(e&&0<=e.indexOf("//")?"":"https://")+e+n},getSettingsUrl=function(e,n){return void 0===n&&(n=SETTINGS_PATH),(e&&0<=e.indexOf("//")?"":"https://")+e+n},getViewId=function(e){return e+"_"+Date.now()},getDefaultSessionId=function(){return uuid()},getStorageKey=function(e){return STORAGE_PREFIX+e},getStoreInfo=function(e){e=getStorageKey(e);return getStorageItem(e)||{userId:uuid(),deviceId:uuid(),r:Math.random()}},saveStoreInfo=function(e){var n=e.aid,r=e.userId,t=e.deviceId,e=e.sample,n=getStorageKey(n);setStorageItem(n,{userId:r,deviceId:t,r:e.r})},createBrowserConfigManager=function(n){var r,t,o,i=n,a={},u=noop,s=noop;return{getConfig:function(){return i},setConfig:function(e){return a=__assign(__assign({},a),e||{}),c(),r||(r=e,i.useLocalConfig?(o={},u()):t?f():getServerConfig(i.transport,i.domain,i.aid,function(e){t=e,f()})),i},onChange:function(e){s=e},onReady:function(e){u=function(){!function(){n.userId!==i.userId&&(n.sample.r=Math.random(),c());saveStoreInfo(i)}(),e()},o&&u()}};function c(){var e=__assign(__assign(__assign({},n),o||{}),a);e.plugins=mergeDeepConcatArray(n.plugins,(null==o?void 0:o.plugins)||{},a.plugins||{}),e.sample=mergeSampleConfig(mergeSampleConfig(n.sample,null==o?void 0:o.sample),a.sample),i=e,s()}function f(){o=parseServerConfig(t),c(),u()}};function getServerConfig(e,n,r,t){e.get({withCredentials:!0,url:getSettingsUrl(n)+"?aid="+r,success:function(e){t(e.data||{})},fail:function(){t()}})}function mergeSampleConfig(t,o){if(!t||!o)return t||o;var e=__assign(__assign({},t),o);return e.include_users=__spreadArray(__spreadArray([],__read(t.include_users||[]),!1),__read(o.include_users||[]),!1),e.rules=__spreadArray(__spreadArray([],__read(Object.keys(t.rules||{})),!1),__read(Object.keys(o.rules||{})),!1).reduce(function(e,n){var r;return n in e||(n in(t.rules||{})&&n in(o.rules||{})?(e[n]=__assign(__assign({},t.rules[n]),o.rules[n]),e[n].conditional_sample_rules=__spreadArray(__spreadArray([],__read(t.rules[n].conditional_sample_rules||[]),!1),__read(o.rules[n].conditional_sample_rules||[]),!1)):e[n]=(null===(r=t.rules)||void 0===r?void 0:r[n])||(null===(r=o.rules)||void 0===r?void 0:r[n])),e},{}),e}var addEnvToSendEvent=function(e){var n={url:getLocationUrl(),timestamp:Date.now()};return __assign(__assign({},e),{extra:__assign(__assign({},n),e.extra||{})})},InjectEnvPlugin=function(e){e.on("report",function(e){return addEnvToSendEvent(e)})},MAX_RTT=700,TimeCalibrationPlugin=function(r){var t,o=!1;r.on("init",function(){t=(new Date).getTime(),r.on("config",function(){var e,n=null===(e=r.config())||void 0===e?void 0:e.serverTimestamp;isNaN(n)||Number(n)<=0||o||(o=!0,(e=(new Date).getTime())-t<MAX_RTT&&n&&(e=n-(e+t)/2,!isNaN(e)&&(0<e||e<-6e5)&&r.set({offset:e})))})})},addConfigToReportEvent=function(e,n){var r={};return r.aid=n.aid,r.pid=n.pid,r.view_id=n.viewId,r.user_id=n.userId,__assign(__assign({},e),{extra:__assign(__assign({},r),e.extra||{})})},InjectConfigPlugin=function(n){n.on("beforeBuild",function(e){return addConfigToReportEvent(e,n.config())})},InjectQueryPlugin=function(u){u.on("start",function(){var e=u.config(),n=e.deviceId,r=e.sessionId,t=e.release,o=e.env,i=e.offset,a=e.aid,e=e.token,a={did:n,sid:r,release:t,env:o,sname:SDK_NAME,sversion:SDK_VERSION,soffset:i||0,biz_id:a,x_auth_token:e},e=u.getSender();e.setEndpoint(e.getEndpoint()+joinQueryWithMap(a))})},getDefaultConfig=function(e){e=getStoreInfo(e.aid);return{aid:0,pid:"",token:"",viewId:getViewId("_"),userId:e.userId,deviceId:e.deviceId,sessionId:getDefaultSessionId(),domain:REPORT_DOMAIN,plugins:{ajax:{ignoreUrls:DEFAULT_IGNORE_PATHS},fetch:{ignoreUrls:DEFAULT_IGNORE_PATHS},breadcrumb:{},pageview:{},jsError:{},resource:{},resourceError:{},performance:{},tti:{},fmp:{},blankScreen:!1},release:"",env:"production",sample:__assign(__assign({},DEFAULT_SAMPLE_CONFIG),{r:e.r}),transport:getXhrTransport()}},createMinimalBrowserClient=function(e){var n=void 0===e?{}:e,r=n.createSender,e=n.builder,n=n.createDefaultConfig,t=createClient({validateInitConfig:validateInitConfig,initConfigNormalizer:normalizeInitConfig,userConfigNormalizer:normalizeUserConfig,createSender:void 0===r?function(e){return createBrowserSender({size:DEFAULT_SENDER_SIZE,endpoint:getReportUrl(e.domain),transport:e.transport})}:r,builder:void 0===e?browserBuilder:e,createDefaultConfig:void 0===n?getDefaultConfig:n,createConfigManager:createBrowserConfigManager});ContextPlugin(t);n=getGlobalRegistry(getDefaultBrowser());SubjectPlugin(t,n&&n.subject),TimeCalibrationPlugin(t),InjectConfigPlugin(t),InjectEnvPlugin(t),InjectNetworkTypePlugin(t),InjectQueryPlugin(t);n=withCommandArray(t,captureCurrentContext,function(e,n,r){return syncReportWithCapturedContext(e,n)(function(){var e=__read(r),n=e[0],e=e.slice(1);t[n].apply(t,__spreadArray([],__read(e),!1))})});return IntegrationPlugin(n),n};export{createMinimalBrowserClient,getDefaultConfig};
var __assign=function(){return(__assign=Object.assign||function(e){for(var n,r=1,t=arguments.length;r<t;r++)for(var o in n=arguments[r])Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o]);return e}).apply(this,arguments)};function __read(e,n){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var t,o,i=r.call(e),a=[];try{for(;(void 0===n||0<n--)&&!(t=i.next()).done;)a.push(t.value)}catch(e){o={error:e}}finally{try{t&&!t.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a}function __spreadArray(e,n,r){if(r||2===arguments.length)for(var t,o=0,i=n.length;o<i;o++)!t&&o in n||((t=t||Array.prototype.slice.call(n,0,o))[o]=n[o]);return e.concat(t||Array.prototype.slice.call(n))}var DEFAULT_SIZE=10,DEFAULT_WAIT=1e3,stringifyBatch=function(e){return JSON.stringify({ev_type:"batch",list:e})};function createBatchSender(e){var r,t=e.transport,o=e.endpoint,n=e.size,i=void 0===n?DEFAULT_SIZE:n,e=e.wait,a=void 0===e?DEFAULT_WAIT:e,u=[],s=0;function c(){var n;u.length&&(n=this.getBatchData(),t.post({url:o,data:n,fail:function(e){r&&r(e,n)}}),u=[])}return{getSize:function(){return i},getWait:function(){return a},setSize:function(e){i=e},setWait:function(e){a=e},getEndpoint:function(){return o},setEndpoint:function(e){o=e},send:function(e){u.push(e),u.length>=i&&c.call(this),clearTimeout(s),s=setTimeout(c.bind(this),a)},flush:function(){clearTimeout(s),c.call(this)},getBatchData:function(){return u.length?stringifyBatch(u):""},clear:function(){clearTimeout(s),u=[]},fail:function(e){r=e}}}var EVENTS=["init","start","config","beforeDestroy","provide","beforeReport","report","beforeBuild","build","beforeSend","send","beforeConfig"],noop=function(){return{}};function isObject(e){return"object"==typeof e&&null!==e}var objProto=Object.prototype;function isPlainObject(e){if(isObject(e)){if("function"!=typeof Object.getPrototypeOf)return"[object Object]"===objProto.toString.call(e);e=Object.getPrototypeOf(e);return e===objProto||null===e}return!1}function isArray(e){return"[object Array]"===objProto.toString.call(e)}function isFunction(e){return"function"==typeof e}function isString(e){return"string"==typeof e}function hasKey(e,n){return Object.prototype.hasOwnProperty.call(e,n)}function mergeDeepConcatArray(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];for(var r={},t=0;t<e.length;)r=_mergeDeepMergeArray(r,e[t++]);return r}function _mergeDeepMergeArray(e,n){var r,t=__assign({},e);for(r in n)hasKey(n,r)&&void 0!==n[r]&&(isObject(n[r])&&isPlainObject(n[r])?t[r]=_mergeDeepMergeArray(isObject(e[r])?e[r]:{},n[r]):isArray(n[r])&&isArray(e[r])?t[r]=_mergeDeepArray(e[r],n[r]):t[r]=n[r]);return t}function _mergeDeepArray(e,n){e=isArray(e)?e:[],n=isArray(n)?n:[];return Array.prototype.concat.call(e,n).map(function(e){return e instanceof RegExp?e:isObject(e)&&isPlainObject(e)?_mergeDeepMergeArray({},e):isArray(e)?_mergeDeepArray([],e):e})}function arrayIncludes(e,n){if(!isArray(e))return!1;if(0===e.length)return!1;for(var r=0;r<e.length;){if(e[r]===n)return!0;r++}return!1}var arrayRemove=function(e,n){if(!isArray(e))return e;var r=e.indexOf(n);if(0<=r){n=e.slice();return n.splice(r,1),n}return e},safeVisit=function(e,n,r){for(var t,n=__read(n.split(".")),o=n[0],i=n.slice(1);e&&0<i.length;)e=e[o],o=(t=__read(i))[0],i=t.slice(1);if(e)return r(e,o)},safeCall=function(e,n,r){return safeVisit(e,n,function(e,n){if(e&&n in e&&isFunction(e[n]))try{return e[n].apply(e,r)}catch(e){return}})};function safeStringify(e){try{return isString(e)?e:JSON.stringify(e)}catch(e){return"[FAILED_TO_STRINGIFY]:"+String(e)}}var joinQueryWithMap=function(r){return isObject(r)?Object.keys(r).reduce(function(e,n){return e+="&"+n+"="+r[n]},"").replace("&","?"):""};function createContextAgent(){var r={},t={},o={set:function(e,n){return r[e]=n,t[e]=safeStringify(n),o},merge:function(n){return r=__assign(__assign({},r),n),Object.keys(n).forEach(function(e){t[e]=safeStringify(n[e])}),o},delete:function(e){return delete r[e],delete t[e],o},clear:function(){return r={},t={},o},get:function(e){return t[e]},toString:function(){return __assign({},t)}};return o}var hookObjectProperty=function(i,a,u,s){return void 0===s&&(s=!0),function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];if(!i)return noop;var r=i[a],t=u.apply(void 0,__spreadArray([r],__read(e),!1)),o=t;return isFunction(o)&&s&&(o=function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];try{return t.apply(this,n)}catch(e){return isFunction(r)&&r.apply(this,n)}}),i[a]=o,function(e){e||(o===i[a]?i[a]=r:t=r)}}},errCount=0,error=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];console.error.apply(console,__spreadArray(["[SDK]",Date.now(),(""+errCount++).padStart(8," ")],__read(e),!1))},warnCount=0,warn=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];console.warn.apply(console,__spreadArray(["[SDK]",Date.now(),(""+warnCount++).padStart(8," ")],__read(e),!1))},runProcessors=function(t){return function(e){for(var n=e,r=0;r<t.length&&n;r++)try{n=t[r](n)}catch(e){error(e)}return n}};function mathRNG(){for(var e=new Array(16),n=0,r=0;r<16;r++)0==(3&r)&&(n=4294967296*Math.random()),e[r]=n>>>((3&r)<<3)&255;return e}function bytesToUuid(e){for(var n=[],r=0;r<256;++r)n[r]=(r+256).toString(16).substr(1);var t=0,o=n;return[o[e[t++]],o[e[t++]],o[e[t++]],o[e[t++]],"-",o[e[t++]],o[e[t++]],"-",o[e[t++]],o[e[t++]],"-",o[e[t++]],o[e[t++]],"-",o[e[t++]],o[e[t++]],o[e[t++]],o[e[t++]],o[e[+t]],o[e[15]]].join("")}function uuid(){var e=mathRNG();return e[6]=15&e[6]|64,e[8]=63&e[8]|128,bytesToUuid(e)}var BUFFER_TIME=3e5,applyBufferTimer=function(e,n,r){var t=0;return-1===r?noop:function(){if(e())return t&&clearTimeout(t),void(t=0);0===t&&(t=setTimeout(n,r))}},nextLink=function(t,e){var n=[];try{n=e.reduce(function(e,n){try{var r=n(t);"function"==typeof r&&e.push(r)}catch(e){}return e},[])}catch(e){}return function(e){return nextLink(e,n)}},toObservable=function(e){function n(e){t=arrayRemove(t,e),i||a()}var r,t=[],o=[],i=!1,a=applyBufferTimer(function(){return!!t.length},function(){i=!0,r&&r[0](),o.forEach(function(e){return e()}),o.length=0,r=void 0},e=void 0===e?BUFFER_TIME:e);return{next:function(e){return nextLink(e,t)},complete:function(e){o.push(e)},attach:function(e,n){r=[e,n]},subscribe:function(e){if(i)throw new Error("Observer is closed");return t.push(e),r&&r[1]&&r[1](e),a(),function(){return n(e)}},unsubscribe:n}},createSafeObserver=function(e,n,r){r=toObservable(r);try{e(r.next,r.attach),n&&r.complete(n)}catch(e){}return[r.subscribe,r.unsubscribe]};function createClient(e){var r,t,n=e.builder,o=e.createSender,i=e.createDefaultConfig,a=e.createConfigManager,u=e.userConfigNormalizer,s=e.initConfigNormalizer,c=e.validateInitConfig,f={};EVENTS.forEach(function(e){return f[e]=[]});var l=!1,g=!1,d=!1,p=[],_=[],v={getBuilder:function(){return n},getSender:function(){return r},getPreStartQueue:function(){return p},init:function(e){if(l)warn("already inited");else{if(!(e&&isObject(e)&&c(e)))throw new Error("invalid InitConfig, init failed");var n=i(e);if(!n)throw new Error("defaultConfig missing");e=s(e);if((t=a(n)).setConfig(e),t.onChange(function(){y("config")}),!(r=o(t.getConfig())))throw new Error("sender missing");y("init",l=!0)}},set:function(e){l&&e&&isObject(e)&&(y("beforeConfig",!1,e),null!=t&&t.setConfig(e))},config:function(e){if(l)return e&&isObject(e)&&(y("beforeConfig",!1,e),null!=t&&t.setConfig(u(e))),null==t?void 0:t.getConfig()},provide:function(e,n){arrayIncludes(_,e)?warn("cannot provide "+e+", reserved"):(v[e]=n,y("provide",!1,e))},start:function(){var n=this;l&&(g||null!=t&&t.onReady(function(){y("start",g=!0),p.forEach(function(e){return n.build(e)}),p=[]}))},report:function(e){e&&(!(e=runProcessors(f.beforeReport)(e))||(e=runProcessors(f.report)(e))&&(g?this.build(e):p.push(e)))},build:function(e){!g||(e=runProcessors(f.beforeBuild)(e))&&(!(e=n.build(e))||(e=runProcessors(f.build)(e))&&this.send(e))},send:function(e){!g||(e=runProcessors(f.beforeSend)(e))&&(r.send(e),y("send",!1,e))},destroy:function(){y("beforeDestroy",d=!0)},on:function(e,n){"init"===e&&l||"start"===e&&g||"beforeDestroy"===e&&d?n():f[e]&&f[e].push(n)},off:function(e,n){f[e]&&(f[e]=arrayRemove(f[e],n))}},_=Object.keys(v);return v;function y(e,n){void 0===n&&(n=!1);for(var r=[],t=2;t<arguments.length;t++)r[t-2]=arguments[t];f[e].forEach(function(e){try{e.apply(void 0,__spreadArray([],__read(r),!1))}catch(e){}}),n&&(f[e].length=0)}}var ContextPlugin=function(e){var n=createContextAgent();e.provide("context",n),e.on("report",function(e){return e.extra||(e.extra={}),e.extra.context=n.toString(),e})},withCommandArray=function(i,a,r){function u(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];if(o=e[0]){var r=o.split(".")[0];if(r in u)return safeCall(u,o,[].slice.call(e,1));var t=s[r]||[],o=null!==(o=null==a?void 0:a(i))&&void 0!==o?o:{};t.push(__spreadArray([o],__read(e),!1)),void(s[r]=t)}}var e,s={};for(e in hookObjectProperty(i,"provide",function(r){return function(e,n){u[e]=n,r.call(i,e,n)}})(),i)Object.prototype.hasOwnProperty.call(i,e)&&(u[e]=i[e]);return i.on("provide",function(e){s[e]&&(s[e].forEach(function(e){var n=__read(e),e=n[0],n=n.slice(1);null!=r&&r(i,e,n)}),s[e]=null)}),u};function IntegrationPlugin(r){r.on("init",function(){var n=[],e=r.config();e&&e.integrations&&e.integrations.forEach(function(e){arrayIncludes(n,e.name)||(n.push(e.name),e.setup(r),e.tearDown&&r.on("beforeDestroy",e.tearDown))})})}function SubjectPlugin(e,n){var r=n||{};e.provide("initSubject",function(e){var e=__read(e,2),n=e[0],e=e[1];return r[n]||(r[n]=createSafeObserver(e,function(){r[n]=void 0})),r[n]}),e.provide("getSubject",function(e){return r[e]}),e.provide("privateSubject",{})}var now=function(){return Date.now()};function getDefaultBrowser(){if("object"==typeof window&&isObject(window))return window}function getDefaultLocation(){return getDefaultBrowser()&&window.location}function getDefaultXMLHttpRequest(){if("function"==typeof XMLHttpRequest&&isFunction(XMLHttpRequest))return XMLHttpRequest}function getDefaultNavigator(){if(getDefaultBrowser()&&"navigator"in window)return window.navigator}function getDefaultNetworkInformation(){var e=getDefaultNavigator();if(e)return e.connection||e.mozConnection||e.webkitConnection}function getLocationUrl(){var e=getDefaultBrowser()&&getDefaultLocation();return null==e?void 0:e.href}var getGlobalRegistry=function(e){if(e)return e.__SLARDAR_REGISTRY__||(e.__SLARDAR_REGISTRY__={Slardar:{plugins:[],errors:[],subject:{}}}),e.__SLARDAR_REGISTRY__.Slardar},captureCurrentContext=function(e){var n={url:getLocationUrl(),timestamp:now()},r=e.config();return null!=r&&r.pid&&(n.pid=r.pid),null!=e&&e.context&&(n.context=e.context.toString()),n},syncReportWithCapturedContext=function(r,t){return function(e){function n(e){return e.overrides=t,e}r.on("report",n),e(),r.off("report",n)}},invokeCallbackOnce=function(n){var r=!1;return[function(e){r||(r=!0,n&&n(e))}]},onPageUnload=function(e){var n,r=getDefaultBrowser();r&&(n=__read(invokeCallbackOnce(e),1)[0],["unload","beforeunload","pagehide"].forEach(function(e){r.addEventListener(e,n)}))},getStorageItem=function(e){try{var n=localStorage.getItem(e),r=n;return r=n&&"string"==typeof n?JSON.parse(n):r}catch(e){return}},setStorageItem=function(e,n){try{var r="string"==typeof n?n:JSON.stringify(n);localStorage.setItem(e,r)}catch(e){}};function getNetworkType(e){return(null==e?void 0:e.effectiveType)||(null==e?void 0:e.type)||""}var InjectNetworkTypePlugin=function(e){var n=getDefaultNetworkInformation(),r=getNetworkType(n);n&&(n.onchange=function(){r=getNetworkType(n)}),e.on("report",function(e){return __assign(__assign({},e),{extra:__assign(__assign({},e.extra||{}),{network_type:r})})})},getBeaconTransport=function(){var r=getDefaultBrowser();return r&&r.navigator.sendBeacon?{get:function(){},post:function(e,n){r.navigator.sendBeacon(e,n)}}:{get:noop,post:noop}},request=function(e,n,r){var t=n.url,o=n.data,i=n.success,a=void 0===i?noop:i,i=n.fail,u=void 0===i?noop:i,i=n.getResponseText,s=void 0===i?noop:i,n=n.withCredentials,n=void 0!==n&&n,r=new r;r.withCredentials=n,r.open(e,t,!0),r.setRequestHeader("Content-Type","application/json"),r.onload=function(){null!=s&&s(this.responseText);try{var e;this.responseText?(e=JSON.parse(this.responseText),a(e)):a({})}catch(e){u(e)}},r.onerror=function(){u(new Error("Network request failed"))},r.onabort=function(){u(new Error("Network request aborted"))},r.send(o)},getXhrTransport=function(){var n=getDefaultXMLHttpRequest();return n?{get:function(e){request("GET",e,n)},post:function(e){request("POST",e,n)}}:{get:noop,post:noop}};function createBrowserSender(e){function n(e){t.post(r.getEndpoint(),stringifyBatch([e]))}var r=createBatchSender(e),t=getBeaconTransport();return onPageUnload(function(){var e=r.getBatchData();e&&(t.post(r.getEndpoint(),e),r.clear()),r.send=n}),r}var browserBuilder={build:function(e){return{ev_type:e.ev_type,payload:e.payload,common:__assign(__assign({},e.extra||{}),e.overrides||{})}}};function normalizeInitConfig(e){var n,r=e.plugins||{};for(n in r)r[n]&&!isObject(r[n])&&(r[n]={});return __assign(__assign({},e),{plugins:r})}function validateInitConfig(e){return isObject(e)&&"aid"in e}function normalizeUserConfig(e){return __assign({},e)}function parseServerConfig(e){if(!e)return{};var n=e.sample,r=e.timestamp,t=e.status;if(!n)return{};var o=n.sample_rate,e=n.sample_granularity;return{sample:{include_users:n.include_users,sample_rate:t&&4===t?0:o,sample_granularity:e,rules:n.rules.reduce(function(e,n){var r=n.name,t=n.enable,o=n.sample_rate,n=n.conditional_sample_rules;return e[r]={enable:t,sample_rate:o,conditional_sample_rules:n},e},{})},serverTimestamp:r}}var REPORT_DOMAIN="apmplus.volces.com",SDK_VERSION="2.0.5-alpha.0",SDK_NAME="APM_PLUS_WEB",SETTINGS_PATH="/settings/get/webpro",BATCH_REPORT_PATH="/monitor_web/collect",STORAGE_PREFIX="APMPLUS",DEFAULT_IGNORE_PATHS=[BATCH_REPORT_PATH,SETTINGS_PATH,"/monitor_browser/collect"],DEFAULT_SAMPLE_CONFIG={sample_rate:1,include_users:[],sample_granularity:"session",rules:{}},DEFAULT_SENDER_SIZE=20,getReportUrl=function(e,n){return void 0===n&&(n=BATCH_REPORT_PATH),(e&&0<=e.indexOf("//")?"":"https://")+e+n},getSettingsUrl=function(e,n){return void 0===n&&(n=SETTINGS_PATH),(e&&0<=e.indexOf("//")?"":"https://")+e+n},getViewId=function(e){return e+"_"+Date.now()},getDefaultSessionId=function(){return uuid()},getStorageKey=function(e){return STORAGE_PREFIX+e},getStoreInfo=function(e){e=getStorageKey(e);return getStorageItem(e)||{userId:uuid(),deviceId:uuid(),r:Math.random()}},saveStoreInfo=function(e){var n=e.aid,r=e.userId,t=e.deviceId,e=e.sample,n=getStorageKey(n);setStorageItem(n,{userId:r,deviceId:t,r:e.r})},createBrowserConfigManager=function(n){var r,t,o,i=n,a={},u=noop,s=noop;return{getConfig:function(){return i},setConfig:function(e){return a=__assign(__assign({},a),e||{}),c(),r||(r=e,i.useLocalConfig?(o={},u()):t?f():getServerConfig(i.transport,i.domain,i.aid,function(e){t=e,f()})),i},onChange:function(e){s=e},onReady:function(e){u=function(){!function(){n.userId!==i.userId&&(n.sample.r=Math.random(),c());saveStoreInfo(i)}(),e()},o&&u()}};function c(){var e=__assign(__assign(__assign({},n),o||{}),a);e.plugins=mergeDeepConcatArray(n.plugins,(null==o?void 0:o.plugins)||{},a.plugins||{}),e.sample=mergeSampleConfig(mergeSampleConfig(n.sample,null==o?void 0:o.sample),a.sample),i=e,s()}function f(){o=parseServerConfig(t),c(),u()}};function getServerConfig(e,n,r,t){e.get({withCredentials:!0,url:getSettingsUrl(n)+"?aid="+r,success:function(e){t(e.data||{})},fail:function(){t()}})}function mergeSampleConfig(t,o){if(!t||!o)return t||o;var e=__assign(__assign({},t),o);return e.include_users=__spreadArray(__spreadArray([],__read(t.include_users||[]),!1),__read(o.include_users||[]),!1),e.rules=__spreadArray(__spreadArray([],__read(Object.keys(t.rules||{})),!1),__read(Object.keys(o.rules||{})),!1).reduce(function(e,n){var r;return n in e||(n in(t.rules||{})&&n in(o.rules||{})?(e[n]=__assign(__assign({},t.rules[n]),o.rules[n]),e[n].conditional_sample_rules=__spreadArray(__spreadArray([],__read(t.rules[n].conditional_sample_rules||[]),!1),__read(o.rules[n].conditional_sample_rules||[]),!1)):e[n]=(null===(r=t.rules)||void 0===r?void 0:r[n])||(null===(r=o.rules)||void 0===r?void 0:r[n])),e},{}),e}var addEnvToSendEvent=function(e){var n={url:getLocationUrl(),timestamp:Date.now()};return __assign(__assign({},e),{extra:__assign(__assign({},n),e.extra||{})})},InjectEnvPlugin=function(e){e.on("report",function(e){return addEnvToSendEvent(e)})},MAX_RTT=700,TimeCalibrationPlugin=function(r){var t,o=!1;r.on("init",function(){t=(new Date).getTime(),r.on("config",function(){var e,n=null===(e=r.config())||void 0===e?void 0:e.serverTimestamp;isNaN(n)||Number(n)<=0||o||(o=!0,(e=(new Date).getTime())-t<MAX_RTT&&n&&(e=n-(e+t)/2,!isNaN(e)&&(0<e||e<-6e5)&&r.set({offset:e})))})})},addConfigToReportEvent=function(e,n){var r={};return r.aid=n.aid,r.pid=n.pid,r.view_id=n.viewId,r.user_id=n.userId,__assign(__assign({},e),{extra:__assign(__assign({},r),e.extra||{})})},InjectConfigPlugin=function(n){n.on("beforeBuild",function(e){return addConfigToReportEvent(e,n.config())})},InjectQueryPlugin=function(u){u.on("start",function(){var e=u.config(),n=e.deviceId,r=e.sessionId,t=e.release,o=e.env,i=e.offset,a=e.aid,e=e.token,a={did:n,sid:r,release:t,env:o,sname:SDK_NAME,sversion:SDK_VERSION,soffset:i||0,biz_id:a,x_auth_token:e},e=u.getSender();e.setEndpoint(e.getEndpoint()+joinQueryWithMap(a))})},getDefaultConfig=function(e){e=getStoreInfo(e.aid);return{aid:0,pid:"",token:"",viewId:getViewId("_"),userId:e.userId,deviceId:e.deviceId,sessionId:getDefaultSessionId(),domain:REPORT_DOMAIN,plugins:{ajax:{ignoreUrls:DEFAULT_IGNORE_PATHS},fetch:{ignoreUrls:DEFAULT_IGNORE_PATHS},breadcrumb:{},pageview:{},jsError:{},resource:{},resourceError:{},performance:{},tti:{},fmp:{},blankScreen:!1},release:"",env:"production",sample:__assign(__assign({},DEFAULT_SAMPLE_CONFIG),{r:e.r}),transport:getXhrTransport()}},createMinimalBrowserClient=function(e){var n=void 0===e?{}:e,r=n.createSender,e=n.builder,n=n.createDefaultConfig,t=createClient({validateInitConfig:validateInitConfig,initConfigNormalizer:normalizeInitConfig,userConfigNormalizer:normalizeUserConfig,createSender:void 0===r?function(e){return createBrowserSender({size:DEFAULT_SENDER_SIZE,endpoint:getReportUrl(e.domain),transport:e.transport})}:r,builder:void 0===e?browserBuilder:e,createDefaultConfig:void 0===n?getDefaultConfig:n,createConfigManager:createBrowserConfigManager});ContextPlugin(t);n=getGlobalRegistry(getDefaultBrowser());SubjectPlugin(t,n&&n.subject),TimeCalibrationPlugin(t),InjectConfigPlugin(t),InjectEnvPlugin(t),InjectNetworkTypePlugin(t),InjectQueryPlugin(t);n=withCommandArray(t,captureCurrentContext,function(e,n,r){return syncReportWithCapturedContext(e,n)(function(){var e=__read(r),n=e[0],e=e.slice(1);t[n].apply(t,__spreadArray([],__read(e),!1))})});return IntegrationPlugin(n),n};export{createMinimalBrowserClient,getDefaultConfig};

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

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var __assign=function(){return(__assign=Object.assign||function(e){for(var n,r=1,t=arguments.length;r<t;r++)for(var o in n=arguments[r])Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o]);return e}).apply(this,arguments)};function __read(e,n){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var t,o,i=r.call(e),a=[];try{for(;(void 0===n||0<n--)&&!(t=i.next()).done;)a.push(t.value)}catch(e){o={error:e}}finally{try{t&&!t.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a}function __spreadArray(e,n,r){if(r||2===arguments.length)for(var t,o=0,i=n.length;o<i;o++)!t&&o in n||((t=t||Array.prototype.slice.call(n,0,o))[o]=n[o]);return e.concat(t||Array.prototype.slice.call(n))}var DEFAULT_SIZE=10,DEFAULT_WAIT=1e3,stringifyBatch=function(e){return JSON.stringify({ev_type:"batch",list:e})};function createBatchSender(e){var r,t=e.transport,o=e.endpoint,n=e.size,i=void 0===n?DEFAULT_SIZE:n,e=e.wait,a=void 0===e?DEFAULT_WAIT:e,u=[],s=0;function c(){var n;u.length&&(n=this.getBatchData(),t.post({url:o,data:n,fail:function(e){r&&r(e,n)}}),u=[])}return{getSize:function(){return i},getWait:function(){return a},setSize:function(e){i=e},setWait:function(e){a=e},getEndpoint:function(){return o},setEndpoint:function(e){o=e},send:function(e){u.push(e),u.length>=i&&c.call(this),clearTimeout(s),s=setTimeout(c.bind(this),a)},flush:function(){clearTimeout(s),c.call(this)},getBatchData:function(){return u.length?stringifyBatch(u):""},clear:function(){clearTimeout(s),u=[]},fail:function(e){r=e}}}var EVENTS=["init","start","config","beforeDestroy","provide","beforeReport","report","beforeBuild","build","beforeSend","send","beforeConfig"],noop=function(){return{}};function isObject(e){return"object"==typeof e&&null!==e}var objProto=Object.prototype;function isPlainObject(e){if(isObject(e)){if("function"!=typeof Object.getPrototypeOf)return"[object Object]"===objProto.toString.call(e);e=Object.getPrototypeOf(e);return e===objProto||null===e}return!1}function isArray(e){return"[object Array]"===objProto.toString.call(e)}function isFunction(e){return"function"==typeof e}function isString(e){return"string"==typeof e}function hasKey(e,n){return Object.prototype.hasOwnProperty.call(e,n)}function mergeDeepConcatArray(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];for(var r={},t=0;t<e.length;)r=_mergeDeepMergeArray(r,e[t++]);return r}function _mergeDeepMergeArray(e,n){var r,t=__assign({},e);for(r in n)hasKey(n,r)&&void 0!==n[r]&&(isObject(n[r])&&isPlainObject(n[r])?t[r]=_mergeDeepMergeArray(isObject(e[r])?e[r]:{},n[r]):isArray(n[r])&&isArray(e[r])?t[r]=_mergeDeepArray(e[r],n[r]):t[r]=n[r]);return t}function _mergeDeepArray(e,n){e=isArray(e)?e:[],n=isArray(n)?n:[];return Array.prototype.concat.call(e,n).map(function(e){return e instanceof RegExp?e:isObject(e)&&isPlainObject(e)?_mergeDeepMergeArray({},e):isArray(e)?_mergeDeepArray([],e):e})}function arrayIncludes(e,n){if(!isArray(e))return!1;if(0===e.length)return!1;for(var r=0;r<e.length;){if(e[r]===n)return!0;r++}return!1}var arrayRemove=function(e,n){if(!isArray(e))return e;var r=e.indexOf(n);if(0<=r){n=e.slice();return n.splice(r,1),n}return e},safeVisit=function(e,n,r){for(var t,n=__read(n.split(".")),o=n[0],i=n.slice(1);e&&0<i.length;)e=e[o],o=(t=__read(i))[0],i=t.slice(1);if(e)return r(e,o)},safeCall=function(e,n,r){return safeVisit(e,n,function(e,n){if(e&&n in e&&isFunction(e[n]))try{return e[n].apply(e,r)}catch(e){return}})};function safeStringify(e){try{return isString(e)?e:JSON.stringify(e)}catch(e){return"[FAILED_TO_STRINGIFY]:"+String(e)}}var joinQueryWithMap=function(r){return isObject(r)?Object.keys(r).reduce(function(e,n){return e+="&"+n+"="+r[n]},"").replace("&","?"):""};function createContextAgent(){var r={},t={},o={set:function(e,n){return r[e]=n,t[e]=safeStringify(n),o},merge:function(n){return r=__assign(__assign({},r),n),Object.keys(n).forEach(function(e){t[e]=safeStringify(n[e])}),o},delete:function(e){return delete r[e],delete t[e],o},clear:function(){return r={},t={},o},get:function(e){return t[e]},toString:function(){return __assign({},t)}};return o}var hookObjectProperty=function(i,a,u,s){return void 0===s&&(s=!0),function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];if(!i)return noop;var r=i[a],t=u.apply(void 0,__spreadArray([r],__read(e),!1)),o=t;return isFunction(o)&&s&&(o=function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];try{return t.apply(this,n)}catch(e){return isFunction(r)&&r.apply(this,n)}}),i[a]=o,function(e){e||(o===i[a]?i[a]=r:t=r)}}},errCount=0,error=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];console.error.apply(console,__spreadArray(["[SDK]",Date.now(),(""+errCount++).padStart(8," ")],__read(e),!1))},warnCount=0,warn=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];console.warn.apply(console,__spreadArray(["[SDK]",Date.now(),(""+warnCount++).padStart(8," ")],__read(e),!1))},runProcessors=function(t){return function(e){for(var n=e,r=0;r<t.length&&n;r++)try{n=t[r](n)}catch(e){error(e)}return n}};function mathRNG(){for(var e=new Array(16),n=0,r=0;r<16;r++)0==(3&r)&&(n=4294967296*Math.random()),e[r]=n>>>((3&r)<<3)&255;return e}function bytesToUuid(e){for(var n=[],r=0;r<256;++r)n[r]=(r+256).toString(16).substr(1);var t=0,o=n;return[o[e[t++]],o[e[t++]],o[e[t++]],o[e[t++]],"-",o[e[t++]],o[e[t++]],"-",o[e[t++]],o[e[t++]],"-",o[e[t++]],o[e[t++]],"-",o[e[t++]],o[e[t++]],o[e[t++]],o[e[t++]],o[e[+t]],o[e[15]]].join("")}function uuid(){var e=mathRNG();return e[6]=15&e[6]|64,e[8]=63&e[8]|128,bytesToUuid(e)}var BUFFER_TIME=3e5,applyBufferTimer=function(e,n,r){var t=0;return-1===r?noop:function(){if(e())return t&&clearTimeout(t),void(t=0);0===t&&(t=setTimeout(n,r))}},nextLink=function(t,e){var n=[];try{n=e.reduce(function(e,n){try{var r=n(t);"function"==typeof r&&e.push(r)}catch(e){}return e},[])}catch(e){}return function(e){return nextLink(e,n)}},toObservable=function(e){function n(e){t=arrayRemove(t,e),i||a()}var r,t=[],o=[],i=!1,a=applyBufferTimer(function(){return!!t.length},function(){i=!0,r&&r[0](),o.forEach(function(e){return e()}),o.length=0,r=void 0},e=void 0===e?BUFFER_TIME:e);return{next:function(e){return nextLink(e,t)},complete:function(e){o.push(e)},attach:function(e,n){r=[e,n]},subscribe:function(e){if(i)throw new Error("Observer is closed");return t.push(e),r&&r[1]&&r[1](e),a(),function(){return n(e)}},unsubscribe:n}},createSafeObserver=function(e,n,r){r=toObservable(r);try{e(r.next,r.attach),n&&r.complete(n)}catch(e){}return[r.subscribe,r.unsubscribe]};function createClient(e){var r,t,n=e.builder,o=e.createSender,i=e.createDefaultConfig,a=e.createConfigManager,u=e.userConfigNormalizer,s=e.initConfigNormalizer,c=e.validateInitConfig,f={};EVENTS.forEach(function(e){return f[e]=[]});var l=!1,g=!1,d=!1,p=[],_=[],v={getBuilder:function(){return n},getSender:function(){return r},getPreStartQueue:function(){return p},init:function(e){if(l)warn("already inited");else{if(!(e&&isObject(e)&&c(e)))throw new Error("invalid InitConfig, init failed");var n=i(e);if(!n)throw new Error("defaultConfig missing");e=s(e);if((t=a(n)).setConfig(e),t.onChange(function(){y("config")}),!(r=o(t.getConfig())))throw new Error("sender missing");y("init",l=!0)}},set:function(e){l&&e&&isObject(e)&&(y("beforeConfig",!1,e),null!=t&&t.setConfig(e))},config:function(e){if(l)return e&&isObject(e)&&(y("beforeConfig",!1,e),null!=t&&t.setConfig(u(e))),null==t?void 0:t.getConfig()},provide:function(e,n){arrayIncludes(_,e)?warn("cannot provide "+e+", reserved"):(v[e]=n,y("provide",!1,e))},start:function(){var n=this;l&&(g||null!=t&&t.onReady(function(){y("start",g=!0),p.forEach(function(e){return n.build(e)}),p=[]}))},report:function(e){e&&(!(e=runProcessors(f.beforeReport)(e))||(e=runProcessors(f.report)(e))&&(g?this.build(e):p.push(e)))},build:function(e){!g||(e=runProcessors(f.beforeBuild)(e))&&(!(e=n.build(e))||(e=runProcessors(f.build)(e))&&this.send(e))},send:function(e){!g||(e=runProcessors(f.beforeSend)(e))&&(r.send(e),y("send",!1,e))},destroy:function(){y("beforeDestroy",d=!0)},on:function(e,n){"init"===e&&l||"start"===e&&g||"beforeDestroy"===e&&d?n():f[e]&&f[e].push(n)},off:function(e,n){f[e]&&(f[e]=arrayRemove(f[e],n))}},_=Object.keys(v);return v;function y(e,n){void 0===n&&(n=!1);for(var r=[],t=2;t<arguments.length;t++)r[t-2]=arguments[t];f[e].forEach(function(e){try{e.apply(void 0,__spreadArray([],__read(r),!1))}catch(e){}}),n&&(f[e].length=0)}}var ContextPlugin=function(e){var n=createContextAgent();e.provide("context",n),e.on("report",function(e){return e.extra||(e.extra={}),e.extra.context=n.toString(),e})},withCommandArray=function(i,a,r){function u(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];if(o=e[0]){var r=o.split(".")[0];if(r in u)return safeCall(u,o,[].slice.call(e,1));var t=s[r]||[],o=null!==(o=null==a?void 0:a(i))&&void 0!==o?o:{};t.push(__spreadArray([o],__read(e),!1)),void(s[r]=t)}}var e,s={};for(e in hookObjectProperty(i,"provide",function(r){return function(e,n){u[e]=n,r.call(i,e,n)}})(),i)Object.prototype.hasOwnProperty.call(i,e)&&(u[e]=i[e]);return i.on("provide",function(e){s[e]&&(s[e].forEach(function(e){var n=__read(e),e=n[0],n=n.slice(1);null!=r&&r(i,e,n)}),s[e]=null)}),u};function IntegrationPlugin(r){r.on("init",function(){var n=[],e=r.config();e&&e.integrations&&e.integrations.forEach(function(e){arrayIncludes(n,e.name)||(n.push(e.name),e.setup(r),e.tearDown&&r.on("beforeDestroy",e.tearDown))})})}function SubjectPlugin(e,n){var r=n||{};e.provide("initSubject",function(e){var e=__read(e,2),n=e[0],e=e[1];return r[n]||(r[n]=createSafeObserver(e,function(){r[n]=void 0})),r[n]}),e.provide("getSubject",function(e){return r[e]}),e.provide("privateSubject",{})}function getDefaultBrowser(){if("object"==typeof window&&isObject(window))return window}function getDefaultLocation(){return getDefaultBrowser()&&window.location}function getDefaultXMLHttpRequest(){if("function"==typeof XMLHttpRequest&&isFunction(XMLHttpRequest))return XMLHttpRequest}function getDefaultNavigator(){if(getDefaultBrowser()&&"navigator"in window)return window.navigator}function getDefaultNetworkInformation(){var e=getDefaultNavigator();if(e)return e.connection||e.mozConnection||e.webkitConnection}var getGlobalRegistry=function(e){if(e)return e.__SLARDAR_REGISTRY__||(e.__SLARDAR_REGISTRY__={Slardar:{plugins:[],errors:[],subject:{}}}),e.__SLARDAR_REGISTRY__.Slardar},now=function(){return Date.now()};function getLocationUrl(){var e=getDefaultBrowser()&&getDefaultLocation();return null==e?void 0:e.href}var captureCurrentContext=function(e){var n={url:getLocationUrl(),timestamp:now()},r=e.config();return null!=r&&r.pid&&(n.pid=r.pid),null!=e&&e.context&&(n.context=e.context.toString()),n},syncReportWithCapturedContext=function(r,t){return function(e){function n(e){return e.overrides=t,e}r.on("report",n),e(),r.off("report",n)}},invokeCallbackOnce=function(n){var r=!1;return[function(e){r||(r=!0,n&&n(e))}]},onPageUnload=function(e){var n,r=getDefaultBrowser();r&&(n=__read(invokeCallbackOnce(e),1)[0],["unload","beforeunload","pagehide"].forEach(function(e){r.addEventListener(e,n)}))},getStorageItem=function(e){try{var n=localStorage.getItem(e),r=n;return r=n&&"string"==typeof n?JSON.parse(n):r}catch(e){return}},setStorageItem=function(e,n){try{var r="string"==typeof n?n:JSON.stringify(n);localStorage.setItem(e,r)}catch(e){}};function getNetworkType(e){return(null==e?void 0:e.effectiveType)||(null==e?void 0:e.type)||""}var InjectNetworkTypePlugin=function(e){var n=getDefaultNetworkInformation(),r=getNetworkType(n);n&&(n.onchange=function(){r=getNetworkType(n)}),e.on("report",function(e){return __assign(__assign({},e),{extra:__assign(__assign({},e.extra||{}),{network_type:r})})})},getBeaconTransport=function(){var r=getDefaultBrowser();return r&&r.navigator.sendBeacon?{get:function(){},post:function(e,n){r.navigator.sendBeacon(e,n)}}:{get:noop,post:noop}},request=function(e,n,r){var t=n.url,o=n.data,i=n.success,a=void 0===i?noop:i,i=n.fail,u=void 0===i?noop:i,i=n.getResponseText,s=void 0===i?noop:i,n=n.withCredentials,n=void 0!==n&&n,r=new r;r.withCredentials=n,r.open(e,t,!0),r.setRequestHeader("Content-Type","application/json"),r.onload=function(){null!=s&&s(this.responseText);try{var e;this.responseText?(e=JSON.parse(this.responseText),a(e)):a({})}catch(e){u(e)}},r.onerror=function(){u(new Error("Network request failed"))},r.onabort=function(){u(new Error("Network request aborted"))},r.send(o)},getXhrTransport=function(){var n=getDefaultXMLHttpRequest();return n?{get:function(e){request("GET",e,n)},post:function(e){request("POST",e,n)}}:{get:noop,post:noop}};function createBrowserSender(e){function n(e){t.post(r.getEndpoint(),stringifyBatch([e]))}var r=createBatchSender(e),t=getBeaconTransport();return onPageUnload(function(){var e=r.getBatchData();e&&(t.post(r.getEndpoint(),e),r.clear()),r.send=n}),r}var browserBuilder={build:function(e){return{ev_type:e.ev_type,payload:e.payload,common:__assign(__assign({},e.extra||{}),e.overrides||{})}}};function normalizeInitConfig(e){var n,r=e.plugins||{};for(n in r)r[n]&&!isObject(r[n])&&(r[n]={});return __assign(__assign({},e),{plugins:r})}function validateInitConfig(e){return isObject(e)&&"aid"in e}function normalizeUserConfig(e){return __assign({},e)}function parseServerConfig(e){if(!e)return{};var n=e.sample,r=e.timestamp,t=e.status;if(!n)return{};var o=n.sample_rate,e=n.sample_granularity;return{sample:{include_users:n.include_users,sample_rate:t&&4===t?0:o,sample_granularity:e,rules:n.rules.reduce(function(e,n){var r=n.name,t=n.enable,o=n.sample_rate,n=n.conditional_sample_rules;return e[r]={enable:t,sample_rate:o,conditional_sample_rules:n},e},{})},serverTimestamp:r}}var REPORT_DOMAIN="apmplus.volces.com",SDK_VERSION="2.0.4",SDK_NAME="APM_PLUS_WEB",SETTINGS_PATH="/settings/get/webpro",BATCH_REPORT_PATH="/monitor_web/collect",STORAGE_PREFIX="APMPLUS",DEFAULT_IGNORE_PATHS=[BATCH_REPORT_PATH,SETTINGS_PATH,"/monitor_browser/collect"],DEFAULT_SAMPLE_CONFIG={sample_rate:1,include_users:[],sample_granularity:"session",rules:{}},DEFAULT_SENDER_SIZE=20,getReportUrl=function(e,n){return void 0===n&&(n=BATCH_REPORT_PATH),(e&&0<=e.indexOf("//")?"":"https://")+e+n},getSettingsUrl=function(e,n){return void 0===n&&(n=SETTINGS_PATH),(e&&0<=e.indexOf("//")?"":"https://")+e+n},getViewId=function(e){return e+"_"+Date.now()},getDefaultSessionId=function(){return uuid()},getStorageKey=function(e){return STORAGE_PREFIX+e},getStoreInfo=function(e){e=getStorageKey(e);return getStorageItem(e)||{userId:uuid(),deviceId:uuid(),r:Math.random()}},saveStoreInfo=function(e){var n=e.aid,r=e.userId,t=e.deviceId,e=e.sample,n=getStorageKey(n);setStorageItem(n,{userId:r,deviceId:t,r:e.r})},createBrowserConfigManager=function(n){var r,t,o,i=n,a={},u=noop,s=noop;return{getConfig:function(){return i},setConfig:function(e){return a=__assign(__assign({},a),e||{}),c(),r||(r=e,i.useLocalConfig?(o={},u()):t?f():getServerConfig(i.transport,i.domain,i.aid,function(e){t=e,f()})),i},onChange:function(e){s=e},onReady:function(e){u=function(){!function(){n.userId!==i.userId&&(n.sample.r=Math.random(),c());saveStoreInfo(i)}(),e()},o&&u()}};function c(){var e=__assign(__assign(__assign({},n),o||{}),a);e.plugins=mergeDeepConcatArray(n.plugins,(null==o?void 0:o.plugins)||{},a.plugins||{}),e.sample=mergeSampleConfig(mergeSampleConfig(n.sample,null==o?void 0:o.sample),a.sample),i=e,s()}function f(){o=parseServerConfig(t),c(),u()}};function getServerConfig(e,n,r,t){e.get({withCredentials:!0,url:getSettingsUrl(n)+"?aid="+r,success:function(e){t(e.data||{})},fail:function(){t()}})}function mergeSampleConfig(t,o){if(!t||!o)return t||o;var e=__assign(__assign({},t),o);return e.include_users=__spreadArray(__spreadArray([],__read(t.include_users||[]),!1),__read(o.include_users||[]),!1),e.rules=__spreadArray(__spreadArray([],__read(Object.keys(t.rules||{})),!1),__read(Object.keys(o.rules||{})),!1).reduce(function(e,n){var r;return n in e||(n in(t.rules||{})&&n in(o.rules||{})?(e[n]=__assign(__assign({},t.rules[n]),o.rules[n]),e[n].conditional_sample_rules=__spreadArray(__spreadArray([],__read(t.rules[n].conditional_sample_rules||[]),!1),__read(o.rules[n].conditional_sample_rules||[]),!1)):e[n]=(null===(r=t.rules)||void 0===r?void 0:r[n])||(null===(r=o.rules)||void 0===r?void 0:r[n])),e},{}),e}var addEnvToSendEvent=function(e){var n={url:getLocationUrl(),timestamp:Date.now()};return __assign(__assign({},e),{extra:__assign(__assign({},n),e.extra||{})})},InjectEnvPlugin=function(e){e.on("report",function(e){return addEnvToSendEvent(e)})},MAX_RTT=700,TimeCalibrationPlugin=function(r){var t,o=!1;r.on("init",function(){t=(new Date).getTime(),r.on("config",function(){var e,n=null===(e=r.config())||void 0===e?void 0:e.serverTimestamp;isNaN(n)||Number(n)<=0||o||(o=!0,(e=(new Date).getTime())-t<MAX_RTT&&n&&(e=n-(e+t)/2,!isNaN(e)&&(0<e||e<-6e5)&&r.set({offset:e})))})})},addConfigToReportEvent=function(e,n){var r={};return r.aid=n.aid,r.pid=n.pid,r.view_id=n.viewId,r.user_id=n.userId,__assign(__assign({},e),{extra:__assign(__assign({},r),e.extra||{})})},InjectConfigPlugin=function(n){n.on("beforeBuild",function(e){return addConfigToReportEvent(e,n.config())})},InjectQueryPlugin=function(u){u.on("start",function(){var e=u.config(),n=e.deviceId,r=e.sessionId,t=e.release,o=e.env,i=e.offset,a=e.aid,e=e.token,a={did:n,sid:r,release:t,env:o,sname:SDK_NAME,sversion:SDK_VERSION,soffset:i||0,biz_id:a,x_auth_token:e},e=u.getSender();e.setEndpoint(e.getEndpoint()+joinQueryWithMap(a))})},getDefaultConfig=function(e){e=getStoreInfo(e.aid);return{aid:0,pid:"",token:"",viewId:getViewId("_"),userId:e.userId,deviceId:e.deviceId,sessionId:getDefaultSessionId(),domain:REPORT_DOMAIN,plugins:{ajax:{ignoreUrls:DEFAULT_IGNORE_PATHS},fetch:{ignoreUrls:DEFAULT_IGNORE_PATHS},breadcrumb:{},pageview:{},jsError:{},resource:{},resourceError:{},performance:{},tti:{},fmp:{},blankScreen:!1},release:"",env:"production",sample:__assign(__assign({},DEFAULT_SAMPLE_CONFIG),{r:e.r}),transport:getXhrTransport()}},createMinimalBrowserClient=function(e){var n=void 0===e?{}:e,r=n.createSender,e=n.builder,n=n.createDefaultConfig,t=createClient({validateInitConfig:validateInitConfig,initConfigNormalizer:normalizeInitConfig,userConfigNormalizer:normalizeUserConfig,createSender:void 0===r?function(e){return createBrowserSender({size:DEFAULT_SENDER_SIZE,endpoint:getReportUrl(e.domain),transport:e.transport})}:r,builder:void 0===e?browserBuilder:e,createDefaultConfig:void 0===n?getDefaultConfig:n,createConfigManager:createBrowserConfigManager});ContextPlugin(t);n=getGlobalRegistry(getDefaultBrowser());SubjectPlugin(t,n&&n.subject),TimeCalibrationPlugin(t),InjectConfigPlugin(t),InjectEnvPlugin(t),InjectNetworkTypePlugin(t),InjectQueryPlugin(t);n=withCommandArray(t,captureCurrentContext,function(e,n,r){return syncReportWithCapturedContext(e,n)(function(){var e=__read(r),n=e[0],e=e.slice(1);t[n].apply(t,__spreadArray([],__read(e),!1))})});return IntegrationPlugin(n),n};exports.createMinimalBrowserClient=createMinimalBrowserClient,exports.getDefaultConfig=getDefaultConfig;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var __assign=function(){return(__assign=Object.assign||function(e){for(var n,r=1,t=arguments.length;r<t;r++)for(var o in n=arguments[r])Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o]);return e}).apply(this,arguments)};function __read(e,n){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var t,o,i=r.call(e),a=[];try{for(;(void 0===n||0<n--)&&!(t=i.next()).done;)a.push(t.value)}catch(e){o={error:e}}finally{try{t&&!t.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a}function __spreadArray(e,n,r){if(r||2===arguments.length)for(var t,o=0,i=n.length;o<i;o++)!t&&o in n||((t=t||Array.prototype.slice.call(n,0,o))[o]=n[o]);return e.concat(t||Array.prototype.slice.call(n))}var DEFAULT_SIZE=10,DEFAULT_WAIT=1e3,stringifyBatch=function(e){return JSON.stringify({ev_type:"batch",list:e})};function createBatchSender(e){var r,t=e.transport,o=e.endpoint,n=e.size,i=void 0===n?DEFAULT_SIZE:n,e=e.wait,a=void 0===e?DEFAULT_WAIT:e,u=[],s=0;function c(){var n;u.length&&(n=this.getBatchData(),t.post({url:o,data:n,fail:function(e){r&&r(e,n)}}),u=[])}return{getSize:function(){return i},getWait:function(){return a},setSize:function(e){i=e},setWait:function(e){a=e},getEndpoint:function(){return o},setEndpoint:function(e){o=e},send:function(e){u.push(e),u.length>=i&&c.call(this),clearTimeout(s),s=setTimeout(c.bind(this),a)},flush:function(){clearTimeout(s),c.call(this)},getBatchData:function(){return u.length?stringifyBatch(u):""},clear:function(){clearTimeout(s),u=[]},fail:function(e){r=e}}}var EVENTS=["init","start","config","beforeDestroy","provide","beforeReport","report","beforeBuild","build","beforeSend","send","beforeConfig"],noop=function(){return{}};function isObject(e){return"object"==typeof e&&null!==e}var objProto=Object.prototype;function isPlainObject(e){if(isObject(e)){if("function"!=typeof Object.getPrototypeOf)return"[object Object]"===objProto.toString.call(e);e=Object.getPrototypeOf(e);return e===objProto||null===e}return!1}function isArray(e){return"[object Array]"===objProto.toString.call(e)}function isFunction(e){return"function"==typeof e}function isString(e){return"string"==typeof e}function hasKey(e,n){return Object.prototype.hasOwnProperty.call(e,n)}function mergeDeepConcatArray(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];for(var r={},t=0;t<e.length;)r=_mergeDeepMergeArray(r,e[t++]);return r}function _mergeDeepMergeArray(e,n){var r,t=__assign({},e);for(r in n)hasKey(n,r)&&void 0!==n[r]&&(isObject(n[r])&&isPlainObject(n[r])?t[r]=_mergeDeepMergeArray(isObject(e[r])?e[r]:{},n[r]):isArray(n[r])&&isArray(e[r])?t[r]=_mergeDeepArray(e[r],n[r]):t[r]=n[r]);return t}function _mergeDeepArray(e,n){e=isArray(e)?e:[],n=isArray(n)?n:[];return Array.prototype.concat.call(e,n).map(function(e){return e instanceof RegExp?e:isObject(e)&&isPlainObject(e)?_mergeDeepMergeArray({},e):isArray(e)?_mergeDeepArray([],e):e})}function arrayIncludes(e,n){if(!isArray(e))return!1;if(0===e.length)return!1;for(var r=0;r<e.length;){if(e[r]===n)return!0;r++}return!1}var arrayRemove=function(e,n){if(!isArray(e))return e;var r=e.indexOf(n);if(0<=r){n=e.slice();return n.splice(r,1),n}return e},safeVisit=function(e,n,r){for(var t,n=__read(n.split(".")),o=n[0],i=n.slice(1);e&&0<i.length;)e=e[o],o=(t=__read(i))[0],i=t.slice(1);if(e)return r(e,o)},safeCall=function(e,n,r){return safeVisit(e,n,function(e,n){if(e&&n in e&&isFunction(e[n]))try{return e[n].apply(e,r)}catch(e){return}})};function safeStringify(e){try{return isString(e)?e:JSON.stringify(e)}catch(e){return"[FAILED_TO_STRINGIFY]:"+String(e)}}var joinQueryWithMap=function(r){return isObject(r)?Object.keys(r).reduce(function(e,n){return e+="&"+n+"="+r[n]},"").replace("&","?"):""};function createContextAgent(){var r={},t={},o={set:function(e,n){return r[e]=n,t[e]=safeStringify(n),o},merge:function(n){return r=__assign(__assign({},r),n),Object.keys(n).forEach(function(e){t[e]=safeStringify(n[e])}),o},delete:function(e){return delete r[e],delete t[e],o},clear:function(){return r={},t={},o},get:function(e){return t[e]},toString:function(){return __assign({},t)}};return o}var hookObjectProperty=function(i,a,u,s){return void 0===s&&(s=!0),function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];if(!i)return noop;var r=i[a],t=u.apply(void 0,__spreadArray([r],__read(e),!1)),o=t;return isFunction(o)&&s&&(o=function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];try{return t.apply(this,n)}catch(e){return isFunction(r)&&r.apply(this,n)}}),i[a]=o,function(e){e||(o===i[a]?i[a]=r:t=r)}}},errCount=0,error=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];console.error.apply(console,__spreadArray(["[SDK]",Date.now(),(""+errCount++).padStart(8," ")],__read(e),!1))},warnCount=0,warn=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];console.warn.apply(console,__spreadArray(["[SDK]",Date.now(),(""+warnCount++).padStart(8," ")],__read(e),!1))},runProcessors=function(t){return function(e){for(var n=e,r=0;r<t.length&&n;r++)try{n=t[r](n)}catch(e){error(e)}return n}};function mathRNG(){for(var e=new Array(16),n=0,r=0;r<16;r++)0==(3&r)&&(n=4294967296*Math.random()),e[r]=n>>>((3&r)<<3)&255;return e}function bytesToUuid(e){for(var n=[],r=0;r<256;++r)n[r]=(r+256).toString(16).substr(1);var t=0,o=n;return[o[e[t++]],o[e[t++]],o[e[t++]],o[e[t++]],"-",o[e[t++]],o[e[t++]],"-",o[e[t++]],o[e[t++]],"-",o[e[t++]],o[e[t++]],"-",o[e[t++]],o[e[t++]],o[e[t++]],o[e[t++]],o[e[+t]],o[e[15]]].join("")}function uuid(){var e=mathRNG();return e[6]=15&e[6]|64,e[8]=63&e[8]|128,bytesToUuid(e)}var BUFFER_TIME=3e5,applyBufferTimer=function(e,n,r){var t=0;return-1===r?noop:function(){if(e())return t&&clearTimeout(t),void(t=0);0===t&&(t=setTimeout(n,r))}},nextLink=function(t,e){var n=[];try{n=e.reduce(function(e,n){try{var r=n(t);"function"==typeof r&&e.push(r)}catch(e){}return e},[])}catch(e){}return function(e){return nextLink(e,n)}},toObservable=function(e){function n(e){t=arrayRemove(t,e),i||a()}var r,t=[],o=[],i=!1,a=applyBufferTimer(function(){return!!t.length},function(){i=!0,r&&r[0](),o.forEach(function(e){return e()}),o.length=0,r=void 0},e=void 0===e?BUFFER_TIME:e);return{next:function(e){return nextLink(e,t)},complete:function(e){o.push(e)},attach:function(e,n){r=[e,n]},subscribe:function(e){if(i)throw new Error("Observer is closed");return t.push(e),r&&r[1]&&r[1](e),a(),function(){return n(e)}},unsubscribe:n}},createSafeObserver=function(e,n,r){r=toObservable(r);try{e(r.next,r.attach),n&&r.complete(n)}catch(e){}return[r.subscribe,r.unsubscribe]};function createClient(e){var r,t,n=e.builder,o=e.createSender,i=e.createDefaultConfig,a=e.createConfigManager,u=e.userConfigNormalizer,s=e.initConfigNormalizer,c=e.validateInitConfig,f={};EVENTS.forEach(function(e){return f[e]=[]});var l=!1,g=!1,d=!1,p=[],_=[],v={getBuilder:function(){return n},getSender:function(){return r},getPreStartQueue:function(){return p},init:function(e){if(l)warn("already inited");else{if(!(e&&isObject(e)&&c(e)))throw new Error("invalid InitConfig, init failed");var n=i(e);if(!n)throw new Error("defaultConfig missing");e=s(e);if((t=a(n)).setConfig(e),t.onChange(function(){y("config")}),!(r=o(t.getConfig())))throw new Error("sender missing");y("init",l=!0)}},set:function(e){l&&e&&isObject(e)&&(y("beforeConfig",!1,e),null!=t&&t.setConfig(e))},config:function(e){if(l)return e&&isObject(e)&&(y("beforeConfig",!1,e),null!=t&&t.setConfig(u(e))),null==t?void 0:t.getConfig()},provide:function(e,n){arrayIncludes(_,e)?warn("cannot provide "+e+", reserved"):(v[e]=n,y("provide",!1,e))},start:function(){var n=this;l&&(g||null!=t&&t.onReady(function(){y("start",g=!0),p.forEach(function(e){return n.build(e)}),p=[]}))},report:function(e){e&&(!(e=runProcessors(f.beforeReport)(e))||(e=runProcessors(f.report)(e))&&(g?this.build(e):p.push(e)))},build:function(e){!g||(e=runProcessors(f.beforeBuild)(e))&&(!(e=n.build(e))||(e=runProcessors(f.build)(e))&&this.send(e))},send:function(e){!g||(e=runProcessors(f.beforeSend)(e))&&(r.send(e),y("send",!1,e))},destroy:function(){y("beforeDestroy",d=!0)},on:function(e,n){"init"===e&&l||"start"===e&&g||"beforeDestroy"===e&&d?n():f[e]&&f[e].push(n)},off:function(e,n){f[e]&&(f[e]=arrayRemove(f[e],n))}},_=Object.keys(v);return v;function y(e,n){void 0===n&&(n=!1);for(var r=[],t=2;t<arguments.length;t++)r[t-2]=arguments[t];f[e].forEach(function(e){try{e.apply(void 0,__spreadArray([],__read(r),!1))}catch(e){}}),n&&(f[e].length=0)}}var ContextPlugin=function(e){var n=createContextAgent();e.provide("context",n),e.on("report",function(e){return e.extra||(e.extra={}),e.extra.context=n.toString(),e})},withCommandArray=function(i,a,r){function u(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];if(o=e[0]){var r=o.split(".")[0];if(r in u)return safeCall(u,o,[].slice.call(e,1));var t=s[r]||[],o=null!==(o=null==a?void 0:a(i))&&void 0!==o?o:{};t.push(__spreadArray([o],__read(e),!1)),void(s[r]=t)}}var e,s={};for(e in hookObjectProperty(i,"provide",function(r){return function(e,n){u[e]=n,r.call(i,e,n)}})(),i)Object.prototype.hasOwnProperty.call(i,e)&&(u[e]=i[e]);return i.on("provide",function(e){s[e]&&(s[e].forEach(function(e){var n=__read(e),e=n[0],n=n.slice(1);null!=r&&r(i,e,n)}),s[e]=null)}),u};function IntegrationPlugin(r){r.on("init",function(){var n=[],e=r.config();e&&e.integrations&&e.integrations.forEach(function(e){arrayIncludes(n,e.name)||(n.push(e.name),e.setup(r),e.tearDown&&r.on("beforeDestroy",e.tearDown))})})}function SubjectPlugin(e,n){var r=n||{};e.provide("initSubject",function(e){var e=__read(e,2),n=e[0],e=e[1];return r[n]||(r[n]=createSafeObserver(e,function(){r[n]=void 0})),r[n]}),e.provide("getSubject",function(e){return r[e]}),e.provide("privateSubject",{})}var now=function(){return Date.now()};function getDefaultBrowser(){if("object"==typeof window&&isObject(window))return window}function getDefaultLocation(){return getDefaultBrowser()&&window.location}function getDefaultXMLHttpRequest(){if("function"==typeof XMLHttpRequest&&isFunction(XMLHttpRequest))return XMLHttpRequest}function getDefaultNavigator(){if(getDefaultBrowser()&&"navigator"in window)return window.navigator}function getDefaultNetworkInformation(){var e=getDefaultNavigator();if(e)return e.connection||e.mozConnection||e.webkitConnection}function getLocationUrl(){var e=getDefaultBrowser()&&getDefaultLocation();return null==e?void 0:e.href}var getGlobalRegistry=function(e){if(e)return e.__SLARDAR_REGISTRY__||(e.__SLARDAR_REGISTRY__={Slardar:{plugins:[],errors:[],subject:{}}}),e.__SLARDAR_REGISTRY__.Slardar},captureCurrentContext=function(e){var n={url:getLocationUrl(),timestamp:now()},r=e.config();return null!=r&&r.pid&&(n.pid=r.pid),null!=e&&e.context&&(n.context=e.context.toString()),n},syncReportWithCapturedContext=function(r,t){return function(e){function n(e){return e.overrides=t,e}r.on("report",n),e(),r.off("report",n)}},invokeCallbackOnce=function(n){var r=!1;return[function(e){r||(r=!0,n&&n(e))}]},onPageUnload=function(e){var n,r=getDefaultBrowser();r&&(n=__read(invokeCallbackOnce(e),1)[0],["unload","beforeunload","pagehide"].forEach(function(e){r.addEventListener(e,n)}))},getStorageItem=function(e){try{var n=localStorage.getItem(e),r=n;return r=n&&"string"==typeof n?JSON.parse(n):r}catch(e){return}},setStorageItem=function(e,n){try{var r="string"==typeof n?n:JSON.stringify(n);localStorage.setItem(e,r)}catch(e){}};function getNetworkType(e){return(null==e?void 0:e.effectiveType)||(null==e?void 0:e.type)||""}var InjectNetworkTypePlugin=function(e){var n=getDefaultNetworkInformation(),r=getNetworkType(n);n&&(n.onchange=function(){r=getNetworkType(n)}),e.on("report",function(e){return __assign(__assign({},e),{extra:__assign(__assign({},e.extra||{}),{network_type:r})})})},getBeaconTransport=function(){var r=getDefaultBrowser();return r&&r.navigator.sendBeacon?{get:function(){},post:function(e,n){r.navigator.sendBeacon(e,n)}}:{get:noop,post:noop}},request=function(e,n,r){var t=n.url,o=n.data,i=n.success,a=void 0===i?noop:i,i=n.fail,u=void 0===i?noop:i,i=n.getResponseText,s=void 0===i?noop:i,n=n.withCredentials,n=void 0!==n&&n,r=new r;r.withCredentials=n,r.open(e,t,!0),r.setRequestHeader("Content-Type","application/json"),r.onload=function(){null!=s&&s(this.responseText);try{var e;this.responseText?(e=JSON.parse(this.responseText),a(e)):a({})}catch(e){u(e)}},r.onerror=function(){u(new Error("Network request failed"))},r.onabort=function(){u(new Error("Network request aborted"))},r.send(o)},getXhrTransport=function(){var n=getDefaultXMLHttpRequest();return n?{get:function(e){request("GET",e,n)},post:function(e){request("POST",e,n)}}:{get:noop,post:noop}};function createBrowserSender(e){function n(e){t.post(r.getEndpoint(),stringifyBatch([e]))}var r=createBatchSender(e),t=getBeaconTransport();return onPageUnload(function(){var e=r.getBatchData();e&&(t.post(r.getEndpoint(),e),r.clear()),r.send=n}),r}var browserBuilder={build:function(e){return{ev_type:e.ev_type,payload:e.payload,common:__assign(__assign({},e.extra||{}),e.overrides||{})}}};function normalizeInitConfig(e){var n,r=e.plugins||{};for(n in r)r[n]&&!isObject(r[n])&&(r[n]={});return __assign(__assign({},e),{plugins:r})}function validateInitConfig(e){return isObject(e)&&"aid"in e}function normalizeUserConfig(e){return __assign({},e)}function parseServerConfig(e){if(!e)return{};var n=e.sample,r=e.timestamp,t=e.status;if(!n)return{};var o=n.sample_rate,e=n.sample_granularity;return{sample:{include_users:n.include_users,sample_rate:t&&4===t?0:o,sample_granularity:e,rules:n.rules.reduce(function(e,n){var r=n.name,t=n.enable,o=n.sample_rate,n=n.conditional_sample_rules;return e[r]={enable:t,sample_rate:o,conditional_sample_rules:n},e},{})},serverTimestamp:r}}var REPORT_DOMAIN="apmplus.volces.com",SDK_VERSION="2.0.5-alpha.0",SDK_NAME="APM_PLUS_WEB",SETTINGS_PATH="/settings/get/webpro",BATCH_REPORT_PATH="/monitor_web/collect",STORAGE_PREFIX="APMPLUS",DEFAULT_IGNORE_PATHS=[BATCH_REPORT_PATH,SETTINGS_PATH,"/monitor_browser/collect"],DEFAULT_SAMPLE_CONFIG={sample_rate:1,include_users:[],sample_granularity:"session",rules:{}},DEFAULT_SENDER_SIZE=20,getReportUrl=function(e,n){return void 0===n&&(n=BATCH_REPORT_PATH),(e&&0<=e.indexOf("//")?"":"https://")+e+n},getSettingsUrl=function(e,n){return void 0===n&&(n=SETTINGS_PATH),(e&&0<=e.indexOf("//")?"":"https://")+e+n},getViewId=function(e){return e+"_"+Date.now()},getDefaultSessionId=function(){return uuid()},getStorageKey=function(e){return STORAGE_PREFIX+e},getStoreInfo=function(e){e=getStorageKey(e);return getStorageItem(e)||{userId:uuid(),deviceId:uuid(),r:Math.random()}},saveStoreInfo=function(e){var n=e.aid,r=e.userId,t=e.deviceId,e=e.sample,n=getStorageKey(n);setStorageItem(n,{userId:r,deviceId:t,r:e.r})},createBrowserConfigManager=function(n){var r,t,o,i=n,a={},u=noop,s=noop;return{getConfig:function(){return i},setConfig:function(e){return a=__assign(__assign({},a),e||{}),c(),r||(r=e,i.useLocalConfig?(o={},u()):t?f():getServerConfig(i.transport,i.domain,i.aid,function(e){t=e,f()})),i},onChange:function(e){s=e},onReady:function(e){u=function(){!function(){n.userId!==i.userId&&(n.sample.r=Math.random(),c());saveStoreInfo(i)}(),e()},o&&u()}};function c(){var e=__assign(__assign(__assign({},n),o||{}),a);e.plugins=mergeDeepConcatArray(n.plugins,(null==o?void 0:o.plugins)||{},a.plugins||{}),e.sample=mergeSampleConfig(mergeSampleConfig(n.sample,null==o?void 0:o.sample),a.sample),i=e,s()}function f(){o=parseServerConfig(t),c(),u()}};function getServerConfig(e,n,r,t){e.get({withCredentials:!0,url:getSettingsUrl(n)+"?aid="+r,success:function(e){t(e.data||{})},fail:function(){t()}})}function mergeSampleConfig(t,o){if(!t||!o)return t||o;var e=__assign(__assign({},t),o);return e.include_users=__spreadArray(__spreadArray([],__read(t.include_users||[]),!1),__read(o.include_users||[]),!1),e.rules=__spreadArray(__spreadArray([],__read(Object.keys(t.rules||{})),!1),__read(Object.keys(o.rules||{})),!1).reduce(function(e,n){var r;return n in e||(n in(t.rules||{})&&n in(o.rules||{})?(e[n]=__assign(__assign({},t.rules[n]),o.rules[n]),e[n].conditional_sample_rules=__spreadArray(__spreadArray([],__read(t.rules[n].conditional_sample_rules||[]),!1),__read(o.rules[n].conditional_sample_rules||[]),!1)):e[n]=(null===(r=t.rules)||void 0===r?void 0:r[n])||(null===(r=o.rules)||void 0===r?void 0:r[n])),e},{}),e}var addEnvToSendEvent=function(e){var n={url:getLocationUrl(),timestamp:Date.now()};return __assign(__assign({},e),{extra:__assign(__assign({},n),e.extra||{})})},InjectEnvPlugin=function(e){e.on("report",function(e){return addEnvToSendEvent(e)})},MAX_RTT=700,TimeCalibrationPlugin=function(r){var t,o=!1;r.on("init",function(){t=(new Date).getTime(),r.on("config",function(){var e,n=null===(e=r.config())||void 0===e?void 0:e.serverTimestamp;isNaN(n)||Number(n)<=0||o||(o=!0,(e=(new Date).getTime())-t<MAX_RTT&&n&&(e=n-(e+t)/2,!isNaN(e)&&(0<e||e<-6e5)&&r.set({offset:e})))})})},addConfigToReportEvent=function(e,n){var r={};return r.aid=n.aid,r.pid=n.pid,r.view_id=n.viewId,r.user_id=n.userId,__assign(__assign({},e),{extra:__assign(__assign({},r),e.extra||{})})},InjectConfigPlugin=function(n){n.on("beforeBuild",function(e){return addConfigToReportEvent(e,n.config())})},InjectQueryPlugin=function(u){u.on("start",function(){var e=u.config(),n=e.deviceId,r=e.sessionId,t=e.release,o=e.env,i=e.offset,a=e.aid,e=e.token,a={did:n,sid:r,release:t,env:o,sname:SDK_NAME,sversion:SDK_VERSION,soffset:i||0,biz_id:a,x_auth_token:e},e=u.getSender();e.setEndpoint(e.getEndpoint()+joinQueryWithMap(a))})},getDefaultConfig=function(e){e=getStoreInfo(e.aid);return{aid:0,pid:"",token:"",viewId:getViewId("_"),userId:e.userId,deviceId:e.deviceId,sessionId:getDefaultSessionId(),domain:REPORT_DOMAIN,plugins:{ajax:{ignoreUrls:DEFAULT_IGNORE_PATHS},fetch:{ignoreUrls:DEFAULT_IGNORE_PATHS},breadcrumb:{},pageview:{},jsError:{},resource:{},resourceError:{},performance:{},tti:{},fmp:{},blankScreen:!1},release:"",env:"production",sample:__assign(__assign({},DEFAULT_SAMPLE_CONFIG),{r:e.r}),transport:getXhrTransport()}},createMinimalBrowserClient=function(e){var n=void 0===e?{}:e,r=n.createSender,e=n.builder,n=n.createDefaultConfig,t=createClient({validateInitConfig:validateInitConfig,initConfigNormalizer:normalizeInitConfig,userConfigNormalizer:normalizeUserConfig,createSender:void 0===r?function(e){return createBrowserSender({size:DEFAULT_SENDER_SIZE,endpoint:getReportUrl(e.domain),transport:e.transport})}:r,builder:void 0===e?browserBuilder:e,createDefaultConfig:void 0===n?getDefaultConfig:n,createConfigManager:createBrowserConfigManager});ContextPlugin(t);n=getGlobalRegistry(getDefaultBrowser());SubjectPlugin(t,n&&n.subject),TimeCalibrationPlugin(t),InjectConfigPlugin(t),InjectEnvPlugin(t),InjectNetworkTypePlugin(t),InjectQueryPlugin(t);n=withCommandArray(t,captureCurrentContext,function(e,n,r){return syncReportWithCapturedContext(e,n)(function(){var e=__read(r),n=e[0],e=e.slice(1);t[n].apply(t,__spreadArray([],__read(e),!1))})});return IntegrationPlugin(n),n};exports.createMinimalBrowserClient=createMinimalBrowserClient,exports.getDefaultConfig=getDefaultConfig;
{
"name": "@apmplus/web",
"version": "2.0.4",
"version": "2.0.5-alpha.0",
"description": "APM Plus Web SDK",

@@ -39,9 +39,2 @@ "main": "cn/index.cjs.js",

],
"nyc": {
"extends": "@istanbuljs/nyc-config-typescript",
"extension": [".ts"],
"include": ["**/*.ts"],
"exclude": ["**/__tests__/**/*.*", "**/__test__/**/*.*", "**/vendors/**/*.*", "src/plugins/index.ts"],
"check-coverage": false
},
"scripts": {

@@ -51,3 +44,3 @@ "test": "ava",

"esm": "ttsc -b ./tsconfig.json",
"cover": "nyc --reporter=json ava && nyc report",
"cover": "c8 -c='../../tools/sub-c8rc.json' ava",
"analyze": "library-analyze -p ./cn/*[^0-9].cn.js,./cn/plugins/*.js",

@@ -54,0 +47,0 @@ "uglifySnippet": "uglifyjs snippet.js -m -o snippet.min.js",

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc