rollbar
Version:
Effortlessly track and debug errors in your JavaScript applications with Rollbar. This package includes advanced error tracking features and an intuitive interface to help you identify and fix issues more quickly.
2 lines • 382 kB
JavaScript
/*! For license information please see rollbar.replay.min.js.LICENSE.txt */
!function(){"use strict";var e={d:function(t,r){for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r:function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return n(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var o=0,i=function(){};return{s:i,n:function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,s=!0,u=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return s=e.done,e},e:function(e){u=!0,a=e},f:function(){try{s||null==r.return||r.return()}finally{if(u)throw a}}}}function n(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function o(e){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o(e)}function i(e,t){return t===a(e)}function a(e){var t=o(e);return"object"!==t?t:e?e instanceof Error?"error":{}.toString.call(e).match(/\s([a-zA-Z]+)/)[1].toLowerCase():"null"}function s(e){return i(e,"function")}function u(e){return null!=e&&("object"==o(e)||"function"==typeof e)}function l(e,t){return null!=e&&(Object.hasOwn?Object.hasOwn(e,t):Object.prototype.hasOwnProperty.call(e,t))}function c(e){return Number.isFinite(e)}function f(e){return i(e,"error")||i(e,"exception")}function h(){return"********"}e.r(t),e.d(t,{parse:function(){return dn}});var p={debug:0,info:1,warning:2,error:3,critical:4};function d(e){try{var t=new URL(e);return t.password&&(t.password="********"),t.search&&(t.search="********"),t.toString()}catch(t){return e}}function v(e){var t=function(e){if(!i(e,"string"))return;for(var t=y,r=t.parser[t.strictMode?"strict":"loose"].exec(e),n={},o=0,a=t.key.length;o<a;++o)n[t.key[o]]=r[o]||"";return n[t.q.name]={},n[t.key[12]].replace(t.q.parser,function(e,r,o){r&&(n[t.q.name][r]=o)}),n}(e);return t?(""===t.anchor&&(t.source=t.source.replace("#","")),e=t.source.replace("?"+t.query,"")):"(unknown)"}var y={strictMode:!1,key:["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],q:{name:"queryKey",parser:/(?:^|&)([^&=]*)=?([^&]*)/g},parser:{strict:/^(?:([^:/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\d*))?))?((((?:[^?#/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,loose:/^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#/]*\.[^?#/.]+(?:[?#]|$)))*\/?)?([^?#/]*))(?:\?([^#]*))?(?:#(.*))?)/}};function m(e,t){if(!(t=t||e.protocol)&&e.port&&(80===e.port?t="http:":443===e.port&&(t="https:")),t=t||"https:",!e.hostname)return null;var r=t+"//"+e.hostname;return e.port&&(r=r+":"+e.port),e.path&&(r+=e.path),r}function g(e,t){var r,n;try{r=JSON.stringify(e)}catch(o){if(t&&s(t))try{r=t(e)}catch(e){n=e}else n=o}return{error:n,value:r}}function b(e){var t,r;try{t=JSON.parse(e)}catch(e){r=e}return{error:r,value:t}}function w(e,t,r,n,o,i,a,s){var u={url:t||"",line:r,column:n};u.func=s.guessFunctionName(u.url,u.line),u.context=s.gatherContext(u.url,u.line);var l="undefined"!=typeof document&&document&&document.location&&document.location.href,c="undefined"!=typeof window&&window&&window.navigator&&window.navigator.userAgent;return{mode:i,message:o?String(o):e||a,url:l,stack:[u],useragent:c}}function k(e,t){return function(r,n){try{t(r,n)}catch(t){e.error(t)}}}function S(e){return function e(t,r){var n,o,s,u={};try{for(o in t)(n=t[o])&&(i(n,"object")||i(n,"array"))?r.includes(n)?u[o]="Removed circular reference: "+a(n):((s=r.slice()).push(n),u[o]=e(n,s)):u[o]=n}catch(e){u="Failed cloning custom data: "+e.message}return u}(e,[e])}function C(e,t,r,n,o){for(var i,s,u,l,c,f,h=[],p=[],d=0,v=e.length;d<v;++d){var y=a(f=e[d]);switch(p.push(y),y){case"undefined":break;case"string":i?h.push(f):i=f;break;case"function":l=k(t,f);break;case"date":h.push(f);break;case"error":case"domexception":case"exception":s?h.push(f):s=f;break;case"object":case"array":if(f instanceof Error||"undefined"!=typeof DOMException&&f instanceof DOMException){s?h.push(f):s=f;break}if(n&&"object"===y&&!c){for(var m=0,g=n.length;m<g;++m)if(void 0!==f[n[m]]){c=f;break}if(c)break}u?h.push(f):u=f;break;default:if(f instanceof Error||"undefined"!=typeof DOMException&&f instanceof DOMException){s?h.push(f):s=f;break}h.push(f)}}u&&(u=S(u)),h.length>0&&(u||(u=S({})),u.extraArgs=S(h));var b,w={message:i,err:s,custom:u,timestamp:R(),callback:l,notifier:r,diagnostic:{},uuid:(b=R(),"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=(b+16*Math.random())%16|0;return b=Math.floor(b/16),("x"===e?t:7&t|8).toString(16)}))};return w.data=w.data||{},function(e,t){t&&void 0!==t.level&&(e.level=t.level,delete t.level);t&&void 0!==t.skipFrames&&(e.skipFrames=t.skipFrames,delete t.skipFrames)}(w,u),n&&c&&(w.request=c),o&&(w.lambdaContext=o),w._originalArgs=e,w.diagnostic.original_arg_types=p,w}var I=["log","network","dom","navigation","error","manual"],O=["critical","error","warning","info","debug"];function x(e,t){var n,o=r(e);try{for(o.s();!(n=o.n()).done;){if(n.value===t)return!0}}catch(e){o.e(e)}finally{o.f()}return!1}function _(e,t){e.attributes=e.attributes||[];var n,o=r(t);try{for(o.s();!(n=o.n()).done;){var i=n.value;void 0!==i.value&&e.attributes.push(i)}}catch(e){o.e(e)}finally{o.f()}}function E(e,t){if(e){var r=t.split("."),n=e;try{for(var o=0,i=r.length;o<i;++o)n=n[r[o]]}catch(e){n=void 0}return n}}function A(e,t,r){if(e){Object.setPrototypeOf(e,null);var n=t.split("."),o=n.length;if(!(o<1))if(1!==o)try{for(var i=e[n[0]]||{},a=i,s=1;s<o-1;++s)i[n[s]]=i[n[s]]||{},i=i[n[s]];i[n[o-1]]=r,e[n[0]]=a}catch(e){return}else e[n[0]]=r}}function R(){return Date.now?Date.now():Number(new Date)}function T(e,t,r,n){var o=M(e,t,r);return o=function(e,t){e.hostWhiteList&&!e.hostSafeList&&(e.hostSafeList=e.hostWhiteList,e.hostWhiteList=void 0,t&&t.log("hostWhiteList is deprecated. Use hostSafeList."));e.hostBlackList&&!e.hostBlockList&&(e.hostBlockList=e.hostBlackList,e.hostBlackList=void 0,t&&t.log("hostBlackList is deprecated. Use hostBlockList."));return e}(o,n),!t||t.overwriteScrubFields||t.scrubFields&&(o.scrubFields=(e.scrubFields||[]).concat(t.scrubFields)),o}function M(){function e(e){if(!e||"[object Object]"!==Object.prototype.toString.call(e))return!1;var t,r=l(e,"constructor"),n=e.constructor&&e.constructor.prototype&&l(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!r&&!n)return!1;for(t in e);return void 0===t||l(e,t)}var t,r,n,o,i,a=Object.create(null),s=null,u=arguments.length;for(t=0;t<u;t++)if(null!=(s=arguments[t]))for(i in s)r=a[i],a!==(n=s[i])&&(n&&e(n)?(o=r&&e(r)?r:{},a[i]=M(o,n)):void 0!==n&&(a[i]=n));return a}function P(e,t,r){var n;if(null==t||!t.sessionId||!r)return!1;var o=null==e||null===(n=e.tracing)||void 0===n?void 0:n.propagation,a=null==o?void 0:o.enabledHeaders;if(!Array.isArray(a)||!a.includes("baggage"))return!1;var s=null==o?void 0:o.enabledCorsUrls;return!(!Array.isArray(s)||0===s.length)&&s.some(function(e){return i(e,"string")?r===e:!!i(e,"regexp")&&e.test(r)})}function j(e,t){var r,n=e[1],o=null===(r=n)||void 0===r?void 0:r.headers,i=function(e){return"undefined"!=typeof Request&&e instanceof Request}(e[0])&&e[0].headers,a=o||i;if(a||(n||(e[1]=n={}),a=n.headers={}),a instanceof Headers)for(var s=0,l=Object.keys(t);s<l.length;s++){var c=l[s];a.append(c,t[c])}else if(u(a))for(var f=0,h=Object.keys(t);f<h.length;f++){var p=h[f];a[p]=t[p]}}var N=function(e,t,r){var n,o,a,s,u=i(e,"object"),c=i(e,"array"),f=[];if(r=r||{obj:[],mapped:[]},u){if(s=r.obj.indexOf(e),u&&-1!==s)return r.mapped[s]||r.obj[s];r.obj.push(e),s=r.obj.length-1}if(u)for(n in e)l(e,n)&&f.push(n);else if(c)for(a=0;a<e.length;++a)f.push(a);var h=u?{}:[],p=!0;for(a=0;a<f.length;++a)o=e[n=f[a]],h[n]=t(n,o,r),p=p&&h[n]===e[n];return u&&!p&&(r.mapped[s]=h),p?e:h};function L(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,i,a,s=[],u=!0,l=!1;try{if(i=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=i.call(r)).done)&&(s.push(n.value),s.length!==t);u=!0);}catch(e){l=!0,o=e}finally{try{if(!u&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return s}}(e,t)||F(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function D(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=F(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,i=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw i}}}}function F(e,t){if(e){if("string"==typeof e)return U(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?U(e,t):void 0}}function U(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function B(e,t){var r=t.split("."),n=r.length-1;try{var o,i=D(r.entries());try{for(i.s();!(o=i.n()).done;){var a=L(o.value,2),s=a[0],u=a[1];s<n?e=e[u]:e[u]=h()}}catch(e){i.e(e)}finally{i.f()}}catch(e){}}var W=function(e,t,r){if(t=t||[],r){var n,o=D(r);try{for(o.s();!(n=o.n()).done;){B(e,n.value)}}catch(e){o.e(e)}finally{o.f()}}var a=function(e){var t,r=[],n=D(e);try{for(n.s();!(t=n.n()).done;){var o="^\\[?(%5[bB])?"+t.value+"\\[?(%5[bB])?\\]?(%5[dD])?$";r.push(new RegExp(o,"i"))}}catch(e){n.e(e)}finally{n.f()}return r}(t),s=function(e){var t,r=[],n=D(e);try{for(n.s();!(t=n.n()).done;){var o="\\[?(%5[bB])?"+t.value+"\\[?(%5[bB])?\\]?(%5[dD])?";r.push(new RegExp("("+o+"=)([^&\\n]+)","igm"))}}catch(e){n.e(e)}finally{n.f()}return r}(t);function u(e,t){return t+"********"}return N(e,function e(t,r,n){var o=function(e,t){var r,n=D(a);try{for(n.s();!(r=n.n()).done;)if(r.value.test(e)){t=h();break}}catch(e){n.e(e)}finally{n.f()}return t}(t,r);return o===r?i(r,"object")||i(r,"array")?N(r,e,n):function(e){if(i(e,"string")){var t,r=D(s);try{for(r.s();!(t=r.n()).done;){var n=t.value;e=e.replace(n,u)}}catch(e){r.e(e)}finally{r.f()}}return e}(o):o})},z=["otelAttributes"];function G(e){return G="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},G(e)}function V(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function H(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?V(Object(r),!0).forEach(function(t){q(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):V(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function q(e,t,r){return(t=Z(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function J(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,Z(n.key),n)}}function Z(e){var t=function(e,t){if("object"!=G(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=G(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==G(t)?t:t+""}var Y=100;function X(e){return[Math.trunc(e/1e3),Math.round(e%1e3*1e6)]}var K=function(){return e=function e(t,r){var n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.queue=[],this.options=M(t);var o=this.options.maxTelemetryEvents||Y;this.maxQueueSize=Math.max(0,Math.min(o,Y)),this.tracing=r,this.telemetrySpan=null===(n=this.tracing)||void 0===n?void 0:n.startSpan("rollbar-telemetry",{})},t=[{key:"configure",value:function(e){var t=this.options;this.options=M(t,e);var r=this.options.maxTelemetryEvents||Y,n=Math.max(0,Math.min(r,Y)),o=0;this.queue.length>n&&(o=this.queue.length-n),this.maxQueueSize=n,this.queue.splice(0,o)}},{key:"copyEvents",value:function(){var e=Array.prototype.slice.call(this.queue,0);if(s(this.options.filterTelemetry))try{for(var t=e.length;t--;)this.options.filterTelemetry(e[t])&&e.splice(t,1)}catch(e){this.options.filterTelemetry=null}return e=(e=e.filter(function(e){return"connectivity"!==e.type})).map(function(e){e.otelAttributes;var t=function(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(-1!==t.indexOf(n))continue;r[n]=e[n]}return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],-1===t.indexOf(r)&&{}.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}(e,z);return t}),e}},{key:"exportTelemetrySpan",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.telemetrySpan&&(this.telemetrySpan.end(e),this.telemetrySpan=this.tracing.startSpan("rollbar-telemetry",{}))}},{key:"capture",value:function(e,t,r,n){var o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,a={level:$(e,r),type:e,timestamp_ms:o||R(),body:t,source:"client"};n&&(a.uuid=n),i&&(a.otelAttributes=i);try{if(s(this.options.filterTelemetry)&&this.options.filterTelemetry(a))return!1}catch(e){this.options.filterTelemetry=null}return this.push(a),a}},{key:"captureEvent",value:function(e,t,r,n){return this.capture(e,t,r,n)}},{key:"captureError",value:function(e,t,r,n){var o,i=e.message||String(e),a={message:i};e.stack&&(a.stack=e.stack);var s={message:i,level:t,type:"error",uuid:r};return null===(o=this.telemetrySpan)||void 0===o||o.addEvent("rollbar-occurrence-event",s,X(n)),this.capture("error",a,t,r,n,s)}},{key:"captureLog",value:function(e,t,r,n){var o,i=r?"rollbar-occurrence-event":"rollbar-log-event",a=H({message:e,level:t},r?{type:"message",uuid:r}:{});return null===(o=this.telemetrySpan)||void 0===o||o.addEvent(i,a,X(n)),this.capture("log",{message:e},t,r,n,a)}},{key:"captureNetwork",value:function(e,t,r,n){var o,i,a;t=t||"xhr",e.subtype=e.subtype||t,n&&(e.request=n);var s=this.levelFromStatus(e.status_code),u=1e6*(e.end_time_ms||0),l={type:e.subtype,method:e.method,url:e.url,statusCode:e.status_code,"request.headers":JSON.stringify(e.request_headers||{}),"response.headers":JSON.stringify((null===(o=e.response)||void 0===o?void 0:o.headers)||{}),"response.timeUnixNano":u.toString()},c=e.request,f=null===(i=e.response)||void 0===i?void 0:i.body;return c&&(l["request.body"]=JSON.stringify(c)),f&&(l["response.body"]=JSON.stringify(f)),null===(a=this.telemetrySpan)||void 0===a||a.addEvent("rollbar-network-event",l,X(e.start_time_ms)),this.capture("network",e,s,r,e.start_time_ms,l)}},{key:"levelFromStatus",value:function(e){return e>=200&&e<400?"info":0===e||e>=400?"error":"info"}},{key:"captureDom",value:function(e,t,r,n,o){var i={subtype:e,element:t};return void 0!==r&&(i.value=r),void 0!==n&&(i.checked=n),this.capture("dom",i,"info",o)}},{key:"captureInput",value:function(e){var t,r=e.type,n=e.isSynthetic,o=e.element,i=e.value,a=e.timestamp,s="rollbar-input-event",u={type:s,subtype:r,element:o,value:i},l={type:r,isSynthetic:n,element:o,value:i,endTimeUnixNano:X(a)},c=this._getRepeatedEvent(s,l);return c?this._updateRepeatedEvent(c,l,a):(null===(t=this.telemetrySpan)||void 0===t||t.addEvent(s,l,X(a)),this.capture("dom",u,"info",null,a,l))}},{key:"captureClick",value:function(e){var t,r=e.type,n=e.isSynthetic,o=e.element,i=e.timestamp,a="rollbar-click-event",s={type:a,subtype:r,element:o},u={type:r,isSynthetic:n,element:o,endTimeUnixNano:X(i)},l=this._getRepeatedEvent(a,u);return l?this._updateRepeatedEvent(l,u,i):(null===(t=this.telemetrySpan)||void 0===t||t.addEvent(a,u,X(i)),this.capture("dom",s,"info",null,i,u))}},{key:"_getRepeatedEvent",value:function(e,t){var r=this._lastEvent(this.queue);if(r&&r.body.type===e&&r.otelAttributes.target===t.target)return r}},{key:"_updateRepeatedEvent",value:function(e,t,r){var n=Math.max(r-e.timestamp_ms,1);e.body.value=t.value,e.otelAttributes.value=t.value,e.otelAttributes.height=t.height,e.otelAttributes.width=t.width,e.otelAttributes.textZoomRatio=t.textZoomRatio,e.otelAttributes.endTimeUnixNano=X(r),e.otelAttributes.durationUnixNano=X(n),e.otelAttributes.count=(e.otelAttributes.count||1)+1,e.otelAttributes.rate=e.otelAttributes.count/(n/1e3)}},{key:"_lastEvent",value:function(e){return e.length>0?e[e.length-1]:null}},{key:"captureFocus",value:function(e){var t,r=e.type,n=e.isSynthetic,o=e.element,i=e.timestamp,a="rollbar-focus-event",s={type:a,subtype:r,element:o},u={type:r,isSynthetic:n,element:o};return null===(t=this.telemetrySpan)||void 0===t||t.addEvent(a,u,X(i)),this.capture("dom",s,"info",null,i,u)}},{key:"captureResize",value:function(e){var t,r=e.type,n=e.isSynthetic,o=e.width,i=e.height,a=e.textZoomRatio,s=e.timestamp,u="rollbar-resize-event",l={type:u,subtype:r,width:o,height:i,textZoomRatio:a},c={type:r,isSynthetic:n,width:o,height:i,textZoomRatio:a},f=this._getRepeatedEvent(u,c);return f?this._updateRepeatedEvent(f,c,s):(null===(t=this.telemetrySpan)||void 0===t||t.addEvent(u,c,X(s)),this.capture("dom",l,"info",null,s,c))}},{key:"captureDragDrop",value:function(e){var t,r=e.type,n=e.isSynthetic,o=e.element,i=e.dropEffect,a=e.effectAllowed,s=e.kinds,u=e.mediaTypes,l=e.timestamp,c="rollbar-dragdrop-event",f={type:c,subtype:r,isSynthetic:n},h={type:r,isSynthetic:n};return"dragstart"===r&&(f=H(H({},f),{},{element:o,dropEffect:i,effectAllowed:a}),h=H(H({},h),{},{element:o,dropEffect:i,effectAllowed:a})),"drop"===r&&(f=H(H({},f),{},{element:o,dropEffect:i,effectAllowed:a,kinds:s,mediaTypes:u}),h=H(H({},h),{},{element:o,dropEffect:i,effectAllowed:a,kinds:s,mediaTypes:u})),null===(t=this.telemetrySpan)||void 0===t||t.addEvent(c,h,X(l)),this.capture("dom",f,"info",null,l,h)}},{key:"captureNavigation",value:function(e,t,r,n){var o;return null===(o=this.telemetrySpan)||void 0===o||o.addEvent("rollbar-navigation-event",{"previous.url.full":e,"url.full":t},X(n)),this.capture("navigation",{from:e,to:t},"info",r,n)}},{key:"captureDomContentLoaded",value:function(e){return this.capture("navigation",{subtype:"DOMContentLoaded"},"info",void 0,e&&e.getTime())}},{key:"captureLoad",value:function(e){return this.capture("navigation",{subtype:"load"},"info",void 0,e&&e.getTime())}},{key:"captureConnectivityChange",value:function(e){var t,r=e.type,n=e.isSynthetic,o=e.timestamp,i="rollbar-connectivity-event",a={type:i,subtype:r},s={type:r,isSynthetic:n};return null===(t=this.telemetrySpan)||void 0===t||t.addEvent(i,s,X(o)),this.capture("connectivity",a,"info",null,o,s)}},{key:"_captureRollbarItem",value:function(e){if(this.options.includeItemsInTelemetry)return e.err?this.captureError(e.err,e.level,e.uuid,e.timestamp):e.message?this.captureLog(e.message,e.level,e.uuid,e.timestamp):e.custom?this.capture("log",e.custom,e.level,e.uuid,e.timestamp):void 0}},{key:"push",value:function(e){this.queue.push(e),this.queue.length>this.maxQueueSize&&this.queue.shift()}}],t&&J(e.prototype,t),r&&J(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,r}();function $(e,t){if(t)return t;return{error:"error",manual:"info"}[e]||"info"}var Q=K;function ee(e){return ee="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ee(e)}function te(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,re(n.key),n)}}function re(e){var t=function(e,t){if("object"!=ee(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=ee(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==ee(t)?t:t+""}var ne=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._currentContext=t?new Map(t):new Map}return t=e,(r=[{key:"getValue",value:function(e){return this._currentContext.get(e)}},{key:"setValue",value:function(t,r){var n=new e(this._currentContext);return n._currentContext.set(t,r),n}},{key:"deleteValue",value:function(t){var r=new e(self._currentContext);return r._currentContext.delete(t),r}}])&&te(t.prototype,r),n&&te(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,r,n}(),oe=new ne;function ie(e){return ie="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ie(e)}function ae(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,se(n.key),n)}}function se(e){var t=function(e,t){if("object"!=ie(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=ie(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==ie(t)?t:t+""}var ue=function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.currentContext=oe},t=[{key:"active",value:function(){return this.currentContext}},{key:"enterContext",value:function(e){var t=this.currentContext;return this.currentContext=e||oe,t}},{key:"exitContext",value:function(e){return this.currentContext=e,this.currentContext}},{key:"with",value:function(e,t,r){var n=this.enterContext(e);try{for(var o=arguments.length,i=new Array(o>3?o-3:0),a=3;a<o;a++)i[a-3]=arguments[a];return t.call.apply(t,[r].concat(i))}finally{this.exitContext(n)}}}],t&&ae(e.prototype,t),r&&ae(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,r}();function le(e){return[Math.trunc(e/1e3),Math.round(e%1e3*1e6)]}function ce(e,t){return[e[0]+t[0]+Math.trunc((e[1]+t[1])/1e9),(e[1]+t[1])%1e9]}var fe={fromMillis:le,toMillis:function(e){return 1e3*e[0]+Math.round(e[1]/1e6)},toNanos:function(e){return 1e9*e[0]+e[1]},add:ce,now:function(){return arguments.length>0&&void 0!==arguments[0]&&arguments[0]?ce(le(performance.timeOrigin),le(performance.now())):le(Date.now())},isHrTime:function(e){return Array.isArray(e)&&2===e.length&&"number"==typeof e[0]&&"number"==typeof e[1]}};function he(e){return he="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},he(e)}function pe(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,i,a,s=[],u=!0,l=!1;try{if(i=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=i.call(r)).done)&&(s.push(n.value),s.length!==t);u=!0);}catch(e){l=!0,o=e}finally{try{if(!u&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return s}}(e,t)||ve(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function de(e){return function(e){if(Array.isArray(e))return ye(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||ve(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ve(e,t){if(e){if("string"==typeof e)return ye(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?ye(e,t):void 0}}function ye(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function me(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,ge(n.key),n)}}function ge(e){var t=function(e,t){if("object"!=he(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=he(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==he(t)?t:t+""}var be=function(){return e=function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.api=t,this.options=r},t=[{key:"export",value:function(e,t){we.push.apply(we,de(e))}},{key:"toPayload",value:function(){var e=this,t=we.slice();if(we.length=0,!t||!t.length)return{resourceSpans:[]};var r,n=t[0]&&t[0].resource||{},o=new Map,i=function(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=ve(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,i=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw i}}}}(t);try{for(i.s();!(r=i.n()).done;){var a=r.value,s=a.instrumentationScope?"".concat(a.instrumentationScope.name,":").concat(a.instrumentationScope.version):"default:1.0.0";o.has(s)||o.set(s,{scope:a.instrumentationScope||{name:"default",version:"1.0.0",attributes:[]},spans:[]}),o.get(s).spans.push(this._transformSpan(a))}}catch(e){i.e(e)}finally{i.f()}return{resourceSpans:[{resource:this._transformResource(n),scopeSpans:Array.from(o.values()).map(function(t){return{scope:e._transformInstrumentationScope(t.scope),spans:t.spans}})}]}}},{key:"post",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.api.postSpans(e,t)}},{key:"_transformSpan",value:function(e){var t,r=this,n=function(e){return Object.entries(e||{}).map(function(e){var t=pe(e,2),n=t[0],o=t[1];return{key:n,value:r._transformAnyValue(o)}})};return{traceId:e.spanContext.traceId,spanId:e.spanContext.spanId,parentSpanId:e.parentSpanId||"",name:e.name,kind:e.kind||1,startTimeUnixNano:fe.toNanos(e.startTime),endTimeUnixNano:fe.toNanos(e.endTime),attributes:n(e.attributes),events:(t=e.events,(t||[]).map(function(e){return{timeUnixNano:fe.toNanos(e.time),name:e.name,attributes:n(e.attributes)}}))}}},{key:"_transformResource",value:function(e){var t=this,r=e.attributes||{};return{attributes:Object.entries(r).map(function(e){var r=pe(e,2),n=r[0],o=r[1];return{key:n,value:t._transformAnyValue(o)}})}}},{key:"_transformInstrumentationScope",value:function(e){var t=this;return{name:e.name||"",version:e.version||"",attributes:(e.attributes||[]).map(function(e){return{key:e.key,value:t._transformAnyValue(e.value)}})}}},{key:"_transformAnyValue",value:function(e){var t=this;if(null==e)return{stringValue:""};var r=he(e);return"string"===r?{stringValue:e}:"number"===r?Number.isInteger(e)?{intValue:e.toString()}:{doubleValue:e}:"boolean"===r?{boolValue:e}:Array.isArray(e)?{arrayValue:{values:e.map(function(e){return t._transformAnyValue(e)})}}:"object"===r?{kvlistValue:{values:Object.entries(e).map(function(e){var r=pe(e,2),n=r[0],o=r[1];return{key:n,value:t._transformAnyValue(o)}})}}:{stringValue:String(e)}}}],t&&me(e.prototype,t),r&&me(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,r}(),we=[];var ke={gen:function(){var e=new Uint8Array(arguments.length>0&&void 0!==arguments[0]?arguments[0]:16);return crypto.getRandomValues(e),Array.from(e,function(e){return e.toString(16).padStart(2,"0")}).join("")}};function Se(e){return Se="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Se(e)}function Ce(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function Ie(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Ce(Object(r),!0).forEach(function(t){xe(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ce(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function Oe(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,_e(n.key),n)}}function xe(e,t,r){return(t=_e(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _e(e){var t=function(e,t){if("object"!=Se(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=Se(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==Se(t)?t:t+""}var Ee="RollbarSession",Ae=function(){return e=function e(t,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),xe(this,"_attributes",void 0),this.options=r,this.tracing=t,this.window=t.window,this.session=null,this._attributes={}},t=[{key:"init",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.session||(this.getSession()||this.createSession(),this.initSessionAttributes(e)),this}},{key:"getSession",value:function(){try{var e=this.window.sessionStorage.getItem(Ee);if(!e)return null;this.session=JSON.parse(e)}catch(e){return null}return this}},{key:"createSession",value:function(){return this.session={id:ke.gen(),createdAt:Date.now()},this.setSession(this.session)}},{key:"setSession",value:function(e){var t=JSON.stringify(e);try{this.window.sessionStorage.setItem(Ee,t)}catch(e){return null}return this}},{key:"attributes",get:function(){return this._attributes}},{key:"setAttributes",value:function(e){return this._attributes=Ie(Ie({},this._attributes),e),this}},{key:"setUser",value:function(e){return this.setAttributes({"user.id":null==e?void 0:e.id,"user.email":null==e?void 0:e.email,"user.name":(null==e?void 0:e.name)||(null==e?void 0:e.username)}),this}},{key:"initSessionAttributes",value:function(e){var t,r,n;return this.setAttributes(Ie({"session.id":this.session.id,"browser.brands":null===(t=navigator.userAgentData)||void 0===t?void 0:t.brands,"browser.language":navigator.language,"browser.mobile":null===(r=navigator.userAgentData)||void 0===r?void 0:r.mobile,"browser.platform":null===(n=navigator.userAgentData)||void 0===n?void 0:n.platform,"client.address":"$remote_ip","rollbar.notifier.framework":"browser-js","user_agent.original":navigator.userAgent},e)),this}}],t&&Oe(e.prototype,t),r&&Oe(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,r}(),Re=function(){},Te={debug:0,info:1,warn:2,error:3,disable:4},Me={error:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return Re("error",t)},warn:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return Re("warn",t)},info:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return Re("info",t)},debug:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return Re("debug",t)},log:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return Re("info",t)},init:function(e){var t=e.logLevel;Re=function(e,r){Te[e]<Te[t]||(r.unshift("Rollbar:"),console[e].apply(console,r))}}},Pe=Me;function je(e){return je="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},je(e)}function Ne(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return Le(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Le(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,i=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw i}}}}function Le(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function De(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,Fe(n.key),n)}}function Fe(e){var t=function(e,t){if("object"!=je(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=je(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==je(t)?t:t+""}var Ue=function(){return e=function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.exporter=t,this.options=r,this.pendingSpans=new Map,this.transforms=[this.userTransform.bind(this)]},t=[{key:"addTransform",value:function(e){this.transforms.unshift(e)}},{key:"userTransform",value:function(e){this.options.transformSpan&&this.options.transformSpan({span:e})}},{key:"applyTransforms",value:function(e){var t,r=Ne(this.transforms);try{for(r.s();!(t=r.n()).done;){var n=t.value;try{n(e)}catch(e){Pe.error("Error running span transform callback",e)}}}catch(e){r.e(e)}finally{r.f()}}},{key:"onStart",value:function(e,t){this.pendingSpans.set(e.span.spanContext.spanId,e)}},{key:"onEnd",value:function(e){this.applyTransforms(e.span),this.exporter.export([e.export()]),this.pendingSpans.delete(e.span.spanContext.spanId)}}],t&&De(e.prototype,t),r&&De(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,r}();function Be(e){return Be="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Be(e)}function We(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,i,a,s=[],u=!0,l=!1;try{if(i=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=i.call(r)).done)&&(s.push(n.value),s.length!==t);u=!0);}catch(e){l=!0,o=e}finally{try{if(!u&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return ze(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?ze(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ze(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function Ge(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,Ve(n.key),n)}}function Ve(e){var t=function(e,t){if("object"!=Be(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=Be(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==Be(t)?t:t+""}var He=function(){return e=function e(t){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.usePerformance=t.usePerformance,this.initReadableSpan(t),this.spanProcessor=t.spanProcessor,this.spanProcessor.onStart(this,t.context),t.attributes&&this.setAttributes(t.attributes),this},t=[{key:"initReadableSpan",value:function(e){var t;this.span={name:e.name,kind:e.kind,spanContext:e.spanContext,parentSpanId:e.parentSpanId,startTime:e.startTime||fe.now(e.usePerformance),endTime:[0,0],status:{code:0,message:""},attributes:{"session.id":null===(t=e.session)||void 0===t?void 0:t.id},links:[],events:[],duration:0,ended:!1,resource:e.resource,instrumentationScope:e.scope,droppedAttributesCount:0,droppedEventsCount:0,droppedLinksCount:0}}},{key:"spanContext",value:function(){return this.span.spanContext}},{key:"spanId",get:function(){return this.span.spanContext.spanId}},{key:"traceId",get:function(){return this.span.spanContext.traceId}},{key:"setAttribute",value:function(e,t){return null==t||this.span.ended||0===e.length||(this.span.attributes[e]=t),this}},{key:"setAttributes",value:function(e){for(var t=0,r=Object.entries(e);t<r.length;t++){var n=We(r[t],2),o=n[0],i=n[1];this.setAttribute(o,i)}return this}},{key:"addEvent",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0;return this.span.ended||this.span.events.push({name:e,attributes:t,time:r||fe.now(),droppedAttributesCount:0}),this}},{key:"isRecording",value:function(){return!1===this.span.ended}},{key:"end",value:function(e,t){e&&this.setAttributes(e),this.span.endTime=t||fe.now(this.usePerformance),this.span.ended=!0,this.spanProcessor.onEnd(this)}},{key:"export",value:function(){return this.span}}],t&&Ge(e.prototype,t),r&&Ge(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,r}();function qe(e){return qe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},qe(e)}function Je(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function Ze(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Je(Object(r),!0).forEach(function(t){Ye(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Je(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function Ye(e,t,r){return(t=Ke(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Xe(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,Ke(n.key),n)}}function Ke(e){var t=function(e,t){if("object"!=qe(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=qe(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==qe(t)?t:t+""}var $e=function(){return e=function e(t,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.spanProcessor=r,this.tracing=t},t=[{key:"startSpan",value:function(e){var t,r,n,o,i,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.tracing.contextManager.active(),u=this.tracing.getSpan(s),l=null==u?void 0:u.spanContext(),c=ke.gen(8),f=null;l?(o=l.traceId,f=l.traceState,i=l.spanId):o=ke.gen(16);var h={traceId:o,spanId:c,traceFlags:0,traceState:f},p={attributes:Ze(Ze({},(null===(t=this.tracing.resource)||void 0===t?void 0:t.attributes)||{}),(null===(r=a.resource)||void 0===r?void 0:r.attributes)||{})};return new He({resource:p,scope:this.tracing.scope,session:null===(n=this.tracing.session)||void 0===n?void 0:n.session,context:s,spanContext:h,name:e,kind:0,parentSpanId:i,spanProcessor:this.spanProcessor,startTime:a.startTime,usePerformance:a.usePerformance})}}],t&&Xe(e.prototype,t),r&&Xe(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,r}();function Qe(e){return Qe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Qe(e)}function et(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function tt(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?et(Object(r),!0).forEach(function(t){rt(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):et(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function rt(e,t,r){return(t=ot(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function nt(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,ot(n.key),n)}}function ot(e){var t=function(e,t){if("object"!=Qe(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=Qe(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==Qe(t)?t:t+""}var it,at=(it="Rollbar Context Key SPAN",Symbol.for(it)),st=function(){return e=function e(t,r,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.api=r,this.options=n,this.window=t,this.window.sessionStorage&&(this.session=new Ae(this,n)),this.createTracer()},t=[{key:"configure",value:function(e){this.options=e}},{key:"initSession",value:function(){this.session&&this.session.init()}},{key:"sessionId",get:function(){return this.session?this.session.session.id:null}},{key:"resource",get:function(){var e,t;return{attributes:tt(tt({},this.options.resource||{}),{},{"rollbar.environment":null!==(e=null===(t=this.options.payload)||void 0===t?void 0:t.environment)&&void 0!==e?e:this.options.environment})}}},{key:"scope",get:function(){return{name:"rollbar-browser-js",version:this.options.version}}},{key:"idGen",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:16;return ke.gen(e)}},{key:"createTracer",value:function(){this.contextManager=new ue,this.exporter=new be(this.api,this.options),this.spanProcessor=new Ue(this.exporter,this.options.tracing),this.tracer=new $e(this,this.spanProcessor)}},{key:"getTracer",value:function(){return this.tracer}},{key:"addSpanTransform",value:function(e){this.spanProcessor.addTransform(e)}},{key:"getSpan",value:function(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.contextManager.active()).getValue(at)}},{key:"setSpan",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.contextManager.active(),t=arguments.length>1?arguments[1]:void 0;return e.setValue(at,t)}},{key:"startSpan",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.contextManager.active();return this.tracer.startSpan(e,t,r)}},{key:"with",value:function(e,t,r){for(var n,o=arguments.length,i=new Array(o>3?o-3:0),a=3;a<o;a++)i[a-3]=arguments[a];return(n=this.contextManager).with.apply(n,[e,t,r].concat(i))}},{key:"withSpan",value:function(e,t,r,n){var o=this.startSpan(e,t);return this.with(this.setSpan(this.contextManager.active(),o),r,n,o)}}],t&&nt(e.prototype,t),r&&nt(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,r}();function ut(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,i,a,s=[],u=!0,l=!1;try{if(i=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=i.call(r)).done)&&(s.push(n.value),s.length!==t);u=!0);}catch(e){l=!0,o=e}finally{try{if(!u&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return s}}(e,t)||ct(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function lt(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=ct(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,i=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw i}}}}function ct(e,t){if(e){if("string"==typeof e)return ft(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?ft(e,t):void 0}}function ft(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function ht(e,t){return[e,g(e,t)]}function pt(e,t){var r=e.length;return r>2*t?e.slice(0,t).concat(e.slice(r-t)):e}function dt(e,t,r){r=void 0===r?30:r;var n,o=e.data.body;if(o.trace_chain){var i,a=lt(o.trace_chain);try{for(a.s();!(i=a.n()).done;){var s=i.value;n=pt(n=s.frames,r),s.frames=n}}catch(e){a.e(e)}finally{a.f()}}else o.trace&&(n=pt(n=o.trace.frames,r),o.trace.frames=n);return[e,g(e,t)]}function vt(e,t){return t&&t.length>e?t.slice(0,e-3).concat("..."):t}function yt(e,t,r){return t=N(t,function t(r,n,o){switch(a(n)){case"string":return vt(e,n);case"object":case"array":return N(n,t,o);default:return n}}),[t,g(t,r)]}function mt(e){return e.exception&&(delete e.exception.description,e.exception.message=vt(255,e.exception.message)),e.frames=pt(e.frames,1),e}function gt(e,t){var r=e.data.body;if(r.trace_chain){var n,o=r.trace_chain,i=lt(o.entries());try{for(i.s();!(n=i.n()).done;){var a=ut(n.value,2),s=a[0],u=a[1];o[s]=mt(u)}}catch(e){i.e(e)}finally{i.f()}}else r.trace&&(r.trace=mt(r.trace));return[e,g(e,t)]}function bt(e,t){return function(e){for(var t=0,r=e.length,n=0;n<r;n++){var o=e.charCodeAt(n);o<128?t+=1:o<2048?t+=2:o<65536&&(t+=3)}return t}(e)>t}var wt={truncate:function(e,t,r){r=void 0===r?524288:r;for(var n,o,i,a=[ht,dt,yt.bind(null,1024),yt.bind(null,512),yt.bind(null,256),gt];n=a.shift();)if(e=(o=n(e,t))[0],(i=o[1]).error||!bt(i.value,r))return i;return i},raw:ht,truncateFrames:dt,truncateStrings:yt,maybeTruncateValue:vt};function kt(e){if(!i(e.context,"string")){var t=g(e.context);t.error?e.context="Error: could not serialize 'context'":e.context=t.value||"",e.context.length>255&&(e.context=e.context.substr(0,255))}return{data:e}}function St(e,t,r){var n=t.hostname,o=t.protocol,i=t.port,a=t.path,s=t.search,u=e.timeout,l=function(e){var t="undefined"!=typeof