UNPKG

@leanix/reporting

Version:

Library for writing LeanIX EAM reports

1 lines 95.2 kB
var e={d:(t,n)=>{for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)},t={};e.d(t,{AG:()=>$r,lx:()=>jr,lq:()=>Lr,jV:()=>Ar});class n{getRelationDefinition(e,t){const n=e.relationMapping[t].persistedName;return n in e.relations?e.relations[n]:(console.warn(`Relation ${n} could not be found in enrichedDataModel.relations`),null)}isConstrainingRelation(e,t){const n=this.getRelationDefinition(e,t);return!!n&&n&&!!n.constrainingRelations&&n.constrainingRelations.length>0}}const r="_allMessages_";class s{constructor(){this.parentWindow=window.parent,this.parentOrigin="*",this.listeners={},window.addEventListener("message",this.messageListener.bind(this))}sendToParent(e,t){try{if(t){const t=e.id||String(Date.now()+Math.random()),n=this.listenOnce(t);return this.sendToParent(Object.assign(Object.assign({},e),{id:t})),n}return void this.parentWindow.postMessage(e,this.parentOrigin)}catch(t){throw console.error("Error while sending message to parent:",e.id,t),t}}registerListener(e=r,t,n=!1){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push({listener:t,callOnError:n})}deRegisterListener(e=r,t){t?this.listeners[e]=this.listeners[e].filter((e=>e.listener===t)):delete this.listeners[e]}deRegisterAllListeners(){Object.keys(this.listeners).forEach((e=>{this.deRegisterListener(e)}))}listenOnce(e=r){return new Promise(((t,n)=>{const r=(s,o)=>{o?n(s):t(s),this.deRegisterListener(e,r)};this.registerListener(e,r,!0)}))}messageListener(e){if(e.source===this.parentWindow||window.isStorybookInstance){this.parentOrigin=e.origin;const t=e.data;this.callListeners(e.data.id,t),this.callListeners(r,t)}}callListeners(e,t){const n=this.listeners[e];n&&n.forEach((n=>{t.success?this.invokeCallback(e,(()=>n.listener(t.data))):n.callOnError?this.invokeCallback(e,(()=>n.listener(t.data,!0))):console.error(t.data)}))}invokeCallback(e,t){try{t()}catch(t){this.showError(t.toString(),"Internal report error while processing "+e)}}showError(e,t="errors.inReport"){this.sendToParent({action:"show-toastr",params:{type:"error",message:e,title:t}})}}function o(e,t,n=null){if(Object.hasOwnProperty.call(e,t))return e[t];const r=t.split(/[,[\].]+?/).filter(Boolean);return r.length>0?r.reduce(((e,t)=>e&&Object.hasOwnProperty.call(e,t)?e[t]:n),e):void 0}function i(e){return!(!e||"[object Function]"!=={}.toString.call(e))}function a(e,t){if(Object.hasOwnProperty.call(e,t))e[t]=void 0;else{const n=t.split(/[,[\].]+?/).filter(Boolean),r=n.pop(),s=o(e,n.join("."));s&&Object.hasOwnProperty.call(s,r)&&(s[r]=void 0)}}function c(e){if(Array.isArray(e)){const t=[...e];for(let e=0;e<t.length;e++)t[e]=c(t[e]);return t}if("object"==typeof e){const t=Object.assign({},e);return Object.keys(t).forEach((e=>{t[e]=c(t[e])})),t}return e}class u{constructor(){this.messenger=new s,this.facetsConfigs=[]}showPopover(e){if(!this.facetsConfigs.every((e=>this.attributesPresentInConfig(e,["id","type"]))))throw new Error("The attributes 'id' and 'type' are mandatory for displaying report popover dialogs.");return this.messenger.sendToParent({action:"table.show-popover",params:e})}hidePopover(){return this.messenger.sendToParent({action:"table.hide-popover"})}setFacetsConfig(e,t){this.facetsConfigs[t]=e}attributesPresentInConfig(e,t){var n;var r,s,o;return 0===(s=t,o=(r=(null!==(n=e.attributes)&&void 0!==n?n:[]).map((e=>{for(;/{/.test(e);)e=e.replace(/{[^{]*?}/g,"");return e.split(/ +/)})),(r||[]).reduce(((e,t)=>e.concat(t)),[])).filter(Boolean),[s||[],o||[]].reduce(((e,t)=>e.filter((e=>!t.includes(e)))))).length}}const l="9.22.0",d=globalThis;function p(){return h(d),d}function h(e){const t=e.__SENTRY__=e.__SENTRY__||{};return t.version=t.version||l,t[l]=t[l]||{}}function f(e,t,n=d){const r=n.__SENTRY__=n.__SENTRY__||{},s=r[l]=r[l]||{};return s[e]||(s[e]=t())}const m="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__,g=Object.prototype.toString;function _(e){switch(g.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object WebAssembly.Exception]":return!0;default:return C(e,Error)}}function y(e,t){return g.call(e)===`[object ${t}]`}function v(e){return y(e,"ErrorEvent")}function b(e){return y(e,"DOMError")}function E(e){return y(e,"String")}function S(e){return"object"==typeof e&&null!==e&&"__sentry_template_string__"in e&&"__sentry_template_values__"in e}function w(e){return null===e||S(e)||"object"!=typeof e&&"function"!=typeof e}function x(e){return y(e,"Object")}function k(e){return"undefined"!=typeof Event&&C(e,Event)}function T(e){return Boolean(e?.then&&"function"==typeof e.then)}function C(e,t){try{return e instanceof t}catch(e){return!1}}function P(e){return!("object"!=typeof e||null===e||!e.__isVue&&!e._isVue)}const O=d;function I(e,t={}){if(!e)return"<unknown>";try{let n=e;const r=5,s=[];let o=0,i=0;const a=" > ",c=a.length;let u;const l=Array.isArray(t)?t:t.keyAttrs,d=!Array.isArray(t)&&t.maxStringLength||80;for(;n&&o++<r&&(u=R(n,l),!("html"===u||o>1&&i+s.length*c+u.length>=d));)s.push(u),i+=u.length,n=n.parentNode;return s.reverse().join(a)}catch(e){return"<unknown>"}}function R(e,t){const n=e,r=[];if(!n?.tagName)return"";if(O.HTMLElement&&n instanceof HTMLElement&&n.dataset){if(n.dataset.sentryComponent)return n.dataset.sentryComponent;if(n.dataset.sentryElement)return n.dataset.sentryElement}r.push(n.tagName.toLowerCase());const s=t?.length?t.filter((e=>n.getAttribute(e))).map((e=>[e,n.getAttribute(e)])):null;if(s?.length)s.forEach((e=>{r.push(`[${e[0]}="${e[1]}"]`)}));else{n.id&&r.push(`#${n.id}`);const e=n.className;if(e&&E(e)){const t=e.split(/\s+/);for(const e of t)r.push(`.${e}`)}}const o=["aria-label","type","name","title","alt"];for(const e of o){const t=n.getAttribute(e);t&&r.push(`[${e}="${t}"]`)}return r.join("")}function D(){try{return O.document.location.href}catch(e){return""}}const $=["debug","info","warn","error","log","assert","trace"],L={};function j(e){if(!("console"in d))return e();const t=d.console,n={},r=Object.keys(L);r.forEach((e=>{const r=L[e];n[e]=t[e],t[e]=r}));try{return e()}finally{r.forEach((e=>{t[e]=n[e]}))}}const A=f("logger",(function(){let e=!1;const t={enable:()=>{e=!0},disable:()=>{e=!1},isEnabled:()=>e};return m?$.forEach((n=>{t[n]=(...t)=>{e&&j((()=>{d.console[n](`Sentry Logger [${n}]:`,...t)}))}})):$.forEach((e=>{t[e]=()=>{}})),t}));function N(e,t=0){return"string"!=typeof e||0===t||e.length<=t?e:`${e.slice(0,t)}...`}function M(e,t){if(!Array.isArray(e))return"";const n=[];for(let t=0;t<e.length;t++){const r=e[t];try{P(r)?n.push("[VueViewModel]"):n.push(String(r))}catch(e){n.push("[value cannot be serialized]")}}return n.join(t)}function F(e,t=[],n=!1){return t.some((t=>function(e,t,n=!1){return!!E(e)&&(y(t,"RegExp")?t.test(e):!!E(t)&&(n?e===t:e.includes(t)))}(e,t,n)))}function U(e,t,n){if(!(t in e))return;const r=e[t];if("function"!=typeof r)return;const s=n(r);"function"==typeof s&&B(s,r);try{e[t]=s}catch{m&&A.log(`Failed to replace method "${t}" in object`,e)}}function q(e,t,n){try{Object.defineProperty(e,t,{value:n,writable:!0,configurable:!0})}catch(n){m&&A.log(`Failed to add non-enumerable property "${t}" to object`,e)}}function B(e,t){try{const n=t.prototype||{};e.prototype=t.prototype=n,q(e,"__sentry_original__",t)}catch(e){}}function H(e){return e.__sentry_original__}function z(e){if(_(e))return{message:e.message,name:e.name,stack:e.stack,...G(e)};if(k(e)){const t={type:e.type,target:V(e.target),currentTarget:V(e.currentTarget),...G(e)};return"undefined"!=typeof CustomEvent&&C(e,CustomEvent)&&(t.detail=e.detail),t}return e}function V(e){try{return"undefined"!=typeof Element&&C(e,Element)?I(e):Object.prototype.toString.call(e)}catch(e){return"<unknown>"}}function G(e){if("object"==typeof e&&null!==e){const t={};for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t}return{}}function W(e=function(){const e=d;return e.crypto||e.msCrypto}()){let t=()=>16*Math.random();try{if(e?.randomUUID)return e.randomUUID().replace(/-/g,"");e?.getRandomValues&&(t=()=>{const t=new Uint8Array(1);return e.getRandomValues(t),t[0]})}catch(e){}return([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^(15&t())>>e/4).toString(16)))}function Y(e){return e.exception?.values?.[0]}function X(e){const{message:t,event_id:n}=e;if(t)return t;const r=Y(e);return r?r.type&&r.value?`${r.type}: ${r.value}`:r.type||r.value||n||"<unknown>":n||"<unknown>"}function J(e,t,n){const r=e.exception=e.exception||{},s=r.values=r.values||[],o=s[0]=s[0]||{};o.value||(o.value=t||""),o.type||(o.type=n||"Error")}function K(e,t){const n=Y(e);if(!n)return;const r=n.mechanism;if(n.mechanism={type:"generic",handled:!0,...r,...t},t&&"data"in t){const e={...r?.data,...t.data};n.mechanism.data=e}}function Q(e){if(function(e){try{return e.__sentry_captured__}catch{}}(e))return!0;try{q(e,"__sentry_captured__",!0)}catch(e){}return!1}function Z(){return Date.now()/1e3}const ee=function(){const{performance:e}=d;if(!e?.now)return Z;const t=Date.now()-e.now(),n=null==e.timeOrigin?t:e.timeOrigin;return()=>(n+e.now())/1e3}();function te(e,t={}){if(t.user&&(!e.ipAddress&&t.user.ip_address&&(e.ipAddress=t.user.ip_address),e.did||t.did||(e.did=t.user.id||t.user.email||t.user.username)),e.timestamp=t.timestamp||ee(),t.abnormal_mechanism&&(e.abnormal_mechanism=t.abnormal_mechanism),t.ignoreDuration&&(e.ignoreDuration=t.ignoreDuration),t.sid&&(e.sid=32===t.sid.length?t.sid:W()),void 0!==t.init&&(e.init=t.init),!e.did&&t.did&&(e.did=`${t.did}`),"number"==typeof t.started&&(e.started=t.started),e.ignoreDuration)e.duration=void 0;else if("number"==typeof t.duration)e.duration=t.duration;else{const t=e.timestamp-e.started;e.duration=t>=0?t:0}t.release&&(e.release=t.release),t.environment&&(e.environment=t.environment),!e.ipAddress&&t.ipAddress&&(e.ipAddress=t.ipAddress),!e.userAgent&&t.userAgent&&(e.userAgent=t.userAgent),"number"==typeof t.errors&&(e.errors=t.errors),t.status&&(e.status=t.status)}function ne(e,t,n=2){if(!t||"object"!=typeof t||n<=0)return t;if(e&&0===Object.keys(t).length)return e;const r={...e};for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&(r[e]=ne(r[e],t[e],n-1));return r}const re="_sentrySpan";function se(e,t){t?q(e,re,t):delete e[re]}function oe(e){return e[re]}function ie(){return W()}function ae(){return W().substring(16)}class ce{constructor(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._attachments=[],this._user={},this._tags={},this._extra={},this._contexts={},this._sdkProcessingMetadata={},this._propagationContext={traceId:ie(),sampleRand:Math.random()}}clone(){const e=new ce;return e._breadcrumbs=[...this._breadcrumbs],e._tags={...this._tags},e._extra={...this._extra},e._contexts={...this._contexts},this._contexts.flags&&(e._contexts.flags={values:[...this._contexts.flags.values]}),e._user=this._user,e._level=this._level,e._session=this._session,e._transactionName=this._transactionName,e._fingerprint=this._fingerprint,e._eventProcessors=[...this._eventProcessors],e._attachments=[...this._attachments],e._sdkProcessingMetadata={...this._sdkProcessingMetadata},e._propagationContext={...this._propagationContext},e._client=this._client,e._lastEventId=this._lastEventId,se(e,oe(this)),e}setClient(e){this._client=e}setLastEventId(e){this._lastEventId=e}getClient(){return this._client}lastEventId(){return this._lastEventId}addScopeListener(e){this._scopeListeners.push(e)}addEventProcessor(e){return this._eventProcessors.push(e),this}setUser(e){return this._user=e||{email:void 0,id:void 0,ip_address:void 0,username:void 0},this._session&&te(this._session,{user:e}),this._notifyScopeListeners(),this}getUser(){return this._user}setTags(e){return this._tags={...this._tags,...e},this._notifyScopeListeners(),this}setTag(e,t){return this._tags={...this._tags,[e]:t},this._notifyScopeListeners(),this}setExtras(e){return this._extra={...this._extra,...e},this._notifyScopeListeners(),this}setExtra(e,t){return this._extra={...this._extra,[e]:t},this._notifyScopeListeners(),this}setFingerprint(e){return this._fingerprint=e,this._notifyScopeListeners(),this}setLevel(e){return this._level=e,this._notifyScopeListeners(),this}setTransactionName(e){return this._transactionName=e,this._notifyScopeListeners(),this}setContext(e,t){return null===t?delete this._contexts[e]:this._contexts[e]=t,this._notifyScopeListeners(),this}setSession(e){return e?this._session=e:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(e){if(!e)return this;const t="function"==typeof e?e(this):e,n=t instanceof ce?t.getScopeData():x(t)?e:void 0,{tags:r,extra:s,user:o,contexts:i,level:a,fingerprint:c=[],propagationContext:u}=n||{};return this._tags={...this._tags,...r},this._extra={...this._extra,...s},this._contexts={...this._contexts,...i},o&&Object.keys(o).length&&(this._user=o),a&&(this._level=a),c.length&&(this._fingerprint=c),u&&(this._propagationContext=u),this}clear(){return this._breadcrumbs=[],this._tags={},this._extra={},this._user={},this._contexts={},this._level=void 0,this._transactionName=void 0,this._fingerprint=void 0,this._session=void 0,se(this,void 0),this._attachments=[],this.setPropagationContext({traceId:ie(),sampleRand:Math.random()}),this._notifyScopeListeners(),this}addBreadcrumb(e,t){const n="number"==typeof t?t:100;if(n<=0)return this;const r={timestamp:Z(),...e,message:e.message?N(e.message,2048):e.message};return this._breadcrumbs.push(r),this._breadcrumbs.length>n&&(this._breadcrumbs=this._breadcrumbs.slice(-n),this._client?.recordDroppedEvent("buffer_overflow","log_item")),this._notifyScopeListeners(),this}getLastBreadcrumb(){return this._breadcrumbs[this._breadcrumbs.length-1]}clearBreadcrumbs(){return this._breadcrumbs=[],this._notifyScopeListeners(),this}addAttachment(e){return this._attachments.push(e),this}clearAttachments(){return this._attachments=[],this}getScopeData(){return{breadcrumbs:this._breadcrumbs,attachments:this._attachments,contexts:this._contexts,tags:this._tags,extra:this._extra,user:this._user,level:this._level,fingerprint:this._fingerprint||[],eventProcessors:this._eventProcessors,propagationContext:this._propagationContext,sdkProcessingMetadata:this._sdkProcessingMetadata,transactionName:this._transactionName,span:oe(this)}}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata=ne(this._sdkProcessingMetadata,e,2),this}setPropagationContext(e){return this._propagationContext=e,this}getPropagationContext(){return this._propagationContext}captureException(e,t){const n=t?.event_id||W();if(!this._client)return A.warn("No client configured on scope - will not capture exception!"),n;const r=new Error("Sentry syntheticException");return this._client.captureException(e,{originalException:e,syntheticException:r,...t,event_id:n},this),n}captureMessage(e,t,n){const r=n?.event_id||W();if(!this._client)return A.warn("No client configured on scope - will not capture message!"),r;const s=new Error(e);return this._client.captureMessage(e,t,{originalException:e,syntheticException:s,...n,event_id:r},this),r}captureEvent(e,t){const n=t?.event_id||W();return this._client?(this._client.captureEvent(e,{...t,event_id:n},this),n):(A.warn("No client configured on scope - will not capture event!"),n)}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach((e=>{e(this)})),this._notifyingListeners=!1)}}class ue{constructor(e,t){let n,r;n=e||new ce,r=t||new ce,this._stack=[{scope:n}],this._isolationScope=r}withScope(e){const t=this._pushScope();let n;try{n=e(t)}catch(e){throw this._popScope(),e}return T(n)?n.then((e=>(this._popScope(),e)),(e=>{throw this._popScope(),e})):(this._popScope(),n)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this._isolationScope}getStackTop(){return this._stack[this._stack.length-1]}_pushScope(){const e=this.getScope().clone();return this._stack.push({client:this.getClient(),scope:e}),e}_popScope(){return!(this._stack.length<=1||!this._stack.pop())}}function le(){const e=h(p());return e.stack=e.stack||new ue(f("defaultCurrentScope",(()=>new ce)),f("defaultIsolationScope",(()=>new ce)))}function de(e){return le().withScope(e)}function pe(e,t){const n=le();return n.withScope((()=>(n.getStackTop().scope=e,t(e))))}function he(e){return le().withScope((()=>e(le().getIsolationScope())))}function fe(e){const t=h(e);return t.acs?t.acs:{withIsolationScope:he,withScope:de,withSetScope:pe,withSetIsolationScope:(e,t)=>he(t),getCurrentScope:()=>le().getScope(),getIsolationScope:()=>le().getIsolationScope()}}function me(){return fe(p()).getCurrentScope()}function ge(){return fe(p()).getIsolationScope()}function _e(){return me().getClient()}function ye(e){const t=e.getPropagationContext(),{traceId:n,parentSpanId:r,propagationSpanId:s}=t,o={trace_id:n,span_id:s||ae()};return r&&(o.parent_span_id=r),o}const ve="production";var be;function Ee(e){return new we((t=>{t(e)}))}function Se(e){return new we(((t,n)=>{n(e)}))}!function(e){e[e.PENDING=0]="PENDING",e[e.RESOLVED=1]="RESOLVED",e[e.REJECTED=2]="REJECTED"}(be||(be={}));class we{constructor(e){this._state=be.PENDING,this._handlers=[],this._runExecutor(e)}then(e,t){return new we(((n,r)=>{this._handlers.push([!1,t=>{if(e)try{n(e(t))}catch(e){r(e)}else n(t)},e=>{if(t)try{n(t(e))}catch(e){r(e)}else r(e)}]),this._executeHandlers()}))}catch(e){return this.then((e=>e),e)}finally(e){return new we(((t,n)=>{let r,s;return this.then((t=>{s=!1,r=t,e&&e()}),(t=>{s=!0,r=t,e&&e()})).then((()=>{s?n(r):t(r)}))}))}_executeHandlers(){if(this._state===be.PENDING)return;const e=this._handlers.slice();this._handlers=[],e.forEach((e=>{e[0]||(this._state===be.RESOLVED&&e[1](this._value),this._state===be.REJECTED&&e[2](this._value),e[0]=!0)}))}_runExecutor(e){const t=(e,t)=>{this._state===be.PENDING&&(T(t)?t.then(n,r):(this._state=e,this._value=t,this._executeHandlers()))},n=e=>{t(be.RESOLVED,e)},r=e=>{t(be.REJECTED,e)};try{e(n,r)}catch(e){r(e)}}}function xe(e,t,n,r=0){return new we(((s,o)=>{const i=e[r];if(null===t||"function"!=typeof i)s(t);else{const a=i({...t},n);m&&i.id&&null===a&&A.log(`Event processor "${i.id}" dropped event`),T(a)?a.then((t=>xe(e,t,n,r+1).then(s))).then(null,o):xe(e,a,n,r+1).then(s).then(null,o)}}))}let ke,Te,Ce;const Pe="?",Oe=/\(error: (.*)\)/,Ie=/captureMessage|captureException/;function Re(...e){const t=e.sort(((e,t)=>e[0]-t[0])).map((e=>e[1]));return(e,n=0,r=0)=>{const s=[],o=e.split("\n");for(let e=n;e<o.length;e++){const n=o[e];if(n.length>1024)continue;const i=Oe.test(n)?n.replace(Oe,"$1"):n;if(!i.match(/\S*Error: /)){for(const e of t){const t=e(i);if(t){s.push(t);break}}if(s.length>=50+r)break}}return function(e){if(!e.length)return[];const t=Array.from(e);return/sentryWrapped/.test(De(t).function||"")&&t.pop(),t.reverse(),Ie.test(De(t).function||"")&&(t.pop(),Ie.test(De(t).function||"")&&t.pop()),t.slice(0,50).map((e=>({...e,filename:e.filename||De(t).filename,function:e.function||Pe})))}(s.slice(r))}}function De(e){return e[e.length-1]||{}}const $e="<anonymous>";function Le(e){try{return e&&"function"==typeof e&&e.name||$e}catch(e){return $e}}function je(e){const t=e.exception;if(t){const e=[];try{return t.values.forEach((t=>{t.stacktrace.frames&&e.push(...t.stacktrace.frames)})),e}catch(e){return}}}function Ae(e,t=100,n=1/0){try{return Me("",e,t,n)}catch(e){return{ERROR:`**non-serializable** (${e})`}}}function Ne(e,t=3,n=102400){const r=Ae(e,t);return s=r,function(e){return~-encodeURI(e).split(/%..|./).length}(JSON.stringify(s))>n?Ne(e,t-1,n):r;var s}function Me(e,t,n=1/0,r=1/0,s=function(){const e=new WeakSet;return[function(t){return!!e.has(t)||(e.add(t),!1)},function(t){e.delete(t)}]}()){const[o,i]=s;if(null==t||["boolean","string"].includes(typeof t)||"number"==typeof t&&Number.isFinite(t))return t;const a=function(e,t){try{if("domain"===e&&t&&"object"==typeof t&&t._events)return"[Domain]";if("domainEmitter"===e)return"[DomainEmitter]";if("undefined"!=typeof global&&t===global)return"[Global]";if("undefined"!=typeof window&&t===window)return"[Window]";if("undefined"!=typeof document&&t===document)return"[Document]";if(P(t))return"[VueViewModel]";if(x(n=t)&&"nativeEvent"in n&&"preventDefault"in n&&"stopPropagation"in n)return"[SyntheticEvent]";if("number"==typeof t&&!Number.isFinite(t))return`[${t}]`;if("function"==typeof t)return`[Function: ${Le(t)}]`;if("symbol"==typeof t)return`[${String(t)}]`;if("bigint"==typeof t)return`[BigInt: ${String(t)}]`;const r=function(e){const t=Object.getPrototypeOf(e);return t?.constructor?t.constructor.name:"null prototype"}(t);return/^HTML(\w*)Element$/.test(r)?`[HTMLElement: ${r}]`:`[object ${r}]`}catch(e){return`**non-serializable** (${e})`}var n}(e,t);if(!a.startsWith("[object "))return a;if(t.__sentry_skip_normalization__)return t;const c="number"==typeof t.__sentry_override_normalization_depth__?t.__sentry_override_normalization_depth__:n;if(0===c)return a.replace("object ","");if(o(t))return"[Circular ~]";const u=t;if(u&&"function"==typeof u.toJSON)try{return Me("",u.toJSON(),c-1,r,s)}catch(e){}const l=Array.isArray(t)?[]:{};let d=0;const p=z(t);for(const e in p){if(!Object.prototype.hasOwnProperty.call(p,e))continue;if(d>=r){l[e]="[MaxProperties ~]";break}const t=p[e];l[e]=Me(e,t,c-1,r,s),d++}return i(t),l}const Fe="sentry.profile_id",Ue="sentry.exclusive_time";function qe(e){return{scope:e._sentryScope,isolationScope:e._sentryIsolationScope}}let Be=!1;function He(e){const{spanId:t,traceId:n,isRemote:r}=e.spanContext(),s=r?t:We(e).parent_span_id,o=qe(e).scope;return{parent_span_id:s,span_id:r?o?.getPropagationContext().propagationSpanId||ae():t,trace_id:n}}function ze(e){return e&&e.length>0?e.map((({context:{spanId:e,traceId:t,traceFlags:n,...r},attributes:s})=>({span_id:e,trace_id:t,sampled:1===n,attributes:s,...r}))):void 0}function Ve(e){return"number"==typeof e?Ge(e):Array.isArray(e)?e[0]+e[1]/1e9:e instanceof Date?Ge(e.getTime()):ee()}function Ge(e){return e>9999999999?e/1e3:e}function We(e){if(function(e){return"function"==typeof e.getSpanJSON}(e))return e.getSpanJSON();const{spanId:t,traceId:n}=e.spanContext();if(function(e){const t=e;return!!(t.attributes&&t.startTime&&t.name&&t.endTime&&t.status)}(e)){const{attributes:r,startTime:s,name:o,endTime:i,status:a,links:c}=e;return{span_id:t,trace_id:n,data:r,description:o,parent_span_id:"parentSpanId"in e?e.parentSpanId:"parentSpanContext"in e?e.parentSpanContext?.spanId:void 0,start_timestamp:Ve(s),timestamp:Ve(i)||void 0,status:Ye(a),op:r["sentry.op"],origin:r["sentry.origin"],links:ze(c)}}return{span_id:t,trace_id:n,start_timestamp:0,data:{}}}function Ye(e){if(e&&0!==e.code)return 1===e.code?"ok":e.message||"unknown_error"}function Xe(e){return e._sentryRootSpan||e}function Je(){Be||(j((()=>{console.warn("[Sentry] Returning null from `beforeSendSpan` is disallowed. To drop certain spans, configure the respective integrations directly.")})),Be=!0)}const Ke=/^sentry-/;function Qe(e){return e.split(",").map((e=>e.split("=").map((e=>{try{return decodeURIComponent(e.trim())}catch{return}})))).reduce(((e,[t,n])=>(t&&n&&(e[t]=n),e)),{})}const Ze=/^o(\d+)\./,et=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)([\w.-]+)(?::(\d+))?\/(.+)/;function tt(e,t=!1){const{host:n,path:r,pass:s,port:o,projectId:i,protocol:a,publicKey:c}=e;return`${a}://${c}${t&&s?`:${s}`:""}@${n}${o?`:${o}`:""}/${r?`${r}/`:r}${i}`}function nt(e){return{protocol:e.protocol,publicKey:e.publicKey||"",pass:e.pass||"",host:e.host,port:e.port||"",path:e.path||"",projectId:e.projectId}}function rt(e,t){const n=t.getOptions(),{publicKey:r,host:s}=t.getDsn()||{};let o;n.orgId?o=String(n.orgId):s&&(o=function(e){const t=e.match(Ze);return t?.[1]}(s));const i={environment:n.environment||ve,release:n.release,public_key:r,trace_id:e,org_id:o};return t.emit("createDsc",i),i}function st(e){const t=_e();if(!t)return{};const n=Xe(e),r=We(n),s=r.data,o=n.spanContext().traceState,i=o?.get("sentry.sample_rate")??s["sentry.sample_rate"]??s["sentry.previous_trace_sample_rate"];function a(e){return"number"!=typeof i&&"string"!=typeof i||(e.sample_rate=`${i}`),e}const c=n._frozenDsc;if(c)return a(c);const u=o?.get("sentry.dsc"),l=u&&function(e){const t=function(e){if(e&&(E(e)||Array.isArray(e)))return Array.isArray(e)?e.reduce(((e,t)=>{const n=Qe(t);return Object.entries(n).forEach((([t,n])=>{e[t]=n})),e}),{}):Qe(e)}(e);if(!t)return;const n=Object.entries(t).reduce(((e,[t,n])=>(t.match(Ke)&&(e[t.slice(7)]=n),e)),{});return Object.keys(n).length>0?n:void 0}(u);if(l)return a(l);const d=rt(e.spanContext().traceId,t),p=s["sentry.source"],h=r.description;return"url"!==p&&h&&(d.transaction=h),function(e){if("boolean"==typeof __SENTRY_TRACING__&&!__SENTRY_TRACING__)return!1;const t=e||_e()?.getOptions();return!(!t||null==t.tracesSampleRate&&!t.tracesSampler)}()&&(d.sampled=String(function(e){const{traceFlags:t}=e.spanContext();return 1===t}(n)),d.sample_rand=o?.get("sentry.sample_rand")??qe(n).scope?.getPropagationContext().sampleRand.toString()),a(d),t.emit("createDsc",d,n),d}function ot(e,t){const{extra:n,tags:r,user:s,contexts:o,level:i,sdkProcessingMetadata:a,breadcrumbs:c,fingerprint:u,eventProcessors:l,attachments:d,propagationContext:p,transactionName:h,span:f}=t;it(e,"extra",n),it(e,"tags",r),it(e,"user",s),it(e,"contexts",o),e.sdkProcessingMetadata=ne(e.sdkProcessingMetadata,a,2),i&&(e.level=i),h&&(e.transactionName=h),f&&(e.span=f),c.length&&(e.breadcrumbs=[...e.breadcrumbs,...c]),u.length&&(e.fingerprint=[...e.fingerprint,...u]),l.length&&(e.eventProcessors=[...e.eventProcessors,...l]),d.length&&(e.attachments=[...e.attachments,...d]),e.propagationContext={...e.propagationContext,...p}}function it(e,t,n){e[t]=ne(e[t],n,1)}function at(e,t,n,r,s,o){const{normalizeDepth:i=3,normalizeMaxBreadth:a=1e3}=e,c={...t,event_id:t.event_id||n.event_id||W(),timestamp:t.timestamp||Z()},u=n.integrations||e.integrations.map((e=>e.name));!function(e,t){const{environment:n,release:r,dist:s,maxValueLength:o=250}=t;e.environment=e.environment||n||ve,!e.release&&r&&(e.release=r),!e.dist&&s&&(e.dist=s);const i=e.request;i?.url&&(i.url=N(i.url,o))}(c,e),function(e,t){t.length>0&&(e.sdk=e.sdk||{},e.sdk.integrations=[...e.sdk.integrations||[],...t])}(c,u),s&&s.emit("applyFrameMetadata",t),void 0===t.type&&function(e,t){const n=function(e){const t=d._sentryDebugIds;if(!t)return{};const n=Object.keys(t);return Ce&&n.length===Te||(Te=n.length,Ce=n.reduce(((n,r)=>{ke||(ke={});const s=ke[r];if(s)n[s[0]]=s[1];else{const s=e(r);for(let e=s.length-1;e>=0;e--){const o=s[e],i=o?.filename,a=t[r];if(i&&a){n[i]=a,ke[r]=[i,a];break}}}return n}),{})),Ce}(t);e.exception?.values?.forEach((e=>{e.stacktrace?.frames?.forEach((e=>{e.filename&&(e.debug_id=n[e.filename])}))}))}(c,e.stackParser);const l=function(e,t){if(!t)return e;const n=e?e.clone():new ce;return n.update(t),n}(r,n.captureContext);n.mechanism&&K(c,n.mechanism);const p=s?s.getEventProcessors():[],h=f("globalScope",(()=>new ce)).getScopeData();o&&ot(h,o.getScopeData()),l&&ot(h,l.getScopeData());const m=[...n.attachments||[],...h.attachments];return m.length&&(n.attachments=m),function(e,t){const{fingerprint:n,span:r,breadcrumbs:s,sdkProcessingMetadata:o}=t;!function(e,t){const{extra:n,tags:r,user:s,contexts:o,level:i,transactionName:a}=t;Object.keys(n).length&&(e.extra={...n,...e.extra}),Object.keys(r).length&&(e.tags={...r,...e.tags}),Object.keys(s).length&&(e.user={...s,...e.user}),Object.keys(o).length&&(e.contexts={...o,...e.contexts}),i&&(e.level=i),a&&"transaction"!==e.type&&(e.transaction=a)}(e,t),r&&function(e,t){e.contexts={trace:He(t),...e.contexts},e.sdkProcessingMetadata={dynamicSamplingContext:st(t),...e.sdkProcessingMetadata};const n=We(Xe(t)).description;n&&!e.transaction&&"transaction"===e.type&&(e.transaction=n)}(e,r),function(e,t){e.fingerprint=e.fingerprint?Array.isArray(e.fingerprint)?e.fingerprint:[e.fingerprint]:[],t&&(e.fingerprint=e.fingerprint.concat(t)),e.fingerprint.length||delete e.fingerprint}(e,n),function(e,t){const n=[...e.breadcrumbs||[],...t];e.breadcrumbs=n.length?n:void 0}(e,s),function(e,t){e.sdkProcessingMetadata={...e.sdkProcessingMetadata,...t}}(e,o)}(c,h),xe([...p,...h.eventProcessors],c,n).then((e=>(e&&function(e){const t={};if(e.exception?.values?.forEach((e=>{e.stacktrace?.frames?.forEach((e=>{e.debug_id&&(e.abs_path?t[e.abs_path]=e.debug_id:e.filename&&(t[e.filename]=e.debug_id),delete e.debug_id)}))})),0===Object.keys(t).length)return;e.debug_meta=e.debug_meta||{},e.debug_meta.images=e.debug_meta.images||[];const n=e.debug_meta.images;Object.entries(t).forEach((([e,t])=>{n.push({type:"sourcemap",code_file:e,debug_id:t})}))}(e),"number"==typeof i&&i>0?function(e,t,n){if(!e)return null;const r={...e,...e.breadcrumbs&&{breadcrumbs:e.breadcrumbs.map((e=>({...e,...e.data&&{data:Ae(e.data,t,n)}})))},...e.user&&{user:Ae(e.user,t,n)},...e.contexts&&{contexts:Ae(e.contexts,t,n)},...e.extra&&{extra:Ae(e.extra,t,n)}};return e.contexts?.trace&&r.contexts&&(r.contexts.trace=e.contexts.trace,e.contexts.trace.data&&(r.contexts.trace.data=Ae(e.contexts.trace.data,t,n))),e.spans&&(r.spans=e.spans.map((e=>({...e,...e.data&&{data:Ae(e.data,t,n)}})))),e.contexts?.flags&&r.contexts&&(r.contexts.flags=Ae(e.contexts.flags,3,n)),r}(e,i,a):e)))}const ct=["user","level","extra","contexts","tags","fingerprint","propagationContext"];function ut(e,t){return me().captureException(e,function(e){if(e)return function(e){return e instanceof ce||"function"==typeof e}(e)||function(e){return Object.keys(e).some((e=>ct.includes(e)))}(e)?{captureContext:e}:e}(t))}function lt(e,t){return me().captureEvent(e,t)}function dt(e){const t=ge(),n=me(),{userAgent:r}=d.navigator||{},s=function(e){const t=ee(),n={sid:W(),init:!0,timestamp:t,started:t,duration:0,status:"ok",errors:0,ignoreDuration:!1,toJSON:()=>function(e){return{sid:`${e.sid}`,init:e.init,started:new Date(1e3*e.started).toISOString(),timestamp:new Date(1e3*e.timestamp).toISOString(),status:e.status,errors:e.errors,did:"number"==typeof e.did||"string"==typeof e.did?`${e.did}`:void 0,duration:e.duration,abnormal_mechanism:e.abnormal_mechanism,attrs:{release:e.release,environment:e.environment,ip_address:e.ipAddress,user_agent:e.userAgent}}}(n)};return e&&te(n,e),n}({user:n.getUser()||t.getUser(),...r&&{userAgent:r},...e}),o=t.getSession();return"ok"===o?.status&&te(o,{status:"exited"}),pt(),t.setSession(s),s}function pt(){const e=ge(),t=me().getSession()||e.getSession();t&&function(e){let t={};"ok"===e.status&&(t={status:"exited"}),te(e,t)}(t),ht(),e.setSession()}function ht(){const e=ge(),t=_e(),n=e.getSession();n&&t&&t.captureSession(n)}function ft(e=!1){e?pt():ht()}const mt=[];function gt(e){const t=e.defaultIntegrations||[],n=e.integrations;let r;if(t.forEach((e=>{e.isDefaultInstance=!0})),Array.isArray(n))r=[...t,...n];else if("function"==typeof n){const e=n(t);r=Array.isArray(e)?e:[e]}else r=t;return function(e){const t={};return e.forEach((e=>{const{name:n}=e,r=t[n];r&&!r.isDefaultInstance&&e.isDefaultInstance||(t[n]=e)})),Object.values(t)}(r)}function _t(e,t){for(const n of t)n?.afterAllSetup&&n.afterAllSetup(e)}function yt(e,t,n){if(n[t.name])m&&A.log(`Integration skipped because it was already installed: ${t.name}`);else{if(n[t.name]=t,-1===mt.indexOf(t.name)&&"function"==typeof t.setupOnce&&(t.setupOnce(),mt.push(t.name)),t.setup&&"function"==typeof t.setup&&t.setup(e),"function"==typeof t.preprocessEvent){const n=t.preprocessEvent.bind(t);e.on("preprocessEvent",((t,r)=>n(t,r,e)))}if("function"==typeof t.processEvent){const n=t.processEvent.bind(t),r=Object.assign(((t,r)=>n(t,r,e)),{id:t.name});e.addEventProcessor(r)}m&&A.log(`Integration installed: ${t.name}`)}}function vt(e){const t=[];e.message&&t.push(e.message);try{const n=e.exception.values[e.exception.values.length-1];n?.value&&(t.push(n.value),n.type&&t.push(`${n.type}: ${n.value}`))}catch(e){}return t}const bt=[/^Script error\.?$/,/^Javascript error: Script error\.? on line 0$/,/^ResizeObserver loop completed with undelivered notifications.$/,/^Cannot redefine property: googletag$/,/^Can't find variable: gmo$/,/^undefined is not an object \(evaluating 'a\.[A-Z]'\)$/,'can\'t redefine non-configurable property "solana"',"vv().getRestrictions is not a function. (In 'vv().getRestrictions(1,a)', 'vv().getRestrictions' is undefined)","Can't find variable: _AutofillCallbackHandler",/^Non-Error promise rejection captured with value: Object Not Found Matching Id:\d+, MethodName:simulateEvent, ParamCount:\d+$/,/^Java exception was raised during method invocation$/],Et=(e={})=>{let t;return{name:"EventFilters",setup(n){const r=n.getOptions();t=wt(e,r)},processEvent(n,r,s){if(!t){const n=s.getOptions();t=wt(e,n)}return function(e,t){if(e.type){if("transaction"===e.type&&function(e,t){if(!t?.length)return!1;const n=e.transaction;return!!n&&F(n,t)}(e,t.ignoreTransactions))return m&&A.warn(`Event dropped due to being matched by \`ignoreTransactions\` option.\nEvent: ${X(e)}`),!0}else{if(function(e,t){return!!t?.length&&vt(e).some((e=>F(e,t)))}(e,t.ignoreErrors))return m&&A.warn(`Event dropped due to being matched by \`ignoreErrors\` option.\nEvent: ${X(e)}`),!0;if(function(e){return!!e.exception?.values?.length&&(!e.message&&!e.exception.values.some((e=>e.stacktrace||e.type&&"Error"!==e.type||e.value)))}(e))return m&&A.warn(`Event dropped due to not having an error message, error type or stacktrace.\nEvent: ${X(e)}`),!0;if(function(e,t){if(!t?.length)return!1;const n=xt(e);return!!n&&F(n,t)}(e,t.denyUrls))return m&&A.warn(`Event dropped due to being matched by \`denyUrls\` option.\nEvent: ${X(e)}.\nUrl: ${xt(e)}`),!0;if(!function(e,t){if(!t?.length)return!0;const n=xt(e);return!n||F(n,t)}(e,t.allowUrls))return m&&A.warn(`Event dropped due to not being matched by \`allowUrls\` option.\nEvent: ${X(e)}.\nUrl: ${xt(e)}`),!0}return!1}(n,t)?null:n}}},St=(e={})=>({...Et(e),name:"InboundFilters"});function wt(e={},t={}){return{allowUrls:[...e.allowUrls||[],...t.allowUrls||[]],denyUrls:[...e.denyUrls||[],...t.denyUrls||[]],ignoreErrors:[...e.ignoreErrors||[],...t.ignoreErrors||[],...e.disableErrorDefaults?[]:bt],ignoreTransactions:[...e.ignoreTransactions||[],...t.ignoreTransactions||[]]}}function xt(e){try{const t=[...e.exception?.values??[]].reverse().find((e=>void 0===e.mechanism?.parent_id&&e.stacktrace?.frames?.length)),n=t?.stacktrace?.frames;return n?function(e=[]){for(let t=e.length-1;t>=0;t--){const n=e[t];if(n&&"<anonymous>"!==n.filename&&"[native code]"!==n.filename)return n.filename||null}return null}(n):null}catch(t){return m&&A.error(`Cannot extract url for event ${X(e)}`),null}}let kt;const Tt=new WeakMap,Ct=()=>({name:"FunctionToString",setupOnce(){kt=Function.prototype.toString;try{Function.prototype.toString=function(...e){const t=H(this),n=Tt.has(_e())&&void 0!==t?t:this;return kt.apply(n,e)}}catch{}},setup(e){Tt.set(e,!0)}}),Pt=()=>{let e;return{name:"Dedupe",processEvent(t){if(t.type)return t;try{if(function(e,t){return!!t&&(!!function(e,t){const n=e.message,r=t.message;return!(!n&&!r)&&(!(n&&!r||!n&&r)&&(n===r&&(!!It(e,t)&&!!Ot(e,t))))}(e,t)||!!function(e,t){const n=Rt(t),r=Rt(e);return!(!n||!r)&&(n.type===r.type&&n.value===r.value&&(!!It(e,t)&&!!Ot(e,t)))}(e,t))}(t,e))return m&&A.warn("Event dropped due to being a duplicate of previously captured event."),null}catch(e){}return e=t}}};function Ot(e,t){let n=je(e),r=je(t);if(!n&&!r)return!0;if(n&&!r||!n&&r)return!1;if(r.length!==n.length)return!1;for(let e=0;e<r.length;e++){const t=r[e],s=n[e];if(t.filename!==s.filename||t.lineno!==s.lineno||t.colno!==s.colno||t.function!==s.function)return!1}return!0}function It(e,t){let n=e.fingerprint,r=t.fingerprint;if(!n&&!r)return!0;if(n&&!r||!n&&r)return!1;try{return!(n.join("")!==r.join(""))}catch(e){return!1}}function Rt(e){return e.exception?.values&&e.exception.values[0]}function Dt(e,t=[]){return[e,t]}function $t(e,t){const[n,r]=e;return[n,[...r,t]]}function Lt(e,t){const n=e[1];for(const e of n)if(t(e,e[0].type))return!0;return!1}function jt(e){const t=h(d);return t.encodePolyfill?t.encodePolyfill(e):(new TextEncoder).encode(e)}function At(e){const[t,n]=e;let r=JSON.stringify(t);function s(e){"string"==typeof r?r="string"==typeof e?r+e:[jt(r),e]:r.push("string"==typeof e?jt(e):e)}for(const e of n){const[t,n]=e;if(s(`\n${JSON.stringify(t)}\n`),"string"==typeof n||n instanceof Uint8Array)s(n);else{let e;try{e=JSON.stringify(n)}catch(t){e=JSON.stringify(Ae(n))}s(e)}}return"string"==typeof r?r:function(e){const t=e.reduce(((e,t)=>e+t.length),0),n=new Uint8Array(t);let r=0;for(const t of e)n.set(t,r),r+=t.length;return n}(r)}function Nt(e){const t="string"==typeof e.data?jt(e.data):e.data;return[{type:"attachment",length:t.length,filename:e.filename,content_type:e.contentType,attachment_type:e.attachmentType},t]}const Mt={session:"session",sessions:"session",attachment:"attachment",transaction:"transaction",event:"error",client_report:"internal",user_report:"default",profile:"profile",profile_chunk:"profile",replay_event:"replay",replay_recording:"replay",check_in:"monitor",feedback:"feedback",span:"span",raw_security:"security",log:"log_item"};function Ft(e){return Mt[e]}function Ut(e){if(!e?.sdk)return;const{name:t,version:n}=e.sdk;return{name:t,version:n}}const qt="Not capturing exception because it's already been captured.",Bt="Discarded session because of missing or non-string release",Ht=Symbol.for("SentryInternalError"),zt=Symbol.for("SentryDoNotSendEventError");function Vt(e){return{message:e,[Ht]:!0}}function Gt(e){return{message:e,[zt]:!0}}function Wt(e){return!!e&&"object"==typeof e&&Ht in e}function Yt(e){return!!e&&"object"==typeof e&&zt in e}class Xt{constructor(e){if(this._options=e,this._integrations={},this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],e.dsn?this._dsn=function(e){const t="string"==typeof e?function(e){const t=et.exec(e);if(!t)return void j((()=>{console.error(`Invalid Sentry Dsn: ${e}`)}));const[n,r,s="",o="",i="",a=""]=t.slice(1);let c="",u=a;const l=u.split("/");if(l.length>1&&(c=l.slice(0,-1).join("/"),u=l.pop()),u){const e=u.match(/^\d+/);e&&(u=e[0])}return nt({host:o,pass:s,path:c,projectId:u,port:i,protocol:n,publicKey:r})}(e):nt(e);if(t&&function(e){if(!m)return!0;const{port:t,projectId:n,protocol:r}=e;return!(["protocol","publicKey","host","projectId"].find((t=>!e[t]&&(A.error(`Invalid Sentry Dsn: ${t} missing`),!0)))||(n.match(/^\d+$/)?function(e){return"http"===e||"https"===e}(r)?t&&isNaN(parseInt(t,10))&&(A.error(`Invalid Sentry Dsn: Invalid port ${t}`),1):(A.error(`Invalid Sentry Dsn: Invalid protocol ${r}`),1):(A.error(`Invalid Sentry Dsn: Invalid projectId ${n}`),1)))}(t))return t}(e.dsn):m&&A.warn("No DSN provided, client will not send events."),this._dsn){const s=(t=this._dsn,n=e.tunnel,r=e._metadata?e._metadata.sdk:void 0,n||`${function(e){return`${function(e){const t=e.protocol?`${e.protocol}:`:"",n=e.port?`:${e.port}`:"";return`${t}//${e.host}${n}${e.path?`/${e.path}`:""}/api/`}(e)}${e.projectId}/envelope/`}(t)}?${function(e,t){const n={sentry_version:"7"};return e.publicKey&&(n.sentry_key=e.publicKey),t&&(n.sentry_client=`${t.name}/${t.version}`),new URLSearchParams(n).toString()}(t,r)}`);this._transport=e.transport({tunnel:this._options.tunnel,recordDroppedEvent:this.recordDroppedEvent.bind(this),...e.transportOptions,url:s})}var t,n,r}captureException(e,t,n){const r=W();if(Q(e))return m&&A.log(qt),r;const s={event_id:r,...t};return this._process(this.eventFromException(e,s).then((e=>this._captureEvent(e,s,n)))),s.event_id}captureMessage(e,t,n,r){const s={event_id:W(),...n},o=S(e)?e:String(e),i=w(e)?this.eventFromMessage(o,t,s):this.eventFromException(e,s);return this._process(i.then((e=>this._captureEvent(e,s,r)))),s.event_id}captureEvent(e,t,n){const r=W();if(t?.originalException&&Q(t.originalException))return m&&A.log(qt),r;const s={event_id:r,...t},o=e.sdkProcessingMetadata||{},i=o.capturedSpanScope,a=o.capturedSpanIsolationScope;return this._process(this._captureEvent(e,s,i||n,a)),s.event_id}captureSession(e){this.sendSession(e),te(e,{init:!1})}getDsn(){return this._dsn}getOptions(){return this._options}getSdkMetadata(){return this._options._metadata}getTransport(){return this._transport}flush(e){const t=this._transport;return t?(this.emit("flush"),this._isClientDoneProcessing(e).then((n=>t.flush(e).then((e=>n&&e))))):Ee(!0)}close(e){return this.flush(e).then((e=>(this.getOptions().enabled=!1,this.emit("close"),e)))}getEventProcessors(){return this._eventProcessors}addEventProcessor(e){this._eventProcessors.push(e)}init(){(this._isEnabled()||this._options.integrations.some((({name:e})=>e.startsWith("Spotlight"))))&&this._setupIntegrations()}getIntegrationByName(e){return this._integrations[e]}addIntegration(e){const t=this._integrations[e.name];yt(this,e,this._integrations),t||_t(this,[e])}sendEvent(e,t={}){this.emit("beforeSendEvent",e,t);let n=function(e,t,n,r){const s=Ut(n),o=e.type&&"replay_event"!==e.type?e.type:"event";!function(e,t){t&&(e.sdk=e.sdk||{},e.sdk.name=e.sdk.name||t.name,e.sdk.version=e.sdk.version||t.version,e.sdk.integrations=[...e.sdk.integrations||[],...t.integrations||[]],e.sdk.packages=[...e.sdk.packages||[],...t.packages||[]])}(e,n?.sdk);const i=function(e,t,n,r){const s=e.sdkProcessingMetadata?.dynamicSamplingContext;return{event_id:e.event_id,sent_at:(new Date).toISOString(),...t&&{sdk:t},...!!n&&r&&{dsn:tt(r)},...s&&{trace:s}}}(e,s,r,t);return delete e.sdkProcessingMetadata,Dt(i,[[{type:o},e]])}(e,this._dsn,this._options._metadata,this._options.tunnel);for(const e of t.attachments||[])n=$t(n,Nt(e));const r=this.sendEnvelope(n);r&&r.then((t=>this.emit("afterSendEvent",e,t)),null)}sendSession(e){const{release:t,environment:n=ve}=this._options;if("aggregates"in e){const r=e.attrs||{};if(!r.release&&!t)return void(m&&A.warn(Bt));r.release=r.release||t,r.environment=r.environment||n,e.attrs=r}else{if(!e.release&&!t)return void(m&&A.warn(Bt));e.release=e.release||t,e.environment=e.environment||n}this.emit("beforeSendSession",e);const r=function(e,t,n,r){const s=Ut(n);return Dt({sent_at:(new Date).toISOString(),...s&&{sdk:s},...!!r&&t&&{dsn:tt(t)}},["aggregates"in e?[{type:"sessions"},e]:[{type:"session"},e.toJSON()]])}(e,this._dsn,this._options._metadata,this._options.tunnel);this.sendEnvelope(r)}recordDroppedEvent(e,t,n=1){if(this._options.sendClientReports){const r=`${e}:${t}`;m&&A.log(`Recording outcome: "${r}"${n>1?` (${n} times)`:""}`),this._outcomes[r]=(this._outcomes[r]||0)+n}}on(e,t){const n=this._hooks[e]=this._hooks[e]||[];return n.push(t),()=>{const e=n.indexOf(t);e>-1&&n.splice(e,1)}}emit(e,...t){const n=this._hooks[e];n&&n.forEach((e=>e(...t)))}sendEnvelope(e){return this.emit("beforeEnvelope",e),this._isEnabled()&&this._transport?this._transport.send(e).then(null,(e=>(m&&A.error("Error while sending envelope:",e),e))):(m&&A.error("Transport disabled"),Ee({}))}_setupIntegrations(){const{integrations:e}=this._options;this._integrations=function(e,t){const n={};return t.forEach((t=>{t&&yt(e,t,n)})),n}(this,e),_t(this,e)}_updateSessionFromEvent(e,t){let n="fatal"===t.level,r=!1;const s=t.exception?.values;if(s){r=!0;for(const e of s){const t=e.mechanism;if(!1===t?.handled){n=!0;break}}}const o="ok"===e.status;(o&&0===e.errors||o&&n)&&(te(e,{...n&&{status:"crashed"},errors:e.errors||Number(r||n)}),this.captureSession(e))}_isClientDoneProcessing(e){return new we((t=>{let n=0;const r=setInterval((()=>{0==this._numProcessing?(clearInterval(r),t(!0)):(n+=1,e&&n>=e&&(clearInterval(r),t(!1)))}),1)}))}_isEnabled(){return!1!==this.getOptions().enabled&&void 0!==this._transport}_prepareEvent(e,t,n,r){const s=this.getOptions(),o=Object.keys(this._integrations);return!t.integrations&&o?.length&&(t.integrations=o),this.emit("preprocessEvent",e,t),e.type||r.setLastEventId(e.event_id||t.event_id),at(s,e,t,n,this,r).then((e=>{if(null===e)return e;this.emit("postprocessEvent",e,t),e.contexts={trace:ye(n),...e.contexts};const r=function(e,t){const n=t.getPropagationContext();return n.dsc||rt(n.traceId,e)}(this,n);return e.sdkProcessingMetadata={dynamicSamplingContext:r,...e.sdkProcessingMetadata},e}))}_captureEvent(e,t={},n=me(),r=ge()){return m&&Jt(e)&&A.log(`Captured error event \`${vt(e)[0]||"<unknown>"}\``),this._processEvent(e,t,n,r).then((e=>e.event_id),(e=>{m&&(Yt(e)?A.log(e.message):Wt(e)?A.warn(e.message):A.warn(e))}))}_processEvent(e,t,n,r){const s=this.getOptions(),{sampleRate:o}=s,i=Kt(e),a=Jt(e),c=e.type||"error",u=`before send for type \`${c}\``,l=void 0===o?void 0:function(e){if("boolean"==typeof e)return Number(e);const t="string"==typeof e?parseFloat(e):e;return"number"!=typeof t||isNaN(t)||t<0||t>1?void 0:t}(o);if(a&&"number"==typeof l&&Math.random()>l)return this.recordDroppedEvent("sample_rate","error"),Se(Gt(`Discarding event because it's not included in the random sample (sampling rate = ${o})`));const d="replay_event"===c?"replay":c;return this._prepareEvent(e,t,n,r).then((e=>{if(null===e)throw this.recordDroppedEvent("event_processor",d),Gt("An event processor returned `null`, will not send event.");if(t.data&&!0===t.data.__sentry__)return e;const n=function(e,t,n,r){const{beforeSend:s,beforeSendTransaction:o,beforeSendSpan:i}=t;let a=n;if(Jt(a)&&s)return s(a,r);if(Kt(a)){if(i){const e=i(function(e){const{trace_id:t,parent_span_id:n,span_id:r,status:s,origin:o,data:i,op:a}=e.contexts?.trace??{};return{data:i??{},description:e.transaction,op:a,parent_span_id:n,span_id:r??"",start_timestamp:e.start_timestamp??0,status:s,timestamp:e.timestamp,trace_id:t??"",origin:o,profile_id:i?.[Fe],exclusive_time:i?.[Ue],measurements:e.measurements,is_segment:!0}}(a));if(e?a=ne(n,{type:"transaction",timestamp:(c=e).timestamp,start_timestamp:c.start_timestamp,transaction:c.description,contexts:{trace:{trace_id:c.trace_id,span_id:c.span_id,parent_span_id:c.parent_span_id,op:c.op,status:c.status,origin:c.origin,data:{...c.data,...c.profile_id&&{[Fe]:c.profile_id},...c.exclusive_time&&{[Ue]:c.exclusive_time}}}},measurements:c.measurements}):Je(),a.spans){const e=[];for(const t of a.spans){const n=i(t);n?e.push(n):(Je(),e.push(t))}a.spans=e}}if(o){if(a.spans){const e=a.spans.length;a.sdkProcessingMetadata={...n.sdkProcessingMetadata,spanCountBeforeProcessing:e}}return o(a,r)}}var c;return a}(0,s,e,t);return function(e,t){const n=`${t} must return \`null\` or a valid event.`;if(T(e))return e.then((e=>{if(!x(e)&&null!==e)throw Vt(n);return e}),(e=>{throw Vt(`${t} rejected with ${e}`)}));if(!x(e)&&null!==e)throw Vt(n);return e}(n,u)})).then((s=>{if(null===s){if(this.recordDroppedEvent("before_send",d),i){const t=1+(e.spans||[]).length;this.recordDroppedEvent("before_send","span",t)}throw Gt(`${u} returned \`null\`, will not send event.`)}const o=n.getSession()||r.getSession();if(a&&o&&this._updateSessionFromEvent(o,s),i){const e=(s.sdkProcessingMetadata?.spanCountBeforeProcessing||0)-(s.spans?s.spans.length:0);e>0&&this.recordDroppedEvent("before_send","span",e)}const c=s.transaction_info;if(i&&c&&s.transaction!==e.transaction){const e="custom";s.transaction_info={...c,source:e}}return this.sendEvent(s,t),s})).then(null,(e=>{if(Yt(e)||Wt(e))throw e;throw this.captureException(e,{data:{__sentry__:!0},originalException:e}),Vt(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.\nReason: ${e}`)}))}_process(e){this._numProcessing++,e.then((e=>(this._numProcessing--,e)),(e=>(this._numProcessing--,e)))}_clearOutcomes(){const e=this._outcomes;return this._outcomes={},Object.entries(e).map((([e,t])=>{const[n,r]=e.split(":");return{reason:n,category:r,quantity:t}}))}_flushOutcomes(){m&&A.log("Flushing outcomes...");const e=this._clearOutcomes();if(0===e.length)return void(m&&A.log("No outcomes to send"));if(!this._dsn)return void(m&&A.log("No dsn provided, will not send outcomes"));m&&A.log("Sending outcomes:",e);const t=(n=e,Dt((r=this._options.tunnel&&tt(this._dsn))?{dsn:r}:{},[[{type:"client_report"},{timestamp:Z(),discarded_events:n}]]));var n,r;this.sendEnvelope(t)}}function Jt(e){return void 0===e.type}function Kt(e){return"transaction"===e.type}function Qt(e,t){const n=t??function(e){return d._sentryClientToLogBufferMap?.get(e)}(e)??[];if(0===n.length)return;const r=e.getOptions(),s=function(e,t,n,r){const s={};return t?.sdk&&(s.sdk={name:t.sdk.name,version:t.sdk.version}),n&&r&&(s.dsn=tt(r)),Dt(s,[(o=e,[{type:"log",item_count:o.length,content_type:"application/vnd.sentry.items.log+json"},{items:o}])]);var o}(n,r._metadata,r.tunnel,e.getDsn());d._sentryClientToLogBufferMap?.set(e,[]),e.emit("flushLogs"),e.sendEnvelope(s)}function Zt(e){void 0===e.user?.ip_address&&(e.user={...e.user,ip_address:"{{auto}}"})}function en(e){"aggregates"in e?void 0===e.attrs?.ip_address&&(e.attrs={...e.attrs,ip_address:"{{auto}}"}):void 0===e.ipAddress&&(e.ipAddress="{{auto}}")}function tn(e,t){const n=rn(e,t),r={type:an(t),value:cn(t)};return n.length&&(r.stacktrace={frames:n}),void 0===r.type&&""===r.value&&(r.value="Unrecoverable error caught"),r}function nn(e,t){return{exception:{values:[tn(e,t)]}}}function rn(e,t){const n=t.stacktrace||t.stack||"",r=function(e){return e&&sn.test(e.message)?1:0}(t),s=function(e){return"number"==typeof e.framesToPop?e.framesToPop:0}(t);try{return e(n,r,s)}catch(e){}return[]}d._sentryClientToLogBufferMap=new WeakMap;const sn=/Minified React error #\d+;/i;function on(e){return"undefined"!=typeof WebAssembly&&void 0!==WebAssembly.Exception&&e instanceof WebAssembly.Exception}function an(e){const t=e?.name;return!t&&on(e)?e.message&&Array.isArray(e.message)&&2==e.message.length?e.message[0]:"WebAssembly.Exception":t}function cn(e){const t=e?.message;return on(e)?Array.isArray(e.message)&&2==e.message.length?e.message[1]:"wasm exception":t?t.error&&"string"==typeof t.error.message?t.error.message:t:"No error message"}function un(e,t,n,r,s){let o;if(v(t)&&t.error)return nn(e,t.error);if(b(t)||y(t,"DOMException")){const s=t;if("stack"in t)o=nn(e,t);else{const t=s.name||(b(s)?"DOMError":"DOMException"),i=s