import{c as ze}from"./vendor-react-FyxEPqXS.js";const C=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,H=globalThis,gn="10.53.1";function An(){return Es(H),H}function Es(e){const t=e.__SENTRY__=e.__SENTRY__||{};return t.version=t.version||gn,t[gn]=t[gn]||{}}function vi(e,t,n=H){const r=n.__SENTRY__=n.__SENTRY__||{},i=r[gn]=r[gn]||{};return i[e]||(i[e]=t())}const Al=["debug","info","warn","error","log","assert","trace"],pE="Sentry Logger ",Qo={};function Cn(e){if(!("console"in H))return e();const t=H.console,n={},r=Object.keys(Qo);r.forEach(i=>{const s=Qo[i];n[i]=t[i],t[i]=s});try{return e()}finally{r.forEach(i=>{t[i]=n[i]})}}function hE(){xl().enabled=!0}function mE(){xl().enabled=!1}function Xm(){return xl().enabled}function gE(...e){Cl("log",...e)}function _E(...e){Cl("warn",...e)}function yE(...e){Cl("error",...e)}function Cl(e,...t){C&&Xm()&&Cn(()=>{H.console[e](`${pE}[${e}]:`,...t)})}function xl(){return C?vi("loggerSettings",()=>({enabled:!1})):{enabled:!1}}const y={enable:hE,disable:mE,isEnabled:Xm,log:gE,warn:_E,error:yE},Qm=50,Qt="?",wf=/\(error: (.*)\)/,If=/captureMessage|captureException/;function Zm(...e){const t=e.sort((n,r)=>n[0]-r[0]).map(n=>n[1]);return(n,r=0,i=0)=>{const s=[],o=n.split(` `);for(let a=r;a1024&&(c=c.slice(0,1024));const u=wf.test(c)?c.replace(wf,"$1"):c;if(!u.includes("Error: ")){for(const d of t){const l=d(u);if(l){s.push(l);break}}if(s.length>=Qm+i)break}}return SE(s.slice(i))}}function bE(e){return Array.isArray(e)?Zm(...e):e}function SE(e){if(!e.length)return[];const t=Array.from(e);return/sentryWrapped/.test(io(t).function||"")&&t.pop(),t.reverse(),If.test(io(t).function||"")&&(t.pop(),If.test(io(t).function||"")&&t.pop()),t.slice(0,Qm).map(n=>({...n,filename:n.filename||io(t).filename,function:n.function||Qt}))}function io(e){return e[e.length-1]||{}}const Pc="";function Sn(e){try{return!e||typeof e!="function"?Pc:e.name||Pc}catch{return Pc}}function xu(e){const t=e.exception;if(t){const n=[];try{return t.values.forEach(r=>{r.stacktrace.frames&&n.push(...r.stacktrace.frames)}),n}catch{return}}}function eg(e){return"__v_isVNode"in e&&e.__v_isVNode?"[VueVNode]":"[VueViewModel]"}function vE(e){let t=e?.startsWith("file://")?e.slice(7):e;return t?.match(/\/[A-Z]:/)&&(t=t.slice(1)),t}const Vi={},kf={};function Zn(e,t){return Vi[e]=Vi[e]||[],Vi[e].push(t),()=>{const n=Vi[e];if(n){const r=n.indexOf(t);r!==-1&&n.splice(r,1)}}}function er(e,t){if(!kf[e]){kf[e]=!0;try{t()}catch(n){C&&y.error(`Error while instrumenting ${e}`,n)}}}function Et(e,t){const n=e&&Vi[e];if(n)for(const r of n)try{r(t)}catch(i){C&&y.error(`Error while triggering instrumentation handler. Type: ${e} Name: ${Sn(r)} Error:`,i)}}let Lc=null;function tg(e){const t="error";Zn(t,e),er(t,EE)}function EE(){Lc=H.onerror,H.onerror=function(e,t,n,r,i){return Et("error",{column:r,error:i,line:n,msg:e,url:t}),Lc?Lc.apply(this,arguments):!1},H.onerror.__SENTRY_INSTRUMENTED__=!0}let Dc=null;function ng(e){const t="unhandledrejection";Zn(t,e),er(t,TE)}function TE(){Dc=H.onunhandledrejection,H.onunhandledrejection=function(e){return Et("unhandledrejection",e),Dc?Dc.apply(this,arguments):!0},H.onunhandledrejection.__SENTRY_INSTRUMENTED__=!0}const rg=Object.prototype.toString;function Jt(e){switch(rg.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object WebAssembly.Exception]":return!0;default:return En(e,Error)}}function Ei(e,t){return rg.call(e)===`[object ${t}]`}function ig(e){return Ei(e,"ErrorEvent")}function Rf(e){return Ei(e,"DOMError")}function wE(e){return Ei(e,"DOMException")}function Lt(e){return Ei(e,"String")}function Ba(e){return typeof e=="object"&&e!==null&&"__sentry_template_string__"in e&&"__sentry_template_values__"in e}function vn(e){return e===null||Ba(e)||typeof e!="object"&&typeof e!="function"}function ot(e){return Ei(e,"Object")}function Ha(e){return typeof Event<"u"&&En(e,Event)}function IE(e){return typeof Element<"u"&&En(e,Element)}function kE(e){return Ei(e,"RegExp")}function tr(e){return!!(e?.then&&typeof e.then=="function")}function RE(e){return ot(e)&&"nativeEvent"in e&&"preventDefault"in e&&"stopPropagation"in e}function En(e,t){try{return e instanceof t}catch{return!1}}function sg(e){return!!(typeof e=="object"&&e!==null&&(e.__isVue||e._isVue||e.__v_isVNode))}function Ol(e){return typeof Request<"u"&&En(e,Request)}const Ml=H,AE=80;function Be(e,t={}){if(!e)return"";try{let n=e;const r=5,i=[];let s=0,o=0;const a=" > ",c=a.length;let u;const d=Array.isArray(t)?t:t.keyAttrs,l=!Array.isArray(t)&&t.maxStringLength||AE;for(;n&&s++1&&o+i.length*c+u.length>=l));)i.push(u),o+=u.length,n=n.parentNode;return i.reverse().join(a)}catch{return""}}function CE(e,t){const n=e,r=[];if(!n?.tagName)return"";if(Ml.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 i=t?.length?t.filter(s=>n.getAttribute(s)).map(s=>[s,n.getAttribute(s)]):null;if(i?.length)i.forEach(s=>{r.push(`[${s[0]}="${s[1]}"]`)});else{n.id&&r.push(`#${n.id}`);const s=n.className;if(s&&Lt(s)){const o=s.split(/\s+/);for(const a of o)r.push(`.${a}`)}}for(const s of["aria-label","type","name","title","alt"]){const o=n.getAttribute(s);o&&r.push(`[${s}="${o}"]`)}return r.join("")}function xr(){try{return Ml.document.location.href}catch{return""}}function Nl(e,t=5){if(!Ml.HTMLElement)return null;let n=e;for(let r=0;r"}}function Cf(e){return typeof e=="object"&&e!==null?Object.fromEntries(Object.entries(e)):{}}function xE(e){const t=Object.keys(ag(e));return t.sort(),t[0]?t.join(", "):"[object has no keys]"}let Dr;function Ts(e){if(Dr!==void 0)return Dr?Dr(e):e();const t=Symbol.for("__SENTRY_SAFE_RANDOM_ID_WRAPPER__"),n=H;return t in n&&typeof n[t]=="function"?(Dr=n[t],Dr(e)):(Dr=null,e())}function _n(){return Ts(()=>Math.random())}function ws(){return Ts(()=>Date.now())}function as(e,t=0){return typeof e!="string"||t===0||e.length<=t?e:`${e.slice(0,t)}...`}function Fc(e,t){let n=e;const r=n.length;if(r<=150)return n;t>r&&(t=r);let i=Math.max(t-60,0);i<5&&(i=0);let s=Math.min(i+140,r);return s>r-5&&(s=r),s===r&&(i=Math.max(s-140,0)),n=n.slice(i,s),i>0&&(n=`'{snip} ${n}`),se.randomUUID()).replace(/-/g,"")}catch{}return $c||($c="10000000100040008000"+1e11),$c.replace(/[018]/g,t=>(t^(ME()&15)>>t/4).toString(16))}function cg(e){return e.exception?.values?.[0]}function cr(e){const{message:t,event_id:n}=e;if(t)return t;const r=cg(e);return r?r.type&&r.value?`${r.type}: ${r.value}`:r.type||r.value||n||"":n||""}function Ou(e,t,n){const r=e.exception=e.exception||{},i=r.values=r.values||[],s=i[0]=i[0]||{};s.value||(s.value=t||""),s.type||(s.type="Error")}function Tn(e,t){const n=cg(e);if(!n)return;const r={type:"generic",handled:!0},i=n.mechanism;if(n.mechanism={...r,...i,...t},t&&"data"in t){const s={...i?.data,...t.data};n.mechanism.data=s}}function NE(e,t,n=5){if(t.lineno===void 0)return;const r=e.length,i=Math.max(Math.min(r-1,t.lineno-1),0);t.pre_context=e.slice(Math.max(0,i-n),i).map(o=>Fc(o,0));const s=Math.min(r-1,i);t.context_line=Fc(e[s],t.colno||0),t.post_context=e.slice(Math.min(i+1,r),i+1+n).map(o=>Fc(o,0))}function xf(e){if(PE(e))return!0;try{xe(e,"__sentry_captured__",!0)}catch{}return!1}function PE(e){try{return e.__sentry_captured__}catch{}}const ug=1e3;function Or(){return ws()/ug}function LE(){const{performance:e}=H;if(!e?.now||!e.timeOrigin)return Or;const t=e.timeOrigin;return()=>(t+Ts(()=>e.now()))/ug}let Of;function ye(){return(Of??(Of=LE()))()}let Uc=null;function DE(){const{performance:e}=H;if(!e?.now)return;const t=3e5,n=Ts(()=>e.now()),r=ws(),i=e.timeOrigin;if(typeof i=="number"&&Math.abs(i+n-r)UE(n)};return e&&ri(n,e),n}function ri(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||ye(),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:$e()),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{const n=e.timestamp-e.started;e.duration=n>=0?n: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 $E(e,t){let n={};e.status==="ok"&&(n={status:"exited"}),ri(e,n)}function UE(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 Is(e,t,n=2){if(!t||typeof t!="object"||n<=0)return t;if(e&&Object.keys(t).length===0)return e;const r={...e};for(const i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[i]=Is(r[i],t[i],n-1));return r}function Zt(){return $e()}function yn(){return $e().substring(16)}const Mu="_sentrySpan";function en(e,t){t?xe(e,Mu,t):delete e[Mu]}function ii(e){return e[Mu]}const BE=100;class $t{constructor(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._attachments=[],this._user={},this._tags={},this._attributes={},this._extra={},this._contexts={},this._sdkProcessingMetadata={},this._propagationContext={traceId:Zt(),sampleRand:_n()}}clone(){const t=new $t;return t._breadcrumbs=[...this._breadcrumbs],t._tags={...this._tags},t._attributes={...this._attributes},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,t._conversationId=this._conversationId,en(t,ii(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&&ri(this._session,{user:t}),this._notifyScopeListeners(),this}getUser(){return this._user}setConversationId(t){return this._conversationId=t||void 0,this._notifyScopeListeners(),this}setTags(t){return this._tags={...this._tags,...t},this._notifyScopeListeners(),this}setTag(t,n){return this.setTags({[t]:n})}setAttributes(t){return this._attributes={...this._attributes,...t},this._notifyScopeListeners(),this}setAttribute(t,n){return this.setAttributes({[t]:n})}removeAttribute(t){return t in this._attributes&&(delete this._attributes[t],this._notifyScopeListeners()),this}setExtras(t){return this._extra={...this._extra,...t},this._notifyScopeListeners(),this}setExtra(t,n){return this._extra={...this._extra,[t]:n},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,n){return n===null?delete this._contexts[t]:this._contexts[t]=n,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;const n=typeof t=="function"?t(this):t,r=n instanceof $t?n.getScopeData():ot(n)?t:void 0,{tags:i,attributes:s,extra:o,user:a,contexts:c,level:u,fingerprint:d=[],propagationContext:l,conversationId:p}=r||{};return this._tags={...this._tags,...i},this._attributes={...this._attributes,...s},this._extra={...this._extra,...o},this._contexts={...this._contexts,...c},a&&Object.keys(a).length&&(this._user=a),u&&(this._level=u),d.length&&(this._fingerprint=d),l&&(this._propagationContext=l),p&&(this._conversationId=p),this}clear(){return this._breadcrumbs=[],this._tags={},this._attributes={},this._extra={},this._user={},this._contexts={},this._level=void 0,this._transactionName=void 0,this._fingerprint=void 0,this._session=void 0,this._conversationId=void 0,en(this,void 0),this._attachments=[],this.setPropagationContext({traceId:Zt(),sampleRand:_n()}),this._notifyScopeListeners(),this}addBreadcrumb(t,n){const r=typeof n=="number"?n:BE;if(r<=0)return this;const i={timestamp:Or(),...t,message:t.message?as(t.message,2048):t.message};return this._breadcrumbs.push(i),this._breadcrumbs.length>r&&(this._breadcrumbs=this._breadcrumbs.slice(-r),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,attributes:this._attributes,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:ii(this),conversationId:this._conversationId}}setSDKProcessingMetadata(t){return this._sdkProcessingMetadata=Is(this._sdkProcessingMetadata,t,2),this}setPropagationContext(t){return this._propagationContext=t,this}getPropagationContext(){return this._propagationContext}captureException(t,n){const r=n?.event_id||$e();if(!this._client)return C&&y.warn("No client configured on scope - will not capture exception!"),r;const i=new Error("Sentry syntheticException");return this._client.captureException(t,{originalException:t,syntheticException:i,...n,event_id:r},this),r}captureMessage(t,n,r){const i=r?.event_id||$e();if(!this._client)return C&&y.warn("No client configured on scope - will not capture message!"),i;const s=r?.syntheticException??new Error(t);return this._client.captureMessage(t,n,{originalException:t,syntheticException:s,...r,event_id:i},this),i}captureEvent(t,n){const r=t.event_id||n?.event_id||$e();return this._client?(this._client.captureEvent(t,{...n,event_id:r},this),r):(C&&y.warn("No client configured on scope - will not capture event!"),r)}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach(t=>{t(this)}),this._notifyingListeners=!1)}}function HE(){return vi("defaultCurrentScope",()=>new $t)}function jE(){return vi("defaultIsolationScope",()=>new $t)}const Mf=e=>e instanceof Promise&&!e[lg],lg=Symbol("chained PromiseLike"),dg=(e,t,n)=>{const r=e.then(i=>(t(i),i),i=>{throw n(i),i});return Mf(r)&&Mf(e)?r:WE(e,r)},WE=(e,t)=>{if(!t)return e;let n=!1;for(const r in e){if(r in t)continue;n=!0;const i=e[r];typeof i=="function"?Object.defineProperty(t,r,{value:(...s)=>i.apply(e,s),enumerable:!0,configurable:!0,writable:!0}):t[r]=i}return n&&Object.assign(t,{[lg]:!0}),t};class zE{constructor(t,n){let r;t?r=t:r=new $t;let i;n?i=n:i=new $t,this._stack=[{scope:r}],this._isolationScope=i}withScope(t){const n=this._pushScope();let r;try{r=t(n)}catch(i){throw this._popScope(),i}return tr(r)?dg(r,()=>this._popScope(),()=>this._popScope()):(this._popScope(),r)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this._isolationScope}getStackTop(){return this._stack[this._stack.length-1]}_pushScope(){const 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 si(){const e=An(),t=Es(e);return t.stack=t.stack||new zE(HE(),jE())}function qE(e){return si().withScope(e)}function GE(e,t){const n=si();return n.withScope(()=>(n.getStackTop().scope=e,t(e)))}function Nf(e){return si().withScope(()=>e(si().getIsolationScope()))}function VE(){return{withIsolationScope:Nf,withScope:qE,withSetScope:GE,withSetIsolationScope:(e,t)=>Nf(t),getCurrentScope:()=>si().getScope(),getIsolationScope:()=>si().getIsolationScope()}}function nr(e){const t=Es(e);return t.acs?t.acs:VE()}function YE(e){return typeof e=="object"&&e!=null&&!Array.isArray(e)&&Object.keys(e).includes("value")}function KE(e,t){const{value:n,unit:r}=YE(e)?e:{value:e,unit:void 0},i=JE(n),s=r&&typeof r=="string"?{unit:r}:{};if(i)return{...i,...s};if(!t||t==="skip-undefined"&&n===void 0)return;let o="";try{o=JSON.stringify(n)??""}catch{}return{value:o,type:"string",...s}}function oi(e,t=!1){const n={};for(const[r,i]of Object.entries(e??{})){const s=KE(i,t);s&&(n[r]=s)}return n}function Pf(e){if(!e)return 0;let t=0;for(const[n,r]of Object.entries(e)){t+=n.length*2,t+=r.type.length*2,t+=(r.unit?.length??0)*2;const i=r.value;Array.isArray(i)?t+=Lf(i[0])*i.length:vn(i)?t+=Lf(i):t+=100}return t}function Lf(e){return typeof e=="string"?e.length*2:typeof e=="boolean"?4:typeof e=="number"?8:0}function JE(e){const t=typeof e=="string"?"string":typeof e=="boolean"?"boolean":typeof e=="number"&&!Number.isNaN(e)?Number.isInteger(e)?"integer":"double":null;if(t)return{value:e,type:t}}function G(){const e=An();return nr(e).getCurrentScope()}function Oe(){const e=An();return nr(e).getIsolationScope()}function mr(){return vi("globalScope",()=>new $t)}function at(...e){const t=An(),n=nr(t);if(e.length===2){const[r,i]=e;return r?n.withSetScope(r,i):n.withScope(i)}return n.withScope(e[0])}function XE(...e){const t=An(),n=nr(t);if(e.length===2){const[r,i]=e;return r?n.withSetIsolationScope(r,i):n.withIsolationScope(i)}return n.withIsolationScope(e[0])}function O(){return G().getClient()}function fg(e){const t=e.getPropagationContext(),{traceId:n,parentSpanId:r,propagationSpanId:i}=t,s={trace_id:n,span_id:i||yn()};return r&&(s.parent_span_id=r),s}const le="sentry.source",ja="sentry.sample_rate",pg="sentry.previous_trace_sample_rate",oe="sentry.op",J="sentry.origin",cs="sentry.idle_span_finish_reason",ks="sentry.measurement_unit",Rs="sentry.measurement_value",QE="sentry.release",ZE="sentry.environment",eT="sentry.segment.name",tT="sentry.segment.id",nT="sentry.sdk.name",rT="sentry.sdk.version",iT="user.id",sT="user.email",oT="user.ip_address",aT="user.name",us="sentry.custom_span_name",Ll="sentry.profile_id",rr="sentry.exclusive_time",cT="http.request.method",uT="url.full",lT="sentry.link.type",dT="gen_ai.conversation.id",hg=0,As=1,ce=2;function mg(e){if(e<400&&e>=100)return{code:As};if(e>=400&&e<500)switch(e){case 401:return{code:ce,message:"unauthenticated"};case 403:return{code:ce,message:"permission_denied"};case 404:return{code:ce,message:"not_found"};case 409:return{code:ce,message:"already_exists"};case 413:return{code:ce,message:"failed_precondition"};case 429:return{code:ce,message:"resource_exhausted"};case 499:return{code:ce,message:"cancelled"};default:return{code:ce,message:"invalid_argument"}}if(e>=500&&e<600)switch(e){case 501:return{code:ce,message:"unimplemented"};case 503:return{code:ce,message:"unavailable"};case 504:return{code:ce,message:"deadline_exceeded"};default:return{code:ce,message:"internal_error"}}return{code:ce,message:"internal_error"}}function ls(e,t){e.setAttribute("http.response.status_code",t);const n=mg(t);n.message!=="unknown_error"&&e.setStatus(n)}function fT(e){try{const t=H.WeakRef;if(typeof t=="function")return new t(e)}catch{}return e}function pT(e){if(e){if(typeof e=="object"&&"deref"in e&&typeof e.deref=="function")try{return e.deref()}catch{return}return e}}const gg="_sentryScope",_g="_sentryIsolationScope";function hT(e,t,n){e&&(xe(e,_g,fT(n)),xe(e,gg,t))}function ds(e){const t=e;return{scope:t[gg],isolationScope:pT(t[_g])}}const ea="sentry-",mT=8192;function Dl(e){const t=gT(e);if(!t)return;const n=Object.entries(t).reduce((r,[i,s])=>{if(i.startsWith(ea)){const o=i.slice(ea.length);r[o]=s}return r},{});if(Object.keys(n).length>0)return n}function yg(e){if(!e)return;const t=Object.entries(e).reduce((n,[r,i])=>(i&&(n[`${ea}${r}`]=i),n),{});return _T(t)}function gT(e){if(!(!e||!Lt(e)&&!Array.isArray(e)))return Array.isArray(e)?e.reduce((t,n)=>{const r=Df(n);return Object.entries(r).forEach(([i,s])=>{t[i]=s}),t},{}):Df(e)}function Df(e){return e.split(",").map(t=>{const n=t.indexOf("=");if(n===-1)return[];const r=t.slice(0,n),i=t.slice(n+1);return[r,i].map(s=>{try{return decodeURIComponent(s.trim())}catch{return}})}).reduce((t,[n,r])=>(n&&r&&(t[n]=r),t),{})}function _T(e){if(Object.keys(e).length!==0)return Object.entries(e).reduce((t,[n,r],i)=>{const s=`${encodeURIComponent(n)}=${encodeURIComponent(r)}`,o=i===0?s:`${t},${s}`;return o.length>mT?(C&&y.warn(`Not adding key: ${n} with val: ${r} to baggage header due to exceeding baggage size limits.`),t):o},"")}const yT=/^o(\d+)\./,bT=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)((?:\[[:.%\w]+\]|[\w.-]+))(?::(\d+))?\/(.+)/;function ST(e){return e==="http"||e==="https"}function sn(e,t=!1){const{host:n,path:r,pass:i,port:s,projectId:o,protocol:a,publicKey:c}=e;return`${a}://${c}${t&&i?`:${i}`:""}@${n}${s?`:${s}`:""}/${r&&`${r}/`}${o}`}function bg(e){const t=bT.exec(e);if(!t){Cn(()=>{console.error(`Invalid Sentry Dsn: ${e}`)});return}const[n,r,i="",s="",o="",a=""]=t.slice(1);let c="",u=a;const d=u.split("/");if(d.length>1&&(c=d.slice(0,-1).join("/"),u=d.pop()),u){const l=u.match(/^\d+/);l&&(u=l[0])}return Sg({host:s,pass:i,path:c,projectId:u,port:o,protocol:n,publicKey:r})}function Sg(e){return{protocol:e.protocol,publicKey:e.publicKey||"",pass:e.pass||"",host:e.host,port:e.port||"",path:e.path||"",projectId:e.projectId}}function vT(e){if(!C)return!0;const{port:t,projectId:n,protocol:r}=e;return["protocol","publicKey","host","projectId"].find(o=>e[o]?!1:(y.error(`Invalid Sentry Dsn: ${o} missing`),!0))?!1:n.match(/^\d+$/)?ST(r)?t&&isNaN(parseInt(t,10))?(y.error(`Invalid Sentry Dsn: Invalid port ${t}`),!1):!0:(y.error(`Invalid Sentry Dsn: Invalid protocol ${r}`),!1):(y.error(`Invalid Sentry Dsn: Invalid projectId ${n}`),!1)}function ET(e){return e.match(yT)?.[1]}function vg(e){const t=e.getOptions(),{host:n}=e.getDsn()||{};let r;return t.orgId?r=String(t.orgId):n&&(r=ET(n)),r}function Eg(e){const t=typeof e=="string"?bg(e):Sg(e);if(!(!t||!vT(t)))return t}function vr(e){if(typeof e=="boolean")return Number(e);const t=typeof e=="string"?parseFloat(e):e;if(!(typeof t!="number"||isNaN(t)||t<0||t>1))return t}const Tg=new RegExp("^[ \\t]*([0-9a-f]{32})?-?([0-9a-f]{16})?-?([01])?[ \\t]*$");function TT(e){if(!e)return;const t=e.match(Tg);if(!t)return;let n;return t[3]==="1"?n=!0:t[3]==="0"&&(n=!1),{traceId:t[1],parentSampled:n,parentSpanId:t[2]}}function wg(e,t){const n=TT(e),r=Dl(t);if(!n?.traceId)return{traceId:Zt(),sampleRand:_n()};const i=wT(n,r);r&&(r.sample_rand=i.toString());const{traceId:s,parentSpanId:o,parentSampled:a}=n;return{traceId:s,parentSpanId:o,sampled:a,dsc:r||{},sampleRand:i}}function Ig(e=Zt(),t=yn(),n){let r="";return n!==void 0&&(r=n?"-1":"-0"),`${e}-${t}${r}`}function kg(e=Zt(),t=yn(),n){return`00-${e}-${t}-${n?"01":"00"}`}function wT(e,t){const n=vr(t?.sample_rand);if(n!==void 0)return n;const r=vr(t?.sample_rate);return r&&e?.parentSampled!==void 0?e.parentSampled?_n()*r:r+_n()*(1-r):_n()}function IT(e,t){const n=vg(e);return t&&n&&t!==n?(y.log(`Won't continue trace because org IDs don't match (incoming baggage: ${t}, SDK options: ${n})`),!1):(e.getOptions().strictTraceContinuation||!1)&&(t&&!n||!t&&n)?(y.log(`Starting a new trace because strict trace continuation is enabled but one org ID is missing (incoming baggage: ${t}, Sentry client: ${n})`),!1):!0}const Rg=0,Wa=1;let Ff=!1;function kT(e){const{spanId:t,traceId:n}=e.spanContext(),{data:r,op:i,parent_span_id:s,status:o,origin:a,links:c}=B(e);return{parent_span_id:s,span_id:t,trace_id:n,data:r,op:i,status:o,origin:a,links:c}}function Ag(e){const{spanId:t,traceId:n,isRemote:r}=e.spanContext(),i=r?t:B(e).parent_span_id,s=ds(e).scope,o=r?s?.getPropagationContext().propagationSpanId||yn():t;return{parent_span_id:i,span_id:o,trace_id:n}}function Cg(e){const{traceId:t,spanId:n}=e.spanContext(),r=xn(e);return Ig(t,n,r)}function RT(e){const{traceId:t,spanId:n}=e.spanContext(),r=xn(e);return kg(t,n,r)}function xg(e){if(e&&e.length>0)return e.map(({context:{spanId:t,traceId:n,traceFlags:r,...i},attributes:s})=>({span_id:t,trace_id:n,sampled:r===Wa,attributes:s,...i}))}function Og(e){if(e?.length)return e.map(({context:{spanId:t,traceId:n,traceFlags:r},attributes:i})=>({span_id:t,trace_id:n,sampled:r===Wa,attributes:i}))}function bn(e){return typeof e=="number"?$f(e):Array.isArray(e)?e[0]+e[1]/1e9:e instanceof Date?$f(e.getTime()):ye()}function $f(e){return e>9999999999?e/1e3:e}function B(e){if(Lg(e))return e.getSpanJSON();const{spanId:t,traceId:n}=e.spanContext();if(Pg(e)){const{attributes:r,startTime:i,name:s,endTime:o,status:a,links:c}=e;return{span_id:t,trace_id:n,data:r,description:s,parent_span_id:Mg(e),start_timestamp:bn(i),timestamp:bn(o)||void 0,status:Dg(a),op:r[oe],origin:r[J],links:xg(c)}}return{span_id:t,trace_id:n,start_timestamp:0,data:{}}}function ta(e){if(Lg(e))return e.getStreamedSpanJSON();const{spanId:t,traceId:n}=e.spanContext();if(Pg(e)){const{attributes:r,startTime:i,name:s,endTime:o,status:a,links:c}=e;return{name:s,span_id:t,trace_id:n,parent_span_id:Mg(e),start_timestamp:bn(i),end_timestamp:bn(o),is_segment:e===na(e),status:Fg(a),attributes:r,links:Og(c)}}return{span_id:t,trace_id:n,start_timestamp:0,name:"",end_timestamp:0,status:"ok",is_segment:e===na(e)}}function Mg(e){return"parentSpanId"in e?e.parentSpanId:"parentSpanContext"in e?e.parentSpanContext?.spanId:void 0}function Ng(e){return{...e,attributes:oi(e.attributes),links:e.links?.map(t=>({...t,attributes:oi(t.attributes)}))}}function Pg(e){const t=e;return!!t.attributes&&!!t.startTime&&!!t.name&&!!t.endTime&&!!t.status}function Lg(e){return typeof e.getSpanJSON=="function"}function xn(e){const{traceFlags:t}=e.spanContext();return t===Wa}function Dg(e){if(!(!e||e.code===hg))return e.code===As?"ok":e.message||"internal_error"}function Fg(e){return!e||e.code===As||e.code===hg||e.message==="cancelled"?"ok":"error"}const gr="_sentryChildSpans",Nu="_sentryRootSpan";function $g(e,t){const n=e[Nu]||e;xe(t,Nu,n),e[gr]?e[gr].add(t):xe(e,gr,new Set([t]))}function AT(e,t){e[gr]&&e[gr].delete(t)}function Zi(e){const t=new Set;function n(r){if(!t.has(r)&&xn(r)){t.add(r);const i=r[gr]?Array.from(r[gr]):[];for(const s of i)n(s)}}return n(e),Array.from(t)}const ke=na;function na(e){return e[Nu]||e}function Ae(){const e=An(),t=nr(e);return t.getActiveSpan?t.getActiveSpan():ii(G())}function ra(){Ff||(Cn(()=>{console.warn("[Sentry] Returning null from `beforeSendSpan` is disallowed. To drop certain spans, configure the respective integrations directly or use `ignoreSpans`.")}),Ff=!0)}function CT(e,t){e.updateName(t),e.setAttributes({[le]:"custom",[us]:t})}let Uf=!1;function Ug(){if(Uf)return;function e(){const t=Ae(),n=t&&ke(t);if(n){const r="internal_error";C&&y.log(`[Tracing] Root span: ${r} -> Global error occurred`),n.setStatus({code:ce,message:r})}}e.tag="sentry_tracingErrorCallback",Uf=!0,tg(e),ng(e)}function wt(e){if(typeof __SENTRY_TRACING__=="boolean"&&!__SENTRY_TRACING__)return!1;const t=e||O()?.getOptions();return!!t&&(t.tracesSampleRate!=null||!!t.tracesSampler)}function Bf(e){y.log(`Ignoring span ${e.op} - ${e.description} because it matches \`ignoreSpans\`.`)}function fs(e,t){if(!t?.length)return!1;for(const n of t){if(MT(n)){if(e.description&&Qi(e.description,n))return C&&Bf(e),!0;continue}const r=!!n.attributes&&Object.keys(n.attributes).length>0;if(!n.name&&!n.op&&!r)continue;const i=n.name?e.description&&Qi(e.description,n.name):!0,s=n.op?e.op&&Qi(e.op,n.op):!0,o=n.attributes?Object.entries(n.attributes).every(([a,c])=>xT(e.attributes?.[a],c)):!0;if(i&&s&&o)return C&&Bf(e),!0}return!1}function xT(e,t){return typeof e=="string"&&(typeof t=="string"||t instanceof RegExp)?Qi(e,t):Array.isArray(e)&&Array.isArray(t)?e.length===t.length&&e.every((n,r)=>n===t[r]):e===t}function OT(e,t){const n=t.parent_span_id,r=t.span_id;if(n)for(const i of e)i.parent_span_id===r&&(i.parent_span_id=n)}function MT(e){return typeof e=="string"||e instanceof RegExp}const za="production",Bg="_frozenDsc";function Oo(e,t){xe(e,Bg,t)}function Hg(e,t){const n=t.getOptions(),{publicKey:r}=t.getDsn()||{},i={environment:n.environment||za,release:n.release,public_key:r,trace_id:e,org_id:vg(t)};return t.emit("createDsc",i),i}function Fl(e,t){const n=t.getPropagationContext();return n.dsc||Hg(n.traceId,e)}function gt(e){const t=O();if(!t)return{};const n=ke(e),r=B(n),i=r.data,s=n.spanContext().traceState,o=s?.get("sentry.sample_rate")??i[ja]??i[pg];function a(h){return(typeof o=="number"||typeof o=="string")&&(h.sample_rate=`${o}`),h}const c=n[Bg];if(c)return a(c);const u=s?.get("sentry.dsc"),d=u&&Dl(u);if(d)return a(d);const l=Hg(e.spanContext().traceId,t),p=i[le]??i["sentry.span.source"],f=r.description;return p!=="url"&&f&&(l.transaction=f),wt()&&(l.sampled=String(xn(n)),l.sample_rand=s?.get("sentry.sample_rand")??ds(n).scope?.getPropagationContext().sampleRand.toString()),a(l),t.emit("createDsc",l,n),l}function NT(e){const t=gt(e);return yg(t)}class ht{constructor(t={}){this._traceId=t.traceId||Zt(),this._spanId=t.spanId||yn(),this.dropReason=t.dropReason}spanContext(){return{spanId:this._spanId,traceId:this._traceId,traceFlags:Rg}}end(t){}setAttribute(t,n){return this}setAttributes(t){return this}setStatus(t){return this}updateName(t){return this}isRecording(){return!1}addEvent(t,n,r){return this}addLink(t){return this}addLinks(t){return this}recordException(t,n){}}function PT(e){return xe(e,"_streamed",!0),e}function qa(e){return!!e&&typeof e=="function"&&"_streamed"in e&&!!e._streamed}const jg=Symbol.for("sentry.skipNormalization"),Wg=Symbol.for("sentry.overrideNormalizationDepth");function LT(e){xe(e,jg,!0)}function DT(e,t){xe(e,Wg,t)}function FT(e){return!!e[jg]}function $T(e){const t=e[Wg];return typeof t=="number"?t:void 0}function Ge(e,t=100,n=1/0){try{return Pu("",e,t,n)}catch(r){return{ERROR:`**non-serializable** (${r})`}}}function zg(e,t=3,n=100*1024){const r=Ge(e,t);return jT(r)>n?zg(e,t-1,n):r}function Pu(e,t,n=1/0,r=1/0,i=WT()){const[s,o]=i;if(t==null||["boolean","string"].includes(typeof t)||typeof t=="number"&&Number.isFinite(t))return t;const a=UT(e,t);if(!a.startsWith("[object "))return a;if(FT(t))return t;const c=$T(t),u=c!==void 0?c:n;if(u===0)return a.replace("object ","");if(s(t))return"[Circular ~]";const d=t;if(d&&typeof d.toJSON=="function")try{const h=d.toJSON();return Pu("",h,u-1,r,i)}catch{}const l=Array.isArray(t)?[]:{};let p=0;const f=ag(t);for(const h in f){if(!Object.prototype.hasOwnProperty.call(f,h))continue;if(p>=r){l[h]="[MaxProperties ~]";break}const m=f[h];l[h]=Pu(h,m,u-1,r,i),p++}return o(t),l}function UT(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(sg(t))return eg(t);if(RE(t))return"[SyntheticEvent]";if(typeof t=="number"&&!Number.isFinite(t))return`[${t}]`;if(typeof t=="function")return`[Function: ${Sn(t)}]`;if(typeof t=="symbol")return`[${String(t)}]`;if(typeof t=="bigint")return`[BigInt: ${String(t)}]`;const n=BT(t);return/^HTML(\w*)Element$/.test(n)?`[HTMLElement: ${n}]`:`[object ${n}]`}catch(n){return`**non-serializable** (${n})`}}function BT(e){const t=Object.getPrototypeOf(e);return t?.constructor?t.constructor.name:"null prototype"}function HT(e){return~-encodeURI(e).split(/%..|./).length}function jT(e){return HT(JSON.stringify(e))}function WT(){const e=new WeakSet;function t(r){return e.has(r)?!0:(e.add(r),!1)}function n(r){e.delete(r)}return[t,n]}function Ot(e,t=[]){return[e,t]}function Hf(e,t){const[n,r]=e;return[n,[...r,t]]}function Er(e,t){const n=e[1];for(const r of n){const i=r[0].type;if(t(r,i))return!0}return!1}function Lu(e,t){return Er(e,(n,r)=>t.includes(r))}function ia(e){const t=Es(H);return t.encodePolyfill?t.encodePolyfill(e):new TextEncoder().encode(e)}function zT(e){const t=Es(H);return t.decodePolyfill?t.decodePolyfill(e):new TextDecoder().decode(e)}function sa(e){const[t,n]=e;let r=JSON.stringify(t);function i(s){typeof r=="string"?r=typeof s=="string"?r+s:[ia(r),s]:r.push(typeof s=="string"?ia(s):s)}for(const s of n){const[o,a]=s;if(i(` ${JSON.stringify(o)} `),typeof a=="string"||a instanceof Uint8Array)i(a);else{let c;try{c=JSON.stringify(a)}catch{c=JSON.stringify(Ge(a))}i(c)}}return typeof r=="string"?r:qT(r)}function qT(e){const t=e.reduce((i,s)=>i+s.length,0),n=new Uint8Array(t);let r=0;for(const i of e)n.set(i,r),r+=i.length;return n}function GT(e){let t=typeof e=="string"?ia(e):e;function n(o){const a=t.subarray(0,o);return t=t.subarray(o+1),a}function r(){let o=t.indexOf(10);return o<0&&(o=t.length),JSON.parse(zT(n(o)))}const i=r(),s=[];for(;t.length;){const o=r(),a=typeof o.length=="number"?o.length:void 0;s.push([o,a?n(a):r()])}return[i,s]}function VT(e){return[{type:"span"},e]}function YT(e){const t=typeof e.data=="string"?ia(e.data):e.data;return[{type:"attachment",length:t.length,filename:e.filename,content_type:e.contentType,attachment_type:e.attachmentType},t]}const qg={sessions:"session",event:"error",client_report:"internal",user_report:"default",profile_chunk:"profile",replay_event:"replay",replay_recording:"replay",check_in:"monitor",raw_security:"security",log:"log_item",trace_metric:"metric"};function KT(e){return e in qg}function jf(e){return KT(e)?qg[e]:e}function Cs(e){if(!e?.sdk)return;const{name:t,version:n}=e.sdk;return{name:t,version:n}}function Gg(e,t,n,r){const i=e.sdkProcessingMetadata?.dynamicSamplingContext;return{event_id:e.event_id,sent_at:new Date().toISOString(),...t&&{sdk:t},...!!n&&r&&{dsn:sn(r)},...i&&{trace:i}}}function JT(e,t){if(!t)return e;const n=e.sdk||{};return e.sdk={...n,name:n.name||t.name,version:n.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 XT(e,t,n,r){const i=Cs(n),s={sent_at:new Date().toISOString(),...i&&{sdk:i},...!!r&&t&&{dsn:sn(t)}},o="aggregates"in e?[{type:"sessions"},e]:[{type:"session"},e.toJSON()];return Ot(s,[o])}function QT(e,t,n,r){const i=Cs(n),s=e.type&&e.type!=="replay_event"?e.type:"event";JT(e,n?.sdk);const o=Gg(e,i,r,t);return delete e.sdkProcessingMetadata,Ot(o,[[{type:s},e]])}function ZT(e,t){function n(f){return!!f.trace_id&&!!f.public_key}const r=gt(e[0]),i=t?.getDsn(),s=t?.getOptions().tunnel,o={sent_at:new Date().toISOString(),...n(r)&&{trace:r},...!!s&&i&&{dsn:sn(i)}},{beforeSendSpan:a,ignoreSpans:c}=t?.getOptions()||{},u=c?.length?e.filter(f=>{const h=B(f);return!fs({description:h.description,op:h.op,attributes:h.data},c)}):e,d=e.length-u.length;d&&t?.recordDroppedEvent("before_send","span",d);const l=a?f=>{const h=B(f),m=qa(a)?h:a(h);return m||(ra(),h)}:B,p=[];for(const f of u){const h=l(f);h&&p.push(VT(h))}return Ot(o,p)}function e0(e){if(!C)return;const{description:t="< unknown name >",op:n="< unknown op >",parent_span_id:r}=B(e),{spanId:i}=e.spanContext(),s=xn(e),o=ke(e),a=o===e,c=`[Tracing] Starting ${s?"sampled":"unsampled"} ${a?"root ":""}span`,u=[`op: ${n}`,`name: ${t}`,`ID: ${i}`];if(r&&u.push(`parent ID: ${r}`),!a){const{op:d,description:l}=B(o);u.push(`root ID: ${o.spanContext().spanId}`),d&&u.push(`root op: ${d}`),l&&u.push(`root description: ${l}`)}y.log(`${c} ${u.join(` `)}`)}function t0(e){if(!C)return;const{description:t="< unknown name >",op:n="< unknown op >"}=B(e),{spanId:r}=e.spanContext(),s=ke(e)===e,o=`[Tracing] Finishing "${n}" ${s?"root ":""}span "${t}" with ID ${r}`;y.log(o)}function Vg(e,t,n,r=Ae()){const i=r&&ke(r);i&&(C&&y.log(`[Measurement] Setting measurement on root span: ${e} = ${t} ${n}`),i.addEvent(e,{[Rs]:t,[ks]:n}))}function Wf(e){if(!e||e.length===0)return;const t={};return e.forEach(n=>{const r=n.attributes||{},i=r[ks],s=r[Rs];typeof i=="string"&&typeof s=="number"&&(t[n.name]={value:s,unit:i})}),t}function Rt(e){return e.getOptions().traceLifecycle==="stream"}const zf=1e3;class Ga{constructor(t={}){this._traceId=t.traceId||Zt(),this._spanId=t.spanId||yn(),this._startTime=t.startTimestamp||ye(),this._links=t.links,this._attributes={},this.setAttributes({[J]:"manual",[oe]:t.op,...t.attributes}),this._name=t.name,t.parentSpanId&&(this._parentSpanId=t.parentSpanId),"sampled"in t&&(this._sampled=t.sampled),t.endTimestamp&&(this._endTime=t.endTimestamp),this._events=[],this._isStandaloneSpan=t.isStandalone,this._endTime&&this._onSpanEnded()}addLink(t){return this._links?this._links.push(t):this._links=[t],this}addLinks(t){return this._links?this._links.push(...t):this._links=t,this}recordException(t,n){}spanContext(){const{_spanId:t,_traceId:n,_sampled:r}=this;return{spanId:t,traceId:n,traceFlags:r?Wa:Rg}}setAttribute(t,n){return n===void 0?delete this._attributes[t]:this._attributes[t]=n,this}setAttributes(t){return Object.keys(t).forEach(n=>this.setAttribute(n,t[n])),this}updateStartTime(t){this._startTime=bn(t)}setStatus(t){return this._status=t,this}updateName(t){return this._name=t,this.setAttribute(le,"custom"),this}end(t){this._endTime||(this._endTime=bn(t),t0(this),this._onSpanEnded())}getSpanJSON(){return{data:this._attributes,description:this._name,op:this._attributes[oe],parent_span_id:this._parentSpanId,span_id:this._spanId,start_timestamp:this._startTime,status:Dg(this._status),timestamp:this._endTime,trace_id:this._traceId,origin:this._attributes[J],profile_id:this._attributes[Ll],exclusive_time:this._attributes[rr],measurements:Wf(this._events),is_segment:this._isStandaloneSpan&&ke(this)===this||void 0,segment_id:this._isStandaloneSpan?ke(this).spanContext().spanId:void 0,links:xg(this._links)}}getStreamedSpanJSON(){return{name:this._name??"",span_id:this._spanId,trace_id:this._traceId,parent_span_id:this._parentSpanId,start_timestamp:this._startTime,end_timestamp:this._endTime??this._startTime,is_segment:this._isStandaloneSpan||this===ke(this),status:Fg(this._status),attributes:this._attributes,links:Og(this._links)}}isRecording(){return!this._endTime&&!!this._sampled}addEvent(t,n,r){C&&y.log("[Tracing] Adding an event to span:",t);const i=qf(n)?n:r||ye(),s=qf(n)?{}:n||{},o={name:t,time:bn(i),attributes:s};return this._events.push(o),this}isStandaloneSpan(){return!!this._isStandaloneSpan}_onSpanEnded(){const t=O();if(t&&(t.emit("spanEnd",this),this._isStandaloneSpan||t.emit("afterSpanEnd",this)),!(this._isStandaloneSpan||this===ke(this)))return;if(this._isStandaloneSpan){this._sampled?r0(ZT([this],t)):(C&&y.log("[Tracing] Discarding standalone span because its trace was not chosen to be sampled."),t&&t.recordDroppedEvent("sample_rate","span"));return}else if(t&&Rt(t)){t.emit("afterSegmentSpanEnd",this);return}const r=this._convertSpanToTransaction();r&&(ds(this).scope||G()).captureEvent(r)}_convertSpanToTransaction(){if(!Gf(B(this)))return;this._name||(C&&y.warn("Transaction has no name, falling back to ``."),this._name="");const{scope:t,isolationScope:n}=ds(this),r=t?.getScopeData().sdkProcessingMetadata?.normalizedRequest;if(this._sampled!==!0)return;const s=Zi(this).filter(l=>l!==this&&!n0(l)).map(l=>B(l)).filter(Gf),o=this._attributes[le];delete this._attributes[us];let a=!1;s.forEach(l=>{delete l.data[us],l.op?.startsWith("gen_ai.")&&(a=!0)});const c={contexts:{trace:kT(this)},spans:s.length>zf?s.sort((l,p)=>l.start_timestamp-p.start_timestamp).slice(0,zf):s,start_timestamp:this._startTime,timestamp:this._endTime,transaction:this._name,type:"transaction",sdkProcessingMetadata:{capturedSpanScope:t,capturedSpanIsolationScope:n,dynamicSamplingContext:gt(this),hasGenAiSpans:a},request:r,...o&&{transaction_info:{source:o}}},u=Wf(this._events);return u&&Object.keys(u).length&&(C&&y.log("[Measurements] Adding measurements to transaction event",JSON.stringify(u,void 0,2)),c.measurements=u),c}}function qf(e){return e&&typeof e=="number"||e instanceof Date||Array.isArray(e)}function Gf(e){return!!e.start_timestamp&&!!e.timestamp&&!!e.span_id&&!!e.trace_id}function n0(e){return e instanceof Ga&&e.isStandaloneSpan()}function r0(e){const t=O();if(!t)return;const n=e[1];if(!n||n.length===0){t.recordDroppedEvent("before_send","span");return}t.sendEnvelope(e)}function $l(e,t,n=()=>{},r=()=>{}){let i;try{i=e()}catch(s){throw t(s),n(),s}return i0(i,t,n,r)}function i0(e,t,n,r){return tr(e)?dg(e,i=>{n(),r(i)},i=>{t(i),n()}):(n(),r(e),e)}function s0(e,t,n){if(!wt(e))return[!1];let r,i;typeof e.tracesSampler=="function"?(i=e.tracesSampler({...t,inheritOrSampleWith:a=>typeof t.parentSampleRate=="number"?t.parentSampleRate:typeof t.parentSampled=="boolean"?Number(t.parentSampled):a}),r=!0):t.parentSampled!==void 0?i=t.parentSampled:typeof e.tracesSampleRate<"u"&&(i=e.tracesSampleRate,r=!0);const s=vr(i);if(s===void 0)return C&&y.warn(`[Tracing] Discarding root span because of invalid sample rate. Sample rate must be a boolean or a number between 0 and 1. Got ${JSON.stringify(i)} of type ${JSON.stringify(typeof i)}.`),[!1];if(!s)return C&&y.log(`[Tracing] Discarding transaction because ${typeof e.tracesSampler=="function"?"tracesSampler returned 0 or false":"a negative sampling decision was inherited or tracesSampleRate is set to 0"}`),[!1,s,r];const o=nJg(s)(()=>{const u=G(),d=Hl(u,s),l=O(),p=e.onlyIfParent&&!d,f=p?new ht:Ul({parentSpan:d,spanArguments:r,forceTransaction:i,scope:u});return p&&l?.recordDroppedEvent("no_parent_span","span"),(!Xg(f)||!d)&&en(u,f),$l(()=>t(f),()=>{const{status:h}=B(f);f.isRecording()&&(!h||h==="ok")&&f.setStatus({code:ce,message:"internal_error"})},()=>{f.end()})}))}function pn(e,t){const n=Ti();if(n.startSpanManual)return n.startSpanManual(e,t);const r=Bl(e),{forceTransaction:i,parentSpan:s,scope:o}=e,a=o?.clone();return at(a,()=>Jg(s)(()=>{const u=G(),d=Hl(u,s),l=e.onlyIfParent&&!d,p=l?new ht:Ul({parentSpan:d,spanArguments:r,forceTransaction:i,scope:u});return l&&O()?.recordDroppedEvent("no_parent_span","span"),(!Xg(p)||!d)&&en(u,p),$l(()=>t(p,()=>p.end()),()=>{const{status:f}=B(p);p.isRecording()&&(!f||f==="ok")&&p.setStatus({code:ce,message:"internal_error"})})}))}function mt(e){const t=Ti();if(t.startInactiveSpan)return t.startInactiveSpan(e);const n=Bl(e),{forceTransaction:r,parentSpan:i}=e;return(e.scope?o=>at(e.scope,o):i!==void 0?o=>Tr(i,o):o=>o())(()=>{const o=G(),a=Hl(o,i),c=O();return e.onlyIfParent&&!a?(c?.recordDroppedEvent("no_parent_span","span"),new ht):Ul({parentSpan:a,spanArguments:n,forceTransaction:r,scope:o})})}const o0=(e,t)=>{const n=An(),r=nr(n);if(r.continueTrace)return r.continueTrace(e,t);const{sentryTrace:i,baggage:s}=e,o=O(),a=Dl(s);return o&&!IT(o,a?.org_id)?Kg(t):at(c=>{const u=wg(i,s);return c.setPropagationContext(u),en(c,void 0),t()})};function Tr(e,t){const n=Ti();return n.withActiveSpan?n.withActiveSpan(e,t):at(r=>(en(r,e||void 0),t(r)))}function Yg(e){const t=Ti();return t.suppressTracing?t.suppressTracing(e):at(n=>{n.setSDKProcessingMetadata({[Du]:!0});const r=e();return n.setSDKProcessingMetadata({[Du]:void 0}),r})}function Kg(e){const t=Ti();return t.startNewTrace?t.startNewTrace(e):at(n=>(n.setPropagationContext({traceId:Zt(),sampleRand:_n()}),C&&y.log(`Starting a new trace with id ${n.getPropagationContext().traceId}`),Tr(null,e)))}function Ul({parentSpan:e,spanArguments:t,forceTransaction:n,scope:r}){if(!wt()){const a=new ht;if(n||!e){const c={sampled:"false",sample_rate:"0",transaction:t.name,...gt(a)};Oo(a,c)}return a}const i=O();if(c0(i,t))return jl(r)||i?.recordDroppedEvent("ignored","span"),new ht({dropReason:"ignored",traceId:e?.spanContext().traceId??r.getPropagationContext().traceId});const s=Oe();let o;if(e&&!n)o=a0(e,r,t),$g(e,o);else if(e){const a=gt(e),{traceId:c,spanId:u}=e.spanContext(),d=xn(e);o=Vf({traceId:c,parentSpanId:u,...t},r,d),Oo(o,a)}else{const{traceId:a,dsc:c,parentSpanId:u,sampled:d}={...s.getPropagationContext(),...r.getPropagationContext()};o=Vf({traceId:a,parentSpanId:u,...t},r,d),c&&Oo(o,c)}return e0(o),hT(o,r,s),o}function Bl(e){const n={isStandalone:(e.experimental||{}).standalone,...e};if(e.startTime){const r={...n};return r.startTimestamp=bn(e.startTime),delete r.startTime,r}return n}function Ti(){const e=An();return nr(e)}function Vf(e,t,n){const r=O(),i=r?.getOptions()||{},{name:s=""}=e,o={spanAttributes:{...e.attributes},spanName:s,parentSampled:n};r?.emit("beforeSampling",o,{decision:!1});const a=o.parentSampled??n,c=o.spanAttributes,u=t.getPropagationContext(),d=jl(t),[l,p,f]=d?[!1]:s0(i,{name:s,parentSampled:a,attributes:c,parentSampleRate:vr(u.dsc?.sample_rate)},u.sampleRand),h=new Ga({...e,attributes:{[le]:"custom",[ja]:p!==void 0&&f?p:void 0,...c},sampled:l});return!l&&r&&!d&&(C&&y.log("[Tracing] Discarding root span because its trace was not chosen to be sampled."),r.recordDroppedEvent("sample_rate",Rt(r)?"span":"transaction")),r&&r.emit("spanStart",h),h}function a0(e,t,n){const{spanId:r,traceId:i}=e.spanContext(),s=jl(t),o=s?!1:xn(e),a=o?new Ga({...n,parentSpanId:r,traceId:i,sampled:o}):new ht({traceId:i});$g(e,a);const c=O();return c&&(Rt(c)&&a instanceof ht&&(e instanceof ht&&e.dropReason?(a.dropReason=e.dropReason,c.recordDroppedEvent(e.dropReason,"span")):s||(a.dropReason="sample_rate",c.recordDroppedEvent("sample_rate","span"))),c.emit("spanStart",a),n.endTimestamp&&(c.emit("spanEnd",a),c.emit("afterSpanEnd",a))),a}function Hl(e,t){if(t)return t;if(t===null)return;const n=ii(e);if(!n)return;const r=O();return(r?r.getOptions():{}).parentSpanIsAlwaysRootSpan?ke(n):n}function Jg(e){return e!==void 0?t=>Tr(e,t):t=>t()}function c0(e,t){const n=e?.getOptions().ignoreSpans;return!e||!Rt(e)||!n?.length?!1:fs({description:t.name||"",op:t.attributes?.[oe]||t.op,attributes:t.attributes},n)}function Xg(e){return e instanceof ht&&e.dropReason==="ignored"}function jl(e){return e.getScopeData().sdkProcessingMetadata[Du]===!0}const Mo={idleTimeout:1e3,finalTimeout:3e4,childSpanTimeout:15e3},u0="heartbeatFailed",l0="idleTimeout",d0="finalTimeout",f0="externalFinish";function Qg(e,t={}){const n=new Map;let r=!1,i,s=f0,o=!t.disableAutoFinish;const a=[],{idleTimeout:c=Mo.idleTimeout,finalTimeout:u=Mo.finalTimeout,childSpanTimeout:d=Mo.childSpanTimeout,beforeSpanEnd:l,trimIdleSpanEndTimestamp:p=!0}=t,f=O();if(!f||!wt()){const b=new ht,I={sample_rate:"0",sampled:"false",...gt(b)};return Oo(b,I),b}const h=G(),m=Ae(),g=p0(e);g.end=new Proxy(g.end,{apply(b,I,M){if(l&&l(g),I instanceof ht)return;const[k,...D]=M,x=k||ye(),L=bn(x),F=Zi(g).filter(P=>P!==g),Z=B(g);if(!F.length||!p)return T(L),Reflect.apply(b,I,[L,...D]);const Y=f.getOptions().ignoreSpans,ne=F?.reduce((P,U)=>{const re=B(U);return!re.timestamp||Y&&fs({description:re.description,op:re.op,attributes:re.data},Y)?P:P?Math.max(P,re.timestamp):re.timestamp},void 0),R=Z.start_timestamp,j=Math.min(R?R+u/1e3:1/0,Math.max(R||-1/0,Math.min(L,ne||1/0)));return T(j),Reflect.apply(b,I,[j,...D])}});function _(){i&&(clearTimeout(i),i=void 0)}function S(b){_(),i=setTimeout(()=>{!r&&n.size===0&&o&&(s=l0,g.end(b))},c)}function E(b){i=setTimeout(()=>{!r&&o&&(s=u0,g.end(b))},d)}function v(b){_(),n.set(b,!0);const I=ye();E(I+d/1e3)}function w(b){if(n.has(b)&&n.delete(b),n.size===0){const I=ye();S(I+c/1e3)}}function T(b){r=!0,n.clear(),a.forEach(F=>F()),en(h,m);const I=B(g),{start_timestamp:M}=I;if(!M)return;I.data[cs]||g.setAttribute(cs,s);const D=I.status;(!D||D==="unknown")&&g.setStatus({code:As}),y.log(`[Tracing] Idle span "${I.op}" finished`);const x=Zi(g).filter(F=>F!==g);let L=0;x.forEach(F=>{F.isRecording()&&(F.setStatus({code:ce,message:"cancelled"}),F.end(b),C&&y.log("[Tracing] Cancelling span since span ended early",JSON.stringify(F,void 0,2)));const Z=B(F),{timestamp:Y=0,start_timestamp:ne=0}=Z,R=ne<=b,j=(u+c)/1e3,P=Y-ne<=j;if(C){const U=JSON.stringify(F,void 0,2);R?P||y.log("[Tracing] Discarding span since it finished after idle span final timeout",U):y.log("[Tracing] Discarding span since it happened after idle span was finished",U)}(!P||!R)&&(AT(g,F),L++)}),L>0&&g.setAttribute("sentry.idle_span_discarded_spans",L)}return a.push(f.on("spanStart",b=>{if(r||b===g||B(b).timestamp||b instanceof Ga&&b.isStandaloneSpan())return;Zi(g).includes(b)&&v(b.spanContext().spanId)})),a.push(f.on("spanEnd",b=>{r||w(b.spanContext().spanId)})),a.push(f.on("idleSpanEnableAutoFinish",b=>{b===g&&(o=!0,S(),n.size&&E())})),t.disableAutoFinish||S(),setTimeout(()=>{r||(g.setStatus({code:ce,message:"deadline_exceeded"}),s=d0,g.end())},u),g}function p0(e){const t=mt(e);return en(G(),t),C&&y.log("[Tracing] Started span is an idle span"),t}function h0(e,t){const{fingerprint:n,span:r,breadcrumbs:i,sdkProcessingMetadata:s}=t;m0(e,t),r&&y0(e,r),b0(e,n),g0(e,i),_0(e,s)}function Yf(e,t){const{extra:n,tags:r,attributes:i,user:s,contexts:o,level:a,sdkProcessingMetadata:c,breadcrumbs:u,fingerprint:d,eventProcessors:l,attachments:p,propagationContext:f,transactionName:h,span:m}=t;Wi(e,"extra",n),Wi(e,"tags",r),Wi(e,"attributes",i),Wi(e,"user",s),Wi(e,"contexts",o),e.sdkProcessingMetadata=Is(e.sdkProcessingMetadata,c,2),a&&(e.level=a),h&&(e.transactionName=h),m&&(e.span=m),u.length&&(e.breadcrumbs=[...e.breadcrumbs,...u]),d.length&&(e.fingerprint=[...e.fingerprint,...d]),l.length&&(e.eventProcessors=[...e.eventProcessors,...l]),p.length&&(e.attachments=[...e.attachments,...p]),e.propagationContext={...e.propagationContext,...f}}function Wi(e,t,n){e[t]=Is(e[t],n,1)}function xs(e,t){const n=mr().getScopeData();return e&&Yf(n,e.getScopeData()),t&&Yf(n,t.getScopeData()),n}function m0(e,t){const{extra:n,tags:r,user:i,contexts:s,level:o,transactionName:a}=t;Object.keys(n).length&&(e.extra={...n,...e.extra}),Object.keys(r).length&&(e.tags={...r,...e.tags}),Object.keys(i).length&&(e.user={...i,...e.user}),Object.keys(s).length&&(e.contexts={...s,...e.contexts}),o&&(e.level=o),a&&e.type!=="transaction"&&(e.transaction=a)}function g0(e,t){const n=[...e.breadcrumbs||[],...t];e.breadcrumbs=n.length?n:void 0}function _0(e,t){e.sdkProcessingMetadata={...e.sdkProcessingMetadata,...t}}function y0(e,t){e.contexts={trace:Ag(t),...e.contexts},e.sdkProcessingMetadata={dynamicSamplingContext:gt(t),...e.sdkProcessingMetadata};const n=ke(t),r=B(n).description;r&&!e.transaction&&e.type==="transaction"&&(e.transaction=r)}function b0(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}const S0="thismessage:/";function Wl(e){return"isRelative"in e}function zl(e,t){const n=e.indexOf("://")<=0&&e.indexOf("//")!==0,r=n?S0:void 0;try{if("canParse"in URL&&!URL.canParse(e,r))return;const i=new URL(e,r);return n?{isRelative:n,pathname:i.pathname,search:i.search,hash:i.hash}:i}catch{}}function v0(e){if(Wl(e))return e.pathname;const t=new URL(e);return t.search="",t.hash="",["80","443"].includes(t.port)&&(t.port=""),t.password&&(t.password="%filtered%"),t.username&&(t.username="%filtered%"),t.toString()}function Bn(e){if(!e)return{};const t=e.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!t)return{};const n=t[6]||"",r=t[8]||"";return{host:t[4],path:t[5],protocol:t[2],search:n,hash:r,relative:t[5]+n+r}}function oa(e){return e.split(/[?#]/,1)[0]}function E0(e){const{protocol:t,host:n,path:r}=e,i=n?.replace(/^.*@/,"[filtered]:[filtered]@").replace(/(:80)$/,"").replace(/(:443)$/,"")||"";return`${t?`${t}://`:""}${i}${r}`}function Hn(e,t=!0){if(e.startsWith("data:")){const n=e.match(/^data:([^;,]+)/),r=n?n[1]:"text/plain",i=e.includes(";base64,"),s=e.indexOf(",");let o="";if(t&&s!==-1){const a=e.slice(s+1);o=a.length>10?`${a.slice(0,10)}... [truncated]`:a}return`data:${r}${i?",base64":""}${o?`,${o}`:""}`}return e}function T0(e,t){const n=ta(e),r=na(e),i=ta(r),{isolationScope:s,scope:o}=ds(e),a=xs(s,o);w0(n,i,t,a);const c=e.kind;k0(n,c),n.is_segment&&t.emit("processSegmentSpan",n),t.emit("processSpan",n);const{beforeSendSpan:u}=t.getOptions(),d=u&&qa(u)?I0(n,u):n,l=d.attributes?.[le];return l&&It(d,{"sentry.span.source":l}),{...Ng(d),_segmentSpan:r}}function It(e,t){const n=e.attributes??(e.attributes={});Object.entries(t).forEach(([r,i])=>{i!=null&&!(r in n)&&(n[r]=i)})}function w0(e,t,n,r){const i=n.getSdkMetadata(),{release:s,environment:o}=n.getOptions();It(e,{[QE]:s,[ZE]:o,[eT]:t.name,[tT]:t.span_id,[nT]:i?.sdk?.name,[rT]:i?.sdk?.version,[iT]:r.user?.id,[sT]:r.user?.email,[oT]:r.user?.ip_address,[aT]:r.user?.username,...r.attributes})}function I0(e,t){const n=t(e);return n||(ra(),e)}const Fu=1,Kf=2;function k0(e,t){const n=e.attributes;if(!n)return;const r=n["http.request.method"]||n["http.method"];if(r){R0(e,n,t,r);return}const i=n["db.system.name"]||n["db.system"],s=typeof n[oe]=="string"&&`${n[oe]}`.startsWith("cache.");if(i&&!s){C0(e,n);return}if(n["rpc.service"]){It(e,{[oe]:"rpc"});return}if(n["messaging.system"]){It(e,{[oe]:"message"});return}const o=n["faas.trigger"];o&&It(e,{[oe]:`${o}`})}function R0(e,t,n,r){const i=["http"];n===Kf?i.push("client"):n===Fu&&i.push("server"),t["sentry.http.prefetch"]&&i.push("prefetch"),It(e,{[oe]:i.join(".")});const s=t[us];if(typeof s=="string"){e.name=s;return}if(t[le]==="custom")return;const o=t["http.route"];if(typeof o=="string")e.name=`${r} ${o}`,It(e,{[le]:"route"});else{if(n===Kf||n===Fu){const a=A0(t,n);a&&(e.name=`${r} ${a}`)}It(e,{[le]:"url"})}}function A0(e,t){const n=e["http.url"]||e["url.full"],r=e["http.target"],i=typeof n=="string"?Bn(n):void 0,s=i?E0(i):void 0;if(t===Fu&&typeof r=="string")return oa(r);if(s)return s;if(typeof r=="string")return oa(r)}function C0(e,t){It(e,{[oe]:"db"});const n=t[us];if(typeof n=="string"){e.name=n;return}if(t[le]==="custom")return;const r=t["db.statement"];r&&(e.name=`${r}`,It(e,{[le]:"task"}))}const Bc=0,Jf=1,Xf=2;function Os(e){return new ps(t=>{t(e)})}function ql(e){return new ps((t,n)=>{n(e)})}class ps{constructor(t){this._state=Bc,this._handlers=[],this._runExecutor(t)}then(t,n){return new ps((r,i)=>{this._handlers.push([!1,s=>{if(!t)r(s);else try{r(t(s))}catch(o){i(o)}},s=>{if(!n)i(s);else try{r(n(s))}catch(o){i(o)}}]),this._executeHandlers()})}catch(t){return this.then(n=>n,t)}finally(t){return new ps((n,r)=>{let i,s;return this.then(o=>{s=!1,i=o,t&&t()},o=>{s=!0,i=o,t&&t()}).then(()=>{if(s){r(i);return}n(i)})})}_executeHandlers(){if(this._state===Bc)return;const t=this._handlers.slice();this._handlers=[],t.forEach(n=>{n[0]||(this._state===Jf&&n[1](this._value),this._state===Xf&&n[2](this._value),n[0]=!0)})}_runExecutor(t){const n=(s,o)=>{if(this._state===Bc){if(tr(o)){o.then(r,i);return}this._state=s,this._value=o,this._executeHandlers()}},r=s=>{n(Jf,s)},i=s=>{n(Xf,s)};try{t(r,i)}catch(s){i(s)}}}function x0(e,t,n,r=0){try{const i=$u(t,n,e,r);return tr(i)?i:Os(i)}catch(i){return ql(i)}}function $u(e,t,n,r){const i=n[r];if(!e||!i)return e;const s=i({...e},t);return C&&s===null&&y.log(`Event processor "${i.id||"?"}" dropped event`),tr(s)?s.then(o=>$u(o,t,n,r+1)):$u(s,t,n,r+1)}let or,Qf,Zf,Pn;function Zg(e){const t=H._sentryDebugIds,n=H._debugIds;if(!t&&!n)return{};const r=t?Object.keys(t):[],i=n?Object.keys(n):[];if(Pn&&r.length===Qf&&i.length===Zf)return Pn;Qf=r.length,Zf=i.length,Pn={},or||(or={});const s=(o,a)=>{for(const c of o){const u=a[c],d=or?.[c];if(d&&Pn&&u)Pn[d[0]]=u,or&&(or[c]=[d[0],u]);else if(u){const l=e(c);for(let p=l.length-1;p>=0;p--){const h=l[p]?.filename;if(h&&Pn&&or){Pn[h]=u,or[c]=[h,u];break}}}}};return t&&s(r,t),n&&s(i,n),Pn}function O0(e,t){const n=Zg(e);if(!n)return[];const r=[];for(const i of t){const s=vE(i);s&&n[s]&&r.push({type:"sourcemap",code_file:i,debug_id:n[s]})}return r}function e_(e,t,n,r,i,s){const{normalizeDepth:o=3,normalizeMaxBreadth:a=1e3}=e,c={...t,event_id:t.event_id||n.event_id||$e(),timestamp:t.timestamp||Or()},u=n.integrations||e.integrations.map(_=>_.name);M0(c,e),L0(c,u),i&&i.emit("applyFrameMetadata",t),t.type===void 0&&N0(c,e.stackParser);const d=F0(r,n.captureContext);n.mechanism&&Tn(c,n.mechanism);const l=i?i.getEventProcessors():[],p=xs(s,d),f=[...n.attachments||[],...p.attachments];f.length&&(n.attachments=f),h0(c,p);const h=[...l,...p.eventProcessors];return(n.data&&n.data.__sentry__===!0?Os(c):x0(h,c,n)).then(_=>(_&&P0(_),typeof o=="number"&&o>0?D0(_,o,a):_))}function M0(e,t){const{environment:n,release:r,dist:i,maxValueLength:s}=t;e.environment=e.environment||n||za,!e.release&&r&&(e.release=r),!e.dist&&i&&(e.dist=i);const o=e.request;o?.url&&s&&(o.url=as(o.url,s)),s&&e.exception?.values?.forEach(a=>{a.value&&(a.value=as(a.value,s))})}function N0(e,t){const n=Zg(t);e.exception?.values?.forEach(r=>{r.stacktrace?.frames?.forEach(i=>{i.filename&&(i.debug_id=n[i.filename])})})}function P0(e){const t={};if(e.exception?.values?.forEach(r=>{r.stacktrace?.frames?.forEach(i=>{i.debug_id&&(i.abs_path?t[i.abs_path]=i.debug_id:i.filename&&(t[i.filename]=i.debug_id),delete i.debug_id)})}),Object.keys(t).length===0)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(([r,i])=>{n.push({type:"sourcemap",code_file:r,debug_id:i})})}function L0(e,t){t.length>0&&(e.sdk=e.sdk||{},e.sdk.integrations=[...e.sdk.integrations||[],...t])}function D0(e,t,n){if(!e)return null;const r={...e,...e.breadcrumbs&&{breadcrumbs:e.breadcrumbs.map(i=>({...i,...i.data&&{data:Ge(i.data,t,n)}}))},...e.user&&{user:Ge(e.user,t,n)},...e.contexts&&{contexts:Ge(e.contexts,t,n)},...e.extra&&{extra:Ge(e.extra,t,n)}};return e.contexts?.trace&&r.contexts&&(r.contexts.trace=e.contexts.trace,e.contexts.trace.data&&(r.contexts.trace.data=Ge(e.contexts.trace.data,t,n))),e.spans&&(r.spans=e.spans.map(i=>({...i,...i.data&&{data:Ge(i.data,t,n)}}))),e.contexts?.flags&&r.contexts&&(r.contexts.flags=Ge(e.contexts.flags,3,n)),r}function F0(e,t){if(!t)return e;const n=e?e.clone():new $t;return n.update(t),n}function $0(e){if(e)return U0(e)?{captureContext:e}:H0(e)?{captureContext:e}:e}function U0(e){return e instanceof $t||typeof e=="function"}const B0=["user","level","extra","contexts","tags","fingerprint","propagationContext"];function H0(e){return Object.keys(e).some(t=>B0.includes(t))}function be(e,t){return G().captureException(e,$0(t))}function t_(e,t){const n=typeof t=="string"?t:void 0,r=typeof t!="string"?{captureContext:t}:void 0;return G().captureMessage(e,n,r)}function wi(e,t){return G().captureEvent(e,t)}function Gl(e,t){Oe().setContext(e,t)}function j0(e){Oe().setExtras(e)}function W0(e,t){Oe().setExtra(e,t)}function z0(e){Oe().setTags(e)}function q0(e,t){Oe().setTag(e,t)}function G0(e){Oe().setUser(e)}function V0(e){Oe().setConversationId(e)}function n_(){return Oe().lastEventId()}async function Y0(e){const t=O();return t?t.flush(e):(C&&y.warn("Cannot flush events. No client defined."),Promise.resolve(!1))}async function K0(e){const t=O();return t?t.close(e):(C&&y.warn("Cannot flush events and disable SDK. No client defined."),Promise.resolve(!1))}function J0(){return!!O()}function r_(){const e=O();return e?.getOptions().enabled!==!1&&!!e?.getTransport()}function i_(e){Oe().addEventProcessor(e)}function Uu(e){const t=Oe(),{user:n}=xs(t,G()),{userAgent:r}=H.navigator||{},i=FE({user:n,...r&&{userAgent:r},...e}),s=t.getSession();return s?.status==="ok"&&ri(s,{status:"exited"}),Vl(),t.setSession(i),i}function Vl(){const e=Oe(),n=G().getSession()||e.getSession();n&&$E(n),s_(),e.setSession()}function s_(){const e=Oe(),t=O(),n=e.getSession();n&&t&&t.captureSession(n)}function No(e=!1){if(e){Vl();return}s_()}const X0="7";function o_(e){const t=e.protocol?`${e.protocol}:`:"",n=e.port?`:${e.port}`:"";return`${t}//${e.host}${n}${e.path?`/${e.path}`:""}/api/`}function Q0(e){return`${o_(e)}${e.projectId}/envelope/`}function Z0(e,t){const n={sentry_version:X0};return e.publicKey&&(n.sentry_key=e.publicKey),t&&(n.sentry_client=`${t.name}/${t.version}`),new URLSearchParams(n).toString()}function a_(e,t,n){return t||`${Q0(e)}?${Z0(e,n)}`}function ew(e,t){const n=Eg(e);if(!n)return"";const r=`${o_(n)}embed/error-page/`;let i=`dsn=${sn(n)}`;for(const s in t)if(s!=="dsn"&&s!=="onClose")if(s==="user"){const o=t.user;if(!o)continue;o.name&&(i+=`&name=${encodeURIComponent(o.name)}`),o.email&&(i+=`&email=${encodeURIComponent(o.email)}`)}else i+=`&${encodeURIComponent(s)}=${encodeURIComponent(t[s])}`;return`${r}?${i}`}const ep=[];function tw(e){const t={};return e.forEach(n=>{const{name:r}=n,i=t[r];i&&!i.isDefaultInstance&&n.isDefaultInstance||(t[r]=n)}),Object.values(t)}function nw(e){const t=e.defaultIntegrations||[],n=e.integrations;t.forEach(i=>{i.isDefaultInstance=!0});let r;if(Array.isArray(n))r=[...t,...n];else if(typeof n=="function"){const i=n(t);r=Array.isArray(i)?i:[i]}else r=t;return tw(r)}function rw(e,t){const n={};return t.forEach(r=>{r?.beforeSetup&&r.beforeSetup(e)}),t.forEach(r=>{r&&c_(e,r,n)}),n}function tp(e,t){for(const n of t)n?.afterAllSetup&&n.afterAllSetup(e)}function c_(e,t,n){if(n[t.name]){C&&y.log(`Integration skipped because it was already installed: ${t.name}`);return}if(n[t.name]=t,!ep.includes(t.name)&&typeof t.setupOnce=="function"&&(t.setupOnce(),ep.push(t.name)),t.setup&&typeof t.setup=="function"&&t.setup(e),typeof t.preprocessEvent=="function"){const r=t.preprocessEvent.bind(t);e.on("preprocessEvent",(i,s)=>r(i,s,e))}if(typeof t.processEvent=="function"){const r=t.processEvent.bind(t),i=Object.assign((s,o)=>r(s,o,e),{id:t.name});e.addEventProcessor(i)}["processSpan","processSegmentSpan"].forEach(r=>{const i=t[r];typeof i=="function"&&e.on(r,s=>i.call(t,s,e))}),C&&y.log(`Integration installed: ${t.name}`)}function Bu(e){const t=O();if(!t){C&&y.warn(`Cannot add integration "${e.name}" because no SDK Client is available.`);return}t.addIntegration(e)}const iw="sentry.timestamp.sequence";let Hc=0,jc;function u_(e){const t=Math.floor(e*1e3);jc!==void 0&&t!==jc&&(Hc=0);const n=Hc;return Hc++,jc=t,{key:iw,value:{value:n,type:"integer"}}}function l_(e,t){return t?at(t,()=>{const n=Ae(),r=n?Ag(n):fg(t);return[n?gt(n):Fl(e,t),r]}):[void 0,void 0]}const sw={trace:1,debug:5,info:9,warn:13,error:17,fatal:21};function ow(){return typeof __SENTRY_BROWSER_BUNDLE__<"u"&&!!__SENTRY_BROWSER_BUNDLE__}function aw(){return"npm"}function cw(){return!ow()&&Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]"}function Kn(){return typeof window<"u"&&(!cw()||uw())}function uw(){return H.process?.type==="renderer"}function lw(e,t){const n=t?"auto":"never";return[{type:"log",item_count:e.length,content_type:"application/vnd.sentry.items.log+json"},{version:2,...Kn()&&{ingest_settings:{infer_ip:n,infer_user_agent:n}},items:e}]}function dw(e,t,n,r,i){const s={};return t?.sdk&&(s.sdk={name:t.sdk.name,version:t.sdk.version}),n&&r&&(s.dsn=sn(r)),Ot(s,[lw(e,i)])}const fw=100;function Vt(e,t,n,r=!0){n&&(!e[t]||r)&&(e[t]=n)}function pw(e,t){const n=Yl(),r=d_(e);r===void 0?n.set(e,[t]):r.length>=fw?(ca(e,r),n.set(e,[t])):n.set(e,[...r,t])}function aa(e,t=G(),n=pw){const r=t?.getClient()??O();if(!r){C&&y.warn("No client available to capture log.");return}const{release:i,environment:s,enableLogs:o=!1,beforeSendLog:a}=r.getOptions();if(!o){C&&y.warn("logging option not enabled, log will not be captured.");return}const[,c]=l_(r,t),u={...e.attributes},{user:{id:d,email:l,username:p},attributes:f={}}=xs(Oe(),t);Vt(u,"user.id",d,!1),Vt(u,"user.email",l,!1),Vt(u,"user.name",p,!1),Vt(u,"sentry.release",i),Vt(u,"sentry.environment",s);const{name:h,version:m}=r.getSdkMetadata()?.sdk??{};Vt(u,"sentry.sdk.name",h),Vt(u,"sentry.sdk.version",m);const g=r.getIntegrationByName("Replay"),_=g?.getReplayId(!0);Vt(u,"sentry.replay_id",_),_&&g?.getRecordingMode()==="buffer"&&Vt(u,"sentry._internal.replay_is_buffering",!0);const S=e.message;if(Ba(S)){const{__sentry_template_string__:L,__sentry_template_values__:F=[]}=S;F?.length&&(u["sentry.message.template"]=L),F.forEach((Z,Y)=>{u[`sentry.message.parameter.${Y}`]=Z})}const E=ii(t);Vt(u,"sentry.trace.parent_span_id",E?.spanContext().spanId);const v={...e,attributes:u};r.emit("beforeCaptureLog",v);const w=a?Cn(()=>a(v)):v;if(!w){r.recordDroppedEvent("before_send","log_item",1),C&&y.warn("beforeSendLog returned null, log will not be captured.");return}const{level:T,message:b,attributes:I={},severityNumber:M}=w,k=ye(),D=u_(k),x={timestamp:k,level:T,body:b,trace_id:c?.trace_id,severity_number:M??sw[T],attributes:{...oi(f),...oi(I,!0),[D.key]:D.value}};n(r,x),r.emit("afterCaptureLog",w)}function ca(e,t){const n=t??d_(e)??[];if(n.length===0)return;const r=e.getOptions(),i=dw(n,r._metadata,r.tunnel,e.getDsn(),r.sendDefaultPii);Yl().set(e,[]),e.emit("flushLogs"),e.sendEnvelope(i)}function d_(e){return Yl().get(e)}function Yl(){return vi("clientToLogBufferMap",()=>new WeakMap)}function hw(e,t){const n=t?"auto":"never";return[{type:"trace_metric",item_count:e.length,content_type:"application/vnd.sentry.items.trace-metric+json"},{version:2,...Kn()&&{ingest_settings:{infer_ip:n,infer_user_agent:n}},items:e}]}function mw(e,t,n,r,i){const s={};return t?.sdk&&(s.sdk={name:t.sdk.name,version:t.sdk.version}),n&&r&&(s.dsn=sn(r)),Ot(s,[hw(e,i)])}const gw=1e3;function ln(e,t,n,r=!0){n&&(r||!(t in e))&&(e[t]=n)}function _w(e,t){const n=Jl(),r=f_(e);r===void 0?n.set(e,[t]):r.length>=gw?(Kl(e,r),n.set(e,[t])):n.set(e,[...r,t])}function yw(e,t,n){const{release:r,environment:i}=t.getOptions(),s={...e.attributes};ln(s,"user.id",n.id,!1),ln(s,"user.email",n.email,!1),ln(s,"user.name",n.username,!1),ln(s,"sentry.release",r),ln(s,"sentry.environment",i);const{name:o,version:a}=t.getSdkMetadata()?.sdk??{};ln(s,"sentry.sdk.name",o),ln(s,"sentry.sdk.version",a);const c=t.getIntegrationByName("Replay"),u=c?.getReplayId(!0);return ln(s,"sentry.replay_id",u),u&&c?.getRecordingMode()==="buffer"&&ln(s,"sentry._internal.replay_is_buffering",!0),{...e,attributes:s}}function bw(e,t,n,r){const[,i]=l_(t,n),s=ii(n),o=s?s.spanContext().traceId:i?.trace_id,a=s?s.spanContext().spanId:void 0,c=ye(),u=u_(c);return{timestamp:c,trace_id:o??"",span_id:a,name:e.name,type:e.type,unit:e.unit,value:e.value,attributes:{...oi(r),...oi(e.attributes,"skip-undefined"),[u.key]:u.value}}}function Sw(e,t){const n=t?.scope??G(),r=t?.captureSerializedMetric??_w,i=n?.getClient()??O();if(!i){C&&y.warn("No client available to capture metric.");return}const{_experiments:s,enableMetrics:o,beforeSendMetric:a}=i.getOptions();if(!(o??s?.enableMetrics??!0)){C&&y.warn("metrics option not enabled, metric will not be captured.");return}const{user:u,attributes:d}=xs(Oe(),n),l=yw(e,i,u);i.emit("processMetric",l);const p=a||s?.beforeSendMetric,f=p?p(l):l;if(!f){C&&y.log("`beforeSendMetric` returned `null`, will not send metric.");return}const h=bw(f,i,n,d);C&&y.log("[Metric]",h),r(i,h),i.emit("afterCaptureMetric",f)}function Kl(e,t){const n=t??f_(e)??[];if(n.length===0)return;const r=e.getOptions(),i=mw(n,r._metadata,r.tunnel,e.getDsn(),r.sendDefaultPii);Jl().set(e,[]),e.emit("flushMetrics"),e.sendEnvelope(i)}function f_(e){return Jl().get(e)}function Jl(){return vi("clientToMetricBufferMap",()=>new WeakMap)}function vw(e){const t={trace_id:e.trace_id,span_id:e.span_id,parent_span_id:e.parent_span_id,name:e.description||"",start_timestamp:e.start_timestamp,end_timestamp:e.timestamp||e.start_timestamp,status:!e.status||e.status==="ok"||e.status==="cancelled"?"ok":"error",is_segment:!1,attributes:{...e.data},links:e.links};return Ng(t)}function Ew(e,t){if(e.type!=="transaction"||!e.spans?.length||!e.sdkProcessingMetadata?.hasGenAiSpans||!t.getOptions().streamGenAiSpans||Rt(t))return;const n=[],r=[];for(const s of e.spans)s.op?.startsWith("gen_ai.")?n.push(vw(s)):r.push(s);if(n.length===0)return;e.spans=r;const i=t.getOptions().sendDefaultPii?"auto":"never";return[{type:"span",item_count:n.length,content_type:"application/vnd.sentry.items.span.v2+json"},{version:2,...Kn()&&{ingest_settings:{infer_ip:i,infer_user_agent:i}},items:n}]}function Va(e){return typeof e=="object"&&typeof e.unref=="function"&&e.unref(),e}const Xl=Symbol.for("SentryBufferFullError");function Ql(e=100){const t=new Set;function n(){return t.sizer(a),()=>r(a)),a}function s(o){if(!t.size)return Os(!0);const a=Promise.allSettled(Array.from(t)).then(()=>!0);if(!o)return a;const c=[a,new Promise(u=>Va(setTimeout(()=>u(!1),o)))];return Promise.race(c)}return{get $(){return Array.from(t)},add:i,drain:s}}const Tw=60*1e3;function p_(e,t=ws()){const n=parseInt(`${e}`,10);if(!isNaN(n))return n*1e3;const r=Date.parse(`${e}`);return isNaN(r)?Tw:r-t}function ww(e,t){return e[t]||e.all||0}function h_(e,t,n=ws()){return ww(e,t)>n}function m_(e,{statusCode:t,headers:n},r=ws()){const i={...e},s=n?.["x-sentry-rate-limits"],o=n?.["retry-after"];if(s)for(const a of s.trim().split(",")){const[c,u,,,d]=a.split(":",5),l=parseInt(c,10),p=(isNaN(l)?60:l)*1e3;if(!u)i.all=r+p;else for(const f of u.split(";"))f==="metric_bucket"?(!d||d.split(";").includes("custom"))&&(i[f]=r+p):i[f]=r+p}else o?i.all=r+p_(o,r):t===429&&(i.all=r+60*1e3);return i}const g_=64;function __(e,t,n=Ql(e.bufferSize||g_)){let r={};const i=o=>n.drain(o);function s(o){const a=[];if(Er(o,(l,p)=>{const f=jf(p);h_(r,f)?e.recordDroppedEvent("ratelimit_backoff",f):a.push(l)}),a.length===0)return Promise.resolve({});const c=Ot(o[0],a),u=l=>{if(Lu(c,["client_report"])){C&&y.warn(`Dropping client report. Will not send outcomes (reason: ${l}).`);return}Er(c,(p,f)=>{e.recordDroppedEvent(l,jf(f))})},d=()=>t({body:sa(c)}).then(l=>l.statusCode===413?(C&&y.error("Sentry responded with status code 413. Envelope was discarded due to exceeding size limits."),u("send_error"),l):(C&&l.statusCode!==void 0&&(l.statusCode<200||l.statusCode>=300)&&y.warn(`Sentry responded with status code ${l.statusCode} to sent event.`),r=m_(r,l),l),l=>{throw u("network_error"),C&&y.error("Encountered error running transport request:",l),l});return n.add(d).then(l=>l,l=>{if(l===Xl)return C&&y.error("Skipped sending event because buffer is full."),u("queue_overflow"),Promise.resolve({});throw l})}return{send:s,flush:i}}function Iw(e,t,n){const r=[{type:"client_report"},{timestamp:Or(),discarded_events:e}];return Ot(t?{dsn:t}:{},[r])}function y_(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{}return t}function kw(e){const{trace_id:t,parent_span_id:n,span_id:r,status:i,origin:s,data:o,op:a}=e.contexts?.trace??{};return{data:o??{},description:e.transaction,op:a,parent_span_id:n,span_id:r??"",start_timestamp:e.start_timestamp??0,status:i,timestamp:e.timestamp,trace_id:t??"",origin:s,profile_id:o?.[Ll],exclusive_time:o?.[rr],measurements:e.measurements,is_segment:!0}}function Rw(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&&{[Ll]:e.profile_id},...e.exclusive_time&&{[rr]:e.exclusive_time}}}},measurements:e.measurements}}const np="Not capturing exception because it's already been captured.",rp="Discarded session because of missing or non-string release",b_=Symbol.for("SentryInternalError"),S_=Symbol.for("SentryDoNotSendEventError"),Aw=5e3;function Po(e){return{message:e,[b_]:!0}}function Wc(e){return{message:e,[S_]:!0}}function ip(e){return!!e&&typeof e=="object"&&b_ in e}function sp(e){return!!e&&typeof e=="object"&&S_ in e}function op(e,t,n,r,i){let s=0,o,a=!1;e.on(n,()=>{s=0,clearTimeout(o),a=!1}),e.on(t,c=>{s+=r(c),s>=8e5?i(e):a||(a=!0,o=Va(setTimeout(()=>{i(e)},Aw)))}),e.on("flush",()=>{i(e)})}class Cw{constructor(t){if(this._options=t,this._integrations={},this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],this._promiseBuffer=Ql(t.transportOptions?.bufferSize??g_),t.dsn?this._dsn=Eg(t.dsn):C&&y.warn("No DSN provided, client will not send events."),this._dsn){const r=a_(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=this._options.enableLogs??this._options._experiments?.enableLogs,this._options.enableLogs&&op(this,"afterCaptureLog","flushLogs",Nw,ca),(this._options.enableMetrics??this._options._experiments?.enableMetrics??!0)&&op(this,"afterCaptureMetric","flushMetrics",Mw,Kl)}captureException(t,n,r){const i=$e();if(xf(t))return C&&y.log(np),i;const s={event_id:i,...n};return this._process(()=>this.eventFromException(t,s).then(o=>this._captureEvent(o,s,r)).then(o=>o),"error"),s.event_id}captureMessage(t,n,r,i){const s={event_id:$e(),...r},o=Ba(t)?t:String(t),a=vn(t),c=a?this.eventFromMessage(o,n,s):this.eventFromException(t,s);return this._process(()=>c.then(u=>this._captureEvent(u,s,i)),a?"unknown":"error"),s.event_id}captureEvent(t,n,r){const i=$e();if(n?.originalException&&xf(n.originalException))return C&&y.log(np),i;const s={event_id:i,...n},o=t.sdkProcessingMetadata||{},a=o.capturedSpanScope,c=o.capturedSpanIsolationScope,u=ap(t.type);return this._process(()=>this._captureEvent(t,s,a||r,c),u),s.event_id}captureSession(t){this.sendSession(t),ri(t,{init:!1})}getDsn(){return this._dsn}getOptions(){return this._options}getSdkMetadata(){return this._options._metadata}getTransport(){return this._transport}async flush(t){const n=this._transport;if(this.emit("flush"),!n)return!0;const r=await this._isClientDoneProcessing(t),i=await n.flush(t);return r&&i}async close(t){ca(this);const n=await this.flush(t);return this.getOptions().enabled=!1,this.emit("close"),n}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){const n=this._integrations[t.name];!n&&t.beforeSetup&&t.beforeSetup(this),c_(this,t,this._integrations),n||tp(this,[t])}sendEvent(t,n={}){this.emit("beforeSendEvent",t,n);const r=Ew(t,this);let i=QT(t,this._dsn,this._options._metadata,this._options.tunnel);for(const s of n.attachments||[])i=Hf(i,YT(s));r&&(i=Hf(i,r)),this.sendEnvelope(i).then(s=>this.emit("afterSendEvent",t,s))}sendSession(t){const{release:n,environment:r=za}=this._options;if("aggregates"in t){const s=t.attrs||{};if(!s.release&&!n){C&&y.warn(rp);return}s.release=s.release||n,s.environment=s.environment||r,t.attrs=s}else{if(!t.release&&!n){C&&y.warn(rp);return}t.release=t.release||n,t.environment=t.environment||r}this.emit("beforeSendSession",t);const i=XT(t,this._dsn,this._options._metadata,this._options.tunnel);this.sendEnvelope(i)}recordDroppedEvent(t,n,r=1){if(this._options.sendClientReports){const i=`${t}:${n}`;C&&y.log(`Recording outcome: "${i}"${r>1?` (${r} times)`:""}`),this._outcomes[i]=(this._outcomes[i]||0)+r}}on(t,n){const r=this._hooks[t]=this._hooks[t]||new Set,i=(...s)=>n(...s);return r.add(i),()=>{r.delete(i)}}emit(t,...n){const r=this._hooks[t];r&&r.forEach(i=>i(...n))}async sendEnvelope(t){if(this.emit("beforeEnvelope",t),this._isEnabled()&&this._transport)try{return await this._transport.send(t)}catch(n){return C&&y.error("Error while sending envelope:",n),{}}return C&&y.error("Transport disabled"),{}}registerCleanup(t){}dispose(){}_setupIntegrations(){const{integrations:t}=this._options;this._integrations=rw(this,t),tp(this,t)}_updateSessionFromEvent(t,n){let r=n.level==="fatal",i=!1;const s=n.exception?.values;if(s){i=!0,r=!1;for(const c of s)if(c.mechanism?.handled===!1){r=!0;break}}const o=t.status==="ok";(o&&t.errors===0||o&&r)&&(ri(t,{...r&&{status:"crashed"},errors:t.errors||Number(i||r)}),this.captureSession(t))}async _isClientDoneProcessing(t){let n=0;for(;!t||nsetTimeout(r,1)),!this._numProcessing)return!0;n++}return!1}_isEnabled(){return this.getOptions().enabled!==!1&&this._transport!==void 0}_prepareEvent(t,n,r,i){const s=this.getOptions(),o=Object.keys(this._integrations);return!n.integrations&&o?.length&&(n.integrations=o),this.emit("preprocessEvent",t,n),t.type||i.setLastEventId(t.event_id||n.event_id),e_(s,t,n,r,this,i).then(a=>{if(a===null)return a;this.emit("postprocessEvent",a,n),a.contexts={trace:{...a.contexts?.trace,...fg(r)},...a.contexts};const c=Fl(this,r);return a.sdkProcessingMetadata={dynamicSamplingContext:c,...a.sdkProcessingMetadata},a})}_captureEvent(t,n={},r=G(),i=Oe()){return C&&Hu(t)&&y.log(`Captured error event \`${y_(t)[0]||""}\``),this._processEvent(t,n,r,i).then(s=>s.event_id,s=>{C&&(sp(s)?y.log(s.message):ip(s)?y.warn(s.message):y.warn(s))})}_processEvent(t,n,r,i){const s=this.getOptions(),{sampleRate:o}=s,a=v_(t),c=Hu(t),d=`before send for type \`${t.type||"error"}\``,l=typeof o>"u"?void 0:vr(o);if(c&&typeof l=="number"&&_n()>l)return this.recordDroppedEvent("sample_rate","error"),ql(Wc(`Discarding event because it's not included in the random sample (sampling rate = ${o})`));const p=ap(t.type);return this._prepareEvent(t,n,r,i).then(f=>{if(f===null)throw this.recordDroppedEvent("event_processor",p),Wc("An event processor returned `null`, will not send event.");if(n.data?.__sentry__===!0)return f;const m=Ow(this,s,f,n);return xw(m,d)}).then(f=>{if(f===null){if(this.recordDroppedEvent("before_send",p),a){const _=1+(t.spans||[]).length;this.recordDroppedEvent("before_send","span",_)}throw Wc(`${d} returned \`null\`, will not send event.`)}const h=r.getSession()||i.getSession();if(c&&h&&this._updateSessionFromEvent(h,f),a){const g=f.sdkProcessingMetadata?.spanCountBeforeProcessing||0,_=f.spans?f.spans.length:0,S=g-_;S>0&&this.recordDroppedEvent("before_send","span",S)}const m=f.transaction_info;if(a&&m&&f.transaction!==t.transaction){const g="custom";f.transaction_info={...m,source:g}}return this.sendEvent(f,n),f}).then(null,f=>{throw sp(f)||ip(f)?f:(this.captureException(f,{mechanism:{handled:!1,type:"internal"},data:{__sentry__:!0},originalException:f}),Po(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event. Reason: ${f}`))})}_process(t,n){this._numProcessing++,this._promiseBuffer.add(t).then(r=>(this._numProcessing--,r),r=>(this._numProcessing--,r===Xl&&this.recordDroppedEvent("queue_overflow",n),r))}_clearOutcomes(){const t=this._outcomes;return this._outcomes={},Object.entries(t).map(([n,r])=>{const[i,s]=n.split(":");return{reason:i,category:s,quantity:r}})}_flushOutcomes(){C&&y.log("Flushing outcomes...");const t=this._clearOutcomes();if(t.length===0){C&&y.log("No outcomes to send");return}if(!this._dsn){C&&y.log("No dsn provided, will not send outcomes");return}C&&y.log("Sending outcomes:",t);const n=Iw(t,this._options.tunnel&&sn(this._dsn));this.sendEnvelope(n)}}function ap(e){return e==="replay_event"?"replay":e||"error"}function xw(e,t){const n=`${t} must return \`null\` or a valid event.`;if(tr(e))return e.then(r=>{if(!ot(r)&&r!==null)throw Po(n);return r},r=>{throw Po(`${t} rejected with ${r}`)});if(!ot(e)&&e!==null)throw Po(n);return e}function Ow(e,t,n,r){const{beforeSend:i,beforeSendTransaction:s,ignoreSpans:o}=t,a=!qa(t.beforeSendSpan)&&t.beforeSendSpan;let c=n;if(Hu(c)&&i)return i(c,r);if(v_(c)){if(a||o){const u=kw(c);if(o?.length&&fs({description:u.description,op:u.op,attributes:u.data},o))return null;if(a){const d=a(u);d?c=Is(n,Rw(d)):ra()}if(c.spans){const d=[],l=c.spans;for(const f of l){if(o?.length&&fs({description:f.description,op:f.op,attributes:f.data},o)){OT(l,f);continue}if(a){const h=a(f);h?d.push(h):(ra(),d.push(f))}else d.push(f)}const p=c.spans.length-d.length;p&&e.recordDroppedEvent("before_send","span",p),c.spans=d}}if(s){if(c.spans){const u=c.spans.length;c.sdkProcessingMetadata={...n.sdkProcessingMetadata,spanCountBeforeProcessing:u}}return s(c,r)}}return c}function Hu(e){return e.type===void 0}function v_(e){return e.type==="transaction"}function Mw(e){let t=0;return e.name&&(t+=e.name.length*2),t+=8,t+E_(e.attributes)}function Nw(e){let t=0;return e.message&&(t+=e.message.length*2),t+E_(e.attributes)}function E_(e){if(!e)return 0;let t=0;return Object.values(e).forEach(n=>{Array.isArray(n)?t+=n.length*cp(n[0]):vn(n)?t+=cp(n):t+=100}),t}function cp(e){return typeof e=="string"?e.length*2:typeof e=="number"?8:typeof e=="boolean"?4:0}function Pw(e,t){t.debug===!0&&(C?y.enable():Cn(()=>{console.warn("[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.")})),G().update(t.initialScope);const r=new e(t);return T_(r),r.init(),r}function T_(e){G().setClient(e)}const zc=100,qc=5e3,Lw=36e5;function Dw(e){function t(...n){C&&y.log("[Offline]:",...n)}return n=>{const r=e(n);if(!n.createStore)throw new Error("No `createStore` function was provided");const i=n.createStore(n);let s=qc,o;function a(l,p,f){return Lu(l,["client_report"])?!1:n.shouldStore?n.shouldStore(l,p,f):!0}function c(l){o&&clearTimeout(o),o=Va(setTimeout(async()=>{o=void 0;const p=await i.shift();p&&(t("Attempting to send previously queued event"),p[0].sent_at=new Date().toISOString(),d(p,!0).catch(f=>{t("Failed to retry sending",f)}))},l))}function u(){o||(c(s),s=Math.min(s*2,Lw))}async function d(l,p=!1){if(!p&&Lu(l,["replay_event","replay_recording"]))return await i.push(l),c(zc),{};try{if(n.shouldSend&&await n.shouldSend(l)===!1)throw new Error("Envelope not sent because `shouldSend` callback returned false");const f=await r.send(l);let h=zc;if(f){if(f.headers?.["retry-after"])h=p_(f.headers["retry-after"]);else if(f.headers?.["x-sentry-rate-limits"])h=6e4;else if((f.statusCode||0)>=400)return f}return c(h),s=qc,f}catch(f){if(await a(l,f,s))return p?await i.unshift(l):await i.push(l),u(),t("Error sending. Event queued.",f),{};throw f}}return n.flushAtStartup&&u(),{send:d,flush:l=>(l===void 0&&(s=qc,c(zc)),r.flush(l))}}}const Lo="MULTIPLEXED_TRANSPORT_EXTRA_KEY";function w_(e,t){let n;return Er(e,(r,i)=>(t.includes(i)&&(n=Array.isArray(r)?r[1]:void 0),!!n)),n}function Fw(e,t){return n=>{const r=e(n);return{...r,send:async i=>{const s=w_(i,["event","transaction","profile","replay_event"]);return s&&(s.release=t),r.send(i)}}}}function $w(e,t){return Ot(t?{...e[0],dsn:t}:e[0],e[1])}function Uw(e,t){return n=>{const r=e(n),i=new Map,s=t||(u=>{const d=u.getEvent();return d?.extra?.[Lo]&&Array.isArray(d.extra[Lo])?d.extra[Lo]:[]});function o(u,d){const l=d?`${u}:${d}`:u;let p=i.get(l);if(!p){const f=bg(u);if(!f)return;const h=a_(f,n.tunnel);p=d?Fw(e,d)({...n,url:h}):e({...n,url:h}),i.set(l,p)}return[u,p]}async function a(u){function d(h){const m=h?.length?h:["event"];return w_(u,m)}const l=s({envelope:u,getEvent:d}).map(h=>typeof h=="string"?o(h,void 0):o(h.dsn,h.release)).filter(h=>!!h),p=l.length?l:[["",r]];return(await Promise.all(p.map(([h,m])=>m.send($w(u,h)))))[0]}async function c(u){const d=[...i.values(),r];return(await Promise.all(d.map(p=>p.flush(u)))).every(p=>p)}return{send:a,flush:c}}}function I_(e,t){const n=t?.getDsn(),r=t?.getOptions().tunnel;return Hw(e,n)||Bw(e,r)}function Bw(e,t){return t?up(e)===up(t):!1}function Hw(e,t){const n=zl(e);return!n||Wl(n)||!t?!1:jw(n.hostname,t.host)&&/(^|&|\?)sentry_key=/.test(n.search)}function jw(e,t){return e===t||t.length>0&&e.endsWith(`.${t}`)}function up(e){return e[e.length-1]==="/"?e.slice(0,-1):e}function k_(e,...t){const n=new String(String.raw(e,...t));return n.__sentry_template_string__=e.join("\0").replace(/%/g,"%%").replace(/\0/g,"%s"),n.__sentry_template_values__=t,n}const Ww=k_;function zw(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 R_(e,t,n=[t],r="npm"){const i=(e._metadata=e._metadata||{}).sdk=e._metadata.sdk||{};i.name||(i.name=`sentry.javascript.${t}`,i.packages=n.map(s=>({name:`${r}:@sentry/${s}`,version:gn})),i.version=gn)}function Zl(e={}){const t=e.client||O();if(!r_()||!t)return{};const n=An(),r=nr(n);if(r.getTraceData)return r.getTraceData(e);const i=e.scope||G(),s=e.span||Ae(),o=s?Cg(s):qw(i),a=s?gt(s):Fl(t,i),c=yg(a);if(!Tg.test(o))return y.warn("Invalid sentry-trace data. Cannot generate trace data"),{};const d={"sentry-trace":o,baggage:c};return e.propagateTraceparent&&(d.traceparent=s?RT(s):Gw(i)),d}function qw(e){const{traceId:t,sampled:n,propagationSpanId:r}=e.getPropagationContext();return Ig(t,r,n)}function Gw(e){const{traceId:t,sampled:n,propagationSpanId:r}=e.getPropagationContext();return kg(t,r,n)}function Vw(e,t,n){let r,i,s;const o=n?.maxWait?Math.max(n.maxWait,t):0,a=n?.setTimeoutImpl||setTimeout;function c(){return u(),r=e(),r}function u(){i!==void 0&&clearTimeout(i),s!==void 0&&clearTimeout(s),i=s=void 0}function d(){return i!==void 0||s!==void 0?c():r}function l(){return i&&clearTimeout(i),i=a(c,t),o&&s===void 0&&(s=a(c,o)),r}return l.cancel=u,l.flush=d,l}const Yw=100;function Ut(e,t){const n=O(),r=Oe();if(!n)return;const{beforeBreadcrumb:i=null,maxBreadcrumbs:s=Yw}=n.getOptions();if(s<=0)return;const a={timestamp:Or(),...e},c=i?Cn(()=>i(a,t)):a;c!==null&&(n.emit&&n.emit("beforeAddBreadcrumb",c,t),r.addBreadcrumb(c,s))}let lp;const Kw="FunctionToString",dp=new WeakMap,Jw=(()=>({name:Kw,setupOnce(){lp=Function.prototype.toString;try{Function.prototype.toString=function(...e){const t=Pl(this),n=dp.has(O())&&t!==void 0?t:this;return lp.apply(n,e)}}catch{}},setup(e){dp.set(e,!0)}})),A_=Jw,Xw=[/^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/,/Can't find variable: _AutofillCallbackHandler/,/Object Not Found Matching Id:\d+, MethodName:simulateEvent/,/^Java exception was raised during method invocation$/],Qw="EventFilters",C_=(e={})=>{let t;return{name:Qw,setup(n){const r=n.getOptions();t=fp(e,r)},processEvent(n,r,i){if(!t){const s=i.getOptions();t=fp(e,s)}return Zw(n,t)?null:n}}},x_=((e={})=>({...C_(e),name:"InboundFilters"}));function fp(e={},t={}){return{allowUrls:[...e.allowUrls||[],...t.allowUrls||[]],denyUrls:[...e.denyUrls||[],...t.denyUrls||[]],ignoreErrors:[...e.ignoreErrors||[],...t.ignoreErrors||[],...e.disableErrorDefaults?[]:Xw],ignoreTransactions:[...e.ignoreTransactions||[],...t.ignoreTransactions||[]]}}function Zw(e,t){if(e.type){if(e.type==="transaction"&&tI(e,t.ignoreTransactions))return C&&y.warn(`Event dropped due to being matched by \`ignoreTransactions\` option. Event: ${cr(e)}`),!0}else{if(eI(e,t.ignoreErrors))return C&&y.warn(`Event dropped due to being matched by \`ignoreErrors\` option. Event: ${cr(e)}`),!0;if(sI(e))return C&&y.warn(`Event dropped due to not having an error message, error type or stacktrace. Event: ${cr(e)}`),!0;if(nI(e,t.denyUrls))return C&&y.warn(`Event dropped due to being matched by \`denyUrls\` option. Event: ${cr(e)}. Url: ${ua(e)}`),!0;if(!rI(e,t.allowUrls))return C&&y.warn(`Event dropped due to not being matched by \`allowUrls\` option. Event: ${cr(e)}. Url: ${ua(e)}`),!0}return!1}function eI(e,t){return t?.length?y_(e).some(n=>Tt(n,t)):!1}function tI(e,t){if(!t?.length)return!1;const n=e.transaction;return n?Tt(n,t):!1}function nI(e,t){if(!t?.length)return!1;const n=ua(e);return n?Tt(n,t):!1}function rI(e,t){if(!t?.length)return!0;const n=ua(e);return n?Tt(n,t):!0}function iI(e=[]){for(let t=e.length-1;t>=0;t--){const n=e[t];if(n&&n.filename!==""&&n.filename!=="[native code]")return n.filename||null}return null}function ua(e){try{const n=[...e.exception?.values??[]].reverse().find(r=>r.mechanism?.parent_id===void 0&&r.stacktrace?.frames?.length)?.stacktrace?.frames;return n?iI(n):null}catch{return C&&y.error(`Cannot extract url for event ${cr(e)}`),null}}function sI(e){return e.exception?.values?.length?!e.message&&!e.exception.values.some(t=>t.stacktrace||t.type&&t.type!=="Error"||t.value):!1}function oI(e,t,n,r,i,s){if(!i.exception?.values||!s||!En(s.originalException,Error))return;const o=i.exception.values.length>0?i.exception.values[i.exception.values.length-1]:void 0;o&&(i.exception.values=ju(e,t,r,s.originalException,n,i.exception.values,o,0))}function ju(e,t,n,r,i,s,o,a){if(s.length>=n+1)return s;let c=[...s];if(En(r[i],Error)){pp(o,a,r);const u=e(t,r[i]),d=c.length;hp(u,i,d,a),c=ju(e,t,n,r[i],i,[u,...c],u,d)}return O_(r)&&r.errors.forEach((u,d)=>{if(En(u,Error)){pp(o,a,r);const l=e(t,u),p=c.length;hp(l,`errors[${d}]`,p,a),c=ju(e,t,n,u,i,[l,...c],l,p)}}),c}function O_(e){return Array.isArray(e.errors)}function pp(e,t,n){e.mechanism={handled:!0,type:"auto.core.linked_errors",...O_(n)&&{is_exception_group:!0},...e.mechanism,exception_id:t}}function hp(e,t,n,r){e.mechanism={handled:!0,...e.mechanism,type:"chained",source:t,exception_id:n,parent_id:r}}function aI(e){return Jt(e)&&"__sentry_fetch_url_host__"in e&&typeof e.__sentry_fetch_url_host__=="string"}function mp(e){return aI(e)?`${e.message} (${e.__sentry_fetch_url_host__})`:e.message}const M_=new Map,gp=new Set;function cI(e){if(H._sentryModuleMetadata)for(const t of Object.keys(H._sentryModuleMetadata)){const n=H._sentryModuleMetadata[t];if(gp.has(t))continue;gp.add(t);const r=e(t);for(const i of r.reverse())if(i.filename){M_.set(i.filename,n);break}}}function uI(e,t){return cI(e),M_.get(t)}function N_(e,t){t.exception?.values?.forEach(n=>{n.stacktrace?.frames?.forEach(r=>{if(!r.filename||r.module_metadata)return;const i=uI(e,r.filename);i&&(r.module_metadata=i)})})}function P_(e){e.exception?.values?.forEach(t=>{t.stacktrace?.frames?.forEach(n=>{delete n.module_metadata})})}const lI=()=>({name:"ModuleMetadata",setup(e){e.on("beforeEnvelope",t=>{Er(t,(n,r)=>{if(r==="event"){const i=Array.isArray(n)?n[1]:void 0;i&&(P_(i),n[1]=i)}})}),e.on("applyFrameMetadata",t=>{if(t.type)return;const n=e.getOptions().stackParser;N_(n,t)})}}),_p=new Set([]);function ed(e){const t="console",n=Zn(t,e);return er(t,dI),n}function dI(){"console"in H&&Al.forEach(function(e){e in H.console&&Ve(H.console,e,function(t){return Qo[e]=t,function(...n){const r=n[0],i=Qo[e],s=_p.size&&typeof r=="string"&&Tt(r,_p);s||Et("console",{args:n,level:e}),(!s||C&&y.isEnabled())&&i?.apply(H.console,n)}})})}function la(e){return e==="warn"?"warning":["fatal","error","warning","log","info","debug"].includes(e)?e:"log"}const fI="CaptureConsole",pI=((e={})=>{const t=e.levels||Al,n=e.handled??!0;return{name:fI,setup(r){"console"in H&&ed(({args:i,level:s})=>{O()!==r||!t.includes(s)||mI(i,s,n)})}}}),hI=pI;function mI(e,t,n){const r=la(t),i=new Error,s={level:la(t),extra:{arguments:e}};at(o=>{if(o.addEventProcessor(u=>(u.logger="console",Tn(u,{handled:n,type:"auto.core.capture_console"}),u)),t==="assert"){if(!e[0]){const u=`Assertion failed: ${Zo(e.slice(1)," ")||"console.assert"}`;o.setExtra("arguments",e.slice(1)),o.captureMessage(u,r,{captureContext:s,syntheticException:i})}return}const a=e.find(u=>u instanceof Error);if(a){be(a,s);return}const c=Zo(e," ");o.captureMessage(c,r,{captureContext:s,syntheticException:i})})}const gI="Dedupe",_I=(()=>{let e;return{name:gI,processEvent(t){if(t.type)return t;try{if(yI(t,e))return C&&y.warn("Event dropped due to being a duplicate of previously captured event."),null}catch{}return e=t}}}),L_=_I;function yI(e,t){return t?!!(bI(e,t)||SI(e,t)):!1}function bI(e,t){const n=e.message,r=t.message;return!(!n&&!r||n&&!r||!n&&r||n!==r||!F_(e,t)||!D_(e,t))}function SI(e,t){const n=yp(t),r=yp(e);return!(!n||!r||n.type!==r.type||n.value!==r.value||!F_(e,t)||!D_(e,t))}function D_(e,t){let n=xu(e),r=xu(t);if(!n&&!r)return!0;if(n&&!r||!n&&r||(n=n,r=r,r.length!==n.length))return!1;for(let i=0;i{const{depth:t=3,captureErrorCause:n=!0}=e;return{name:vI,processEvent(r,i,s){const{maxValueLength:o}=s.getOptions();return wI(r,i,t,n,o)}}}),TI=EI;function wI(e,t={},n,r,i){if(!t.originalException||!Jt(t.originalException))return e;const s=t.originalException.name||t.originalException.constructor.name,o=$_(t.originalException,r,i);if(o){const a={...e.contexts},c=Ge(o,n);return ot(c)&&(LT(c),a[s]=c),{...e,contexts:a}}return e}function $_(e,t,n){try{const r=["name","message","stack","line","column","fileName","lineNumber","columnNumber","toJSON"],i={};for(const s of Object.keys(e)){if(r.indexOf(s)!==-1)continue;const o=e[s];i[s]=Jt(o)||typeof o=="string"?n?as(`${o}`,n):`${o}`:o}if(t&&e.cause!==void 0)if(Jt(e.cause)){const s=e.cause.name||e.cause.constructor.name;i.cause={[s]:$_(e.cause,!1,n)}}else i.cause=e.cause;if(typeof e.toJSON=="function"){const s=e.toJSON();for(const o of Object.keys(s)){const a=s[o];i[o]=Jt(a)?a.toString():a}}return i}catch(r){C&&y.error("Unable to extract extra data from the Error object:",r)}return null}function II(e,t){let n=0;for(let r=e.length-1;r>=0;r--){const i=e[r];i==="."?e.splice(r,1):i===".."?(e.splice(r,1),n++):n&&(e.splice(r,1),n--)}if(t)for(;n--;n)e.unshift("..");return e}const kI=/^(\S+:\\|\/?)([\s\S]*?)((?:\.{1,2}|[^/\\]+?|)(\.[^./\\]*|))(?:[/\\]*)$/;function RI(e){const t=e.length>1024?`${e.slice(-1024)}`:e,n=kI.exec(t);return n?n.slice(1):[]}function bp(...e){let t="",n=!1;for(let r=e.length-1;r>=-1&&!n;r--){const i=r>=0?e[r]:"/";i&&(t=`${i}/${t}`,n=i.charAt(0)==="/")}return t=II(t.split("/").filter(r=>!!r),!n).join("/"),(n?"/":"")+t||"."}function Sp(e){let t=0;for(;t=0&&e[n]==="";n--);return t>n?[]:e.slice(t,n-t+1)}function AI(e,t){e=bp(e).slice(1),t=bp(t).slice(1);const n=Sp(e.split("/")),r=Sp(t.split("/")),i=Math.min(n.length,r.length);let s=i;for(let a=0;a{const t=e.root,n=e.prefix||"app:///",r="window"in H&&!!H.window,i=e.iteratee||MI({isBrowser:r,root:t,prefix:n});function s(a){try{return{...a,exception:{...a.exception,values:a.exception.values.map(c=>({...c,...c.stacktrace&&{stacktrace:o(c.stacktrace)}}))}}}catch{return a}}function o(a){return{...a,frames:a?.frames?.map(c=>i(c))}}return{name:xI,processEvent(a){let c=a;return a.exception&&Array.isArray(a.exception.values)&&(c=s(c)),c}}};function MI({isBrowser:e,root:t,prefix:n}){return r=>{if(!r.filename)return r;const i=/^[a-zA-Z]:\\/.test(r.filename)||r.filename.includes("\\")&&!r.filename.includes("/"),s=/^\//.test(r.filename);if(e){if(t){const o=r.filename;o.indexOf(t)===0&&(r.filename=o.replace(t,n))}}else if(i||s){const o=i?r.filename.replace(/^[a-zA-Z]:/,"").replace(/\\/g,"/"):r.filename,a=t?AI(t,o):CI(o);r.filename=`${n}${a}`}return r}}const NI=["reauthenticate","signInAnonymously","signInWithOAuth","signInWithIdToken","signInWithOtp","signInWithPassword","signInWithSSO","signOut","signUp","verifyOtp"],PI=["createUser","deleteUser","listUsers","getUserById","updateUserById","inviteUserByEmail"],LI={eq:"eq",neq:"neq",gt:"gt",gte:"gte",lt:"lt",lte:"lte",like:"like","like(all)":"likeAllOf","like(any)":"likeAnyOf",ilike:"ilike","ilike(all)":"ilikeAllOf","ilike(any)":"ilikeAnyOf",is:"is",in:"in",cs:"contains",cd:"containedBy",sr:"rangeGt",nxl:"rangeGte",sl:"rangeLt",nxr:"rangeLte",adj:"rangeAdjacent",ov:"overlaps",fts:"",plfts:"plain",phfts:"phrase",wfts:"websearch",not:"not"},U_=["select","insert","upsert","update","delete"];function Ya(e){try{e.__SENTRY_INSTRUMENTED__=!0}catch{}}function Ka(e){try{return e.__SENTRY_INSTRUMENTED__}catch{return!1}}function B_(e,t){if(Object.keys(t).length>0)return t;if(Array.isArray(e)&&e.length>0)return e}function DI(e,t){return B_(e,t)!==void 0}function FI(e,t={}){switch(e){case"GET":return"select";case"POST":return t.Prefer?.includes("resolution=")?"upsert":"insert";case"PATCH":return"update";case"DELETE":return"delete";default:return""}}function $I(e,t){if(t===""||t==="*")return"select(*)";if(e==="select")return`select(${t})`;if(e==="or"||e.endsWith(".or"))return`${e}${t}`;const[n,...r]=t.split(".");let i;return n?.startsWith("fts")?i="textSearch":n?.startsWith("plfts")?i="textSearch[plain]":n?.startsWith("phfts")?i="textSearch[phrase]":n?.startsWith("wfts")?i="textSearch[websearch]":i=n&&LI[n]||"filter",`${i}(${e}, ${r.join(".")})`}function vp(e,t=!1){return new Proxy(e,{apply(n,r,i){return on({name:`auth ${t?"(admin) ":""}${e.name}`,attributes:{[J]:"auto.db.supabase",[oe]:"db","db.system":"postgresql","db.operation":`auth.${t?"admin.":""}${e.name}`}},s=>Reflect.apply(n,r,i).then(o=>(o&&typeof o=="object"&&"error"in o&&o.error?(s.setStatus({code:ce}),be(o.error,{mechanism:{handled:!1,type:"auto.db.supabase.auth"}})):s.setStatus({code:As}),s.end(),o)).catch(o=>{throw s.setStatus({code:ce}),s.end(),be(o,{mechanism:{handled:!1,type:"auto.db.supabase.auth"}}),o}).then(...i))}})}function UI(e){const t=e.auth;if(!(!t||Ka(e.auth))){for(const n of NI){const r=t[n];r&&typeof e.auth[n]=="function"&&(e.auth[n]=vp(r))}for(const n of PI){const r=t.admin[n];r&&typeof e.auth.admin[n]=="function"&&(e.auth.admin[n]=vp(r,!0))}Ya(e.auth)}}function BI(e){Ka(e.prototype.from)||(e.prototype.from=new Proxy(e.prototype.from,{apply(t,n,r){const i=Reflect.apply(t,n,r),s=i.constructor;return jI(s),i}}),Ya(e.prototype.from))}function HI(e){Ka(e.prototype.then)||(e.prototype.then=new Proxy(e.prototype.then,{apply(t,n,r){const i=U_,s=n,o=FI(s.method,s.headers);if(!i.includes(o)||!s?.url?.pathname||typeof s.url.pathname!="string")return Reflect.apply(t,n,r);const a=s.url.pathname.split("/"),c=a.length>0?a[a.length-1]:"",u=[];for(const[S,E]of s.url.searchParams.entries())u.push($I(S,E));const d=Object.create(null);if(ot(s.body))for(const[S,E]of Object.entries(s.body))d[S]=E;const l=!!O()?.getOptions().sendDefaultPii,p=B_(s.body,d),f=o==="select"?"":`${o}${DI(s.body,d)?"(...) ":""}`,h=l?u.join(" "):u.length>0?"[redacted]":"",m=[f.trimEnd(),h].filter(Boolean).join(" "),g=m?`${m} from(${c})`:`from(${c})`,_={"db.table":c,"db.schema":s.schema,"db.url":s.url.origin,"db.sdk":s.headers["X-Client-Info"],"db.system":"postgresql","db.operation":o,[J]:"auto.db.supabase",[oe]:"db"};return u.length&&l&&(_["db.query"]=u),p!==void 0&&l&&(_["db.body"]=p),on({name:g,attributes:_},S=>Reflect.apply(t,n,[]).then(E=>{if(S&&(E&&typeof E=="object"&&"status"in E&&ls(S,E.status||500),S.end()),E?.error){const T=new Error(E.error.message);E.error.code&&(T.code=E.error.code),E.error.details&&(T.details=E.error.details);const b={};u.length&&l&&(b.query=u),p!==void 0&&l&&(b.body=p),be(T,I=>(I.addEventProcessor(M=>(Tn(M,{handled:!1,type:"auto.db.supabase.postgres"}),M)),I.setContext("supabase",b),I))}const v={type:"supabase",category:`db.${o}`,message:g},w={};return u.length&&l&&(w.query=u),p!==void 0&&l&&(w.body=p),Object.keys(w).length&&(v.data=w),Ut(v),E},E=>{throw S&&(ls(S,500),S.end()),E}).then(...r))}}),Ya(e.prototype.then))}function jI(e){for(const t of U_)Ka(e.prototype[t])||(e.prototype[t]=new Proxy(e.prototype[t],{apply(n,r,i){const s=Reflect.apply(n,r,i),o=s.constructor;return C&&y.log(`Instrumenting ${t} operation's PostgRESTFilterBuilder`),HI(o),s}}),Ya(e.prototype[t]))}const H_=e=>{if(!e){C&&y.warn("Supabase integration was not installed because no Supabase client was provided.");return}const t=e.constructor===Function?e:e.constructor;BI(t),UI(e)},WI="Supabase",zI=(e=>({setupOnce(){H_(e)},name:WI})),qI=e=>zI(e.supabaseClient),GI=10,VI="ZodErrors";function YI(e){return Jt(e)&&e.name==="ZodError"&&Array.isArray(e.issues)}function KI(e){return{...e,path:"path"in e&&Array.isArray(e.path)?e.path.join("."):void 0,keys:"keys"in e?JSON.stringify(e.keys):void 0,unionErrors:"unionErrors"in e?JSON.stringify(e.unionErrors):void 0}}function JI(e){return e.map(t=>typeof t=="number"?"":t).join(".")}function XI(e){const t=new Set;for(const r of e.issues){const i=JI(r.path);i.length>0&&t.add(i)}const n=Array.from(t);if(n.length===0){let r="variable";if(e.issues.length>0){const i=e.issues[0];i!==void 0&&"expected"in i&&typeof i.expected=="string"&&(r=i.expected)}return`Failed to validate ${r}`}return`Failed to validate keys: ${as(n.join(", "),100)}`}function QI(e,t=!1,n,r){if(!n.exception?.values||!r.originalException||!YI(r.originalException)||r.originalException.issues.length===0)return n;try{const s=(t?r.originalException.issues:r.originalException.issues.slice(0,e)).map(KI);return t&&(Array.isArray(r.attachments)||(r.attachments=[]),r.attachments.push({filename:"zod_issues.json",data:JSON.stringify({issues:s})})),{...n,exception:{...n.exception,values:[{...n.exception.values[0],value:XI(r.originalException)},...n.exception.values.slice(1)]},extra:{...n.extra,"zoderror.issues":s.slice(0,e)}}}catch(i){return{...n,extra:{...n.extra,"zoderrors sentry integration parse error":{message:"an exception was thrown while processing ZodError within applyZodErrorsToEvent()",error:i instanceof Error?`${i.name}: ${i.message} ${i.stack}`:"unknown"}}}}}const ZI=((e={})=>{const t=e.limit??GI;return{name:VI,processEvent(n,r){return QI(t,e.saveZodIssuesAsAttachment,n,r)}}}),ek=ZI,tk=e=>({name:"ThirdPartyErrorsFilter",setup(t){t.on("beforeEnvelope",n=>{Er(n,(r,i)=>{if(i==="event"){const s=Array.isArray(r)?r[1]:void 0;s&&(P_(s),r[1]=s)}})}),t.on("applyFrameMetadata",n=>{if(n.type)return;const r=t.getOptions().stackParser;N_(r,n)})},processEvent(t){const n=rk(t,e.ignoreSentryInternalFrames);if(n){const r=e.behaviour==="drop-error-if-contains-third-party-frames"||e.behaviour==="apply-tag-if-contains-third-party-frames"?"some":"every";if(n[r](s=>!s.some(o=>e.filterKeys.includes(o)))){if(e.behaviour==="drop-error-if-contains-third-party-frames"||e.behaviour==="drop-error-if-exclusively-contains-third-party-frames")return null;t.tags={...t.tags,third_party_code:!0}}}return t}});function nk(e,t){if(t!==0||!e.context_line||!e.filename||!e.filename.includes("sentry")||!e.filename.includes("helpers")||!e.context_line.includes(sk))return!1;if(e.pre_context){const n=e.pre_context.length;for(let r=0;r!r.filename||r.lineno==null&&r.colno==null&&r.instruction_addr==null?!1:!t||!nk(r,i)).map(r=>r.module_metadata?Object.keys(r.module_metadata).filter(i=>i.startsWith(Ep)).map(i=>i.slice(Ep.length)):[])}const Ep="_sentryBundlerPluginAppKey:",ik="Attempt to invoke user-land function",sk="fn.apply(this, wrappedArguments)",ok=100,ak=10,so="flag.evaluation.";function Ii(e){if(e.type)return e;const n=G().getScopeData().contexts.flags,r=n?n.values:[];return r.length&&(e.contexts===void 0&&(e.contexts={}),e.contexts.flags={values:[...r]}),e}function wr(e,t,n=ok){const r=G().getScopeData().contexts;r.flags||(r.flags={values:[]});const i=r.flags.values;ck(i,e,t,n)}function ck(e,t,n,r){if(typeof n!="boolean")return;if(e.length>r){C&&y.error(`[Feature Flags] insertToFlagBuffer called on a buffer larger than maxSize=${r}`);return}const i=e.findIndex(s=>s.flag===t);i!==-1&&e.splice(i,1),e.length===r&&e.shift(),e.push({flag:t,result:n})}function Ir(e,t,n=ak){if(typeof t!="boolean")return;const r=Ae();if(!r)return;const i=B(r).data;if(`${so}${e}`in i){r.setAttribute(`${so}${e}`,t);return}Object.keys(i).filter(o=>o.startsWith(so)).length({name:"FeatureFlags",processEvent(e,t,n){return Ii(e)},addFeatureFlag(e,t){wr(e,t),Ir(e,t)}}),lk=({growthbookClass:e})=>({name:"GrowthBook",setupOnce(){const t=e.prototype;typeof t.isOn=="function"&&Ve(t,"isOn",Tp),typeof t.getFeatureValue=="function"&&Ve(t,"getFeatureValue",Tp)},processEvent(t,n,r){return Ii(t)}});function Tp(e){return function(...t){const n=t[0],r=e.apply(this,t);return typeof n=="string"&&typeof r=="boolean"&&(wr(n,r),Ir(n,r)),r}}const dk="ConversationId",fk=(()=>({name:dk,setup(e){e.on("spanStart",t=>{const n=G().getScopeData(),r=Oe().getScopeData(),i=n.conversationId||r.conversationId;if(i){const{op:s,data:o,description:a}=B(t);if(!s?.startsWith("gen_ai.")&&!o["ai.operationId"]&&!a?.startsWith("ai."))return;t.setAttribute(dT,i)}})}})),pk=fk;function hk(e,t,n,r,i){if(!e.fetchData)return;const{method:s,url:o}=e.fetchData,a=wt()&&t(o);if(e.endTimestamp){const h=e.fetchData.__span;if(!h)return;const m=r[h];m&&(a&&(_k(m,e),mk(m,e,i)),delete r[h]);return}const{spanOrigin:c="auto.http.browser",propagateTraceparent:u=!1}=typeof i=="object"?i:{spanOrigin:i},d=O(),p=!!Ae()||!!d&&Rt(d),f=a&&p?mt(Sk(o,s,c)):new ht;if(a&&!p&&d?.recordDroppedEvent("no_parent_span","span"),e.fetchData.__span=f.spanContext().spanId,r[f.spanContext().spanId]=f,n(e.fetchData.url)){const h=e.args[0],m={...e.args[1]||{}},g=gk(h,m,wt()&&p?f:void 0,u);g&&(e.args[1]=m,m.headers=g)}if(d){const h={input:e.args,response:e.response,startTimestamp:e.startTimestamp,endTimestamp:e.endTimestamp};d.emit("beforeOutgoingRequestSpan",f,h)}return f}function mk(e,t,n){(typeof n=="object"&&n!==null?n.onRequestSpanEnd:void 0)?.(e,{headers:t.response?.headers,error:t.error})}function gk(e,t,n,r){const i=Zl({span:n,propagateTraceparent:r}),s=i["sentry-trace"],o=i.baggage,a=i.traceparent;if(!s)return;const c=t.headers||(Ol(e)?e.headers:void 0);if(c)if(yk(c)){const u=new Headers(c);if(u.get("sentry-trace")||u.set("sentry-trace",s),r&&a&&!u.get("traceparent")&&u.set("traceparent",a),o){const d=u.get("baggage");d?oo(d)||u.set("baggage",`${d},${o}`):u.set("baggage",o)}return u}else if(bk(c)){const u=[...c];u.find(l=>l[0]==="sentry-trace")||u.push(["sentry-trace",s]),r&&a&&!u.find(l=>l[0]==="traceparent")&&u.push(["traceparent",a]);const d=c.find(l=>l[0]==="baggage"&&typeof l[1]=="string"&&oo(l[1]));return o&&!d&&u.push(["baggage",o]),u}else{const u="sentry-trace"in c?c["sentry-trace"]:void 0,d="traceparent"in c?c.traceparent:void 0,l="baggage"in c?c.baggage:void 0,p=l?Array.isArray(l)?[...l]:[l]:[],f=l&&(Array.isArray(l)?l.find(m=>oo(m)):oo(l));o&&!f&&p.push(o);const h=Object.assign({},c,{"sentry-trace":u??s,baggage:p.length>0?p.join(","):void 0});return r&&a&&!d&&(h.traceparent=a),h}else return{...i}}function _k(e,t){if(t.response){ls(e,t.response.status);const n=t.response?.headers?.get("content-length");if(n){const r=parseInt(n);r>0&&e.setAttribute("http.response_content_length",r)}}else t.error&&e.setStatus({code:ce,message:"internal_error"});e.end()}function oo(e){return typeof e!="string"?!1:e.split(",").some(t=>t.trim().startsWith(ea))}function yk(e){return typeof Headers<"u"&&En(e,Headers)}function bk(e){return Array.isArray(e)?e.every(t=>Array.isArray(t)&&t.length===2&&typeof t[0]=="string"):!1}function Sk(e,t,n){if(e.startsWith("data:")){const s=Hn(e);return{name:`${t} ${s}`,attributes:wp(e,void 0,t,n)}}const r=zl(e),i=r?v0(r):e;return{name:`${t} ${i}`,attributes:wp(e,r,t,n)}}function wp(e,t,n,r){const i={url:Hn(e),type:"fetch","http.method":n,[J]:r,[oe]:"http.client"};return t&&(Wl(t)||(i["http.url"]=Hn(t.href),i["server.address"]=t.host),t.search&&(i["http.query"]=t.search),t.hash&&(i["http.fragment"]=t.hash)),i}function j_(e,t={},n=G()){const{message:r,name:i,email:s,url:o,source:a,associatedEventId:c,tags:u}=e,d={contexts:{feedback:{contact_email:s,name:i,message:r,url:o,source:a,associated_event_id:c}},type:"feedback",level:"info",tags:u},l=n?.getClient()||O();return l&&l.emit("beforeSendFeedback",d,t),n.captureEvent(d,t)}function ki(e,t,n,r,i){aa({level:e,message:t,attributes:n,severityNumber:i},r)}function vk(e,t,{scope:n}={}){ki("trace",e,t,n)}function Ek(e,t,{scope:n}={}){ki("debug",e,t,n)}function Tk(e,t,{scope:n}={}){ki("info",e,t,n)}function wk(e,t,{scope:n}={}){ki("warn",e,t,n)}function Ik(e,t,{scope:n}={}){ki("error",e,t,n)}function kk(e,t,{scope:n}={}){ki("fatal",e,t,n)}const Rk=Object.freeze(Object.defineProperty({__proto__:null,debug:Ek,error:Ik,fatal:kk,fmt:Ww,info:Tk,trace:vk,warn:wk},Symbol.toStringTag,{value:"Module"}));function da(e,t,n){return"util"in H&&typeof H.util.format=="function"?H.util.format(...e):Ak(e,t,n)}function Ak(e,t,n){return e.map(r=>vn(r)?String(r):JSON.stringify(Ge(r,t,n))).join(" ")}function W_(e){return/%[sdifocO]/.test(e)}function z_(e,t){const n={},r=new Array(t.length).fill("{}").join(" ");return n["sentry.message.template"]=`${e} ${r}`,t.forEach((i,s)=>{n[`sentry.message.parameter.${s}`]=i}),n}const Ck="ConsoleLogs",Ip={[J]:"auto.log.console"},xk=((e={})=>{const t=e.levels||Al;return{name:Ck,setup(n){const{enableLogs:r,normalizeDepth:i=3,normalizeMaxBreadth:s=1e3}=n.getOptions();if(!r){C&&y.warn("`enableLogs` is not enabled, ConsoleLogs integration disabled");return}const o=ed(({args:a,level:c})=>{if(O()!==n||!t.includes(c))return;const u=a[0],d=a.slice(1);if(c==="assert"){if(!u){const h=d.length>0?`Assertion failed: ${da(d,i,s)}`:"Assertion failed";aa({level:"error",message:h,attributes:Ip})}return}const l=c==="log",p=a.length>1&&typeof a[0]=="string"&&!W_(a[0]),f={...Ip,...p?z_(u,d):{}};aa({level:l?"info":c,message:da(a,i,s),severityNumber:l?10:void 0,attributes:f})});n.registerCleanup(o)}}}),Ok=xk;function td(e,t,n,r){Sw({type:e,name:t,value:n,unit:r?.unit,attributes:r?.attributes},{scope:r?.scope})}function Mk(e,t=1,n){td("counter",e,t,n)}function Nk(e,t,n){td("gauge",e,t,n)}function Wu(e,t,n){td("distribution",e,t,n)}const Pk=Object.freeze(Object.defineProperty({__proto__:null,count:Mk,distribution:Wu,gauge:Nk},Symbol.toStringTag,{value:"Module"})),Lk=["trace","debug","info","warn","error","fatal"];function Dk(e={}){const t=new Set(e.levels??Lk),n=e.client;return{log(r){const{type:i,level:s,message:o,args:a,tag:c,date:u,...d}=r,l=n||O();if(!l)return;const p=Uk(i,s);if(!t.has(p))return;const{normalizeDepth:f=3,normalizeMaxBreadth:h=1e3}=l.getOptions(),m={};for(const[_,S]of Object.entries(d))m[_]=Ge(S,f,h);m["sentry.origin"]="auto.log.consola",c&&(m["consola.tag"]=c),i&&(m["consola.type"]=i),s!=null&&typeof s=="number"&&(m["consola.level"]=s);const g=Hk(Bk(a,f,h),f,h);g?.attributes&&Object.assign(m,g.attributes),aa({level:p,message:g?.message||o||a&&da(a,f,h)||"",attributes:m})}}}const Fk={silent:"trace",fatal:"fatal",error:"error",warn:"warn",log:"info",info:"info",success:"info",fail:"error",ready:"info",start:"info",box:"info",debug:"debug",trace:"trace",verbose:"debug",critical:"fatal",notice:"info"},$k={0:"fatal",1:"warn",2:"info",3:"info",4:"debug",5:"trace"};function Uk(e,t){if(e==="verbose")return"debug";if(e==="silent")return"trace";if(e){const n=Fk[e];if(n)return n}if(typeof t=="number"){const n=$k[t];if(n)return n}return"info"}function Bk(e,t,n){if(!e?.length)return{message:""};const r=da(e,t,n),i=e[0];if(ot(i)){const s=typeof e[1]=="string"?2:1,o=e.slice(s);return{message:r,attributes:i,messageParameters:o}}else{const s=e.slice(1),o=s.length>0&&typeof i=="string"&&!W_(i);return{message:r,messageTemplate:o?i:void 0,messageParameters:o?s:void 0}}}function Hk(e,t,n){const{message:r,attributes:i,messageTemplate:s,messageParameters:o}=e,a={};if(s&&o){const c=z_(s,o);for(const[u,d]of Object.entries(c))a[u]=u.startsWith("sentry.message.parameter.")?Ge(d,t,n):d}else o&&o.length>0&&o.forEach((c,u)=>{a[`sentry.message.parameter.${u}`]=Ge(c,t,n)});return{message:r,attributes:{...Ge(i,t,n),...a}}}const jk="gen_ai.prompt",Ms="gen_ai.system",Ye="gen_ai.request.model",nd="gen_ai.request.stream",Ja="gen_ai.request.temperature",rd="gen_ai.request.max_tokens",Xa="gen_ai.request.frequency_penalty",id="gen_ai.request.presence_penalty",Qa="gen_ai.request.top_p",q_="gen_ai.request.top_k",G_="gen_ai.request.encoding_format",V_="gen_ai.request.dimensions",Qr="gen_ai.response.finish_reasons",Ri="gen_ai.response.model",Za="gen_ai.response.id",Wk="gen_ai.response.stop_reason",kr="gen_ai.usage.input_tokens",Rr="gen_ai.usage.output_tokens",Jn="gen_ai.usage.total_tokens",Dt="gen_ai.operation.name",Ar="sentry.sdk_meta.gen_ai.input.messages.original_length",Ai="gen_ai.input.messages",Ns="gen_ai.system_instructions",Xt="gen_ai.response.text",Ps="gen_ai.request.available_tools",zk="gen_ai.response.streaming",jn="gen_ai.response.tool_calls",ec="gen_ai.agent.name",qk="gen_ai.pipeline.name",sd="gen_ai.conversation.id",Gk="gen_ai.usage.cache_creation_input_tokens",Vk="gen_ai.usage.cache_read_input_tokens",Yk="gen_ai.invoke_agent",od="gen_ai.embeddings.input",Y_="gen_ai.embeddings",kp="gen_ai.execute_tool",K_="gen_ai.tool.name",Kk="gen_ai.tool.call.id",Jk="gen_ai.tool.type",J_="gen_ai.tool.input",X_="gen_ai.tool.output",Xk="gen_ai.tool.description";function Zr(e){return!e||typeof e!="object"?!1:Zk(e)||Z_(e)||Qk(e)||ey(e)||ty(e)||eR(e)||tR(e)||nR(e)||rR(e)||iR(e)||sR(e)||oR(e)}function Qk(e){return"image_url"in e?typeof e.image_url=="string"?e.image_url.startsWith("data:"):Q_(e):!1}function Q_(e){return"image_url"in e&&!!e.image_url&&typeof e.image_url=="object"&&"url"in e.image_url&&typeof e.image_url.url=="string"&&e.image_url.url.startsWith("data:")}function Zk(e){return"type"in e&&typeof e.type=="string"&&"source"in e&&Zr(e.source)}function Z_(e){return"inlineData"in e&&!!e.inlineData&&typeof e.inlineData=="object"&&"data"in e.inlineData&&typeof e.inlineData.data=="string"}function ey(e){return"type"in e&&e.type==="input_audio"&&"input_audio"in e&&!!e.input_audio&&typeof e.input_audio=="object"&&"data"in e.input_audio&&typeof e.input_audio.data=="string"}function ty(e){return"type"in e&&e.type==="file"&&"file"in e&&!!e.file&&typeof e.file=="object"&&"file_data"in e.file&&typeof e.file.file_data=="string"}function eR(e){return"media_type"in e&&typeof e.media_type=="string"&&"data"in e}function tR(e){return"type"in e&&e.type==="file"&&"mediaType"in e&&typeof e.mediaType=="string"&&"data"in e&&typeof e.data=="string"&&!e.data.startsWith("http://")&&!e.data.startsWith("https://")}function nR(e){return"type"in e&&e.type==="image"&&"image"in e&&typeof e.image=="string"&&!e.image.startsWith("http://")&&!e.image.startsWith("https://")}function rR(e){return"type"in e&&(e.type==="blob"||e.type==="base64")}function iR(e){return"b64_json"in e}function sR(e){return"type"in e&&"result"in e&&e.type==="image_generation"}function oR(e){return"uri"in e&&typeof e.uri=="string"&&e.uri.startsWith("data:")}const zi="[Blob substitute]",aR=["image_url","data","content","b64_json","result","uri","image"];function es(e){const t={...e};Zr(t.source)&&(t.source=es(t.source)),Z_(e)&&(t.inlineData={...e.inlineData,data:zi}),Q_(e)&&(t.image_url={...e.image_url,url:zi}),ey(e)&&(t.input_audio={...e.input_audio,data:zi}),ty(e)&&(t.file={...e.file,file_data:zi});for(const n of aR)typeof t[n]=="string"&&(t[n]=zi);return t}const ny=2e4,fa=e=>new TextEncoder().encode(e).length,ad=e=>fa(JSON.stringify(e));function tc(e,t){if(fa(e)<=t)return e;let n=0,r=e.length,i="";for(;n<=r;){const s=Math.floor((n+r)/2),o=e.slice(0,s);fa(o)<=t?(i=o,n=s+1):r=s-1}return i}function cR(e){return typeof e=="string"?e:"text"in e&&typeof e.text=="string"?e.text:""}function Rp(e,t){return typeof e=="string"?t:{...e,text:t}}function uR(e){return e!==null&&typeof e=="object"&&"content"in e&&typeof e.content=="string"}function ry(e){return e!==null&&typeof e=="object"&&"content"in e&&Array.isArray(e.content)}function iy(e){return e!==null&&typeof e=="object"&&"parts"in e&&Array.isArray(e.parts)&&e.parts.length>0}function lR(e,t){const n={...e,content:""},r=ad(n),i=t-r;if(i<=0)return[];const s=tc(e.content,i);return[{...e,content:s}]}function dR(e){return"parts"in e&&Array.isArray(e.parts)?{key:"parts",items:e.parts}:"content"in e&&Array.isArray(e.content)?{key:"content",items:e.content}:{key:null,items:[]}}function fR(e,t){const{key:n,items:r}=dR(e);if(n===null||r.length===0)return[];const i=r.map(c=>Rp(c,"")),s=ad({...e,[n]:i});let o=t-s;if(o<=0)return[];const a=[];for(const c of r){const u=cR(c),d=fa(u);if(d<=o)a.push(c),o-=d;else if(a.length===0){const l=tc(u,o);l&&a.push(Rp(c,l));break}else break}return a.length<=0?[]:[{...e,[n]:a}]}function pR(e,t){if(!e)return[];if(typeof e=="string"){const n=tc(e,t);return n?[n]:[]}return typeof e!="object"?[]:uR(e)?lR(e,t):ry(e)||iy(e)?fR(e,t):[]}function zu(e){return e.map(n=>{let r;return n&&typeof n=="object"&&(ry(n)?r={...n,content:zu(n.content)}:"content"in n&&Zr(n.content)&&(r={...n,content:es(n.content)}),iy(n)&&(r={...r??n,parts:zu(n.parts)}),Zr(r)?r=es(r):Zr(n)&&(r=es(n))),r??n})}function hR(e,t){if(!Array.isArray(e)||e.length===0)return e;const n=t-2,r=e[e.length-1],i=zu([r]),s=i[0];return ad(s)<=n?i:pR(s,n)}function mR(e){return hR(e,ny)}function gR(e){return tc(e,ny)}function Mr(e){const t=!!O()?.getOptions().sendDefaultPii;return{...e,recordInputs:e?.recordInputs??t,recordOutputs:e?.recordOutputs??t}}function wn(e){const t=O();return e??!(t&&Rt(t))}function cd(e,t){return e?`${e}.${t}`:t}function _R(e,t,n,r,i){if(t!==void 0&&e.setAttributes({[kr]:t}),n!==void 0&&e.setAttributes({[Rr]:n}),t!==void 0||n!==void 0||r!==void 0||i!==void 0){const s=(t??0)+(n??0)+(r??0)+(i??0);e.setAttributes({[Jn]:s})}}function nc(e,t,n){if(!e.isRecording())return;const r={[zk]:!0};t.responseId&&(r[Za]=t.responseId),t.responseModel&&(r[Ri]=t.responseModel),t.promptTokens!==void 0&&(r[kr]=t.promptTokens),t.completionTokens!==void 0&&(r[Rr]=t.completionTokens),t.totalTokens!==void 0?r[Jn]=t.totalTokens:(t.promptTokens!==void 0||t.completionTokens!==void 0||t.cacheCreationInputTokens!==void 0||t.cacheReadInputTokens!==void 0)&&(r[Jn]=(t.promptTokens??0)+(t.completionTokens??0)+(t.cacheCreationInputTokens??0)+(t.cacheReadInputTokens??0)),t.finishReasons.length&&(r[Qr]=JSON.stringify(t.finishReasons)),n&&t.responseTexts.length&&(r[Xt]=t.responseTexts.join("")),n&&t.toolCalls.length&&(r[jn]=JSON.stringify(t.toolCalls)),e.setAttributes(r),e.end()}function Ci(e){return typeof e=="string"?e:JSON.stringify(e)}function xi(e){if(typeof e=="string")return gR(e);if(Array.isArray(e)){const t=mR(e);return JSON.stringify(t)}return JSON.stringify(e)}function Ls(e){if(!Array.isArray(e))return{systemInstructions:void 0,filteredMessages:e};const t=e.findIndex(o=>o&&typeof o=="object"&&"role"in o&&o.role==="system");if(t===-1)return{systemInstructions:void 0,filteredMessages:e};const n=e[t],r=typeof n.content=="string"?n.content:n.content!==void 0?JSON.stringify(n.content):void 0;if(!r)return{systemInstructions:void 0,filteredMessages:e};const i=JSON.stringify([{type:"text",content:r}]),s=[...e.slice(0,t),...e.slice(t+1)];return{systemInstructions:i,filteredMessages:s}}async function yR(e,t,n){const r=e.catch(o=>{throw be(o,{mechanism:{handled:!1,type:n}}),o}),i=await t,s=await r;return s&&typeof s=="object"&&"data"in s?{...s,data:i}:i}function pa(e,t,n){return tr(e)?new Proxy(e,{get(r,i){const o=i in Promise.prototype||i===Symbol.toStringTag?t:r,a=Reflect.get(o,i);return i==="withResponse"&&typeof a=="function"?function(){const u=a.call(r);return yR(u,t,n)}:typeof a=="function"?a.bind(o):a}}):t}const bR={"responses.create":{operation:"chat"},"chat.completions.create":{operation:"chat"},"embeddings.create":{operation:"embeddings"},"conversations.create":{operation:"chat"}},SR=["response.output_item.added","response.function_call_arguments.delta","response.function_call_arguments.done","response.output_item.done"],vR=["response.created","response.in_progress","response.failed","response.completed","response.incomplete","response.queued","response.output_text.delta",...SR];function ER(e){return e!==null&&typeof e=="object"&&"type"in e&&typeof e.type=="string"&&e.type.startsWith("response.")}function TR(e){return e!==null&&typeof e=="object"&&"object"in e&&e.object==="chat.completion.chunk"}function wR(e,t,n){if(!t||typeof t!="object")return;const r=t,i={};if(typeof r.id=="string"&&(i[Za]=r.id),typeof r.model=="string"&&(i[Ri]=r.model),r.object==="conversation"&&typeof r.id=="string"&&(i[sd]=r.id),r.usage&&typeof r.usage=="object"){const s=r.usage,o=s.prompt_tokens??s.input_tokens;typeof o=="number"&&(i[kr]=o);const a=s.completion_tokens??s.output_tokens;typeof a=="number"&&(i[Rr]=a),typeof s.total_tokens=="number"&&(i[Jn]=s.total_tokens)}if(Array.isArray(r.choices)){const s=r.choices,o=s.map(a=>a.finish_reason).filter(a=>typeof a=="string");if(o.length>0&&(i[Qr]=JSON.stringify(o)),n){const a=s.map(u=>u.message?.content||"");i[Xt]=JSON.stringify(a);const c=s.map(u=>u.message?.tool_calls).filter(u=>Array.isArray(u)&&u.length>0).flat();c.length>0&&(i[jn]=JSON.stringify(c))}}if(typeof r.status=="string"&&(i[Qr]||(i[Qr]=JSON.stringify([r.status]))),n&&(typeof r.output_text=="string"&&!i[Xt]&&(i[Xt]=r.output_text),Array.isArray(r.output)&&r.output.length>0&&!i[jn])){const s=r.output.filter(o=>o?.type==="function_call");s.length>0&&(i[jn]=JSON.stringify(s))}e.setAttributes(i)}function IR(e){if("conversation"in e&&typeof e.conversation=="string")return e.conversation;if("previous_response_id"in e&&typeof e.previous_response_id=="string")return e.previous_response_id}function kR(e){const t={[Ye]:e.model??"unknown"};"temperature"in e&&(t[Ja]=e.temperature),"top_p"in e&&(t[Qa]=e.top_p),"frequency_penalty"in e&&(t[Xa]=e.frequency_penalty),"presence_penalty"in e&&(t[id]=e.presence_penalty),"stream"in e&&(t[nd]=e.stream),"encoding_format"in e&&(t[G_]=e.encoding_format),"dimensions"in e&&(t[V_]=e.dimensions);const n=IR(e);return n&&(t[sd]=n),t}function RR(e,t){for(const n of e){const r=n.index;if(!(r===void 0||!n.function))if(!(r in t.chatCompletionToolCalls))t.chatCompletionToolCalls[r]={...n,function:{name:n.function.name,arguments:n.function.arguments||""}};else{const i=t.chatCompletionToolCalls[r];n.function.arguments&&i?.function&&(i.function.arguments+=n.function.arguments)}}}function AR(e,t,n){t.responseId=e.id??t.responseId,t.responseModel=e.model??t.responseModel,e.usage&&(t.promptTokens=e.usage.prompt_tokens,t.completionTokens=e.usage.completion_tokens,t.totalTokens=e.usage.total_tokens);for(const r of e.choices??[])n&&(r.delta?.content&&t.responseTexts.push(r.delta.content),r.delta?.tool_calls&&RR(r.delta.tool_calls,t)),r.finish_reason&&t.finishReasons.push(r.finish_reason)}function CR(e,t,n,r){if(!(e&&typeof e=="object")){t.eventTypes.push("unknown:non-object");return}if(e instanceof Error){r.setStatus({code:ce,message:"internal_error"}),be(e,{mechanism:{handled:!1,type:"auto.ai.openai.stream-response"}});return}if(!("type"in e))return;const i=e;if(!vR.includes(i.type)){t.eventTypes.push(i.type);return}if(n&&(i.type==="response.output_item.done"&&"item"in i&&t.responsesApiToolCalls.push(i.item),i.type==="response.output_text.delta"&&"delta"in i&&i.delta)){t.responseTexts.push(i.delta);return}if("response"in i){const{response:s}=i;t.responseId=s.id??t.responseId,t.responseModel=s.model??t.responseModel,s.usage&&(t.promptTokens=s.usage.input_tokens,t.completionTokens=s.usage.output_tokens,t.totalTokens=s.usage.total_tokens),s.status&&t.finishReasons.push(s.status),n&&s.output_text&&t.responseTexts.push(s.output_text)}}async function*xR(e,t,n){const r={eventTypes:[],responseTexts:[],finishReasons:[],responseId:"",responseModel:"",promptTokens:void 0,completionTokens:void 0,totalTokens:void 0,chatCompletionToolCalls:{},responsesApiToolCalls:[]};try{for await(const i of e)TR(i)?AR(i,r,n):ER(i)&&CR(i,r,n,t),yield i}finally{const i=[...Object.values(r.chatCompletionToolCalls),...r.responsesApiToolCalls];nc(t,{...r,toolCalls:i},n)}}function OR(e){const t=Array.isArray(e.tools)?e.tools:[],r=e.web_search_options&&typeof e.web_search_options=="object"?[{type:"web_search_options",...e.web_search_options}]:[],i=[...t,...r];if(i.length!==0)try{return JSON.stringify(i)}catch(s){C&&y.error("Failed to serialize OpenAI tools:",s);return}}function MR(e,t){const n={[Ms]:"openai",[Dt]:t,[J]:"auto.ai.openai"};if(e.length>0&&typeof e[0]=="object"&&e[0]!==null){const r=e[0],i=OR(r);i&&(n[Ps]=i),Object.assign(n,kR(r))}else n[Ye]="unknown";return n}function Ap(e,t,n,r){if(n==="embeddings"&&"input"in t){const a=t.input;if(a==null||typeof a=="string"&&a.length===0||Array.isArray(a)&&a.length===0)return;e.setAttribute(od,typeof a=="string"?a:JSON.stringify(a));return}const i="input"in t?t.input:"messages"in t?t.messages:void 0;if(!i||Array.isArray(i)&&i.length===0)return;const{systemInstructions:s,filteredMessages:o}=Ls(i);s&&e.setAttribute(Ns,s),e.setAttribute(Ai,r?xi(o):Ci(o)),Array.isArray(o)?e.setAttribute(Ar,o.length):e.setAttribute(Ar,1)}function NR(e,t,n,r,i){return function(...o){const a=n.operation||"unknown",c=MR(o,a),u=c[Ye]||"unknown",d=o[0],l=d&&typeof d=="object"&&d.stream===!0,p={name:`${a} ${u}`,op:`gen_ai.${a}`,attributes:c};if(l){let m;const g=pn(p,_=>(m=e.apply(r,o),i.recordInputs&&d&&Ap(_,d,a,wn(i.enableTruncation)),(async()=>{try{const S=await m;return xR(S,_,i.recordOutputs??!1)}catch(S){throw _.setStatus({code:ce,message:"internal_error"}),be(S,{mechanism:{handled:!1,type:"auto.ai.openai.stream",data:{function:t}}}),_.end(),S}})()));return pa(m,g,"auto.ai.openai")}let f;const h=on(p,m=>(f=e.apply(r,o),i.recordInputs&&d&&Ap(m,d,a,wn(i.enableTruncation)),f.then(g=>(wR(m,g,i.recordOutputs),g),g=>{throw be(g,{mechanism:{handled:!1,type:"auto.ai.openai",data:{function:t}}}),g})));return pa(f,h,"auto.ai.openai")}}function sy(e,t="",n){return new Proxy(e,{get(r,i){const s=r[i],o=cd(t,String(i)),a=bR[o];return typeof s=="function"&&a?NR(s,o,a,r,n):typeof s=="function"?s.bind(r):s&&typeof s=="object"?sy(s,o,n):s}})}function PR(e,t){return sy(e,"",Mr(t))}const LR={"messages.create":{operation:"chat"},"messages.stream":{operation:"chat",streaming:!0},"messages.countTokens":{operation:"chat"},"models.get":{operation:"models"},"completions.create":{operation:"chat"},"models.retrieve":{operation:"models"},"beta.messages.create":{operation:"chat"}};function DR(e,t,n){if(Array.isArray(t)&&t.length===0)return;const{systemInstructions:r,filteredMessages:i}=Ls(t);r&&e.setAttributes({[Ns]:r});const s=Array.isArray(i)?i.length:1;e.setAttributes({[Ai]:n?xi(i):Ci(i),[Ar]:s})}const FR={invalid_request_error:"invalid_argument",authentication_error:"unauthenticated",permission_error:"permission_denied",not_found_error:"not_found",request_too_large:"failed_precondition",rate_limit_error:"resource_exhausted",api_error:"internal_error",overloaded_error:"unavailable"};function oy(e){return e&&FR[e]||"internal_error"}function $R(e,t){t.error&&(e.setStatus({code:ce,message:oy(t.error.type)}),be(t.error,{mechanism:{handled:!1,type:"auto.ai.anthropic.anthropic_error"}}))}function UR(e){const{system:t,messages:n,input:r}=e,i=typeof t=="string"?[{role:"system",content:e.system}]:[],s=Array.isArray(r)?r:r!=null?[r]:void 0,o=Array.isArray(n)?n:n!=null?[n]:[],a=s??o;return[...i,...a]}function BR(e,t){return"type"in e&&typeof e.type=="string"&&e.type==="error"?(t.setStatus({code:ce,message:oy(e.error?.type)}),be(e.error,{mechanism:{handled:!1,type:"auto.ai.anthropic.anthropic_error"}}),!0):!1}function HR(e,t){if(e.type==="message_delta"&&e.usage&&"output_tokens"in e.usage&&typeof e.usage.output_tokens=="number"&&(t.completionTokens=e.usage.output_tokens),e.message){const n=e.message;n.id&&(t.responseId=n.id),n.model&&(t.responseModel=n.model),n.stop_reason&&t.finishReasons.push(n.stop_reason),n.usage&&(typeof n.usage.input_tokens=="number"&&(t.promptTokens=n.usage.input_tokens),typeof n.usage.cache_creation_input_tokens=="number"&&(t.cacheCreationInputTokens=n.usage.cache_creation_input_tokens),typeof n.usage.cache_read_input_tokens=="number"&&(t.cacheReadInputTokens=n.usage.cache_read_input_tokens))}}function jR(e,t){e.type!=="content_block_start"||typeof e.index!="number"||!e.content_block||(e.content_block.type==="tool_use"||e.content_block.type==="server_tool_use")&&(t.activeToolBlocks[e.index]={id:e.content_block.id,name:e.content_block.name,inputJsonParts:[]})}function WR(e,t,n){if(!(e.type!=="content_block_delta"||!e.delta)){if(typeof e.index=="number"&&"partial_json"in e.delta&&typeof e.delta.partial_json=="string"){const r=t.activeToolBlocks[e.index];r&&r.inputJsonParts.push(e.delta.partial_json)}n&&typeof e.delta.text=="string"&&t.responseTexts.push(e.delta.text)}}function zR(e,t){if(e.type!=="content_block_stop"||typeof e.index!="number")return;const n=t.activeToolBlocks[e.index];if(!n)return;const r=n.inputJsonParts.join("");let i;try{i=r?JSON.parse(r):{}}catch{i={__unparsed:r}}t.toolCalls.push({type:"tool_use",id:n.id,name:n.name,input:i}),delete t.activeToolBlocks[e.index]}function ay(e,t,n,r){!(e&&typeof e=="object")||BR(e,r)||(HR(e,t),jR(e,t),WR(e,t,n),zR(e,t))}async function*qR(e,t,n){const r={responseTexts:[],finishReasons:[],responseId:"",responseModel:"",promptTokens:void 0,completionTokens:void 0,cacheCreationInputTokens:void 0,cacheReadInputTokens:void 0,toolCalls:[],activeToolBlocks:{}};try{for await(const i of e)ay(i,r,n,t),yield i}finally{nc(t,r,n)}}function GR(e,t,n){const r={responseTexts:[],finishReasons:[],responseId:"",responseModel:"",promptTokens:void 0,completionTokens:void 0,cacheCreationInputTokens:void 0,cacheReadInputTokens:void 0,toolCalls:[],activeToolBlocks:{}};return e.on("streamEvent",i=>{ay(i,r,n,t)}),e.on("message",()=>{nc(t,r,n)}),e.on("error",i=>{be(i,{mechanism:{handled:!1,type:"auto.ai.anthropic.stream_error"}}),t.isRecording()&&(t.setStatus({code:ce,message:"internal_error"}),t.end())}),e}function VR(e,t,n){const r={[Ms]:"anthropic",[Dt]:n,[J]:"auto.ai.anthropic"};if(e.length>0&&typeof e[0]=="object"&&e[0]!==null){const i=e[0];i.tools&&Array.isArray(i.tools)&&(r[Ps]=JSON.stringify(i.tools)),r[Ye]=i.model??"unknown","temperature"in i&&(r[Ja]=i.temperature),"top_p"in i&&(r[Qa]=i.top_p),"stream"in i&&(r[nd]=i.stream),"top_k"in i&&(r[q_]=i.top_k),"frequency_penalty"in i&&(r[Xa]=i.frequency_penalty),"max_tokens"in i&&(r[rd]=i.max_tokens)}else t==="models.retrieve"||t==="models.get"?r[Ye]=e[0]:r[Ye]="unknown";return r}function qu(e,t,n){const r=UR(t);DR(e,r,n),"prompt"in t&&e.setAttributes({[jk]:JSON.stringify(t.prompt)})}function YR(e,t){if("content"in t&&Array.isArray(t.content)){e.setAttributes({[Xt]:t.content.map(r=>r.text).filter(r=>!!r).join("")});const n=[];for(const r of t.content)(r.type==="tool_use"||r.type==="server_tool_use")&&n.push(r);n.length>0&&e.setAttributes({[jn]:JSON.stringify(n)})}"completion"in t&&e.setAttributes({[Xt]:t.completion}),"input_tokens"in t&&e.setAttributes({[Xt]:JSON.stringify(t.input_tokens)})}function KR(e,t){"id"in t&&"model"in t&&(e.setAttributes({[Za]:t.id,[Ri]:t.model}),"usage"in t&&t.usage&&_R(e,t.usage.input_tokens,t.usage.output_tokens,t.usage.cache_creation_input_tokens,t.usage.cache_read_input_tokens))}function JR(e,t,n){if(!(!t||typeof t!="object")){if("type"in t&&t.type==="error"){$R(e,t);return}n&&YR(e,t),KR(e,t)}}function Cp(e,t,n){throw be(e,{mechanism:{handled:!1,type:"auto.ai.anthropic",data:{function:n}}}),t.isRecording()&&(t.setStatus({code:ce,message:"internal_error"}),t.end()),e}function XR(e,t,n,r,i,s,o,a,c,u,d){const l=i[Ye]??"unknown",p={name:`${s} ${l}`,op:`gen_ai.${s}`,attributes:i};if(u&&!d){let f;const h=pn(p,m=>(f=e.apply(n,r),c.recordInputs&&a&&qu(m,a,wn(c.enableTruncation)),(async()=>{try{const g=await f;return qR(g,m,c.recordOutputs??!1)}catch(g){return Cp(g,m,o)}})()));return pa(f,h,"auto.ai.anthropic")}else return pn(p,f=>{try{c.recordInputs&&a&&qu(f,a,wn(c.enableTruncation));const h=t.apply(n,r);return GR(h,f,c.recordOutputs??!1)}catch(h){return Cp(h,f,o)}})}function QR(e,t,n,r,i){return new Proxy(e,{apply(s,o,a){const c=n.operation||"unknown",u=VR(a,t,c),d=u[Ye]??"unknown",l=typeof a[0]=="object"?a[0]:void 0,p=!!l?.stream,f=n.streaming===!0;if(p||f)return XR(e,s,r,a,u,c,t,l,i,p,f);let h;const m=on({name:`${c} ${d}`,op:`gen_ai.${c}`,attributes:u},g=>(h=s.apply(r,a),i.recordInputs&&l&&qu(g,l,wn(i.enableTruncation)),h.then(_=>(JR(g,_,i.recordOutputs),_),_=>{throw be(_,{mechanism:{handled:!1,type:"auto.ai.anthropic",data:{function:t}}}),_})));return pa(h,m,"auto.ai.anthropic")}})}function cy(e,t="",n){return new Proxy(e,{get(r,i){const s=r[i],o=cd(t,String(i)),a=LR[o];return typeof s=="function"&&a?QR(s,o,a,r,n):typeof s=="function"?s.bind(r):s&&typeof s=="object"?cy(s,o,n):s}})}function ZR(e,t){return cy(e,"",Mr(t))}const eA={"models.generateContent":{operation:"generate_content"},"models.generateContentStream":{operation:"generate_content",streaming:!0},"models.embedContent":{operation:"embeddings"},"chats.create":{proxyResultPath:"chat"},"chat.sendMessage":{operation:"chat"},"chat.sendMessageStream":{operation:"chat",streaming:!0}},tA="google_genai";function nA(e,t){const n=e?.promptFeedback;if(n?.blockReason){const r=n.blockReasonMessage??n.blockReason;return t.setStatus({code:ce,message:"internal_error"}),be(`Content blocked: ${r}`,{mechanism:{handled:!1,type:"auto.ai.google_genai"}}),!0}return!1}function rA(e,t){typeof e.responseId=="string"&&(t.responseId=e.responseId),typeof e.modelVersion=="string"&&(t.responseModel=e.modelVersion);const n=e.usageMetadata;n&&(typeof n.promptTokenCount=="number"&&(t.promptTokens=n.promptTokenCount),typeof n.candidatesTokenCount=="number"&&(t.completionTokens=n.candidatesTokenCount),typeof n.totalTokenCount=="number"&&(t.totalTokens=n.totalTokenCount))}function iA(e,t,n){Array.isArray(e.functionCalls)&&t.toolCalls.push(...e.functionCalls);for(const r of e.candidates??[]){r?.finishReason&&!t.finishReasons.includes(r.finishReason)&&t.finishReasons.push(r.finishReason);for(const i of r?.content?.parts??[])n&&i.text&&t.responseTexts.push(i.text),i.functionCall&&t.toolCalls.push({type:"function",id:i.functionCall.id,name:i.functionCall.name,arguments:i.functionCall.args})}}function sA(e,t,n,r){!e||nA(e,r)||(rA(e,t),iA(e,t,n))}async function*oA(e,t,n){const r={responseTexts:[],finishReasons:[],toolCalls:[]};try{for await(const i of e)sA(i,r,n,t),yield i}finally{nc(t,r,n)}}function Yi(e,t="user"){return typeof e=="string"?[{role:t,content:e}]:Array.isArray(e)?e.flatMap(n=>Yi(n,t)):typeof e!="object"||!e?[]:"role"in e&&typeof e.role=="string"?[e]:"parts"in e?[{...e,role:t}]:[{role:t,content:e}]}function xp(e,t){if("model"in e&&typeof e.model=="string")return e.model;if(t&&typeof t=="object"){const n=t;if("model"in n&&typeof n.model=="string")return n.model;if("modelVersion"in n&&typeof n.modelVersion=="string")return n.modelVersion}return"unknown"}function aA(e){const t={};return"temperature"in e&&typeof e.temperature=="number"&&(t[Ja]=e.temperature),"topP"in e&&typeof e.topP=="number"&&(t[Qa]=e.topP),"topK"in e&&typeof e.topK=="number"&&(t[q_]=e.topK),"maxOutputTokens"in e&&typeof e.maxOutputTokens=="number"&&(t[rd]=e.maxOutputTokens),"frequencyPenalty"in e&&typeof e.frequencyPenalty=="number"&&(t[Xa]=e.frequencyPenalty),"presencePenalty"in e&&typeof e.presencePenalty=="number"&&(t[id]=e.presencePenalty),t}function cA(e,t,n){const r={[Ms]:tA,[Dt]:e,[J]:"auto.ai.google_genai"};if(t){if(r[Ye]=xp(t,n),"config"in t&&typeof t.config=="object"&&t.config){const i=t.config;if(Object.assign(r,aA(i)),"tools"in i&&Array.isArray(i.tools)){const s=i.tools.flatMap(o=>o.functionDeclarations);r[Ps]=JSON.stringify(s)}}}else r[Ye]=xp({},n);return r}function Op(e,t,n,r){if(n){const s=t.contents;s!=null&&e.setAttribute(od,typeof s=="string"?s:JSON.stringify(s));return}const i=[];if("config"in t&&t.config&&typeof t.config=="object"&&"systemInstruction"in t.config&&t.config.systemInstruction&&i.push(...Yi(t.config.systemInstruction,"system")),"history"in t&&i.push(...Yi(t.history,"user")),"contents"in t&&i.push(...Yi(t.contents,"user")),"message"in t&&i.push(...Yi(t.message,"user")),Array.isArray(i)&&i.length){const{systemInstructions:s,filteredMessages:o}=Ls(i);s&&e.setAttribute(Ns,s);const a=Array.isArray(o)?o.length:0;e.setAttributes({[Ar]:a,[Ai]:r?xi(o):Ci(o)})}}function uA(e,t,n){if(!(!t||typeof t!="object")){if(t.modelVersion&&e.setAttribute(Ri,t.modelVersion),t.usageMetadata&&typeof t.usageMetadata=="object"){const r=t.usageMetadata;typeof r.promptTokenCount=="number"&&e.setAttributes({[kr]:r.promptTokenCount}),typeof r.candidatesTokenCount=="number"&&e.setAttributes({[Rr]:r.candidatesTokenCount}),typeof r.totalTokenCount=="number"&&e.setAttributes({[Jn]:r.totalTokenCount})}if(n&&Array.isArray(t.candidates)&&t.candidates.length>0){const r=t.candidates.map(i=>i.content?.parts&&Array.isArray(i.content.parts)?i.content.parts.map(s=>typeof s.text=="string"?s.text:"").filter(s=>s.length>0).join(""):"").filter(i=>i.length>0);r.length>0&&e.setAttributes({[Xt]:r.join("")})}if(n&&t.functionCalls){const r=t.functionCalls;Array.isArray(r)&&r.length>0&&e.setAttributes({[jn]:JSON.stringify(r)})}}}function lA(e,t,n,r,i){const s=n.operation==="embeddings";return new Proxy(e,{apply(o,a,c){const u=n.operation||"unknown",d=c[0],l=cA(u,d,r),p=l[Ye]??"unknown";return n.streaming?pn({name:`${u} ${p}`,op:`gen_ai.${u}`,attributes:l},async f=>{try{i.recordInputs&&d&&Op(f,d,s,wn(i.enableTruncation));const h=await o.apply(r,c);return oA(h,f,!!i.recordOutputs)}catch(h){throw f.setStatus({code:ce,message:"internal_error"}),be(h,{mechanism:{handled:!1,type:"auto.ai.google_genai",data:{function:t}}}),f.end(),h}}):on({name:`${u} ${p}`,op:`gen_ai.${u}`,attributes:l},f=>(i.recordInputs&&d&&Op(f,d,s,wn(i.enableTruncation)),$l(()=>o.apply(r,c),h=>{be(h,{mechanism:{handled:!1,type:"auto.ai.google_genai",data:{function:t}}})},()=>{},h=>{s||uA(f,h,i.recordOutputs)})))}})}function Gu(e,t="",n){return new Proxy(e,{get:(r,i,s)=>{const o=Reflect.get(r,i,s),a=cd(t,String(i)),c=eA[a];if(typeof o=="function"&&c){const u=c.operation?lA(o,a,c,r,n):o.bind(r);return c.proxyResultPath?function(...d){const l=u(...d);return l&&typeof l=="object"?Gu(l,c.proxyResultPath,n):l}:u}return typeof o=="function"?o.bind(r):o&&typeof o=="object"?Gu(o,a,n):o}})}function dA(e,t){return Gu(e,"",Mr(t))}const qr="auto.ai.langchain",fA={human:"user",ai:"assistant",assistant:"assistant",system:"system",function:"function",tool:"tool"},vt=(e,t,n)=>{n!=null&&(e[t]=n)},dt=(e,t,n)=>{const r=Number(n);Number.isNaN(r)||(e[t]=r)};function _r(e){if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function Fr(e){if(Array.isArray(e))try{const t=e.map(n=>n&&typeof n=="object"&&Zr(n)?es(n):n);return JSON.stringify(t)}catch{return String(e)}return _r(e)}function qi(e){const t=e.toLowerCase();return fA[t]??t}function Mp(e){return e.includes("System")?"system":e.includes("Human")?"user":e.includes("AI")||e.includes("Assistant")?"assistant":e.includes("Function")?"function":e.includes("Tool")?"tool":"user"}function Np(e){if(!(!e||Array.isArray(e)))return e.invocation_params}function ud(e){return e.map(t=>{const n=t._getType;if(typeof n=="function"){const i=n.call(t);return{role:qi(i),content:Fr(t.content)}}if(t.lc===1&&t.kwargs){const i=t.id,s=Array.isArray(i)&&i.length>0?i[i.length-1]:"",o=typeof s=="string"?Mp(s):"user";return{role:qi(o),content:Fr(t.kwargs?.content)}}if(t.type){const i=String(t.type).toLowerCase();return{role:qi(i),content:Fr(t.content)}}if(t.role)return{role:qi(String(t.role)),content:Fr(t.content)};const r=t.constructor?.name;return r&&r!=="Object"?{role:qi(Mp(r)),content:Fr(t.content)}:{role:"user",content:Fr(t.content)}})}function pA(e,t,n){const r={},i="kwargs"in e?e.kwargs:void 0,s=t?.temperature??n?.ls_temperature??i?.temperature;dt(r,Ja,s);const o=t?.max_tokens??n?.ls_max_tokens??i?.max_tokens;dt(r,rd,o);const a=t?.top_p??i?.top_p;dt(r,Qa,a);const c=t?.frequency_penalty;dt(r,Xa,c);const u=t?.presence_penalty;return dt(r,id,u),t&&"stream"in t&&vt(r,nd,!!t.stream),r}function uy(e,t,n,r,i){return{[Ms]:_r(e??"langchain"),[Dt]:"chat",[Ye]:_r(t),[J]:qr,...pA(n,r,i)}}function hA(e,t,n,r,i,s){const o=s?.ls_provider,a=i?.model??s?.ls_model_name??"unknown",c=uy(o,a,e,i,s);if(n&&Array.isArray(t)&&t.length>0){vt(c,Ar,t.length);const u=t.map(d=>({role:"user",content:d}));vt(c,Ai,r?xi(u):Ci(u))}return c}function mA(e,t,n,r,i,s){const o=s?.ls_provider??e.id?.[2],a=i?.model??s?.ls_model_name??"unknown",c=uy(o,a,e,i,s);if(n&&Array.isArray(t)&&t.length>0){const u=ud(t.flat()),{systemInstructions:d,filteredMessages:l}=Ls(u);d&&vt(c,Ns,d);const p=Array.isArray(l)?l.length:0;vt(c,Ar,p),vt(c,Ai,r?xi(l):Ci(l))}return c}function gA(e,t){const n=[],r=e.flat();for(const i of r){const o=i.message?.tool_calls;if(Array.isArray(o)&&o.length>0)n.push(...o);else{const a=i.message?.content;if(Array.isArray(a))for(const c of a){const u=c;u.type==="tool_use"&&n.push(u)}}}n.length>0&&vt(t,jn,_r(n))}function _A(e,t){if(!e)return;const n=e.tokenUsage,r=e.usage;if(n)dt(t,kr,n.promptTokens),dt(t,Rr,n.completionTokens),dt(t,Jn,n.totalTokens);else if(r){dt(t,kr,r.input_tokens),dt(t,Rr,r.output_tokens);const i=Number(r.input_tokens),s=Number(r.output_tokens),o=(Number.isNaN(i)?0:i)+(Number.isNaN(s)?0:s);o>0&&dt(t,Jn,o),r.cache_creation_input_tokens!==void 0&&dt(t,Gk,r.cache_creation_input_tokens),r.cache_read_input_tokens!==void 0&&dt(t,Vk,r.cache_read_input_tokens)}}function yA(e,t){if(!e)return;const n={};if(Array.isArray(e.generations)){const u=e.generations.flat().map(d=>d.generationInfo?.finish_reason?d.generationInfo.finish_reason:d.generation_info?.finish_reason?d.generation_info.finish_reason:null).filter(d=>typeof d=="string");if(u.length>0&&vt(n,Qr,_r(u)),gA(e.generations,n),t){const d=e.generations.flat().map(l=>l.text??l.message?.content).filter(l=>typeof l=="string");d.length>0&&vt(n,Xt,_r(d))}}_A(e.llmOutput,n);const r=e.llmOutput,s=e.generations?.[0]?.[0]?.message,o=r?.model_name??r?.model??s?.response_metadata?.model_name;o&&vt(n,Ri,o);const a=r?.id??s?.id;a&&vt(n,Za,a);const c=r?.stop_reason??s?.response_metadata?.finish_reason;return c&&vt(n,Wk,_r(c)),n}function Gc(e){const t={},n=e?.lc_agent_name;return typeof n=="string"&&(t[ec]=n),t}function bA(e){const t=e?.invocation_params?.tools??e?.options?.tools;if(!Array.isArray(t)||t.length===0)return;const n=t.map(r=>{const i=r.function;return{type:"function",name:r.name??i?.name??"",description:r.description??i?.description}});return JSON.stringify(n)}function ld(e={}){const{recordInputs:t,recordOutputs:n}=Mr(e),r=wn(e.enableTruncation),i=new Map,s=a=>{const c=i.get(a);c?.isRecording()&&(c.end(),i.delete(a))},o={lc_serializable:!1,lc_namespace:["langchain_core","callbacks","sentry"],lc_secrets:void 0,lc_attributes:void 0,lc_aliases:void 0,lc_serializable_keys:void 0,lc_id:["langchain_core","callbacks","sentry"],lc_kwargs:{},name:"SentryCallbackHandler",ignoreLLM:!1,ignoreChain:!1,ignoreAgent:!1,ignoreRetriever:!1,ignoreCustomEvent:!1,raiseError:!1,awaitHandlers:!0,handleLLMStart(a,c,u,d,l,p,f,h){const m=Np(p),g=hA(a,c,t,r,m,f),_=g[Ye],S=g[Dt];pn({name:`${S} ${_}`,op:"gen_ai.chat",attributes:{...Gc(f),...g,[oe]:"gen_ai.chat"}},E=>(i.set(u,E),E))},handleChatModelStart(a,c,u,d,l,p,f,h){const m=Np(p),g=mA(a,c,t,r,m,f),_=bA(l);_&&(g[Ps]=_);const S=g[Ye],E=g[Dt];pn({name:`${E} ${S}`,op:"gen_ai.chat",attributes:{...Gc(f),...g,[oe]:"gen_ai.chat"}},v=>(i.set(u,v),v))},handleLLMEnd(a,c,u,d,l){const p=i.get(c);if(p?.isRecording()){const f=yA(a,n);f&&p.setAttributes(f),s(c)}},handleLLMError(a,c){const u=i.get(c);u?.isRecording()&&(u.setStatus({code:ce,message:"internal_error"}),s(c)),be(a,{mechanism:{handled:!1,type:`${qr}.llm_error_handler`}})},handleChainStart(a,c,u,d,l,p,f,h){if(p?.__sentry_langgraph__)return;const m=h||a.name||"unknown_chain",g={[J]:"auto.ai.langchain","langchain.chain.name":m};t&&(g["langchain.chain.inputs"]=JSON.stringify(c)),pn({name:`chain ${m}`,op:"gen_ai.invoke_agent",attributes:{...g,[oe]:"gen_ai.invoke_agent"}},_=>(i.set(u,_),_))},handleChainEnd(a,c){const u=i.get(c);u?.isRecording()&&(n&&u.setAttributes({"langchain.chain.outputs":JSON.stringify(a)}),s(c))},handleChainError(a,c){const u=i.get(c);u?.isRecording()&&(u.setStatus({code:ce,message:"internal_error"}),s(c)),be(a,{mechanism:{handled:!1,type:`${qr}.chain_error_handler`}})},handleToolStart(a,c,u,d,l,p,f){if(p?.__sentry_langgraph__)return;const h=f||a.name||"unknown_tool",m={...Gc(p),[J]:qr,[Dt]:"execute_tool",[K_]:h};t&&(m[J_]=c),pn({name:`execute_tool ${h}`,op:"gen_ai.execute_tool",attributes:{...m,[oe]:"gen_ai.execute_tool"}},g=>(i.set(u,g),g))},handleToolEnd(a,c){const u=i.get(c);if(u?.isRecording()){if(n){const d=a,l=d&&typeof d=="object"&&"content"in d?d.content:a;u.setAttributes({[X_]:typeof l=="string"?l:JSON.stringify(l)})}s(c)}},handleToolError(a,c){const u=i.get(c);u?.isRecording()&&(u.setStatus({code:ce,message:"internal_error"}),s(c)),be(a,{mechanism:{handled:!1,type:`${qr}.tool_error_handler`}})},copy(){return o},toJSON(){return{lc:1,type:"not_implemented",id:o.lc_id}},toJSONNotImplemented(){return{lc:1,type:"not_implemented",id:o.lc_id}}};return o}const dd="auto.ai.langgraph";function SA(e){const t=e[0];if(typeof t!="object"||!t||!("llm"in t)||!t.llm||typeof t.llm!="object")return null;const n=t.llm;return typeof n.modelName!="string"&&typeof n.model!="string"?null:n}function vA(e){const t=e[0];return typeof t=="object"&&t&&"name"in t&&typeof t.name=="string"?t.name:null}function EA(e,t,n){const r="__sentry_tool_wrapped__";for(const i of e){if(!i||typeof i!="object")continue;const s=i,o=s.invoke;if(typeof o!="function"||Object.prototype.hasOwnProperty.call(s,r))continue;const a=typeof s.name=="string"?s.name:"unknown_tool",c=typeof s.description=="string"?s.description:void 0,u=new Proxy(o,{apply(d,l,p){const f={[J]:dd,[oe]:kp,[Dt]:"execute_tool",[K_]:a,[Jk]:"function"},m=p[1]?.metadata?.lc_agent_name??n;typeof m=="string"&&(f[ec]=m),c&&(f[Xk]=c);const g=p[0];if(typeof g=="object"&&g&&("id"in g&&typeof g.id=="string"&&(f[Kk]=g.id),t.recordInputs)){const _="args"in g&&typeof g.args=="object"?g.args:g;try{f[J_]=JSON.stringify(_)}catch{}}return on({op:kp,name:`execute_tool ${a}`,attributes:f},async _=>{try{const S=await Reflect.apply(d,l,p);if(t.recordOutputs)try{const E=S,v=E&&typeof E=="object"&&"content"in E?E.content:S;_.setAttribute(X_,typeof v=="string"?v:JSON.stringify(v))}catch{}return S}catch(S){throw _.setStatus({code:ce,message:"internal_error"}),be(S,{mechanism:{handled:!1,type:"auto.ai.langgraph.error"}}),S}})}});s.invoke=u,Object.defineProperty(s,r,{value:!0,enumerable:!1})}return e}function TA(e){if(!e||e.length===0)return null;const t=[];for(const n of e)if(n&&typeof n=="object"){const r=n.tool_calls;r&&Array.isArray(r)&&t.push(...r)}return t.length>0?t:null}function wA(e){const t=e;let n=0,r=0,i=0;if(t.usage_metadata&&typeof t.usage_metadata=="object"){const s=t.usage_metadata;return typeof s.input_tokens=="number"&&(n=s.input_tokens),typeof s.output_tokens=="number"&&(r=s.output_tokens),typeof s.total_tokens=="number"&&(i=s.total_tokens),{inputTokens:n,outputTokens:r,totalTokens:i}}if(t.response_metadata&&typeof t.response_metadata=="object"){const s=t.response_metadata;if(s.tokenUsage&&typeof s.tokenUsage=="object"){const o=s.tokenUsage;typeof o.promptTokens=="number"&&(n=o.promptTokens),typeof o.completionTokens=="number"&&(r=o.completionTokens),typeof o.totalTokens=="number"&&(i=o.totalTokens)}}return{inputTokens:n,outputTokens:r,totalTokens:i}}function IA(e,t){const n=t;if(n.response_metadata&&typeof n.response_metadata=="object"){const r=n.response_metadata;r.model_name&&typeof r.model_name=="string"&&e.setAttribute(Ri,r.model_name),r.finish_reason&&typeof r.finish_reason=="string"&&e.setAttribute(Qr,[r.finish_reason])}}function kA(e){if(!e.builder?.nodes?.tools?.runnable?.tools)return null;const t=e.builder?.nodes?.tools?.runnable?.tools;return!t||!Array.isArray(t)||t.length===0?null:t.map(n=>({name:n.lc_kwargs?.name,description:n.lc_kwargs?.description,schema:n.lc_kwargs?.schema}))}function RA(e,t,n){const i=n?.messages;if(!i||!Array.isArray(i))return;const s=t?.length??0,o=i.length>s?i.slice(s):[];if(o.length===0)return;const a=TA(o);a&&e.setAttribute(jn,JSON.stringify(a));const c=ud(o);e.setAttribute(Xt,JSON.stringify(c));let u=0,d=0,l=0;for(const p of o){const f=wA(p);u+=f.inputTokens,d+=f.outputTokens,l+=f.totalTokens,IA(e,p)}u>0&&e.setAttribute(kr,u),d>0&&e.setAttribute(Rr,d),l>0&&e.setAttribute(Jn,l)}function AA(e,t){if(!e)return[t];if(Array.isArray(e))return e.includes(t)?e:[...e,t];const n=e;return typeof n.addHandler=="function"&&(Array.isArray(n.handlers)&&n.handlers.includes(t)||n.addHandler(t)),e}let Vu=!1;const ha="__sentry_patched__";function CA(e,t){if(Object.prototype.hasOwnProperty.call(e,ha))return e;const n=ld(t),r=new Proxy(e,{apply(i,s,o){return Vu?Reflect.apply(i,s,o):on({op:"gen_ai.create_agent",name:"create_agent",attributes:{[J]:dd,[oe]:"gen_ai.create_agent",[Dt]:"create_agent"}},a=>{try{const c=Reflect.apply(i,s,o),u=o.length>0?o[0]:{};u?.name&&typeof u.name=="string"&&(a.setAttribute(ec,u.name),a.updateName(`create_agent ${u.name}`));const d=c.invoke;return d&&typeof d=="function"&&(c.invoke=ly(d.bind(c),c,u,t,void 0,n)),c}catch(c){throw a.setStatus({code:ce,message:"internal_error"}),be(c,{mechanism:{handled:!1,type:"auto.ai.langgraph.error"}}),c}})}});return Object.defineProperty(r,ha,{value:!0,enumerable:!1}),r}function ly(e,t,n,r,i,s){return new Proxy(e,{apply(o,a,c){const u=i?.modelName??i?.model;return on({op:"gen_ai.invoke_agent",name:"invoke_agent",attributes:{[J]:dd,[oe]:Yk,[Dt]:"invoke_agent"}},async d=>{try{const l=n?.name;l&&typeof l=="string"&&(d.setAttribute(qk,l),d.setAttribute(ec,l),d.updateName(`invoke_agent ${l}`)),u&&d.setAttribute(Ye,u);const h=(c.length>1?c[1]:void 0)?.configurable?.thread_id;if(h&&typeof h=="string"&&d.setAttribute(sd,h),s){const v=c[1]??{};c[1]=v;const w=v.metadata??{};v.metadata={...w,__sentry_langgraph__:!0,...typeof l=="string"?{lc_agent_name:l}:{}},v.callbacks=AA(v.callbacks,s)}const m=kA(t);m&&d.setAttribute(Ps,JSON.stringify(m));const g=r.recordInputs,_=r.recordOutputs,S=c.length>0?c[0]?.messages??[]:[];if(S&&g){const v=ud(S),{systemInstructions:w,filteredMessages:T}=Ls(v);w&&d.setAttribute(Ns,w);const b=wn(r.enableTruncation),I=Array.isArray(T)?T.length:0;d.setAttributes({[Ai]:b?xi(T):Ci(T),[Ar]:I})}const E=await Reflect.apply(o,a,c);return _&&RA(d,S??null,E),E}catch(l){throw d.setStatus({code:ce,message:"internal_error"}),be(l,{mechanism:{handled:!1,type:"auto.ai.langgraph.error"}}),l}})}})}function xA(e,t){if(Object.prototype.hasOwnProperty.call(e,ha))return e;const n=Mr(t),r=ld(n),i=new Proxy(e,{apply(s,o,a){const c=SA(a),u=vA(a),d=a[0];d&&Array.isArray(d.tools)&&d.tools.length>0&&EA(d.tools,n,u??void 0),Vu=!0;let l;try{l=Reflect.apply(s,o,a)}finally{Vu=!1}const p=l.invoke;if(p&&typeof p=="function"){const f={};u&&(f.name=u),l.invoke=ly(p.bind(l),l,f,n,c,r)}return l}});return Object.defineProperty(i,ha,{value:!0,enumerable:!1}),i}function OA(e,t){return e.compile=CA(e.compile,Mr(t)),e}function MA(e,t,n){const r=n.getOptions(),i=n.getDsn(),s=r.tunnel,o=Cs(r._metadata),a={sent_at:new Date().toISOString(),...NA(t)&&{trace:t},...o&&{sdk:o},...!!s&&i&&{dsn:sn(i)}},c=r.sendDefaultPii?"auto":"never",u=[{type:"span",item_count:e.length,content_type:"application/vnd.sentry.items.span.v2+json"},{version:2,...Kn()&&{ingest_settings:{infer_ip:c,infer_user_agent:c}},items:e}];return Ot(a,[u])}function NA(e){return!!e.trace_id&&!!e.public_key}function PA(e){let t=156;if(t+=e.name.length*2,t+=Pf(e.attributes),e.links&&e.links.length>0){const r=e.links[0]?.attributes,i=100+(r?Pf(r):0);t+=i*e.links.length}return t}const Pp=1e3,LA=5e6;class DA{constructor(t,n){this._traceBuckets=new Map,this._client=t;const{maxSpanLimit:r,flushInterval:i,maxTraceWeightInBytes:s}=n??{};this._maxSpanLimit=r&&r>0&&r<=Pp?r:Pp,this._flushInterval=i&&i>0?i:5e3,this._maxTraceWeight=s&&s>0?s:LA,this._client.on("flush",()=>{this.drain()}),this._client.on("close",()=>{this._traceBuckets.forEach(o=>{clearTimeout(o.timeout)}),this._traceBuckets.clear()})}add(t){const n=t.trace_id;let r=this._traceBuckets.get(n);r||(r={spans:new Set,size:0,timeout:Va(setTimeout(()=>{this.flush(n)},this._flushInterval))},this._traceBuckets.set(n,r)),r.spans.add(t),r.size+=PA(t),(r.spans.size>=this._maxSpanLimit||r.size>=this._maxTraceWeight)&&this.flush(n)}drain(){this._traceBuckets.size&&(C&&y.log(`Flushing span tree map with ${this._traceBuckets.size} traces`),this._traceBuckets.forEach((t,n)=>{this.flush(n)}))}flush(t){const n=this._traceBuckets.get(t);if(!n)return;if(!n.spans.size){this._removeTrace(t);return}const r=Array.from(n.spans),i=r[0]?._segmentSpan;if(!i){C&&y.warn("No segment span reference found on span JSON, cannot compute DSC"),this._removeTrace(t);return}const s=gt(i),o=r.map(c=>{const{_segmentSpan:u,...d}=c;return d}),a=MA(o,s,this._client);C&&y.log(`Sending span envelope for trace ${t} with ${o.length} spans`),this._client.sendEnvelope(a).then(null,c=>{C&&y.error("Error while sending streamed span envelope:",c)}),this._removeTrace(t)}_removeTrace(t){const n=this._traceBuckets.get(t);n&&clearTimeout(n.timeout),this._traceBuckets.delete(t)}}function dy(e){if(e!==void 0)return e>=400&&e<500?"warning":e>=500?"error":void 0}const ai=H;function FA(){return"history"in ai&&!!ai.history}function $A(){if(!("fetch"in ai))return!1;try{return new Headers,new Request("data:,"),new Response,!0}catch{return!1}}function Yu(e){return e&&/^function\s+\w+\(\)\s+\{\s+\[native code\]\s+\}$/.test(e.toString())}function fy(){if(typeof EdgeRuntime=="string")return!0;if(!$A())return!1;if(Yu(ai.fetch))return!0;let e=!1;const t=ai.document;if(t&&typeof t.createElement=="function")try{const n=t.createElement("iframe");n.hidden=!0,t.head.appendChild(n),n.contentWindow?.fetch&&(e=Yu(n.contentWindow.fetch)),t.head.removeChild(n)}catch(n){C&&y.warn("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",n)}return e}function UA(){return"ReportingObserver"in ai}function fd(e,t){const n="fetch",r=Zn(n,e);return er(n,()=>py(void 0,t)),r}function BA(e){const t="fetch-body-resolved",n=Zn(t,e);return er(t,()=>py(jA)),n}function py(e,t=!1){t&&!fy()||Ve(H,"fetch",function(n){return function(...r){const i=new Error,{method:s,url:o}=WA(r),a={args:r,fetchData:{method:s,url:o},startTimestamp:ye()*1e3,virtualError:i,headers:zA(r)};return e||Et("fetch",{...a}),n.apply(H,r).then(async c=>(e?e(c):Et("fetch",{...a,endTimestamp:ye()*1e3,response:c}),c),c=>{Et("fetch",{...a,endTimestamp:ye()*1e3,error:c}),Jt(c)&&c.stack===void 0&&(c.stack=i.stack,xe(c,"framesToPop",1));const d=O()?.getOptions().enhanceFetchErrorMessages??"always";if(d!==!1&&c instanceof TypeError&&(c.message==="Failed to fetch"||c.message==="Load failed"||c.message==="NetworkError when attempting to fetch resource."))try{const f=new URL(a.fetchData.url).host;d==="always"?c.message=`${c.message} (${f})`:xe(c,"__sentry_fetch_url_host__",f)}catch{}throw c})}})}async function HA(e,t){if(e?.body){const n=e.body,r=n.getReader(),i=setTimeout(()=>{n.cancel().then(null,()=>{})},90*1e3);let s=!0;for(;s;){let o;try{o=setTimeout(()=>{n.cancel().then(null,()=>{})},5e3);const{done:a}=await r.read();clearTimeout(o),a&&(t(),s=!1)}catch{s=!1}finally{clearTimeout(o)}}clearTimeout(i),r.releaseLock(),n.cancel().then(null,()=>{})}}function jA(e){let t;try{t=e.clone()}catch{return}HA(t,()=>{Et("fetch-body-resolved",{endTimestamp:ye()*1e3,response:e})})}function Do(e,t){return!!e&&typeof e=="object"&&!!e[t]}function Lp(e){return typeof e=="string"?e:e?Do(e,"url")?e.url:e.toString?e.toString():"":""}function WA(e){if(e.length===0)return{method:"GET",url:""};if(e.length===2){const[n,r]=e;return{url:Lp(n),method:Do(r,"method")?String(r.method).toUpperCase():Ol(n)&&Do(n,"method")?String(n.method).toUpperCase():"GET"}}const t=e[0];return{url:Lp(t),method:Do(t,"method")?String(t.method).toUpperCase():"GET"}}function zA(e){const[t,n]=e;try{if(typeof n=="object"&&n!==null&&"headers"in n&&n.headers)return new Headers(n.headers);if(Ol(t))return new Headers(t.headers)}catch{}}function qA(e){const t=e.constructor?.name??"";return t.includes("OpenAI")?"openai":t.includes("Google")?"google_genai":t.includes("Mistral")?"mistralai":t.includes("Vertex")?"google_vertexai":t.includes("Bedrock")?"aws_bedrock":t.includes("Ollama")?"ollama":t.includes("Cloudflare")?"cloudflare":t.includes("Cohere")?"cohere":"langchain"}function GA(e){const t=e??{},n={[J]:qr,[oe]:Y_,[Dt]:"embeddings",[Ye]:t.model??"unknown"};return n[Ms]=qA(t),"dimensions"in t&&(n[V_]=t.dimensions),"encodingFormat"in t&&(n[G_]=t.encodingFormat),n}function Dp(e,t={}){const{recordInputs:n}=Mr(t);return new Proxy(e,{apply(r,i,s){const o=GA(i),a=o[Ye]||"unknown";if(n){const c=s[0];c!=null&&(o[od]=typeof c=="string"?c:JSON.stringify(c))}return on({name:`embeddings ${a}`,op:Y_,attributes:o},()=>Reflect.apply(r,i,s).then(void 0,c=>{throw be(c,{mechanism:{handled:!1,type:"auto.ai.langchain"}}),c}))}})}function VA(e,t){const n=e;return typeof n.embedQuery=="function"&&(n.embedQuery=Dp(n.embedQuery,t)),typeof n.embedDocuments=="function"&&(n.embedDocuments=Dp(n.embedDocuments,t)),e}const Pt=H,me=Pt.document,Ki=Pt.navigator,hy="Report a Bug",YA="Cancel",KA="Send Bug Report",JA="Confirm",XA="Report a Bug",QA="your.email@example.org",ZA="Email",eC="What's the bug? What did you expect?",tC="Description",nC="Your Name",rC="Name",iC="Thank you for your report!",sC="(required)",oC="Add a screenshot",aC="Remove screenshot",cC="Highlight",uC="Hide",lC="Remove",my="Unable to submit feedback with empty message",gy="No client setup, cannot send feedback.",_y="Unable to determine if Feedback was correctly sent.",yy="Unable to send feedback. This could be because this domain is not in your list of allowed domains.",by="Unable to send feedback. This could be because of network issues, or because you are using an ad-blocker.",dC="widget",fC="api",pC=5e3,hC={ERROR_EMPTY_MESSAGE:my,ERROR_NO_CLIENT:gy,ERROR_TIMEOUT:_y,ERROR_FORBIDDEN:yy,ERROR_GENERIC:by};function Fo(e,t){return t?.[e]??hC[e]}function Fp(e,t){return new Error(Fo(e,t))}const Sy=(e,t={includeReplay:!0})=>{const n=t.errorMessages;if(!e.message)throw Fp("ERROR_EMPTY_MESSAGE",n);const r=O();if(!r)throw Fp("ERROR_NO_CLIENT",n);e.tags&&Object.keys(e.tags).length&&G().setTags(e.tags);const i=j_({source:fC,url:xr(),...e},t);return new Promise((s,o)=>{const a=setTimeout(()=>{c(),o(Fo("ERROR_TIMEOUT",n))},3e4),c=r.on("afterSendEvent",(u,d)=>{if(u.event_id===i)return clearTimeout(a),c(),d?.statusCode&&d.statusCode>=200&&d.statusCode<300?s(i):d?.statusCode===403?o(Fo("ERROR_FORBIDDEN",n)):o(Fo("ERROR_GENERIC",n))})})},$o=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;function mC(){return!(/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(Ki.userAgent)||/Macintosh/i.test(Ki.userAgent)&&Ki.maxTouchPoints&&Ki.maxTouchPoints>1||!isSecureContext)}function ao(e,t){return{...e,...t,tags:{...e.tags,...t.tags},onFormOpen:()=>{t.onFormOpen?.(),e.onFormOpen?.()},onFormClose:()=>{t.onFormClose?.(),e.onFormClose?.()},onSubmitSuccess:(n,r)=>{t.onSubmitSuccess?.(n,r),e.onSubmitSuccess?.(n,r)},onSubmitError:n=>{t.onSubmitError?.(n),e.onSubmitError?.(n)},onFormSubmitted:()=>{t.onFormSubmitted?.(),e.onFormSubmitted?.()},themeDark:{...e.themeDark,...t.themeDark},themeLight:{...e.themeLight,...t.themeLight}}}function gC(e){const t=me.createElement("style");return t.textContent=` .widget__actor { position: fixed; z-index: var(--z-index); margin: var(--page-margin); inset: var(--actor-inset); display: flex; align-items: center; gap: 8px; padding: 16px; font-family: inherit; font-size: var(--font-size); font-weight: 600; line-height: 1.14em; text-decoration: none; background: var(--actor-background, var(--background)); border-radius: var(--actor-border-radius, 1.7em/50%); border: var(--actor-border, var(--border)); box-shadow: var(--actor-box-shadow, var(--box-shadow)); color: var(--actor-color, var(--foreground)); fill: var(--actor-color, var(--foreground)); cursor: pointer; opacity: 1; transition: transform 0.2s ease-in-out; transform: translate(0, 0) scale(1); } .widget__actor[aria-hidden="true"] { opacity: 0; pointer-events: none; visibility: hidden; transform: translate(0, 16px) scale(0.98); } .widget__actor:hover { background: var(--actor-hover-background, var(--background)); filter: var(--interactive-filter); } .widget__actor svg { width: 1.14em; height: 1.14em; } @media (max-width: 600px) { .widget__actor span { display: none; } } `,e&&t.setAttribute("nonce",e),t}function pt(e,t){return Object.entries(t).forEach(([n,r])=>{e.setAttributeNS(null,n,r)}),e}const $r=20,_C="http://www.w3.org/2000/svg";function yC(){const e=a=>Pt.document.createElementNS(_C,a),t=pt(e("svg"),{width:`${$r}`,height:`${$r}`,viewBox:`0 0 ${$r} ${$r}`,fill:"var(--actor-color, var(--foreground))"}),n=pt(e("g"),{clipPath:"url(#clip0_57_80)"}),r=pt(e("path"),{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M15.6622 15H12.3997C12.2129 14.9959 12.031 14.9396 11.8747 14.8375L8.04965 12.2H7.49956V19.1C7.4875 19.3348 7.3888 19.5568 7.22256 19.723C7.05632 19.8892 6.83435 19.9879 6.59956 20H2.04956C1.80193 19.9968 1.56535 19.8969 1.39023 19.7218C1.21511 19.5467 1.1153 19.3101 1.11206 19.0625V12.2H0.949652C0.824431 12.2017 0.700142 12.1783 0.584123 12.1311C0.468104 12.084 0.362708 12.014 0.274155 11.9255C0.185602 11.8369 0.115689 11.7315 0.0685419 11.6155C0.0213952 11.4995 -0.00202913 11.3752 -0.00034808 11.25V3.75C-0.00900498 3.62067 0.0092504 3.49095 0.0532651 3.36904C0.0972798 3.24712 0.166097 3.13566 0.255372 3.04168C0.344646 2.94771 0.452437 2.87327 0.571937 2.82307C0.691437 2.77286 0.82005 2.74798 0.949652 2.75H8.04965L11.8747 0.1625C12.031 0.0603649 12.2129 0.00407221 12.3997 0H15.6622C15.9098 0.00323746 16.1464 0.103049 16.3215 0.278167C16.4966 0.453286 16.5964 0.689866 16.5997 0.9375V3.25269C17.3969 3.42959 18.1345 3.83026 18.7211 4.41679C19.5322 5.22788 19.9878 6.32796 19.9878 7.47502C19.9878 8.62209 19.5322 9.72217 18.7211 10.5333C18.1345 11.1198 17.3969 11.5205 16.5997 11.6974V14.0125C16.6047 14.1393 16.5842 14.2659 16.5395 14.3847C16.4948 14.5035 16.4268 14.6121 16.3394 14.7042C16.252 14.7962 16.147 14.8698 16.0307 14.9206C15.9144 14.9714 15.7891 14.9984 15.6622 15ZM1.89695 10.325H1.88715V4.625H8.33715C8.52423 4.62301 8.70666 4.56654 8.86215 4.4625L12.6872 1.875H14.7247V13.125H12.6872L8.86215 10.4875C8.70666 10.3835 8.52423 10.327 8.33715 10.325H2.20217C2.15205 10.3167 2.10102 10.3125 2.04956 10.3125C1.9981 10.3125 1.94708 10.3167 1.89695 10.325ZM2.98706 12.2V18.1625H5.66206V12.2H2.98706ZM16.5997 9.93612V5.01393C16.6536 5.02355 16.7072 5.03495 16.7605 5.04814C17.1202 5.13709 17.4556 5.30487 17.7425 5.53934C18.0293 5.77381 18.2605 6.06912 18.4192 6.40389C18.578 6.73866 18.6603 7.10452 18.6603 7.47502C18.6603 7.84552 18.578 8.21139 18.4192 8.54616C18.2605 8.88093 18.0293 9.17624 17.7425 9.41071C17.4556 9.64518 17.1202 9.81296 16.7605 9.90191C16.7072 9.91509 16.6536 9.9265 16.5997 9.93612Z"});t.appendChild(n).appendChild(r);const i=e("defs"),s=pt(e("clipPath"),{id:"clip0_57_80"}),o=pt(e("rect"),{width:`${$r}`,height:`${$r}`,fill:"white"});return s.appendChild(o),i.appendChild(s),t.appendChild(i).appendChild(s).appendChild(o),t}function bC({triggerLabel:e,triggerAriaLabel:t,shadow:n,styleNonce:r}){const i=me.createElement("button");if(i.type="button",i.className="widget__actor",i.ariaHidden="false",i.ariaLabel=t||e||hy,i.appendChild(yC()),e){const o=me.createElement("span");o.appendChild(me.createTextNode(e)),i.appendChild(o)}const s=gC(r);return{el:i,appendToDom(){n.appendChild(s),n.appendChild(i)},removeFromDom(){i.remove(),s.remove()},show(){i.ariaHidden="false"},hide(){i.ariaHidden="true"}}}const vy="rgba(88, 74, 192, 1)",SC={foreground:"#2b2233",background:"#ffffff",accentForeground:"white",accentBackground:vy,successColor:"#268d75",errorColor:"#df3338",border:"1.5px solid rgba(41, 35, 47, 0.13)",boxShadow:"0px 4px 24px 0px rgba(43, 34, 51, 0.12)",outline:"1px auto var(--accent-background)",interactiveFilter:"brightness(95%)"},$p={foreground:"#ebe6ef",background:"#29232f",accentForeground:"white",accentBackground:vy,successColor:"#2da98c",errorColor:"#f55459",border:"1.5px solid rgba(235, 230, 239, 0.15)",boxShadow:"0px 4px 24px 0px rgba(43, 34, 51, 0.12)",outline:"1px auto var(--accent-background)",interactiveFilter:"brightness(150%)"};function Up(e){return` --foreground: ${e.foreground}; --background: ${e.background}; --accent-foreground: ${e.accentForeground}; --accent-background: ${e.accentBackground}; --success-color: ${e.successColor}; --error-color: ${e.errorColor}; --border: ${e.border}; --box-shadow: ${e.boxShadow}; --outline: ${e.outline}; --interactive-filter: ${e.interactiveFilter}; `}function Bp({colorScheme:e,themeDark:t,themeLight:n,styleNonce:r}){const i=me.createElement("style");return i.textContent=` :host { --font-family: system-ui, 'Helvetica Neue', Arial, sans-serif; --font-size: 14px; --z-index: 100000; --page-margin: 16px; --inset: auto 0 0 auto; --actor-inset: var(--inset); font-family: var(--font-family); font-size: var(--font-size); ${e!=="system"?`color-scheme: only ${e};`:""} ${Up(e==="dark"?{...$p,...t}:{...SC,...n})} } ${e==="system"?` @media (prefers-color-scheme: dark) { :host { color-scheme: only dark; ${Up({...$p,...t})} } }`:""} `,r&&i.setAttribute("nonce",r),i}const Ey=({lazyLoadIntegration:e,getModalIntegration:t,getScreenshotIntegration:n})=>(({id:i="sentry-feedback",autoInject:s=!0,showBranding:o=!0,isEmailRequired:a=!1,isNameRequired:c=!1,showEmail:u=!0,showName:d=!0,enableScreenshot:l=!0,useSentryUser:p={email:"email",name:"username"},tags:f,styleNonce:h,scriptNonce:m,colorScheme:g="system",themeLight:_={},themeDark:S={},addScreenshotButtonLabel:E=oC,cancelButtonLabel:v=YA,confirmButtonLabel:w=JA,emailLabel:T=ZA,emailPlaceholder:b=QA,formTitle:I=XA,isRequiredLabel:M=sC,messageLabel:k=tC,messagePlaceholder:D=eC,nameLabel:x=rC,namePlaceholder:L=nC,removeScreenshotButtonLabel:F=aC,submitButtonLabel:Z=KA,successMessageText:Y=iC,triggerLabel:ne=hy,triggerAriaLabel:R="",highlightToolText:j=cC,hideToolText:P=uC,removeHighlightText:U=lC,errorEmptyMessageText:re=my,errorNoClientText:ee=gy,errorTimeoutText:Se=_y,errorForbiddenText:Fe=yy,errorGenericText:He=by,onFormOpen:Xe,onFormClose:Qe,onSubmitSuccess:Ht,onSubmitError:Ze,onFormSubmitted:Mn}={})=>{const ut={id:i,autoInject:s,showBranding:o,isEmailRequired:a,isNameRequired:c,showEmail:u,showName:d,enableScreenshot:l,useSentryUser:p,tags:f,styleNonce:h,scriptNonce:m,colorScheme:g,themeDark:S,themeLight:_,triggerLabel:ne,triggerAriaLabel:R,cancelButtonLabel:v,submitButtonLabel:Z,confirmButtonLabel:w,formTitle:I,emailLabel:T,emailPlaceholder:b,messageLabel:k,messagePlaceholder:D,nameLabel:x,namePlaceholder:L,successMessageText:Y,isRequiredLabel:M,addScreenshotButtonLabel:E,removeScreenshotButtonLabel:F,highlightToolText:j,hideToolText:P,removeHighlightText:U,errorEmptyMessageText:re,errorNoClientText:ee,errorTimeoutText:Se,errorForbiddenText:Fe,errorGenericText:He,onFormClose:Qe,onFormOpen:Xe,onSubmitError:Ze,onSubmitSuccess:Ht,onFormSubmitted:Mn};let et=null,qe=null,Ke=[];const cn=$=>{if(!et){const fe=me.createElement("div");fe.id=String($.id),me.body.appendChild(fe),et=fe.attachShadow({mode:"open"}),qe=Bp($),et.appendChild(qe)}return et},Nn=async $=>{const fe=$.enableScreenshot&&mC();let V,ae;try{V=(t?t():await e("feedbackModalIntegration",m))(),Bu(V)}catch{throw $o&&y.error("[Feedback] Error when trying to load feedback integrations. Try using `feedbackSyncIntegration` in your `Sentry.init`."),new Error("[Feedback] Missing feedback modal integration!")}try{const zt=fe?n?n():await e("feedbackScreenshotIntegration",m):void 0;zt&&(ae=zt(),Bu(ae))}catch{$o&&y.error("[Feedback] Missing feedback screenshot integration. Proceeding without screenshots.")}const W={ERROR_EMPTY_MESSAGE:$.errorEmptyMessageText,ERROR_NO_CLIENT:$.errorNoClientText,ERROR_TIMEOUT:$.errorTimeoutText,ERROR_FORBIDDEN:$.errorForbiddenText,ERROR_GENERIC:$.errorGenericText},yt=(zt,lt)=>Sy(zt,{includeReplay:!0,...lt,errorMessages:W}),Wt=V.createDialog({options:{...$,onFormClose:()=>{Wt?.close(),$.onFormClose?.()},onFormSubmitted:()=>{Wt?.close(),$.onFormSubmitted?.()}},screenshotIntegration:ae,sendFeedback:yt,shadow:cn($)});return Wt},_t=($,fe={})=>{const V=ao(ut,fe),ae=typeof $=="string"?me.querySelector($):typeof $.addEventListener=="function"?$:null;if(!ae)throw $o&&y.error("[Feedback] Unable to attach to target element"),new Error("Unable to attach to target element");let W=null;const yt=async()=>{W||(W=await Nn({...V,onFormSubmitted:()=>{W?.removeFromDom(),V.onFormSubmitted?.()}})),W.appendToDom(),W.open()};ae.addEventListener("click",yt);const Wt=()=>{Ke=Ke.filter(zt=>zt!==Wt),W?.removeFromDom(),W=null,ae.removeEventListener("click",yt)};return Ke.push(Wt),Wt},jt=($={})=>{const fe=ao(ut,$),V=cn(fe),ae=bC({triggerLabel:fe.triggerLabel,triggerAriaLabel:fe.triggerAriaLabel,shadow:V,styleNonce:h});return _t(ae.el,{...fe,onFormOpen(){ae.hide()},onFormClose(){ae.show()},onFormSubmitted(){ae.show()}}),ae};return{name:"Feedback",setupOnce(){!Kn()||!ut.autoInject||(me.readyState==="loading"?me.addEventListener("DOMContentLoaded",()=>jt().appendToDom()):jt().appendToDom())},attachTo:_t,createWidget($={}){const fe=jt(ao(ut,$));return fe.appendToDom(),fe},async createForm($={}){return Nn(ao(ut,$))},setTheme($){if(ut.colorScheme=$,et){const fe=Bp(ut);qe?et.replaceChild(fe,qe):et.prepend(fe),qe=fe}},remove(){et&&(et.parentElement?.remove(),et=null,qe=null),Ke.forEach($=>$()),Ke=[]}}});function vC(){return O()?.getIntegrationByName("Feedback")}var rc,_e,Ty,ur,Hp,wy,Ku,hs={},pd=[],EC=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,hd=Array.isArray;function Un(e,t){for(var n in t)e[n]=t[n];return e}function Iy(e){var t=e.parentNode;t&&t.removeChild(e)}function se(e,t,n){var r,i,s,o={};for(s in t)s=="key"?r=t[s]:s=="ref"?i=t[s]:o[s]=t[s];if(arguments.length>2&&(o.children=arguments.length>3?rc.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(s in e.defaultProps)o[s]===void 0&&(o[s]=e.defaultProps[s]);return Uo(e,o,r,i,null)}function Uo(e,t,n,r,i){var s={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:i??++Ty,__i:-1,__u:0};return i==null&&_e.vnode!=null&&_e.vnode(s),s}function Ds(e){return e.children}function Bo(e,t){this.props=e,this.context=t}function ci(e,t){if(t==null)return e.__?ci(e.__,e.__i+1):null;for(var n;tn?(Ju(r,t,i),i.length=r.length=0,t=void 0,ur.sort(Ku)):t&&_e.__c&&_e.__c(t,pd));t&&Ju(r,t,i),ma.__r=0}function Ry(e,t,n,r,i,s,o,a,c,u,d){var l,p,f,h,m,g=r&&r.__k||pd,_=t.length;for(n.__d=c,wC(n,t,g),c=n.__d,l=0;l<_;l++)(f=n.__k[l])!=null&&typeof f!="boolean"&&typeof f!="function"&&(p=f.__i===-1?hs:g[f.__i]||hs,f.__i=l,md(e,f,p,i,s,o,a,c,u,d),h=f.__e,f.ref&&p.ref!=f.ref&&(p.ref&&gd(p.ref,null,f),d.push(f.ref,f.__c||h,f)),m==null&&h!=null&&(m=h),65536&f.__u||p.__k===f.__k?c=Ay(f,c,e):typeof f.type=="function"&&f.__d!==void 0?c=f.__d:h&&(c=h.nextSibling),f.__d=void 0,f.__u&=-196609);n.__d=c,n.__e=m}function wC(e,t,n){var r,i,s,o,a,c=t.length,u=n.length,d=u,l=0;for(e.__k=[],r=0;r0?Uo(i.type,i.props,i.key,i.ref?i.ref:null,i.__v):i)!=null?(i.__=e,i.__b=e.__b+1,a=IC(i,n,o=r+l,d),i.__i=a,s=null,a!==-1&&(d--,(s=n[a])&&(s.__u|=131072)),s==null||s.__v===null?(a==-1&&l--,typeof i.type!="function"&&(i.__u|=65536)):a!==o&&(a===o+1?l++:a>o?d>c-o?l+=a-o:l--:l=a(c!=null&&(131072&c.__u)==0?1:0))for(;o>=0||a=0){if((c=t[o])&&(131072&c.__u)==0&&i==c.key&&s===c.type)return o;o--}if(a=n.__.length&&n.__.push({__V:Ho}),n.__[e]}function dr(e){return ui=1,xy(My,e)}function xy(e,t,n){var r=Nr(In++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):My(void 0,t),function(a){var c=r.__N?r.__N[0]:r.__[0],u=r.t(c,a);c!==u&&(r.__N=[u,r.__[1]],r.__c.setState({}))}],r.__c=ge,!ge.u)){var i=function(a,c,u){if(!r.__c.__H)return!0;var d=r.__c.__H.__.filter(function(p){return!!p.__c});if(d.every(function(p){return!p.__N}))return!s||s.call(this,a,c,u);var l=!1;return d.forEach(function(p){if(p.__N){var f=p.__[0];p.__=p.__N,p.__N=void 0,f!==p.__[0]&&(l=!0)}}),!(!l&&r.__c.props===a)&&(!s||s.call(this,a,c,u))};ge.u=!0;var s=ge.shouldComponentUpdate,o=ge.componentWillUpdate;ge.componentWillUpdate=function(a,c,u){if(this.__e){var d=s;s=void 0,i(a,c,u),s=d}o&&o.call(this,a,c,u)},ge.shouldComponentUpdate=i}return r.__N||r.__}function CC(e,t){var n=Nr(In++,3);!Ce.__s&&_d(n.__H,t)&&(n.__=e,n.i=t,ge.__H.__h.push(n))}function Oy(e,t){var n=Nr(In++,4);!Ce.__s&&_d(n.__H,t)&&(n.__=e,n.i=t,ge.__h.push(n))}function xC(e){return ui=5,Fs(function(){return{current:e}},[])}function OC(e,t,n){ui=6,Oy(function(){return typeof e=="function"?(e(t()),function(){return e(null)}):e?(e.current=t(),function(){return e.current=null}):void 0},n==null?n:n.concat(e))}function Fs(e,t){var n=Nr(In++,7);return _d(n.__H,t)?(n.__V=e(),n.i=t,n.__h=e,n.__V):n.__}function ei(e,t){return ui=8,Fs(function(){return e},t)}function MC(e){var t=ge.context[e.__c],n=Nr(In++,9);return n.c=e,t?(n.__==null&&(n.__=!0,t.sub(ge)),t.props.value):e.__}function NC(e,t){Ce.useDebugValue&&Ce.useDebugValue(t?t(e):e)}function PC(e){var t=Nr(In++,10),n=dr();return t.__=e,ge.componentDidCatch||(ge.componentDidCatch=function(r,i){t.__&&t.__(r,i),n[1](r)}),[n[0],function(){n[1](void 0)}]}function LC(){var e=Nr(In++,11);if(!e.__){for(var t=ge.__v;t!==null&&!t.__m&&t.__!==null;)t=t.__;var n=t.__m||(t.__m=[0,0]);e.__="P"+n[0]+"-"+n[1]++}return e.__}function DC(){for(var e;e=Cy.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(jo),e.__H.__h.forEach(Qu),e.__H.__h=[]}catch(t){e.__H.__h=[],Ce.__e(t,e.__v)}}Ce.__b=function(e){ge=null,Vp&&Vp(e)},Ce.__=function(e,t){t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Qp&&Qp(e,t)},Ce.__r=function(e){Yp&&Yp(e),In=0;var t=(ge=e.__c).__H;t&&(Vc===ge?(t.__h=[],ge.__h=[],t.__.forEach(function(n){n.__N&&(n.__=n.__N),n.__V=Ho,n.__N=n.i=void 0})):(t.__h.forEach(jo),t.__h.forEach(Qu),t.__h=[],In=0)),Vc=ge},Ce.diffed=function(e){Kp&&Kp(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Cy.push(t)!==1&&Gp===Ce.requestAnimationFrame||((Gp=Ce.requestAnimationFrame)||FC)(DC)),t.__H.__.forEach(function(n){n.i&&(n.__H=n.i),n.__V!==Ho&&(n.__=n.__V),n.i=void 0,n.__V=Ho})),Vc=ge=null},Ce.__c=function(e,t){t.some(function(n){try{n.__h.forEach(jo),n.__h=n.__h.filter(function(r){return!r.__||Qu(r)})}catch(r){t.some(function(i){i.__h&&(i.__h=[])}),t=[],Ce.__e(r,n.__v)}}),Jp&&Jp(e,t)},Ce.unmount=function(e){Xp&&Xp(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(r){try{jo(r)}catch(i){t=i}}),n.__H=void 0,t&&Ce.__e(t,n.__v))};var Zp=typeof requestAnimationFrame=="function";function FC(e){var t,n=function(){clearTimeout(r),Zp&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,100);Zp&&(t=requestAnimationFrame(n))}function jo(e){var t=ge,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),ge=t}function Qu(e){var t=ge;e.__c=e.__(),ge=t}function _d(e,t){return!e||e.length!==t.length||t.some(function(n,r){return n!==e[r]})}function My(e,t){return typeof t=="function"?t(e):t}const $C=Object.defineProperty({__proto__:null,useCallback:ei,useContext:MC,useDebugValue:NC,useEffect:CC,useErrorBoundary:PC,useId:LC,useImperativeHandle:OC,useLayoutEffect:Oy,useMemo:Fs,useReducer:xy,useRef:xC,useState:dr},Symbol.toStringTag,{value:"Module"}),UC="http://www.w3.org/2000/svg";function BC(){const e=r=>me.createElementNS(UC,r),t=pt(e("svg"),{width:"32",height:"30",viewBox:"0 0 72 66",fill:"inherit"}),n=pt(e("path"),{transform:"translate(11, 11)",d:"M29,2.26a4.67,4.67,0,0,0-8,0L14.42,13.53A32.21,32.21,0,0,1,32.17,40.19H27.55A27.68,27.68,0,0,0,12.09,17.47L6,28a15.92,15.92,0,0,1,9.23,12.17H4.62A.76.76,0,0,1,4,39.06l2.94-5a10.74,10.74,0,0,0-3.36-1.9l-2.91,5a4.54,4.54,0,0,0,1.69,6.24A4.66,4.66,0,0,0,4.62,44H19.15a19.4,19.4,0,0,0-8-17.31l2.31-4A23.87,23.87,0,0,1,23.76,44H36.07a35.88,35.88,0,0,0-16.41-31.8l4.67-8a.77.77,0,0,1,1.05-.27c.53.29,20.29,34.77,20.66,35.17a.76.76,0,0,1-.68,1.13H40.6q.09,1.91,0,3.81h4.78A4.59,4.59,0,0,0,50,39.43a4.49,4.49,0,0,0-.62-2.28Z"});return t.appendChild(n),t}function HC({options:e}){const t=Fs(()=>({__html:BC().outerHTML}),[]);return se("h2",{class:"dialog__header"},se("span",{class:"dialog__title"},e.formTitle),e.showBranding?se("a",{class:"brand-link",target:"_blank",href:"https://sentry.io/welcome/",title:"Powered by Sentry",rel:"noopener noreferrer",dangerouslySetInnerHTML:t}):null)}function jC(e,t){const n=[];return t.isNameRequired&&!e.name&&n.push(t.nameLabel),t.isEmailRequired&&!e.email&&n.push(t.emailLabel),e.message||n.push(t.messageLabel),n}function Yc(e,t){const n=e.get(t);return typeof n=="string"?n.trim():""}function WC({options:e,defaultEmail:t,defaultName:n,onFormClose:r,onSubmit:i,onSubmitSuccess:s,onSubmitError:o,showEmail:a,showName:c,screenshotInput:u}){const{tags:d,addScreenshotButtonLabel:l,removeScreenshotButtonLabel:p,cancelButtonLabel:f,emailLabel:h,emailPlaceholder:m,isEmailRequired:g,isNameRequired:_,messageLabel:S,messagePlaceholder:E,nameLabel:v,namePlaceholder:w,submitButtonLabel:T,isRequiredLabel:b}=e,[I,M]=dr(!1),[k,D]=dr(null),[x,L]=dr(!1),F=u?.input,[Z,Y]=dr(null),ne=ei(P=>{Y(P),L(!1)},[]),R=ei(P=>{const U=jC(P,{emailLabel:h,isEmailRequired:g,isNameRequired:_,messageLabel:S,nameLabel:v});return U.length>0?D(`Please enter in the following required fields: ${U.join(", ")}`):D(null),U.length===0},[h,g,_,S,v]),j=ei(async P=>{M(!0);try{if(P.preventDefault(),!(P.target instanceof HTMLFormElement))return;const U=new FormData(P.target),re=await(u&&x?u.value():void 0),ee={name:Yc(U,"name"),email:Yc(U,"email"),message:Yc(U,"message"),attachments:re?[re]:void 0};if(!R(ee))return;try{const Se=await i({name:ee.name,email:ee.email,message:ee.message,source:dC,tags:d},{attachments:ee.attachments});s(ee,Se)}catch(Se){$o&&y.error(Se);const Fe=Se instanceof Error?Se:new Error(String(Se));D(Fe.message),o(Fe)}}finally{M(!1)}},[u&&x,s,o]);return se("form",{class:"form",onSubmit:j},F&&x?se(F,{onError:ne}):null,se("fieldset",{class:"form__right","data-sentry-feedback":!0,disabled:I},se("div",{class:"form__top"},k?se("div",{class:"form__error-container"},k):null,c?se("label",{for:"name",class:"form__label"},se(Kc,{label:v,isRequiredLabel:b,isRequired:_}),se("input",{class:"form__input",defaultValue:n,id:"name",name:"name",placeholder:w,required:_,type:"text"})):se("input",{"aria-hidden":!0,value:n,name:"name",type:"hidden"}),a?se("label",{for:"email",class:"form__label"},se(Kc,{label:h,isRequiredLabel:b,isRequired:g}),se("input",{class:"form__input",defaultValue:t,id:"email",name:"email",placeholder:m,required:g,type:"email"})):se("input",{"aria-hidden":!0,value:t,name:"email",type:"hidden"}),se("label",{for:"message",class:"form__label"},se(Kc,{label:S,isRequiredLabel:b,isRequired:!0}),se("textarea",{autoFocus:!0,class:"form__input form__input--textarea",id:"message",name:"message",placeholder:E,required:!0,rows:5})),F?se("label",{for:"screenshot",class:"form__label"},se("button",{class:"btn btn--default",disabled:I,type:"button",onClick:()=>{Y(null),L(P=>!P)}},x?p:l),Z?se("div",{class:"form__error-container"},Z.message):null):null),se("div",{class:"btn-group"},se("button",{class:"btn btn--primary",disabled:I,type:"submit"},T),se("button",{class:"btn btn--default",disabled:I,type:"button",onClick:r},f))))}function Kc({label:e,isRequired:t,isRequiredLabel:n}){return se("span",{class:"form__label__text"},e,t&&se("span",{class:"form__label__text--required"},n))}const uo=16,eh=17,zC="http://www.w3.org/2000/svg";function qC(){const e=c=>Pt.document.createElementNS(zC,c),t=pt(e("svg"),{width:`${uo}`,height:`${eh}`,viewBox:`0 0 ${uo} ${eh}`,fill:"inherit"}),n=pt(e("g"),{clipPath:"url(#clip0_57_156)"}),r=pt(e("path"),{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M3.55544 15.1518C4.87103 16.0308 6.41775 16.5 8 16.5C10.1217 16.5 12.1566 15.6571 13.6569 14.1569C15.1571 12.6566 16 10.6217 16 8.5C16 6.91775 15.5308 5.37103 14.6518 4.05544C13.7727 2.73985 12.5233 1.71447 11.0615 1.10897C9.59966 0.503466 7.99113 0.34504 6.43928 0.653721C4.88743 0.962403 3.46197 1.72433 2.34315 2.84315C1.22433 3.96197 0.462403 5.38743 0.153721 6.93928C-0.15496 8.49113 0.00346625 10.0997 0.608967 11.5615C1.21447 13.0233 2.23985 14.2727 3.55544 15.1518ZM4.40546 3.1204C5.46945 2.40946 6.72036 2.03 8 2.03C9.71595 2.03 11.3616 2.71166 12.575 3.92502C13.7883 5.13838 14.47 6.78405 14.47 8.5C14.47 9.77965 14.0905 11.0306 13.3796 12.0945C12.6687 13.1585 11.6582 13.9878 10.476 14.4775C9.29373 14.9672 7.99283 15.0953 6.73777 14.8457C5.48271 14.596 4.32987 13.9798 3.42502 13.075C2.52018 12.1701 1.90397 11.0173 1.65432 9.76224C1.40468 8.50718 1.5328 7.20628 2.0225 6.02404C2.5122 4.8418 3.34148 3.83133 4.40546 3.1204Z"}),i=pt(e("path"),{d:"M6.68775 12.4297C6.78586 12.4745 6.89218 12.4984 7 12.5C7.11275 12.4955 7.22315 12.4664 7.32337 12.4145C7.4236 12.3627 7.51121 12.2894 7.58 12.2L12 5.63999C12.0848 5.47724 12.1071 5.28902 12.0625 5.11098C12.0178 4.93294 11.9095 4.77744 11.7579 4.67392C11.6064 4.57041 11.4221 4.52608 11.24 4.54931C11.0579 4.57254 10.8907 4.66173 10.77 4.79999L6.88 10.57L5.13 8.56999C5.06508 8.49566 4.98613 8.43488 4.89768 8.39111C4.80922 8.34735 4.713 8.32148 4.61453 8.31498C4.51605 8.30847 4.41727 8.32147 4.32382 8.35322C4.23038 8.38497 4.14413 8.43484 4.07 8.49999C3.92511 8.63217 3.83692 8.81523 3.82387 9.01092C3.81083 9.2066 3.87393 9.39976 4 9.54999L6.43 12.24C6.50187 12.3204 6.58964 12.385 6.68775 12.4297Z"});t.appendChild(n).append(i,r);const s=e("defs"),o=pt(e("clipPath"),{id:"clip0_57_156"}),a=pt(e("rect"),{width:`${uo}`,height:`${uo}`,fill:"white",transform:"translate(0 0.5)"});return o.appendChild(a),s.appendChild(o),t.appendChild(s).appendChild(o).appendChild(a),t}function GC({open:e,onFormSubmitted:t,...n}){const r=n.options,i=Fs(()=>({__html:qC().outerHTML}),[]),[s,o]=dr(null),a=ei(()=>{s&&(clearTimeout(s),o(null)),t()},[s]),c=ei((u,d)=>{n.onSubmitSuccess(u,d),o(setTimeout(()=>{t(),o(null)},pC))},[t]);return se(Ds,null,s?se("div",{class:"success__position",onClick:a},se("div",{class:"success__content"},r.successMessageText,se("span",{class:"success__icon",dangerouslySetInnerHTML:i}))):se("dialog",{class:"dialog",onClick:r.onFormClose,open:e},se("div",{class:"dialog__position"},se("div",{class:"dialog__content",onClick:u=>{u.stopPropagation()}},se(HC,{options:r}),se(WC,{...n,onSubmitSuccess:c})))))}const VC=` .dialog { position: fixed; z-index: var(--z-index); margin: 0; inset: 0; display: flex; align-items: center; justify-content: center; padding: 0; height: 100vh; width: 100vw; color: var(--dialog-color, var(--foreground)); fill: var(--dialog-color, var(--foreground)); line-height: 1.75em; background-color: rgba(0, 0, 0, 0.05); border: none; inset: 0; opacity: 1; transition: opacity 0.2s ease-in-out; } .dialog__position { position: fixed; z-index: var(--z-index); inset: var(--dialog-inset); padding: var(--page-margin); display: flex; max-height: calc(100vh - (2 * var(--page-margin))); } @media (max-width: 600px) { .dialog__position { inset: var(--page-margin); padding: 0; } } .dialog__position:has(.editor) { inset: var(--page-margin); padding: 0; } .dialog:not([open]) { opacity: 0; pointer-events: none; visibility: hidden; } .dialog:not([open]) .dialog__content { transform: translate(0, -16px) scale(0.98); } .dialog__content { display: flex; flex-direction: column; gap: 16px; padding: var(--dialog-padding, 24px); max-width: 100%; width: 100%; max-height: 100%; overflow: auto; background: var(--dialog-background, var(--background)); border-radius: var(--dialog-border-radius, 20px); border: var(--dialog-border, var(--border)); box-shadow: var(--dialog-box-shadow, var(--box-shadow)); transform: translate(0, 0) scale(1); transition: transform 0.2s ease-in-out; } `,YC=` .dialog__header { display: flex; gap: 4px; justify-content: space-between; font-weight: var(--dialog-header-weight, 600); margin: 0; } .dialog__title { align-self: center; width: var(--form-width, 272px); } @media (max-width: 600px) { .dialog__title { width: auto; } } .dialog__position:has(.editor) .dialog__title { width: auto; } .brand-link { display: inline-flex; } .brand-link:focus-visible { outline: var(--outline); } `,KC=` .form { display: flex; overflow: auto; flex-direction: row; gap: 16px; flex: 1 0; } .form fieldset { border: none; margin: 0; padding: 0; } .form__right { flex: 0 0 auto; display: flex; overflow: auto; flex-direction: column; justify-content: space-between; gap: 20px; width: var(--form-width, 100%); } .dialog__position:has(.editor) .form__right { width: var(--form-width, 272px); } .form__top { display: flex; flex-direction: column; gap: 8px; } .form__error-container { color: var(--error-color); fill: var(--error-color); } .form__label { display: flex; flex-direction: column; gap: 4px; margin: 0px; } .form__label__text { display: flex; gap: 4px; align-items: center; } .form__label__text--required { font-size: 0.85em; } .form__input { font-family: inherit; line-height: inherit; background: transparent; box-sizing: border-box; border: var(--input-border, var(--border)); border-radius: var(--input-border-radius, 6px); color: var(--input-color, inherit); fill: var(--input-color, inherit); font-size: var(--input-font-size, inherit); font-weight: var(--input-font-weight, 500); padding: 6px 12px; } .form__input::placeholder { opacity: 0.65; color: var(--input-placeholder-color, inherit); filter: var(--interactive-filter); } .form__input:focus-visible { outline: var(--input-focus-outline, var(--outline)); } .form__input--textarea { font-family: inherit; resize: vertical; } .error { color: var(--error-color); fill: var(--error-color); } `,JC=` .btn-group { display: grid; gap: 8px; } .btn { line-height: inherit; border: var(--button-border, var(--border)); border-radius: var(--button-border-radius, 6px); cursor: pointer; font-family: inherit; font-size: var(--button-font-size, inherit); font-weight: var(--button-font-weight, 600); padding: var(--button-padding, 6px 16px); } .btn[disabled] { opacity: 0.6; pointer-events: none; } .btn--primary { color: var(--button-primary-color, var(--accent-foreground)); fill: var(--button-primary-color, var(--accent-foreground)); background: var(--button-primary-background, var(--accent-background)); border: var(--button-primary-border, var(--border)); border-radius: var(--button-primary-border-radius, 6px); font-weight: var(--button-primary-font-weight, 500); } .btn--primary:hover { color: var(--button-primary-hover-color, var(--accent-foreground)); fill: var(--button-primary-hover-color, var(--accent-foreground)); background: var(--button-primary-hover-background, var(--accent-background)); filter: var(--interactive-filter); } .btn--primary:focus-visible { background: var(--button-primary-hover-background, var(--accent-background)); filter: var(--interactive-filter); outline: var(--button-primary-focus-outline, var(--outline)); } .btn--default { color: var(--button-color, var(--foreground)); fill: var(--button-color, var(--foreground)); background: var(--button-background, var(--background)); border: var(--button-border, var(--border)); border-radius: var(--button-border-radius, 6px); font-weight: var(--button-font-weight, 500); } .btn--default:hover { color: var(--button-color, var(--foreground)); fill: var(--button-color, var(--foreground)); background: var(--button-hover-background, var(--background)); filter: var(--interactive-filter); } .btn--default:focus-visible { background: var(--button-hover-background, var(--background)); filter: var(--interactive-filter); outline: var(--button-focus-outline, var(--outline)); } `,XC=` .success__position { position: fixed; inset: var(--dialog-inset); padding: var(--page-margin); z-index: var(--z-index); } .success__content { background: var(--success-background, var(--background)); border: var(--success-border, var(--border)); border-radius: var(--success-border-radius, 1.7em/50%); box-shadow: var(--success-box-shadow, var(--box-shadow)); font-weight: var(--success-font-weight, 600); color: var(--success-color); fill: var(--success-color); padding: 12px 24px; line-height: 1.75em; display: grid; align-items: center; grid-auto-flow: column; gap: 6px; cursor: default; } .success__icon { display: flex; } `;function QC(e){const t=me.createElement("style");return t.textContent=` :host { --dialog-inset: var(--inset); } ${VC} ${YC} ${KC} ${JC} ${XC} `,e&&t.setAttribute("nonce",e),t}function ZC(){const e=G().getUser(),t=Oe().getUser(),n=mr().getUser();return e&&Object.keys(e).length?e:t&&Object.keys(t).length?t:n}const e1=(()=>({name:"FeedbackModal",setupOnce(){},createDialog:({options:e,screenshotIntegration:t,sendFeedback:n,shadow:r})=>{const i=r,s=e.useSentryUser,o=ZC(),a=me.createElement("div"),c=QC(e.styleNonce);let u="";const d={get el(){return a},appendToDom(){!i.contains(c)&&!i.contains(a)&&(i.appendChild(c),i.appendChild(a))},removeFromDom(){a.remove(),c.remove(),me.body.style.overflow=u},open(){p(!0),e.onFormOpen?.(),O()?.emit("openFeedbackWidget"),u=me.body.style.overflow,me.body.style.overflow="hidden"},close(){p(!1),me.body.style.overflow=u}},l=t?.createInput({h:se,hooks:$C,dialog:d,options:e}),p=f=>{AC(se(GC,{options:e,screenshotInput:l,showName:e.showName||e.isNameRequired,showEmail:e.showEmail||e.isEmailRequired,defaultName:String(s&&o?.[s.name]||""),defaultEmail:String(s&&o?.[s.email]||""),onFormClose:()=>{p(!1),e.onFormClose?.()},onSubmit:n,onSubmitSuccess:(h,m)=>{p(!1),e.onSubmitSuccess?.(h,m)},onSubmitError:h=>{e.onSubmitError?.(h)},onFormSubmitted:()=>{e.onFormSubmitted?.()},open:f}),a)};return d}}));function t1({h:e}){return function(){return e("svg",{"data-test-id":"icon-close",viewBox:"0 0 16 16",fill:"#2B2233",height:"25px",width:"25px"},e("circle",{r:"7",cx:"8",cy:"8",fill:"white"}),e("path",{strokeWidth:"1.5",d:"M8,16a8,8,0,1,1,8-8A8,8,0,0,1,8,16ZM8,1.53A6.47,6.47,0,1,0,14.47,8,6.47,6.47,0,0,0,8,1.53Z"}),e("path",{strokeWidth:"1.5",d:"M5.34,11.41a.71.71,0,0,1-.53-.22.74.74,0,0,1,0-1.06l5.32-5.32a.75.75,0,0,1,1.06,1.06L5.87,11.19A.74.74,0,0,1,5.34,11.41Z"}),e("path",{strokeWidth:"1.5",d:"M10.66,11.41a.74.74,0,0,1-.53-.22L4.81,5.87A.75.75,0,0,1,5.87,4.81l5.32,5.32a.74.74,0,0,1,0,1.06A.71.71,0,0,1,10.66,11.41Z"}))}}function n1(e){const t=me.createElement("style"),n="#1A141F",r="#302735";return t.textContent=` .editor { display: flex; flex-grow: 1; flex-direction: column; } .editor__image-container { justify-items: center; padding: 15px; position: relative; height: 100%; border-radius: var(--menu-border-radius, 6px); background-color: ${n}; background-image: repeating-linear-gradient( -145deg, transparent, transparent 8px, ${n} 8px, ${n} 11px ), repeating-linear-gradient( -45deg, transparent, transparent 15px, ${r} 15px, ${r} 16px ); } .editor__canvas-container { width: 100%; height: 100%; position: relative; display: flex; align-items: center; justify-content: center; } .editor__canvas-container > * { object-fit: contain; position: absolute; } .editor__tool-container { padding-top: 8px; display: flex; justify-content: center; } .editor__tool-bar { display: flex; gap: 8px; } .editor__tool { display: flex; padding: 8px 12px; justify-content: center; align-items: center; border: var(--button-border, var(--border)); border-radius: var(--button-border-radius, 6px); background: var(--button-background, var(--background)); color: var(--button-color, var(--foreground)); } .editor__tool--active { background: var(--button-primary-background, var(--accent-background)); color: var(--button-primary-color, var(--accent-foreground)); } .editor__rect { position: absolute; z-index: 2; } .editor__rect button { opacity: 0; position: absolute; top: -12px; right: -12px; cursor: pointer; padding: 0; z-index: 3; border: none; background: none; } .editor__rect:hover button { opacity: 1; } `,e&&t.setAttribute("nonce",e),t}function r1({h:e}){return function({action:n,setAction:r,options:i}){return e("div",{class:"editor__tool-container"},e("div",{class:"editor__tool-bar"},e("button",{type:"button",class:`editor__tool ${n==="highlight"?"editor__tool--active":""}`,onClick:()=>{r(n==="highlight"?"":"highlight")}},i.highlightToolText),e("button",{type:"button",class:`editor__tool ${n==="hide"?"editor__tool--active":""}`,onClick:()=>{r(n==="hide"?"":"hide")}},i.hideToolText)))}}function i1({hooks:e}){function t(){const[n,r]=e.useState(Pt.devicePixelRatio??1);return e.useEffect(()=>{const i=()=>{r(Pt.devicePixelRatio)},s=matchMedia(`(resolution: ${Pt.devicePixelRatio}dppx)`);return s.addEventListener("change",i),()=>{s.removeEventListener("change",i)}},[]),n}return function({onBeforeScreenshot:r,onScreenshot:i,onAfterScreenshot:s,onError:o}){const a=t();e.useEffect(()=>{(async()=>{r();const u=await Ki.mediaDevices.getDisplayMedia({video:{width:Pt.innerWidth*a,height:Pt.innerHeight*a},audio:!1,monitorTypeSurfaces:"exclude",preferCurrentTab:!0,selfBrowserSurface:"include",surfaceSwitching:"exclude"}),d=me.createElement("video");await new Promise((l,p)=>{d.srcObject=u,d.onloadedmetadata=()=>{i(d,a),u.getTracks().forEach(f=>f.stop()),l()},d.play().catch(p)}),s()})().catch(o)},[])}}function s1(e,t,n){switch(e.type){case"highlight":{t.shadowColor="rgba(0, 0, 0, 0.7)",t.shadowBlur=50,t.fillStyle=n,t.fillRect(e.x-1,e.y-1,e.w+2,e.h+2),t.clearRect(e.x,e.y,e.w,e.h);break}case"hide":t.fillStyle="rgb(0, 0, 0)",t.fillRect(e.x,e.y,e.w,e.h);break}}function Dn(e,t,n){if(!e)return;const r=e.getContext("2d",t);r&&n(e,r)}function Jc(e,t){Dn(e,{alpha:!0},(n,r)=>{r.drawImage(t,0,0,t.width,t.height,0,0,n.width,n.height)})}function Xc(e,t,n){Dn(e,{alpha:!0},(r,i)=>{n.length&&(i.fillStyle="rgba(0, 0, 0, 0.25)",i.fillRect(0,0,r.width,r.height)),n.forEach(s=>{s1(s,i,t)})})}function o1({h:e,hooks:t,outputBuffer:n,dialog:r,options:i}){const s=i1({hooks:t}),o=r1({h:e}),a=t1({h:e}),c={__html:n1(i.styleNonce).innerText},u=r.el.style,d=({screenshot:l})=>{const[p,f]=t.useState("highlight"),[h,m]=t.useState([]),g=t.useRef(null),_=t.useRef(null),S=t.useRef(null),E=t.useRef(null),[v,w]=t.useState(1),T=t.useMemo(()=>{const x=me.getElementById(i.id);if(!x)return"white";const L=getComputedStyle(x);return L.getPropertyValue("--button-primary-background")||L.getPropertyValue("--accent-background")},[i.id]);t.useLayoutEffect(()=>{const x=()=>{const L=g.current;L&&(Dn(l.canvas,{alpha:!1},F=>{const Z=Math.min(L.clientWidth/F.width,L.clientHeight/F.height);w(Z)}),(L.clientHeight===0||L.clientWidth===0)&&setTimeout(x,0))};return x(),Pt.addEventListener("resize",x),()=>{Pt.removeEventListener("resize",x)}},[l]);const b=t.useCallback((x,L)=>{Dn(x,{alpha:!0},(F,Z)=>{Z.scale(L,L),F.width=l.canvas.width,F.height=l.canvas.height})},[l]);t.useEffect(()=>{b(_.current,l.dpi),Jc(_.current,l.canvas)},[l]),t.useEffect(()=>{b(S.current,l.dpi),Dn(S.current,{alpha:!0},(x,L)=>{L.clearRect(0,0,x.width,x.height)}),Xc(S.current,T,h)},[h,T]),t.useEffect(()=>{b(n,l.dpi),Jc(n,l.canvas),Dn(me.createElement("canvas"),{alpha:!0},(x,L)=>{L.scale(l.dpi,l.dpi),x.width=l.canvas.width,x.height=l.canvas.height,Xc(x,T,h),Jc(n,x)})},[h,l,T]);const I=x=>{if(!p||!E.current)return;const L=E.current.getBoundingClientRect(),F={type:p,x:x.offsetX/v,y:x.offsetY/v},Z=(R,j)=>{const P=(j.clientX-L.x)/v,U=(j.clientY-L.y)/v;return{type:R.type,x:Math.min(R.x,P),y:Math.min(R.y,U),w:Math.abs(P-R.x),h:Math.abs(U-R.y)}},Y=R=>{Dn(S.current,{alpha:!0},(j,P)=>{P.clearRect(0,0,j.width,j.height)}),Xc(S.current,T,[...h,Z(F,R)])},ne=R=>{const j=Z(F,R);j.w*v>=1&&j.h*v>=1&&m(P=>[...P,j]),me.removeEventListener("mousemove",Y),me.removeEventListener("mouseup",ne)};me.addEventListener("mousemove",Y),me.addEventListener("mouseup",ne)},M=t.useCallback(x=>L=>{L.preventDefault(),L.stopPropagation(),m(F=>{const Z=[...F];return Z.splice(x,1),Z})},[]),k={width:`${l.canvas.width*v}px`,height:`${l.canvas.height*v}px`},D=x=>{x.stopPropagation()};return e("div",{class:"editor"},e("style",{nonce:i.styleNonce,dangerouslySetInnerHTML:c}),e("div",{class:"editor__image-container"},e("div",{class:"editor__canvas-container",ref:g},e("canvas",{ref:_,id:"background",style:k}),e("canvas",{ref:S,id:"foreground",style:k}),e("div",{ref:E,onMouseDown:I,style:k},h.map((x,L)=>e("div",{key:L,class:"editor__rect",style:{top:`${x.y*v}px`,left:`${x.x*v}px`,width:`${x.w*v}px`,height:`${x.h*v}px`}},e("button",{"aria-label":i.removeHighlightText,onClick:M(L),onMouseDown:D,onMouseUp:D,type:"button"},e(a,null))))))),e(o,{options:i,action:p,setAction:f}))};return function({onError:p}){const[f,h]=t.useState();return s({onBeforeScreenshot:t.useCallback(()=>{u.display="none"},[]),onScreenshot:t.useCallback((m,g)=>{Dn(me.createElement("canvas"),{alpha:!1},(_,S)=>{S.scale(g,g),_.width=m.videoWidth,_.height=m.videoHeight,S.drawImage(m,0,0,_.width,_.height),h({canvas:_,dpi:g})}),n.width=m.videoWidth,n.height=m.videoHeight},[]),onAfterScreenshot:t.useCallback(()=>{u.display="block"},[]),onError:t.useCallback(m=>{u.display="block",p(m)},[])}),f?e(d,{screenshot:f}):e("div",null)}}const a1=(()=>({name:"FeedbackScreenshot",setupOnce(){},createInput:({h:e,hooks:t,dialog:n,options:r})=>{const i=me.createElement("canvas");return{input:o1({h:e,hooks:t,outputBuffer:i,dialog:n,options:r}),value:async()=>{const s=await new Promise(o=>{i.toBlob(o,"image/png")});if(s)return{data:new Uint8Array(await s.arrayBuffer()),filename:"screenshot.png",contentType:"application/png"}}}}})),N=H;let Zu=0;function Ny(){return Zu>0}function c1(){Zu++,setTimeout(()=>{Zu--})}function li(e,t={}){function n(i){return typeof i=="function"}if(!n(e))return e;try{const i=e.__sentry_wrapped__;if(i)return typeof i=="function"?i:e;if(Pl(e))return e}catch{return e}const r=function(...i){try{const s=i.map(o=>li(o,t));return e.apply(this,s)}catch(s){throw c1(),at(o=>{o.addEventProcessor(a=>(t.mechanism&&(Ou(a,void 0),Tn(a,t.mechanism)),a.extra={...a.extra,arguments:i},a)),be(s)}),s}};try{for(const i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=e[i])}catch{}og(r,e),xe(e,"__sentry_wrapped__",r);try{Object.getOwnPropertyDescriptor(r,"name").configurable&&Object.defineProperty(r,"name",{get(){return e.name}})}catch{}return r}function ga(){const e=xr(),{referrer:t}=N.document||{},{userAgent:n}=N.navigator||{},r={...t&&{Referer:t},...n&&{"User-Agent":n}};return{url:e,headers:r}}const u1=["replayIntegration","replayCanvasIntegration","feedbackIntegration","feedbackModalIntegration","feedbackScreenshotIntegration","captureConsoleIntegration","contextLinesIntegration","linkedErrorsIntegration","dedupeIntegration","extraErrorDataIntegration","graphqlClientIntegration","httpClientIntegration","reportingObserverIntegration","rewriteFramesIntegration","browserProfilingIntegration","moduleMetadataIntegration","instrumentAnthropicAiClient","instrumentOpenAiClient","instrumentGoogleGenAIClient","instrumentLangGraph","createLangChainCallbackHandler","instrumentLangChainEmbeddings"],l1={replayCanvasIntegration:"replay-canvas",feedbackModalIntegration:"feedback-modal",feedbackScreenshotIntegration:"feedback-screenshot"};function d1(e){return l1[e]||e.replace("Integration","").toLowerCase()}const th=N;async function Py(e,t){const n=u1.includes(e)?d1(e):void 0,r=th.Sentry=th.Sentry||{};if(!n)throw new Error(`Cannot lazy load integration: ${e}`);const i=r[e];if(typeof i=="function"&&!("_isShim"in i))return i;const s=f1(n),o=N.document.createElement("script");o.src=s,o.crossOrigin="anonymous",o.referrerPolicy="strict-origin",t&&o.setAttribute("nonce",t);const a=new Promise((l,p)=>{o.addEventListener("load",()=>l()),o.addEventListener("error",p)}),c=N.document.currentScript,u=N.document.body||N.document.head||c?.parentElement;if(u)u.appendChild(o);else throw new Error(`Could not find parent element to insert lazy-loaded ${e} script`);try{await a}catch{throw new Error(`Error when loading integration: ${e}`)}const d=r[e];if(typeof d!="function")throw new Error(`Could not load integration: ${e}`);return d}function f1(e){const n=O()?.getOptions()?.cdnBaseUrl||"https://browser.sentry-cdn.com";return new URL(`/${gn}/${e}.min.js`,n).toString()}const p1=Ey({lazyLoadIntegration:Py}),nh=Ey({getModalIntegration:()=>e1,getScreenshotIntegration:()=>a1});function ic(e,t){const n=yd(e,t),r={type:y1(t),value:b1(t)};return n.length&&(r.stacktrace={frames:n}),r.type===void 0&&r.value===""&&(r.value="Unrecoverable error caught"),r}function h1(e,t,n,r){const s=O()?.getOptions().normalizeDepth,o=E1(t),a={__serialized__:zg(t,s)};if(o)return{exception:{values:[ic(e,o)]},extra:a};const c={exception:{values:[{type:Ha(t)?t.constructor.name:r?"UnhandledRejection":"Error",value:S1(t,{isUnhandledRejection:r})}]},extra:a};if(n){const u=yd(e,n);u.length&&(c.exception.values[0].stacktrace={frames:u})}return c}function Qc(e,t){return{exception:{values:[ic(e,t)]}}}function yd(e,t){const n=t.stacktrace||t.stack||"",r=g1(t),i=_1(t);try{return e(n,r,i)}catch{}return[]}const m1=/Minified React error #\d+;/i;function g1(e){return e&&m1.test(e.message)?1:0}function _1(e){return typeof e.framesToPop=="number"?e.framesToPop:0}function Ly(e){return typeof WebAssembly<"u"&&typeof WebAssembly.Exception<"u"?e instanceof WebAssembly.Exception:!1}function y1(e){const t=e?.name;return!t&&Ly(e)?e.message&&Array.isArray(e.message)&&e.message.length==2?e.message[0]:"WebAssembly.Exception":t}function b1(e){const t=e?.message;return Ly(e)?Array.isArray(e.message)&&e.message.length==2?e.message[1]:"wasm exception":t?t.error&&typeof t.error.message=="string"?mp(t.error):mp(e):"No error message"}function Dy(e,t,n,r){const i=n?.syntheticException||void 0,s=sc(e,t,i,r);return Tn(s),s.level="error",n?.event_id&&(s.event_id=n.event_id),Os(s)}function Fy(e,t,n="info",r,i){const s=r?.syntheticException||void 0,o=el(e,t,s,i);return o.level=n,r?.event_id&&(o.event_id=r.event_id),Os(o)}function sc(e,t,n,r,i){let s;if(ig(t)&&t.error)return Qc(e,t.error);if(Rf(t)||wE(t)){const o=t;if("stack"in t)s=Qc(e,t);else{const a=o.name||(Rf(o)?"DOMError":"DOMException"),c=o.message?`${a}: ${o.message}`:a;s=el(e,c,n,r),Ou(s,c)}return"code"in o&&(s.tags={...s.tags,"DOMException.code":`${o.code}`}),s}return Jt(t)?Qc(e,t):ot(t)||Ha(t)?(s=h1(e,t,n,i),Tn(s,{synthetic:!0}),s):(s=el(e,t,n,r),Ou(s,`${t}`),Tn(s,{synthetic:!0}),s)}function el(e,t,n,r){const i={};if(r&&n){const s=yd(e,n);s.length&&(i.exception={values:[{value:t,stacktrace:{frames:s}}]}),Tn(i,{synthetic:!0})}if(Ba(t)){const{__sentry_template_string__:s,__sentry_template_values__:o}=t;return i.logentry={message:s,params:o},i}return i.message=t,i}function S1(e,{isUnhandledRejection:t}){const n=xE(e),r=t?"promise rejection":"exception";return ig(e)?`Event \`ErrorEvent\` captured as ${r} with message \`${e.message}\``:Ha(e)?`Event \`${v1(e)}\` (type=${e.type}) captured as ${r}`:`Object captured as ${r} with keys: ${n}`}function v1(e){try{const t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{}}function E1(e){return Object.values(e).find(t=>t instanceof Error)}class $y extends Cw{constructor(t){const n=T1(t),r=N.SENTRY_SDK_SOURCE||aw();R_(n,"browser",["browser"],r),n._metadata?.sdk&&(n._metadata.sdk.settings={infer_ip:n.sendDefaultPii?"auto":"never",...n._metadata.sdk.settings}),super(n);const{sendDefaultPii:i,sendClientReports:s,enableLogs:o,_experiments:a,enableMetrics:c}=this._options,u=c??a?.enableMetrics??!0;N.document&&(s||o||u)&&N.document.addEventListener("visibilitychange",()=>{N.document.visibilityState==="hidden"&&(s&&this._flushOutcomes(),o&&ca(this),u&&Kl(this))}),i&&this.on("beforeSendSession",zw)}eventFromException(t,n){return Dy(this._options.stackParser,t,n,this._options.attachStacktrace)}eventFromMessage(t,n="info",r){return Fy(this._options.stackParser,t,n,r,this._options.attachStacktrace)}_prepareEvent(t,n,r,i){return t.platform=t.platform||"javascript",super._prepareEvent(t,n,r,i)}}function T1(e){return{release:typeof __SENTRY_RELEASE__=="string"?__SENTRY_RELEASE__:N.SENTRY_RELEASE?.id,sendClientReports:!0,parentSpanIsAlwaysRootSpan:!0,...e}}const Bt=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,Q=H,w1=(e,t)=>e>t[1]?"poor":e>t[0]?"needs-improvement":"good",$s=(e,t,n,r)=>{let i,s;return o=>{t.value>=0&&(o||r)&&(s=t.value-(i??0),(s||i===void 0)&&(i=t.value,t.delta=s,t.rating=w1(t.value,n),e(t)))}},Us=(e=!0)=>{const t=Q.performance?.getEntriesByType?.("navigation")[0];if(!e||t&&t.responseStart>0&&t.responseStartUs()?.activationStart??0;function Wn(e,t,n){Q.document&&Q.addEventListener(e,t,n)}function _a(e,t,n){Q.document&&Q.removeEventListener(e,t,n)}let ti=-1;const Uy=new Set,I1=()=>Q.document?.visibilityState==="hidden"&&!Q.document?.prerendering?0:1/0,Wo=e=>{if(k1(e)&&ti>-1){if(e.type==="visibilitychange"||e.type==="pagehide")for(const t of Uy)t();isFinite(ti)||(ti=e.type==="visibilitychange"?e.timeStamp:0,_a("prerenderingchange",Wo,!0))}},Bs=()=>{if(Q.document&&ti<0){const e=Oi();ti=(Q.document.prerendering?void 0:globalThis.performance.getEntriesByType("visibility-state").filter(n=>n.name==="hidden"&&n.startTime>e)[0]?.startTime)??I1(),Wn("visibilitychange",Wo,!0),Wn("pagehide",Wo,!0),Wn("prerenderingchange",Wo,!0)}return{get firstHiddenTime(){return ti},onHidden(e){Uy.add(e)}}};function k1(e){return e.type==="pagehide"||Q.document?.visibilityState==="hidden"}const R1=()=>`v5-${Date.now()}-${Math.floor(Math.random()*(9e12-1))+1e12}`,Hs=(e,t=-1)=>{const n=Us();let r="navigate";return n&&(Q.document?.prerendering||Oi()>0?r="prerender":Q.document?.wasDiscarded?r="restore":n.type&&(r=n.type.replace(/_/g,"-"))),{name:e,value:t,rating:"good",delta:0,entries:[],id:R1(),navigationType:r}},Zc=new WeakMap;function bd(e,t){try{return Zc.get(e)||Zc.set(e,new t),Zc.get(e)}catch{return new t}}class ya{constructor(){ya.prototype.__init.call(this),ya.prototype.__init2.call(this)}__init(){this._sessionValue=0}__init2(){this._sessionEntries=[]}_processEntry(t){if(t.hadRecentInput)return;const n=this._sessionEntries[0],r=this._sessionEntries[this._sessionEntries.length-1];this._sessionValue&&n&&r&&t.startTime-r.startTime<1e3&&t.startTime-n.startTime<5e3?(this._sessionValue+=t.value,this._sessionEntries.push(t)):(this._sessionValue=t.value,this._sessionEntries=[t]),this._onAfterProcessingUnexpectedShift?.(t)}}const Mi=(e,t,n={})=>{try{if(PerformanceObserver.supportedEntryTypes.includes(e)){const r=new PerformanceObserver(i=>{Promise.resolve().then(()=>{t(i.getEntries())})});return r.observe({type:e,buffered:!0,...n}),r}}catch{}},Sd=e=>{let t=!1;return()=>{t||(e(),t=!0)}},oc=e=>{Q.document?.prerendering?addEventListener("prerenderingchange",()=>e(),!0):e()},A1=[1800,3e3],C1=(e,t={})=>{oc(()=>{const n=Bs(),r=Hs("FCP");let i;const o=Mi("paint",a=>{for(const c of a)c.name==="first-contentful-paint"&&(o.disconnect(),c.startTime{C1(Sd(()=>{const n=Hs("CLS",0);let r;const i=Bs(),s=bd(t,ya),o=c=>{for(const u of c)s._processEntry(u);s._sessionValue>n.value&&(n.value=s._sessionValue,n.entries=s._sessionEntries,r())},a=Mi("layout-shift",o);a&&(r=$s(e,n,x1,t.reportAllChanges),i.onHidden(()=>{o(a.takeRecords()),r(!0)}),Q?.setTimeout?.(r))}))};let By=0,eu=1/0,lo=0;const M1=e=>{e.forEach(t=>{t.interactionId&&(eu=Math.min(eu,t.interactionId),lo=Math.max(lo,t.interactionId),By=lo?(lo-eu)/7+1:0)})};let tl;const Hy=()=>tl?By:performance.interactionCount||0,N1=()=>{"interactionCount"in performance||tl||(tl=Mi("event",M1,{type:"event",buffered:!0,durationThreshold:0}))},tu=10;let jy=0;const P1=()=>Hy()-jy;class ba{constructor(){ba.prototype.__init.call(this),ba.prototype.__init2.call(this)}__init(){this._longestInteractionList=[]}__init2(){this._longestInteractionMap=new Map}_resetInteractions(){jy=Hy(),this._longestInteractionList.length=0,this._longestInteractionMap.clear()}_estimateP98LongestInteraction(){const t=Math.min(this._longestInteractionList.length-1,Math.floor(P1()/50));return this._longestInteractionList[t]}_processEntry(t){if(this._onBeforeProcessingEntry?.(t),!(t.interactionId||t.entryType==="first-input"))return;const n=this._longestInteractionList.at(-1);let r=this._longestInteractionMap.get(t.interactionId);if(r||this._longestInteractionList.lengthn._latency){if(r?t.duration>r._latency?(r.entries=[t],r._latency=t.duration):t.duration===r._latency&&t.startTime===r.entries[0].startTime&&r.entries.push(t):(r={id:t.interactionId,entries:[t],_latency:t.duration},this._longestInteractionMap.set(r.id,r),this._longestInteractionList.push(r)),this._longestInteractionList.sort((i,s)=>s._latency-i._latency),this._longestInteractionList.length>tu){const i=this._longestInteractionList.splice(tu);for(const s of i)this._longestInteractionMap.delete(s.id)}this._onAfterProcessingINPCandidate?.(r)}}}const Wy=e=>{const t=Q.requestIdleCallback||Q.setTimeout;Q.document?.visibilityState==="hidden"?e():(e=Sd(e),Wn("visibilitychange",e,{once:!0,capture:!0}),Wn("pagehide",e,{once:!0,capture:!0}),t(()=>{e(),_a("visibilitychange",e,{capture:!0}),_a("pagehide",e,{capture:!0})}))},L1=[200,500],D1=40,F1=(e,t={})=>{if(!(globalThis.PerformanceEventTiming&&"interactionId"in PerformanceEventTiming.prototype))return;const n=Bs();oc(()=>{N1();const r=Hs("INP");let i;const s=bd(t,ba),o=c=>{Wy(()=>{for(const d of c)s._processEntry(d);const u=s._estimateP98LongestInteraction();u&&u._latency!==r.value&&(r.value=u._latency,r.entries=u.entries,i())})},a=Mi("event",o,{durationThreshold:t.durationThreshold??D1});i=$s(e,r,L1,t.reportAllChanges),a&&(a.observe({type:"first-input",buffered:!0}),n.onHidden(()=>{o(a.takeRecords()),i(!0)}))})};class $1{_processEntry(t){this._onBeforeProcessingEntry?.(t)}}const U1=[2500,4e3],B1=(e,t={})=>{oc(()=>{const n=Bs(),r=Hs("LCP");let i;const s=bd(t,$1),o=c=>{t.reportAllChanges||(c=c.slice(-1));for(const u of c)s._processEntry(u),u.startTime{o(a.takeRecords()),a.disconnect(),i(!0)}),u=d=>{d.isTrusted&&(Wy(c),_a(d.type,u,{capture:!0}))};for(const d of["keydown","click","visibilitychange"])Wn(d,u,{capture:!0})}})},H1=[800,1800],nl=e=>{Q.document?.prerendering?oc(()=>nl(e)):Q.document?.readyState!=="complete"?addEventListener("load",()=>nl(e),!0):setTimeout(e)},j1=(e,t={})=>{const n=Hs("TTFB"),r=$s(e,n,H1,t.reportAllChanges);nl(()=>{const i=Us();i&&(n.value=Math.max(i.responseStart-Oi(),0),n.entries=[i],r(!0))})},ts={},Sa={};let zy,qy,Gy,Vy;function ac(e,t=!1){return uc("cls",e,z1,zy,t)}function cc(e,t=!1){return uc("lcp",e,q1,qy,t)}function W1(e){return uc("ttfb",e,G1,Gy)}function vd(e){return uc("inp",e,V1,Vy)}function Cr(e,t){return Yy(e,t),Sa[e]||(Y1(e),Sa[e]=!0),Ky(e,t)}function js(e,t){const n=ts[e];if(n?.length)for(const r of n)try{r(t)}catch(i){Bt&&y.error(`Error while triggering instrumentation handler. Type: ${e} Name: ${Sn(r)} Error:`,i)}}function z1(){return O1(e=>{js("cls",{metric:e}),zy=e},{reportAllChanges:!0})}function q1(){return B1(e=>{js("lcp",{metric:e}),qy=e},{reportAllChanges:!0})}function G1(){return j1(e=>{js("ttfb",{metric:e}),Gy=e})}function V1(){return F1(e=>{js("inp",{metric:e}),Vy=e})}function uc(e,t,n,r,i=!1){Yy(e,t);let s;return Sa[e]||(s=n(),Sa[e]=!0),r&&t({metric:r}),Ky(e,t,i?s:void 0)}function Y1(e){const t={};e==="event"&&(t.durationThreshold=0),Mi(e,n=>{js(e,{entries:n})},t)}function Yy(e,t){ts[e]=ts[e]||[],ts[e].push(t)}function Ky(e,t,n){return()=>{n&&n();const r=ts[e];if(!r)return;const i=r.indexOf(t);i!==-1&&r.splice(i,1)}}function K1(e){return"duration"in e}const J1=e=>{const t=n=>{(n.type==="pagehide"||Q.document?.visibilityState==="hidden")&&e(n)};Wn("visibilitychange",t,{capture:!0,once:!0}),Wn("pagehide",t,{capture:!0,once:!0})};function nu(e){return typeof e=="number"&&isFinite(e)}function Xn(e,t,n,{...r}){const i=B(e).start_timestamp;return i&&i>t&&typeof e.updateStartTime=="function"&&e.updateStartTime(t),Tr(e,()=>{const s=mt({startTime:t,...r});return s&&s.end(n),s})}function Ed(e){const t=O();if(!t)return;const{name:n,transaction:r,attributes:i,startTime:s}=e,{release:o,environment:a,sendDefaultPii:c}=t.getOptions(),d=t.getIntegrationByName("Replay")?.getReplayId(),l=G(),p=l.getUser(),f=p!==void 0?p.email||p.id||p.ip_address:void 0;let h;try{h=l.getScopeData().contexts.profile.profile_id}catch{}const m={release:o,environment:a,user:f||void 0,profile_id:h||void 0,replay_id:d||void 0,transaction:r,"user_agent.original":Q.navigator?.userAgent,"client.address":c?"{{auto}}":void 0,...i};return mt({name:n,attributes:m,startTime:s,experimental:{standalone:!0}})}function Ni(){return Q.addEventListener&&Q.performance}function Ie(e){return e/1e3}function X1(e){let t="unknown",n="unknown",r="";for(const i of e){if(i==="/"){[t,n]=e.split("/");break}if(!isNaN(Number(i))){t=r==="h"?"http":r,n=e.split(r)[1];break}r+=i}return r===e&&(t=r),{name:t,version:n}}function lc(e){try{return PerformanceObserver.supportedEntryTypes.includes(e)}catch{return!1}}function dc(e,t){let n,r=!1;function i(a){!r&&n&&t(a,n.spanContext().spanId,n),r=!0}J1(()=>{i("pagehide")});const s=e.on("beforeStartNavigationSpan",(a,c)=>{c?.isRedirect||(i("navigation"),s(),o())}),o=e.on("afterStartPageLoadSpan",a=>{n=a,o()})}function Q1(e){let t=0,n;if(!lc("layout-shift"))return;const r=ac(({metric:i})=>{const s=i.entries[i.entries.length-1];s&&(t=i.value,n=s)},!0);dc(e,(i,s)=>{Z1(t,n,s,i),r()})}function Z1(e,t,n,r){Bt&&y.log(`Sending CLS span (${e})`);const i=t?Ie((De()||0)+t.startTime):ye(),s=G().getScopeData().transactionName,o=t?Be(t.sources[0]?.node):"Layout shift",a={[J]:"auto.http.browser.cls",[oe]:"ui.webvital.cls",[rr]:0,"sentry.pageload.span_id":n,"sentry.report_event":r};t?.sources&&t.sources.forEach((u,d)=>{a[`cls.source.${d+1}`]=Be(u.node)});const c=Ed({name:o,transaction:s,attributes:a,startTime:i});c&&(c.addEvent("cls",{[ks]:"",[Rs]:e}),c.end(i))}const ex=6e4;function Ws(e){return e!=null&&e>0&&e<=ex}function tx(e){let t=0,n;if(!lc("largest-contentful-paint"))return;const r=cc(({metric:i})=>{const s=i.entries[i.entries.length-1];!s||!Ws(i.value)||(t=i.value,n=s)},!0);dc(e,(i,s)=>{nx(t,n,s,i),r()})}function nx(e,t,n,r){if(!Ws(e))return;Bt&&y.log(`Sending LCP span (${e})`);const i=Ie((De()||0)+(t?.startTime||0)),s=G().getScopeData().transactionName,o=t?Be(t.element):"Largest contentful paint",a={[J]:"auto.http.browser.lcp",[oe]:"ui.webvital.lcp",[rr]:0,"sentry.pageload.span_id":n,"sentry.report_event":r};t&&(t.element&&(a["lcp.element"]=Be(t.element)),t.id&&(a["lcp.id"]=t.id),t.url&&(a["lcp.url"]=t.url),t.loadTime!=null&&(a["lcp.loadTime"]=t.loadTime),t.renderTime!=null&&(a["lcp.renderTime"]=t.renderTime),t.size!=null&&(a["lcp.size"]=t.size));const c=Ed({name:o,transaction:s,attributes:a,startTime:i});c&&(c.addEvent("lcp",{[ks]:"millisecond",[Rs]:e}),c.end(i))}function bt(e){return e&&((De()||performance.timeOrigin)+e)/1e3}function Jy(e){const t={};if(e.nextHopProtocol!=null){const{name:n,version:r}=X1(e.nextHopProtocol);t["network.protocol.version"]=r,t["network.protocol.name"]=n}return De()||Ni()?.timeOrigin?rx({...t,"http.request.redirect_start":bt(e.redirectStart),"http.request.redirect_end":bt(e.redirectEnd),"http.request.worker_start":bt(e.workerStart),"http.request.fetch_start":bt(e.fetchStart),"http.request.domain_lookup_start":bt(e.domainLookupStart),"http.request.domain_lookup_end":bt(e.domainLookupEnd),"http.request.connect_start":bt(e.connectStart),"http.request.secure_connection_start":bt(e.secureConnectionStart),"http.request.connection_end":bt(e.connectEnd),"http.request.request_start":bt(e.requestStart),"http.request.response_start":bt(e.responseStart),"http.request.response_end":bt(e.responseEnd),"http.request.time_to_first_byte":e.responseStart!=null?e.responseStart/1e3:void 0}):t}function rx(e){return Object.fromEntries(Object.entries(e).filter(([,t])=>t!=null))}const ix=2147483647;let rh=0,nt={},st,va;function sx({recordClsStandaloneSpans:e,recordLcpStandaloneSpans:t,client:n}){const r=Ni();if(r&&De()){r.mark&&Q.performance.mark("sentry-tracing-init");const i=t?tx(n):t===!1?lx():void 0,s=e?Q1(n):e===!1?ux():void 0,o=dx();return()=>{o(),i?.(),s?.()}}return()=>{}}function ox(){Cr("longtask",({entries:e})=>{const t=Ae();if(!t)return;const{op:n,start_timestamp:r}=B(t);for(const i of e){const s=Ie(De()+i.startTime),o=Ie(i.duration);n==="navigation"&&r&&s{const n=Ae();if(n)for(const r of t.getEntries()){if(!r.scripts[0])continue;const i=Ie(De()+r.startTime),{start_timestamp:s,op:o}=B(n);if(o==="navigation"&&s&&i{const t=Ae();if(t){for(const n of e)if(n.name==="click"){const r=Ie(De()+n.startTime),i=Ie(n.duration),s={name:Be(n.target),op:`ui.interaction.${n.name}`,startTime:r,attributes:{[J]:"auto.ui.browser.metrics"}},o=Nl(n.target);o&&(s.attributes["ui.component_name"]=o),Xn(t,r,r+i,s)}}})}function ux(){return ac(({metric:e})=>{const t=e.entries[e.entries.length-1];t&&(nt.cls={value:e.value,unit:""},va=t)},!0)}function lx(){return cc(({metric:e})=>{const t=e.entries[e.entries.length-1];!t||!Ws(e.value)||(nt.lcp={value:e.value,unit:"millisecond"},st=t)},!0)}function dx(){return W1(({metric:e})=>{e.entries[e.entries.length-1]&&(nt.ttfb={value:e.value,unit:"millisecond"})})}function fx(e,t){const n=Ni(),r=De();if(!n?.getEntries||!r)return;const{spanStreamingEnabled:i,ignorePerformanceApiSpans:s,ignoreResourceSpans:o,recordClsOnPageloadSpan:a,recordLcpOnPageloadSpan:c}=t,u=Ie(r),d=n.getEntries(),{op:l,start_timestamp:p}=B(e);if(d.slice(rh).forEach(f=>{const h=Ie(f.startTime),m=Ie(Math.max(0,f.duration));if(!(l==="navigation"&&p&&u+h{const _=g??`browser.web_vital.${h}.value`;e.setAttribute(_,m),Bt&&y.log("Setting web vital attribute",{[_]:m},"on pageload span")};["ttfb","fp","fcp"].forEach(h=>{nt[h]&&f(h,nt[h].value)}),nt["ttfb.requestTime"]&&f("ttfb.requestTime",nt["ttfb.requestTime"].value,"browser.web_vital.ttfb.request_time")}else a||delete nt.cls,c||delete nt.lcp,Object.entries(nt).forEach(([f,h])=>{Vg(f,h.value,h.unit)}),vx(e,t);e.setAttribute(i?"browser.performance.time_origin":"performance.timeOrigin",u),e.setAttribute(i?"browser.performance.navigation.activation_start":"performance.activationStart",Oi())}st=void 0,va=void 0,nt={}}function px(e){if(e?.entryType==="measure")try{return e.detail.devtools.track==="Components ⚛"}catch{return}}function hx(e,t,n,r,i,s){if(px(t)||["mark","measure"].includes(t.entryType)&&Tt(t.name,s))return;const o=Us(!1),a=Ie(o?o.requestStart:0),c=i+Math.max(n,a),u=i+n,d=u+r,l={[J]:"auto.resource.browser.metrics"};c!==u&&(l["sentry.browser.measure_happened_before_request"]=!0,l["sentry.browser.measure_start_time"]=c),mx(l,t),c<=d&&Xn(e,c,d,{name:t.name,op:t.entryType,attributes:l})}function mx(e,t){try{const n=t.detail;if(!n)return;if(typeof n=="object"){for(const[r,i]of Object.entries(n))if(i&&vn(i))e[`sentry.browser.measure.detail.${r}`]=i;else if(i!==void 0)try{e[`sentry.browser.measure.detail.${r}`]=JSON.stringify(i)}catch{}return}if(vn(n)){e["sentry.browser.measure.detail"]=n;return}try{e["sentry.browser.measure.detail"]=JSON.stringify(n)}catch{}}catch{}}function gx(e,t,n){["unloadEvent","redirect","domContentLoadedEvent","loadEvent","connect"].forEach(r=>{fo(e,t,r,n)}),fo(e,t,"secureConnection",n,"TLS/SSL"),fo(e,t,"fetch",n,"cache"),fo(e,t,"domainLookup",n,"DNS"),yx(e,t,n)}function fo(e,t,n,r,i=n){const s=_x(n),o=t[s],a=t[`${n}Start`];!a||!o||Xn(e,r+Ie(a),r+Ie(o),{op:`browser.${i}`,name:t.name,attributes:{[J]:"auto.ui.browser.metrics",...n==="redirect"&&t.redirectCount!=null?{"http.redirect_count":t.redirectCount}:{}}})}function _x(e){return e==="secureConnection"?"connectEnd":e==="fetch"?"domainLookupStart":`${e}End`}function yx(e,t,n){const r=n+Ie(t.requestStart),i=n+Ie(t.responseEnd),s=n+Ie(t.responseStart);t.responseEnd&&(Xn(e,r,i,{op:"browser.request",name:t.name,attributes:{[J]:"auto.ui.browser.metrics"}}),Xn(e,s,i,{op:"browser.response",name:t.name,attributes:{[J]:"auto.ui.browser.metrics"}}))}function bx(e,t,n,r,i,s,o){if(t.initiatorType==="xmlhttprequest"||t.initiatorType==="fetch")return;const a=t.initiatorType?`resource.${t.initiatorType}`:"resource.other";if(o?.includes(a))return;const c={[J]:"auto.resource.browser.metrics"},u=Bn(n);u.protocol&&(c["url.scheme"]=u.protocol.split(":").pop()),u.host&&(c["server.address"]=u.host),c["url.same_origin"]=n.includes(Q.location.origin),Ex(t,c,[["responseStatus","http.response.status_code"],["transferSize","http.response_transfer_size"],["encodedBodySize","http.response_content_length"],["decodedBodySize","http.decoded_response_content_length"],["renderBlockingStatus","resource.render_blocking_status"],["deliveryType","http.response_delivery_type"]]);const d={...c,...Jy(t)},l=s+r,p=l+i;Xn(e,l,p,{name:n.replace(Q.location.origin,""),op:a,attributes:d})}function Sx(e,t){const n=Q.navigator;if(!n)return;const r=n.connection;r&&(r.effectiveType&&e.setAttribute(t?"network.connection.effective_type":"effectiveConnectionType",r.effectiveType),r.type&&e.setAttribute(t?"network.connection.type":"connectionType",r.type),nu(r.rtt)&&(nt["connection.rtt"]={value:r.rtt,unit:"millisecond"},t&&e.setAttribute("network.connection.rtt",r.rtt))),nu(n.deviceMemory)&&(t?e.setAttribute("device.memory.estimated_capacity",n.deviceMemory):e.setAttribute("deviceMemory",`${n.deviceMemory} GB`)),nu(n.hardwareConcurrency)&&(t?e.setAttribute("device.processor_count",n.hardwareConcurrency):e.setAttribute("hardwareConcurrency",String(n.hardwareConcurrency)))}function vx(e,t){st&&t.recordLcpOnPageloadSpan&&(st.element&&e.setAttribute("lcp.element",Be(st.element)),st.id&&e.setAttribute("lcp.id",st.id),st.url&&e.setAttribute("lcp.url",st.url.trim().slice(0,200)),st.loadTime!=null&&e.setAttribute("lcp.loadTime",st.loadTime),st.renderTime!=null&&e.setAttribute("lcp.renderTime",st.renderTime),e.setAttribute("lcp.size",st.size)),va?.sources&&t.recordClsOnPageloadSpan&&va.sources.forEach((n,r)=>e.setAttribute(`cls.source.${r+1}`,Be(n.node)))}function Ex(e,t,n){n.forEach(([r,i])=>{const s=e[r];s!=null&&(typeof s=="number"&&s({name:wx,setup(){!Ni()||!De()||Cr("element",({entries:t})=>{for(const n of t){const r=n;if(!r.identifier)continue;const i=r.identifier,s=r.name,o=r.renderTime,a=r.loadTime,c={"sentry.origin":"auto.ui.browser.element_timing","ui.element.identifier":i};s&&(c["ui.element.paint_type"]=s),r.id&&(c["ui.element.id"]=r.id),r.element&&(c["ui.element.type"]=r.element.tagName.toLowerCase()),r.url&&(c["ui.element.url"]=r.url),r.naturalWidth&&(c["ui.element.width"]=r.naturalWidth),r.naturalHeight&&(c["ui.element.height"]=r.naturalHeight),o>0&&Wu("ui.element.render_time",o,{unit:"millisecond",attributes:c}),a>0&&Wu("ui.element.load_time",a,{unit:"millisecond",attributes:c})}})}})),kx=Ix,ru=[],ns=new Map,Ur=new Map,Xy=60;function Rx(){if(Ni()&&De()){const t=Ax();return()=>{t()}}return()=>{}}const ms={click:"click",pointerdown:"click",pointerup:"click",mousedown:"click",mouseup:"click",touchstart:"click",touchend:"click",mouseover:"hover",mouseout:"hover",mouseenter:"hover",mouseleave:"hover",pointerover:"hover",pointerout:"hover",pointerenter:"hover",pointerleave:"hover",dragstart:"drag",dragend:"drag",drag:"drag",dragenter:"drag",dragleave:"drag",dragover:"drag",drop:"drag",keydown:"press",keyup:"press",keypress:"press",input:"press"};function Ax(){return vd(Cx)}const Cx=({metric:e})=>{if(e.value==null)return;const t=Ie(e.value);if(t>Xy)return;const n=e.entries.find(h=>h.duration===e.value&&ms[h.name]);if(!n)return;const{interactionId:r}=n,i=ms[n.name],s=Ie(De()+n.startTime),o=Ae(),a=o?ke(o):void 0,c=r!=null?ns.get(r):void 0,u=c?.span||a,d=u?B(u).description:G().getScopeData().transactionName,l=c?.elementName||Be(n.target),p={[J]:"auto.http.browser.inp",[oe]:`ui.interaction.${i}`,[rr]:n.duration},f=Ed({name:l,transaction:d,attributes:p,startTime:s});f&&(f.addEvent("inp",{[ks]:"millisecond",[Rs]:e.value}),f.end(s+t))};function xx(e){return e!=null?ns.get(e):void 0}function Ox(){const e=Object.keys(ms);Kn()&&e.forEach(i=>{Q.addEventListener(i,t,{capture:!0,passive:!0})});function t(i){const s=i.target;if(!s)return;const o=Be(s),a=Math.round(i.timeStamp);if(Ur.set(a,o),Ur.size>50){const c=Ur.keys().next().value;c!==void 0&&Ur.delete(c)}}function n(i){const s=Math.round(i.startTime);let o=Ur.get(s);if(!o)for(let a=-5;a<=5;a++){const c=Ur.get(s+a);if(c){o=c;break}}return o||""}const r=({entries:i})=>{const s=Ae(),o=s&&ke(s);i.forEach(a=>{if(!K1(a))return;const c=a.interactionId;if(c==null||ns.has(c))return;const u=a.target?Be(a.target):n(a);if(ru.length>10){const d=ru.shift();ns.delete(d)}ru.push(c),ns.set(c,{span:o,elementName:u})})};Cr("event",r),Cr("first-input",r)}function Td(e){const{name:t,op:n,origin:r,metricName:i,value:s,attributes:o,parentSpan:a,reportEvent:c,startTime:u,endTime:d}=e,l=G().getScopeData().transactionName,p={[J]:r,[oe]:n,[rr]:0,[`browser.web_vital.${i}.value`]:s,"sentry.transaction":l,"user_agent.original":Q.navigator?.userAgent,...o};a&&ta(a).attributes?.[oe]==="pageload"&&(p["sentry.pageload.span_id"]=a.spanContext().spanId),c&&(p[`browser.web_vital.${i}.report_event`]=c);const f=mt({name:t,attributes:p,startTime:u,parentSpan:a});f&&f.end(d??u)}function Mx(e){let t=0,n;if(!lc("largest-contentful-paint"))return;const r=cc(({metric:i})=>{const s=i.entries[i.entries.length-1];!s||!Ws(i.value)||(t=i.value,n=s)},!0);dc(e,(i,s,o)=>{Nx(t,n,o,i),r()})}function Nx(e,t,n,r){if(!Ws(e))return;Bt&&y.log(`Sending LCP span (${e})`);const i=De()||0,s=Ie(i),o=Ie(i+(t?.startTime||0)),a=t?Be(t.element):"Largest contentful paint",c={};t?.element&&(c["browser.web_vital.lcp.element"]=Be(t.element)),t?.id&&(c["browser.web_vital.lcp.id"]=t.id),t?.url&&(c["browser.web_vital.lcp.url"]=t.url),t?.loadTime!=null&&(c["browser.web_vital.lcp.load_time"]=t.loadTime),t?.renderTime!=null&&(c["browser.web_vital.lcp.render_time"]=t.renderTime),t?.size!=null&&(c["browser.web_vital.lcp.size"]=t.size),Td({name:a,op:"ui.webvital.lcp",origin:"auto.http.browser.lcp",metricName:"lcp",value:e,attributes:c,parentSpan:n,reportEvent:r,startTime:s,endTime:o})}function Px(e){let t=0,n;if(!lc("layout-shift"))return;const r=ac(({metric:i})=>{const s=i.entries[i.entries.length-1];s&&(t=i.value,n=s)},!0);dc(e,(i,s,o)=>{Lx(t,n,o,i),r()})}function Lx(e,t,n,r){Bt&&y.log(`Sending CLS span (${e})`);const i=t?Ie((De()||0)+t.startTime):ye(),s=t?Be(t.sources[0]?.node):"Layout shift",o={};t?.sources&&t.sources.forEach((a,c)=>{o[`browser.web_vital.cls.source.${c+1}`]=Be(a.node)}),Td({name:s,op:"ui.webvital.cls",origin:"auto.http.browser.cls",metricName:"cls",value:e,attributes:o,parentSpan:n,reportEvent:r,startTime:i})}function Dx(){if(!Ni()||!De())return;vd(({metric:n})=>{if(n.value==null||Ie(n.value)>Xy)return;const i=n.entries.find(s=>s.duration===n.value&&ms[s.name]);i&&Fx(n.value,i)})}function Fx(e,t){Bt&&y.log(`Sending INP span (${e})`);const n=Ie(De()+t.startTime),r=Ie(e),i=ms[t.name],s=xx(t.interactionId),o=Ae(),a=o?ke(o):void 0,c=s?.span||a,u=c?ta(c).name:G().getScopeData().transactionName,d=s?.elementName||Be(t.target);Td({name:d,op:`ui.interaction.${i}`,origin:"auto.http.browser.inp",metricName:"inp",value:e,attributes:{[rr]:t.duration,"sentry.transaction":u},startTime:n,endTime:n+r,parentSpan:c})}const $x=1e3;let ih,rl,il;function Qy(e){Zn("dom",e),er("dom",Ux)}function Ux(){if(!Q.document)return;const e=Et.bind(null,"dom"),t=sh(e,!0);Q.document.addEventListener("click",t,!1),Q.document.addEventListener("keypress",t,!1),["EventTarget","Node"].forEach(n=>{const i=Q[n]?.prototype;i?.hasOwnProperty?.("addEventListener")&&(Ve(i,"addEventListener",function(s){return function(o,a,c){if(o==="click"||o=="keypress")try{const u=this.__sentry_instrumentation_handlers__=this.__sentry_instrumentation_handlers__||{},d=u[o]=u[o]||{refCount:0};if(!d.handler){const l=sh(e);d.handler=l,s.call(this,o,l,c)}d.refCount++}catch{}return s.call(this,o,a,c)}}),Ve(i,"removeEventListener",function(s){return function(o,a,c){if(o==="click"||o=="keypress")try{const u=this.__sentry_instrumentation_handlers__||{},d=u[o];d&&(d.refCount--,d.refCount<=0&&(s.call(this,o,d.handler,c),d.handler=void 0,delete u[o]),Object.keys(u).length===0&&delete this.__sentry_instrumentation_handlers__)}catch{}return s.call(this,o,a,c)}}))})}function Bx(e){if(e.type!==rl)return!1;try{if(!e.target||e.target._sentryId!==il)return!1}catch{}return!0}function Hx(e,t){return e!=="keypress"?!1:t?.tagName?!(t.tagName==="INPUT"||t.tagName==="TEXTAREA"||t.isContentEditable):!0}function sh(e,t=!1){return n=>{if(!n||n._sentryCaptured)return;const r=jx(n);if(Hx(n.type,r))return;xe(n,"_sentryCaptured",!0),r&&!r._sentryId&&xe(r,"_sentryId",$e());const i=n.type==="keypress"?"input":n.type;Bx(n)||(e({event:n,name:i,global:t}),rl=n.type,il=r?r._sentryId:void 0),clearTimeout(ih),ih=Q.setTimeout(()=>{il=void 0,rl=void 0},$x)}}function jx(e){try{return e.target}catch{return null}}let po;function fc(e){const t="history";Zn(t,e),er(t,Wx)}function Wx(){if(Q.addEventListener("popstate",()=>{const t=Q.location.href,n=po;if(po=t,n===t)return;Et("history",{from:n,to:t})}),!FA())return;function e(t){return function(...n){const r=n.length>2?n[2]:void 0;if(r){const i=po,s=zx(String(r));if(po=s,i===s)return t.apply(this,n);Et("history",{from:i,to:s})}return t.apply(this,n)}}Ve(Q.history,"pushState",e),Ve(Q.history,"replaceState",e)}function zx(e){try{return new URL(e,Q.location.origin).toString()}catch{return e}}const zo={};function wd(e){const t=zo[e];if(t)return t;let n=Q[e];if(Yu(n))return zo[e]=n.bind(Q);const r=Q.document;if(r&&typeof r.createElement=="function")try{const i=r.createElement("iframe");i.hidden=!0,r.head.appendChild(i);const s=i.contentWindow;s?.[e]&&(n=s[e]),r.head.removeChild(i)}catch(i){Bt&&y.warn(`Could not create sandbox iframe for ${e} check, bailing to window.${e}: `,i)}return n&&(zo[e]=n.bind(Q))}function qx(e){zo[e]=void 0}function zs(...e){return wd("setTimeout")(...e)}const hn="__sentry_xhr_v3__";function Id(e){Zn("xhr",e),er("xhr",Gx)}function Gx(){if(!Q.XMLHttpRequest)return;const e=XMLHttpRequest.prototype;e.open=new Proxy(e.open,{apply(t,n,r){const i=new Error,s=ye()*1e3,o=Lt(r[0])?r[0].toUpperCase():void 0,a=Vx(r[1]);if(!o||!a)return t.apply(n,r);n[hn]={method:o,url:a,request_headers:{}},o==="POST"&&a.match(/sentry_key/)&&(n.__sentry_own_request__=!0);const c=()=>{const u=n[hn];if(u&&n.readyState===4){try{u.status_code=n.status}catch{}const d={endTimestamp:ye()*1e3,startTimestamp:s,xhr:n,virtualError:i};Et("xhr",d)}};return"onreadystatechange"in n&&typeof n.onreadystatechange=="function"?n.onreadystatechange=new Proxy(n.onreadystatechange,{apply(u,d,l){return c(),u.apply(d,l)}}):n.addEventListener("readystatechange",c),n.setRequestHeader=new Proxy(n.setRequestHeader,{apply(u,d,l){const[p,f]=l,h=d[hn];return h&&Lt(p)&&Lt(f)&&(h.request_headers[p.toLowerCase()]=f),u.apply(d,l)}}),t.apply(n,r)}}),e.send=new Proxy(e.send,{apply(t,n,r){const i=n[hn];if(!i)return t.apply(n,r);r[0]!==void 0&&(i.body=r[0]);const s={startTimestamp:ye()*1e3,xhr:n};return Et("xhr",s),t.apply(n,r)}})}function Vx(e){if(Lt(e))return e;try{return e.toString()}catch{}}const Yx=Symbol.for("sentry__originalRequestBody");function Zy(e){return new URLSearchParams(e).toString()}function Ea(e,t=y){try{if(typeof e=="string")return[e];if(e instanceof URLSearchParams)return[e.toString()];if(e instanceof FormData)return[Zy(e)];if(!e)return[void 0]}catch(n){return Bt&&t.error(n,"Failed to serialize body",e),[void 0,"BODY_PARSE_ERROR"]}return Bt&&t.log("Skipping network body because of body type",e),[void 0,"UNPARSEABLE_BODY_TYPE"]}function kd(e=[]){if(e.length>=2&&e[1]&&typeof e[1]=="object"&&"body"in e[1])return e[1].body;if(e.length>=1&&e[0]instanceof Request){const n=e[0][Yx];return n!==void 0?n:void 0}}function eb(e){let t;try{t=e.getAllResponseHeaders()}catch(n){return Bt&&y.error(n,"Failed to get xhr response headers",e),{}}return t?t.split(`\r `).reduce((n,r)=>{const[i,s]=r.split(": ");return s&&(n[i.toLowerCase()]=s),n},{}):{}}const Kx=40;function Rd(e,t=wd("fetch")){let n=0,r=0;async function i(s){const o=s.body.length;n+=o,r++;const a={body:s.body,method:"POST",referrerPolicy:"strict-origin",headers:e.headers,keepalive:n<=6e4&&r<15,...e.fetchOptions};try{const 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 qx("fetch"),c}finally{n-=o,r--}}return __(e,i,Ql(e.bufferSize||Kx))}const A=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;function Jx(){const e=O();if(!e){A&&y.warn("No Sentry client available, profiling is not started");return}if(!e.getIntegrationByName("BrowserProfiling")){A&&y.warn("BrowserProfiling integration is not available");return}e.emit("startUIProfiler")}function Xx(){const e=O();if(!e){A&&y.warn("No Sentry client available, profiling is not started");return}if(!e.getIntegrationByName("BrowserProfiling")){A&&y.warn("ProfilingIntegration is not available");return}e.emit("stopUIProfiler")}const Qx={startProfiler:Jx,stopProfiler:Xx},Zx=10,eO=20,tO=30,nO=40,rO=50;function di(e,t,n,r){const i={filename:e,function:t===""?Qt:t,in_app:!0};return n!==void 0&&(i.lineno=n),r!==void 0&&(i.colno=r),i}const iO=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,sO=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,oO=/\((\S*)(?::(\d+))(?::(\d+))\)/,aO=/at (.+?) ?\(data:(.+?),/,cO=e=>{const t=e.match(aO);if(t)return{filename:``,function:t[1]};const n=iO.exec(e);if(n){const[,i,s,o]=n;return di(i,Qt,+s,+o)}const r=sO.exec(e);if(r){if(r[2]?.indexOf("eval")===0){const a=oO.exec(r[2]);a&&(r[2]=a[1],r[3]=a[2],r[4]=a[3])}const[s,o]=sb(r[1]||Qt,r[2]);return di(o,s,r[3]?+r[3]:void 0,r[4]?+r[4]:void 0)}},tb=[tO,cO],uO=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,lO=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,dO=e=>{const t=uO.exec(e);if(t){if(t[3]&&t[3].indexOf(" > eval")>-1){const s=lO.exec(t[3]);s&&(t[1]=t[1]||"eval",t[3]=s[1],t[4]=s[2],t[5]="")}let r=t[3],i=t[1]||Qt;return[i,r]=sb(i,r),di(r,i,t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}},nb=[rO,dO],fO=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:[-a-z]+):.*?):(\d+)(?::(\d+))?\)?\s*$/i,pO=e=>{const t=fO.exec(e);return t?di(t[2],t[1]||Qt,+t[3],t[4]?+t[4]:void 0):void 0},hO=[nO,pO],mO=/ line (\d+).*script (?:in )?(\S+)(?:: in function (\S+))?$/i,gO=e=>{const t=mO.exec(e);return t?di(t[2],t[3]||Qt,+t[1]):void 0},_O=[Zx,gO],yO=/ line (\d+), column (\d+)\s*(?:in (?:]+)>|([^)]+))\(.*\))? in (.*):\s*$/i,bO=e=>{const t=yO.exec(e);return t?di(t[5],t[3]||t[4]||Qt,+t[1],+t[2]):void 0},SO=[eO,bO],rb=[tb,nb],ib=Zm(...rb),sb=(e,t)=>{const n=e.indexOf("safari-extension")!==-1,r=e.indexOf("safari-web-extension")!==-1;return n||r?[e.indexOf("@")!==-1?e.split("@")[0]:Qt,n?`safari-extension:${t}`:`safari-web-extension:${t}`]:[e,t]};function vO(e,{metadata:t,tunnel:n,dsn:r}){const i={event_id:e.event_id,sent_at:new Date().toISOString(),...t?.sdk&&{sdk:{name:t.sdk.name,version:t.sdk.version}},...!!n&&!!r&&{dsn:sn(r)}},s=EO(e);return Ot(i,[s])}function EO(e){return[{type:"user_report"},e]}const ho=1024,TO="Breadcrumbs",wO=((e={})=>{const t={console:!0,dom:!0,fetch:!0,history:!0,sentry:!0,xhr:!0,...e};return{name:TO,setup(n){t.console&&ed(RO(n)),t.dom&&Qy(kO(n,t.dom)),t.xhr&&Id(AO(n)),t.fetch&&fd(CO(n)),t.history&&fc(xO(n)),t.sentry&&n.on("beforeSendEvent",IO(n))}}}),ob=wO;function IO(e){return function(n){O()===e&&Ut({category:`sentry.${n.type==="transaction"?"transaction":"event"}`,event_id:n.event_id,level:n.level,message:cr(n)},{event:n})}}function kO(e,t){return function(r){if(O()!==e)return;let i,s,o=typeof t=="object"?t.serializeAttribute:void 0,a=typeof t=="object"&&typeof t.maxStringLength=="number"?t.maxStringLength:void 0;a&&a>ho&&(A&&y.warn(`\`dom.maxStringLength\` cannot exceed ${ho}, but a value of ${a} was configured. Sentry will use ${ho} instead.`),a=ho),typeof o=="string"&&(o=[o]);try{const u=r.event,d=OO(u)?u.target:u;i=Be(d,{keyAttrs:o,maxStringLength:a}),s=Nl(d)}catch{i=""}if(i.length===0)return;const c={category:`ui.${r.name}`,message:i};s&&(c.data={"ui.component_name":s}),Ut(c,{event:r.event,name:r.name,global:r.global})}}function RO(e){return function(n){if(O()!==e)return;const r={category:"console",data:{arguments:n.args,logger:"console"},level:la(n.level),message:Zo(n.args," ")};if(n.level==="assert")if(n.args[0]===!1)r.message=`Assertion failed: ${Zo(n.args.slice(1)," ")||"console.assert"}`,r.data.arguments=n.args.slice(1);else return;Ut(r,{input:n.args,level:n.level})}}function AO(e){return function(n){if(O()!==e)return;const{startTimestamp:r,endTimestamp:i}=n,s=n.xhr[hn];if(!r||!i||!s)return;const{method:o,url:a,status_code:c,body:u}=s,d={method:o,url:a,status_code:c},l={xhr:n.xhr,input:u,startTimestamp:r,endTimestamp:i},p={category:"xhr",data:d,type:"http",level:dy(c)};e.emit("beforeOutgoingRequestBreadcrumb",p,l),Ut(p,l)}}function CO(e){return function(n){if(O()!==e)return;const{startTimestamp:r,endTimestamp:i}=n;if(i&&!(n.fetchData.url.match(/sentry_key/)&&n.fetchData.method==="POST"))if(n.error){const s={data:n.error,input:n.args,startTimestamp:r,endTimestamp:i},o={category:"fetch",data:n.fetchData,level:"error",type:"http"};e.emit("beforeOutgoingRequestBreadcrumb",o,s),Ut(o,s)}else{const s=n.response,o={...n.fetchData,status_code:s?.status},a={input:n.args,response:s,startTimestamp:r,endTimestamp:i},c={category:"fetch",data:o,type:"http",level:dy(o.status_code)};e.emit("beforeOutgoingRequestBreadcrumb",c,a),Ut(c,a)}}}function xO(e){return function(n){if(O()!==e)return;let r=n.from,i=n.to;const s=Bn(N.location.href);let o=r?Bn(r):void 0;const a=Bn(i);o?.path||(o=s),s.protocol===a.protocol&&s.host===a.host&&(i=a.relative),s.protocol===o.protocol&&s.host===o.host&&(r=o.relative),Ut({category:"navigation",data:{from:r,to:i}})}}function OO(e){return!!e&&!!e.target}const MO="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".split(","),NO="BrowserApiErrors",PO=((e={})=>{const t={XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0,unregisterOriginalCallbacks:!1,...e};return{name:NO,setupOnce(){t.setTimeout&&Ve(N,"setTimeout",oh),t.setInterval&&Ve(N,"setInterval",oh),t.requestAnimationFrame&&Ve(N,"requestAnimationFrame",LO),t.XMLHttpRequest&&"XMLHttpRequest"in N&&Ve(XMLHttpRequest.prototype,"send",DO);const n=t.eventTarget;n&&(Array.isArray(n)?n:MO).forEach(i=>FO(i,t))}}}),ab=PO;function oh(e){return function(...t){const n=t[0];return t[0]=li(n,{mechanism:{handled:!1,type:`auto.browser.browserapierrors.${Sn(e)}`}}),e.apply(this,t)}}function LO(e){return function(t){return e.apply(this,[li(t,{mechanism:{data:{handler:Sn(e)},handled:!1,type:"auto.browser.browserapierrors.requestAnimationFrame"}})])}}function DO(e){return function(...t){const n=this;return["onload","onerror","onprogress","onreadystatechange"].forEach(i=>{i in n&&typeof n[i]=="function"&&Ve(n,i,function(s){const o={mechanism:{data:{handler:Sn(s)},handled:!1,type:`auto.browser.browserapierrors.xhr.${i}`}},a=Pl(s);return a&&(o.mechanism.data.handler=Sn(a)),li(s,o)})}),e.apply(this,t)}}function FO(e,t){const r=N[e]?.prototype;r?.hasOwnProperty?.("addEventListener")&&(Ve(r,"addEventListener",function(i){return function(s,o,a){try{$O(o)&&(o.handleEvent=li(o.handleEvent,{mechanism:{data:{handler:Sn(o),target:e},handled:!1,type:"auto.browser.browserapierrors.handleEvent"}}))}catch{}return t.unregisterOriginalCallbacks&&UO(this,s,o),i.apply(this,[s,li(o,{mechanism:{data:{handler:Sn(o),target:e},handled:!1,type:"auto.browser.browserapierrors.addEventListener"}}),a])}}),Ve(r,"removeEventListener",function(i){return function(s,o,a){try{const c=o.__sentry_wrapped__;c&&i.call(this,s,c,a)}catch{}return i.call(this,s,o,a)}}))}function $O(e){return typeof e.handleEvent=="function"}function UO(e,t,n){e&&typeof e=="object"&&"removeEventListener"in e&&typeof e.removeEventListener=="function"&&e.removeEventListener(t,n)}const cb=(e={})=>{const t=e.lifecycle??"route";return{name:"BrowserSession",setupOnce(){if(typeof N.document>"u"){A&&y.warn("Using the `browserSessionIntegration` in non-browser environments is not supported.");return}Uu({ignoreDuration:!0}),No();const n=Oe();let r=n.getUser();n.addScopeListener(i=>{const s=i.getUser();(r?.id!==s?.id||r?.ip_address!==s?.ip_address)&&(No(),r=s)}),t==="route"&&fc(({from:i,to:s})=>{i!==s&&(Uu({ignoreDuration:!0}),No())})}}},BO="CultureContext",HO=(()=>({name:BO,preprocessEvent(e){const t=ah();t&&(e.contexts={...e.contexts,culture:{...t,...e.contexts?.culture}})},processSegmentSpan(e){const t=ah();t&&It(e,{"culture.locale":t.locale,"culture.timezone":t.timezone,"culture.calendar":t.calendar})}})),ub=HO;function ah(){try{const e=N.Intl;if(!e)return;const t=e.DateTimeFormat().resolvedOptions();return{locale:t.locale,timezone:t.timeZone,calendar:t.calendar}}catch{return}}const jO="GlobalHandlers",WO=((e={})=>{const t={onerror:!0,onunhandledrejection:!0,...e};return{name:jO,setupOnce(){Error.stackTraceLimit=50},setup(n){t.onerror&&(zO(n),ch("onerror")),t.onunhandledrejection&&(qO(n),ch("onunhandledrejection"))}}}),lb=WO;function zO(e){tg(t=>{const{stackParser:n,attachStacktrace:r}=pb();if(O()!==e||Ny())return;const{msg:i,url:s,line:o,column:a,error:c}=t,u=GO(sc(n,c||i,void 0,r,!1),s,o,a);u.level="error",wi(u,{originalException:c,mechanism:{handled:!1,type:"auto.browser.global_handlers.onerror"}})})}function qO(e){ng(t=>{const{stackParser:n,attachStacktrace:r}=pb();if(O()!==e||Ny())return;const i=db(t),s=vn(i)?fb(i):sc(n,i,void 0,r,!0);s.level="error",wi(s,{originalException:i,mechanism:{handled:!1,type:"auto.browser.global_handlers.onunhandledrejection"}})})}function db(e){if(vn(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 fb(e){return{exception:{values:[{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(e)}`}]}}}function GO(e,t,n,r){const i=e.exception=e.exception||{},s=i.values=i.values||[],o=s[0]=s[0]||{},a=o.stacktrace=o.stacktrace||{},c=a.frames=a.frames||[];return c.length===0&&c.push({colno:r,lineno:n,filename:VO(t)??xr(),function:Qt,in_app:!0}),e}function ch(e){A&&y.log(`Global Handler attached: ${e}`)}function pb(){return O()?.getOptions()||{stackParser:()=>[],attachStacktrace:!1}}function VO(e){if(!(!Lt(e)||e.length===0))return e.startsWith("data:")?`<${Hn(e,!1)}>`:e}const hb=()=>({name:"HttpContext",preprocessEvent(e){if(!N.navigator&&!N.location&&!N.document)return;const t=ga(),n={...t.headers,...e.request?.headers};e.request={...t,...e.request,headers:n}},processSegmentSpan(e){if(!N.navigator&&!N.location&&!N.document)return;const t=ga();It(e,{"url.full":t.url||void 0,"http.request.header.user_agent":t.headers["User-Agent"],"http.request.header.referer":t.headers.Referer})}}),YO="cause",KO=5,JO="LinkedErrors",XO=((e={})=>{const t=e.limit||KO,n=e.key||YO;return{name:JO,preprocessEvent(r,i,s){const o=s.getOptions();oI(ic,o.stackParser,n,t,r,i)}}}),mb=XO,QO="SpotlightBrowser",ZO=[{op:"ui.interaction.click",name:"#sentry-spotlight"}],eM=((e={})=>{const t=e.sidecarUrl||"http://localhost:8969/stream";return{name:QO,setup:()=>{A&&y.log("Using Sidecar URL",t)},beforeSetup(n){const r=n.getOptions();r.ignoreSpans=[...r.ignoreSpans||[],...ZO]},afterAllSetup:n=>{tM(n,t)}}});function tM(e,t){const n=wd("fetch");let r=0;e.on("beforeEnvelope",i=>{if(r>3){y.warn("[Spotlight] Disabled Sentry -> Spotlight integration due to too many failed requests:",r);return}n(t,{method:"POST",body:sa(i),headers:{"Content-Type":"application/x-sentry-envelope"},mode:"cors"}).then(s=>{s.status>=200&&s.status<400&&(r=0)},s=>{r++,y.error("Sentry SDK can't connect to Sidecar is it running? See: https://spotlightjs.com/sidecar/npx/",s)})})}const nM=eM;function rM(){return iM()?(A&&Cn(()=>{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 iM(){if(typeof N.window>"u")return!1;const e=N;if(e.nw||!(e.chrome||e.browser)?.runtime?.id)return!1;const n=xr();return!(N===N.top&&/^(?:chrome-extension|moz-extension|ms-browser-extension|safari-web-extension):\/\//.test(n))}function gb(e){return[x_(),A_(),pk(),ab(),ob(),lb(),mb(),L_(),hb(),ub(),cb()]}function sM(e={}){const t=!e.skipBrowserExtensionCheck&&rM();let n=e.defaultIntegrations==null?gb():e.defaultIntegrations;const r={...e,enabled:t?!1:e.enabled,stackParser:bE(e.stackParser||ib),integrations:nw({integrations:e.integrations,defaultIntegrations:n}),transport:e.transport||Rd};return Pw($y,r)}function oM(){}function aM(e){e()}function sl(e={}){const t=N.document,n=t?.head||t?.body;if(!n){A&&y.error("[showReportDialog] Global document not defined");return}const r=G(),s=O()?.getDsn();if(!s){A&&y.error("[showReportDialog] DSN not configured");return}const o={...e,user:{...r.getUser(),...e.user},eventId:e.eventId||n_()},a=N.document.createElement("script");a.async=!0,a.crossOrigin="anonymous",a.src=ew(s,o);const{onLoad:c,onClose:u}=o;if(c&&(a.onload=c),u){const d=l=>{if(l.data==="__sentry_reportdialog_closed__")try{u()}finally{N.removeEventListener("message",d)}};N.addEventListener("message",d)}n.appendChild(a)}const cM=H,uM="ReportingObserver",uh=new WeakMap,lM=((e={})=>{const t=e.types||["crash","deprecation","intervention"];function n(r){if(uh.has(O()))for(const i of r)at(s=>{s.setExtra("url",i.url);const o=`ReportingObserver [${i.type}]`;let a="No details available";if(i.body){const c={};for(const u in i.body)c[u]=i.body[u];if(s.setExtra("body",c),i.type==="crash"){const u=i.body;a=[u.crashId||"",u.reason||""].join(" ").trim()||a}else a=i.body.message||a}t_(`${o}: ${a}`)})}return{name:uM,setupOnce(){if(!UA())return;new cM.ReportingObserver(n,{buffered:!0,types:t}).observe()},setup(r){uh.set(r,!0)}}}),dM=lM,fM="HttpClient",pM=((e={})=>{const t={failedRequestStatusCodes:[[500,599]],failedRequestTargets:[/.*/],...e};return{name:fM,setup(n){EM(n,t),TM(n,t)}}}),hM=pM;function mM(e,t,n,r,i){if(yb(e,n.status,n.url)){const s=wM(t,r);let o,a,c,u;Sb()&&([o,c]=lh("Cookie",s),[a,u]=lh("Set-Cookie",n));const d=bb({url:s.url,method:s.method,status:n.status,requestHeaders:o,responseHeaders:a,requestCookies:c,responseCookies:u,error:i,type:"fetch"});wi(d)}}function lh(e,t){const n=yM(t.headers);let r;try{const i=n[e]||n[e.toLowerCase()]||void 0;i&&(r=_b(i))}catch{}return[n,r]}function gM(e,t,n,r,i){if(yb(e,t.status,t.responseURL)){let s,o,a;if(Sb()){try{const u=t.getResponseHeader("Set-Cookie")||t.getResponseHeader("set-cookie")||void 0;u&&(o=_b(u))}catch{}try{a=bM(t)}catch{}s=r}const c=bb({url:t.responseURL,method:n,status:t.status,requestHeaders:s,responseHeaders:a,responseCookies:o,error:i,type:"xhr"});wi(c)}}function _M(e){if(e){const t=e["Content-Length"]||e["content-length"];if(t)return parseInt(t,10)}}function _b(e){return e.split("; ").reduce((t,n)=>{const[r,i]=n.split("=");return r&&i&&(t[r]=i),t},{})}function yM(e){const t={};return e.forEach((n,r)=>{t[r]=n}),t}function bM(e){const t=e.getAllResponseHeaders();return t?t.split(`\r `).reduce((n,r)=>{const[i,s]=r.split(": ");return i&&s&&(n[i]=s),n},{}):{}}function SM(e,t){return e.some(n=>typeof n=="string"?t.includes(n):n.test(t))}function vM(e,t){return e.some(n=>typeof n=="number"?n===t:t>=n[0]&&t<=n[1])}function EM(e,t){fy()&&fd(n=>{if(O()!==e)return;const{response:r,args:i,error:s,virtualError:o}=n,[a,c]=i;r&&mM(t,a,r,c,s||o)},!1)}function TM(e,t){"XMLHttpRequest"in H&&Id(n=>{if(O()!==e)return;const{error:r,virtualError:i}=n,s=n.xhr,o=s[hn];if(!o)return;const{method:a,request_headers:c}=o;try{gM(t,s,a,c,r||i)}catch(u){A&&y.warn("Error while extracting response event form XHR response",u)}})}function yb(e,t,n){return vM(e.failedRequestStatusCodes,t)&&SM(e.failedRequestTargets,n)&&!I_(n,O())}function bb(e){const t=O(),n=t&&e.error&&e.error instanceof Error?e.error.stack:void 0,r=n&&t?t.getOptions().stackParser(n,0,1):void 0,i=`HTTP Client Error with status code: ${e.status}`,s={message:i,exception:{values:[{type:"Error",value:i,stacktrace:r?{frames:r}:void 0}]},request:{url:e.url,method:e.method,headers:e.requestHeaders,cookies:e.requestCookies},contexts:{response:{status_code:e.status,headers:e.responseHeaders,cookies:e.responseCookies,body_size:_M(e.responseHeaders)}}};return Tn(s,{type:`auto.http.client.${e.type}`,handled:!1}),s}function wM(e,t){return!t&&e instanceof Request||e instanceof Request&&e.bodyUsed?e:new Request(e,t)}function Sb(){const e=O();return e?!!e.getOptions().sendDefaultPii:!1}const iu=H,IM=7,kM="ContextLines",RM=((e={})=>{const t=e.frameContextLines!=null?e.frameContextLines:IM;return{name:kM,processEvent(n){return CM(n,t)}}}),AM=RM;function CM(e,t){const n=iu.document,r=iu.location&&oa(iu.location.href);if(!n||!r)return e;const i=e.exception?.values;if(!i?.length)return e;const s=n.documentElement.innerHTML;if(!s)return e;const o=["","",...s.split(` `),""];return i.forEach(a=>{const c=a.stacktrace;c?.frames&&(c.frames=c.frames.map(u=>xM(u,o,r,t)))}),e}function xM(e,t,n,r){return e.filename!==n||!e.lineno||!t.length||NE(t,e,r),e}const OM="GraphQLClient",MM=(e=>({name:OM,setup(t){NM(t,e),PM(t,e)}}));function NM(e,t){e.on("beforeOutgoingRequestSpan",(n,r)=>{const s=B(n).data||{};if(!(s[oe]==="http.client"))return;const c=s[uT]||s["http.url"]||s.url,u=s[cT]||s["http.method"];if(!Lt(c)||!Lt(u))return;const{endpoints:d}=t,l=Tt(c,d),p=Eb(r);if(l&&p){const f=Tb(p);if(f){const h=vb(f);n.updateName(`${u} ${c} (${h})`),pc(f)&&n.setAttribute("graphql.document",f.query),hc(f)&&(n.setAttribute("graphql.persisted_query.hash.sha256",f.extensions.persistedQuery.sha256Hash),n.setAttribute("graphql.persisted_query.version",f.extensions.persistedQuery.version))}}})}function PM(e,t){e.on("beforeOutgoingRequestBreadcrumb",(n,r)=>{const{category:i,type:s,data:o}=n;if(s==="http"&&(i==="fetch"||i==="xhr")){const d=o?.url,{endpoints:l}=t,p=Tt(d,l),f=Eb(r);if(p&&o&&f){const h=Tb(f);if(!o.graphql&&h){const m=vb(h);o["graphql.operation"]=m,pc(h)&&(o["graphql.document"]=h.query),hc(h)&&(o["graphql.persisted_query.hash.sha256"]=h.extensions.persistedQuery.sha256Hash,o["graphql.persisted_query.version"]=h.extensions.persistedQuery.version)}}}})}function vb(e){if(hc(e))return`persisted ${e.operationName}`;if(pc(e)){const{query:t,operationName:n}=e,{operationName:r=n,operationType:i}=LM(t);return r?`${i} ${r}`:`${i}`}return"unknown"}function Eb(e){const t="xhr"in e;let n;if(t){const r=e.xhr[hn];n=r&&Ea(r.body)[0]}else{const r=kd(e.input);n=Ea(r)[0]}return n}function LM(e){const t=/^(?:\s*)(query|mutation|subscription)(?:\s*)(\w+)(?:\s*)[{(]/,n=/^(?:\s*)(query|mutation|subscription)(?:\s*)[{(]/,r=e.match(t);if(r)return{operationType:r[1],operationName:r[2]};const i=e.match(n);return i?{operationType:i[1],operationName:void 0}:{operationType:void 0,operationName:void 0}}function qo(e){return typeof e=="object"&&e!==null}function pc(e){return qo(e)&&typeof e.query=="string"}function hc(e){return qo(e)&&typeof e.operationName=="string"&&qo(e.extensions)&&qo(e.extensions.persistedQuery)&&typeof e.extensions.persistedQuery.sha256Hash=="string"&&typeof e.extensions.persistedQuery.version=="number"}function Tb(e){try{const t=JSON.parse(e);return pc(t)||hc(t)?t:void 0}catch{return}}const DM=MM,FM=(e={})=>{const t=["script"];function n(r,i,s=0){if(!r)return;const o="shadowRoot"in r&&r.shadowRoot?r.shadowRoot.children:r.children;for(const a of o){if(!(a instanceof HTMLElement))continue;const c=Nl(a,1)||void 0,u=a.tagName.toLowerCase();if(t.includes(u))continue;const d=e.onElement?.({element:a,componentName:c,tagName:u,depth:s})||{};if(d==="skip")continue;if(d==="children"){n(a,i,s+1);continue}const{x:l,y:p,width:f,height:h}=a.getBoundingClientRect(),m={identifier:a.id||void 0,type:c||u,visible:!0,alpha:1,height:h,width:f,x:l,y:p,...d},g=[];m.children=g,n(a,m.children,s+1),i.push(m)}}return{name:"ViewHierarchy",processEvent:(r,i)=>{if(r.type!==void 0||e.shouldAttach?.(r,i)===!1)return r;const s={rendering_system:"DOM",positioning:"absolute",windows:[]};n(e.rootElement?.()||N.document.body,s.windows);const o={filename:"view-hierarchy.json",attachmentType:"event.view_hierarchy",contentType:"application/json",data:JSON.stringify(s)};return i.attachments=i.attachments||[],i.attachments.push(o),r}}},Te=H,Ad="sentryReplaySession",$M="replay_event",Cd="Unable to send Replay",UM=3e5,BM=9e5,HM=5e3,jM=5500,WM=6e4,zM=5e3,qM=3,dh=15e4,mo=5e3,GM=3e3,VM=300,xd=2e7,YM=4999,KM=5e4,fh=36e5;var JM=Object.defineProperty,XM=(e,t,n)=>t in e?JM(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ph=(e,t,n)=>XM(e,typeof t!="symbol"?t+"":t,n),Pe=(e=>(e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment",e))(Pe||{});function QM(e){return e.nodeType===e.ELEMENT_NODE}function rs(e){return e?.host?.shadowRoot===e}function is(e){return Object.prototype.toString.call(e)==="[object ShadowRoot]"}function ZM(e){return e.includes(" background-clip: text;")&&!e.includes(" -webkit-background-clip: text;")&&(e=e.replace(/\sbackground-clip:\s*text;/g," -webkit-background-clip: text; background-clip: text;")),e}function eN(e){const{cssText:t}=e;if(t.split('"').length<3)return t;const n=["@import",`url(${JSON.stringify(e.href)})`];return e.layerName===""?n.push("layer"):e.layerName&&n.push(`layer(${e.layerName})`),e.supportsText&&n.push(`supports(${e.supportsText})`),e.media.length&&n.push(e.media.mediaText),n.join(" ")+";"}function Ta(e){try{const t=e.rules||e.cssRules;return t?ZM(Array.from(t,wb).join("")):null}catch{return null}}function tN(e){let t="";for(let n=0;nthis.removeNodeFromMap(r))}has(t){return this.idNodeMap.has(t)}hasNode(t){return this.nodeMetaMap.has(t)}add(t,n){const r=n.id;this.idNodeMap.set(r,t),this.nodeMetaMap.set(t,n)}replace(t,n){const r=this.getNode(t);if(r){const i=this.nodeMetaMap.get(r);i&&this.nodeMetaMap.set(n,i)}this.idNodeMap.set(t,n)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}};function sN(){return new Ib}function mc({maskInputOptions:e,tagName:t,type:n}){return t==="OPTION"&&(t="SELECT"),!!(e[t.toLowerCase()]||n&&e[n]||n==="password"||t==="INPUT"&&!n&&e.text)}function gs({isMasked:e,element:t,value:n,maskInputFn:r}){let i=n||"";return e?(r&&(i=r(i,t)),"*".repeat(i.length)):i}function fi(e){return e.toLowerCase()}function ol(e){return e.toUpperCase()}const hh="__rrweb_original__";function oN(e){const t=e.getContext("2d");if(!t)return!0;const n=50;for(let r=0;rc!==0))return!1}return!0}function Od(e){const t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?fi(t):null}function wa(e,t,n){return t==="INPUT"&&(n==="radio"||n==="checkbox")?e.getAttribute("value")||"":e.value}function kb(e,t){let n;try{n=new URL(e,t??window.location.href)}catch{return null}const r=/\.([0-9a-z]+)(?:$)/i;return n.pathname.match(r)?.[1]??null}const mh={};function Rb(e){const t=mh[e];if(t)return t;const n=window.document;let r=window[e];if(n&&typeof n.createElement=="function")try{const i=n.createElement("iframe");i.hidden=!0,n.head.appendChild(i);const s=i.contentWindow;s&&s[e]&&(r=s[e]),n.head.removeChild(i)}catch{}return mh[e]=r.bind(window)}function al(...e){return Rb("setTimeout")(...e)}function Ab(...e){return Rb("clearTimeout")(...e)}function Cb(e){try{return e.contentDocument}catch{}}function aN(e){try{return e.contentWindow}catch{}}let cN=1;const uN=new RegExp("[^a-z0-9-_:]"),_s=-2;function Md(){return cN++}function lN(e){if(e instanceof HTMLFormElement)return"form";const t=fi(e.tagName);return uN.test(t)?"div":t}function dN(e){let t="";return e.indexOf("//")>-1?t=e.split("/").slice(0,3).join("/"):t=e.split("/")[0],t=t.split("?")[0],t}let Br,gh;const fN=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,pN=/^(?:[a-z+]+:)?\/\//i,hN=/^www\..*/i,mN=/^(data:)([^,]*),(.*)/i;function gN(e,t){if(!e||t.size===0)return e;try{const n=e.split(";"),r=[];for(let i of n){if(i=i.trim(),!i)continue;const s=i.indexOf(":");if(s===-1){r.push(i);continue}const o=i.slice(0,s).trim();t.has(o)||r.push(i)}return r.join("; ")+(r.length>0&&e.endsWith(";")?";":"")}catch(n){return console.warn("Error filtering CSS properties:",n),e}}function Ia(e,t){return(e||"").replace(fN,(n,r,i,s,o,a)=>{const c=i||o||a,u=r||s||"";if(!c)return n;if(pN.test(c)||hN.test(c))return`url(${u}${c}${u})`;if(mN.test(c))return`url(${u}${c}${u})`;if(c[0]==="/")return`url(${u}${dN(t)+c}${u})`;const d=t.split("/"),l=c.split("/");d.pop();for(const p of l)p!=="."&&(p===".."?d.pop():d.push(p));return`url(${u}${d.join("/")}${u})`})}const _N=/^[^ \t\n\r\u000c]+/,yN=/^[, \t\n\r\u000c]+/;function bN(e,t){if(t.trim()==="")return t;let n=0;function r(s){let o;const a=s.exec(t.substring(n));return a?(o=a[0],n+=o.length,o):""}const i=[];for(;r(yN),!(n>=t.length);){let s=r(_N);if(s.slice(-1)===",")s=Gr(e,s.substring(0,s.length-1)),i.push(s);else{let o="";s=Gr(e,s);let a=!1;for(;;){const c=t.charAt(n);if(c===""){i.push((s+o).trim());break}else if(a)c===")"&&(a=!1);else if(c===","){n+=1,i.push((s+o).trim());break}else c==="("&&(a=!0);o+=c,n+=1}}}return i.join(", ")}const _h=new WeakMap;function Gr(e,t){return!t||t.trim()===""?t:gc(e,t)}function SN(e){return!!(e.tagName==="svg"||e.ownerSVGElement)}function gc(e,t){let n=_h.get(e);if(n||(n=e.createElement("a"),_h.set(e,n)),!t)t="";else if(t.startsWith("blob:")||t.startsWith("data:"))return t;return n.setAttribute("href",t),n.href}function xb(e,t,n,r,i,s,o){if(!r)return r;if(n==="src"||n==="href"&&!(t==="use"&&r[0]==="#"))return Gr(e,r);if(n==="xlink:href"&&r[0]!=="#")return Gr(e,r);if(n==="background"&&(t==="table"||t==="td"||t==="th"))return Gr(e,r);if(n==="srcset")return bN(e,r);if(n==="style"){let a=Ia(r,gc(e));return o&&o.size>0&&(a=gN(a,o)),a}else if(t==="object"&&n==="data")return Gr(e,r);return typeof s=="function"?s(n,r,i):r}function Ob(e,t,n){return(e==="video"||e==="audio")&&t==="autoplay"}function vN(e,t,n,r){try{if(r&&e.matches(r))return!1;if(typeof t=="string"){if(e.classList.contains(t))return!0}else for(let i=e.classList.length;i--;){const s=e.classList[i];if(t.test(s))return!0}if(n)return e.matches(n)}catch{}return!1}function EN(e,t){for(let n=e.classList.length;n--;){const r=e.classList[n];if(t.test(r))return!0}return!1}function fr(e,t,n=1/0,r=0){return!e||e.nodeType!==e.ELEMENT_NODE||r>n?-1:t(e)?r:fr(e.parentNode,t,n,r+1)}function Vr(e,t){return n=>{const r=n;if(r===null)return!1;try{if(e){if(typeof e=="string"){if(r.matches(`.${e}`))return!0}else if(EN(r,e))return!0}return!!(t&&r.matches(t))}catch{return!1}}}function pi(e,t,n,r,i,s){try{const o=e.nodeType===e.ELEMENT_NODE?e:e.parentElement;if(o===null)return!1;if(o.tagName==="INPUT"){const u=o.getAttribute("autocomplete");if(["current-password","new-password","cc-number","cc-exp","cc-exp-month","cc-exp-year","cc-csc"].includes(u))return!0}let a=-1,c=-1;if(s){if(c=fr(o,Vr(r,i)),c<0)return!0;a=fr(o,Vr(t,n),c>=0?c:1/0)}else{if(a=fr(o,Vr(t,n)),a<0)return!1;c=fr(o,Vr(r,i),a>=0?a:1/0)}return a>=0?c>=0?a<=c:!0:c>=0?!1:!!s}catch{}return!!s}function TN(e,t,n){const r=aN(e);if(!r)return;let i=!1,s;try{s=r.document.readyState}catch{return}if(s!=="complete"){const a=al(()=>{i||(t(),i=!0)},n);e.addEventListener("load",()=>{Ab(a),i=!0,t()});return}const o="about:blank";if(r.location.href!==o||e.src===o||e.src==="")return al(t,0),e.addEventListener("load",t);e.addEventListener("load",t)}function wN(e,t,n){let r=!1,i;try{i=e.sheet}catch{i=null}if(i)return;const s=al(()=>{r||(t(),r=!0)},n);e.addEventListener("load",()=>{Ab(s),r=!0,t()})}function IN(e,t){const{doc:n,mirror:r,blockClass:i,blockSelector:s,unblockSelector:o,maskAllText:a,maskAttributeFn:c,maskTextClass:u,unmaskTextClass:d,maskTextSelector:l,unmaskTextSelector:p,inlineStylesheet:f,maskInputOptions:h={},maskTextFn:m,maskInputFn:g,dataURLOptions:_={},inlineImages:S,recordCanvas:E,keepIframeSrcFn:v,newlyAddedElement:w=!1,ignoreCSSAttributes:T}=t,b=kN(n,r);switch(e.nodeType){case e.DOCUMENT_NODE:return e.compatMode!=="CSS1Compat"?{type:Pe.Document,childNodes:[],compatMode:e.compatMode}:{type:Pe.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:Pe.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:b};case e.ELEMENT_NODE:return AN(e,{doc:n,blockClass:i,blockSelector:s,unblockSelector:o,inlineStylesheet:f,maskAttributeFn:c,maskInputOptions:h,maskInputFn:g,dataURLOptions:_,inlineImages:S,recordCanvas:E,keepIframeSrcFn:v,newlyAddedElement:w,rootId:b,maskTextClass:u,unmaskTextClass:d,maskTextSelector:l,unmaskTextSelector:p,ignoreCSSAttributes:T});case e.TEXT_NODE:return RN(e,{doc:n,maskAllText:a,maskTextClass:u,unmaskTextClass:d,maskTextSelector:l,unmaskTextSelector:p,maskTextFn:m,maskInputOptions:h,maskInputFn:g,rootId:b});case e.CDATA_SECTION_NODE:return{type:Pe.CDATA,textContent:"",rootId:b};case e.COMMENT_NODE:return{type:Pe.Comment,textContent:e.textContent||"",rootId:b};default:return!1}}function kN(e,t){if(!t.hasNode(e))return;const n=t.getId(e);return n===1?void 0:n}function RN(e,t){const{maskAllText:n,maskTextClass:r,unmaskTextClass:i,maskTextSelector:s,unmaskTextSelector:o,maskTextFn:a,maskInputOptions:c,maskInputFn:u,rootId:d}=t,l=e.parentNode&&e.parentNode.tagName;let p=e.textContent;const f=l==="STYLE"?!0:void 0,h=l==="SCRIPT"?!0:void 0,m=l==="TEXTAREA"?!0:void 0;if(f&&p){try{e.nextSibling||e.previousSibling||e.parentNode.sheet?.cssRules&&(p=Ta(e.parentNode.sheet))}catch(_){console.warn(`Cannot get CSS styles from text's parentNode. Error: ${_}`,e)}p=Ia(p,gc(t.doc))}h&&(p="SCRIPT_PLACEHOLDER");const g=pi(e,r,s,i,o,n);if(!f&&!h&&!m&&p&&g&&(p=a?a(p,e.parentElement):p.replace(/[\S]/g,"*")),m&&p&&(c.textarea||g)&&(p=u?u(p,e.parentNode):p.replace(/[\S]/g,"*")),l==="OPTION"&&p){const _=mc({type:null,tagName:l,maskInputOptions:c});p=gs({isMasked:pi(e,r,s,i,o,_),element:e,value:p,maskInputFn:u})}return{type:Pe.Text,textContent:p||"",isStyle:f,rootId:d}}function AN(e,t){const{doc:n,blockClass:r,blockSelector:i,unblockSelector:s,inlineStylesheet:o,maskInputOptions:a={},maskAttributeFn:c,maskInputFn:u,dataURLOptions:d={},inlineImages:l,recordCanvas:p,keepIframeSrcFn:f,newlyAddedElement:h=!1,rootId:m,maskTextClass:g,unmaskTextClass:_,maskTextSelector:S,unmaskTextSelector:E,ignoreCSSAttributes:v}=t,w=vN(e,r,i,s),T=lN(e);let b={};const I=e.attributes.length;for(let k=0;kx.href===e.href);let D=null;k&&(D=Ta(k)),D&&(b.rel=null,b.href=null,b.crossorigin=null,b._cssText=Ia(D,k.href))}if(T==="style"&&e.sheet&&!(e.innerText||e.textContent||"").trim().length){const k=Ta(e.sheet);k&&(b._cssText=Ia(k,gc(n)))}if(T==="input"||T==="textarea"||T==="select"||T==="option"){const k=e,D=Od(k),x=wa(k,ol(T),D),L=k.checked;if(D!=="submit"&&D!=="button"&&x){const F=pi(k,g,S,_,E,mc({type:D,tagName:ol(T),maskInputOptions:a}));b.value=gs({isMasked:F,element:k,value:x,maskInputFn:u})}L&&(b.checked=L)}if(T==="option"&&(e.selected&&!a.select?b.selected=!0:delete b.selected),T==="canvas"&&p){if(e.__context==="2d")oN(e)||(b.rr_dataURL=e.toDataURL(d.type,d.quality));else if(!("__context"in e)){const k=e.toDataURL(d.type,d.quality),D=n.createElement("canvas");D.width=e.width,D.height=e.height;const x=D.toDataURL(d.type,d.quality);k!==x&&(b.rr_dataURL=k)}}if(T==="img"&&l){Br||(Br=n.createElement("canvas"),gh=Br.getContext("2d"));const k=e,D=k.currentSrc||k.getAttribute("src")||"",x=k.crossOrigin,L=()=>{k.removeEventListener("load",L);try{Br.width=k.naturalWidth,Br.height=k.naturalHeight,gh.drawImage(k,0,0),b.rr_dataURL=Br.toDataURL(d.type,d.quality)}catch(F){if(k.crossOrigin!=="anonymous"){k.crossOrigin="anonymous",k.complete&&k.naturalWidth!==0?L():k.addEventListener("load",L);return}else console.warn(`Cannot inline img src=${D}! Error: ${F}`)}k.crossOrigin==="anonymous"&&(x?b.crossOrigin=x:k.removeAttribute("crossorigin"))};k.complete&&k.naturalWidth!==0?L():k.addEventListener("load",L)}if((T==="audio"||T==="video")&&(b.rr_mediaState=e.paused?"paused":"played",b.rr_mediaCurrentTime=e.currentTime),h||(e.scrollLeft&&(b.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(b.rr_scrollTop=e.scrollTop)),w){const{width:k,height:D}=e.getBoundingClientRect();b={class:b.class,rr_width:`${k}px`,rr_height:`${D}px`}}T==="iframe"&&!f(b.src)&&(!w&&!Cb(e)&&(b.rr_src=b.src),delete b.src);let M;try{customElements.get(T)&&(M=!0)}catch{}return{type:Pe.Element,tagName:T,attributes:b,childNodes:[],isSVG:SN(e)||void 0,needBlock:w,rootId:m,isCustom:M}}function Ee(e){return e==null?"":e.toLowerCase()}function CN(e,t){if(t.comment&&e.type===Pe.Comment)return!0;if(e.type===Pe.Element){if(t.script&&(e.tagName==="script"||e.tagName==="link"&&(e.attributes.rel==="preload"||e.attributes.rel==="modulepreload")||e.tagName==="link"&&e.attributes.rel==="prefetch"&&typeof e.attributes.href=="string"&&kb(e.attributes.href)==="js"))return!0;if(t.headFavicon&&(e.tagName==="link"&&e.attributes.rel==="shortcut icon"||e.tagName==="meta"&&(Ee(e.attributes.name).match(/^msapplication-tile(image|color)$/)||Ee(e.attributes.name)==="application-name"||Ee(e.attributes.rel)==="icon"||Ee(e.attributes.rel)==="apple-touch-icon"||Ee(e.attributes.rel)==="shortcut icon")))return!0;if(e.tagName==="meta"){if(t.headMetaDescKeywords&&Ee(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(Ee(e.attributes.property).match(/^(og|twitter|fb):/)||Ee(e.attributes.name).match(/^(og|twitter):/)||Ee(e.attributes.name)==="pinterest"))return!0;if(t.headMetaRobots&&(Ee(e.attributes.name)==="robots"||Ee(e.attributes.name)==="googlebot"||Ee(e.attributes.name)==="bingbot"))return!0;if(t.headMetaHttpEquiv&&e.attributes["http-equiv"]!==void 0)return!0;if(t.headMetaAuthorship&&(Ee(e.attributes.name)==="author"||Ee(e.attributes.name)==="generator"||Ee(e.attributes.name)==="framework"||Ee(e.attributes.name)==="publisher"||Ee(e.attributes.name)==="progid"||Ee(e.attributes.property).match(/^article:/)||Ee(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&(Ee(e.attributes.name)==="google-site-verification"||Ee(e.attributes.name)==="yandex-verification"||Ee(e.attributes.name)==="csrf-token"||Ee(e.attributes.name)==="p:domain_verify"||Ee(e.attributes.name)==="verify-v1"||Ee(e.attributes.name)==="verification"||Ee(e.attributes.name)==="shopify-checkout-api-token"))return!0}}return!1}function Yr(e,t){const{doc:n,mirror:r,blockClass:i,blockSelector:s,unblockSelector:o,maskAllText:a,maskTextClass:c,unmaskTextClass:u,maskTextSelector:d,unmaskTextSelector:l,skipChild:p=!1,inlineStylesheet:f=!0,maskInputOptions:h={},maskAttributeFn:m,maskTextFn:g,maskInputFn:_,slimDOMOptions:S,dataURLOptions:E={},inlineImages:v=!1,recordCanvas:w=!1,onSerialize:T,onIframeLoad:b,iframeLoadTimeout:I=5e3,onBlockedImageLoad:M,onStylesheetLoad:k,stylesheetLoadTimeout:D=5e3,keepIframeSrcFn:x=()=>!1,newlyAddedElement:L=!1,ignoreCSSAttributes:F}=t;let{preserveWhiteSpace:Z=!0}=t;const Y=IN(e,{doc:n,mirror:r,blockClass:i,blockSelector:s,maskAllText:a,unblockSelector:o,maskTextClass:c,unmaskTextClass:u,maskTextSelector:d,unmaskTextSelector:l,inlineStylesheet:f,maskInputOptions:h,maskAttributeFn:m,maskTextFn:g,maskInputFn:_,dataURLOptions:E,inlineImages:v,recordCanvas:w,keepIframeSrcFn:x,newlyAddedElement:L,ignoreCSSAttributes:F});if(!Y)return console.warn(e,"not serialized"),null;let ne;r.hasNode(e)?ne=r.getId(e):CN(Y,S)||!Z&&Y.type===Pe.Text&&!Y.isStyle&&!Y.textContent.trim().length?ne=_s:ne=Md();const R=Object.assign(Y,{id:ne});if(r.add(e,R),ne===_s)return null;T&&T(e);let j=!p;if(R.type===Pe.Element){j=j&&!R.needBlock;const P=e.shadowRoot;P&&is(P)&&(R.isShadowHost=!0)}if((R.type===Pe.Document||R.type===Pe.Element)&&j){S.headWhitespace&&R.type===Pe.Element&&R.tagName==="head"&&(Z=!1);const P={doc:n,mirror:r,blockClass:i,blockSelector:s,maskAllText:a,unblockSelector:o,maskTextClass:c,unmaskTextClass:u,maskTextSelector:d,unmaskTextSelector:l,skipChild:p,inlineStylesheet:f,maskInputOptions:h,maskAttributeFn:m,maskTextFn:g,maskInputFn:_,slimDOMOptions:S,dataURLOptions:E,inlineImages:v,recordCanvas:w,preserveWhiteSpace:Z,onSerialize:T,onIframeLoad:b,iframeLoadTimeout:I,onBlockedImageLoad:M,onStylesheetLoad:k,stylesheetLoadTimeout:D,keepIframeSrcFn:x,ignoreCSSAttributes:F},U=e.childNodes?Array.from(e.childNodes):[];for(const re of U){const ee=Yr(re,P);ee&&R.childNodes.push(ee)}if(QM(e)&&e.shadowRoot)for(const re of Array.from(e.shadowRoot.childNodes)){const ee=Yr(re,P);ee&&(is(e.shadowRoot)&&(ee.isShadow=!0),R.childNodes.push(ee))}}if(e.parentNode&&rs(e.parentNode)&&is(e.parentNode)&&(R.isShadow=!0),R.type===Pe.Element&&R.tagName==="iframe"&&!R.needBlock&&TN(e,()=>{const P=Cb(e);if(P&&b){const U=Yr(P,{doc:P,mirror:r,blockClass:i,blockSelector:s,unblockSelector:o,maskAllText:a,maskTextClass:c,unmaskTextClass:u,maskTextSelector:d,unmaskTextSelector:l,skipChild:!1,inlineStylesheet:f,maskInputOptions:h,maskAttributeFn:m,maskTextFn:g,maskInputFn:_,slimDOMOptions:S,dataURLOptions:E,inlineImages:v,recordCanvas:w,preserveWhiteSpace:Z,onSerialize:T,onIframeLoad:b,iframeLoadTimeout:I,onStylesheetLoad:k,stylesheetLoadTimeout:D,keepIframeSrcFn:x,ignoreCSSAttributes:F});U&&b(e,U)}},I),R.type===Pe.Element&&R.tagName==="img"&&!e.complete&&R.needBlock){const P=e,U=()=>{if(P.isConnected&&!P.complete&&M)try{const re=P.getBoundingClientRect();re.width>0&&re.height>0&&M(P,R,re)}catch{}P.removeEventListener("load",U)};P.isConnected&&P.addEventListener("load",U)}return R.type===Pe.Element&&R.tagName==="link"&&typeof R.attributes.rel=="string"&&(R.attributes.rel==="stylesheet"||R.attributes.rel==="preload"&&typeof R.attributes.href=="string"&&kb(R.attributes.href)==="css")&&wN(e,()=>{if(k){const P=Yr(e,{doc:n,mirror:r,blockClass:i,blockSelector:s,unblockSelector:o,maskAllText:a,maskTextClass:c,unmaskTextClass:u,maskTextSelector:d,unmaskTextSelector:l,skipChild:!1,inlineStylesheet:f,maskInputOptions:h,maskAttributeFn:m,maskTextFn:g,maskInputFn:_,slimDOMOptions:S,dataURLOptions:E,inlineImages:v,recordCanvas:w,preserveWhiteSpace:Z,onSerialize:T,onIframeLoad:b,iframeLoadTimeout:I,onStylesheetLoad:k,stylesheetLoadTimeout:D,keepIframeSrcFn:x,ignoreCSSAttributes:F});P&&k(e,P)}},D),R.type===Pe.Element&&delete R.needBlock,R}function xN(e,t){const{mirror:n=new Ib,blockClass:r="rr-block",blockSelector:i=null,unblockSelector:s=null,maskAllText:o=!1,maskTextClass:a="rr-mask",unmaskTextClass:c=null,maskTextSelector:u=null,unmaskTextSelector:d=null,inlineStylesheet:l=!0,inlineImages:p=!1,recordCanvas:f=!1,maskAllInputs:h=!1,maskAttributeFn:m,maskTextFn:g,maskInputFn:_,slimDOM:S=!1,dataURLOptions:E,preserveWhiteSpace:v,onSerialize:w,onIframeLoad:T,iframeLoadTimeout:b,onBlockedImageLoad:I,onStylesheetLoad:M,stylesheetLoadTimeout:k,keepIframeSrcFn:D=()=>!1,ignoreCSSAttributes:x=new Set([])}=t||{};return Yr(e,{doc:e,mirror:n,blockClass:r,blockSelector:i,unblockSelector:s,maskAllText:o,maskTextClass:a,unmaskTextClass:c,maskTextSelector:u,unmaskTextSelector:d,skipChild:!1,inlineStylesheet:l,maskInputOptions:h===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0}:h===!1?{}:h,maskAttributeFn:m,maskTextFn:g,maskInputFn:_,slimDOMOptions:S===!0||S==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:S==="all",headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:S===!1?{}:S,dataURLOptions:E,inlineImages:p,recordCanvas:f,preserveWhiteSpace:v,onSerialize:w,onIframeLoad:T,iframeLoadTimeout:b,onBlockedImageLoad:I,onStylesheetLoad:M,stylesheetLoadTimeout:k,keepIframeSrcFn:D,newlyAddedElement:!1,ignoreCSSAttributes:x})}function Nd(e){try{return e.contentDocument}catch{}}function ys(e){try{return e.contentWindow}catch{}}function it(e,t,n=document){const r={capture:!0,passive:!0};return n.addEventListener(e,t,r),()=>n.removeEventListener(e,t,r)}const jr=`Please stop import mirror directly. Instead of that,\r now you can use replayer.getMirror() to access the mirror instance of a replayer,\r or you can use record.mirror to access the mirror instance during recording.`;let yh={map:{},getId(){return console.error(jr),-1},getNode(){return console.error(jr),null},removeNodeFromMap(){console.error(jr)},has(){return console.error(jr),!1},reset(){console.error(jr)}};typeof window<"u"&&window.Proxy&&window.Reflect&&(yh=new Proxy(yh,{get(e,t,n){return t==="map"&&console.error(jr),Reflect.get(e,t,n)}}));function bs(e,t,n={}){let r=null,i=0;return function(...s){const o=Date.now();!i&&n.leading===!1&&(i=o);const a=t-(o-i),c=this;a<=0||a>t?(r&&(FN(r),r=null),i=o,e.apply(c,s)):!r&&n.trailing!==!1&&(r=_c(()=>{i=n.leading===!1?0:Date.now(),r=null,e.apply(c,s)},a))}}function Mb(e,t,n,r,i=window){const s=i.Object.getOwnPropertyDescriptor(e,t);return i.Object.defineProperty(e,t,r?n:{set(o){_c(()=>{n.set.call(this,o)},0),s&&s.set&&s.set.call(this,o)}}),()=>Mb(e,t,s||{},!0)}function Pd(e,t,n){try{if(!(t in e))return()=>{};const r=e[t],i=n(r);return typeof i=="function"&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__rrweb_original__:{enumerable:!1,value:r}})),e[t]=i,()=>{e[t]=r}}catch{return()=>{}}}let ka=Date.now;/[1-9][0-9]{12}/.test(Date.now().toString())||(ka=()=>new Date().getTime());function Nb(e){const t=e.document;return{left:t.scrollingElement?t.scrollingElement.scrollLeft:e.pageXOffset!==void 0?e.pageXOffset:t?.documentElement.scrollLeft||t?.body?.parentElement?.scrollLeft||t?.body?.scrollLeft||0,top:t.scrollingElement?t.scrollingElement.scrollTop:e.pageYOffset!==void 0?e.pageYOffset:t?.documentElement.scrollTop||t?.body?.parentElement?.scrollTop||t?.body?.scrollTop||0}}function Pb(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function Lb(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function Db(e){if(!e)return null;try{return e.nodeType===e.ELEMENT_NODE?e:e.parentElement}catch{return null}}function ft(e,t,n,r,i){if(!e)return!1;const s=Db(e);if(!s)return!1;const o=Vr(t,n);if(!i){const u=r&&s.matches(r);return o(s)&&!u}const a=fr(s,o);let c=-1;return a<0?!1:(r&&(c=fr(s,Vr(null,r))),a>-1&&c<0?!0:a{let n=t[0];if(!(0 in t))throw new TypeError("1 argument is required");do if(this===n)return!0;while(n=n&&n.parentNode);return!1})}function $b(e,t){return!!(e.nodeName==="IFRAME"&&t.getMeta(e))}function Ub(e,t){return!!(e.nodeName==="LINK"&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&e.getAttribute("rel")==="stylesheet"&&t.getMeta(e))}function ul(e){return!!e?.shadowRoot}class NN{constructor(){this.id=1,this.styleIDMap=new WeakMap,this.idStyleMap=new Map}getId(t){return this.styleIDMap.get(t)??-1}has(t){return this.styleIDMap.has(t)}add(t,n){if(this.has(t))return this.getId(t);let r;return n===void 0?r=this.id++:r=n,this.styleIDMap.set(t,r),this.idStyleMap.set(r,t),r}getStyle(t){return this.idStyleMap.get(t)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}}function Bb(e){let t=null;return e.getRootNode?.()?.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&e.getRootNode().host&&(t=e.getRootNode().host),t}function PN(e){let t=e,n;for(;n=Bb(t);)t=n;return t}function LN(e){const t=e.ownerDocument;if(!t)return!1;const n=PN(e);return t.contains(n)}function Hb(e){const t=e.ownerDocument;return t?t.contains(e)||LN(e):!1}const bh={};function Ld(e){const t=bh[e];if(t)return t;const n=window.document;let r=window[e];if(n&&typeof n.createElement=="function")try{const i=n.createElement("iframe");i.hidden=!0,n.head.appendChild(i);const s=i.contentWindow;s&&s[e]&&(r=s[e]),n.head.removeChild(i)}catch{}return bh[e]=r.bind(window)}function DN(...e){return Ld("requestAnimationFrame")(...e)}function _c(...e){return Ld("setTimeout")(...e)}function FN(...e){return Ld("clearTimeout")(...e)}var ie=(e=>(e[e.DomContentLoaded=0]="DomContentLoaded",e[e.Load=1]="Load",e[e.FullSnapshot=2]="FullSnapshot",e[e.IncrementalSnapshot=3]="IncrementalSnapshot",e[e.Meta=4]="Meta",e[e.Custom=5]="Custom",e[e.Plugin=6]="Plugin",e))(ie||{}),K=(e=>(e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration",e[e.Selection=14]="Selection",e[e.AdoptedStyleSheet=15]="AdoptedStyleSheet",e[e.CustomElement=16]="CustomElement",e))(K||{}),tt=(e=>(e[e.MouseUp=0]="MouseUp",e[e.MouseDown=1]="MouseDown",e[e.Click=2]="Click",e[e.ContextMenu=3]="ContextMenu",e[e.DblClick=4]="DblClick",e[e.Focus=5]="Focus",e[e.Blur=6]="Blur",e[e.TouchStart=7]="TouchStart",e[e.TouchMove_Departed=8]="TouchMove_Departed",e[e.TouchEnd=9]="TouchEnd",e[e.TouchCancel=10]="TouchCancel",e))(tt||{}),dn=(e=>(e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e))(dn||{}),Wr=(e=>(e[e.Play=0]="Play",e[e.Pause=1]="Pause",e[e.Seeked=2]="Seeked",e[e.VolumeChange=3]="VolumeChange",e[e.RateChange=4]="RateChange",e))(Wr||{});class $N{constructor(t){this.doc=t,this.unattachedDoc=null}parse(t){return this.parseWithConstructableStylesheet(t)||this.parseWithDetachedElement(t)}parseWithConstructableStylesheet(t){if(typeof CSSStyleSheet>"u"||typeof CSSStyleSheet.prototype.replaceSync!="function")return null;try{const n=new CSSStyleSheet;n.replaceSync(`x { ${t} }`);const r=n.cssRules[0];return!r||r.type!==CSSRule.STYLE_RULE?null:r.style}catch{return null}}parseWithDetachedElement(t){const n=this.getUnattachedDoc().createElement("span");return n.setAttribute("style",t),n.style}getUnattachedDoc(){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch{this.unattachedDoc=this.doc}return this.unattachedDoc}}function Sh(e){return"__ln"in e}class UN{constructor(){this.length=0,this.head=null,this.tail=null}get(t){if(t>=this.length)throw new Error("Position outside of list range");let n=this.head;for(let r=0;r`${e}@${t}`;class BN{constructor(){this.frozen=!1,this.locked=!1,this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.removes=[],this.mapRemoves=[],this.movedMap={},this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.processMutations=t=>{t.forEach(this.processMutation),this.emit()},this.emit=()=>{if(this.frozen||this.locked)return;const t=[],n=new Set,r=new UN,i=c=>{let u=c,d=_s;for(;d===_s;)u=u&&u.nextSibling,d=u&&this.mirror.getId(u);return d},s=c=>{if(!c.parentNode||!Hb(c))return;const u=rs(c.parentNode)?this.mirror.getId(Bb(c)):this.mirror.getId(c.parentNode),d=i(c);if(u===-1||d===-1)return r.addNode(c);const l=Yr(c,{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskAllText:this.maskAllText,unblockSelector:this.unblockSelector,maskTextClass:this.maskTextClass,unmaskTextClass:this.unmaskTextClass,maskTextSelector:this.maskTextSelector,unmaskTextSelector:this.unmaskTextSelector,skipChild:!0,newlyAddedElement:!0,inlineStylesheet:this.inlineStylesheet,maskInputOptions:this.maskInputOptions,maskAttributeFn:this.maskAttributeFn,maskTextFn:this.maskTextFn,maskInputFn:this.maskInputFn,slimDOMOptions:this.slimDOMOptions,dataURLOptions:this.dataURLOptions,recordCanvas:this.recordCanvas,inlineImages:this.inlineImages,onSerialize:p=>{$b(p,this.mirror)&&!ft(p,this.blockClass,this.blockSelector,this.unblockSelector,!1)&&this.iframeManager.addIframe(p),Ub(p,this.mirror)&&this.stylesheetManager.trackLinkElement(p),ul(c)&&this.shadowDomManager.addShadowRoot(c.shadowRoot,this.doc)},onIframeLoad:(p,f)=>{if(ft(p,this.blockClass,this.blockSelector,this.unblockSelector,!1))return;this.iframeManager.attachIframe(p,f);const h=ys(p);h&&this.canvasManager.addWindow(h),this.shadowDomManager.observeAttachShadow(p)},onStylesheetLoad:(p,f)=>{this.stylesheetManager.attachLinkElement(p,f)},onBlockedImageLoad:(p,f,{width:h,height:m})=>{this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:f.id,attributes:{style:{width:`${h}px`,height:`${m}px`}}}]})},ignoreCSSAttributes:this.ignoreCSSAttributes});l&&(t.push({parentId:u,nextId:d,node:l}),n.add(l.id))};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(const c of this.movedSet)Eh(this.removes,c,this.mirror)&&!this.movedSet.has(c.parentNode)||s(c);for(const c of this.addedSet)!Th(this.droppedSet,c)&&!Eh(this.removes,c,this.mirror)||Th(this.movedSet,c)?s(c):this.droppedSet.add(c);let o=null;for(;r.length;){let c=null;if(o){const u=this.mirror.getId(o.value.parentNode),d=i(o.value);u!==-1&&d!==-1&&(c=o)}if(!c){let u=r.tail;for(;u;){const d=u;if(u=u.previous,d){const l=this.mirror.getId(d.value.parentNode);if(i(d.value)===-1)continue;if(l!==-1){c=d;break}else{const f=d.value;if(f.parentNode&&f.parentNode.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const h=f.parentNode.host;if(this.mirror.getId(h)!==-1){c=d;break}}}}}}if(!c){for(;r.head;)r.removeNode(r.head.value);break}o=c.previous,r.removeNode(c.value),s(c.value)}const a={texts:this.texts.map(c=>({id:this.mirror.getId(c.node),value:c.value})).filter(c=>!n.has(c.id)).filter(c=>this.mirror.has(c.id)),attributes:this.attributes.map(c=>{const{attributes:u}=c;if(typeof u.style=="string"){const d=JSON.stringify(c.styleDiff),l=JSON.stringify(c._unchangedStyles);d.length!n.has(c.id)).filter(c=>this.mirror.has(c.id)),removes:this.removes,adds:t};!a.texts.length&&!a.attributes.length&&!a.removes.length&&!a.adds.length||(this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.movedMap={},this.mutationCb(a))},this.processMutation=t=>{if(!su(t.target,this.mirror))switch(t.type){case"characterData":{const n=t.target.textContent;!ft(t.target,this.blockClass,this.blockSelector,this.unblockSelector,!1)&&n!==t.oldValue&&this.texts.push({value:pi(t.target,this.maskTextClass,this.maskTextSelector,this.unmaskTextClass,this.unmaskTextSelector,this.maskAllText)&&n?this.maskTextFn?this.maskTextFn(n,Db(t.target)):n.replace(/[\S]/g,"*"):n,node:t.target});break}case"attributes":{const n=t.target;let r=t.attributeName,i=t.target.getAttribute(r);if(r==="value"){const o=Od(n),a=n.tagName;i=wa(n,a,o);const c=mc({maskInputOptions:this.maskInputOptions,tagName:a,type:o}),u=pi(t.target,this.maskTextClass,this.maskTextSelector,this.unmaskTextClass,this.unmaskTextSelector,c);i=gs({isMasked:u,element:n,value:i,maskInputFn:this.maskInputFn})}if(ft(t.target,this.blockClass,this.blockSelector,this.unblockSelector,!1)||i===t.oldValue)return;let s=this.attributeMap.get(t.target);if(n.tagName==="IFRAME"&&r==="src"&&!this.keepIframeSrcFn(i))if(!Nd(n))r="rr_src";else return;if(s||(s={node:t.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(s),this.attributeMap.set(t.target,s)),r==="type"&&n.tagName==="INPUT"&&(t.oldValue||"").toLowerCase()==="password"&&n.setAttribute("data-rr-is-password","true"),!Ob(n.tagName,r)&&(s.attributes[r]=xb(this.doc,fi(n.tagName),fi(r),i,n,this.maskAttributeFn),r==="style")){const o=t.oldValue?this.styleDeclarationParser.parse(t.oldValue):null;for(const a of Array.from(n.style)){const c=n.style.getPropertyValue(a),u=n.style.getPropertyPriority(a);c!==(o?.getPropertyValue(a)||"")||u!==(o?.getPropertyPriority(a)||"")?u===""?s.styleDiff[a]=c:s.styleDiff[a]=[c,u]:s._unchangedStyles[a]=[c,u]}if(o)for(const a of Array.from(o))n.style.getPropertyValue(a)===""&&(s.styleDiff[a]=!1)}break}case"childList":{if(ft(t.target,this.blockClass,this.blockSelector,this.unblockSelector,!0))return;t.addedNodes.forEach(n=>this.genAdds(n,t.target)),t.removedNodes.forEach(n=>{const r=this.mirror.getId(n),i=rs(t.target)?this.mirror.getId(t.target.host):this.mirror.getId(t.target);ft(t.target,this.blockClass,this.blockSelector,this.unblockSelector,!1)||su(n,this.mirror)||!ON(n,this.mirror)||(this.addedSet.has(n)?(ll(this.addedSet,n),this.droppedSet.add(n)):this.addedSet.has(t.target)&&r===-1||Fb(t.target,this.mirror)||(this.movedSet.has(n)&&this.movedMap[vh(r,i)]?ll(this.movedSet,n):this.removes.push({parentId:i,id:r,isShadow:rs(t.target)&&is(t.target)?!0:void 0})),this.mapRemoves.push(n))});break}}},this.genAdds=(t,n)=>{if(!this.processedNodeManager.inOtherBuffer(t,this)&&!(this.addedSet.has(t)||this.movedSet.has(t))){if(this.mirror.hasNode(t)){if(su(t,this.mirror))return;this.movedSet.add(t);let r=null;n&&this.mirror.hasNode(n)&&(r=this.mirror.getId(n)),r&&r!==-1&&(this.movedMap[vh(this.mirror.getId(t),r)]=!0)}else this.addedSet.add(t),this.droppedSet.delete(t);ft(t,this.blockClass,this.blockSelector,this.unblockSelector,!1)||(t.childNodes&&t.childNodes.forEach(r=>this.genAdds(r)),ul(t)&&t.shadowRoot.childNodes.forEach(r=>{this.processedNodeManager.add(r,this),this.genAdds(r,t)}))}}}init(t){["mutationCb","blockClass","blockSelector","unblockSelector","maskAllText","maskTextClass","unmaskTextClass","maskTextSelector","unmaskTextSelector","inlineStylesheet","maskInputOptions","maskAttributeFn","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager","ignoreCSSAttributes"].forEach(n=>{this[n]=t[n]}),this.styleDeclarationParser=new $N(this.doc)}freeze(){this.frozen=!0,this.canvasManager.freeze()}unfreeze(){this.frozen=!1,this.canvasManager.unfreeze(),this.emit()}isFrozen(){return this.frozen}lock(){this.locked=!0,this.canvasManager.lock()}unlock(){this.locked=!1,this.canvasManager.unlock(),this.emit()}reset(){this.shadowDomManager.reset(),this.canvasManager.reset()}}function ll(e,t){e.delete(t),t.childNodes?.forEach(n=>ll(e,n))}function Eh(e,t,n){return e.length===0?!1:HN(e,t,n)}function HN(e,t,n){let r=t.parentNode;for(;r;){const i=n.getId(r);if(e.some(s=>s.id===i))return!0;r=r.parentNode}return!1}function Th(e,t){return e.size===0?!1:jb(e,t)}function jb(e,t){const{parentNode:n}=t;return n?e.has(n)?!0:jb(e,n):!1}let ss;function jN(e){ss=e}function WN(){ss=void 0}const de=e=>ss?((...n)=>{try{return e(...n)}catch(r){if(ss&&ss(r)===!0)return()=>{};throw r}}):e,Kr=[];function qs(e){try{if("composedPath"in e){const t=e.composedPath();if(t.length)return t[0]}else if("path"in e&&e.path.length)return e.path[0]}catch{}return e&&e.target}function Wb(e,t){const n=new BN;Kr.push(n),n.init(e);let r=window.MutationObserver||window.__rrMutationObserver;const i=window?.Zone?.__symbol__?.("MutationObserver");i&&window[i]&&(r=window[i]);const s=new r(de(o=>{e.onMutation&&e.onMutation(o)===!1||n.processMutations.bind(n)(o)}));return s.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),s}function zN({mousemoveCb:e,sampling:t,doc:n,mirror:r}){if(t.mousemove===!1)return()=>{};const i=typeof t.mousemove=="number"?t.mousemove:50,s=typeof t.mousemoveCallback=="number"?t.mousemoveCallback:500;let o=[],a;const c=bs(de(l=>{const p=Date.now()-a;e(o.map(f=>(f.timeOffset-=p,f)),l),o=[],a=null}),s),u=de(bs(de(l=>{const p=qs(l),{clientX:f,clientY:h}=cl(l)?l.changedTouches[0]:l;a||(a=ka()),o.push({x:f,y:h,id:r.getId(p),timeOffset:ka()-a}),c(typeof DragEvent<"u"&&l instanceof DragEvent?K.Drag:l instanceof MouseEvent?K.MouseMove:K.TouchMove)}),i,{trailing:!1})),d=[it("mousemove",u,n),it("touchmove",u,n),it("drag",u,n)];return de(()=>{d.forEach(l=>l())})}function qN({mouseInteractionCb:e,doc:t,mirror:n,blockClass:r,blockSelector:i,unblockSelector:s,sampling:o}){if(o.mouseInteraction===!1)return()=>{};const a=o.mouseInteraction===!0||o.mouseInteraction===void 0?{}:o.mouseInteraction,c=[];let u=null;const d=l=>p=>{const f=qs(p);if(ft(f,r,i,s,!0))return;let h=null,m=l;if("pointerType"in p){switch(p.pointerType){case"mouse":h=dn.Mouse;break;case"touch":h=dn.Touch;break;case"pen":h=dn.Pen;break}h===dn.Touch?tt[l]===tt.MouseDown?m="TouchStart":tt[l]===tt.MouseUp&&(m="TouchEnd"):dn.Pen}else cl(p)&&(h=dn.Touch);h!==null?(u=h,(m.startsWith("Touch")&&h===dn.Touch||m.startsWith("Mouse")&&h===dn.Mouse)&&(h=null)):tt[l]===tt.Click&&(h=u,u=null);const g=cl(p)?p.changedTouches[0]:p;if(!g)return;const _=n.getId(f),{clientX:S,clientY:E}=g;de(e)({type:tt[m],id:_,x:S,y:E,...h!==null&&{pointerType:h}})};return Object.keys(tt).filter(l=>Number.isNaN(Number(l))&&!l.endsWith("_Departed")&&a[l]!==!1).forEach(l=>{let p=fi(l);const f=d(l);if(window.PointerEvent)switch(tt[l]){case tt.MouseDown:case tt.MouseUp:p=p.replace("mouse","pointer");break;case tt.TouchStart:case tt.TouchEnd:return}c.push(it(p,f,t))}),de(()=>{c.forEach(l=>l())})}function zb({scrollCb:e,doc:t,mirror:n,blockClass:r,blockSelector:i,unblockSelector:s,sampling:o}){const a=de(bs(de(c=>{const u=qs(c);if(!u||ft(u,r,i,s,!0))return;const d=n.getId(u);if(u===t&&t.defaultView){const l=Nb(t.defaultView);e({id:d,x:l.left,y:l.top})}else e({id:d,x:u.scrollLeft,y:u.scrollTop})}),o.scroll||100));return it("scroll",a,t)}function GN({viewportResizeCb:e},{win:t}){let n=-1,r=-1;const i=de(bs(de(()=>{const s=Pb(),o=Lb();(n!==s||r!==o)&&(e({width:Number(o),height:Number(s)}),n=s,r=o)}),200));return it("resize",i,t)}const VN=["INPUT","TEXTAREA","SELECT"],wh=new WeakMap;function YN({inputCb:e,doc:t,mirror:n,blockClass:r,blockSelector:i,unblockSelector:s,ignoreClass:o,ignoreSelector:a,maskInputOptions:c,maskInputFn:u,sampling:d,userTriggeredOnInput:l,maskTextClass:p,unmaskTextClass:f,maskTextSelector:h,unmaskTextSelector:m}){function g(b){let I=qs(b);const M=b.isTrusted,k=I&&ol(I.tagName);if(k==="OPTION"&&(I=I.parentElement),!I||!k||VN.indexOf(k)<0||ft(I,r,i,s,!0))return;const D=I;if(D.classList.contains(o)||a&&D.matches(a))return;const x=Od(I);let L=wa(D,k,x),F=!1;const Z=mc({maskInputOptions:c,tagName:k,type:x}),Y=pi(I,p,h,f,m,Z);(x==="radio"||x==="checkbox")&&(F=I.checked),L=gs({isMasked:Y,element:I,value:L,maskInputFn:u}),_(I,l?{text:L,isChecked:F,userTriggered:M}:{text:L,isChecked:F});const ne=I.name;x==="radio"&&ne&&F&&t.querySelectorAll(`input[type="radio"][name="${ne}"]`).forEach(R=>{if(R!==I){const j=gs({isMasked:Y,element:R,value:wa(R,k,x),maskInputFn:u});_(R,l?{text:j,isChecked:!F,userTriggered:!1}:{text:j,isChecked:!F})}})}function _(b,I){const M=wh.get(b);if(!M||M.text!==I.text||M.isChecked!==I.isChecked){wh.set(b,I);const k=n.getId(b);de(e)({...I,id:k})}}const E=(d.input==="last"?["change"]:["input","change"]).map(b=>it(b,de(g),t)),v=t.defaultView;if(!v)return()=>{E.forEach(b=>b())};const w=v.Object.getOwnPropertyDescriptor(v.HTMLInputElement.prototype,"value"),T=[[v.HTMLInputElement.prototype,"value"],[v.HTMLInputElement.prototype,"checked"],[v.HTMLSelectElement.prototype,"value"],[v.HTMLTextAreaElement.prototype,"value"],[v.HTMLSelectElement.prototype,"selectedIndex"],[v.HTMLOptionElement.prototype,"selected"]];return w&&w.set&&E.push(...T.map(b=>Mb(b[0],b[1],{set(){de(g)({target:this,isTrusted:!1})}},!1,v))),de(()=>{E.forEach(b=>b())})}function Ra(e){const t=[];function n(r,i){if(go("CSSGroupingRule")&&r.parentRule instanceof CSSGroupingRule||go("CSSMediaRule")&&r.parentRule instanceof CSSMediaRule||go("CSSSupportsRule")&&r.parentRule instanceof CSSSupportsRule||go("CSSConditionRule")&&r.parentRule instanceof CSSConditionRule){const o=Array.from(r.parentRule.cssRules).indexOf(r);i.unshift(o)}else if(r.parentStyleSheet){const o=Array.from(r.parentStyleSheet.cssRules).indexOf(r);i.unshift(o)}return i}return n(e,t)}function Fn(e,t,n){let r,i;return e?(e.ownerNode?r=t.getId(e.ownerNode):i=n.getId(e),{styleId:i,id:r}):{}}function KN({styleSheetRuleCb:e,mirror:t,stylesheetManager:n},{win:r}){if(!r.CSSStyleSheet||!r.CSSStyleSheet.prototype)return()=>{};const i=r.CSSStyleSheet.prototype.insertRule;r.CSSStyleSheet.prototype.insertRule=new Proxy(i,{apply:de((d,l,p)=>{const[f,h]=p,{id:m,styleId:g}=Fn(l,t,n.styleMirror);return(m&&m!==-1||g&&g!==-1)&&e({id:m,styleId:g,adds:[{rule:f,index:h}]}),d.apply(l,p)})});const s=r.CSSStyleSheet.prototype.deleteRule;r.CSSStyleSheet.prototype.deleteRule=new Proxy(s,{apply:de((d,l,p)=>{const[f]=p,{id:h,styleId:m}=Fn(l,t,n.styleMirror);return(h&&h!==-1||m&&m!==-1)&&e({id:h,styleId:m,removes:[{index:f}]}),d.apply(l,p)})});let o;r.CSSStyleSheet.prototype.replace&&(o=r.CSSStyleSheet.prototype.replace,r.CSSStyleSheet.prototype.replace=new Proxy(o,{apply:de((d,l,p)=>{const[f]=p,{id:h,styleId:m}=Fn(l,t,n.styleMirror);return(h&&h!==-1||m&&m!==-1)&&e({id:h,styleId:m,replace:f}),d.apply(l,p)})}));let a;r.CSSStyleSheet.prototype.replaceSync&&(a=r.CSSStyleSheet.prototype.replaceSync,r.CSSStyleSheet.prototype.replaceSync=new Proxy(a,{apply:de((d,l,p)=>{const[f]=p,{id:h,styleId:m}=Fn(l,t,n.styleMirror);return(h&&h!==-1||m&&m!==-1)&&e({id:h,styleId:m,replaceSync:f}),d.apply(l,p)})}));const c={};_o("CSSGroupingRule")?c.CSSGroupingRule=r.CSSGroupingRule:(_o("CSSMediaRule")&&(c.CSSMediaRule=r.CSSMediaRule),_o("CSSConditionRule")&&(c.CSSConditionRule=r.CSSConditionRule),_o("CSSSupportsRule")&&(c.CSSSupportsRule=r.CSSSupportsRule));const u={};return Object.entries(c).forEach(([d,l])=>{u[d]={insertRule:l.prototype.insertRule,deleteRule:l.prototype.deleteRule},l.prototype.insertRule=new Proxy(u[d].insertRule,{apply:de((p,f,h)=>{const[m,g]=h,{id:_,styleId:S}=Fn(f.parentStyleSheet,t,n.styleMirror);return(_&&_!==-1||S&&S!==-1)&&e({id:_,styleId:S,adds:[{rule:m,index:[...Ra(f),g||0]}]}),p.apply(f,h)})}),l.prototype.deleteRule=new Proxy(u[d].deleteRule,{apply:de((p,f,h)=>{const[m]=h,{id:g,styleId:_}=Fn(f.parentStyleSheet,t,n.styleMirror);return(g&&g!==-1||_&&_!==-1)&&e({id:g,styleId:_,removes:[{index:[...Ra(f),m]}]}),p.apply(f,h)})})}),de(()=>{r.CSSStyleSheet.prototype.insertRule=i,r.CSSStyleSheet.prototype.deleteRule=s,o&&(r.CSSStyleSheet.prototype.replace=o),a&&(r.CSSStyleSheet.prototype.replaceSync=a),Object.entries(c).forEach(([d,l])=>{l.prototype.insertRule=u[d].insertRule,l.prototype.deleteRule=u[d].deleteRule})})}function qb({mirror:e,stylesheetManager:t},n){let r=null;n.nodeName==="#document"?r=e.getId(n):r=e.getId(n.host);const i=n.nodeName==="#document"?n.defaultView?.Document:n.ownerDocument?.defaultView?.ShadowRoot,s=i?.prototype?Object.getOwnPropertyDescriptor(i?.prototype,"adoptedStyleSheets"):void 0;return r===null||r===-1||!i||!s?()=>{}:(Object.defineProperty(n,"adoptedStyleSheets",{configurable:s.configurable,enumerable:s.enumerable,get(){return s.get?.call(this)},set(o){const a=s.set?.call(this,o);if(r!==null&&r!==-1)try{t.adoptStyleSheets(o,r)}catch{}return a}}),de(()=>{Object.defineProperty(n,"adoptedStyleSheets",{configurable:s.configurable,enumerable:s.enumerable,get:s.get,set:s.set})}))}function JN({styleDeclarationCb:e,mirror:t,ignoreCSSAttributes:n,stylesheetManager:r},{win:i}){const s=i.CSSStyleDeclaration.prototype.setProperty;i.CSSStyleDeclaration.prototype.setProperty=new Proxy(s,{apply:de((a,c,u)=>{const[d,l,p]=u;if(n.has(d))return s.apply(c,[d,l,p]);const{id:f,styleId:h}=Fn(c.parentRule?.parentStyleSheet,t,r.styleMirror);return(f&&f!==-1||h&&h!==-1)&&e({id:f,styleId:h,set:{property:d,value:l,priority:p},index:Ra(c.parentRule)}),a.apply(c,u)})});const o=i.CSSStyleDeclaration.prototype.removeProperty;return i.CSSStyleDeclaration.prototype.removeProperty=new Proxy(o,{apply:de((a,c,u)=>{const[d]=u;if(n.has(d))return o.apply(c,[d]);const{id:l,styleId:p}=Fn(c.parentRule?.parentStyleSheet,t,r.styleMirror);return(l&&l!==-1||p&&p!==-1)&&e({id:l,styleId:p,remove:{property:d},index:Ra(c.parentRule)}),a.apply(c,u)})}),de(()=>{i.CSSStyleDeclaration.prototype.setProperty=s,i.CSSStyleDeclaration.prototype.removeProperty=o})}function XN({mediaInteractionCb:e,blockClass:t,blockSelector:n,unblockSelector:r,mirror:i,sampling:s,doc:o}){const a=de(u=>bs(de(d=>{const l=qs(d);if(!l||ft(l,t,n,r,!0))return;const{currentTime:p,volume:f,muted:h,playbackRate:m}=l;e({type:u,id:i.getId(l),currentTime:p,volume:f,muted:h,playbackRate:m})}),s.media||500)),c=[it("play",a(Wr.Play),o),it("pause",a(Wr.Pause),o),it("seeked",a(Wr.Seeked),o),it("volumechange",a(Wr.VolumeChange),o),it("ratechange",a(Wr.RateChange),o)];return de(()=>{c.forEach(u=>u())})}function QN({fontCb:e,doc:t}){const n=t.defaultView;if(!n)return()=>{};const r=[],i=new WeakMap,s=n.FontFace;n.FontFace=function(c,u,d){const l=new s(c,u,d);return i.set(l,{family:c,buffer:typeof u!="string",descriptors:d,fontSource:typeof u=="string"?u:JSON.stringify(Array.from(new Uint8Array(u)))}),l};const o=Pd(t.fonts,"add",function(a){return function(c){return _c(de(()=>{const u=i.get(c);u&&(e(u),i.delete(c))}),0),a.apply(this,[c])}});return r.push(()=>{n.FontFace=s}),r.push(o),de(()=>{r.forEach(a=>a())})}function ZN(e){const{doc:t,mirror:n,blockClass:r,blockSelector:i,unblockSelector:s,selectionCb:o}=e;let a=!0;const c=de(()=>{const u=t.getSelection();if(!u||a&&u?.isCollapsed)return;a=u.isCollapsed||!1;const d=[],l=u.rangeCount||0;for(let p=0;p{}:Pd(n.customElements,"define",function(i){return function(s,o,a){try{t({define:{name:s}})}catch{}return i.apply(this,[s,o,a])}})}function tP(e,t={}){const n=e.doc.defaultView;if(!n)return()=>{};let r;e.recordDOM&&(r=Wb(e,e.doc));const i=zN(e),s=qN(e),o=zb(e),a=GN(e,{win:n}),c=YN(e),u=XN(e);let d=()=>{},l=()=>{},p=()=>{},f=()=>{};e.recordDOM&&(d=KN(e,{win:n}),l=qb(e,e.doc),p=JN(e,{win:n}),e.collectFonts&&(f=QN(e)));const h=ZN(e),m=eP(e),g=[];for(const _ of e.plugins)g.push(_.observer(_.callback,n,_.options));return de(()=>{Kr.forEach(_=>_.reset()),r?.disconnect(),i(),s(),o(),a(),c(),u(),d(),l(),p(),f(),h(),m(),g.forEach(_=>_())})}function go(e){return typeof window[e]<"u"}function _o(e){return!!(typeof window[e]<"u"&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}class dl{constructor(t){this.generateIdFn=t,this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap}getId(t,n,r,i){const s=r||this.getIdToRemoteIdMap(t),o=i||this.getRemoteIdToIdMap(t);let a=s.get(n);return a||(a=this.generateIdFn(),s.set(n,a),o.set(a,n)),a}getIds(t,n){const r=this.getIdToRemoteIdMap(t),i=this.getRemoteIdToIdMap(t);return n.map(s=>this.getId(t,s,r,i))}getRemoteId(t,n,r){const i=r||this.getRemoteIdToIdMap(t);if(typeof n!="number")return n;const s=i.get(n);return s||-1}getRemoteIds(t,n){const r=this.getRemoteIdToIdMap(t);return n.map(i=>this.getRemoteId(t,i,r))}reset(t){if(!t){this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap;return}this.iframeIdToRemoteIdMap.delete(t),this.iframeRemoteIdToIdMap.delete(t)}getIdToRemoteIdMap(t){let n=this.iframeIdToRemoteIdMap.get(t);return n||(n=new Map,this.iframeIdToRemoteIdMap.set(t,n)),n}getRemoteIdToIdMap(t){let n=this.iframeRemoteIdToIdMap.get(t);return n||(n=new Map,this.iframeRemoteIdToIdMap.set(t,n)),n}}class nP{constructor(){this.crossOriginIframeMirror=new dl(Md),this.crossOriginIframeRootIdMap=new WeakMap}addIframe(){}addLoadListener(){}attachIframe(){}}class rP{constructor(t){this.iframes=new WeakMap,this.crossOriginIframeMap=new WeakMap,this.crossOriginIframeMirror=new dl(Md),this.crossOriginIframeRootIdMap=new WeakMap,this.mutationCb=t.mutationCb,this.wrappedEmit=t.wrappedEmit,this.stylesheetManager=t.stylesheetManager,this.recordCrossOriginIframes=t.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new dl(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=t.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.handleMessage.bind(this))}addIframe(t){this.iframes.set(t,!0);const n=ys(t);n&&this.crossOriginIframeMap.set(n,t)}addLoadListener(t){this.loadListener=t}attachIframe(t,n){this.mutationCb({adds:[{parentId:this.mirror.getId(t),nextId:null,node:n}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),this.recordCrossOriginIframes&&ys(t)?.addEventListener("message",this.handleMessage.bind(this)),this.loadListener?.(t);const r=Nd(t);r&&r.adoptedStyleSheets&&r.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(r.adoptedStyleSheets,this.mirror.getId(r))}handleMessage(t){const n=t;if(n.data.type!=="rrweb"||n.origin!==n.data.origin||!t.source)return;const i=this.crossOriginIframeMap.get(t.source);if(!i)return;const s=this.transformCrossOriginEvent(i,n.data.event);s&&this.wrappedEmit(s,n.data.isCheckout)}transformCrossOriginEvent(t,n){switch(n.type){case ie.FullSnapshot:{this.crossOriginIframeMirror.reset(t),this.crossOriginIframeStyleMirror.reset(t),this.replaceIdOnNode(n.data.node,t);const r=n.data.node.id;return this.crossOriginIframeRootIdMap.set(t,r),this.patchRootIdOnNode(n.data.node,r),{timestamp:n.timestamp,type:ie.IncrementalSnapshot,data:{source:K.Mutation,adds:[{parentId:this.mirror.getId(t),nextId:null,node:n.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case ie.Meta:case ie.Load:case ie.DomContentLoaded:return!1;case ie.Plugin:return n;case ie.Custom:return this.replaceIds(n.data.payload,t,["id","parentId","previousId","nextId"]),n;case ie.IncrementalSnapshot:switch(n.data.source){case K.Mutation:return n.data.adds.forEach(r=>{this.replaceIds(r,t,["parentId","nextId","previousId"]),this.replaceIdOnNode(r.node,t);const i=this.crossOriginIframeRootIdMap.get(t);i&&this.patchRootIdOnNode(r.node,i)}),n.data.removes.forEach(r=>{this.replaceIds(r,t,["parentId","id"])}),n.data.attributes.forEach(r=>{this.replaceIds(r,t,["id"])}),n.data.texts.forEach(r=>{this.replaceIds(r,t,["id"])}),n;case K.Drag:case K.TouchMove:case K.MouseMove:return n.data.positions.forEach(r=>{this.replaceIds(r,t,["id"])}),n;case K.ViewportResize:return!1;case K.MediaInteraction:case K.MouseInteraction:case K.Scroll:case K.CanvasMutation:case K.Input:return this.replaceIds(n.data,t,["id"]),n;case K.StyleSheetRule:case K.StyleDeclaration:return this.replaceIds(n.data,t,["id"]),this.replaceStyleIds(n.data,t,["styleId"]),n;case K.Font:return n;case K.Selection:return n.data.ranges.forEach(r=>{this.replaceIds(r,t,["start","end"])}),n;case K.AdoptedStyleSheet:return this.replaceIds(n.data,t,["id"]),this.replaceStyleIds(n.data,t,["styleIds"]),n.data.styles?.forEach(r=>{this.replaceStyleIds(r,t,["styleId"])}),n}}return!1}replace(t,n,r,i){for(const s of i)!Array.isArray(n[s])&&typeof n[s]!="number"||(Array.isArray(n[s])?n[s]=t.getIds(r,n[s]):n[s]=t.getId(r,n[s]));return n}replaceIds(t,n,r){return this.replace(this.crossOriginIframeMirror,t,n,r)}replaceStyleIds(t,n,r){return this.replace(this.crossOriginIframeStyleMirror,t,n,r)}replaceIdOnNode(t,n){this.replaceIds(t,n,["id","rootId"]),"childNodes"in t&&t.childNodes.forEach(r=>{this.replaceIdOnNode(r,n)})}patchRootIdOnNode(t,n){t.type!==Pe.Document&&!t.rootId&&(t.rootId=n),"childNodes"in t&&t.childNodes.forEach(r=>{this.patchRootIdOnNode(r,n)})}}class iP{init(){}addShadowRoot(){}observeAttachShadow(){}reset(){}}class sP{constructor(t){this.shadowDoms=new WeakSet,this.restoreHandlers=[],this.mutationCb=t.mutationCb,this.scrollCb=t.scrollCb,this.bypassOptions=t.bypassOptions,this.mirror=t.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(t,n){if(!is(t)||this.shadowDoms.has(t))return;this.shadowDoms.add(t),this.bypassOptions.canvasManager.addShadowRoot(t);const r=Wb({...this.bypassOptions,doc:n,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this},t);this.restoreHandlers.push(()=>r.disconnect()),this.restoreHandlers.push(zb({...this.bypassOptions,scrollCb:this.scrollCb,doc:t,mirror:this.mirror})),_c(()=>{t.adoptedStyleSheets&&t.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(t.adoptedStyleSheets,this.mirror.getId(t.host)),this.restoreHandlers.push(qb({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},t))},0)}observeAttachShadow(t){const n=Nd(t),r=ys(t);!n||!r||this.patchAttachShadow(r.Element,n)}patchAttachShadow(t,n){const r=this;this.restoreHandlers.push(Pd(t.prototype,"attachShadow",function(i){return function(s){const o=i.call(this,s);return this.shadowRoot&&Hb(this)&&r.addShadowRoot(this.shadowRoot,n),o}}))}reset(){this.restoreHandlers.forEach(t=>{try{t()}catch{}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet,this.bypassOptions.canvasManager.resetShadowRoots()}}var Ih="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",oP=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var yo=0;yo({rule:wb(a),index:c}))})),r.styleIds.push(o)}i.length>0&&(r.styles=i),this.adoptedStyleSheetCb(r)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(t){}}class cP{constructor(){this.nodeMap=new WeakMap,this.active=!1}inOtherBuffer(t,n){const r=this.nodeMap.get(t);return r&&Array.from(r).some(i=>i!==n)}add(t,n){this.active||(this.active=!0,DN(()=>{this.nodeMap=new WeakMap,this.active=!1})),this.nodeMap.set(t,(this.nodeMap.get(t)||new Set).add(n))}destroy(){}}let Me,Aa;try{if(Array.from([1],e=>e*2)[0]!==2){const e=document.createElement("iframe");document.body.appendChild(e),Array.from=e.contentWindow?.Array.from||Array.from,document.body.removeChild(e)}}catch(e){console.debug("Unable to override Array.from",e)}const Mt=sN();function Ft(e={}){const{emit:t,checkoutEveryNms:n,checkoutEveryNth:r,blockClass:i="rr-block",blockSelector:s=null,unblockSelector:o=null,ignoreClass:a="rr-ignore",ignoreSelector:c=null,maskAllText:u=!1,maskTextClass:d="rr-mask",unmaskTextClass:l=null,maskTextSelector:p=null,unmaskTextSelector:f=null,inlineStylesheet:h=!0,maskAllInputs:m,maskInputOptions:g,slimDOMOptions:_,maskAttributeFn:S,maskInputFn:E,maskTextFn:v,maxCanvasSize:w=null,packFn:T,sampling:b={},dataURLOptions:I={},mousemoveWait:M,recordDOM:k=!0,recordCanvas:D=!1,recordCrossOriginIframes:x=!1,recordAfter:L=e.recordAfter==="DOMContentLoaded"?e.recordAfter:"load",userTriggeredOnInput:F=!1,collectFonts:Z=!1,inlineImages:Y=!1,plugins:ne,keepIframeSrcFn:R=()=>!1,ignoreCSSAttributes:j=new Set([]),errorHandler:P,onMutation:U,getCanvasManager:re}=e;jN(P);const ee=x?window.parent===window:!0;let Se=!1;if(!ee)try{window.parent.document&&(Se=!1)}catch{Se=!0}if(ee&&!t)throw new Error("emit function is required");if(!ee&&!Se)return()=>{};M!==void 0&&b.mousemove===void 0&&(b.mousemove=M),Mt.reset();const Fe=m===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,radio:!0,checkbox:!0}:g!==void 0?g:{},He=_===!0||_==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:_==="all",headMetaDescKeywords:_==="all"}:_||{};MN();let Xe,Qe=0;const Ht=$=>{for(const fe of ne||[])fe.eventProcessor&&($=fe.eventProcessor($));return T&&!Se&&($=T($)),$};Me=($,fe)=>{const V=$;if(V.timestamp=ka(),Kr[0]?.isFrozen()&&V.type!==ie.FullSnapshot&&!(V.type===ie.IncrementalSnapshot&&V.data.source===K.Mutation)&&Kr.forEach(ae=>ae.unfreeze()),ee)t?.(Ht(V),fe);else if(Se){const ae={type:"rrweb",event:Ht(V),origin:window.location.origin,isCheckout:fe};window.parent.postMessage(ae,"*")}if(V.type===ie.FullSnapshot)Xe=V,Qe=0;else if(V.type===ie.IncrementalSnapshot){if(V.data.source===K.Mutation&&V.data.isAttachIframe)return;Qe++;const ae=r&&Qe>=r,W=n&&Xe&&V.timestamp-Xe.timestamp>n;(ae||W)&&jt(!0)}};const Ze=$=>{Me({type:ie.IncrementalSnapshot,data:{source:K.Mutation,...$}})},Mn=$=>Me({type:ie.IncrementalSnapshot,data:{source:K.Scroll,...$}}),ut=$=>Me({type:ie.IncrementalSnapshot,data:{source:K.CanvasMutation,...$}}),et=$=>Me({type:ie.IncrementalSnapshot,data:{source:K.AdoptedStyleSheet,...$}}),qe=new aP({mutationCb:Ze,adoptedStyleSheetCb:et}),Ke=typeof __RRWEB_EXCLUDE_IFRAME__=="boolean"&&__RRWEB_EXCLUDE_IFRAME__?new nP:new rP({mirror:Mt,mutationCb:Ze,stylesheetManager:qe,recordCrossOriginIframes:x,wrappedEmit:Me});for(const $ of ne||[])$.getMirror&&$.getMirror({nodeMirror:Mt,crossOriginIframeMirror:Ke.crossOriginIframeMirror,crossOriginIframeStyleMirror:Ke.crossOriginIframeStyleMirror});const cn=new cP,Nn=lP(re,{mirror:Mt,win:window,mutationCb:$=>Me({type:ie.IncrementalSnapshot,data:{source:K.CanvasMutation,...$}}),recordCanvas:D,blockClass:i,blockSelector:s,unblockSelector:o,maxCanvasSize:w,sampling:b.canvas,dataURLOptions:I,errorHandler:P}),_t=typeof __RRWEB_EXCLUDE_SHADOW_DOM__=="boolean"&&__RRWEB_EXCLUDE_SHADOW_DOM__?new iP:new sP({mutationCb:Ze,scrollCb:Mn,bypassOptions:{onMutation:U,blockClass:i,blockSelector:s,unblockSelector:o,maskAllText:u,maskTextClass:d,unmaskTextClass:l,maskTextSelector:p,unmaskTextSelector:f,inlineStylesheet:h,maskInputOptions:Fe,dataURLOptions:I,maskAttributeFn:S,maskTextFn:v,maskInputFn:E,recordCanvas:D,inlineImages:Y,sampling:b,slimDOMOptions:He,iframeManager:Ke,stylesheetManager:qe,canvasManager:Nn,keepIframeSrcFn:R,processedNodeManager:cn,ignoreCSSAttributes:j},mirror:Mt}),jt=($=!1)=>{if(!k)return;Me({type:ie.Meta,data:{href:window.location.href,width:Lb(),height:Pb()}},$),qe.reset(),_t.init(),Kr.forEach(V=>V.lock());const fe=xN(document,{mirror:Mt,blockClass:i,blockSelector:s,unblockSelector:o,maskAllText:u,maskTextClass:d,unmaskTextClass:l,maskTextSelector:p,unmaskTextSelector:f,inlineStylesheet:h,maskAllInputs:Fe,maskAttributeFn:S,maskInputFn:E,maskTextFn:v,slimDOM:He,dataURLOptions:I,recordCanvas:D,inlineImages:Y,onSerialize:V=>{$b(V,Mt)&&Ke.addIframe(V),Ub(V,Mt)&&qe.trackLinkElement(V),ul(V)&&_t.addShadowRoot(V.shadowRoot,document)},onIframeLoad:(V,ae)=>{Ke.attachIframe(V,ae);const W=ys(V);W&&Nn.addWindow(W),_t.observeAttachShadow(V)},onStylesheetLoad:(V,ae)=>{qe.attachLinkElement(V,ae)},onBlockedImageLoad:(V,ae,{width:W,height:yt})=>{Ze({adds:[],removes:[],texts:[],attributes:[{id:ae.id,attributes:{style:{width:`${W}px`,height:`${yt}px`}}}]})},keepIframeSrcFn:R,ignoreCSSAttributes:j});if(!fe)return console.warn("Failed to snapshot the document");Me({type:ie.FullSnapshot,data:{node:fe,initialOffset:Nb(window)}}),Kr.forEach(V=>V.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&qe.adoptStyleSheets(document.adoptedStyleSheets,Mt.getId(document))};Aa=jt;try{const $=[],fe=ae=>de(tP)({onMutation:U,mutationCb:Ze,mousemoveCb:(W,yt)=>Me({type:ie.IncrementalSnapshot,data:{source:yt,positions:W}}),mouseInteractionCb:W=>Me({type:ie.IncrementalSnapshot,data:{source:K.MouseInteraction,...W}}),scrollCb:Mn,viewportResizeCb:W=>Me({type:ie.IncrementalSnapshot,data:{source:K.ViewportResize,...W}}),inputCb:W=>Me({type:ie.IncrementalSnapshot,data:{source:K.Input,...W}}),mediaInteractionCb:W=>Me({type:ie.IncrementalSnapshot,data:{source:K.MediaInteraction,...W}}),styleSheetRuleCb:W=>Me({type:ie.IncrementalSnapshot,data:{source:K.StyleSheetRule,...W}}),styleDeclarationCb:W=>Me({type:ie.IncrementalSnapshot,data:{source:K.StyleDeclaration,...W}}),canvasMutationCb:ut,fontCb:W=>Me({type:ie.IncrementalSnapshot,data:{source:K.Font,...W}}),selectionCb:W=>{Me({type:ie.IncrementalSnapshot,data:{source:K.Selection,...W}})},customElementCb:W=>{Me({type:ie.IncrementalSnapshot,data:{source:K.CustomElement,...W}})},blockClass:i,ignoreClass:a,ignoreSelector:c,maskAllText:u,maskTextClass:d,unmaskTextClass:l,maskTextSelector:p,unmaskTextSelector:f,maskInputOptions:Fe,inlineStylesheet:h,sampling:b,recordDOM:k,recordCanvas:D,inlineImages:Y,userTriggeredOnInput:F,collectFonts:Z,doc:ae,maskAttributeFn:S,maskInputFn:E,maskTextFn:v,keepIframeSrcFn:R,blockSelector:s,unblockSelector:o,slimDOMOptions:He,dataURLOptions:I,mirror:Mt,iframeManager:Ke,stylesheetManager:qe,shadowDomManager:_t,processedNodeManager:cn,canvasManager:Nn,ignoreCSSAttributes:j,plugins:ne?.filter(W=>W.observer)?.map(W=>({observer:W.observer,options:W.options,callback:yt=>Me({type:ie.Plugin,data:{plugin:W.name,payload:yt}})}))||[]},{});Ke.addLoadListener(ae=>{try{$.push(fe(ae.contentDocument))}catch(W){console.warn(W)}});const V=()=>{jt(),$.push(fe(document))};return document.readyState==="interactive"||document.readyState==="complete"?V():($.push(it("DOMContentLoaded",()=>{Me({type:ie.DomContentLoaded,data:{}}),L==="DOMContentLoaded"&&V()})),$.push(it("load",()=>{Me({type:ie.Load,data:{}}),L==="load"&&V()},window))),()=>{$.forEach(ae=>ae()),cn.destroy(),Aa=void 0,WN()}}catch($){console.warn($)}}function uP(e){if(!Aa)throw new Error("please take full snapshot after start recording");Aa(e)}Ft.mirror=Mt;Ft.takeFullSnapshot=uP;function lP(e,t){try{return e?e(t):new kh}catch{return console.warn("Unable to initialize CanvasManager"),new kh}}var Rh;(function(e){e[e.NotStarted=0]="NotStarted",e[e.Running=1]="Running",e[e.Stopped=2]="Stopped"})(Rh||(Rh={}));const dP=3,fP=5;function Dd(e){return e>9999999999?e:e*1e3}function ou(e){return e>9999999999?e/1e3:e}function Gs(e,t){t.category!=="sentry.transaction"&&(["ui.click","ui.input"].includes(t.category)?e.triggerUserActivity():e.checkAndHandleExpiredSession(),e.addUpdate(()=>(e.throttledAddEvent({type:ie.Custom,timestamp:(t.timestamp||0)*1e3,data:{tag:"breadcrumb",payload:Ge(t,10,1e3)}}),t.category==="console")))}const pP="button,a";function Gb(e){return e.closest(pP)||e}function Vb(e){const t=Yb(e);return!t||!(t instanceof Element)?t:Gb(t)}function Yb(e){return hP(e)?e.target:e}function hP(e){return typeof e=="object"&&!!e&&"target"in e}let $n;function mP(e){return $n||($n=[],gP()),$n.push(e),()=>{const t=$n?$n.indexOf(e):-1;t>-1&&$n.splice(t,1)}}function gP(){Ve(Te,"open",function(e){return function(...t){if($n)try{$n.forEach(n=>n())}catch{}return e.apply(Te,t)}})}const _P=new Set([K.Mutation,K.StyleSheetRule,K.StyleDeclaration,K.AdoptedStyleSheet,K.CanvasMutation,K.Selection,K.MediaInteraction]);function yP(e,t,n){e.handleClick(t,n)}class bP{constructor(t,n,r=Gs){this._lastMutation=0,this._lastScroll=0,this._clicks=[],this._timeout=n.timeout/1e3,this._threshold=n.threshold/1e3,this._scrollTimeout=n.scrollTimeout/1e3,this._replay=t,this._ignoreSelector=n.ignoreSelector,this._addBreadcrumbEvent=r}addListeners(){const t=mP(()=>{this._lastMutation=Ah()});this._teardown=()=>{t(),this._clicks=[],this._lastMutation=0,this._lastScroll=0}}removeListeners(){this._teardown&&this._teardown(),this._checkClickTimeout&&clearTimeout(this._checkClickTimeout)}handleClick(t,n){if(vP(n,this._ignoreSelector)||!EP(t))return;const r={timestamp:ou(t.timestamp),clickBreadcrumb:t,clickCount:0,node:n};this._clicks.some(i=>i.node===r.node&&Math.abs(i.timestamp-r.timestamp)<1)||(this._clicks.push(r),this._clicks.length===1&&this._scheduleCheckClicks())}registerMutation(t=Date.now()){this._lastMutation=ou(t)}registerScroll(t=Date.now()){this._lastScroll=ou(t)}registerClick(t){const n=Gb(t);this._handleMultiClick(n)}_handleMultiClick(t){this._getClicks(t).forEach(n=>{n.clickCount++})}_getClicks(t){return this._clicks.filter(n=>n.node===t)}_checkClicks(){const t=[],n=Ah();this._clicks.forEach(r=>{!r.mutationAfter&&this._lastMutation&&(r.mutationAfter=r.timestamp<=this._lastMutation?this._lastMutation-r.timestamp:void 0),!r.scrollAfter&&this._lastScroll&&(r.scrollAfter=r.timestamp<=this._lastScroll?this._lastScroll-r.timestamp:void 0),r.timestamp+this._timeout<=n&&t.push(r)});for(const r of t){const i=this._clicks.indexOf(r);i>-1&&(this._generateBreadcrumbs(r),this._clicks.splice(i,1))}this._clicks.length&&this._scheduleCheckClicks()}_generateBreadcrumbs(t){const n=this._replay,r=t.scrollAfter&&t.scrollAfter<=this._scrollTimeout,i=t.mutationAfter&&t.mutationAfter<=this._threshold,s=!r&&!i,{clickCount:o,clickBreadcrumb:a}=t;if(s){const c=Math.min(t.mutationAfter||this._timeout,this._timeout)*1e3,u=c1){const c={type:"default",message:a.message,timestamp:a.timestamp,category:"ui.multiClick",data:{...a.data,url:Te.location.href,route:n.getCurrentRoute(),clickCount:o,metric:!0}};this._addBreadcrumbEvent(n,c)}}_scheduleCheckClicks(){this._checkClickTimeout&&clearTimeout(this._checkClickTimeout),this._checkClickTimeout=zs(()=>this._checkClicks(),1e3)}}const SP=["A","BUTTON","INPUT"];function vP(e,t){return!!(!SP.includes(e.tagName)||e.tagName==="INPUT"&&!["submit","button"].includes(e.getAttribute("type")||"")||e.tagName==="A"&&(e.hasAttribute("download")||e.hasAttribute("target")&&e.getAttribute("target")!=="_self")||t&&e.matches(t))}function EP(e){return!!(e.data&&typeof e.data.nodeId=="number"&&e.timestamp)}function Ah(){return Date.now()/1e3}function TP(e,t){try{if(!wP(t))return;const{source:n}=t.data;if(_P.has(n)&&e.registerMutation(t.timestamp),n===K.Scroll&&e.registerScroll(t.timestamp),IP(t)){const{type:r,id:i}=t.data,s=Ft.mirror.getNode(i);s instanceof HTMLElement&&r===tt.Click&&e.registerClick(s)}}catch{}}function wP(e){return e.type===dP}function IP(e){return e.data.source===K.MouseInteraction}function Yt(e){return{timestamp:Date.now()/1e3,type:"default",...e}}var yc=(e=>(e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment",e))(yc||{});const kP=new Set(["id","class","aria-label","role","name","alt","title","data-test-id","data-testid","disabled","aria-disabled","data-sentry-component"]);function RP(e){const t={};!e["data-sentry-component"]&&e["data-sentry-element"]&&(e["data-sentry-component"]=e["data-sentry-element"]);for(const n in e)if(kP.has(n)){let r=n;(n==="data-testid"||n==="data-test-id")&&(r="testId"),t[r]=e[n]}return t}const AP=e=>t=>{if(!e.isEnabled())return;const n=CP(t);if(!n)return;const r=t.name==="click",i=r?t.event:void 0;r&&e.clickDetector&&i?.target&&!i.altKey&&!i.metaKey&&!i.ctrlKey&&!i.shiftKey&&yP(e.clickDetector,n,Vb(t.event)),Gs(e,n)};function Kb(e,t){const n=Ft.mirror.getId(e),r=n&&Ft.mirror.getNode(n),i=r&&Ft.mirror.getMeta(r),s=i&&OP(i)?i:null;return{message:t,data:s?{nodeId:n,node:{id:n,tagName:s.tagName,textContent:Array.from(s.childNodes).map(o=>o.type===yc.Text&&o.textContent).filter(Boolean).map(o=>o.trim()).join(""),attributes:RP(s.attributes)}}:{}}}function CP(e){const{target:t,message:n}=xP(e);return Yt({category:`ui.${e.name}`,...Kb(t,n)})}function xP(e){const t=e.name==="click";let n,r=null;try{r=t?Vb(e.event):Yb(e.event),n=Be(r,{maxStringLength:200})||""}catch{n=""}return{target:r,message:n}}function OP(e){return e.type===yc.Element}function MP(e,t){if(!e.isEnabled())return;e.updateUserActivity();const n=NP(t);n&&Gs(e,n)}function NP(e){const{metaKey:t,shiftKey:n,ctrlKey:r,altKey:i,key:s,target:o}=e;if(!o||PP(o)||!s)return null;const a=t||r||i,c=s.length===1;if(!a&&c)return null;const u=Be(o,{maxStringLength:200})||"",d=Kb(o,u);return Yt({category:"ui.keyDown",message:u,data:{...d.data,metaKey:t,shiftKey:n,ctrlKey:r,altKey:i,key:s}})}function PP(e){return e.tagName==="INPUT"||e.tagName==="TEXTAREA"||e.isContentEditable}const LP={resource:BP,paint:$P,navigation:UP};function au(e,t){return({metric:n})=>void t.replayPerformanceEntries.push(e(n))}function DP(e){return e.map(FP).filter(Boolean)}function FP(e){const t=LP[e.entryType];return t?t(e):null}function hi(e){return((De()||Te.performance.timeOrigin)+e)/1e3}function $P(e){const{duration:t,entryType:n,name:r,startTime:i}=e,s=hi(i);return{type:n,name:r,start:s,end:s+t,data:void 0}}function UP(e){const{entryType:t,name:n,decodedBodySize:r,duration:i,domComplete:s,encodedBodySize:o,domContentLoadedEventStart:a,domContentLoadedEventEnd:c,domInteractive:u,loadEventStart:d,loadEventEnd:l,redirectCount:p,startTime:f,transferSize:h,type:m}=e;return i===0?null:{type:`${t}.${m}`,start:hi(f),end:hi(s),name:n,data:{size:h,decodedBodySize:r,encodedBodySize:o,duration:i,domInteractive:u,domContentLoadedEventStart:a,domContentLoadedEventEnd:c,loadEventStart:d,loadEventEnd:l,domComplete:s,redirectCount:p}}}function BP(e){const{entryType:t,initiatorType:n,name:r,responseEnd:i,startTime:s,decodedBodySize:o,encodedBodySize:a,responseStatus:c,transferSize:u}=e;return["fetch","xmlhttprequest"].includes(n)?null:{type:`${t}.${n}`,start:hi(s),end:hi(i),name:r,data:{size:u,statusCode:c,decodedBodySize:o,encodedBodySize:a}}}function HP(e){const t=e.entries[e.entries.length-1],n=t?.element?[t.element]:void 0;return Fd(e,"largest-contentful-paint",n)}function jP(e){return e.sources!==void 0}function WP(e){const t=[],n=[];for(const r of e.entries)if(jP(r)){const i=[];for(const s of r.sources)if(s.node){n.push(s.node);const o=Ft.mirror.getId(s.node);o&&i.push(o)}t.push({value:r.value,nodeIds:i.length?i:void 0})}return Fd(e,"cumulative-layout-shift",n,t)}function zP(e){const t=e.entries[e.entries.length-1],n=t?.target?[t.target]:void 0;return Fd(e,"interaction-to-next-paint",n)}function Fd(e,t,n,r){const i=e.value,s=e.rating,o=hi(i);return{type:"web-vital",name:t,start:o,end:o,data:{value:i,size:i,rating:s,nodeIds:n?n.map(a=>Ft.mirror.getId(a)):void 0,attributions:r}}}function qP(e){function t(i){e.performanceEntries.includes(i)||e.performanceEntries.push(i)}function n({entries:i}){i.forEach(t)}const r=[];return["navigation","paint","resource"].forEach(i=>{r.push(Cr(i,n))}),r.push(cc(au(HP,e)),ac(au(WP,e)),vd(au(zP,e))),()=>{r.forEach(i=>i())}}const z=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,GP='var t=Uint8Array,n=Uint16Array,r=Int32Array,e=new t([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),i=new t([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),s=new t([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),a=function(t,e){for(var i=new n(31),s=0;s<31;++s)i[s]=e+=1<>1|(21845&c)<<1;v=(61680&(v=(52428&v)>>2|(13107&v)<<2))>>4|(3855&v)<<4,u[c]=((65280&v)>>8|(255&v)<<8)>>1}var d=function(t,r,e){for(var i=t.length,s=0,a=new n(r);s>f]=l}else for(o=new n(i),s=0;s>15-t[s]);return o},p=new t(288);for(c=0;c<144;++c)p[c]=8;for(c=144;c<256;++c)p[c]=9;for(c=256;c<280;++c)p[c]=7;for(c=280;c<288;++c)p[c]=8;var g=new t(32);for(c=0;c<32;++c)g[c]=5;var w=d(p,9,0),y=d(g,5,0),m=function(t){return(t+7)/8|0},b=function(n,r,e){return(null==e||e>n.length)&&(e=n.length),new t(n.subarray(r,e))},M=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],E=function(t,n,r){var e=new Error(n||M[t]);if(e.code=t,Error.captureStackTrace&&Error.captureStackTrace(e,E),!r)throw e;return e},z=function(t,n,r){r<<=7&n;var e=n/8|0;t[e]|=r,t[e+1]|=r>>8},_=function(t,n,r){r<<=7&n;var e=n/8|0;t[e]|=r,t[e+1]|=r>>8,t[e+2]|=r>>16},x=function(r,e){for(var i=[],s=0;sd&&(d=o[s].s);var p=new n(d+1),g=A(i[c-1],p,0);if(g>e){s=0;var w=0,y=g-e,m=1<e))break;w+=m-(1<>=y;w>0;){var M=o[s].s;p[M]=0&&w;--s){var E=o[s].s;p[E]==e&&(--p[E],++w)}g=e}return{t:new t(p),l:g}},A=function(t,n,r){return-1==t.s?Math.max(A(t.l,n,r+1),A(t.r,n,r+1)):n[t.s]=r},D=function(t){for(var r=t.length;r&&!t[--r];);for(var e=new n(++r),i=0,s=t[0],a=1,o=function(t){e[i++]=t},h=1;h<=r;++h)if(t[h]==s&&h!=r)++a;else{if(!s&&a>2){for(;a>138;a-=138)o(32754);a>2&&(o(a>10?a-11<<5|28690:a-3<<5|12305),a=0)}else if(a>3){for(o(s),--a;a>6;a-=6)o(8304);a>2&&(o(a-3<<5|8208),a=0)}for(;a--;)o(s);a=1,s=t[h]}return{c:e.subarray(0,i),n:r}},T=function(t,n){for(var r=0,e=0;e>8,t[i+2]=255^t[i],t[i+3]=255^t[i+1];for(var s=0;s4&&!H[s[K-1]];--K);var N,P,Q,R,V=v+5<<3,W=T(h,p)+T(f,g)+l,X=T(h,M)+T(f,U)+l+14+3*K+T(q,H)+2*q[16]+3*q[17]+7*q[18];if(c>=0&&V<=W&&V<=X)return k(r,m,t.subarray(c,c+v));if(z(r,m,1+(X15&&(z(r,m,tt[B]>>5&127),m+=tt[B]>>12)}}}else N=w,P=p,Q=y,R=g;for(B=0;B255){_(r,m,N[(nt=rt>>18&31)+257]),m+=P[nt+257],nt>7&&(z(r,m,rt>>23&31),m+=e[nt]);var et=31&rt;_(r,m,Q[et]),m+=R[et],et>3&&(_(r,m,rt>>5&8191),m+=i[et])}else _(r,m,N[rt]),m+=P[rt]}return _(r,m,N[256]),m+P[256]},C=new r([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),F=new t(0),I=function(){for(var t=new Int32Array(256),n=0;n<256;++n){for(var r=n,e=9;--e;)r=(1&r&&-306674912)^r>>>1;t[n]=r}return t}(),S=function(){var t=1,n=0;return{p:function(r){for(var e=t,i=n,s=0|r.length,a=0;a!=s;){for(var o=Math.min(a+2655,s);a>16),i=(65535&i)+15*(i>>16)}t=e,n=i},d:function(){return(255&(t%=65521))<<24|(65280&t)<<8|(255&(n%=65521))<<8|n>>8}}},L=function(s,a,o,h,u){if(!u&&(u={l:1},a.dictionary)){var c=a.dictionary.subarray(-32768),v=new t(c.length+s.length);v.set(c),v.set(s,c.length),s=v,u.w=c.length}return function(s,a,o,h,u,c){var v=c.z||s.length,d=new t(h+v+5*(1+Math.ceil(v/7e3))+u),p=d.subarray(h,d.length-u),g=c.l,w=7&(c.r||0);if(a){w&&(p[0]=c.r>>3);for(var y=C[a-1],M=y>>13,E=8191&y,z=(1<7e3||q>24576)&&(N>423||!g)){w=U(s,p,0,F,I,S,O,q,G,j-G,w),q=L=O=0,G=j;for(var P=0;P<286;++P)I[P]=0;for(P=0;P<30;++P)S[P]=0}var Q=2,R=0,V=E,W=J-K&32767;if(N>2&&H==T(j-W))for(var X=Math.min(M,N)-1,Y=Math.min(32767,j),Z=Math.min(258,N);W<=Y&&--V&&J!=K;){if(s[j+Q]==s[j+Q-W]){for(var $=0;$Q){if(Q=$,R=W,$>X)break;var tt=Math.min(W,$-2),nt=0;for(P=0;Pnt&&(nt=et,K=rt)}}}W+=(J=K)-(K=_[J])&32767}if(R){F[q++]=268435456|f[Q]<<18|l[R];var it=31&f[Q],st=31&l[R];O+=e[it]+i[st],++I[257+it],++S[st],B=j+Q,++L}else F[q++]=s[j],++I[s[j]]}}for(j=Math.max(j,B);j=v&&(p[w/8|0]=g,at=v),w=k(p,w+1,s.subarray(j,at))}c.i=v}return b(d,0,h+m(w)+u)}(s,null==a.level?6:a.level,null==a.mem?u.l?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(s.length)))):20:12+a.mem,o,h,u)},O=function(t,n,r){for(;r;++n)t[n]=r,r>>>=8},j=function(){function n(n,r){if("function"==typeof n&&(r=n,n={}),this.ondata=r,this.o=n||{},this.s={l:0,i:32768,w:32768,z:32768},this.b=new t(98304),this.o.dictionary){var e=this.o.dictionary.subarray(-32768);this.b.set(e,32768-e.length),this.s.i=32768-e.length}}return n.prototype.p=function(t,n){this.ondata(L(t,this.o,0,0,this.s),n)},n.prototype.push=function(n,r){this.ondata||E(5),this.s.l&&E(4);var e=n.length+this.s.z;if(e>this.b.length){if(e>2*this.b.length-32768){var i=new t(-32768&e);i.set(this.b.subarray(0,this.s.z)),this.b=i}var s=this.b.length-this.s.z;this.b.set(n.subarray(0,s),this.s.z),this.s.z=this.b.length,this.p(this.b,!1),this.b.set(this.b.subarray(-32768)),this.b.set(n.subarray(s),32768),this.s.z=n.length-s+32768,this.s.i=32766,this.s.w=32768}else this.b.set(n,this.s.z),this.s.z+=n.length;this.s.l=1&r,(this.s.z>this.s.w+8191||r)&&(this.p(this.b,r||!1),this.s.w=this.s.i,this.s.i-=2)},n.prototype.flush=function(){this.ondata||E(5),this.s.l&&E(4),this.p(this.b,!1),this.s.w=this.s.i,this.s.i-=2},n}();function q(t,n){n||(n={});var r=function(){var t=-1;return{p:function(n){for(var r=t,e=0;e>>8;t=r},d:function(){return~t}}}(),e=t.length;r.p(t);var i,s=L(t,n,10+((i=n).filename?i.filename.length+1:0),8),a=s.length;return function(t,n){var r=n.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=n.level<2?4:9==n.level?2:0,t[9]=3,0!=n.mtime&&O(t,4,Math.floor(new Date(n.mtime||Date.now())/1e3)),r){t[3]=8;for(var e=0;e<=r.length;++e)t[e+10]=r.charCodeAt(e)}}(s,n),O(s,a-8,r.d()),O(s,a-4,e),s}var B=function(){function t(t,n){this.c=S(),this.v=1,j.call(this,t,n)}return t.prototype.push=function(t,n){this.c.p(t),j.prototype.push.call(this,t,n)},t.prototype.p=function(t,n){var r=L(t,this.o,this.v&&(this.o.dictionary?6:2),n&&4,this.s);this.v&&(function(t,n){var r=n.level,e=0==r?0:r<6?1:9==r?3:2;if(t[0]=120,t[1]=e<<6|(n.dictionary&&32),t[1]|=31-(t[0]<<8|t[1])%31,n.dictionary){var i=S();i.p(n.dictionary),O(t,2,i.d())}}(r,this.o),this.v=0),n&&O(r,r.length-4,this.c.d()),this.ondata(r,n)},t.prototype.flush=function(){j.prototype.flush.call(this)},t}(),G="undefined"!=typeof TextEncoder&&new TextEncoder,H="undefined"!=typeof TextDecoder&&new TextDecoder;try{H.decode(F,{stream:!0})}catch(t){}var J=function(){function t(t){this.ondata=t}return t.prototype.push=function(t,n){this.ondata||E(5),this.d&&E(4),this.ondata(K(t),this.d=n||!1)},t}();function K(n,r){if(G)return G.encode(n);for(var e=n.length,i=new t(n.length+(n.length>>1)),s=0,a=function(t){i[s++]=t},o=0;oi.length){var h=new t(s+8+(e-o<<1));h.set(i),i=h}var f=n.charCodeAt(o);f<128||r?a(f):f<2048?(a(192|f>>6),a(128|63&f)):f>55295&&f<57344?(a(240|(f=65536+(1047552&f)|1023&n.charCodeAt(++o))>>18),a(128|f>>12&63),a(128|f>>6&63),a(128|63&f)):(a(224|f>>12),a(128|f>>6&63),a(128|63&f))}return b(i,0,s)}const N=new class{constructor(){this._init()}clear(){this._init()}addEvent(t){if(!t)throw new Error("Adding invalid event");const n=this._hasEvents?",":"";this.stream.push(n+t),this._hasEvents=!0}finish(){this.stream.push("]",!0);const t=function(t){let n=0;for(const r of t)n+=r.length;const r=new Uint8Array(n);for(let n=0,e=0,i=t.length;n{this._deflatedData.push(t)},this.stream=new J((t,n)=>{this.deflate.push(t,n)}),this.stream.push("[")}},P={clear:()=>{N.clear()},addEvent:t=>N.addEvent(t),finish:()=>N.finish(),compress:t=>function(t){return q(K(t))}(t)};addEventListener("message",function(t){const n=t.data.method,r=t.data.id,e=t.data.arg;if(n in P&&"function"==typeof P[n])try{const t=P[n](e);postMessage({id:r,method:n,success:!0,response:t})}catch(t){postMessage({id:r,method:n,success:!1,response:t.message}),console.error(t)}}),postMessage({id:void 0,method:"init",success:!0,response:void 0});';function VP(){const e=new Blob([GP]);return URL.createObjectURL(e)}const Ch=["log","warn","error"],Go="[Replay] ";function cu(e,t="info"){Ut({category:"console",data:{logger:"replay"},level:t,message:`${Go}${e}`},{level:t})}function YP(){let e=!1,t=!1;const n={exception:()=>{},infoTick:()=>{},setConfig:r=>{e=!!r.captureExceptions,t=!!r.traceInternals}};return z?(Ch.forEach(r=>{n[r]=(...i)=>{y[r](Go,...i),t&&cu(i.join(""),la(r))}}),n.exception=(r,...i)=>{i.length&&n.error&&n.error(...i),y.error(Go,r),e?be(r,{mechanism:{handled:!0,type:"auto.function.replay.debug"}}):t&&cu(r,"error")},n.infoTick=(...r)=>{y.log(Go,...r),t&&setTimeout(()=>cu(r[0]),0)}):Ch.forEach(r=>{n[r]=()=>{}}),n}const q=YP();class $d extends Error{constructor(){super(`Event buffer exceeded maximum size of ${xd}.`)}}class Jb{constructor(){this.events=[],this._totalSize=0,this.hasCheckout=!1,this.waitForCheckout=!1}get hasEvents(){return this.events.length>0}get type(){return"sync"}destroy(){this.events=[]}async addEvent(t){const n=JSON.stringify(t).length;if(this._totalSize+=n,this._totalSize>xd)throw new $d;this.events.push(t)}finish(){return new Promise(t=>{const n=this.events;this.clear(),t(JSON.stringify(n))})}clear(){this.events=[],this._totalSize=0,this.hasCheckout=!1}getEarliestTimestamp(){let t=null;for(const{timestamp:n}of this.events)(t===null||n{this._worker.addEventListener("message",({data:r})=>{r.success?t():(z&&q.warn("Received worker message with unsuccessful status",r),n(new Error("Received worker message with unsuccessful status")))},{once:!0}),this._worker.addEventListener("error",r=>{z&&q.warn("Failed to load Replay compression worker",r),n(new Error(`Failed to load Replay compression worker: ${r instanceof ErrorEvent&&r.message?r.message:"Unknown error. This can happen due to CSP policy restrictions, network issues, or the worker script failing to load."}`))},{once:!0})}),this._ensureReadyPromise)}destroy(){z&&q.log("Destroying compression worker"),this._worker.removeEventListener("message",this._onMessage),this._pending.forEach(t=>t.reject(new Error("Worker destroyed"))),this._pending.clear(),this._worker.terminate()}postMessage(t,n){const r=this._getAndIncrementId();return new Promise((i,s)=>{this._pending.set(r,{method:t,resolve:i,reject:s});try{this._worker.postMessage({id:r,method:t,arg:n})}catch(o){this._pending.delete(r),s(o)}})}__init(){this._onMessage=({data:t})=>{const n=t;if(typeof n.id!="number")return;const r=this._pending.get(n.id);if(!(!r||r.method!==n.method)){if(this._pending.delete(n.id),!n.success){z&&q.error("Error in compression worker: ",n.response),r.reject(new Error("Error in compression worker"));return}r.resolve(n.response)}}}_getAndIncrementId(){return this._id++}}class KP{constructor(t){this._worker=new Ud(t),this._earliestTimestamp=null,this._totalSize=0,this.hasCheckout=!1,this.waitForCheckout=!1}get hasEvents(){return!!this._earliestTimestamp}get type(){return"worker"}ensureReady(){return this._worker.ensureReady()}destroy(){this._worker.destroy()}addEvent(t){const n=Dd(t.timestamp);(!this._earliestTimestamp||nxd?Promise.reject(new $d):this._sendEventToWorker(r)}finish(){return this._finishRequest()}clear(){this._earliestTimestamp=null,this._totalSize=0,this.hasCheckout=!1,this._worker.postMessage("clear").then(null,t=>{z&&q.exception(t,'Sending "clear" message to worker failed',t)})}getEarliestTimestamp(){return this._earliestTimestamp}_sendEventToWorker(t){return this._worker.postMessage("addEvent",t)}async _finishRequest(){const t=await this._worker.postMessage("finish");return this._earliestTimestamp=null,this._totalSize=0,t}}class JP{constructor(t){this._fallback=new Jb,this._compression=new KP(t),this._used=this._fallback,this._ensureWorkerIsLoadedPromise=this._ensureWorkerIsLoaded()}get waitForCheckout(){return this._used.waitForCheckout}get type(){return this._used.type}get hasEvents(){return this._used.hasEvents}get hasCheckout(){return this._used.hasCheckout}set hasCheckout(t){this._used.hasCheckout=t}set waitForCheckout(t){this._used.waitForCheckout=t}destroy(){this._fallback.destroy(),this._compression.destroy()}clear(){return this._used.clear()}getEarliestTimestamp(){return this._used.getEarliestTimestamp()}addEvent(t){return this._used.addEvent(t)}async finish(){return await this.ensureWorkerIsLoaded(),this._used.finish()}ensureWorkerIsLoaded(){return this._ensureWorkerIsLoadedPromise}async _ensureWorkerIsLoaded(){try{await this._compression.ensureReady()}catch(t){z&&q.exception(t,"Failed to load the compression worker, falling back to simple buffer");return}await this._switchToCompressionWorker()}async _switchToCompressionWorker(){const{events:t,hasCheckout:n,waitForCheckout:r}=this._fallback,i=[];for(const s of t)i.push(this._compression.addEvent(s));this._compression.hasCheckout=n,this._compression.waitForCheckout=r,this._used=this._compression;try{await Promise.all(i),this._fallback.clear()}catch(s){z&&q.exception(s,"Failed to add events when switching buffers.")}}}function XP({useCompression:e,workerUrl:t}){if(e&&window.Worker){const n=QP(t);if(n)return n}return z&&q.log("Using simple buffer"),new Jb}function QP(e){try{const t=e||ZP();if(!t)return;z&&q.log(`Using compression worker${e?` from ${e}`:""}`);const n=new Worker(t);return new JP(n)}catch(t){z&&q.exception(t,"Failed to create compression worker")}}function ZP(){return typeof __SENTRY_EXCLUDE_REPLAY_WORKER__>"u"||!__SENTRY_EXCLUDE_REPLAY_WORKER__?VP():""}function Bd(){try{return"sessionStorage"in Te&&!!Te.sessionStorage}catch{return!1}}function eL(e){tL(),e.session=void 0}function tL(){if(Bd())try{Te.sessionStorage.removeItem(Ad)}catch{}}function Xb(e){return e===void 0?!1:Math.random()e.getContext().initialTimestamp+e.getOptions().maxReplayDuration?(z&&q.infoTick(`Skipping event with timestamp ${n} because it is after maxReplayDuration`),!1):!0}function aL(e,t){try{if(typeof t=="function"&&sL(e))return t(e)}catch(n){return z&&q.exception(n,"An error occurred in the `beforeAddRecordingEvent` callback, skipping the event..."),null}return e}function jd(e){return!e.type}function pl(e){return e.type==="transaction"}function cL(e){return e.type==="replay_event"}function Oh(e){return e.type==="feedback"}function uL(e){return(t,n)=>{if(!e.isEnabled()||!jd(t)&&!pl(t))return;const r=n.statusCode;if(!(!r||r<200||r>=300)){if(pl(t)){lL(e,t);return}dL(e,t)}}}function lL(e,t){const n=e.getContext();t.contexts?.trace?.trace_id&&n.traceIds.size<100&&n.traceIds.add(t.contexts.trace.trace_id)}function dL(e,t){const n=e.getContext();if(t.event_id&&n.errorIds.size<100&&n.errorIds.add(t.event_id),e.recordingMode!=="buffer"||!t.tags?.replayId)return;const{beforeErrorSampling:r}=e.getOptions();typeof r=="function"&&!r(t)||zs(async()=>{try{await e.sendBufferedReplayOrFlush()}catch(i){e.handleException(i)}})}function fL(e){return t=>{!e.isEnabled()||!jd(t)||pL(e,t)}}function pL(e,t){const n=t.exception?.values?.[0]?.value;if(typeof n=="string"&&(n.match(/(reactjs\.org\/docs\/error-decoder\.html\?invariant=|react\.dev\/errors\/)(418|419|422|423|425)/)||n.match(/(does not match server-rendered HTML|Hydration failed because)/i))){const r=Yt({category:"replay.hydrate-error",data:{url:xr()}});Gs(e,r)}}function hL(e){const t=O();t&&t.on("beforeAddBreadcrumb",n=>mL(e,n))}function mL(e,t){if(!e.isEnabled()||!tS(t))return;const n=gL(t);n&&Gs(e,n)}function gL(e){return!tS(e)||["fetch","xhr","sentry.event","sentry.transaction"].includes(e.category)||e.category.startsWith("ui.")?null:e.category==="console"?_L(e):Yt(e)}function _L(e){const t=e.data?.arguments;if(!Array.isArray(t)||t.length===0)return Yt(e);let n=!1;const r=t.map(i=>{if(!i)return i;if(typeof i=="string")return i.length>mo?(n=!0,`${i.slice(0,mo)}…`):i;if(typeof i=="object")try{const s=Ge(i,7);return JSON.stringify(s).length>mo?(n=!0,`${JSON.stringify(s,null,2).slice(0,mo)}…`):s}catch{}return i});return Yt({...e,data:{...e.data,arguments:r,...n?{_meta:{warnings:["CONSOLE_ARG_TRUNCATED"]}}:{}}})}function tS(e){return!!e.category}function yL(e,t){return e.type||!e.exception?.values?.length?!1:!!t.originalException?.__rrweb__}function xa(){const e=G().getPropagationContext().dsc;e&&delete e.replay_id;const t=Ae();if(t){const n=gt(t);delete n.replay_id}}function bL(e){const t=G().getPropagationContext().dsc;t&&(t.replay_id=e);const n=Ae();if(n){const r=gt(n);r.replay_id=e}}function SL(e,t){e.triggerUserActivity(),e.addUpdate(()=>t.timestamp?(e.throttledAddEvent({type:ie.Custom,timestamp:t.timestamp*1e3,data:{tag:"breadcrumb",payload:{timestamp:t.timestamp,type:"default",category:"sentry.feedback",data:{feedbackId:t.event_id}}}}),!1):!0)}function vL(e,t){return e.recordingMode!=="buffer"||t.message===Cd||!t.exception||t.type?!1:Xb(e.getOptions().errorSampleRate)}function EL(e){return Object.assign((t,n)=>{if(e.session&&Ca(e.session,{maxReplayDuration:e.getOptions().maxReplayDuration,sessionIdleExpire:e.timeouts.sessionIdleExpire})&&xa(),!e.isEnabled()||e.isPaused())return t;if(cL(t))return delete t.breadcrumbs,t;if(!jd(t)&&!pl(t)&&!Oh(t))return t;if(!e.checkAndHandleExpiredSession())return xa(),t;if(Oh(t))return e.flush(),t.contexts.feedback.replay_id=e.getSessionId(),SL(e,t),t;if(yL(t,n)&&!e.getOptions()._experiments.captureExceptions)return z&&q.log("Ignoring error from rrweb internals",t),null;const i=vL(e,t);if((i||e.recordingMode==="session")&&(t.tags={...t.tags,replayId:e.getSessionId()}),i&&e.recordingMode==="buffer"&&e.session?.sampled==="buffer"){const o=e.session;o.dirty=!0,e.getOptions().stickySession&&bc(o)}return t},{id:"Replay"})}function Sc(e,t){return t.map(({type:n,start:r,end:i,name:s,data:o})=>{const a=e.throttledAddEvent({type:ie.Custom,timestamp:r,data:{tag:"performanceSpan",payload:{op:n,description:s,startTimestamp:r,endTimestamp:i,data:o}}});return typeof a=="string"?Promise.resolve(null):a})}function TL(e){const{from:t,to:n}=e,r=Date.now()/1e3;return{type:"navigation.push",start:r,end:r,name:n,data:{previous:t}}}function wL(e){return t=>{if(!e.isEnabled())return;const n=TL(t);n!==null&&(e.getContext().urls.push(n.name),e.triggerUserActivity(),e.addUpdate(()=>(Sc(e,[n]),!1)))}}function IL(e,t){return z&&e.getOptions()._experiments.traceInternals?!1:I_(t,O())}function nS(e,t){e.isEnabled()&&t!==null&&(IL(e,t.name)||e.addUpdate(()=>(Sc(e,[t]),!0)))}function vc(e){if(!e)return;const t=new TextEncoder;try{if(typeof e=="string")return t.encode(e).length;if(e instanceof URLSearchParams)return t.encode(e.toString()).length;if(e instanceof FormData){const n=Zy(e);return t.encode(n).length}if(e instanceof Blob)return e.size;if(e instanceof ArrayBuffer)return e.byteLength}catch{}}function rS(e){if(!e)return;const t=parseInt(e,10);return isNaN(t)?void 0:t}function Oa(e,t){if(!e)return{headers:{},size:void 0,_meta:{warnings:[t]}};const n={...e._meta},r=n.warnings||[];return n.warnings=[...r,t],e._meta=n,e}function iS(e,t){if(!t)return null;const{startTimestamp:n,endTimestamp:r,url:i,method:s,statusCode:o,request:a,response:c}=t;return{type:e,start:n/1e3,end:r/1e3,name:i,data:{method:s,statusCode:o,request:a,response:c}}}function Ss(e){return{headers:{},size:e,_meta:{warnings:["URL_SKIPPED"]}}}function zn(e,t,n){if(!t&&Object.keys(e).length===0)return;if(!t)return{headers:e};if(!n)return{headers:e,size:t};const r={headers:e,size:t},{body:i,warnings:s}=kL(n);return r.body=i,s?.length&&(r._meta={warnings:s}),r}function hl(e,t){return Object.entries(e).reduce((n,[r,i])=>{const s=r.toLowerCase();return t.includes(s)&&e[r]&&(n[s]=i),n},{})}function kL(e){if(!e||typeof e!="string")return{body:e};const t=e.length>dh,n=RL(e);if(t){const r=e.slice(0,dh);return n?{body:r,warnings:["MAYBE_JSON_TRUNCATED"]}:{body:`${r}…`,warnings:["TEXT_TRUNCATED"]}}if(n)try{return{body:JSON.parse(e)}}catch{}return{body:e}}function RL(e){const t=e[0],n=e[e.length-1];return t==="["&&n==="]"||t==="{"&&n==="}"}function Ma(e,t){const n=AL(e);return Tt(n,t)}function AL(e,t=Te.document.baseURI){if(e.startsWith("http://")||e.startsWith("https://")||e.startsWith(Te.location.origin))return e;const n=new URL(e,t);if(n.origin!==new URL(t).origin)return e;const r=n.href;return!e.endsWith("/")&&r.endsWith("/")?r.slice(0,-1):r}async function CL(e,t,n){try{const r=await OL(e,t,n),i=iS("resource.fetch",r);nS(n.replay,i)}catch(r){z&&q.exception(r,"Failed to capture fetch breadcrumb")}}function xL(e,t){const{input:n,response:r}=t,i=n?kd(n):void 0,s=vc(i),o=r?rS(r.headers.get("content-length")):void 0;s!==void 0&&(e.data.request_body_size=s),o!==void 0&&(e.data.response_body_size=o)}async function OL(e,t,n){const r=Date.now(),{startTimestamp:i=r,endTimestamp:s=r}=t,{url:o,method:a,status_code:c=0,request_body_size:u,response_body_size:d}=e.data,l=Ma(o,n.networkDetailAllowUrls)&&!Ma(o,n.networkDetailDenyUrls),p=l?ML(n,t.input,u):Ss(u),f=await NL(l,n,t.response,d);return{startTimestamp:i,endTimestamp:s,url:o,method:a,statusCode:c,request:p,response:f}}function ML({networkCaptureBodies:e,networkRequestHeaders:t},n,r){const i=n?DL(n,t):{};if(!e)return zn(i,r,void 0);const s=kd(n),[o,a]=Ea(s,q),c=zn(i,r,o);return a?Oa(c,a):c}async function NL(e,{networkCaptureBodies:t,networkResponseHeaders:n},r,i){if(!e&&i!==void 0)return Ss(i);const s=r?sS(r.headers,n):{};if(!r||!t&&i!==void 0)return zn(s,i,void 0);const[o,a]=await LL(r),c=PL(o,{networkCaptureBodies:t,responseBodySize:i,captureDetails:e,headers:s});return a?Oa(c,a):c}function PL(e,{networkCaptureBodies:t,responseBodySize:n,captureDetails:r,headers:i}){try{const s=e?.length&&n===void 0?vc(e):n;return r?t?zn(i,s,e):zn(i,s,void 0):Ss(s)}catch(s){return z&&q.exception(s,"Failed to serialize response body"),zn(i,n,void 0)}}async function LL(e){const t=FL(e);if(!t)return[void 0,"BODY_PARSE_ERROR"];try{return[await $L(t)]}catch(n){return n instanceof Error&&n.message.indexOf("Timeout")>-1?(z&&q.warn("Parsing text body from response timed out"),[void 0,"BODY_PARSE_TIMEOUT"]):(z&&q.exception(n,"Failed to get text body from response"),[void 0,"BODY_PARSE_ERROR"])}}function sS(e,t){const n={};return t.forEach(r=>{e.get(r)&&(n[r]=e.get(r))}),n}function DL(e,t){return e.length===1&&typeof e[0]!="string"?Mh(e[0],t):e.length===2?Mh(e[1],t):{}}function Mh(e,t){if(!e)return{};const n=e.headers;return n?n instanceof Headers?sS(n,t):Array.isArray(n)?{}:hl(n,t):{}}function FL(e){try{return e.clone()}catch(t){z&&q.exception(t,"Failed to clone response body")}}function $L(e){return new Promise((t,n)=>{const r=zs(()=>n(new Error("Timeout while trying to read response body")),500);UL(e).then(i=>t(i),i=>n(i)).finally(()=>clearTimeout(r))})}async function UL(e){return await e.text()}async function BL(e,t,n){try{const r=jL(e,t,n),i=iS("resource.xhr",r);nS(n.replay,i)}catch(r){z&&q.exception(r,"Failed to capture xhr breadcrumb")}}function HL(e,t){const{xhr:n,input:r}=t;if(!n)return;const i=vc(r),s=n.getResponseHeader("content-length")?rS(n.getResponseHeader("content-length")):qL(n.response,n.responseType);i!==void 0&&(e.data.request_body_size=i),s!==void 0&&(e.data.response_body_size=s)}function jL(e,t,n){const r=Date.now(),{startTimestamp:i=r,endTimestamp:s=r,input:o,xhr:a}=t,{url:c,method:u,status_code:d=0,request_body_size:l,response_body_size:p}=e.data;if(!c)return null;if(!a||!Ma(c,n.networkDetailAllowUrls)||Ma(c,n.networkDetailDenyUrls)){const T=Ss(l),b=Ss(p);return{startTimestamp:i,endTimestamp:s,url:c,method:u,statusCode:d,request:T,response:b}}const f=a[hn],h=f?hl(f.request_headers,n.networkRequestHeaders):{},m=hl(eb(a),n.networkResponseHeaders),[g,_]=n.networkCaptureBodies?Ea(o,q):[void 0],[S,E]=n.networkCaptureBodies?WL(a):[void 0],v=zn(h,l,g),w=zn(m,p,S);return{startTimestamp:i,endTimestamp:s,url:c,method:u,statusCode:d,request:_?Oa(v,_):v,response:E?Oa(w,E):w}}function WL(e){const t=[];try{return[e.responseText]}catch(n){t.push(n)}try{return zL(e.response,e.responseType)}catch(n){t.push(n)}return z&&q.warn("Failed to get xhr response body",...t),[void 0]}function zL(e,t){try{if(typeof e=="string")return[e];if(e instanceof Document)return[e.body.outerHTML];if(t==="json"&&e&&typeof e=="object")return[JSON.stringify(e)];if(!e)return[void 0]}catch(n){return z&&q.exception(n,"Failed to serialize body",e),[void 0,"BODY_PARSE_ERROR"]}return z&&q.log("Skipping network body because of body type",e),[void 0,"UNPARSEABLE_BODY_TYPE"]}function qL(e,t){try{const n=t==="json"&&e&&typeof e=="object"?JSON.stringify(e):e;return vc(n)}catch{return}}function GL(e){const t=O();try{const{networkDetailAllowUrls:n,networkDetailDenyUrls:r,networkCaptureBodies:i,networkRequestHeaders:s,networkResponseHeaders:o}=e.getOptions(),a={replay:e,networkDetailAllowUrls:n,networkDetailDenyUrls:r,networkCaptureBodies:i,networkRequestHeaders:s,networkResponseHeaders:o};t&&t.on("beforeAddBreadcrumb",(c,u)=>VL(a,c,u))}catch{}}function VL(e,t,n){if(t.data)try{YL(t)&&JL(n)&&(HL(t,n),BL(t,n,e)),KL(t)&&XL(n)&&(xL(t,n),CL(t,n,e))}catch(r){z&&q.exception(r,"Error when enriching network breadcrumb")}}function YL(e){return e.category==="xhr"}function KL(e){return e.category==="fetch"}function JL(e){return e?.xhr}function XL(e){return e?.input!==void 0}function QL(e){const t=O();Qy(AP(e)),fc(wL(e)),hL(e),GL(e);const n=EL(e);i_(n),t&&(t.on("beforeSendEvent",fL(e)),t.on("afterSendEvent",uL(e)),t.on("createDsc",r=>{const i=e.getSessionId();i&&e.isEnabled()&&e.recordingMode==="session"&&e.checkAndHandleExpiredSession()&&(r.replay_id=i)}),t.on("spanStart",r=>{e.lastActiveSpan=r}),t.on("spanEnd",r=>{e.lastActiveSpan=r}),t.on("beforeSendFeedback",async(r,i)=>{const s=e.getSessionId();i?.includeReplay&&e.isEnabled()&&s&&r.contexts?.feedback&&(r.contexts.feedback.source==="api"&&await e.sendBufferedReplayOrFlush(),r.contexts.feedback.replay_id=s)}),t.on("openFeedbackWidget",async()=>{await e.sendBufferedReplayOrFlush()}))}async function ZL(e){try{return Promise.all(Sc(e,[eD(Te.performance.memory)]))}catch{return[]}}function eD(e){const{jsHeapSizeLimit:t,totalJSHeapSize:n,usedJSHeapSize:r}=e,i=Date.now()/1e3;return{type:"memory",name:"memory",start:i,end:i,data:{memory:{jsHeapSizeLimit:t,totalJSHeapSize:n,usedJSHeapSize:r}}}}function tD(e,t,n){return Vw(e,t,{...n,setTimeoutImpl:zs})}const bo=H.navigator;function nD(){return/iPhone|iPad|iPod/i.test(bo?.userAgent??"")||/Macintosh/i.test(bo?.userAgent??"")&&bo?.maxTouchPoints&&bo?.maxTouchPoints>1?{sampling:{mousemove:!1}}:{}}function rD(e){let t=!1;return(n,r)=>{if(!e.checkAndHandleExpiredSession()){z&&q.warn("Received replay event after session expired.");return}const i=r||!t;t=!0,iD(n),e.clickDetector&&TP(e.clickDetector,n),e.addUpdate(()=>{if(e.recordingMode==="buffer"&&i&&e.setInitialState(),!Hd(e,n,i))return!0;if(!i)return!1;const s=e.session;if(oD(e,i),e.recordingMode==="buffer"&&s&&e.eventBuffer&&!s.dirty){const o=e.eventBuffer.getEarliestTimestamp();o&&(z&&q.log(`Updating session start time to earliest event in buffer to ${new Date(o)}`),s.started=o,e.getOptions().stickySession&&bc(s))}return s?.previousSessionId||e.recordingMode==="session"&&e.flush(),!0})}}function iD(e){const t=e.data;if(!(e.type!==ie.IncrementalSnapshot||!t||typeof t!="object"||!("source"in t)||t.source!==K.Mutation||!("attributes"in t)||!Array.isArray(t.attributes)))for(const n of t.attributes){const r=Ft.mirror.getNode(n.id),i=r&&Ft.mirror.getMeta(r);if(i?.type===yc.Element)for(const[s,o]of Object.entries(n.attributes))o===null?delete i.attributes[s]:i.attributes[s]=o}}function sD(e){const t=e.getOptions();return{type:ie.Custom,timestamp:Date.now(),data:{tag:"options",payload:{shouldRecordCanvas:e.isRecordingCanvas(),sessionSampleRate:t.sessionSampleRate,errorSampleRate:t.errorSampleRate,useCompressionOption:t.useCompression,blockAllMedia:t.blockAllMedia,maskAllText:t.maskAllText,maskAllInputs:t.maskAllInputs,useCompression:e.eventBuffer?e.eventBuffer.type==="worker":!1,networkDetailHasUrls:t.networkDetailAllowUrls.length>0,networkCaptureBodies:t.networkCaptureBodies,networkRequestHasHeaders:t.networkRequestHeaders.length>0,networkResponseHasHeaders:t.networkResponseHeaders.length>0}}}}function oD(e,t){!t||e.session?.segmentId!==0||Hd(e,sD(e),!1)}function aD(e){if(!e)return null;try{return e.nodeType===e.ELEMENT_NODE?e:e.parentElement}catch{return null}}function cD(e,t,n,r){return Ot(Gg(e,Cs(e),r,n),[[{type:"replay_event"},e],[{type:"replay_recording",length:typeof t=="string"?new TextEncoder().encode(t).length:t.length},t]])}function uD({recordingData:e,headers:t}){let n;const r=`${JSON.stringify(t)} `;if(typeof e=="string")n=`${r}${e}`;else{const s=new TextEncoder().encode(r);n=new Uint8Array(s.length+e.length),n.set(s),n.set(e,s.length)}return n}async function lD({client:e,scope:t,replayId:n,event:r}){const i=typeof e._integrations=="object"&&e._integrations!==null&&!Array.isArray(e._integrations)?Object.keys(e._integrations):void 0,s={event_id:n,integrations:i};e.emit("preprocessEvent",r,s);const o=await e_(e.getOptions(),r,s,t,e,Oe());if(!o)return null;e.emit("postprocessEvent",o,s),o.platform=o.platform||"javascript";const a=e.getSdkMetadata(),{name:c,version:u,settings:d}=a?.sdk||{};return o.sdk={...o.sdk,name:c||"sentry.javascript.unknown",version:u||"0.0.0",settings:d},o}async function dD({recordingData:e,replayId:t,segmentId:n,eventContext:r,timestamp:i,session:s}){const o=uD({recordingData:e,headers:{segment_id:n}}),{urls:a,errorIds:c,traceIds:u,initialTimestamp:d}=r,l=O(),p=G(),f=l?.getTransport(),h=l?.getDsn();if(!l||!f||!h||!s.sampled)return Promise.resolve({});const m={type:$M,replay_start_timestamp:d/1e3,timestamp:i/1e3,error_ids:c,trace_ids:u,urls:a,replay_id:t,segment_id:n,replay_type:s.sampled},g=await lD({scope:p,client:l,replayId:t,event:m});if(!g)return l.recordDroppedEvent("event_processor","replay"),z&&q.log("An event processor returned `null`, will not send event."),Promise.resolve({});delete g.sdkProcessingMetadata;const _=cD(g,o,h,l.getOptions().tunnel);let S;try{S=await f.send(_)}catch(v){const w=new Error(Cd);try{w.cause=v}catch{}throw w}const E=m_({},S);if(h_(E,"replay"))throw new Wd(E);if(typeof S.statusCode=="number"&&(S.statusCode<200||S.statusCode>=300))throw new oS(S.statusCode);return S}class oS extends Error{constructor(t){super(`Transport returned status code ${t}`)}}class Wd extends Error{constructor(t){super("Rate limit hit"),this.rateLimits=t}}class Nh extends Error{constructor(){super("Session is too long, not sending replay")}}async function aS(e,t={count:0,interval:zM}){const{recordingData:n,onError:r}=e;if(n.length)try{return await dD(e),!0}catch(i){if(i instanceof oS||i instanceof Wd)throw i;if(Gl("Replays",{_retryCount:t.count}),r&&r(i),t.count>=qM){const s=new Error(`${Cd} - max retries exceeded`);try{s.cause=i}catch{}throw s}return t.interval*=++t.count,new Promise((s,o)=>{zs(async()=>{try{await aS(e,t),s(!0)}catch(a){o(a)}},t.interval)})}}const cS="__THROTTLED",fD="__SKIPPED";function pD(e,t,n){const r=new Map,i=a=>{const c=a-n;r.forEach((u,d)=>{d[...r.values()].reduce((a,c)=>a+c,0);let o=!1;return(...a)=>{const c=Math.floor(Date.now()/1e3);if(i(c),s()>=t){const d=o;return o=!0,d?fD:cS}o=!1;const u=r.get(c)||0;return r.set(c,u+1),e(...a)}}class hD{constructor({options:t,recordingOptions:n}){this.eventBuffer=null,this.performanceEntries=[],this.replayPerformanceEntries=[],this.recordingMode="session",this.timeouts={sessionIdlePause:UM,sessionIdleExpire:BM},this._lastActivity=Date.now(),this._isEnabled=!1,this._isPaused=!1,this._requiresManualStart=!1,this._hasInitializedCoreListeners=!1,this._context={errorIds:new Set,traceIds:new Set,urls:[],initialTimestamp:Date.now(),initialUrl:""},this._recordingOptions=n,this._options=t,this._debouncedFlush=tD(()=>this._flush(),this._options.flushMinDelay,{maxWait:this._options.flushMaxDelay}),this._throttledAddEvent=pD((o,a)=>oL(this,o,a),300,5);const{slowClickTimeout:r,slowClickIgnoreSelectors:i}=this.getOptions(),s=r?{threshold:Math.min(GM,r),timeout:r,scrollTimeout:VM,ignoreSelector:i?i.join(","):""}:void 0;if(s&&(this.clickDetector=new bP(this,s)),z){const o=t._experiments;q.setConfig({captureExceptions:!!o.captureExceptions,traceInternals:!!o.traceInternals})}this._handleVisibilityChange=()=>{Te.document.visibilityState==="visible"?this._doChangeToForegroundTasks():this._doChangeToBackgroundTasks()},this._handleWindowBlur=()=>{const o=Yt({category:"ui.blur"});this._doChangeToBackgroundTasks(o)},this._handleWindowFocus=()=>{const o=Yt({category:"ui.focus"});this._doChangeToForegroundTasks(o)},this._handleKeyboardEvent=o=>{MP(this,o)}}getContext(){return this._context}isEnabled(){return this._isEnabled}isPaused(){return this._isPaused}isRecordingCanvas(){return!!this._canvas}getOptions(){return this._options}handleException(t){z&&q.exception(t),this._options.onError&&this._options.onError(t)}initializeSampling(t){const{errorSampleRate:n,sessionSampleRate:r}=this._options,i=n<=0&&r<=0;if(this._requiresManualStart=i,!i){if(this._initializeSessionForSampling(t),!this.session){z&&q.exception(new Error("Unable to initialize and create session"));return}this.session.sampled!==!1&&(this.recordingMode=this.session.sampled==="buffer"&&this.session.segmentId===0?"buffer":"session",z&&q.infoTick(`Starting replay in ${this.recordingMode} mode`),this._initializeRecording())}}start(){if(this._isEnabled&&this.recordingMode==="session"){z&&q.log("Recording is already in progress");return}if(this._isEnabled&&this.recordingMode==="buffer"){z&&q.log("Buffering is in progress, call `flush()` to save the replay");return}z&&q.infoTick("Starting replay in session mode"),this._updateUserActivity();const t=uu({maxReplayDuration:this._options.maxReplayDuration,sessionIdleExpire:this.timeouts.sessionIdleExpire},{stickySession:this._options.stickySession,sessionSampleRate:1,allowBuffering:!1});this.session=t,this.recordingMode="session",this._initializeRecording()}startBuffering(){if(this._isEnabled){z&&q.log("Buffering is in progress, call `flush()` to save the replay");return}z&&q.infoTick("Starting replay in buffer mode");const t=uu({sessionIdleExpire:this.timeouts.sessionIdleExpire,maxReplayDuration:this._options.maxReplayDuration},{stickySession:this._options.stickySession,sessionSampleRate:0,allowBuffering:!0});this.session=t,this.recordingMode="buffer",this._initializeRecording()}startRecording(){try{const t=this._canvas;this._stopRecording=Ft({...this._recordingOptions,...this.recordingMode==="buffer"?{checkoutEveryNms:WM}:this._options._experiments.continuousCheckout&&{checkoutEveryNms:Math.max(36e4,this._options._experiments.continuousCheckout)},emit:rD(this),...nD(),onMutation:this._onMutationHandler.bind(this),...t?{recordCanvas:t.recordCanvas,getCanvasManager:t.getCanvasManager,sampling:t.sampling,dataURLOptions:t.dataURLOptions}:{}})}catch(t){this.handleException(t)}}stopRecording(){try{return this._stopRecording&&(this._stopRecording(),this._stopRecording=void 0),!0}catch(t){return this.handleException(t),!1}}async stop({forceFlush:t=!1,reason:n}={}){if(!this._isEnabled)return;this._isEnabled=!1,this.recordingMode="buffer";const r=n??"manual";O()?.emit("replayEnd",{sessionId:this.session?.id,reason:r});try{z&&q.log(`Stopping Replay triggered by ${r}`),xa(),this._removeListeners(),this.stopRecording(),this._debouncedFlush.cancel(),t&&await this._flush({force:!0}),this.eventBuffer?.destroy(),this.eventBuffer=null,eL(this)}catch(i){this.handleException(i)}}pause(){this._isPaused||(this._isPaused=!0,this.stopRecording(),z&&q.log("Pausing replay"))}resume(){!this._isPaused||!this._checkSession()||(this._isPaused=!1,this.startRecording(),z&&q.log("Resuming replay"))}async sendBufferedReplayOrFlush({continueRecording:t=!0}={}){if(this.recordingMode==="session")return this.flushImmediate();const n=Date.now();z&&q.log("Converting buffer to session"),await this.flushImmediate();const r=this.stopRecording();!t||!r||this.recordingMode!=="session"&&(this.recordingMode="session",this.session&&(this.session.dirty=!1,this._updateUserActivity(n),this._updateSessionActivity(n),this._maybeSaveSession()),this.startRecording())}addUpdate(t){const n=t();this.recordingMode==="buffer"||!this._isEnabled||n!==!0&&this._debouncedFlush()}triggerUserActivity(){if(this._updateUserActivity(),!this._stopRecording){if(!this._checkSession())return;this.resume();return}this.checkAndHandleExpiredSession(),this._updateSessionActivity()}updateUserActivity(){this._updateUserActivity(),this._updateSessionActivity()}conditionalFlush(){return this.recordingMode==="buffer"?Promise.resolve():this.flushImmediate()}flush(){return this._debouncedFlush()}flushImmediate(){return this._debouncedFlush(),this._debouncedFlush.flush()}cancelFlush(){this._debouncedFlush.cancel()}getSessionId(t){if(!(t&&this.session?.sampled===!1))return this.session?.id}checkAndHandleExpiredSession(){if(this._lastActivity&&fl(this._lastActivity,this.timeouts.sessionIdlePause)&&this.session?.sampled==="session"){this.pause();return}return!!this._checkSession()}setInitialState(){const t=`${Te.location.pathname}${Te.location.hash}${Te.location.search}`,n=`${Te.location.origin}${t}`;this.performanceEntries=[],this.replayPerformanceEntries=[],this._clearContext(),this._context.initialUrl=n,this._context.initialTimestamp=Date.now(),this._context.urls.push(n)}throttledAddEvent(t,n){const r=this._throttledAddEvent(t,n);if(r===cS){const i=Yt({category:"replay.throttled"});this.addUpdate(()=>!Hd(this,{type:fP,timestamp:i.timestamp||0,data:{tag:"breadcrumb",payload:i,metric:!0}}))}return r}getCurrentRoute(){const t=this.lastActiveSpan||Ae(),n=t&&ke(t),i=(n&&B(n).data||{})[le];if(!(!n||!i||!["route","custom"].includes(i)))return B(n).description}_initializeRecording(){this.setInitialState(),this._updateSessionActivity(),this.eventBuffer=XP({useCompression:this._options.useCompression,workerUrl:this._options.workerUrl}),this._removeListeners(),this._addListeners(),this._isEnabled=!0,this._isPaused=!1,this.session&&O()?.emit("replayStart",{sessionId:this.session.id,recordingMode:this.recordingMode}),this.startRecording(),this.recordingMode==="session"&&this.session&&bL(this.session.id)}_initializeSessionForSampling(t){const n=this._options.errorSampleRate>0,r=uu({sessionIdleExpire:this.timeouts.sessionIdleExpire,maxReplayDuration:this._options.maxReplayDuration,previousSessionId:t},{stickySession:this._options.stickySession,sessionSampleRate:this._options.sessionSampleRate,allowBuffering:n});this.session=r}_checkSession(){if(!this.session)return!1;const t=this.session;return Ca(t,{sessionIdleExpire:this.timeouts.sessionIdleExpire,maxReplayDuration:this._options.maxReplayDuration})?(this._refreshSession(t),!1):!0}async _refreshSession(t){this._isEnabled&&(await this.stop({reason:"sessionExpired"}),this.initializeSampling(t.id))}_addListeners(){try{Te.document.addEventListener("visibilitychange",this._handleVisibilityChange),Te.addEventListener("blur",this._handleWindowBlur),Te.addEventListener("focus",this._handleWindowFocus),Te.addEventListener("keydown",this._handleKeyboardEvent),this.clickDetector&&this.clickDetector.addListeners(),this._hasInitializedCoreListeners||(QL(this),this._hasInitializedCoreListeners=!0)}catch(t){this.handleException(t)}this._performanceCleanupCallback=qP(this)}_removeListeners(){try{Te.document.removeEventListener("visibilitychange",this._handleVisibilityChange),Te.removeEventListener("blur",this._handleWindowBlur),Te.removeEventListener("focus",this._handleWindowFocus),Te.removeEventListener("keydown",this._handleKeyboardEvent),this.clickDetector&&this.clickDetector.removeListeners(),this._performanceCleanupCallback&&this._performanceCleanupCallback()}catch(t){this.handleException(t)}}_doChangeToBackgroundTasks(t){if(!this.session)return;if(Ca(this.session,{maxReplayDuration:this._options.maxReplayDuration,sessionIdleExpire:this.timeouts.sessionIdleExpire})){xa();return}t&&this._createCustomBreadcrumb(t),this.conditionalFlush()}_doChangeToForegroundTasks(t){if(!this.session)return;if(!this.checkAndHandleExpiredSession()){z&&q.log("Document has become active, but session has expired");return}t&&this._createCustomBreadcrumb(t)}_updateUserActivity(t=Date.now()){this._lastActivity=t}_updateSessionActivity(t=Date.now()){this.session&&(this.session.lastActivity=t,this._maybeSaveSession())}_createCustomBreadcrumb(t){this.addUpdate(()=>{this.throttledAddEvent({type:ie.Custom,timestamp:t.timestamp||0,data:{tag:"breadcrumb",payload:t}})})}_addPerformanceEntries(){let t=DP(this.performanceEntries).concat(this.replayPerformanceEntries);if(this.performanceEntries=[],this.replayPerformanceEntries=[],this._requiresManualStart){const n=this._context.initialTimestamp/1e3;t=t.filter(r=>r.start>=n)}return Promise.all(Sc(this,t))}_clearContext(){this._context.errorIds.clear(),this._context.traceIds.clear(),this._context.urls=[]}_updateInitialTimestampFromEventBuffer(){const{session:t,eventBuffer:n}=this;if(!t||!n||this._requiresManualStart||t.segmentId)return;const r=n.getEarliestTimestamp();r&&rthis._options.maxReplayDuration+3e4)throw new Nh;const r=this._popEventContext(),i=this.session.segmentId++;this._maybeSaveSession();const s=await this.eventBuffer.finish();await aS({replayId:t,recordingData:s,segmentId:i,eventContext:r,session:this.session,timestamp:n,onError:o=>this.handleException(o)})}catch(n){this.handleException(n),this.stop({reason:"sendError"});const r=O();if(r){let i;n instanceof Wd?i="ratelimit_backoff":n instanceof Nh?i="invalid":i="send_error",r.recordDroppedEvent(i,"replay")}}}async _flush({force:t=!1}={}){if(!this._isEnabled&&!t)return;if(!this.checkAndHandleExpiredSession()){z&&q.error("Attempting to finish replay event after session expired.");return}if(!this.session)return;const n=this.session.started,i=Date.now()-n;this._debouncedFlush.cancel();const s=ithis._options.maxReplayDuration+5e3;if(s||o){z&&q.log(`Session duration (${Math.floor(i/1e3)}s) is too ${s?"short":"long"}, not sending replay.`),s&&this._debouncedFlush();return}const a=this.eventBuffer;a&&this.session.segmentId===0&&!a.hasCheckout&&z&&q.log("Flushing initial segment without checkout.");const c=!!this._flushLock;this._flushLock||(this._flushLock=this._runFlush());try{await this._flushLock}catch(u){this.handleException(u)}finally{this._flushLock=void 0,c&&this._debouncedFlush()}}_maybeSaveSession(){this.session&&this._options.stickySession&&bc(this.session)}_onMutationHandler(t){const{ignoreMutations:n}=this._options._experiments;if(n?.length&&t.some(a=>{const c=aD(a.target),u=n.join(",");return c?.matches(u)}))return!1;const r=t.length,i=this._options.mutationLimit,s=this._options.mutationBreadcrumbLimit,o=i&&r>i;if(r>s||o){const a=Yt({category:"replay.mutations",data:{count:r,limit:o}});this._createCustomBreadcrumb(a)}return o?(this.stop({reason:"mutationLimit",forceFlush:this.recordingMode==="session"}),!1):!0}}function Gi(e,t){return[...e,...t].join(",")}function mD({mask:e,unmask:t,block:n,unblock:r,ignore:i}){const s=["base","iframe[srcdoc]:not([src])"],o=Gi(e,[".sentry-mask","[data-sentry-mask]"]),a=Gi(t,[]);return{maskTextSelector:o,unmaskTextSelector:a,blockSelector:Gi(n,[".sentry-block","[data-sentry-block]",...s]),unblockSelector:Gi(r,[]),ignoreSelector:Gi(i,[".sentry-ignore","[data-sentry-ignore]",'input[type="file"]'])}}function gD({el:e,key:t,maskAttributes:n,maskAllText:r,privacyOptions:i,value:s}){if(i.unmaskTextSelector&&e.matches(i.unmaskTextSelector))return s;const o=n.includes(t),a=r&&t==="value"&&e.tagName==="INPUT"&&["submit","button"].includes(e.getAttribute("type")||"");return o||a?s.replace(/[\S]/g,"*"):s}const Ph='img,image,svg,video,object,picture,embed,map,audio,link[rel="icon"],link[rel="apple-touch-icon"]',_D=["content-length","content-type","accept"],yD=Symbol.for("sentry__originalRequestBody");let Lh=!1,Dh=!1;function bD(){if(typeof Request>"u"||Dh)return;const e=Request;try{const t=function(n,r){const i=new e(n,r);return r?.body!=null&&(i[yD]=r.body),i};t.prototype=e.prototype,H.Request=t,Dh=!0}catch{}}const SD=(e=>new vD(e));class vD{constructor({flushMinDelay:t=HM,flushMaxDelay:n=jM,minReplayDuration:r=YM,maxReplayDuration:i=fh,stickySession:s=!0,useCompression:o=!0,workerUrl:a,_experiments:c={},maskAllText:u=!0,maskAllInputs:d=!0,blockAllMedia:l=!0,mutationBreadcrumbLimit:p=750,mutationLimit:f=1e4,slowClickTimeout:h=7e3,slowClickIgnoreSelectors:m=[],networkDetailAllowUrls:g=[],networkDetailDenyUrls:_=[],networkCaptureBodies:S=!0,networkRequestHeaders:E=[],networkResponseHeaders:v=[],mask:w=[],maskAttributes:T=["title","placeholder","aria-label"],unmask:b=[],block:I=[],unblock:M=[],ignore:k=[],maskFn:D,beforeAddRecordingEvent:x,beforeErrorSampling:L,onError:F,attachRawBodyFromRequest:Z=!1}={}){this.name="Replay";const Y=mD({mask:w,unmask:b,block:I,unblock:M,ignore:k});if(this._recordingOptions={maskAllInputs:d,maskAllText:u,maskInputOptions:{password:!0},maskTextFn:D,maskInputFn:D,maskAttributeFn:(ne,R,j)=>gD({maskAttributes:T,maskAllText:u,privacyOptions:Y,key:ne,value:R,el:j}),...Y,slimDOMOptions:"all",inlineStylesheet:!0,inlineImages:!1,collectFonts:!0,errorHandler:ne=>{try{ne.__rrweb__=!0}catch{}},recordCrossOriginIframes:!!c.recordCrossOriginIframes},this._initialOptions={flushMinDelay:t,flushMaxDelay:n,minReplayDuration:Math.min(r,KM),maxReplayDuration:Math.min(i,fh),stickySession:s,useCompression:o,workerUrl:a,blockAllMedia:l,maskAllInputs:d,maskAllText:u,mutationBreadcrumbLimit:p,mutationLimit:f,slowClickTimeout:h,slowClickIgnoreSelectors:m,networkDetailAllowUrls:g,networkDetailDenyUrls:_,networkCaptureBodies:S,networkRequestHeaders:Fh(E),networkResponseHeaders:Fh(v),beforeAddRecordingEvent:x,beforeErrorSampling:L,onError:F,attachRawBodyFromRequest:Z,_experiments:c},this._initialOptions.blockAllMedia&&(this._recordingOptions.blockSelector=this._recordingOptions.blockSelector?`${this._recordingOptions.blockSelector},${Ph}`:Ph,this._recordingOptions.ignoreCSSAttributes=new Set(["background-image"])),this._isInitialized&&Kn())throw new Error("Multiple Sentry Session Replay instances are not supported");this._isInitialized=!0}get _isInitialized(){return Lh}set _isInitialized(t){Lh=t}afterAllSetup(t){!Kn()||this._replay||(this._initialOptions.attachRawBodyFromRequest&&bD(),this._setup(t),this._initialize(t))}start(){this._replay&&this._replay.start()}startBuffering(){this._replay&&this._replay.startBuffering()}stop(){return this._replay?this._replay.stop({forceFlush:this._replay.recordingMode==="session",reason:"manual"}):Promise.resolve()}flush(t){return this._replay?this._replay.isEnabled()?this._replay.sendBufferedReplayOrFlush(t):(this._replay.start(),Promise.resolve()):Promise.resolve()}getReplayId(t){if(this._replay?.isEnabled())return this._replay.getSessionId(t)}getRecordingMode(){if(this._replay?.isEnabled())return this._replay.recordingMode}_initialize(t){this._replay&&(this._maybeLoadFromReplayCanvasIntegration(t),this._replay.initializeSampling())}_setup(t){const n=ED(this._initialOptions,t);this._replay=new hD({options:n,recordingOptions:this._recordingOptions})}_maybeLoadFromReplayCanvasIntegration(t){try{const n=t.getIntegrationByName("ReplayCanvas");if(!n)return;this._replay._canvas=n.getOptions()}catch{}}}function ED(e,t){const n=t.getOptions(),r={sessionSampleRate:0,errorSampleRate:0,...e},i=vr(n.replaysSessionSampleRate),s=vr(n.replaysOnErrorSampleRate);return i==null&&s==null&&Cn(()=>{console.warn("Replay is disabled because neither `replaysSessionSampleRate` nor `replaysOnErrorSampleRate` are set.")}),i!=null&&(r.sessionSampleRate=i),s!=null&&(r.errorSampleRate=s),r}function Fh(e){return[..._D,...e.map(t=>t.toLowerCase())]}function TD(){return O()?.getIntegrationByName("Replay")}var wD=Object.defineProperty,ID=(e,t,n)=>t in e?wD(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,$h=(e,t,n)=>ID(e,typeof t!="symbol"?t+"":t,n);class kD{constructor(){$h(this,"idNodeMap",new Map),$h(this,"nodeMetaMap",new WeakMap)}getId(t){return t?this.getMeta(t)?.id??-1:-1}getNode(t){return this.idNodeMap.get(t)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(t){return this.nodeMetaMap.get(t)||null}removeNodeFromMap(t){const n=this.getId(t);this.idNodeMap.delete(n),t.childNodes&&t.childNodes.forEach(r=>this.removeNodeFromMap(r))}has(t){return this.idNodeMap.has(t)}hasNode(t){return this.nodeMetaMap.has(t)}add(t,n){const r=n.id;this.idNodeMap.set(r,t),this.nodeMetaMap.set(t,n)}replace(t,n){const r=this.getNode(t);if(r){const i=this.nodeMetaMap.get(r);i&&this.nodeMetaMap.set(n,i)}this.idNodeMap.set(t,n)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function RD(){return new kD}function AD(e,t){for(let n=e.classList.length;n--;){const r=e.classList[n];if(t.test(r))return!0}return!1}function ml(e,t,n=1/0,r=0){return!e||e.nodeType!==e.ELEMENT_NODE||r>n?-1:t(e)?r:ml(e.parentNode,t,n,r+1)}function Uh(e,t){return n=>{const r=n;if(r===null)return!1;try{if(e){if(typeof e=="string"){if(r.matches(`.${e}`))return!0}else if(AD(r,e))return!0}return!!(t&&r.matches(t))}catch{return!1}}}const zr=`Please stop import mirror directly. Instead of that,\r now you can use replayer.getMirror() to access the mirror instance of a replayer,\r or you can use record.mirror to access the mirror instance during recording.`;let Bh={map:{},getId(){return console.error(zr),-1},getNode(){return console.error(zr),null},removeNodeFromMap(){console.error(zr)},has(){return console.error(zr),!1},reset(){console.error(zr)}};typeof window<"u"&&window.Proxy&&window.Reflect&&(Bh=new Proxy(Bh,{get(e,t,n){return t==="map"&&console.error(zr),Reflect.get(e,t,n)}}));function zd(e,t,n,r,i=window){const s=i.Object.getOwnPropertyDescriptor(e,t);return i.Object.defineProperty(e,t,r?n:{set(o){lS(()=>{n.set.call(this,o)},0),s&&s.set&&s.set.call(this,o)}}),()=>zd(e,t,s||{},!0)}function qd(e,t,n){try{if(!(t in e))return()=>{};const r=e[t],i=n(r);return typeof i=="function"&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__rrweb_original__:{enumerable:!1,value:r}})),e[t]=i,()=>{e[t]=r}}catch{return()=>{}}}Date.now().toString();function CD(e){if(!e)return null;try{return e.nodeType===e.ELEMENT_NODE?e:e.parentElement}catch{return null}}function Ec(e,t,n,r,i){if(!e)return!1;const s=CD(e);if(!s)return!1;const o=Uh(t,n),a=ml(s,o);let c=-1;return a<0?!1:(r&&(c=ml(s,Uh(null,r))),a>-1&&c<0?!0:a(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(mi||{});let Vo;function xD(e){Vo=e}const lu=e=>Vo?((...n)=>{try{return e(...n)}catch(r){if(Vo&&Vo(r)===!0)return()=>{};throw r}}):e;var Jr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",OD=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var So=0;So>2],i+=Jr[(t[n]&3)<<4|t[n+1]>>4],i+=Jr[(t[n+1]&15)<<2|t[n+2]>>6],i+=Jr[t[n+2]&63];return r%3===2?i=i.substring(0,i.length-1)+"=":r%3===1&&(i=i.substring(0,i.length-2)+"=="),i};const jh=new Map;function ND(e,t){let n=jh.get(e);return n||(n=new Map,jh.set(e,n)),n.has(t)||n.set(t,[]),n.get(t)}const dS=(e,t,n)=>{if(!e||!(pS(e,t)||typeof e=="object"))return;const r=e.constructor.name,i=ND(n,r);let s=i.indexOf(e);return s===-1&&(s=i.length,i.push(e)),s};function Yo(e,t,n){if(e instanceof Array)return e.map(r=>Yo(r,t,n));if(e===null)return e;if(e instanceof Float32Array||e instanceof Float64Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Uint8Array||e instanceof Uint16Array||e instanceof Int16Array||e instanceof Int8Array||e instanceof Uint8ClampedArray)return{rr_type:e.constructor.name,args:[Object.values(e)]};if(e instanceof ArrayBuffer){const r=e.constructor.name,i=MD(e);return{rr_type:r,base64:i}}else{if(e instanceof DataView)return{rr_type:e.constructor.name,args:[Yo(e.buffer,t,n),e.byteOffset,e.byteLength]};if(e instanceof HTMLImageElement){const r=e.constructor.name,{src:i}=e;return{rr_type:r,src:i}}else if(e instanceof HTMLCanvasElement){const r="HTMLImageElement",i=e.toDataURL();return{rr_type:r,src:i}}else{if(e instanceof ImageData)return{rr_type:e.constructor.name,args:[Yo(e.data,t,n),e.width,e.height]};if(pS(e,t)||typeof e=="object"){const r=e.constructor.name,i=dS(e,t,n);return{rr_type:r,index:i}}}}return e}const fS=(e,t,n)=>e.map(r=>Yo(r,t,n)),pS=(e,t)=>!!["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(i=>typeof t[i]=="function").find(i=>e instanceof t[i]);function PD(e,t,n,r,i){const s=[],o=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype);for(const a of o)try{if(typeof t.CanvasRenderingContext2D.prototype[a]!="function")continue;const c=qd(t.CanvasRenderingContext2D.prototype,a,function(u){return function(...d){return Ec(this.canvas,n,r,i,!0)||lS(()=>{const l=fS(d,t,this);e(this.canvas,{type:mi["2D"],property:a,args:l})},0),u.apply(this,d)}});s.push(c)}catch{const c=zd(t.CanvasRenderingContext2D.prototype,a,{set(u){e(this.canvas,{type:mi["2D"],property:a,args:[u],setter:!0})}});s.push(c)}return()=>{s.forEach(a=>a())}}function LD(e){return e==="experimental-webgl"?"webgl":e}function Wh(e,t,n,r,i){const s=[];try{const o=qd(e.HTMLCanvasElement.prototype,"getContext",function(a){return function(c,...u){if(!Ec(this,t,n,r,!0)){const d=LD(c);if("__context"in this||(this.__context=d),i&&["webgl","webgl2"].includes(d))if(u[0]&&typeof u[0]=="object"){const l=u[0];l.preserveDrawingBuffer||(l.preserveDrawingBuffer=!0)}else u.splice(0,1,{preserveDrawingBuffer:!0})}return a.apply(this,[c,...u])}});s.push(o)}catch{console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{s.forEach(o=>o())}}function zh(e,t,n,r,i,s,o,a){const c=[],u=Object.getOwnPropertyNames(e);for(const d of u)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(d))try{if(typeof e[d]!="function")continue;const l=qd(e,d,function(p){return function(...f){const h=p.apply(this,f);if(dS(h,a,this),"tagName"in this.canvas&&!Ec(this.canvas,r,i,s,!0)){const m=fS(f,a,this),g={type:t,property:d,args:m};n(this.canvas,g)}return h}});c.push(l)}catch{const l=zd(e,d,{set(p){n(this.canvas,{type:t,property:d,args:[p],setter:!0})}});c.push(l)}return c}function DD(e,t,n,r,i,s){const o=[];return o.push(...zh(t.WebGLRenderingContext.prototype,mi.WebGL,e,n,r,i,s,t)),typeof t.WebGL2RenderingContext<"u"&&o.push(...zh(t.WebGL2RenderingContext.prototype,mi.WebGL2,e,n,r,i,s,t)),()=>{o.forEach(a=>a())}}const FD='for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t="undefined"==typeof Uint8Array?[]:new Uint8Array(256),a=0;a<64;a++)t[e.charCodeAt(a)]=a;var n=function(t){var a,n=new Uint8Array(t),r=n.length,s="";for(a=0;a>2],s+=e[(3&n[a])<<4|n[a+1]>>4],s+=e[(15&n[a+1])<<2|n[a+2]>>6],s+=e[63&n[a+2]];return r%3==2?s=s.substring(0,s.length-1)+"=":r%3==1&&(s=s.substring(0,s.length-2)+"=="),s};const r=new Map,s=new Map;const i=self;i.onmessage=async function(e){if(!("OffscreenCanvas"in globalThis))return i.postMessage({id:e.data.id});{const{id:t,bitmap:a,width:o,height:f,maxCanvasSize:c,dataURLOptions:g}=e.data,u=async function(e,t,a){const r=e+"-"+t;if("OffscreenCanvas"in globalThis){if(s.has(r))return s.get(r);const i=new OffscreenCanvas(e,t);i.getContext("2d");const o=await i.convertToBlob(a),f=await o.arrayBuffer(),c=n(f);return s.set(r,c),c}return""}(o,f,g),[h,d]=function(e,t,a){if(!a)return[e,t];const[n,r]=a;if(e<=n&&t<=r)return[e,t];let s=e,i=t;return s>n&&(i=Math.floor(n*t/e),s=n),i>r&&(s=Math.floor(r*e/t),i=r),[s,i]}(o,f,c),l=new OffscreenCanvas(h,d),w=l.getContext("bitmaprenderer"),p=h===o&&d===f?a:await createImageBitmap(a,{resizeWidth:h,resizeHeight:d,resizeQuality:"low"});w?.transferFromImageBitmap(p),a.close();const y=await l.convertToBlob(g),v=y.type,b=await y.arrayBuffer(),m=n(b);if(p.close(),!r.has(t)&&await u===m)return r.set(t,m),i.postMessage({id:t});if(r.get(t)===m)return i.postMessage({id:t});i.postMessage({id:t,type:v,base64:m,width:o,height:f}),r.set(t,m)}};';function $D(){const e=new Blob([FD]);return URL.createObjectURL(e)}class UD{constructor(t){this.pendingCanvasMutations=new Map,this.rafStamps={latestId:0,invokeId:null},this.shadowDoms=new Set,this.windowsSet=new WeakSet,this.windows=[],this.restoreHandlers=[],this.frozen=!1,this.locked=!1,this.snapshotInProgressMap=new Map,this.worker=null,this.lastSnapshotTime=0,this.processMutation=(a,c)=>{(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId||!this.rafStamps.invokeId)&&(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(a)||this.pendingCanvasMutations.set(a,[]),this.pendingCanvasMutations.get(a).push(c)};const{enableManualSnapshot:n,sampling:r="all",win:i,recordCanvas:s,errorHandler:o}=t;t.sampling=r,this.mutationCb=t.mutationCb,this.mirror=t.mirror,this.options=t,o&&xD(o),(s&&typeof r=="number"||n)&&(this.worker=this.initFPSWorker()),this.addWindow(i),!n&&lu(()=>{s&&r==="all"&&(this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher()),s&&typeof r=="number"&&this.initCanvasFPSObserver()})()}reset(){this.pendingCanvasMutations.clear(),this.restoreHandlers.forEach(t=>{try{t()}catch{}}),this.restoreHandlers=[],this.windowsSet=new WeakSet,this.windows=[],this.shadowDoms=new Set,this.worker?.terminate(),this.worker=null,this.snapshotInProgressMap=new Map}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}addWindow(t){const{sampling:n="all",blockClass:r,blockSelector:i,unblockSelector:s,recordCanvas:o,enableManualSnapshot:a}=this.options;if(!this.windowsSet.has(t)){if(a){this.windowsSet.add(t),this.windows.push(new WeakRef(t));return}lu(()=>{if(o&&n==="all"&&this.initCanvasMutationObserver(t,r,i,s),o&&typeof n=="number"){const c=Wh(t,r,i,s,!0);this.restoreHandlers.push(()=>{c()})}})(),this.windowsSet.add(t),this.windows.push(new WeakRef(t))}}addShadowRoot(t){this.shadowDoms.add(new WeakRef(t))}resetShadowRoots(){this.shadowDoms=new Set}snapshot(t,n){if(n?.skipRequestAnimationFrame){this.takeSnapshot(performance.now(),!0,t);return}ar(r=>this.takeSnapshot(r,!0,t))}initFPSWorker(){const t=new Worker($D());return t.onmessage=n=>{const r=n.data,{id:i}=r;if(this.snapshotInProgressMap.set(i,!1),!("base64"in r))return;const{base64:s,type:o,width:a,height:c}=r;this.mutationCb({id:i,type:mi["2D"],commands:[{property:"clearRect",args:[0,0,a,c]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:s}],type:o}]},0,0,a,c]}]})},t}initCanvasFPSObserver(){let t;if(!this.windows.length&&!this.shadowDoms.size)return;const n=r=>{this.takeSnapshot(r,!1),t=ar(n)};t=ar(n),this.restoreHandlers.push(()=>{t&&cancelAnimationFrame(t)})}initCanvasMutationObserver(t,n,r,i){const s=Wh(t,n,r,i,!1),o=PD(this.processMutation.bind(this),t,n,r,i),a=DD(this.processMutation.bind(this),t,n,r,i,this.mirror);this.restoreHandlers.push(()=>{s(),o(),a()})}getCanvasElements(t,n,r){const i=[],s=o=>{o.querySelectorAll("canvas").forEach(a=>{Ec(a,t,n,r)||i.push(a)})};for(const o of this.windows){const a=o.deref();let c;try{c=a&&a.document}catch{}c&&s(c)}for(const o of this.shadowDoms){const a=o.deref();a&&s(a)}return i}takeSnapshot(t,n,r){const{sampling:i,blockClass:s,blockSelector:o,unblockSelector:a,dataURLOptions:c,maxCanvasSize:u}=this.options,l=1e3/(i==="all"?2:i||2);return this.lastSnapshotTime&&t-this.lastSnapshotTime{const m=this.mirror.getId(h);if(!(!this.mirror.hasNode(h)||!h.width||!h.height||this.snapshotInProgressMap.get(m))){if(this.snapshotInProgressMap.set(m,!0),!n&&["webgl","webgl2"].includes(h.__context)){const g=h.getContext(h.__context);g?.getContextAttributes()?.preserveDrawingBuffer===!1&&g.clear(g.COLOR_BUFFER_BIT)}createImageBitmap(h).then(g=>{this.worker?.postMessage({id:m,bitmap:g,width:h.width,height:h.height,dataURLOptions:c,maxCanvasSize:u},[g])}).catch(g=>{lu(()=>{throw this.snapshotInProgressMap.delete(m),g})()})}}),!0)}startPendingCanvasMutationFlusher(){ar(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){const t=n=>{this.rafStamps.latestId=n,ar(t)};ar(t)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((t,n)=>{const r=this.mirror.getId(n);this.flushPendingCanvasMutationFor(n,r)}),ar(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(t,n){if(this.frozen||this.locked)return;const r=this.pendingCanvasMutations.get(t);if(!r||n===-1)return;const i=r.map(o=>{const{type:a,...c}=o;return c}),{type:s}=r[0];this.mutationCb({id:n,type:s,commands:i}),this.pendingCanvasMutations.delete(t)}}try{if(Array.from([1],e=>e*2)[0]!==2){const e=document.createElement("iframe");document.body.appendChild(e),Array.from=e.contentWindow?.Array.from||Array.from,document.body.removeChild(e)}}catch(e){console.debug("Unable to override Array.from",e)}RD();var qh;(function(e){e[e.NotStarted=0]="NotStarted",e[e.Running=1]="Running",e[e.Stopped=2]="Stopped"})(qh||(qh={}));const Gh={low:{sampling:{canvas:1},dataURLOptions:{type:"image/webp",quality:.25}},medium:{sampling:{canvas:2},dataURLOptions:{type:"image/webp",quality:.4}},high:{sampling:{canvas:4},dataURLOptions:{type:"image/webp",quality:.5}}},BD="ReplayCanvas",vo=1280,HD=((e={})=>{const[t,n]=e.maxCanvasSize||[],r={quality:e.quality||"medium",enableManualSnapshot:e.enableManualSnapshot,maxCanvasSize:[t?Math.min(t,vo):vo,n?Math.min(n,vo):vo]};let i,s;const o=new Promise(a=>s=a);return{name:BD,getOptions(){const{quality:a,enableManualSnapshot:c,maxCanvasSize:u}=r;return{enableManualSnapshot:c,recordCanvas:!0,getCanvasManager:d=>{const l=new UD({...d,enableManualSnapshot:c,maxCanvasSize:u,errorHandler:p=>{try{typeof p=="object"&&(p.__rrweb__=!0)}catch{}}});return i=l,s(l),l},...Gh[a]||Gh.medium}},async snapshot(a,c){(i||await o).snapshot(a,c)}}}),jD=HD;function WD(e){return e.split(",").some(t=>t.trim().startsWith("sentry-"))}function hS(e){try{return new URL(e,N.location.origin).href}catch{return}}function zD(e){return e.entryType==="resource"&&"initiatorType"in e&&typeof e.nextHopProtocol=="string"&&(e.initiatorType==="fetch"||e.initiatorType==="xmlhttprequest")}function mS(e){try{return new Headers(e)}catch{return}}const Vh=new WeakMap,du=new Map,Gd={traceFetch:!0,traceXHR:!0,enableHTTPTimings:!0,trackFetchStreamPerformance:!1};function gS(e,t){const{traceFetch:n,traceXHR:r,trackFetchStreamPerformance:i,shouldCreateSpanForRequest:s,enableHTTPTimings:o,tracePropagationTargets:a,onRequestSpanStart:c,onRequestSpanEnd:u}={...Gd,...t},d=typeof s=="function"?s:h=>!0,l=h=>GD(h,a),p={},f=e.getOptions().propagateTraceparent;n&&(e.addEventProcessor(h=>(h.type==="transaction"&&h.spans&&h.spans.forEach(m=>{if(m.op==="http.client"){const g=du.get(m.span_id);g&&(m.timestamp=g/1e3,du.delete(m.span_id))}}),h)),i&&BA(h=>{if(h.response){const m=Vh.get(h.response);m&&h.endTimestamp&&du.set(m,h.endTimestamp)}}),fd(h=>{const m=hk(h,d,l,p,{propagateTraceparent:f,onRequestSpanEnd:u});if(h.response&&h.fetchData.__span&&Vh.set(h.response,h.fetchData.__span),m){const g=hS(h.fetchData.url),_=g?Bn(g).host:void 0;m.setAttributes({"http.url":g?Hn(g):void 0,"server.address":_}),o&&Yh(m,e),c?.(m,{headers:h.headers})}})),r&&Id(h=>{const m=VD(h,d,l,p,f,u);m&&(o&&Yh(m,e),c?.(m,{headers:mS(h.xhr.__sentry_xhr_v3__?.request_headers)}))})}const qD=300;function Yh(e,t){const{url:n}=B(e).data;if(!n||typeof n!="string")return;let r=()=>void setTimeout(i);if(Rt(t)){const s=e.end.bind(e);e.end=o=>{const a=o??ye();let c=!1;const u=()=>{c||(c=!0,setTimeout(i),s(a),clearTimeout(d))};r=u;const d=setTimeout(u,qD)}}const i=Cr("resource",({entries:s})=>{s.forEach(o=>{zD(o)&&o.name.endsWith(n)&&(e.setAttributes(Jy(o)),r())})})}function GD(e,t){const n=xr();if(n){let r,i;try{r=new URL(e,n),i=new URL(n).origin}catch{return!1}const s=r.origin===i;return t?Tt(r.toString(),t)||s&&Tt(r.pathname,t):s}else{const r=!!e.match(/^\/(?!\/)/);return t?Tt(e,t):r}}function VD(e,t,n,r,i,s){const o=e.xhr,a=o?.[hn];if(!o||o.__sentry_own_request__||!a)return;const{url:c,method:u}=a,d=wt()&&t(c);if(e.endTimestamp){const S=o.__sentry_xhr_span_id__;if(!S)return;const E=r[S];E&&(d&&a.status_code!==void 0&&(ls(E,a.status_code),E.end(),s?.(E,{headers:mS(eb(o)),error:e.error})),delete r[S]);return}const l=hS(c),p=Bn(l||c),f=Hn(oa(c)),h=O(),g=!!Ae()||!!h&&Rt(h),_=d&&g?mt({name:`${u} ${f}`,attributes:{url:Hn(c),type:"xhr","http.method":u,"http.url":l?Hn(l):void 0,"server.address":p?.host,[J]:"auto.http.browser",[oe]:"http.client",...p?.search&&{"http.query":p?.search},...p?.hash&&{"http.fragment":p?.hash}}}):new ht;return d&&!g&&h?.recordDroppedEvent("no_parent_span","span"),o.__sentry_xhr_span_id__=_.spanContext().spanId,r[o.__sentry_xhr_span_id__]=_,n(c)&&YD(o,wt()&&g?_:void 0,i),h&&h.emit("beforeOutgoingRequestSpan",_,e),_}function YD(e,t,n){const{"sentry-trace":r,baggage:i,traceparent:s}=Zl({span:t,propagateTraceparent:n});r&&KD(e,r,i,s)}function KD(e,t,n,r){const i=e.__sentry_xhr_v3__?.request_headers;if(!(i?.["sentry-trace"]||!e.setRequestHeader))try{if(e.setRequestHeader("sentry-trace",t),r&&!i?.traceparent&&e.setRequestHeader("traceparent",r),n){const s=i?.baggage;(!s||!WD(s))&&e.setRequestHeader("baggage",n)}}catch{}}function JD(){N.document?N.document.addEventListener("visibilitychange",()=>{const e=Ae();if(!e)return;const t=ke(e);if(N.document.hidden&&t){const n="cancelled",{op:r,status:i}=B(t);A&&y.log(`[Tracing] Transaction: ${n} -> since tab moved to the background, op: ${r}`),i||t.setStatus({code:ce,message:n}),t.setAttribute("sentry.cancellation_reason","document.hidden"),t.end()}}):A&&y.warn("[Tracing] Could not set up background tab detection due to lack of global document")}const XD=3600,_S="sentry_previous_trace",QD="sentry.previous_trace";function ZD(e,{linkPreviousTrace:t,consistentTraceSampling:n}){const r=t==="session-storage";let i=r?nF():void 0;e.on("spanStart",o=>{if(ke(o)!==o)return;const a=G().getPropagationContext();i=eF(i,o,a),r&&tF(i)});let s=!0;n&&e.on("beforeSampling",o=>{if(!i)return;const a=G(),c=a.getPropagationContext();if(s&&c.parentSpanId){s=!1;return}a.setPropagationContext({...c,dsc:{...c.dsc,sample_rate:String(i.sampleRate),sampled:String(gl(i.spanContext))},sampleRand:i.sampleRand}),o.parentSampled=gl(i.spanContext),o.parentSampleRate=i.sampleRate,o.spanAttributes={...o.spanAttributes,[pg]:i.sampleRate}})}function eF(e,t,n){const r=B(t);function i(){try{return Number(n.dsc?.sample_rate)??Number(r.data?.[ja])}catch{return 0}}const s={spanContext:t.spanContext(),startTimestamp:r.start_timestamp,sampleRate:i(),sampleRand:n.sampleRand};if(!e)return s;const o=e.spanContext;return o.traceId===r.trace_id?e:(Date.now()/1e3-e.startTimestamp<=XD&&(A&&y.log(`Adding previous_trace \`${JSON.stringify(o)}\` link to span \`${JSON.stringify({op:r.op,...t.spanContext()})}\``),t.addLink({context:o,attributes:{[lT]:"previous_trace"}}),t.setAttribute(QD,`${o.traceId}-${o.spanId}-${gl(o)?1:0}`)),s)}function tF(e){try{N.sessionStorage.setItem(_S,JSON.stringify(e))}catch(t){A&&y.warn("Could not store previous trace in sessionStorage",t)}}function nF(){try{const e=N.sessionStorage?.getItem(_S);return JSON.parse(e)}catch{return}}function gl(e){return e.traceFlags===1}const rF="BrowserTracing",iF=/Googlebot|Google-InspectionTool|Storebot-Google|Bingbot|Slurp|DuckDuckBot|Baiduspider|YandexBot|Facebot|facebookexternalhit|LinkedInBot|Twitterbot|Applebot/i;function yS(){const e=N.navigator;return e?.userAgent?iF.test(e.userAgent):!1}const sF={...Mo,instrumentNavigation:!0,instrumentPageLoad:!0,markBackgroundSpan:!0,enableLongTask:!0,enableLongAnimationFrame:!0,enableInp:!0,ignoreResourceSpans:[],ignorePerformanceApiSpans:[],detectRedirects:!0,linkPreviousTrace:"in-memory",consistentTraceSampling:!1,enableReportPageLoaded:!1,_experiments:{},...Gd},Pi=((e={})=>{"enableElementTiming"in e&&Cn(()=>{console.warn("[Sentry] `enableElementTiming` is deprecated and no longer has any effect. Use the standalone `elementTimingIntegration` instead.")});const t={name:void 0,source:void 0},n=N.document,{enableInp:r,enableLongTask:i,enableLongAnimationFrame:s,_experiments:{enableInteractions:o,enableStandaloneClsSpans:a,enableStandaloneLcpSpans:c},beforeStartSpan:u,idleTimeout:d,finalTimeout:l,childSpanTimeout:p,markBackgroundSpan:f,traceFetch:h,traceXHR:m,trackFetchStreamPerformance:g,shouldCreateSpanForRequest:_,enableHTTPTimings:S,ignoreResourceSpans:E,ignorePerformanceApiSpans:v,instrumentPageLoad:w,instrumentNavigation:T,detectRedirects:b,linkPreviousTrace:I,consistentTraceSampling:M,enableReportPageLoaded:k,onRequestSpanStart:D,onRequestSpanEnd:x}={...sF,...e},L=yS();let F,Z,Y;function ne(R,j,P=!0){const U=j.op==="pageload",re=j.name,ee=u?u(j):j,Se=ee.attributes||{};if(re!==ee.name&&(Se[le]="custom",ee.attributes=Se),!P){const Xe=Or();mt({...ee,startTime:Xe}).end(Xe);return}t.name=ee.name,t.source=Se[le];const Fe=Qg(ee,{idleTimeout:d,finalTimeout:l,childSpanTimeout:p,disableAutoFinish:U,beforeSpanEnd:Xe=>{F?.();const Qe=Rt(R);fx(Xe,{recordClsOnPageloadSpan:!Qe&&!a,recordLcpOnPageloadSpan:!Qe&&!c,ignoreResourceSpans:E,ignorePerformanceApiSpans:v,spanStreamingEnabled:Qe}),Xh(R,void 0);const Ht=G(),Ze=Ht.getPropagationContext();Ht.setPropagationContext({...Ze,traceId:Fe.spanContext().traceId,sampled:xn(Fe),dsc:gt(Xe)}),U&&(Y=void 0)},trimIdleSpanEndTimestamp:!k});U&&k&&(Y=Fe),Xh(R,Fe);function He(){n&&["interactive","complete"].includes(n.readyState)&&R.emit("idleSpanEnableAutoFinish",Fe)}U&&!k&&n&&(n.addEventListener("readystatechange",()=>{He()}),He())}return{name:rF,setup(R){if(L){A&&y.log("[Tracing] Skipping browserTracingIntegration setup for bot user agent.");return}Ug();const j=Rt(R);if(F=sx({recordClsStandaloneSpans:j?void 0:a||!1,recordLcpStandaloneSpans:j?void 0:c||!1,client:R}),j?(Mx(R),Px(R),r&&Dx()):r&&Rx(),s&&H.PerformanceObserver&&PerformanceObserver.supportedEntryTypes?.includes("long-animation-frame")?ax():i&&ox(),o&&cx(),b&&n){const U=()=>{Z=ye()};addEventListener("click",U,{capture:!0}),addEventListener("keydown",U,{capture:!0,passive:!0})}function P(){const U=vs(R);U&&!B(U).timestamp&&(A&&y.log(`[Tracing] Finishing current active span with op: ${B(U).op}`),U.setAttribute(cs,"cancelled"),U.end())}R.on("startNavigationSpan",(U,re)=>{if(O()!==R)return;if(re?.isRedirect){A&&y.warn("[Tracing] Detected redirect, navigation span will not be the root span, but a child span."),ne(R,{op:"navigation.redirect",...U},!1);return}Z=void 0,P(),Oe().setPropagationContext({traceId:Zt(),sampleRand:Math.random(),propagationSpanId:wt()?void 0:yn()});const ee=G();ee.setPropagationContext({traceId:Zt(),sampleRand:Math.random(),propagationSpanId:wt()?void 0:yn()}),ee.setSDKProcessingMetadata({normalizedRequest:void 0}),ne(R,{op:"navigation",...U,parentSpan:null,forceTransaction:!0})}),R.on("startPageLoadSpan",(U,re={})=>{if(O()!==R)return;P();const ee=re.sentryTrace||Kh("sentry-trace")||Jh("sentry-trace"),Se=re.baggage||Kh("baggage")||Jh("baggage"),Fe=wg(ee,Se),He=G();He.setPropagationContext(Fe),wt()||(He.getPropagationContext().propagationSpanId=yn()),He.setSDKProcessingMetadata({normalizedRequest:ga()}),ne(R,{op:"pageload",...U})}),R.on("endPageloadSpan",()=>{k&&Y&&(Y.setAttribute(cs,"reportPageLoaded"),Y.end())})},afterAllSetup(R){if(L)return;let j=xr();if(I!=="off"&&ZD(R,{linkPreviousTrace:I,consistentTraceSampling:M}),N.location){if(w){const P=De();Li(R,{name:N.location.pathname,startTime:P?P/1e3:void 0,attributes:{[le]:"url",[J]:"auto.pageload.browser"}})}T&&fc(({to:P,from:U})=>{if(U===void 0&&j?.indexOf(P)!==-1){j=void 0;return}j=void 0;const re=zl(P),ee=vs(R),Se=ee&&b&&aF(ee,Z);Di(R,{name:re?.pathname||N.location.pathname,attributes:{[le]:"url",[J]:"auto.navigation.browser"}},{url:P,isRedirect:Se})})}f&&JD(),o&&oF(R,d,l,p,t),r&&Ox(),gS(R,{traceFetch:h,traceXHR:m,trackFetchStreamPerformance:g,tracePropagationTargets:R.getOptions().tracePropagationTargets,shouldCreateSpanForRequest:_,enableHTTPTimings:S,onRequestSpanStart:D,onRequestSpanEnd:x})}}});function Li(e,t,n){e.emit("startPageLoadSpan",t,n),G().setTransactionName(t.name);const r=vs(e);return r&&e.emit("afterStartPageLoadSpan",r),r}function Di(e,t,n){const{url:r,isRedirect:i}=n||{};e.emit("beforeStartNavigationSpan",t,{isRedirect:i}),e.emit("startNavigationSpan",t,{isRedirect:i});const s=G();return s.setTransactionName(t.name),r&&!i&&s.setSDKProcessingMetadata({normalizedRequest:{...ga(),url:r}}),vs(e)}function Kh(e){return N.document?.querySelector(`meta[name=${e}]`)?.getAttribute("content")||void 0}function Jh(e){return N.performance?.getEntriesByType?.("navigation")[0]?.serverTiming?.find(r=>r.name===e)?.description}function oF(e,t,n,r,i){const s=N.document;let o;const a=()=>{const c="ui.action.click",u=vs(e);if(u){const d=B(u).op;if(["navigation","pageload"].includes(d)){A&&y.warn(`[Tracing] Did not create ${c} span because a pageload or navigation span is in progress.`);return}}if(o&&(o.setAttribute(cs,"interactionInterrupted"),o.end(),o=void 0),!i.name){A&&y.warn(`[Tracing] Did not create ${c} transaction because _latestRouteName is missing.`);return}o=Qg({name:i.name,op:c,attributes:{[le]:i.source||"url"}},{idleTimeout:t,finalTimeout:n,childSpanTimeout:r})};s&&addEventListener("click",a,{capture:!0})}const bS="_sentry_idleSpan";function vs(e){return e[bS]}function Xh(e,t){xe(e,bS,t)}const Qh=1.5;function aF(e,t){const n=B(e),r=Or(),i=n.start_timestamp;return!(r-i>Qh||t&&r-t<=Qh)}function cF(e=O()){e?.emit("endPageloadSpan")}function uF(e){const t=Ae();if(t===e)return;const n=G();e.end=new Proxy(e.end,{apply(r,i,s){return en(n,t),Reflect.apply(r,i,s)}}),en(n,e)}const lF=()=>({name:"SpanStreaming",beforeSetup(e){const t=e.getOptions();t.traceLifecycle||(A&&y.log('[SpanStreaming] setting `traceLifecycle` to "stream"'),t.traceLifecycle="stream")},setup(e){const t="SpanStreaming integration requires",n="Falling back to static trace lifecycle.",r=e.getOptions();if(!Rt(e)){r.traceLifecycle="static",A&&y.warn(`${t} \`traceLifecycle\` to be set to "stream"! ${n}`);return}const i=r.beforeSendSpan;if(i&&!qa(i)){r.traceLifecycle="static",A&&y.warn(`${t} a beforeSendSpan callback using \`withStreamedSpan\`! ${n}`);return}const s=new DA(e);e.on("afterSpanEnd",o=>{xn(o)&&s.add(T0(o,e))}),e.on("afterSegmentSpanEnd",o=>{const a=o.spanContext().traceId;setTimeout(()=>{s.flush(a)},500)})}});function gi(e){return new Promise((t,n)=>{e.oncomplete=e.onsuccess=()=>t(e.result),e.onabort=e.onerror=()=>n(e.error)})}function dF(e,t){const n=indexedDB.open(e);n.onupgradeneeded=()=>n.result.createObjectStore(t);const r=gi(n);return i=>r.then(s=>i(s.transaction(t,"readwrite").objectStore(t)))}function Vd(e){return gi(e.getAllKeys())}function fF(e,t,n){return e(r=>Vd(r).then(i=>{if(!(i.length>=n))return r.put(t,Math.max(...i,0)+1),gi(r.transaction)}))}function pF(e,t,n){return e(r=>Vd(r).then(i=>{if(!(i.length>=n))return r.put(t,Math.min(...i,0)-1),gi(r.transaction)}))}function hF(e){return e(t=>Vd(t).then(n=>{const r=n[0];if(r!=null)return gi(t.get(r)).then(i=>(t.delete(r),gi(t.transaction).then(()=>i)))}))}function mF(e){let t;function n(){return t==null&&(t=dF(e.dbName||"sentry-offline",e.storeName||"queue")),t}return{push:async r=>{try{const i=sa(r);await fF(n(),i,e.maxQueueSize||30)}catch{}},unshift:async r=>{try{const i=sa(r);await pF(n(),i,e.maxQueueSize||30)}catch{}},shift:async()=>{try{const r=await hF(n());if(r)return GT(r)}catch{}}}}function gF(e){return t=>{const n=e({...t,createStore:mF});return N.addEventListener("online",async r=>{await n.flush()}),n}}function _F(e=Rd){return gF(Dw(e))}const Zh=1e6,yF="window"in H&&H.window===H&&typeof importScripts>"u",yr=String(0),Yd=yF?"main":"worker",Na=N.navigator;let SS="",vS="",ES="",_l=Na?.userAgent||"",TS="";const bF=Na?.language||Na?.languages?.[0]||"";function SF(e){return typeof e=="object"&&e!==null&&"getHighEntropyValues"in e}const em=Na?.userAgentData;SF(em)&&em.getHighEntropyValues(["architecture","model","platform","platformVersion","fullVersionList"]).then(e=>{if(SS=e.platform||"",ES=e.architecture||"",TS=e.model||"",vS=e.platformVersion||"",e.fullVersionList?.length){const t=e.fullVersionList[e.fullVersionList.length-1];_l=`${t.brand} ${t.version}`}}).catch(e=>{});function vF(e){return!("thread_metadata"in e)}function EF(e){return vF(e)?AF(e):e}function TF(e){const t=e.contexts?.trace?.trace_id;return typeof t=="string"&&t.length!==32&&A&&y.log(`[Profiling] Invalid traceId: ${t} on profiled event`),typeof t!="string"?"":t}function wF(e,t,n,r){if(r.type!=="transaction")throw new TypeError("Profiling events may only be attached to transactions, this should never occur.");if(n==null)throw new TypeError(`Cannot construct profiling event envelope without a valid profile. Got ${n} instead.`);const i=TF(r),s=EF(n),o=t||(typeof r.start_timestamp=="number"?r.start_timestamp*1e3:ye()*1e3),a=typeof r.timestamp=="number"?r.timestamp*1e3:ye()*1e3;return{event_id:e,timestamp:new Date(o).toISOString(),platform:"javascript",version:"1",release:r.release||"",environment:r.environment||za,runtime:{name:"javascript",version:N.navigator.userAgent},os:{name:SS,version:vS,build_number:_l},device:{locale:bF,model:TS,manufacturer:_l,architecture:ES,is_emulator:!1},debug_meta:{images:IS(n.resources)},profile:s,transactions:[{name:r.transaction||"",id:r.event_id||$e(),trace_id:i,active_thread_id:yr,relative_start_ns:"0",relative_end_ns:((a-o)*1e6).toFixed(0)}]}}function IF(e,t,n){if(e==null)throw new TypeError(`Cannot construct profiling event envelope without a valid profile. Got ${e} instead.`);const r=RF(e),i=t.getOptions(),s=t.getSdkMetadata?.()?.sdk;return{chunk_id:$e(),client_sdk:{name:s?.name??"sentry.javascript.browser",version:s?.version??"0.0.0"},profiler_id:n||$e(),platform:"javascript",version:"2",release:i.release??"",environment:i.environment??"production",debug_meta:{images:IS(e.resources)},profile:r}}function kF(e){try{if(!e||typeof e!="object")return{reason:"chunk is not an object"};const t=r=>typeof r=="string"&&/^[a-f0-9]{32}$/.test(r);if(!t(e.profiler_id))return{reason:"missing or invalid profiler_id"};if(!t(e.chunk_id))return{reason:"missing or invalid chunk_id"};if(!e.client_sdk)return{reason:"missing client_sdk metadata"};const n=e.profile;return n?!Array.isArray(n.frames)||!n.frames.length?{reason:"profile has no frames"}:!Array.isArray(n.stacks)||!n.stacks.length?{reason:"profile has no stacks"}:!Array.isArray(n.samples)||!n.samples.length?{reason:"profile has no samples"}:{valid:!0}:{reason:"missing profile data"}}catch(t){return{reason:`unknown validation error: ${t}`}}}function RF(e){const t=[];for(let a=0;a{if(u.stackId===void 0){t===void 0&&(t=n,r.stacks[t]=[],n++),r.samples[d]={elapsed_since_start_ns:((u.timestamp+c-s)*Zh).toFixed(0),stack_id:t,thread_id:yr};return}let l=e.stacks[u.stackId];const p=[];for(;l;){p.push(l.frameId);const h=e.frames[l.frameId];h&&r.frames[l.frameId]===void 0&&(r.frames[l.frameId]={function:h.name,abs_path:typeof h.resourceId=="number"?e.resources[h.resourceId]:void 0,lineno:h.line,colno:h.column}),l=l.parentId===void 0?void 0:e.stacks[l.parentId]}const f={elapsed_since_start_ns:((u.timestamp+c-s)*Zh).toFixed(0),stack_id:n,thread_id:yr};r.stacks[n]=p,r.samples[d]=f,n++}),r}function CF(e,t){if(!t.length)return e;for(const n of t)e[1].push([{type:"profile"},n]);return e}function xF(e){const t=[];return Er(e,(n,r)=>{if(r==="transaction")for(let i=1;i1?(A&&y.warn(`[Profiling] Invalid sample rate. Sample rate must be between 0 and 1. Got ${e}.`),!1):!0}function OF(e){return e.samples.length<2?(A&&y.log("[Profiling] Discarding profile because it contains less than 2 samples"),!1):e.frames.length?!0:(A&&y.log("[Profiling] Discarding profile because it contains no frames"),!1)}let Kd=!1;const RS=3e4;function MF(e){return typeof e=="function"}function AS(){const e=N.Profiler;if(!MF(e)){A&&y.log("[Profiling] Profiling is not supported by this browser, Profiler interface missing on window object.");return}const t=10,n=Math.floor(RS/t);try{return new e({sampleInterval:t,maxBufferSize:n})}catch{A&&(y.log("[Profiling] Failed to initialize the Profiling constructor, this is likely due to a missing 'Document-Policy': 'js-profiling' header."),y.log("[Profiling] Disabling profiling for current user session.")),Kd=!0}}function tm(e){if(Kd)return A&&y.log("[Profiling] Profiling has been disabled for the duration of the current user session."),!1;if(!e.isRecording())return A&&y.log("[Profiling] Discarding profile because root span was not sampled."),!1;const n=O()?.getOptions();if(!n)return A&&y.log("[Profiling] Profiling disabled, no options found."),!1;const r=n.profilesSampleRate;return kS(r)?r?(r===!0?!0:Math.random()30){const n=pr.keys().next().value;n!==void 0&&pr.delete(n)}}const CS=new WeakSet;function Pa(e){e.setAttribute("thread.id",yr),e.setAttribute("thread.name",Yd)}function nm(e){let t;wS(e)&&(t=ye()*1e3);const n=AS();if(!n)return;A&&y.log(`[Profiling] started profiling span: ${B(e).description}`);const r=$e();let i=null;G().setContext("profile",{profile_id:r,start_timestamp:t}),CS.add(e),Pa(e);async function s(){if(e&&n){if(i){A&&y.log("[Profiling] profile for:",B(e).description,"already exists, returning early");return}return n.stop().then(u=>{if(o&&(N.clearTimeout(o),o=void 0),A&&y.log(`[Profiling] stopped profiling of span: ${B(e).description}`),!u){A&&y.log(`[Profiling] profiler returned null profile for: ${B(e).description}`,"this may indicate an overlapping span or a call to stopProfiling with a profile title that was never started");return}i=u,FF(r,u)}).catch(u=>{A&&y.log("[Profiling] error while stopping profiler:",u)})}}let o=N.setTimeout(()=>{A&&y.log("[Profiling] max profile duration elapsed, stopping profiling for:",B(e).description),s()},RS);const a=e.end.bind(e);function c(){return e?(s().then(()=>{a()},()=>{a()}),e):a()}e.end=c}const $F=6e4,UF=3e5;class BF{constructor(){this._client=void 0,this._profiler=void 0,this._chunkTimer=void 0,this._profilerId=void 0,this._isRunning=!1,this._sessionSampled=!1,this._lifecycleMode=void 0,this._activeRootSpanIds=new Set,this._rootSpanTimeouts=new Map}initialize(t){const n=t.getOptions().profileLifecycle,r=NF(t.getOptions());A&&y.log(`[Profiling] Initializing profiler (lifecycle='${n}').`),r||A&&y.log("[Profiling] Session not sampled. Skipping lifecycle profiler initialization."),this._profilerId=$e(),this._client=t,this._sessionSampled=r,this._lifecycleMode=n,n==="trace"&&this._setupTraceLifecycleListeners(t),t.on("spanStart",i=>{this._isRunning&&Pa(i)})}start(){if(this._lifecycleMode==="trace"){A&&y.warn('[Profiling] `profileLifecycle` is set to "trace". Calls to `uiProfiler.start()` are ignored in trace mode.');return}if(this._isRunning){A&&y.warn("[Profiling] Profile session is already running, `uiProfiler.start()` is a no-op.");return}if(!this._sessionSampled){A&&y.warn("[Profiling] Session is not sampled, `uiProfiler.start()` is a no-op.");return}this._beginProfiling()}stop(){if(this._lifecycleMode==="trace"){A&&y.warn('[Profiling] `profileLifecycle` is set to "trace". Calls to `uiProfiler.stop()` are ignored in trace mode.');return}if(!this._isRunning){A&&y.warn("[Profiling] Profiler is not running, `uiProfiler.stop()` is a no-op.");return}this._endProfiling()}notifyRootSpanActive(t){if(this._lifecycleMode!=="trace"||!this._sessionSampled)return;const n=t.spanContext().spanId;if(!n||this._activeRootSpanIds.has(n))return;this._registerTraceRootSpan(n);const r=this._activeRootSpanIds.size;r===1&&(A&&y.log("[Profiling] Detected already active root span during setup. Active root spans now:",r),this._beginProfiling()),this._isRunning&&Pa(t)}_beginProfiling(){if(!this._isRunning){if(this._isRunning=!0,A&&y.log("[Profiling] Started profiling with profiler ID:",this._profilerId),mr().setContext("profile",{profiler_id:this._profilerId}),this._startProfilerInstance(),!this._profiler){A&&y.log("[Profiling] Failed to start JS Profiler; stopping."),this._resetProfilerInfo();return}this._startPeriodicChunking()}}_endProfiling(){this._isRunning&&(this._isRunning=!1,this._chunkTimer&&(clearTimeout(this._chunkTimer),this._chunkTimer=void 0),this._clearAllRootSpanTimeouts(),this._collectCurrentChunk().catch(t=>{A&&y.error("[Profiling] Failed to collect current profile chunk on `stop()`:",t)}),this._lifecycleMode==="manual"&&mr().setContext("profile",{}))}_setupTraceLifecycleListeners(t){t.on("spanStart",n=>{if(!this._sessionSampled){A&&y.log("[Profiling] Span not profiled because of negative sampling decision for user session.");return}if(n!==ke(n))return;if(!n.isRecording()){A&&y.log("[Profiling] Discarding profile because root span was not sampled.");return}const r=n.spanContext().spanId;if(!r||this._activeRootSpanIds.has(r))return;this._registerTraceRootSpan(r);const i=this._activeRootSpanIds.size;i===1&&(A&&y.log(`[Profiling] Root span ${r} started. Profiling active while there are active root spans (count=${i}).`),this._beginProfiling())}),t.on("spanEnd",n=>{if(!this._sessionSampled)return;const r=n.spanContext().spanId;if(!r||!this._activeRootSpanIds.has(r))return;this._activeRootSpanIds.delete(r);const i=this._activeRootSpanIds.size;A&&y.log(`[Profiling] Root span with ID ${r} ended. Will continue profiling for as long as there are active root spans (currently: ${i}).`),i===0&&(this._collectCurrentChunk().catch(s=>{A&&y.error("[Profiling] Failed to collect current profile chunk on last `spanEnd`:",s)}),this._endProfiling())})}_resetProfilerInfo(){this._isRunning=!1,mr().setContext("profile",{})}_clearAllRootSpanTimeouts(){this._rootSpanTimeouts.forEach(t=>clearTimeout(t)),this._rootSpanTimeouts.clear()}_registerTraceRootSpan(t){this._activeRootSpanIds.add(t);const n=setTimeout(()=>this._onRootSpanTimeout(t),UF);this._rootSpanTimeouts.set(t,n)}_startProfilerInstance(){if(this._profiler?.stopped===!1)return;const t=AS();if(!t){A&&y.log("[Profiling] Failed to start JS Profiler.");return}this._profiler=t}_startPeriodicChunking(){this._isRunning&&(this._chunkTimer=setTimeout(()=>{if(this._collectCurrentChunk().catch(t=>{A&&y.error("[Profiling] Failed to collect current profile chunk during periodic chunking:",t)}),this._isRunning){if(this._startProfilerInstance(),!this._profiler){this._resetProfilerInfo();return}this._startPeriodicChunking()}},$F))}_onRootSpanTimeout(t){this._rootSpanTimeouts.has(t)&&(this._rootSpanTimeouts.delete(t),this._activeRootSpanIds.has(t)&&(A&&y.log(`[Profiling] Reached 5-minute timeout for root span ${t}. You likely started a manual root span that never called \`.end()\`.`),this._activeRootSpanIds.delete(t),this._activeRootSpanIds.size===0&&this._endProfiling()))}async _collectCurrentChunk(){const t=this._profiler;if(this._profiler=void 0,!!t)try{const n=await t.stop(),r=IF(n,this._client,this._profilerId),i=kF(r);if("reason"in i){A&&y.log("[Profiling] Discarding invalid profile chunk (this is probably a bug in the SDK):",i.reason);return}this._sendProfileChunk(r),A&&y.log("[Profiling] Collected browser profile chunk.")}catch(n){A&&y.log("[Profiling] Error while stopping JS Profiler for chunk:",n)}}_sendProfileChunk(t){const n=this._client,r=Cs(n.getSdkMetadata?.()),i=n.getDsn(),s=n.getOptions().tunnel,o=Ot({event_id:$e(),sent_at:new Date().toISOString(),...r&&{sdk:r},...!!s&&i&&{dsn:sn(i)}},[[{type:"profile_chunk",platform:"javascript"},t]]);n.sendEnvelope(o).then(null,a=>{A&&y.error("Error while sending profile chunk envelope:",a)})}}const HF="BrowserProfiling",jF=(()=>({name:HF,setup(e){const t=e.getOptions(),n=new BF;if(!Eo(t)&&!t.profileLifecycle&&(t.profileLifecycle="manual"),Eo(t)&&!t.profilesSampleRate){A&&y.log("[Profiling] Profiling disabled, no profiling options found.");return}const r=Ae(),i=r&&ke(r);if(Eo(t)&&t.profileSessionSampleRate!==void 0&&A&&y.warn("[Profiling] Both legacy profiling (`profilesSampleRate`) and UI profiling settings are defined. `profileSessionSampleRate` has no effect when legacy profiling is enabled."),Eo(t))i&&wS(i)&&tm(i)&&nm(i),e.on("spanStart",s=>{const o=ke(s);s===o?tm(s)&&nm(s):CS.has(o)&&Pa(s)}),e.on("beforeEnvelope",s=>{if(!LF())return;const o=xF(s);if(!o.length)return;const a=[];for(const c of o){const u=c?.contexts,d=u?.profile?.profile_id,l=u?.profile?.start_timestamp;if(typeof d!="string"){A&&y.log("[Profiling] cannot find profile for a span without a profile context");continue}if(!d){A&&y.log("[Profiling] cannot find profile for a span without a profile context");continue}u?.profile&&delete u.profile;const p=DF(d);if(!p){A&&y.log(`[Profiling] Could not retrieve profile for span: ${d}`);continue}const f=PF(d,l,p,c);f&&a.push(f)}CF(s,a)});else{const s=t.profileLifecycle;if(e.on("startUIProfiler",()=>n.start()),e.on("stopUIProfiler",()=>n.stop()),s==="manual")n.initialize(e);else if(s==="trace"){if(!wt(t)){A&&y.warn("[Profiling] `profileLifecycle` is 'trace' but tracing is disabled. Set a `tracesSampleRate` or `tracesSampler` to enable span tracing.");return}n.initialize(e),i&&n.notifyRootSpanActive(i),N.setTimeout(()=>{const o=Ae(),a=o&&ke(o);a&&n.notifyRootSpanActive(a)},0)}}}})),WF=jF,zF=()=>({name:"LaunchDarkly",processEvent(e,t,n){return Ii(e)}});function qF(){return{name:"sentry-flag-auditor",type:"flag-used",synchronous:!0,method:(e,t,n)=>{wr(e,t.value),Ir(e,t.value)}}}const GF=()=>({name:"OpenFeature",processEvent(e,t,n){return Ii(e)}});class VF{after(t,n){wr(n.flagKey,n.value),Ir(n.flagKey,n.value)}error(t,n,r){wr(t.flagKey,t.defaultValue),Ir(t.flagKey,t.defaultValue)}}const YF=({featureFlagClientClass:e})=>({name:"Unleash",setupOnce(){const t=e.prototype;Ve(t,"isEnabled",KF)},processEvent(t,n,r){return Ii(t)}});function KF(e){return function(...t){const n=t[0],r=e.apply(this,t);return typeof n=="string"&&typeof r=="boolean"?(wr(n,r),Ir(n,r)):A&&y.error(`[Feature Flags] UnleashClient.isEnabled does not match expected signature. arg0: ${n} (${typeof n}), result: ${r} (${typeof r})`),r}}const JF=(({growthbookClass:e})=>lk({growthbookClass:e})),XF=({featureFlagClient:e})=>({name:"Statsig",setup(t){e.on("gate_evaluation",n=>{wr(n.gate.name,n.gate.value),Ir(n.gate.name,n.gate.value)})},processEvent(t,n,r){return Ii(t)}});async function QF(){const e=O();if(!e)return"no-client-active";if(!e.getDsn())return"no-dsn-configured";const r=e.getOptions().tunnel||"https://o447951.ingest.sentry.io/api/4509632503087104/envelope/?sentry_version=7&sentry_key=c1dfb07d783ad5325c245c1fd3725390&sentry_client=sentry.javascript.browser%2F1.33.7";try{await Yg(()=>fetch(r,{body:"{}",method:"POST",mode:"cors",credentials:"omit"}))}catch{return"sentry-unreachable"}}const ZF="WebWorker",e$=({worker:e})=>({name:ZF,setupOnce:()=>{(Array.isArray(e)?e:[e]).forEach(t=>rm(t))},addWorker:t=>rm(t)});function rm(e){e.addEventListener("message",t=>{if(r$(t.data)){if(t.stopImmediatePropagation(),t.data._sentryDebugIds&&(A&&y.log("Sentry debugId web worker message received",t.data),N._sentryDebugIds={...t.data._sentryDebugIds,...N._sentryDebugIds}),t.data._sentryModuleMetadata&&(A&&y.log("Sentry module metadata web worker message received",t.data),N._sentryModuleMetadata={...t.data._sentryModuleMetadata,...N._sentryModuleMetadata}),t.data._sentryWasmImages){A&&y.log("Sentry WASM images web worker message received",t.data);const n=N._sentryWasmImages||[],r=t.data._sentryWasmImages.filter(i=>ot(i)&&typeof i.code_file=="string"&&!n.some(s=>s.code_file===i.code_file));N._sentryWasmImages=[...n,...r]}t.data._sentryWorkerError&&(A&&y.log("Sentry worker rejection message received",t.data._sentryWorkerError),t$(t.data._sentryWorkerError))}})}function t$(e){const t=O();if(!t)return;const n=t.getOptions().stackParser,r=t.getOptions().attachStacktrace,i=e.reason,s=vn(i)?fb(i):sc(n,i,void 0,r,!0);s.level="error",e.filename&&(s.contexts={...s.contexts,worker:{filename:e.filename}}),wi(s,{originalException:i,mechanism:{handled:!1,type:"auto.browser.web_worker.onunhandledrejection"}}),A&&y.log("Captured worker unhandled rejection",i)}function n$({self:e}){e.postMessage({_sentryMessage:!0,_sentryDebugIds:e._sentryDebugIds??void 0,_sentryModuleMetadata:e._sentryModuleMetadata??void 0}),e.addEventListener("unhandledrejection",t=>{const r={reason:db(t),filename:e.location?.href};e.postMessage({_sentryMessage:!0,_sentryWorkerError:r}),A&&y.log("[Sentry Worker] Forwarding unhandled rejection to parent",r)}),A&&y.log("[Sentry Worker] Registered worker with unhandled rejection handling")}function r$(e){if(!ot(e)||e._sentryMessage!==!0)return!1;const t="_sentryDebugIds"in e,n="_sentryModuleMetadata"in e,r="_sentryWorkerError"in e,i="_sentryWasmImages"in e;return!(!t&&!n&&!r&&!i||t&&!(ot(e._sentryDebugIds)||e._sentryDebugIds===void 0)||n&&!(ot(e._sentryModuleMetadata)||e._sentryModuleMetadata===void 0)||r&&!ot(e._sentryWorkerError)||i&&(!Array.isArray(e._sentryWasmImages)||!e._sentryWasmImages.every(s=>ot(s)&&typeof s.code_file=="string")))}function i$(e){const t={...e};return R_(t,"react"),Gl("react",{version:ze.version}),sM(t)}function s$(e){const t=e.match(/^([^.]+)/);return t!==null&&parseInt(t[0])>=17}function o$(e,t){const n=new WeakSet;function r(i,s){if(!n.has(i)){if(i.cause)return n.add(i),r(i.cause,s);i.cause=s}}r(e,t)}function Jd(e,{componentStack:t},n){if(s$(ze.version)&&Jt(e)&&t){const r=new Error(e.message);r.name=`React ErrorBoundary ${e.name}`,r.stack=t,o$(e,r)}return at(r=>(r.setContext("react",{componentStack:t}),be(e,n)))}function a$(e){return(t,n)=>{const r=!!e,i=Jd(t,n,{mechanism:{handled:r,type:"auto.function.react.error_handler"}});r&&e(t,n,i)}}const xS="ui.react.render",c$="ui.react.update",OS="ui.react.mount",u$={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},l$={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},d$={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},MS={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},f$=Symbol.for("react.forward_ref"),NS=Symbol.for("react.memo");function p$(e){return typeof e=="object"&&e!==null&&e.$$typeof===NS}const Xd={};Xd[f$]=d$;Xd[NS]=MS;function im(e){if(p$(e))return MS;const t=e.$$typeof;return t&&Xd[t]||u$}const h$=Object.defineProperty.bind(Object),m$=Object.getOwnPropertyNames.bind(Object),sm=Object.getOwnPropertySymbols?.bind(Object),om=Object.getOwnPropertyDescriptor.bind(Object),g$=Object.getPrototypeOf.bind(Object),am=Object.prototype;function Vs(e,t,n){if(typeof t!="string"){if(am){const o=g$(t);o&&o!==am&&Vs(e,o)}let r=m$(t);sm&&(r=r.concat(sm(t)));const i=im(e),s=im(t);for(const o of r)if(!l$[o]&&!s?.[o]&&!i?.[o]&&!om(e,o)){const a=om(t,o);if(a)try{h$(e,o,a)}catch{}}}return e}const _$="unknown";class Qd extends ze.Component{constructor(t){super(t);const{name:n,disabled:r=!1}=this.props;r||(this._mountSpan=mt({name:`<${n}>`,onlyIfParent:!0,op:OS,attributes:{[J]:"auto.ui.react.profiler","ui.component_name":n}}))}componentDidMount(){this._mountSpan&&this._mountSpan.end()}shouldComponentUpdate({updateProps:t,includeUpdates:n=!0}){if(n&&this._mountSpan&&t!==this.props.updateProps){const r=Object.keys(t).filter(i=>t[i]!==this.props.updateProps[i]);if(r.length>0){const i=ye();this._updateSpan=Tr(this._mountSpan,()=>mt({name:`<${this.props.name}>`,onlyIfParent:!0,op:c$,startTime:i,attributes:{[J]:"auto.ui.react.profiler","ui.component_name":this.props.name,"ui.react.changed_props":r}}))}}return!0}componentDidUpdate(){this._updateSpan&&(this._updateSpan.end(),this._updateSpan=void 0)}componentWillUnmount(){const t=ye(),{name:n,includeRender:r=!0}=this.props;if(this._mountSpan&&r){const i=B(this._mountSpan).timestamp;Tr(this._mountSpan,()=>{const s=mt({onlyIfParent:!0,name:`<${n}>`,op:xS,startTime:i,attributes:{[J]:"auto.ui.react.profiler","ui.component_name":n}});s&&s.end(t)})}}render(){return this.props.children}}Object.assign(Qd,{defaultProps:{disabled:!1,includeRender:!0,includeUpdates:!0}});function y$(e,t){const n=t?.name||e.displayName||e.name||_$,r=i=>ze.createElement(Qd,{...t,name:n,updateProps:i},ze.createElement(e,{...i}));return r.displayName=`profiler(${n})`,Vs(r,e),r}function b$(e,t={disabled:!1,hasRenderSpan:!0}){const[n]=ze.useState(()=>{if(!t?.disabled)return mt({name:`<${e}>`,onlyIfParent:!0,op:OS,attributes:{[J]:"auto.ui.react.profiler","ui.component_name":e}})});ze.useEffect(()=>(n&&n.end(),()=>{if(n&&t.hasRenderSpan){const r=B(n).timestamp,i=ye(),s=mt({name:`<${e}>`,onlyIfParent:!0,op:xS,startTime:r,attributes:{[J]:"auto.ui.react.profiler","ui.component_name":e}});s&&s.end(i)}}),[])}const Ue=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,S$="unknown",fu={componentStack:null,error:null,eventId:null};class PS extends ze.Component{constructor(t){super(t),this.state=fu,this._openFallbackReportDialog=!0;const n=O();n&&t.showDialog&&(this._openFallbackReportDialog=!1,this._cleanupHook=n.on("afterSendEvent",r=>{!r.type&&this._lastEventId&&r.event_id===this._lastEventId&&sl({...t.dialogOptions,eventId:this._lastEventId})}))}componentDidCatch(t,n){const{componentStack:r}=n,{beforeCapture:i,onError:s,showDialog:o,dialogOptions:a}=this.props;at(c=>{i&&i(c,t,r);const u=this.props.handled!=null?this.props.handled:!!this.props.fallback,d=Jd(t,n,{mechanism:{handled:u,type:"auto.function.react.error_boundary"}});s&&s(t,r,d),o&&(this._lastEventId=d,this._openFallbackReportDialog&&sl({...a,eventId:d})),this.setState({error:t,componentStack:r,eventId:d})})}componentDidMount(){const{onMount:t}=this.props;t&&t()}componentWillUnmount(){const{error:t,componentStack:n,eventId:r}=this.state,{onUnmount:i}=this.props;i&&(this.state===fu?i(null,null,null):i(t,n,r)),this._cleanupHook&&(this._cleanupHook(),this._cleanupHook=void 0)}resetErrorBoundary(){const{onReset:t}=this.props,{error:n,componentStack:r,eventId:i}=this.state;t&&t(n,r,i),this.setState(fu)}render(){const{fallback:t,children:n}=this.props,r=this.state;if(r.componentStack===null)return typeof n=="function"?n():n;const i=typeof t=="function"?ze.createElement(t,{error:r.error,componentStack:r.componentStack,resetError:()=>this.resetErrorBoundary(),eventId:r.eventId}):t;return ze.isValidElement(i)?i:(t&&Ue&&y.warn("fallback did not produce a valid ReactElement"),null)}}function v$(e,t){const n=e.displayName||e.name||S$,r=ze.memo(i=>ze.createElement(PS,{...t},ze.createElement(e,{...i})));return r.displayName=`errorBoundary(${n})`,Vs(r,e),r}const E$="redux.action",T$="info",w$={attachReduxState:!0,actionTransformer:e=>e,stateTransformer:e=>e||null};function I$(e){const t={...w$,...e};return n=>(r,i)=>{t.attachReduxState&&mr().addEventProcessor((a,c)=>{try{a.type===void 0&&a.contexts.state.state.type==="redux"&&(c.attachments=[...c.attachments||[],{filename:"redux_state.json",data:JSON.stringify(a.contexts.state.state.value)}])}catch{}return a});function s(a){return(c,u)=>{const d=a(c,u),l=G(),p=t.actionTransformer(u);typeof p<"u"&&p!==null&&Ut({category:E$,data:p,type:T$});const f=t.stateTransformer(d);if(typeof f<"u"&&f!==null){const _=O()?.getOptions()?.normalizeDepth||3,S={state:{type:"redux",value:f}};DT(S,3+_),l.setContext("state",S)}else l.setContext("state",null);const{configureScopeWithState:h}=t;return typeof h=="function"&&h(l,d),d}}const o=n(s(r),i);return o.replaceReducer=new Proxy(o.replaceReducer,{apply:function(a,c,u){a.apply(c,[s(u[0])])}}),o}}function k$(e){const t=Pi({...e,instrumentPageLoad:!1,instrumentNavigation:!1}),{history:n,routes:r,match:i,instrumentPageLoad:s=!0,instrumentNavigation:o=!0}=e;return{...t,afterAllSetup(a){t.afterAllSetup(a),s&&N.location&&cm(r,N.location,i,(c,u="url")=>{Li(a,{name:c,attributes:{[oe]:"pageload",[J]:"auto.pageload.react.reactrouter_v3",[le]:u}})}),o&&n.listen&&n.listen(c=>{(c.action==="PUSH"||c.action==="POP")&&cm(r,c,i,(u,d="url")=>{Di(a,{name:u,attributes:{[oe]:"navigation",[J]:"auto.navigation.react.reactrouter_v3",[le]:d}})})})}}}function cm(e,t,n,r){let i=t.pathname;n({location:t,routes:e},(s,o,a)=>{if(s||!a)return r(i);const c=R$(a.routes||[]);return c.length===0||c==="/*"?r(i):(i=c,r(i,"route"))})}function R$(e){if(!Array.isArray(e)||e.length===0)return"";const t=e.filter(r=>!!r.path);let n=-1;for(let r=t.length-1;r>=0;r--)if(t[r].path?.startsWith("/")){n=r;break}return t.slice(n).reduce((r,{path:i})=>{const s=r==="/"||r===""?i:`/${i}`;return`${r}${s}`},"")}function A$(e,t={}){const n=e,r=Pi({...t,instrumentNavigation:!1,instrumentPageLoad:!1}),{instrumentPageLoad:i=!0,instrumentNavigation:s=!0}=t;return{...r,afterAllSetup(o){r.afterAllSetup(o);const a=N.location;if(i&&a){const c=n.matchRoutes(a.pathname,n.options.parseSearch(a.search),{preload:!1,throwOnError:!1}),u=c[c.length-1],d=u?.routeId!=="__root__"?u:void 0;Li(o,{name:d?d.routeId:a.pathname,attributes:{[oe]:"pageload",[J]:"auto.pageload.react.tanstack_router",[le]:d?"route":"url",...um(d)}})}s&&n.subscribe("onBeforeNavigate",c=>{if(!c.fromLocation||c.toLocation.state===c.fromLocation.state)return;const u=n.matchRoutes(c.toLocation.pathname,c.toLocation.search,{preload:!1,throwOnError:!1}),d=u[u.length-1],l=d?.routeId!=="__root__"?d:void 0,p=N.location,f=Di(o,{name:l?l.routeId:p.pathname,attributes:{[oe]:"navigation",[J]:"auto.navigation.react.tanstack_router",[le]:l?"route":"url"}}),h=n.subscribe("onResolved",m=>{if(h(),f){const g=n.matchRoutes(m.toLocation.pathname,m.toLocation.search,{preload:!1,throwOnError:!1}),_=g[g.length-1],S=_?.routeId!=="__root__"?_:void 0;S&&(f.updateName(S.routeId),f.setAttribute(le,"route"),f.setAttributes(um(S)))}})})}}}function um(e){if(!e)return{};const t={};return Object.entries(e.params).forEach(([n,r])=>{t[`url.path.params.${n}`]=r,t[`url.path.parameter.${n}`]=r,t[`params.${n}`]=r}),t}function C$(e){const t=Pi({...e,instrumentPageLoad:!1,instrumentNavigation:!1}),{history:n,routes:r,matchPath:i,instrumentPageLoad:s=!0,instrumentNavigation:o=!0}=e;return{...t,afterAllSetup(a){t.afterAllSetup(a),LS(a,s,o,n,"reactrouter_v4",r,i)}}}function x$(e){const t=Pi({...e,instrumentPageLoad:!1,instrumentNavigation:!1}),{history:n,routes:r,matchPath:i,instrumentPageLoad:s=!0,instrumentNavigation:o=!0}=e;return{...t,afterAllSetup(a){t.afterAllSetup(a),LS(a,s,o,n,"reactrouter_v5",r,i)}}}function LS(e,t,n,r,i,s=[],o){function a(){if(r.location)return r.location.pathname;if(N.location)return N.location.pathname}function c(u){if(s.length===0||!o)return[u,"url"];const d=DS(s,u,o);for(const l of d)if(l.match.isExact)return[l.match.path,"route"];return[u,"url"]}if(t){const u=a();if(u){const[d,l]=c(u);Li(e,{name:d,attributes:{[oe]:"pageload",[J]:`auto.pageload.react.${i}`,[le]:l}})}}n&&r.listen&&r.listen((u,d)=>{if(d&&(d==="PUSH"||d==="POP")){const[l,p]=c(u.pathname);Di(e,{name:l,attributes:{[oe]:"navigation",[J]:`auto.navigation.react.${i}`,[le]:p}})}})}function DS(e,t,n,r=[]){return e.some(i=>{const s=i.path?n(t,i):r.length?r[r.length-1].match:O$(t);return s&&(r.push({route:i,match:s}),i.routes&&DS(i.routes,t,n,r)),!!s}),r}function O$(e){return{path:"/",url:"/",params:{},isExact:e==="/"}}function M$(e){const t=e.displayName||e.name,n=r=>{if(r?.computedMatch?.isExact){const i=r.computedMatch.path,s=N$();G().setTransactionName(i),s&&(s.updateName(i),s.setAttribute(le,"route"))}return ze.createElement(e,{...r})};return n.displayName=`sentryRoute(${t})`,Vs(n,e),n}function N$(){const e=Ae(),t=e&&ke(e);if(!t)return;const n=B(t).op;return n==="navigation"||n==="pageload"?t:void 0}function Ys(e,t){if(!t||t==="/"||!e.toLowerCase().startsWith(t.toLowerCase()))return e;const n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?e:e.slice(n)||"/"}const lm=new WeakMap;function P$(e,t,n){if(!e||!t?.length)return null;const r=n?Ys(e,n):e;let i=lm.get(t);i||(i=B$(t),lm.set(t,i),Ue&&y.log("[React Router] Sorted route manifest by specificity:",i.length,"patterns"));for(const s of i)if(L$(r,s))return Ue&&y.log("[React Router] Matched pathname",r,"to pattern",s),s;return Ue&&y.log("[React Router] No manifest match found for pathname:",r),null}function L$(e,t){if(t==="/")return e==="/"||e==="";const n=fm(e),r=fm(t);if(r.length>0&&r[r.length-1]==="*"){const s=r.slice(0,-1);if(n.length{const r=pm(t);return pm(n)-r})}let Zd,br=!1;const qn=[],H$=10;function j$(e,t){const n={};return qn.length>=H$&&(Ue&&y.warn("[React Router] Navigation context stack overflow - removing oldest context"),qn.shift()),qn.push({token:n,targetPath:e,span:t}),n}function W$(e){qn[qn.length-1]?.token===e&&qn.pop()}function $S(){const e=qn.length;return e>0?qn[e-1]??null:null}function z$(e,t=!1){Zd=e,br=t}function q$(e){return V$(e.route.path||"")}function G$(e){return e.params["*"]||""}function V$(e){return e[e.length-1]==="*"?e.slice(0,-1):e}function ni(e){return e[e.length-1]==="/"?e.slice(0,-1):e}function US(e){return e.endsWith("*")}function Qn(e){return e.includes("/*")||e.endsWith("*")}function hm(e,t){return US(e)&&!!t.route.children?.length||!1}function Y$(e){return!!(!e.children&&e.element&&e.path?.endsWith("/*"))}function K$(e,t,n){const r=e&&e.length>0?e:br?Ys(t,n):t;let i=r.slice(-2)==="/*"?r.slice(0,-2):r;return i.length>1&&i[i.length-1]==="/"&&(i=i.slice(0,-1)),[i,"route"]}function mm(e){return e.split(/\\?\//).filter(t=>t.length>0&&t!==",").length}function La(e){return e[0]==="/"?e:`/${e}`}function BS(e,t){const n=Zd(e,t);if(!n||n.length===0)return"";for(const r of n)if(r.route.path&&r.route.path!=="*"){const i=q$(r),s=Ys(t.pathname,La(r.pathnameBase));return t.pathname===s?ni(s):ni(ni(i||"")+La(BS(e.filter(o=>o!==r.route),{pathname:s})))}return""}function J$(e,t){const n=Zd(t,e);if(n){for(const r of n)if(Y$(r.route)&&G$(r))return!0}return!1}function gm(e,t){return br?Ys(e.pathname,t):e.pathname||""}function X$(e,t,n,r=""){if(!e||e.length===0)return[br?Ys(t.pathname,r):t.pathname,"url"];if(!n)return[gm(t,r),"url"];let i="";for(const s of n){const o=s.route;if(!o)continue;if(o.index)return K$(i,s.pathname,r);const a=o.path;if(!a||hm(a,s))continue;const c=a[0]==="/"||i[i.length-1]==="/"?a:`/${a}`;if(i=ni(i)+La(c),ni(t.pathname)===ni(r+s.pathname))return mm(i)!==mm(s.pathname)&&!US(i)?[(br?"":r)+c,"route"]:(hm(i,s)&&(i=i.slice(0,-1)),[(br?"":r)+i,"route"])}return[gm(t,r),"url"]}function Tc(e,t,n,r,i="",s,o){if(o&&s&&s.length>0){const d=P$(e.pathname,s,i);if(d)return[(br?"":i)+d,"route"]}let a,c="url";const u=J$(e,n);return u&&(a=La(BS(n,e)),c="route"),(!u||!a)&&([a,c]=X$(t,e,r,i)),[a||e.pathname,c]}function tn(){const e=Ae(),t=e?ke(e):void 0;if(!t)return;const n=B(t).op;return n==="navigation"||n==="pageload"?t:void 0}function Q$(){const e=$S();if(e)return e.targetPath?{pathname:e.targetPath,search:"",hash:"",state:null,key:"default"}:null;if(typeof N<"u")try{const t=N.location;if(t)return{pathname:t.pathname,search:t.search||"",hash:t.hash||"",state:null,key:"default"}}catch{Ue&&y.warn("[React Router] Could not access window.location")}return null}function Z$(){const e=$S();return e?e.span:tn()}function eU(e,t,n,r){const i=new Proxy(e,{apply(s,o,a){const c=Q$(),u=Z$(),d=s.apply(o,a);return tU(d,t,n,r,c,u),d}});return xe(i,"__sentry_proxied__",!0),i}function tU(e,t,n,r,i,s){tr(e)?e.then(o=>{Array.isArray(o)&&r(o,t,i??void 0,s)}).catch(o=>{Ue&&y.warn(`Error resolving async handler '${n}' for route`,t,o)}):Array.isArray(e)&&r(e,t,i??void 0,s)}function wc(e,t){if(e.handle&&typeof e.handle=="object")for(const n of Object.keys(e.handle)){const r=e.handle[n];typeof r=="function"&&!r.__sentry_proxied__&&(e.handle[n]=eU(r,e,n,t))}if(Array.isArray(e.children))for(const n of e.children)wc(n,t)}let Gn,Vn,Yn,Ko,At,ir=!1,hr=3e3,Ks,ef="";const HS=new WeakSet,lr=new WeakMap,je=new Set,Jo=new WeakMap,yl=new WeakMap;function nU(e){return N?.requestAnimationFrame?N.requestAnimationFrame(e):setTimeout(e,0)}function _m(e){N?.cancelAnimationFrame?N.cancelAnimationFrame(e):clearTimeout(e)}function jS(e){return`${e.pathname}${e.search||""}${e.hash||""}`}function ym(e){return e.includes(":")||e.includes("*")}function rU(e,t,n,r){if(!e)return{skip:!1,shouldUpdate:!1};if(e.locationKey===t&&(e.isPlaceholder||!r)){const s=!!e.routeName&&Qn(e.routeName),o=Qn(n),a=!!e.routeName&&ym(e.routeName),c=ym(n),u=s&&!o,d=!a&&c,l=n!==e.routeName&&n.length>(e.routeName?.length||0)&&!o;return{skip:!0,shouldUpdate:!!(e.routeName&&(u||d||l))}}return{skip:!1,shouldUpdate:!1}}function WS(e,t){const n=t.children||[],r=e.filter(i=>!n.some(s=>s===i||i.path&&s.path===i.path||i.id&&s.id===i.id));r.length>0&&(t.children=[...n,...r])}function zS(e,t){let n=Jo.get(e);n||(n=new Set,Jo.set(e,n)),n.add(t),t.finally(()=>{const r=Jo.get(e);r&&r.delete(t)})}function qS(e){const t=new Promise(n=>{yl.set(e,n)});zS(e,t)}function iU(e){const t=yl.get(e);t&&(t(),yl.delete(e),e.__sentry_may_have_lazy_routes__&&(e.__sentry_may_have_lazy_routes__=!1))}function tf(e,t,n=null,r){e.forEach(s=>{je.add(s),ir&&wc(s,tf)}),t&&WS(e,t);const i=r??tn();if(i){const s=B(i);if(s.timestamp){Ue&&y.warn("[React Router] Lazy handler resolved after span ended - skipping update");return}const o=s.op;let a=n;if(!a&&!r&&typeof N<"u"){const c=N.location;c?.pathname&&(a={pathname:c.pathname})}a&&(o==="pageload"?Xs({activeRootSpan:i,location:{pathname:a.pathname},routes:Array.from(je),allRoutes:Array.from(je)}):o==="navigation"&&bl(i,a,Array.from(je),!1,At))}}function bl(e,t,n,r=!1,i){const s=B(e),o=s.description,a=e?.__sentry_navigation_name_set__,c=o&&Qn(o);if((!a||r||c)&&!s.timestamp){const d=i(n,t),[l,p]=Tc(t,n,n,d||[],ef,Ks,ir),f=s.data?.[le];l&&(!o||!a&&(f!=="route"||p==="route")||f!=="route"&&p==="route"||f==="route"&&p==="route"&&c)&&(e.updateName(l),e.setAttribute(le,p),!Qn(l)&&p==="route"&&xe(e,"__sentry_navigation_name_set__",!0))}}function GS(e,t,n,r,i){let s=!1,o=!!i&&B(i).op==="pageload",a=!1,c=null,u=null;e.subscribe(d=>{if(!s){const p=tn();p&&B(p).op==="pageload"?o=!0:o&&(d.historyAction==="POP"&&!a?a=!0:s=!0)}if(d.historyAction==="PUSH"||d.historyAction==="POP"&&s){const p=jS(d.location),f=()=>{u!==p&&(u=p,c=null,nf({location:d.location,routes:t,navigationType:d.historyAction,version:n,basename:r,allRoutes:Array.from(je)}))};d.navigation.state!=="idle"?(u!==p&&(u=null),c!==null&&_m(c),c=nU(f)):(c!==null&&(_m(c),c=null),f())}})}function VS(e,t){return!Gn||!Vn||!Yn||!At?(Ue&&y.warn(`reactRouterV${t}Instrumentation was unable to wrap the \`createRouter\` function because of one or more missing parameters.`),e):function(n,r){if(Js(n),ir)for(const u of n)wc(u,tf);const i=tn();r&&"patchRoutesOnNavigation"in r&&typeof r.patchRoutesOnNavigation=="function"&&i&&(xe(i,"__sentry_may_have_lazy_routes__",!0),qS(i));const o=XS(r,!1,i),a=e(n,o),c=r?.basename;return a.state.historyAction==="POP"&&i&&Xs({activeRootSpan:i,location:a.state.location,routes:n,basename:c,allRoutes:Array.from(je)}),ef=c||"",GS(a,n,t,c,i),a}}function YS(e,t){return!Gn||!Vn||!Yn||!At?(Ue&&y.warn(`reactRouterV${t}Instrumentation was unable to wrap the \`createMemoryRouter\` function because of one or more missing parameters.`),e):function(n,r){if(Js(n),ir)for(const g of n)wc(g,tf);const i=tn();r&&"patchRoutesOnNavigation"in r&&typeof r.patchRoutesOnNavigation=="function"&&i&&(xe(i,"__sentry_may_have_lazy_routes__",!0),qS(i));const o=XS(r,!0,i),a=e(n,o),c=r?.basename;let u;const d=r?.initialEntries,l=r?.initialIndex,p=d?.length===1,f=l!==void 0&&d?.[l];u=p?d[0]:f?d[l]:void 0;const h=u?typeof u=="string"?{pathname:u}:u:a.state.location,m=tn();return a.state.historyAction==="POP"&&m&&Xs({activeRootSpan:m,location:h,routes:n,basename:c,allRoutes:Array.from(je)}),ef=c||"",GS(a,n,t,c,m),a}}function KS(e,t){const n=Pi({...e,instrumentPageLoad:!1,instrumentNavigation:!1}),{useEffect:r,useLocation:i,useNavigationType:s,createRoutesFromChildren:o,matchRoutes:a,stripBasename:c,enableAsyncRouteHandlers:u=!1,instrumentPageLoad:d=!0,instrumentNavigation:l=!0,lazyRouteTimeout:p,lazyRouteManifest:f}=e;return{...n,setup(h){n.setup(h);const m=e.finalTimeout??3e4,g=(e.idleTimeout??1e3)*3,_=p??g;_===1/0?(hr=m,Ue&&y.log("[React Router] lazyRouteTimeout set to Infinity, capping at finalTimeout:",m,"ms to prevent indefinite hangs")):Number.isNaN(_)?(Ue&&y.warn("[React Router] lazyRouteTimeout must be a number, falling back to default:",g),hr=g):_<0?(Ue&&y.warn("[React Router] lazyRouteTimeout must be non-negative or Infinity, got:",_,"falling back to:",g),hr=g):hr=_,Gn=r,Vn=i,Yn=s,At=a,Ko=o,ir=u,Ks=f,z$(a,c||!1)},afterAllSetup(h){n.afterAllSetup(h);const m=N.location?.pathname;d&&m&&Li(h,{name:m,attributes:{[le]:"url",[oe]:"pageload",[J]:`auto.pageload.react.reactrouter_v${t}`}}),l&&HS.add(h)}}}function JS(e,t){if(!Gn||!Vn||!Yn||!At)return Ue&&y.warn("reactRouterV6Instrumentation was unable to wrap `useRoutes` because of one or more missing parameters."),e;const n=r=>{const i=ze.useRef(!0),{routes:s,locationArg:o}=r,a=e(s,o),c=Vn(),u=Yn(),d=typeof o=="string"||o?.pathname?o:c;return Gn(()=>{const l=typeof d=="string"?{pathname:d}:d;i.current?(Js(s),Xs({activeRootSpan:tn(),location:l,routes:s,allRoutes:Array.from(je)}),i.current=!1):nf({location:l,routes:s,navigationType:u,version:t,allRoutes:Array.from(je)})},[u,d]),a};return(r,i)=>ze.createElement(n,{routes:r,locationArg:i})}function XS(e,t=!1,n){if(!e||!("patchRoutesOnNavigation"in e)||typeof e.patchRoutesOnNavigation!="function")return e||{};const r=e.patchRoutesOnNavigation;return{...e,patchRoutesOnNavigation:async i=>{const s=i?.path,o=tn()??n;if(!t){const c=i?.patch,u=i?.matches;c&&(i.patch=(d,l)=>{if(Js(l),u&&u.length>0){const h=u[u.length-1]?.route;if(h){const m=Array.from(je).find(g=>{const _=g.id!==void 0&&g.id===d,S=g===h,E=g.path!==void 0&&h.path!==void 0&&g.path===h.path;return _||S||E});m&&WS(l,m)}}const p=o?B(o):void 0;return s&&o&&p&&!p.timestamp&&p.op==="navigation"&&bl(o,{pathname:s,search:"",hash:"",state:null,key:"default"},Array.from(je),!0,At),c(d,l)})}const a=(async()=>{const c=j$(s,o);let u;try{u=await r(i)}finally{W$(c),o&&iU(o)}const d=o?B(o):void 0;if(o&&d&&!d.timestamp&&d.op==="navigation"){const l=s;l&&bl(o,{pathname:l,search:"",hash:"",state:null,key:"default"},Array.from(je),!1,At)}return u})();return o&&zS(o,a),a}}}function nf(e){const{location:t,routes:n,navigationType:r,version:i,matches:s,basename:o,allRoutes:a}=e,c=Array.isArray(s)?s:At(a||n,t,o),u=O();if(!u||!HS.has(u))return;const d=tn();if(!(d&&B(d).op==="pageload"&&r==="POP")&&(r==="PUSH"||r==="POP")&&c){const[l,p]=Tc(t,a||n,a||n,c,o,Ks,ir),f=jS(t),h=lr.get(u),m=h&&!h.isPlaceholder?!!B(h.span).timestamp:!1,{skip:g,shouldUpdate:_}=rU(h,f,l,m);if(g){if(_&&h){const w=h.routeName;h.isPlaceholder?(h.routeName=l,Ue&&y.log(`[Tracing] Updated placeholder navigation name from "${w}" to "${l}" (will apply to real span)`)):(h.span.updateName(l),h.span.setAttribute(le,p),xe(h.span,"__sentry_navigation_name_set__",!0),h.routeName=l,Ue&&y.log(`[Tracing] Updated navigation span name from "${w}" to "${l}"`))}else Ue&&y.log(`[Tracing] Skipping duplicate navigation for location: ${f}`);return}const E={span:{end:()=>{}},routeName:l,pathname:t.pathname,locationKey:f,isPlaceholder:!0};lr.set(u,E);let v;try{v=Di(u,{name:E.routeName,attributes:{[le]:p,[oe]:"navigation",[J]:`auto.navigation.react.reactrouter_v${i}`}})}catch(w){throw lr.delete(u),w}v?(lr.set(u,{span:v,routeName:E.routeName,pathname:t.pathname,locationKey:f}),Sl(v,t,n,o,"navigation")):lr.delete(u)}}function Js(e){e.forEach(t=>{QS(t).forEach(r=>{je.add(r)})})}function QS(e,t=new Set){return t.has(e)||(t.add(e),e.children&&!e.index&&e.children.forEach(n=>{QS(n,t).forEach(i=>{t.add(i)})})),t}function Xs({activeRootSpan:e,location:t,routes:n,matches:r,basename:i,allRoutes:s}){const o=Array.isArray(r)?r:At(s||n,t,i);if(o){const[a,c]=Tc(t,s||n,s||n,o,i,Ks,ir);G().setTransactionName(a||"/"),e&&(e.updateName(a),e.setAttribute(le,c),Sl(e,t,n,i,"pageload"))}else e&&Sl(e,t,n,i,"pageload")}function sU(e,t,n,r,i=!1){return n?!!(!e&&i||e&&Qn(e)&&r==="route"&&!Qn(n)||t!=="route"&&r==="route"):!1}function pu(e,t,n,r,i,s,o,a){try{const c=t.data?.[le];if(c==="route"&&n&&!Qn(n))return;const u=Array.from(a),d=u.length>0?u:i,l=At(d,r,s);if(!l)return;const[p,f]=Tc(r,d,d,l,s,Ks,ir),h=sU(n,c,p,f,!0),m=o==="pageload"||!t.timestamp;h&&m&&(e.updateName(p),e.setAttribute(le,f))}catch(c){Ue&&y.warn(`Error updating span details before ending: ${c}`)}}function Sl(e,t,n,r,i){const s=`__sentry_${i}_end_patched__`;if(e?.[s]||!e.end)return;const a=e.end.bind(e);let c=!1;e.end=function(...d){if(c)return;c=!0;const l=d.length>0?d[0]:Date.now()/1e3,p=B(e),f=p.description,h=p.data?.[le],m=()=>{const v=O();if(v&&i==="navigation"){const w=lr.get(v);w&&w.span===e&&lr.delete(v)}},g=Jo.get(e),_=e.__sentry_may_have_lazy_routes__;if((g&&g.size>0||_)&&f&&(Qn(f)||h!=="route")){if(hr===0){pu(e,p,f,t,n,r,i,je),m(),a(l);return}const v=new Promise(T=>setTimeout(T,hr));let w;if(g&&g.size>0){const T=Promise.allSettled(g).then(()=>{});w=hr===1/0?T:Promise.race([T,v])}else w=v;w.then(()=>{const T=B(e);pu(e,T,T.description,t,n,r,i,je),m(),a(l)}).catch(()=>{m(),a(l)});return}pu(e,p,f,t,n,r,i,je),m(),a(l)},xe(e,s,!0)}function ZS(e,t){if(!Gn||!Vn||!Yn||!Ko||!At)return Ue&&y.warn(`reactRouterV6Instrumentation was unable to wrap Routes because of one or more missing parameters. useEffect: ${Gn}. useLocation: ${Vn}. useNavigationType: ${Yn}. createRoutesFromChildren: ${Ko}. matchRoutes: ${At}.`),e;const n=r=>{const i=ze.useRef(!0),s=Vn(),o=Yn();return Gn(()=>{const a=Ko(r.children);i.current?(Js(a),Xs({activeRootSpan:tn(),location:s,routes:a,allRoutes:Array.from(je)}),i.current=!1):nf({location:s,routes:a,navigationType:o,version:t,allRoutes:Array.from(je)})},[s,o]),ze.createElement(e,{...r})};return Vs(n,e),n}function oU(e){return KS(e,"6")}function aU(e){return JS(e,"6")}function cU(e){return VS(e,"6")}function uU(e){return YS(e,"6")}function lU(e){return ZS(e,"6")}function dU(e){return KS(e,"7")}function fU(e){return ZS(e,"7")}function pU(e){return VS(e,"7")}function hU(e){return YS(e,"7")}function mU(e){return JS(e,"7")}const K3=Object.freeze(Object.defineProperty({__proto__:null,BrowserClient:$y,ErrorBoundary:PS,MULTIPLEXED_TRANSPORT_EXTRA_KEY:Lo,OpenFeatureIntegrationHook:VF,Profiler:Qd,SDK_VERSION:gn,SEMANTIC_ATTRIBUTE_SENTRY_OP:oe,SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN:J,SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE:ja,SEMANTIC_ATTRIBUTE_SENTRY_SOURCE:le,Scope:$t,WINDOW:N,addBreadcrumb:Ut,addEventProcessor:i_,addIntegration:Bu,breadcrumbsIntegration:ob,browserApiErrorsIntegration:ab,browserProfilingIntegration:WF,browserSessionIntegration:cb,browserTracingIntegration:Pi,buildLaunchDarklyFlagUsedHandler:qF,captureConsoleIntegration:hI,captureEvent:wi,captureException:be,captureFeedback:j_,captureMessage:t_,captureReactException:Jd,captureSession:No,chromeStackLineParser:tb,close:K0,consoleLoggingIntegration:Ok,contextLinesIntegration:AM,continueTrace:o0,createConsolaReporter:Dk,createLangChainCallbackHandler:ld,createReduxEnhancer:I$,createTransport:__,createUserFeedbackEnvelope:vO,cultureContextIntegration:ub,dedupeIntegration:L_,defaultRequestInstrumentationOptions:Gd,defaultStackLineParsers:rb,defaultStackParser:ib,diagnoseSdkConnectivity:QF,elementTimingIntegration:kx,endSession:Vl,eventFiltersIntegration:C_,eventFromException:Dy,eventFromMessage:Fy,exceptionFromError:ic,extraErrorDataIntegration:TI,featureFlagsIntegration:uk,feedbackAsyncIntegration:p1,feedbackIntegration:nh,feedbackSyncIntegration:nh,flush:Y0,forceLoad:oM,functionToStringIntegration:A_,geckoStackLineParser:nb,getActiveSpan:Ae,getClient:O,getCurrentScope:G,getDefaultIntegrations:gb,getFeedback:vC,getGlobalScope:mr,getIsolationScope:Oe,getReplay:TD,getRootSpan:ke,getSpanDescendants:Zi,getSpanStatusFromHttpCode:mg,getTraceData:Zl,globalHandlersIntegration:lb,graphqlClientIntegration:DM,growthbookIntegration:JF,httpClientIntegration:hM,httpContextIntegration:hb,inboundFiltersIntegration:x_,init:i$,instrumentAnthropicAiClient:ZR,instrumentCreateReactAgent:xA,instrumentGoogleGenAIClient:dA,instrumentLangChainEmbeddings:VA,instrumentLangGraph:OA,instrumentOpenAiClient:PR,instrumentOutgoingRequests:gS,instrumentSupabaseClient:H_,isBotUserAgent:yS,isEnabled:r_,isInitialized:J0,lastEventId:n_,launchDarklyIntegration:zF,lazyLoadIntegration:Py,linkedErrorsIntegration:mb,logger:Rk,makeBrowserOfflineTransport:_F,makeFetchTransport:Rd,makeMultiplexedTransport:Uw,metrics:Pk,moduleMetadataIntegration:lI,onLoad:aM,openFeatureIntegration:GF,opera10StackLineParser:_O,opera11StackLineParser:SO,parameterize:k_,reactErrorHandler:a$,reactRouterV3BrowserTracingIntegration:k$,reactRouterV4BrowserTracingIntegration:C$,reactRouterV5BrowserTracingIntegration:x$,reactRouterV6BrowserTracingIntegration:oU,reactRouterV7BrowserTracingIntegration:dU,registerSpanErrorInstrumentation:Ug,registerWebWorker:n$,replayCanvasIntegration:jD,replayIntegration:SD,reportPageLoaded:cF,reportingObserverIntegration:dM,rewriteFramesIntegration:OI,sendFeedback:Sy,setActiveSpanInBrowser:uF,setContext:Gl,setConversationId:V0,setCurrentClient:T_,setExtra:W0,setExtras:j0,setHttpStatus:ls,setMeasurement:Vg,setTag:q0,setTags:z0,setUser:G0,showReportDialog:sl,spanStreamingIntegration:lF,spanToBaggageHeader:NT,spanToJSON:B,spanToTraceHeader:Cg,spotlightBrowserIntegration:nM,startBrowserTracingNavigationSpan:Di,startBrowserTracingPageLoadSpan:Li,startInactiveSpan:mt,startNewTrace:Kg,startSession:Uu,startSpan:on,startSpanManual:pn,statsigIntegration:XF,supabaseIntegration:qI,suppressTracing:Yg,tanstackRouterBrowserTracingIntegration:A$,thirdPartyErrorFilterIntegration:tk,uiProfiler:Qx,unleashIntegration:YF,updateSpanName:CT,useProfiler:b$,viewHierarchyIntegration:FM,webWorkerIntegration:e$,winjsStackLineParser:hO,withActiveSpan:Tr,withErrorBoundary:v$,withIsolationScope:XE,withProfiler:y$,withScope:at,withSentryReactRouterV6Routing:lU,withSentryReactRouterV7Routing:fU,withSentryRouting:M$,withStreamedSpan:PT,wrapCreateBrowserRouterV6:cU,wrapCreateBrowserRouterV7:pU,wrapCreateMemoryRouterV6:uU,wrapCreateMemoryRouterV7:hU,wrapUseRoutesV6:aU,wrapUseRoutesV7:mU,zodErrorsIntegration:ek},Symbol.toStringTag,{value:"Module"})),gU=250,_U=50;class yU{constructor(t,n){var r,i;this.signalBuffer=[],this.itemLimit=(r=n?.itemLimit)!==null&&r!==void 0?r:_U,this.sendTimeout=(i=n?.sendTimeout)!==null&&i!==void 0?i:gU,this.paused=n?.paused||!1,this.sendFn=t,this.flushInterval=-1,this.paused||this.start(),document.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&this.flush()})}addItem(t){this.paused||(this.signalBuffer.push(t),this.signalBuffer.length>=this.itemLimit&&this.flush())}start(){this.paused=!1,this.sendTimeout>0&&(this.flushInterval=window.setInterval(()=>this.flush(),this.sendTimeout))}pause(){this.paused=!0,clearInterval(this.flushInterval)}groupItems(t){const n=new Map;return t.forEach(r=>{const i=JSON.stringify(r.meta);let s=n.get(i);s===void 0?s=[r]:s=[...s,r],n.set(i,s)}),Array.from(n.values())}flush(){if(this.paused||this.signalBuffer.length===0)return;this.groupItems(this.signalBuffer).forEach(this.sendFn),this.signalBuffer=[]}}var Le;(function(e){e.EXCEPTION="exception",e.LOG="log",e.MEASUREMENT="measurement",e.TRACE="trace",e.EVENT="event"})(Le||(Le={}));const ev={[Le.EXCEPTION]:"exceptions",[Le.LOG]:"logs",[Le.MEASUREMENT]:"measurements",[Le.TRACE]:"traces",[Le.EVENT]:"events"};function bU(e,t,n,r){var i;t.debug("Initializing transports");const s=[];let o=n.paused,a=[];const c=(...w)=>{t.debug("Adding transports"),w.forEach(T=>{if(t.debug(`Adding "${T.name}" transport`),s.some(I=>I===T)){t.warn(`Transport ${T.name} is already added`);return}T.unpatchedConsole=e,T.internalLogger=t,T.config=n,T.metas=r,s.push(T)})},u=(...w)=>{t.debug(`Adding beforeSendHooks `,a),w.forEach(T=>{T&&a.push(T)})},d=w=>{let T=w;for(const b of a){const I=T.map(b).filter(Boolean);if(I.length===0)return[];T=SU(I,n)}return T},l=w=>{const T=d(w);if(T.length!==0)for(const b of s)t.debug(`Transporting item using ${b.name} `,T),b.isBatched()&&b.send(T)},p=w=>{var T,b;if(!((T=n.batching)===null||T===void 0)&&T.enabled&&s.every(M=>M.isBatched()))return;const[I]=d([w]);if(I!==void 0)for(const M of s)t.debug(`Transporting item using ${M.name} `,I),M.isBatched()?!((b=n.batching)===null||b===void 0)&&b.enabled||M.send([I]):M.send(I)};let f;return!((i=n.batching)===null||i===void 0)&&i.enabled&&(f=new yU(l,{sendTimeout:n.batching.sendTimeout,itemLimit:n.batching.itemLimit,paused:o})),{add:c,addBeforeSendHooks:u,getBeforeSendHooks:()=>[...a],execute:w=>{var T;o||(!((T=n.batching)===null||T===void 0)&&T.enabled&&f?.addItem(w),p(w))},isPaused:()=>o,pause:()=>{t.debug("Pausing transports"),f?.pause(),o=!0},remove:(...w)=>{t.debug("Removing transports"),w.forEach(T=>{t.debug(`Removing "${T.name}" transport`);const b=s.indexOf(T);if(b===-1){t.warn(`Transport "${T.name}" is not added`);return}s.splice(b,1)})},removeBeforeSendHooks:(...w)=>{a.filter(T=>!w.includes(T))},get transports(){return[...s]},unpause:()=>{t.debug("Unpausing transports"),f?.start(),o=!1}}}function SU(e,t){if(t.preserveOriginalError)for(const n of e)n.type===Le.EXCEPTION&&delete n.payload.originalError;return e}function vU(e){return Math.min(1,Math.max(0,e))}function Ct(e,t){return typeof e===t}function Fi(e,t){return Object.prototype.toString.call(e)===`[object ${t}]`}function Qs(e,t){try{return e instanceof t}catch{return!1}}const EU=(e=>Ct(e,"undefined")),$i=(e=>Ct(e,"null")),Ui=(e=>Ct(e,"string")),rf=(e=>Ct(e,"number")&&!isNaN(e)||Ct(e,"bigint")),TU=(e=>rf(e)&&Number.isInteger(e)),tv=(e=>Ct(e,"boolean")),wU=(e=>Ct(e,"symbol")),xt=(e=>!$i(e)&&Ct(e,"object")),Pr=(e=>Ct(e,"function")),_i=(e=>Fi(e,"Array")),IU=(e=>Fi(e,"RegExp")),kU=(e=>Pr(e?.then)),nv=(e=>!xt(e)&&!Pr(e)),rv=typeof Event<"u",iv=(e=>rv&&Qs(e,Event)),sv=typeof Error<"u",Ic=(e=>sv&&Qs(e,Error)),ov=(e=>Fi(e,"ErrorEvent")),av=(e=>Fi(e,"DOMError")),cv=(e=>Fi(e,"DOMException")),uv=typeof Element<"u",RU=(e=>uv&&Qs(e,Element)),lv=typeof Map<"u",AU=(e=>lv&&Qs(e,Map)),CU=(e=>xt(e)&&"nativeEvent"in e&&"preventDefault"in e&&"stopPropagation"in e);function On(e){return e==null?!0:_i(e)||Ui(e)?e.length===0:xt(e)?Object.keys(e).length===0:!1}function kn(e,t){if(e===t)return!0;if(Ct(e,"number")&&isNaN(e))return Ct(t,"number")&&isNaN(t);const n=_i(e),r=_i(t);if(n!==r)return!1;if(n&&r){const o=e.length;if(o!==t.length)return!1;for(let a=o;a--!==0;)if(!kn(e[a],t[a]))return!1;return!0}const i=xt(e),s=xt(t);if(i!==s)return!1;if(e&&t&&i&&s){const o=Object.keys(e),a=Object.keys(t),c=o.length,u=a.length;if(c!==u)return!1;for(let d of o)if(!a.includes(d))return!1;for(let d of o)if(!kn(e[d],t[d]))return!1;return!0}return!1}function yi(){return Date.now()}function os(){return typeof performance<"u"&&typeof performance.now=="function"?performance.now():Date.now()}function Zs(){return new Date().toISOString()}function kc(e){return new Date(e).toISOString()}var Je;(function(e){e.TRACE="trace",e.DEBUG="debug",e.INFO="info",e.LOG="log",e.WARN="warn",e.ERROR="error"})(Je||(Je={}));const dv=Je.LOG,fv=[Je.TRACE,Je.DEBUG,Je.INFO,Je.LOG,Je.WARN,Je.ERROR];function Kt(){}function pv(e){const{size:t,concurrency:n}=e,r=[];let i=0;const s=()=>{if(i{i--,s(),c(d)},d=>{i--,s(),u(d)})}};return{add:a=>{if(r.length+i>=t)throw new Error("Task buffer full");return new Promise((c,u)=>{r.push({producer:a,resolve:c,reject:u}),s()})}}}const bm="abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ0123456789";function sr(e=10){return Array.from(Array(e)).map(()=>bm[Math.floor(Math.random()*bm.length)]).join("")}const kt=typeof globalThis<"u"?globalThis:typeof global<"u"?global:typeof self<"u"?self:void 0;function xU(e){const t=`__faroBundleId_${e}`,n=kt?.[t];if(typeof n=="string"&&n!=="")return n;const r=typeof window<"u"?window[t]:void 0;if(typeof r=="string"&&r!=="")return r}function OU(e){return kt?.[`__faroGitHash_${e}`]}function MU(){const e=new WeakSet;return function(t,n){if(xt(n)&&n!==null){if(e.has(n))return null;e.add(n)}return n}}function eo(e={}){return JSON.stringify(e??{},MU())}function Bi(e={}){const t={};for(const[n,r]of Object.entries(e))t[n]=xt(r)&&r!==null?eo(r):String(r);return t}class We{constructor(){this.subscribers=[]}subscribe(t){return this.subscribers.push(t),{unsubscribe:()=>this.unsubscribe(t)}}unsubscribe(t){this.subscribers=this.subscribers.filter(n=>n!==t)}notify(t){this.subscribers.forEach(n=>n(t))}first(){const t=new We,n=s=>{t.notify(s),r.unsubscribe()},r=this.subscribe(n),i=t.unsubscribe.bind(t);return this.withUnsubscribeOverride(t,i,n)}takeWhile(t){const n=new We,r=s=>{t(s)?n.notify(s):n.unsubscribe(r)};this.subscribe(r);const i=n.unsubscribe.bind(n);return this.withUnsubscribeOverride(n,i,r)}filter(t){const n=new We,r=s=>{t(s)&&n.notify(s)};this.subscribe(r);const i=n.unsubscribe.bind(n);return this.withUnsubscribeOverride(n,i,r)}merge(...t){const n=new We,r=[];t.forEach(s=>{const o=s.subscribe(a=>{n.notify(a)});r.push(o)});const i=n.unsubscribeAll.bind(n);return n.unsubscribe=()=>{r.forEach(s=>s.unsubscribe()),i()},n}withUnsubscribeOverride(t,n,r){return t.unsubscribe=i=>{n(i),this.unsubscribe(r)},t}unsubscribeAll(){this.subscribers=[]}}var fn;(function(e){e[e.OFF=0]="OFF",e[e.ERROR=1]="ERROR",e[e.WARN=2]="WARN",e[e.INFO=3]="INFO",e[e.VERBOSE=4]="VERBOSE"})(fn||(fn={}));const NU="Faro",sf={debug:Kt,error:Kt,info:Kt,prefix:NU,warn:Kt},of=fn.ERROR,to=Object.assign({},console);let hu=to;function PU(e){var t;return hu=(t=e.unpatchedConsole)!==null&&t!==void 0?t:hu,hu}function af(e=to,t=of){const n=sf;return t>fn.OFF&&(n.error=t>=fn.ERROR?function(...r){e.error(`${n.prefix} `,...r)}:Kt,n.warn=t>=fn.WARN?function(...r){e.warn(`${n.prefix} `,...r)}:Kt,n.info=t>=fn.INFO?function(...r){e.info(`${n.prefix} `,...r)}:Kt,n.debug=t>=fn.VERBOSE?function(...r){e.debug(`${n.prefix} `,...r)}:Kt),n}let Sm=sf;function LU(e,t){return Sm=af(e,t.internalLoggerLevel),Sm}class cf{constructor(){this.unpatchedConsole=to,this.internalLogger=sf,this.config={},this.metas={}}logDebug(...t){this.internalLogger.debug(`${this.name} `,...t)}logInfo(...t){this.internalLogger.info(`${this.name} `,...t)}logWarn(...t){this.internalLogger.warn(`${this.name} `,...t)}logError(...t){this.internalLogger.error(`${this.name} `,...t)}}class uf extends cf{isBatched(){return!1}getIgnoreUrls(){return[]}}function DU(e){e.transports.add(...e.config.transports),e.transports.addBeforeSendHooks(e.config.beforeSend)}function FU(e,t){var n,r;if(t===void 0)return e;if(e===void 0)return{resourceSpans:t};const i=(n=e.resourceSpans)===null||n===void 0?void 0:n[0];if(i===void 0)return e;const s=i?.scopeSpans||[],o=((r=t?.[0])===null||r===void 0?void 0:r.scopeSpans)||[];return Object.assign(Object.assign({},e),{resourceSpans:[Object.assign(Object.assign({},i),{scopeSpans:[...s,...o]})]})}function lf(e){let t={meta:{}};return e[0]!==void 0&&(t.meta=e[0].meta),e.forEach(n=>{switch(n.type){case Le.LOG:case Le.EVENT:case Le.EXCEPTION:case Le.MEASUREMENT:{const r=ev[n.type],i=t[r];t=Object.assign(Object.assign({},t),{[r]:i===void 0?[n.payload]:[...i,n.payload]});break}case Le.TRACE:{t=Object.assign(Object.assign({},t),{traces:FU(t.traces,n.payload.resourceSpans)});break}}}),t}const $U="faroApiCall",UU="user_action_start",hv={Normal:"normal"},BU="faro.user.action";var we;(function(e){e[e.Started=0]="Started",e[e.Halted=1]="Halted",e[e.Cancelled=2]="Cancelled",e[e.Ended=3]="Ended"})(we||(we={}));class HU{constructor(){this.buffer=[]}addItem(t){this.buffer.push(t)}flushBuffer(t){if(Pr(t))for(const n of this.buffer)t(n);this.buffer.length=0}size(){return this.buffer.length}}class jU extends We{constructor({name:t,parentId:n,trigger:r,transports:i,attributes:s,trackUserActionsExcludeItem:o,importance:a=hv.Normal,pushEvent:c}){super(),this.name=t,this.attributes=s,this.id=sr(),this.trigger=r,this.parentId=n??this.id,this.trackUserActionsExcludeItem=o,this.importance=a,this._pushEvent=c,this._itemBuffer=new HU,this._transports=i,this._state=we.Started,this._start()}addItem(t){return this._state===we.Started?(this._itemBuffer.addItem(t),!0):!1}_start(){this._state=we.Started,this._state===we.Started&&(this.startTime=yi(),this._startTimeMono=os())}halt(){this._state===we.Started&&(this._state=we.Halted,this.notify(this._state))}cancel(){this._state===we.Started&&this._itemBuffer.flushBuffer(t=>{this._transports.execute(t)}),this._state=we.Cancelled,this.notify(this._state)}end(){if(this._state===we.Cancelled)return;const t=yi(),n=os()-this._startTimeMono;this._state=we.Ended,this._itemBuffer.flushBuffer(r=>{if(WU(r,this.trackUserActionsExcludeItem)){this._transports.execute(r);return}const i=Object.assign(Object.assign({},r),{payload:Object.assign(Object.assign({},r.payload),{action:{parentId:this.id,name:this.name}})});this._transports.execute(i)}),this._state=we.Ended,this.notify(this._state),this._pushEvent(BU,Object.assign({userActionName:this.name,userActionStartTime:this.startTime.toString(),userActionEndTime:t.toString(),userActionDuration:n.toString(),userActionTrigger:this.trigger,userActionImportance:this.importance},Bi(this.attributes)),void 0,{timestampOverwriteMs:this.startTime,customPayloadTransformer:r=>(r.action={id:this.id,name:this.name},r)})}getState(){return this._state}}function WU(e,t){return t?.(e)||e.type===Le.MEASUREMENT&&e.payload.type==="web-vitals"}const mv=new We;function zU({transports:e,internalLogger:t,config:n,pushEvent:r}){var i;const s=(i=n.userActionsInstrumentation)===null||i===void 0?void 0:i.excludeItem;let o;const a=(d,l,p)=>{if(c()===void 0){const h=new jU({name:d,transports:e,attributes:l,trigger:p?.triggerName||$U,importance:p?.importance||hv.Normal,trackUserActionsExcludeItem:s,pushEvent:r});return h.filter(m=>[we.Ended,we.Cancelled].includes(m)).first().subscribe(()=>{o=void 0}),mv.notify({type:UU,userAction:h}),o=h,o}else{t.error("Attempted to create a new user action while one is already running. This is not possible.");return}},c=()=>o;return{startUserAction:a,getActiveUserAction:c}}function Rc(e,t){return!e||e?.getState()!==we.Started?!1:(e.addItem(t),!0)}function qU({internalLogger:e,config:t,metas:n,transports:r,tracesApi:i,userActionsApi:s}){let o=null;return{pushEvent:(c,u,d,{skipDedupe:l,spanContext:p,timestampOverwriteMs:f,customPayloadTransformer:h=m=>m}={})=>{try{const m=Bi(u),g={meta:n.value,payload:h({name:c,domain:d??t.eventDomain,attributes:On(m)?void 0:m,timestamp:f?kc(f):Zs(),trace:p?{trace_id:p.traceId,span_id:p.spanId}:i.getTraceContext()}),type:Le.EVENT},_={name:g.payload.name,attributes:g.payload.attributes,domain:g.payload.domain};if(!l&&t.dedupe&&!$i(o)&&kn(_,o)){e.debug(`Skipping event push because it is the same as the last one `,g.payload);return}o=_,e.debug(`Pushing event `,g),Rc(s.getActiveUserAction(),g)||r.execute(g)}catch(m){e.error("Error pushing event",m)}}}}const df="Error",vm=e=>e.map(t=>xt(t)?eo(t):String(t)).join(" ");function GU(e,t){return e.some(n=>Ui(n)?t.includes(n):!!t.match(n))}let Ln;function VU({internalLogger:e,config:t,metas:n,transports:r,tracesApi:i,userActionsApi:s}){var o;e.debug("Initializing exceptions API");let a=null;Ln=(o=t.parseStacktrace)!==null&&o!==void 0?o:Ln;const c=f=>{e.debug("Changing stacktrace parser"),Ln=f??Ln},u=()=>Ln,{ignoreErrors:d=[],preserveOriginalError:l}=t,p=(f,{skipDedupe:h,stackFrames:m,type:g,context:_,spanContext:S,timestampOverwriteMs:E,originalError:v,fingerprint:w,fatal:T}={})=>{var b;if(!KU(d,v??f))try{const I=Bi(Object.assign(Object.assign({},YU(v??f)),_??{})),M={meta:n.value,payload:Object.assign(Object.assign(Object.assign(Object.assign({type:g||f.name||df,value:f.message,timestamp:E?kc(E):Zs(),trace:S?{trace_id:S.traceId,span_id:S.spanId}:i.getTraceContext()},On(I)?{}:{context:I}),l?{originalError:v}:{}),w?{fingerprint:w}:{}),T!==void 0?{fatal:T}:{}),type:Le.EXCEPTION};m=m??(f.stack?Ln?.(f).frames:void 0),m?.length&&(M.payload.stacktrace={frames:m});const k={type:M.payload.type,value:M.payload.value,stacktrace:M.payload.stacktrace,context:M.payload.context,fingerprint:M.payload.fingerprint,fatal:(b=M.payload.fatal)!==null&&b!==void 0?b:!1};if(!h&&t.dedupe&&!$i(a)&&kn(k,a)){e.debug(`Skipping error push because it is the same as the last one `,M.payload);return}a=k,e.debug(`Pushing exception `,M),Rc(s.getActiveUserAction(),M)||r.execute(M)}catch(I){e.error("Error pushing event",I)}};return c(t.parseStacktrace),{changeStacktraceParser:c,getStacktraceParser:u,pushError:p}}function YU(e){let t=e.cause;return Ic(t)?t=e.cause.toString():t!==null&&(xt(e.cause)||_i(e.cause))?t=eo(e.cause):t!=null&&(t=e.cause.toString()),t==null?{}:{cause:t}}function KU(e,t){const{message:n,name:r,stack:i}=t;return GU(e,n+" "+r+" "+i)}const Da=e=>e.map(t=>{try{return String(t)}catch{return""}}).join(" ");function JU({internalLogger:e,config:t,metas:n,transports:r,tracesApi:i,userActionsApi:s}){var o;e.debug("Initializing logs API");let a=null;const c=(o=t.logArgsSerializer)!==null&&o!==void 0?o:Da;return{pushLog:(d,{context:l,level:p,skipDedupe:f,spanContext:h,timestampOverwriteMs:m}={})=>{try{const g=Bi(l),_={type:Le.LOG,payload:{message:c(d),level:p??dv,context:On(g)?void 0:g,timestamp:m?kc(m):Zs(),trace:h?{trace_id:h.traceId,span_id:h.spanId}:i.getTraceContext()},meta:n.value},S={message:_.payload.message,level:_.payload.level,context:_.payload.context};if(!f&&t.dedupe&&!$i(a)&&kn(S,a)){e.debug(`Skipping log push because it is the same as the last one `,_.payload);return}a=S,e.debug(`Pushing log `,_),Rc(s.getActiveUserAction(),_)||r.execute(_)}catch(g){e.error(`Error pushing log `,g)}}}}function XU({internalLogger:e,config:t,metas:n,transports:r,tracesApi:i,userActionsApi:s}){e.debug("Initializing measurements API");let o=null;return{pushMeasurement:(c,{skipDedupe:u,context:d,spanContext:l,timestampOverwriteMs:p}={})=>{try{const f=Bi(d),h={type:Le.MEASUREMENT,payload:Object.assign(Object.assign({},c),{trace:l?{trace_id:l.traceId,span_id:l.spanId}:i.getTraceContext(),timestamp:p?kc(p):Zs(),context:On(f)?void 0:f}),meta:n.value},m={type:h.payload.type,values:h.payload.values,context:h.payload.context};if(!u&&t.dedupe&&!$i(o)&&kn(m,o)){e.debug(`Skipping measurement push because it is the same as the last one `,h.payload);return}o=m,e.debug(`Pushing measurement `,h),Rc(s.getActiveUserAction(),h)||r.execute(h)}catch(f){e.error(`Error pushing measurement `,f)}}}}function QU({internalLogger:e,metas:t}){e.debug("Initializing meta API");let n,r,i,s;const o=f=>{r&&t.remove(r),r={user:f},t.add(r)},a=(f,h)=>{var m;const g=h?.overrides,_=g?{overrides:Object.assign(Object.assign({},(m=n?.session)===null||m===void 0?void 0:m.overrides),g)}:{};n&&t.remove(n),n={session:Object.assign(Object.assign({},On(f)?void 0:f),_)},t.add(n)},c=()=>t.value.session,u=(f,h)=>{var m;if(h?.overrides&&a(c(),{overrides:h.overrides}),((m=i?.view)===null||m===void 0?void 0:m.name)===f?.name)return;const g=i;i={view:f},t.add(i),g&&t.remove(g)},d=()=>t.value.view,l=f=>{var h;const m=Ui(f)?Object.assign(Object.assign({},(h=s?.page)!==null&&h!==void 0?h:p()),{id:f}):f;s&&t.remove(s),s={page:m},t.add(s)},p=()=>t.value.page;return{setUser:o,resetUser:o,setSession:a,resetSession:a,getSession:c,setView:u,getView:d,setPage:l,getPage:p}}function ZU(e,t,n,r,i){t.debug("Initializing traces API");let s;return{getOTEL:()=>s,getTraceContext:()=>{const l=s?.trace.getSpanContext(s.context.active());return l?{trace_id:l.traceId,span_id:l.spanId}:void 0},initOTEL:(l,p)=>{t.debug("Initializing OpenTelemetry"),s={trace:l,context:p}},isOTELInitialized:()=>!!s,pushTraces:l=>{try{const p={type:Le.TRACE,payload:l,meta:r.value};t.debug(`Pushing trace `,p),i.execute(p)}catch(p){t.error(`Error pushing trace `,p)}}}}function eB(e,t,n,r,i){t.debug("Initializing API");let s=null;const a=zU({transports:i,config:n,internalLogger:t,pushEvent:(l,p,f,h)=>{s?s(l,p,f,h):t.warn("pushEventImpl is not initialized. Event dropped:",{name:l,attributes:p,domain:f,options:h})}}),c=ZU(e,t,n,r,i),u={internalLogger:t,userActionsApi:a,config:n,metas:r,transports:i,tracesApi:c},d=qU(u);return s=d.pushEvent,Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},c),VU(u)),QU(u)),JU(u)),XU(u)),d),a)}function tB(){return{pushLog:()=>{},pushError:()=>{},changeStacktraceParser:()=>{},getStacktraceParser:()=>{},pushMeasurement:()=>{},pushTraces:()=>{},getOTEL:()=>{},getTraceContext:()=>{},initOTEL:()=>{},isOTELInitialized:()=>!1,setUser:()=>{},resetUser:()=>{},setSession:()=>{},resetSession:()=>{},getSession:()=>{},setView:()=>{},getView:()=>{},setPage:()=>{},getPage:()=>{},pushEvent:()=>{},startUserAction:()=>{},getActiveUserAction:()=>{}}}class an extends cf{constructor(){super(...arguments),this.api={},this.transports={}}}function nB(e,t,n,r,i,s){t.debug("Initializing instrumentations");const o=[];return{add:(...u)=>{t.debug("Adding instrumentations"),u.forEach(d=>{if(t.debug(`Adding "${d.name}" instrumentation`),o.some(p=>p.name===d.name)){t.warn(`Instrumentation ${d.name} is already added`);return}d.unpatchedConsole=e,d.internalLogger=t,d.config=n,d.metas=r,d.transports=i,d.api=s,o.push(d),d.initialize()})},get instrumentations(){return[...o]},remove:(...u)=>{t.debug("Removing instrumentations"),u.forEach(d=>{var l,p;t.debug(`Removing "${d.name}" instrumentation`);const f=o.reduce((h,m,g)=>h===null&&m.name===d.name?g:null,null);if(f===null){t.warn(`Instrumentation "${d.name}" is not added`);return}(p=(l=o[f]).destroy)===null||p===void 0||p.call(l),o.splice(f,1)})}}}function rB(e){e.instrumentations.add(...e.config.instrumentations)}function iB(e,t,n){let r=[],i=[];const s=()=>r.reduce((l,p)=>Object.assign(l,Pr(p)?p():p),{}),o=()=>{if(i.length){const l=s();i.forEach(p=>p(l))}};return{add:(...l)=>{t.debug(`Adding metas `,l),r.push(...l),o()},remove:(...l)=>{t.debug(`Removing metas `,l),r=r.filter(p=>!l.includes(p)),o()},addListener:l=>{t.debug(`Adding metas listener `,l),i.push(l)},removeListener:l=>{t.debug(`Removing metas listener `,l),i=i.filter(p=>p!==l)},get value(){return s()}}}const ct="2.7.0";function sB(e){var t,n;const r=e.config.app.name,i=r?OU(r):void 0,s={sdk:{version:ct,name:"faro"},app:Object.assign({bundleId:r&&xU(r)},i!==void 0?{gitHash:i}:{})},o=(t=e.config.sessionTracking)===null||t===void 0?void 0:t.session;o&&e.api.setSession(o),e.config.app&&(s.app=Object.assign(Object.assign({},e.config.app),s.app)),e.config.user&&(s.user=e.config.user),e.config.view&&(s.view=e.config.view),e.metas.add(s,...(n=e.config.metas)!==null&&n!==void 0?n:[])}const Ac="_faroInternal";function oB(e){if(e.config.preventGlobalExposure)e.internalLogger.debug("Skipping registering public Faro instance in the global scope");else{if(e.internalLogger.debug(`Registering public faro reference in the global scope using "${e.config.globalObjectKey}" key`),e.config.globalObjectKey in kt){e.internalLogger.warn(`Skipping global registration due to key "${e.config.globalObjectKey}" being used already. Please set "globalObjectKey" to something else or set "preventGlobalExposure" to "true"`);return}Object.defineProperty(kt,e.config.globalObjectKey,{configurable:!1,writable:!1,value:e})}}function aB(){return kt[Ac]}function gv(e){e.config.isolate?e.internalLogger.debug("Skipping registering internal Faro instance on global object"):(e.internalLogger.debug("Registering internal Faro instance on global object"),Object.defineProperty(kt,Ac,{configurable:!1,enumerable:!1,writable:!1,value:e}))}function _v(){return Ac in kt}let Re={api:tB()};function cB(e,t,n,r,i,s,o){return t.debug("Initializing Faro"),Re={api:s,config:n,instrumentations:o,internalLogger:t,metas:r,pause:i.pause,transports:i,unpatchedConsole:e,unpause:i.unpause},gv(Re),oB(Re),Re}function uB(e){const t=PU(e),n=LU(t,e);if(_v()&&!e.isolate){n.error('Faro is already registered. Either add instrumentations, transports etc. to the global faro instance or use the "isolate" property');return}n.debug("Initializing");const r=iB(t,n),i=bU(t,n,e,r),s=eB(t,n,e,r,i),o=nB(t,n,e,r,i,s),a=cB(t,n,e,r,i,s,o);return sB(a),DU(a),rB(a),a}const yv="faro",lB={enabled:!0,sendTimeout:250,itemLimit:50},dB="click",fB="navigation",bv="view_changed",Ji="session_start",Xo="session_resume",Sv="session_extend",pB="service_name_override",hB="route_change",rt="unknown";var Xi={exports:{}},mB=Xi.exports,Em;function gB(){return Em||(Em=1,(function(e,t){(function(n,r){var i="1.0.41",s="",o="?",a="function",c="undefined",u="object",d="string",l="major",p="model",f="name",h="type",m="vendor",g="version",_="architecture",S="console",E="mobile",v="tablet",w="smarttv",T="wearable",b="embedded",I=500,M="Amazon",k="Apple",D="ASUS",x="BlackBerry",L="Browser",F="Chrome",Z="Edge",Y="Firefox",ne="Google",R="Honor",j="Huawei",P="Lenovo",U="LG",re="Microsoft",ee="Motorola",Se="Nvidia",Fe="OnePlus",He="Opera",Xe="OPPO",Qe="Samsung",Ht="Sharp",Ze="Sony",Mn="Xiaomi",ut="Zebra",et="Facebook",qe="Chromium OS",Ke="Mac OS",cn=" Browser",Nn=function(ue,pe){var te={};for(var ve in ue)pe[ve]&&pe[ve].length%2===0?te[ve]=pe[ve].concat(ue[ve]):te[ve]=ue[ve];return te},_t=function(ue){for(var pe={},te=0;te0?he.length===2?typeof he[1]==a?this[he[0]]=he[1].call(this,Gt):this[he[0]]=he[1]:he.length===3?typeof he[1]===a&&!(he[1].exec&&he[1].test)?this[he[0]]=Gt?he[1].call(this,Gt,he[2]):r:this[he[0]]=Gt?Gt.replace(he[1],he[2]):r:he.length===4&&(this[he[0]]=Gt?he[3].call(this,Gt.replace(he[1],he[2])):r):this[he]=Gt||r;te+=2}},W=function(ue,pe){for(var te in pe)if(typeof pe[te]===u&&pe[te].length>0){for(var ve=0;ve2&&(X[p]="iPad",X[h]=v),X},this.getEngine=function(){var X={};return X[f]=r,X[g]=r,ae.call(X,ve,qt.engine),X},this.getOS=function(){var X={};return X[f]=r,X[g]=r,ae.call(X,ve,qt.os),he&&!X[f]&&un&&un.platform&&un.platform!="Unknown"&&(X[f]=un.platform.replace(/chrome os/i,qe).replace(/macos/i,Ke)),X},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return ve},this.setUA=function(X){return ve=typeof X===d&&X.length>I?V(X,I):X,this},this.setUA(ve),this};lt.VERSION=i,lt.BROWSER=_t([f,g,l]),lt.CPU=_t([_]),lt.DEVICE=_t([p,m,h,S,E,w,v,T,b]),lt.ENGINE=lt.OS=_t([f,g]),e.exports&&(t=e.exports=lt),t.UAParser=lt;var Lr=typeof n!==c&&(n.jQuery||n.Zepto);if(Lr&&!Lr.ua){var ro=new lt;Lr.ua=ro.getResult(),Lr.ua.get=function(){return ro.getUA()},Lr.ua.set=function(ue){ro.setUA(ue);var pe=ro.getResult();for(var te in pe)Lr.ua[te]=pe[te]}}})(typeof window=="object"?window:mB)})(Xi,Xi.exports)),Xi.exports}var _B=gB();let Tm,mu;function vv(){const e=typeof navigator<"u"?navigator.userAgent:"";return(Tm!==e||!mu)&&(mu=new _B.UAParser(e).getResult(),Tm=e),mu}const Ev=()=>{const{browser:e,os:t,ua:n}=vv(),{name:r,version:i}=e,{name:s,version:o}=t,a=navigator.language,c=n.includes("Mobi"),u=d();return{browser:{name:r??rt,version:i??rt,os:`${s??rt} ${o??rt}`,userAgent:n??rt,language:a??rt,mobile:c,brands:u??rt,viewportWidth:`${window.innerWidth}`,viewportHeight:`${window.innerHeight}`}};function d(){if(!(!r||!i)&&"userAgentData"in navigator&&navigator.userAgentData)return navigator.userAgentData.brands}},Tv=()=>{const{name:e,version:t}=vv().os;if(!e&&!t)return{};const n={};return e&&(n.name=e),t&&(n.version=t),{os:n}};function wv(e){var t,n,r,i;return{id:(i=(r=(n=(t=Re.config)===null||t===void 0?void 0:t.sessionTracking)===null||n===void 0?void 0:n.generateSessionId)===null||r===void 0?void 0:r.call(n))!==null&&i!==void 0?i:sr(),attributes:e}}const Iv=()=>({sdk:{name:"faro-web",version:ct}}),Rn={session:"sessionStorage",local:"localStorage"};function kv(e){var t;try{let n;n=window[e];const r="__faro_storage_test__";return n.setItem(r,r),n.removeItem(r),!0}catch(n){return(t=Re.internalLogger)===null||t===void 0||t.info(`Web storage of type ${e} is not available. Reason: ${n}`),!1}}function Cc(e,t){return pf(t)?window[t].getItem(e):null}function ff(e,t,n){if(pf(n))try{window[n].setItem(e,t)}catch{}}function Rv(e,t){pf(t)&&window[t].removeItem(e)}const Av=kv(Rn.local),Cv=kv(Rn.session);function pf(e){return e===Rn.local?Av:e===Rn.session?Cv:!1}function xv(e,t){let n=!1,r;const i=()=>{if(r==null){n=!1;return}e(...r),r=null,setTimeout(i,t)};return(...s)=>{if(n){r=s;return}e(...s),n=!0,setTimeout(i,t)}}function Ov(){return Re.transports.transports.flatMap(e=>e.getIgnoreUrls())}function xc(e=""){return Ov().some(t=>e&&e.match(t)!=null)}function Mv(e){if(Ui(e))return e;if(e instanceof URL)return e.href;if(!On(e)&&Pr(e?.toString))return e.toString()}const Sr="com.grafana.faro.session",Nv=14400*1e3,hf=900*1e3,Pv=1*1e3,Lv=hf,yB={enabled:!0,persistent:!1,maxSessionPersistenceTime:Lv};function mf(){var e,t,n;const i=Re.config.sessionTracking,s=(n=(t=(e=i?.sampler)===null||e===void 0?void 0:e.call(i,{metas:Re.metas.value}))!==null&&t!==void 0?t:i?.samplingRate)!==null&&n!==void 0?n:1,o=typeof s=="number"?vU(s):0;return Math.random()this.updateUserSession(),Pv),this.updateUserSession=gf({fetchUserSession:St.fetchUserSession,storeUserSession:St.storeUserSession}),this.init()}static removeUserSession(){Rv(Sr,St.storageTypeLocal)}static storeUserSession(t){ff(Sr,eo(t),St.storageTypeLocal)}static fetchUserSession(){const t=Cc(Sr,St.storageTypeLocal);return t?JSON.parse(t):null}init(){document.addEventListener("visibilitychange",()=>{document.visibilityState==="visible"&&this.updateSession()}),Re.metas.addListener($v({fetchUserSession:St.fetchUserSession,storeUserSession:St.storeUserSession}))}}St.storageTypeLocal=Rn.local;class Nt{constructor(){this.updateSession=xv(()=>this.updateUserSession(),Pv),this.updateUserSession=gf({fetchUserSession:Nt.fetchUserSession,storeUserSession:Nt.storeUserSession}),this.init()}static removeUserSession(){Rv(Sr,Nt.storageTypeSession)}static storeUserSession(t){ff(Sr,eo(t),Nt.storageTypeSession)}static fetchUserSession(){const t=Cc(Sr,Nt.storageTypeSession);return t?JSON.parse(t):null}init(){document.addEventListener("visibilitychange",()=>{document.visibilityState==="visible"&&this.updateSession()}),Re.metas.addListener($v({fetchUserSession:Nt.fetchUserSession,storeUserSession:Nt.storeUserSession}))}}Nt.storageTypeSession=Rn.session;function Uv(e){return e?.persistent?St:Nt}class Bv extends an{constructor(){super(...arguments),this.name="@grafana/faro-web-sdk:instrumentation-session",this.version=ct}sendSessionStartEvent(t){var n,r;const i=t.session;if(i&&i.id!==((n=this.notifiedSession)===null||n===void 0?void 0:n.id)){if(this.notifiedSession&&this.notifiedSession.id===((r=i.attributes)===null||r===void 0?void 0:r.previousSession)){this.api.pushEvent(Sv,{},void 0,{skipDedupe:!0}),this.notifiedSession=i;return}this.notifiedSession=i,this.api.pushEvent(Ji,{},void 0,{skipDedupe:!0})}}createInitialSession(t,n){var r,i,s,o,a,c;let u=t.fetchUserSession();if(n.persistent&&n.maxSessionPersistenceTime&&u){const p=yi();u.lastActivity{var s,o,a;r();const c=(s=i.meta.session)===null||s===void 0?void 0:s.attributes;if(c&&c?.isSampled==="true"){let u=JSON.parse(JSON.stringify(i));const d=(o=u.meta.session)===null||o===void 0?void 0:o.attributes;return d==null||delete d.isSampled,Object.keys(d??{}).length===0&&((a=u.meta.session)===null||a===void 0||delete a.attributes),u}return null})}initialize(){this.logDebug("init session instrumentation");const t=this.config.sessionTracking;if(t?.enabled){const n=Uv(t);this.registerBeforeSendHook(n);const{initialSession:r,lifecycleType:i}=this.createInitialSession(n,t);n.storeUserSession(r);const s=r.sessionMeta;this.notifiedSession=s,this.api.setSession(s),i===Ji&&this.api.pushEvent(Ji,{},void 0,{skipDedupe:!0}),i===Xo&&this.api.pushEvent(Xo,{},void 0,{skipDedupe:!0})}this.metas.addListener(this.sendSessionStartEvent.bind(this))}}const vB="resource-entry",_f="http-request-start",yf="http-request-end",EB="dom-mutation",TB="console";let To,wm=!1;function wB(e){if(To||(To=new We),!wm){const t=e??to;fv.forEach(n=>{console[n]=(...r)=>{var i;To.notify({type:TB,level:n,args:r}),(i=t[n])===null||i===void 0||i.apply(console,r)}}),wm=!0}return To}const IB="Non-Error promise rejection captured with value:",kB="UnhandledRejection",RB="DOMError",AB="DOMException",CB="Non-Error exception captured with keys:",xB="?",OB=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;function MB(e){var t,n;const r=e.match(OB),i=(t=r?.[1])!==null&&t!==void 0?t:df;return[(n=r?.[2])!==null&&n!==void 0?n:e,i]}const Im=` `,NB="eval",PB="?",km="@",LB=/^\s*at (?:(?![a-z]+:\/\/)([^(]+?) ?\((?:address at )?)?((?:file|https?|blob|chrome-extension|address|native|eval|webpack||[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,DB=/\((\S*)(?::(\d+))(?::(\d+))\)/,FB="eval",Hv="address at ",$B=Hv.length,UB=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:file|https?|blob|chrome|webpack|resource|moz-extension|safari-extension|safari-web-extension|capacitor)?:\/.*?|\[native code]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,BB=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,HB=" > eval",Rm="safari-extension",Am="safari-web-extension",jB=/Minified React error #\d+;/i;function bf(e,t,n,r){const i={filename:e||document.location.href,function:t||PB};return n!==void 0&&(i.lineno=n),r!==void 0&&(i.colno=r),i}function vl(e,t){const n=e?.includes(Rm),r=!n&&e?.includes(Am);return!n&&!r?[e,t]:[e?.includes(km)?e.split(km)[0]:e,n?`${Rm}:${t}`:`${Am}:${t}`]}function $a(e){let t=[];e.stacktrace?t=e.stacktrace.split(Im).filter((r,i)=>i%2===0):e.stack&&(t=e.stack.split(Im));const n=t.reduce((r,i,s)=>{let o,a,c,u,d;if(o=LB.exec(i)){if(a=o[1],c=o[2],u=o[3],d=o[4],c?.startsWith(FB)){const l=DB.exec(c);l&&(c=l[1],u=l[2],d=l[3])}c=c?.startsWith(Hv)?c.substring($B):c,[a,c]=vl(a,c)}else if(o=UB.exec(i)){if(a=o[1],c=o[3],u=o[4],d=o[5],c&&c.includes(HB)){const l=BB.exec(c);l&&(a=a||NB,c=l[1],u=l[2])}else s===0&&!d&&rf(e.columnNumber)&&(d=String(e.columnNumber+1));[a,c]=vl(a,c)}return(c||a)&&r.push(bf(c,a,u?Number(u):void 0,d?Number(d):void 0)),r},[]);return jB.test(e.message)?n.slice(1):n}function jv(e){return{frames:$a(e)}}function Wv(e){let t,n,r=[],i,s;if(ov(e)&&e.error)t=e.error.message,n=e.error.name,r=$a(e.error);else if((i=av(e))||cv(e)){const{name:o,message:a}=e;n=o??(i?RB:AB),t=a?`${n}: ${a}`:n}else Ic(e)?(n=e.name,t=e.message,r=$a(e)):(xt(e)||(s=iv(e)))&&(n=s?e.constructor.name:void 0,t=`${CB} ${Object.keys(e)}`);return[t,n,r]}function zv(e){const[t,n,r,i,s]=e;let o,a,c=[];const u=Ui(t),d=bf(n,xB,r,i);return s||!u?([o,a,c]=Wv(s??t),c.length===0&&(c=[d])):u&&([o,a]=MB(t),c=[d]),{value:o,type:a,stackFrames:c}}function Cm(e,t){return Ic(e[0])?zv(e):{value:t(e)}}class mn extends an{constructor(){super(...arguments),this.name="@grafana/faro-web-sdk:instrumentation-console",this.version=ct,this.errorSerializer=Da}initialize(){var t,n;const r=this.config.consoleInstrumentation,i=r?.serializeErrors||!!r?.errorSerializer;this.errorSerializer=i?(t=r?.errorSerializer)!==null&&t!==void 0?t:vm:Da;const s=(n=r?.disabledLevels)!==null&&n!==void 0?n:mn.defaultDisabledLevels,o=wB(this.unpatchedConsole);this.subscription=o.subscribe(({level:a,args:c})=>{if(!s.includes(a))try{if(a===Je.ERROR&&!r?.consoleErrorAsLog){const{value:u,type:d,stackFrames:l}=Cm(c,this.errorSerializer);if(u&&!d&&!l){this.api.pushError(new Error(mn.consoleErrorPrefix+u));return}this.api.pushError(new Error(mn.consoleErrorPrefix+u),{type:d,stackFrames:l})}else if(a===Je.ERROR&&r?.consoleErrorAsLog){const{value:u,type:d,stackFrames:l}=Cm(c,this.errorSerializer);this.api.pushLog(u?[mn.consoleErrorPrefix+u]:c,{level:a,context:{value:u??"",type:d??"",stackFrames:l?.length?vm(l):""}})}else this.api.pushLog(c,{level:a})}catch(u){this.logError(u)}})}destroy(){var t;(t=this.subscription)===null||t===void 0||t.unsubscribe(),this.subscription=void 0}}mn.defaultDisabledLevels=[Je.DEBUG,Je.TRACE,Je.LOG];mn.consoleErrorPrefix="console.error: ";function WB(e){const t=window.onerror;window.onerror=(...n)=>{try{const{value:r,type:i,stackFrames:s}=zv(n),o=n[4];if(r){const a={type:i,stackFrames:s};o!=null&&(a.originalError=o),e.pushError(new Error(r),a)}}finally{t?.apply(window,n)}}}function zB(e){const t=n=>{var r,i;let s=n;s.reason?s=n.reason:!((r=n.detail)===null||r===void 0)&&r.reason&&(s=(i=n.detail)===null||i===void 0?void 0:i.reason);let o,a,c=[];nv(s)?(o=`${IB} ${String(s)}`,a=kB):[o,a,c]=Wv(s),o&&e.pushError(new Error(o),{type:a,stackFrames:c})};window.addEventListener("unhandledrejection",t)}class qv extends an{constructor(){super(...arguments),this.name="@grafana/faro-web-sdk:instrumentation-errors",this.version=ct}initialize(){this.logDebug("Initializing"),WB(this.api),zB(this.api)}}class Gv extends an{constructor(){super(...arguments),this.name="@grafana/faro-web-sdk:instrumentation-view",this.version=ct}sendViewChangedEvent(t){var n,r,i,s;const o=t.view;o&&o.name!==((n=this.notifiedView)===null||n===void 0?void 0:n.name)&&(this.api.pushEvent(bv,{fromView:(i=(r=this.notifiedView)===null||r===void 0?void 0:r.name)!==null&&i!==void 0?i:rt,toView:(s=o.name)!==null&&s!==void 0?s:rt},void 0,{skipDedupe:!0}),this.notifiedView=o)}initialize(){this.metas.addListener(this.sendViewChangedEvent.bind(this))}}class xm{t;o=0;i=[];u(t){if(t.hadRecentInput)return;const n=this.i[0],r=this.i.at(-1);this.o&&n&&r&&t.startTime-r.startTime<1e3&&t.startTime-n.startTime<5e3?(this.o+=t.value,this.i.push(t)):(this.o=t.value,this.i=[t]),this.t?.(t)}}const Hi=()=>{const e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart{if(document.readyState==="loading")return"loading";const t=Hi();if(t){if(e{const t=e.nodeName;return e.nodeType===1?t.toLowerCase():t.toUpperCase().replace(/^#/,"")},Sf=e=>{let t="";try{for(;e?.nodeType!==9;){const n=e,r=n.id?"#"+n.id:[qB(n),...Array.from(n.classList).sort()].join(".");if(t.length+r.length>99)return t||r;if(t=t?r+">"+t:r,n.id)break;e=n.parentNode}}catch{}return t},gu=new WeakMap;function bi(e,t){return gu.get(e)||gu.set(e,new t),gu.get(e)}let Vv=-1;const Yv=()=>Vv,ji=e=>{addEventListener("pageshow",t=>{t.persisted&&(Vv=t.timeStamp,e(t))},!0)},nn=(e,t,n,r)=>{let i,s;return o=>{t.value>=0&&(o||r)&&(s=t.value-(i??0),(s||i===void 0)&&(i=t.value,t.delta=s,t.rating=((a,c)=>a>c[1]?"poor":a>c[0]?"needs-improvement":"good")(t.value,n),e(t)))}},vf=e=>{requestAnimationFrame(()=>requestAnimationFrame(e))},no=()=>Hi()?.activationStart??0,rn=(e,t=-1)=>{const n=Hi();let r="navigate";return Yv()>=0?r="back-forward-cache":n&&(document.prerendering||no()>0?r="prerender":document.wasDiscarded?r="restore":n.type&&(r=n.type.replace(/_/g,"-"))),{name:e,value:t,rating:"good",delta:0,entries:[],id:`v5-${Date.now()}-${Math.floor(8999999999999*Math.random())+1e12}`,navigationType:r}},Si=(e,t,n={})=>{try{if(PerformanceObserver.supportedEntryTypes.includes(e)){const r=new PerformanceObserver(i=>{queueMicrotask(()=>{t(i.getEntries())})});return r.observe({type:e,buffered:!0,...n}),r}}catch{}},Ef=e=>{let t=!1;return()=>{t||(e(),t=!0)}};let Xr=-1;const Kv=new Set,Om=()=>document.visibilityState!=="hidden"||document.prerendering?1/0:0,El=e=>{if(document.visibilityState==="hidden"){if(e.type==="visibilitychange")for(const t of Kv)t();isFinite(Xr)||(Xr=e.type==="visibilitychange"?e.timeStamp:0,removeEventListener("prerenderingchange",El,!0))}},Oc=()=>{if(Xr<0){const e=no();Xr=(document.prerendering?void 0:globalThis.performance.getEntriesByType("visibility-state").find(n=>n.name==="hidden"&&n.startTime>=e)?.startTime)??Om(),addEventListener("visibilitychange",El,!0),addEventListener("prerenderingchange",El,!0),ji(()=>{setTimeout(()=>{Xr=Om()})})}return{get firstHiddenTime(){return Xr},onHidden(e){Kv.add(e)}}},Mc=e=>{document.prerendering?addEventListener("prerenderingchange",e,!0):e()},Mm=[1800,3e3],Jv=(e,t={})=>{Mc(()=>{const n=Oc();let r,i=rn("FCP");const s=Si("paint",o=>{for(const a of o)a.name==="first-contentful-paint"&&(s.disconnect(),a.startTime{i=rn("FCP"),r=nn(e,i,Mm,t.reportAllChanges),vf(()=>{i.value=performance.now()-o.timeStamp,r(!0)})}))})},Nm=[.1,.25],Pm=e=>e.find(t=>t.node?.nodeType===1)||e[0],GB=(e,t={})=>{const n=bi(t=Object.assign({},t),xm),r=new WeakMap;n.t=i=>{if(i?.sources?.length){const s=Pm(i.sources),o=s?.node;if(o){const a=t.generateTarget?.(o)??Sf(o);r.set(s,a)}}},((i,s={})=>{const o=Oc();Jv(Ef(()=>{let a,c=rn("CLS",0);const u=bi(s,xm),d=p=>{for(const f of p)u.u(f);u.o>c.value&&(c.value=u.o,c.entries=u.i,a())},l=Si("layout-shift",d);l&&(a=nn(i,c,Nm,s.reportAllChanges),o.onHidden(()=>{d(l.takeRecords()),a(!0)}),ji(()=>{u.o=0,c=rn("CLS",0),a=nn(i,c,Nm,s.reportAllChanges),vf(a)}),setTimeout(a))}))})(i=>{e((s=>{let o={};if(s.entries.length){const a=s.entries.reduce((c,u)=>c.value>u.value?c:u);if(a?.sources?.length){const c=Pm(a.sources);c&&(o={largestShiftTarget:r.get(c),largestShiftTime:a.startTime,largestShiftValue:a.value,largestShiftSource:c,largestShiftEntry:a,loadState:Ua(a.startTime)})}}return Object.assign(s,{attribution:o})})(i))},t)},VB=(e,t={})=>{Jv(n=>{e((r=>{let i={timeToFirstByte:0,firstByteToFCP:r.value,loadState:Ua(Yv())};if(r.entries.length){const s=Hi(),o=r.entries.at(-1);if(s){const a=s.activationStart||0,c=Math.max(0,s.responseStart-a);i={timeToFirstByte:c,firstByteToFCP:r.value-c,loadState:Ua(r.entries[0].startTime),navigationEntry:s,fcpEntry:o}}}return Object.assign(r,{attribution:i})})(n))},t)};let Xv=0,_u=1/0,wo=0;const YB=e=>{for(const t of e)t.interactionId&&(_u=Math.min(_u,t.interactionId),wo=Math.max(wo,t.interactionId),Xv=wo?(wo-_u)/7+1:0)};let Tl;const Lm=()=>Tl?Xv:performance.interactionCount??0,KB=()=>{"interactionCount"in performance||Tl||(Tl=Si("event",YB,{durationThreshold:0}))};let Dm=0;class Fm{l=[];h=new Map;m;p;v(){Dm=Lm(),this.l.length=0,this.h.clear()}M(){const t=Math.min(this.l.length-1,Math.floor((Lm()-Dm)/50));return this.l[t]}u(t){if(this.m?.(t),!t.interactionId&&t.entryType!=="first-input")return;const n=this.l.at(-1);let r=this.h.get(t.interactionId);if(r||this.l.length<10||t.duration>n.T){if(r?t.duration>r.T?(r.entries=[t],r.T=t.duration):t.duration===r.T&&t.startTime===r.entries[0].startTime&&r.entries.push(t):(r={id:t.interactionId,entries:[t],T:t.duration},this.h.set(r.id,r),this.l.push(r)),this.l.sort((i,s)=>s.T-i.T),this.l.length>10){const i=this.l.splice(10);for(const s of i)this.h.delete(s.id)}this.p?.(r)}}}const wl=e=>{const t=globalThis.requestIdleCallback||setTimeout,n=globalThis.cancelIdleCallback||clearTimeout;if(document.visibilityState==="hidden")e();else{const r=Ef(e);let i=-1;const s=()=>{n(i),r()};addEventListener("visibilitychange",s,{once:!0,capture:!0}),i=t(()=>{removeEventListener("visibilitychange",s,{capture:!0}),r()})}},$m=[200,500],JB=(e,t={})=>{const n=bi(t=Object.assign({},t),Fm);let r=[],i=[],s=0;const o=new WeakMap,a=new WeakMap;let c=!1;const u=()=>{c||(wl(d),c=!0)},d=()=>{const f=new Set(n.l.map(g=>o.get(g.entries[0]))),h=i.length-10;i=i.filter((g,_)=>_>=h||f.has(g));const m=new Set;for(const g of i){const _=l(g.startTime,g.processingEnd);for(const S of _)m.add(S)}r=r.filter(g=>g.startTime>s||m.has(g)),c=!1};n.m=f=>{const h=f.startTime+f.duration;let m;s=Math.max(s,f.processingEnd);for(let g=i.length-1;g>=0;g--){const _=i[g];if(Math.abs(h-_.renderTime)<=8){m=_,m.startTime=Math.min(f.startTime,m.startTime),m.processingStart=Math.min(f.processingStart,m.processingStart),m.processingEnd=Math.max(f.processingEnd,m.processingEnd),t.includeProcessedEventEntries!==!1&&m.entries.push(f);break}}m||(m={startTime:f.startTime,processingStart:f.processingStart,processingEnd:f.processingEnd,renderTime:h,entries:t.includeProcessedEventEntries!==!1?[f]:[]},i.push(m)),(f.interactionId||f.entryType==="first-input")&&o.set(f,m),u()},n.p=f=>{if(!a.get(f)){const h=f.entries[0].target;if(h){const m=t.generateTarget?.(h)??Sf(h);a.set(f,m)}}};const l=(f,h)=>{const m=[];for(const g of r)if(!(g.startTime+g.durationh)break;m.push(g)}return m},p=f=>{const h=f.entries[0],m=o.get(h),g=h.processingStart,_=Math.max(h.startTime+h.duration,g),S=Math.min(m.processingEnd,_),E=m.entries.sort((b,I)=>b.processingStart-I.processingStart),v=l(h.startTime,S),w=n.h.get(h.interactionId),T={interactionTarget:a.get(w),interactionType:h.name.startsWith("key")?"keyboard":"pointer",interactionTime:h.startTime,nextPaintTime:_,processedEventEntries:E,longAnimationFrameEntries:v,inputDelay:g-h.startTime,processingDuration:S-g,presentationDelay:_-S,loadState:Ua(h.startTime),longestScript:void 0,totalScriptDuration:void 0,totalStyleAndLayoutDuration:void 0,totalPaintDuration:void 0,totalUnattributedDuration:void 0};return(b=>{if(!b.longAnimationFrameEntries?.length)return;const I=b.interactionTime,M=b.inputDelay,k=b.processingDuration;let D,x,L=0,F=0,Z=0,Y=0;for(const j of b.longAnimationFrameEntries){F=F+j.startTime+j.duration-j.styleAndLayoutStart;for(const P of j.scripts){const U=P.startTime+P.duration;if(UY&&(x=P.startTime=I+M+k?"presentation-delay":"processing-duration",D=P,Y=re)}}const ne=b.longAnimationFrameEntries.at(-1),R=ne?ne.startTime+ne.duration:0;R>=I+M+k&&(Z=b.nextPaintTime-R),D&&x&&(b.longestScript={entry:D,subpart:x,intersectingDuration:Y}),b.totalScriptDuration=L,b.totalStyleAndLayoutDuration=F,b.totalPaintDuration=Z,b.totalUnattributedDuration=b.nextPaintTime-I-L-F-Z})(T),Object.assign(f,{attribution:T})};Si("long-animation-frame",f=>{r=r.concat(f),u()}),((f,h={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;const m=Oc();Mc(()=>{KB();let g,_=rn("INP");const S=bi(h,Fm),E=w=>{wl(()=>{for(const b of w)S.u(b);const T=S.M();T&&T.T!==_.value&&(_.value=T.T,_.entries=T.entries,g())})},v=Si("event",E,{durationThreshold:h.durationThreshold??40});g=nn(f,_,$m,h.reportAllChanges),v&&(v.observe({type:"first-input",buffered:!0}),m.onHidden(()=>{E(v.takeRecords()),g(!0)}),ji(()=>{S.v(),_=rn("INP"),g=nn(f,_,$m,h.reportAllChanges)}))})})(f=>{e(p(f))},t)};class Um{m;u(t){this.m?.(t)}}const Bm=[2500,4e3],XB=(e,t={})=>{const n=bi(t=Object.assign({},t),Um),r=new WeakMap;n.m=i=>{const s=i.element;if(s){const o=t.generateTarget?.(s)??Sf(s);r.set(i,o)}else i.id&&r.set(i,`#${i.id}`)},((i,s={})=>{Mc(()=>{const o=Oc();let a,c=rn("LCP");const u=bi(s,Um),d=p=>{s.reportAllChanges||(p=p.slice(-1));for(const f of p)u.u(f),f.startTime{d(l.takeRecords()),l.disconnect(),a(!0)}),f=h=>{h.isTrusted&&(wl(p),removeEventListener(h.type,f,{capture:!0}))};for(const h of["keydown","click","visibilitychange"])addEventListener(h,f,{capture:!0});ji(h=>{c=rn("LCP"),a=nn(i,c,Bm,s.reportAllChanges),vf(()=>{c.value=performance.now()-h.timeStamp,a(!0)})})}})})(i=>{e((s=>{let o={timeToFirstByte:0,resourceLoadDelay:0,resourceLoadDuration:0,elementRenderDelay:s.value};if(s.entries.length){const a=s.entries.at(-1),c=a.url&&performance.getEntriesByType("resource").find(d=>d.name===a.url);o.target=r.get(a),o.lcpEntry=a,a.url&&(o.url=a.url),c&&(o.lcpResourceEntry=c);const u=Hi();if(u){const d=u.activationStart||0,l=Math.max(0,u.responseStart-d),p=Math.max(l,c?(c.requestStart||c.startTime)-d:0),f=Math.min(s.value,Math.max(p,c?c.responseEnd-d:0));o={...o,timeToFirstByte:l,resourceLoadDelay:p-l,resourceLoadDuration:f-p,elementRenderDelay:s.value-f,navigationEntry:u}}}return Object.assign(s,{attribution:o})})(i))},t)},Hm=[800,1800],Il=e=>{document.prerendering?Mc(()=>Il(e)):document.readyState!=="complete"?addEventListener("load",()=>Il(e),!0):setTimeout(e)},QB=(e,t={})=>{((n,r={})=>{let i=rn("TTFB"),s=nn(n,i,Hm,r.reportAllChanges);Il(()=>{const o=Hi();o&&(i.value=Math.max(o.responseStart-no(),0),i.entries=[o],s(!0),ji(()=>{i=rn("TTFB",0),s=nn(n,i,Hm,r.reportAllChanges),s(!0)}))})})(n=>{e((r=>{let i={waitingDuration:0,cacheDuration:0,dnsDuration:0,connectionDuration:0,requestDuration:0};if(r.entries.length){const s=r.entries[0],o=s.activationStart||0,a=Math.max((s.workerStart||s.fetchStart)-o,0),c=Math.max(s.domainLookupStart-o,0),u=Math.max(s.connectStart-o,0),d=Math.max(s.connectEnd-o,0);i={waitingDuration:a,cacheDuration:c-a,dnsDuration:u-c,connectionDuration:d-u,requestDuration:r.value-d,navigationEntry:s}}return Object.assign(r,{attribution:i})})(n))},t)},kl="com.grafana.faro.lastNavigationId",yu="load_state",jm="time_to_first_byte";class ZB{constructor(t,n){this.corePushMeasurement=t,this.webVitalConfig=n}initialize(){this.measureCLS(),this.measureFCP(),this.measureINP(),this.measureLCP(),this.measureTTFB()}measureCLS(){var t;GB(n=>{const{loadState:r,largestShiftValue:i,largestShiftTime:s,largestShiftTarget:o}=n.attribution,a=this.buildInitialValues(n);this.addIfPresent(a,"largest_shift_value",i),this.addIfPresent(a,"largest_shift_time",s);const c=this.buildInitialContext(n);this.addIfPresent(c,yu,r),this.addIfPresent(c,"largest_shift_target",o),this.pushMeasurement(a,c)},{reportAllChanges:(t=this.webVitalConfig)===null||t===void 0?void 0:t.reportAllChanges})}measureFCP(){var t;VB(n=>{const{firstByteToFCP:r,timeToFirstByte:i,loadState:s}=n.attribution,o=this.buildInitialValues(n);this.addIfPresent(o,"first_byte_to_fcp",r),this.addIfPresent(o,jm,i);const a=this.buildInitialContext(n);this.addIfPresent(a,yu,s),this.pushMeasurement(o,a)},{reportAllChanges:(t=this.webVitalConfig)===null||t===void 0?void 0:t.reportAllChanges})}measureINP(){var t;JB(n=>{const{interactionTime:r,presentationDelay:i,inputDelay:s,processingDuration:o,nextPaintTime:a,loadState:c,interactionTarget:u,interactionType:d}=n.attribution,l=this.buildInitialValues(n);this.addIfPresent(l,"interaction_time",r),this.addIfPresent(l,"presentation_delay",i),this.addIfPresent(l,"input_delay",s),this.addIfPresent(l,"processing_duration",o),this.addIfPresent(l,"next_paint_time",a);const p=this.buildInitialContext(n);this.addIfPresent(p,yu,c),this.addIfPresent(p,"interaction_target",u),this.addIfPresent(p,"interaction_type",d),this.pushMeasurement(l,p)},{reportAllChanges:(t=this.webVitalConfig)===null||t===void 0?void 0:t.reportAllChanges})}measureLCP(){var t;XB(n=>{const{elementRenderDelay:r,resourceLoadDelay:i,resourceLoadDuration:s,timeToFirstByte:o,target:a}=n.attribution,c=this.buildInitialValues(n);this.addIfPresent(c,"element_render_delay",r),this.addIfPresent(c,"resource_load_delay",i),this.addIfPresent(c,"resource_load_duration",s),this.addIfPresent(c,jm,o);const u=this.buildInitialContext(n);this.addIfPresent(u,"element",a),this.pushMeasurement(c,u)},{reportAllChanges:(t=this.webVitalConfig)===null||t===void 0?void 0:t.reportAllChanges})}measureTTFB(){var t;QB(n=>{const{dnsDuration:r,connectionDuration:i,requestDuration:s,waitingDuration:o,cacheDuration:a}=n.attribution,c=this.buildInitialValues(n);this.addIfPresent(c,"dns_duration",r),this.addIfPresent(c,"connection_duration",i),this.addIfPresent(c,"request_duration",s),this.addIfPresent(c,"waiting_duration",o),this.addIfPresent(c,"cache_duration",a);const u=this.buildInitialContext(n);this.pushMeasurement(c,u)},{reportAllChanges:(t=this.webVitalConfig)===null||t===void 0?void 0:t.reportAllChanges})}buildInitialValues(t){return{[t.name.toLowerCase()]:t.value,delta:t.delta}}buildInitialContext(t){var n;const r=(n=Cc(kl,Rn.session))!==null&&n!==void 0?n:rt;return{id:t.id,rating:t.rating,navigation_type:t.navigationType,navigation_entry_id:r}}pushMeasurement(t,n){this.corePushMeasurement({type:"web-vitals",values:t},{context:n})}addIfPresent(t,n,r){r&&(t[n]=r)}}class Qv extends an{constructor(){super(...arguments),this.name="@grafana/faro-web-sdk:instrumentation-web-vitals",this.version=ct}initialize(){this.logDebug("Initializing"),new ZB(this.api.pushMeasurement,this.config.webVitalsInstrumentation).initialize()}}const e3="navigation",Rl="resource",t3=/^00-[a-f0-9]{32}-[a-f0-9]{16}-[0-9]{1,2}$/;function Zv(e=[]){for(const t of e)if(t.name==="traceparent"){if(!t3.test(t.description))continue;const[,n,r]=t.description.split("-");if(n!=null&&r!=null)return{traceId:n,spanId:r};break}}function n3(){return"PerformanceObserver"in window}function r3(e){if(document.readyState==="complete")e();else{const t=()=>{document.readyState==="complete"&&(e(),document.removeEventListener("readystatechange",t))};document.addEventListener("readystatechange",t)}}function i3(e,t={}){for(const[n,r]of Object.entries(t)){const i=e[n];return i==null?!1:_i(r)?r.includes(i):i===r}return!0}function eE(e){const{connectEnd:t,connectStart:n,decodedBodySize:r,domainLookupEnd:i,domainLookupStart:s,duration:o,encodedBodySize:a,fetchStart:c,initiatorType:u,name:d,nextHopProtocol:l,redirectEnd:p,redirectStart:f,renderBlockingStatus:h,requestStart:m,responseEnd:g,responseStart:_,responseStatus:S,secureConnectionStart:E,transferSize:v,workerStart:w}=e;return{name:d,httpHost:a3(d),duration:Ne(o),tcpHandshakeTime:Ne(t-n),dnsLookupTime:Ne(i-s),tlsNegotiationTime:Ne(t-E),responseStatus:Ne(S),redirectTime:Ne(p-f),requestTime:Ne(_-m),responseTime:Ne(g-_),fetchTime:Ne(g-c),serviceWorkerTime:Ne(c-w),decodedBodySize:Ne(r),encodedBodySize:Ne(a),cacheHitStatus:T(),renderBlockingStatus:Ne(h),protocol:l,initiatorType:u,visibilityState:document.visibilityState,ttfb:Ne(_-m),transferSize:Ne(v)};function T(){let b="fullLoad";return v===0?r>0&&(b="cache"):S!=null?S===304&&(b="conditionalFetch"):a>0&&v0?e:0).toString():e.toString()}function c3(e){let t;const n=new Promise(i=>{t=i});return new PerformanceObserver(i=>{var s;const[o]=i.getEntries();if(o==null||xc(o.name))return;const a=o.toJSON();let c=Zv(a?.serverTiming);const u=(s=Cc(kl,Rn.session))!==null&&s!==void 0?s:rt,d=Object.assign(Object.assign({},s3(a)),{faroNavigationId:sr(),faroPreviousNavigationId:u});ff(kl,d.faroNavigationId,Rn.session),e("faro.performance.navigation",d,void 0,{spanContext:c,timestampOverwriteMs:performance.timeOrigin+a.startTime}),t(d)}).observe({type:e3,buffered:!0}),n}const u3={initiatorType:["xmlhttprequest","fetch"]};function l3(e,t,n){const r=Re.config.trackResources;new PerformanceObserver(s=>{const o=s.getEntries();for(const a of o){if(xc(a.name))continue;n?.notify({type:Rl});const c=a.toJSON();let u=Zv(c?.serverTiming);if(r==null&&i3(c,u3)||r){const d=Object.assign(Object.assign({},eE(c)),{faroNavigationId:e,faroResourceId:sr()});t("faro.performance.resource",d,void 0,{spanContext:u,timestampOverwriteMs:performance.timeOrigin+c.startTime})}}}).observe({type:Rl,buffered:!0})}var d3=function(e,t,n,r){function i(s){return s instanceof n?s:new n(function(o){o(s)})}return new(n||(n=Promise))(function(s,o){function a(d){try{u(r.next(d))}catch(l){o(l)}}function c(d){try{u(r.throw(d))}catch(l){o(l)}}function u(d){d.done?s(d.value):i(d.value).then(a,c)}u((r=r.apply(e,t||[])).next())})};const tE=new We;class nE extends an{constructor(){super(...arguments),this.name="@grafana/faro-web-sdk:instrumentation-performance",this.version=ct}initialize(){if(!n3()){this.logDebug("performance observer not supported. Disable performance instrumentation.");return}r3(()=>d3(this,void 0,void 0,function*(){const t=this.api.pushEvent,{faroNavigationId:n}=yield c3(t);n!=null&&l3(n,t,tE)}))}}const f3="faroUserActionName",rE="data-faro-user-action-name";let Io,bu;function iE(){return Io||(Io=new We),bu||(bu=new MutationObserver((e,t)=>{Io.notify({type:EB})}),bu.observe(document,{attributes:!0,childList:!0,subtree:!0,characterData:!0})),Io}const Su="fetch",ko="xhr";let Hr,Wm=!1,vu,Eu;function sE(){if(Hr)return Hr;Hr=new We;function e(n){Hr.notify({type:_f,request:n})}function t(n){Hr.notify({type:yf,request:n})}return Wm||(h3({onRequestStart:e,onRequestEnd:t}),p3({onRequestStart:e,onRequestEnd:t}),Wm=!0),Hr}function p3({onRequestStart:e,onRequestEnd:t}){vu||(vu=XMLHttpRequest.prototype.open),XMLHttpRequest.prototype.open=function(){const n=arguments[1],r=xc(n),i=arguments[0],s=sr();this.addEventListener("loadstart",function(){r||e({url:n,method:i,requestId:s,apiType:ko})}),this.addEventListener("load",function(){r||t({url:n,method:i,requestId:s,apiType:ko})}),this.addEventListener("error",function(){r||t({url:n,method:i,requestId:s,apiType:ko})}),this.addEventListener("abort",function(){r||t({url:n,method:i,requestId:s,apiType:ko})}),vu.apply(this,arguments)}}function h3({onRequestEnd:e,onRequestStart:t}){Eu||(Eu=window.fetch),window.fetch=function(){var n,r;const i=(n=Mv(arguments[0]))!==null&&n!==void 0?n:"",s=xc(i),o=((r=arguments[1])!==null&&r!==void 0?r:{}).method,a=sr();return s||t({url:i,method:o,requestId:a,apiType:Su}),Eu.apply(this,arguments).then(c=>(s||e({url:i,method:o,requestId:a,apiType:Su}),c)).catch(c=>{throw s||e({url:i,method:o,requestId:a,apiType:Su}),c})}}let Ro,zm=!1;function m3(){return Ro||(Ro=new We),zm||(tE.subscribe(e=>{e.type===Rl&&Ro.notify({type:vB})}),zm=!0),Ro}function g3(e){const t=e.split("data-")[1],n=t?.replace(/-(.)/g,(r,i)=>i.toUpperCase());return n?.replace(/-/g,"")}function _3(e,t,n){return e&&clearTimeout(e),e=setTimeout(()=>{t()},n),e}function y3(e){return e.type===_f}function Tu(e){return e.type===yf}const b3=100,S3=10*1e3;class v3{constructor(t){this.userAction=t,this.http=sE(),this.dom=iE(),this.perf=m3(),this.isValid=!1,this.runningRequests=new Map}attach(){this.allMonitorsSub=new We().merge(this.http,this.dom,this.perf).takeWhile(()=>[we.Started,we.Halted].includes(this.userAction.getState())).filter(t=>!(this.userAction.getState()===we.Halted&&!(Tu(t)&&this.runningRequests.has(t.request.requestId)))).subscribe(t=>{y3(t)&&this.runningRequests.set(t.request.requestId,t.request),Tu(t)&&this.runningRequests.delete(t.request.requestId),Tu(t)?this.userAction.getState()===we.Halted&&this.runningRequests.size===0&&this.endAction():(this.isValid||(this.isValid=!0),this.scheduleFollowUp())}),this.stateSub=this.userAction.filter(t=>[we.Ended,we.Cancelled].includes(t)).first().subscribe(()=>this.cleanup()),this.scheduleFollowUp()}scheduleFollowUp(){this.clearTimer(this.followUpTid),this.followUpTid=setTimeout(()=>{if(this.userAction.getState()===we.Started&&this.runningRequests.size>0){this.haltAction();return}if(this.isValid){this.endAction();return}this.cancelAction()},b3)}haltAction(){this.userAction.getState()===we.Started&&(this.userAction.halt(),this.startHaltTimeout())}startHaltTimeout(){this.clearTimer(this.haltTid),this.haltTid=_3(this.haltTid,()=>{this.userAction.getState()===we.Halted&&this.endAction()},S3)}endAction(){this.userAction.end(),this.cleanup()}cancelAction(){this.userAction.cancel(),this.cleanup()}cleanup(){var t,n;this.clearTimer(this.followUpTid),this.clearTimer(this.haltTid),(t=this.allMonitorsSub)===null||t===void 0||t.unsubscribe(),(n=this.stateSub)===null||n===void 0||n.unsubscribe(),this.allMonitorsSub=void 0,this.stateSub=void 0,this.runningRequests.clear()}clearTimer(t){t&&clearTimeout(t)}}function E3(e){const{api:t,config:n}=e;function r(s){var o,a;const c=T3(s.target,(a=(o=n.userActionsInstrumentation)===null||o===void 0?void 0:o.dataAttributeName)!==null&&a!==void 0?a:f3);if(!c)return;const u=t.startUserAction(c,{},{triggerName:s.type});u&&i(u)}function i(s){const o=s;new v3(o).attach()}return{processUserEvent:r,processUserActionStarted:i}}function T3(e,t){const n=g3(t),r=e.dataset;for(const i in r)if(i===n)return r[i]}class oE extends an{constructor(){super(...arguments),this.name="@grafana/faro-web-sdk:instrumentation-user-action",this.version=ct}initialize(){const{processUserEvent:t,processUserActionStarted:n}=E3(Re);window.addEventListener("pointerdown",t),window.addEventListener("keydown",r=>{[" ","Enter"].includes(r.key)&&t(r)}),this._userActionSub=mv.subscribe(({type:r,userAction:i})=>{r==="user_action_start"&&n(i)})}destroy(){var t;(t=this._userActionSub)===null||t===void 0||t.unsubscribe()}}class aE extends an{constructor(){super(),this.name="@grafana/faro-web-sdk:instrumentation-csp",this.version=ct}initialize(){document.addEventListener("securitypolicyviolation",this.securitypolicyviolationHandler.bind(this))}destroy(){document.removeEventListener("securitypolicyviolation",this.securitypolicyviolationHandler)}securitypolicyviolationHandler(t){const n={blockedURI:t.blockedURI,columnNumber:t.columnNumber,disposition:t.disposition,documentURI:t.documentURI,effectiveDirective:t.effectiveDirective,lineNumber:t.lineNumber,originalPolicy:t.originalPolicy,referrer:t.referrer,sample:t.sample,sourceFile:t.sourceFile,statusCode:t.statusCode,violatedDirective:t.violatedDirective};this.api.pushEvent("securitypolicyviolation",Bi(n))}}function w3(e){return e.type===_f}function I3(e){return e.type===yf}class k3 extends We{constructor(t,n){var r,i,s,o;super(),this._tracking=!1,this.eventsObservable=t,this._options={inactivityMs:(r=n?.inactivityMs)!==null&&r!==void 0?r:100,drainTimeoutMs:(i=n?.drainTimeoutMs)!==null&&i!==void 0?i:10*1e3,isOperationStart:(s=n?.isOperationStart)!==null&&s!==void 0?s:(()=>{}),isOperationEnd:(o=n?.isOperationEnd)!==null&&o!==void 0?o:(()=>{})},this._initialize()}_initialize(){this.eventsObservable.filter(()=>this._tracking).subscribe(t=>{var n,r,i;this._lastEventTime=os(),(n=this._currentEvents)===null||n===void 0||n.push(t);const s=this._options.isOperationStart(t);s&&((r=this._activeOperations)===null||r===void 0||r.set(s,!0));const o=this._options.isOperationEnd(t);o&&((i=this._activeOperations)===null||i===void 0||i.delete(o)),this._scheduleInactivityCheck()})}startTracking(){this._tracking||(this._tracking=!0,this._startTime=os(),this._lastEventTime=this._startTime,this.notify({message:"tracking-started"}),this._currentEvents=[],this._activeOperations=new Map,this._scheduleInactivityCheck())}stopTracking(){this._tracking=!1,this._clearTimer(this._inactivityTid),this._clearTimer(this._drainTid);let t;this.hasActiveOperations()?t=os()-this._startTime:t=this._lastEventTime?this._lastEventTime-this._startTime:0,this.notify({message:"tracking-ended",events:this._currentEvents,duration:t})}_scheduleInactivityCheck(){this._inactivityTid=qm(this._inactivityTid,()=>{this.hasActiveOperations()?this._startDrainTimeout():this.stopTracking()},this._options.inactivityMs)}_startDrainTimeout(){this._drainTid=qm(this._drainTid,()=>{this.stopTracking()},this._options.drainTimeoutMs)}hasActiveOperations(){return!!this._activeOperations&&this._activeOperations.size>0}_clearTimer(t){t&&clearTimeout(t)}}function qm(e,t,n){return e&&clearTimeout(e),e=setTimeout(()=>{t()},n),e}const R3="interaction";let Ao;const Gm=new Set,A3=new Map;function C3(e){return Ao||(Ao=new We),e.forEach(t=>{if(!Gm.has(t)){const n=()=>{Ao.notify({type:R3,name:t})};window.addEventListener(t,n),Gm.add(t),A3.set(t,n)}}),Ao}const x3="url-change";let Co,wu=!1,xo,Iu,ku,Vm,Ym,Km,Ru;function O3(){Co||(Co=new We,xo=location.href);function e(t,n){const r=n??location.href;r!==xo&&(Co.notify({type:x3,from:xo,to:r,trigger:t}),xo=r)}if(!wu)if("navigation"in window&&"NavigateEvent"in window){Km=r=>{try{const i=r?.destination;i?.sameDocument&&typeof i.url=="string"&&e("navigate",i.url)}catch{}},window.navigation.addEventListener("navigate",Km);const n=window.NavigateEvent;n&&n.prototype&&typeof n.prototype.intercept=="function"&&(Ru||(Ru=n.prototype.intercept),n.prototype.intercept=function(r){try{const i=!!(!(this===null||this===void 0)&&this.canIntercept),s=this===null||this===void 0?void 0:this.destination;i&&s&&s.sameDocument===!1&&typeof s.url=="string"&&e("navigate-intercept",s.url)}catch{}return Ru.call(this,r)}),wu=!0}else Iu||(Iu=window.history.pushState),window.history.pushState=function(...n){const r=Iu.apply(window.history,n);return e("pushState"),r},ku||(ku=window.history.replaceState),window.history.replaceState=function(...n){const r=ku.apply(window.history,n);return e("replaceState"),r},Vm=()=>e("popstate"),Ym=()=>e("hashchange"),window.addEventListener("popstate",Vm),window.addEventListener("hashchange",Ym),wu=!0;return Co}class cE extends an{constructor(){super(...arguments),this.name="@grafana/faro-web-sdk:instrumentation-navigation",this.version=ct}initialize(){const t=sE(),n=iE(),r=O3(),i=C3(["pointerdown","keydown"]),s=new k3(new We().merge(t,n,r),{inactivityMs:100,drainTimeoutMs:10*1e3,isOperationStart:o=>w3(o)?o.request.requestId:void 0,isOperationEnd:o=>I3(o)?o.request.requestId:void 0});s.filter(o=>o.message==="tracking-ended").subscribe(o=>{var a,c,u;if(!((a=o.events)===null||a===void 0)&&a.some(d=>d.type==="url-change")&&(!((c=o.events)===null||c===void 0)&&c.some(d=>d.type==="dom-mutation"))){const d=(u=o.events)===null||u===void 0?void 0:u.find(l=>l.type==="url-change");Re.api.pushEvent("faro.navigation",{fromUrl:d?.from,toUrl:d?.to,sameDocument:String(!0),duration:o.duration})}}),i.subscribe(()=>{s.startTracking()})}}function uE(e={}){const t=[new oE,new qv,new Qv,new Bv,new Gv,new cE];return e.enablePerformanceInstrumentation!==!1&&t.unshift(new nE),e.enableContentSecurityPolicyInstrumentation!==!1&&t.push(new aE),e.captureConsole!==!1&&t.push(new mn),t}const lE="browser",M3=()=>{const e=window.k6;return{k6:Object.assign({isK6Browser:!0},e?.testRunId&&{testRunId:e?.testRunId})}};let Jm,Au;function N3({generatePageId:e,initialPageMeta:t}={}){return()=>{const r=location.href;return Pr(e)&&Jm!==r&&(Jm=r,Au=e(location)),{page:Object.assign(Object.assign({url:r},Au?{id:Au}:{}),t)}}}class P3 extends uf{constructor(t={}){super(),this.options=t,this.name="@grafana/faro-web-sdk:transport-console",this.version=ct}send(t){var n;return this.unpatchedConsole[(n=this.options.level)!==null&&n!==void 0?n:Je.DEBUG]("New event",lf([t]))}}var Cu=function(e,t,n,r){function i(s){return s instanceof n?s:new n(function(o){o(s)})}return new(n||(n=Promise))(function(s,o){function a(d){try{u(r.next(d))}catch(l){o(l)}}function c(d){try{u(r.throw(d))}catch(l){o(l)}}function u(d){d.done?s(d.value):i(d.value).then(a,c)}u((r=r.apply(e,t||[])).next())})},L3=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);iDate.now()),this.promiseBuffer=pv({size:(i=t.bufferSize)!==null&&i!==void 0?i:D3,concurrency:(s=t.concurrency)!==null&&s!==void 0?s:F3})}send(t){return Cu(this,void 0,void 0,function*(){try{if(this.disabledUntil>new Date(this.getNow()))return this.logWarn(`Dropping transport item due to too many requests. Backoff until ${this.disabledUntil}`),Promise.resolve();yield this.promiseBuffer.add(()=>Cu(this,void 0,void 0,function*(){const n=JSON.stringify(lf(t)),{url:r,requestOptions:i,apiKey:s}=this.options,o=i??{},{headers:a={}}=o,c=L3(o,["headers"]);let u;const d=this.metas.value.session;d!=null&&(u=d.id);const l={};for(const[p,f]of Object.entries(a))l[p]=typeof f=="function"?yield Promise.resolve(f()):f;return fetch(r,Object.assign({method:"POST",headers:Object.assign(Object.assign(Object.assign({"Content-Type":"application/json"},l),s?{"x-api-key":s}:{}),u?{"x-faro-session-id":u}:{}),body:n,keepalive:n.length<=U3},c??{})).then(p=>Cu(this,void 0,void 0,function*(){return p.status===H3&&p.headers.get("X-Faro-Session-Status")==="invalid"&&this.extendFaroSession(this.config,this.logDebug),p.status===B3&&(this.disabledUntil=this.getRetryAfterDate(p),this.logWarn(`Too many requests, backing off until ${this.disabledUntil}`)),p.text().catch(Kt),p})).catch(p=>{this.logError(`Failed sending payload to the receiver `,JSON.parse(n),p)})}))}catch(n){this.logError(n)}})}getIgnoreUrls(){var t;return[this.options.url].concat((t=this.config.ignoreUrls)!==null&&t!==void 0?t:[])}isBatched(){return!0}getRetryAfterDate(t){const n=this.getNow(),r=t.headers.get("Retry-After");if(r){const i=Number(r);if(!isNaN(i))return new Date(i*1e3+n);const s=Date.parse(r);if(!isNaN(s))return new Date(s)}return new Date(n+this.rateLimitBackoffMs)}extendFaroSession(t,n){const r="Session expired",i=t.sessionTracking;if(i?.enabled){const{fetchUserSession:s,storeUserSession:o}=Uv(i);gf({fetchUserSession:s,storeUserSession:o})({forceSessionExtend:!0}),n(`${r} created new session.`)}else n(`${r}.`)}}var j3=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i!(i.name==="@grafana/faro-web-sdk:instrumentation-navigation"&&!r))}function z3(e){var t,n;const{page:r,generatePageId:i}=(t=e?.pageTracking)!==null&&t!==void 0?t:{},s=[Ev,Tv,N3({generatePageId:i,initialPageMeta:r}),...(n=e.metas)!==null&&n!==void 0?n:[],Iv];return xt(window?.k6)?[...s,M3]:s}function q3({trackGeolocation:e,sessionTracking:t}){var n;const r={};return tv(e)&&(r.geoLocationTrackingEnabled=e),On(r)?{}:{session:Object.assign(Object.assign({},(n=t?.session)!==null&&n!==void 0?n:{}),{overrides:r})}}function G3(e){const t=fE(e);if(t)return uB(t)}const J3=Object.freeze(Object.defineProperty({__proto__:null,BaseExtension:cf,BaseInstrumentation:an,BaseTransport:uf,CSPInstrumentation:aE,ConsoleInstrumentation:mn,ConsoleTransport:P3,EVENT_CLICK:dB,EVENT_NAVIGATION:fB,EVENT_ROUTE_CHANGE:hB,EVENT_SESSION_EXTEND:Sv,EVENT_SESSION_RESUME:Xo,EVENT_SESSION_START:Ji,EVENT_VIEW_CHANGED:bv,ErrorsInstrumentation:qv,FetchTransport:dE,get InternalLoggerLevel(){return fn},get LogLevel(){return Je},MAX_SESSION_PERSISTENCE_TIME:Lv,NavigationInstrumentation:cE,Observable:We,PerformanceInstrumentation:nE,PersistentSessionsManager:St,SESSION_EXPIRATION_TIME:Nv,SESSION_INACTIVITY_TIME:hf,STORAGE_KEY:Sr,SessionInstrumentation:Bv,get TransportItemType(){return Le},UserActionInstrumentation:oE,get UserActionState(){return we},VERSION:ct,ViewInstrumentation:Gv,VolatileSessionsManager:Nt,WebVitalsInstrumentation:Qv,allLogLevels:fv,browserMeta:Ev,buildStackFrame:bf,createInternalLogger:af,createPromiseBuffer:pv,createSession:wv,deepEqual:kn,defaultEventDomain:lE,defaultExceptionType:df,defaultGlobalObjectKey:yv,defaultInternalLoggerLevel:of,defaultLogLevel:dv,get faro(){return Re},genShortID:sr,getCurrentTimestamp:Zs,getDataFromSafariExtensions:vl,getIgnoreUrls:Ov,getInternalFaroFromGlobalObject:aB,getStackFramesFromError:$a,getTransportBody:lf,getUrlFromResource:Mv,getWebInstrumentations:uE,globalObject:kt,initializeFaro:G3,internalGlobalObjectKey:Ac,isArray:_i,isBoolean:tv,isDomError:av,isDomException:cv,isElement:RU,isElementDefined:uv,isEmpty:On,isError:Ic,isErrorDefined:sv,isErrorEvent:ov,isEvent:iv,isEventDefined:rv,isFunction:Pr,isInstanceOf:Qs,isInt:TU,isInternalFaroOnGlobalObject:_v,isMap:AU,isMapDefined:lv,isNull:$i,isNumber:rf,isObject:xt,isPrimitive:nv,isRegExp:IU,isString:Ui,isSymbol:wU,isSyntheticEvent:CU,isThenable:kU,isToString:Fi,isTypeof:Ct,isUndefined:EU,makeCoreConfig:fE,noop:Kt,osMeta:Tv,parseStacktrace:jv,sdkMeta:Iv,setInternalFaroOnGlobalObject:gv,transportItemTypeToBodyKey:ev,unknownString:rt,userActionDataAttribute:rE},Symbol.toStringTag,{value:"Module"}));export{J3 as a,Pi as b,be as c,i$ as d,K3 as i,SD as r}; //# sourceMappingURL=vendor-observability-PbcLCb4f.js.map