UNPKG

sentry-javascript

Version:

A generic Javascript SDK based on Self-Hosted Sentry.

2 lines (1 loc) 28.6 kB
function _defineProperty(e,t,r){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _toPropertyKey(e){var t=_toPrimitive(e,"string");return"symbol"===_typeof(t)?t:String(t)}function _toPrimitive(e,t){if("object"!==_typeof(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==_typeof(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function _regeneratorRuntime(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */_regeneratorRuntime=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n=Object.defineProperty||function(e,t,r){e[t]=r.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",i=o.asyncIterator||"@@asyncIterator",s=o.toStringTag||"@@toStringTag";function u(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,r){return e[t]=r}}function c(e,t,r,o){var a=t&&t.prototype instanceof p?t:p,i=Object.create(a.prototype),s=new k(o||[]);return n(i,"_invoke",{value:O(e,r,s)}),i}function l(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=c;var f={};function p(){}function d(){}function v(){}var h={};u(h,a,(function(){return this}));var m=Object.getPrototypeOf,g=m&&m(m(E([])));g&&g!==t&&r.call(g,a)&&(h=g);var y=v.prototype=p.prototype=Object.create(h);function b(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function w(e,t){function o(n,a,i,s){var u=l(e[n],e,a);if("throw"!==u.type){var c=u.arg,f=c.value;return f&&"object"==_typeof(f)&&r.call(f,"__await")?t.resolve(f.__await).then((function(e){o("next",e,i,s)}),(function(e){o("throw",e,i,s)})):t.resolve(f).then((function(e){c.value=e,i(c)}),(function(e){return o("throw",e,i,s)}))}s(u.arg)}var a;n(this,"_invoke",{value:function(e,r){function n(){return new t((function(t,n){o(e,r,t,n)}))}return a=a?a.then(n,n):n()}})}function O(e,t,r){var n="suspendedStart";return function(o,a){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw a;return N()}for(r.method=o,r.arg=a;;){var i=r.delegate;if(i){var s=x(i,r);if(s){if(s===f)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=l(e,t,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===f)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}function x(e,t){var r=t.method,n=e.iterator[r];if(void 0===n)return t.delegate=null,"throw"===r&&e.iterator.return&&(t.method="return",t.arg=void 0,x(e,t),"throw"===t.method)||"return"!==r&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+r+"' method")),f;var o=l(n,e.iterator,t.arg);if("throw"===o.type)return t.method="throw",t.arg=o.arg,t.delegate=null,f;var a=o.arg;return a?a.done?(t[e.resultName]=a.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,f):a:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,f)}function _(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function j(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function k(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(_,this),this.reset(!0)}function E(e){if(e){var t=e[a];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,o=function t(){for(;++n<e.length;)if(r.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return o.next=o}}return{next:N}}function N(){return{value:void 0,done:!0}}return d.prototype=v,n(y,"constructor",{value:v,configurable:!0}),n(v,"constructor",{value:d,configurable:!0}),d.displayName=u(v,s,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===d||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,v):(e.__proto__=v,u(e,s,"GeneratorFunction")),e.prototype=Object.create(y),e},e.awrap=function(e){return{__await:e}},b(w.prototype),u(w.prototype,i,(function(){return this})),e.AsyncIterator=w,e.async=function(t,r,n,o,a){void 0===a&&(a=Promise);var i=new w(c(t,r,n,o),a);return e.isGeneratorFunction(r)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},b(y),u(y,s,"Generator"),u(y,a,(function(){return this})),u(y,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},e.values=E,k.prototype={constructor:k,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(j),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(r,n){return i.type="throw",i.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],i=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var s=r.call(a,"catchLoc"),u=r.call(a,"finallyLoc");if(s&&u){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=e,i.arg=t,a?(this.method="next",this.next=a.finallyLoc,f):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),f},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),j(r),f}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;j(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:E(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},e}function _toConsumableArray(e){return _arrayWithoutHoles(e)||_iterableToArray(e)||_unsupportedIterableToArray(e)||_nonIterableSpread()}function _nonIterableSpread(){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 _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(e,t):void 0}}function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function _typeof(e){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof(e)}var Sentry=function(e){"use strict";var t;function r(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]])}return r}function n(e,t,r,n){return new(r||(r=Promise))((function(o,a){function i(e){try{u(n.next(e))}catch(e){a(e)}}function s(e){try{u(n.throw(e))}catch(e){a(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,s)}u((n=n.apply(e,t||[])).next())}))}var o=["log","debug","info","error","warn"],a="sentry-javascript";function i(e,t){var r=t&&o.includes(t)?t:"log";console.hasOwnProperty(r)?console[r]('Module "'.concat(a,'" ').concat(r," message => ").concat(e)):console.log('Module "'.concat(a,'" debug message => ').concat(e))}var s=function(e){return"object"===_typeof(e)&&null!==e&&!Array.isArray(e)};function u(e){for(var t=new WeakSet,r=function e(r,n){if("object"!==_typeof(r)||"object"!==_typeof(n))return n;if(t.has(n))return n;t.add(n);var o=Array.isArray(r)?_toConsumableArray(r):Object.assign({},r);if(Array.isArray(n))for(var a=0;a<n.length;a++)o[a]=a in r?e(r[a],n[a]):n[a];else for(var i in n){var s=n[i],u=o[i];o[i]="object"===_typeof(s)&&null!==s&&"object"===_typeof(u)&&null!==u?e(u,s):s}return t.delete(n),o},n=arguments.length,o=new Array(n>1?n-1:0),a=1;a<n;a++)o[a-1]=arguments[a];return o.forEach((function(t){e=r(e,t)})),e}var c=1024,l=Math.pow(c,2),f=Math.pow(c,3),p=20*l,d=function(e){return new Blob([e]).size},v=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:p;return d(e)>t};function h(){if(!window.fetch)return!1;try{return new Headers,new Request(""),new Response,(e=window.fetch)&&/^function fetch\(\)\s+\{\s+\[native code\]\s+\}$/.test(e.toString())}catch(e){return!1}var e}var m=200,g=400,y=500,b=413,w=[g,429],O=10001,x=1,_=1e3;function j(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return n(this,void 0,void 0,_regeneratorRuntime().mark((function o(){var a,i,s,u,c,l=this;return _regeneratorRuntime().wrap((function(o){for(;;)switch(o.prev=o.next){case 0:return a=0,i="number"==typeof r.maxRetries?r.maxRetries:x,s="number"==typeof r.retryDelay?r.retryDelay:_,u=function(){return n(l,void 0,void 0,_regeneratorRuntime().mark((function r(){return _regeneratorRuntime().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.abrupt("return",fetch(e,t).then((function(e){if(!e.ok){var t=new Error("Failed with status ".concat(e.status));throw t.status=e.status,t}return e.json()})));case 1:case"end":return r.stop()}}),r)})))},c=function t(){return n(l,void 0,void 0,_regeneratorRuntime().mark((function r(){return _regeneratorRuntime().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(!(++a<=i)){r.next=5;break}return r.abrupt("return",new Promise((function(e){setTimeout((function(){e(u())}),s)})).then((function(e){return e})).catch((function(){return t()})));case 5:throw new Error("Max retries (".concat(i,") exceeded for ").concat(e));case 6:case"end":return r.stop()}}),r)})))},o.abrupt("return",u().catch((function(e){if(e.status&&w.includes(e.status))throw e;return c()})));case 6:case"end":return o.stop()}}),o)})))}var k=["GET","POST","HEAD","PUT","OPTIONS","DELETE","CONNECT"];function E(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return n(this,void 0,void 0,_regeneratorRuntime().mark((function o(){var a,i,u,c,l,f,p,d,v=this;return _regeneratorRuntime().wrap((function(o){for(;;)switch(o.prev=o.next){case 0:return a=0,i="number"==typeof r.maxRetries?r.maxRetries:x,u="number"==typeof r.retryDelay?r.retryDelay:_,c=s(t.headers)?t.headers:{},l=t.body,f="string"==typeof t.method&&k.includes(t.method)?t.method:"GET",p=function(){return n(v,void 0,void 0,_regeneratorRuntime().mark((function t(){return _regeneratorRuntime().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",new Promise((function(t,r){var n=new XMLHttpRequest;for(var o in n.onerror=function(e){return r(e)},n.onload=function(){if(4===n.readyState&&n.status===m&&n.response){var e=JSON.parse(n.response);t(e)}else{var o=new Error("Failed with status ".concat(n.status));o.status=n.status,r(o)}},n.open(f,e),c)Object.prototype.hasOwnProperty.call(c,o)&&n.setRequestHeader(o,c[o]);n.send(l)})));case 1:case"end":return t.stop()}}),t)})))},d=function t(){return n(v,void 0,void 0,_regeneratorRuntime().mark((function r(){return _regeneratorRuntime().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(!(++a<=i)){r.next=5;break}return r.abrupt("return",new Promise((function(e){setTimeout((function(){e(p())}),u)})).then((function(e){return e})).catch((function(){return t()})));case 5:throw new Error("Max retries (".concat(i,") exceeded for ").concat(e));case 6:case"end":return r.stop()}}),r)})))},o.abrupt("return",p().catch((function(e){if(e.status&&w.includes(e.status))throw e;return d()})));case 9:case"end":return o.stop()}}),o)})))}function N(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return n(this,void 0,void 0,_regeneratorRuntime().mark((function n(){return _regeneratorRuntime().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.abrupt("return",h()?j(e,t,r):E(e,t,r));case 1:case"end":return n.stop()}}),n)})))}var S=(_defineProperty(t={},g,"Bad Request"),_defineProperty(t,429,"Too Many Requests"),_defineProperty(t,y,"Internal Server Error"),_defineProperty(t,b,"The current size of the log to be uploaded has exceeded the ".concat(function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return"number"!=typeof e||e<=0?"":e>f?"".concat((e/f).toFixed(t),"G"):e>l?"".concat((e/l).toFixed(t),"M"):e>c?"".concat((e/c).toFixed(t),"K"):"".concat(e,"B")}(p)," limit")),_defineProperty(t,O,"Log uploading is disabled"),t);function T(e){return{code:g,data:null,message:e||S[g]}}function L(e){var t=S[e];return t?{code:e,data:null,message:t}:T()}function P(e){return{code:0,data:e,message:""}}function A(e){var t={code:y,data:null,message:S[y]};if(e.status&&"number"==typeof e.status&&e.status<1e3){var r=S[e.status];r&&(t.code=e.status,t.message=r)}return t}"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;var R,I,M,F,B,$={},q={},G={get exports(){return q},set exports(e){q=e}};function C(){return R||(R=1,G.exports=function(){function e(e){return!isNaN(parseFloat(e))&&isFinite(e)}function t(e){return e.charAt(0).toUpperCase()+e.substring(1)}function r(e){return function(){return this[e]}}var n=["isConstructor","isEval","isNative","isToplevel"],o=["columnNumber","lineNumber"],a=["fileName","functionName","source"],i=["args"],s=["evalOrigin"],u=n.concat(o,a,i,s);function c(e){if(e)for(var r=0;r<u.length;r++)void 0!==e[u[r]]&&this["set"+t(u[r])](e[u[r]])}c.prototype={getArgs:function(){return this.args},setArgs:function(e){if("[object Array]"!==Object.prototype.toString.call(e))throw new TypeError("Args must be an Array");this.args=e},getEvalOrigin:function(){return this.evalOrigin},setEvalOrigin:function(e){if(e instanceof c)this.evalOrigin=e;else{if(!(e instanceof Object))throw new TypeError("Eval Origin must be an Object or StackFrame");this.evalOrigin=new c(e)}},toString:function(){var e=this.getFileName()||"",t=this.getLineNumber()||"",r=this.getColumnNumber()||"",n=this.getFunctionName()||"";return this.getIsEval()?e?"[eval] ("+e+":"+t+":"+r+")":"[eval]:"+t+":"+r:n?n+" ("+e+":"+t+":"+r+")":e+":"+t+":"+r}},c.fromString=function(e){var t=e.indexOf("("),r=e.lastIndexOf(")"),n=e.substring(0,t),o=e.substring(t+1,r).split(","),a=e.substring(r+1);if(0===a.indexOf("@"))var i=/@(.+?)(?::(\d+))?(?::(\d+))?$/.exec(a,""),s=i[1],u=i[2],l=i[3];return new c({functionName:n,args:o||void 0,fileName:s,lineNumber:u||void 0,columnNumber:l||void 0})};for(var l=0;l<n.length;l++)c.prototype["get"+t(n[l])]=r(n[l]),c.prototype["set"+t(n[l])]=function(e){return function(t){this[e]=Boolean(t)}}(n[l]);for(var f=0;f<o.length;f++)c.prototype["get"+t(o[f])]=r(o[f]),c.prototype["set"+t(o[f])]=function(t){return function(r){if(!e(r))throw new TypeError(t+" must be a Number");this[t]=Number(r)}}(o[f]);for(var p=0;p<a.length;p++)c.prototype["get"+t(a[p])]=r(a[p]),c.prototype["set"+t(a[p])]=function(e){return function(t){this[e]=String(t)}}(a[p]);return c}()),q}({get exports(){return $},set exports(e){$=e}}).exports=(I=C(),M=/(^|@)\S+:\d+/,F=/^\s*at .*(\S+:\d+|\(native\))/m,B=/^(eval@)?(\[native code])?$/,{parse:function(e){if(void 0!==e.stacktrace||void 0!==e["opera#sourceloc"])return this.parseOpera(e);if(e.stack&&e.stack.match(F))return this.parseV8OrIE(e);if(e.stack)return this.parseFFOrSafari(e);throw new Error("Cannot parse given Error object")},extractLocation:function(e){if(-1===e.indexOf(":"))return[e];var t=/(.+?)(?::(\d+))?(?::(\d+))?$/.exec(e.replace(/[()]/g,""));return[t[1],t[2]||void 0,t[3]||void 0]},parseV8OrIE:function(e){return e.stack.split("\n").filter((function(e){return!!e.match(F)}),this).map((function(e){e.indexOf("(eval ")>-1&&(e=e.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(,.*$)/g,""));var t=e.replace(/^\s+/,"").replace(/\(eval code/g,"(").replace(/^.*?\s+/,""),r=t.match(/ (\(.+\)$)/);t=r?t.replace(r[0],""):t;var n=this.extractLocation(r?r[1]:t),o=r&&t||void 0,a=["eval","<anonymous>"].indexOf(n[0])>-1?void 0:n[0];return new I({functionName:o,fileName:a,lineNumber:n[1],columnNumber:n[2],source:e})}),this)},parseFFOrSafari:function(e){return e.stack.split("\n").filter((function(e){return!e.match(B)}),this).map((function(e){if(e.indexOf(" > eval")>-1&&(e=e.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,":$1")),-1===e.indexOf("@")&&-1===e.indexOf(":"))return new I({functionName:e});var t=/((.*".+"[^@]*)?[^@]*)(?:@)/,r=e.match(t),n=r&&r[1]?r[1]:void 0,o=this.extractLocation(e.replace(t,""));return new I({functionName:n,fileName:o[0],lineNumber:o[1],columnNumber:o[2],source:e})}),this)},parseOpera:function(e){return!e.stacktrace||e.message.indexOf("\n")>-1&&e.message.split("\n").length>e.stacktrace.split("\n").length?this.parseOpera9(e):e.stack?this.parseOpera11(e):this.parseOpera10(e)},parseOpera9:function(e){for(var t=/Line (\d+).*script (?:in )?(\S+)/i,r=e.message.split("\n"),n=[],o=2,a=r.length;o<a;o+=2){var i=t.exec(r[o]);i&&n.push(new I({fileName:i[2],lineNumber:i[1],source:r[o]}))}return n},parseOpera10:function(e){for(var t=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,r=e.stacktrace.split("\n"),n=[],o=0,a=r.length;o<a;o+=2){var i=t.exec(r[o]);i&&n.push(new I({functionName:i[3]||void 0,fileName:i[2],lineNumber:i[1],source:r[o]}))}return n},parseOpera11:function(e){return e.stack.split("\n").filter((function(e){return!!e.match(M)&&!e.match(/^Error created at/)}),this).map((function(e){var t,r=e.split("@"),n=this.extractLocation(r.pop()),o=r.shift()||"",a=o.replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^)]*\)/g,"")||void 0;o.match(/\(([^)]*)\)/)&&(t=o.replace(/^[^(]+\(([^)]*)\)$/,"$1"));var i=void 0===t||"[arguments not available]"===t?void 0:t.split(",");return new I({functionName:a,args:i,fileName:n[0],lineNumber:n[1],columnNumber:n[2],source:e})}),this)}});var D=$,H=["fatal","error","warning","info","debug"],U=["default","debug","error","navigation","http","info","query","user"],J=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+))?@)([\w.-]+)(?::(\d+))?\/(.+)/,K=/^.+@\d+\.\d+\.\d+$/,W="1.0.1",z="sentry.javascript.browser",V={dsn:"",enabled:!0,debug:!1,platform:"javascript",level:"error",serverName:window.location.hostname,environment:"production",envelope:!0,release:""},Y={ip_address:"{{auto}}"},X=Object.assign({},Y),Q={},Z={},ee="",te=[];function re(){return{method:"GET",url:window.location.href,headers:{Referer:window.document.referrer,"User-Agent":window.navigator.userAgent}}}function ne(e){"object"===_typeof(e)?X=e?Object.assign(Object.assign({},X),e):Object.assign({},Y):V.debug&&i('Method "setUser" must pass a object parameter, please check again!',"error")}function oe(e,t){"string"==typeof e&&"string"==typeof t?Q[e]=t:V.debug&&i('Method "setTag" must pass two string parameter, please check again!',"error")}function ae(e){"string"==typeof e?delete Q[e]:V.debug&&i('The parameter "key" of method "removeTag" must pass a string value, please check again!',"error")}function ie(e,t){"string"==typeof e?Z[e]=t:V.debug&&i('The parameter "key" of method "setExtra" must pass a string value, please check again!',"error")}function se(e){"string"==typeof e?delete Z[e]:V.debug&&i('The parameter "key" of method "removeExtra" must pass a string value, please check again!',"error")}function ue(e){H.includes(e)?ee=e:V.debug&&i('The parameter "level" of method "setLevel" must pass a valid string value, please check again!',"error")}function ce(e){if(s(e)){var t=e.type,r=void 0===t?"default":t,n=e.category,o=void 0===n?"":n,a=e.message,u=void 0===a?"":a,c=e.data,l=void 0===c?null:c,f=e.level,p=void 0===f?"info":f,d=e.timestamp,v=void 0===d?(new Date).toISOString():d;void 0===r||"string"==typeof r&&U.includes(r)?["undefined","string"].includes(_typeof(o))?["undefined","string"].includes(_typeof(u))?["undefined","object"].includes(_typeof(l))?void 0===p||"string"==typeof p&&H.includes(p)?["undefined","string","number"].includes(_typeof(v))?te.push({type:r,category:o,message:u,data:l,level:p,timestamp:v}):V.debug&&i('The option parameter "timestamp" in the method "addBreadcrumb" must be a valid string or number value, please check again!',"error"):V.debug&&i('The option parameter "level" in the method "addBreadcrumb" must be a valid string value, please check again!',"error"):V.debug&&i('The option parameter "data" in the method "addBreadcrumb" must be a object value, please check again!',"error"):V.debug&&i('The option parameter "message" in the method "addBreadcrumb" must be a string value, please check again!',"error"):V.debug&&i('The option parameter "category" in the method "addBreadcrumb" must be a string value, please check again!',"error"):V.debug&&i('The option parameter "type" in the method "addBreadcrumb" must be a valid string value, please check again!',"error")}else V.debug&&i('Method "addBreadcrumb" must pass a object value, please check again!',"error")}function le(){te=[]}function fe(){ee="",X=Object.assign({},Y),Q={},Z={},le()}function pe(){var e,t,r,n,o,a,i,s=V.envelope?"envelope":"store",u=(e=J.exec(V.dsn),t=e?e.slice(1):[],r=t[0],n=t[1],o=t[3],a=t[4]||"",i=t[5],{uri:"".concat(r,"://").concat(o).concat(a,"/api/"),publicKey:n,projectId:i});return"".concat(u.uri).concat(u.projectId,"/").concat(s,"/?sentry_version=7&sentry_client=").concat(z).concat(W,"&sentry_key=").concat(u.publicKey)}function de(e){return Array.isArray(e)&&e.length>0?e:te}function ve(e){var t=e.user,n=void 0===t?{}:t,o=e.request,a=void 0===o?{}:o,i=e.tags,s=void 0===i?{}:i,c=e.extra,l=void 0===c?{}:c,f=e.breadcrumbs,p=void 0===f?[]:f,d=e.level,v=r(e,["user","request","tags","extra","breadcrumbs","level"]),h=Object.assign({platform:V.platform,level:"string"==typeof d&&H.includes(d)?d:ee||V.level,server_name:V.serverName,environment:V.environment,release:V.release,timestamp:(new Date).toISOString(),user:Object.assign(Object.assign({},X),n),sdk:{name:z,version:W},request:u(re(),a),tags:Object.assign(Object.assign({},Q),s),extra:u(Z,l),breadcrumbs:de(p)},v);return{url:pe(),headers:{Accept:"application/json","Content-Type":"application/json"},payload:JSON.stringify(h)}}function he(e){var t=e.user,n=void 0===t?{}:t,o=e.request,a=void 0===o?{}:o,i=e.tags,s=void 0===i?{}:i,c=e.extra,l=void 0===c?{}:c,f=e.breadcrumbs,p=void 0===f?[]:f,d=e.type,v=void 0===d?"event":d,h=e.level,m=e.event_id,g=void 0===m?"":m,y=r(e,["user","request","tags","extra","breadcrumbs","type","level","event_id"]),b=Object.assign({platform:V.platform,level:"string"==typeof h&&H.includes(h)?h:ee||V.level,server_name:V.serverName,environment:V.environment,release:V.release,type:v,user:Object.assign(Object.assign({},X),n),request:u(re(),a),tags:Object.assign(Object.assign({},Q),s),extra:u(Z,l),breadcrumbs:de(p)},y),w=Object.assign({sent_at:(new Date).toISOString(),sdk:{name:z,version:W}},g&&{event_id:g}),O={type:v},x=JSON.stringify(w)+"\n"+JSON.stringify(O)+"\n"+JSON.stringify(b)+"\n";return{url:pe(),headers:{},payload:x}}function me(e){return n(this,void 0,void 0,_regeneratorRuntime().mark((function t(){var r,n,o,a,s;return _regeneratorRuntime().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=V.envelope?he(e):ve(e),n=r.url,o=r.headers,a=r.payload,!v(a)){t.next=8;break}return s=L(b),V.debug&&i(s.message,"error"),t.abrupt("return",Promise.resolve(s));case 8:return t.abrupt("return",N(n,{method:"POST",headers:o,body:a}).then(P).catch(A));case 9:case"end":return t.stop()}}),t)})))}return e.captureException=function(e,t){if(!V.dsn){var n='Please check if the "init" method was called!';return V.debug&&i(n,"error"),Promise.resolve(T(n))}if(!V.enabled){var o=L(O);return V.debug&&i(o.message,"warn"),Promise.resolve(o)}if("object"!==_typeof(e)||!(e instanceof Error)){var a='Method "captureException" must pass a stantard instance of Error class on parameter "err", please check again!';return V.debug&&i(a,"error"),Promise.resolve(T(a))}var u=D.parse(e),c=[];u.length>0&&(c=u.map((function(e){return{function:e.functionName||"",filename:e.fileName||"",abs_path:e.fileName||"",lineno:e.lineNumber,colno:e.columnNumber,in_app:!0}})));var l={values:[{type:e.name,value:e.message,stacktrace:{frames:c}}]};if(void 0===t)return me({exception:l});if(!s(t)){var f='Method "captureException" must pass a object value on parameter "options", please check again!';return V.debug&&i(f,"error"),Promise.resolve(T(f))}var p=t.exception,d=void 0===p?{}:p,v=r(t,["exception"]);return me(Object.assign({exception:Object.assign(Object.assign({},l),d)},v))},e.captureMessage=function(e,t){if(!V.dsn){var n='Please check if the "init" method was called!';return V.debug&&i(n,"error"),Promise.resolve(T(n))}if(!V.enabled){var o=L(O);return V.debug&&i(o.message,"warn"),Promise.resolve(o)}if("string"!=typeof e||""===e){var a='Method "captureMessage" must pass a valid string value on parameter "message", please check again!';return V.debug&&i(a,"error"),Promise.resolve(T(a))}var u={level:ee||"info"};if(void 0===t)return me(Object.assign({message:e},u));if("string"==typeof t)return H.includes(t)&&(u.level=t),me(Object.assign({message:e},u));if(!s(t)){var c='Method "captureMessage" must pass a string or object value on parameter "options", please check again!';return V.debug&&i(c,"error"),Promise.resolve(T(c))}var l=t.message,f=void 0===l?e:l,p=r(t,["message"]);return me(Object.assign(Object.assign({message:f},u),p))},e.configureScope=function(e){"function"==typeof e?e({setUser:ne,setTag:oe,removeTag:ae,setExtra:ie,removeExtra:se,setLevel:ue,addBreadcrumb:ce,clearBreadcrumbs:le,clear:fe}):V.debug&&i('Method "configureScope" must pass a function value on parameter "callback", please check again!',"error")},e.init=function(e){if(s(e))if("string"==typeof e.dsn)if(J.test(e.dsn)){if(V.dsn=e.dsn,"boolean"==typeof e.enabled&&(V.enabled=e.enabled),"boolean"==typeof e.envelope&&(V.envelope=e.envelope),"boolean"==typeof e.debug&&(V.debug=e.debug),"string"==typeof e.environment&&(V.environment=e.environment),"string"==typeof e.release){if(!K.test(e.release))return void(V.debug&&i('The option parameter "release" in the method "init" must be a string in the format "my-project-name@1.0.0", please check again!',"error"));V.release=e.release}}else V.debug&&i('"dsn" must be a valid value, please check again!',"error");else V.debug&&i('Method "init" must pass the value of "dsn" on options params, please check again!',"error");else V.debug&&i('Method "init" must pass a object value, please check again!',"error")},e}({});