@deflectbot/deflect-sdk 1.3.6 → 1.3.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +44 -0
- package/dist/index.esm.js +302 -0
- package/dist/index.js +6873 -194
- package/dist/index.min.js +15 -1
- package/package.json +14 -4
package/dist/index.min.js
CHANGED
|
@@ -1 +1,15 @@
|
|
|
1
|
-
"use strict";(()=>{var
|
|
1
|
+
"use strict";(()=>{var m=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;var g=globalThis;var P="10.22.0";function te(){return re(g),g}function re(e){let t=e.__SENTRY__=e.__SENTRY__||{};return t.version=t.version||P,t[P]=t[P]||{}}function M(e,t,r=g){let n=r.__SENTRY__=r.__SENTRY__||{},o=n[P]=n[P]||{};return o[e]||(o[e]=t())}var _t=["debug","info","warn","error","log","assert","trace"],Po="Sentry Logger ",de={};function O(e){if(!("console"in g))return e();let t=g.console,r={},n=Object.keys(de);n.forEach(o=>{let i=de[o];r[o]=t[o],t[o]=i});try{return e()}finally{n.forEach(o=>{t[o]=r[o]})}}function Bo(){St().enabled=!0}function Ho(){St().enabled=!1}function Fr(){return St().enabled}function $o(...e){Et("log",...e)}function Go(...e){Et("warn",...e)}function jo(...e){Et("error",...e)}function Et(e,...t){m&&Fr()&&O(()=>{g.console[e](`${Po}[${e}]:`,...t)})}function St(){return m?M("loggerSettings",()=>({enabled:!1})):{enabled:!1}}var d={enable:Bo,disable:Ho,isEnabled:Fr,log:$o,warn:Go,error:jo};var B="?",Ur=/\(error: (.*)\)/,Pr=/captureMessage|captureException/;function Pe(...e){let t=e.sort((r,n)=>r[0]-n[0]).map(r=>r[1]);return(r,n=0,o=0)=>{let i=[],s=r.split(`
|
|
2
|
+
`);for(let a=n;a<s.length;a++){let c=s[a];c.length>1024&&(c=c.slice(0,1024));let u=Ur.test(c)?c.replace(Ur,"$1"):c;if(!u.match(/\S*Error: /)){for(let p of t){let f=p(u);if(f){i.push(f);break}}if(i.length>=50+o)break}}return Br(i.slice(o))}}function Tt(e){return Array.isArray(e)?Pe(...e):e}function Br(e){if(!e.length)return[];let t=Array.from(e);return/sentryWrapped/.test(Ue(t).function||"")&&t.pop(),t.reverse(),Pr.test(Ue(t).function||"")&&(t.pop(),Pr.test(Ue(t).function||"")&&t.pop()),t.slice(0,50).map(r=>({...r,filename:r.filename||Ue(t).filename,function:r.function||B}))}function Ue(e){return e[e.length-1]||{}}var yt="<anonymous>";function L(e){try{return!e||typeof e!="function"?yt:e.name||yt}catch{return yt}}function Be(e){let t=e.exception;if(t){let r=[];try{return t.values.forEach(n=>{n.stacktrace.frames&&r.push(...n.stacktrace.frames)}),r}catch{return}}}var He={},Hr={};function R(e,t){He[e]=He[e]||[],He[e].push(t)}function v(e,t){if(!Hr[e]){Hr[e]=!0;try{t()}catch(r){m&&d.error(`Error while instrumenting ${e}`,r)}}}function y(e,t){let r=e&&He[e];if(r)for(let n of r)try{n(t)}catch(o){m&&d.error(`Error while triggering instrumentation handler.
|
|
3
|
+
Type: ${e}
|
|
4
|
+
Name: ${L(n)}
|
|
5
|
+
Error:`,o)}}var It=null;function bt(e){let t="error";R(t,e),v(t,Wo)}function Wo(){It=g.onerror,g.onerror=function(e,t,r,n,o){return y("error",{column:n,error:o,line:r,msg:e,url:t}),It?It.apply(this,arguments):!1},g.onerror.__SENTRY_INSTRUMENTED__=!0}var xt=null;function Rt(e){let t="unhandledrejection";R(t,e),v(t,zo)}function zo(){xt=g.onunhandledrejection,g.onunhandledrejection=function(e){return y("unhandledrejection",e),xt?xt.apply(this,arguments):!0},g.onunhandledrejection.__SENTRY_INSTRUMENTED__=!0}var $r=Object.prototype.toString;function ne(e){switch($r.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object WebAssembly.Exception]":return!0;default:return F(e,Error)}}function le(e,t){return $r.call(e)===`[object ${t}]`}function $e(e){return le(e,"ErrorEvent")}function Ge(e){return le(e,"DOMError")}function vt(e){return le(e,"DOMException")}function A(e){return le(e,"String")}function me(e){return typeof e=="object"&&e!==null&&"__sentry_template_string__"in e&&"__sentry_template_values__"in e}function J(e){return e===null||me(e)||typeof e!="object"&&typeof e!="function"}function q(e){return le(e,"Object")}function oe(e){return typeof Event<"u"&&F(e,Event)}function At(e){return typeof Element<"u"&&F(e,Element)}function Nt(e){return le(e,"RegExp")}function H(e){return!!(e?.then&&typeof e.then=="function")}function Ct(e){return q(e)&&"nativeEvent"in e&&"preventDefault"in e&&"stopPropagation"in e}function F(e,t){try{return e instanceof t}catch{return!1}}function Ie(e){return!!(typeof e=="object"&&e!==null&&(e.__isVue||e._isVue))}function Gr(e){return typeof Request<"u"&&F(e,Request)}var wt=g,Yo=80;function be(e,t={}){if(!e)return"<unknown>";try{let r=e,n=5,o=[],i=0,s=0,a=" > ",c=a.length,u,p=Array.isArray(t)?t:t.keyAttrs,f=!Array.isArray(t)&&t.maxStringLength||Yo;for(;r&&i++<n&&(u=qo(r,p),!(u==="html"||i>1&&s+o.length*c+u.length>=f));)o.push(u),s+=u.length,r=r.parentNode;return o.reverse().join(a)}catch{return"<unknown>"}}function qo(e,t){let r=e,n=[];if(!r?.tagName)return"";if(wt.HTMLElement&&r instanceof HTMLElement&&r.dataset){if(r.dataset.sentryComponent)return r.dataset.sentryComponent;if(r.dataset.sentryElement)return r.dataset.sentryElement}n.push(r.tagName.toLowerCase());let o=t?.length?t.filter(s=>r.getAttribute(s)).map(s=>[s,r.getAttribute(s)]):null;if(o?.length)o.forEach(s=>{n.push(`[${s[0]}="${s[1]}"]`)});else{r.id&&n.push(`#${r.id}`);let s=r.className;if(s&&A(s)){let a=s.split(/\s+/);for(let c of a)n.push(`.${c}`)}}let i=["aria-label","type","name","title","alt"];for(let s of i){let a=r.getAttribute(s);a&&n.push(`[${s}="${a}"]`)}return n.join("")}function ie(){try{return wt.document.location.href}catch{return""}}function Dt(e){if(!wt.HTMLElement)return null;let t=e,r=5;for(let n=0;n<r;n++){if(!t)return null;if(t instanceof HTMLElement){if(t.dataset.sentryComponent)return t.dataset.sentryComponent;if(t.dataset.sentryElement)return t.dataset.sentryElement}t=t.parentNode}return null}function V(e,t=0){return typeof e!="string"||t===0||e.length<=t?e:`${e.slice(0,t)}...`}function je(e,t){if(!Array.isArray(e))return"";let r=[];for(let n=0;n<e.length;n++){let o=e[n];try{Ie(o)?r.push("[VueViewModel]"):r.push(String(o))}catch{r.push("[value cannot be serialized]")}}return r.join(t)}function ge(e,t,r=!1){return A(e)?Nt(t)?t.test(e):A(t)?r?e===t:e.includes(t):!1:!1}function he(e,t=[],r=!1){return t.some(n=>ge(e,n,r))}function T(e,t,r){if(!(t in e))return;let n=e[t];if(typeof n!="function")return;let o=r(n);typeof o=="function"&&We(o,n);try{e[t]=o}catch{m&&d.log(`Failed to replace method "${t}" in object`,e)}}function w(e,t,r){try{Object.defineProperty(e,t,{value:r,writable:!0,configurable:!0})}catch{m&&d.log(`Failed to add non-enumerable property "${t}" to object`,e)}}function We(e,t){try{let r=t.prototype||{};e.prototype=t.prototype=r,w(e,"__sentry_original__",t)}catch{}}function se(e){return e.__sentry_original__}function ze(e){if(ne(e))return{message:e.message,name:e.name,stack:e.stack,...Wr(e)};if(oe(e)){let t={type:e.type,target:jr(e.target),currentTarget:jr(e.currentTarget),...Wr(e)};return typeof CustomEvent<"u"&&F(e,CustomEvent)&&(t.detail=e.detail),t}else return e}function jr(e){try{return At(e)?be(e):Object.prototype.toString.call(e)}catch{return"<unknown>"}}function Wr(e){if(typeof e=="object"&&e!==null){let t={};for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}else return{}}function Ot(e,t=40){let r=Object.keys(ze(e));r.sort();let n=r[0];if(!n)return"[object has no keys]";if(n.length>=t)return V(n,t);for(let o=r.length;o>0;o--){let i=r.slice(0,o).join(", ");if(!(i.length>t))return o===r.length?i:V(i,t)}return""}function Ko(){let e=g;return e.crypto||e.msCrypto}var Lt;function Jo(){return Math.random()*16}function I(e=Ko()){try{if(e?.randomUUID)return e.randomUUID().replace(/-/g,"")}catch{}return Lt||(Lt="10000000100040008000"+1e11),Lt.replace(/[018]/g,t=>(t^(Jo()&15)>>t/4).toString(16))}function zr(e){return e.exception?.values?.[0]}function $(e){let{message:t,event_id:r}=e;if(t)return t;let n=zr(e);return n?n.type&&n.value?`${n.type}: ${n.value}`:n.type||n.value||r||"<unknown>":r||"<unknown>"}function _e(e,t,r){let n=e.exception=e.exception||{},o=n.values=n.values||[],i=o[0]=o[0]||{};i.value||(i.value=t||""),i.type||(i.type=r||"Error")}function G(e,t){let r=zr(e);if(!r)return;let n={type:"generic",handled:!0},o=r.mechanism;if(r.mechanism={...n,...o,...t},t&&"data"in t){let i={...o?.data,...t.data};r.mechanism.data=i}}function Ye(e){if(Vo(e))return!0;try{w(e,"__sentry_captured__",!0)}catch{}return!1}function Vo(e){try{return e.__sentry_captured__}catch{}}var qr=1e3;function j(){return Date.now()/qr}function Xo(){let{performance:e}=g;if(!e?.now||!e.timeOrigin)return j;let t=e.timeOrigin;return()=>(t+e.now())/qr}var Yr;function N(){return(Yr??(Yr=Xo()))()}function Kr(e){let t=N(),r={sid:I(),init:!0,timestamp:t,started:t,duration:0,status:"ok",errors:0,ignoreDuration:!1,toJSON:()=>Zo(r)};return e&&K(r,e),r}function K(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||N(),t.abnormal_mechanism&&(e.abnormal_mechanism=t.abnormal_mechanism),t.ignoreDuration&&(e.ignoreDuration=t.ignoreDuration),t.sid&&(e.sid=t.sid.length===32?t.sid:I()),t.init!==void 0&&(e.init=t.init),!e.did&&t.did&&(e.did=`${t.did}`),typeof t.started=="number"&&(e.started=t.started),e.ignoreDuration)e.duration=void 0;else if(typeof t.duration=="number")e.duration=t.duration;else{let r=e.timestamp-e.started;e.duration=r>=0?r: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),typeof t.errors=="number"&&(e.errors=t.errors),t.status&&(e.status=t.status)}function Jr(e,t){let r={};t?r={status:t}:e.status==="ok"&&(r={status:"exited"}),K(e,r)}function Zo(e){return{sid:`${e.sid}`,init:e.init,started:new Date(e.started*1e3).toISOString(),timestamp:new Date(e.timestamp*1e3).toISOString(),status:e.status,errors:e.errors,did:typeof e.did=="number"||typeof e.did=="string"?`${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}}}function X(e,t,r=2){if(!t||typeof t!="object"||r<=0)return t;if(e&&Object.keys(t).length===0)return e;let n={...e};for(let o in t)Object.prototype.hasOwnProperty.call(t,o)&&(n[o]=X(n[o],t[o],r-1));return n}function kt(){return I()}function qe(){return I().substring(16)}var Mt="_sentrySpan";function Ft(e,t){t?w(e,Mt,t):delete e[Mt]}function Ut(e){return e[Mt]}var Qo=100,C=class e{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:kt(),sampleRand:Math.random()}}clone(){let t=new e;return t._breadcrumbs=[...this._breadcrumbs],t._tags={...this._tags},t._extra={...this._extra},t._contexts={...this._contexts},this._contexts.flags&&(t._contexts.flags={values:[...this._contexts.flags.values]}),t._user=this._user,t._level=this._level,t._session=this._session,t._transactionName=this._transactionName,t._fingerprint=this._fingerprint,t._eventProcessors=[...this._eventProcessors],t._attachments=[...this._attachments],t._sdkProcessingMetadata={...this._sdkProcessingMetadata},t._propagationContext={...this._propagationContext},t._client=this._client,t._lastEventId=this._lastEventId,Ft(t,Ut(this)),t}setClient(t){this._client=t}setLastEventId(t){this._lastEventId=t}getClient(){return this._client}lastEventId(){return this._lastEventId}addScopeListener(t){this._scopeListeners.push(t)}addEventProcessor(t){return this._eventProcessors.push(t),this}setUser(t){return this._user=t||{email:void 0,id:void 0,ip_address:void 0,username:void 0},this._session&&K(this._session,{user:t}),this._notifyScopeListeners(),this}getUser(){return this._user}setTags(t){return this._tags={...this._tags,...t},this._notifyScopeListeners(),this}setTag(t,r){return this._tags={...this._tags,[t]:r},this._notifyScopeListeners(),this}setExtras(t){return this._extra={...this._extra,...t},this._notifyScopeListeners(),this}setExtra(t,r){return this._extra={...this._extra,[t]:r},this._notifyScopeListeners(),this}setFingerprint(t){return this._fingerprint=t,this._notifyScopeListeners(),this}setLevel(t){return this._level=t,this._notifyScopeListeners(),this}setTransactionName(t){return this._transactionName=t,this._notifyScopeListeners(),this}setContext(t,r){return r===null?delete this._contexts[t]:this._contexts[t]=r,this._notifyScopeListeners(),this}setSession(t){return t?this._session=t:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(t){if(!t)return this;let r=typeof t=="function"?t(this):t,n=r instanceof e?r.getScopeData():q(r)?t:void 0,{tags:o,extra:i,user:s,contexts:a,level:c,fingerprint:u=[],propagationContext:p}=n||{};return this._tags={...this._tags,...o},this._extra={...this._extra,...i},this._contexts={...this._contexts,...a},s&&Object.keys(s).length&&(this._user=s),c&&(this._level=c),u.length&&(this._fingerprint=u),p&&(this._propagationContext=p),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,Ft(this,void 0),this._attachments=[],this.setPropagationContext({traceId:kt(),sampleRand:Math.random()}),this._notifyScopeListeners(),this}addBreadcrumb(t,r){let n=typeof r=="number"?r:Qo;if(n<=0)return this;let o={timestamp:j(),...t,message:t.message?V(t.message,2048):t.message};return this._breadcrumbs.push(o),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(t){return this._attachments.push(t),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:Ut(this)}}setSDKProcessingMetadata(t){return this._sdkProcessingMetadata=X(this._sdkProcessingMetadata,t,2),this}setPropagationContext(t){return this._propagationContext=t,this}getPropagationContext(){return this._propagationContext}captureException(t,r){let n=r?.event_id||I();if(!this._client)return m&&d.warn("No client configured on scope - will not capture exception!"),n;let o=new Error("Sentry syntheticException");return this._client.captureException(t,{originalException:t,syntheticException:o,...r,event_id:n},this),n}captureMessage(t,r,n){let o=n?.event_id||I();if(!this._client)return m&&d.warn("No client configured on scope - will not capture message!"),o;let i=new Error(t);return this._client.captureMessage(t,r,{originalException:t,syntheticException:i,...n,event_id:o},this),o}captureEvent(t,r){let n=r?.event_id||I();return this._client?(this._client.captureEvent(t,{...r,event_id:n},this),n):(m&&d.warn("No client configured on scope - will not capture event!"),n)}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach(t=>{t(this)}),this._notifyingListeners=!1)}};function Vr(){return M("defaultCurrentScope",()=>new C)}function Xr(){return M("defaultIsolationScope",()=>new C)}var Pt=class{constructor(t,r){let n;t?n=t:n=new C;let o;r?o=r:o=new C,this._stack=[{scope:n}],this._isolationScope=o}withScope(t){let r=this._pushScope(),n;try{n=t(r)}catch(o){throw this._popScope(),o}return H(n)?n.then(o=>(this._popScope(),o),o=>{throw this._popScope(),o}):(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(){let t=this.getScope().clone();return this._stack.push({client:this.getClient(),scope:t}),t}_popScope(){return this._stack.length<=1?!1:!!this._stack.pop()}};function Ee(){let e=te(),t=re(e);return t.stack=t.stack||new Pt(Vr(),Xr())}function ei(e){return Ee().withScope(e)}function ti(e,t){let r=Ee();return r.withScope(()=>(r.getStackTop().scope=e,t(e)))}function Zr(e){return Ee().withScope(()=>e(Ee().getIsolationScope()))}function Qr(){return{withIsolationScope:Zr,withScope:ei,withSetScope:ti,withSetIsolationScope:(e,t)=>Zr(t),getCurrentScope:()=>Ee().getScope(),getIsolationScope:()=>Ee().getIsolationScope()}}function Ke(e){let t=re(e);return t.acs?t.acs:Qr()}function D(){let e=te();return Ke(e).getCurrentScope()}function W(){let e=te();return Ke(e).getIsolationScope()}function Je(){return M("globalScope",()=>new C)}function Ve(...e){let t=te(),r=Ke(t);if(e.length===2){let[n,o]=e;return n?r.withSetScope(n,o):r.withScope(o)}return r.withScope(e[0])}function E(){return D().getClient()}function Bt(e){let t=e.getPropagationContext(),{traceId:r,parentSpanId:n,propagationSpanId:o}=t,i={trace_id:r,span_id:o||qe()};return n&&(i.parent_span_id=n),i}var Xe="sentry.source",Ht="sentry.sample_rate",en="sentry.previous_trace_sample_rate",$t="sentry.op",Gt="sentry.origin";var jt="sentry.profile_id",Wt="sentry.exclusive_time";var ri="_sentryScope",ni="_sentryIsolationScope";function oi(e){if(e){if(typeof e=="object"&&"deref"in e&&typeof e.deref=="function")try{return e.deref()}catch{return}return e}}function Ze(e){let t=e;return{scope:t[ri],isolationScope:oi(t[ni])}}var ii="sentry-",si=/^sentry-/;function rn(e){let t=ai(e);if(!t)return;let r=Object.entries(t).reduce((n,[o,i])=>{if(o.match(si)){let s=o.slice(ii.length);n[s]=i}return n},{});if(Object.keys(r).length>0)return r}function ai(e){if(!(!e||!A(e)&&!Array.isArray(e)))return Array.isArray(e)?e.reduce((t,r)=>{let n=tn(r);return Object.entries(n).forEach(([o,i])=>{t[o]=i}),t},{}):tn(e)}function tn(e){return e.split(",").map(t=>{let r=t.indexOf("=");if(r===-1)return[];let n=t.slice(0,r),o=t.slice(r+1);return[n,o].map(i=>{try{return decodeURIComponent(i.trim())}catch{return}})}).reduce((t,[r,n])=>(r&&n&&(t[r]=n),t),{})}var ci=/^o(\d+)\./,ui=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)([\w.-]+)(?::(\d+))?\/(.+)/;function pi(e){return e==="http"||e==="https"}function z(e,t=!1){let{host:r,path:n,pass:o,port:i,projectId:s,protocol:a,publicKey:c}=e;return`${a}://${c}${t&&o?`:${o}`:""}@${r}${i?`:${i}`:""}/${n&&`${n}/`}${s}`}function fi(e){let t=ui.exec(e);if(!t){O(()=>{console.error(`Invalid Sentry Dsn: ${e}`)});return}let[r,n,o="",i="",s="",a=""]=t.slice(1),c="",u=a,p=u.split("/");if(p.length>1&&(c=p.slice(0,-1).join("/"),u=p.pop()),u){let f=u.match(/^\d+/);f&&(u=f[0])}return nn({host:i,pass:o,path:c,projectId:u,port:s,protocol:r,publicKey:n})}function nn(e){return{protocol:e.protocol,publicKey:e.publicKey||"",pass:e.pass||"",host:e.host,port:e.port||"",path:e.path||"",projectId:e.projectId}}function di(e){if(!m)return!0;let{port:t,projectId:r,protocol:n}=e;return["protocol","publicKey","host","projectId"].find(s=>e[s]?!1:(d.error(`Invalid Sentry Dsn: ${s} missing`),!0))?!1:r.match(/^\d+$/)?pi(n)?t&&isNaN(parseInt(t,10))?(d.error(`Invalid Sentry Dsn: Invalid port ${t}`),!1):!0:(d.error(`Invalid Sentry Dsn: Invalid protocol ${n}`),!1):(d.error(`Invalid Sentry Dsn: Invalid projectId ${r}`),!1)}function li(e){return e.match(ci)?.[1]}function on(e){let t=e.getOptions(),{host:r}=e.getDsn()||{},n;return t.orgId?n=String(t.orgId):r&&(n=li(r)),n}function sn(e){let t=typeof e=="string"?fi(e):nn(e);if(!(!t||!di(t)))return t}function an(e){if(typeof e=="boolean")return Number(e);let t=typeof e=="string"?parseFloat(e):e;if(!(typeof t!="number"||isNaN(t)||t<0||t>1))return t}var fn=1,cn=!1;function dn(e){let{spanId:t,traceId:r,isRemote:n}=e.spanContext(),o=n?t:Se(e).parent_span_id,i=Ze(e).scope,s=n?i?.getPropagationContext().propagationSpanId||qe():t;return{parent_span_id:o,span_id:s,trace_id:r}}function mi(e){if(e&&e.length>0)return e.map(({context:{spanId:t,traceId:r,traceFlags:n,...o},attributes:i})=>({span_id:t,trace_id:r,sampled:n===fn,attributes:i,...o}))}function un(e){return typeof e=="number"?pn(e):Array.isArray(e)?e[0]+e[1]/1e9:e instanceof Date?pn(e.getTime()):N()}function pn(e){return e>9999999999?e/1e3:e}function Se(e){if(hi(e))return e.getSpanJSON();let{spanId:t,traceId:r}=e.spanContext();if(gi(e)){let{attributes:n,startTime:o,name:i,endTime:s,status:a,links:c}=e,u="parentSpanId"in e?e.parentSpanId:"parentSpanContext"in e?e.parentSpanContext?.spanId:void 0;return{span_id:t,trace_id:r,data:n,description:i,parent_span_id:u,start_timestamp:un(o),timestamp:un(s)||void 0,status:_i(a),op:n[$t],origin:n[Gt],links:mi(c)}}return{span_id:t,trace_id:r,start_timestamp:0,data:{}}}function gi(e){let t=e;return!!t.attributes&&!!t.startTime&&!!t.name&&!!t.endTime&&!!t.status}function hi(e){return typeof e.getSpanJSON=="function"}function ln(e){let{traceFlags:t}=e.spanContext();return t===fn}function _i(e){if(!(!e||e.code===0))return e.code===1?"ok":e.message||"unknown_error"}var Ei="_sentryRootSpan";function xe(e){return e[Ei]||e}function zt(){cn||(O(()=>{console.warn("[Sentry] Returning null from `beforeSendSpan` is disallowed. To drop certain spans, configure the respective integrations directly or use `ignoreSpans`.")}),cn=!0)}function mn(e){if(typeof __SENTRY_TRACING__=="boolean"&&!__SENTRY_TRACING__)return!1;let t=e||E()?.getOptions();return!!t&&(t.tracesSampleRate!=null||!!t.tracesSampler)}function gn(e){d.log(`Ignoring span ${e.op} - ${e.description} because it matches \`ignoreSpans\`.`)}function Yt(e,t){if(!t?.length||!e.description)return!1;for(let r of t){if(Si(r)){if(ge(e.description,r))return m&&gn(e),!0;continue}if(!r.name&&!r.op)continue;let n=r.name?ge(e.description,r.name):!0,o=r.op?e.op&&ge(e.op,r.op):!0;if(n&&o)return m&&gn(e),!0}return!1}function hn(e,t){let r=t.parent_span_id,n=t.span_id;if(r)for(let o of e)o.parent_span_id===n&&(o.parent_span_id=r)}function Si(e){return typeof e=="string"||e instanceof RegExp}var ye="production";var yi="_frozenDsc";function _n(e,t){let r=t.getOptions(),{publicKey:n}=t.getDsn()||{},o={environment:r.environment||ye,release:r.release,public_key:n,trace_id:e,org_id:on(t)};return t.emit("createDsc",o),o}function En(e,t){let r=t.getPropagationContext();return r.dsc||_n(r.traceId,e)}function Sn(e){let t=E();if(!t)return{};let r=xe(e),n=Se(r),o=n.data,i=r.spanContext().traceState,s=i?.get("sentry.sample_rate")??o[Ht]??o[en];function a(S){return(typeof s=="number"||typeof s=="string")&&(S.sample_rate=`${s}`),S}let c=r[yi];if(c)return a(c);let u=i?.get("sentry.dsc"),p=u&&rn(u);if(p)return a(p);let f=_n(e.spanContext().traceId,t),h=o[Xe],l=n.description;return h!=="url"&&l&&(f.transaction=l),mn()&&(f.sampled=String(ln(r)),f.sample_rand=i?.get("sentry.sample_rand")??Ze(r).scope?.getPropagationContext().sampleRand.toString()),a(f),t.emit("createDsc",f,r),f}function k(e,t=100,r=1/0){try{return qt("",e,t,r)}catch(n){return{ERROR:`**non-serializable** (${n})`}}}function Qe(e,t=3,r=100*1024){let n=k(e,t);return xi(n)>r?Qe(e,t-1,r):n}function qt(e,t,r=1/0,n=1/0,o=Ri()){let[i,s]=o;if(t==null||["boolean","string"].includes(typeof t)||typeof t=="number"&&Number.isFinite(t))return t;let a=Ti(e,t);if(!a.startsWith("[object "))return a;if(t.__sentry_skip_normalization__)return t;let c=typeof t.__sentry_override_normalization_depth__=="number"?t.__sentry_override_normalization_depth__:r;if(c===0)return a.replace("object ","");if(i(t))return"[Circular ~]";let u=t;if(u&&typeof u.toJSON=="function")try{let l=u.toJSON();return qt("",l,c-1,n,o)}catch{}let p=Array.isArray(t)?[]:{},f=0,h=ze(t);for(let l in h){if(!Object.prototype.hasOwnProperty.call(h,l))continue;if(f>=n){p[l]="[MaxProperties ~]";break}let S=h[l];p[l]=qt(l,S,c-1,n,o),f++}return s(t),p}function Ti(e,t){try{if(e==="domain"&&t&&typeof t=="object"&&t._events)return"[Domain]";if(e==="domainEmitter")return"[DomainEmitter]";if(typeof global<"u"&&t===global)return"[Global]";if(typeof window<"u"&&t===window)return"[Window]";if(typeof document<"u"&&t===document)return"[Document]";if(Ie(t))return"[VueViewModel]";if(Ct(t))return"[SyntheticEvent]";if(typeof t=="number"&&!Number.isFinite(t))return`[${t}]`;if(typeof t=="function")return`[Function: ${L(t)}]`;if(typeof t=="symbol")return`[${String(t)}]`;if(typeof t=="bigint")return`[BigInt: ${String(t)}]`;let r=Ii(t);return/^HTML(\w*)Element$/.test(r)?`[HTMLElement: ${r}]`:`[object ${r}]`}catch(r){return`**non-serializable** (${r})`}}function Ii(e){let t=Object.getPrototypeOf(e);return t?.constructor?t.constructor.name:"null prototype"}function bi(e){return~-encodeURI(e).split(/%..|./).length}function xi(e){return bi(JSON.stringify(e))}function Ri(){let e=new WeakSet;function t(n){return e.has(n)?!0:(e.add(n),!1)}function r(n){e.delete(n)}return[t,r]}function U(e,t=[]){return[e,t]}function yn(e,t){let[r,n]=e;return[r,[...n,t]]}function Jt(e,t){let r=e[1];for(let n of r){let o=n[0].type;if(t(n,o))return!0}return!1}function Kt(e){let t=re(g);return t.encodePolyfill?t.encodePolyfill(e):new TextEncoder().encode(e)}function Tn(e){let[t,r]=e,n=JSON.stringify(t);function o(i){typeof n=="string"?n=typeof i=="string"?n+i:[Kt(n),i]:n.push(typeof i=="string"?Kt(i):i)}for(let i of r){let[s,a]=i;if(o(`
|
|
6
|
+
${JSON.stringify(s)}
|
|
7
|
+
`),typeof a=="string"||a instanceof Uint8Array)o(a);else{let c;try{c=JSON.stringify(a)}catch{c=JSON.stringify(k(a))}o(c)}}return typeof n=="string"?n:vi(n)}function vi(e){let t=e.reduce((o,i)=>o+i.length,0),r=new Uint8Array(t),n=0;for(let o of e)r.set(o,n),n+=o.length;return r}function In(e){let t=typeof e.data=="string"?Kt(e.data):e.data;return[{type:"attachment",length:t.length,filename:e.filename,content_type:e.contentType,attachment_type:e.attachmentType},t]}var Ai={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",metric:"metric",trace_metric:"metric"};function Vt(e){return Ai[e]}function Xt(e){if(!e?.sdk)return;let{name:t,version:r}=e.sdk;return{name:t,version:r}}function bn(e,t,r,n){let o=e.sdkProcessingMetadata?.dynamicSamplingContext;return{event_id:e.event_id,sent_at:new Date().toISOString(),...t&&{sdk:t},...!!r&&n&&{dsn:z(n)},...o&&{trace:o}}}function Ni(e,t){if(!t)return e;let r=e.sdk||{};return e.sdk={...r,name:r.name||t.name,version:r.version||t.version,integrations:[...e.sdk?.integrations||[],...t.integrations||[]],packages:[...e.sdk?.packages||[],...t.packages||[]],settings:e.sdk?.settings||t.settings?{...e.sdk?.settings,...t.settings}:void 0},e}function xn(e,t,r,n){let o=Xt(r),i={sent_at:new Date().toISOString(),...o&&{sdk:o},...!!n&&t&&{dsn:z(t)}},s="aggregates"in e?[{type:"sessions"},e]:[{type:"session"},e.toJSON()];return U(i,[s])}function Rn(e,t,r,n){let o=Xt(r),i=e.type&&e.type!=="replay_event"?e.type:"event";Ni(e,r?.sdk);let s=bn(e,o,n,t);return delete e.sdkProcessingMetadata,U(s,[[{type:i},e]])}var Zt=0,vn=1,An=2;function Z(e){return new Re(t=>{t(e)})}function ae(e){return new Re((t,r)=>{r(e)})}var Re=class e{constructor(t){this._state=Zt,this._handlers=[],this._runExecutor(t)}then(t,r){return new e((n,o)=>{this._handlers.push([!1,i=>{if(!t)n(i);else try{n(t(i))}catch(s){o(s)}},i=>{if(!r)o(i);else try{n(r(i))}catch(s){o(s)}}]),this._executeHandlers()})}catch(t){return this.then(r=>r,t)}finally(t){return new e((r,n)=>{let o,i;return this.then(s=>{i=!1,o=s,t&&t()},s=>{i=!0,o=s,t&&t()}).then(()=>{if(i){n(o);return}r(o)})})}_executeHandlers(){if(this._state===Zt)return;let t=this._handlers.slice();this._handlers=[],t.forEach(r=>{r[0]||(this._state===vn&&r[1](this._value),this._state===An&&r[2](this._value),r[0]=!0)})}_runExecutor(t){let r=(i,s)=>{if(this._state===Zt){if(H(s)){s.then(n,o);return}this._state=i,this._value=s,this._executeHandlers()}},n=i=>{r(vn,i)},o=i=>{r(An,i)};try{t(n,o)}catch(i){o(i)}}};function Nn(e,t,r,n=0){try{let o=Qt(t,r,e,n);return H(o)?o:Z(o)}catch(o){return ae(o)}}function Qt(e,t,r,n){let o=r[n];if(!e||!o)return e;let i=o({...e},t);return m&&i===null&&d.log(`Event processor "${o.id||"?"}" dropped event`),H(i)?i.then(s=>Qt(s,t,r,n+1)):Qt(i,t,r,n+1)}function Cn(e,t){let{fingerprint:r,span:n,breadcrumbs:o,sdkProcessingMetadata:i}=t;Ci(e,t),n&&Oi(e,n),Li(e,r),wi(e,o),Di(e,i)}function er(e,t){let{extra:r,tags:n,user:o,contexts:i,level:s,sdkProcessingMetadata:a,breadcrumbs:c,fingerprint:u,eventProcessors:p,attachments:f,propagationContext:h,transactionName:l,span:S}=t;et(e,"extra",r),et(e,"tags",n),et(e,"user",o),et(e,"contexts",i),e.sdkProcessingMetadata=X(e.sdkProcessingMetadata,a,2),s&&(e.level=s),l&&(e.transactionName=l),S&&(e.span=S),c.length&&(e.breadcrumbs=[...e.breadcrumbs,...c]),u.length&&(e.fingerprint=[...e.fingerprint,...u]),p.length&&(e.eventProcessors=[...e.eventProcessors,...p]),f.length&&(e.attachments=[...e.attachments,...f]),e.propagationContext={...e.propagationContext,...h}}function et(e,t,r){e[t]=X(e[t],r,1)}function Ci(e,t){let{extra:r,tags:n,user:o,contexts:i,level:s,transactionName:a}=t;Object.keys(r).length&&(e.extra={...r,...e.extra}),Object.keys(n).length&&(e.tags={...n,...e.tags}),Object.keys(o).length&&(e.user={...o,...e.user}),Object.keys(i).length&&(e.contexts={...i,...e.contexts}),s&&(e.level=s),a&&e.type!=="transaction"&&(e.transaction=a)}function wi(e,t){let r=[...e.breadcrumbs||[],...t];e.breadcrumbs=r.length?r:void 0}function Di(e,t){e.sdkProcessingMetadata={...e.sdkProcessingMetadata,...t}}function Oi(e,t){e.contexts={trace:dn(t),...e.contexts},e.sdkProcessingMetadata={dynamicSamplingContext:Sn(t),...e.sdkProcessingMetadata};let r=xe(t),n=Se(r).description;n&&!e.transaction&&e.type==="transaction"&&(e.transaction=n)}function Li(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}var ce,wn,Dn,Q;function On(e){let t=g._sentryDebugIds,r=g._debugIds;if(!t&&!r)return{};let n=t?Object.keys(t):[],o=r?Object.keys(r):[];if(Q&&n.length===wn&&o.length===Dn)return Q;wn=n.length,Dn=o.length,Q={},ce||(ce={});let i=(s,a)=>{for(let c of s){let u=a[c],p=ce?.[c];if(p&&Q&&u)Q[p[0]]=u,ce&&(ce[c]=[p[0],u]);else if(u){let f=e(c);for(let h=f.length-1;h>=0;h--){let S=f[h]?.filename;if(S&&Q&&ce){Q[S]=u,ce[c]=[S,u];break}}}}};return t&&i(n,t),r&&i(o,r),Q}function Ln(e,t,r,n,o,i){let{normalizeDepth:s=3,normalizeMaxBreadth:a=1e3}=e,c={...t,event_id:t.event_id||r.event_id||I(),timestamp:t.timestamp||j()},u=r.integrations||e.integrations.map(x=>x.name);ki(c,e),Ui(c,u),o&&o.emit("applyFrameMetadata",t),t.type===void 0&&Mi(c,e.stackParser);let p=Bi(n,r.captureContext);r.mechanism&&G(c,r.mechanism);let f=o?o.getEventProcessors():[],h=Je().getScopeData();if(i){let x=i.getScopeData();er(h,x)}if(p){let x=p.getScopeData();er(h,x)}let l=[...r.attachments||[],...h.attachments];l.length&&(r.attachments=l),Cn(c,h);let S=[...f,...h.eventProcessors];return Nn(S,c,r).then(x=>(x&&Fi(x),typeof s=="number"&&s>0?Pi(x,s,a):x))}function ki(e,t){let{environment:r,release:n,dist:o,maxValueLength:i=250}=t;e.environment=e.environment||r||ye,!e.release&&n&&(e.release=n),!e.dist&&o&&(e.dist=o);let s=e.request;s?.url&&(s.url=V(s.url,i))}function Mi(e,t){let r=On(t);e.exception?.values?.forEach(n=>{n.stacktrace?.frames?.forEach(o=>{o.filename&&(o.debug_id=r[o.filename])})})}function Fi(e){let t={};if(e.exception?.values?.forEach(n=>{n.stacktrace?.frames?.forEach(o=>{o.debug_id&&(o.abs_path?t[o.abs_path]=o.debug_id:o.filename&&(t[o.filename]=o.debug_id),delete o.debug_id)})}),Object.keys(t).length===0)return;e.debug_meta=e.debug_meta||{},e.debug_meta.images=e.debug_meta.images||[];let r=e.debug_meta.images;Object.entries(t).forEach(([n,o])=>{r.push({type:"sourcemap",code_file:n,debug_id:o})})}function Ui(e,t){t.length>0&&(e.sdk=e.sdk||{},e.sdk.integrations=[...e.sdk.integrations||[],...t])}function Pi(e,t,r){if(!e)return null;let n={...e,...e.breadcrumbs&&{breadcrumbs:e.breadcrumbs.map(o=>({...o,...o.data&&{data:k(o.data,t,r)}}))},...e.user&&{user:k(e.user,t,r)},...e.contexts&&{contexts:k(e.contexts,t,r)},...e.extra&&{extra:k(e.extra,t,r)}};return e.contexts?.trace&&n.contexts&&(n.contexts.trace=e.contexts.trace,e.contexts.trace.data&&(n.contexts.trace.data=k(e.contexts.trace.data,t,r))),e.spans&&(n.spans=e.spans.map(o=>({...o,...o.data&&{data:k(o.data,t,r)}}))),e.contexts?.flags&&n.contexts&&(n.contexts.flags=k(e.contexts.flags,3,r)),n}function Bi(e,t){if(!t)return e;let r=e?e.clone():new C;return r.update(t),r}function kn(e){if(e)return Hi(e)?{captureContext:e}:Gi(e)?{captureContext:e}:e}function Hi(e){return e instanceof C||typeof e=="function"}var $i=["user","level","extra","contexts","tags","fingerprint","propagationContext"];function Gi(e){return Object.keys(e).some(t=>$i.includes(t))}function ue(e,t){return D().captureException(e,kn(t))}function ve(e,t){return D().captureEvent(e,t)}function Ae(e){let t=W(),r=D(),{userAgent:n}=g.navigator||{},o=Kr({user:r.getUser()||t.getUser(),...n&&{userAgent:n},...e}),i=t.getSession();return i?.status==="ok"&&K(i,{status:"exited"}),tt(),t.setSession(o),o}function tt(){let e=W(),r=D().getSession()||e.getSession();r&&Jr(r),Fn(),e.setSession()}function Fn(){let e=W(),t=E(),r=e.getSession();r&&t&&t.captureSession(r)}function Ne(e=!1){if(e){tt();return}Fn()}var ji="7";function Wi(e){let t=e.protocol?`${e.protocol}:`:"",r=e.port?`:${e.port}`:"";return`${t}//${e.host}${r}${e.path?`/${e.path}`:""}/api/`}function zi(e){return`${Wi(e)}${e.projectId}/envelope/`}function Yi(e,t){let r={sentry_version:ji};return e.publicKey&&(r.sentry_key=e.publicKey),t&&(r.sentry_client=`${t.name}/${t.version}`),new URLSearchParams(r).toString()}function Un(e,t,r){return t||`${zi(e)}?${Yi(e,r)}`}var Pn=[];function qi(e){let t={};return e.forEach(r=>{let{name:n}=r,o=t[n];o&&!o.isDefaultInstance&&r.isDefaultInstance||(t[n]=r)}),Object.values(t)}function tr(e){let t=e.defaultIntegrations||[],r=e.integrations;t.forEach(o=>{o.isDefaultInstance=!0});let n;if(Array.isArray(r))n=[...t,...r];else if(typeof r=="function"){let o=r(t);n=Array.isArray(o)?o:[o]}else n=t;return qi(n)}function Bn(e,t){let r={};return t.forEach(n=>{n&&nr(e,n,r)}),r}function rr(e,t){for(let r of t)r?.afterAllSetup&&r.afterAllSetup(e)}function nr(e,t,r){if(r[t.name]){m&&d.log(`Integration skipped because it was already installed: ${t.name}`);return}if(r[t.name]=t,Pn.indexOf(t.name)===-1&&typeof t.setupOnce=="function"&&(t.setupOnce(),Pn.push(t.name)),t.setup&&typeof t.setup=="function"&&t.setup(e),typeof t.preprocessEvent=="function"){let n=t.preprocessEvent.bind(t);e.on("preprocessEvent",(o,i)=>n(o,i,e))}if(typeof t.processEvent=="function"){let n=t.processEvent.bind(t),o=Object.assign((i,s)=>n(i,s,e),{id:t.name});e.addEventProcessor(o)}m&&d.log(`Integration installed: ${t.name}`)}function Ki(e){return[{type:"log",item_count:e.length,content_type:"application/vnd.sentry.items.log+json"},{items:e}]}function Hn(e,t,r,n){let o={};return t?.sdk&&(o.sdk={name:t.sdk.name,version:t.sdk.version}),r&&n&&(o.dsn=z(n)),U(o,[Ki(e)])}function Ce(e,t){let r=t??Ji(e)??[];if(r.length===0)return;let n=e.getOptions(),o=Hn(r,n._metadata,n.tunnel,e.getDsn());$n().set(e,[]),e.emit("flushLogs"),e.sendEnvelope(o)}function Ji(e){return $n().get(e)}function $n(){return M("clientToLogBufferMap",()=>new WeakMap)}function Vi(e){return[{type:"trace_metric",item_count:e.length,content_type:"application/vnd.sentry.items.trace-metric+json"},{items:e}]}function Gn(e,t,r,n){let o={};return t?.sdk&&(o.sdk={name:t.sdk.name,version:t.sdk.version}),r&&n&&(o.dsn=z(n)),U(o,[Vi(e)])}function we(e,t){let r=t??Xi(e)??[];if(r.length===0)return;let n=e.getOptions(),o=Gn(r,n._metadata,n.tunnel,e.getDsn());jn().set(e,[]),e.emit("flushMetrics"),e.sendEnvelope(o)}function Xi(e){return jn().get(e)}function jn(){return M("clientToMetricBufferMap",()=>new WeakMap)}function Wn(e,t,r){let n=[{type:"client_report"},{timestamp:r||j(),discarded_events:e}];return U(t?{dsn:t}:{},[n])}function rt(e){let t=[];e.message&&t.push(e.message);try{let r=e.exception.values[e.exception.values.length-1];r?.value&&(t.push(r.value),r.type&&t.push(`${r.type}: ${r.value}`))}catch{}return t}function zn(e){let{trace_id:t,parent_span_id:r,span_id:n,status:o,origin:i,data:s,op:a}=e.contexts?.trace??{};return{data:s??{},description:e.transaction,op:a,parent_span_id:r,span_id:n??"",start_timestamp:e.start_timestamp??0,status:o,timestamp:e.timestamp,trace_id:t??"",origin:i,profile_id:s?.[jt],exclusive_time:s?.[Wt],measurements:e.measurements,is_segment:!0}}function Yn(e){return{type:"transaction",timestamp:e.timestamp,start_timestamp:e.start_timestamp,transaction:e.description,contexts:{trace:{trace_id:e.trace_id,span_id:e.span_id,parent_span_id:e.parent_span_id,op:e.op,status:e.status,origin:e.origin,data:{...e.data,...e.profile_id&&{[jt]:e.profile_id},...e.exclusive_time&&{[Wt]:e.exclusive_time}}}},measurements:e.measurements}}var qn="Not capturing exception because it's already been captured.",Kn="Discarded session because of missing or non-string release",Qn=Symbol.for("SentryInternalError"),eo=Symbol.for("SentryDoNotSendEventError"),Zi=5e3;function nt(e){return{message:e,[Qn]:!0}}function or(e){return{message:e,[eo]:!0}}function Jn(e){return!!e&&typeof e=="object"&&Qn in e}function Vn(e){return!!e&&typeof e=="object"&&eo in e}function Xn(e,t,r,n,o){let i=0,s;e.on(r,()=>{i=0,clearTimeout(s)}),e.on(t,a=>{i+=n(a),i>=8e5?o(e):(clearTimeout(s),s=setTimeout(()=>{o(e)},Zi))}),e.on("flush",()=>{o(e)})}var De=class{constructor(t){if(this._options=t,this._integrations={},this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],t.dsn?this._dsn=sn(t.dsn):m&&d.warn("No DSN provided, client will not send events."),this._dsn){let r=Un(this._dsn,t.tunnel,t._metadata?t._metadata.sdk:void 0);this._transport=t.transport({tunnel:this._options.tunnel,recordDroppedEvent:this.recordDroppedEvent.bind(this),...t.transportOptions,url:r})}this._options.enableLogs&&Xn(this,"afterCaptureLog","flushLogs",rs,Ce),this._options._experiments?.enableMetrics&&Xn(this,"afterCaptureMetric","flushMetrics",ts,we)}captureException(t,r,n){let o=I();if(Ye(t))return m&&d.log(qn),o;let i={event_id:o,...r};return this._process(this.eventFromException(t,i).then(s=>this._captureEvent(s,i,n))),i.event_id}captureMessage(t,r,n,o){let i={event_id:I(),...n},s=me(t)?t:String(t),a=J(t)?this.eventFromMessage(s,r,i):this.eventFromException(t,i);return this._process(a.then(c=>this._captureEvent(c,i,o))),i.event_id}captureEvent(t,r,n){let o=I();if(r?.originalException&&Ye(r.originalException))return m&&d.log(qn),o;let i={event_id:o,...r},s=t.sdkProcessingMetadata||{},a=s.capturedSpanScope,c=s.capturedSpanIsolationScope;return this._process(this._captureEvent(t,i,a||n,c)),i.event_id}captureSession(t){this.sendSession(t),K(t,{init:!1})}getDsn(){return this._dsn}getOptions(){return this._options}getSdkMetadata(){return this._options._metadata}getTransport(){return this._transport}async flush(t){let r=this._transport;if(!r)return!0;this.emit("flush");let n=await this._isClientDoneProcessing(t),o=await r.flush(t);return n&&o}async close(t){let r=await this.flush(t);return this.getOptions().enabled=!1,this.emit("close"),r}getEventProcessors(){return this._eventProcessors}addEventProcessor(t){this._eventProcessors.push(t)}init(){(this._isEnabled()||this._options.integrations.some(({name:t})=>t.startsWith("Spotlight")))&&this._setupIntegrations()}getIntegrationByName(t){return this._integrations[t]}addIntegration(t){let r=this._integrations[t.name];nr(this,t,this._integrations),r||rr(this,[t])}sendEvent(t,r={}){this.emit("beforeSendEvent",t,r);let n=Rn(t,this._dsn,this._options._metadata,this._options.tunnel);for(let o of r.attachments||[])n=yn(n,In(o));this.sendEnvelope(n).then(o=>this.emit("afterSendEvent",t,o))}sendSession(t){let{release:r,environment:n=ye}=this._options;if("aggregates"in t){let i=t.attrs||{};if(!i.release&&!r){m&&d.warn(Kn);return}i.release=i.release||r,i.environment=i.environment||n,t.attrs=i}else{if(!t.release&&!r){m&&d.warn(Kn);return}t.release=t.release||r,t.environment=t.environment||n}this.emit("beforeSendSession",t);let o=xn(t,this._dsn,this._options._metadata,this._options.tunnel);this.sendEnvelope(o)}recordDroppedEvent(t,r,n=1){if(this._options.sendClientReports){let o=`${t}:${r}`;m&&d.log(`Recording outcome: "${o}"${n>1?` (${n} times)`:""}`),this._outcomes[o]=(this._outcomes[o]||0)+n}}on(t,r){let n=this._hooks[t]=this._hooks[t]||new Set,o=(...i)=>r(...i);return n.add(o),()=>{n.delete(o)}}emit(t,...r){let n=this._hooks[t];n&&n.forEach(o=>o(...r))}async sendEnvelope(t){if(this.emit("beforeEnvelope",t),this._isEnabled()&&this._transport)try{return await this._transport.send(t)}catch(r){return m&&d.error("Error while sending envelope:",r),{}}return m&&d.error("Transport disabled"),{}}_setupIntegrations(){let{integrations:t}=this._options;this._integrations=Bn(this,t),rr(this,t)}_updateSessionFromEvent(t,r){let n=r.level==="fatal",o=!1,i=r.exception?.values;if(i){o=!0;for(let c of i)if(c.mechanism?.handled===!1){n=!0;break}}let s=t.status==="ok";(s&&t.errors===0||s&&n)&&(K(t,{...n&&{status:"crashed"},errors:t.errors||Number(o||n)}),this.captureSession(t))}async _isClientDoneProcessing(t){let r=0;for(;!t||r<t;){if(await new Promise(n=>setTimeout(n,1)),!this._numProcessing)return!0;r++}return!1}_isEnabled(){return this.getOptions().enabled!==!1&&this._transport!==void 0}_prepareEvent(t,r,n,o){let i=this.getOptions(),s=Object.keys(this._integrations);return!r.integrations&&s?.length&&(r.integrations=s),this.emit("preprocessEvent",t,r),t.type||o.setLastEventId(t.event_id||r.event_id),Ln(i,t,r,n,this,o).then(a=>{if(a===null)return a;this.emit("postprocessEvent",a,r),a.contexts={trace:Bt(n),...a.contexts};let c=En(this,n);return a.sdkProcessingMetadata={dynamicSamplingContext:c,...a.sdkProcessingMetadata},a})}_captureEvent(t,r={},n=D(),o=W()){return m&&ir(t)&&d.log(`Captured error event \`${rt(t)[0]||"<unknown>"}\``),this._processEvent(t,r,n,o).then(i=>i.event_id,i=>{m&&(Vn(i)?d.log(i.message):Jn(i)?d.warn(i.message):d.warn(i))})}_processEvent(t,r,n,o){let i=this.getOptions(),{sampleRate:s}=i,a=to(t),c=ir(t),u=t.type||"error",p=`before send for type \`${u}\``,f=typeof s>"u"?void 0:an(s);if(c&&typeof f=="number"&&Math.random()>f)return this.recordDroppedEvent("sample_rate","error"),ae(or(`Discarding event because it's not included in the random sample (sampling rate = ${s})`));let h=u==="replay_event"?"replay":u;return this._prepareEvent(t,r,n,o).then(l=>{if(l===null)throw this.recordDroppedEvent("event_processor",h),or("An event processor returned `null`, will not send event.");if(r.data&&r.data.__sentry__===!0)return l;let Te=es(this,i,l,r);return Qi(Te,p)}).then(l=>{if(l===null){if(this.recordDroppedEvent("before_send",h),a){let ht=1+(t.spans||[]).length;this.recordDroppedEvent("before_send","span",ht)}throw or(`${p} returned \`null\`, will not send event.`)}let S=n.getSession()||o.getSession();if(c&&S&&this._updateSessionFromEvent(S,l),a){let x=l.sdkProcessingMetadata?.spanCountBeforeProcessing||0,ht=l.spans?l.spans.length:0,Mr=x-ht;Mr>0&&this.recordDroppedEvent("before_send","span",Mr)}let Te=l.transaction_info;if(a&&Te&&l.transaction!==t.transaction){let x="custom";l.transaction_info={...Te,source:x}}return this.sendEvent(l,r),l}).then(null,l=>{throw Vn(l)||Jn(l)?l:(this.captureException(l,{mechanism:{handled:!1,type:"internal"},data:{__sentry__:!0},originalException:l}),nt(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.
|
|
8
|
+
Reason: ${l}`))})}_process(t){this._numProcessing++,t.then(r=>(this._numProcessing--,r),r=>(this._numProcessing--,r))}_clearOutcomes(){let t=this._outcomes;return this._outcomes={},Object.entries(t).map(([r,n])=>{let[o,i]=r.split(":");return{reason:o,category:i,quantity:n}})}_flushOutcomes(){m&&d.log("Flushing outcomes...");let t=this._clearOutcomes();if(t.length===0){m&&d.log("No outcomes to send");return}if(!this._dsn){m&&d.log("No dsn provided, will not send outcomes");return}m&&d.log("Sending outcomes:",t);let r=Wn(t,this._options.tunnel&&z(this._dsn));this.sendEnvelope(r)}};function Qi(e,t){let r=`${t} must return \`null\` or a valid event.`;if(H(e))return e.then(n=>{if(!q(n)&&n!==null)throw nt(r);return n},n=>{throw nt(`${t} rejected with ${n}`)});if(!q(e)&&e!==null)throw nt(r);return e}function es(e,t,r,n){let{beforeSend:o,beforeSendTransaction:i,beforeSendSpan:s,ignoreSpans:a}=t,c=r;if(ir(c)&&o)return o(c,n);if(to(c)){if(s||a){let u=zn(c);if(a?.length&&Yt(u,a))return null;if(s){let p=s(u);p?c=X(r,Yn(p)):zt()}if(c.spans){let p=[],f=c.spans;for(let l of f){if(a?.length&&Yt(l,a)){hn(f,l);continue}if(s){let S=s(l);S?p.push(S):(zt(),p.push(l))}else p.push(l)}let h=c.spans.length-p.length;h&&e.recordDroppedEvent("before_send","span",h),c.spans=p}}if(i){if(c.spans){let u=c.spans.length;c.sdkProcessingMetadata={...r.sdkProcessingMetadata,spanCountBeforeProcessing:u}}return i(c,n)}}return c}function ir(e){return e.type===void 0}function to(e){return e.type==="transaction"}function ts(e){let t=0;return e.name&&(t+=e.name.length*2),typeof e.value=="string"?t+=e.value.length*2:t+=8,t+ro(e.attributes)}function rs(e){let t=0;return e.message&&(t+=e.message.length*2),t+ro(e.attributes)}function ro(e){if(!e)return 0;let t=0;return Object.values(e).forEach(r=>{Array.isArray(r)?t+=r.length*Zn(r[0]):J(r)?t+=Zn(r):t+=100}),t}function Zn(e){return typeof e=="string"?e.length*2:typeof e=="number"?8:typeof e=="boolean"?4:0}function sr(e,t){t.debug===!0&&(m?d.enable():O(()=>{console.warn("[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.")})),D().update(t.initialScope);let n=new e(t);return ar(n),n.init(),n}function ar(e){D().setClient(e)}var cr=Symbol.for("SentryBufferFullError");function no(e=100){let t=new Set;function r(){return t.size<e}function n(s){t.delete(s)}function o(s){if(!r())return ae(cr);let a=s();return t.add(a),a.then(()=>n(a),()=>n(a)),a}function i(s){if(!t.size)return Z(!0);let a=Promise.allSettled(Array.from(t)).then(()=>!0);if(!s)return a;let c=[a,new Promise(u=>setTimeout(()=>u(!1),s))];return Promise.race(c)}return{get $(){return Array.from(t)},add:o,drain:i}}function ns(e,t=Date.now()){let r=parseInt(`${e}`,10);if(!isNaN(r))return r*1e3;let n=Date.parse(`${e}`);return isNaN(n)?6e4:n-t}function os(e,t){return e[t]||e.all||0}function oo(e,t,r=Date.now()){return os(e,t)>r}function io(e,{statusCode:t,headers:r},n=Date.now()){let o={...e},i=r?.["x-sentry-rate-limits"],s=r?.["retry-after"];if(i)for(let a of i.trim().split(",")){let[c,u,,,p]=a.split(":",5),f=parseInt(c,10),h=(isNaN(f)?60:f)*1e3;if(!u)o.all=n+h;else for(let l of u.split(";"))l==="metric_bucket"?(!p||p.split(";").includes("custom"))&&(o[l]=n+h):o[l]=n+h}else s?o.all=n+ns(s,n):t===429&&(o.all=n+60*1e3);return o}var is=64;function ot(e,t,r=no(e.bufferSize||is)){let n={},o=s=>r.drain(s);function i(s){let a=[];if(Jt(s,(f,h)=>{let l=Vt(h);oo(n,l)?e.recordDroppedEvent("ratelimit_backoff",l):a.push(f)}),a.length===0)return Promise.resolve({});let c=U(s[0],a),u=f=>{Jt(c,(h,l)=>{e.recordDroppedEvent(f,Vt(l))})},p=()=>t({body:Tn(c)}).then(f=>(f.statusCode!==void 0&&(f.statusCode<200||f.statusCode>=300)&&m&&d.warn(`Sentry responded with status code ${f.statusCode} to sent event.`),n=io(n,f),f),f=>{throw u("network_error"),m&&d.error("Encountered error running transport request:",f),f});return r.add(p).then(f=>f,f=>{if(f===cr)return m&&d.error("Skipped sending event because buffer is full."),u("queue_overflow"),Promise.resolve({});throw f})}return{send:i,flush:o}}function Oe(e){if(!e)return{};let t=e.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!t)return{};let r=t[6]||"",n=t[8]||"";return{host:t[4],path:t[5],protocol:t[2],search:r,hash:n,relative:t[5]+r+n}}function ur(e){"aggregates"in e?e.attrs?.ip_address===void 0&&(e.attrs={...e.attrs,ip_address:"{{auto}}"}):e.ipAddress===void 0&&(e.ipAddress="{{auto}}")}function pr(e,t,r=[t],n="npm"){let o=e._metadata||{};o.sdk||(o.sdk={name:`sentry.javascript.${t}`,packages:r.map(i=>({name:`${n}:@sentry/${i}`,version:P})),version:P}),e._metadata=o}var ss=100;function Y(e,t){let r=E(),n=W();if(!r)return;let{beforeBreadcrumb:o=null,maxBreadcrumbs:i=ss}=r.getOptions();if(i<=0)return;let a={timestamp:j(),...e},c=o?O(()=>o(a,t)):a;c!==null&&(r.emit&&r.emit("beforeAddBreadcrumb",c,t),n.addBreadcrumb(c,i))}var so,as="FunctionToString",ao=new WeakMap,cs=()=>({name:as,setupOnce(){so=Function.prototype.toString;try{Function.prototype.toString=function(...e){let t=se(this),r=ao.has(E())&&t!==void 0?t:this;return so.apply(r,e)}}catch{}},setup(e){ao.set(e,!0)}}),it=cs;var us=[/^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$/],ps="EventFilters",fr=(e={})=>{let t;return{name:ps,setup(r){let n=r.getOptions();t=co(e,n)},processEvent(r,n,o){if(!t){let i=o.getOptions();t=co(e,i)}return fs(r,t)?null:r}}},at=(e={})=>({...fr(e),name:"InboundFilters"});function co(e={},t={}){return{allowUrls:[...e.allowUrls||[],...t.allowUrls||[]],denyUrls:[...e.denyUrls||[],...t.denyUrls||[]],ignoreErrors:[...e.ignoreErrors||[],...t.ignoreErrors||[],...e.disableErrorDefaults?[]:us],ignoreTransactions:[...e.ignoreTransactions||[],...t.ignoreTransactions||[]]}}function fs(e,t){if(e.type){if(e.type==="transaction"&&ls(e,t.ignoreTransactions))return m&&d.warn(`Event dropped due to being matched by \`ignoreTransactions\` option.
|
|
9
|
+
Event: ${$(e)}`),!0}else{if(ds(e,t.ignoreErrors))return m&&d.warn(`Event dropped due to being matched by \`ignoreErrors\` option.
|
|
10
|
+
Event: ${$(e)}`),!0;if(_s(e))return m&&d.warn(`Event dropped due to not having an error message, error type or stacktrace.
|
|
11
|
+
Event: ${$(e)}`),!0;if(ms(e,t.denyUrls))return m&&d.warn(`Event dropped due to being matched by \`denyUrls\` option.
|
|
12
|
+
Event: ${$(e)}.
|
|
13
|
+
Url: ${st(e)}`),!0;if(!gs(e,t.allowUrls))return m&&d.warn(`Event dropped due to not being matched by \`allowUrls\` option.
|
|
14
|
+
Event: ${$(e)}.
|
|
15
|
+
Url: ${st(e)}`),!0}return!1}function ds(e,t){return t?.length?rt(e).some(r=>he(r,t)):!1}function ls(e,t){if(!t?.length)return!1;let r=e.transaction;return r?he(r,t):!1}function ms(e,t){if(!t?.length)return!1;let r=st(e);return r?he(r,t):!1}function gs(e,t){if(!t?.length)return!0;let r=st(e);return r?he(r,t):!0}function hs(e=[]){for(let t=e.length-1;t>=0;t--){let r=e[t];if(r&&r.filename!=="<anonymous>"&&r.filename!=="[native code]")return r.filename||null}return null}function st(e){try{let r=[...e.exception?.values??[]].reverse().find(n=>n.mechanism?.parent_id===void 0&&n.stacktrace?.frames?.length)?.stacktrace?.frames;return r?hs(r):null}catch{return m&&d.error(`Cannot extract url for event ${$(e)}`),null}}function _s(e){return e.exception?.values?.length?!e.message&&!e.exception.values.some(t=>t.stacktrace||t.type&&t.type!=="Error"||t.value):!1}function lr(e,t,r,n,o,i){if(!o.exception?.values||!i||!F(i.originalException,Error))return;let s=o.exception.values.length>0?o.exception.values[o.exception.values.length-1]:void 0;s&&(o.exception.values=dr(e,t,n,i.originalException,r,o.exception.values,s,0))}function dr(e,t,r,n,o,i,s,a){if(i.length>=r+1)return i;let c=[...i];if(F(n[o],Error)){uo(s,a);let u=e(t,n[o]),p=c.length;po(u,o,p,a),c=dr(e,t,r,n[o],o,[u,...c],u,p)}return Array.isArray(n.errors)&&n.errors.forEach((u,p)=>{if(F(u,Error)){uo(s,a);let f=e(t,u),h=c.length;po(f,`errors[${p}]`,h,a),c=dr(e,t,r,u,o,[f,...c],f,h)}}),c}function uo(e,t){e.mechanism={handled:!0,type:"auto.core.linked_errors",...e.mechanism,...e.type==="AggregateError"&&{is_exception_group:!0},exception_id:t}}function po(e,t,r,n){e.mechanism={handled:!0,...e.mechanism,type:"chained",source:t,exception_id:r,parent_id:n}}function mr(e){let t="console";R(t,e),v(t,Es)}function Es(){"console"in g&&_t.forEach(function(e){e in g.console&&T(g.console,e,function(t){return de[e]=t,function(...r){y("console",{args:r,level:e}),de[e]?.apply(g.console,r)}})})}function gr(e){return e==="warn"?"warning":["fatal","error","warning","log","info","debug"].includes(e)?e:"log"}var Ss="Dedupe",ys=()=>{let e;return{name:Ss,processEvent(t){if(t.type)return t;try{if(Ts(t,e))return m&&d.warn("Event dropped due to being a duplicate of previously captured event."),null}catch{}return e=t}}},ct=ys;function Ts(e,t){return t?!!(Is(e,t)||bs(e,t)):!1}function Is(e,t){let r=e.message,n=t.message;return!(!r&&!n||r&&!n||!r&&n||r!==n||!mo(e,t)||!lo(e,t))}function bs(e,t){let r=fo(t),n=fo(e);return!(!r||!n||r.type!==n.type||r.value!==n.value||!mo(e,t)||!lo(e,t))}function lo(e,t){let r=Be(e),n=Be(t);if(!r&&!n)return!0;if(r&&!n||!r&&n||(r=r,n=n,n.length!==r.length))return!1;for(let o=0;o<n.length;o++){let i=n[o],s=r[o];if(i.filename!==s.filename||i.lineno!==s.lineno||i.colno!==s.colno||i.function!==s.function)return!1}return!0}function mo(e,t){let r=e.fingerprint,n=t.fingerprint;if(!r&&!n)return!0;if(r&&!n||!r&&n)return!1;r=r,n=n;try{return r.join("")===n.join("")}catch{return!1}}function fo(e){return e.exception?.values?.[0]}function ut(e){if(e!==void 0)return e>=400&&e<500?"warning":e>=500?"error":void 0}var Le=g;function hr(){return"history"in Le&&!!Le.history}function xs(){if(!("fetch"in Le))return!1;try{return new Headers,new Request("http://www.example.com"),new Response,!0}catch{return!1}}function ke(e){return e&&/^function\s+\w+\(\)\s+\{\s+\[native code\]\s+\}$/.test(e.toString())}function _r(){if(typeof EdgeRuntime=="string")return!0;if(!xs())return!1;if(ke(Le.fetch))return!0;let e=!1,t=Le.document;if(t&&typeof t.createElement=="function")try{let r=t.createElement("iframe");r.hidden=!0,t.head.appendChild(r),r.contentWindow?.fetch&&(e=ke(r.contentWindow.fetch)),t.head.removeChild(r)}catch(r){m&&d.warn("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",r)}return e}function Sr(e,t){let r="fetch";R(r,e),v(r,()=>Rs(void 0,t))}function Rs(e,t=!1){t&&!_r()||T(g,"fetch",function(r){return function(...n){let o=new Error,{method:i,url:s}=vs(n),a={args:n,fetchData:{method:i,url:s},startTimestamp:N()*1e3,virtualError:o,headers:As(n)};return e||y("fetch",{...a}),r.apply(g,n).then(async c=>(e?e(c):y("fetch",{...a,endTimestamp:N()*1e3,response:c}),c),c=>{if(y("fetch",{...a,endTimestamp:N()*1e3,error:c}),ne(c)&&c.stack===void 0&&(c.stack=o.stack,w(c,"framesToPop",1)),c instanceof TypeError&&(c.message==="Failed to fetch"||c.message==="Load failed"||c.message==="NetworkError when attempting to fetch resource."))try{let u=new URL(a.fetchData.url);c.message=`${c.message} (${u.host})`}catch{}throw c})}})}function Er(e,t){return!!e&&typeof e=="object"&&!!e[t]}function go(e){return typeof e=="string"?e:e?Er(e,"url")?e.url:e.toString?e.toString():"":""}function vs(e){if(e.length===0)return{method:"GET",url:""};if(e.length===2){let[r,n]=e;return{url:go(r),method:Er(n,"method")?String(n.method).toUpperCase():"GET"}}let t=e[0];return{url:go(t),method:Er(t,"method")?String(t.method).toUpperCase():"GET"}}function As(e){let[t,r]=e;try{if(typeof r=="object"&&r!==null&&"headers"in r&&r.headers)return new Headers(r.headers);if(Gr(t))return new Headers(t.headers)}catch{}}function yr(){return"npm"}var _=g,Tr=0;function Ir(){return Tr>0}function Gs(){Tr++,setTimeout(()=>{Tr--})}function pe(e,t={}){function r(o){return typeof o=="function"}if(!r(e))return e;try{let o=e.__sentry_wrapped__;if(o)return typeof o=="function"?o:e;if(se(e))return e}catch{return e}let n=function(...o){try{let i=o.map(s=>pe(s,t));return e.apply(this,i)}catch(i){throw Gs(),Ve(s=>{s.addEventProcessor(a=>(t.mechanism&&(_e(a,void 0,void 0),G(a,t.mechanism)),a.extra={...a.extra,arguments:o},a)),ue(i)}),i}};try{for(let o in e)Object.prototype.hasOwnProperty.call(e,o)&&(n[o]=e[o])}catch{}We(n,e),w(e,"__sentry_wrapped__",n);try{Object.getOwnPropertyDescriptor(n,"name").configurable&&Object.defineProperty(n,"name",{get(){return e.name}})}catch{}return n}function ho(){let e=ie(),{referrer:t}=_.document||{},{userAgent:r}=_.navigator||{},n={...t&&{Referer:t},...r&&{"User-Agent":r}};return{url:e,headers:n}}function pt(e,t){let r=Rr(e,t),n={type:qs(t),value:Ks(t)};return r.length&&(n.stacktrace={frames:r}),n.type===void 0&&n.value===""&&(n.value="Unrecoverable error caught"),n}function js(e,t,r,n){let i=E()?.getOptions().normalizeDepth,s=Xs(t),a={__serialized__:Qe(t,i)};if(s)return{exception:{values:[pt(e,s)]},extra:a};let c={exception:{values:[{type:oe(t)?t.constructor.name:n?"UnhandledRejection":"Error",value:Js(t,{isUnhandledRejection:n})}]},extra:a};if(r){let u=Rr(e,r);u.length&&(c.exception.values[0].stacktrace={frames:u})}return c}function br(e,t){return{exception:{values:[pt(e,t)]}}}function Rr(e,t){let r=t.stacktrace||t.stack||"",n=zs(t),o=Ys(t);try{return e(r,n,o)}catch{}return[]}var Ws=/Minified React error #\d+;/i;function zs(e){return e&&Ws.test(e.message)?1:0}function Ys(e){return typeof e.framesToPop=="number"?e.framesToPop:0}function _o(e){return typeof WebAssembly<"u"&&typeof WebAssembly.Exception<"u"?e instanceof WebAssembly.Exception:!1}function qs(e){let t=e?.name;return!t&&_o(e)?e.message&&Array.isArray(e.message)&&e.message.length==2?e.message[0]:"WebAssembly.Exception":t}function Ks(e){let t=e?.message;return _o(e)?Array.isArray(e.message)&&e.message.length==2?e.message[1]:"wasm exception":t?t.error&&typeof t.error.message=="string"?t.error.message:t:"No error message"}function Eo(e,t,r,n){let o=r?.syntheticException||void 0,i=ft(e,t,o,n);return G(i),i.level="error",r?.event_id&&(i.event_id=r.event_id),Z(i)}function So(e,t,r="info",n,o){let i=n?.syntheticException||void 0,s=xr(e,t,i,o);return s.level=r,n?.event_id&&(s.event_id=n.event_id),Z(s)}function ft(e,t,r,n,o){let i;if($e(t)&&t.error)return br(e,t.error);if(Ge(t)||vt(t)){let s=t;if("stack"in t)i=br(e,t);else{let a=s.name||(Ge(s)?"DOMError":"DOMException"),c=s.message?`${a}: ${s.message}`:a;i=xr(e,c,r,n),_e(i,c)}return"code"in s&&(i.tags={...i.tags,"DOMException.code":`${s.code}`}),i}return ne(t)?br(e,t):q(t)||oe(t)?(i=js(e,t,r,o),G(i,{synthetic:!0}),i):(i=xr(e,t,r,n),_e(i,`${t}`,void 0),G(i,{synthetic:!0}),i)}function xr(e,t,r,n){let o={};if(n&&r){let i=Rr(e,r);i.length&&(o.exception={values:[{value:t,stacktrace:{frames:i}}]}),G(o,{synthetic:!0})}if(me(t)){let{__sentry_template_string__:i,__sentry_template_values__:s}=t;return o.logentry={message:i,params:s},o}return o.message=t,o}function Js(e,{isUnhandledRejection:t}){let r=Ot(e),n=t?"promise rejection":"exception";return $e(e)?`Event \`ErrorEvent\` captured as ${n} with message \`${e.message}\``:oe(e)?`Event \`${Vs(e)}\` (type=${e.type}) captured as ${n}`:`Object captured as ${n} with keys: ${r}`}function Vs(e){try{let t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{}}function Xs(e){for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t)){let r=e[t];if(r instanceof Error)return r}}var dt=class extends De{constructor(t){let r=Zs(t),n=_.SENTRY_SDK_SOURCE||yr();pr(r,"browser",["browser"],n),r._metadata?.sdk&&(r._metadata.sdk.settings={infer_ip:r.sendDefaultPii?"auto":"never",...r._metadata.sdk.settings}),super(r);let{sendDefaultPii:o,sendClientReports:i,enableLogs:s,_experiments:a}=this._options;_.document&&(i||s||a?.enableMetrics)&&_.document.addEventListener("visibilitychange",()=>{_.document.visibilityState==="hidden"&&(i&&this._flushOutcomes(),s&&Ce(this),a?.enableMetrics&&we(this))}),o&&this.on("beforeSendSession",ur)}eventFromException(t,r){return Eo(this._options.stackParser,t,r,this._options.attachStacktrace)}eventFromMessage(t,r="info",n){return So(this._options.stackParser,t,r,n,this._options.attachStacktrace)}_prepareEvent(t,r,n,o){return t.platform=t.platform||"javascript",super._prepareEvent(t,r,n,o)}};function Zs(e){return{release:typeof __SENTRY_RELEASE__=="string"?__SENTRY_RELEASE__:_.SENTRY_RELEASE?.id,sendClientReports:!0,parentSpanIsAlwaysRootSpan:!0,...e}}var yo=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;var b=g;var Qs=1e3,To,vr,Ar;function Nr(e){let t="dom";R(t,e),v(t,ea)}function ea(){if(!b.document)return;let e=y.bind(null,"dom"),t=Io(e,!0);b.document.addEventListener("click",t,!1),b.document.addEventListener("keypress",t,!1),["EventTarget","Node"].forEach(r=>{let o=b[r]?.prototype;o?.hasOwnProperty?.("addEventListener")&&(T(o,"addEventListener",function(i){return function(s,a,c){if(s==="click"||s=="keypress")try{let u=this.__sentry_instrumentation_handlers__=this.__sentry_instrumentation_handlers__||{},p=u[s]=u[s]||{refCount:0};if(!p.handler){let f=Io(e);p.handler=f,i.call(this,s,f,c)}p.refCount++}catch{}return i.call(this,s,a,c)}}),T(o,"removeEventListener",function(i){return function(s,a,c){if(s==="click"||s=="keypress")try{let u=this.__sentry_instrumentation_handlers__||{},p=u[s];p&&(p.refCount--,p.refCount<=0&&(i.call(this,s,p.handler,c),p.handler=void 0,delete u[s]),Object.keys(u).length===0&&delete this.__sentry_instrumentation_handlers__)}catch{}return i.call(this,s,a,c)}}))})}function ta(e){if(e.type!==vr)return!1;try{if(!e.target||e.target._sentryId!==Ar)return!1}catch{}return!0}function ra(e,t){return e!=="keypress"?!1:t?.tagName?!(t.tagName==="INPUT"||t.tagName==="TEXTAREA"||t.isContentEditable):!0}function Io(e,t=!1){return r=>{if(!r||r._sentryCaptured)return;let n=na(r);if(ra(r.type,n))return;w(r,"_sentryCaptured",!0),n&&!n._sentryId&&w(n,"_sentryId",I());let o=r.type==="keypress"?"input":r.type;ta(r)||(e({event:r,name:o,global:t}),vr=r.type,Ar=n?n._sentryId:void 0),clearTimeout(To),To=b.setTimeout(()=>{Ar=void 0,vr=void 0},Qs)}}function na(e){try{return e.target}catch{return null}}var lt;function Fe(e){let t="history";R(t,e),v(t,oa)}function oa(){if(b.addEventListener("popstate",()=>{let t=b.location.href,r=lt;if(lt=t,r===t)return;y("history",{from:r,to:t})}),!hr())return;function e(t){return function(...r){let n=r.length>2?r[2]:void 0;if(n){let o=lt,i=ia(String(n));if(lt=i,o===i)return t.apply(this,r);y("history",{from:o,to:i})}return t.apply(this,r)}}T(b.history,"pushState",e),T(b.history,"replaceState",e)}function ia(e){try{return new URL(e,b.location.origin).toString()}catch{return e}}var mt={};function Cr(e){let t=mt[e];if(t)return t;let r=b[e];if(ke(r))return mt[e]=r.bind(b);let n=b.document;if(n&&typeof n.createElement=="function")try{let o=n.createElement("iframe");o.hidden=!0,n.head.appendChild(o);let i=o.contentWindow;i?.[e]&&(r=i[e]),n.head.removeChild(o)}catch(o){yo&&d.warn(`Could not create sandbox iframe for ${e} check, bailing to window.${e}: `,o)}return r&&(mt[e]=r.bind(b))}function wr(e){mt[e]=void 0}var fe="__sentry_xhr_v3__";function Dr(e){let t="xhr";R(t,e),v(t,sa)}function sa(){if(!b.XMLHttpRequest)return;let e=XMLHttpRequest.prototype;e.open=new Proxy(e.open,{apply(t,r,n){let o=new Error,i=N()*1e3,s=A(n[0])?n[0].toUpperCase():void 0,a=aa(n[1]);if(!s||!a)return t.apply(r,n);r[fe]={method:s,url:a,request_headers:{}},s==="POST"&&a.match(/sentry_key/)&&(r.__sentry_own_request__=!0);let c=()=>{let u=r[fe];if(u&&r.readyState===4){try{u.status_code=r.status}catch{}let p={endTimestamp:N()*1e3,startTimestamp:i,xhr:r,virtualError:o};y("xhr",p)}};return"onreadystatechange"in r&&typeof r.onreadystatechange=="function"?r.onreadystatechange=new Proxy(r.onreadystatechange,{apply(u,p,f){return c(),u.apply(p,f)}}):r.addEventListener("readystatechange",c),r.setRequestHeader=new Proxy(r.setRequestHeader,{apply(u,p,f){let[h,l]=f,S=p[fe];return S&&A(h)&&A(l)&&(S.request_headers[h.toLowerCase()]=l),u.apply(p,f)}}),t.apply(r,n)}}),e.send=new Proxy(e.send,{apply(t,r,n){let o=r[fe];if(!o)return t.apply(r,n);n[0]!==void 0&&(o.body=n[0]);let i={startTimestamp:N()*1e3,xhr:r};return y("xhr",i),t.apply(r,n)}})}function aa(e){if(A(e))return e;try{return e.toString()}catch{}}function bo(e,t=Cr("fetch")){let r=0,n=0;async function o(i){let s=i.body.length;r+=s,n++;let a={body:i.body,method:"POST",referrerPolicy:"strict-origin",headers:e.headers,keepalive:r<=6e4&&n<15,...e.fetchOptions};try{let c=await t(e.url,a);return{statusCode:c.status,headers:{"x-sentry-rate-limits":c.headers.get("X-Sentry-Rate-Limits"),"retry-after":c.headers.get("Retry-After")}}}catch(c){throw wr("fetch"),c}finally{r-=s,n--}}return ot(e,o)}var ca=30;var ua=50;function Or(e,t,r,n){let o={filename:e,function:t==="<anonymous>"?B:t,in_app:!0};return r!==void 0&&(o.lineno=r),n!==void 0&&(o.colno=n),o}var pa=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,fa=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,da=/\((\S*)(?::(\d+))(?::(\d+))\)/,la=/at (.+?) ?\(data:(.+?),/,ma=e=>{let t=e.match(la);if(t)return{filename:`<data:${t[2]}>`,function:t[1]};let r=pa.exec(e);if(r){let[,o,i,s]=r;return Or(o,B,+i,+s)}let n=fa.exec(e);if(n){if(n[2]&&n[2].indexOf("eval")===0){let a=da.exec(n[2]);a&&(n[2]=a[1],n[3]=a[2],n[4]=a[3])}let[i,s]=Ro(n[1]||B,n[2]);return Or(s,i,n[3]?+n[3]:void 0,n[4]?+n[4]:void 0)}},ga=[ca,ma],ha=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,_a=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Ea=e=>{let t=ha.exec(e);if(t){if(t[3]&&t[3].indexOf(" > eval")>-1){let i=_a.exec(t[3]);i&&(t[1]=t[1]||"eval",t[3]=i[1],t[4]=i[2],t[5]="")}let n=t[3],o=t[1]||B;return[o,n]=Ro(o,n),Or(n,o,t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}},Sa=[ua,Ea];var ya=[ga,Sa],xo=Pe(...ya),Ro=(e,t)=>{let r=e.indexOf("safari-extension")!==-1,n=e.indexOf("safari-web-extension")!==-1;return r||n?[e.indexOf("@")!==-1?e.split("@")[0]:B,r?`safari-extension:${t}`:`safari-web-extension:${t}`]:[e,t]};var ee=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;var gt=1024,Ta="Breadcrumbs",Ia=(e={})=>{let t={console:!0,dom:!0,fetch:!0,history:!0,sentry:!0,xhr:!0,...e};return{name:Ta,setup(r){t.console&&mr(Ra(r)),t.dom&&Nr(xa(r,t.dom)),t.xhr&&Dr(va(r)),t.fetch&&Sr(Aa(r)),t.history&&Fe(Na(r)),t.sentry&&r.on("beforeSendEvent",ba(r))}}},vo=Ia;function ba(e){return function(r){E()===e&&Y({category:`sentry.${r.type==="transaction"?"transaction":"event"}`,event_id:r.event_id,level:r.level,message:$(r)},{event:r})}}function xa(e,t){return function(n){if(E()!==e)return;let o,i,s=typeof t=="object"?t.serializeAttribute:void 0,a=typeof t=="object"&&typeof t.maxStringLength=="number"?t.maxStringLength:void 0;a&&a>gt&&(ee&&d.warn(`\`dom.maxStringLength\` cannot exceed ${gt}, but a value of ${a} was configured. Sentry will use ${gt} instead.`),a=gt),typeof s=="string"&&(s=[s]);try{let u=n.event,p=Ca(u)?u.target:u;o=be(p,{keyAttrs:s,maxStringLength:a}),i=Dt(p)}catch{o="<unknown>"}if(o.length===0)return;let c={category:`ui.${n.name}`,message:o};i&&(c.data={"ui.component_name":i}),Y(c,{event:n.event,name:n.name,global:n.global})}}function Ra(e){return function(r){if(E()!==e)return;let n={category:"console",data:{arguments:r.args,logger:"console"},level:gr(r.level),message:je(r.args," ")};if(r.level==="assert")if(r.args[0]===!1)n.message=`Assertion failed: ${je(r.args.slice(1)," ")||"console.assert"}`,n.data.arguments=r.args.slice(1);else return;Y(n,{input:r.args,level:r.level})}}function va(e){return function(r){if(E()!==e)return;let{startTimestamp:n,endTimestamp:o}=r,i=r.xhr[fe];if(!n||!o||!i)return;let{method:s,url:a,status_code:c,body:u}=i,p={method:s,url:a,status_code:c},f={xhr:r.xhr,input:u,startTimestamp:n,endTimestamp:o},h={category:"xhr",data:p,type:"http",level:ut(c)};e.emit("beforeOutgoingRequestBreadcrumb",h,f),Y(h,f)}}function Aa(e){return function(r){if(E()!==e)return;let{startTimestamp:n,endTimestamp:o}=r;if(o&&!(r.fetchData.url.match(/sentry_key/)&&r.fetchData.method==="POST"))if(r.fetchData.method,r.fetchData.url,r.error){let i=r.fetchData,s={data:r.error,input:r.args,startTimestamp:n,endTimestamp:o},a={category:"fetch",data:i,level:"error",type:"http"};e.emit("beforeOutgoingRequestBreadcrumb",a,s),Y(a,s)}else{let i=r.response,s={...r.fetchData,status_code:i?.status};r.fetchData.request_body_size,r.fetchData.response_body_size,i?.status;let a={input:r.args,response:i,startTimestamp:n,endTimestamp:o},c={category:"fetch",data:s,type:"http",level:ut(s.status_code)};e.emit("beforeOutgoingRequestBreadcrumb",c,a),Y(c,a)}}}function Na(e){return function(r){if(E()!==e)return;let n=r.from,o=r.to,i=Oe(_.location.href),s=n?Oe(n):void 0,a=Oe(o);s?.path||(s=i),i.protocol===a.protocol&&i.host===a.host&&(o=a.relative),i.protocol===s.protocol&&i.host===s.host&&(n=s.relative),Y({category:"navigation",data:{from:n,to:o}})}}function Ca(e){return!!e&&!!e.target}var wa=["EventTarget","Window","Node","ApplicationCache","AudioTrackList","BroadcastChannel","ChannelMergerNode","CryptoOperation","EventSource","FileReader","HTMLUnknownElement","IDBDatabase","IDBRequest","IDBTransaction","KeyOperation","MediaController","MessagePort","ModalWindow","Notification","SVGElementInstance","Screen","SharedWorker","TextTrack","TextTrackCue","TextTrackList","WebSocket","WebSocketWorker","Worker","XMLHttpRequest","XMLHttpRequestEventTarget","XMLHttpRequestUpload"],Da="BrowserApiErrors",Oa=(e={})=>{let t={XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0,unregisterOriginalCallbacks:!1,...e};return{name:Da,setupOnce(){t.setTimeout&&T(_,"setTimeout",Ao),t.setInterval&&T(_,"setInterval",Ao),t.requestAnimationFrame&&T(_,"requestAnimationFrame",La),t.XMLHttpRequest&&"XMLHttpRequest"in _&&T(XMLHttpRequest.prototype,"send",ka);let r=t.eventTarget;r&&(Array.isArray(r)?r:wa).forEach(o=>Ma(o,t))}}},No=Oa;function Ao(e){return function(...t){let r=t[0];return t[0]=pe(r,{mechanism:{handled:!1,type:`auto.browser.browserapierrors.${L(e)}`}}),e.apply(this,t)}}function La(e){return function(t){return e.apply(this,[pe(t,{mechanism:{data:{handler:L(e)},handled:!1,type:"auto.browser.browserapierrors.requestAnimationFrame"}})])}}function ka(e){return function(...t){let r=this;return["onload","onerror","onprogress","onreadystatechange"].forEach(o=>{o in r&&typeof r[o]=="function"&&T(r,o,function(i){let s={mechanism:{data:{handler:L(i)},handled:!1,type:`auto.browser.browserapierrors.xhr.${o}`}},a=se(i);return a&&(s.mechanism.data.handler=L(a)),pe(i,s)})}),e.apply(this,t)}}function Ma(e,t){let n=_[e]?.prototype;n?.hasOwnProperty?.("addEventListener")&&(T(n,"addEventListener",function(o){return function(i,s,a){try{Fa(s)&&(s.handleEvent=pe(s.handleEvent,{mechanism:{data:{handler:L(s),target:e},handled:!1,type:"auto.browser.browserapierrors.handleEvent"}}))}catch{}return t.unregisterOriginalCallbacks&&Ua(this,i,s),o.apply(this,[i,pe(s,{mechanism:{data:{handler:L(s),target:e},handled:!1,type:"auto.browser.browserapierrors.addEventListener"}}),a])}}),T(n,"removeEventListener",function(o){return function(i,s,a){try{let c=s.__sentry_wrapped__;c&&o.call(this,i,c,a)}catch{}return o.call(this,i,s,a)}}))}function Fa(e){return typeof e.handleEvent=="function"}function Ua(e,t,r){e&&typeof e=="object"&&"removeEventListener"in e&&typeof e.removeEventListener=="function"&&e.removeEventListener(t,r)}var Co=()=>({name:"BrowserSession",setupOnce(){if(typeof _.document>"u"){ee&&d.warn("Using the `browserSessionIntegration` in non-browser environments is not supported.");return}Ae({ignoreDuration:!0}),Ne(),Fe(({from:e,to:t})=>{e!==void 0&&e!==t&&(Ae({ignoreDuration:!0}),Ne())})}});var Pa="GlobalHandlers",Ba=(e={})=>{let t={onerror:!0,onunhandledrejection:!0,...e};return{name:Pa,setupOnce(){Error.stackTraceLimit=50},setup(r){t.onerror&&(Ha(r),wo("onerror")),t.onunhandledrejection&&($a(r),wo("onunhandledrejection"))}}},Do=Ba;function Ha(e){bt(t=>{let{stackParser:r,attachStacktrace:n}=Oo();if(E()!==e||Ir())return;let{msg:o,url:i,line:s,column:a,error:c}=t,u=Wa(ft(r,c||o,void 0,n,!1),i,s,a);u.level="error",ve(u,{originalException:c,mechanism:{handled:!1,type:"auto.browser.global_handlers.onerror"}})})}function $a(e){Rt(t=>{let{stackParser:r,attachStacktrace:n}=Oo();if(E()!==e||Ir())return;let o=Ga(t),i=J(o)?ja(o):ft(r,o,void 0,n,!0);i.level="error",ve(i,{originalException:o,mechanism:{handled:!1,type:"auto.browser.global_handlers.onunhandledrejection"}})})}function Ga(e){if(J(e))return e;try{if("reason"in e)return e.reason;if("detail"in e&&"reason"in e.detail)return e.detail.reason}catch{}return e}function ja(e){return{exception:{values:[{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(e)}`}]}}}function Wa(e,t,r,n){let o=e.exception=e.exception||{},i=o.values=o.values||[],s=i[0]=i[0]||{},a=s.stacktrace=s.stacktrace||{},c=a.frames=a.frames||[],u=n,p=r,f=za(t)??ie();return c.length===0&&c.push({colno:u,filename:f,function:B,in_app:!0,lineno:p}),e}function wo(e){ee&&d.log(`Global Handler attached: ${e}`)}function Oo(){return E()?.getOptions()||{stackParser:()=>[],attachStacktrace:!1}}function za(e){if(!(!A(e)||e.length===0)){if(e.startsWith("data:")){let t=e.match(/^data:([^;]+)/),r=t?t[1]:"text/javascript",n=e.includes("base64,");return`<data:${r}${n?",base64":""}>`}return e.slice(0,1024)}}var Lo=()=>({name:"HttpContext",preprocessEvent(e){if(!_.navigator&&!_.location&&!_.document)return;let t=ho(),r={...t.headers,...e.request?.headers};e.request={...t,...e.request,headers:r}}});var Ya="cause",qa=5,Ka="LinkedErrors",Ja=(e={})=>{let t=e.limit||qa,r=e.key||Ya;return{name:Ka,preprocessEvent(n,o,i){let s=i.getOptions();lr(pt,s.stackParser,r,t,n,o)}}},ko=Ja;function Mo(){return Va()?(ee&&O(()=>{console.error("[Sentry] You cannot use Sentry.init() in a browser extension, see: https://docs.sentry.io/platforms/javascript/best-practices/browser-extensions/")}),!0):!1}function Va(){if(typeof _.window>"u")return!1;let e=_;if(e.nw||!(e.chrome||e.browser)?.runtime?.id)return!1;let r=ie(),n=["chrome-extension","moz-extension","ms-browser-extension","safari-web-extension"];return!(_===_.top&&n.some(i=>r.startsWith(`${i}://`)))}function Fo(e){return[at(),it(),No(),vo(),Do(),ko(),ct(),Lo(),Co()]}function Lr(e={}){let t=!e.skipBrowserExtensionCheck&&Mo(),r={...e,enabled:t?!1:e.enabled,stackParser:Tt(e.stackParser||xo),integrations:tr({integrations:e.integrations,defaultIntegrations:e.defaultIntegrations==null?Fo():e.defaultIntegrations}),transport:e.transport||bo};return sr(dt,r)}var kr=class{constructor(){this.config=null;this.scriptCache=null;this.isWarmupInProgress=!1;this.hasWarmupError=!1;this.initializeSentry(),this.initializeGlobalState(),this.setupAutomaticWarmup()}static{this.SDK_ERROR_MARKER="__DEFLECT_SDK_ERROR__"}initializeSentry(){try{Lr({dsn:"https://4a62ed75ab362d4694ae4215c2b4f621@o4509968565665792.ingest.de.sentry.io/4510257986469968",sendDefaultPii:!0,environment:typeof window<"u"?window.location.hostname:"unknown",beforeSend(t){return t.tags?.deflect_sdk_error==="true"?(typeof window<"u"&&typeof navigator<"u"&&(t.contexts=t.contexts||{},t.contexts.browser={name:navigator.userAgent,version:navigator.appVersion},t.request=t.request||{},t.request.headers=t.request.headers||{},t.request.headers["User-Agent"]=navigator.userAgent,t.contexts.page={url:window.location.href,referrer:document.referrer,title:document.title},t.contexts.device={screen_width:window.screen.width,screen_height:window.screen.height,viewport_width:window.innerWidth,viewport_height:window.innerHeight,language:navigator.language,platform:navigator.platform}),t):null}})}catch{}}initializeGlobalState(){typeof window>"u"||(window.Deflect=window.Deflect||{})}setupAutomaticWarmup(){typeof window>"u"||(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>this.tryWarmup()):setTimeout(()=>this.tryWarmup(),100))}async tryWarmup(){if(!(!this.config?.actionId||this.isWarmupInProgress||this.scriptCache||this.hasWarmupError)){this.isWarmupInProgress=!0;try{this.scriptCache=await this.fetchScript(),this.hasWarmupError=!1}catch{this.hasWarmupError=!0}finally{this.isWarmupInProgress=!1}}}buildScriptUrl(t){let r=this.config?.scriptUrl||"https://js.deflect.bot/main.js",n=Date.now().toString();return`${r}?action_id=${t}&_=${n}`}async fetchScript(){if(!this.config?.actionId)throw new Error("actionId is required");let t=this.buildScriptUrl(this.config.actionId),r=await fetch(t,{cache:"no-store"});if(!r.ok)throw new Error(`Failed to fetch script: ${r.status}`);let n=await r.text();try{let o=JSON.parse(n);if(o.success===!1||o.error){let i=o.error||"Script fetch failed",s=new Error(i);throw(i==="action_does_not_exist"||i.includes("invalid action"))&&(s.isUserError=!0),s}}catch(o){if(!(o instanceof SyntaxError))throw o}return{content:n,sessionId:r.headers.get("session_id")||void 0}}async executeScript(t){t.sessionId&&typeof window<"u"&&(window.Deflect.sessionId=t.sessionId);let r=this.createScriptBlob(t.content),n=await this.loadScriptElement(r);try{await this.waitForGetToken();let o=await this.getTokenFromScript();return this.prefetchNextScript(),o}finally{this.cleanup(r,n)}}prefetchNextScript(){this.hasWarmupError||this.tryWarmup().catch(()=>{})}async waitForGetToken(){return new Promise(t=>{let r=setInterval(()=>{typeof window<"u"&&typeof window.Deflect?.getToken=="function"&&(clearInterval(r),t())},10);setTimeout(()=>{clearInterval(r),t()},1e4)})}createScriptBlob(t){let r=new Blob([t],{type:"text/javascript"});return URL.createObjectURL(r)}async loadScriptElement(t){return new Promise((r,n)=>{let o=document.createElement("script");o.type="module",o.src=t,o.onload=()=>r(o),o.onerror=()=>n(new Error("Script failed to load")),document.head.appendChild(o)})}async getTokenFromScript(){if(typeof window>"u"||typeof window.Deflect?.getToken!="function")throw new Error("Script did not load properly - getToken not available");try{return await window.Deflect.getToken()}catch(t){throw new Error(`Script execution failed: ${t}`)}}cleanup(t,r){URL.revokeObjectURL(t),r.remove(),typeof window<"u"&&window.Deflect?.getToken&&delete window.Deflect.getToken}configure(t){try{if(!t.actionId?.trim())throw new Error("actionId is required and cannot be empty");if(this.config?.actionId===t.actionId)return;this.hasWarmupError=!1,this.scriptCache=null,this.config={...t},typeof window<"u"&&(window.Deflect.actionId=t.actionId),this.isTestMode()||this.tryWarmup()}catch(r){throw r&&typeof r=="object"&&"isUserError"in r&&r.isUserError===!0||ue(r,{tags:{deflect_sdk_error:"true",method:"configure",actionId:t?.actionId||"unknown"}}),r}}isTestMode(){return this.config?.actionId==="t/FFFFFFFFFFFFF/111111111"||this.config?.actionId==="t/FFFFFFFFFFFFF/000000000"}async solveChallenge(){return this.getToken()}async getToken(){try{if(!this.config?.actionId)throw new Error("Must call configure() before solveChallenge()");if(this.isTestMode())return"TESTTOKEN";if(this.config.actionId==="SENTRY_TEST")throw new Error("SENTRY_TEST: This is a test error to verify Sentry integration is working");let t;return this.scriptCache&&!this.isWarmupInProgress?(t=this.scriptCache,this.scriptCache=null):t=await this.fetchScript(),this.executeScript(t)}catch(t){throw t&&typeof t=="object"&&"isUserError"in t&&t.isUserError===!0||ue(t,{tags:{deflect_sdk_error:"true",method:"getToken",actionId:this.config?.actionId||"unknown",hasCache:this.scriptCache!==null,hasWarmupError:this.hasWarmupError}}),t}}async warmup(){if(!this.config?.actionId)return!1;try{return await this.tryWarmup(),this.scriptCache!==null}catch{return!1}}clearCache(){this.scriptCache=null}async injectToken(t){if(!t||!t.target||!(t.target instanceof HTMLFormElement))throw new Error("injectToken: must be called from a form submit event");t.preventDefault();let r=t.target,n=await this.getToken();Array.from(r.querySelectorAll('input[name="deflect_token"]')).forEach(i=>i.remove());let o=document.createElement("input");return o.type="hidden",o.name="deflect_token",o.value=n,r.appendChild(o),r.submit(),!1}},Uo=new kr;typeof window<"u"&&(window.Deflect=Uo);var eh=Uo;})();
|
package/package.json
CHANGED
|
@@ -1,29 +1,39 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deflectbot/deflect-sdk",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.8",
|
|
4
4
|
"description": "SDK for deflect.bot - Use it for seamless captcha integration on any website.",
|
|
5
5
|
"main": "dist/index.min.js",
|
|
6
6
|
"module": "dist/index.esm.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
8
8
|
"unpkg": "dist/index.min.js",
|
|
9
9
|
"jsdelivr": "dist/index.min.js",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"import": "./dist/index.esm.js",
|
|
14
|
+
"require": "./dist/index.min.js"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
10
17
|
"files": [
|
|
11
18
|
"dist/**/*"
|
|
12
19
|
],
|
|
13
20
|
"scripts": {
|
|
14
|
-
"build": "esbuild src/index.ts --bundle --format=iife --outfile=dist/index.js --keep-names && esbuild src/index.ts --bundle --format=iife --minify --outfile=dist/index.min.js && esbuild src/index.ts --
|
|
21
|
+
"build": "esbuild src/index.ts --bundle --format=iife --outfile=dist/index.js --keep-names && esbuild src/index.ts --bundle --format=iife --minify --outfile=dist/index.min.js && esbuild src/index.ts --format=esm --outfile=dist/index.esm.js && tsc --declaration --emitDeclarationOnly --outDir dist"
|
|
15
22
|
},
|
|
16
23
|
"author": "Deflect",
|
|
17
24
|
"license": "MIT",
|
|
18
25
|
"devDependencies": {
|
|
19
26
|
"@eslint/js": "^9.22.0",
|
|
27
|
+
"esbuild": "^0.23.0",
|
|
20
28
|
"eslint": "^9.22.0",
|
|
21
29
|
"globals": "^16.0.0",
|
|
22
30
|
"typescript": "^5.7.3",
|
|
23
|
-
"typescript-eslint": "^8.27.0"
|
|
24
|
-
"esbuild": "^0.23.0"
|
|
31
|
+
"typescript-eslint": "^8.27.0"
|
|
25
32
|
},
|
|
26
33
|
"publishConfig": {
|
|
27
34
|
"access": "public"
|
|
35
|
+
},
|
|
36
|
+
"dependencies": {
|
|
37
|
+
"@sentry/browser": "^10.22.0"
|
|
28
38
|
}
|
|
29
39
|
}
|