Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@honeybadger-io/js

Package Overview
Dependencies
Maintainers
8
Versions
99
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@honeybadger-io/js - npm Package Compare versions

Comparing version 4.0.3 to 4.0.4

2

dist/browser/honeybadger.min.js

@@ -1,2 +0,2 @@

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).Honeybadger=e()}(this,function(){"use strict";var r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(t,e)};var n=function(){return(n=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)};function t(t,a,c,s){return new(c=c||Promise)(function(n,e){function r(t){try{i(s.next(t))}catch(t){e(t)}}function o(t){try{i(s.throw(t))}catch(t){e(t)}}function i(t){var e;t.done?n(t.value):((e=t.value)instanceof c?e:new c(function(t){t(e)})).then(r,o)}i((s=s.apply(t,a||[])).next())})}function c(n,r){var o,i,a,c={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},t={next:e(0),throw:e(1),return:e(2)};return"function"==typeof Symbol&&(t[Symbol.iterator]=function(){return this}),t;function e(e){return function(t){return function(e){if(o)throw new TypeError("Generator is already executing.");for(;c;)try{if(o=1,i&&(a=2&e[0]?i.return:e[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,e[1])).done)return a;switch(i=0,a&&(e=[2&e[0],a.value]),e[0]){case 0:case 1:a=e;break;case 4:return c.label++,{value:e[1],done:!1};case 5:c.label++,i=e[1],e=[0];continue;case 7:e=c.ops.pop(),c.trys.pop();continue;default:if(!(a=0<(a=c.trys).length&&a[a.length-1])&&(6===e[0]||2===e[0])){c=0;continue}if(3===e[0]&&(!a||e[1]>a[0]&&e[1]<a[3])){c.label=e[1];break}if(6===e[0]&&c.label<a[1]){c.label=a[1],a=e;break}if(a&&c.label<a[2]){c.label=a[2],c.ops.push(e);break}a[2]&&c.ops.pop(),c.trys.pop();continue}e=r.call(n,c)}catch(t){e=[6,t],i=0}finally{o=a=0}if(5&e[0])throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}([e,t])}}}var o="<unknown>";function a(t){return t.split("\n").reduce(function(t,e){e=function(t){var e=i.exec(t);if(!e)return null;var n=e[2]&&0===e[2].indexOf("native"),r=e[2]&&0===e[2].indexOf("eval"),t=s.exec(e[2]);r&&null!=t&&(e[2]=t[1],e[3]=t[2],e[4]=t[3]);return{file:n?null:e[2],methodName:e[1]||o,arguments:n?[e[2]]:[],lineNumber:e[3]?+e[3]:null,column:e[4]?+e[4]:null}}(e)||function(t){t=u.exec(t);return t?{file:t[2],methodName:t[1]||o,arguments:[],lineNumber:+t[3],column:t[4]?+t[4]:null}:null}(e)||function(t){var e=f.exec(t);if(!e)return null;var n=e[3]&&-1<e[3].indexOf(" > eval"),t=l.exec(e[3]);n&&null!=t&&(e[3]=t[1],e[4]=t[2],e[5]=null);return{file:e[3],methodName:e[1]||o,arguments:e[2]?e[2].split(","):[],lineNumber:e[4]?+e[4]:null,column:e[5]?+e[5]:null}}(e)||function(t){t=p.exec(t);return t?{file:t[2],methodName:t[1]||o,arguments:[],lineNumber:+t[3],column:t[4]?+t[4]:null}:null}(e)||function(t){t=d.exec(t);return t?{file:t[3],methodName:t[1]||o,arguments:[],lineNumber:+t[4],column:t[5]?+t[5]:null}:null}(e);return e&&t.push(e),t},[])}var i=/^\s*at (.*?) ?\(((?:file|https?|blob|chrome-extension|native|eval|webpack|<anonymous>|\/|[a-z]:\\|\\\\).*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,s=/\((\S*)(?::(\d+))(?::(\d+))\)/;var u=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i;var f=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)((?:file|https?|blob|chrome|webpack|resource|\[native).*?|[^@]*bundle)(?::(\d+))?(?::(\d+))?\s*$/i,l=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i;var d=/^\s*(?:([^@]*)(?:\((.*?)\))?@)?(\S.*?):(\d+)(?::(\d+))?\s*$/i;var p=/^\s*at (?:((?:\[object object\])?[^\\/]+(?: \[as \S+\])?) )?\(?(.*?):(\d+)(?::(\d+))?\)?\s*$/i;function h(t,e){var n,r={};for(n in t)r[n]=t[n];for(n in e)r[n]=e[n];return r}function g(t,e){var n=h(t,e);return t.context&&e.context&&(n.context=h(t.context,e.context)),n}function m(i,a){return t(this,void 0,void 0,function(){var e,n,r,o;return c(this,function(t){switch(t.label){case 0:if(e=[],!a||!i||!i.length)return[2,e];n=0,t.label=1;case 1:return i.length?(r=i.splice(0)[n],[4,a(r.file)]):[3,3];case 2:return o=t.sent(),e[n]=function(t,e,n){void 0===n&&(n=2);if(!t)return null;var r=t.split("\n");r.unshift("");for(var o=e+n,i={},a=e-n;a<=o;a++){var c=r[a];"string"==typeof c&&(i[a]=c)}return i}(o,r.number),n++,[3,1];case 3:return[2,e]}})})}function y(t,e,n){t&&t.afterNotify&&t.afterNotify(n,t);for(var r=0,o=e.length;r<o;r++)e[r](n,t);return 1}function b(t){if("object"!=typeof t||null===t)return{};var e,n={};for(e in t)n[e]=t[e];return n}function v(t,c){void 0===c&&(c=8);var s=[];function n(t,e){if(void 0===e&&(e=0),c<=e)return"[DEPTH]";if(!(/function/.test(r=typeof(n=t))?"toJSON"===n.name:!/symbol/.test(r)&&(null!==n&&("object"!=typeof n||void 0!==n.hasOwnProperty))))return Object.prototype.toString.call(t);var n,r;if(function(t){if(t&&"object"==typeof t){for(var e=0;e<s.length;e++)if(s[e]===t)return 1;s.push(t)}}(t))return"[RECURSION]";if(Array.isArray(t))return t.map(function(t){return u(t,e+1)});if("object"!=typeof t)return t;var o,i={};for(o in t){var a=t[o];Object.prototype.hasOwnProperty.call(t,o)&&null!=o&&null!=a&&(i[o]=u(a,e+1))}return i}function u(t,e){void 0===e&&(e=0);try{return n(t,e)}catch(t){return"[ERROR] ".concat(t)}}return u(t)}function _(o){function t(r){return function(){for(var t,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];if("debug"===r){if(!o.config.debug)return;r="log"}e.unshift("[Honeybadger]"),(t=o.config.logger)[r].apply(t,e)}}return{log:t("log"),info:t("info"),debug:t("debug"),warn:t("warn"),error:t("error")}}function w(t){return t?t instanceof Error||"[object Error]"===Object.prototype.toString.call(t)?h(t,{name:t.name,message:t.message,stack:t.stack}):"object"==typeof t?b(t):{message:String(t)}:{}}function E(t,e,n){if(t&&e&&n&&e in t){for(var r=t[e];r&&r.__hb_original;)r=r.__hb_original;try{t[e]=n(r),t[e].__hb_original=r}catch(t){}}}function x(t,o){if(j("Object",t)){j("Array",o)||(o=[]);var i=[];return function t(e){var n,r;if(j("Object",e)||j("Array",e)){if(-1!==i.indexOf(e))return"[CIRCULAR DATA STRUCTURE]";i.push(e)}if(j("Object",e)){for(n in r={},e)k(n,o)?r[n]="[FILTERED]":r[n]=t(e[n]);return r}return j("Array",e)?e.map(t):j("Function",e)?"[FUNC]":e}(t)}}function k(t,e){for(var n=0;n<e.length;n++)if(-1!==t.toLowerCase().indexOf(e[n].toLowerCase()))return 1}function j(t,e){var n=Object.prototype.toString.call(e).slice(8,-1);return null!=e&&n===t}var N=(e.prototype.getStore=function(){return this.store},e.prototype.run=function(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return this.store=t,e.apply(void 0,n)},e);function e(t){this.store=t}var S={name:"honeybadger-js",url:"https://github.com/honeybadger-io/honeybadger-js",version:"4.0.3"},O=/,|\s+/,T=/\S/,R=(C.prototype.getVersion=function(){return S.version},C.prototype.configure=function(t){var e,n=this;for(e in void 0===t&&(t={}),t)this.config[e]=t[e];return this.__pluginsExecuted||(this.__pluginsExecuted=!0,this.config.__plugins.forEach(function(t){return t.load(n)})),this},C.prototype.__setStore=function(t){this.__store=t},C.prototype.beforeNotify=function(t){return this.__beforeNotifyHandlers.push(t),this},C.prototype.afterNotify=function(t){return this.__afterNotifyHandlers.push(t),this},C.prototype.setContext=function(t){var e;return"object"==typeof t&&((e=this.__store.getStore()).context=h(e.context,t)),this},C.prototype.resetContext=function(t){this.logger.warn("Deprecation warning: `Honeybadger.resetContext()` has been deprecated; please use `Honeybadger.clear()` instead.");var e=this.__store.getStore();return e.context="object"==typeof t&&null!==t?t:{},this},C.prototype.clear=function(){var t=this.__store.getStore();return t.context={},t.breadcrumbs=[],this},C.prototype.notify=function(t,e,n){var r=this;void 0===e&&(e=void 0),void 0===n&&(n=void 0);var o=null,i=this.makeNotice(t,e,n);i||(this.logger.debug("failed to build error report"),o=new Error("failed to build error report")),o||!1!==this.config.reportData||(this.logger.debug("skipping error report: honeybadger.js is disabled",i),o=new Error("honeybadger.js is disabled")),!o&&this.__developmentMode()&&(this.logger.log("honeybadger.js is in development mode; the following error report will be sent in production.",i),o=new Error("honeybadger.js is in development mode")),o||this.config.apiKey||(this.logger.warn("could not send error report: no API key has been configured",i),o=new Error("missing API key"));e=i&&i.backtrace?i.backtrace.map(b):null,n=function(t,e){for(var n=!0,r=0,o=e.length;r<o;r++)!1===(0,e[r])(t)&&(n=!1);return n}(i,this.__beforeNotifyHandlers);if(o||n||(this.logger.debug("skipping error report: beforeNotify handlers returned false",i),o=new Error("beforeNotify handlers returned false")),o)return y(i,this.__afterNotifyHandlers,o),!1;this.addBreadcrumb("Honeybadger Notice",{category:"notice",metadata:{message:i.message,name:i.name,stack:i.stack}});o=this.__getStoreContentsOrDefault().breadcrumbs;return i.__breadcrumbs=this.config.breadcrumbsEnabled?o.slice():[],m(e,this.__getSourceFileHandler).then(function(t){t.forEach(function(t,e){i.backtrace[e].source=t});var e,n=r.__buildPayload(i);r.__transport.send({headers:{"X-API-Key":r.config.apiKey,"Content-Type":"application/json",Accept:"text/json, application/json"},method:"POST",endpoint:(e=r.config.endpoint,t="/v1/notices/js",e=e.trim().replace(/\/$/,""),t=t.trim().replace(/(^\/|\/$)/g,""),"".concat(e,"/").concat(t)),maxObjectDepth:r.config.maxObjectDepth,logger:r.logger,async:void 0!==r.config.async?r.config.async:void 0},n).then(function(t){if(201!==t.statusCode)return y(i,r.__afterNotifyHandlers,new Error("Bad HTTP response: ".concat(t.statusCode))),void r.logger.warn("Error report failed: unknown response from server. code=".concat(t.statusCode));t=JSON.parse(t.body).id;y(h(i,{id:t}),r.__afterNotifyHandlers),r.logger.info("Error report sent ⚡ https://app.honeybadger.io/notice/".concat(t))}).catch(function(t){r.logger.error("Error report failed: an unknown error occurred.","message=".concat(t.message)),y(i,r.__afterNotifyHandlers,t)})}),!0},C.prototype.notifyAsync=function(i,a,c){var s=this;return void 0===a&&(a=void 0),void 0===c&&(c=void 0),new Promise(function(e,n){var t,r,o=i.afterNotify?i:a&&a.afterNotify?a:c&&c.afterNotify?c:a&&"object"==typeof a?a:c||(a={});r=(t=o).afterNotify,t.afterNotify=function(t){if(null!=r&&r.call(s,t),t)return n(t);e()},s.notify(i,a,c)})},C.prototype.makeNotice=function(t,e,n){void 0===e&&(e=void 0),void 0===n&&(n=void 0);var r=w(t);if(e&&"object"!=typeof e&&(e={name:String(e)}),e&&(r=g(r,e)),"object"==typeof n&&null!==n&&(r=g(r,n)),function(t){for(var e in t)if(Object.prototype.hasOwnProperty.call(t,e))return;return 1}(r))return null;var o=this.__getStoreContentsOrDefault().context,t=this.__constructTags(r.tags),e=this.__constructTags(o.tags),n=this.__constructTags(this.config.tags),i=t.concat(e).concat(n),e=i.filter(function(t,e){return i.indexOf(t)===e}),n=0;return"string"==typeof(r=h(r,{name:r.name||"Error",context:h(o,r.context),projectRoot:r.projectRoot||this.config.projectRoot,environment:r.environment||this.config.environment,component:r.component||this.config.component,action:r.action||this.config.action,revision:r.revision||this.config.revision,tags:e})).stack&&r.stack.trim()||(r.stack=function(){try{throw new Error("")}catch(t){if(t.stack)return t.stack}for(var t=[],e=arguments.callee;e&&t.length<10;){/function(?:\s+([\w$]+))+\s*\(/.test(e.toString())?t.push(RegExp.$1||"<anonymous>"):t.push("<anonymous>");try{e=e.caller}catch(t){break}}return t.join("\n")}(),n=2),r.backtrace=function(t,e){void 0===e&&(e=0);try{var n=a(t).map(function(t){return{file:t.file,method:t.methodName,number:t.lineNumber,column:t.column}});return n.splice(0,e),n}catch(t){return[]}}(r.stack,n),r},C.prototype.addBreadcrumb=function(t,e){if(this.config.breadcrumbsEnabled){var n=b((e=e||{}).metadata),r=e.category||"custom",o=(new Date).toISOString(),i=this.__store.getStore(),e=i.breadcrumbs;e.push({category:r,message:t,metadata:n,timestamp:o});o=this.config.maxBreadcrumbs;return e.length>o&&(e=e.slice(e.length-o)),i.breadcrumbs=e,this}},C.prototype.__developmentMode=function(){return!0!==this.config.reportData&&(this.config.environment&&this.config.developmentEnvironments.includes(this.config.environment))},C.prototype.__buildPayload=function(t){var e=x(t.headers,this.config.filters)||{},e=x(n(n({},t.cgiData),function(n,r){void 0===r&&(r="");var o={};return Object.keys(n).forEach(function(t){var e=r+t.replace(/\W/g,"_").toUpperCase();o[e]=n[t]}),o}(e,"HTTP_")),this.config.filters);return{notifier:S,breadcrumbs:{enabled:!!this.config.breadcrumbsEnabled,trail:t.__breadcrumbs||[]},error:{class:t.name,message:t.message,backtrace:t.backtrace,fingerprint:t.fingerprint,tags:t.tags},request:{url:function(t,n){if(!n)return t;if("string"!=typeof t)return t;var e=t.split(/\?/,2)[1];if(!e)return t;var r=t;return e.split(/[&]\s?/).forEach(function(t){var e=t.split("=",2),t=e[0],e=e[1];k(t,n)&&(r=r.replace("".concat(t,"=").concat(e),"".concat(t,"=[FILTERED]")))}),r}(t.url,this.config.filters),component:t.component,action:t.action,context:t.context,cgi_data:e,params:x(t.params,this.config.filters)||{},session:x(t.session,this.config.filters)||{}},server:{project_root:t.projectRoot,environment_name:t.environment,revision:t.revision,hostname:this.config.hostname,time:(new Date).toUTCString()},details:t.details||{}}},C.prototype.__constructTags=function(t){return t?t.toString().split(O).filter(function(t){return T.test(t)}):[]},C.prototype.__getStoreContentsOrDefault=function(){var t=this.__store.getStore();return n({context:{},breadcrumbs:[]},t||{})},C);function C(t,e){void 0===t&&(t={}),this.__pluginsExecuted=!1,this.__store=null,this.__beforeNotifyHandlers=[],this.__afterNotifyHandlers=[],this.config=n({apiKey:null,endpoint:"https://api.honeybadger.io",environment:null,hostname:null,projectRoot:null,component:null,action:null,revision:null,reportData:null,breadcrumbsEnabled:!0,maxBreadcrumbs:40,maxObjectDepth:8,logger:console,developmentEnvironments:["dev","development","test"],debug:!1,tags:null,enableUncaught:!0,enableUnhandledRejection:!0,afterUncaught:function(){return!0},filters:["creditcard","password"],__plugins:[]},t),this.__store=new N({context:{},breadcrumbs:[]}),this.__transport=e,this.logger=_(this)}function H(n){if(!n||!n.tagName)return"";var r=n.tagName.toLowerCase();if("html"===r)return"";n.id&&(r+="#".concat(n.id));var t=n.getAttribute("class");t&&t.split(/\s+/).forEach(function(t){r+=".".concat(t)}),["alt","name","title","type"].forEach(function(t){var e=n.getAttribute(t);e&&(r+="[".concat(t,'="').concat(e,'"]'))});t=function(e){try{var t=e.parentNode.childNodes,n=[];return Array.prototype.forEach.call(t,function(t){t.tagName&&t.tagName===e.tagName&&n.push(t)}),n}catch(t){return[]}}(n);return 1<t.length&&(r+=":nth-child(".concat(Array.prototype.indexOf.call(t,n)+1,")")),r}function P(t){var e=t.textContent||t.innerText||"";return e||"submit"!==t.type&&"button"!==t.type||(e=t.value),function(t,e){t.length>e&&(t=t.substr(0,e)+"...");return t}(e.trim(),300)}function A(t){return-1!==t.toString().indexOf("native")}function U(t){t=t.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/)||{};return{protocol:t[2],host:t[4],pathname:t[5]}}function D(t){var e=U(t),t=U(document.URL);return!e.host||!e.protocol||e.protocol===t.protocol&&e.host===t.host?e.pathname:"".concat(e.protocol,"://").concat(e.host).concat(e.pathname)}var L,I=function(){var t=!0;if(window.atob||(t=!1),window.ErrorEvent)try{0===new window.ErrorEvent("").colno&&(t=!1)}catch(t){}return t}(),B=0;var M,q,W,$,F,X,K=(G.prototype.send=function(o,i){return new Promise(function(t,e){try{var n=new XMLHttpRequest;if(n.open(o.method,o.endpoint,o.async),Object.keys(o.headers||[]).length)for(var r in o.headers)void 0!==o.headers[r]&&n.setRequestHeader(r,String(o.headers[r]));n.send(i?JSON.stringify(v(i,o.maxObjectDepth)):void 0),n.onload=function(){return t({statusCode:n.status,body:n.response})}}catch(t){e(t)}})},G);function G(){}function J(t){void 0===t&&(t={});var e=M.call(this,n({async:!0,maxErrors:null,projectRoot:window.location.protocol+"//"+window.location.host},t),new K)||this;return e.__errorsSent=0,e.__lastWrapErr=void 0,e.__beforeNotifyHandlers=[function(t){return e.__exceedsMaxErrors()?(e.logger.debug("Dropping notice: max errors exceeded",t),!1):(t.url||(t.url=document.URL),e.__incrementErrorsCount(),!0)}],e}return new(function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}(J,M=R),J.prototype.configure=function(t){return void 0===t&&(t={}),M.prototype.configure.call(this,t)},J.prototype.resetMaxErrors=function(){return this.__errorsSent=0},J.prototype.factory=function(t){return new J(t)},J.prototype.checkIn=function(t){throw new Error("Honeybadger.checkIn() is not supported on the browser")},J.prototype.__buildPayload=function(t){var e,n,r={HTTP_USER_AGENT:void 0,HTTP_REFERER:void 0,HTTP_COOKIE:void 0};r.HTTP_USER_AGENT=navigator.userAgent,document.referrer.match(/\S/)&&(r.HTTP_REFERER=document.referrer),(e="string"==typeof t.cookies?(e=t.cookies,n={},e.split(/[;,]\s?/).forEach(function(t){var e=t.split("=",2),t=e[0],e=e[1];n[t]=e}),n):t.cookies)&&(r.HTTP_COOKIE=function(t){if("object"==typeof t){var e,n=[];for(e in t)n.push(e+"="+t[e]);return n.join(";")}}(x(e,this.config.filters)));t=M.prototype.__buildPayload.call(this,t);return t.request.cgi_data=h(r,t.request.cgi_data),t},J.prototype.__wrap=function(t,e){void 0===e&&(e={});var n,r,o=t;e=e||{};try{return"function"!=typeof o?o:(r=o,"function"!=typeof Object.isExtensible||Object.isExtensible(r)?(o.___hb||(n=this,o.___hb=function(){if(!I)return o.apply(this,arguments);try{return o.apply(this,arguments)}catch(t){if(n.__lastWrapErr===t)throw t;throw n.__lastWrapErr=t,B+=1,clearTimeout(L),L=setTimeout(function(){B=0}),n.addBreadcrumb(e.component?"".concat(e.component,": ").concat(t.name):t.name,{category:"error",metadata:{message:t.message,name:t.name,stack:t.stack}}),n.config.enableUncaught&&n.notify(t),t}}),o.___hb.___hb=o.___hb,o.___hb):o)}catch(t){return o}},J.prototype.__incrementErrorsCount=function(){return this.__errorsSent++},J.prototype.__exceedsMaxErrors=function(){return this.config.maxErrors&&this.__errorsSent>=this.config.maxErrors},J)({__plugins:[(void 0===X&&(X=window),{load:function(a){E(X,"onerror",function(i){return function(t,e,n,r,o){return function(t,e,n,r,o){if(a.logger.debug("window.onerror callback invoked",arguments),0<B)return a.logger.debug("Ignoring window.onerror (error likely reported earlier)",arguments),--B;0===n&&/Script error\.?/.test(t)?a.config.enableUncaught&&a.logger.warn("Ignoring cross-domain script error: enable CORS to track these types of errors",arguments):((o=w(o)).name||(o.name="window.onerror"),o.message||(o.message=t),o.stack||(o.stack=[o.message,"\n at ? (",e||"unknown",":",n||0,":",r||0,")"].join("")),a.addBreadcrumb("window.onerror"!==o.name&&o.name?"window.onerror: ".concat(o.name):"window.onerror",{category:"error",metadata:{name:o.name,message:o.message,stack:o.stack}}),a.config.enableUncaught&&a.notify(o))}(t,e,n,r,o),"function"==typeof i&&i.apply(window,arguments)}})}}),(void 0===F&&(F=window),{load:function(r){r.config.enableUnhandledRejection&&E(F,"onunhandledrejection",function(e){return function(t){!function(t){if(r.logger.debug("window.onunhandledrejection callback invoked",arguments),r.config.enableUnhandledRejection){var e=t.reason;if(e instanceof Error){t="".concat(e.message,"\n at ? (").concat("unknown",":").concat(0,")"),t=e.stack||t,t={name:e.name,message:"UnhandledPromiseRejectionWarning: ".concat(e),stack:t};return r.addBreadcrumb("window.onunhandledrejection: ".concat(t.name),{category:"error",metadata:t}),r.notify(t)}var n="string"==typeof e?e:null!==(n=JSON.stringify(e))&&void 0!==n?n:"Unspecified reason";r.notify({name:"window.onunhandledrejection",message:"UnhandledPromiseRejectionWarning: ".concat(n)})}}(t),"function"==typeof e&&e.apply(this,arguments)}})}}),(void 0===$&&($=window),{load:function(i){function t(o){return function(r){return function(t,e){if("function"!=typeof t)return r(t,e);var n=Array.prototype.slice.call(arguments,2);return t=i.__wrap(t,o),r(function(){t.apply(void 0,n)},e)}}}E($,"setTimeout",t({component:"setTimeout"})),E($,"setInterval",t({component:"setInterval"}))}}),(void 0===W&&(W=window),{load:function(a){["EventTarget","Window","Node","ApplicationCache","AudioTrackList","ChannelMergerNode","CryptoOperation","EventSource","FileReader","HTMLUnknownElement","IDBDatabase","IDBRequest","IDBTransaction","KeyOperation","MediaController","MessagePort","ModalWindow","Notification","SVGElementInstance","Screen","TextTrack","TextTrackCue","TextTrackList","WebSocket","WebSocketWorker","Worker","XMLHttpRequest","XMLHttpRequestEventTarget","XMLHttpRequestUpload"].forEach(function(t){var e=W[t]&&W[t].prototype;e&&Object.prototype.hasOwnProperty.call(e,"addEventListener")&&(E(e,"addEventListener",function(o){var i={component:"".concat(t,".prototype.addEventListener")};return function(t,e,n,r){try{e&&null!=e.handleEvent&&(e.handleEvent=a.__wrap(e.handleEvent,i))}catch(t){a.logger.error(t)}return o.call(this,t,a.__wrap(e,i),n,r)}}),E(e,"removeEventListener",function(o){return function(t,e,n,r){return o.call(this,t,e,n,r),o.call(this,t,a.__wrap(e),n,r)}}))})}}),(void 0===q&&(q=window),{load:function(a){function t(t){return!0===a.config.breadcrumbsEnabled||(t?!0===a.config.breadcrumbsEnabled[t]:!1!==a.config.breadcrumbsEnabled)}function n(t,e){r=e,a.addBreadcrumb("Page changed",{category:"navigation",metadata:{from:t,to:e}})}function e(e){return function(){var t=2<arguments.length?arguments[2]:void 0;return t&&n(r,String(t)),e.apply(this,arguments)}}var r;t("console")&&["debug","info","warn","error","log"].forEach(function(r){E(q.console,r,function(n){return function(){var t,e=Array.prototype.slice.call(arguments),t=(t=e,Array.isArray(t)?t.map(function(t){try{return String(t)}catch(t){return"[unknown]"}}).join(" "):""),e={category:"log",metadata:{level:r,arguments:v(e,3)}};a.addBreadcrumb(t,e),"function"==typeof n&&Function.prototype.apply.call(n,q.console,arguments)}})}),t("dom")&&q.addEventListener("click",function(t){var e,n,r;try{e=H(t.target),n=function t(e){var n=H(e);if(e.parentNode&&e.parentNode.tagName&&0<(e=t(e.parentNode)).length)return"".concat(e," > ").concat(n);return n}(t.target),r=P(t.target)}catch(t){e="UI Click",r=n="[unknown]"}0!==e.length&&a.addBreadcrumb(e,{category:"ui.click",metadata:{selector:n,text:r,event:t}})},!0),t("network")&&(E(XMLHttpRequest.prototype,"open",function(r){return function(){var t=arguments[1],e="string"==typeof arguments[0]?arguments[0].toUpperCase():arguments[0],n="".concat(e," ").concat(D(t));this.__hb_xhr={type:"xhr",method:e,url:t,message:n},"function"==typeof r&&r.apply(this,arguments)}}),E(XMLHttpRequest.prototype,"send",function(t){return function(){var e=this;function n(){var t;4===e.readyState&&(t=void 0,e.__hb_xhr&&(e.__hb_xhr.status_code=e.status,t=e.__hb_xhr.message,delete e.__hb_xhr.message),a.addBreadcrumb(t||"XMLHttpRequest",{category:"request",metadata:e.__hb_xhr}))}"onreadystatechange"in e&&"function"==typeof e.onreadystatechange?E(e,"onreadystatechange",function(t){return function(){n(),"function"==typeof t&&t.apply(this,arguments)}}):e.onreadystatechange=n,"function"==typeof t&&t.apply(e,arguments)}})),!t("network")||function(){if(window.fetch){if(A(window.fetch))return 1;try{var t=document.createElement("iframe");t.style.display="none",document.head.appendChild(t);var e=t.contentWindow.fetch&&A(t.contentWindow.fetch);return document.head.removeChild(t),e}catch(t){console&&console.warn&&console.warn("failed to detect native fetch via iframe: "+t)}}}()&&E(q,"fetch",function(i){return function(){var t,e=arguments[0],n="GET";"string"==typeof e?t=e:"Request"in q&&e instanceof Request?(t=e.url,e.method&&(n=e.method)):t=String(e),arguments[1]&&arguments[1].method&&(n=arguments[1].method),"string"==typeof n&&(n=n.toUpperCase());var r="".concat(n," ").concat(D(t)),o={type:"fetch",method:n,url:t};return i.apply(this,arguments).then(function(t){return o.status_code=t.status,a.addBreadcrumb(r,{category:"request",metadata:o}),t}).catch(function(t){throw a.addBreadcrumb("fetch error",{category:"error",metadata:o}),t})}}),t("navigation")&&(r=q.location.href,E(q,"onpopstate",function(t){return function(){if(n(r,q.location.href),t)return t.apply(this,arguments)}}),E(q.history,"pushState",e),E(q.history,"replaceState",e))}})]})});
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).Honeybadger=e()}(this,(function(){"use strict";var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};var e=function(){return e=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},e.apply(this,arguments)};function n(t,e,n,r){return new(n||(n=Promise))((function(o,i){function a(t){try{u(r.next(t))}catch(t){i(t)}}function c(t){try{u(r.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,c)}u((r=r.apply(t,e||[])).next())}))}function r(t,e){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(i){return function(c){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=e.call(t,a)}catch(t){i=[6,t],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,c])}}}var o="<unknown>";function i(t){return t.split("\n").reduce((function(t,e){var n=function(t){var e=a.exec(t);if(!e)return null;var n=e[2]&&0===e[2].indexOf("native"),r=e[2]&&0===e[2].indexOf("eval"),i=c.exec(e[2]);r&&null!=i&&(e[2]=i[1],e[3]=i[2],e[4]=i[3]);return{file:n?null:e[2],methodName:e[1]||o,arguments:n?[e[2]]:[],lineNumber:e[3]?+e[3]:null,column:e[4]?+e[4]:null}}(e)||function(t){var e=u.exec(t);if(!e)return null;return{file:e[2],methodName:e[1]||o,arguments:[],lineNumber:+e[3],column:e[4]?+e[4]:null}}(e)||function(t){var e=s.exec(t);if(!e)return null;var n=e[3]&&e[3].indexOf(" > eval")>-1,r=f.exec(e[3]);n&&null!=r&&(e[3]=r[1],e[4]=r[2],e[5]=null);return{file:e[3],methodName:e[1]||o,arguments:e[2]?e[2].split(","):[],lineNumber:e[4]?+e[4]:null,column:e[5]?+e[5]:null}}(e)||function(t){var e=d.exec(t);if(!e)return null;return{file:e[2],methodName:e[1]||o,arguments:[],lineNumber:+e[3],column:e[4]?+e[4]:null}}(e)||function(t){var e=l.exec(t);if(!e)return null;return{file:e[3],methodName:e[1]||o,arguments:[],lineNumber:+e[4],column:e[5]?+e[5]:null}}(e);return n&&t.push(n),t}),[])}var a=/^\s*at (.*?) ?\(((?:file|https?|blob|chrome-extension|native|eval|webpack|<anonymous>|\/|[a-z]:\\|\\\\).*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,c=/\((\S*)(?::(\d+))(?::(\d+))\)/;var u=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i;var s=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)((?:file|https?|blob|chrome|webpack|resource|\[native).*?|[^@]*bundle)(?::(\d+))?(?::(\d+))?\s*$/i,f=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i;var l=/^\s*(?:([^@]*)(?:\((.*?)\))?@)?(\S.*?):(\d+)(?::(\d+))?\s*$/i;var d=/^\s*at (?:((?:\[object object\])?[^\\/]+(?: \[as \S+\])?) )?\(?(.*?):(\d+)(?::(\d+))?\)?\s*$/i;function p(t,e){var n={};for(var r in t)n[r]=t[r];for(var r in e)n[r]=e[r];return n}function h(t,e){var n=p(t,e);return t.context&&e.context&&(n.context=p(t.context,e.context)),n}function g(t,e,n){t&&t.afterNotify&&t.afterNotify(n,t);for(var r=0,o=e.length;r<o;r++)e[r](n,t);return!0}function m(t){if("object"!=typeof t||null===t)return{};var e={};for(var n in t)e[n]=t[n];return e}function y(t,e){void 0===e&&(e=8);var n=[];function r(t,r){if(void 0===r&&(r=0),r>=e)return"[DEPTH]";if(!function(t){var e=typeof t;return/function/.test(e)?"toJSON"===t.name:!/symbol/.test(e)&&null!==t&&("object"!=typeof t||void 0!==t.hasOwnProperty)}(t))return Object.prototype.toString.call(t);if(function(t){if(!t||"object"!=typeof t)return!1;for(var e=0;e<n.length;e++)if(n[e]===t)return!0;return n.push(t),!1}(t))return"[RECURSION]";if(Array.isArray(t))return t.map((function(t){return o(t,r+1)}));if("object"==typeof t){var i={};for(var a in t){var c=t[a];Object.prototype.hasOwnProperty.call(t,a)&&null!=a&&null!=c&&(i[a]=o(c,r+1))}return i}return t}function o(t,e){void 0===e&&(e=0);try{return r(t,e)}catch(t){return"[ERROR] ".concat(t)}}return o(t)}function v(t){var e;if(t)if(t instanceof Error||"[object Error]"===Object.prototype.toString.call(t)){var n=t;e=p(t,{name:n.name,message:n.message,stack:n.stack})}else if("object"==typeof t)e=m(t);else{e={message:String(t)}}else e={};return e}function b(t,e,n){if(t&&e&&n&&e in t){for(var r=t[e];r&&r.__hb_original;)r=r.__hb_original;try{t[e]=n(r),t[e].__hb_original=r}catch(t){}}}function _(t,e){var n=t.trim().replace(/\/$/,"");return e=e.trim().replace(/(^\/|\/$)/g,""),"".concat(n,"/").concat(e)}function w(t,e){if(x("Object",t)){x("Array",e)||(e=[]);var n=[];return function t(r){var o,i;if(x("Object",r)||x("Array",r)){if(-1!==n.indexOf(r))return"[CIRCULAR DATA STRUCTURE]";n.push(r)}if(x("Object",r)){for(o in i={},r)E(o,e)?i[o]="[FILTERED]":i[o]=t(r[o]);return i}return x("Array",r)?r.map((function(e){return t(e)})):x("Function",r)?"[FUNC]":r}(t)}}function E(t,e){for(var n=0;n<e.length;n++)if(-1!==t.toLowerCase().indexOf(e[n].toLowerCase()))return!0;return!1}function x(t,e){var n=Object.prototype.toString.call(e).slice(8,-1);return null!=e&&n===t}function k(t,e){if(!e)return t;if("string"!=typeof t)return t;var n=t.split(/\?/,2)[1];if(!n)return t;var r=t;return n.split(/[&]\s?/).forEach((function(t){var n=t.split("=",2),o=n[0],i=n[1];E(o,e)&&(r=r.replace("".concat(o,"=").concat(i),"".concat(o,"=[FILTERED]")))})),r}var j=function(){function t(t){this.store=t}return t.prototype.getStore=function(){return this.store},t.prototype.run=function(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return this.store=t,e.apply(void 0,n)},t}(),N={name:"honeybadger-js",url:"https://github.com/honeybadger-io/honeybadger-js",version:"4.0.4"},S=/,|\s+/,O=/\S/,T=function(){function t(t,n){var r,o;void 0===t&&(t={}),this.__pluginsExecuted=!1,this.__store=null,this.__beforeNotifyHandlers=[],this.__afterNotifyHandlers=[],this.config=e({apiKey:null,endpoint:"https://api.honeybadger.io",environment:null,hostname:null,projectRoot:null,component:null,action:null,revision:null,reportData:null,breadcrumbsEnabled:!0,maxBreadcrumbs:40,maxObjectDepth:8,logger:console,developmentEnvironments:["dev","development","test"],debug:!1,tags:null,enableUncaught:!0,enableUnhandledRejection:!0,afterUncaught:function(){return!0},filters:["creditcard","password"],__plugins:[]},t),this.__store=new j({context:{},breadcrumbs:[]}),this.__transport=n,this.logger=(r=this,o=function(t){return function(){for(var e,n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];if("debug"===t){if(!r.config.debug)return;t="log"}n.unshift("[Honeybadger]"),(e=r.config.logger)[t].apply(e,n)}},{log:o("log"),info:o("info"),debug:o("debug"),warn:o("warn"),error:o("error")})}return t.prototype.getVersion=function(){return N.version},t.prototype.configure=function(t){var e=this;for(var n in void 0===t&&(t={}),t)this.config[n]=t[n];return this.__pluginsExecuted||(this.__pluginsExecuted=!0,this.config.__plugins.forEach((function(t){return t.load(e)}))),this},t.prototype.__setStore=function(t){this.__store=t},t.prototype.beforeNotify=function(t){return this.__beforeNotifyHandlers.push(t),this},t.prototype.afterNotify=function(t){return this.__afterNotifyHandlers.push(t),this},t.prototype.setContext=function(t){if("object"==typeof t){var e=this.__store.getStore();e.context=p(e.context,t)}return this},t.prototype.resetContext=function(t){this.logger.warn("Deprecation warning: `Honeybadger.resetContext()` has been deprecated; please use `Honeybadger.clear()` instead.");var e=this.__store.getStore();return e.context="object"==typeof t&&null!==t?t:{},this},t.prototype.clear=function(){var t=this.__store.getStore();return t.context={},t.breadcrumbs=[],this},t.prototype.notify=function(t,e,o){var i=this;void 0===e&&(e=void 0),void 0===o&&(o=void 0);var a=null,c=this.makeNotice(t,e,o);c||(this.logger.debug("failed to build error report"),a=new Error("failed to build error report")),a||!1!==this.config.reportData||(this.logger.debug("skipping error report: honeybadger.js is disabled",c),a=new Error("honeybadger.js is disabled")),!a&&this.__developmentMode()&&(this.logger.log("honeybadger.js is in development mode; the following error report will be sent in production.",c),a=new Error("honeybadger.js is in development mode")),a||this.config.apiKey||(this.logger.warn("could not send error report: no API key has been configured",c),a=new Error("missing API key"));var u=c&&c.backtrace?c.backtrace.map((function(t){return m(t)})):null,s=function(t,e){for(var n=!0,r=0,o=e.length;r<o;r++)!1===(0,e[r])(t)&&(n=!1);return n}(c,this.__beforeNotifyHandlers);if(a||s||(this.logger.debug("skipping error report: beforeNotify handlers returned false",c),a=new Error("beforeNotify handlers returned false")),a)return g(c,this.__afterNotifyHandlers,a),!1;this.addBreadcrumb("Honeybadger Notice",{category:"notice",metadata:{message:c.message,name:c.name,stack:c.stack}});var f=this.__getStoreContentsOrDefault().breadcrumbs;return c.__breadcrumbs=this.config.breadcrumbsEnabled?f.slice():[],function(t,e){return n(this,void 0,void 0,(function(){var n,o,i,a;return r(this,(function(r){switch(r.label){case 0:if(n=[],!e||!t||!t.length)return[2,n];o=0,r.label=1;case 1:return t.length?(i=t.splice(0)[o],[4,e(i.file)]):[3,3];case 2:return a=r.sent(),n[o]=function(t,e,n){if(void 0===n&&(n=2),!t)return null;var r=t.split("\n");r.unshift("");for(var o=e+n,i={},a=e-n;a<=o;a++){var c=r[a];"string"==typeof c&&(i[a]=c)}return i}(a,i.number),o++,[3,1];case 3:return[2,n]}}))}))}(u,this.__getSourceFileHandler).then((function(t){t.forEach((function(t,e){c.backtrace[e].source=t}));var e,n=i.__buildPayload(c);i.__transport.send({headers:{"X-API-Key":i.config.apiKey,"Content-Type":"application/json",Accept:"text/json, application/json"},method:"POST",endpoint:_(i.config.endpoint,"/v1/notices/js"),maxObjectDepth:i.config.maxObjectDepth,logger:i.logger,async:(e=i.config,void 0!==e.async?i.config.async:void 0)},n).then((function(t){if(201!==t.statusCode)return g(c,i.__afterNotifyHandlers,new Error("Bad HTTP response: ".concat(t.statusCode))),void i.logger.warn("Error report failed: unknown response from server. code=".concat(t.statusCode));var e=JSON.parse(t.body).id;g(p(c,{id:e}),i.__afterNotifyHandlers),i.logger.info("Error report sent ⚡ https://app.honeybadger.io/notice/".concat(e))})).catch((function(t){i.logger.error("Error report failed: an unknown error occurred.","message=".concat(t.message)),g(c,i.__afterNotifyHandlers,t)}))})),!0},t.prototype.notifyAsync=function(t,e,n){var r=this;return void 0===e&&(e=void 0),void 0===n&&(n=void 0),new Promise((function(o,i){var a,c,u;a=t.afterNotify?t:e&&e.afterNotify?e:n&&n.afterNotify?n:e&&"object"==typeof e?e:n||(e={}),u=(c=a).afterNotify,c.afterNotify=function(t){if(null==u||u.call(r,t),t)return i(t);o()},r.notify(t,e,n)}))},t.prototype.makeNotice=function(t,e,n){void 0===e&&(e=void 0),void 0===n&&(n=void 0);var r=v(t);e&&"object"!=typeof e&&(e={name:String(e)});if(e&&(r=h(r,e)),"object"==typeof n&&null!==n&&(r=h(r,n)),function(t){for(var e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}(r))return null;var o=this.__getStoreContentsOrDefault().context,a=this.__constructTags(r.tags),c=this.__constructTags(o.tags),u=this.__constructTags(this.config.tags),s=a.concat(c).concat(u),f=s.filter((function(t,e){return s.indexOf(t)===e})),l=0;return"string"==typeof(r=p(r,{name:r.name||"Error",context:p(o,r.context),projectRoot:r.projectRoot||this.config.projectRoot,environment:r.environment||this.config.environment,component:r.component||this.config.component,action:r.action||this.config.action,revision:r.revision||this.config.revision,tags:f})).stack&&r.stack.trim()||(r.stack=function(){try{throw new Error("")}catch(t){if(t.stack)return t.stack}for(var t=10,e=[],n=arguments.callee;n&&e.length<t;){/function(?:\s+([\w$]+))+\s*\(/.test(n.toString())?e.push(RegExp.$1||"<anonymous>"):e.push("<anonymous>");try{n=n.caller}catch(t){break}}return e.join("\n")}(),l=2),r.backtrace=function(t,e){void 0===e&&(e=0);try{var n=i(t).map((function(t){return{file:t.file,method:t.methodName,number:t.lineNumber,column:t.column}}));return n.splice(0,e),n}catch(t){return[]}}(r.stack,l),r},t.prototype.addBreadcrumb=function(t,e){if(this.config.breadcrumbsEnabled){var n=m((e=e||{}).metadata),r=e.category||"custom",o=(new Date).toISOString(),i=this.__store.getStore(),a=i.breadcrumbs;a.push({category:r,message:t,metadata:n,timestamp:o});var c=this.config.maxBreadcrumbs;return a.length>c&&(a=a.slice(a.length-c)),i.breadcrumbs=a,this}},t.prototype.__developmentMode=function(){return!0!==this.config.reportData&&(this.config.environment&&this.config.developmentEnvironments.includes(this.config.environment))},t.prototype.__buildPayload=function(t){var n=w(t.headers,this.config.filters)||{},r=w(e(e({},t.cgiData),function(t,e){void 0===e&&(e="");var n={};return Object.keys(t).forEach((function(r){var o=e+r.replace(/\W/g,"_").toUpperCase();n[o]=t[r]})),n}(n,"HTTP_")),this.config.filters);return{notifier:N,breadcrumbs:{enabled:!!this.config.breadcrumbsEnabled,trail:t.__breadcrumbs||[]},error:{class:t.name,message:t.message,backtrace:t.backtrace,fingerprint:t.fingerprint,tags:t.tags},request:{url:k(t.url,this.config.filters),component:t.component,action:t.action,context:t.context,cgi_data:r,params:w(t.params,this.config.filters)||{},session:w(t.session,this.config.filters)||{}},server:{project_root:t.projectRoot,environment_name:t.environment,revision:t.revision,hostname:this.config.hostname,time:(new Date).toUTCString()},details:t.details||{}}},t.prototype.__constructTags=function(t){return t?t.toString().split(S).filter((function(t){return O.test(t)})):[]},t.prototype.__getStoreContentsOrDefault=function(){var t=this.__store.getStore();return e({context:{},breadcrumbs:[]},t||{})},t}();function R(t){if(!t||!t.tagName)return"";var e=t.tagName.toLowerCase();if("html"===e)return"";t.id&&(e+="#".concat(t.id));var n=t.getAttribute("class");n&&n.split(/\s+/).forEach((function(t){e+=".".concat(t)})),["alt","name","title","type"].forEach((function(n){var r=t.getAttribute(n);r&&(e+="[".concat(n,'="').concat(r,'"]'))}));var r=function(t){try{var e=t.parentNode.childNodes,n=[];return Array.prototype.forEach.call(e,(function(e){e.tagName&&e.tagName===t.tagName&&n.push(e)})),n}catch(t){return[]}}(t);return r.length>1&&(e+=":nth-child(".concat(Array.prototype.indexOf.call(r,t)+1,")")),e}function C(t){var e=R(t);if(t.parentNode&&t.parentNode.tagName){var n=C(t.parentNode);if(n.length>0)return"".concat(n," > ").concat(e)}return e}function H(t){return-1!==t.toString().indexOf("native")}function P(t){var e=t.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/)||{};return{protocol:e[2],host:e[4],pathname:e[5]}}function A(t){var e=P(t),n=P(document.URL);return e.host&&e.protocol?e.protocol===n.protocol&&e.host===n.host?e.pathname:"".concat(e.protocol,"://").concat(e.host).concat(e.pathname):e.pathname}var U,D=function(){var t=!0;if(window.atob||(t=!1),window.ErrorEvent)try{0===new window.ErrorEvent("").colno&&(t=!1)}catch(t){}return t}(),L=0;function I(){L+=1,clearTimeout(U),U=setTimeout((function(){L=0}))}var B,M=function(){function t(){}return t.prototype.send=function(t,e){return new Promise((function(n,r){try{var o=new XMLHttpRequest;if(o.open(t.method,t.endpoint,t.async),Object.keys(t.headers||[]).length)for(var i in t.headers)void 0!==t.headers[i]&&o.setRequestHeader(i,String(t.headers[i]));o.send(e?JSON.stringify(y(e,t.maxObjectDepth)):void 0),o.onload=function(){return n({statusCode:o.status,body:o.response})}}catch(t){r(t)}}))},t}(),q=function(n){function r(t){void 0===t&&(t={});var r=n.call(this,e({async:!0,maxErrors:null,projectRoot:window.location.protocol+"//"+window.location.host},t),new M)||this;return r.__errorsSent=0,r.__lastWrapErr=void 0,r.__beforeNotifyHandlers=[function(t){return r.__exceedsMaxErrors()?(r.logger.debug("Dropping notice: max errors exceeded",t),!1):(t&&!t.url&&(t.url=document.URL),r.__incrementErrorsCount(),!0)}],r}return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}(r,n),r.prototype.configure=function(t){return void 0===t&&(t={}),n.prototype.configure.call(this,t)},r.prototype.resetMaxErrors=function(){return this.__errorsSent=0},r.prototype.factory=function(t){return new r(t)},r.prototype.checkIn=function(t){throw new Error("Honeybadger.checkIn() is not supported on the browser")},r.prototype.__buildPayload=function(t){var e,r,o,i={HTTP_USER_AGENT:void 0,HTTP_REFERER:void 0,HTTP_COOKIE:void 0};i.HTTP_USER_AGENT=navigator.userAgent,document.referrer.match(/\S/)&&(i.HTTP_REFERER=document.referrer),"string"==typeof t.cookies?(r=t.cookies,o={},r.split(/[;,]\s?/).forEach((function(t){var e=t.split("=",2),n=e[0],r=e[1];o[n]=r})),e=o):e=t.cookies,e&&(i.HTTP_COOKIE=function(t){if("object"==typeof t){var e=[];for(var n in t)e.push(n+"="+t[n]);return e.join(";")}}(w(e,this.config.filters)));var a=n.prototype.__buildPayload.call(this,t);return a.request.cgi_data=p(i,a.request.cgi_data),a},r.prototype.__wrap=function(t,e){void 0===e&&(e={});var n,r=t;e||(e={});try{if("function"!=typeof r)return r;if(n=r,"function"==typeof Object.isExtensible&&!Object.isExtensible(n))return r;if(!r.___hb){var o=this;r.___hb=function(){if(!D)return r.apply(this,arguments);try{return r.apply(this,arguments)}catch(t){if(o.__lastWrapErr===t)throw t;throw o.__lastWrapErr=t,I(),o.addBreadcrumb(e.component?"".concat(e.component,": ").concat(t.name):t.name,{category:"error",metadata:{message:t.message,name:t.name,stack:t.stack}}),o.config.enableUncaught&&o.notify(t),t}}}return r.___hb.___hb=r.___hb,r.___hb}catch(t){return r}},r.prototype.__incrementErrorsCount=function(){return this.__errorsSent++},r.prototype.__exceedsMaxErrors=function(){return this.config.maxErrors&&this.__errorsSent>=this.config.maxErrors},r}(T),W=new q({__plugins:[(void 0===B&&(B=window),{load:function(t){b(B,"onerror",(function(e){var n=function(e,n,r,o,i){if(t.logger.debug("window.onerror callback invoked",arguments),L>0)return t.logger.debug("Ignoring window.onerror (error likely reported earlier)",arguments),void(L-=1);if(0===r&&/Script error\.?/.test(e))t.config.enableUncaught&&t.logger.warn("Ignoring cross-domain script error: enable CORS to track these types of errors",arguments);else{var a=v(i);a.name||(a.name="window.onerror"),a.message||(a.message=e),a.stack||(a.stack=[a.message,"\n at ? (",n||"unknown",":",r||0,":",o||0,")"].join("")),t.addBreadcrumb("window.onerror"!==a.name&&a.name?"window.onerror: ".concat(a.name):"window.onerror",{category:"error",metadata:{name:a.name,message:a.message,stack:a.stack}}),t.config.enableUncaught&&t.notify(a)}};return function(t,r,o,i,a){return n(t,r,o,i,a),"function"==typeof e&&e.apply(window,arguments)}}))}}),function(t){return void 0===t&&(t=window),{load:function(e){e.config.enableUnhandledRejection&&b(t,"onunhandledrejection",(function(t){function n(t){var n;if(e.logger.debug("window.onunhandledrejection callback invoked",arguments),e.config.enableUnhandledRejection){var r=t.reason;if(r instanceof Error){var o="unknown",i=0,a="".concat(r.message,"\n at ? (").concat(o,":").concat(i,")"),c=r.stack||a,u={name:r.name,message:"UnhandledPromiseRejectionWarning: ".concat(r),stack:c};return e.addBreadcrumb("window.onunhandledrejection: ".concat(u.name),{category:"error",metadata:u}),void e.notify(u)}var s="string"==typeof r?r:null!==(n=JSON.stringify(r))&&void 0!==n?n:"Unspecified reason";e.notify({name:"window.onunhandledrejection",message:"UnhandledPromiseRejectionWarning: ".concat(s)})}}return function(e){n(e),"function"==typeof t&&t.apply(this,arguments)}}))}}}(),function(t){return void 0===t&&(t=window),{load:function(e){!function(){function n(t){return function(n){return function(r,o){if("function"==typeof r){var i=Array.prototype.slice.call(arguments,2);return r=e.__wrap(r,t),n((function(){r.apply(void 0,i)}),o)}return n(r,o)}}}b(t,"setTimeout",n({component:"setTimeout"})),b(t,"setInterval",n({component:"setInterval"}))}()}}}(),function(t){return void 0===t&&(t=window),{load:function(e){["EventTarget","Window","Node","ApplicationCache","AudioTrackList","ChannelMergerNode","CryptoOperation","EventSource","FileReader","HTMLUnknownElement","IDBDatabase","IDBRequest","IDBTransaction","KeyOperation","MediaController","MessagePort","ModalWindow","Notification","SVGElementInstance","Screen","TextTrack","TextTrackCue","TextTrackList","WebSocket","WebSocketWorker","Worker","XMLHttpRequest","XMLHttpRequestEventTarget","XMLHttpRequestUpload"].forEach((function(n){var r=t[n]&&t[n].prototype;r&&Object.prototype.hasOwnProperty.call(r,"addEventListener")&&(b(r,"addEventListener",(function(t){var r={component:"".concat(n,".prototype.addEventListener")};return function(n,o,i,a){try{o&&null!=o.handleEvent&&(o.handleEvent=e.__wrap(o.handleEvent,r))}catch(t){e.logger.error(t)}return t.call(this,n,e.__wrap(o,r),i,a)}})),b(r,"removeEventListener",(function(t){return function(n,r,o,i){return t.call(this,n,r,o,i),t.call(this,n,e.__wrap(r),o,i)}})))}))}}}(),function(t){return void 0===t&&(t=window),{load:function(e){function n(t){return!0===e.config.breadcrumbsEnabled||(t?!0===e.config.breadcrumbsEnabled[t]:!1!==e.config.breadcrumbsEnabled)}!function(){function r(t){return Array.isArray(t)?t.map((function(t){try{return String(t)}catch(t){return"[unknown]"}})).join(" "):""}n("console")&&["debug","info","warn","error","log"].forEach((function(n){b(t.console,n,(function(o){return function(){var i=Array.prototype.slice.call(arguments),a=r(i),c={category:"log",metadata:{level:n,arguments:y(i,3)}};e.addBreadcrumb(a,c),"function"==typeof o&&Function.prototype.apply.call(o,t.console,arguments)}}))}))}(),n("dom")&&t.addEventListener("click",(function(t){var n,r,o;try{n=R(t.target),r=C(t.target),o=function(t){var e,n,r=t.textContent||t.innerText||"";return r||"submit"!==t.type&&"button"!==t.type||(r=t.value),e=r.trim(),n=300,e.length>n&&(e=e.substr(0,n)+"..."),e}(t.target)}catch(t){n="UI Click",r="[unknown]",o="[unknown]"}0!==n.length&&e.addBreadcrumb(n,{category:"ui.click",metadata:{selector:r,text:o,event:t}})}),!0),n("network")&&(b(XMLHttpRequest.prototype,"open",(function(t){return function(){var e=this,n=arguments[1],r="string"==typeof arguments[0]?arguments[0].toUpperCase():arguments[0],o="".concat(r," ").concat(A(n));this.__hb_xhr={type:"xhr",method:r,url:n,message:o},"function"==typeof t&&t.apply(e,arguments)}})),b(XMLHttpRequest.prototype,"send",(function(t){return function(){var n=this;function r(){if(4===n.readyState){var t=void 0;n.__hb_xhr&&(n.__hb_xhr.status_code=n.status,t=n.__hb_xhr.message,delete n.__hb_xhr.message),e.addBreadcrumb(t||"XMLHttpRequest",{category:"request",metadata:n.__hb_xhr})}}"onreadystatechange"in n&&"function"==typeof n.onreadystatechange?b(n,"onreadystatechange",(function(t){return function(){r(),"function"==typeof t&&t.apply(this,arguments)}})):n.onreadystatechange=r,"function"==typeof t&&t.apply(n,arguments)}}))),n("network")&&function(){if(!window.fetch)return!1;if(H(window.fetch))return!0;try{var t=document.createElement("iframe");t.style.display="none",document.head.appendChild(t);var e=t.contentWindow.fetch&&H(t.contentWindow.fetch);return document.head.removeChild(t),e}catch(t){console&&console.warn&&console.warn("failed to detect native fetch via iframe: "+t)}return!1}()&&b(t,"fetch",(function(n){return function(){var r,o=arguments[0],i="GET";"string"==typeof o?r=o:"Request"in t&&o instanceof Request?(r=o.url,o.method&&(i=o.method)):r=String(o),arguments[1]&&arguments[1].method&&(i=arguments[1].method),"string"==typeof i&&(i=i.toUpperCase());var a="".concat(i," ").concat(A(r)),c={type:"fetch",method:i,url:r};return n.apply(this,arguments).then((function(t){return c.status_code=t.status,e.addBreadcrumb(a,{category:"request",metadata:c}),t})).catch((function(t){throw e.addBreadcrumb("fetch error",{category:"error",metadata:c}),t}))}})),function(){if(n("navigation")){var r=t.location.href;b(t,"onpopstate",(function(e){return function(){if(o(r,t.location.href),e)return e.apply(this,arguments)}})),b(t.history,"pushState",i),b(t.history,"replaceState",i)}function o(t,n){r=n,e.addBreadcrumb("Page changed",{category:"navigation",metadata:{from:t,to:n}})}function i(t){return function(){var e=arguments.length>2?arguments[2]:void 0;return e&&o(r,String(e)),t.apply(this,arguments)}}}()}}}()]});return W}));
//# sourceMappingURL=honeybadger.min.js.map

@@ -20,3 +20,3 @@ 'use strict';

/*! *****************************************************************************
/******************************************************************************
Copyright (c) Microsoft Corporation.

@@ -623,3 +623,3 @@

url: 'https://github.com/honeybadger-io/honeybadger-js',
version: '4.0.3'
version: '4.0.4'
};

@@ -1279,14 +1279,17 @@ // Split at commas and spaces

if (opts === void 0) { opts = {}; }
var _this = this;
var _a;
var _this = _super.call(this, __assign({ afterUncaught: fatallyLogAndExit, projectRoot: process.cwd(), hostname: os__default["default"].hostname() }, opts), new ServerTransport()) || this;
_this = _super.call(this, __assign({ afterUncaught: fatallyLogAndExit, projectRoot: process.cwd(), hostname: os__default["default"].hostname() }, opts), new ServerTransport()) || this;
/** @internal */
_this.__beforeNotifyHandlers = [
function (notice) {
notice.backtrace.forEach(function (line) {
if (line.file) {
line.file = line.file.replace(/.*\/node_modules\/(.+)/, '[NODE_MODULES]/$1');
line.file = line.file.replace(notice.projectRoot, '[PROJECT_ROOT]');
}
return line;
});
if (notice && notice.backtrace) {
notice.backtrace.forEach(function (line) {
if (line.file) {
line.file = line.file.replace(/.*\/node_modules\/(.+)/, '[NODE_MODULES]/$1');
line.file = line.file.replace(notice.projectRoot, '[PROJECT_ROOT]');
}
return line;
});
}
}

@@ -1293,0 +1296,0 @@ ];

{
"name": "@honeybadger-io/js",
"version": "4.0.3",
"version": "4.0.4",
"license": "MIT",

@@ -48,7 +48,7 @@ "homepage": "https://github.com/honeybadger-io/honeybadger-js",

"devDependencies": {
"@commitlint/cli": "^16.2.3",
"@commitlint/config-conventional": "^16.2.1",
"@rollup/plugin-node-resolve": "^13.0.6",
"@commitlint/cli": "^17.0.0",
"@commitlint/config-conventional": "^17.0.0",
"@rollup/plugin-node-resolve": "^13.3.0",
"@rollup/plugin-replace": "^4.0.0",
"@rollup/plugin-typescript": "^8.3.0",
"@rollup/plugin-typescript": "^8.3.3",
"@types/aws-lambda": "^8.10.89",

@@ -70,9 +70,9 @@ "@types/express": "^4.17.13",

"nock": "^13.2.1",
"rollup": "^2.61.1",
"rollup-plugin-uglify": "^6.0.2",
"rollup": "^2.75.6",
"rollup-plugin-terser": "^7.0.2",
"shipjs": "0.24.4",
"sinon": "^14.0.0",
"supertest": "^6.1.6",
"ts-jest": "^28.0.2",
"tsd": "^0.20.0",
"ts-jest": "^27.1.5",
"tsd": "^0.21.0",
"tslib": "^2.3.1",

@@ -79,0 +79,0 @@ "typescript": "^4.5.3"

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc