rollbar 3.0.0 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/rollbar.cjs +260 -3
- package/dist/rollbar.js +88 -2
- package/dist/rollbar.js.map +1 -1
- package/dist/rollbar.min.cjs +1 -1
- package/dist/rollbar.min.js +1 -1
- package/dist/rollbar.min.js.map +1 -1
- package/dist/rollbar.named-amd.js +88 -2
- package/dist/rollbar.named-amd.js.map +1 -1
- package/dist/rollbar.named-amd.min.js +1 -1
- package/dist/rollbar.named-amd.min.js.map +1 -1
- package/dist/rollbar.noconflict.umd.js +88 -2
- package/dist/rollbar.noconflict.umd.js.map +1 -1
- package/dist/rollbar.noconflict.umd.min.js +1 -1
- package/dist/rollbar.noconflict.umd.min.js.map +1 -1
- package/dist/rollbar.replay.js +88 -2
- package/dist/rollbar.replay.js.map +1 -1
- package/dist/rollbar.replay.min.js +1 -1
- package/dist/rollbar.replay.min.js.map +1 -1
- package/dist/rollbar.replay.noconflict.umd.js +88 -2
- package/dist/rollbar.replay.noconflict.umd.js.map +1 -1
- package/dist/rollbar.replay.noconflict.umd.min.js +1 -1
- package/dist/rollbar.replay.noconflict.umd.min.js.map +1 -1
- package/dist/rollbar.replay.umd.js +88 -2
- package/dist/rollbar.replay.umd.js.map +1 -1
- package/dist/rollbar.replay.umd.min.js +1 -1
- package/dist/rollbar.replay.umd.min.js.map +1 -1
- package/dist/rollbar.snippet.js +1 -1
- package/dist/rollbar.umd.js +88 -2
- package/dist/rollbar.umd.js.map +1 -1
- package/dist/rollbar.umd.min.js +1 -1
- package/dist/rollbar.umd.min.js.map +1 -1
- package/index.d.ts +15 -0
- package/package.json +2 -1
- package/src/browser/telemetry.js +25 -0
- package/src/defaults.js +1 -1
- package/src/rollbar.js +3 -1
- package/src/server/middleware/rollbarExpressMiddleware.js +63 -0
- package/src/server/rollbar.js +13 -0
- package/src/server/telemetry.js +120 -1
- package/src/utility.js +70 -0
package/dist/rollbar.min.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see rollbar.min.cjs.LICENSE.txt */
|
|
2
|
-
(()=>{"use strict";var t={d:(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:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)},e={};t.d(e,{default:()=>kr});const r=require("os"),n=require("url"),o=require("util"),i=require("json-stringify-safe");function a(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 s(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)?s(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,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}function s(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){return u="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},u(t)}function l(t,e){return e===c(t)}function c(t){var e=u(t);return"object"!==e?e:t?t instanceof Error?"error":{}.toString.call(t).match(/\s([a-zA-Z]+)/)[1].toLowerCase():"null"}function f(t){return l(t,"function")}function p(t){return null!=t&&("object"==u(t)||"function"==typeof t)}function h(t,e){return null!=t&&(Object.hasOwn?Object.hasOwn(t,e):Object.prototype.hasOwnProperty.call(t,e))}function d(){return"********"}var m={debug:0,info:1,warning:2,error:3,critical:4};function y(t,e){var r,n;try{r=JSON.stringify(t)}catch(o){if(e&&f(e))try{r=e(t)}catch(t){n=t}else n=o}return{error:n,value:r}}function v(t,e){return function(r,n){try{e(r,n)}catch(e){t.error(e)}}}function g(t){return function t(e,r){var n,o,i,a={};try{for(o in e)(n=e[o])&&(l(n,"object")||l(n,"array"))?r.includes(n)?a[o]="Removed circular reference: "+c(n):((i=r.slice()).push(n),a[o]=t(n,i)):a[o]=n}catch(t){a="Failed cloning custom data: "+t.message}return a}(t,[t])}function b(t,e,r,n,o){for(var i,a,s,u,l,f,p=[],h=[],d=0,m=t.length;d<m;++d){var y=c(f=t[d]);switch(h.push(y),y){case"undefined":break;case"string":i?p.push(f):i=f;break;case"function":u=v(e,f);break;case"date":p.push(f);break;case"error":case"domexception":case"exception":a?p.push(f):a=f;break;case"object":case"array":if(f instanceof Error||"undefined"!=typeof DOMException&&f instanceof DOMException){a?p.push(f):a=f;break}if(n&&"object"===y&&!l){for(var b=0,w=n.length;b<w;++b)if(void 0!==f[n[b]]){l=f;break}if(l)break}s?p.push(f):s=f;break;default:if(f instanceof Error||"undefined"!=typeof DOMException&&f instanceof DOMException){a?p.push(f):a=f;break}p.push(f)}}s&&(s=g(s)),p.length>0&&(s||(s=g({})),s.extraArgs=g(p));var k,_={message:i,err:a,custom:s,timestamp:O(),callback:u,notifier:r,diagnostic:{},uuid:(k=O(),"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var e=(k+16*Math.random())%16|0;return k=Math.floor(k/16),("x"===t?e:7&e|8).toString(16)}))};return _.data=_.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),n&&l&&(_.request=l),o&&(_.lambdaContext=o),_._originalArgs=t,_.diagnostic.original_arg_types=h,_}var w=["log","network","dom","navigation","error","manual"],k=["critical","error","warning","info","debug"];function _(t,e){var r,n=a(t);try{for(n.s();!(r=n.n()).done;){if(r.value===e)return!0}}catch(t){n.e(t)}finally{n.f()}return!1}function S(t,e){t.attributes=t.attributes||[];var r,n=a(e);try{for(n.s();!(r=n.n()).done;){var o=r.value;void 0!==o.value&&t.attributes.push(o)}}catch(t){n.e(t)}finally{n.f()}}function E(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 x(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 O(){return Date.now?Date.now():Number(new Date)}function I(t,e,r,n){var o=T(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 T(){function t(t){if(!t||"[object Object]"!==Object.prototype.toString.call(t))return!1;var e,r=h(t,"constructor"),n=t.constructor&&t.constructor.prototype&&h(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!r&&!n)return!1;for(e in t);return void 0===e||h(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]=T(o,n)):void 0!==n&&(a[i]=n));return a}function j(t){if(!l(t.context,"string")){var e=y(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 P(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(t.endpoint){var f=r.parse(t.endpoint);n=f.hostname,o=f.protocol,i=f.port,a=f.pathname,s=f.search}return{timeout:u,hostname:n,protocol:o,port:i,path:a,search:s,proxy:c,transport:l}}function R(t,e){var r=t.protocol||"https:",n=t.port||("http:"===r?80:"https:"===r?443:void 0),o=t.hostname,i=t.path,a=t.timeout,s=t.transport;return t.search&&(i+=t.search),t.proxy&&(i=r+"//"+o+i,o=t.proxy.host||t.proxy.hostname,n=t.proxy.port,r=t.proxy.protocol||r),{timeout:a,protocol:r,hostname:o,path:i,port:n,method:e,transport:s}}function L(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 A(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?L(Object(r),!0).forEach(function(e){q(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):L(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function q(t,e,r){return(e=F(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function C(t){return C="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},C(t)}function M(){var t,e,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function i(r,n,o,i){var u=n&&n.prototype instanceof s?n:s,l=Object.create(u.prototype);return U(l,"_invoke",function(r,n,o){var i,s,u,l=0,c=o||[],f=!1,p={p:0,n:0,v:t,a:h,f:h.bind(t,4),d:function(e,r){return i=e,s=0,u=t,p.n=r,a}};function h(r,n){for(s=r,u=n,e=0;!f&&l&&!o&&e<c.length;e++){var o,i=c[e],h=p.p,d=i[2];r>3?(o=d===n)&&(u=i[(s=i[4])?5:(s=3,3)],i[4]=i[5]=t):i[0]<=h&&((o=r<2&&h<i[1])?(s=0,p.v=n,p.n=i[1]):h<d&&(o=r<3||i[0]>n||n>d)&&(i[4]=r,i[5]=n,p.n=d,s=0))}if(o||r>1)return a;throw f=!0,n}return function(o,c,d){if(l>1)throw TypeError("Generator is already running");for(f&&1===c&&h(c,d),s=c,u=d;(e=s<2?t:u)||!f;){i||(s?s<3?(s>1&&(p.n=-1),h(s,u)):p.n=u:p.v=u);try{if(l=2,i){if(s||(o="next"),e=i[o]){if(!(e=e.call(i,u)))throw TypeError("iterator result is not an object");if(!e.done)return e;u=e.value,s<2&&(s=0)}else 1===s&&(e=i.return)&&e.call(i),s<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),s=1);i=t}else if((e=(f=p.n<0)?u:r.call(n,p))!==a)break}catch(e){i=t,s=1,u=e}finally{l=1}}return{value:e,done:f}}}(r,o,i),!0),l}var a={};function s(){}function u(){}function l(){}e=Object.getPrototypeOf;var c=[][n]?e(e([][n]())):(U(e={},n,function(){return this}),e),f=l.prototype=s.prototype=Object.create(c);function p(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,l):(t.__proto__=l,U(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return u.prototype=l,U(f,"constructor",l),U(l,"constructor",u),u.displayName="GeneratorFunction",U(l,o,"GeneratorFunction"),U(f),U(f,o,"Generator"),U(f,n,function(){return this}),U(f,"toString",function(){return"[object Generator]"}),(M=function(){return{w:i,m:p}})()}function U(t,e,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}U=function(t,e,r,n){function i(e,r){U(t,e,function(t){return this._invoke(e,r,t)})}e?o?o(t,e,{value:r,enumerable:!n,configurable:!n,writable:!n}):t[e]=r:(i("next",0),i("throw",1),i("return",2))},U(t,e,r,n)}function D(t,e,r,n,o,i,a){try{var s=t[i](a),u=s.value}catch(t){return void r(t)}s.done?e(u):Promise.resolve(u).then(n,o)}function N(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,F(n.key),n)}}function F(t){var e=function(t,e){if("object"!=C(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!=C(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==C(e)?e:e+""}var H={hostname:"api.rollbar.com",path:"/api/1/item/",search:null,version:"1",protocol:"https:",port:443},B={hostname:"api.rollbar.com",path:"/api/1/session/",search:null,version:"1",protocol:"https:",port:443},J=function(){return t=function t(e,r,n,o){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.options=e,this.transport=r,this.url=n,this.truncation=o,this.accessToken=e.accessToken,this.transportOptions=W(e,n),this.OTLPTransportOptions=G(e,n)},e=[{key:"_postPromise",value:function(t){var e=this,r=t.accessToken,n=t.options,o=t.payload,i=t.headers;return new Promise(function(t,a){e.transport.post({accessToken:r,options:n,payload:o,headers:i,callback:function(e,r){return e?a(e):t(r)}})})}},{key:"postItem",value:function(t,e){var r=this,n=R(this.transportOptions,"POST"),o=j(t);setTimeout(function(){r.transport.post({accessToken:r.accessToken,options:n,payload:o,callback:e})},0)}},{key:"postSpans",value:(n=M().m(function t(e){var r,n,o=arguments;return M().w(function(t){for(;;)if(0===t.n)return r=o.length>1&&void 0!==o[1]?o[1]:{},n=R(this.OTLPTransportOptions,"POST"),t.a(2,this._postPromise({accessToken:this.accessToken,options:n,payload:e,headers:r}))},t,this)}),o=function(){var t=this,e=arguments;return new Promise(function(r,o){var i=n.apply(t,e);function a(t){D(i,r,o,a,s,"next",t)}function s(t){D(i,r,o,a,s,"throw",t)}a(void 0)})},function(t){return o.apply(this,arguments)})},{key:"buildJsonPayload",value:function(t,e){var r,n=j(t);return(r=this.truncation?this.truncation.truncate(n):y(n)).error?(e&&e(r.error),null):r.value}},{key:"postJsonPayload",value:function(t,e){var r=R(this.transportOptions,"POST");this.transport.postJsonPayload(this.accessToken,r,t,e)}},{key:"configure",value:function(t){var e=this.options;return this.options=T(e,t),this.transportOptions=W(this.options,this.url),this.OTLPTransportOptions=G(this.options,this.url),void 0!==this.options.accessToken&&(this.accessToken=this.options.accessToken),this}}],e&&N(t.prototype,e),r&&N(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,r,n,o}();function W(t,e){return P(t,H,e)}function G(t,e){var r;return P(t=A(A({},t),{},{endpoint:null===(r=t.tracing)||void 0===r?void 0:r.endpoint}),B,e)}const z=J;var $="3.0.0",Q="debug";var Z=function(){},V={debug:0,info:1,warn:2,error:3,disable:4},X={error:function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return Z("error",e)},warn:function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return Z("warn",e)},info:function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return Z("info",e)},debug:function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return Z("debug",e)},log:function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return Z("info",e)},init:function(t){var e=t.logLevel;Z=function(t,r){V[t]<V[e]||(r.unshift("Rollbar:"),console[t].apply(console,r))}}};const K=X;function Y(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 tt(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)?tt(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 tt(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 et(t,e){var r=t.level,n=m[r]||0,o=e.reportLevel;return!(n<(m[o]||0))}function rt(t,e,r){if(!t)return!r;var n,o,i=t.frames;if(!i||0===i.length)return!r;for(var a=e.length,s=i.length,u=0;u<s;u++){if(!l(n=i[u].filename,"string"))return!r;for(var c=0;c<a;c++)if(o=e[c],new RegExp(o).test(n))return!0}return!1}function nt(t,e,r,n){var o,i,a=!1;"blocklist"===r&&(a=!0);try{if(o=a?e.hostBlockList:e.hostSafeList,i=E(t,"body.trace_chain")||[E(t,"body.trace")],!o||0===o.length)return!a;if(0===i.length||!i[0])return!a;for(var s=i.length,u=0;u<s;u++)if(rt(i[u],o,a))return!0}catch(t){a?e.hostBlockList=null:e.hostSafeList=null;var l=a?"hostBlockList":"hostSafeList";return n.error("Error while reading your configuration's "+l+" option. Removing custom "+l+".",t),!a}return!1}function ot(t){return function(e,r){var n,o,i,a,s,u;try{if(!(i=r.ignoredMessages)||0===i.length)return!0;if(u=function(t){var e=t.body,r=[];if(e.trace_chain){var n,o=Y(e.trace_chain);try{for(o.s();!(n=o.n()).done;){var i=n.value;r.push(E(i,"exception.message"))}}catch(t){o.e(t)}finally{o.f()}}e.trace&&r.push(E(e,"trace.exception.message"));e.message&&r.push(E(e,"message.body"));return r}(e),0===u.length)return!0;for(a=i.length,n=0;n<a;n++)for(s=new RegExp(i[n],"gi"),o=0;o<u.length;o++)if(s.test(u[o]))return!1}catch(e){r.ignoredMessages=null,t.error("Error while reading your configuration's ignoredMessages option. Removing custom ignoredMessages.")}return!0}}function it(t){return it="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},it(t)}function at(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,st(n.key),n)}}function st(t){var e=function(t,e){if("object"!=it(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!=it(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==it(e)?e:e+""}var ut=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.queue=e,this.options=r,this.transforms=[],this.diagnostic={}},(e=[{key:"configure",value:function(t){var e;null===(e=this.queue)||void 0===e||e.configure(t);var r=this.options;return this.options=T(r,t),this}},{key:"addTransform",value:function(t){return f(t)&&this.transforms.push(t),this}},{key:"log",value:function(t,e){var r=this;if(e=f(e)?e:function(){},!this.options.enabled)return e(new Error("Rollbar is not enabled"),null);this.queue.addPendingItem(t);var n=t.err;this._applyTransforms(t,function(o,i){if(o)return r.queue.removePendingItem(t),e(o,null);r.queue.addItem(i,e,n,t)})}},{key:"_applyTransforms",value:function(t,e){var r=-1,n=this.transforms.length,o=this.transforms,i=this.options,a=function(t,s){t?e(t,null):++r!==n?o[r](s,i,a):e(null,s)};a(null,t)}}])&&at(t.prototype,e),r&&at(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,r}();function lt(t){return lt="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},lt(t)}function ct(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,ft(n.key),n)}}function ft(t){var e=function(t,e){if("object"!=lt(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!=lt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==lt(e)?e:e+""}var pt,ht,dt,mt=function(){function t(e,r,n,o,i){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.rateLimiter=e,this.api=r,this.logger=n,this.options=o,this.replay=i,this.predicates=[],this.pendingItems=[],this.pendingRequests=[],this.retryQueue=[],this.retryHandle=null,this.waitCallback=null,this.waitIntervalID=null}return e=t,(r=[{key:"configure",value:function(t){var e;null===(e=this.api)||void 0===e||e.configure(t);var r=this.options;return this.options=T(r,t),this}},{key:"addPredicate",value:function(t){return f(t)&&this.predicates.push(t),this}},{key:"addPendingItem",value:function(t){this.pendingItems.push(t)}},{key:"removePendingItem",value:function(t){var e=this.pendingItems.indexOf(t);-1!==e&&this.pendingItems.splice(e,1)}},{key:"addItem",value:function(t,e,r,n){var o=this;e&&f(e)||(e=function(){});var i=t.data,a=this._applyPredicates(i);if(a.stop)return this.removePendingItem(n),void e(a.err);if(this._maybeLog(i,r),this.removePendingItem(n),this.options.transmit){this.replay&&i.body&&(t.replayId=this.replay.capture(null,i.uuid,{type:"occurrence",level:t.level}),t.replayId&&S(t.data,[{key:"replay_id",value:t.replayId}])),this.pendingRequests.push(i);try{this._makeApiRequest(i,function(r,n,a){o._dequeuePendingRequest(i),t.replayId&&o.replay.sendOrDiscardReplay(t.replayId,r,n,a),e(r,n)})}catch(r){var s;this._dequeuePendingRequest(i),t.replayId&&(null===(s=this.replay)||void 0===s||s.discard(t.replayId)),e(r)}}else e(new Error("Transmit disabled"))}},{key:"wait",value:function(t){var e=this;f(t)&&(this.waitCallback=t,this._maybeCallWait()||(this.waitIntervalID&&(this.waitIntervalID=clearInterval(this.waitIntervalID)),this.waitIntervalID=setInterval(function(){e._maybeCallWait()},500)))}},{key:"_applyPredicates",value:function(t){for(var e=null,r=0,n=this.predicates.length;r<n;r++)if(!(e=this.predicates[r](t,this.options))||void 0!==e.err)return{stop:!0,err:e.err};return{stop:!1,err:null}}},{key:"_makeApiRequest",value:function(t,e){var r=this,n=this.rateLimiter.shouldSend(t);n.shouldSend?this.api.postItem(t,function(n,o,i){n?r._maybeRetry(n,t,e):e(n,o,i)}):n.error?e(n.error):this.api.postItem(n.payload,e)}},{key:"_maybeRetry",value:function(e,r,n){var o,i=!1;if(this.options.retryInterval){for(var a=0,s=t.RETRIABLE_ERRORS.length;a<s;a++)if(e.code===t.RETRIABLE_ERRORS[a]){i=!0;break}i&&(o=this.options.maxRetries,Number.isFinite(o))&&(r.retries=r.retries?r.retries+1:1,r.retries>this.options.maxRetries&&(i=!1))}i?this._retryApiRequest(r,n):n(e)}},{key:"_retryApiRequest",value:function(t,e){var r=this;this.retryQueue.push({item:t,callback:e}),this.retryHandle||(this.retryHandle=setInterval(function(){for(;r.retryQueue.length;){var t=r.retryQueue.shift();r._makeApiRequest(t.item,t.callback)}},this.options.retryInterval))}},{key:"_dequeuePendingRequest",value:function(t){var e=this.pendingRequests.indexOf(t);-1!==e&&(this.pendingRequests.splice(e,1),this._maybeCallWait())}},{key:"_maybeLog",value:function(t,e){if(this.logger&&this.options.verbose){var r=e||E(t,"body.trace.exception.message")||E(t,"body.trace_chain.0.exception.message");if(r)return void this.logger.error(r);(r=E(t,"body.message.body"))&&this.logger.log(r)}}},{key:"_maybeCallWait",value:function(){return!(!f(this.waitCallback)||0!==this.pendingItems.length||0!==this.pendingRequests.length||(this.waitIntervalID&&(this.waitIntervalID=clearInterval(this.waitIntervalID)),this.waitCallback(),0))}}])&&ct(e.prototype,r),n&&ct(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,r,n}();pt=mt,dt=["ECONNRESET","ENOTFOUND","ESOCKETTIMEDOUT","ETIMEDOUT","ECONNREFUSED","EHOSTUNREACH","EPIPE","EAI_AGAIN"],(ht=ft(ht="RETRIABLE_ERRORS"))in pt?Object.defineProperty(pt,ht,{value:dt,enumerable:!0,configurable:!0,writable:!0}):pt[ht]=dt;const yt=mt;function vt(t){return vt="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},vt(t)}function gt(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,bt(n.key),n)}}function bt(t){var e=function(t,e){if("object"!=vt(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!=vt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==vt(e)?e:e+""}var wt=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.startTime=Date.now(),this.counter=0,this.perMinCounter=0,this.platform=null,this.platformOptions={},this.configureGlobal(e)}return function(t,e,r){return e&>(t.prototype,e),r&>(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}(t,[{key:"configureGlobal",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=e.startTime,n=e.maxItems,o=e.itemsPerMinute;void 0!==r&&(t.globalSettings.startTime=r),void 0!==n&&(t.globalSettings.maxItems=n),void 0!==o&&(t.globalSettings.itemsPerMinute=o)}},{key:"shouldSend",value:function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Date.now(),n=r-this.startTime;(n<0||n>=6e4)&&(this.startTime=r,this.perMinCounter=0);var o=t.globalSettings.maxItems,i=t.globalSettings.itemsPerMinute;if(kt(e,o,this.counter))return _t(this.platform,this.platformOptions,"".concat(o," max items reached"),!1);if(kt(e,i,this.perMinCounter))return _t(this.platform,this.platformOptions,"".concat(i," items per minute reached"),!1);this.counter+=1,this.perMinCounter+=1;var a=!kt(e,o,this.counter),s=a,u=a&&!kt(e,i,this.perMinCounter);return _t(this.platform,this.platformOptions,null,u,o,i,s)}},{key:"setPlatformOptions",value:function(t,e){this.platform=t,this.platformOptions=e}}])}();function kt(t,e,r){return!t.ignoreRateLimit&&e>=1&&r>e}function _t(t,e,r,n,o,i,a){var s=null,u=r?new Error(r):null;return u||n||(s=function(t,e,r,n,o){var i=e.environment||e.payload&&e.payload.environment,a=o?"item per minute limit reached, ignoring errors until timeout":"maxItems has been hit, ignoring errors until reset.",s={body:{message:{body:a,extra:{maxItems:r,itemsPerMinute:n}}},language:"javascript",environment:i,notifier:{version:e.notifier&&e.notifier.version||e.version}};"browser"===t?(s.platform="browser",s.framework="browser-js",s.notifier.name="rollbar-browser-js"):"server"===t?(s.framework=e.framework||"node-js",s.notifier.name=e.notifier.name):"react-native"===t&&(s.framework=e.framework||"react-native",s.notifier.name=e.notifier.name);return s}(t,e,o,i,a)),{error:u,shouldSend:n,payload:s}}!function(t,e,r){(e=bt(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r}(wt,"globalSettings",{startTime:Date.now(),maxItems:void 0,itemsPerMinute:void 0});const St=wt;function Et(t,e,r,n,o,i,a){this.options=T(t),this.logger=r,Et.rateLimiter.configureGlobal(this.options),Et.rateLimiter.setPlatformOptions(a,this.options),this.api=e,this.queue=new yt(Et.rateLimiter,e,r,this.options,i),this.tracing=o;var s=this.options.tracer||null;Ot(s)?(this.tracer=s,this.options.tracer="opentracing-tracer-enabled",this.options._configuredOptions.tracer="opentracing-tracer-enabled"):this.tracer=null,this.notifier=new ut(this.queue,this.options),this.telemeter=n,xt(t),this.lastError=null,this.lastErrorHash="none"}function xt(t){t.stackTraceLimit&&(Error.stackTraceLimit=t.stackTraceLimit)}function Ot(t){if(!t)return!1;if(!t.scope||"function"!=typeof t.scope)return!1;var e=t.scope();return!(!e||!e.active||"function"!=typeof e.active)}Et.rateLimiter=new St({maxItems:0,itemsPerMinute:60}),Et.prototype.global=function(t){return Et.rateLimiter.configureGlobal(t),this},Et.prototype.configure=function(t,e){var r=this.options,n={};e&&(n={payload:e}),this.options=T(r,t,n);var o=this.options.tracer||null;return Ot(o)?(this.tracer=o,this.options.tracer="opentracing-tracer-enabled",this.options._configuredOptions.tracer="opentracing-tracer-enabled"):this.tracer=null,this.notifier&&this.notifier.configure(this.options),this.telemeter&&this.telemeter.configure(this.options),xt(t),this.global(this.options),Ot(t.tracer)&&(this.tracer=t.tracer),this},Et.prototype.log=function(t){var e=this._defaultLogLevel();return this._log(e,t)},Et.prototype.debug=function(t){this._log("debug",t)},Et.prototype.info=function(t){this._log("info",t)},Et.prototype.warn=function(t){this._log("warning",t)},Et.prototype.warning=function(t){this._log("warning",t)},Et.prototype.error=function(t){this._log("error",t)},Et.prototype.critical=function(t){this._log("critical",t)},Et.prototype.wait=function(t){this.queue.wait(t)},Et.prototype.captureEvent=function(t,e,r){return this.telemeter&&this.telemeter.captureEvent(t,e,r)},Et.prototype.captureDomContentLoaded=function(t){return this.telemeter&&this.telemeter.captureDomContentLoaded(t)},Et.prototype.captureLoad=function(t){return this.telemeter&&this.telemeter.captureLoad(t)},Et.prototype.buildJsonPayload=function(t){return this.api.buildJsonPayload(t)},Et.prototype.sendJsonPayload=function(t){this.api.postJsonPayload(t)},Et.prototype._log=function(t,e){var r;if(e.callback&&(r=e.callback,delete e.callback),this.options.ignoreDuplicateErrors&&this._sameAsLastError(e)){if(r){var n=new Error("ignored identical item");n.item=e,r(n)}}else try{e.level=e.level||t,this._addItemAttributes(e),this._addTracingInfo(e);var o=this.telemeter;o&&(o._captureRollbarItem(e),e.telemetryEvents=o.copyEvents()||[]),this.notifier.log(e,r)}catch(t){r&&r(t),this.logger.error(t)}},Et.prototype._addItemAttributes=function(t){var e,r,n=null===(e=this.tracing)||void 0===e?void 0:e.getSpan(),o=[{key:"session_id",value:null===(r=this.tracing)||void 0===r?void 0:r.sessionId},{key:"span_id",value:null==n?void 0:n.spanId},{key:"trace_id",value:null==n?void 0:n.traceId}];t._isUncaught&&o.push({key:"is_uncaught",value:"true"}),S(t.data,o),null==n||n.addEvent("rollbar.occurrence",[{key:"rollbar.occurrence.uuid",value:t.uuid}])},Et.prototype._defaultLogLevel=function(){return this.options.logLevel||"debug"},Et.prototype._sameAsLastError=function(t){if(!t._isUncaught)return!1;var e=function(t){var e=t.message||"",r=(t.err||{}).stack||String(t.err);return e+"::"+r}(t);return this.lastErrorHash===e||(this.lastError=t.err,this.lastErrorHash=e,!1)},Et.prototype._addTracingInfo=function(t){if(this.tracer){var e=this.tracer.scope().active();if(function(t){if(!t||!t.context||"function"!=typeof t.context)return!1;var e=t.context();if(!e||!e.toSpanId||!e.toTraceId||"function"!=typeof e.toSpanId||"function"!=typeof e.toTraceId)return!1;return!0}(e)){e.setTag("rollbar.error_uuid",t.uuid),e.setTag("rollbar.has_error",!0),e.setTag("error",!0),e.setTag("rollbar.item_url","https://rollbar.com/item/uuid/?uuid=".concat(t.uuid)),e.setTag("rollbar.occurrence_url","https://rollbar.com/occurrence/uuid/?uuid=".concat(t.uuid));var r=e.context().toSpanId(),n=e.context().toTraceId();t.custom?(t.custom.opentracing_span_id=r,t.custom.opentracing_trace_id=n):t.custom={opentracing_span_id:r,opentracing_trace_id:n}}}};const It=Et;var Tt=["otelAttributes"];function jt(t){return jt="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},jt(t)}function Pt(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 Rt(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?Pt(Object(r),!0).forEach(function(e){Lt(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Pt(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function Lt(t,e,r){return(e=qt(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function At(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,qt(n.key),n)}}function qt(t){var e=function(t,e){if("object"!=jt(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!=jt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==jt(e)?e:e+""}var Ct=100;function Mt(t){return[Math.trunc(t/1e3),Math.round(t%1e3*1e6)]}var Ut=function(){return function(t,e,r){return e&&At(t.prototype,e),r&&At(t,r),Object.defineProperty(t,"prototype",{writable:!1}),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=T(e);var o=this.options.maxTelemetryEvents||Ct;this.maxQueueSize=Math.max(0,Math.min(o,Ct)),this.tracing=r,this.telemetrySpan=null===(n=this.tracing)||void 0===n?void 0:n.startSpan("rollbar-telemetry",{})},[{key:"configure",value:function(t){var e=this.options;this.options=T(e,t);var r=this.options.maxTelemetryEvents||Ct,n=Math.max(0,Math.min(r,Ct)),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(f(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.filter(function(t){return"connectivity"!==t.type}),t=t.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,Tt);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:Dt(t,r),type:t,timestamp_ms:o||O(),body:e,source:"client"};n&&(a.uuid=n),i&&(a.otelAttributes=i);try{if(f(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,Mt(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=Rt({message:t,level:e},r?{type:"message",uuid:r}:{});return null===(o=this.telemetrySpan)||void 0===o||o.addEvent(i,a,Mt(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,Mt(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:Mt(a)},c=this._getRepeatedEvent(s,l);return c?this._updateRepeatedEvent(c,l,a):(null===(e=this.telemetrySpan)||void 0===e||e.addEvent(s,l,Mt(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:Mt(i)},l=this._getRepeatedEvent(a,u);return l?this._updateRepeatedEvent(l,u,i):(null===(e=this.telemetrySpan)||void 0===e||e.addEvent(a,u,Mt(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=Mt(r),t.otelAttributes.durationUnixNano=Mt(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,Mt(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,Mt(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=Rt(Rt({},f),{},{element:o,dropEffect:i,effectAllowed:a}),p=Rt(Rt({},p),{},{element:o,dropEffect:i,effectAllowed:a})),"drop"===r&&(f=Rt(Rt({},f),{},{element:o,dropEffect:i,effectAllowed:a,kinds:s,mediaTypes:u}),p=Rt(Rt({},p),{},{element:o,dropEffect:i,effectAllowed:a,kinds:s,mediaTypes:u})),null===(e=this.telemetrySpan)||void 0===e||e.addEvent(c,p,Mt(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},Mt(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,Mt(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()}}])}();function Dt(t,e){if(e)return e;return{error:"error",manual:"info"}[t]||"info"}const Nt=Ut;function Ft(t,e,r){t._isUncaught&&(t.data._isUncaught=!0),t._originalArgs&&(t.data._originalArgs=t._originalArgs),r(null,t)}function Ht(t,e,r){var n=e.payload||{};n.body&&delete n.body,t.data=T(t.data,n),r(null,t)}function Bt(t,e,r){t.telemetryEvents&&x(t,"data.body.telemetry",t.telemetryEvents),r(null,t)}function Jt(t,e,r){if(t.message){var n="data.body.trace_chain.0",o=E(t,n);if(o||(o=E(t,n="data.body.trace")),o){if(!o.exception||!o.exception.description)return x(t,n+".exception.description",t.message),void r(null,t);x(t,n+".extra",T(E(t,n+".extra")||{},{message:t.message}))}r(null,t)}else r(null,t)}function Wt(t){return function(e,r,n){var o,i=T(e),a=null;try{f(r.transform)&&(a=r.transform(i.data,e))}catch(o){return r.transform=null,t.error("Error while calling custom transform() function. Removing custom transform().",o),void n(null,e)}p(o=a)&&l(o.then,"function")?a.then(function(t){t&&(i.data=t),n(null,i)},function(t){n(t,e)}):n(null,i)}}function Gt(t,e,r){if(!e.sendConfig)return r(null,t);var n=E(t,"data.custom")||{};n._rollbarConfig=e,t.data.custom=n,r(null,t)}function zt(t,e){f(t[e])&&(t[e]=t[e].toString())}function $t(t,e,r){var n=e._configuredOptions;zt(n,"transform"),zt(n,"checkIgnore"),zt(n,"onSendCallback"),delete n.accessToken,t.data.notifier.configured_options=n,r(null,t)}function Qt(t,e,r){var n=T(t.notifier.client.notifier.diagnostic,t.diagnostic);if(E(t,"err._isAnonymous")&&(n.is_anonymous=!0),t._isUncaught&&(n.is_uncaught=t._isUncaught),t.err)try{n.raw_error={message:t.err.message,name:t.err.name,constructor_name:t.err.constructor&&t.err.constructor.name,filename:t.err.fileName,line:t.err.lineNumber,column:t.err.columnNumber,stack:t.err.stack}}catch(t){n.raw_error={failed:String(t)}}t.data.notifier.diagnostic=T(t.data.notifier.diagnostic,n),r(null,t)}const Zt=function(t,e,r){var n,o,i,a,s=l(t,"object"),u=l(t,"array"),c=[];if(r=r||{obj:[],mapped:[]},s){if(a=r.obj.indexOf(t),s&&-1!==a)return r.mapped[a]||r.obj[a];r.obj.push(t),a=r.obj.length-1}if(s)for(n in t)h(t,n)&&c.push(n);else if(u)for(i=0;i<t.length;++i)c.push(i);var f=s?{}:[],p=!0;for(i=0;i<c.length;++i)o=t[n=c[i]],f[n]=e(n,o,r),p=p&&f[n]===t[n];return s&&!p&&(r.mapped[a]=f),p?t:f};function Vt(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)||Kt(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 Xt(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=Kt(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 Kt(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 te(t,e){return[t,y(t,e)]}function ee(t,e){var r=t.length;return r>2*e?t.slice(0,e).concat(t.slice(r-e)):t}function re(t,e,r){r=void 0===r?30:r;var n,o=t.data.body;if(o.trace_chain){var i,a=Xt(o.trace_chain);try{for(a.s();!(i=a.n()).done;){var s=i.value;n=ee(n=s.frames,r),s.frames=n}}catch(t){a.e(t)}finally{a.f()}}else o.trace&&(n=ee(n=o.trace.frames,r),o.trace.frames=n);return[t,y(t,e)]}function ne(t,e){return e&&e.length>t?e.slice(0,t-3).concat("..."):e}function oe(t,e,r){return e=Zt(e,function e(r,n,o){switch(c(n)){case"string":return ne(t,n);case"object":case"array":return Zt(n,e,o);default:return n}}),[e,y(e,r)]}function ie(t){return t.exception&&(delete t.exception.description,t.exception.message=ne(255,t.exception.message)),t.frames=ee(t.frames,1),t}function ae(t,e){var r=t.data.body;if(r.trace_chain){var n,o=r.trace_chain,i=Xt(o.entries());try{for(i.s();!(n=i.n()).done;){var a=Vt(n.value,2),s=a[0],u=a[1];o[s]=ie(u)}}catch(t){i.e(t)}finally{i.f()}}else r.trace&&(r.trace=ie(r.trace));return[t,y(t,e)]}function se(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}const ue={truncate:function(t,e,r){r=void 0===r?524288:r;for(var n,o,i,a=[te,re,oe.bind(null,1024),oe.bind(null,512),oe.bind(null,256),ae];n=a.shift();)if(t=(o=n(t,e))[0],(i=o[1]).error||!se(i.value,r))return i;return i},raw:te,truncateFrames:re,truncateStrings:oe,maybeTruncateValue:ne};function le(t){return function(t){if(Array.isArray(t))return ce(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(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}}(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 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}var fe=["authorization","www-authorization","http_authorization","omniauth.auth","cookie","oauth-access-token","x-access-token","x_csrf_token","http_x_csrf_token","x-csrf-token"],pe=[].concat(le(["pw","pass","passwd","password","secret","confirm_password","confirmPassword","password_confirmation","passwordConfirmation","access_token","accessToken","X-Rollbar-Access-Token","secret_key","secretKey","secretToken"]),le(["api_key","authenticity_token","oauth_token","token","user_session_secret"]),le(["request.session.csrf","request.session._csrf","request.params._csrf","request.cookie","request.cookies"]));const he=require("http"),de=require("https");const me=function(t,e,r,n,o){var i=t[e];t[e]=r(i),n&&n[o].push([t,e,i])};function ye(t){var e={protocol:t.protocol,hostname:"string"==typeof t.hostname&&t.hostname.startsWith("[")?t.hostname.slice(1,-1):t.hostname,hash:t.hash,search:t.search,pathname:t.pathname,path:"".concat(t.pathname||"").concat(t.search||""),href:t.href};return""!==t.port&&(e.port=Number(t.port)),(t.username||t.password)&&(e.auth="".concat(t.username,":").concat(t.password)),e}function ve(t){var e=t.protocol||"http:";return e+="//",t.auth&&(e+="".concat(t.auth,"@")),e+=t.hostname||t.host||"localhost",t.port&&(e+=":".concat(t.port)),e+=t.path||"/"}var ge={network:!0,networkResponseHeaders:!1,networkRequestHeaders:!1,log:!0};function be(t,e,r){this.options=t;var n=t.autoInstrument;!1===t.enabled||!1===n?this.autoInstrument={}:(l(n,"object")||(n=ge),this.autoInstrument=T(ge,n)),this.telemeter=e,this.rollbar=r,this.diagnostic=r.client.notifier.diagnostic,this.replacements={network:[],log:[]}}function we(t){var e=this,r=this.telemeter;return function(){for(var o=arguments.length,i=new Array(o),a=0;a<o;a++)i[a]=arguments[a];var s=function(t,e,r){if("string"==typeof t){var o=t;t=ye(new n.URL(o))}else t&&t instanceof n.URL?t=ye(t):(r=e,e=t,t=null);return"function"==typeof e?(r=e,e=t||{}):e=T(t||{},e),{options:e,cb:r}}(i[0],i[1],i[2]),u={method:s.options.method||"GET",url:ve(s.options),status_code:null,start_time_ms:O(),end_time_ms:null};e.autoInstrument.networkRequestHeaders&&(u.request_headers=s.options.headers),r.captureNetwork(u,"http");var l=function(t,e,r){return function(n){if(e.end_time_ms=O(),e.status_code=n.statusCode,e.response={},t.networkResponseHeaders&&(e.response.headers=n.headers),r)return r.apply(void 0,arguments)}}(e.autoInstrument,u,s.cb);s.cb&&i.pop(),i.push(l);var c=t.apply(de,i);return c.on("error",function(t){u.status_code=0,u.error=[t.name,t.message].join(": ")}),c}}function ke(t,e){for(var r;t[e].length;)(r=t[e].shift())[0][r[1]]=r[2]}be.prototype.configure=function(t){this.options=T(this.options,t);var e=t.autoInstrument,r=T(this.autoInstrument);!1===t.enabled||!1===e?this.autoInstrument={}:(l(e,"object")||(e=ge),this.autoInstrument=T(ge,e)),this.instrument(r)},be.prototype.instrument=function(t){!this.autoInstrument.network||t&&t.network?!this.autoInstrument.network&&t&&t.network&&this.deinstrumentNetwork():this.instrumentNetwork(),!this.autoInstrument.log||t&&t.log?!this.autoInstrument.log&&t&&t.log&&this.deinstrumentConsole():this.instrumentConsole()},be.prototype.deinstrumentNetwork=function(){ke(this.replacements,"network")},be.prototype.instrumentNetwork=function(){me(he,"request",we.bind(this),this.replacements,"network"),me(de,"request",we.bind(this),this.replacements,"network")},be.prototype.captureNetwork=function(t,e,r){return this.telemeter.captureNetwork(t,e,r)},be.prototype.deinstrumentConsole=function(){ke(this.replacements,"log")},be.prototype.instrumentConsole=function(){var t=this.telemeter,e=process.stdout;me(e,"write",function(r){return function(n){return t.captureLog(n,"info"),r.apply(e,arguments)}},this.replacements,"log");var r=process.stderr;me(r,"write",function(e){return function(n){return t.captureLog(n,"error"),e.apply(r,arguments)}},this.replacements,"log")};const _e=be,Se=require("async"),Ee=require("request-ip");function xe(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)||Ie(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 Oe(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=Ie(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 Ie(t,e){if(t){if("string"==typeof t)return Te(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)?Te(t,e):void 0}}function Te(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 je(t,e){var r=e.split("."),n=r.length-1;try{var o,i=Oe(r.entries());try{for(i.s();!(o=i.n()).done;){var a=xe(o.value,2),s=a[0],u=a[1];s<n?t=t[u]:t[u]=d()}}catch(t){i.e(t)}finally{i.f()}}catch(t){}}const Pe=function(t,e,r){if(e=e||[],r){var n,o=Oe(r);try{for(o.s();!(n=o.n()).done;){je(t,n.value)}}catch(t){o.e(t)}finally{o.f()}}var i=function(t){var e,r=[],n=Oe(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),a=function(t){var e,r=[],n=Oe(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 s(t,e){return e+"********"}return Zt(t,function t(e,r,n){var o=function(t,e){var r,n=Oe(i);try{for(n.s();!(r=n.n()).done;)if(r.value.test(t)){e=d();break}}catch(t){n.e(t)}finally{n.f()}return e}(e,r);return o===r?l(r,"object")||l(r,"array")?Zt(r,t,n):function(t){if(l(t,"string")){var e,r=Oe(a);try{for(r.s();!(e=r.n()).done;){var n=e.value;t=t.replace(n,s)}}catch(t){r.e(t)}finally{r.f()}}return t}(o):o})},Re=require("fs"),Le=require("lru-cache"),Ae=require("path"),qe=require("source-map");var Ce={},Me={},Ue={},De=/^data:application\/json[^,]+base64,/;function Ne(t){if(t=t.trim(),/^file:/.test(t)&&(t=t.replace(/file:\/\/\/(\w:)?/,function(t,e){return e?"":"/"})),t in Ce)return Ce[t];var e="";try{Re.existsSync(t)&&(e=Re.readFileSync(t,"utf8"))}catch(t){}return Ce[t]=e}function Fe(t,e){if(!t)return e;var r=Ae.dirname(t),n=/^\w+:\/\/[^/]*/.exec(r),o=n?n[0]:"",i=r.slice(o.length);return o&&/^\/\w:/.test(i)?(o+="/")+Ae.resolve(r.slice(o.length),e).replace(/\\/g,"/"):o+Ae.resolve(r.slice(o.length),e)}function He(t){var e,r=function(t){var e;e=Ne(t);for(var r,n,o=/(?:\/\/[@#][ \t]+sourceMappingURL=([^\s'"]+?)[ \t]*$)|(?:\/\*[@#][ \t]+sourceMappingURL=([^*]+?)[ \t]*(?:\*\/)[ \t]*$)/gm;n=o.exec(e);)r=n;return r?r[1]:null}(t);if(!r)return null;if(De.test(r)){var n=r.slice(r.indexOf(",")+1);e=Buffer.from(n,"base64").toString(),r=t}else e=Ne(r=Fe(t,r));return e?{url:r,map:e}:null}function Be(t,e){var r=Me[t.source];if(!r){var n=He(t.source);n?(r=Me[t.source]={url:n.url,map:new qe.SourceMapConsumer(n.map)},e.node_source_maps.source_mapping_urls[t.source]=n.url,r.map.sourcesContent&&r.map.sources.forEach(function(t,e){var n=r.map.sourcesContent[e];if(n){var o=Fe(r.url,t);Ce[o]=n}})):(r=Me[t.source]={url:null,map:null},e.node_source_maps.source_mapping_urls[t.source]="not found")}if(r&&r.map&&"function"==typeof r.map.originalPositionFor){var o=r.map.originalPositionFor(t);if(null!==o.source){var i=o.source;return o.source=Fe(r.url,o.source),function(t,e,r){Ue[r]||(Ue[r]=t.map.sourceContentFor(e,!0))}(r,i,o.source),o}}return t}function Je(t){return Ue[t]}function We(t){return We="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},We(t)}var Ge=/^\s*at (?:([^(]+(?: \[\w\s+\])?(?:.*\)*)) )?\(?(.+?)(?::(\d+):(\d+)(?:, <js>:(\d+):(\d+))?)?\)?$/,ze=/^\s*at .+ \(.+ (at[^)]+\))\)$/,$e=/^\s*(>?) [0-9]+\|(\s*.+)$/m,Qe=new Le({max:100}),Ze={};function Ve(t,e){var r,n,o,i,a;if((r=(n=t).match(ze))&&(n=r[1]),!(r=n.match(Ge)))return e(null,null);var s={source:(o=r.slice(1))[1],line:Math.floor(o[2]),column:Math.floor(o[3])-1};a=this.useSourceMaps?function(t,e){return Be({source:t.source,line:t.line,column:t.column},e)}(s,this.diagnostic):s,i={method:o[0]||"<unknown>",filename:a.source,lineno:a.line,colno:a.column,runtimePosition:s},o[4]&&(i.compiled_lineno=Math.floor(o[4])),o[5]&&(i.compiled_colno=Math.floor(o[5])),e(null,i)}function Xe(t,e){var r,n,o;r="/"===t[0]||"."===t[0],n=Boolean(Qe.get(t)),o=Boolean(Ze[t]),e(null,r&&!n&&!o)}function Ke(t,e){if(Je(t))return e(null,!0);Re.stat(t,function(t){e(null,!t)})}function Ye(t,e){var r=[];t.forEach(function(t){-1===r.indexOf(t.filename)&&r.push(t.filename)}),Se.filter(r,Xe,function(r,n){if(r)return e(r);var o;function i(t,e){o[t]=e,Qe.set(t,e)}function a(t,e){var r=Je(t);if(r)try{var n=r.split("\n");return i(t,n),e(null)}catch(t){return e(t)}!function(t,e){try{Re.readFile(t,function(t,r){var n;return t?e(t):(n=r.toString("utf8").split("\n"),e(null,n))})}catch(t){K.log(t)}}(t,function(r,n){return r?e(r):(i(t,n),e(null))})}function s(t,e){var r=o[t.filename]||Qe.get(t.filename);r&&function(t,e){t.code=e[t.lineno-1],t.context={pre:e.slice(Math.max(0,t.lineno-4),t.lineno-1),post:e.slice(t.lineno,t.lineno+3)}}(t,r),e(null)}o={},Se.filter(n,Ke,function(r,n){if(r)return e(r);Se.each(n,a,function(r){if(r)return e(r);Se.eachSeries(t,s,function(r){if(r)return e(r);e(null,t)})})})})}function tr(t,e,r,n){var i=function(t){var e,r;if(null==t)return null;if("object"!==We(t))return null;if(o.isArray(t))return t;for(r in e=[],t)Object.prototype.hasOwnProperty.call(t,r)&&e.push(t[r]);return e}(t.errors);return function(t,e,r,n){var o,i=t;for(;"object"===We(i);)i=i&&i.stack;o=(i||"").split("\n").slice(1),e.nodeSourceMaps&&(r.diagnostic.node_source_maps={},r.diagnostic.node_source_maps.source_mapping_urls={});Se.map(o,Ve.bind({useSourceMaps:e.nodeSourceMaps,diagnostic:r.diagnostic}),function(t,e){if(t)return n(t);e.reverse(),Se.filter(e,function(t,e){e(null,Boolean(t))},function(t,e){if(t)return n(t);Ye(e,n)})})}(t.stack,e,r,function(e,o){var a,s,u,l,c;return e?(K.error("could not parse exception, err: "+e),n(e)):(a=String(t.message||"<no message>"),s=String(t.name||"<unknown>"),u={class:s,message:a,frames:o},i&&i.length&&(l=i[0],u={class:s,message:String(l.message||"<no message>"),frames:o}),a.match($e)&&(c=function(t){var e,r,n,o,i,a,s,u,l,c,f;for(r=(e=t.split("\n"))[0].indexOf(":"),n=e[0].slice(0,r),o=parseInt(e[0].slice(r+1),10),a=e[(i=e.length)-1],e=e.slice(1,i-1),l=[],c=[],s=0;s<i-2;++s)(f=e[s].match($e))&&(">"===f[1]?u=f[2]:u?f[2]&&c.push(f[2]):f[2]&&l.push(f[2]));return{frame:{method:"<jade>",filename:n,lineno:o,code:u,context:{pre:l=l.slice(0,Math.min(l.length,3)),post:c=c.slice(0,Math.min(c.length,3))}},message:a}}(a),u.message=c.message,u.frames.push(c.frame)),r.localsMap?void r.notifier.locals.mergeLocals(r.localsMap,o,t.stack,function(t){return t&&(K.error("could not parse locals, err: "+t),r.diagnostic["error parsing locals"]=t),n(null,u)}):n(null,u))})}function er(t,e,r){var n,o=e.payload&&e.payload.environment||e.environment,i={timestamp:Math.round(t.timestamp/1e3),environment:t.environment||o,level:t.level||"error",language:"javascript",framework:t.framework||e.framework,uuid:t.uuid,notifier:JSON.parse(JSON.stringify(e.notifier)),custom:t.custom,attributes:null===(n=t.data)||void 0===n?void 0:n.attributes};e.codeVersion?i.code_version=e.codeVersion:e.code_version&&(i.code_version=e.code_version),Object.getOwnPropertyNames(t.custom||{}).forEach(function(e){h(i,e)||(i[e]=t.custom[e])}),i.server={host:e.host,argv:process.argv.concat(),pid:process.pid},e.branch&&(i.server.branch=e.branch),e.root&&(i.server.root=e.root),t.data=i,r(null,t)}function rr(t,e,r){t.stackInfo?function(t,e,r){t.stackInfo&&(t.data=t.data||{},t.data.body=t.data.body||{},t.data.body.trace_chain=t.stackInfo),r(null,t)}(t,0,r):function(t,e,r){t.data=t.data||{},t.data.body=t.data.body||{};var n=t.message||"Item sent with null or missing arguments.";t.data.body.message={body:n},r(null,t)}(t,0,r)}function nr(t,e,r){if(!t.err)return r(null,t);var n=t.err,o=[],i=[];do{o.push(n),n=n.nested||n.cause}while(n);t.stackInfo=i,e.addErrorContext&&function(t,e){var r=t.data.custom||{},n=!1;try{var o,i=a(e);try{for(i.s();!(o=i.n()).done;){var s=o.value;h(s,"rollbarContext")&&(r=T(r,g(s.rollbarContext)),n=!0)}}catch(t){i.e(t)}finally{i.f()}n&&(t.data.custom=r)}catch(e){t.diagnostic.error_context="Failed: "+e.message}}(t,o);Se.eachSeries(o,function(t,e,r){return function(n,o){tr(n,e,r,function(e,r){return e?o(e):(t.push({frames:r.frames,exception:{class:r.class,message:r.message}}),o(null))})}}(i,e,t),function(e){e&&(t.message=t.err.message||t.err.description||t.message||String(t.err),t.diagnostic.buildTraceData=e.message,delete t.stackInfo),r(null,t)})}function or(t,e,r){t.data=t.data||{};var o=t.request;if(o){var i=o.baseUrl||"";if(e.addRequestData&&f(e.addRequestData))return e.addRequestData(t.data,o),void r(null,t);var a,s=function(t){var e,r=t.headers||{},o=r.host||"<no host>",i=t.protocol||(t.socket&&t.socket.encrypted?"https":"http"),a=t.baseUrl||"";if(l(t.url,"string")){var s=a&&a.length?a+t.url:t.url;e=n.parse(s,!0)}else e=t.url||{};e.protocol=e.protocol||i,e.host=e.host||o;var u={url:n.format(e),user_ip:ur(t),headers:r,method:t.method};e.search&&e.search.length>0&&(u.GET=e.query);var f=t.body||t.payload;if(f){var p={};if("object"===(m=c(f))||"array"===m){for(var d in f)h(f,d)&&(p[d]=f[d]);u[t.method]=p}else u.body=f}var m;return u}(o);if(function(t,e){if(t&&t.user_ip&&!0!==e){var r=t.user_ip;if(e)try{var n;if(-1!==r.indexOf("."))(n=r.split(".")).pop(),n.push("0"),r=n.join(".");else if(-1!==r.indexOf(":")){if((n=r.split(":")).length>2){var o=n.slice(0,3),i=o[2].indexOf("/");-1!==i&&(o[2]=o[2].substring(0,i)),r=o.concat("0000:0000:0000:0000:0000").join(":")}}else r=null}catch(t){r=null}else r=null;t.user_ip=r}}(s,e.captureIp),t.data.request=s,o.route)a=o.route.path,t.data.context=i&&i.length?i+a:a;else try{a=o.app._router.matchRequest(o).path,t.data.context=i&&i.length?i+a:a}catch(t){}var u=e.captureEmail,p=e.captureUsername;if(o.rollbar_person){var d=o.rollbar_person;!u&&d.email&&(d.email=null),!p&&d.username&&(d.username=null),t.data.person=d}else if(o.user)t.data.person={id:o.user.id},o.user.username&&p&&(t.data.person.username=o.user.username),o.user.email&&u&&(t.data.person.email=o.user.email);else if(o.user_id||o.userId){var m=o.user_id||o.userId;f(m)&&(m=m()),t.data.person={id:m}}r(null,t)}else r(null,t)}function ir(t,e,r){var n=t.lambdaContext;if(n){var o={remainingTimeInMillis:n.getRemainingTimeInMillis(),callbackWaitsForEmptyEventLoop:n.callbackWaitsForEmptyEventLoop,functionName:n.functionName,functionVersion:n.functionVersion,arn:n.invokedFunctionArn,requestId:n.awsRequestId};t.data=t.data||{},t.data.custom=t.data.custom||{},t.data.custom.lambda=o,r(null,t)}else r(null,t)}function ar(t,e,r){var n=e.scrubHeaders||[],o=e.scrubFields||[],i=e.scrubPaths||[];o=n.concat(o),function(t,e){if(!t||!e.scrubRequestBody)return;try{("string"==typeof(r=t.body)||r instanceof String)&&sr(t)&&(t.body=JSON.parse(t.body))}catch(e){t.body=null,t.error="request.body parse failed: "+e.message}var r}(t.data.request,e),t.data=Pe(t.data,o,i),function(t,e){if(!t||!e.scrubRequestBody)return;try{p(t.body)&&sr(t)&&(t.body=JSON.stringify(t.body))}catch(e){t.body=null,t.error="request.body serialization failed: "+e.message}}(t.data.request,e),r(null,t)}function sr(t){return t.headers&&t.headers["content-type"]&&t.headers["content-type"].includes("json")}function ur(t){var e=t.ip;return e||(e=Ee.getClientIp(t)),e}function lr(){this.rateLimitExpires=0}function cr(t,e,r){var n=e&&e.headers||{};if(n["Content-Type"]="application/json",r)try{n["Content-Length"]=Buffer.byteLength(r,"utf8")}catch(t){K.error("Could not get the content length of the data")}return n["X-Rollbar-Access-Token"]=t,n}function fr(t){return{"http:":he,"https:":de}[t.protocol]}function pr(){return Math.floor(Date.now()/1e3)}lr.prototype.get=function(t,e,r,n,o){var i;if(n&&f(n)||(n=function(){}),function(t,e,r){(r=r||{}).access_token=t;var n,o=[];for(n in r)Object.prototype.hasOwnProperty.call(r,n)&&o.push([n,r[n]].join("="));var i="?"+o.sort().join("&");(e=e||{}).path=e.path||"";var a,s=e.path.indexOf("?"),u=e.path.indexOf("#");-1!==s&&(-1===u||u>s)?(a=e.path,e.path=a.substring(0,s)+i+"&"+a.substring(s+1)):-1!==u?(a=e.path,e.path=a.substring(0,u)+i+a.substring(u)):e.path=e.path+i}(t,e=e||{},r),e.headers=cr(t,e),!(i=o?o(e):fr(e)))return K.error("Unknown transport based on given protocol: "+e.protocol),n(new Error("Unknown transport"));var a=i.request(e,function(t){this.handleResponse(t,n)}.bind(this));a.on("error",function(t){n(t)}),a.end()},lr.prototype.post=function(t){var e,r=t.accessToken,n=t.options,o=t.payload,a=t.callback,s=t.transportFactory;if(a&&f(a)||(a=function(){}),pr()<this.rateLimitExpires)return a(new Error("Exceeded rate limit"));if(n=n||{},!o)return a(new Error("Cannot send empty request"));var u=ue.truncate(o,i);if(u.error)return K.error("Problem stringifying payload. Giving up"),a(u.error);var l=u.value;if(n.headers=cr(r,n,l),!(e=s?s(n):fr(n)))return K.error("Unknown transport based on given protocol: "+n.protocol),a(new Error("Unknown transport"));var c=e.request(n,function(t){this.handleResponse(t,function(t){return function(e,r){if(e)return t(e);r.result&&r.result.uuid?K.log(["Successful api response."," Link: https://rollbar.com/occurrence/uuid/?uuid="+r.result.uuid].join("")):K.log("Successful api response"),t(null,r.result)}}(a))}.bind(this));c.on("error",function(t){a(t)}),l&&c.write(l),c.end()},lr.prototype.updateRateLimit=function(t){var e=parseInt(t.headers["x-rate-limit-remaining"]||0),r=Math.min(60,t.headers["x-rate-limit-remaining-seconds"]||0),n=pr();429===t.statusCode&&0===e?this.rateLimitExpires=n+r:this.rateLimitExpires=n},lr.prototype.handleResponse=function(t,e){this.updateRateLimit(t);var r=[];t.setEncoding("utf8"),t.on("data",function(t){r.push(t)}),t.on("end",function(){!function(t,e){var r=function(t){var e,r;try{e=JSON.parse(t)}catch(t){r=t}return{error:r,value:e}}(t);if(r.error)return K.error("Could not parse api response, err: "+r.error),e(r.error);if((t=r.value).err)return K.error("Received error: "+t.message),e(new Error("Api error: "+(t.message||"Unknown error")));e(null,t)}(r=r.join(""),e)})};const hr=lr;function dr(t,e){if(l(t,"string")){var r=t;(t={}).accessToken=r}void 0!==t.minimumLevel&&(t.reportLevel=t.minimumLevel,delete t.minimumLevel),K.init({logLevel:t.logLevel||"error"}),this.options=I(dr.defaultOptions,t,null,K),this.options._configuredOptions=t,delete this.options.maxItems,this.options.environment=this.options.environment||"unspecified",this.lambdaContext=null,this.lambdaTimeoutHandle=null;var o=new hr,a=new z(this.options,o,n,ue,i),s=new Nt(this.options);this.client=e||new It(this.options,a,K,s,null,null,"server"),this.instrumenter=new _e(this.options,this.client.telemeter,this),this.instrumenter.instrument(),this.options.locals&&(this.locals=mr(this.options.locals,K)),this.client.notifier.addTransform(er).addTransform(nr).addTransform(rr).addTransform(Jt).addTransform(Bt).addTransform(or).addTransform(ir).addTransform(Gt).addTransform(ar).addTransform(Ht).addTransform(Wt(K)).addTransform($t).addTransform(Qt).addTransform(Ft),function(t){t.addPredicate(et).addPredicate(function(t){return function(e,r){var n=Boolean(e._isUncaught);delete e._isUncaught;var o=e._originalArgs;delete e._originalArgs;try{f(r.onSendCallback)&&r.onSendCallback(n,o,e)}catch(e){r.onSendCallback=null,t.error("Error while calling onSendCallback, removing",e)}try{if(f(r.checkIgnore)&&r.checkIgnore(n,o,e))return!1}catch(e){r.checkIgnore=null,t.error("Error while calling custom checkIgnore(), removing",e)}return!0}}(K)).addPredicate(function(t){return function(e,r){return!nt(e,r,"blocklist",t)}}(K)).addPredicate(function(t){return function(e,r){return nt(e,r,"safelist",t)}}(K)).addPredicate(ot(K))}(this.client.queue),this.setupUnhandledCapture()}function mr(t,e){var r;if(process.versions.node.split(".")[0]<10)return null;if("function"==typeof t)r=t,t=null;else{if(!l(t,"object"))return e.error("options.locals or options.locals.module must be a Locals module"),null;r=t.module,delete t.module}return new r(t,e)}var yr=null;function vr(t){var e="Rollbar is not initialized";K.error(e),t&&t(new Error(e))}function gr(t){for(var e=0,r=t.length;e<r;++e)if(f(t[e]))return t[e]}function br(t,e){var r=function(t,r){e(t,r)};r._rollbarHandler=!0;for(var n=process.listeners(t),o=n.length,i=0;i<o;++i)n[i]._rollbarHandler&&process.removeListener(t,n[i]);process.on(t,r)}function wr(t,e){Error.call(this),Error.captureStackTrace(this,this.constructor),this.message=t,this.nested=e,this.name=this.constructor.name}dr.init=function(t,e){return yr?yr.global(t).configure(t):yr=new dr(t,e)},dr.prototype.global=function(t){return delete(t=I(t)).maxItems,this.client.global(t),this},dr.global=function(t){if(yr)return yr.global(t);vr()},dr.prototype.configure=function(t,e){t.logLevel&&K.init({logLevel:t.logLevel});var r=this.options,n={};return e&&(n={payload:e}),this.options=I(r,t,n,K),this.options._configuredOptions=I(r._configuredOptions,t,n),delete this.options.maxItems,this.client.configure(t,e),this.setupUnhandledCapture(),this.options.locals&&(this.locals?this.locals.updateOptions(this.options.locals):this.locals=mr(this.options.locals,K)),this},dr.configure=function(t,e){if(yr)return yr.configure(t,e);vr()},dr.prototype.lastError=function(){return this.client.lastError},dr.lastError=function(){if(yr)return yr.lastError();vr()},dr.prototype.log=function(){var t=this._createItem(arguments),e=t.uuid;return this.client.log(t),{uuid:e}},dr.log=function(){if(yr)return yr.log.apply(yr,arguments);vr(gr(arguments))},dr.prototype.debug=function(){var t=this._createItem(arguments),e=t.uuid;return this.client.debug(t),{uuid:e}},dr.debug=function(){if(yr)return yr.debug.apply(yr,arguments);vr(gr(arguments))},dr.prototype.info=function(){var t=this._createItem(arguments),e=t.uuid;return this.client.info(t),{uuid:e}},dr.info=function(){if(yr)return yr.info.apply(yr,arguments);vr(gr(arguments))},dr.prototype.warn=function(){var t=this._createItem(arguments),e=t.uuid;return this.client.warn(t),{uuid:e}},dr.warn=function(){if(yr)return yr.warn.apply(yr,arguments);vr(gr(arguments))},dr.prototype.warning=function(){var t=this._createItem(arguments),e=t.uuid;return this.client.warning(t),{uuid:e}},dr.warning=function(){if(yr)return yr.warning.apply(yr,arguments);vr(gr(arguments))},dr.prototype.error=function(){var t=this._createItem(arguments),e=t.uuid;return this.client.error(t),{uuid:e}},dr.error=function(){if(yr)return yr.error.apply(yr,arguments);vr(gr(arguments))},dr.prototype._uncaughtError=function(){var t=this._createItem(arguments);t._isUncaught=!0,t.level=this.options.uncaughtErrorLevel;var e=t.uuid;return this.client.log(t),{uuid:e}},dr.prototype.critical=function(){var t=this._createItem(arguments),e=t.uuid;return this.client.critical(t),{uuid:e}},dr.critical=function(){if(yr)return yr.critical.apply(yr,arguments);vr(gr(arguments))},dr.prototype.buildJsonPayload=function(t){return this.client.buildJsonPayload(t)},dr.buildJsonPayload=function(){if(yr)return yr.buildJsonPayload.apply(yr,arguments);vr()},dr.prototype.sendJsonPayload=function(t){return this.client.sendJsonPayload(t)},dr.sendJsonPayload=function(){if(yr)return yr.sendJsonPayload.apply(yr,arguments);vr()},dr.prototype.wait=function(t){this.client.wait(t)},dr.wait=function(t){if(yr)return yr.wait(t);vr(gr(arguments))},dr.prototype.errorHandler=function(){return function(t,e,r,n){var o=function(o){return o&&K.error("Error reporting to rollbar, ignoring: "+o),n(t,e,r)};return t?t instanceof Error?this.error(t,e,o):this.error("Error: "+t,e,o):n(t,e,r)}.bind(this)},dr.errorHandler=function(){if(yr)return yr.errorHandler();vr()},dr.prototype.lambdaHandler=function(t,e){return t.length<=2?this.asyncLambdaHandler(t,e):this.syncLambdaHandler(t,e)},dr.prototype.asyncLambdaHandler=function(t,e){var r=this,n=function(t,e){var n={originalEvent:t,originalRequestId:e.awsRequestId};r.error("Function timed out",n)},o=this.options.captureLambdaTimeouts;return function(i,a){return new Promise(function(s,u){if(r.lambdaContext=a,o){var l=(e||n).bind(null,i,a);r.lambdaTimeoutHandle=setTimeout(l,a.getRemainingTimeInMillis()-1e3)}t(i,a).then(function(t){r.wait(function(){clearTimeout(r.lambdaTimeoutHandle),s(t)})}).catch(function(t){r.error(t),r.wait(function(){clearTimeout(r.lambdaTimeoutHandle),u(t)})})})}},dr.prototype.syncLambdaHandler=function(t,e){var r=this,n=function(t,e,n){var o={originalEvent:t,originalRequestId:e.awsRequestId};r.error("Function timed out",o)},o=this.options.captureLambdaTimeouts;return function(i,a,s){if(r.lambdaContext=a,o){var u=(e||n).bind(null,i,a,s);r.lambdaTimeoutHandle=setTimeout(u,a.getRemainingTimeInMillis()-1e3)}try{t(i,a,function(t,e){t&&r.error(t),r.wait(function(){clearTimeout(r.lambdaTimeoutHandle),s(t,e)})})}catch(t){r.error(t),r.wait(function(){throw clearTimeout(r.lambdaTimeoutHandle),t})}}},dr.lambdaHandler=function(t){if(yr)return yr.lambdaHandler(t);vr()},dr.prototype.wrapCallback=function(t){return function(t,e){return function(){var r=arguments[0];return r&&t.error(r),e.apply(this,arguments)}}(this,t)},dr.wrapCallback=function(t){if(yr)return yr.wrapCallback(t);vr()},dr.prototype.captureEvent=function(){var t=function(t){for(var e,r,n,o,i=0,a=t.length;i<a;++i)switch(c(o=t[i])){case"string":!e&&_(w,o)?e=o:!n&&_(k,o)&&(n=o);break;case"object":r=o}return{type:e||"manual",metadata:r||{},level:n}}(arguments);return this.client.captureEvent(t.type,t.metadata,t.level)},dr.captureEvent=function(){if(yr)return yr.captureEvent.apply(yr,arguments);vr()},dr.prototype.reportMessage=function(t,e,r,n){return K.log("reportMessage is deprecated"),f(this[e])?this[e](t,r,n):this.error(t,r,n)},dr.reportMessage=function(t,e,r,n){if(yr)return yr.reportMessage(t,e,r,n);vr(n)},dr.prototype.reportMessageWithPayloadData=function(t,e,r,n){return K.log("reportMessageWithPayloadData is deprecated"),this.error(t,r,e,n)},dr.reportMessageWithPayloadData=function(t,e,r,n){if(yr)return yr.reportMessageWithPayloadData(t,e,r,n);vr(n)},dr.prototype.handleError=function(t,e,r){return K.log("handleError is deprecated"),this.error(t,e,r)},dr.handleError=function(t,e,r){if(yr)return yr.handleError(t,e,r);vr(r)},dr.prototype.handleErrorWithPayloadData=function(t,e,r,n){return K.log("handleErrorWithPayloadData is deprecated"),this.error(t,r,e,n)},dr.handleErrorWithPayloadData=function(t,e,r,n){if(yr)return yr.handleErrorWithPayloadData(t,e,r,n);vr(n)},dr.handleUncaughtExceptions=function(t,e){if(yr)return(e=e||{}).accessToken=t,yr.configure(e);vr()},dr.handleUnhandledRejections=function(t,e){if(yr)return(e=e||{}).accessToken=t,yr.configure(e);vr()},dr.handleUncaughtExceptionsAndRejections=function(t,e){if(yr)return(e=e||{}).accessToken=t,yr.configure(e);vr()},dr.prototype._createItem=function(t){var e=b(t,K,this,["headers","protocol","url","method","body","route"],this.lambdaContext);return e.err&&e.notifier.locals&&(e.localsMap=e.notifier.locals.currentLocalsMap()),e},dr.prototype.setupUnhandledCapture=function(){(this.options.captureUncaught||this.options.handleUncaughtExceptions)&&this.handleUncaughtExceptions(),(this.options.captureUnhandledRejections||this.options.handleUnhandledRejections)&&this.handleUnhandledRejections()},dr.prototype.handleUncaughtExceptions=function(){var t=Boolean(this.options.exitOnUncaughtException);delete this.options.exitOnUncaughtException,br("uncaughtException",function(e){(this.options.captureUncaught||this.options.handleUncaughtExceptions)&&(this._uncaughtError(e,function(t){t&&(K.error("Encountered error while handling an uncaught exception."),K.error(t))}),t&&setImmediate(function(){this.wait(function(){process.exit(1)})}.bind(this)))}.bind(this))},dr.prototype.handleUnhandledRejections=function(){br("unhandledRejection",function(t){(this.options.captureUnhandledRejections||this.options.handleUnhandledRejections)&&this._uncaughtError(t,function(t){t&&(K.error("Encountered error while handling an uncaught exception."),K.error(t))})}.bind(this))},o.inherits(wr,Error),dr.Error=wr,dr.defaultOptions={host:r.hostname(),environment:"production",framework:"node-js",showReportedMessageTraces:!1,notifier:{name:"node_rollbar",version:$},scrubHeaders:fe,scrubFields:pe,addRequestData:null,reportLevel:Q,verbose:!1,enabled:!0,transmit:!0,sendConfig:!1,includeItemsInTelemetry:!1,captureEmail:!1,captureUsername:!1,captureIp:!0,captureLambdaTimeouts:!0,ignoreDuplicateErrors:!0,scrubRequestBody:!0,autoInstrument:!1};const kr=dr;module.exports=e.default})();
|
|
2
|
+
(()=>{"use strict";var t={d:(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:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)},e={};t.d(e,{default:()=>jr});const r=require("os"),n=require("url"),o=require("util"),i=require("json-stringify-safe");function a(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 s(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)?s(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,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}function s(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){return u="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},u(t)}function l(t,e){return e===c(t)}function c(t){var e=u(t);return"object"!==e?e:t?t instanceof Error?"error":{}.toString.call(t).match(/\s([a-zA-Z]+)/)[1].toLowerCase():"null"}function f(t){return l(t,"function")}function p(t){return null!=t&&("object"==u(t)||"function"==typeof t)}function d(t,e){return null!=t&&(Object.hasOwn?Object.hasOwn(t,e):Object.prototype.hasOwnProperty.call(t,e))}function h(){return"********"}var m={debug:0,info:1,warning:2,error:3,critical:4};function y(t,e){var r,n;try{r=JSON.stringify(t)}catch(o){if(e&&f(e))try{r=e(t)}catch(t){n=t}else n=o}return{error:n,value:r}}function v(t,e){return function(r,n){try{e(r,n)}catch(e){t.error(e)}}}function g(t){return function t(e,r){var n,o,i,a={};try{for(o in e)(n=e[o])&&(l(n,"object")||l(n,"array"))?r.includes(n)?a[o]="Removed circular reference: "+c(n):((i=r.slice()).push(n),a[o]=t(n,i)):a[o]=n}catch(t){a="Failed cloning custom data: "+t.message}return a}(t,[t])}function b(t,e,r,n,o){for(var i,a,s,u,l,f,p=[],d=[],h=0,m=t.length;h<m;++h){var y=c(f=t[h]);switch(d.push(y),y){case"undefined":break;case"string":i?p.push(f):i=f;break;case"function":u=v(e,f);break;case"date":p.push(f);break;case"error":case"domexception":case"exception":a?p.push(f):a=f;break;case"object":case"array":if(f instanceof Error||"undefined"!=typeof DOMException&&f instanceof DOMException){a?p.push(f):a=f;break}if(n&&"object"===y&&!l){for(var b=0,w=n.length;b<w;++b)if(void 0!==f[n[b]]){l=f;break}if(l)break}s?p.push(f):s=f;break;default:if(f instanceof Error||"undefined"!=typeof DOMException&&f instanceof DOMException){a?p.push(f):a=f;break}p.push(f)}}s&&(s=g(s)),p.length>0&&(s||(s=g({})),s.extraArgs=g(p));var k,_={message:i,err:a,custom:s,timestamp:O(),callback:u,notifier:r,diagnostic:{},uuid:(k=O(),"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var e=(k+16*Math.random())%16|0;return k=Math.floor(k/16),("x"===t?e:7&e|8).toString(16)}))};return _.data=_.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),n&&l&&(_.request=l),o&&(_.lambdaContext=o),_._originalArgs=t,_.diagnostic.original_arg_types=d,_}var w=["log","network","dom","navigation","error","manual"],k=["critical","error","warning","info","debug"];function _(t,e){var r,n=a(t);try{for(n.s();!(r=n.n()).done;){if(r.value===e)return!0}}catch(t){n.e(t)}finally{n.f()}return!1}function S(t,e){t.attributes=t.attributes||[];var r,n=a(e);try{for(n.s();!(r=n.n()).done;){var o=r.value;void 0!==o.value&&t.attributes.push(o)}}catch(t){n.e(t)}finally{n.f()}}function E(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 x(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 O(){return Date.now?Date.now():Number(new Date)}function I(t,e,r,n){var o=T(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 T(){function t(t){if(!t||"[object Object]"!==Object.prototype.toString.call(t))return!1;var e,r=d(t,"constructor"),n=t.constructor&&t.constructor.prototype&&d(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!r&&!n)return!1;for(e in t);return void 0===e||d(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]=T(o,n)):void 0!==n&&(a[i]=n));return a}function j(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,i=null==o?void 0:o.enabledHeaders;if(!Array.isArray(i)||!i.includes("baggage"))return!1;var a=null==o?void 0:o.enabledCorsUrls;return!(!Array.isArray(a)||0===a.length)&&a.some(function(t){return l(t,"string")?r===t:!!l(t,"regexp")&&t.test(r)})}function P(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 u=0,l=Object.keys(e);u<l.length;u++){var c=l[u];s.append(c,e[c])}else if(p(s))for(var f=0,d=Object.keys(e);f<d.length;f++){var h=d[f];s[h]=e[h]}}function R(t){var e=t.asyncLocalStorage;if(!e||"function"!=typeof e.getStore)return null;var r=e.getStore();return(null==r?void 0:r.sessionId)||null}function A(t){if(!l(t.context,"string")){var e=y(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 L(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(t.endpoint){var f=r.parse(t.endpoint);n=f.hostname,o=f.protocol,i=f.port,a=f.pathname,s=f.search}return{timeout:u,hostname:n,protocol:o,port:i,path:a,search:s,proxy:c,transport:l}}function q(t,e){var r=t.protocol||"https:",n=t.port||("http:"===r?80:"https:"===r?443:void 0),o=t.hostname,i=t.path,a=t.timeout,s=t.transport;return t.search&&(i+=t.search),t.proxy&&(i=r+"//"+o+i,o=t.proxy.host||t.proxy.hostname,n=t.proxy.port,r=t.proxy.protocol||r),{timeout:a,protocol:r,hostname:o,path:i,port:n,method:e,transport:s}}function C(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 M(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?C(Object(r),!0).forEach(function(e){U(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):C(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function U(t,e,r){return(e=J(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function D(t){return D="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},D(t)}function N(){var t,e,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function i(r,n,o,i){var u=n&&n.prototype instanceof s?n:s,l=Object.create(u.prototype);return H(l,"_invoke",function(r,n,o){var i,s,u,l=0,c=o||[],f=!1,p={p:0,n:0,v:t,a:d,f:d.bind(t,4),d:function(e,r){return i=e,s=0,u=t,p.n=r,a}};function d(r,n){for(s=r,u=n,e=0;!f&&l&&!o&&e<c.length;e++){var o,i=c[e],d=p.p,h=i[2];r>3?(o=h===n)&&(u=i[(s=i[4])?5:(s=3,3)],i[4]=i[5]=t):i[0]<=d&&((o=r<2&&d<i[1])?(s=0,p.v=n,p.n=i[1]):d<h&&(o=r<3||i[0]>n||n>h)&&(i[4]=r,i[5]=n,p.n=h,s=0))}if(o||r>1)return a;throw f=!0,n}return function(o,c,h){if(l>1)throw TypeError("Generator is already running");for(f&&1===c&&d(c,h),s=c,u=h;(e=s<2?t:u)||!f;){i||(s?s<3?(s>1&&(p.n=-1),d(s,u)):p.n=u:p.v=u);try{if(l=2,i){if(s||(o="next"),e=i[o]){if(!(e=e.call(i,u)))throw TypeError("iterator result is not an object");if(!e.done)return e;u=e.value,s<2&&(s=0)}else 1===s&&(e=i.return)&&e.call(i),s<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),s=1);i=t}else if((e=(f=p.n<0)?u:r.call(n,p))!==a)break}catch(e){i=t,s=1,u=e}finally{l=1}}return{value:e,done:f}}}(r,o,i),!0),l}var a={};function s(){}function u(){}function l(){}e=Object.getPrototypeOf;var c=[][n]?e(e([][n]())):(H(e={},n,function(){return this}),e),f=l.prototype=s.prototype=Object.create(c);function p(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,l):(t.__proto__=l,H(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return u.prototype=l,H(f,"constructor",l),H(l,"constructor",u),u.displayName="GeneratorFunction",H(l,o,"GeneratorFunction"),H(f),H(f,o,"Generator"),H(f,n,function(){return this}),H(f,"toString",function(){return"[object Generator]"}),(N=function(){return{w:i,m:p}})()}function H(t,e,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}H=function(t,e,r,n){function i(e,r){H(t,e,function(t){return this._invoke(e,r,t)})}e?o?o(t,e,{value:r,enumerable:!n,configurable:!n,writable:!n}):t[e]=r:(i("next",0),i("throw",1),i("return",2))},H(t,e,r,n)}function F(t,e,r,n,o,i,a){try{var s=t[i](a),u=s.value}catch(t){return void r(t)}s.done?e(u):Promise.resolve(u).then(n,o)}function B(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,J(n.key),n)}}function J(t){var e=function(t,e){if("object"!=D(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!=D(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==D(e)?e:e+""}var W={hostname:"api.rollbar.com",path:"/api/1/item/",search:null,version:"1",protocol:"https:",port:443},G={hostname:"api.rollbar.com",path:"/api/1/session/",search:null,version:"1",protocol:"https:",port:443},z=function(){return t=function t(e,r,n,o){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.options=e,this.transport=r,this.url=n,this.truncation=o,this.accessToken=e.accessToken,this.transportOptions=$(e,n),this.OTLPTransportOptions=Q(e,n)},e=[{key:"_postPromise",value:function(t){var e=this,r=t.accessToken,n=t.options,o=t.payload,i=t.headers;return new Promise(function(t,a){e.transport.post({accessToken:r,options:n,payload:o,headers:i,callback:function(e,r){return e?a(e):t(r)}})})}},{key:"postItem",value:function(t,e){var r=this,n=q(this.transportOptions,"POST"),o=A(t);setTimeout(function(){r.transport.post({accessToken:r.accessToken,options:n,payload:o,callback:e})},0)}},{key:"postSpans",value:(n=N().m(function t(e){var r,n,o=arguments;return N().w(function(t){for(;;)if(0===t.n)return r=o.length>1&&void 0!==o[1]?o[1]:{},n=q(this.OTLPTransportOptions,"POST"),t.a(2,this._postPromise({accessToken:this.accessToken,options:n,payload:e,headers:r}))},t,this)}),o=function(){var t=this,e=arguments;return new Promise(function(r,o){var i=n.apply(t,e);function a(t){F(i,r,o,a,s,"next",t)}function s(t){F(i,r,o,a,s,"throw",t)}a(void 0)})},function(t){return o.apply(this,arguments)})},{key:"buildJsonPayload",value:function(t,e){var r,n=A(t);return(r=this.truncation?this.truncation.truncate(n):y(n)).error?(e&&e(r.error),null):r.value}},{key:"postJsonPayload",value:function(t,e){var r=q(this.transportOptions,"POST");this.transport.postJsonPayload(this.accessToken,r,t,e)}},{key:"configure",value:function(t){var e=this.options;return this.options=T(e,t),this.transportOptions=$(this.options,this.url),this.OTLPTransportOptions=Q(this.options,this.url),void 0!==this.options.accessToken&&(this.accessToken=this.options.accessToken),this}}],e&&B(t.prototype,e),r&&B(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,r,n,o}();function $(t,e){return L(t,W,e)}function Q(t,e){var r;return L(t=M(M({},t),{},{endpoint:null===(r=t.tracing)||void 0===r?void 0:r.endpoint}),G,e)}const Z=z;var V="3.1.0",X="debug";var K=function(){},Y={debug:0,info:1,warn:2,error:3,disable:4},tt={error:function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return K("error",e)},warn:function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return K("warn",e)},info:function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return K("info",e)},debug:function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return K("debug",e)},log:function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return K("info",e)},init:function(t){var e=t.logLevel;K=function(t,r){Y[t]<Y[e]||(r.unshift("Rollbar:"),console[t].apply(console,r))}}};const et=tt;function rt(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 nt(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)?nt(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 nt(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 ot(t,e){var r=t.level,n=m[r]||0,o=e.reportLevel;return!(n<(m[o]||0))}function it(t,e,r){if(!t)return!r;var n,o,i=t.frames;if(!i||0===i.length)return!r;for(var a=e.length,s=i.length,u=0;u<s;u++){if(!l(n=i[u].filename,"string"))return!r;for(var c=0;c<a;c++)if(o=e[c],new RegExp(o).test(n))return!0}return!1}function at(t,e,r,n){var o,i,a=!1;"blocklist"===r&&(a=!0);try{if(o=a?e.hostBlockList:e.hostSafeList,i=E(t,"body.trace_chain")||[E(t,"body.trace")],!o||0===o.length)return!a;if(0===i.length||!i[0])return!a;for(var s=i.length,u=0;u<s;u++)if(it(i[u],o,a))return!0}catch(t){a?e.hostBlockList=null:e.hostSafeList=null;var l=a?"hostBlockList":"hostSafeList";return n.error("Error while reading your configuration's "+l+" option. Removing custom "+l+".",t),!a}return!1}function st(t){return function(e,r){var n,o,i,a,s,u;try{if(!(i=r.ignoredMessages)||0===i.length)return!0;if(u=function(t){var e=t.body,r=[];if(e.trace_chain){var n,o=rt(e.trace_chain);try{for(o.s();!(n=o.n()).done;){var i=n.value;r.push(E(i,"exception.message"))}}catch(t){o.e(t)}finally{o.f()}}e.trace&&r.push(E(e,"trace.exception.message"));e.message&&r.push(E(e,"message.body"));return r}(e),0===u.length)return!0;for(a=i.length,n=0;n<a;n++)for(s=new RegExp(i[n],"gi"),o=0;o<u.length;o++)if(s.test(u[o]))return!1}catch(e){r.ignoredMessages=null,t.error("Error while reading your configuration's ignoredMessages option. Removing custom ignoredMessages.")}return!0}}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 lt(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,ct(n.key),n)}}function ct(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 ft=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.queue=e,this.options=r,this.transforms=[],this.diagnostic={}},(e=[{key:"configure",value:function(t){var e;null===(e=this.queue)||void 0===e||e.configure(t);var r=this.options;return this.options=T(r,t),this}},{key:"addTransform",value:function(t){return f(t)&&this.transforms.push(t),this}},{key:"log",value:function(t,e){var r=this;if(e=f(e)?e:function(){},!this.options.enabled)return e(new Error("Rollbar is not enabled"),null);this.queue.addPendingItem(t);var n=t.err;this._applyTransforms(t,function(o,i){if(o)return r.queue.removePendingItem(t),e(o,null);r.queue.addItem(i,e,n,t)})}},{key:"_applyTransforms",value:function(t,e){var r=-1,n=this.transforms.length,o=this.transforms,i=this.options,a=function(t,s){t?e(t,null):++r!==n?o[r](s,i,a):e(null,s)};a(null,t)}}])&<(t.prototype,e),r&<(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,r}();function pt(t){return pt="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},pt(t)}function dt(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,ht(n.key),n)}}function ht(t){var e=function(t,e){if("object"!=pt(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!=pt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==pt(e)?e:e+""}var mt,yt,vt,gt=function(){function t(e,r,n,o,i){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.rateLimiter=e,this.api=r,this.logger=n,this.options=o,this.replay=i,this.predicates=[],this.pendingItems=[],this.pendingRequests=[],this.retryQueue=[],this.retryHandle=null,this.waitCallback=null,this.waitIntervalID=null}return e=t,(r=[{key:"configure",value:function(t){var e;null===(e=this.api)||void 0===e||e.configure(t);var r=this.options;return this.options=T(r,t),this}},{key:"addPredicate",value:function(t){return f(t)&&this.predicates.push(t),this}},{key:"addPendingItem",value:function(t){this.pendingItems.push(t)}},{key:"removePendingItem",value:function(t){var e=this.pendingItems.indexOf(t);-1!==e&&this.pendingItems.splice(e,1)}},{key:"addItem",value:function(t,e,r,n){var o=this;e&&f(e)||(e=function(){});var i=t.data,a=this._applyPredicates(i);if(a.stop)return this.removePendingItem(n),void e(a.err);if(this._maybeLog(i,r),this.removePendingItem(n),this.options.transmit){this.replay&&i.body&&(t.replayId=this.replay.capture(null,i.uuid,{type:"occurrence",level:t.level}),t.replayId&&S(t.data,[{key:"replay_id",value:t.replayId}])),this.pendingRequests.push(i);try{this._makeApiRequest(i,function(r,n,a){o._dequeuePendingRequest(i),t.replayId&&o.replay.sendOrDiscardReplay(t.replayId,r,n,a),e(r,n)})}catch(r){var s;this._dequeuePendingRequest(i),t.replayId&&(null===(s=this.replay)||void 0===s||s.discard(t.replayId)),e(r)}}else e(new Error("Transmit disabled"))}},{key:"wait",value:function(t){var e=this;f(t)&&(this.waitCallback=t,this._maybeCallWait()||(this.waitIntervalID&&(this.waitIntervalID=clearInterval(this.waitIntervalID)),this.waitIntervalID=setInterval(function(){e._maybeCallWait()},500)))}},{key:"_applyPredicates",value:function(t){for(var e=null,r=0,n=this.predicates.length;r<n;r++)if(!(e=this.predicates[r](t,this.options))||void 0!==e.err)return{stop:!0,err:e.err};return{stop:!1,err:null}}},{key:"_makeApiRequest",value:function(t,e){var r=this,n=this.rateLimiter.shouldSend(t);n.shouldSend?this.api.postItem(t,function(n,o,i){n?r._maybeRetry(n,t,e):e(n,o,i)}):n.error?e(n.error):this.api.postItem(n.payload,e)}},{key:"_maybeRetry",value:function(e,r,n){var o,i=!1;if(this.options.retryInterval){for(var a=0,s=t.RETRIABLE_ERRORS.length;a<s;a++)if(e.code===t.RETRIABLE_ERRORS[a]){i=!0;break}i&&(o=this.options.maxRetries,Number.isFinite(o))&&(r.retries=r.retries?r.retries+1:1,r.retries>this.options.maxRetries&&(i=!1))}i?this._retryApiRequest(r,n):n(e)}},{key:"_retryApiRequest",value:function(t,e){var r=this;this.retryQueue.push({item:t,callback:e}),this.retryHandle||(this.retryHandle=setInterval(function(){for(;r.retryQueue.length;){var t=r.retryQueue.shift();r._makeApiRequest(t.item,t.callback)}},this.options.retryInterval))}},{key:"_dequeuePendingRequest",value:function(t){var e=this.pendingRequests.indexOf(t);-1!==e&&(this.pendingRequests.splice(e,1),this._maybeCallWait())}},{key:"_maybeLog",value:function(t,e){if(this.logger&&this.options.verbose){var r=e||E(t,"body.trace.exception.message")||E(t,"body.trace_chain.0.exception.message");if(r)return void this.logger.error(r);(r=E(t,"body.message.body"))&&this.logger.log(r)}}},{key:"_maybeCallWait",value:function(){return!(!f(this.waitCallback)||0!==this.pendingItems.length||0!==this.pendingRequests.length||(this.waitIntervalID&&(this.waitIntervalID=clearInterval(this.waitIntervalID)),this.waitCallback(),0))}}])&&dt(e.prototype,r),n&&dt(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,r,n}();mt=gt,vt=["ECONNRESET","ENOTFOUND","ESOCKETTIMEDOUT","ETIMEDOUT","ECONNREFUSED","EHOSTUNREACH","EPIPE","EAI_AGAIN"],(yt=ht(yt="RETRIABLE_ERRORS"))in mt?Object.defineProperty(mt,yt,{value:vt,enumerable:!0,configurable:!0,writable:!0}):mt[yt]=vt;const bt=gt;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 kt(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,_t(n.key),n)}}function _t(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 St=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.startTime=Date.now(),this.counter=0,this.perMinCounter=0,this.platform=null,this.platformOptions={},this.configureGlobal(e)}return function(t,e,r){return e&&kt(t.prototype,e),r&&kt(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}(t,[{key:"configureGlobal",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=e.startTime,n=e.maxItems,o=e.itemsPerMinute;void 0!==r&&(t.globalSettings.startTime=r),void 0!==n&&(t.globalSettings.maxItems=n),void 0!==o&&(t.globalSettings.itemsPerMinute=o)}},{key:"shouldSend",value:function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Date.now(),n=r-this.startTime;(n<0||n>=6e4)&&(this.startTime=r,this.perMinCounter=0);var o=t.globalSettings.maxItems,i=t.globalSettings.itemsPerMinute;if(Et(e,o,this.counter))return xt(this.platform,this.platformOptions,"".concat(o," max items reached"),!1);if(Et(e,i,this.perMinCounter))return xt(this.platform,this.platformOptions,"".concat(i," items per minute reached"),!1);this.counter+=1,this.perMinCounter+=1;var a=!Et(e,o,this.counter),s=a,u=a&&!Et(e,i,this.perMinCounter);return xt(this.platform,this.platformOptions,null,u,o,i,s)}},{key:"setPlatformOptions",value:function(t,e){this.platform=t,this.platformOptions=e}}])}();function Et(t,e,r){return!t.ignoreRateLimit&&e>=1&&r>e}function xt(t,e,r,n,o,i,a){var s=null,u=r?new Error(r):null;return u||n||(s=function(t,e,r,n,o){var i=e.environment||e.payload&&e.payload.environment,a=o?"item per minute limit reached, ignoring errors until timeout":"maxItems has been hit, ignoring errors until reset.",s={body:{message:{body:a,extra:{maxItems:r,itemsPerMinute:n}}},language:"javascript",environment:i,notifier:{version:e.notifier&&e.notifier.version||e.version}};"browser"===t?(s.platform="browser",s.framework="browser-js",s.notifier.name="rollbar-browser-js"):"server"===t?(s.framework=e.framework||"node-js",s.notifier.name=e.notifier.name):"react-native"===t&&(s.framework=e.framework||"react-native",s.notifier.name=e.notifier.name);return s}(t,e,o,i,a)),{error:u,shouldSend:n,payload:s}}!function(t,e,r){(e=_t(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r}(St,"globalSettings",{startTime:Date.now(),maxItems:void 0,itemsPerMinute:void 0});const Ot=St;function It(t,e,r,n,o,i,a){this.options=T(t),this.logger=r,It.rateLimiter.configureGlobal(this.options),It.rateLimiter.setPlatformOptions(a,this.options),this.api=e,this.queue=new bt(It.rateLimiter,e,r,this.options,i),this.tracing=o;var s=this.options.tracer||null;jt(s)?(this.tracer=s,this.options.tracer="opentracing-tracer-enabled",this.options._configuredOptions.tracer="opentracing-tracer-enabled"):this.tracer=null,this.notifier=new ft(this.queue,this.options),this.telemeter=n,Tt(t),this.lastError=null,this.lastErrorHash="none"}function Tt(t){t.stackTraceLimit&&(Error.stackTraceLimit=t.stackTraceLimit)}function jt(t){if(!t)return!1;if(!t.scope||"function"!=typeof t.scope)return!1;var e=t.scope();return!(!e||!e.active||"function"!=typeof e.active)}It.rateLimiter=new Ot({maxItems:0,itemsPerMinute:60}),It.prototype.global=function(t){return It.rateLimiter.configureGlobal(t),this},It.prototype.configure=function(t,e){var r=this.options,n={};e&&(n={payload:e}),this.options=T(r,t,n);var o=this.options.tracer||null;return jt(o)?(this.tracer=o,this.options.tracer="opentracing-tracer-enabled",this.options._configuredOptions.tracer="opentracing-tracer-enabled"):this.tracer=null,this.notifier&&this.notifier.configure(this.options),this.telemeter&&this.telemeter.configure(this.options),Tt(t),this.global(this.options),jt(t.tracer)&&(this.tracer=t.tracer),this},It.prototype.log=function(t){var e=this._defaultLogLevel();return this._log(e,t)},It.prototype.debug=function(t){this._log("debug",t)},It.prototype.info=function(t){this._log("info",t)},It.prototype.warn=function(t){this._log("warning",t)},It.prototype.warning=function(t){this._log("warning",t)},It.prototype.error=function(t){this._log("error",t)},It.prototype.critical=function(t){this._log("critical",t)},It.prototype.wait=function(t){this.queue.wait(t)},It.prototype.captureEvent=function(t,e,r){return this.telemeter&&this.telemeter.captureEvent(t,e,r)},It.prototype.captureDomContentLoaded=function(t){return this.telemeter&&this.telemeter.captureDomContentLoaded(t)},It.prototype.captureLoad=function(t){return this.telemeter&&this.telemeter.captureLoad(t)},It.prototype.buildJsonPayload=function(t){return this.api.buildJsonPayload(t)},It.prototype.sendJsonPayload=function(t){this.api.postJsonPayload(t)},It.prototype._log=function(t,e){var r;if(e.callback&&(r=e.callback,delete e.callback),this.options.ignoreDuplicateErrors&&this._sameAsLastError(e)){if(r){var n=new Error("ignored identical item");n.item=e,r(n)}}else try{e.level=e.level||t,this._addItemAttributes(e),this._addTracingInfo(e);var o=this.telemeter;o&&(o._captureRollbarItem(e),e.telemetryEvents=o.copyEvents()||[]),this.notifier.log(e,r)}catch(t){r&&r(t),this.logger.error(t)}},It.prototype._addItemAttributes=function(t){var e,r,n=null===(e=this.tracing)||void 0===e?void 0:e.getSpan(),o=[{key:"session_id",value:R(this)||(null===(r=this.tracing)||void 0===r?void 0:r.sessionId)},{key:"span_id",value:null==n?void 0:n.spanId},{key:"trace_id",value:null==n?void 0:n.traceId}];t._isUncaught&&o.push({key:"is_uncaught",value:"true"}),S(t.data,o),null==n||n.addEvent("rollbar.occurrence",[{key:"rollbar.occurrence.uuid",value:t.uuid}])},It.prototype._defaultLogLevel=function(){return this.options.logLevel||"debug"},It.prototype._sameAsLastError=function(t){if(!t._isUncaught)return!1;var e=function(t){var e=t.message||"",r=(t.err||{}).stack||String(t.err);return e+"::"+r}(t);return this.lastErrorHash===e||(this.lastError=t.err,this.lastErrorHash=e,!1)},It.prototype._addTracingInfo=function(t){if(this.tracer){var e=this.tracer.scope().active();if(function(t){if(!t||!t.context||"function"!=typeof t.context)return!1;var e=t.context();if(!e||!e.toSpanId||!e.toTraceId||"function"!=typeof e.toSpanId||"function"!=typeof e.toTraceId)return!1;return!0}(e)){e.setTag("rollbar.error_uuid",t.uuid),e.setTag("rollbar.has_error",!0),e.setTag("error",!0),e.setTag("rollbar.item_url","https://rollbar.com/item/uuid/?uuid=".concat(t.uuid)),e.setTag("rollbar.occurrence_url","https://rollbar.com/occurrence/uuid/?uuid=".concat(t.uuid));var r=e.context().toSpanId(),n=e.context().toTraceId();t.custom?(t.custom.opentracing_span_id=r,t.custom.opentracing_trace_id=n):t.custom={opentracing_span_id:r,opentracing_trace_id:n}}}};const Pt=It;var Rt=["otelAttributes"];function At(t){return At="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},At(t)}function Lt(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 qt(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?Lt(Object(r),!0).forEach(function(e){Ct(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Lt(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function Ct(t,e,r){return(e=Ut(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Mt(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,Ut(n.key),n)}}function Ut(t){var e=function(t,e){if("object"!=At(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!=At(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==At(e)?e:e+""}var Dt=100;function Nt(t){return[Math.trunc(t/1e3),Math.round(t%1e3*1e6)]}var Ht=function(){return function(t,e,r){return e&&Mt(t.prototype,e),r&&Mt(t,r),Object.defineProperty(t,"prototype",{writable:!1}),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=T(e);var o=this.options.maxTelemetryEvents||Dt;this.maxQueueSize=Math.max(0,Math.min(o,Dt)),this.tracing=r,this.telemetrySpan=null===(n=this.tracing)||void 0===n?void 0:n.startSpan("rollbar-telemetry",{})},[{key:"configure",value:function(t){var e=this.options;this.options=T(e,t);var r=this.options.maxTelemetryEvents||Dt,n=Math.max(0,Math.min(r,Dt)),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(f(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.filter(function(t){return"connectivity"!==t.type}),t=t.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,Rt);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:Ft(t,r),type:t,timestamp_ms:o||O(),body:e,source:"client"};n&&(a.uuid=n),i&&(a.otelAttributes=i);try{if(f(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,Nt(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=qt({message:t,level:e},r?{type:"message",uuid:r}:{});return null===(o=this.telemetrySpan)||void 0===o||o.addEvent(i,a,Nt(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,Nt(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:Nt(a)},c=this._getRepeatedEvent(s,l);return c?this._updateRepeatedEvent(c,l,a):(null===(e=this.telemetrySpan)||void 0===e||e.addEvent(s,l,Nt(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:Nt(i)},l=this._getRepeatedEvent(a,u);return l?this._updateRepeatedEvent(l,u,i):(null===(e=this.telemetrySpan)||void 0===e||e.addEvent(a,u,Nt(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=Nt(r),t.otelAttributes.durationUnixNano=Nt(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,Nt(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,Nt(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=qt(qt({},f),{},{element:o,dropEffect:i,effectAllowed:a}),p=qt(qt({},p),{},{element:o,dropEffect:i,effectAllowed:a})),"drop"===r&&(f=qt(qt({},f),{},{element:o,dropEffect:i,effectAllowed:a,kinds:s,mediaTypes:u}),p=qt(qt({},p),{},{element:o,dropEffect:i,effectAllowed:a,kinds:s,mediaTypes:u})),null===(e=this.telemetrySpan)||void 0===e||e.addEvent(c,p,Nt(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},Nt(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,Nt(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()}}])}();function Ft(t,e){if(e)return e;return{error:"error",manual:"info"}[t]||"info"}const Bt=Ht;function Jt(t,e,r){t._isUncaught&&(t.data._isUncaught=!0),t._originalArgs&&(t.data._originalArgs=t._originalArgs),r(null,t)}function Wt(t,e,r){var n=e.payload||{};n.body&&delete n.body,t.data=T(t.data,n),r(null,t)}function Gt(t,e,r){t.telemetryEvents&&x(t,"data.body.telemetry",t.telemetryEvents),r(null,t)}function zt(t,e,r){if(t.message){var n="data.body.trace_chain.0",o=E(t,n);if(o||(o=E(t,n="data.body.trace")),o){if(!o.exception||!o.exception.description)return x(t,n+".exception.description",t.message),void r(null,t);x(t,n+".extra",T(E(t,n+".extra")||{},{message:t.message}))}r(null,t)}else r(null,t)}function $t(t){return function(e,r,n){var o,i=T(e),a=null;try{f(r.transform)&&(a=r.transform(i.data,e))}catch(o){return r.transform=null,t.error("Error while calling custom transform() function. Removing custom transform().",o),void n(null,e)}p(o=a)&&l(o.then,"function")?a.then(function(t){t&&(i.data=t),n(null,i)},function(t){n(t,e)}):n(null,i)}}function Qt(t,e,r){if(!e.sendConfig)return r(null,t);var n=E(t,"data.custom")||{};n._rollbarConfig=e,t.data.custom=n,r(null,t)}function Zt(t,e){f(t[e])&&(t[e]=t[e].toString())}function Vt(t,e,r){var n=e._configuredOptions;Zt(n,"transform"),Zt(n,"checkIgnore"),Zt(n,"onSendCallback"),delete n.accessToken,t.data.notifier.configured_options=n,r(null,t)}function Xt(t,e,r){var n=T(t.notifier.client.notifier.diagnostic,t.diagnostic);if(E(t,"err._isAnonymous")&&(n.is_anonymous=!0),t._isUncaught&&(n.is_uncaught=t._isUncaught),t.err)try{n.raw_error={message:t.err.message,name:t.err.name,constructor_name:t.err.constructor&&t.err.constructor.name,filename:t.err.fileName,line:t.err.lineNumber,column:t.err.columnNumber,stack:t.err.stack}}catch(t){n.raw_error={failed:String(t)}}t.data.notifier.diagnostic=T(t.data.notifier.diagnostic,n),r(null,t)}const Kt=function(t,e,r){var n,o,i,a,s=l(t,"object"),u=l(t,"array"),c=[];if(r=r||{obj:[],mapped:[]},s){if(a=r.obj.indexOf(t),s&&-1!==a)return r.mapped[a]||r.obj[a];r.obj.push(t),a=r.obj.length-1}if(s)for(n in t)d(t,n)&&c.push(n);else if(u)for(i=0;i<t.length;++i)c.push(i);var f=s?{}:[],p=!0;for(i=0;i<c.length;++i)o=t[n=c[i]],f[n]=e(n,o,r),p=p&&f[n]===t[n];return s&&!p&&(r.mapped[a]=f),p?t:f};function Yt(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)||ee(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 te(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=ee(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 ee(t,e){if(t){if("string"==typeof t)return re(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)?re(t,e):void 0}}function re(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 ne(t,e){return[t,y(t,e)]}function oe(t,e){var r=t.length;return r>2*e?t.slice(0,e).concat(t.slice(r-e)):t}function ie(t,e,r){r=void 0===r?30:r;var n,o=t.data.body;if(o.trace_chain){var i,a=te(o.trace_chain);try{for(a.s();!(i=a.n()).done;){var s=i.value;n=oe(n=s.frames,r),s.frames=n}}catch(t){a.e(t)}finally{a.f()}}else o.trace&&(n=oe(n=o.trace.frames,r),o.trace.frames=n);return[t,y(t,e)]}function ae(t,e){return e&&e.length>t?e.slice(0,t-3).concat("..."):e}function se(t,e,r){return e=Kt(e,function e(r,n,o){switch(c(n)){case"string":return ae(t,n);case"object":case"array":return Kt(n,e,o);default:return n}}),[e,y(e,r)]}function ue(t){return t.exception&&(delete t.exception.description,t.exception.message=ae(255,t.exception.message)),t.frames=oe(t.frames,1),t}function le(t,e){var r=t.data.body;if(r.trace_chain){var n,o=r.trace_chain,i=te(o.entries());try{for(i.s();!(n=i.n()).done;){var a=Yt(n.value,2),s=a[0],u=a[1];o[s]=ue(u)}}catch(t){i.e(t)}finally{i.f()}}else r.trace&&(r.trace=ue(r.trace));return[t,y(t,e)]}function ce(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}const fe={truncate:function(t,e,r){r=void 0===r?524288:r;for(var n,o,i,a=[ne,ie,se.bind(null,1024),se.bind(null,512),se.bind(null,256),le];n=a.shift();)if(t=(o=n(t,e))[0],(i=o[1]).error||!ce(i.value,r))return i;return i},raw:ne,truncateFrames:ie,truncateStrings:se,maybeTruncateValue:ae};function pe(t){return function(t){if(Array.isArray(t))return de(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return de(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)?de(t,e):void 0}}(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 de(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}var he=["authorization","www-authorization","http_authorization","omniauth.auth","cookie","oauth-access-token","x-access-token","x_csrf_token","http_x_csrf_token","x-csrf-token"],me=[].concat(pe(["pw","pass","passwd","password","secret","confirm_password","confirmPassword","password_confirmation","passwordConfirmation","access_token","accessToken","X-Rollbar-Access-Token","secret_key","secretKey","secretToken"]),pe(["api_key","authenticity_token","oauth_token","token","user_session_secret"]),pe(["request.session.csrf","request.session._csrf","request.params._csrf","request.cookie","request.cookies"]));const ye=require("node:async_hooks");function ve(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 ge(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)?ge(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 ge(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 be(t){var e=(null==t?void 0:t.client.asyncLocalStorage)||new ye.AsyncLocalStorage;return t&&(t.client.asyncLocalStorage=e),function(t,r,n){var o=function(t){if(!t)return null;var e=Array.isArray(t)?t.join(","):t;if("string"!=typeof e)return null;var r,n=ve(e.split(","));try{for(n.s();!(r=n.n()).done;){var o=r.value.trim();if(o){var i=o.indexOf("=");if(-1!==i&&"rollbar.session.id"===o.slice(0,i).trim()){var a=o.slice(i+1).trim();if(!a)return null;try{return decodeURIComponent(a)}catch(t){return a}}}}}catch(t){n.e(t)}finally{n.f()}return null}(function(t){var e;return t?"function"==typeof t.get?t.get("baggage"):(null===(e=t.headers)||void 0===e?void 0:e.baggage)||null:null}(t));return o?e.run({sessionId:o},function(){return n()}):n()}}const we=require("http"),ke=require("https");const _e=function(t,e,r,n,o){var i=t[e];t[e]=r(i),n&&n[o].push([t,e,i])};function Se(t){var e={protocol:t.protocol,hostname:"string"==typeof t.hostname&&t.hostname.startsWith("[")?t.hostname.slice(1,-1):t.hostname,hash:t.hash,search:t.search,pathname:t.pathname,path:"".concat(t.pathname||"").concat(t.search||""),href:t.href};return""!==t.port&&(e.port=Number(t.port)),(t.username||t.password)&&(e.auth="".concat(t.username,":").concat(t.password)),e}var Ee={network:!0,networkResponseHeaders:!1,networkRequestHeaders:!1,log:!0};function xe(t,e,r){this.options=t;var n=t.autoInstrument;!1===t.enabled||!1===n?this.autoInstrument={}:(l(n,"object")||(n=Ee),this.autoInstrument=T(Ee,n)),this.telemeter=e,this.rollbar=r,this.diagnostic=r.client.notifier.diagnostic,this.replacements={network:[],log:[]}}function Oe(t){var e=this,r=this.telemeter;return function(){for(var o=arguments.length,i=new Array(o),a=0;a<o;a++)i[a]=arguments[a];var s=function(t,e,r){if("string"==typeof t){var o=t;t=Se(new n.URL(o))}else t&&t instanceof n.URL?t=Se(t):(r=e,e=t,t=null);return"function"==typeof e?(r=e,e=t||{}):e=T(t||{},e),{options:e,cb:r}}(i[0],i[1],i[2]),u=function(t){var e=t.protocol||"http:";return e+="//",t.auth&&(e+="".concat(t.auth,"@")),e+=t.hostname||t.host||"localhost",t.port&&(e+=":".concat(t.port)),e+(t.path||"/")}(s.options),l=R(e.rollbar.client);l&&j(e.options,{sessionId:l},u)&&(s.options.headers||(s.options.headers={}),s.options.headers.baggage="rollbar.session.id=".concat(l));var c={method:s.options.method||"GET",url:u,status_code:null,start_time_ms:O(),end_time_ms:null};e.autoInstrument.networkRequestHeaders&&(c.request_headers=s.options.headers),r.captureNetwork(c,"http");var f=function(t,e,r){return function(n){if(e.end_time_ms=O(),e.status_code=n.statusCode,e.response={},t.networkResponseHeaders&&(e.response.headers=n.headers),r)return r.apply(void 0,arguments)}}(e.autoInstrument,c,s.cb);s.cb&&i.pop(),i.push(f);var p=t.apply(ke,i);return p.on("error",function(t){c.status_code=0,c.error=[t.name,t.message].join(": ")}),p}}function Ie(t){var e=this,r=this.telemeter;return function(){for(var n=arguments.length,o=new Array(n),i=0;i<n;i++)o[i]=arguments[i];var a,s=o[0],u=o[1],c="GET",f=R(e.rollbar.client);(l(s,"string")||s instanceof URL?a=s.toString():s&&(a=s.url,s.method&&(c=s.method)),u&&u.method&&(c=u.method),f&&j(e.options,{sessionId:f},a))&&P(o,{baggage:"rollbar.session.id=".concat(f)});var p={method:c,url:a,status_code:null,start_time_ms:O(),end_time_ms:null};if(e.autoInstrument.networkRequestHeaders){var d=Te(u&&u.headers?u.headers:s&&s.headers);d&&(p.request_headers=d)}return r.captureNetwork(p,"fetch"),t.apply(globalThis,o).then(function(t){if(p.end_time_ms=O(),p.status_code=t.status,e.autoInstrument.networkResponseHeaders){var r=Te(t.headers);r&&(p.response=p.response||{},p.response.headers=r)}return t},function(t){throw p.end_time_ms=O(),p.status_code=0,p.error=[t.name,t.message].join(": "),t})}}function Te(t){if(!t)return null;if("function"==typeof t.forEach){var e={};return t.forEach(function(t,r){e[r]=t}),e}if(Array.isArray(t)){var r={};return t.forEach(function(t){t&&t.length>1&&(r[t[0]]=t[1])}),r}return l(t,"object")?t:null}function je(t,e){for(var r;t[e].length;)(r=t[e].shift())[0][r[1]]=r[2]}xe.prototype.configure=function(t){this.options=T(this.options,t);var e=t.autoInstrument,r=T(this.autoInstrument);!1===t.enabled||!1===e?this.autoInstrument={}:(l(e,"object")||(e=Ee),this.autoInstrument=T(Ee,e)),this.instrument(r)},xe.prototype.instrument=function(t){!this.autoInstrument.network||t&&t.network?!this.autoInstrument.network&&t&&t.network&&this.deinstrumentNetwork():this.instrumentNetwork(),!this.autoInstrument.log||t&&t.log?!this.autoInstrument.log&&t&&t.log&&this.deinstrumentConsole():this.instrumentConsole()},xe.prototype.deinstrumentNetwork=function(){je(this.replacements,"network")},xe.prototype.instrumentNetwork=function(){_e(we,"request",Oe.bind(this),this.replacements,"network"),_e(ke,"request",Oe.bind(this),this.replacements,"network"),"function"==typeof globalThis.fetch&&_e(globalThis,"fetch",Ie.bind(this),this.replacements,"network")},xe.prototype.captureNetwork=function(t,e,r){return this.telemeter.captureNetwork(t,e,r)},xe.prototype.deinstrumentConsole=function(){je(this.replacements,"log")},xe.prototype.instrumentConsole=function(){var t=this.telemeter,e=process.stdout;_e(e,"write",function(r){return function(n){return t.captureLog(n,"info"),r.apply(e,arguments)}},this.replacements,"log");var r=process.stderr;_e(r,"write",function(e){return function(n){return t.captureLog(n,"error"),e.apply(r,arguments)}},this.replacements,"log")};const Pe=xe,Re=require("async"),Ae=require("request-ip");function Le(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)||Ce(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 qe(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=Ce(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 Ce(t,e){if(t){if("string"==typeof t)return Me(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)?Me(t,e):void 0}}function Me(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 Ue(t,e){var r=e.split("."),n=r.length-1;try{var o,i=qe(r.entries());try{for(i.s();!(o=i.n()).done;){var a=Le(o.value,2),s=a[0],u=a[1];s<n?t=t[u]:t[u]=h()}}catch(t){i.e(t)}finally{i.f()}}catch(t){}}const De=function(t,e,r){if(e=e||[],r){var n,o=qe(r);try{for(o.s();!(n=o.n()).done;){Ue(t,n.value)}}catch(t){o.e(t)}finally{o.f()}}var i=function(t){var e,r=[],n=qe(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),a=function(t){var e,r=[],n=qe(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 s(t,e){return e+"********"}return Kt(t,function t(e,r,n){var o=function(t,e){var r,n=qe(i);try{for(n.s();!(r=n.n()).done;)if(r.value.test(t)){e=h();break}}catch(t){n.e(t)}finally{n.f()}return e}(e,r);return o===r?l(r,"object")||l(r,"array")?Kt(r,t,n):function(t){if(l(t,"string")){var e,r=qe(a);try{for(r.s();!(e=r.n()).done;){var n=e.value;t=t.replace(n,s)}}catch(t){r.e(t)}finally{r.f()}}return t}(o):o})},Ne=require("fs"),He=require("lru-cache"),Fe=require("path"),Be=require("source-map");var Je={},We={},Ge={},ze=/^data:application\/json[^,]+base64,/;function $e(t){if(t=t.trim(),/^file:/.test(t)&&(t=t.replace(/file:\/\/\/(\w:)?/,function(t,e){return e?"":"/"})),t in Je)return Je[t];var e="";try{Ne.existsSync(t)&&(e=Ne.readFileSync(t,"utf8"))}catch(t){}return Je[t]=e}function Qe(t,e){if(!t)return e;var r=Fe.dirname(t),n=/^\w+:\/\/[^/]*/.exec(r),o=n?n[0]:"",i=r.slice(o.length);return o&&/^\/\w:/.test(i)?(o+="/")+Fe.resolve(r.slice(o.length),e).replace(/\\/g,"/"):o+Fe.resolve(r.slice(o.length),e)}function Ze(t){var e,r=function(t){var e;e=$e(t);for(var r,n,o=/(?:\/\/[@#][ \t]+sourceMappingURL=([^\s'"]+?)[ \t]*$)|(?:\/\*[@#][ \t]+sourceMappingURL=([^*]+?)[ \t]*(?:\*\/)[ \t]*$)/gm;n=o.exec(e);)r=n;return r?r[1]:null}(t);if(!r)return null;if(ze.test(r)){var n=r.slice(r.indexOf(",")+1);e=Buffer.from(n,"base64").toString(),r=t}else e=$e(r=Qe(t,r));return e?{url:r,map:e}:null}function Ve(t,e){var r=We[t.source];if(!r){var n=Ze(t.source);n?(r=We[t.source]={url:n.url,map:new Be.SourceMapConsumer(n.map)},e.node_source_maps.source_mapping_urls[t.source]=n.url,r.map.sourcesContent&&r.map.sources.forEach(function(t,e){var n=r.map.sourcesContent[e];if(n){var o=Qe(r.url,t);Je[o]=n}})):(r=We[t.source]={url:null,map:null},e.node_source_maps.source_mapping_urls[t.source]="not found")}if(r&&r.map&&"function"==typeof r.map.originalPositionFor){var o=r.map.originalPositionFor(t);if(null!==o.source){var i=o.source;return o.source=Qe(r.url,o.source),function(t,e,r){Ge[r]||(Ge[r]=t.map.sourceContentFor(e,!0))}(r,i,o.source),o}}return t}function Xe(t){return Ge[t]}function Ke(t){return Ke="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},Ke(t)}var Ye=/^\s*at (?:([^(]+(?: \[\w\s+\])?(?:.*\)*)) )?\(?(.+?)(?::(\d+):(\d+)(?:, <js>:(\d+):(\d+))?)?\)?$/,tr=/^\s*at .+ \(.+ (at[^)]+\))\)$/,er=/^\s*(>?) [0-9]+\|(\s*.+)$/m,rr=new He({max:100}),nr={};function or(t,e){var r,n,o,i,a;if((r=(n=t).match(tr))&&(n=r[1]),!(r=n.match(Ye)))return e(null,null);var s={source:(o=r.slice(1))[1],line:Math.floor(o[2]),column:Math.floor(o[3])-1};a=this.useSourceMaps?function(t,e){return Ve({source:t.source,line:t.line,column:t.column},e)}(s,this.diagnostic):s,i={method:o[0]||"<unknown>",filename:a.source,lineno:a.line,colno:a.column,runtimePosition:s},o[4]&&(i.compiled_lineno=Math.floor(o[4])),o[5]&&(i.compiled_colno=Math.floor(o[5])),e(null,i)}function ir(t,e){var r,n,o;r="/"===t[0]||"."===t[0],n=Boolean(rr.get(t)),o=Boolean(nr[t]),e(null,r&&!n&&!o)}function ar(t,e){if(Xe(t))return e(null,!0);Ne.stat(t,function(t){e(null,!t)})}function sr(t,e){var r=[];t.forEach(function(t){-1===r.indexOf(t.filename)&&r.push(t.filename)}),Re.filter(r,ir,function(r,n){if(r)return e(r);var o;function i(t,e){o[t]=e,rr.set(t,e)}function a(t,e){var r=Xe(t);if(r)try{var n=r.split("\n");return i(t,n),e(null)}catch(t){return e(t)}!function(t,e){try{Ne.readFile(t,function(t,r){var n;return t?e(t):(n=r.toString("utf8").split("\n"),e(null,n))})}catch(t){et.log(t)}}(t,function(r,n){return r?e(r):(i(t,n),e(null))})}function s(t,e){var r=o[t.filename]||rr.get(t.filename);r&&function(t,e){t.code=e[t.lineno-1],t.context={pre:e.slice(Math.max(0,t.lineno-4),t.lineno-1),post:e.slice(t.lineno,t.lineno+3)}}(t,r),e(null)}o={},Re.filter(n,ar,function(r,n){if(r)return e(r);Re.each(n,a,function(r){if(r)return e(r);Re.eachSeries(t,s,function(r){if(r)return e(r);e(null,t)})})})})}function ur(t,e,r,n){var i=function(t){var e,r;if(null==t)return null;if("object"!==Ke(t))return null;if(o.isArray(t))return t;for(r in e=[],t)Object.prototype.hasOwnProperty.call(t,r)&&e.push(t[r]);return e}(t.errors);return function(t,e,r,n){var o,i=t;for(;"object"===Ke(i);)i=i&&i.stack;o=(i||"").split("\n").slice(1),e.nodeSourceMaps&&(r.diagnostic.node_source_maps={},r.diagnostic.node_source_maps.source_mapping_urls={});Re.map(o,or.bind({useSourceMaps:e.nodeSourceMaps,diagnostic:r.diagnostic}),function(t,e){if(t)return n(t);e.reverse(),Re.filter(e,function(t,e){e(null,Boolean(t))},function(t,e){if(t)return n(t);sr(e,n)})})}(t.stack,e,r,function(e,o){var a,s,u,l,c;return e?(et.error("could not parse exception, err: "+e),n(e)):(a=String(t.message||"<no message>"),s=String(t.name||"<unknown>"),u={class:s,message:a,frames:o},i&&i.length&&(l=i[0],u={class:s,message:String(l.message||"<no message>"),frames:o}),a.match(er)&&(c=function(t){var e,r,n,o,i,a,s,u,l,c,f;for(r=(e=t.split("\n"))[0].indexOf(":"),n=e[0].slice(0,r),o=parseInt(e[0].slice(r+1),10),a=e[(i=e.length)-1],e=e.slice(1,i-1),l=[],c=[],s=0;s<i-2;++s)(f=e[s].match(er))&&(">"===f[1]?u=f[2]:u?f[2]&&c.push(f[2]):f[2]&&l.push(f[2]));return{frame:{method:"<jade>",filename:n,lineno:o,code:u,context:{pre:l=l.slice(0,Math.min(l.length,3)),post:c=c.slice(0,Math.min(c.length,3))}},message:a}}(a),u.message=c.message,u.frames.push(c.frame)),r.localsMap?void r.notifier.locals.mergeLocals(r.localsMap,o,t.stack,function(t){return t&&(et.error("could not parse locals, err: "+t),r.diagnostic["error parsing locals"]=t),n(null,u)}):n(null,u))})}function lr(t,e,r){var n,o=e.payload&&e.payload.environment||e.environment,i={timestamp:Math.round(t.timestamp/1e3),environment:t.environment||o,level:t.level||"error",language:"javascript",framework:t.framework||e.framework,uuid:t.uuid,notifier:JSON.parse(JSON.stringify(e.notifier)),custom:t.custom,attributes:null===(n=t.data)||void 0===n?void 0:n.attributes};e.codeVersion?i.code_version=e.codeVersion:e.code_version&&(i.code_version=e.code_version),Object.getOwnPropertyNames(t.custom||{}).forEach(function(e){d(i,e)||(i[e]=t.custom[e])}),i.server={host:e.host,argv:process.argv.concat(),pid:process.pid},e.branch&&(i.server.branch=e.branch),e.root&&(i.server.root=e.root),t.data=i,r(null,t)}function cr(t,e,r){t.stackInfo?function(t,e,r){t.stackInfo&&(t.data=t.data||{},t.data.body=t.data.body||{},t.data.body.trace_chain=t.stackInfo),r(null,t)}(t,0,r):function(t,e,r){t.data=t.data||{},t.data.body=t.data.body||{};var n=t.message||"Item sent with null or missing arguments.";t.data.body.message={body:n},r(null,t)}(t,0,r)}function fr(t,e,r){if(!t.err)return r(null,t);var n=t.err,o=[],i=[];do{o.push(n),n=n.nested||n.cause}while(n);t.stackInfo=i,e.addErrorContext&&function(t,e){var r=t.data.custom||{},n=!1;try{var o,i=a(e);try{for(i.s();!(o=i.n()).done;){var s=o.value;d(s,"rollbarContext")&&(r=T(r,g(s.rollbarContext)),n=!0)}}catch(t){i.e(t)}finally{i.f()}n&&(t.data.custom=r)}catch(e){t.diagnostic.error_context="Failed: "+e.message}}(t,o);Re.eachSeries(o,function(t,e,r){return function(n,o){ur(n,e,r,function(e,r){return e?o(e):(t.push({frames:r.frames,exception:{class:r.class,message:r.message}}),o(null))})}}(i,e,t),function(e){e&&(t.message=t.err.message||t.err.description||t.message||String(t.err),t.diagnostic.buildTraceData=e.message,delete t.stackInfo),r(null,t)})}function pr(t,e,r){t.data=t.data||{};var o=t.request;if(o){var i=o.baseUrl||"";if(e.addRequestData&&f(e.addRequestData))return e.addRequestData(t.data,o),void r(null,t);var a,s=function(t){var e,r=t.headers||{},o=r.host||"<no host>",i=t.protocol||(t.socket&&t.socket.encrypted?"https":"http"),a=t.baseUrl||"";if(l(t.url,"string")){var s=a&&a.length?a+t.url:t.url;e=n.parse(s,!0)}else e=t.url||{};e.protocol=e.protocol||i,e.host=e.host||o;var u={url:n.format(e),user_ip:yr(t),headers:r,method:t.method};e.search&&e.search.length>0&&(u.GET=e.query);var f=t.body||t.payload;if(f){var p={};if("object"===(m=c(f))||"array"===m){for(var h in f)d(f,h)&&(p[h]=f[h]);u[t.method]=p}else u.body=f}var m;return u}(o);if(function(t,e){if(t&&t.user_ip&&!0!==e){var r=t.user_ip;if(e)try{var n;if(-1!==r.indexOf("."))(n=r.split(".")).pop(),n.push("0"),r=n.join(".");else if(-1!==r.indexOf(":")){if((n=r.split(":")).length>2){var o=n.slice(0,3),i=o[2].indexOf("/");-1!==i&&(o[2]=o[2].substring(0,i)),r=o.concat("0000:0000:0000:0000:0000").join(":")}}else r=null}catch(t){r=null}else r=null;t.user_ip=r}}(s,e.captureIp),t.data.request=s,o.route)a=o.route.path,t.data.context=i&&i.length?i+a:a;else try{a=o.app._router.matchRequest(o).path,t.data.context=i&&i.length?i+a:a}catch(t){}var u=e.captureEmail,p=e.captureUsername;if(o.rollbar_person){var h=o.rollbar_person;!u&&h.email&&(h.email=null),!p&&h.username&&(h.username=null),t.data.person=h}else if(o.user)t.data.person={id:o.user.id},o.user.username&&p&&(t.data.person.username=o.user.username),o.user.email&&u&&(t.data.person.email=o.user.email);else if(o.user_id||o.userId){var m=o.user_id||o.userId;f(m)&&(m=m()),t.data.person={id:m}}r(null,t)}else r(null,t)}function dr(t,e,r){var n=t.lambdaContext;if(n){var o={remainingTimeInMillis:n.getRemainingTimeInMillis(),callbackWaitsForEmptyEventLoop:n.callbackWaitsForEmptyEventLoop,functionName:n.functionName,functionVersion:n.functionVersion,arn:n.invokedFunctionArn,requestId:n.awsRequestId};t.data=t.data||{},t.data.custom=t.data.custom||{},t.data.custom.lambda=o,r(null,t)}else r(null,t)}function hr(t,e,r){var n=e.scrubHeaders||[],o=e.scrubFields||[],i=e.scrubPaths||[];o=n.concat(o),function(t,e){if(!t||!e.scrubRequestBody)return;try{("string"==typeof(r=t.body)||r instanceof String)&&mr(t)&&(t.body=JSON.parse(t.body))}catch(e){t.body=null,t.error="request.body parse failed: "+e.message}var r}(t.data.request,e),t.data=De(t.data,o,i),function(t,e){if(!t||!e.scrubRequestBody)return;try{p(t.body)&&mr(t)&&(t.body=JSON.stringify(t.body))}catch(e){t.body=null,t.error="request.body serialization failed: "+e.message}}(t.data.request,e),r(null,t)}function mr(t){return t.headers&&t.headers["content-type"]&&t.headers["content-type"].includes("json")}function yr(t){var e=t.ip;return e||(e=Ae.getClientIp(t)),e}function vr(){this.rateLimitExpires=0}function gr(t,e,r){var n=e&&e.headers||{};if(n["Content-Type"]="application/json",r)try{n["Content-Length"]=Buffer.byteLength(r,"utf8")}catch(t){et.error("Could not get the content length of the data")}return n["X-Rollbar-Access-Token"]=t,n}function br(t){return{"http:":we,"https:":ke}[t.protocol]}function wr(){return Math.floor(Date.now()/1e3)}vr.prototype.get=function(t,e,r,n,o){var i;if(n&&f(n)||(n=function(){}),function(t,e,r){(r=r||{}).access_token=t;var n,o=[];for(n in r)Object.prototype.hasOwnProperty.call(r,n)&&o.push([n,r[n]].join("="));var i="?"+o.sort().join("&");(e=e||{}).path=e.path||"";var a,s=e.path.indexOf("?"),u=e.path.indexOf("#");-1!==s&&(-1===u||u>s)?(a=e.path,e.path=a.substring(0,s)+i+"&"+a.substring(s+1)):-1!==u?(a=e.path,e.path=a.substring(0,u)+i+a.substring(u)):e.path=e.path+i}(t,e=e||{},r),e.headers=gr(t,e),!(i=o?o(e):br(e)))return et.error("Unknown transport based on given protocol: "+e.protocol),n(new Error("Unknown transport"));var a=i.request(e,function(t){this.handleResponse(t,n)}.bind(this));a.on("error",function(t){n(t)}),a.end()},vr.prototype.post=function(t){var e,r=t.accessToken,n=t.options,o=t.payload,a=t.callback,s=t.transportFactory;if(a&&f(a)||(a=function(){}),wr()<this.rateLimitExpires)return a(new Error("Exceeded rate limit"));if(n=n||{},!o)return a(new Error("Cannot send empty request"));var u=fe.truncate(o,i);if(u.error)return et.error("Problem stringifying payload. Giving up"),a(u.error);var l=u.value;if(n.headers=gr(r,n,l),!(e=s?s(n):br(n)))return et.error("Unknown transport based on given protocol: "+n.protocol),a(new Error("Unknown transport"));var c=e.request(n,function(t){this.handleResponse(t,function(t){return function(e,r){if(e)return t(e);r.result&&r.result.uuid?et.log(["Successful api response."," Link: https://rollbar.com/occurrence/uuid/?uuid="+r.result.uuid].join("")):et.log("Successful api response"),t(null,r.result)}}(a))}.bind(this));c.on("error",function(t){a(t)}),l&&c.write(l),c.end()},vr.prototype.updateRateLimit=function(t){var e=parseInt(t.headers["x-rate-limit-remaining"]||0),r=Math.min(60,t.headers["x-rate-limit-remaining-seconds"]||0),n=wr();429===t.statusCode&&0===e?this.rateLimitExpires=n+r:this.rateLimitExpires=n},vr.prototype.handleResponse=function(t,e){this.updateRateLimit(t);var r=[];t.setEncoding("utf8"),t.on("data",function(t){r.push(t)}),t.on("end",function(){!function(t,e){var r=function(t){var e,r;try{e=JSON.parse(t)}catch(t){r=t}return{error:r,value:e}}(t);if(r.error)return et.error("Could not parse api response, err: "+r.error),e(r.error);if((t=r.value).err)return et.error("Received error: "+t.message),e(new Error("Api error: "+(t.message||"Unknown error")));e(null,t)}(r=r.join(""),e)})};const kr=vr;function _r(t,e){if(l(t,"string")){var r=t;(t={}).accessToken=r}void 0!==t.minimumLevel&&(t.reportLevel=t.minimumLevel,delete t.minimumLevel),et.init({logLevel:t.logLevel||"error"}),this.options=I(_r.defaultOptions,t,null,et),this.options._configuredOptions=t,delete this.options.maxItems,this.options.environment=this.options.environment||"unspecified",this.lambdaContext=null,this.lambdaTimeoutHandle=null;var o=new kr,a=new Z(this.options,o,n,fe,i),s=new Bt(this.options);this.client=e||new Pt(this.options,a,et,s,null,null,"server"),this.instrumenter=new Pe(this.options,this.client.telemeter,this),this.instrumenter.instrument(),this.options.locals&&(this.locals=Sr(this.options.locals,et)),this.client.notifier.addTransform(lr).addTransform(fr).addTransform(cr).addTransform(zt).addTransform(Gt).addTransform(pr).addTransform(dr).addTransform(Qt).addTransform(hr).addTransform(Wt).addTransform($t(et)).addTransform(Vt).addTransform(Xt).addTransform(Jt),function(t){t.addPredicate(ot).addPredicate(function(t){return function(e,r){var n=Boolean(e._isUncaught);delete e._isUncaught;var o=e._originalArgs;delete e._originalArgs;try{f(r.onSendCallback)&&r.onSendCallback(n,o,e)}catch(e){r.onSendCallback=null,t.error("Error while calling onSendCallback, removing",e)}try{if(f(r.checkIgnore)&&r.checkIgnore(n,o,e))return!1}catch(e){r.checkIgnore=null,t.error("Error while calling custom checkIgnore(), removing",e)}return!0}}(et)).addPredicate(function(t){return function(e,r){return!at(e,r,"blocklist",t)}}(et)).addPredicate(function(t){return function(e,r){return at(e,r,"safelist",t)}}(et)).addPredicate(st(et))}(this.client.queue),this.setupUnhandledCapture()}function Sr(t,e){var r;if(process.versions.node.split(".")[0]<10)return null;if("function"==typeof t)r=t,t=null;else{if(!l(t,"object"))return e.error("options.locals or options.locals.module must be a Locals module"),null;r=t.module,delete t.module}return new r(t,e)}var Er=null;function xr(t){var e="Rollbar is not initialized";et.error(e),t&&t(new Error(e))}function Or(t){for(var e=0,r=t.length;e<r;++e)if(f(t[e]))return t[e]}function Ir(t,e){var r=function(t,r){e(t,r)};r._rollbarHandler=!0;for(var n=process.listeners(t),o=n.length,i=0;i<o;++i)n[i]._rollbarHandler&&process.removeListener(t,n[i]);process.on(t,r)}function Tr(t,e){Error.call(this),Error.captureStackTrace(this,this.constructor),this.message=t,this.nested=e,this.name=this.constructor.name}_r.init=function(t,e){return Er?Er.global(t).configure(t):Er=new _r(t,e)},_r.prototype.global=function(t){return delete(t=I(t)).maxItems,this.client.global(t),this},_r.global=function(t){if(Er)return Er.global(t);xr()},_r.prototype.configure=function(t,e){t.logLevel&&et.init({logLevel:t.logLevel});var r=this.options,n={};return e&&(n={payload:e}),this.options=I(r,t,n,et),this.options._configuredOptions=I(r._configuredOptions,t,n),delete this.options.maxItems,this.client.configure(t,e),this.setupUnhandledCapture(),this.options.locals&&(this.locals?this.locals.updateOptions(this.options.locals):this.locals=Sr(this.options.locals,et)),this},_r.configure=function(t,e){if(Er)return Er.configure(t,e);xr()},_r.prototype.lastError=function(){return this.client.lastError},_r.lastError=function(){if(Er)return Er.lastError();xr()},_r.prototype.log=function(){var t=this._createItem(arguments),e=t.uuid;return this.client.log(t),{uuid:e}},_r.log=function(){if(Er)return Er.log.apply(Er,arguments);xr(Or(arguments))},_r.prototype.debug=function(){var t=this._createItem(arguments),e=t.uuid;return this.client.debug(t),{uuid:e}},_r.debug=function(){if(Er)return Er.debug.apply(Er,arguments);xr(Or(arguments))},_r.prototype.info=function(){var t=this._createItem(arguments),e=t.uuid;return this.client.info(t),{uuid:e}},_r.info=function(){if(Er)return Er.info.apply(Er,arguments);xr(Or(arguments))},_r.prototype.warn=function(){var t=this._createItem(arguments),e=t.uuid;return this.client.warn(t),{uuid:e}},_r.warn=function(){if(Er)return Er.warn.apply(Er,arguments);xr(Or(arguments))},_r.prototype.warning=function(){var t=this._createItem(arguments),e=t.uuid;return this.client.warning(t),{uuid:e}},_r.warning=function(){if(Er)return Er.warning.apply(Er,arguments);xr(Or(arguments))},_r.prototype.error=function(){var t=this._createItem(arguments),e=t.uuid;return this.client.error(t),{uuid:e}},_r.error=function(){if(Er)return Er.error.apply(Er,arguments);xr(Or(arguments))},_r.prototype._uncaughtError=function(){var t=this._createItem(arguments);t._isUncaught=!0,t.level=this.options.uncaughtErrorLevel;var e=t.uuid;return this.client.log(t),{uuid:e}},_r.prototype.critical=function(){var t=this._createItem(arguments),e=t.uuid;return this.client.critical(t),{uuid:e}},_r.critical=function(){if(Er)return Er.critical.apply(Er,arguments);xr(Or(arguments))},_r.prototype.buildJsonPayload=function(t){return this.client.buildJsonPayload(t)},_r.buildJsonPayload=function(){if(Er)return Er.buildJsonPayload.apply(Er,arguments);xr()},_r.prototype.sendJsonPayload=function(t){return this.client.sendJsonPayload(t)},_r.sendJsonPayload=function(){if(Er)return Er.sendJsonPayload.apply(Er,arguments);xr()},_r.prototype.wait=function(t){this.client.wait(t)},_r.wait=function(t){if(Er)return Er.wait(t);xr(Or(arguments))},_r.prototype.errorHandler=function(){return function(t,e,r,n){var o=function(o){return o&&et.error("Error reporting to rollbar, ignoring: "+o),n(t,e,r)};return t?t instanceof Error?this.error(t,e,o):this.error("Error: "+t,e,o):n(t,e,r)}.bind(this)},_r.errorHandler=function(){if(Er)return Er.errorHandler();xr()},_r.prototype.lambdaHandler=function(t,e){return t.length<=2?this.asyncLambdaHandler(t,e):this.syncLambdaHandler(t,e)},_r.prototype.asyncLambdaHandler=function(t,e){var r=this,n=function(t,e){var n={originalEvent:t,originalRequestId:e.awsRequestId};r.error("Function timed out",n)},o=this.options.captureLambdaTimeouts;return function(i,a){return new Promise(function(s,u){if(r.lambdaContext=a,o){var l=(e||n).bind(null,i,a);r.lambdaTimeoutHandle=setTimeout(l,a.getRemainingTimeInMillis()-1e3)}t(i,a).then(function(t){r.wait(function(){clearTimeout(r.lambdaTimeoutHandle),s(t)})}).catch(function(t){r.error(t),r.wait(function(){clearTimeout(r.lambdaTimeoutHandle),u(t)})})})}},_r.prototype.syncLambdaHandler=function(t,e){var r=this,n=function(t,e,n){var o={originalEvent:t,originalRequestId:e.awsRequestId};r.error("Function timed out",o)},o=this.options.captureLambdaTimeouts;return function(i,a,s){if(r.lambdaContext=a,o){var u=(e||n).bind(null,i,a,s);r.lambdaTimeoutHandle=setTimeout(u,a.getRemainingTimeInMillis()-1e3)}try{t(i,a,function(t,e){t&&r.error(t),r.wait(function(){clearTimeout(r.lambdaTimeoutHandle),s(t,e)})})}catch(t){r.error(t),r.wait(function(){throw clearTimeout(r.lambdaTimeoutHandle),t})}}},_r.lambdaHandler=function(t){if(Er)return Er.lambdaHandler(t);xr()},_r.prototype.wrapCallback=function(t){return function(t,e){return function(){var r=arguments[0];return r&&t.error(r),e.apply(this,arguments)}}(this,t)},_r.wrapCallback=function(t){if(Er)return Er.wrapCallback(t);xr()},_r.prototype.expressMiddleware=function(){return be(this)},_r.expressMiddleware=function(){if(Er)return be(Er);xr()},_r.prototype.captureEvent=function(){var t=function(t){for(var e,r,n,o,i=0,a=t.length;i<a;++i)switch(c(o=t[i])){case"string":!e&&_(w,o)?e=o:!n&&_(k,o)&&(n=o);break;case"object":r=o}return{type:e||"manual",metadata:r||{},level:n}}(arguments);return this.client.captureEvent(t.type,t.metadata,t.level)},_r.captureEvent=function(){if(Er)return Er.captureEvent.apply(Er,arguments);xr()},_r.prototype.reportMessage=function(t,e,r,n){return et.log("reportMessage is deprecated"),f(this[e])?this[e](t,r,n):this.error(t,r,n)},_r.reportMessage=function(t,e,r,n){if(Er)return Er.reportMessage(t,e,r,n);xr(n)},_r.prototype.reportMessageWithPayloadData=function(t,e,r,n){return et.log("reportMessageWithPayloadData is deprecated"),this.error(t,r,e,n)},_r.reportMessageWithPayloadData=function(t,e,r,n){if(Er)return Er.reportMessageWithPayloadData(t,e,r,n);xr(n)},_r.prototype.handleError=function(t,e,r){return et.log("handleError is deprecated"),this.error(t,e,r)},_r.handleError=function(t,e,r){if(Er)return Er.handleError(t,e,r);xr(r)},_r.prototype.handleErrorWithPayloadData=function(t,e,r,n){return et.log("handleErrorWithPayloadData is deprecated"),this.error(t,r,e,n)},_r.handleErrorWithPayloadData=function(t,e,r,n){if(Er)return Er.handleErrorWithPayloadData(t,e,r,n);xr(n)},_r.handleUncaughtExceptions=function(t,e){if(Er)return(e=e||{}).accessToken=t,Er.configure(e);xr()},_r.handleUnhandledRejections=function(t,e){if(Er)return(e=e||{}).accessToken=t,Er.configure(e);xr()},_r.handleUncaughtExceptionsAndRejections=function(t,e){if(Er)return(e=e||{}).accessToken=t,Er.configure(e);xr()},_r.prototype._createItem=function(t){var e=b(t,et,this,["headers","protocol","url","method","body","route"],this.lambdaContext);return e.err&&e.notifier.locals&&(e.localsMap=e.notifier.locals.currentLocalsMap()),e},_r.prototype.setupUnhandledCapture=function(){(this.options.captureUncaught||this.options.handleUncaughtExceptions)&&this.handleUncaughtExceptions(),(this.options.captureUnhandledRejections||this.options.handleUnhandledRejections)&&this.handleUnhandledRejections()},_r.prototype.handleUncaughtExceptions=function(){var t=Boolean(this.options.exitOnUncaughtException);delete this.options.exitOnUncaughtException,Ir("uncaughtException",function(e){(this.options.captureUncaught||this.options.handleUncaughtExceptions)&&(this._uncaughtError(e,function(t){t&&(et.error("Encountered error while handling an uncaught exception."),et.error(t))}),t&&setImmediate(function(){this.wait(function(){process.exit(1)})}.bind(this)))}.bind(this))},_r.prototype.handleUnhandledRejections=function(){Ir("unhandledRejection",function(t){(this.options.captureUnhandledRejections||this.options.handleUnhandledRejections)&&this._uncaughtError(t,function(t){t&&(et.error("Encountered error while handling an uncaught exception."),et.error(t))})}.bind(this))},o.inherits(Tr,Error),_r.Error=Tr,_r.defaultOptions={host:r.hostname(),environment:"production",framework:"node-js",showReportedMessageTraces:!1,notifier:{name:"node_rollbar",version:V},scrubHeaders:he,scrubFields:me,addRequestData:null,reportLevel:X,verbose:!1,enabled:!0,transmit:!0,sendConfig:!1,includeItemsInTelemetry:!1,captureEmail:!1,captureUsername:!1,captureIp:!0,captureLambdaTimeouts:!0,ignoreDuplicateErrors:!0,scrubRequestBody:!0,autoInstrument:!1};const jr=_r;module.exports=e.default})();
|