UNPKG

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 132 kB
/*! For license information please see rollbar.min.js.LICENSE.txt */ !function(){"use strict";var t={d:function(e,r){for(var n in r)t.o(r,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:r[n]})},o:function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r:function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};function r(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return n(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var o=0,i=function(){};return{s:i,n:function(){return o>=t.length?{done:!0}:{done:!1,value:t[o++]}},e:function(t){throw t},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(t)},n:function(){var t=r.next();return s=t.done,t},e:function(t){u=!0,a=t},f:function(){try{s||null==r.return||r.return()}finally{if(u)throw a}}}}function n(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function o(t){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o(t)}function i(t,e){return e===a(t)}function a(t){var e=o(t);return"object"!==e?e:t?t instanceof Error?"error":{}.toString.call(t).match(/\s([a-zA-Z]+)/)[1].toLowerCase():"null"}function s(t){return i(t,"function")}function u(t){return null!=t&&("object"==o(t)||"function"==typeof t)}function l(t,e){return null!=t&&(Object.hasOwn?Object.hasOwn(t,e):Object.prototype.hasOwnProperty.call(t,e))}function c(t){return Number.isFinite(t)}function f(t){return i(t,"error")||i(t,"exception")}function p(){return"********"}t.r(e),t.d(e,{parse:function(){return dn}});var d={debug:0,info:1,warning:2,error:3,critical:4};function h(t){var e=function(t){if(!i(t,"string"))return;for(var e=y,r=e.parser[e.strictMode?"strict":"loose"].exec(t),n={},o=0,a=e.key.length;o<a;++o)n[e.key[o]]=r[o]||"";return n[e.q.name]={},n[e.key[12]].replace(e.q.parser,function(t,r,o){r&&(n[e.q.name][r]=o)}),n}(t);return e?(""===e.anchor&&(e.source=e.source.replace("#","")),t=e.source.replace("?"+e.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 v(t,e){if(!(e=e||t.protocol)&&t.port&&(80===t.port?e="http:":443===t.port&&(e="https:")),e=e||"https:",!t.hostname)return null;var r=e+"//"+t.hostname;return t.port&&(r=r+":"+t.port),t.path&&(r+=t.path),r}function m(t,e){var r,n;try{r=JSON.stringify(t)}catch(o){if(e&&s(e))try{r=e(t)}catch(t){n=t}else n=o}return{error:n,value:r}}function b(t){var e,r;try{e=JSON.parse(t)}catch(t){r=t}return{error:r,value:e}}function g(t,e,r,n,o,i,a,s){var u={url:e||"",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):t||a,url:l,stack:[u],useragent:c}}function w(t,e){return function(r,n){try{e(r,n)}catch(e){t.error(e)}}}function k(t){return function t(e,r){var n,o,s,u={};try{for(o in e)(n=e[o])&&(i(n,"object")||i(n,"array"))?r.includes(n)?u[o]="Removed circular reference: "+a(n):((s=r.slice()).push(n),u[o]=t(n,s)):u[o]=n}catch(t){u="Failed cloning custom data: "+t.message}return u}(t,[t])}function S(t,e,r,n,o){for(var i,s,u,l,c,f,p=[],d=[],h=0,y=t.length;h<y;++h){var v=a(f=t[h]);switch(d.push(v),v){case"undefined":break;case"string":i?p.push(f):i=f;break;case"function":l=w(e,f);break;case"date":p.push(f);break;case"error":case"domexception":case"exception":s?p.push(f):s=f;break;case"object":case"array":if(f instanceof Error||"undefined"!=typeof DOMException&&f instanceof DOMException){s?p.push(f):s=f;break}if(n&&"object"===v&&!c){for(var m=0,b=n.length;m<b;++m)if(void 0!==f[n[m]]){c=f;break}if(c)break}u?p.push(f):u=f;break;default:if(f instanceof Error||"undefined"!=typeof DOMException&&f instanceof DOMException){s?p.push(f):s=f;break}p.push(f)}}u&&(u=k(u)),p.length>0&&(u||(u=k({})),u.extraArgs=k(p));var g,S={message:i,err:s,custom:u,timestamp:T(),callback:l,notifier:r,diagnostic:{},uuid:(g=T(),"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var e=(g+16*Math.random())%16|0;return g=Math.floor(g/16),("x"===t?e:7&e|8).toString(16)}))};return S.data=S.data||{},function(t,e){e&&void 0!==e.level&&(t.level=e.level,delete e.level);e&&void 0!==e.skipFrames&&(t.skipFrames=e.skipFrames,delete e.skipFrames)}(S,u),n&&c&&(S.request=c),o&&(S.lambdaContext=o),S._originalArgs=t,S.diagnostic.original_arg_types=d,S}var _=["log","network","dom","navigation","error","manual"],O=["critical","error","warning","info","debug"];function x(t,e){var n,o=r(t);try{for(o.s();!(n=o.n()).done;){if(n.value===e)return!0}}catch(t){o.e(t)}finally{o.f()}return!1}function E(t,e){t.attributes=t.attributes||[];var n,o=r(e);try{for(o.s();!(n=o.n()).done;){var i=n.value;void 0!==i.value&&t.attributes.push(i)}}catch(t){o.e(t)}finally{o.f()}}function j(t,e){if(t){var r=e.split("."),n=t;try{for(var o=0,i=r.length;o<i;++o)n=n[r[o]]}catch(t){n=void 0}return n}}function I(t,e,r){if(t){Object.setPrototypeOf(t,null);var n=e.split("."),o=n.length;if(!(o<1))if(1!==o)try{for(var i=t[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,t[n[0]]=a}catch(t){return}else t[n[0]]=r}}function T(){return Date.now?Date.now():Number(new Date)}function P(t,e,r,n){var o=A(t,e,r);return o=function(t,e){t.hostWhiteList&&!t.hostSafeList&&(t.hostSafeList=t.hostWhiteList,t.hostWhiteList=void 0,e&&e.log("hostWhiteList is deprecated. Use hostSafeList."));t.hostBlackList&&!t.hostBlockList&&(t.hostBlockList=t.hostBlackList,t.hostBlackList=void 0,e&&e.log("hostBlackList is deprecated. Use hostBlockList."));return t}(o,n),!e||e.overwriteScrubFields||e.scrubFields&&(o.scrubFields=(t.scrubFields||[]).concat(e.scrubFields)),o}function A(){function t(t){if(!t||"[object Object]"!==Object.prototype.toString.call(t))return!1;var e,r=l(t,"constructor"),n=t.constructor&&t.constructor.prototype&&l(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!r&&!n)return!1;for(e in t);return void 0===e||l(t,e)}var e,r,n,o,i,a=Object.create(null),s=null,u=arguments.length;for(e=0;e<u;e++)if(null!=(s=arguments[e]))for(i in s)r=a[i],a!==(n=s[i])&&(n&&t(n)?(o=r&&t(r)?r:{},a[i]=A(o,n)):void 0!==n&&(a[i]=n));return a}function R(t,e,r){var n;if(null==e||!e.sessionId||!r)return!1;var o=null==t||null===(n=t.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(t){return i(t,"string")?r===t:!!i(t,"regexp")&&t.test(r)})}function C(t,e){var r,n,o=t[1],i=null===(r=o)||void 0===r?void 0:r.headers,a=(n=t[0],"undefined"!=typeof Request&&n instanceof Request&&t[0].headers),s=i||a;if(s||(o||(t[1]=o={}),s=o.headers={}),s instanceof Headers)for(var l=0,c=Object.keys(e);l<c.length;l++){var f=c[l];s.append(f,e[f])}else if(u(s))for(var p=0,d=Object.keys(e);p<d.length;p++){var h=d[p];s[h]=e[h]}}var L=function(t,e,r){var n,o,a,s,u=i(t,"object"),c=i(t,"array"),f=[];if(r=r||{obj:[],mapped:[]},u){if(s=r.obj.indexOf(t),u&&-1!==s)return r.mapped[s]||r.obj[s];r.obj.push(t),s=r.obj.length-1}if(u)for(n in t)l(t,n)&&f.push(n);else if(c)for(a=0;a<t.length;++a)f.push(a);var p=u?{}:[],d=!0;for(a=0;a<f.length;++a)o=t[n=f[a]],p[n]=e(n,o,r),d=d&&p[n]===t[n];return u&&!d&&(r.mapped[s]=p),d?t:p};function q(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,s=[],u=!0,l=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=i.call(r)).done)&&(s.push(n.value),s.length!==e);u=!0);}catch(t){l=!0,o=t}finally{try{if(!u&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return s}}(t,e)||D(t,e)||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 N(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=D(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},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(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw i}}}}function D(t,e){if(t){if("string"==typeof t)return M(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?M(t,e):void 0}}function M(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function U(t,e){var r=e.split("."),n=r.length-1;try{var o,i=N(r.entries());try{for(i.s();!(o=i.n()).done;){var a=q(o.value,2),s=a[0],u=a[1];s<n?t=t[u]:t[u]=p()}}catch(t){i.e(t)}finally{i.f()}}catch(t){}}var H=function(t,e,r){if(e=e||[],r){var n,o=N(r);try{for(o.s();!(n=o.n()).done;){U(t,n.value)}}catch(t){o.e(t)}finally{o.f()}}var a=function(t){var e,r=[],n=N(t);try{for(n.s();!(e=n.n()).done;){var o="^\\[?(%5[bB])?"+e.value+"\\[?(%5[bB])?\\]?(%5[dD])?$";r.push(new RegExp(o,"i"))}}catch(t){n.e(t)}finally{n.f()}return r}(e),s=function(t){var e,r=[],n=N(t);try{for(n.s();!(e=n.n()).done;){var o="\\[?(%5[bB])?"+e.value+"\\[?(%5[bB])?\\]?(%5[dD])?";r.push(new RegExp("("+o+"=)([^&\\n]+)","igm"))}}catch(t){n.e(t)}finally{n.f()}return r}(e);function u(t,e){return e+"********"}return L(t,function t(e,r,n){var o=function(t,e){var r,n=N(a);try{for(n.s();!(r=n.n()).done;)if(r.value.test(t)){e=p();break}}catch(t){n.e(t)}finally{n.f()}return e}(e,r);return o===r?i(r,"object")||i(r,"array")?L(r,t,n):function(t){if(i(t,"string")){var e,r=N(s);try{for(r.s();!(e=r.n()).done;){var n=e.value;t=t.replace(n,u)}}catch(t){r.e(t)}finally{r.f()}}return t}(o):o})},F=["otelAttributes"];function J(t){return J="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},J(t)}function V(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function B(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?V(Object(r),!0).forEach(function(e){W(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):V(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function W(t,e,r){return(e=G(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function $(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,G(n.key),n)}}function G(t){var e=function(t,e){if("object"!=J(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!=J(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==J(e)?e:e+""}var z=100;function X(t){return[Math.trunc(t/1e3),Math.round(t%1e3*1e6)]}var Z=function(){return t=function t(e,r){var n;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.queue=[],this.options=A(e);var o=this.options.maxTelemetryEvents||z;this.maxQueueSize=Math.max(0,Math.min(o,z)),this.tracing=r,this.telemetrySpan=null===(n=this.tracing)||void 0===n?void 0:n.startSpan("rollbar-telemetry",{})},e=[{key:"configure",value:function(t){var e=this.options;this.options=A(e,t);var r=this.options.maxTelemetryEvents||z,n=Math.max(0,Math.min(r,z)),o=0;this.queue.length>n&&(o=this.queue.length-n),this.maxQueueSize=n,this.queue.splice(0,o)}},{key:"copyEvents",value:function(){var t=Array.prototype.slice.call(this.queue,0);if(s(this.options.filterTelemetry))try{for(var e=t.length;e--;)this.options.filterTelemetry(t[e])&&t.splice(e,1)}catch(t){this.options.filterTelemetry=null}return t=(t=t.filter(function(t){return"connectivity"!==t.type})).map(function(t){t.otelAttributes;var e=function(t,e){if(null==t)return{};var r,n,o=function(t,e){if(null==t)return{};var r={};for(var n in t)if({}.hasOwnProperty.call(t,n)){if(-1!==e.indexOf(n))continue;r[n]=t[n]}return r}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n<i.length;n++)r=i[n],-1===e.indexOf(r)&&{}.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}(t,F);return e}),t}},{key:"exportTelemetrySpan",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.telemetrySpan&&(this.telemetrySpan.end(t),this.telemetrySpan=this.tracing.startSpan("rollbar-telemetry",{}))}},{key:"capture",value:function(t,e,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:Q(t,r),type:t,timestamp_ms:o||T(),body:e,source:"client"};n&&(a.uuid=n),i&&(a.otelAttributes=i);try{if(s(this.options.filterTelemetry)&&this.options.filterTelemetry(a))return!1}catch(t){this.options.filterTelemetry=null}return this.push(a),a}},{key:"captureEvent",value:function(t,e,r,n){return this.capture(t,e,r,n)}},{key:"captureError",value:function(t,e,r,n){var o,i=t.message||String(t),a={message:i};t.stack&&(a.stack=t.stack);var s={message:i,level:e,type:"error",uuid:r};return null===(o=this.telemetrySpan)||void 0===o||o.addEvent("rollbar-occurrence-event",s,X(n)),this.capture("error",a,e,r,n,s)}},{key:"captureLog",value:function(t,e,r,n){var o,i=r?"rollbar-occurrence-event":"rollbar-log-event",a=B({message:t,level:e},r?{type:"message",uuid:r}:{});return null===(o=this.telemetrySpan)||void 0===o||o.addEvent(i,a,X(n)),this.capture("log",{message:t},e,r,n,a)}},{key:"captureNetwork",value:function(t,e,r,n){var o,i,a;e=e||"xhr",t.subtype=t.subtype||e,n&&(t.request=n);var s=this.levelFromStatus(t.status_code),u=1e6*(t.end_time_ms||0),l={type:t.subtype,method:t.method,url:t.url,statusCode:t.status_code,"request.headers":JSON.stringify(t.request_headers||{}),"response.headers":JSON.stringify((null===(o=t.response)||void 0===o?void 0:o.headers)||{}),"response.timeUnixNano":u.toString()},c=t.request,f=null===(i=t.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(t.start_time_ms)),this.capture("network",t,s,r,t.start_time_ms,l)}},{key:"levelFromStatus",value:function(t){return t>=200&&t<400?"info":0===t||t>=400?"error":"info"}},{key:"captureDom",value:function(t,e,r,n,o){var i={subtype:t,element:e};return void 0!==r&&(i.value=r),void 0!==n&&(i.checked=n),this.capture("dom",i,"info",o)}},{key:"captureInput",value:function(t){var e,r=t.type,n=t.isSynthetic,o=t.element,i=t.value,a=t.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===(e=this.telemetrySpan)||void 0===e||e.addEvent(s,l,X(a)),this.capture("dom",u,"info",null,a,l))}},{key:"captureClick",value:function(t){var e,r=t.type,n=t.isSynthetic,o=t.element,i=t.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===(e=this.telemetrySpan)||void 0===e||e.addEvent(a,u,X(i)),this.capture("dom",s,"info",null,i,u))}},{key:"_getRepeatedEvent",value:function(t,e){var r=this._lastEvent(this.queue);if(r&&r.body.type===t&&r.otelAttributes.target===e.target)return r}},{key:"_updateRepeatedEvent",value:function(t,e,r){var n=Math.max(r-t.timestamp_ms,1);t.body.value=e.value,t.otelAttributes.value=e.value,t.otelAttributes.height=e.height,t.otelAttributes.width=e.width,t.otelAttributes.textZoomRatio=e.textZoomRatio,t.otelAttributes.endTimeUnixNano=X(r),t.otelAttributes.durationUnixNano=X(n),t.otelAttributes.count=(t.otelAttributes.count||1)+1,t.otelAttributes.rate=t.otelAttributes.count/(n/1e3)}},{key:"_lastEvent",value:function(t){return t.length>0?t[t.length-1]:null}},{key:"captureFocus",value:function(t){var e,r=t.type,n=t.isSynthetic,o=t.element,i=t.timestamp,a="rollbar-focus-event",s={type:a,subtype:r,element:o},u={type:r,isSynthetic:n,element:o};return null===(e=this.telemetrySpan)||void 0===e||e.addEvent(a,u,X(i)),this.capture("dom",s,"info",null,i,u)}},{key:"captureResize",value:function(t){var e,r=t.type,n=t.isSynthetic,o=t.width,i=t.height,a=t.textZoomRatio,s=t.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===(e=this.telemetrySpan)||void 0===e||e.addEvent(u,c,X(s)),this.capture("dom",l,"info",null,s,c))}},{key:"captureDragDrop",value:function(t){var e,r=t.type,n=t.isSynthetic,o=t.element,i=t.dropEffect,a=t.effectAllowed,s=t.kinds,u=t.mediaTypes,l=t.timestamp,c="rollbar-dragdrop-event",f={type:c,subtype:r,isSynthetic:n},p={type:r,isSynthetic:n};return"dragstart"===r&&(f=B(B({},f),{},{element:o,dropEffect:i,effectAllowed:a}),p=B(B({},p),{},{element:o,dropEffect:i,effectAllowed:a})),"drop"===r&&(f=B(B({},f),{},{element:o,dropEffect:i,effectAllowed:a,kinds:s,mediaTypes:u}),p=B(B({},p),{},{element:o,dropEffect:i,effectAllowed:a,kinds:s,mediaTypes:u})),null===(e=this.telemetrySpan)||void 0===e||e.addEvent(c,p,X(l)),this.capture("dom",f,"info",null,l,p)}},{key:"captureNavigation",value:function(t,e,r,n){var o;return null===(o=this.telemetrySpan)||void 0===o||o.addEvent("rollbar-navigation-event",{"previous.url.full":t,"url.full":e},X(n)),this.capture("navigation",{from:t,to:e},"info",r,n)}},{key:"captureDomContentLoaded",value:function(t){return this.capture("navigation",{subtype:"DOMContentLoaded"},"info",void 0,t&&t.getTime())}},{key:"captureLoad",value:function(t){return this.capture("navigation",{subtype:"load"},"info",void 0,t&&t.getTime())}},{key:"captureConnectivityChange",value:function(t){var e,r=t.type,n=t.isSynthetic,o=t.timestamp,i="rollbar-connectivity-event",a={type:i,subtype:r},s={type:r,isSynthetic:n};return null===(e=this.telemetrySpan)||void 0===e||e.addEvent(i,s,X(o)),this.capture("connectivity",a,"info",null,o,s)}},{key:"_captureRollbarItem",value:function(t){if(this.options.includeItemsInTelemetry)return t.err?this.captureError(t.err,t.level,t.uuid,t.timestamp):t.message?this.captureLog(t.message,t.level,t.uuid,t.timestamp):t.custom?this.capture("log",t.custom,t.level,t.uuid,t.timestamp):void 0}},{key:"push",value:function(t){this.queue.push(t),this.queue.length>this.maxQueueSize&&this.queue.shift()}}],e&&$(t.prototype,e),r&&$(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,r}();function Q(t,e){if(e)return e;return{error:"error",manual:"info"}[t]||"info"}var K=Z;function Y(t){return Y="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Y(t)}function tt(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,et(n.key),n)}}function et(t){var e=function(t,e){if("object"!=Y(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!=Y(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Y(e)?e:e+""}var rt=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this._currentContext=e?new Map(e):new Map}return e=t,(r=[{key:"getValue",value:function(t){return this._currentContext.get(t)}},{key:"setValue",value:function(e,r){var n=new t(this._currentContext);return n._currentContext.set(e,r),n}},{key:"deleteValue",value:function(e){var r=new t(self._currentContext);return r._currentContext.delete(e),r}}])&&tt(e.prototype,r),n&&tt(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,r,n}(),nt=new rt;function ot(t){return ot="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ot(t)}function it(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,at(n.key),n)}}function at(t){var e=function(t,e){if("object"!=ot(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!=ot(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==ot(e)?e:e+""}var st=function(){return t=function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.currentContext=nt},e=[{key:"active",value:function(){return this.currentContext}},{key:"enterContext",value:function(t){var e=this.currentContext;return this.currentContext=t||nt,e}},{key:"exitContext",value:function(t){return this.currentContext=t,this.currentContext}},{key:"with",value:function(t,e,r){var n=this.enterContext(t);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 e.call.apply(e,[r].concat(i))}finally{this.exitContext(n)}}}],e&&it(t.prototype,e),r&&it(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,r}();function ut(t){return[Math.trunc(t/1e3),Math.round(t%1e3*1e6)]}function lt(t,e){return[t[0]+e[0]+Math.trunc((t[1]+e[1])/1e9),(t[1]+e[1])%1e9]}var ct={fromMillis:ut,toMillis:function(t){return 1e3*t[0]+Math.round(t[1]/1e6)},toNanos:function(t){return 1e9*t[0]+t[1]},add:lt,now:function(){return arguments.length>0&&void 0!==arguments[0]&&arguments[0]?lt(ut(performance.timeOrigin),ut(performance.now())):ut(Date.now())},isHrTime:function(t){return Array.isArray(t)&&2===t.length&&"number"==typeof t[0]&&"number"==typeof t[1]}};function ft(t){return ft="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ft(t)}function pt(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,s=[],u=!0,l=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=i.call(r)).done)&&(s.push(n.value),s.length!==e);u=!0);}catch(t){l=!0,o=t}finally{try{if(!u&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return s}}(t,e)||ht(t,e)||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 dt(t){return function(t){if(Array.isArray(t))return yt(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||ht(t)||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 ht(t,e){if(t){if("string"==typeof t)return yt(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?yt(t,e):void 0}}function yt(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function vt(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,mt(n.key),n)}}function mt(t){var e=function(t,e){if("object"!=ft(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!=ft(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==ft(e)?e:e+""}var bt=function(){return t=function t(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.api=e,this.options=r},e=[{key:"export",value:function(t,e){gt.push.apply(gt,dt(t))}},{key:"toPayload",value:function(){var t=this,e=gt.slice();if(gt.length=0,!e||!e.length)return{resourceSpans:[]};var r,n=e[0]&&e[0].resource||{},o=new Map,i=function(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=ht(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},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(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw i}}}}(e);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(t){i.e(t)}finally{i.f()}return{resourceSpans:[{resource:this._transformResource(n),scopeSpans:Array.from(o.values()).map(function(e){return{scope:t._transformInstrumentationScope(e.scope),spans:e.spans}})}]}}},{key:"post",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.api.postSpans(t,e)}},{key:"_transformSpan",value:function(t){var e,r=this,n=function(t){return Object.entries(t||{}).map(function(t){var e=pt(t,2),n=e[0],o=e[1];return{key:n,value:r._transformAnyValue(o)}})};return{traceId:t.spanContext.traceId,spanId:t.spanContext.spanId,parentSpanId:t.parentSpanId||"",name:t.name,kind:t.kind||1,startTimeUnixNano:ct.toNanos(t.startTime),endTimeUnixNano:ct.toNanos(t.endTime),attributes:n(t.attributes),events:(e=t.events,(e||[]).map(function(t){return{timeUnixNano:ct.toNanos(t.time),name:t.name,attributes:n(t.attributes)}}))}}},{key:"_transformResource",value:function(t){var e=this,r=t.attributes||{};return{attributes:Object.entries(r).map(function(t){var r=pt(t,2),n=r[0],o=r[1];return{key:n,value:e._transformAnyValue(o)}})}}},{key:"_transformInstrumentationScope",value:function(t){var e=this;return{name:t.name||"",version:t.version||"",attributes:(t.attributes||[]).map(function(t){return{key:t.key,value:e._transformAnyValue(t.value)}})}}},{key:"_transformAnyValue",value:function(t){var e=this;if(null==t)return{stringValue:""};var r=ft(t);return"string"===r?{stringValue:t}:"number"===r?Number.isInteger(t)?{intValue:t.toString()}:{doubleValue:t}:"boolean"===r?{boolValue:t}:Array.isArray(t)?{arrayValue:{values:t.map(function(t){return e._transformAnyValue(t)})}}:"object"===r?{kvlistValue:{values:Object.entries(t).map(function(t){var r=pt(t,2),n=r[0],o=r[1];return{key:n,value:e._transformAnyValue(o)}})}}:{stringValue:String(t)}}}],e&&vt(t.prototype,e),r&&vt(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,r}(),gt=[];var wt={gen:function(){var t=new Uint8Array(arguments.length>0&&void 0!==arguments[0]?arguments[0]:16);return crypto.getRandomValues(t),Array.from(t,function(t){return t.toString(16).padStart(2,"0")}).join("")}};function kt(t){return kt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},kt(t)}function St(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function _t(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?St(Object(r),!0).forEach(function(e){xt(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):St(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function Ot(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Et(n.key),n)}}function xt(t,e,r){return(e=Et(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Et(t){var e=function(t,e){if("object"!=kt(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!=kt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==kt(e)?e:e+""}var jt="RollbarSession",It=function(){return t=function t(e,r){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),xt(this,"_attributes",void 0),this.options=r,this.tracing=e,this.window=e.window,this.session=null,this._attributes={}},e=[{key:"init",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.session||(this.getSession()||this.createSession(),this.initSessionAttributes(t)),this}},{key:"getSession",value:function(){try{var t=this.window.sessionStorage.getItem(jt);if(!t)return null;this.session=JSON.parse(t)}catch(t){return null}return this}},{key:"createSession",value:function(){return this.session={id:wt.gen(),createdAt:Date.now()},this.setSession(this.session)}},{key:"setSession",value:function(t){var e=JSON.stringify(t);try{this.window.sessionStorage.setItem(jt,e)}catch(t){return null}return this}},{key:"attributes",get:function(){return this._attributes}},{key:"setAttributes",value:function(t){return this._attributes=_t(_t({},this._attributes),t),this}},{key:"setUser",value:function(t){return this.setAttributes({"user.id":null==t?void 0:t.id,"user.email":null==t?void 0:t.email,"user.name":(null==t?void 0:t.name)||(null==t?void 0:t.username)}),this}},{key:"initSessionAttributes",value:function(t){var e,r,n;return this.setAttributes(_t({"session.id":this.session.id,"browser.brands":null===(e=navigator.userAgentData)||void 0===e?void 0:e.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},t)),this}}],e&&Ot(t.prototype,e),r&&Ot(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,r}(),Tt=function(){},Pt={debug:0,info:1,warn:2,error:3,disable:4},At={error:function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return Tt("error",e)},warn:function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return Tt("warn",e)},info:function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return Tt("info",e)},debug:function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return Tt("debug",e)},log:function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return Tt("info",e)},init:function(t){var e=t.logLevel;Tt=function(t,r){Pt[t]<Pt[e]||(r.unshift("Rollbar:"),console[t].apply(console,r))}}},Rt=At;function Ct(t){return Ct="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ct(t)}function Lt(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return qt(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?qt(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},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(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw i}}}}function qt(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function Nt(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Dt(n.key),n)}}function Dt(t){var e=function(t,e){if("object"!=Ct(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!=Ct(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Ct(e)?e:e+""}var Mt=function(){return t=function t(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.exporter=e,this.options=r,this.pendingSpans=new Map,this.transforms=[this.userTransform.bind(this)]},e=[{key:"addTransform",value:function(t){this.transforms.unshift(t)}},{key:"userTransform",value:function(t){this.options.transformSpan&&this.options.transformSpan({span:t})}},{key:"applyTransforms",value:function(t){var e,r=Lt(this.transforms);try{for(r.s();!(e=r.n()).done;){var n=e.value;try{n(t)}catch(t){Rt.error("Error running span transform callback",t)}}}catch(t){r.e(t)}finally{r.f()}}},{key:"onStart",value:function(t,e){this.pendingSpans.set(t.span.spanContext.spanId,t)}},{key:"onEnd",value:function(t){this.applyTransforms(t.span),this.exporter.export([t.export()]),this.pendingSpans.delete(t.span.spanContext.spanId)}}],e&&Nt(t.prototype,e),r&&Nt(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,r}();function Ut(t){return Ut="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ut(t)}function Ht(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,s=[],u=!0,l=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=i.call(r)).done)&&(s.push(n.value),s.length!==e);u=!0);}catch(t){l=!0,o=t}finally{try{if(!u&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return s}}(t,e)||function(t,e){if(t){if("string"==typeof t)return Ft(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Ft(t,e):void 0}}(t,e)||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 Ft(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function Jt(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Vt(n.key),n)}}function Vt(t){var e=function(t,e){if("object"!=Ut(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!=Ut(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Ut(e)?e:e+""}var Bt=function(){return t=function t(e){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.usePerformance=e.usePerformance,this.initReadableSpan(e),this.spanProcessor=e.spanProcessor,this.spanProcessor.onStart(this,e.context),e.attributes&&this.setAttributes(e.attributes),this},e=[{key:"initReadableSpan",value:function(t){var e;this.span={name:t.name,kind:t.kind,spanContext:t.spanContext,parentSpanId:t.parentSpanId,startTime:t.startTime||ct.now(t.usePerformance),endTime:[0,0],status:{code:0,message:""},attributes:{"session.id":null===(e=t.session)||void 0===e?void 0:e.id},links:[],events:[],duration:0,ended:!1,resource:t.resource,instrumentationScope:t.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(t,e){return null==e||this.span.ended||0===t.length||(this.span.attributes[t]=e),this}},{key:"setAttributes",value:function(t){for(var e=0,r=Object.entries(t);e<r.length;e++){var n=Ht(r[e],2),o=n[0],i=n[1];this.setAttribute(o,i)}return this}},{key:"addEvent",value:function(t){var e=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:t,attributes:e,time:r||ct.now(),droppedAttributesCount:0}),this}},{key:"isRecording",value:function(){return!1===this.span.ended}},{key:"end",value:function(t,e){t&&this.setAttributes(t),this.span.endTime=e||ct.now(this.usePerformance),this.span.ended=!0,this.spanProcessor.onEnd(this)}},{key:"export",value:function(){return this.span}}],e&&Jt(t.prototype,e),r&&Jt(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,r}();function Wt(t){return Wt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Wt(t)}function $t(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function Gt(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?$t(Object(r),!0).forEach(function(e){zt(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):$t(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function zt(t,e,r){return(e=Zt(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Xt(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Zt(n.key),n)}}function Zt(t){var e=function(t,e){if("object"!=Wt(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!=Wt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Wt(e)?e:e+""}var Qt=function(){return t=function t(e,r){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.spanProcessor=r,this.tracing=e},e=[{key:"startSpan",value:function(t){var e,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=wt.gen(8),f=null;l?(o=l.traceId,f=l.traceState,i=l.spanId):o=wt.gen(16);var p={traceId:o,spanId:c,traceFlags:0,traceState:f},d={attributes:Gt(Gt({},(null===(e=this.tracing.resource)||void 0===e?void 0:e.attributes)||{}),(null===(r=a.resource)||void 0===r?void 0:r.attributes)||{})};return new Bt({resource:d,scope:this.tracing.scope,session:null===(n=this.tracing.session)||void 0===n?void 0:n.session,context:s,spanContext:p,name:t,kind:0,parentSpanId:i,spanProcessor:this.spanProcessor,startTime:a.startTime,usePerformance:a.usePerformance})}}],e&&Xt(t.prototype,e),r&&Xt(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,r}();function Kt(t){return Kt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Kt(t)}function Yt(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function te(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?Yt(Object(r),!0).forEach(function(e){ee(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Yt(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function ee(t,e,r){return(e=ne(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function re(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,ne(n.key),n)}}function ne(t){var e=function(t,e){if("object"!=Kt(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!=Kt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Kt(e)?e:e+""}var oe,ie=(oe="Rollbar Context Key SPAN",Symbol.for(oe)),ae=function(){return t=function t(e,r,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.api=r,this.options=n,this.window=e,this.window.sessionStorage&&(this.session=new It(this,n)),this.createTracer()},e=[{key:"configure",value:function(t){this.options=t}},{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 t,e;return{attributes:te(te({},this.options.resource||{}),{},{"rollbar.environment":null!==(t=null===(e=this.options.payload)||void 0===e?void 0:e.environment)&&void 0!==t?t:this.options.environment})}}},{key:"scope",get:function(){return{name:"rollbar-browser-js",version:this.options.version}}},{key:"idGen",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:16;return wt.gen(t)}},{key:"createTracer",value:function(){this.contextManager=new st,this.exporter=new bt(this.api,this.options),this.spanProcessor=new Mt(this.exporter,this.options.tracing),this.tracer=new Qt(this,this.spanProcessor)}},{key:"getTracer",value:function(){return this.tracer}},{key:"addSpanTransform",value:function(t){this.spanProcessor.addTransform(t)}},{key:"getSpan",value:function(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.contextManager.active()).getValue(ie)}},{key:"setSpan",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.contextManager.active(),e=arguments.length>1?arguments[1]:void 0;return t.setValue(ie,e)}},{key:"startSpan",value:function(t){var e=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(t,e,r)}},{key:"with",value:function(t,e,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,[t,e,r].concat(i))}},{key:"withSpan",value:function(t,e,r,n){var o=this.startSpan(t,e);return this.with(this.setSpan(this.contextManager.active(),o),r,n,o)}}],e&&re(t.prototype,e),r&&re(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,r}();function se(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,s=[],u=!0,l=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=i.call(r)).done)&&(s.push(n.value),s.length!==e);u=!0);}catch(t){l=!0,o=t}finally{try{if(!u&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return s}}(t,e)||le(t,e)||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 ue(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=le(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},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(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw i}}}}function le(t,e){if(t){if("string"==typeof t)return ce(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?ce(t,e):void 0}}function ce(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function fe(t,e){return[t,m(t,e)]}function pe(t,e){var r=t.length;return r>2*e?t.slice(0,e).concat(t.slice(r-e)):t}function de(t,e,r){r=void 0===r?30:r;var n,o=t.data.body;if(o.trace_chain){var i,a=ue(o.trace_chain);try{for(a.s();!(i=a.n()).done;){var s=i.value;n=pe(n=s.frames,r),s.frames=n}}catch(t){a.e(t)}finally{a.f()}}else o.trace&&(n=pe(n=o.trace.frames,r),o.trace.frames=n);return[t,m(t,e)]}function he(t,e){return e&&e.length>t?e.slice(0,t-3).concat("..."):e}function ye(t,e,r){return e=L(e,function e(r,n,o){switch(a(n)){case"string":return he(t,n);case"object":case"array":return L(n,e,o);default:return n}}),[e,m(e,r)]}function ve(t){return t.exception&&(delete t.exception.description,t.exception.message=he(255,t.exception.message)),t.frames=pe(t.frames,1),t}function me(t,e){var r=t.data.body;if(r.trace_chain){var n,o=r.trace_chain,i=ue(o.entries());try{for(i.s();!(n=i.n()).done;){var a=se(n.value,2),s=a[0],u=a[1];o[s]=ve(u)}}catch(t){i.e(t)}finally{i.f()}}else r.trace&&(r.trace=ve(r.trace));return[t,m(t,e)]}function be(t,e){return function(t){for(var e=0,r=t.length,n=0;n<r;n++){var o=t.charCodeAt(n);o<128?e+=1:o<2048?e+=2:o<65536&&(e+=3)}return e}(t)>e}var ge={truncate:function(t,e,r){r=void 0===r?524288:r;for(var n,o,i,a=[fe,de,ye.bind(null,1024),ye.bind(null,512),ye.bind(null,256),me];n=a.shift();)if(t=(o=n(t,e))[0],(i=o[1]).error||!be(i.value,r))return i;return i},raw:fe,truncateFrames:de,truncateStrings:ye,maybeTruncateValue:he};function we(t){if(!i(t.context,"string")){var e=m(t.context);e.error?t.context="Error: could not serialize 'context'":t.context=e.value||"",t.context.length>255&&(t.context=t.context.substr(0,255))}return{data:t}}function ke(t,e,r){var n=e.hostname,o=e.protocol,i=e.port,a=e.path,s=e.search,u=t.timeout,l=function(t){var e="undefined"!=typeof window&&window||"undefined"!=typeof self&&self,r=t.defaultTransport||"xhr";void 0===e.fetch&&(r="xhr");void 0===e.XMLHttpRequest&&(r="fetch");return r}(t),c=t.proxy;if(