@apmplus/integrations
Advanced tools
Comparing version 2.2.0 to 2.2.1-alpha.0
@@ -324,2 +324,4 @@ interface ContextAgent { | ||
type: string; | ||
/** 可附加的日志,长度限制 100K */ | ||
attached_log?: string; | ||
} | ||
@@ -1008,2 +1010,3 @@ | ||
}; | ||
attached_log?: string; | ||
}; | ||
@@ -1016,2 +1019,3 @@ declare type CustomLogData = { | ||
}; | ||
attached_log?: string; | ||
}; | ||
@@ -1018,0 +1022,0 @@ declare type SendCustomEvent = (data: CustomEventData) => void; |
@@ -324,2 +324,4 @@ interface ContextAgent { | ||
type: string; | ||
/** 可附加的日志,长度限制 100K */ | ||
attached_log?: string; | ||
} | ||
@@ -1008,2 +1010,3 @@ | ||
}; | ||
attached_log?: string; | ||
}; | ||
@@ -1016,2 +1019,3 @@ declare type CustomLogData = { | ||
}; | ||
attached_log?: string; | ||
}; | ||
@@ -1018,0 +1022,0 @@ declare type SendCustomEvent = (data: CustomEventData) => void; |
@@ -1,1 +0,1 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var __assign=function(){return(__assign=Object.assign||function(e){for(var n,t=1,r=arguments.length;t<r;t++)for(var o in n=arguments[t])Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o]);return e}).apply(this,arguments)};function __read(e,n){var t="function"==typeof Symbol&&e[Symbol.iterator];if(!t)return e;var r,o,i=t.call(e),u=[];try{for(;(void 0===n||0<n--)&&!(r=i.next()).done;)u.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(t=i.return)&&t.call(i)}finally{if(o)throw o.error}}return u}var noop=function(){return{}};function isObject(e){return"object"==typeof e&&null!==e}function isUndefined(e){return void 0===e}function isFunction(e){return"function"==typeof e}function isNumber(e){return"number"==typeof e}var registerTearDownGroup=function(e,n,t,r){return e.destroyAgent.set(n,t,r)};function initSubjectInGlobal(e,n){return e.initSubject(n)}var now=function(){return Date.now()};function getDefaultBrowser(){if("object"==typeof window&&isObject(window))return window}function getDefaultDocument(){if("object"==typeof document&&isObject(document))return document}function getDefaultPromise(){if(getDefaultBrowser()&&"Promise"in window)return Promise}function getDefaultMutationObserver(){if(getDefaultBrowser()&&isFunction(window.MutationObserver))return window.MutationObserver}function getDefaultPerformanceObserver(){if(getDefaultBrowser()&&isFunction(window.PerformanceObserver))return window.PerformanceObserver}var applyMutationObserver=function(e,n){var t=e&&new e(n);return[function(e,n){t&&e&&t.observe(e,n)},function(){return t&&t.disconnect()}]},applyPerformance=function(t){var e=t&&t.timing||void 0;return[e,function(){return t&&t.now?t.now():(Date.now?Date.now():+new Date)-(e&&e.navigationStart||0)},function(e){var n=(t||{}).getEntriesByType;return isFunction(n)&&n.call(t,e)||[]},function(){var e=(t||{}).clearResourceTimings;isFunction(e)&&e.call(t)},function(e){var n=(t||{}).getEntriesByName;return isFunction(n)&&n.call(t,e)||[]}]},applyRequestIdleCallback=function(n){return n.requestIdleCallback||function(e){return n.setTimeout(e,1)}},addListenerToWindow=function(e,n,t,r){return void 0===r&&(r=!1),e.addEventListener(n,t,r),function(){e.removeEventListener(n,t,r)}},addListenerToDocument=function(e,n,t,r){return void 0===r&&(r=!1),e.addEventListener(n,t,r),function(){e.removeEventListener(n,t,r)}},invokeCallbackOnce=function(n){var t=!1;return[function(e){t||(t=!0,n&&n(e))}]},getConfig=function(e,n){return isObject(e)?__assign(__assign({},n),e):!!e&&n},getReportPathRegExp=function(){var n=new RegExp("\\/monitor_web\\/collect|\\/monitor_browser\\/collect\\/batch","i");return function(e){return n.test(e)}},RESOURCE_TYPE=["resource"],LONGTASK_TYPE=["longtask"],applyPerformanceObserver=function(r,o,i){var u=r&&new r(function(e,r){e.getEntries?e.getEntries().forEach(function(e,n,t){return o(e,n,t,r)}):i&&i()});return[function(e){if(!r||!u)return i&&i();try{u.observe({entryTypes:e})}catch(e){return i&&i()}},function(e,n){if(!r||!u)return i&&i();try{var t={type:e,buffered:!0};isUndefined(n)||(t.durationThreshold=n),u.observe(t)}catch(e){return i&&i()}u.observe({type:e,buffered:!1})},function(){return u&&u.disconnect()}]},observePerf=function(e,n,t){e=__read(applyPerformanceObserver(e,n),3),n=e[0],e=e[2];return n(t),e},LONGTASK_SUBJECT_NAME="longtask_0",observeLongtask=function(e,n){var t=getDefaultPerformanceObserver();t&&n(observePerf(t,e,LONGTASK_TYPE))},longtaskSubject=[LONGTASK_SUBJECT_NAME,observeLongtask],RESOURCE_SUBJECT_NAME="resource_0",observeResource=function(n,e){var t,r=getDefaultPerformanceObserver();r&&(t=getReportPathRegExp(),e(observePerf(r,function(e){t(e.name)||n(e)},RESOURCE_TYPE)))},resourceSubject=[RESOURCE_SUBJECT_NAME,observeResource],JS_ERROR_EV_TYPE="js_error",HTTP_EV_TYPE="http",RESOURCE_ERROR_EV_TYPE="resource_error",CUSTOM_EV_TYPE="custom",PERFORMANCE_METRIC_EV_TYPE="performance",PERFORMANCE_TIMING_EV_TYPE="performance_timing",LONG_TASK_EV_TYPE="performance_longtask",BLANK_SCREEN_EV_TYPE="blank_screen";function getPluginConfig(e,n,t){n=null===(e=e.config())||void 0===e?void 0:e.plugins[n];return getConfig(n,t)}var UNLOAD_SUBJECT_NAME="unload_0",observeUnload=function(e,n){var t,r,o,i=getDefaultBrowser();i&&(t=__read(invokeCallbackOnce(e),1)[0],r=function(){t()},o=[],["unload","beforeunload","pagehide"].forEach(function(e){o.push(addListenerToWindow(i,e,r,!1))}),n(function(){o.forEach(function(e){return e()})}))},unloadSubject=[UNLOAD_SUBJECT_NAME,observeUnload],DOM_CONTENT_LOAD_SUBJECT_NAME="domLoad_1",observeDOMContentLoad=function(e,n){var t,r,o=getDefaultBrowser(),i=getDefaultDocument();o&&i&&(t=!1,r=noop,o=function(){setTimeout(function(){e(),t=!0},0)},"loading"!==i.readyState?o():r=addListenerToDocument(i,"DOMContentLoaded",o,!1),n(function(){r()},function(e){t&&e()}))},DOMContentLoadSubject=[DOM_CONTENT_LOAD_SUBJECT_NAME,observeDOMContentLoad],ACTIVATED_SUBJECT_NAME="activated_0",observeActivated=function(e,n){var t,r,o,i=getDefaultDocument();i&&(t=!1,r=noop,o=function(){e(),t=!0},i&&i.prerendering?r=addListenerToDocument(i,"prerenderingchange",o,!0):o(),n(function(){r()},function(e){t&&e()}))},activatedSubject=[ACTIVATED_SUBJECT_NAME,observeActivated],DEFAULT_IGNORE_TAGS=["SCRIPT","STYLE","META","HEAD"],ERROR_RELATED_TYPE=[JS_ERROR_EV_TYPE,HTTP_EV_TYPE,RESOURCE_ERROR_EV_TYPE],DEFAULT_THRESHOLD=1.5,MAX_RENDER_TIME=1e4,MAX_CHECK_TIME=8e3,DEFAULT_CHECK_TIME=4e3,MAX_RELATED_TIME=1e4,DEFAULT_T0_DATA_URL_QUALITY=.1,DEFAULT_MAX_DEPTH=4,CHECK_EXCLUSIVE_EV_TYPES=[PERFORMANCE_METRIC_EV_TYPE,LONG_TASK_EV_TYPE,PERFORMANCE_TIMING_EV_TYPE,CUSTOM_EV_TYPE],isSkipBeforeCheck=function(e){return~CHECK_EXCLUSIVE_EV_TYPES.indexOf(e.ev_type)},blankErrorCompare=function(e,n){if(-1===ERROR_RELATED_TYPE.indexOf(n.ev_type))return e;if(n.ev_type===HTTP_EV_TYPE&&n.payload.response.status<400)return e;if(e&&ERROR_RELATED_TYPE.indexOf(e.type)<ERROR_RELATED_TYPE.indexOf(n.ev_type))return e;var t="";switch(n.ev_type){case JS_ERROR_EV_TYPE:t=n.payload.error.message;break;case HTTP_EV_TYPE:t=n.payload.request.url;break;case RESOURCE_ERROR_EV_TYPE:t=n.payload.url}return{type:n.ev_type,message:t,timestamp:now()}},isSkipMeasure=function(e,n){return~DEFAULT_IGNORE_TAGS.indexOf(e.tagName)||DEFAULT_MAX_DEPTH<n},getBounding=function(e){e=e.getBoundingClientRect();return{width:e.width,height:e.height,top:e.top}},getElementByRootSelector=function(e){return e?document.querySelector(e):document.body},measure=function(t,r,e,o){if(void 0===r&&(r=0),void 0===e&&(e=0),void 0===o&&(o=DEFAULT_THRESHOLD),!t||isSkipMeasure(t,r)||o<=e)return e;var n=function(){if(!r)return 0;var e=getBounding(t),n=e.top,e=e.height;return n>innerHeight||e<=0?0:1/(1<<r-1)}();return[].reduceRight.call(t.children,function(e,n){return measure(n,r+1,e,o)},e+n)};function serializeDom2String(e,t,n){if(void 0===t&&(t=0),void 0===n&&(n=!0),!e||isSkipMeasure(e,t))return"";var r=__assign(__assign({},getBounding(e)),{id:e.getAttribute("id"),class:e.getAttribute("class")}),o=Object.keys(r).reduce(function(e,n){return e+(isNumber(r[n])||r[n]?" "+n+'="'+r[n]+'"':"")},""),i=e.tagName.toLowerCase(),e=[].reduce.call(e.children,function(e,n){return e+serializeDom2String(n,t+1,!1)},"");return"<"+i+o+(n?' innerHeight="'+innerHeight+'"':"")+">"+e+"</"+i+">"}var screenshot=function(e){var n=e.cb,t=e.screenshotUrl,r=e.window,o=e.document,i=e.mask,u=e.partialShot,a=e.quality,c=e.rootSelector;if(getDefaultPromise()&&r&&o){if(r.html2canvas)return s();e=o.createElement("script");e.src=t,null!==(t=o.head)&&void 0!==t&&t.appendChild(e),e.onload=s,e.onerror=function(){n()}}function s(){applyRequestIdleCallback(r)(function(){r.html2canvas&&r.html2canvas(u&&c&&o.querySelector(c)||o.body,{scale:360/r.innerWidth,mask:i}).then(function(e){n(handleBase64(e.toDataURL("image/jpeg",a)))}).catch(function(){n(getBlankImageBase64())})})}};function handleBase64(e){return"data:image"===e.slice(0,10)?e:getBlankImageBase64()}function getBlankImageBase64(e,n){void 0===e&&(e=192),void 0===n&&(n=108);var t=document.createElement("canvas");t.width=e,t.height=n;var r=t.getContext("2d");return r&&(r.fillStyle="#ffffff",r.fillRect(0,0,e,n)),t.toDataURL("image/jpeg")}var blankScreenGetterWithObserver=function(t,r,e,n){function o(e,n){w||(u=U())&&(w=!0,r.forEach(function(e){return e()}),r.length=0,t({ev_type:BLANK_SCREEN_EV_TYPE,payload:{timestamp:u[0],score:u[1],screenshot:n,error:a,serialized_dom:serializeDom2String(getElementByRootSelector(R))},overrides:{timestamp:e||u[0]}}))}function i(){E&&clearTimeout(E),c&&clearTimeout(c),c=h.setTimeout(function(){s=P(function(){(u=U())&&I()})},1e3)}var u,a,c,s,E,_,f,l=__read(e,5),d=l[0],T=l[1],v=l[2],g=l[3],m=l[4],p=n.threshold,e=n.screenshot,R=n.rootSelector,l=n.autoDetect,b=n.ssUrl,S=n.quality,A=n.mask,O=n.partialShot,D=n.initDetTime,N=n.runDetTime,h=getDefaultBrowser(),C=getDefaultDocument(),P=h.requestAnimationFrame||noop,L=h.cancelAnimationFrame||noop,M=__read(applyPerformance(performance),2)[1],y=0,w=!1,B=!e,U=function(){var e=getElementByRootSelector(R);if(e){e=measure(e,0,0,p);return e<p?[now(),e]:void 0}},I=(_=function(){u&&!w&&(B?o():(B=!0,screenshot({cb:o.bind(null,now()),screenshotUrl:b,window:h,document:C,mask:A,partialShot:O,quality:S,rootSelector:R})))},function(){E&&clearTimeout(E),f=now(),E=h.setTimeout(function(){(f<y?i:_)()},M()>MAX_RENDER_TIME?N:D)});return r.push(m[0](function(){a&&o()})),l&&r.push(d[0](function(){var e=T();r.push(e[0](function(){var e=__read(applyMutationObserver(getDefaultMutationObserver(),i),2),n=e[0],t=e[1];r.push(function(){clearTimeout(c),clearTimeout(E),L(s),t&&t()}),n(null===(n=getDefaultDocument())||void 0===n?void 0:n.body,{subtree:!0,childList:!0}),r.push(v()[0](function(){c&&i()})),r.push(g()[0](function(){c&&i()})),i()}))})),[function(e){w||isSkipBeforeCheck(e)||(y=now(),a&&y-a.timestamp>MAX_RELATED_TIME&&(a=void 0),a=blankErrorCompare(a,e))},i]},BLANK_SCREEN_MONITOR_PLUGIN_NAME="blankScreen";function BlankScreenMonitorBasePlugin(e,n){var t,r,o=getDefaultDocument(),i=getDefaultBrowser();o&&i&&(i=[],n=__read(blankScreenGetterWithObserver(e.report.bind(e),i,[initSubjectInGlobal(e,activatedSubject),function(){return initSubjectInGlobal(e,DOMContentLoadSubject)},function(){return initSubjectInGlobal(e,longtaskSubject)},function(){return initSubjectInGlobal(e,resourceSubject)},initSubjectInGlobal(e,unloadSubject)],n),2),t=n[0],n=n[1],e.on("report",r=function(e){return t(e),e}),i.push(function(){e.off("report",r)}),registerTearDownGroup(e,BLANK_SCREEN_MONITOR_PLUGIN_NAME,BLANK_SCREEN_EV_TYPE,i),e.provide("detectBlankScreen",n))}function BlankScreenMonitorVolPlugin(n,t){n.on("init",function(){var e={autoDetect:!0,threshold:DEFAULT_THRESHOLD,screenshot:!0,ssUrl:"https://apm.volccdn.com/mars-web/apmplus/web/html2canvas.min.js",mask:!1,partialShot:!0,quality:DEFAULT_T0_DATA_URL_QUALITY,initDetTime:MAX_CHECK_TIME,runDetTime:DEFAULT_CHECK_TIME},e=t?getConfig(t,e):getPluginConfig(n,BLANK_SCREEN_MONITOR_PLUGIN_NAME,e);e&&BlankScreenMonitorBasePlugin(n,e)})}var BLANK_SCREEN_INTEGRATION_NAME=BLANK_SCREEN_MONITOR_PLUGIN_NAME,blankScreenPlugin=function(n){return void 0===n&&(n={}),{name:BLANK_SCREEN_INTEGRATION_NAME,setup:function(e){BlankScreenMonitorVolPlugin(e,n)}}};exports.BLANK_SCREEN_INTEGRATION_NAME=BLANK_SCREEN_INTEGRATION_NAME,exports.blankScreenPlugin=blankScreenPlugin; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var __assign=function(){return(__assign=Object.assign||function(e){for(var n,t=1,r=arguments.length;t<r;t++)for(var o in n=arguments[t])Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o]);return e}).apply(this,arguments)};function __read(e,n){var t="function"==typeof Symbol&&e[Symbol.iterator];if(!t)return e;var r,o,i=t.call(e),u=[];try{for(;(void 0===n||0<n--)&&!(r=i.next()).done;)u.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(t=i.return)&&t.call(i)}finally{if(o)throw o.error}}return u}var noop=function(){return{}};function isObject(e){return"object"==typeof e&&null!==e}function isUndefined(e){return void 0===e}function isFunction(e){return"function"==typeof e}function isNumber(e){return"number"==typeof e}var registerTearDownGroup=function(e,n,t,r){return e.destroyAgent.set(n,t,r)};function initSubjectInGlobal(e,n){return e.initSubject(n)}var now=function(){return Date.now()};function getDefaultBrowser(){if("object"==typeof window&&isObject(window))return window}function getDefaultDocument(){if("object"==typeof document&&isObject(document))return document}function getDefaultPromise(){if(getDefaultBrowser()&&"Promise"in window)return Promise}function getDefaultMutationObserver(){if(getDefaultBrowser()&&isFunction(window.MutationObserver))return window.MutationObserver}function getDefaultPerformanceObserver(){if(getDefaultBrowser()&&isFunction(window.PerformanceObserver))return window.PerformanceObserver}var applyMutationObserver=function(e,n){var t=e&&new e(n);return[function(e,n){t&&e&&t.observe(e,n)},function(){return t&&t.disconnect()}]},applyPerformance=function(t){var e=t&&t.timing||void 0;return[e,function(){return t&&t.now?t.now():(Date.now?Date.now():+new Date)-(e&&e.navigationStart||0)},function(e){var n=(t||{}).getEntriesByType;return isFunction(n)&&n.call(t,e)||[]},function(){var e=(t||{}).clearResourceTimings;isFunction(e)&&e.call(t)},function(e){var n=(t||{}).getEntriesByName;return isFunction(n)&&n.call(t,e)||[]}]},applyRequestIdleCallback=function(n){return n.requestIdleCallback||function(e){return n.setTimeout(e,1)}},addListenerToWindow=function(e,n,t,r){return void 0===r&&(r=!1),e.addEventListener(n,t,r),function(){e.removeEventListener(n,t,r)}},addListenerToDocument=function(e,n,t,r){return void 0===r&&(r=!1),e.addEventListener(n,t,r),function(){e.removeEventListener(n,t,r)}},invokeCallbackOnce=function(n){var t=!1;return[function(e){t||(t=!0,n&&n(e))}]},getConfig=function(e,n){return isObject(e)?__assign(__assign({},n),e):!!e&&n},getReportPathRegExp=function(){var n=new RegExp("\\/monitor_web\\/collect|\\/monitor_browser\\/collect\\/batch","i");return function(e){return n.test(e)}},RESOURCE_TYPE=["resource"],LONGTASK_TYPE=["longtask"],applyPerformanceObserver=function(r,o,i){var u=r&&new r(function(e,r){e.getEntries?e.getEntries().forEach(function(e,n,t){return o(e,n,t,r)}):i&&i()});return[function(e){if(!r||!u)return i&&i();try{u.observe({entryTypes:e})}catch(e){return i&&i()}},function(e,n){if(!r||!u)return i&&i();try{var t={type:e,buffered:!0};isUndefined(n)||(t.durationThreshold=n),u.observe(t)}catch(e){return i&&i()}u.observe({type:e,buffered:!1})},function(){return u&&u.disconnect()}]},observePerf=function(e,n,t){e=__read(applyPerformanceObserver(e,n),3),n=e[0],e=e[2];return n(t),e},LONGTASK_SUBJECT_NAME="longtask_0",observeLongtask=function(e,n){var t=getDefaultPerformanceObserver();t&&n(observePerf(t,e,LONGTASK_TYPE))},longtaskSubject=[LONGTASK_SUBJECT_NAME,observeLongtask],RESOURCE_SUBJECT_NAME="resource_0",observeResource=function(n,e){var t,r=getDefaultPerformanceObserver();r&&(t=getReportPathRegExp(),e(observePerf(r,function(e){t(e.name)||n(e)},RESOURCE_TYPE)))},resourceSubject=[RESOURCE_SUBJECT_NAME,observeResource],JS_ERROR_EV_TYPE="js_error",HTTP_EV_TYPE="http",RESOURCE_ERROR_EV_TYPE="resource_error",CUSTOM_EV_TYPE="custom",PERFORMANCE_METRIC_EV_TYPE="performance",PERFORMANCE_TIMING_EV_TYPE="performance_timing",LONG_TASK_EV_TYPE="performance_longtask",BLANK_SCREEN_EV_TYPE="blank_screen";function getPluginConfig(e,n,t){n=null===(e=e.config())||void 0===e?void 0:e.plugins[n];return getConfig(n,t)}var UNLOAD_SUBJECT_NAME="unload_0",observeUnload=function(e,n){var t,r,o,i=getDefaultBrowser();i&&(t=__read(invokeCallbackOnce(e),1)[0],r=function(){t()},o=[],["unload","beforeunload","pagehide"].forEach(function(e){o.push(addListenerToWindow(i,e,r,!1))}),n(function(){o.forEach(function(e){return e()})}))},unloadSubject=[UNLOAD_SUBJECT_NAME,observeUnload],DOM_CONTENT_LOAD_SUBJECT_NAME="domLoad_1",observeDOMContentLoad=function(e,n){var t,r,o=getDefaultBrowser(),i=getDefaultDocument();o&&i&&(t=!1,r=noop,o=function(){setTimeout(function(){e(),t=!0},0)},"loading"!==i.readyState?o():r=addListenerToDocument(i,"DOMContentLoaded",o,!1),n(function(){r()},function(e){t&&e()}))},DOMContentLoadSubject=[DOM_CONTENT_LOAD_SUBJECT_NAME,observeDOMContentLoad],ACTIVATED_SUBJECT_NAME="activated_0",observeActivated=function(e,n){var t,r,o,i=getDefaultDocument();i&&(t=!1,r=noop,o=function(){e(),t=!0},i&&i.prerendering?r=addListenerToDocument(i,"prerenderingchange",o,!0):o(),n(function(){r()},function(e){t&&e()}))},activatedSubject=[ACTIVATED_SUBJECT_NAME,observeActivated],DEFAULT_IGNORE_TAGS=["SCRIPT","STYLE","META","HEAD"],ERROR_RELATED_TYPE=[JS_ERROR_EV_TYPE,HTTP_EV_TYPE,RESOURCE_ERROR_EV_TYPE],DEFAULT_THRESHOLD=1.5,MAX_RENDER_TIME=1e4,MAX_CHECK_TIME=8e3,DEFAULT_CHECK_TIME=4e3,MAX_RELATED_TIME=1e4,DEFAULT_T0_DATA_URL_QUALITY=.1,DEFAULT_MAX_DEPTH=4,CHECK_EXCLUSIVE_EV_TYPES=[PERFORMANCE_METRIC_EV_TYPE,LONG_TASK_EV_TYPE,PERFORMANCE_TIMING_EV_TYPE,CUSTOM_EV_TYPE],isSkipBeforeCheck=function(e){return~CHECK_EXCLUSIVE_EV_TYPES.indexOf(e.ev_type)},blankErrorCompare=function(e,n){if(-1===ERROR_RELATED_TYPE.indexOf(n.ev_type))return e;if(n.ev_type===HTTP_EV_TYPE&&n.payload.response.status<400)return e;if(e&&ERROR_RELATED_TYPE.indexOf(e.type)<ERROR_RELATED_TYPE.indexOf(n.ev_type))return e;var t="";switch(n.ev_type){case JS_ERROR_EV_TYPE:t=n.payload.error.message;break;case HTTP_EV_TYPE:t=n.payload.request.url;break;case RESOURCE_ERROR_EV_TYPE:t=n.payload.url}return{type:n.ev_type,message:t,timestamp:now()}},isSkipMeasure=function(e,n){return~DEFAULT_IGNORE_TAGS.indexOf(e.tagName)||DEFAULT_MAX_DEPTH<n},getBounding=function(e){e=e.getBoundingClientRect();return{width:e.width,height:e.height,top:e.top}},getElementByRootSelector=function(e){return e?document.querySelector(e):document.body},measure=function(t,r,e,o){if(void 0===r&&(r=0),void 0===e&&(e=0),void 0===o&&(o=DEFAULT_THRESHOLD),!t||isSkipMeasure(t,r)||o<=e)return e;var n=function(){if(!r)return 0;var e=getBounding(t),n=e.top,e=e.height;return n>innerHeight||e<=0?0:1/(1<<r-1)}();return[].reduceRight.call(t.children,function(e,n){return measure(n,r+1,e,o)},e+n)};function serializeDom2String(e,t,n){if(void 0===t&&(t=0),void 0===n&&(n=!0),!e||isSkipMeasure(e,t))return"";var r=__assign(__assign({},getBounding(e)),{id:e.getAttribute("id"),class:e.getAttribute("class")}),o=Object.keys(r).reduce(function(e,n){return e+(isNumber(r[n])||r[n]?" "+n+'="'+r[n]+'"':"")},""),i=e.tagName.toLowerCase(),e=[].reduce.call(e.children,function(e,n){return e+serializeDom2String(n,t+1,!1)},"");return"<"+i+o+(n?' innerHeight="'+innerHeight+'"':"")+">"+e+"</"+i+">"}var screenshot=function(e){var n=e.cb,t=e.screenshotUrl,r=e.window,o=e.document,i=e.mask,u=e.partialShot,a=e.quality,c=e.rootSelector;if(getDefaultPromise()&&r&&o){if(r.html2canvas)return s();e=o.createElement("script");e.src=t,e.crossOrigin="anonymous",e.onload=s,e.onerror=function(){n()},null!==(t=o.head)&&void 0!==t&&t.appendChild(e)}function s(){applyRequestIdleCallback(r)(function(){r.html2canvas&&r.html2canvas(u&&c&&o.querySelector(c)||o.body,{scale:360/r.innerWidth,mask:i}).then(function(e){n(handleBase64(e.toDataURL("image/jpeg",a)))}).catch(function(){n(getBlankImageBase64())})})}};function handleBase64(e){return"data:image"===e.slice(0,10)?e:getBlankImageBase64()}function getBlankImageBase64(e,n){void 0===e&&(e=192),void 0===n&&(n=108);var t=document.createElement("canvas");t.width=e,t.height=n;var r=t.getContext("2d");return r&&(r.fillStyle="#ffffff",r.fillRect(0,0,e,n)),t.toDataURL("image/jpeg")}var blankScreenGetterWithObserver=function(t,r,e,n){function o(e,n){w||(u=U())&&(w=!0,r.forEach(function(e){return e()}),r.length=0,t({ev_type:BLANK_SCREEN_EV_TYPE,payload:{timestamp:u[0],score:u[1],screenshot:n,error:a,serialized_dom:serializeDom2String(getElementByRootSelector(R))},overrides:{timestamp:e||u[0]}}))}function i(){E&&clearTimeout(E),c&&clearTimeout(c),c=h.setTimeout(function(){s=P(function(){(u=U())&&I()})},1e3)}var u,a,c,s,E,_,f,l=__read(e,5),d=l[0],T=l[1],v=l[2],g=l[3],m=l[4],p=n.threshold,e=n.screenshot,R=n.rootSelector,l=n.autoDetect,b=n.ssUrl,S=n.quality,A=n.mask,O=n.partialShot,D=n.initDetTime,N=n.runDetTime,h=getDefaultBrowser(),C=getDefaultDocument(),P=h.requestAnimationFrame||noop,L=h.cancelAnimationFrame||noop,M=__read(applyPerformance(performance),2)[1],y=0,w=!1,B=!e,U=function(){var e=getElementByRootSelector(R);if(e){e=measure(e,0,0,p);return e<p?[now(),e]:void 0}},I=(_=function(){u&&!w&&(B?o():(B=!0,screenshot({cb:o.bind(null,now()),screenshotUrl:b,window:h,document:C,mask:A,partialShot:O,quality:S,rootSelector:R})))},function(){E&&clearTimeout(E),f=now(),E=h.setTimeout(function(){(f<y?i:_)()},M()>MAX_RENDER_TIME?N:D)});return r.push(m[0](function(){a&&o()})),l&&r.push(d[0](function(){var e=T();r.push(e[0](function(){var e=__read(applyMutationObserver(getDefaultMutationObserver(),i),2),n=e[0],t=e[1];r.push(function(){clearTimeout(c),clearTimeout(E),L(s),t&&t()}),n(null===(n=getDefaultDocument())||void 0===n?void 0:n.body,{subtree:!0,childList:!0}),r.push(v()[0](function(){c&&i()})),r.push(g()[0](function(){c&&i()})),i()}))})),[function(e){w||isSkipBeforeCheck(e)||(y=now(),a&&y-a.timestamp>MAX_RELATED_TIME&&(a=void 0),a=blankErrorCompare(a,e))},i]},BLANK_SCREEN_MONITOR_PLUGIN_NAME="blankScreen";function BlankScreenMonitorBasePlugin(e,n){var t,r,o=getDefaultDocument(),i=getDefaultBrowser();o&&i&&(i=[],n=__read(blankScreenGetterWithObserver(e.report.bind(e),i,[initSubjectInGlobal(e,activatedSubject),function(){return initSubjectInGlobal(e,DOMContentLoadSubject)},function(){return initSubjectInGlobal(e,longtaskSubject)},function(){return initSubjectInGlobal(e,resourceSubject)},initSubjectInGlobal(e,unloadSubject)],n),2),t=n[0],n=n[1],e.on("report",r=function(e){return t(e),e}),i.push(function(){e.off("report",r)}),registerTearDownGroup(e,BLANK_SCREEN_MONITOR_PLUGIN_NAME,BLANK_SCREEN_EV_TYPE,i),e.provide("detectBlankScreen",n))}function BlankScreenMonitorVolPlugin(n,t){n.on("init",function(){var e={autoDetect:!0,threshold:DEFAULT_THRESHOLD,screenshot:!0,ssUrl:"https://apm.volccdn.com/mars-web/apmplus/web/html2canvas.min.js",mask:!1,partialShot:!0,quality:DEFAULT_T0_DATA_URL_QUALITY,initDetTime:MAX_CHECK_TIME,runDetTime:DEFAULT_CHECK_TIME},e=t?getConfig(t,e):getPluginConfig(n,BLANK_SCREEN_MONITOR_PLUGIN_NAME,e);e&&BlankScreenMonitorBasePlugin(n,e)})}var BLANK_SCREEN_INTEGRATION_NAME=BLANK_SCREEN_MONITOR_PLUGIN_NAME,blankScreenPlugin=function(n){return void 0===n&&(n={}),{name:BLANK_SCREEN_INTEGRATION_NAME,setup:function(e){BlankScreenMonitorVolPlugin(e,n)}}};exports.BLANK_SCREEN_INTEGRATION_NAME=BLANK_SCREEN_INTEGRATION_NAME,exports.blankScreenPlugin=blankScreenPlugin; |
@@ -324,2 +324,4 @@ interface ContextAgent { | ||
type: string; | ||
/** 可附加的日志,长度限制 100K */ | ||
attached_log?: string; | ||
} | ||
@@ -1008,2 +1010,3 @@ | ||
}; | ||
attached_log?: string; | ||
}; | ||
@@ -1016,2 +1019,3 @@ declare type CustomLogData = { | ||
}; | ||
attached_log?: string; | ||
}; | ||
@@ -1018,0 +1022,0 @@ declare type SendCustomEvent = (data: CustomEventData) => void; |
@@ -324,2 +324,4 @@ interface ContextAgent { | ||
type: string; | ||
/** 可附加的日志,长度限制 100K */ | ||
attached_log?: string; | ||
} | ||
@@ -1008,2 +1010,3 @@ | ||
}; | ||
attached_log?: string; | ||
}; | ||
@@ -1016,2 +1019,3 @@ declare type CustomLogData = { | ||
}; | ||
attached_log?: string; | ||
}; | ||
@@ -1018,0 +1022,0 @@ declare type SendCustomEvent = (data: CustomEventData) => void; |
@@ -324,2 +324,4 @@ interface ContextAgent { | ||
type: string; | ||
/** 可附加的日志,长度限制 100K */ | ||
attached_log?: string; | ||
} | ||
@@ -1008,2 +1010,3 @@ | ||
}; | ||
attached_log?: string; | ||
}; | ||
@@ -1016,2 +1019,3 @@ declare type CustomLogData = { | ||
}; | ||
attached_log?: string; | ||
}; | ||
@@ -1018,0 +1022,0 @@ declare type SendCustomEvent = (data: CustomEventData) => void; |
@@ -1,1 +0,1 @@ | ||
"use strict";function isObject(t){return"object"==typeof t&&null!==t}function isNumber(t){return"number"==typeof t}function isString(t){return"string"==typeof t}function safeStringify(t){try{return isString(t)?t:JSON.stringify(t)}catch(t){return"[FAILED_TO_STRINGIFY]:"+String(t)}}Object.defineProperty(exports,"__esModule",{value:!0});var now=function(){return Date.now()},CUSTOM_EV_TYPE="custom",CUSTOM_EVENT_TYPE="event",CUSTOM_LOG_TYPE="log",normalizeCustomEventData=function(t){if(t&&isObject(t)&&t.name&&isString(t.name)){var e={name:t.name,type:CUSTOM_EVENT_TYPE};if("metrics"in t&&isObject(t.metrics)){var n=t.metrics,i={};for(r in n)isNumber(n[r])&&(i[r]=n[r]);e.metrics=i}if("categories"in t&&isObject(t.categories)){var r,o=t.categories,s={};for(r in o)s[r]=safeStringify(o[r]);e.categories=s}return e}},normalizeCustomLogData=function(t){if(t&&isObject(t)&&t.content&&isString(t.content)){var e={content:safeStringify(t.content),type:CUSTOM_LOG_TYPE,level:"info"};if("level"in t&&(e.level=t.level),"extra"in t&&isObject(t.extra)){var n,i=t.extra,r={},o={};for(n in i)isNumber(i[n])?r[n]=i[n]:o[n]=safeStringify(i[n]);e.metrics=r,e.categories=o}return e}},CustomPlugin=function(e){e.provide("sendEvent",function(t){t=normalizeCustomEventData(t);t&&e.report({ev_type:CUSTOM_EV_TYPE,payload:t,extra:{timestamp:now()}})}),e.provide("sendLog",function(t){t=normalizeCustomLogData(t);t&&e.report({ev_type:CUSTOM_EV_TYPE,payload:t,extra:{timestamp:now()}})})},CUSTOM_INTEGRATION_NAME="custom",customPlugin=function(){return{name:CUSTOM_INTEGRATION_NAME,setup:function(t){CustomPlugin(t)}}};exports.CUSTOM_INTEGRATION_NAME=CUSTOM_INTEGRATION_NAME,exports.customPlugin=customPlugin; | ||
"use strict";function isObject(t){return"object"==typeof t&&null!==t}function isNumber(t){return"number"==typeof t}function isString(t){return"string"==typeof t}function safeStringify(t){try{return isString(t)?t:JSON.stringify(t)}catch(t){return"[FAILED_TO_STRINGIFY]:"+String(t)}}Object.defineProperty(exports,"__esModule",{value:!0});var now=function(){return Date.now()},CUSTOM_EV_TYPE="custom",CUSTOM_EVENT_TYPE="event",CUSTOM_LOG_TYPE="log",normalizeCustomEventData=function(t){if(t&&isObject(t)&&t.name&&isString(t.name)){var e={name:t.name,type:CUSTOM_EVENT_TYPE};if("metrics"in t&&isObject(t.metrics)){var n=t.metrics,i={};for(r in n)isNumber(n[r])&&(i[r]=n[r]);e.metrics=i}if("categories"in t&&isObject(t.categories)){var r,o=t.categories,a={};for(r in o)a[r]=safeStringify(o[r]);e.categories=a}return"attached_log"in t&&isString(t.attached_log)&&(e.attached_log=t.attached_log),e}},normalizeCustomLogData=function(t){if(t&&isObject(t)&&t.content&&isString(t.content)){var e={content:safeStringify(t.content),type:CUSTOM_LOG_TYPE,level:"info"};if("level"in t&&(e.level=t.level),"extra"in t&&isObject(t.extra)){var n,i=t.extra,r={},o={};for(n in i)isNumber(i[n])?r[n]=i[n]:o[n]=safeStringify(i[n]);e.metrics=r,e.categories=o}return"attached_log"in t&&isString(t.attached_log)&&(e.attached_log=t.attached_log),e}},CustomPlugin=function(e){e.provide("sendEvent",function(t){t=normalizeCustomEventData(t);t&&e.report({ev_type:CUSTOM_EV_TYPE,payload:t,extra:{timestamp:now()}})}),e.provide("sendLog",function(t){t=normalizeCustomLogData(t);t&&e.report({ev_type:CUSTOM_EV_TYPE,payload:t,extra:{timestamp:now()}})})},CUSTOM_INTEGRATION_NAME="custom",customPlugin=function(){return{name:CUSTOM_INTEGRATION_NAME,setup:function(t){CustomPlugin(t)}}};exports.CUSTOM_INTEGRATION_NAME=CUSTOM_INTEGRATION_NAME,exports.customPlugin=customPlugin; |
@@ -324,2 +324,4 @@ interface ContextAgent { | ||
type: string; | ||
/** 可附加的日志,长度限制 100K */ | ||
attached_log?: string; | ||
} | ||
@@ -1012,2 +1014,3 @@ | ||
}; | ||
attached_log?: string; | ||
}; | ||
@@ -1020,2 +1023,3 @@ declare type CustomLogData = { | ||
}; | ||
attached_log?: string; | ||
}; | ||
@@ -1022,0 +1026,0 @@ declare type SendCustomEvent = (data: CustomEventData) => void; |
@@ -1,1 +0,1 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var __assign=function(){return(__assign=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function __read(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),u=[];try{for(;(void 0===t||0<t--)&&!(n=i.next()).done;)u.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return u}function __spreadArray(e,t,r){if(r||2===arguments.length)for(var n,o=0,i=t.length;o<i;o++)!n&&o in t||((n=n||Array.prototype.slice.call(t,0,o))[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))}var REFRESH_PRE_START_CONTEXT_INTEGRATION_NAME="refreshPreStartContext",refreshPreStartContext=function(){return{name:REFRESH_PRE_START_CONTEXT_INTEGRATION_NAME,setup:function(n){n.on("start",function(){var r=n.getPreStartQueue();r.forEach(function(e,t){r[t]=__assign(__assign({},e),{overrides:__assign(__assign({},null!==(e=e.overrides)&&void 0!==e?e:{}),{context:(null===(e=n.context)||void 0===e?void 0:e.toString())||{}})})})})}}},noop=function(){return{}};function isObject(e){return"object"==typeof e&&null!==e}function isUndefined(e){return void 0===e}function isInstanceOf(e,t){try{return e instanceof t}catch(e){return!1}}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 isError(e){switch(Object.prototype.toString.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMError]":case"[object DOMException]":return!0;default:return e instanceof Error}}function isEvent(e){return"undefined"!=typeof Event&&isInstanceOf(e,Event)}function isErrorEvent(e){return"[object ErrorEvent]"===Object.prototype.toString.call(e)}function isPromiseRejectionEvent(e){return"[object PromiseRejectionEvent]"===Object.prototype.toString.call(e)}function arrayIncludes(e,t){if(!isArray(e))return!1;if(0===e.length)return!1;for(var r=0;r<e.length;){if(e[r]===t)return!0;r++}return!1}var arrayRemove=function(e,t){if(!isArray(e))return e;var r=e.indexOf(t);if(0<=r){t=e.slice();return t.splice(r,1),t}return e},applyRecord=function(){var r={};return[r,function(e,t){return r[e]=t},function(e){return delete r[e]}]},pick=function(r,e){return r&&isObject(r)?e.reduce(function(e,t){return e[t]=r[t],e},{}):r};function getRegexp(e){return isArray(e)&&e.length?joinRegExp(e):null}function joinRegExp(e){for(var t=[],r=e.length,n=0;n<r;n++){var o=e[n];isString(o)?t.push(o.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")):o&&o.source&&t.push(o.source)}return new RegExp(t.join("|"),"i")}var checkIfHit=function(e,t){e=getRegexp(e||[]);return!!e&&e.test(t)};function safeStringify(e){try{return isString(e)?e:JSON.stringify(e)}catch(e){return"[FAILED_TO_STRINGIFY]:"+String(e)}}function safeJoin(e,t){if(!isArray(e))return"";for(var r=[],n=0;n<e.length;n++)try{r.push(String(e[n]))}catch(e){r.push("[value cannot be serialized]")}return r.join(t)}var hookObjectProperty=function(i,u,a,c){return void 0===c&&(c=!0),function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(!i)return noop;var r=i[u],n=a.apply(void 0,__spreadArray([r],__read(e),!1)),o=n;return isFunction(o)&&c&&(o=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];try{return n.apply(this,t)}catch(e){return isFunction(r)&&r.apply(this,t)}}),i[u]=o,function(e){e||(o===i[u]?i[u]=r:n=r)}}},hookMethodDangerously=function(i,u,a){return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(!i)return noop;var r=i[u],n=a.apply(void 0,__spreadArray([r],__read(e),!1)),o=n;return isFunction(o)&&(o=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return n.apply(this,e)}),i[u]=o,function(){o===i[u]?i[u]=r:n=r}}};function mathRNG(){for(var e=new Array(16),t=0,r=0;r<16;r++)0==(3&r)&&(t=4294967296*Math.random()),e[r]=t>>>((3&r)<<3)&255;return e}function bytesToUuid(e){for(var t=[],r=0;r<256;++r)t[r]=(r+256).toString(16).substr(1);var n=0,o=t;return[o[e[n++]],o[e[n++]],o[e[n++]],o[e[n++]],"-",o[e[n++]],o[e[n++]],"-",o[e[n++]],o[e[n++]],"-",o[e[n++]],o[e[n++]],"-",o[e[n++]],o[e[n++]],o[e[n++]],o[e[n++]],o[e[+n]],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,t,r){var n=0;return-1===r?noop:function(){if(e())return n&&clearTimeout(n),void(n=0);0===n&&(n=setTimeout(t,r))}},nextLink=function(n,e){var t=[];try{t=e.reduce(function(e,t){try{var r=t(n);"function"==typeof r&&e.push(r)}catch(e){}return e},[])}catch(e){}return function(e){return nextLink(e,t)}},toObservable=function(e){function t(e){n=arrayRemove(n,e),i||u()}var r,n=[],o=[],i=!1,u=applyBufferTimer(function(){return!!n.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,n)},complete:function(e){o.push(e)},attach:function(e,t){r=[e,t]},subscribe:function(e){if(i)throw new Error("Observer is closed");return n.push(e),r&&r[1]&&r[1](e),u(),function(){return t(e)}},unsubscribe:t}},createSafeObserver=function(e,t,r){r=toObservable(r);try{e(r.next,r.attach),t&&r.complete(t)}catch(e){}return[r.subscribe,r.unsubscribe]},registerTearDownGroup=function(e,t,r,n){return e.destroyAgent.set(t,r,n)};function initSubjectInGlobal(e,t){return e.initSubject(t)}function initPrivateSubject(e,t,r){var t=__read(t,2),n=t[0],t=t[1],o=e.privateSubject||{};return o[n]||(o[n]=createSafeObserver(t,function(){o[n]=void 0},r)),o[n]}var now=function(){return Date.now()};function getDefaultBrowser(){if("object"==typeof window&&isObject(window))return window}function getDefaultDocument(){if("object"==typeof document&&isObject(document))return document}function getDefaultLocation(){return getDefaultBrowser()&&window.location}function getDefaultXMLHttpRequest(){if("function"==typeof XMLHttpRequest&&isFunction(XMLHttpRequest))return XMLHttpRequest}function getDefaultMutationObserver(){if(getDefaultBrowser()&&isFunction(window.MutationObserver))return window.MutationObserver}function getDefaultPerformanceObserver(){if(getDefaultBrowser()&&isFunction(window.PerformanceObserver))return window.PerformanceObserver}function getFullUrl(e){var t=getDefaultDocument();if(!t||!e)return"";t=t.createElement("a");return t.href=e,t.href}function getLocationUrl(){var e=getDefaultBrowser()&&getDefaultLocation();return e?e.href:""}var getViewOverrides=function(e){return{pid:e.pid,view_id:e.viewId,url:getLocationUrl()}},getOverrides=function(e){var t=e.config(),t=getViewOverrides(t);return t.context=e.context?e.context.toString():{},t},reportWithCurrentContext=function(t,e){void 0===e&&(e=!1);var r=getOverrides(t);return e&&(r.timestamp=now()),function(e){t.report(__assign(__assign({},e),{overrides:r}))}},PV_SUBJECT_NAME="view_0",applyPV=function(o){return function(r,e){function t(e){var t;e.viewId&&e.viewId!==(null===(t=o.config())||void 0===t?void 0:t.viewId)&&(r(n),n=__assign(__assign({},getOverrides(o)),getViewOverrides(e)))}var n=getOverrides(o);o.on("beforeConfig",t),e(function(){o.off("beforeConfig",t)})}},getGlobalRegistry=function(e){if(e)return e.__SLARDAR_REGISTRY__||(e.__SLARDAR_REGISTRY__={Slardar:{plugins:[],errors:[],subject:{}}}),e.__SLARDAR_REGISTRY__.Slardar},reportSelfError=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=getGlobalRegistry(getDefaultBrowser());r&&(r.errors||(r.errors=[]),r.errors.push(e))},applyMutationObserver=function(e,t){var r=e&&new e(t);return[function(e,t){r&&e&&r.observe(e,t)},function(){return r&&r.disconnect()}]},applyPerformance=function(r){var e=r&&r.timing||void 0;return[e,function(){return r&&r.now?r.now():(Date.now?Date.now():+new Date)-(e&&e.navigationStart||0)},function(e){var t=(r||{}).getEntriesByType;return isFunction(t)&&t.call(r,e)||[]},function(){var e=(r||{}).clearResourceTimings;isFunction(e)&&e.call(r)},function(e){var t=(r||{}).getEntriesByName;return isFunction(t)&&t.call(r,e)||[]}]},UNKNOWN_PATH="<unknown>";function htmlTreeAsString(e){try{for(var t,r=e,n=[],o=0,i=0,u=" > ".length;r&&o++<5&&!("html"===(t=_htmlElementAsString(r))||1<o&&256<=i+n.length*u+t.length);)n.push(t),i+=t.length,r=r.parentNode;return n.reverse().join(" > ")}catch(e){return UNKNOWN_PATH}}function _htmlElementAsString(e){var t,r,n,o,i=e,u=[];if(!i||!i.tagName)return"";if(u.push(i.tagName.toLowerCase()),i.id)return"#"+i.id;e=i.className;if(e&&isString(e))for(r=e.split(/\s+/),c=0;c<r.length;c++)u.push("."+r[c]);for(var a=["type","name","title","alt"],c=0;c<a.length;c++)n=a[c],(o=i.getAttribute(n))&&u.push("["+n+'="'+o+'"]');for(var s=i,f=1,l=!0;s=s.previousElementSibling;)(null===(t=s.tagName)||void 0===t?void 0:t.toLowerCase())===(null===(t=i.tagName)||void 0===t?void 0:t.toLowerCase())&&(s.className===i.className&&a.every(function(e){return i.getAttribute(e)===(null==s?void 0:s.getAttribute(e))})&&(l=!1),f++);return 1<f&&!l&&u.push(":nth-of-type("+f+")"),u.join("")}var addListenerToWindow=function(e,t,r,n){return void 0===n&&(n=!1),e.addEventListener(t,r,n),function(){e.removeEventListener(t,r,n)}},addListenerToDocument=function(e,t,r,n){return void 0===n&&(n=!1),e.addEventListener(t,r,n),function(){e.removeEventListener(t,r,n)}},getConfig=function(e,t){return isObject(e)?__assign(__assign({},t),e):!!e&&t},XHR_SUBJECT_NAME="xhr_0",getReportPathRegExp=function(){var t=new RegExp("\\/monitor_web\\/collect|\\/monitor_browser\\/collect\\/batch","i");return function(e){return t.test(e)}},hookOpen=function(n){return function(){for(var e,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return e=__read(t,2),this._method=e[0],this._url=e[1],n.apply(this,t)}},hookSetHeader=function(o){return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._reqHeaders=this._reqHeaders||{};var r=__read(e,2),n=r[0],r=r[1];return this._reqHeaders[n]=r,o&&o.apply(this,e)}},hookOnreadystatechange=function(n,o){return hookMethodDangerously(n,"onreadystatechange",function(r){return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return 4===this.readyState&&o(n),r&&r.apply(this,e)}})},hookSend=function(n,o){var i=getReportPathRegExp();return function(){for(var e,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return this._start=now(),this._data=null==t?void 0:t[0],i(this._url)||(e=o([this._method,this._url,this._start,this]),hookOnreadystatechange(this,e)()),n.apply(this,t)}},applyXHR=function(n){return function(e,t){var r;n&&((r=[]).push(hookMethodDangerously(n,"open",hookOpen)()),r.push(hookMethodDangerously(n,"setRequestHeader",hookSetHeader)()),r.push(hookMethodDangerously(n,"send",hookSend)(e)),t(function(){r.forEach(function(e){return e()})}))}},FETCH_SUBJECT_NAME="fetch_0",hookFetch=function(n,o){return function(e,t){var r=o([e,t=void 0===t?{}:t]),t=n(e,t);return t.then(function(e){r(e)},function(){r(void 0)}),t}},observeFetch=function(e,t){var r,n=getDefaultBrowser();n&&fetch&&((r=[]).push(hookMethodDangerously(n,"fetch",hookFetch)(e)),t(function(){r.forEach(function(e){return e()})}))},fetchSubject=[FETCH_SUBJECT_NAME,observeFetch],RESOURCE_TYPE=["resource"],LONGTASK_TYPE=["longtask"],applyPerformanceObserver=function(n,o,i){var u=n&&new n(function(e,n){e.getEntries?e.getEntries().forEach(function(e,t,r){return o(e,t,r,n)}):i&&i()});return[function(e){if(!n||!u)return i&&i();try{u.observe({entryTypes:e})}catch(e){return i&&i()}},function(e,t){if(!n||!u)return i&&i();try{var r={type:e,buffered:!0};isUndefined(t)||(r.durationThreshold=t),u.observe(r)}catch(e){return i&&i()}u.observe({type:e,buffered:!1})},function(){return u&&u.disconnect()}]},observePerf=function(e,t,r){e=__read(applyPerformanceObserver(e,t),3),t=e[0],e=e[2];return t(r),e},LONGTASK_SUBJECT_NAME="longtask_0",observeLongtask=function(e,t){var r=getDefaultPerformanceObserver();r&&t(observePerf(r,e,LONGTASK_TYPE))},longtaskSubject=[LONGTASK_SUBJECT_NAME,observeLongtask],RESOURCE_SUBJECT_NAME="resource_0",observeResource=function(t,e){var r,n=getDefaultPerformanceObserver();n&&(r=getReportPathRegExp(),e(observePerf(n,function(e){r(e.name)||t(e)},RESOURCE_TYPE)))},resourceSubject=[RESOURCE_SUBJECT_NAME,observeResource],PAGEVIEW_EV_TYPE="pageview",JS_ERROR_EV_TYPE="js_error",HTTP_EV_TYPE="http",RESOURCE_ERROR_EV_TYPE="resource_error",RESOURCE_EV_TYPE="resource",PERFORMANCE_METRIC_EV_TYPE="performance",LONG_TASK_EV_TYPE="performance_longtask",ACTION_EV_TYPE="action",CLICK_EVENT_NAME="click",CLICK_SUBJECT_NAME=CLICK_EVENT_NAME+"_0",observeClick=function(e,t){var r,n=getDefaultDocument();n&&(r=addListenerToDocument(n,CLICK_EVENT_NAME,e,!0),t(function(){r()}))},clickSubject=[CLICK_SUBJECT_NAME,observeClick],ERROR_FIELDS=["name","message","stack","filename","lineno","colno"],normalize=function(e){var t;return isError(e)?t=pick(e,ERROR_FIELDS):(isPlainObject(e)||isEvent(e)||isString(e))&&(t={message:safeStringify(e)}),t},normalizeError=function(e){return normalize(e.error)},normalizeException=function(e){var t;try{var r=void 0;if("reason"in e?r=e.reason:"detail"in e&&"reason"in e.detail&&(r=e.detail.reason),r){var n=normalize(r);return __assign(__assign({},n),{name:null!==(t=n&&n.name)&&void 0!==t?t:"UnhandledRejection"})}}catch(e){}},normalizeUnknownError=function(e){return(isErrorEvent(e)?normalizeError:isPromiseRejectionEvent(e)?normalizeException:normalize)(e)},DEFAULT_EVENT_TARGET=["EventTarget","Window","Node","ApplicationCache","ChannelMergerNode","EventSource","FileReader","HTMLUnknownElement","IDBDatabase","IDBRequest","IDBTransaction","MessagePort","Notification","SVGElementInstance","Screen","TextTrack","TextTrackCue","TextTrackList","WebSocket","Worker","XMLHttpRequest","XMLHttpRequestEventTarget","XMLHttpRequestUpload"],DEFAULT_TIME_FUNCTION=["setTimeout","setInterval","requestAnimationFrame","requestIdleCallback"],xmlHttpRequestProps=["onload","onerror","onprogress","onreadystatechange"],ADD_EVENT_LISTENER="addEventListener",REMOVE_EVENT_LISTENER="removeEventListener",DEFAULT_SOURCE_TYPE="capture-global",observeAsyncErrorWithSource=function(o,e){function u(e,r){if(!isFunction(e))return e;var n={type:DEFAULT_SOURCE_TYPE,data:__assign({},r)},t=e._w_||(e._w_=function(){try{return(e.handleEvent&&isFunction(e.handleEvent)?e.handleEvent:e).apply(this,[].map.call(arguments,function(e){return u(e,r)}))}catch(e){var t=normalize(e);throw t&&o({source:n,error:t}),e}});return t._hook_=!0,t}var t=getDefaultBrowser(),r=getDefaultXMLHttpRequest(),n=[];t&&n.push.apply(n,__spreadArray([],__read(DEFAULT_TIME_FUNCTION.filter(function(e){return t[e]}).map(function(o){return hookObjectProperty(t,o,function(n){return function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return n&&n.call.apply(n,__spreadArray([this,u(e,{function:o})],__read(t),!1))}},!1)()})),!1)),r&&r.prototype&&n.push(hookObjectProperty(r.prototype,"send",function(n){return function(){for(var t=this,e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return xmlHttpRequestProps.filter(function(e){return t[e]&&!t[e]._hook_}).forEach(function(e){t[e]=u(t[e],{function:e})}),n.apply(this,e)}},!1)()),DEFAULT_EVENT_TARGET.forEach(function(i){var e=t&&t[i]&&t[i].prototype;e&&e[ADD_EVENT_LISTENER]&&(n.push(hookObjectProperty(e,ADD_EVENT_LISTENER,function(o){return function(e,t,r){try{var n=t.handleEvent;isFunction(n)&&(t.handleEvent=u(n,{function:"handleEvent",target:i}))}catch(e){}return o&&o.call(this,e,u(t,{function:ADD_EVENT_LISTENER,target:i}),r)}},!1)()),n.push(hookObjectProperty(e,REMOVE_EVENT_LISTENER,function(n){return function(e,t,r){return null!=t&&t._w_&&n.call(this,e,t._w_,r),n.call(this,e,t,r)}},!1)()))}),e(function(){return n.forEach(function(e){return e()})})},ASYNC_ERROR_SUBJECT_NAME="async_error_0",asyncErrorWithSourceSubject=[ASYNC_ERROR_SUBJECT_NAME,observeAsyncErrorWithSource],ERROR_SUBJECT_NAME="err_0",observeError=function(e,t){var r,n=getDefaultBrowser();n&&(r=addListenerToWindow(n,"error",e,!0),t(function(){r()}))},errorSubject=[ERROR_SUBJECT_NAME,observeError],PROMISE_REJECTION_SUBJECT_NAME="perr_0",observePromiseRejection=function(e,t){var r,n=getDefaultBrowser();n&&(r=addListenerToWindow(n,"unhandledrejection",e,!0),t(function(){r()}))},promiseRejectionSubject=[PROMISE_REJECTION_SUBJECT_NAME,observePromiseRejection],isSameErrorString=function(e,t){return e&&t&&e===t},shouldDropEvent=function(e,t){return!(!e||!t)&&!(!isSameErrorString(e.message,t.message)||!isSameErrorString(e.stack,t.stack))},dedupe=function(){var t;return function(e){try{if(shouldDropEvent(e,t))return void(t=e)}catch(e){reportSelfError(e)}return t=e}},jsErrorGetterWithContext=function(o,e,t,r){function n(e){var t=e.error,r=e.extra,n=e.react,e=e.source;!(t=f?_(t):t)||!t.message||l&&l.test(t.message)||o({ev_type:JS_ERROR_EV_TYPE,payload:{error:t,breadcrumbs:[],extra:r,react:n,source:e}})}var i=__read(t,3),u=i[0],a=i[1],c=i[2],s=r.ignoreErrors,t=r.onerror,i=r.onunhandledrejection,f=r.dedupe,r=r.captureGlobalAsync,l=getRegexp(s),_=dedupe();return t&&e.push(u[0](function(e){return n({error:normalizeError(e),source:{type:"onerror"}})})),i&&e.push(a[0](function(e){return n({error:normalizeException(e),source:{type:"onunhandledrejection"}})})),r&&e.push(c()[0](function(e){n(e)})),function(e,t,r){return n({error:normalizeUnknownError(e),extra:t,react:r,source:{type:"manual"}})}},JS_ERROR_MONITOR_PLUGIN_NAME="jsError",defaultConfig$1={ignoreErrors:[],onerror:!0,onunhandledrejection:!0,captureGlobalAsync:!1,dedupe:!0};function JsErrorMonitorBasePlugin(t,e){window.removeEventListener("error",t.pcErr,!0),window.removeEventListener("unhandledrejection",t.pcRej,!0);var r=getConfig(e,defaultConfig$1);r&&(r=jsErrorGetterWithContext(function(e){t.getBreadcrumbs&&(e.payload.breadcrumbs=t.getBreadcrumbs()),t.report(e)},e=[],[initSubjectInGlobal(t,errorSubject),initSubjectInGlobal(t,promiseRejectionSubject),function(){return initSubjectInGlobal(t,asyncErrorWithSourceSubject)}],r),registerTearDownGroup(t,JS_ERROR_MONITOR_PLUGIN_NAME,JS_ERROR_EV_TYPE,e),t.provide("captureException",r))}function JsErrorMonitorPlugin(t){t.on("init",function(){var e=null===(e=t.config())||void 0===e?void 0:e.plugins[JS_ERROR_MONITOR_PLUGIN_NAME];JsErrorMonitorBasePlugin(t,e)})}var defaultMetricContext={isSupport:!0,isPolyfill:!1,isBounced:!1,isCustom:!1,type:"perf"},initMetric=function(e,t){return __assign({name:e,value:t},defaultMetricContext)},wrapPerformanceMetric=function(e,t){return{ev_type:PERFORMANCE_METRIC_EV_TYPE,payload:e,overrides:t}},applyReportMetric=function(r){return function(e,t){r(wrapPerformanceMetric(e,t))}},SPA_LOAD_METRIC_NAME="spa_load",PAGE_ACTIVITY_DELAY=100,ROOT_TAGS=["BODY","HTML","HEAD"],SVG_TAG="SVG",DEFAULT_ATTR_NAME="data-apm-action",waitActionComplete=function(e,t,r,n){function o(){e.clearTimeout(i),a&&(i=e.setTimeout(function(){t()},PAGE_ACTIVITY_DELAY))}var i,u,a=!1;return[function(){a=!0,e.clearTimeout(u),u=e.setTimeout(function(){t(!0),r()},n),o()},o,function(){a=!1,e.clearTimeout(i),e.clearTimeout(u)}]},isSupportsElementClosest=function(){var e;return function(){return void 0===e?e="closest"in HTMLElement.prototype:e}}(),findElementWithAttributeByParents=function(e,t,r){void 0===r&&(r=10);for(var n=e,o=0;o<r&&n;o++){if(~ROOT_TAGS.indexOf(n.nodeName))return;if(n.hasAttribute(t))return n;n=n.parentElement}},getActionNameByAttribute=function(e,t){e=isSupportsElementClosest()?e.closest("["+t+"]"):findElementWithAttributeByParents(e,t);if(e)return e.getAttribute(t).trim()},getActionName=function(e,t){return getActionNameByAttribute(e,t)||e.innerText},isSVGTarget=function(e){for(var t=e,r=!1;t;)t.tagName.toUpperCase()===SVG_TAG?r=!(t=null):t=t.parentElement;return r},isElementWithinTwoLevels=function(e){e=e.children;return!e.length||![].slice.call(e).some(function(e){return 0<e.children.length})},isValidTarget=function(e){var t=e.tagName.toUpperCase();return 1===e.nodeType&&!ROOT_TAGS.includes(t)&&!isSVGTarget(e)&&((!e.style||"none"!==e.style.display)&&(!(!["A","BUTTON","INPUT","TEXTAREA"].includes(t)&&!getActionNameByAttribute(e,DEFAULT_ATTR_NAME))||!!isElementWithinTwoLevels(e)))},shouldIgnoreUrl=function(e,t){return!!(e&&e.length&&t&&checkIfHit(e,getFullUrl(t)))},shouldIgnoreEvent=function(e,t){var r;return t.ev_type===HTTP_EV_TYPE?r=t.payload.request.url:t.ev_type===RESOURCE_EV_TYPE&&"name"in t.payload?r=t.payload.name:t.ev_type===RESOURCE_ERROR_EV_TYPE&&(r=t.payload.url),shouldIgnoreUrl(e,r)},SUPPORT_TYPES=["click"],EVENT_LISTENER_OPTIONS={capture:!0},MIN_LONG_TASK=50,MAX_ACTIVITY_DELAY=1e4,applyIncompleteReq=function(e,t,r,n){var o=__read(t,2),i=o[0],u=o[1],t=__read(applyRecord(),3),o=t[0],a=t[1],c=t[2],s=0;return e.push(i[0](function(e){e=__read(e,2);e[0];e=e[1];if(shouldIgnoreUrl(n,e))return noop;var t=s+=1;return a(t,now()),r(),function(){c(t),r()}})),e.push(u[0](function(e){e=__read(e,1)[0],e="string"==typeof e?e:e.url;if(shouldIgnoreUrl(n,e))return noop;var t=s+=1;return a(t,now()),r(),function(){c(t),r()}})),o},actionGetterWithFetchObserver=function(o,t,e,r){function n(e){var t;!E||!l&&!Object.keys(E.metrics).length||Object.keys(y).length&&!e||(E.metrics[LONG_TASK_EV_TYPE]&&(E.metrics[LONG_TASK_EV_TYPE].duration=g),t=0<v.length?Math.max.apply(Math,__spreadArray([],__read(v),!1))-Math.min.apply(Math,__spreadArray([],__read(v),!1)):0,E.metrics[HTTP_EV_TYPE]&&(E.metrics[HTTP_EV_TYPE].duration=t),e=h()-E.start_time,d&&d({ev_type:ACTION_EV_TYPE,payload:__assign(__assign({},E),{duration:e,frontend_time:e-t})}),i())}function i(){A(),E&&(p={start_time:E.start_time,id:E.id}),E=null,v=[],g=0}function u(e){E&&(E.metrics[e]={count:(null!==(e=null===(e=E.metrics[e])||void 0===e?void 0:e.count)&&void 0!==e?e:0)+1})}var a=__read(e,4),c=a[0],s=a[1],f=a[2],e=a[3],a=r.types,l=r.pure,_=r.ignoreUrls,E=null,p=null,d=void 0,v=[],g=0,h=__read(applyPerformance(performance),2)[1],r=__read(waitActionComplete(window,n,i,MAX_ACTIVITY_DELAY),3),T=r[0],R=r[1],A=r[2],y=applyIncompleteReq(t,[c,s],R,_),c=__read(applyMutationObserver(MutationObserver,R),2),s=c[0],c=c[1];s(),t.push(c),t.push(A),t.push(f[0](function(e){var t=e.startTime,e=e.duration;R(),E&&E.start_time<=t+MIN_LONG_TASK&&(g+=e,u(LONG_TASK_EV_TYPE))})),t.push(e[0](function(e){var t=e.name,r=e.startTime,n=e.duration,e=e.initiatorType;shouldIgnoreUrl(_,t)||(R(),E&&E.start_time<r&&(["xmlhttprequest","fetch"].includes(e)&&(v.push(r,r+n),u(HTTP_EV_TYPE)),["xmlhttprequest","fetch","beacon"].includes(e)||u(RESOURCE_EV_TYPE)))}));function S(e,t){var r=uuid(),n=__read(applyPerformance(performance),2)[1];E={start_time:n(),id:r,type:t,target:e,metrics:{}},d=o(),T()}function m(e){var t;n(!0),i(),e.target instanceof HTMLElement&&isValidTarget(e.target)&&((t=getActionName(e.target,DEFAULT_ATTR_NAME))&&S({name:t,path:htmlTreeAsString(e.target)},e.type))}a&&a.forEach(function(e){arrayIncludes(SUPPORT_TYPES,e)&&t.push(addListenerToDocument(document,e,m,EVENT_LISTENER_OPTIONS))});return[function(e){if(!shouldIgnoreEvent(_,e)){if(e.ev_type===PAGEVIEW_EV_TYPE)return n(!0),void i();if(e.ev_type===HTTP_EV_TYPE)return(t=e.payload.response.timing&&e.payload.response.timing.startTime)?E&&t>E.start_time?E.id:p&&t>p.start_time?p.id:void 0:void 0;if(e.ev_type!==LONG_TASK_EV_TYPE)return E?(e.ev_type!==JS_ERROR_EV_TYPE&&e.ev_type!==RESOURCE_ERROR_EV_TYPE||u(e.ev_type),E.id):void 0;var t=e.payload.longtasks.length&&e.payload.longtasks[0].startTime+MIN_LONG_TASK;return E&&t&&t>E.start_time?E.id:void 0}},function(e,t){n(!0),i(),S({name:e},t)}]},ACTION_MONITOR_PLUGIN_NAME="action",defaultConfig={types:["click"],pure:!0};function ActionMonitorBasePlugin(e,t){void 0===t&&(t=defaultConfig);var r,n,o=[],i=getDefaultDocument(),u=getDefaultBrowser();i&&u&&(t=__read(actionGetterWithFetchObserver(function(){return reportWithCurrentContext(e,!0)},o,[initSubjectInGlobal(e,[XHR_SUBJECT_NAME,applyXHR(XMLHttpRequest&&XMLHttpRequest.prototype)]),initSubjectInGlobal(e,fetchSubject),initSubjectInGlobal(e,longtaskSubject),initSubjectInGlobal(e,resourceSubject)],t),2),r=t[0],t=t[1],e.on("report",n=function(e){var t=r(e);return t&&e.extra&&(e.extra.action_id=t),e}),o.push(function(){e.off("report",n)}),e.provide("startAction",t),registerTearDownGroup(e,ACTION_MONITOR_PLUGIN_NAME,ACTION_EV_TYPE,o))}var MAX_PAGE_DELAY=3e4,getSPA=function(e,t,r,n){function o(e){!E||Object.keys(h).length&&!e||(p(initMetric(SPA_LOAD_METRIC_NAME,now()-E)),i())}function i(){g(),E=0}var u=__read(r,7),a=u[0],c=u[1],s=u[2],f=u[3],l=u[4],r=u[5],u=u[6],_=n.ignoreUrls,E=0,p=applyReportMetric(e),e=__read(waitActionComplete(window,o,noop,MAX_PAGE_DELAY),3),d=e[0],v=e[1],g=e[2],h=applyIncompleteReq(t,[s,f],v,_);t.push(l[0](function(e){e=e.name;shouldIgnoreUrl(_,e)||v()})),t.push(r[0](v));var u=__read(applyMutationObserver(u,v),2),T=u[0],u=u[1];t.push(u);var R=!0;t.push(a[0](function(){R?R=!1:(o(!0),i(),E=now(),T(document,{childList:!0,subtree:!0}),d())})),t.push(c[0](function(){o(!0),i()})),t.push(i)};function SPALoadMonitorPlugin(n,o){void 0===o&&(o={}),n.on("init",function(){var e=[],t=getDefaultDocument(),r=getDefaultMutationObserver();t&&r&&(getSPA(n.report.bind(n),e,[initPrivateSubject(n,[PV_SUBJECT_NAME,applyPV(n)]),initSubjectInGlobal(n,clickSubject),initSubjectInGlobal(n,[XHR_SUBJECT_NAME,applyXHR(XMLHttpRequest&&XMLHttpRequest.prototype)]),initSubjectInGlobal(n,fetchSubject),initSubjectInGlobal(n,resourceSubject),initSubjectInGlobal(n,longtaskSubject),r],o),n.on("beforeDestroy",function(){e.forEach(function(e){return e()})}))})}var CAPTURE_CONSOLE_INTEGRATION_NAME="captureConsole",captureConsole=function(e){var e=e.levels,r=void 0===e?["log","info","warn","error","debug","assert"]:e;return{name:CAPTURE_CONSOLE_INTEGRATION_NAME,setup:function(n){var t,o=getDefaultBrowser();o&&o.console&&(t=[],r.forEach(function(e){e in o.console&&t.push(hookMethodDangerously(o.console,e,function(r){return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];try{r&&r.call.apply(r,__spreadArray([o.console],__read(e),!1))}finally{n("captureException",safeJoin(e," "))}}})())}),n.on("beforeDestroy",function(){t.forEach(function(e){return e()})}))}}},JS_ERROR_INTEGRATION_NAME=JS_ERROR_MONITOR_PLUGIN_NAME,jsErrorPlugin=function(){return{name:JS_ERROR_INTEGRATION_NAME,setup:function(e){JsErrorMonitorPlugin(e)}}},ACTION_INTEGRATION_NAME=ACTION_MONITOR_PLUGIN_NAME,actionPlugin=function(t){return{name:ACTION_INTEGRATION_NAME,setup:function(e){ActionMonitorBasePlugin(e,t)}}},SPA_LOAD_INTEGRATION_NAME="spa_load",SPALoadPlugin=function(t){return{name:SPA_LOAD_INTEGRATION_NAME,setup:function(e){SPALoadMonitorPlugin(e,t)}}};exports.SPALoadPlugin=SPALoadPlugin,exports.actionPlugin=actionPlugin,exports.captureConsole=captureConsole,exports.jsErrorPlugin=jsErrorPlugin,exports.refreshPreStartContext=refreshPreStartContext; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var __assign=function(){return(__assign=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function __read(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),u=[];try{for(;(void 0===t||0<t--)&&!(n=i.next()).done;)u.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return u}function __spreadArray(e,t,r){if(r||2===arguments.length)for(var n,o=0,i=t.length;o<i;o++)!n&&o in t||((n=n||Array.prototype.slice.call(t,0,o))[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))}var REFRESH_PRE_START_CONTEXT_INTEGRATION_NAME="refreshPreStartContext",refreshPreStartContext=function(){return{name:REFRESH_PRE_START_CONTEXT_INTEGRATION_NAME,setup:function(n){n.on("start",function(){var r=n.getPreStartQueue();r.forEach(function(e,t){r[t]=__assign(__assign({},e),{overrides:__assign(__assign({},null!==(e=e.overrides)&&void 0!==e?e:{}),{context:(null===(e=n.context)||void 0===e?void 0:e.toString())||{}})})})})}}},noop=function(){return{}};function isObject(e){return"object"==typeof e&&null!==e}function isUndefined(e){return void 0===e}function isInstanceOf(e,t){try{return e instanceof t}catch(e){return!1}}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 isError(e){switch(Object.prototype.toString.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMError]":case"[object DOMException]":return!0;default:return e instanceof Error}}function isEvent(e){return"undefined"!=typeof Event&&isInstanceOf(e,Event)}function isErrorEvent(e){return"[object ErrorEvent]"===Object.prototype.toString.call(e)}function isPromiseRejectionEvent(e){return"[object PromiseRejectionEvent]"===Object.prototype.toString.call(e)}function arrayIncludes(e,t){if(!isArray(e))return!1;if(0===e.length)return!1;for(var r=0;r<e.length;){if(e[r]===t)return!0;r++}return!1}var arrayRemove=function(e,t){if(!isArray(e))return e;var r=e.indexOf(t);if(0<=r){t=e.slice();return t.splice(r,1),t}return e},applyRecord=function(){var r={};return[r,function(e,t){return r[e]=t},function(e){return delete r[e]}]},pick=function(r,e){return r&&isObject(r)?e.reduce(function(e,t){return e[t]=r[t],e},{}):r};function getRegexp(e){return isArray(e)&&e.length?joinRegExp(e):null}function joinRegExp(e){for(var t=[],r=e.length,n=0;n<r;n++){var o=e[n];isString(o)?t.push(o.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")):o&&o.source&&t.push(o.source)}return new RegExp(t.join("|"),"i")}var checkIfHit=function(e,t){e=getRegexp(e||[]);return!!e&&e.test(t)};function safeStringify(e){try{return isString(e)?e:JSON.stringify(e)}catch(e){return"[FAILED_TO_STRINGIFY]:"+String(e)}}function safeJoin(e,t){if(!isArray(e))return"";for(var r=[],n=0;n<e.length;n++)try{r.push(String(e[n]))}catch(e){r.push("[value cannot be serialized]")}return r.join(t)}var hookObjectProperty=function(i,u,a,c){return void 0===c&&(c=!0),function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(!i)return noop;var r=i[u],n=a.apply(void 0,__spreadArray([r],__read(e),!1)),o=n;return isFunction(o)&&c&&(o=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];try{return n.apply(this,t)}catch(e){return isFunction(r)&&r.apply(this,t)}}),i[u]=o,function(e){e||(o===i[u]?i[u]=r:n=r)}}},hookMethodDangerously=function(i,u,a){return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(!i)return noop;var r=i[u],n=a.apply(void 0,__spreadArray([r],__read(e),!1)),o=n;return isFunction(o)&&(o=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return n.apply(this,e)}),i[u]=o,function(){o===i[u]?i[u]=r:n=r}}};function mathRNG(){for(var e=new Array(16),t=0,r=0;r<16;r++)0==(3&r)&&(t=4294967296*Math.random()),e[r]=t>>>((3&r)<<3)&255;return e}function bytesToUuid(e){for(var t=[],r=0;r<256;++r)t[r]=(r+256).toString(16).substr(1);var n=0,o=t;return[o[e[n++]],o[e[n++]],o[e[n++]],o[e[n++]],"-",o[e[n++]],o[e[n++]],"-",o[e[n++]],o[e[n++]],"-",o[e[n++]],o[e[n++]],"-",o[e[n++]],o[e[n++]],o[e[n++]],o[e[n++]],o[e[+n]],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,t,r){var n=0;return-1===r?noop:function(){if(e())return n&&clearTimeout(n),void(n=0);0===n&&(n=setTimeout(t,r))}},nextLink=function(n,e){var t=[];try{t=e.reduce(function(e,t){try{var r=t(n);"function"==typeof r&&e.push(r)}catch(e){}return e},[])}catch(e){}return function(e){return nextLink(e,t)}},toObservable=function(e){function t(e){n=arrayRemove(n,e),i||u()}var r,n=[],o=[],i=!1,u=applyBufferTimer(function(){return!!n.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,n)},complete:function(e){o.push(e)},attach:function(e,t){r=[e,t]},subscribe:function(e){if(i)throw new Error("Observer is closed");return n.push(e),r&&r[1]&&r[1](e),u(),function(){return t(e)}},unsubscribe:t}},createSafeObserver=function(e,t,r){r=toObservable(r);try{e(r.next,r.attach),t&&r.complete(t)}catch(e){}return[r.subscribe,r.unsubscribe]},registerTearDownGroup=function(e,t,r,n){return e.destroyAgent.set(t,r,n)};function initSubjectInGlobal(e,t){return e.initSubject(t)}function initPrivateSubject(e,t,r){var t=__read(t,2),n=t[0],t=t[1],o=e.privateSubject||{};return o[n]||(o[n]=createSafeObserver(t,function(){o[n]=void 0},r)),o[n]}var now=function(){return Date.now()};function getDefaultBrowser(){if("object"==typeof window&&isObject(window))return window}function getDefaultDocument(){if("object"==typeof document&&isObject(document))return document}function getDefaultLocation(){return getDefaultBrowser()&&window.location}function getDefaultXMLHttpRequest(){if("function"==typeof XMLHttpRequest&&isFunction(XMLHttpRequest))return XMLHttpRequest}function getDefaultMutationObserver(){if(getDefaultBrowser()&&isFunction(window.MutationObserver))return window.MutationObserver}function getDefaultPerformanceObserver(){if(getDefaultBrowser()&&isFunction(window.PerformanceObserver))return window.PerformanceObserver}function getFullUrl(e){var t=getDefaultDocument();if(!t||!e)return"";t=t.createElement("a");return t.href=e,t.href}function getLocationUrl(){var e=getDefaultBrowser()&&getDefaultLocation();return e?e.href:""}var getViewOverrides=function(e){return{pid:e.pid,view_id:e.viewId,url:getLocationUrl()}},getOverrides=function(e){var t=e.config(),t=getViewOverrides(t);return t.context=e.context?e.context.toString():{},t},reportWithCurrentContext=function(t,e){void 0===e&&(e=!1);var r=getOverrides(t);return e&&(r.timestamp=now()),function(e){t.report(__assign(__assign({},e),{overrides:r}))}},PV_SUBJECT_NAME="view_0",applyPV=function(o){return function(r,e){function t(e){var t;e.viewId&&e.viewId!==(null===(t=o.config())||void 0===t?void 0:t.viewId)&&(r(n),n=__assign(__assign({},getOverrides(o)),getViewOverrides(e)))}var n=getOverrides(o);o.on("beforeConfig",t),e(function(){o.off("beforeConfig",t)})}},getGlobalRegistry=function(e){if(e)return e.__SLARDAR_REGISTRY__||(e.__SLARDAR_REGISTRY__={Slardar:{plugins:[],errors:[],subject:{}}}),e.__SLARDAR_REGISTRY__.Slardar},reportSelfError=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=getGlobalRegistry(getDefaultBrowser());r&&(r.errors||(r.errors=[]),r.errors.push(e))},applyMutationObserver=function(e,t){var r=e&&new e(t);return[function(e,t){r&&e&&r.observe(e,t)},function(){return r&&r.disconnect()}]},applyPerformance=function(r){var e=r&&r.timing||void 0;return[e,function(){return r&&r.now?r.now():(Date.now?Date.now():+new Date)-(e&&e.navigationStart||0)},function(e){var t=(r||{}).getEntriesByType;return isFunction(t)&&t.call(r,e)||[]},function(){var e=(r||{}).clearResourceTimings;isFunction(e)&&e.call(r)},function(e){var t=(r||{}).getEntriesByName;return isFunction(t)&&t.call(r,e)||[]}]},UNKNOWN_PATH="<unknown>";function htmlTreeAsString(e){try{for(var t,r=e,n=[],o=0,i=0,u=" > ".length;r&&o++<5&&!("html"===(t=_htmlElementAsString(r))||1<o&&256<=i+n.length*u+t.length);)n.push(t),i+=t.length,r=r.parentNode;return n.reverse().join(" > ")}catch(e){return UNKNOWN_PATH}}function _htmlElementAsString(e){var t,r,n,o,i=e,u=[];if(!i||!i.tagName)return"";if(u.push(i.tagName.toLowerCase()),i.id)return"#"+i.id;e=i.className;if(e&&isString(e))for(r=e.split(/\s+/),c=0;c<r.length;c++)u.push("."+r[c]);for(var a=["type","name","title","alt"],c=0;c<a.length;c++)n=a[c],(o=i.getAttribute(n))&&u.push("["+n+'="'+o+'"]');for(var s=i,l=1,f=!0;s=s.previousElementSibling;)(null===(t=s.tagName)||void 0===t?void 0:t.toLowerCase())===(null===(t=i.tagName)||void 0===t?void 0:t.toLowerCase())&&(s.className===i.className&&a.every(function(e){return i.getAttribute(e)===(null==s?void 0:s.getAttribute(e))})&&(f=!1),l++);return 1<l&&!f&&u.push(":nth-of-type("+l+")"),u.join("")}var addListenerToWindow=function(e,t,r,n){return void 0===n&&(n=!1),e.addEventListener(t,r,n),function(){e.removeEventListener(t,r,n)}},addListenerToDocument=function(e,t,r,n){return void 0===n&&(n=!1),e.addEventListener(t,r,n),function(){e.removeEventListener(t,r,n)}},getConfig=function(e,t){return isObject(e)?__assign(__assign({},t),e):!!e&&t},XHR_SUBJECT_NAME="xhr_0",getReportPathRegExp=function(){var t=new RegExp("\\/monitor_web\\/collect|\\/monitor_browser\\/collect\\/batch","i");return function(e){return t.test(e)}},hookOpen=function(n){return function(){for(var e,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return e=__read(t,2),this._method=e[0],this._url=e[1],n.apply(this,t)}},hookSetHeader=function(o){return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._reqHeaders=this._reqHeaders||{};var r=__read(e,2),n=r[0],r=r[1];return this._reqHeaders[n]=r,o&&o.apply(this,e)}},hookOnreadystatechange=function(n,o){return hookMethodDangerously(n,"onreadystatechange",function(r){return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return 4===this.readyState&&o(n),r&&r.apply(this,e)}})},hookSend=function(n,o){var i=getReportPathRegExp();return function(){for(var e,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return this._start=now(),this._data=null==t?void 0:t[0],i(this._url)||(e=o([this._method,this._url,this._start,this]),hookOnreadystatechange(this,e)()),n.apply(this,t)}},applyXHR=function(n){return function(e,t){var r;n&&((r=[]).push(hookMethodDangerously(n,"open",hookOpen)()),r.push(hookMethodDangerously(n,"setRequestHeader",hookSetHeader)()),r.push(hookMethodDangerously(n,"send",hookSend)(e)),t(function(){r.forEach(function(e){return e()})}))}},FETCH_SUBJECT_NAME="fetch_0",hookFetch=function(n,o){return function(e,t){var r=o([e,t=void 0===t?{}:t]),t=n(e,t);return t.then(function(e){r(e)},function(){r(void 0)}),t}},observeFetch=function(e,t){var r,n=getDefaultBrowser();n&&fetch&&((r=[]).push(hookMethodDangerously(n,"fetch",hookFetch)(e)),t(function(){r.forEach(function(e){return e()})}))},fetchSubject=[FETCH_SUBJECT_NAME,observeFetch],RESOURCE_TYPE=["resource"],LONGTASK_TYPE=["longtask"],applyPerformanceObserver=function(n,o,i){var u=n&&new n(function(e,n){e.getEntries?e.getEntries().forEach(function(e,t,r){return o(e,t,r,n)}):i&&i()});return[function(e){if(!n||!u)return i&&i();try{u.observe({entryTypes:e})}catch(e){return i&&i()}},function(e,t){if(!n||!u)return i&&i();try{var r={type:e,buffered:!0};isUndefined(t)||(r.durationThreshold=t),u.observe(r)}catch(e){return i&&i()}u.observe({type:e,buffered:!1})},function(){return u&&u.disconnect()}]},observePerf=function(e,t,r){e=__read(applyPerformanceObserver(e,t),3),t=e[0],e=e[2];return t(r),e},LONGTASK_SUBJECT_NAME="longtask_0",observeLongtask=function(e,t){var r=getDefaultPerformanceObserver();r&&t(observePerf(r,e,LONGTASK_TYPE))},longtaskSubject=[LONGTASK_SUBJECT_NAME,observeLongtask],RESOURCE_SUBJECT_NAME="resource_0",observeResource=function(t,e){var r,n=getDefaultPerformanceObserver();n&&(r=getReportPathRegExp(),e(observePerf(n,function(e){r(e.name)||t(e)},RESOURCE_TYPE)))},resourceSubject=[RESOURCE_SUBJECT_NAME,observeResource],PAGEVIEW_EV_TYPE="pageview",JS_ERROR_EV_TYPE="js_error",HTTP_EV_TYPE="http",RESOURCE_ERROR_EV_TYPE="resource_error",RESOURCE_EV_TYPE="resource",PERFORMANCE_METRIC_EV_TYPE="performance",LONG_TASK_EV_TYPE="performance_longtask",ACTION_EV_TYPE="action",CLICK_EVENT_NAME="click",CLICK_SUBJECT_NAME=CLICK_EVENT_NAME+"_0",observeClick=function(e,t){var r,n=getDefaultDocument();n&&(r=addListenerToDocument(n,CLICK_EVENT_NAME,e,!0),t(function(){r()}))},clickSubject=[CLICK_SUBJECT_NAME,observeClick],ERROR_FIELDS=["name","message","stack","filename","lineno","colno"],normalize=function(e){var t;return isError(e)?t=pick(e,ERROR_FIELDS):(isPlainObject(e)||isEvent(e)||isString(e))&&(t={message:safeStringify(e)}),t},normalizeError=function(e){var t=normalize(e.error);if(!t)return t;var r=e.colno,n=e.lineno,e=e.filename;return r&&!t.colno&&(t.colno=String(r)),n&&!t.lineno&&(t.lineno=String(n)),e&&!t.filename&&(t.filename=e),t},normalizeException=function(e){var t;try{var r=void 0;if("reason"in e?r=e.reason:"detail"in e&&"reason"in e.detail&&(r=e.detail.reason),r){var n=normalize(r);return __assign(__assign({},n),{name:null!==(t=n&&n.name)&&void 0!==t?t:"UnhandledRejection"})}}catch(e){}},normalizeUnknownError=function(e){return(isErrorEvent(e)?normalizeError:isPromiseRejectionEvent(e)?normalizeException:normalize)(e)},DEFAULT_EVENT_TARGET=["EventTarget","Window","Node","ApplicationCache","ChannelMergerNode","EventSource","FileReader","HTMLUnknownElement","IDBDatabase","IDBRequest","IDBTransaction","MessagePort","Notification","SVGElementInstance","Screen","TextTrack","TextTrackCue","TextTrackList","WebSocket","Worker","XMLHttpRequest","XMLHttpRequestEventTarget","XMLHttpRequestUpload"],DEFAULT_TIME_FUNCTION=["setTimeout","setInterval","requestAnimationFrame","requestIdleCallback"],xmlHttpRequestProps=["onload","onerror","onprogress","onreadystatechange"],ADD_EVENT_LISTENER="addEventListener",REMOVE_EVENT_LISTENER="removeEventListener",DEFAULT_SOURCE_TYPE="capture-global",observeAsyncErrorWithSource=function(o,e){function u(e,r){if(!isFunction(e))return e;var n={type:DEFAULT_SOURCE_TYPE,data:__assign({},r)},t=e._w_||(e._w_=function(){try{return(e.handleEvent&&isFunction(e.handleEvent)?e.handleEvent:e).apply(this,[].map.call(arguments,function(e){return u(e,r)}))}catch(e){var t=normalize(e);throw t&&o({source:n,error:t}),e}});return t._hook_=!0,t}var t=getDefaultBrowser(),r=getDefaultXMLHttpRequest(),n=[];t&&n.push.apply(n,__spreadArray([],__read(DEFAULT_TIME_FUNCTION.filter(function(e){return t[e]}).map(function(o){return hookObjectProperty(t,o,function(n){return function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return n&&n.call.apply(n,__spreadArray([this,u(e,{function:o})],__read(t),!1))}},!1)()})),!1)),r&&r.prototype&&n.push(hookObjectProperty(r.prototype,"send",function(n){return function(){for(var t=this,e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return xmlHttpRequestProps.filter(function(e){return t[e]&&!t[e]._hook_}).forEach(function(e){t[e]=u(t[e],{function:e})}),n.apply(this,e)}},!1)()),DEFAULT_EVENT_TARGET.forEach(function(i){var e=t&&t[i]&&t[i].prototype;e&&e[ADD_EVENT_LISTENER]&&(n.push(hookObjectProperty(e,ADD_EVENT_LISTENER,function(o){return function(e,t,r){try{var n=t.handleEvent;isFunction(n)&&(t.handleEvent=u(n,{function:"handleEvent",target:i}))}catch(e){}return o&&o.call(this,e,u(t,{function:ADD_EVENT_LISTENER,target:i}),r)}},!1)()),n.push(hookObjectProperty(e,REMOVE_EVENT_LISTENER,function(n){return function(e,t,r){return null!=t&&t._w_&&n.call(this,e,t._w_,r),n.call(this,e,t,r)}},!1)()))}),e(function(){return n.forEach(function(e){return e()})})},ASYNC_ERROR_SUBJECT_NAME="async_error_0",asyncErrorWithSourceSubject=[ASYNC_ERROR_SUBJECT_NAME,observeAsyncErrorWithSource],ERROR_SUBJECT_NAME="err_0",observeError=function(e,t){var r,n=getDefaultBrowser();n&&(r=addListenerToWindow(n,"error",e,!0),t(function(){r()}))},errorSubject=[ERROR_SUBJECT_NAME,observeError],PROMISE_REJECTION_SUBJECT_NAME="perr_0",observePromiseRejection=function(e,t){var r,n=getDefaultBrowser();n&&(r=addListenerToWindow(n,"unhandledrejection",e,!0),t(function(){r()}))},promiseRejectionSubject=[PROMISE_REJECTION_SUBJECT_NAME,observePromiseRejection],isSameErrorString=function(e,t){return e&&t&&e===t},shouldDropEvent=function(e,t){return!(!e||!t)&&!(!isSameErrorString(e.message,t.message)||!isSameErrorString(e.stack,t.stack))},dedupe=function(){var t;return function(e){try{if(shouldDropEvent(e,t))return void(t=e)}catch(e){reportSelfError(e)}return t=e}},jsErrorGetterWithContext=function(o,e,t,r){function n(e){var t=e.error,r=e.extra,n=e.react,e=e.source;!(t=l?_(t):t)||!t.message||f&&f.test(t.message)||o({ev_type:JS_ERROR_EV_TYPE,payload:{error:t,breadcrumbs:[],extra:r,react:n,source:e}})}var i=__read(t,3),u=i[0],a=i[1],c=i[2],s=r.ignoreErrors,t=r.onerror,i=r.onunhandledrejection,l=r.dedupe,r=r.captureGlobalAsync,f=getRegexp(s),_=dedupe();return t&&e.push(u[0](function(e){return n({error:normalizeError(e),source:{type:"onerror"}})})),i&&e.push(a[0](function(e){return n({error:normalizeException(e),source:{type:"onunhandledrejection"}})})),r&&e.push(c()[0](function(e){n(e)})),function(e,t,r){return n({error:normalizeUnknownError(e),extra:t,react:r,source:{type:"manual"}})}},JS_ERROR_MONITOR_PLUGIN_NAME="jsError",defaultConfig$1={ignoreErrors:[],onerror:!0,onunhandledrejection:!0,captureGlobalAsync:!1,dedupe:!0};function JsErrorMonitorBasePlugin(t,e){window.removeEventListener("error",t.pcErr,!0),window.removeEventListener("unhandledrejection",t.pcRej,!0);var r=getConfig(e,defaultConfig$1);r&&(r=jsErrorGetterWithContext(function(e){t.getBreadcrumbs&&(e.payload.breadcrumbs=t.getBreadcrumbs()),t.report(e)},e=[],[initSubjectInGlobal(t,errorSubject),initSubjectInGlobal(t,promiseRejectionSubject),function(){return initSubjectInGlobal(t,asyncErrorWithSourceSubject)}],r),registerTearDownGroup(t,JS_ERROR_MONITOR_PLUGIN_NAME,JS_ERROR_EV_TYPE,e),t.provide("captureException",r))}function JsErrorMonitorPlugin(t){t.on("init",function(){var e=null===(e=t.config())||void 0===e?void 0:e.plugins[JS_ERROR_MONITOR_PLUGIN_NAME];JsErrorMonitorBasePlugin(t,e)})}var defaultMetricContext={isSupport:!0,isPolyfill:!1,isBounced:!1,isCustom:!1,type:"perf"},initMetric=function(e,t){return __assign({name:e,value:t},defaultMetricContext)},wrapPerformanceMetric=function(e,t){return{ev_type:PERFORMANCE_METRIC_EV_TYPE,payload:e,overrides:t}},applyReportMetric=function(r){return function(e,t){r(wrapPerformanceMetric(e,t))}},SPA_LOAD_METRIC_NAME="spa_load",PAGE_ACTIVITY_DELAY=100,ROOT_TAGS=["BODY","HTML","HEAD"],SVG_TAG="SVG",DEFAULT_ATTR_NAME="data-apm-action",waitActionComplete=function(e,t,r,n){function o(){e.clearTimeout(i),a&&(i=e.setTimeout(function(){t()},PAGE_ACTIVITY_DELAY))}var i,u,a=!1;return[function(){a=!0,e.clearTimeout(u),u=e.setTimeout(function(){t(!0),r()},n),o()},o,function(){a=!1,e.clearTimeout(i),e.clearTimeout(u)}]},isSupportsElementClosest=function(){var e;return function(){return void 0===e?e="closest"in HTMLElement.prototype:e}}(),findElementWithAttributeByParents=function(e,t,r){void 0===r&&(r=10);for(var n=e,o=0;o<r&&n;o++){if(~ROOT_TAGS.indexOf(n.nodeName))return;if(n.hasAttribute(t))return n;n=n.parentElement}},getActionNameByAttribute=function(e,t){e=isSupportsElementClosest()?e.closest("["+t+"]"):findElementWithAttributeByParents(e,t);if(e)return e.getAttribute(t).trim()},getActionName=function(e,t){return getActionNameByAttribute(e,t)||e.innerText},isSVGTarget=function(e){for(var t=e,r=!1;t;)t.tagName.toUpperCase()===SVG_TAG?r=!(t=null):t=t.parentElement;return r},isElementWithinTwoLevels=function(e){e=e.children;return!e.length||![].slice.call(e).some(function(e){return 0<e.children.length})},isValidTarget=function(e){var t=e.tagName.toUpperCase();return 1===e.nodeType&&!ROOT_TAGS.includes(t)&&!isSVGTarget(e)&&((!e.style||"none"!==e.style.display)&&(!(!["A","BUTTON","INPUT","TEXTAREA"].includes(t)&&!getActionNameByAttribute(e,DEFAULT_ATTR_NAME))||!!isElementWithinTwoLevels(e)))},shouldIgnoreUrl=function(e,t){return!!(e&&e.length&&t&&checkIfHit(e,getFullUrl(t)))},shouldIgnoreEvent=function(e,t){var r;return t.ev_type===HTTP_EV_TYPE?r=t.payload.request.url:t.ev_type===RESOURCE_EV_TYPE&&"name"in t.payload?r=t.payload.name:t.ev_type===RESOURCE_ERROR_EV_TYPE&&(r=t.payload.url),shouldIgnoreUrl(e,r)},SUPPORT_TYPES=["click"],EVENT_LISTENER_OPTIONS={capture:!0},MIN_LONG_TASK=50,MAX_ACTIVITY_DELAY=1e4,applyIncompleteReq=function(e,t,r,n){var o=__read(t,2),i=o[0],u=o[1],t=__read(applyRecord(),3),o=t[0],a=t[1],c=t[2],s=0;return e.push(i[0](function(e){e=__read(e,2);e[0];e=e[1];if(shouldIgnoreUrl(n,e))return noop;var t=s+=1;return a(t,now()),r(),function(){c(t),r()}})),e.push(u[0](function(e){e=__read(e,1)[0],e="string"==typeof e?e:e.url;if(shouldIgnoreUrl(n,e))return noop;var t=s+=1;return a(t,now()),r(),function(){c(t),r()}})),o},actionGetterWithFetchObserver=function(o,t,e,r){function n(e){var t;!E||!f&&!Object.keys(E.metrics).length||Object.keys(y).length&&!e||(E.metrics[LONG_TASK_EV_TYPE]&&(E.metrics[LONG_TASK_EV_TYPE].duration=g),t=0<v.length?Math.max.apply(Math,__spreadArray([],__read(v),!1))-Math.min.apply(Math,__spreadArray([],__read(v),!1)):0,E.metrics[HTTP_EV_TYPE]&&(E.metrics[HTTP_EV_TYPE].duration=t),e=h()-E.start_time,d&&d({ev_type:ACTION_EV_TYPE,payload:__assign(__assign({},E),{duration:e,frontend_time:e-t})}),i())}function i(){A(),E&&(p={start_time:E.start_time,id:E.id}),E=null,v=[],g=0}function u(e){E&&(E.metrics[e]={count:(null!==(e=null===(e=E.metrics[e])||void 0===e?void 0:e.count)&&void 0!==e?e:0)+1})}var a=__read(e,4),c=a[0],s=a[1],l=a[2],e=a[3],a=r.types,f=r.pure,_=r.ignoreUrls,E=null,p=null,d=void 0,v=[],g=0,h=__read(applyPerformance(performance),2)[1],r=__read(waitActionComplete(window,n,i,MAX_ACTIVITY_DELAY),3),T=r[0],R=r[1],A=r[2],y=applyIncompleteReq(t,[c,s],R,_),c=__read(applyMutationObserver(MutationObserver,R),2),s=c[0],c=c[1];s(),t.push(c),t.push(A),t.push(l[0](function(e){var t=e.startTime,e=e.duration;R(),E&&E.start_time<=t+MIN_LONG_TASK&&(g+=e,u(LONG_TASK_EV_TYPE))})),t.push(e[0](function(e){var t=e.name,r=e.startTime,n=e.duration,e=e.initiatorType;shouldIgnoreUrl(_,t)||(R(),E&&E.start_time<r&&(["xmlhttprequest","fetch"].includes(e)&&(v.push(r,r+n),u(HTTP_EV_TYPE)),["xmlhttprequest","fetch","beacon"].includes(e)||u(RESOURCE_EV_TYPE)))}));function S(e,t){var r=uuid(),n=__read(applyPerformance(performance),2)[1];E={start_time:n(),id:r,type:t,target:e,metrics:{}},d=o(),T()}function m(e){var t;n(!0),i(),e.target instanceof HTMLElement&&isValidTarget(e.target)&&((t=getActionName(e.target,DEFAULT_ATTR_NAME))&&S({name:t,path:htmlTreeAsString(e.target)},e.type))}a&&a.forEach(function(e){arrayIncludes(SUPPORT_TYPES,e)&&t.push(addListenerToDocument(document,e,m,EVENT_LISTENER_OPTIONS))});return[function(e){if(!shouldIgnoreEvent(_,e)){if(e.ev_type===PAGEVIEW_EV_TYPE)return n(!0),void i();if(e.ev_type===HTTP_EV_TYPE)return(t=e.payload.response.timing&&e.payload.response.timing.startTime)?E&&t>E.start_time?E.id:p&&t>p.start_time?p.id:void 0:void 0;if(e.ev_type!==LONG_TASK_EV_TYPE)return E?(e.ev_type!==JS_ERROR_EV_TYPE&&e.ev_type!==RESOURCE_ERROR_EV_TYPE||u(e.ev_type),E.id):void 0;var t=e.payload.longtasks.length&&e.payload.longtasks[0].startTime+MIN_LONG_TASK;return E&&t&&t>E.start_time?E.id:void 0}},function(e,t){n(!0),i(),S({name:e},t)}]},ACTION_MONITOR_PLUGIN_NAME="action",defaultConfig={types:["click"],pure:!0};function ActionMonitorBasePlugin(e,t){void 0===t&&(t=defaultConfig);var r,n,o=[],i=getDefaultDocument(),u=getDefaultBrowser();i&&u&&(t=__read(actionGetterWithFetchObserver(function(){return reportWithCurrentContext(e,!0)},o,[initSubjectInGlobal(e,[XHR_SUBJECT_NAME,applyXHR(XMLHttpRequest&&XMLHttpRequest.prototype)]),initSubjectInGlobal(e,fetchSubject),initSubjectInGlobal(e,longtaskSubject),initSubjectInGlobal(e,resourceSubject)],t),2),r=t[0],t=t[1],e.on("report",n=function(e){var t=r(e);return t&&e.extra&&(e.extra.action_id=t),e}),o.push(function(){e.off("report",n)}),e.provide("startAction",t),registerTearDownGroup(e,ACTION_MONITOR_PLUGIN_NAME,ACTION_EV_TYPE,o))}var MAX_PAGE_DELAY=3e4,getSPA=function(e,t,r,n){function o(e){!E||Object.keys(h).length&&!e||(p(initMetric(SPA_LOAD_METRIC_NAME,now()-E)),i())}function i(){g(),E=0}var u=__read(r,7),a=u[0],c=u[1],s=u[2],l=u[3],f=u[4],r=u[5],u=u[6],_=n.ignoreUrls,E=0,p=applyReportMetric(e),e=__read(waitActionComplete(window,o,noop,MAX_PAGE_DELAY),3),d=e[0],v=e[1],g=e[2],h=applyIncompleteReq(t,[s,l],v,_);t.push(f[0](function(e){e=e.name;shouldIgnoreUrl(_,e)||v()})),t.push(r[0](v));var u=__read(applyMutationObserver(u,v),2),T=u[0],u=u[1];t.push(u);var R=!0;t.push(a[0](function(){R?R=!1:(o(!0),i(),E=now(),T(document,{childList:!0,subtree:!0}),d())})),t.push(c[0](function(){o(!0),i()})),t.push(i)};function SPALoadMonitorPlugin(n,o){void 0===o&&(o={}),n.on("init",function(){var e=[],t=getDefaultDocument(),r=getDefaultMutationObserver();t&&r&&(getSPA(n.report.bind(n),e,[initPrivateSubject(n,[PV_SUBJECT_NAME,applyPV(n)]),initSubjectInGlobal(n,clickSubject),initSubjectInGlobal(n,[XHR_SUBJECT_NAME,applyXHR(XMLHttpRequest&&XMLHttpRequest.prototype)]),initSubjectInGlobal(n,fetchSubject),initSubjectInGlobal(n,resourceSubject),initSubjectInGlobal(n,longtaskSubject),r],o),n.on("beforeDestroy",function(){e.forEach(function(e){return e()})}))})}var CAPTURE_CONSOLE_INTEGRATION_NAME="captureConsole",captureConsole=function(e){var e=e.levels,r=void 0===e?["log","info","warn","error","debug","assert"]:e;return{name:CAPTURE_CONSOLE_INTEGRATION_NAME,setup:function(n){var t,o=getDefaultBrowser();o&&o.console&&(t=[],r.forEach(function(e){e in o.console&&t.push(hookMethodDangerously(o.console,e,function(r){return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];try{r&&r.call.apply(r,__spreadArray([o.console],__read(e),!1))}finally{n("captureException",safeJoin(e," "))}}})())}),n.on("beforeDestroy",function(){t.forEach(function(e){return e()})}))}}},JS_ERROR_INTEGRATION_NAME=JS_ERROR_MONITOR_PLUGIN_NAME,jsErrorPlugin=function(){return{name:JS_ERROR_INTEGRATION_NAME,setup:function(e){JsErrorMonitorPlugin(e)}}},ACTION_INTEGRATION_NAME=ACTION_MONITOR_PLUGIN_NAME,actionPlugin=function(t){return{name:ACTION_INTEGRATION_NAME,setup:function(e){ActionMonitorBasePlugin(e,t)}}},SPA_LOAD_INTEGRATION_NAME="spa_load",SPALoadPlugin=function(t){return{name:SPA_LOAD_INTEGRATION_NAME,setup:function(e){SPALoadMonitorPlugin(e,t)}}};exports.SPALoadPlugin=SPALoadPlugin,exports.actionPlugin=actionPlugin,exports.captureConsole=captureConsole,exports.jsErrorPlugin=jsErrorPlugin,exports.refreshPreStartContext=refreshPreStartContext; |
@@ -324,2 +324,4 @@ interface ContextAgent { | ||
type: string; | ||
/** 可附加的日志,长度限制 100K */ | ||
attached_log?: string; | ||
} | ||
@@ -1008,2 +1010,3 @@ | ||
}; | ||
attached_log?: string; | ||
}; | ||
@@ -1016,2 +1019,3 @@ declare type CustomLogData = { | ||
}; | ||
attached_log?: string; | ||
}; | ||
@@ -1018,0 +1022,0 @@ declare type SendCustomEvent = (data: CustomEventData) => void; |
@@ -1,1 +0,1 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var __assign=function(){return(__assign=Object.assign||function(r){for(var e,t=1,n=arguments.length;t<n;t++)for(var o in e=arguments[t])Object.prototype.hasOwnProperty.call(e,o)&&(r[o]=e[o]);return r}).apply(this,arguments)};function __read(r,e){var t="function"==typeof Symbol&&r[Symbol.iterator];if(!t)return r;var n,o,i=t.call(r),u=[];try{for(;(void 0===e||0<e--)&&!(n=i.next()).done;)u.push(n.value)}catch(r){o={error:r}}finally{try{n&&!n.done&&(t=i.return)&&t.call(i)}finally{if(o)throw o.error}}return u}function __spreadArray(r,e,t){if(t||2===arguments.length)for(var n,o=0,i=e.length;o<i;o++)!n&&o in e||((n=n||Array.prototype.slice.call(e,0,o))[o]=e[o]);return r.concat(n||Array.prototype.slice.call(e))}var noop=function(){return{}};function isObject(r){return"object"==typeof r&&null!==r}function isInstanceOf(r,e){try{return r instanceof e}catch(r){return!1}}var objProto=Object.prototype;function isPlainObject(r){if(isObject(r)){if("function"!=typeof Object.getPrototypeOf)return"[object Object]"===objProto.toString.call(r);r=Object.getPrototypeOf(r);return r===objProto||null===r}return!1}function isArray(r){return"[object Array]"===objProto.toString.call(r)}function isFunction(r){return"function"==typeof r}function isString(r){return"string"==typeof r}function isError(r){switch(Object.prototype.toString.call(r)){case"[object Error]":case"[object Exception]":case"[object DOMError]":case"[object DOMException]":return!0;default:return r instanceof Error}}function isEvent(r){return"undefined"!=typeof Event&&isInstanceOf(r,Event)}function isErrorEvent(r){return"[object ErrorEvent]"===Object.prototype.toString.call(r)}function isPromiseRejectionEvent(r){return"[object PromiseRejectionEvent]"===Object.prototype.toString.call(r)}var pick=function(t,r){return t&&isObject(t)?r.reduce(function(r,e){return r[e]=t[e],r},{}):t};function getRegexp(r){return isArray(r)&&r.length?joinRegExp(r):null}function joinRegExp(r){for(var e=[],t=r.length,n=0;n<t;n++){var o=r[n];isString(o)?e.push(o.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")):o&&o.source&&e.push(o.source)}return new RegExp(e.join("|"),"i")}function safeStringify(r){try{return isString(r)?r:JSON.stringify(r)}catch(r){return"[FAILED_TO_STRINGIFY]:"+String(r)}}var hookObjectProperty=function(i,u,c,a){return void 0===a&&(a=!0),function(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];if(!i)return noop;var t=i[u],n=c.apply(void 0,__spreadArray([t],__read(r),!1)),o=n;return isFunction(o)&&a&&(o=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];try{return n.apply(this,e)}catch(r){return isFunction(t)&&t.apply(this,e)}}),i[u]=o,function(r){r||(o===i[u]?i[u]=t:n=t)}}},registerTearDownGroup=function(r,e,t,n){return r.destroyAgent.set(e,t,n)};function initSubjectInGlobal(r,e){return r.initSubject(e)}function getDefaultBrowser(){if("object"==typeof window&&isObject(window))return window}function getDefaultXMLHttpRequest(){if("function"==typeof XMLHttpRequest&&isFunction(XMLHttpRequest))return XMLHttpRequest}var getGlobalRegistry=function(r){if(r)return r.__SLARDAR_REGISTRY__||(r.__SLARDAR_REGISTRY__={Slardar:{plugins:[],errors:[],subject:{}}}),r.__SLARDAR_REGISTRY__.Slardar},reportSelfError=function(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];var t=getGlobalRegistry(getDefaultBrowser());t&&(t.errors||(t.errors=[]),t.errors.push(r))},addListenerToWindow=function(r,e,t,n){return void 0===n&&(n=!1),r.addEventListener(e,t,n),function(){r.removeEventListener(e,t,n)}},getConfig=function(r,e){return isObject(r)?__assign(__assign({},e),r):!!r&&e},JS_ERROR_EV_TYPE="js_error",ERROR_FIELDS=["name","message","stack","filename","lineno","colno"],normalize=function(r){var e;return isError(r)?e=pick(r,ERROR_FIELDS):(isPlainObject(r)||isEvent(r)||isString(r))&&(e={message:safeStringify(r)}),e},normalizeError=function(r){return normalize(r.error)},normalizeException=function(r){var e;try{var t=void 0;if("reason"in r?t=r.reason:"detail"in r&&"reason"in r.detail&&(t=r.detail.reason),t){var n=normalize(t);return __assign(__assign({},n),{name:null!==(e=n&&n.name)&&void 0!==e?e:"UnhandledRejection"})}}catch(r){}},normalizeUnknownError=function(r){return(isErrorEvent(r)?normalizeError:isPromiseRejectionEvent(r)?normalizeException:normalize)(r)},DEFAULT_EVENT_TARGET=["EventTarget","Window","Node","ApplicationCache","ChannelMergerNode","EventSource","FileReader","HTMLUnknownElement","IDBDatabase","IDBRequest","IDBTransaction","MessagePort","Notification","SVGElementInstance","Screen","TextTrack","TextTrackCue","TextTrackList","WebSocket","Worker","XMLHttpRequest","XMLHttpRequestEventTarget","XMLHttpRequestUpload"],DEFAULT_TIME_FUNCTION=["setTimeout","setInterval","requestAnimationFrame","requestIdleCallback"],xmlHttpRequestProps=["onload","onerror","onprogress","onreadystatechange"],ADD_EVENT_LISTENER="addEventListener",REMOVE_EVENT_LISTENER="removeEventListener",DEFAULT_SOURCE_TYPE="capture-global",observeAsyncErrorWithSource=function(o,r){function u(r,t){if(!isFunction(r))return r;var n={type:DEFAULT_SOURCE_TYPE,data:__assign({},t)},e=r._w_||(r._w_=function(){try{return(r.handleEvent&&isFunction(r.handleEvent)?r.handleEvent:r).apply(this,[].map.call(arguments,function(r){return u(r,t)}))}catch(r){var e=normalize(r);throw e&&o({source:n,error:e}),r}});return e._hook_=!0,e}var e=getDefaultBrowser(),t=getDefaultXMLHttpRequest(),n=[];e&&n.push.apply(n,__spreadArray([],__read(DEFAULT_TIME_FUNCTION.filter(function(r){return e[r]}).map(function(o){return hookObjectProperty(e,o,function(n){return function(r){for(var e=[],t=1;t<arguments.length;t++)e[t-1]=arguments[t];return n&&n.call.apply(n,__spreadArray([this,u(r,{function:o})],__read(e),!1))}},!1)()})),!1)),t&&t.prototype&&n.push(hookObjectProperty(t.prototype,"send",function(n){return function(){for(var e=this,r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return xmlHttpRequestProps.filter(function(r){return e[r]&&!e[r]._hook_}).forEach(function(r){e[r]=u(e[r],{function:r})}),n.apply(this,r)}},!1)()),DEFAULT_EVENT_TARGET.forEach(function(i){var r=e&&e[i]&&e[i].prototype;r&&r[ADD_EVENT_LISTENER]&&(n.push(hookObjectProperty(r,ADD_EVENT_LISTENER,function(o){return function(r,e,t){try{var n=e.handleEvent;isFunction(n)&&(e.handleEvent=u(n,{function:"handleEvent",target:i}))}catch(r){}return o&&o.call(this,r,u(e,{function:ADD_EVENT_LISTENER,target:i}),t)}},!1)()),n.push(hookObjectProperty(r,REMOVE_EVENT_LISTENER,function(n){return function(r,e,t){return null!=e&&e._w_&&n.call(this,r,e._w_,t),n.call(this,r,e,t)}},!1)()))}),r(function(){return n.forEach(function(r){return r()})})},ASYNC_ERROR_SUBJECT_NAME="async_error_0",asyncErrorWithSourceSubject=[ASYNC_ERROR_SUBJECT_NAME,observeAsyncErrorWithSource],ERROR_SUBJECT_NAME="err_0",observeError=function(r,e){var t,n=getDefaultBrowser();n&&(t=addListenerToWindow(n,"error",r,!0),e(function(){t()}))},errorSubject=[ERROR_SUBJECT_NAME,observeError],PROMISE_REJECTION_SUBJECT_NAME="perr_0",observePromiseRejection=function(r,e){var t,n=getDefaultBrowser();n&&(t=addListenerToWindow(n,"unhandledrejection",r,!0),e(function(){t()}))},promiseRejectionSubject=[PROMISE_REJECTION_SUBJECT_NAME,observePromiseRejection],isSameErrorString=function(r,e){return r&&e&&r===e},shouldDropEvent=function(r,e){return!(!r||!e)&&!(!isSameErrorString(r.message,e.message)||!isSameErrorString(r.stack,e.stack))},dedupe=function(){var e;return function(r){try{if(shouldDropEvent(r,e))return void(e=r)}catch(r){reportSelfError(r)}return e=r}},jsErrorGetterWithContext=function(o,r,e,t){function n(r){var e=r.error,t=r.extra,n=r.react,r=r.source;!(e=E?f(e):e)||!e.message||l&&l.test(e.message)||o({ev_type:JS_ERROR_EV_TYPE,payload:{error:e,breadcrumbs:[],extra:t,react:n,source:r}})}var i=__read(e,3),u=i[0],c=i[1],a=i[2],s=t.ignoreErrors,e=t.onerror,i=t.onunhandledrejection,E=t.dedupe,t=t.captureGlobalAsync,l=getRegexp(s),f=dedupe();return e&&r.push(u[0](function(r){return n({error:normalizeError(r),source:{type:"onerror"}})})),i&&r.push(c[0](function(r){return n({error:normalizeException(r),source:{type:"onunhandledrejection"}})})),t&&r.push(a()[0](function(r){n(r)})),function(r,e,t){return n({error:normalizeUnknownError(r),extra:e,react:t,source:{type:"manual"}})}},JS_ERROR_MONITOR_PLUGIN_NAME="jsError",defaultConfig={ignoreErrors:[],onerror:!0,onunhandledrejection:!0,captureGlobalAsync:!1,dedupe:!0};function JsErrorMonitorBasePlugin(e,r){window.removeEventListener("error",e.pcErr,!0),window.removeEventListener("unhandledrejection",e.pcRej,!0);var t=getConfig(r,defaultConfig);t&&(t=jsErrorGetterWithContext(function(r){e.getBreadcrumbs&&(r.payload.breadcrumbs=e.getBreadcrumbs()),e.report(r)},r=[],[initSubjectInGlobal(e,errorSubject),initSubjectInGlobal(e,promiseRejectionSubject),function(){return initSubjectInGlobal(e,asyncErrorWithSourceSubject)}],t),registerTearDownGroup(e,JS_ERROR_MONITOR_PLUGIN_NAME,JS_ERROR_EV_TYPE,r),e.provide("captureException",t))}function JsErrorMonitorPlugin(e){e.on("init",function(){var r=null===(r=e.config())||void 0===r?void 0:r.plugins[JS_ERROR_MONITOR_PLUGIN_NAME];JsErrorMonitorBasePlugin(e,r)})}var JS_ERROR_INTEGRATION_NAME=JS_ERROR_MONITOR_PLUGIN_NAME,jsErrorPlugin=function(){return{name:JS_ERROR_INTEGRATION_NAME,setup:function(r){JsErrorMonitorPlugin(r)}}};exports.JS_ERROR_INTEGRATION_NAME=JS_ERROR_INTEGRATION_NAME,exports.jsErrorPlugin=jsErrorPlugin; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var __assign=function(){return(__assign=Object.assign||function(r){for(var e,t=1,n=arguments.length;t<n;t++)for(var o in e=arguments[t])Object.prototype.hasOwnProperty.call(e,o)&&(r[o]=e[o]);return r}).apply(this,arguments)};function __read(r,e){var t="function"==typeof Symbol&&r[Symbol.iterator];if(!t)return r;var n,o,i=t.call(r),u=[];try{for(;(void 0===e||0<e--)&&!(n=i.next()).done;)u.push(n.value)}catch(r){o={error:r}}finally{try{n&&!n.done&&(t=i.return)&&t.call(i)}finally{if(o)throw o.error}}return u}function __spreadArray(r,e,t){if(t||2===arguments.length)for(var n,o=0,i=e.length;o<i;o++)!n&&o in e||((n=n||Array.prototype.slice.call(e,0,o))[o]=e[o]);return r.concat(n||Array.prototype.slice.call(e))}var noop=function(){return{}};function isObject(r){return"object"==typeof r&&null!==r}function isInstanceOf(r,e){try{return r instanceof e}catch(r){return!1}}var objProto=Object.prototype;function isPlainObject(r){if(isObject(r)){if("function"!=typeof Object.getPrototypeOf)return"[object Object]"===objProto.toString.call(r);r=Object.getPrototypeOf(r);return r===objProto||null===r}return!1}function isArray(r){return"[object Array]"===objProto.toString.call(r)}function isFunction(r){return"function"==typeof r}function isString(r){return"string"==typeof r}function isError(r){switch(Object.prototype.toString.call(r)){case"[object Error]":case"[object Exception]":case"[object DOMError]":case"[object DOMException]":return!0;default:return r instanceof Error}}function isEvent(r){return"undefined"!=typeof Event&&isInstanceOf(r,Event)}function isErrorEvent(r){return"[object ErrorEvent]"===Object.prototype.toString.call(r)}function isPromiseRejectionEvent(r){return"[object PromiseRejectionEvent]"===Object.prototype.toString.call(r)}var pick=function(t,r){return t&&isObject(t)?r.reduce(function(r,e){return r[e]=t[e],r},{}):t};function getRegexp(r){return isArray(r)&&r.length?joinRegExp(r):null}function joinRegExp(r){for(var e=[],t=r.length,n=0;n<t;n++){var o=r[n];isString(o)?e.push(o.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")):o&&o.source&&e.push(o.source)}return new RegExp(e.join("|"),"i")}function safeStringify(r){try{return isString(r)?r:JSON.stringify(r)}catch(r){return"[FAILED_TO_STRINGIFY]:"+String(r)}}var hookObjectProperty=function(i,u,c,a){return void 0===a&&(a=!0),function(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];if(!i)return noop;var t=i[u],n=c.apply(void 0,__spreadArray([t],__read(r),!1)),o=n;return isFunction(o)&&a&&(o=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];try{return n.apply(this,e)}catch(r){return isFunction(t)&&t.apply(this,e)}}),i[u]=o,function(r){r||(o===i[u]?i[u]=t:n=t)}}},registerTearDownGroup=function(r,e,t,n){return r.destroyAgent.set(e,t,n)};function initSubjectInGlobal(r,e){return r.initSubject(e)}function getDefaultBrowser(){if("object"==typeof window&&isObject(window))return window}function getDefaultXMLHttpRequest(){if("function"==typeof XMLHttpRequest&&isFunction(XMLHttpRequest))return XMLHttpRequest}var getGlobalRegistry=function(r){if(r)return r.__SLARDAR_REGISTRY__||(r.__SLARDAR_REGISTRY__={Slardar:{plugins:[],errors:[],subject:{}}}),r.__SLARDAR_REGISTRY__.Slardar},reportSelfError=function(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];var t=getGlobalRegistry(getDefaultBrowser());t&&(t.errors||(t.errors=[]),t.errors.push(r))},addListenerToWindow=function(r,e,t,n){return void 0===n&&(n=!1),r.addEventListener(e,t,n),function(){r.removeEventListener(e,t,n)}},getConfig=function(r,e){return isObject(r)?__assign(__assign({},e),r):!!r&&e},JS_ERROR_EV_TYPE="js_error",ERROR_FIELDS=["name","message","stack","filename","lineno","colno"],normalize=function(r){var e;return isError(r)?e=pick(r,ERROR_FIELDS):(isPlainObject(r)||isEvent(r)||isString(r))&&(e={message:safeStringify(r)}),e},normalizeError=function(r){var e=normalize(r.error);if(!e)return e;var t=r.colno,n=r.lineno,r=r.filename;return t&&!e.colno&&(e.colno=String(t)),n&&!e.lineno&&(e.lineno=String(n)),r&&!e.filename&&(e.filename=r),e},normalizeException=function(r){var e;try{var t=void 0;if("reason"in r?t=r.reason:"detail"in r&&"reason"in r.detail&&(t=r.detail.reason),t){var n=normalize(t);return __assign(__assign({},n),{name:null!==(e=n&&n.name)&&void 0!==e?e:"UnhandledRejection"})}}catch(r){}},normalizeUnknownError=function(r){return(isErrorEvent(r)?normalizeError:isPromiseRejectionEvent(r)?normalizeException:normalize)(r)},DEFAULT_EVENT_TARGET=["EventTarget","Window","Node","ApplicationCache","ChannelMergerNode","EventSource","FileReader","HTMLUnknownElement","IDBDatabase","IDBRequest","IDBTransaction","MessagePort","Notification","SVGElementInstance","Screen","TextTrack","TextTrackCue","TextTrackList","WebSocket","Worker","XMLHttpRequest","XMLHttpRequestEventTarget","XMLHttpRequestUpload"],DEFAULT_TIME_FUNCTION=["setTimeout","setInterval","requestAnimationFrame","requestIdleCallback"],xmlHttpRequestProps=["onload","onerror","onprogress","onreadystatechange"],ADD_EVENT_LISTENER="addEventListener",REMOVE_EVENT_LISTENER="removeEventListener",DEFAULT_SOURCE_TYPE="capture-global",observeAsyncErrorWithSource=function(o,r){function u(r,t){if(!isFunction(r))return r;var n={type:DEFAULT_SOURCE_TYPE,data:__assign({},t)},e=r._w_||(r._w_=function(){try{return(r.handleEvent&&isFunction(r.handleEvent)?r.handleEvent:r).apply(this,[].map.call(arguments,function(r){return u(r,t)}))}catch(r){var e=normalize(r);throw e&&o({source:n,error:e}),r}});return e._hook_=!0,e}var e=getDefaultBrowser(),t=getDefaultXMLHttpRequest(),n=[];e&&n.push.apply(n,__spreadArray([],__read(DEFAULT_TIME_FUNCTION.filter(function(r){return e[r]}).map(function(o){return hookObjectProperty(e,o,function(n){return function(r){for(var e=[],t=1;t<arguments.length;t++)e[t-1]=arguments[t];return n&&n.call.apply(n,__spreadArray([this,u(r,{function:o})],__read(e),!1))}},!1)()})),!1)),t&&t.prototype&&n.push(hookObjectProperty(t.prototype,"send",function(n){return function(){for(var e=this,r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return xmlHttpRequestProps.filter(function(r){return e[r]&&!e[r]._hook_}).forEach(function(r){e[r]=u(e[r],{function:r})}),n.apply(this,r)}},!1)()),DEFAULT_EVENT_TARGET.forEach(function(i){var r=e&&e[i]&&e[i].prototype;r&&r[ADD_EVENT_LISTENER]&&(n.push(hookObjectProperty(r,ADD_EVENT_LISTENER,function(o){return function(r,e,t){try{var n=e.handleEvent;isFunction(n)&&(e.handleEvent=u(n,{function:"handleEvent",target:i}))}catch(r){}return o&&o.call(this,r,u(e,{function:ADD_EVENT_LISTENER,target:i}),t)}},!1)()),n.push(hookObjectProperty(r,REMOVE_EVENT_LISTENER,function(n){return function(r,e,t){return null!=e&&e._w_&&n.call(this,r,e._w_,t),n.call(this,r,e,t)}},!1)()))}),r(function(){return n.forEach(function(r){return r()})})},ASYNC_ERROR_SUBJECT_NAME="async_error_0",asyncErrorWithSourceSubject=[ASYNC_ERROR_SUBJECT_NAME,observeAsyncErrorWithSource],ERROR_SUBJECT_NAME="err_0",observeError=function(r,e){var t,n=getDefaultBrowser();n&&(t=addListenerToWindow(n,"error",r,!0),e(function(){t()}))},errorSubject=[ERROR_SUBJECT_NAME,observeError],PROMISE_REJECTION_SUBJECT_NAME="perr_0",observePromiseRejection=function(r,e){var t,n=getDefaultBrowser();n&&(t=addListenerToWindow(n,"unhandledrejection",r,!0),e(function(){t()}))},promiseRejectionSubject=[PROMISE_REJECTION_SUBJECT_NAME,observePromiseRejection],isSameErrorString=function(r,e){return r&&e&&r===e},shouldDropEvent=function(r,e){return!(!r||!e)&&!(!isSameErrorString(r.message,e.message)||!isSameErrorString(r.stack,e.stack))},dedupe=function(){var e;return function(r){try{if(shouldDropEvent(r,e))return void(e=r)}catch(r){reportSelfError(r)}return e=r}},jsErrorGetterWithContext=function(o,r,e,t){function n(r){var e=r.error,t=r.extra,n=r.react,r=r.source;!(e=E?f(e):e)||!e.message||l&&l.test(e.message)||o({ev_type:JS_ERROR_EV_TYPE,payload:{error:e,breadcrumbs:[],extra:t,react:n,source:r}})}var i=__read(e,3),u=i[0],c=i[1],a=i[2],s=t.ignoreErrors,e=t.onerror,i=t.onunhandledrejection,E=t.dedupe,t=t.captureGlobalAsync,l=getRegexp(s),f=dedupe();return e&&r.push(u[0](function(r){return n({error:normalizeError(r),source:{type:"onerror"}})})),i&&r.push(c[0](function(r){return n({error:normalizeException(r),source:{type:"onunhandledrejection"}})})),t&&r.push(a()[0](function(r){n(r)})),function(r,e,t){return n({error:normalizeUnknownError(r),extra:e,react:t,source:{type:"manual"}})}},JS_ERROR_MONITOR_PLUGIN_NAME="jsError",defaultConfig={ignoreErrors:[],onerror:!0,onunhandledrejection:!0,captureGlobalAsync:!1,dedupe:!0};function JsErrorMonitorBasePlugin(e,r){window.removeEventListener("error",e.pcErr,!0),window.removeEventListener("unhandledrejection",e.pcRej,!0);var t=getConfig(r,defaultConfig);t&&(t=jsErrorGetterWithContext(function(r){e.getBreadcrumbs&&(r.payload.breadcrumbs=e.getBreadcrumbs()),e.report(r)},r=[],[initSubjectInGlobal(e,errorSubject),initSubjectInGlobal(e,promiseRejectionSubject),function(){return initSubjectInGlobal(e,asyncErrorWithSourceSubject)}],t),registerTearDownGroup(e,JS_ERROR_MONITOR_PLUGIN_NAME,JS_ERROR_EV_TYPE,r),e.provide("captureException",t))}function JsErrorMonitorPlugin(e){e.on("init",function(){var r=null===(r=e.config())||void 0===r?void 0:r.plugins[JS_ERROR_MONITOR_PLUGIN_NAME];JsErrorMonitorBasePlugin(e,r)})}var JS_ERROR_INTEGRATION_NAME=JS_ERROR_MONITOR_PLUGIN_NAME,jsErrorPlugin=function(){return{name:JS_ERROR_INTEGRATION_NAME,setup:function(r){JsErrorMonitorPlugin(r)}}};exports.JS_ERROR_INTEGRATION_NAME=JS_ERROR_INTEGRATION_NAME,exports.jsErrorPlugin=jsErrorPlugin; |
@@ -324,2 +324,4 @@ interface ContextAgent { | ||
type: string; | ||
/** 可附加的日志,长度限制 100K */ | ||
attached_log?: string; | ||
} | ||
@@ -1008,2 +1010,3 @@ | ||
}; | ||
attached_log?: string; | ||
}; | ||
@@ -1016,2 +1019,3 @@ declare type CustomLogData = { | ||
}; | ||
attached_log?: string; | ||
}; | ||
@@ -1018,0 +1022,0 @@ declare type SendCustomEvent = (data: CustomEventData) => void; |
@@ -126,2 +126,4 @@ interface ContextAgent { | ||
type: string; | ||
/** 可附加的日志,长度限制 100K */ | ||
attached_log?: string; | ||
} | ||
@@ -128,0 +130,0 @@ |
@@ -324,2 +324,4 @@ interface ContextAgent { | ||
type: string; | ||
/** 可附加的日志,长度限制 100K */ | ||
attached_log?: string; | ||
} | ||
@@ -1008,2 +1010,3 @@ | ||
}; | ||
attached_log?: string; | ||
}; | ||
@@ -1016,2 +1019,3 @@ declare type CustomLogData = { | ||
}; | ||
attached_log?: string; | ||
}; | ||
@@ -1018,0 +1022,0 @@ declare type SendCustomEvent = (data: CustomEventData) => void; |
@@ -324,2 +324,4 @@ interface ContextAgent { | ||
type: string; | ||
/** 可附加的日志,长度限制 100K */ | ||
attached_log?: string; | ||
} | ||
@@ -1012,2 +1014,3 @@ | ||
}; | ||
attached_log?: string; | ||
}; | ||
@@ -1020,2 +1023,3 @@ declare type CustomLogData = { | ||
}; | ||
attached_log?: string; | ||
}; | ||
@@ -1022,0 +1026,0 @@ declare type SendCustomEvent = (data: CustomEventData) => void; |
{ | ||
"name": "@apmplus/integrations", | ||
"version": "2.2.0", | ||
"version": "2.2.1-alpha.0", | ||
"description": "APMPlus Integrations", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is too big to display
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
563348
14251
2